md-iview 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/README.md +2 -0
  2. package/package.json +116 -0
  3. package/src/components/libs/util.js +117 -0
  4. package/src/components/md-error-page/403.less +92 -0
  5. package/src/components/md-error-page/403.vue +34 -0
  6. package/src/components/md-error-page/404.less +60 -0
  7. package/src/components/md-error-page/404.vue +34 -0
  8. package/src/components/md-error-page/500.less +73 -0
  9. package/src/components/md-error-page/500.vue +36 -0
  10. package/src/components/md-error-page/demo/index.less +22 -0
  11. package/src/components/md-error-page/demo/index.vue +97 -0
  12. package/src/components/md-form-item/index.js +3 -0
  13. package/src/components/md-icon/icon.vue +77 -0
  14. package/src/components/md-icon/icons.js +5 -0
  15. package/src/components/md-icon/index.js +11 -0
  16. package/src/components/md-icon/style/index.less +1 -0
  17. package/src/components/md-loading/index.js +55 -0
  18. package/src/components/md-loading/index.vue +53 -0
  19. package/src/components/md-loading/md-loading.js +38 -0
  20. package/src/components/md-print/demo/index.vue +260 -0
  21. package/src/components/md-print/index.js +123 -0
  22. package/src/components/md-rich-editor/index.vue +69 -0
  23. package/src/components/md-rich-editor/module/image-extend/index.js +216 -0
  24. package/src/components/md-scroll-bar/demo/index.vue +102 -0
  25. package/src/components/md-scroll-bar/index.js +3 -0
  26. package/src/components/md-scroll-bar/index.less +90 -0
  27. package/src/components/md-scroll-bar/index.vue +250 -0
  28. package/src/components/md-select/index.js +7 -0
  29. package/src/components/md-select/select.vue +841 -0
  30. package/src/components/md-shrinkable-menu/components/sidebarMenu.vue +167 -0
  31. package/src/components/md-shrinkable-menu/components/sidebarMenuShrink.vue +119 -0
  32. package/src/components/md-shrinkable-menu/demo/data/cachePage.js +1 -0
  33. package/src/components/md-shrinkable-menu/demo/data/currentPath.js +9 -0
  34. package/src/components/md-shrinkable-menu/demo/data/menu.js +575 -0
  35. package/src/components/md-shrinkable-menu/demo/data/menu2.js +1017 -0
  36. package/src/components/md-shrinkable-menu/demo/data/pageTagsList.js +153 -0
  37. package/src/components/md-shrinkable-menu/demo/index.less +297 -0
  38. package/src/components/md-shrinkable-menu/demo/index.vue +285 -0
  39. package/src/components/md-shrinkable-menu/index.vue +112 -0
  40. package/src/components/md-shrinkable-menu/sidebar.vue +195 -0
  41. package/src/components/md-shrinkable-menu/styles/menu.less +5 -0
  42. package/src/components/md-shrinkable-menu/styles/sidebar.less +363 -0
  43. package/src/components/md-split-pane/demo/index.vue +101 -0
  44. package/src/components/md-split-pane/index.js +3 -0
  45. package/src/components/md-split-pane/index.less +93 -0
  46. package/src/components/md-split-pane/index.vue +230 -0
  47. package/src/components/md-table/action-tooltip.vue +45 -0
  48. package/src/components/md-table/can-edit-v2.vue +823 -0
  49. package/src/components/md-table/can-edit.vue +723 -0
  50. package/src/components/md-table/custom-cell.vue +71 -0
  51. package/src/components/md-table/date-picker-cell-v2.vue +48 -0
  52. package/src/components/md-table/date-picker-cell.vue +39 -0
  53. package/src/components/md-table/demo/data/search.js +67 -0
  54. package/src/components/md-table/demo/data/table2csv.js +200 -0
  55. package/src/components/md-table/demo/data/table2excel.js +239 -0
  56. package/src/components/md-table/demo/data/table_data.js +251 -0
  57. package/src/components/md-table/demo/editable-table.vue +144 -0
  58. package/src/components/md-table/demo/exportable-table.vue +124 -0
  59. package/src/components/md-table/demo/widgets/header-search.vue +88 -0
  60. package/src/components/md-table/drop-down-cell-v2.vue +87 -0
  61. package/src/components/md-table/drop-down-cell.vue +81 -0
  62. package/src/components/md-table/editable-expand.vue +143 -0
  63. package/src/components/md-table/expand.vue +97 -0
  64. package/src/components/md-table/index.vue +53 -0
  65. package/src/components/md-table/iview-table/cell.vue +99 -0
  66. package/src/components/md-table/iview-table/expand.js +21 -0
  67. package/src/components/md-table/iview-table/export-csv.js +76 -0
  68. package/src/components/md-table/iview-table/header.js +16 -0
  69. package/src/components/md-table/iview-table/index.js +2 -0
  70. package/src/components/md-table/iview-table/mixin.js +31 -0
  71. package/src/components/md-table/iview-table/table-body.vue +101 -0
  72. package/src/components/md-table/iview-table/table-head.vue +311 -0
  73. package/src/components/md-table/iview-table/table-tr.vue +31 -0
  74. package/src/components/md-table/iview-table/table.vue +1026 -0
  75. package/src/components/md-table/iview-table/util.js +93 -0
  76. package/src/components/md-table/libs/table2excel.js +100 -0
  77. package/src/components/md-table/select-cell-v2.vue +64 -0
  78. package/src/components/md-table/select-cell.vue +46 -0
  79. package/src/components/md-table/table.less +76 -0
  80. package/src/components/md-toolbar/index.vue +171 -0
  81. package/src/components/md-tree/index.js +2 -0
  82. package/src/components/md-tree/node.vue +238 -0
  83. package/src/components/md-tree/render.js +17 -0
  84. package/src/components/md-tree/tree.vue +241 -0
  85. package/src/components/utilities/can.js +35 -0
  86. package/src/directives/index.js +34 -0
  87. package/src/directives/resize.js +27 -0
  88. package/src/directives/scroll.js +27 -0
  89. package/src/directives/style/bg-color.js +23 -0
  90. package/src/directives/style/color.js +23 -0
  91. package/src/directives/style/font-size.js +23 -0
  92. package/src/directives/style/height.js +23 -0
  93. package/src/directives/style/lineHeight.js +23 -0
  94. package/src/directives/style/margin.js +48 -0
  95. package/src/directives/style/opacity.js +23 -0
  96. package/src/directives/style/padding.js +48 -0
  97. package/src/directives/style/width.js +24 -0
  98. package/src/index.js +442 -0
  99. package/src/locale/lang.js +5 -0
  100. package/src/mixins/colorable.js +51 -0
  101. package/src/style/color/bezierEasing.less +110 -0
  102. package/src/style/color/colorPalette.less +75 -0
  103. package/src/style/color/colors.less +146 -0
  104. package/src/style/color/tinyColor.less +1184 -0
  105. package/src/style/common.less +72 -0
  106. package/src/style/components/_ripple.less +60 -0
  107. package/src/style/components/_shrinkable-menu.less +46 -0
  108. package/src/style/components/_toolbar.less +96 -0
  109. package/src/style/components/index.less +3 -0
  110. package/src/style/components/rich-editor.less +6 -0
  111. package/src/style/index.less +10 -0
  112. package/src/style/theme.less +155 -0
  113. package/src/utils/color.js +46 -0
  114. package/src/utils/console.js +105 -0
  115. package/src/utils/load.js +79 -0
  116. package/src/utils/mask.js +139 -0
  117. package/src/utils/mixins.js +5 -0
  118. package/src/utils/validate.js +271 -0
