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,250 @@
1
+ <template>
2
+ <div ref="wraper" :class="wraperClasses" @DOMMouseScroll="handleDOMMouseWheel" @mousewheel="handleMouseWheel">
3
+ <div
4
+ ref="content"
5
+ :class="`${prefix}-content`"
6
+ :style="contentStyles"
7
+ >
8
+ <slot></slot>
9
+ </div>
10
+ <div v-show="percentY < 1 && !disScrollY" :class="scrollYClasses" :style="scrollYStyles">
11
+ <div :class="[`${prefix}-scroll-bar`, `${prefix}-scroll-bar-y`]" :style="scrollBarYStyles" @mousedown="handleMousedownScrollBarY"></div>
12
+ </div>
13
+ <div v-show="percentX < 1 && !disScrollX" :class="scrollXClasses" :style="scrollXStyles">
14
+ <div :class="[`${prefix}-scroll-bar`, `${prefix}-scroll-bar-x`]" :style="scrollBarXStyles" @mousedown="handleMousedownScrollBarX"></div>
15
+ </div>
16
+ <div v-show="percentX < 1 && percentY < 1" :class="`${prefix}-place-holder`"></div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ /**
22
+ * @author Lison<zhigang.li@tendcloud.com>
23
+ */
24
+ export default {
25
+ name: 'scrollBar',
26
+ props: {
27
+ speed: {
28
+ type: Number,
29
+ default: 20
30
+ },
31
+ scrollXStyle: {
32
+ type: Object,
33
+ default () {
34
+ return {};
35
+ }
36
+ },
37
+ disScrollX: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ disScrollY: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ scrollYStyle: {
46
+ type: Object,
47
+ default () {
48
+ return {};
49
+ }
50
+ },
51
+ scrollXType: {
52
+ type: String,
53
+ default: 'cover'
54
+ },
55
+ scrollYType: {
56
+ type: String,
57
+ default: 'cover'
58
+ },
59
+ showAll: {
60
+ type: Boolean,
61
+ default: false
62
+ }
63
+ },
64
+ data () {
65
+ return {
66
+ prefix: 'vue-scroller-bars',
67
+ scrollOffsetX: 0,
68
+ scrollOffsetY: 0,
69
+ contentSize: {
70
+ width: 0,
71
+ height: 0
72
+ },
73
+ wraperSize: {
74
+ width: 0,
75
+ height: 0
76
+ },
77
+ initY: 0,
78
+ initOffsetY: 0,
79
+ initX: 0,
80
+ initOffsetX: 0
81
+ };
82
+ },
83
+ computed: {
84
+ wraperClasses () {
85
+ return [
86
+ `${this.prefix}-wraper`,
87
+ this.showAll ? '' : 'show-when-hover'
88
+ ];
89
+ },
90
+ contentStyles () {
91
+ return {
92
+ transform: `translate3d(-${this.scrollOffsetX}px, -${this.scrollOffsetY}px, 0px)`,
93
+ width: this.disScrollX ? '100%' : 'auto',
94
+ height: this.disScrollY ? '100%' : 'auto'
95
+ };
96
+ },
97
+ percentY () {
98
+ return this.wraperSize.height / this.contentSize.height;
99
+ },
100
+ scrollYStyles () {
101
+ return Object.assign(this.scrollYStyle, {
102
+ height: this.percentX < 1 ? 'calc(100% - 14px)' : '100%'
103
+ });
104
+ },
105
+ scrollBarYHeight () {
106
+ return this.percentY * (this.wraperSize.height - 2);
107
+ },
108
+ scrollBarYStyles () {
109
+ let height = this.scrollBarYHeight;
110
+ return {
111
+ transform: `translate3d(0px, ${this.scrollOffsetY * (height / this.wraperSize.height)}px, 0px)`,
112
+ height: `${height}px`
113
+ };
114
+ },
115
+ scrollYClasses () {
116
+ return [
117
+ `${this.prefix}-scroll`,
118
+ `${this.prefix}-scroll-y`,
119
+ this.scrollYType === 'cover' ? 'scroll-y-cover' : ''
120
+ ];
121
+ },
122
+ gapY () {
123
+ return this.contentSize.height - this.wraperSize.height;
124
+ },
125
+ percentX () {
126
+ return this.wraperSize.width / this.contentSize.width;
127
+ },
128
+ scrollXStyles () {
129
+ return Object.assign(this.scrollXStyle, {
130
+ width: this.percentY < 1 ? 'calc(100% - 14px)' : '100%'
131
+ });
132
+ },
133
+ scrollBarXWidth () {
134
+ return this.percentX * (this.wraperSize.width - 2);
135
+ },
136
+ scrollBarXStyles () {
137
+ let width = this.scrollBarXWidth;
138
+ return {
139
+ transform: `translate3d(${this.scrollOffsetX * (width / this.wraperSize.width)}px, 0px, 0px)`,
140
+ width: `${width}px`
141
+ };
142
+ },
143
+ scrollXClasses () {
144
+ return [
145
+ `${this.prefix}-scroll`,
146
+ `${this.prefix}-scroll-x`,
147
+ this.scrollXType === 'cover' ? 'scroll-x-cover' : ''
148
+ ];
149
+ },
150
+ gapX () {
151
+ return this.contentSize.width - this.wraperSize.width;
152
+ }
153
+ },
154
+ methods: {
155
+ resize () {
156
+ this.$nextTick(() => {
157
+ let wraperRect = this.$refs.wraper.getBoundingClientRect();
158
+ let contentRect = this.$refs.content.getBoundingClientRect();
159
+ this.contentSize = {
160
+ width: contentRect.width,
161
+ height: contentRect.height
162
+ };
163
+ let percentXLowerThanOne = (wraperRect.width / contentRect.width) < 1;
164
+ let percentYLowerThanOne = (wraperRect.height / contentRect.height) < 1;
165
+ let gap = percentXLowerThanOne && percentYLowerThanOne ? 14 : 0;
166
+ this.wraperSize = {
167
+ width: wraperRect.width - gap,
168
+ height: wraperRect.height - gap
169
+ };
170
+ if (this.contentSize.height <= this.wraperSize.height) { // if main's height shorter than wraper's height
171
+ this.scrollOffsetY = 0;
172
+ };
173
+ if ((wraperRect.bottom > contentRect.bottom) && (this.scrollOffsetY > 0)) { // if main's bottom upper wraper's bottom
174
+ this.scrollOffsetY += contentRect.bottom - wraperRect.bottom;
175
+ };
176
+ });
177
+ },
178
+ handleMouseWheel (e) {
179
+ this.scrollOffsetY += this.percentY < 1 ? e.deltaY : 0;
180
+ this.scrollOffsetX += this.percentX < 1 ? e.deltaX : 0;
181
+ if (this.percentY < 1) {
182
+ if (this.scrollOffsetY >= this.gapY) {
183
+ this.scrollOffsetY = Math.min(this.gapY, this.scrollOffsetY);
184
+ } else if (this.scrollOffsetY <= 0) {
185
+ this.scrollOffsetY = Math.max(this.scrollOffsetY, 0);
186
+ }
187
+ }
188
+ if (this.percentX < 1) {
189
+ if (this.scrollOffsetX >= this.gapX) {
190
+ this.scrollOffsetX = Math.min(this.gapX, this.scrollOffsetX);
191
+ } else if (this.scrollOffsetX <= 0) {
192
+ this.scrollOffsetX = Math.max(this.scrollOffsetX, 0);
193
+ }
194
+ }
195
+ },
196
+ handleDOMMouseWheel (e) {
197
+ this.scrollOffsetY += e.detail * 16;
198
+ if (this.scrollOffsetY >= this.gapY) {
199
+ this.scrollOffsetY = Math.min(this.gapY, this.scrollOffsetY);
200
+ } else if (this.scrollOffsetY <= 0) {
201
+ this.scrollOffsetY = Math.max(this.scrollOffsetY, 0);
202
+ }
203
+ },
204
+ handleMousemoveY (e) {
205
+ let offset = e.pageY - this.initY;
206
+ this.scrollOffsetY = this.initOffsetY + offset / ((this.wraperSize.height - 2 - this.scrollBarYHeight) / (this.contentSize.height - this.wraperSize.height));
207
+ if (this.scrollOffsetY >= this.gapY) {
208
+ this.scrollOffsetY = Math.min(this.gapY, this.scrollOffsetY);
209
+ } else if (this.scrollOffsetY <= 0) {
210
+ this.scrollOffsetY = Math.max(this.scrollOffsetY, 0);
211
+ }
212
+ e.preventDefault();
213
+ },
214
+ handleMousedownScrollBarY (e) {
215
+ this.initY = e.pageY;
216
+ this.initOffsetY = this.scrollOffsetY;
217
+ document.addEventListener('mousemove', this.handleMousemoveY);
218
+ document.addEventListener('mouseup', this.handleMouseup);
219
+ },
220
+ handleMousemoveX (e) {
221
+ let offset = e.pageX - this.initX;
222
+ this.scrollOffsetX = this.initOffsetX + offset / ((this.wraperSize.width - 2 - this.scrollBarXWidth) / (this.contentSize.width - this.wraperSize.width));
223
+ if (this.scrollOffsetX >= this.gapX) {
224
+ this.scrollOffsetX = Math.min(this.gapX, this.scrollOffsetX);
225
+ } else if (this.scrollOffsetX <= 0) {
226
+ this.scrollOffsetX = Math.max(this.scrollOffsetX, 0);
227
+ }
228
+ e.preventDefault();
229
+ },
230
+ handleMousedownScrollBarX (e) {
231
+ this.initX = e.pageX;
232
+ this.initOffsetX = this.scrollOffsetX;
233
+ document.addEventListener('mousemove', this.handleMousemoveX);
234
+ document.addEventListener('mouseup', this.handleMouseup);
235
+ },
236
+ handleMouseup (e) {
237
+ document.removeEventListener('mousemove', this.handleMousemoveY);
238
+ document.removeEventListener('mousemove', this.handleMousemoveX);
239
+ document.removeEventListener('mousemove', this.handleMouseup);
240
+ }
241
+ },
242
+ mounted () {
243
+ this.resize();
244
+ }
245
+ };
246
+ </script>
247
+
248
+ <style lang="less">
249
+ /*@import 'index.less';*/
250
+ </style>
@@ -0,0 +1,7 @@
1
+ import Select from './select.vue';
2
+ import Option from 'iview/src/components/select/option.vue';
3
+ import OptionGroup from 'iview/src/components/select/option-group.vue';
4
+
5
+ export { Select, Option, OptionGroup };
6
+
7
+ export default Select;