Commit b35557852a4383d57880609b4735c051bc7635b1
Committed by
GitHub
Merge pull request #2354 from SergioCrisostomo/dry-exports
reorganize and DRY components list
Showing
1 changed file
with
20 additions
and
79 deletions
Show diff stats
src/index.js
... | ... | @@ -51,7 +51,7 @@ import {Row, Col} from './components/grid'; |
51 | 51 | import {Select, Option, OptionGroup} from './components/select'; |
52 | 52 | import locale from './locale/index'; |
53 | 53 | |
54 | -const iview = { | |
54 | +const components = { | |
55 | 55 | Affix, |
56 | 56 | Alert, |
57 | 57 | AutoComplete, |
... | ... | @@ -60,7 +60,6 @@ const iview = { |
60 | 60 | Badge, |
61 | 61 | Breadcrumb, |
62 | 62 | BreadcrumbItem: Breadcrumb.Item, |
63 | - iButton: Button, | |
64 | 63 | Button, |
65 | 64 | ButtonGroup: Button.Group, |
66 | 65 | Card, |
... | ... | @@ -69,9 +68,7 @@ const iview = { |
69 | 68 | Cascader, |
70 | 69 | Checkbox, |
71 | 70 | CheckboxGroup: Checkbox.Group, |
72 | - iCircle: Circle, | |
73 | 71 | Col, |
74 | - iCol: Col, | |
75 | 72 | Collapse, |
76 | 73 | ColorPicker, |
77 | 74 | DatePicker, |
... | ... | @@ -79,16 +76,13 @@ const iview = { |
79 | 76 | DropdownItem: Dropdown.Item, |
80 | 77 | DropdownMenu: Dropdown.Menu, |
81 | 78 | Form, |
82 | - iForm: Form, | |
83 | 79 | FormItem: Form.Item, |
84 | 80 | Icon, |
85 | 81 | Input, |
86 | - iInput: Input, | |
87 | 82 | InputNumber, |
88 | 83 | Scroll, |
89 | 84 | LoadingBar, |
90 | 85 | Menu, |
91 | - iMenu: Menu, | |
92 | 86 | MenuGroup: Menu.Group, |
93 | 87 | MenuItem: Menu.Item, |
94 | 88 | Submenu: Menu.Sub, |
... | ... | @@ -96,26 +90,20 @@ const iview = { |
96 | 90 | Modal, |
97 | 91 | Notice, |
98 | 92 | Option: Option, |
99 | - iOption: Option, | |
100 | 93 | OptionGroup, |
101 | 94 | Page, |
102 | 95 | Panel: Collapse.Panel, |
103 | 96 | Poptip, |
104 | 97 | Progress, |
105 | - iProgress: Progress, | |
106 | 98 | Radio, |
107 | 99 | RadioGroup: Radio.Group, |
108 | 100 | Rate, |
109 | 101 | Row, |
110 | 102 | Select, |
111 | - iSelect: Select, | |
112 | 103 | Slider, |
113 | 104 | Spin, |
114 | 105 | Step: Steps.Step, |
115 | 106 | Steps, |
116 | - // Switch, | |
117 | - iSwitch: Switch, | |
118 | - iTable: Table, | |
119 | 107 | Table, |
120 | 108 | Tabs: Tabs, |
121 | 109 | TabPane: Tabs.Pane, |
... | ... | @@ -129,6 +117,21 @@ const iview = { |
129 | 117 | Upload |
130 | 118 | }; |
131 | 119 | |
120 | +const iview = { | |
121 | + ...components, | |
122 | + iButton: Button, | |
123 | + iCircle: Circle, | |
124 | + iCol: Col, | |
125 | + iForm: Form, | |
126 | + iInput: Input, | |
127 | + iMenu: Menu, | |
128 | + iOption: Option, | |
129 | + iProgress: Progress, | |
130 | + iSelect: Select, | |
131 | + iSwitch: Switch, | |
132 | + iTable: Table | |
133 | +}; | |
134 | + | |
132 | 135 | const install = function(Vue, opts = {}) { |
133 | 136 | locale.use(opts.locale); |
134 | 137 | locale.i18n(opts.i18n); |
... | ... | @@ -149,82 +152,20 @@ if (typeof window !== 'undefined' && window.Vue) { |
149 | 152 | install(window.Vue); |
150 | 153 | } |
151 | 154 | |
152 | -module.exports = { // eslint-disable-line no-undef | |
155 | +const API = { | |
153 | 156 | version: '2.6.0', |
154 | 157 | locale: locale.use, |
155 | 158 | i18n: locale.i18n, |
156 | 159 | install, |
157 | - Affix, | |
158 | - Alert, | |
159 | - AutoComplete, | |
160 | - Avatar, | |
161 | - BackTop, | |
162 | - Badge, | |
163 | - Breadcrumb, | |
164 | - BreadcrumbItem: Breadcrumb.Item, | |
165 | - Button, | |
166 | - ButtonGroup: Button.Group, | |
167 | - Card, | |
168 | - Carousel, | |
169 | - CarouselItem: Carousel.Item, | |
170 | - Cascader, | |
171 | - Checkbox, | |
172 | - CheckboxGroup: Checkbox.Group, | |
173 | 160 | Circle, |
174 | - Col, | |
175 | - Collapse, | |
176 | - ColorPicker, | |
177 | - DatePicker, | |
178 | - Dropdown, | |
179 | - DropdownItem: Dropdown.Item, | |
180 | - DropdownMenu: Dropdown.Menu, | |
181 | - Form, | |
182 | - FormItem: Form.Item, | |
183 | - Icon, | |
184 | - Input, | |
185 | - InputNumber, | |
186 | - Scroll, | |
187 | - LoadingBar, | |
188 | - Menu, | |
189 | - MenuGroup: Menu.Group, | |
190 | - MenuItem: Menu.Item, | |
191 | - Submenu: Menu.Sub, | |
192 | - Message, | |
193 | - Modal, | |
194 | - Notice, | |
195 | - Option: Option, | |
196 | - OptionGroup, | |
197 | - Page, | |
198 | - Panel: Collapse.Panel, | |
199 | - Poptip, | |
200 | - Progress, | |
201 | - Radio, | |
202 | - RadioGroup: Radio.Group, | |
203 | - Rate, | |
204 | - Row, | |
205 | - Select, | |
206 | - Slider, | |
207 | - Spin, | |
208 | - Step: Steps.Step, | |
209 | - Steps, | |
210 | 161 | Switch, |
211 | - Table, | |
212 | - Tabs: Tabs, | |
213 | - TabPane: Tabs.Pane, | |
214 | - Tag, | |
215 | - Timeline, | |
216 | - TimelineItem: Timeline.Item, | |
217 | - TimePicker, | |
218 | - Tooltip, | |
219 | - Transfer, | |
220 | - Tree, | |
221 | - Upload | |
162 | + ...components | |
222 | 163 | }; |
223 | 164 | |
224 | -module.exports.lang = (code) => { // eslint-disable-line no-undef | |
165 | +API.lang = (code) => { | |
225 | 166 | const langObject = window['iview/locale'].default; |
226 | 167 | if (code === langObject.i.locale) locale.use(langObject); |
227 | 168 | else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console |
228 | 169 | }; |
229 | 170 | |
230 | -module.exports.default = module.exports; // eslint-disable-line no-undef | |
171 | +module.exports.default = module.exports = API; // eslint-disable-line no-undef | ... | ... |