@mdsfe/mds-ui 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +778 -0
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/_locale/index.js +18 -0
- package/dist/_locale/zh-CN.js +123 -0
- package/dist/_mixin/emitter.js +35 -0
- package/dist/_mixin/focus.js +13 -0
- package/dist/_mixin/locale.js +17 -0
- package/dist/_mixin/popper.js +192 -0
- package/dist/_mixin/tooltip.js +218 -0
- package/dist/_util/__test__/switchcase.test.js +43 -0
- package/dist/_util/autoprefixer.js +249 -0
- package/dist/_util/clickoutside.js +79 -0
- package/dist/_util/date.js +368 -0
- package/dist/_util/dateUtil.js +311 -0
- package/dist/_util/dom.js +240 -0
- package/dist/_util/getRequestAnimationFrame.js +50 -0
- package/dist/_util/getScroll.js +21 -0
- package/dist/_util/loaders/loaders.css.js +52 -0
- package/dist/_util/loaders/loading.js +53 -0
- package/dist/_util/merge.js +18 -0
- package/dist/_util/popper.js +1261 -0
- package/dist/_util/popup/index.js +232 -0
- package/dist/_util/popup/popup-manager.js +205 -0
- package/dist/_util/proptype.js +12 -0
- package/dist/_util/repeatClick.js +30 -0
- package/dist/_util/resize.js +61 -0
- package/dist/_util/resizeEvent.js +59 -0
- package/dist/_util/scrollIntoView.js +38 -0
- package/dist/_util/scrollbar-width.js +37 -0
- package/dist/_util/soda.js +54 -0
- package/dist/_util/switchcase.js +22 -0
- package/dist/_util/throttleByAnimationFrame.js +70 -0
- package/dist/_util/tree/node.js +412 -0
- package/dist/_util/tree/tree.js +410 -0
- package/dist/_util/util.js +166 -0
- package/dist/_util/vue-popper.js +213 -0
- package/dist/affix.js +509 -0
- package/dist/anchor.js +522 -0
- package/dist/avatar.js +437 -0
- package/dist/backtop.js +469 -0
- package/dist/badge.js +439 -0
- package/dist/bordershadow.js +310 -0
- package/dist/breadcrumb.js +434 -0
- package/dist/button.js +579 -0
- package/dist/card.js +514 -0
- package/dist/carousel.js +1326 -0
- package/dist/cascaderpanel.js +2320 -0
- package/dist/checkbox.js +681 -0
- package/dist/col.js +546 -0
- package/dist/collapse.js +671 -0
- package/dist/color.js +306 -0
- package/dist/datepicker.js +8089 -0
- package/dist/divider.js +346 -0
- package/dist/drawer.js +652 -0
- package/dist/dropdown.js +687 -0
- package/dist/empty.js +416 -0
- package/dist/font.js +306 -0
- package/dist/form.js +878 -0
- package/dist/icon.js +401 -0
- package/dist/index.js +1 -0
- package/dist/input.js +1251 -0
- package/dist/inputnumber.js +689 -0
- package/dist/layout.js +786 -0
- package/dist/list.js +789 -0
- package/dist/loading.js +430 -0
- package/dist/mds-ui.min.css +7 -0
- package/dist/mds-ui.min.js +64911 -0
- package/dist/menu.js +1131 -0
- package/dist/message.js +1016 -0
- package/dist/modal.js +895 -0
- package/dist/notification.js +818 -0
- package/dist/pagination.js +1213 -0
- package/dist/popconfirm.js +336 -0
- package/dist/popover.js +206 -0
- package/dist/progress.js +1023 -0
- package/dist/radio.js +760 -0
- package/dist/rate.js +765 -0
- package/dist/row.js +546 -0
- package/dist/select.js +4950 -0
- package/dist/slider.js +1411 -0
- package/dist/slottable.js +1414 -0
- package/dist/steps.js +546 -0
- package/dist/style/affix.css +5524 -0
- package/dist/style/anchor.css +5572 -0
- package/dist/style/avatar.css +5587 -0
- package/dist/style/backtop.css +34 -0
- package/dist/style/badge.css +5655 -0
- package/dist/style/bordershadow.css +5601 -0
- package/dist/style/breadcrumb.css +5551 -0
- package/dist/style/button.css +7679 -0
- package/dist/style/card.css +5670 -0
- package/dist/style/carousel.css +5731 -0
- package/dist/style/cascaderpanel.css +125 -0
- package/dist/style/checkbox.css +5700 -0
- package/dist/style/col.css +8121 -0
- package/dist/style/collapse.css +5593 -0
- package/dist/style/color.css +6136 -0
- package/dist/style/datepicker.css +5977 -0
- package/dist/style/divider.css +5558 -0
- package/dist/style/drawer.css +7979 -0
- package/dist/style/dropdown.css +7950 -0
- package/dist/style/empty.css +5563 -0
- package/dist/style/font.css +5559 -0
- package/dist/style/form.css +5662 -0
- package/dist/style/icon.css +5538 -0
- package/dist/style/input.css +6256 -0
- package/dist/style/inputnumber.css +5828 -0
- package/dist/style/layout.css +5572 -0
- package/dist/style/list.css +5655 -0
- package/dist/style/loading.css +5540 -0
- package/dist/style/menu.css +6183 -0
- package/dist/style/message.css +194 -0
- package/dist/style/modal.css +5637 -0
- package/dist/style/notification.css +5706 -0
- package/dist/style/pagination.css +6683 -0
- package/dist/style/popconfirm.css +7951 -0
- package/dist/style/popover.css +5727 -0
- package/dist/style/progress.css +5714 -0
- package/dist/style/radio.css +5769 -0
- package/dist/style/rate.css +5616 -0
- package/dist/style/row.css +8121 -0
- package/dist/style/select.css +5729 -0
- package/dist/style/slider.css +5594 -0
- package/dist/style/slottable.css +5831 -0
- package/dist/style/steps.css +6100 -0
- package/dist/style/switch.css +5624 -0
- package/dist/style/table.css +8392 -0
- package/dist/style/tabs.css +6047 -0
- package/dist/style/tag.css +5935 -0
- package/dist/style/text.css +5636 -0
- package/dist/style/timeline.css +5602 -0
- package/dist/style/timepicker.css +5904 -0
- package/dist/style/tooltip.css +5686 -0
- package/dist/style/transfer.css +101 -0
- package/dist/style/transition.css +1417 -0
- package/dist/style/tree.css +5598 -0
- package/dist/style/typography.css +5640 -0
- package/dist/style/upload.css +5834 -0
- package/dist/switch.js +448 -0
- package/dist/table.js +3809 -0
- package/dist/tabs.js +1273 -0
- package/dist/tag.js +478 -0
- package/dist/text.js +1100 -0
- package/dist/timeline.js +495 -0
- package/dist/timepicker.js +1567 -0
- package/dist/tooltip.js +179 -0
- package/dist/transfer.js +981 -0
- package/dist/transition.js +246 -0
- package/dist/tree.js +1866 -0
- package/dist/typography.js +469 -0
- package/dist/upload.js +1990 -0
- package/package.json +144 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _vue = require('vue');
|
|
6
|
+
|
|
7
|
+
var _vue2 = _interopRequireDefault(_vue);
|
|
8
|
+
|
|
9
|
+
var _popup = require('./popup');
|
|
10
|
+
|
|
11
|
+
var _popper = require('./popper.js');
|
|
12
|
+
|
|
13
|
+
var _popper2 = _interopRequireDefault(_popper);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
// todo 可以替换但是 替换后功能有差异 待定
|
|
18
|
+
// import PopperJS2 from 'popper.js'
|
|
19
|
+
var PopperJS = _vue2.default.prototype.$isServer ? function () {} : _popper2.default;
|
|
20
|
+
var stop = function stop(e) {
|
|
21
|
+
return e.stopPropagation();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
|
26
|
+
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
|
|
27
|
+
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
|
|
28
|
+
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
|
|
29
|
+
* @param {Boolean} [visible=false] Visibility of the popup element.
|
|
30
|
+
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
|
|
31
|
+
*/
|
|
32
|
+
exports.default = {
|
|
33
|
+
props: {
|
|
34
|
+
transformOrigin: {
|
|
35
|
+
type: [Boolean, String],
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
placement: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'bottom'
|
|
41
|
+
},
|
|
42
|
+
boundariesPadding: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 5
|
|
45
|
+
},
|
|
46
|
+
reference: {},
|
|
47
|
+
popper: {},
|
|
48
|
+
offset: {
|
|
49
|
+
default: 0
|
|
50
|
+
},
|
|
51
|
+
value: Boolean,
|
|
52
|
+
visibleArrow: Boolean,
|
|
53
|
+
arrowOffset: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 35
|
|
56
|
+
},
|
|
57
|
+
appendToBody: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true
|
|
60
|
+
},
|
|
61
|
+
popperOptions: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: function _default() {
|
|
64
|
+
return {
|
|
65
|
+
gpuAcceleration: false
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
data: function data() {
|
|
72
|
+
return {
|
|
73
|
+
showPopper: false,
|
|
74
|
+
currentPlacement: ''
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
watch: {
|
|
80
|
+
value: {
|
|
81
|
+
immediate: true,
|
|
82
|
+
handler: function handler(val) {
|
|
83
|
+
this.showPopper = val;
|
|
84
|
+
this.$emit('input', val);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
showPopper: function showPopper(val) {
|
|
89
|
+
if (this.disabled) return;
|
|
90
|
+
val ? this.updatePopper() : this.destroyPopper();
|
|
91
|
+
this.$emit('input', val);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
methods: {
|
|
96
|
+
createPopper: function createPopper() {
|
|
97
|
+
var _this = this;
|
|
98
|
+
|
|
99
|
+
if (this.$isServer) return;
|
|
100
|
+
this.currentPlacement = this.currentPlacement || this.placement;
|
|
101
|
+
if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var options = this.popperOptions;
|
|
106
|
+
var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
|
|
107
|
+
var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
|
|
108
|
+
|
|
109
|
+
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
|
110
|
+
reference = this.referenceElm = this.$slots.reference[0].elm;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!popper || !reference) return;
|
|
114
|
+
if (this.visibleArrow) this.appendArrow(popper);
|
|
115
|
+
if (this.appendToBody) document.body.appendChild(this.popperElm);
|
|
116
|
+
if (this.popperJS && this.popperJS.destroy) {
|
|
117
|
+
this.popperJS.destroy();
|
|
118
|
+
}
|
|
119
|
+
options.placement = this.currentPlacement;
|
|
120
|
+
options.offset = this.offset;
|
|
121
|
+
options.arrowOffset = this.arrowOffset;
|
|
122
|
+
this.popperJS = new PopperJS(reference, popper, options);
|
|
123
|
+
this.popperJS.onCreate(function (_) {
|
|
124
|
+
_this.$emit('created', _this);
|
|
125
|
+
_this.resetTransformOrigin();
|
|
126
|
+
_this.$nextTick(_this.updatePopper);
|
|
127
|
+
});
|
|
128
|
+
if (typeof options.onUpdate === 'function') {
|
|
129
|
+
this.popperJS.onUpdate(options.onUpdate);
|
|
130
|
+
}
|
|
131
|
+
this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
|
|
132
|
+
this.popperElm.addEventListener('click', stop);
|
|
133
|
+
},
|
|
134
|
+
updatePopper: function updatePopper() {
|
|
135
|
+
var popperJS = this.popperJS;
|
|
136
|
+
if (popperJS) {
|
|
137
|
+
popperJS.update();
|
|
138
|
+
if (popperJS._popper) {
|
|
139
|
+
popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
this.createPopper();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
doDestroy: function doDestroy(forceDestroy) {
|
|
146
|
+
/* istanbul ignore if */
|
|
147
|
+
if (!this.popperJS || this.showPopper && !forceDestroy) return;
|
|
148
|
+
if (!forceDestroy) {
|
|
149
|
+
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
|
150
|
+
this.popperElm.removeEventListener('click', stop);
|
|
151
|
+
document.body.removeChild(this.popperElm);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this.popperJS.destroy();
|
|
155
|
+
this.popperJS = null;
|
|
156
|
+
},
|
|
157
|
+
destroyPopper: function destroyPopper() {
|
|
158
|
+
if (this.popperJS) {
|
|
159
|
+
this.resetTransformOrigin();
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
resetTransformOrigin: function resetTransformOrigin() {
|
|
163
|
+
if (!this.transformOrigin) return;
|
|
164
|
+
var placementMap = {
|
|
165
|
+
top: 'bottom',
|
|
166
|
+
bottom: 'top',
|
|
167
|
+
left: 'right',
|
|
168
|
+
right: 'left'
|
|
169
|
+
};
|
|
170
|
+
var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
|
|
171
|
+
var origin = placementMap[placement];
|
|
172
|
+
this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
|
|
173
|
+
},
|
|
174
|
+
appendArrow: function appendArrow(element) {
|
|
175
|
+
var hash = void 0;
|
|
176
|
+
if (this.appended) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
this.appended = true;
|
|
181
|
+
|
|
182
|
+
for (var item in element.attributes) {
|
|
183
|
+
if (/^_v-/.test(element.attributes[item].name)) {
|
|
184
|
+
hash = element.attributes[item].name;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
var arrow = document.createElement('div');
|
|
190
|
+
|
|
191
|
+
if (hash) {
|
|
192
|
+
arrow.setAttribute(hash, '');
|
|
193
|
+
}
|
|
194
|
+
arrow.setAttribute('x-arrow', '');
|
|
195
|
+
arrow.className = 'popper__arrow';
|
|
196
|
+
element.appendChild(arrow);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
beforeDestroy: function beforeDestroy() {
|
|
201
|
+
this.doDestroy(true);
|
|
202
|
+
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
|
203
|
+
this.popperElm.removeEventListener('click', stop);
|
|
204
|
+
document.body.removeChild(this.popperElm);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
// call destroy in keep-alive mode
|
|
210
|
+
deactivated: function deactivated() {
|
|
211
|
+
this.$options.beforeDestroy[0].call(this);
|
|
212
|
+
}
|
|
213
|
+
};
|