@@ -0,0 +1,23 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = parseFloat(binding.value);
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+
6
+ el.style.height = `${callback}px`;
7
+ el._height = {
8
+ callback,
9
+ options,
10
+ target
11
+ }
12
+ }
13
+
14
+
15
+ function unbind(el) {
16
+ if (!el._height) return;
17
+ delete el._height
18
+ }
19
+
20
+ export default {
21
+ bind,
22
+ unbind
23
+ }
@@ -0,0 +1,23 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = parseFloat(binding.value);
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+
6
+ el.style.lineHeight = `${callback}px`;
7
+ el._lineHeight = {
8
+ callback,
9
+ options,
10
+ target
11
+ }
12
+ }
13
+
14
+
15
+ function unbind(el) {
16
+ if (!el._lineHeight) return;
17
+ delete el._lineHeight
18
+ }
19
+
20
+ export default {
21
+ bind,
22
+ unbind
23
+ }
@@ -0,0 +1,48 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = binding.value;//parseFloat();
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+ const type = Object.prototype.toString.call(binding.value);
6
+ let marginValue = binding.value;
7
+ if (!target) {
8
+ if (type === '[object Array]') {
9
+ marginValue = callback.map(e=>{
10
+ let numberValue = parseFloat(e);
11
+ return `${numberValue}px`
12
+ }).join(' ')
13
+ el.style.margin = marginValue
14
+ console.log(el.style);
15
+ } else {
16
+ marginValue = parseFloat(binding.value);
17
+ el.style.margin = `${marginValue}px`;
18
+ }
19
+ } else {
20
+ marginValue = parseFloat(binding.value);
21
+ if (target === 'top') {
22
+ el.style.marginTop = `${marginValue}px`;
23
+ }else if (target === 'bottom') {
24
+ el.style.marginBottom = `${marginValue}px`;
25
+ }else if (target === 'left') {
26
+ el.style.marginLeft = `${marginValue}px`;
27
+ }else if (target === 'right') {
28
+ el.style.marginRight = `${marginValue}px`;
29
+ }
30
+ }
31
+
32
+ el._margin = {
33
+ callback,
34
+ options,
35
+ target
36
+ }
37
+ }
38
+
39
+
40
+ function unbind(el) {
41
+ if (!el._margin) return;
42
+ delete el._margin
43
+ }
44
+
45
+ export default {
46
+ bind,
47
+ unbind
48
+ }
@@ -0,0 +1,23 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = parseFloat(binding.value);
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+
6
+ el.style.opacity = callback;
7
+ el._opacity = {
8
+ callback,
9
+ options,
10
+ target
11
+ }
12
+ }
13
+
14
+
15
+ function unbind(el) {
16
+ if (!el._opacity) return;
17
+ delete el._opacity
18
+ }
19
+
20
+ export default {
21
+ bind,
22
+ unbind
23
+ }
@@ -0,0 +1,48 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = binding.value;//parseFloat();
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+ const type = Object.prototype.toString.call(binding.value);
6
+ let paddingValue = binding.value;
7
+ if (!target) {
8
+ if (type === '[object Array]') {
9
+ paddingValue = callback.map(e=>{
10
+ let numberValue = parseFloat(e);
11
+ return `${numberValue}px`
12
+ }).join(' ')
13
+ el.style.padding = paddingValue
14
+ console.log(el.style);
15
+ } else {
16
+ paddingValue = parseFloat(binding.value);
17
+ el.style.padding = `${paddingValue}px`;
18
+ }
19
+ } else {
20
+ paddingValue = parseFloat(binding.value);
21
+ if (target === 'top') {
22
+ el.style.paddingTop = `${paddingValue}px`;
23
+ }else if (target === 'bottom') {
24
+ el.style.paddingBottom = `${paddingValue}px`;
25
+ }else if (target === 'left') {
26
+ el.style.paddingLeft = `${paddingValue}px`;
27
+ }else if (target === 'right') {
28
+ el.style.paddingRight = `${paddingValue}px`;
29
+ }
30
+ }
31
+
32
+ el._padding = {
33
+ callback,
34
+ options,
35
+ target
36
+ }
37
+ }
38
+
39
+
40
+ function unbind(el) {
41
+ if (!el._padding) return;
42
+ delete el._padding
43
+ }
44
+
45
+ export default {
46
+ bind,
47
+ unbind
48
+ }
@@ -0,0 +1,24 @@
1
+ function bind(el, binding, vnode) {
2
+ const callback = parseFloat(binding.value);
3
+ const options = binding.options || { passive: true};
4
+ const target = binding.arg
5
+
6
+ el.style.width = `${callback}px`;
7
+
8
+ el._width = {
9
+ callback,
10
+ options,
11
+ target
12
+ }
13
+ }
14
+
15
+
16
+ function unbind(el) {
17
+ if (!el._width) return;
18
+ delete el._width
19
+ }
20
+
21
+ export default {
22
+ bind,
23
+ unbind
24
+ }
package/src/index.js ADDED
@@ -0,0 +1,442 @@
1
+ import MdAffix from 'iview/src/components/affix';
2
+ import MdAlert from 'iview/src/components/alert';
3
+ import MdAnchor from 'iview/src/components/anchor';
4
+ import MdAnchorLink from 'iview/src/components/anchor-link';
5
+ import MdAutoComplete from 'iview/src/components/auto-complete';
6
+ import MdAvatar from 'iview/src/components/avatar';
7
+ import MdBackTop from 'iview/src/components/back-top';
8
+ import MdBadge from 'iview/src/components/badge';
9
+ import MdBreadcrumb from 'iview/src/components/breadcrumb';
10
+ import MdButton from 'iview/src/components/button';
11
+ import MdBtn from 'iview/src/components/button';
12
+ import MdCard from 'iview/src/components/card';
13
+ import MdCarousel from 'iview/src/components/carousel';
14
+ import MdCascader from 'iview/src/components/cascader';
15
+ import MdCell from 'iview/src/components/cell';
16
+ import MdCheckbox from 'iview/src/components/checkbox';
17
+ import MdCircle from 'iview/src/components/circle';
18
+ import MdCollapse from 'iview/src/components/collapse';
19
+ import MdColorPicker from 'iview/src/components/color-picker';
20
+ import MdContent from 'iview/src/components/content';
21
+ import MdDatePicker from 'iview/src/components/date-picker';
22
+ import MdDivider from 'iview/src/components/divider';
23
+ import MdDrawer from 'iview/src/components/drawer';
24
+ import MdDropdown from 'iview/src/components/dropdown';
25
+ import MdFooter from 'iview/src/components/footer';
26
+ import MdForm from 'iview/src/components/form';
27
+ import MdHeader from 'iview/src/components/header';
28
+ // import MdIcon from 'iview/src/components/icon';
29
+ import MdInput from 'iview/src/components/input';
30
+ import MdInputNumber from 'iview/src/components/input-number';
31
+ import MdScroll from 'iview/src/components/scroll';
32
+ import MdSplit from 'iview/src/components/split';
33
+ import MdLayout from 'iview/src/components/layout';
34
+ import MdLoadingBar from 'iview/src/components/loading-bar';
35
+ import MdMenu from 'iview/src/components/menu';
36
+ import MdMessage from 'iview/src/components/message';
37
+ import MdModal from 'iview/src/components/modal';
38
+ import MdNotice from 'iview/src/components/notice';
39
+ import MdPage from 'iview/src/components/page';
40
+ import MdPoptip from 'iview/src/components/poptip';
41
+ import MdProgress from 'iview/src/components/progress';
42
+ import MdRadio from 'iview/src/components/radio';
43
+ import MdRate from 'iview/src/components/rate';
44
+ import MdSider from 'iview/src/components/sider';
45
+ import MdSlider from 'iview/src/components/slider';
46
+ import MdSpin from 'iview/src/components/spin';
47
+ import MdSteps from 'iview/src/components/steps';
48
+ import MdSwitch from 'iview/src/components/switch';
49
+ import MdTable from 'iview/src/components/table';
50
+ // import MdTable from './components/md-table/index';
51
+ import MdTabs from 'iview/src/components/tabs';
52
+ import MdTag from 'iview/src/components/tag';
53
+ import MdTime from 'iview/src/components/time';
54
+ import MdTimeline from 'iview/src/components/timeline';
55
+ import MdTimePicker from 'iview/src/components/time-picker';
56
+ import MdTooltip from 'iview/src/components/tooltip';
57
+ import MdTransfer from 'iview/src/components/transfer';
58
+ // import MdTree from 'iview/src/components/tree';
59
+ import MdUpload from 'iview/src/components/upload';
60
+ import {Row as MdRow, Col as MdCol} from 'iview/src/components/grid';
61
+ // import { Select as MdSelect, Option as MdOption, OptionGroup as MdOptionGroup} from 'iview/src/components/select';
62
+ import locale from 'iview/src/locale/index';
63
+
64
+ // 漫道扩展
65
+ import MdLoading from './components/md-loading';
66
+ import Can from './components/utilities/can.js';
67
+ import directives from './directives'
68
+ import MdShrinkableMenu from "./components/md-shrinkable-menu/sidebar.vue";
69
+ import MdToolbar from "./components/md-toolbar";
70
+ import MdRichEditor from './components/md-rich-editor'
71
+ import MdIcon from './components/md-icon/icon'
72
+ import { Select as MdSelect, Option as MdOption, OptionGroup as MdOptionGroup} from './components/md-select';
73
+ // import MdSelect from './components/md-select/index'
74
+ import MdTree from './components/md-tree'
75
+ import MdPrint from './components/md-print'
76
+ import MdChart from 'md-d3'
77
+ // Vue.use(MdPrint)
78
+
79
+ import '@/style/index.less'
80
+ import iView from 'iview';
81
+ let components = {
82
+ MdAffix,
83
+ MdAlert,
84
+ MdAnchor,
85
+ MdAnchorLink,
86
+ MdAutoComplete,
87
+ MdAvatar,
88
+ MdBackTop,
89
+ MdBadge,
90
+ MdBreadcrumb,
91
+ MdBreadcrumbItem: MdBreadcrumb.Item,
92
+ MdButton,
93
+ MdBtn,
94
+ MdButtonGroup: MdButton.Group,
95
+ MdBtnGroup: MdBtn.Group,
96
+ MdCard,
97
+ MdCarousel,
98
+ MdCarouselItem: MdCarousel.Item,
99
+ MdCascader,
100
+ MdCell,
101
+ MdCellGroup: MdCell.Group,
102
+ MdCheckbox,
103
+ MdCheckboxGroup: MdCheckbox.Group,
104
+ MdCircle,
105
+ MdCol,
106
+ MdCollapse,
107
+ MdColorPicker,
108
+ MdContent: MdContent,
109
+ MdDatePicker,
110
+ MdDivider,
111
+ MdDrawer,
112
+ MdDropdown,
113
+ MdDropdownItem: MdDropdown.Item,
114
+ MdDropdownMenu: MdDropdown.Menu,
115
+ MdFooter: MdFooter,
116
+ MdForm,
117
+ MdFormItem: MdForm.Item,
118
+ MdHeader: MdHeader,
119
+ // MdIcon,
120
+ MdInput,
121
+ MdInputNumber,
122
+ MdScroll,
123
+ MdSider: MdSider,
124
+ MdSplit,
125
+ MdSubmenu: MdMenu.Sub,
126
+ MdSwitch,
127
+ MdLayout: MdLayout,
128
+ MdLoadingBar,
129
+ MdMenu,
130
+ MdMenuGroup: MdMenu.Group,
131
+ MdMenuItem: MdMenu.Item,
132
+ MdMessage,
133
+ MdModal,
134
+ MdNotice,
135
+ MdOption: MdOption,
136
+ MdOptionGroup,
137
+ MdPage,
138
+ MdPanel: MdCollapse.Panel,
139
+ MdPoptip,
140
+ MdProgress,
141
+ MdRadio,
142
+ MdRadioGroup: MdRadio.Group,
143
+ MdRate,
144
+ MdRow,
145
+ // MdSelect,
146
+ MdSlider,
147
+ MdSpin,
148
+ MdStep: MdSteps.Step,
149
+ MdSteps,
150
+ MdTable,
151
+ MdTabs: MdTabs,
152
+ MdTabPane: MdTabs.Pane,
153
+ MdTag,
154
+ MdTime,
155
+ MdTimeline,
156
+ MdTimelineItem: MdTimeline.Item,
157
+ MdTimePicker,
158
+ MdTooltip,
159
+ MdTransfer,
160
+ // MdTree,
161
+ MdUpload,
162
+ // 漫道扩展
163
+ MdLoading,
164
+ MdShrinkableMenu,
165
+ MdToolbar,
166
+ Can,
167
+ // MdRichEditor,
168
+ MdIcon,
169
+ MdChart,
170
+ MdSelect,
171
+ MdTree,
172
+ // MdPrint
173
+ };
174
+
175
+ import loadCssJs from './utils/load'
176
+
177
+ let MdView = {
178
+ ...components,
179
+ iButton: MdButton,
180
+ iCircle: MdCircle,
181
+ iCol: MdCol,
182
+ iContent: MdContent,
183
+ iForm: MdForm,
184
+ iFooter: MdFooter,
185
+ iHeader: MdHeader,
186
+ iInput: MdInput,
187
+ iMenu: MdMenu,
188
+ iOption: MdOption,
189
+ iProgress: MdProgress,
190
+ iSelect: MdSelect,
191
+ iSwitch: MdSwitch,
192
+ iTable: MdTable,
193
+ iTime: MdTime
194
+ };
195
+
196
+ const install = function (Vue, opts = {}) {
197
+ if (install.installed) return;
198
+ locale.use(opts.locale);
199
+ locale.i18n(opts.i18n);
200
+
201
+ if (opts.hasOwnProperty('richEditor') && opts.richEditor) {
202
+ // components = {
203
+ // ...components,
204
+ // ... {
205
+ // MdRichEditor,
206
+ // }
207
+ // };
208
+
209
+ Object.assign(components, { 'MdRichEditor': MdRichEditor })
210
+ Object.assign(MdView, { 'MdRichEditor': MdRichEditor })
211
+ /*let importCss = function(files,ver=__MDVIEW_VERSION__){
212
+ files.forEach(elem=>{
213
+ let link = document.createElement("link");
214
+
215
+ link.rel = "stylesheet";
216
+
217
+ link.type = "text/css";
218
+
219
+ link.href = elem + "?v=" + ver;
220
+
221
+ document.getElementsByTagName("head")[0].appendChild(link);
222
+ // document.write("<link rel=\"stylesheet\" href=" + elem +"?ver="+ ver +" type=\"text/css\" media=\"screen\"/>");
223
+ })
224
+ };
225
+ importCss(quills);*/
226
+ let quills = [
227
+ "https://cdn.bootcss.com/quill/1.3.6/quill.core.css",
228
+ "https://cdn.bootcss.com/quill/1.3.6/quill.snow.css",
229
+ "https://cdn.bootcss.com/quill/1.3.6/quill.bubble.css",
230
+ ];
231
+ if (Object.prototype.toString.call(opts.richEditor) === "[object Array]" && opts.richEditor.length>0) {
232
+ opts.richEditor.forEach(elem =>{
233
+ loadCssJs(elem)
234
+ })
235
+ } else {
236
+ quills.forEach(elem =>{
237
+ loadCssJs(elem)
238
+ })
239
+ }
240
+ // Vue.component('MdRichEditor', MdRichEditor);
241
+ }
242
+ Object.keys(MdView).forEach(key => {
243
+ Vue.component(key, MdView[key]);
244
+ });
245
+
246
+ Vue.use(MdPrint)
247
+
248
+ Vue.prototype.$MDVIEW = Vue.prototype.$IVIEW = {
249
+ size: opts.size || '',
250
+ transfer: 'transfer' in opts ? opts.transfer : '',
251
+ select: {
252
+ arrow: opts.select ? opts.select.arrow ? opts.select.arrow : '' : '',
253
+ customArrow: opts.select ? opts.select.customArrow ? opts.select.customArrow : '' : '',
254
+ arrowSize: opts.select ? opts.select.arrowSize ? opts.select.arrowSize : '' : ''
255
+ },
256
+ cell: {
257
+ arrow: opts.cell ? opts.cell.arrow ? opts.cell.arrow : '' : '',
258
+ customArrow: opts.cell ? opts.cell.customArrow ? opts.cell.customArrow : '' : '',
259
+ arrowSize: opts.cell ? opts.cell.arrowSize ? opts.cell.arrowSize : '' : ''
260
+ },
261
+ menu: {
262
+ arrow: opts.menu ? opts.menu.arrow ? opts.menu.arrow : '' : '',
263
+ customArrow: opts.menu ? opts.menu.customArrow ? opts.menu.customArrow : '' : '',
264
+ arrowSize: opts.menu ? opts.menu.arrowSize ? opts.menu.arrowSize : '' : ''
265
+ },
266
+ tree: {
267
+ arrow: opts.tree ? opts.tree.arrow ? opts.tree.arrow : '' : '',
268
+ customArrow: opts.tree ? opts.tree.customArrow ? opts.tree.customArrow : '' : '',
269
+ arrowSize: opts.tree ? opts.tree.arrowSize ? opts.tree.arrowSize : '' : ''
270
+ },
271
+ cascader: {
272
+ arrow: opts.cascader ? opts.cascader.arrow ? opts.cascader.arrow : '' : '',
273
+ customArrow: opts.cascader ? opts.cascader.customArrow ? opts.cascader.customArrow : '' : '',
274
+ arrowSize: opts.cascader ? opts.cascader.arrowSize ? opts.cascader.arrowSize : '' : '',
275
+ itemArrow: opts.cascader ? opts.cascader.itemArrow ? opts.cascader.itemArrow : '' : '',
276
+ customItemArrow: opts.cascader ? opts.cascader.customItemArrow ? opts.cascader.customItemArrow : '' : '',
277
+ itemArrowSize: opts.cascader ? opts.cascader.itemArrowSize ? opts.cascader.itemArrowSize : '' : ''
278
+ },
279
+ colorPicker: {
280
+ arrow: opts.colorPicker ? opts.colorPicker.arrow ? opts.colorPicker.arrow : '' : '',
281
+ customArrow: opts.colorPicker ? opts.colorPicker.customArrow ? opts.colorPicker.customArrow : '' : '',
282
+ arrowSize: opts.colorPicker ? opts.colorPicker.arrowSize ? opts.colorPicker.arrowSize : '' : ''
283
+ },
284
+ datePicker: {
285
+ icon: opts.datePicker ? opts.datePicker.icon ? opts.datePicker.icon : '' : '',
286
+ customIcon: opts.datePicker ? opts.datePicker.customIcon ? opts.datePicker.customIcon : '' : '',
287
+ iconSize: opts.datePicker ? opts.datePicker.iconSize ? opts.datePicker.iconSize : '' : ''
288
+ },
289
+ timePicker: {
290
+ icon: opts.timePicker ? opts.timePicker.icon ? opts.timePicker.icon : '' : '',
291
+ customIcon: opts.timePicker ? opts.timePicker.customIcon ? opts.timePicker.customIcon : '' : '',
292
+ iconSize: opts.timePicker ? opts.timePicker.iconSize ? opts.timePicker.iconSize : '' : ''
293
+ },
294
+ tabs: {
295
+ closeIcon: opts.tabs ? opts.tabs.closeIcon ? opts.tabs.closeIcon : '' : '',
296
+ customCloseIcon: opts.tabs ? opts.tabs.customCloseIcon ? opts.tabs.customCloseIcon : '' : '',
297
+ closeIconSize: opts.tabs ? opts.tabs.closeIconSize ? opts.tabs.closeIconSize : '' : ''
298
+ },
299
+ modal: {
300
+ maskClosable: opts.modal ? 'maskClosable' in opts.modal ? opts.modal.maskClosable : '' : ''
301
+ },
302
+ };
303
+
304
+ Vue.prototype.$MdLoading = MdLoadingBar;
305
+ Vue.prototype.$MdMessage = MdMessage;
306
+ Vue.prototype.$MdMdModal = MdModal;
307
+ Vue.prototype.$MdNotice = MdNotice;
308
+ Vue.prototype.$MdSpin = MdSpin;
309
+ Vue.use(iView);
310
+ /**
311
+ * 漫道扩展
312
+ */
313
+ Object.keys(directives).forEach(key => {
314
+ Vue.directive(key, directives[key])
315
+ })
316
+
317
+
318
+ opts.iconfonts && opts.iconfonts.forEach(elem =>{
319
+ loadCssJs(elem)
320
+ })
321
+ };
322
+
323
+
324
+
325
+ // auto install
326
+ if (typeof window !== 'undefined' && window.Vue) {
327
+ install(window.Vue);
328
+ }
329
+
330
+ const API = {
331
+ version: __MDVIEW_VERSION__,
332
+ locale: locale.use,
333
+ i18n: locale.i18n,
334
+ install,
335
+ MdCircle,
336
+ MdSwitch,
337
+ ...components
338
+ };
339
+
340
+ API.lang = (code) => {
341
+ const langObject = window['iview/locale'].default;
342
+ if (code === langObject.i.locale) locale.use(langObject);
343
+ else console.log(`The ${code} language pack is not loaded.`); // eslint-disable-line no-console
344
+ };
345
+ /*
346
+ export {
347
+ MdAffix,
348
+ MdAlert,
349
+ MdAnchor,
350
+ MdAnchorLink,
351
+ MdAutoComplete,
352
+ MdAvatar,
353
+ MdBackTop,
354
+ MdBadge,
355
+ MdBreadcrumb,
356
+ MdBreadcrumbItem,
357
+ MdButton,
358
+ MdBtn,
359
+ MdButtonGroup,
360
+ MdBtnGroup,
361
+ MdCard,
362
+ MdCarousel,
363
+ MdCarouselItem,
364
+ MdCascader,
365
+ MdCell,
366
+ MdCellGroup,
367
+ MdCheckbox,
368
+ MdCheckboxGroup,
369
+ MdCol,
370
+ MdCollapse,
371
+ MdColorPicker,
372
+ MdContent,
373
+ MdDatePicker,
374
+ MdDivider,
375
+ MdDrawer,
376
+ MdDropdown,
377
+ MdDropdownItem,
378
+ MdDropdownMenu,
379
+ MdFooter,
380
+ MdForm,
381
+ MdFormItem,
382
+ MdHeader,
383
+ // MdIcon,
384
+ MdInput,
385
+ MdInputNumber,
386
+ MdScroll,
387
+ MdSider,
388
+ MdSplit,
389
+ MdSubmenu,
390
+ MdLayout,
391
+ MdLoadingBar,
392
+ MdMenu,
393
+ MdMenuGroup,
394
+ MdMenuItem,
395
+ MdMessage,
396
+ MdModal,
397
+ MdNotice,
398
+ MdOption,
399
+ MdOptionGroup,
400
+ MdPage,
401
+ MdPanel,
402
+ MdPoptip,
403
+ MdProgress,
404
+ MdRadio,
405
+ MdRadioGroup,
406
+ MdRate,
407
+ MdRow,
408
+ // MdSelect,
409
+ MdSlider,
410
+ MdSpin,
411
+ MdStep,
412
+ MdSteps,
413
+ MdTable,
414
+ MdTabs,
415
+ MdTabPane,
416
+ MdTag,
417
+ MdTime,
418
+ MdTimeline,
419
+ MdTimelineItem,
420
+ MdTimePicker,
421
+ MdTooltip,
422
+ MdTransfer,
423
+ // MdTree,
424
+ MdUpload,
425
+ // 漫道扩展
426
+ MdLoading,
427
+ MdShrinkableMenu,
428
+ MdToolbar,
429
+ Can,
430
+ MdRichEditor,
431
+ MdIcon,
432
+ MdChart,
433
+ MdSelect,
434
+ MdTree,
435
+ MdPrint
436
+ };*/
437
+
438
+ export default API
439
+ // module.exports.default = module.exports = API; // eslint-disable-line no-undef
440
+ // module.exports.default = module.exports = API; // eslint-disable-line no-undef
441
+ // module.exports = API
442
+ // export default API
@@ -0,0 +1,5 @@
1
+ import zh from 'iview/dist/locale/zh-CN'
2
+ import en from 'iview/dist/locale/en-US'
3
+ import { locale } from 'iview'
4
+
5
+ export { zh, en, locale }
@@ -0,0 +1,51 @@
1
+ import Vue from 'vue'
2
+
3
+ function isCssColor(color) {
4
+ return !!color && !!color.match(/^(#|(rgb|hsl)a?\()/)
5
+ }
6
+
7
+ export default Vue.extend({
8
+ name: 'colorable',
9
+
10
+ props: {
11
+ color: String
12
+ },
13
+
14
+ methods: {
15
+ setBackgroundColor(color, data = {}) {
16
+ if (isCssColor(color)) {
17
+ data.style = {
18
+ ...data.style,
19
+ 'background-color': `${color}`,
20
+ 'border-color': `${color}`
21
+ }
22
+ } else if (color) {
23
+ data.class = {
24
+ ...data.class,
25
+ [color]: true
26
+ }
27
+ }
28
+
29
+ return data
30
+ },
31
+ setTextColor(color, data = {}) {
32
+ if (isCssColor(color)) {
33
+ data.style = {
34
+ ...data.style,
35
+ 'color': `${color}`,
36
+ 'caret-color': `${color}`
37
+ }
38
+ } else if (color) {
39
+ const [colorName, colorModifier] = color.toString().trim().split(' ', 2);
40
+ data.class = {
41
+ ...data.class,
42
+ [colorName + '--text']: true
43
+ }
44
+ if (colorModifier) {
45
+ data.class['text--' + colorModifier] = true
46
+ }
47
+ }
48
+ return data
49
+ }
50
+ },
51
+ })