Blame view

src/index.js 4.78 KB
c6f21c2f   jingsam   :bug: fix ie bug
1
  // es6 polyfill
58ff14d7   Sergio Crisostomo   Make date more IE...
2
  import 'core-js/fn/array/find';
b0893113   jingsam   :art: add eslint
3
  import 'core-js/fn/array/find-index';
c6f21c2f   jingsam   :bug: fix ie bug
4
  
3735e376   jingsam   sort components
5
  import Affix from './components/affix';
5d122b37   梁灏   support Alert
6
  import Alert from './components/alert';
fed3e09d   梁灏   add AutoComplete ...
7
  import AutoComplete from './components/auto-complete';
2c5faf30   梁灏   init Avatar compo...
8
  import Avatar from './components/avatar';
1d8f7767   mod   support BackTop t...
9
  import BackTop from './components/back-top';
15368be1   梁灏   Support Badge
10
  import Badge from './components/badge';
c06e99d0   huixisheng   Support Breadcrumb
11
  import Breadcrumb from './components/breadcrumb';
d47ea998   梁灏   support Button an...
12
  import Button from './components/button';
a8cb711c   huixisheng   Support Card
13
  import Card from './components/card';
bb71140e   梁灏   support Carousel
14
  import Carousel from './components/carousel';
47a7f21d   梁灏   support Cascader
15
  import Cascader from './components/cascader';
cbe03a12   梁灏   support Checkbox
16
  import Checkbox from './components/checkbox';
b2d29401   梁灏   support Circle
17
  import Circle from './components/circle';
a190ce84   梁灏   support Collapse
18
  import Collapse from './components/collapse';
5a9cda85   梁灏   update ColorPicker
19
  import ColorPicker from './components/color-picker';
a2eb0287   zhigang.li   add layout compon...
20
  import Content from './components/content';
531cd165   梁灏   support DatePicke...
21
  import DatePicker from './components/date-picker';
b1c118d8   梁灏   support Dropdown
22
  import Dropdown from './components/dropdown';
a2eb0287   zhigang.li   add layout compon...
23
  import Footer from './components/footer';
257f80f1   梁灏   support Form
24
  import Form from './components/form';
a2eb0287   zhigang.li   add layout compon...
25
  import Header from './components/header';
d47ea998   梁灏   support Button an...
26
  import Icon from './components/icon';
fc7ef072   梁灏   support Input
27
  import Input from './components/input';
c97c42ab   梁灏   support InputNumber
28
  import InputNumber from './components/input-number';
be01f0b4   Sergio Crisostomo   New component: Sc...
29
  import Scroll from './components/scroll';
a2eb0287   zhigang.li   add layout compon...
30
  import Layout from './components/layout';
f97e5bb0   梁灏   support LoadingBar
31
  import LoadingBar from './components/loading-bar';
fd1582c5   梁灏   support Menu & La...
32
  import Menu from './components/menu';
6cadeba4   梁灏   support Message
33
  import Message from './components/message';
6259471f   梁灏   support Modal
34
  import Modal from './components/modal';
833501a4   梁灏   support Notice
35
  import Notice from './components/notice';
87c51597   梁灏   support Page
36
  import Page from './components/page';
79288d43   梁灏   support Poptip & ...
37
  import Poptip from './components/poptip';
5d08ddf2   梁灏   support Progress ...
38
  import Progress from './components/progress';
06322514   梁灏   support Radio
39
  import Radio from './components/radio';
6aa72722   huixisheng   Support rate
40
  import Rate from './components/rate';
a2eb0287   zhigang.li   add layout compon...
41
  import Sider from './components/sider';
d6f644e1   梁灏   support Tooltip
42
  import Slider from './components/slider';
2d43f26b   梁灏   support Spin
43
  import Spin from './components/spin';
bd596e7a   huixisheng   support Steps
44
  import Steps from './components/steps';
2d5ba278   梁灏   support Switch
45
  import Switch from './components/switch';
486d4fda   梁灏   update Table
46
  import Table from './components/table';
30510c3d   梁灏   support Tabs
47
  import Tabs from './components/tabs';
