Blame view

src/index.js 8.75 KB
3735e376   jingsam   sort components
1
  import Affix from './components/affix';
5d122b37   梁灏   support Alert
2
  import Alert from './components/alert';
43513f70   zhigang.li   add anchor component
3
4
  import Anchor from './components/anchor';
  import AnchorLink from './components/anchor-link';
fed3e09d   梁灏   add AutoComplete ...
5
  import AutoComplete from './components/auto-complete';
2c5faf30   梁灏   init Avatar compo...
6
  import Avatar from './components/avatar';
1d8f7767   mod   support BackTop t...
7
  import BackTop from './components/back-top';
15368be1   梁灏   Support Badge
8
  import Badge from './components/badge';
c06e99d0   huixisheng   Support Breadcrumb
9
  import Breadcrumb from './components/breadcrumb';
d47ea998   梁灏   support Button an...
10
  import Button from './components/button';
a8cb711c   huixisheng   Support Card
11
  import Card from './components/card';
e80b805f   chenhaodong   初始化
12
  import Calendar from './components/calendar';
bb71140e   梁灏   support Carousel
13
  import Carousel from './components/carousel';
47a7f21d   梁灏   support Cascader
14
  import Cascader from './components/cascader';
59a3b893   梁灏   add Cell componen...
15
  import Cell from './components/cell';
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';
5f12f09b   梁灏   update code format
22
  import Divider from './components/divider';
c4d780c0   梁灏   init Drawer compo...
23
  import Drawer from './components/drawer';
b1c118d8   梁灏   support Dropdown
24
  import Dropdown from './components/dropdown';
a2eb0287   zhigang.li   add layout compon...
25
  import Footer from './components/footer';
257f80f1   梁灏   support Form
26
  import Form from './components/form';
a2eb0287   zhigang.li   add layout compon...
27
  import Header from './components/header';
d47ea998   梁灏   support Button an...
28
  import Icon from './components/icon';
fc7ef072   梁灏   support Input
29
  import Input from './components/input';
c97c42ab   梁灏   support InputNumber
30
  import InputNumber from './components/input-number';
be01f0b4   Sergio Crisostomo   New component: Sc...
31
  import Scroll from './components/scroll';
8979c734   zhigang.li   add split components
32
  import Split from './components/split';
a2eb0287   zhigang.li   add layout compon...
33
  import Layout from './components/layout';
f97e5bb0   梁灏   support LoadingBar
34
  import LoadingBar from './components/loading-bar';
fd1582c5   梁灏   support Menu & La...
35
  import Menu from './components/menu';
6cadeba4   梁灏   support Message
36
  import Message from './components/message';
e80b805f   chenhaodong   初始化
37
38
  import MewMap from './components/mew-map';
  import MewMapSelector from './components/mew-map-selector';
b9851cf0   chenhaodong   mew-menu
39
  import MewMenu from './components/mew-menu';
6259471f   梁灏   support Modal
40
  import Modal from './components/modal';
833501a4   梁灏   support Notice
41
  import Notice from './components/notice';
87c51597   梁灏   support Page
42
  import Page from './components/page';
79288d43   梁灏   support Poptip & ...
43
  import Poptip from './components/poptip';
5d08ddf2   梁灏   support Progress ...
44
  import Progress from './components/progress';
06322514   梁灏   support Radio
45
  import Radio from './components/radio';
6aa72722   huixisheng   Support rate
46
  import Rate from './components/rate';
a2eb0287   zhigang.li   add layout compon...
47
  import Sider from './components/sider';
d6f644e1   梁灏   support Tooltip
48
  import Slider from './components/slider';
2d43f26b   梁灏   support Spin
49
  import Spin from './components/spin';
bd596e7a   huixisheng   support Steps
50
  import Steps from './components/steps';
2d5ba278   梁灏   support Switch
51
  import Switch from './components/switch';
486d4fda   梁灏   update Table
52
  import Table from './components/table';
30510c3d   梁灏   support Tabs
53
  import Tabs from './components/tabs';
456daf34   梁灏   support Tag
54
  import Tag from './components/tag';
7f9ea0dc   梁灏   init Time component
55
  import Time from './components/time';
6c9e0282   huixisheng   Support timeline
56
  import Timeline from './components/timeline';
531cd165   梁灏   support DatePicke...
57
  import TimePicker from './components/time-picker';
d6f644e1   梁灏   support Tooltip
58
  import Tooltip from './components/tooltip';
5b19b5f5   梁灏   support Transfer
59
  import Transfer from './components/transfer';
