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,7 +51,7 @@ import {Row, Col} from './components/grid'; | ||
| 51 | import {Select, Option, OptionGroup} from './components/select'; | 51 | import {Select, Option, OptionGroup} from './components/select'; |
| 52 | import locale from './locale/index'; | 52 | import locale from './locale/index'; |
| 53 | 53 | ||
| 54 | -const iview = { | 54 | +const components = { |
| 55 | Affix, | 55 | Affix, |
| 56 | Alert, | 56 | Alert, |
| 57 | AutoComplete, | 57 | AutoComplete, |
| @@ -60,7 +60,6 @@ const iview = { | @@ -60,7 +60,6 @@ const iview = { | ||
| 60 | Badge, | 60 | Badge, |
| 61 | Breadcrumb, | 61 | Breadcrumb, |
| 62 | BreadcrumbItem: Breadcrumb.Item, | 62 | BreadcrumbItem: Breadcrumb.Item, |
| 63 | - iButton: Button, | ||
| 64 | Button, | 63 | Button, |
| 65 | ButtonGroup: Button.Group, | 64 | ButtonGroup: Button.Group, |
| 66 | Card, | 65 | Card, |
| @@ -69,9 +68,7 @@ const iview = { | @@ -69,9 +68,7 @@ const iview = { | ||
| 69 | Cascader, | 68 | Cascader, |
| 70 | Checkbox, | 69 | Checkbox, |
| 71 | CheckboxGroup: Checkbox.Group, | 70 | CheckboxGroup: Checkbox.Group, |
| 72 | - iCircle: Circle, | ||
| 73 | Col, | 71 | Col, |
| 74 | - iCol: Col, | ||
| 75 | Collapse, | 72 | Collapse, |
| 76 | ColorPicker, | 73 | ColorPicker, |
| 77 | DatePicker, | 74 | DatePicker, |
| @@ -79,16 +76,13 @@ const iview = { | @@ -79,16 +76,13 @@ const iview = { | ||
| 79 | DropdownItem: Dropdown.Item, | 76 | DropdownItem: Dropdown.Item, |
| 80 | DropdownMenu: Dropdown.Menu, | 77 | DropdownMenu: Dropdown.Menu, |
| 81 | Form, | 78 | Form, |
| 82 | - iForm: Form, | ||
| 83 | FormItem: Form.Item, | 79 | FormItem: Form.Item, |
| 84 | Icon, | 80 | Icon, |
| 85 | Input, | 81 | Input, |
| 86 | - iInput: Input, | ||
| 87 | InputNumber, | 82 | InputNumber, |
| 88 | Scroll, | 83 | Scroll, |
| 89 | LoadingBar, | 84 | LoadingBar, |
| 90 | Menu, | 85 | Menu, |
| 91 | - iMenu: Menu, | ||
| 92 | MenuGroup: Menu.Group, | 86 | MenuGroup: Menu.Group, |
| 93 | MenuItem: Menu.Item, | 87 | MenuItem: Menu.Item, |
| 94 | Submenu: Menu.Sub, | 88 | Submenu: Menu.Sub, |
| @@ -96,26 +90,20 @@ const iview = { | @@ -96,26 +90,20 @@ const iview = { | ||
| 96 | Modal, | 90 | Modal, |
| 97 | Notice, | 91 | Notice, |
| 98 | Option: Option, | 92 | Option: Option, |
| 99 | - iOption: Option, | ||
| 100 | OptionGroup, | 93 | OptionGroup, |
| 101 | Page, | 94 | Page, |
| 102 | Panel: Collapse.Panel, | 95 | Panel: Collapse.Panel, |
| 103 | Poptip, | 96 | Poptip, |
| 104 | Progress, | 97 | Progress, |
| 105 | - iProgress: Progress, | ||
| 106 | Radio, | 98 | Radio, |
| 107 | RadioGroup: Radio.Group, | 99 | RadioGroup: Radio.Group, |
| 108 | Rate, | 100 | Rate, |
| 109 | Row, | 101 | Row, |
| 110 | Select, | 102 | Select, |
| 111 | - iSelect: Select, | ||
| 112 | Slider, | 103 | Slider, |
| 113 | Spin, | 104 | Spin, |
| 114 | Step: Steps.Step, | 105 | Step: Steps.Step, |
| 115 | Steps, | 106 | Steps, |
| 116 | - // Switch, | ||
| 117 | - iSwitch: Switch, | ||
| 118 | - iTable: Table, | ||
| 119 | Table, | 107 | Table, |
| 120 | Tabs: Tabs, | 108 | Tabs: Tabs, |
| 121 | TabPane: Tabs.Pane, | 109 | TabPane: Tabs.Pane, |
| @@ -129,6 +117,21 @@ const iview = { | @@ -129,6 +117,21 @@ const iview = { | ||
| 129 | Upload | 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 | const install = function(Vue, opts = {}) { | 135 | const install = function(Vue, opts = {}) { |
| 133 | locale.use(opts.locale); | 136 | locale.use(opts.locale); |
| 134 | locale.i18n(opts.i18n); | 137 | locale.i18n(opts.i18n); |
| @@ -149,82 +152,20 @@ if (typeof window !== 'undefined' && window.Vue) { | @@ -149,82 +152,20 @@ if (typeof window !== 'undefined' && window.Vue) { | ||
| 149 | install(window.Vue); | 152 | install(window.Vue); |
| 150 | } | 153 | } |
| 151 | 154 | ||
| 152 | -module.exports = { // eslint-disable-line no-undef | 155 | +const API = { |
| 153 | version: '2.6.0', | 156 | version: '2.6.0', |
| 154 | locale: locale.use, | 157 | locale: locale.use, |
| 155 | i18n: locale.i18n, | 158 | i18n: locale.i18n, |
| 156 | install, | 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 | Circle, | 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 | Switch, | 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 | const langObject = window['iview/locale'].default; | 166 | const langObject = window['iview/locale'].default; |
| 226 | if (code === langObject.i.locale) locale.use(langObject); | 167 | if (code === langObject.i.locale) locale.use(langObject); |
| 227 | else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console | 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 |