456daf34   梁灏   support Tag
48
  import Tag from './components/tag';
6c9e0282   huixisheng   Support timeline
49
  import Timeline from './components/timeline';
531cd165   梁灏   support DatePicke...
50
  import TimePicker from './components/time-picker';
d6f644e1   梁灏   support Tooltip
51
  import Tooltip from './components/tooltip';
5b19b5f5   梁灏   support Transfer
52
  import Transfer from './components/transfer';
cb84e64a   梁灏   update Tree
53
  import Tree from './components/tree';
5d08ddf2   梁灏   support Progress ...
54
  import Upload from './components/upload';
be01f0b4   Sergio Crisostomo   New component: Sc...
55
56
  import {Row, Col} from './components/grid';
  import {Select, Option, OptionGroup} from './components/select';
b9c1fe77   Sergio Crisostomo   export locale obj...
57
  import locale from './locale/index';
7fa943eb   梁灏   init
58
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
59
  const components = {
3735e376   jingsam   sort components
60
      Affix,
5d122b37   梁灏   support Alert
61
      Alert,
fed3e09d   梁灏   add AutoComplete ...
62
      AutoComplete,
2c5faf30   梁灏   init Avatar compo...
63
      Avatar,
1d8f7767   mod   support BackTop t...
64
      BackTop,
15368be1   梁灏   Support Badge
65
      Badge,
c06e99d0   huixisheng   Support Breadcrumb
66
67
      Breadcrumb,
      BreadcrumbItem: Breadcrumb.Item,
d47ea998   梁灏   support Button an...
68
69
      Button,
      ButtonGroup: Button.Group,
a8cb711c   huixisheng   Support Card
70
      Card,
bb71140e   梁灏   support Carousel
71
72
      Carousel,
      CarouselItem: Carousel.Item,
47a7f21d   梁灏   support Cascader
73
      Cascader,
cbe03a12   梁灏   support Checkbox
74
75
      Checkbox,
      CheckboxGroup: Checkbox.Group,
5a9cda85   梁灏   update ColorPicker
76
      Col,
5a9cda85   梁灏   update ColorPicker
77
78
      Collapse,
      ColorPicker,
a2eb0287   zhigang.li   add layout compon...
79
      Content: Content,
531cd165   梁灏   support DatePicke...
80
      DatePicker,
b1c118d8   梁灏   support Dropdown
81
82
83
      Dropdown,
      DropdownItem: Dropdown.Item,
      DropdownMenu: Dropdown.Menu,
a2eb0287   zhigang.li   add layout compon...
84
      Footer: Footer,
bf9649f6   梁灏   add Form
85
      Form,
257f80f1   梁灏   support Form
86
      FormItem: Form.Item,
a2eb0287   zhigang.li   add layout compon...
87
      Header: Header,
d47ea998   梁灏   support Button an...
88
      Icon,
fc7ef072   梁灏   support Input
89
      Input,
c97c42ab   梁灏   support InputNumber
90
      InputNumber,
be01f0b4   Sergio Crisostomo   New component: Sc...
91
      Scroll,
a2eb0287   zhigang.li   add layout compon...
92
93
94
      Sider: Sider,
      Submenu: Menu.Sub,
      Layout: Layout,
f97e5bb0   梁灏   support LoadingBar
95
      LoadingBar,
fd1582c5   梁灏   support Menu & La...
96
      Menu,
fd1582c5   梁灏   support Menu & La...
97
98
      MenuGroup: Menu.Group,
      MenuItem: Menu.Item,
6cadeba4   梁灏   support Message
99
      Message,
6259471f   梁灏   support Modal
100
      Modal,
833501a4   梁灏   support Notice
101
      Notice,
50168478   young   config(compontent...
102
      Option: Option,
4aec6a66   梁灏   support Select
103
      OptionGroup,
87c51597   梁灏   support Page
104
      Page,
a190ce84   梁灏   support Collapse
105
      Panel: Collapse.Panel,
79288d43   梁灏   support Poptip & ...
106
      Poptip,
5d08ddf2   梁灏   support Progress ...
107
      Progress,
06322514   梁灏   support Radio
108
109
      Radio,
      RadioGroup: Radio.Group,
6aa72722   huixisheng   Support rate
110
      Rate,
c755733a   梁灏   support Grid
111
      Row,
4a5d5cc9   梁灏   更新几个标签名称
112
      Select,
d6f644e1   梁灏   support Tooltip
113
      Slider,
2d43f26b   梁灏   support Spin
114
      Spin,
bd596e7a   huixisheng   support Steps
115
116
      Step: Steps.Step,
      Steps,
486d4fda   梁灏   update Table
117
      Table,
30510c3d   梁灏   support Tabs
118
119
      Tabs: Tabs,
      TabPane: Tabs.Pane,
456daf34   梁灏   support Tag
120
      Tag,
6c9e0282   huixisheng   Support timeline
121
122
      Timeline,
      TimelineItem: Timeline.Item,
531cd165   梁灏   support DatePicke...
123
      TimePicker,
d6f644e1   梁灏   support Tooltip
124
      Tooltip,
5b19b5f5   梁灏   support Transfer
125
      Transfer,
34ee7b4a   梁灏   support Tree & ad...
126
      Tree,
5d08ddf2   梁灏   support Progress ...
127
      Upload
7fa943eb   梁灏   init
128
  };
fb189f16   young   cancel the compon...
129
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
130
131
132
133
134
  const iview = {
      ...components,
      iButton: Button,
      iCircle: Circle,
      iCol: Col,
a2eb0287   zhigang.li   add layout compon...
135
      iContent: Content,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
136
      iForm: Form,
a2eb0287   zhigang.li   add layout compon...
137
138
      iFooter: Footer,
      iHeader: Header,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
139
140
141
142
143
144
145
146
147
      iInput: Input,
      iMenu: Menu,
      iOption: Option,
      iProgress: Progress,
      iSelect: Select,
      iSwitch: Switch,
      iTable: Table
  };
  
be01f0b4   Sergio Crisostomo   New component: Sc...
148
  const install = function(Vue, opts = {}) {
d64ad52d   梁灏   update index
149
      if (install.installed) return;
d33b5143   梁灏   support i18n
150
151
152
      locale.use(opts.locale);
      locale.i18n(opts.i18n);
  
be01f0b4   Sergio Crisostomo   New component: Sc...
153
      Object.keys(iview).forEach(key => {
fb189f16   young   cancel the compon...
154
          Vue.component(key, iview[key]);
451b52ce   梁灏   Global install iView
155
156
      });
  
f97e5bb0   梁灏   support LoadingBar
157
      Vue.prototype.$Loading = LoadingBar;
6cadeba4   梁灏   support Message
158
      Vue.prototype.$Message = Message;
6259471f   梁灏   support Modal
159
      Vue.prototype.$Modal = Modal;
833501a4   梁灏   support Notice
160
      Vue.prototype.$Notice = Notice;
297648f1   梁灏   fixed #1063
161
      Vue.prototype.$Spin = Spin;
451b52ce   梁灏   Global install iView
162
  };
343abe50   jingsam   add iview.install()
163
164
165
166
  
  // auto install
  if (typeof window !== 'undefined' && window.Vue) {
      install(window.Vue);
451b52ce   梁灏   Global install iView
167
  }
343abe50   jingsam   add iview.install()
168
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
169
  const API = {
d962c7fa   Sergio Crisostomo   use version from ...
170
      version: process.env.VERSION, // eslint-disable-line no-undef
c7e432f7   梁灏   update export & i18n
171
172
173
      locale: locale.use,
      i18n: locale.i18n,
      install,
c7e432f7   梁灏   update export & i18n
174
      Circle,
c7e432f7   梁灏   update export & i18n
175
      Switch,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
176
      ...components
c7e432f7   梁灏   update export & i18n
177
178
  };
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
179
  API.lang = (code) => {
5fbe80fe   Sergio Crisostomo   use dist's locale
180
181
182
183
184
      const langObject = window['iview/locale'].default;
      if (code === langObject.i.locale) locale.use(langObject);
      else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console
  };
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
185
  module.exports.default = module.exports = API;   // eslint-disable-line no-undef