2016-10-31 17:41:42 +08:00
|
|
|
import Affix from './components/affix';
|
2017-03-02 11:50:02 +08:00
|
|
|
import Alert from './components/alert';
|
2018-04-12 17:49:55 +08:00
|
|
|
import Anchor from './components/anchor';
|
|
|
|
import AnchorLink from './components/anchor-link';
|
2017-08-23 14:42:54 +08:00
|
|
|
import AutoComplete from './components/auto-complete';
|
2017-08-15 10:07:15 +08:00
|
|
|
import Avatar from './components/avatar';
|
2017-03-07 10:03:11 +08:00
|
|
|
import BackTop from './components/back-top';
|
2017-03-02 12:05:57 +08:00
|
|
|
import Badge from './components/badge';
|
2017-03-03 21:05:30 +08:00
|
|
|
import Breadcrumb from './components/breadcrumb';
|
2017-03-01 14:43:27 +08:00
|
|
|
import Button from './components/button';
|
2017-03-02 17:35:02 +08:00
|
|
|
import Card from './components/card';
|
2017-03-02 15:36:39 +08:00
|
|
|
import Carousel from './components/carousel';
|
2017-03-06 17:30:39 +08:00
|
|
|
import Cascader from './components/cascader';
|
2017-03-01 17:58:40 +08:00
|
|
|
import Checkbox from './components/checkbox';
|
2017-03-03 11:54:23 +08:00
|
|
|
import Circle from './components/circle';
|
2017-03-02 15:05:06 +08:00
|
|
|
import Collapse from './components/collapse';
|
2017-08-15 16:42:42 +08:00
|
|
|
import ColorPicker from './components/color-picker';
|
2017-12-18 18:25:16 +08:00
|
|
|
import Content from './components/content';
|
2017-03-07 18:06:56 +08:00
|
|
|
import DatePicker from './components/date-picker';
|
2017-03-03 17:46:09 +08:00
|
|
|
import Dropdown from './components/dropdown';
|
2017-12-18 18:25:16 +08:00
|
|
|
import Footer from './components/footer';
|
2017-03-08 15:31:59 +08:00
|
|
|
import Form from './components/form';
|
2017-12-18 18:25:16 +08:00
|
|
|
import Header from './components/header';
|
2017-03-01 14:43:27 +08:00
|
|
|
import Icon from './components/icon';
|
2017-03-01 15:23:12 +08:00
|
|
|
import Input from './components/input';
|
2017-03-02 13:40:09 +08:00
|
|
|
import InputNumber from './components/input-number';
|
2017-09-27 14:46:42 +02:00
|
|
|
import Scroll from './components/scroll';
|
2018-06-07 15:34:42 +08:00
|
|
|
import Split from './components/split';
|
2017-12-18 18:25:16 +08:00
|
|
|
import Layout from './components/layout';
|
2017-03-09 17:29:40 +08:00
|
|
|
import LoadingBar from './components/loading-bar';
|
2017-03-06 13:31:48 +08:00
|
|
|
import Menu from './components/menu';
|
2017-03-09 22:21:54 +08:00
|
|
|
import Message from './components/message';
|
2017-03-09 18:31:47 +08:00
|
|
|
import Modal from './components/modal';
|
2017-03-09 22:32:57 +08:00
|
|
|
import Notice from './components/notice';
|
2017-03-07 10:32:46 +08:00
|
|
|
import Page from './components/page';
|
2017-03-03 15:19:21 +08:00
|
|
|
import Poptip from './components/poptip';
|
2017-03-02 14:41:28 +08:00
|
|
|
import Progress from './components/progress';
|
2017-03-01 17:01:22 +08:00
|
|
|
import Radio from './components/radio';
|
2017-03-02 19:31:21 +08:00
|
|
|
import Rate from './components/rate';
|
2017-12-18 18:25:16 +08:00
|
|
|
import Sider from './components/sider';
|
2017-03-03 14:00:16 +08:00
|
|
|
import Slider from './components/slider';
|
2017-03-06 13:43:15 +08:00
|
|
|
import Spin from './components/spin';
|
2017-03-01 21:10:43 +08:00
|
|
|
import Steps from './components/steps';
|
2017-03-02 11:19:00 +08:00
|
|
|
import Switch from './components/switch';
|
2017-03-09 14:11:22 +08:00
|
|
|
import Table from './components/table';
|
2017-03-03 13:38:46 +08:00
|
|
|
import Tabs from './components/tabs';
|
2017-03-02 12:22:15 +08:00
|
|
|
import Tag from './components/tag';
|
2018-05-17 17:51:37 +08:00
|
|
|
import Time from './components/time';
|
2017-03-02 09:06:39 +08:00
|
|
|
import Timeline from './components/timeline';
|
2017-03-07 18:06:56 +08:00
|
|
|
import TimePicker from './components/time-picker';
|
2017-03-03 14:00:16 +08:00
|
|
|
import Tooltip from './components/tooltip';
|
2017-03-07 15:06:38 +08:00
|
|
|
import Transfer from './components/transfer';
|
2017-03-24 20:52:14 +08:00
|
|
|
import Tree from './components/tree';
|
2017-03-02 14:41:28 +08:00
|
|
|
import Upload from './components/upload';
|
2017-09-27 14:46:42 +02:00
|
|
|
import {Row, Col} from './components/grid';
|
|
|
|
import {Select, Option, OptionGroup} from './components/select';
|
2018-03-29 23:10:14 +08:00
|
|
|
import Divider from './components/divider';
|
2017-11-04 15:21:26 +01:00
|
|
|
import locale from './locale/index';
|
2016-09-09 14:29:19 +08:00
|
|
|
|
2017-11-09 05:50:30 +01:00
|
|
|
const components = {
|
2016-10-31 17:41:42 +08:00
|
|
|
Affix,
|
2017-03-02 11:50:02 +08:00
|
|
|
Alert,
|
2018-04-12 17:49:55 +08:00
|
|
|
Anchor,
|
|
|
|
AnchorLink,
|
2017-08-23 14:42:54 +08:00
|
|
|
AutoComplete,
|
2017-08-15 10:07:15 +08:00
|
|
|
Avatar,
|
2017-03-07 10:03:11 +08:00
|
|
|
BackTop,
|
2017-03-02 12:05:57 +08:00
|
|
|
Badge,
|
2017-03-03 21:05:30 +08:00
|
|
|
Breadcrumb,
|
|
|
|
BreadcrumbItem: Breadcrumb.Item,
|
2017-03-01 14:43:27 +08:00
|
|
|
Button,
|
|
|
|
ButtonGroup: Button.Group,
|
2017-03-02 17:35:02 +08:00
|
|
|
Card,
|
2017-03-02 15:36:39 +08:00
|
|
|
Carousel,
|
|
|
|
CarouselItem: Carousel.Item,
|
2017-03-06 17:30:39 +08:00
|
|
|
Cascader,
|
2017-03-01 17:58:40 +08:00
|
|
|
Checkbox,
|
|
|
|
CheckboxGroup: Checkbox.Group,
|
2017-08-15 16:42:42 +08:00
|
|
|
Col,
|
|
|
|
Collapse,
|
|
|
|
ColorPicker,
|
2017-12-18 18:25:16 +08:00
|
|
|
Content: Content,
|
2017-03-07 18:06:56 +08:00
|
|
|
DatePicker,
|
2017-03-03 17:46:09 +08:00
|
|
|
Dropdown,
|
|
|
|
DropdownItem: Dropdown.Item,
|
|
|
|
DropdownMenu: Dropdown.Menu,
|
2017-12-18 18:25:16 +08:00
|
|
|
Footer: Footer,
|
2017-03-21 13:57:29 +08:00
|
|
|
Form,
|
2017-03-08 15:31:59 +08:00
|
|
|
FormItem: Form.Item,
|
2017-12-18 18:25:16 +08:00
|
|
|
Header: Header,
|
2017-03-01 14:43:27 +08:00
|
|
|
Icon,
|
2017-03-01 15:23:12 +08:00
|
|
|
Input,
|
2017-03-02 13:40:09 +08:00
|
|
|
InputNumber,
|
2017-09-27 14:46:42 +02:00
|
|
|
Scroll,
|
2017-12-18 18:25:16 +08:00
|
|
|
Sider: Sider,
|
2018-06-07 15:34:42 +08:00
|
|
|
Split,
|
2017-12-18 18:25:16 +08:00
|
|
|
Submenu: Menu.Sub,
|
|
|
|
Layout: Layout,
|
2017-03-09 17:29:40 +08:00
|
|
|
LoadingBar,
|
2017-03-06 13:31:48 +08:00
|
|
|
Menu,
|
|
|
|
MenuGroup: Menu.Group,
|
|
|
|
MenuItem: Menu.Item,
|
2017-03-09 22:21:54 +08:00
|
|
|
Message,
|
2017-03-09 18:31:47 +08:00
|
|
|
Modal,
|
2017-03-09 22:32:57 +08:00
|
|
|
Notice,
|
2017-03-14 14:28:56 +08:00
|
|
|
Option: Option,
|
2017-03-06 18:24:57 +08:00
|
|
|
OptionGroup,
|
2017-03-07 10:32:46 +08:00
|
|
|
Page,
|
2017-03-02 15:05:06 +08:00
|
|
|
Panel: Collapse.Panel,
|
2017-03-03 15:19:21 +08:00
|
|
|
Poptip,
|
2017-03-02 14:41:28 +08:00
|
|
|
Progress,
|
2017-03-01 17:01:22 +08:00
|
|
|
Radio,
|
|
|
|
RadioGroup: Radio.Group,
|
2017-03-02 19:31:21 +08:00
|
|
|
Rate,
|
2017-03-01 14:28:44 +08:00
|
|
|
Row,
|
2017-03-13 16:29:29 +08:00
|
|
|
Select,
|
2017-03-03 14:00:16 +08:00
|
|
|
Slider,
|
2017-03-06 13:43:15 +08:00
|
|
|
Spin,
|
2017-03-01 21:10:43 +08:00
|
|
|
Step: Steps.Step,
|
|
|
|
Steps,
|
2017-03-09 14:11:22 +08:00
|
|
|
Table,
|
2017-03-03 13:38:46 +08:00
|
|
|
Tabs: Tabs,
|
|
|
|
TabPane: Tabs.Pane,
|
2017-03-02 12:22:15 +08:00
|
|
|
Tag,
|
2018-05-17 17:51:37 +08:00
|
|
|
Time,
|
2017-03-02 09:06:39 +08:00
|
|
|
Timeline,
|
|
|
|
TimelineItem: Timeline.Item,
|
2017-03-07 18:06:56 +08:00
|
|
|
TimePicker,
|
2017-03-03 14:00:16 +08:00
|
|
|
Tooltip,
|
2017-03-07 15:06:38 +08:00
|
|
|
Transfer,
|
2017-03-02 17:40:19 +08:00
|
|
|
Tree,
|
2018-03-29 23:10:14 +08:00
|
|
|
Upload,
|
|
|
|
Divider
|
2016-09-09 14:29:19 +08:00
|
|
|
};
|
2017-03-15 11:22:33 +08:00
|
|
|
|
2017-11-09 05:50:30 +01:00
|
|
|
const iview = {
|
|
|
|
...components,
|
|
|
|
iButton: Button,
|
|
|
|
iCircle: Circle,
|
|
|
|
iCol: Col,
|
2017-12-18 18:25:16 +08:00
|
|
|
iContent: Content,
|
2017-11-09 05:50:30 +01:00
|
|
|
iForm: Form,
|
2017-12-18 18:25:16 +08:00
|
|
|
iFooter: Footer,
|
|
|
|
iHeader: Header,
|
2017-11-09 05:50:30 +01:00
|
|
|
iInput: Input,
|
|
|
|
iMenu: Menu,
|
|
|
|
iOption: Option,
|
|
|
|
iProgress: Progress,
|
|
|
|
iSelect: Select,
|
|
|
|
iSwitch: Switch,
|
2018-05-17 17:51:37 +08:00
|
|
|
iTable: Table,
|
|
|
|
iTime: Time
|
2017-11-09 05:50:30 +01:00
|
|
|
};
|
|
|
|
|
2017-09-27 14:46:42 +02:00
|
|
|
const install = function(Vue, opts = {}) {
|
2017-11-22 15:19:58 +08:00
|
|
|
if (install.installed) return;
|
2017-01-11 18:04:29 +08:00
|
|
|
locale.use(opts.locale);
|
|
|
|
locale.i18n(opts.i18n);
|
|
|
|
|
2017-09-27 14:46:42 +02:00
|
|
|
Object.keys(iview).forEach(key => {
|
2017-03-15 11:22:33 +08:00
|
|
|
Vue.component(key, iview[key]);
|
2016-11-14 13:49:06 +08:00
|
|
|
});
|
|
|
|
|
2017-03-09 17:29:40 +08:00
|
|
|
Vue.prototype.$Loading = LoadingBar;
|
2017-03-09 22:21:54 +08:00
|
|
|
Vue.prototype.$Message = Message;
|
2017-03-09 18:31:47 +08:00
|
|
|
Vue.prototype.$Modal = Modal;
|
2017-03-09 22:32:57 +08:00
|
|
|
Vue.prototype.$Notice = Notice;
|
2017-09-19 14:26:46 +08:00
|
|
|
Vue.prototype.$Spin = Spin;
|
2016-11-14 13:49:06 +08:00
|
|
|
};
|
2016-11-03 10:19:35 +08:00
|
|
|
|
|
|
|
// auto install
|
|
|
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
|
|
install(window.Vue);
|
2016-11-14 13:49:06 +08:00
|
|
|
}
|
2016-11-03 10:19:35 +08:00
|
|
|
|
2017-11-09 05:50:30 +01:00
|
|
|
const API = {
|
2017-11-14 17:46:52 +01:00
|
|
|
version: process.env.VERSION, // eslint-disable-line no-undef
|
2017-11-07 16:43:23 +08:00
|
|
|
locale: locale.use,
|
|
|
|
i18n: locale.i18n,
|
|
|
|
install,
|
|
|
|
Circle,
|
|
|
|
Switch,
|
2017-11-09 05:50:30 +01:00
|
|
|
...components
|
2017-11-07 16:43:23 +08:00
|
|
|
};
|
|
|
|
|
2017-11-09 05:50:30 +01:00
|
|
|
API.lang = (code) => {
|
2017-11-08 09:59:45 +01:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2017-11-09 05:50:30 +01:00
|
|
|
module.exports.default = module.exports = API; // eslint-disable-line no-undef
|