cb84e64a   梁灏   update Tree
60
  import Tree from './components/tree';
5d08ddf2   梁灏   support Progress ...
61
  import Upload from './components/upload';
be01f0b4   Sergio Crisostomo   New component: Sc...
62
63
  import {Row, Col} from './components/grid';
  import {Select, Option, OptionGroup} from './components/select';
b9c1fe77   Sergio Crisostomo   export locale obj...
64
  import locale from './locale/index';
7fa943eb   梁灏   init
65
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
66
  const components = {
3735e376   jingsam   sort components
67
      Affix,
5d122b37   梁灏   support Alert
68
      Alert,
43513f70   zhigang.li   add anchor component
69
70
      Anchor,
      AnchorLink,
fed3e09d   梁灏   add AutoComplete ...
71
      AutoComplete,
2c5faf30   梁灏   init Avatar compo...
72
      Avatar,
1d8f7767   mod   support BackTop t...
73
      BackTop,
15368be1   梁灏   Support Badge
74
      Badge,
c06e99d0   huixisheng   Support Breadcrumb
75
76
      Breadcrumb,
      BreadcrumbItem: Breadcrumb.Item,
d47ea998   梁灏   support Button an...
77
78
      Button,
      ButtonGroup: Button.Group,
e80b805f   chenhaodong   初始化
79
      Calendar,
a8cb711c   huixisheng   Support Card
80
      Card,
bb71140e   梁灏   support Carousel
81
82
      Carousel,
      CarouselItem: Carousel.Item,
47a7f21d   梁灏   support Cascader
83
      Cascader,
59a3b893   梁灏   add Cell componen...
84
85
      Cell,
      CellGroup: Cell.Group,
cbe03a12   梁灏   support Checkbox
86
87
      Checkbox,
      CheckboxGroup: Checkbox.Group,
5a9cda85   梁灏   update ColorPicker
88
      Col,
5a9cda85   梁灏   update ColorPicker
89
90
      Collapse,
      ColorPicker,
a2eb0287   zhigang.li   add layout compon...
91
      Content: Content,
531cd165   梁灏   support DatePicke...
92
      DatePicker,
5f12f09b   梁灏   update code format
93
      Divider,
c4d780c0   梁灏   init Drawer compo...
94
      Drawer,
b1c118d8   梁灏   support Dropdown
95
96
97
      Dropdown,
      DropdownItem: Dropdown.Item,
      DropdownMenu: Dropdown.Menu,
a2eb0287   zhigang.li   add layout compon...
98
      Footer: Footer,
bf9649f6   梁灏   add Form
99
      Form,
257f80f1   梁灏   support Form
100
      FormItem: Form.Item,
a2eb0287   zhigang.li   add layout compon...
101
      Header: Header,
d47ea998   梁灏   support Button an...
102
      Icon,
fc7ef072   梁灏   support Input
103
      Input,
c97c42ab   梁灏   support InputNumber
104
      InputNumber,
be01f0b4   Sergio Crisostomo   New component: Sc...
105
      Scroll,
a2eb0287   zhigang.li   add layout compon...
106
      Sider: Sider,
8979c734   zhigang.li   add split components
107
      Split,
a2eb0287   zhigang.li   add layout compon...
108
109
      Submenu: Menu.Sub,
      Layout: Layout,
f97e5bb0   梁灏   support LoadingBar
110
      LoadingBar,
fd1582c5   梁灏   support Menu & La...
111
      Menu,
fd1582c5   梁灏   support Menu & La...
112
113
      MenuGroup: Menu.Group,
      MenuItem: Menu.Item,
6cadeba4   梁灏   support Message
114
      Message,
e80b805f   chenhaodong   初始化
115
116
      MewMap,
      MewMapSelector,
b9851cf0   chenhaodong   mew-menu
117
118
119
      MewMenu,
      MewMenuGroup: MewMenu.Group,
      MewMenuItem: MewMenu.Item,
d6fc746e   chenhaodong   fix
120
      MewSubmenu: MewMenu.Sub,
6259471f   梁灏   support Modal
121
      Modal,
833501a4   梁灏   support Notice
122
      Notice,
50168478   young   config(compontent...
123
      Option: Option,
4aec6a66   梁灏   support Select
124
      OptionGroup,
87c51597   梁灏   support Page
125
      Page,
a190ce84   梁灏   support Collapse
126
      Panel: Collapse.Panel,
79288d43   梁灏   support Poptip & ...
127
      Poptip,
5d08ddf2   梁灏   support Progress ...
128
      Progress,
06322514   梁灏   support Radio
129
130
      Radio,
      RadioGroup: Radio.Group,
6aa72722   huixisheng   Support rate
131
      Rate,
c755733a   梁灏   support Grid
132
      Row,
4a5d5cc9   梁灏   更新几个标签名称
133
      Select,
d6f644e1   梁灏   support Tooltip
134
      Slider,
2d43f26b   梁灏   support Spin
135
      Spin,
bd596e7a   huixisheng   support Steps
136
137
      Step: Steps.Step,
      Steps,
486d4fda   梁灏   update Table
138
      Table,
30510c3d   梁灏   support Tabs
139
140
      Tabs: Tabs,
      TabPane: Tabs.Pane,
456daf34   梁灏   support Tag
141
      Tag,
7f9ea0dc   梁灏   init Time component
142
      Time,
6c9e0282   huixisheng   Support timeline
143
144
      Timeline,
      TimelineItem: Timeline.Item,
531cd165   梁灏   support DatePicke...
145
      TimePicker,
d6f644e1   梁灏   support Tooltip
146
      Tooltip,
5b19b5f5   梁灏   support Transfer
147
      Transfer,
34ee7b4a   梁灏   support Tree & ad...
148
      Tree,
5f12f09b   梁灏   update code format
149
      Upload
7fa943eb   梁灏   init
150
  };
fb189f16   young   cancel the compon...
151
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
152
153
154
155
156
  const iview = {
      ...components,
      iButton: Button,
      iCircle: Circle,
      iCol: Col,
a2eb0287   zhigang.li   add layout compon...
157
      iContent: Content,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
158
      iForm: Form,
a2eb0287   zhigang.li   add layout compon...
159
160
      iFooter: Footer,
      iHeader: Header,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
161
162
163
164
165
166
      iInput: Input,
      iMenu: Menu,
      iOption: Option,
      iProgress: Progress,
      iSelect: Select,
      iSwitch: Switch,
7f9ea0dc   梁灏   init Time component
167
168
      iTable: Table,
      iTime: Time
0c0d2c73   Sergio Crisostomo   reorganize and DR...
169
170
  };
  
be01f0b4   Sergio Crisostomo   New component: Sc...
171
  const install = function(Vue, opts = {}) {
d64ad52d   梁灏   update index
172
      if (install.installed) return;
d33b5143   梁灏   support i18n
173
174
175
      locale.use(opts.locale);
      locale.i18n(opts.i18n);
  
be01f0b4   Sergio Crisostomo   New component: Sc...
176
      Object.keys(iview).forEach(key => {
fb189f16   young   cancel the compon...
177
          Vue.component(key, iview[key]);
451b52ce   梁灏   Global install iView
178
179
      });
  
517917a2   梁灏   add global settin...
180
181
      Vue.prototype.$IVIEW = {
          size: opts.size || '',
5fe59e3a   梁灏   select add global...
182
183
          transfer: 'transfer' in opts ? opts.transfer : '',
          select: {
2ef1b05f   梁灏   Cell add globl se...
184
185
186
187
188
189
190
191
              arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '',
              customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '',
              arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : ''
          },
          cell: {
              arrow: opts.cell ? opts.cell.arrow ? opts.cell.arrow : '' : '',
              customArrow: opts.cell ? opts.cell.customArrow ? opts.cell.customArrow : '' : '',
              arrowSize: opts.cell ? opts.cell.arrowSize ? opts.cell.arrowSize : '' : ''
d082f8cc   梁灏   menu add global s...
192
193
194
195
196
          },
          menu: {
              arrow: opts.menu ? opts.menu.arrow ? opts.menu.arrow : '' : '',
              customArrow: opts.menu ? opts.menu.customArrow ? opts.menu.customArrow : '' : '',
              arrowSize: opts.menu ? opts.menu.arrowSize ? opts.menu.arrowSize : '' : ''
37f4b7a8   梁灏   Tree add global s...
197
198
199
200
201
          },
          tree: {
              arrow: opts.tree ? opts.tree.arrow ? opts.tree.arrow : '' : '',
              customArrow: opts.tree ? opts.tree.customArrow ? opts.tree.customArrow : '' : '',
              arrowSize: opts.tree ? opts.tree.arrowSize ? opts.tree.arrowSize : '' : ''
47afd12e   梁灏   Cascader add gloa...
202
203
204
205
206
207
208
209
          },
          cascader: {
              arrow: opts.cascader ? opts.cascader.arrow ? opts.cascader.arrow : '' : '',
              customArrow: opts.cascader ? opts.cascader.customArrow ? opts.cascader.customArrow : '' : '',
              arrowSize: opts.cascader ? opts.cascader.arrowSize ? opts.cascader.arrowSize : '' : '',
              itemArrow: opts.cascader ? opts.cascader.itemArrow ? opts.cascader.itemArrow : '' : '',
              customItemArrow: opts.cascader ? opts.cascader.customItemArrow ? opts.cascader.customItemArrow : '' : '',
              itemArrowSize: opts.cascader ? opts.cascader.itemArrowSize ? opts.cascader.itemArrowSize : '' : ''
4beb8e75   梁灏   ColorPicker add g...
210
211
212
213
214
          },
          colorPicker: {
              arrow: opts.colorPicker ? opts.colorPicker.arrow ? opts.colorPicker.arrow : '' : '',
              customArrow: opts.colorPicker ? opts.colorPicker.customArrow ? opts.colorPicker.customArrow : '' : '',
              arrowSize: opts.colorPicker ? opts.colorPicker.arrowSize ? opts.colorPicker.arrowSize : '' : ''
154bb822   梁灏   DatePicker&TimePi...
215
216
217
218
219
220
221
222
223
224
          },
          datePicker: {
              icon: opts.datePicker ? opts.datePicker.icon ? opts.datePicker.icon : '' : '',
              customIcon: opts.datePicker ? opts.datePicker.customIcon ? opts.datePicker.customIcon : '' : '',
              iconSize: opts.datePicker ? opts.datePicker.iconSize ? opts.datePicker.iconSize : '' : ''
          },
          timePicker: {
              icon: opts.timePicker ? opts.timePicker.icon ? opts.timePicker.icon : '' : '',
              customIcon: opts.timePicker ? opts.timePicker.customIcon ? opts.timePicker.customIcon : '' : '',
              iconSize: opts.timePicker ? opts.timePicker.iconSize ? opts.timePicker.iconSize : '' : ''
383e96a8   梁灏   Tabs add global s...
225
226
227
228
229
          },
          tabs: {
              closeIcon: opts.tabs ? opts.tabs.closeIcon ? opts.tabs.closeIcon : '' : '',
              customCloseIcon: opts.tabs ? opts.tabs.customCloseIcon ? opts.tabs.customCloseIcon : '' : '',
              closeIconSize: opts.tabs ? opts.tabs.closeIconSize ? opts.tabs.closeIconSize : '' : ''
67d3aba1   梁灏   Modal add global ...
230
231
232
          },
          modal: {
              maskClosable: opts.modal ? 'maskClosable' in opts.modal ? opts.modal.maskClosable : '' : ''
5fe59e3a   梁灏   select add global...
233
          }
517917a2   梁灏   add global settin...
234
235
      };
  
f97e5bb0   梁灏   support LoadingBar
236
      Vue.prototype.$Loading = LoadingBar;
6cadeba4   梁灏   support Message
237
      Vue.prototype.$Message = Message;
6259471f   梁灏   support Modal
238
      Vue.prototype.$Modal = Modal;
833501a4   梁灏   support Notice
239
      Vue.prototype.$Notice = Notice;
297648f1   梁灏   fixed #1063
240
      Vue.prototype.$Spin = Spin;
451b52ce   梁灏   Global install iView
241
  };
343abe50   jingsam   add iview.install()
242
243
244
245
  
  // auto install
  if (typeof window !== 'undefined' && window.Vue) {
      install(window.Vue);
451b52ce   梁灏   Global install iView
246
  }
343abe50   jingsam   add iview.install()
247
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
248
  const API = {
d962c7fa   Sergio Crisostomo   use version from ...
249
      version: process.env.VERSION, // eslint-disable-line no-undef
c7e432f7   梁灏   update export & i18n
250
251
252
      locale: locale.use,
      i18n: locale.i18n,
      install,
c7e432f7   梁灏   update export & i18n
253
      Circle,
c7e432f7   梁灏   update export & i18n
254
      Switch,
0c0d2c73   Sergio Crisostomo   reorganize and DR...
255
      ...components
c7e432f7   梁灏   update export & i18n
256
257
  };
  
0c0d2c73   Sergio Crisostomo   reorganize and DR...
258
  API.lang = (code) => {
5fbe80fe   Sergio Crisostomo   use dist's locale
259
260
261
262
263
      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
  };
  
b6f12759   chenhaodong   调整index.js以支持依赖
264
  export default API;   // eslint-disable-line no-undef