@opentiny/vue-renderless 3.12.1 → 3.13.0-alpha.1
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/action-sheet/index.js +20 -13
- package/action-sheet/vue.js +8 -7
- package/alert/index.js +50 -1
- package/alert/vue.js +36 -9
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +20 -6
- package/calendar-view/index.js +10 -12
- package/calendar-view/vue.js +17 -4
- package/cascader/index.js +80 -34
- package/cascader/vue.js +49 -19
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +37 -24
- package/cascader-mobile/vue.js +7 -1
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cascader-view/index.js +1 -1
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +17 -0
- package/checkbox/vue.js +16 -7
- package/checkbox-group/vue.js +2 -0
- package/col/vue.js +3 -2
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/date.js +2 -0
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +48 -5
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +1 -1
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +22 -10
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/container/index.js +17 -1
- package/container/vue.js +12 -3
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +12 -5
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +17 -6
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +26 -5
- package/drawer/vue.js +13 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +21 -8
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +47 -12
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +3 -1
- package/form-item/index.js +4 -4
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/utils/common.js +10 -5
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -0
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +89 -22
- package/input/vue.js +52 -21
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/label/index.js +56 -0
- package/label/vue.js +26 -0
- package/link/vue.js +3 -1
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/mask/index.js +13 -0
- package/mask/vue.js +18 -0
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/multi-select/index.js +150 -10
- package/multi-select/vue.js +46 -11
- package/multi-select-item/index.js +17 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +51 -9
- package/numeric/vue.js +44 -14
- package/option/index.js +12 -5
- package/option/vue.js +15 -7
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +372 -0
- package/pager/vue.js +125 -2
- package/picker/index.js +253 -48
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/index.js +0 -2
- package/pop-upload/vue.js +3 -4
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +55 -24
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +57 -65
- package/pull-refresh/vue.js +23 -7
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +1 -1
- package/search/vue.js +3 -1
- package/select/index.js +176 -110
- package/select/vue.js +105 -20
- package/select-dropdown/index.js +62 -4
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +27 -7
- package/slider/vue.js +26 -7
- package/split/index.js +1 -1
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +9 -4
- package/tab-nav/vue.js +6 -2
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +1 -1
- package/tabs/vue.js +1 -0
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tag/index.js +1 -1
- package/tag/vue.js +5 -1
- package/tag-group/index.js +2 -1
- package/tall-storage/index.js +4 -5
- package/time/index.js +4 -1
- package/time/vue.js +1 -1
- package/time-line/vue.js +1 -1
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/time-spinner/index.js +0 -3
- package/time-spinner/vue.js +2 -3
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +1 -2
- package/tooltip/vue.js +3 -3
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +27 -3
- package/tree-menu/vue.js +27 -14
- package/tree-node/index.js +12 -10
- package/tree-node/vue.js +6 -5
- package/types/action-menu.type.d.ts +5 -0
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +16 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button.type.d.ts +5 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +327 -1
- package/types/checkbox.type.d.ts +9 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +34 -1
- package/types/dialog-box.type.d.ts +5 -1
- package/types/drawer.type.d.ts +132 -1
- package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +2 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +23 -9
- package/types/ip-address.type.d.ts +160 -1
- package/types/label.type.d.ts +81 -0
- package/types/link.type.d.ts +6 -3
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +4 -2
- package/types/numeric.type.d.ts +36 -9
- package/types/pager.type.d.ts +171 -1
- package/types/picker.type.d.ts +14 -0
- package/types/popconfirm.type.d.ts +85 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +8 -1
- package/types/steps.type.d.ts +14 -3
- package/types/tab-item.type.d.ts +0 -1
- package/types/tab-nav.type.d.ts +6 -1
- package/types/tabs.type.d.ts +5 -0
- package/types/tag-group.type.d.ts +64 -1
- package/types/tag.type.d.ts +12 -0
- package/types/tooltip.type.d.ts +1 -1
- package/types/transfer.type.d.ts +183 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +59 -29
- package/upload/vue.js +6 -4
- package/upload-list/index.js +14 -14
- package/upload-list/vue.js +5 -2
- package/user/index.js +5 -4
- package/user-head/index.js +1 -1
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
package/common/deps/popper.js
CHANGED
|
@@ -68,6 +68,22 @@ const isScrollElement = (el) => {
|
|
|
68
68
|
const scrollTypes = ["scroll", "auto"];
|
|
69
69
|
return scrollTypes.includes(getStyleComputedProperty(el, "overflow")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-x")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-y"));
|
|
70
70
|
};
|
|
71
|
+
const getAdjustOffset = (parent) => {
|
|
72
|
+
const placeholder = document.createElement("div");
|
|
73
|
+
setStyle(placeholder, {
|
|
74
|
+
opacity: 0,
|
|
75
|
+
position: "fixed",
|
|
76
|
+
width: 1,
|
|
77
|
+
height: 1,
|
|
78
|
+
top: 0,
|
|
79
|
+
left: 0,
|
|
80
|
+
"z-index": "-99"
|
|
81
|
+
});
|
|
82
|
+
parent.appendChild(placeholder);
|
|
83
|
+
const result = getBoundingClientRect(placeholder);
|
|
84
|
+
parent.removeChild(placeholder);
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
71
87
|
const getScrollParent = (el) => {
|
|
72
88
|
let parent = el.parentNode;
|
|
73
89
|
if (!parent) {
|
|
@@ -84,9 +100,14 @@ const getScrollParent = (el) => {
|
|
|
84
100
|
}
|
|
85
101
|
return getScrollParent(parent);
|
|
86
102
|
};
|
|
87
|
-
const getOffsetRectRelativeToCustomParent = (el, parent, fixed) => {
|
|
103
|
+
const getOffsetRectRelativeToCustomParent = (el, parent, fixed, popper) => {
|
|
88
104
|
let { top, left, width, height } = getBoundingClientRect(el);
|
|
89
105
|
if (fixed) {
|
|
106
|
+
if (popper.parentElement) {
|
|
107
|
+
const { top: adjustTop, left: adjustLeft } = getAdjustOffset(popper.parentElement);
|
|
108
|
+
top -= adjustTop;
|
|
109
|
+
left -= adjustLeft;
|
|
110
|
+
}
|
|
90
111
|
return {
|
|
91
112
|
top,
|
|
92
113
|
left,
|
|
@@ -161,6 +182,9 @@ const getOffsetRect = (el) => {
|
|
|
161
182
|
elementRect.bottom = elementRect.top + elementRect.height;
|
|
162
183
|
return elementRect;
|
|
163
184
|
};
|
|
185
|
+
const stopFn = (ev) => {
|
|
186
|
+
ev.stopPropagation();
|
|
187
|
+
};
|
|
164
188
|
class Popper {
|
|
165
189
|
constructor(reference, popper, options) {
|
|
166
190
|
this.modifiers = {};
|
|
@@ -192,6 +216,7 @@ class Popper {
|
|
|
192
216
|
}
|
|
193
217
|
update() {
|
|
194
218
|
let data = { instance: this, styles: {} };
|
|
219
|
+
this.stopEventBubble();
|
|
195
220
|
this.popperOuterSize = null;
|
|
196
221
|
data.placement = data._originalPlacement = this._options.placement;
|
|
197
222
|
data.offsets = this._getRefPopOffsets(this._popper, this._reference, data.placement);
|
|
@@ -199,6 +224,15 @@ class Popper {
|
|
|
199
224
|
data = this.runModifiers(data, this._options.modifierFns);
|
|
200
225
|
typeof this.state.updateCallback === "function" && this.state.updateCallback(data);
|
|
201
226
|
}
|
|
227
|
+
// 阻止popper的mousewheel等事件冒泡。 通过 onxxx 绑定,是为了避免重复绑定事件
|
|
228
|
+
stopEventBubble() {
|
|
229
|
+
if (!this._popper)
|
|
230
|
+
return;
|
|
231
|
+
if (!this._popper.onmousewheel)
|
|
232
|
+
this._popper.onmousewheel = stopFn;
|
|
233
|
+
if (!this._popper.onwheel)
|
|
234
|
+
this._popper.onwheel = stopFn;
|
|
235
|
+
}
|
|
202
236
|
/** 按顺序执行Modifiers, 如果传入终点modifier,则执行到指定位置 */
|
|
203
237
|
runModifiers(data, modifiers2, ends) {
|
|
204
238
|
let modifiersToRun = modifiers2.slice();
|
|
@@ -206,7 +240,7 @@ class Popper {
|
|
|
206
240
|
if (ends !== void 0) {
|
|
207
241
|
modifiersToRun = this._options.modifierFns.slice(
|
|
208
242
|
0,
|
|
209
|
-
_options.modifierFns.findIndex((m) => m
|
|
243
|
+
_options.modifierFns.findIndex((m) => m === ends)
|
|
210
244
|
);
|
|
211
245
|
}
|
|
212
246
|
modifiersToRun.forEach((modifier) => {
|
|
@@ -221,8 +255,12 @@ class Popper {
|
|
|
221
255
|
let styles = { position: data.offsets.popper.position };
|
|
222
256
|
let left = Math.round(data.offsets.popper.left);
|
|
223
257
|
let top = Math.round(data.offsets.popper.top);
|
|
224
|
-
|
|
225
|
-
|
|
258
|
+
if (this._options.gpuAcceleration) {
|
|
259
|
+
styles.transform = `translate3d(${left}px, ${top}px, 0)`;
|
|
260
|
+
Object.assign(styles, { top: 0, left: 0 });
|
|
261
|
+
} else {
|
|
262
|
+
Object.assign(styles, { top, left });
|
|
263
|
+
}
|
|
226
264
|
Object.assign(styles, data.styles);
|
|
227
265
|
setStyle(this._popper, styles);
|
|
228
266
|
this._popper.setAttribute("x-placement", data.placement);
|
|
@@ -416,7 +454,12 @@ class Popper {
|
|
|
416
454
|
placement = placement.split("-")[0];
|
|
417
455
|
let popperOffsets = { position: this.state.position };
|
|
418
456
|
let isParentFixed = popperOffsets.position === "fixed";
|
|
419
|
-
let referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
457
|
+
let referenceOffsets = getOffsetRectRelativeToCustomParent(
|
|
458
|
+
reference,
|
|
459
|
+
getOffsetParent(popper),
|
|
460
|
+
isParentFixed,
|
|
461
|
+
popper
|
|
462
|
+
);
|
|
420
463
|
const { width, height } = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = getOuterSizes(popper);
|
|
421
464
|
if (~["right", "left"].indexOf(placement)) {
|
|
422
465
|
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - height / 2;
|
|
@@ -24,6 +24,8 @@ class Touch {
|
|
|
24
24
|
this.screenY = pos.screenY + deltaY;
|
|
25
25
|
this.clientX = pos.clientX + deltaX;
|
|
26
26
|
this.clientY = pos.clientY + deltaY;
|
|
27
|
+
this.offsetX = pos.offsetX + deltaX;
|
|
28
|
+
this.offsetY = pos.offsetY + deltaY;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
const TouchList = () => {
|
|
@@ -69,7 +71,8 @@ const onMouse = (touchType) => (ev) => {
|
|
|
69
71
|
if (ev.type === "mousedown" || !mouseTarget) {
|
|
70
72
|
mouseTarget = ev.target;
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
eventTarget = closest(mouseTarget, "[data-tiny-touch-simulate-container]");
|
|
75
|
+
if (eventTarget && eventTarget.dispatchEvent) {
|
|
73
76
|
triggerTouch(touchType, ev);
|
|
74
77
|
}
|
|
75
78
|
if (ev.type === "mouseup") {
|
|
@@ -120,7 +120,7 @@ class Node {
|
|
|
120
120
|
});
|
|
121
121
|
const isLeafKey = ((_b = (_a = this.store) == null ? void 0 : _a.props) == null ? void 0 : _b.isLeaf) || defaultIsLeafKey;
|
|
122
122
|
this.isLeaf = !!(this.data && this.data[isLeafKey]);
|
|
123
|
-
this.loaded =
|
|
123
|
+
this.loaded = this.isLeaf;
|
|
124
124
|
this.loading = false;
|
|
125
125
|
this.childNodes = [];
|
|
126
126
|
this.level = this.parent ? this.parent.level + 1 : 0;
|
|
@@ -27,12 +27,11 @@ class TreeStore {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
filter(value) {
|
|
30
|
-
const { lazy,
|
|
30
|
+
const { lazy, filterNodeMethod } = this;
|
|
31
31
|
const walkTree = (node) => {
|
|
32
32
|
const childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
33
33
|
childNodes.forEach((child) => {
|
|
34
|
-
|
|
35
|
-
child.visible = filterNodeMethod.call(child, value, mappingData, child);
|
|
34
|
+
child.visible = filterNodeMethod.call(child, value, child.data, child);
|
|
36
35
|
walkTree(child);
|
|
37
36
|
});
|
|
38
37
|
if (!node.visible && childNodes.length) {
|
|
@@ -52,16 +51,6 @@ class TreeStore {
|
|
|
52
51
|
};
|
|
53
52
|
walkTree(this);
|
|
54
53
|
}
|
|
55
|
-
getMappingData(data) {
|
|
56
|
-
const props = this.props || {};
|
|
57
|
-
const mapping = {};
|
|
58
|
-
Object.keys(props).forEach((key) => {
|
|
59
|
-
if (hasOwn.call(props, key)) {
|
|
60
|
-
mapping[key] = data[props[key]];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return Object.assign(data, mapping);
|
|
64
|
-
}
|
|
65
54
|
setData(newVal) {
|
|
66
55
|
if (newVal !== this.root.data) {
|
|
67
56
|
this.root.setData(newVal);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
const isWindow = (val) => val === window;
|
|
3
|
+
const makeDOMRect = (width, height) => ({
|
|
4
|
+
top: 0,
|
|
5
|
+
left: 0,
|
|
6
|
+
width,
|
|
7
|
+
right: width,
|
|
8
|
+
height,
|
|
9
|
+
bottom: height
|
|
10
|
+
});
|
|
11
|
+
const useRect = (unref) => (elOrRef) => {
|
|
12
|
+
const el = unref(elOrRef);
|
|
13
|
+
if (isWindow(el)) {
|
|
14
|
+
const width = el.innerWidth;
|
|
15
|
+
const height = el.innerHeight;
|
|
16
|
+
return makeDOMRect(width, height);
|
|
17
|
+
}
|
|
18
|
+
if (el && el.getBoundingClientRect) {
|
|
19
|
+
return el.getBoundingClientRect();
|
|
20
|
+
}
|
|
21
|
+
return makeDOMRect(0, 0);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
useRect
|
|
25
|
+
};
|
|
@@ -6,13 +6,8 @@ import PopperJS from "./popper";
|
|
|
6
6
|
import { on } from "./dom";
|
|
7
7
|
const stop = (e) => e.stopPropagation();
|
|
8
8
|
const isServer = typeof window === "undefined";
|
|
9
|
-
const getReference = ({
|
|
10
|
-
state
|
|
11
|
-
props,
|
|
12
|
-
refs,
|
|
13
|
-
slots
|
|
14
|
-
}) => {
|
|
15
|
-
let reference = state.referenceElm || props.reference || refs.reference && refs.reference.$el || refs.reference;
|
|
9
|
+
const getReference = ({ state, props, vm, slots }) => {
|
|
10
|
+
let reference = state.referenceElm || props.reference || vm.$refs.reference && vm.$refs.reference.$el || vm.$refs.reference;
|
|
16
11
|
if (!reference && slots.reference && slots.reference()[0]) {
|
|
17
12
|
state.referenceElm = slots.reference()[0].elm || slots.reference()[0].el;
|
|
18
13
|
reference = state.referenceElm;
|
|
@@ -20,7 +15,20 @@ const getReference = ({
|
|
|
20
15
|
return reference;
|
|
21
16
|
};
|
|
22
17
|
var vue_popper_default = (options) => {
|
|
23
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
parent,
|
|
20
|
+
emit,
|
|
21
|
+
nextTick,
|
|
22
|
+
onBeforeUnmount,
|
|
23
|
+
onDeactivated,
|
|
24
|
+
props,
|
|
25
|
+
watch,
|
|
26
|
+
reactive,
|
|
27
|
+
vm,
|
|
28
|
+
slots,
|
|
29
|
+
toRefs,
|
|
30
|
+
popperVmRef
|
|
31
|
+
} = options;
|
|
24
32
|
const state = reactive({
|
|
25
33
|
popperJS: null,
|
|
26
34
|
appended: false,
|
|
@@ -56,9 +64,9 @@ var vue_popper_default = (options) => {
|
|
|
56
64
|
return;
|
|
57
65
|
}
|
|
58
66
|
const options2 = props.popperOptions || {};
|
|
59
|
-
state.popperElm = state.popperElm || props.popper || refs.popper;
|
|
67
|
+
state.popperElm = state.popperElm || props.popper || vm.$refs.popper || popperVmRef.popper;
|
|
60
68
|
const popper = state.popperElm;
|
|
61
|
-
let reference = getReference({ state, props,
|
|
69
|
+
let reference = getReference({ state, props, vm, slots });
|
|
62
70
|
if (!popper || !reference || reference.nodeType !== Node.ELEMENT_NODE) {
|
|
63
71
|
return;
|
|
64
72
|
}
|
|
@@ -91,6 +99,10 @@ var vue_popper_default = (options) => {
|
|
|
91
99
|
const popperJS = state.popperJS;
|
|
92
100
|
if (popperJS) {
|
|
93
101
|
popperJS.update();
|
|
102
|
+
if (popperJS._popper) {
|
|
103
|
+
popperJS._popper.style.zIndex = PopupManager.nextZIndex().toString();
|
|
104
|
+
followHide(state.popperJS);
|
|
105
|
+
}
|
|
94
106
|
} else {
|
|
95
107
|
createPopper();
|
|
96
108
|
}
|
package/common/index.js
CHANGED
package/common/runtime.js
CHANGED
|
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
|
|
|
22
22
|
import validate from "./validate";
|
|
23
23
|
import memorize from "./deps/memorize";
|
|
24
24
|
import * as common from ".";
|
|
25
|
-
const version = "3.
|
|
25
|
+
const version = "3.13.0-alpha.0";
|
|
26
26
|
const Renderless = {
|
|
27
27
|
browser,
|
|
28
28
|
array,
|
package/common/type.js
CHANGED
|
@@ -11,6 +11,7 @@ const class2type = {
|
|
|
11
11
|
"[object Date]": "date",
|
|
12
12
|
"[object Array]": "array",
|
|
13
13
|
"[object Function]": "function",
|
|
14
|
+
"[object AsyncFunction]": "asyncFunction",
|
|
14
15
|
"[object String]": "string",
|
|
15
16
|
"[object Number]": "number",
|
|
16
17
|
"[object Boolean]": "boolean"
|
|
@@ -18,7 +19,7 @@ const class2type = {
|
|
|
18
19
|
const isNull = (x) => x === null || x === void 0;
|
|
19
20
|
const typeOf = (obj) => isNull(obj) ? String(obj) : class2type[toString.call(obj)] || "object";
|
|
20
21
|
const isObject = (obj) => typeOf(obj) === "object";
|
|
21
|
-
const isFunction = (fn) => typeOf(fn)
|
|
22
|
+
const isFunction = (fn) => ["asyncFunction", "function"].includes(typeOf(fn));
|
|
22
23
|
const isPlainObject = (obj) => {
|
|
23
24
|
if (!obj || toString.call(obj) !== "[object Object]") {
|
|
24
25
|
return false;
|
|
@@ -4,7 +4,7 @@ const ENUM = "enum";
|
|
|
4
4
|
function enum_default(rule, checkValue, source, errors, options) {
|
|
5
5
|
rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
|
|
6
6
|
if (!rule[ENUM].includes(checkValue)) {
|
|
7
|
-
errors.push(util.format(options.messages[ENUM],
|
|
7
|
+
errors.push(util.format(options.messages[ENUM], "", rule[ENUM].join(", ")));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
@@ -5,12 +5,12 @@ function pattern_default(rule, checkValue, source, errors, options) {
|
|
|
5
5
|
if (rule.pattern instanceof RegExp) {
|
|
6
6
|
rule.pattern.lastIndex = 0;
|
|
7
7
|
if (!rule.pattern.test(checkValue)) {
|
|
8
|
-
errors.push(util.format(options.messages.pattern.mismatch,
|
|
8
|
+
errors.push(util.format(options.messages.pattern.mismatch, "", checkValue, rule.pattern));
|
|
9
9
|
}
|
|
10
10
|
} else if (typeof rule.pattern === "string") {
|
|
11
11
|
const _pattern = new RegExp(rule.pattern);
|
|
12
12
|
if (!_pattern.test(checkValue)) {
|
|
13
|
-
errors.push(util.format(options.messages.pattern.mismatch,
|
|
13
|
+
errors.push(util.format(options.messages.pattern.mismatch, "", checkValue, rule.pattern));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -4,11 +4,11 @@ import { isNumber } from "../../type";
|
|
|
4
4
|
import { getLength } from "../../string";
|
|
5
5
|
function getErro({ min, max, val, key, rule, errors, util: util2, options }) {
|
|
6
6
|
if (min && !max && val < rule.min) {
|
|
7
|
-
errors.push(util2.format(options.messages[key].min,
|
|
7
|
+
errors.push(util2.format(options.messages[key].min, "", rule.min));
|
|
8
8
|
} else if (max && !min && val > rule.max) {
|
|
9
|
-
errors.push(util2.format(options.messages[key].max,
|
|
9
|
+
errors.push(util2.format(options.messages[key].max, "", rule.max));
|
|
10
10
|
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
11
|
-
errors.push(util2.format(options.messages[key].range,
|
|
11
|
+
errors.push(util2.format(options.messages[key].range, "", rule.min, rule.max));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
function range_default(rule, checkValue, source, errors, options) {
|
|
@@ -17,7 +17,7 @@ function range_default(rule, checkValue, source, errors, options) {
|
|
|
17
17
|
const max = isNumber(rule.max);
|
|
18
18
|
let val = checkValue;
|
|
19
19
|
let key = null;
|
|
20
|
-
const num = isNumber(checkValue);
|
|
20
|
+
const num = isNumber(Number(checkValue));
|
|
21
21
|
const str = typeof checkValue === "string";
|
|
22
22
|
const arr = Array.isArray(checkValue);
|
|
23
23
|
if (num) {
|
|
@@ -36,9 +36,12 @@ function range_default(rule, checkValue, source, errors, options) {
|
|
|
36
36
|
if (str) {
|
|
37
37
|
val = getLength(checkValue, "string");
|
|
38
38
|
}
|
|
39
|
+
if (rule.type === "number") {
|
|
40
|
+
val = checkValue;
|
|
41
|
+
}
|
|
39
42
|
if (len) {
|
|
40
43
|
if (val !== rule.len) {
|
|
41
|
-
errors.push(util.format(options.messages[key].len,
|
|
44
|
+
errors.push(util.format(options.messages[key].len, "", rule.len));
|
|
42
45
|
}
|
|
43
46
|
} else {
|
|
44
47
|
getErro({ min, max, val, key, rule, errors, util, options });
|
|
@@ -3,7 +3,7 @@ import * as util from "../util";
|
|
|
3
3
|
import { hasOwn } from "../../type";
|
|
4
4
|
function required_default({ rule, checkValue, source, errors, options, type }) {
|
|
5
5
|
if (rule.required && (!hasOwn.call(source, rule.field) || util.isEmptyValue(checkValue, type || rule.type))) {
|
|
6
|
-
errors.push(util.format(options.messages.required,
|
|
6
|
+
errors.push(util.format(options.messages.required, ""));
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
@@ -17,11 +17,11 @@ const pattern = {
|
|
|
17
17
|
speczh: /^[0-9a-zA-Z_\u4E00-\u9FA5]+$/,
|
|
18
18
|
specialch: /^[0-9a-zA-Z_\-.]+$/,
|
|
19
19
|
specialch2: /^[0-9a-zA-Z_-]+$/,
|
|
20
|
-
url: /^([a-zA-Z]{3,})
|
|
20
|
+
url: /^(([a-zA-Z]{3,}):)?\/\/([\w-]+\.)+[\w]+(\/[a-zA-Z- ./?%&=]*)?/i,
|
|
21
21
|
version: /^\d+\.\d+(\.\d+)*$/
|
|
22
22
|
};
|
|
23
23
|
const types = {
|
|
24
|
-
integer: (value) => types.number(value) &&
|
|
24
|
+
integer: (value) => types.number(value) && /^[-]?[\d]+$/.test(value),
|
|
25
25
|
float: (value) => types.number(value) && !types.integer(value),
|
|
26
26
|
array: Array.isArray,
|
|
27
27
|
regexp(value) {
|
|
@@ -35,7 +35,7 @@ const types = {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
date: isDate,
|
|
38
|
-
number: isNumber,
|
|
38
|
+
number: (value) => isNumber(Number(value)),
|
|
39
39
|
object: (value) => isObject(value) && !types.array(value),
|
|
40
40
|
method: (value) => typeOf(value) === "function",
|
|
41
41
|
email: (value) => isNullOrEmpty(value) || !!value.match(pattern.email) && value.length < 255,
|
|
@@ -89,10 +89,10 @@ function type_default(rule, value, source, errors, options) {
|
|
|
89
89
|
const ruleType = rule.type;
|
|
90
90
|
if (custom.includes(ruleType)) {
|
|
91
91
|
if (!types[ruleType](value)) {
|
|
92
|
-
errors.push(util.format(options.messages.types[ruleType],
|
|
92
|
+
errors.push(util.format(options.messages.types[ruleType], "", rule.type));
|
|
93
93
|
}
|
|
94
94
|
} else if (ruleType && typeof value !== rule.type) {
|
|
95
|
-
errors.push(util.format(options.messages.types[ruleType],
|
|
95
|
+
errors.push(util.format(options.messages.types[ruleType], "", rule.type));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
export {
|
|
@@ -2,7 +2,7 @@ import "../../../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import * as util from "../util";
|
|
3
3
|
function whitespace_default(rule, checkValue, source, errors, options) {
|
|
4
4
|
if (/^\s+$/.test(checkValue) || checkValue === "") {
|
|
5
|
-
errors.push(util.format(options.messages.whitespace,
|
|
5
|
+
errors.push(util.format(options.messages.whitespace, ""));
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export {
|
package/common/validate/util.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import { hasOwn, isNull } from "../type";
|
|
5
5
|
import { log } from "../xss";
|
|
6
6
|
const formatRegExp = /%[sdj%]/g;
|
|
7
|
-
|
|
7
|
+
const warning = () => void 0;
|
|
8
8
|
function convertFieldsError(errors) {
|
|
9
9
|
if (!errors || !errors.length) {
|
|
10
10
|
return null;
|
|
@@ -17,15 +17,14 @@ function convertFieldsError(errors) {
|
|
|
17
17
|
});
|
|
18
18
|
return fields;
|
|
19
19
|
}
|
|
20
|
-
function format(...
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const len = args.length;
|
|
24
|
-
if (typeof checkData === "function") {
|
|
25
|
-
return checkData.apply(null, args.slice(1));
|
|
20
|
+
function format(i18nTemplate, ...rest) {
|
|
21
|
+
if (typeof i18nTemplate === "function") {
|
|
22
|
+
return i18nTemplate(...rest);
|
|
26
23
|
}
|
|
27
|
-
if (typeof
|
|
28
|
-
let
|
|
24
|
+
if (typeof i18nTemplate === "string") {
|
|
25
|
+
let i = 0;
|
|
26
|
+
const len = rest.length;
|
|
27
|
+
let str = String(i18nTemplate).replace(formatRegExp, (matchChar) => {
|
|
29
28
|
if (matchChar === "%%") {
|
|
30
29
|
return "%";
|
|
31
30
|
}
|
|
@@ -35,21 +34,21 @@ function format(...args) {
|
|
|
35
34
|
switch (matchChar) {
|
|
36
35
|
case "%j":
|
|
37
36
|
try {
|
|
38
|
-
return JSON.stringify(
|
|
37
|
+
return JSON.stringify(rest[i++]);
|
|
39
38
|
} catch (e) {
|
|
40
39
|
return "[Circular]";
|
|
41
40
|
}
|
|
42
41
|
case "%d":
|
|
43
|
-
return Number(
|
|
42
|
+
return Number(rest[i++]);
|
|
44
43
|
case "%s":
|
|
45
|
-
return String(
|
|
44
|
+
return String(rest[i++]);
|
|
46
45
|
default:
|
|
47
46
|
return matchChar;
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
return str;
|
|
51
50
|
}
|
|
52
|
-
return
|
|
51
|
+
return i18nTemplate;
|
|
53
52
|
}
|
|
54
53
|
function isNativeStringType(type) {
|
|
55
54
|
return [
|
|
@@ -93,7 +92,7 @@ function asyncParallelArray(arrData, func, callback) {
|
|
|
93
92
|
const results = [];
|
|
94
93
|
const arrLength = arrData.length;
|
|
95
94
|
function checkCount(errors) {
|
|
96
|
-
results.push
|
|
95
|
+
results.push(...errors);
|
|
97
96
|
count++;
|
|
98
97
|
if (count === arrLength) {
|
|
99
98
|
callback(results);
|
|
@@ -124,7 +123,7 @@ function asyncSerialArray(arr, fn, cb) {
|
|
|
124
123
|
function flattenObjArr(objArr) {
|
|
125
124
|
const result = [];
|
|
126
125
|
Object.keys(objArr).forEach((item) => {
|
|
127
|
-
result.push
|
|
126
|
+
result.push(...objArr[item]);
|
|
128
127
|
});
|
|
129
128
|
return result;
|
|
130
129
|
}
|
|
@@ -153,7 +152,7 @@ function asyncMap(objArray, option, func, callback) {
|
|
|
153
152
|
const pending = new Promise((resolve, reject) => {
|
|
154
153
|
const errorFn = reject;
|
|
155
154
|
const next = (errors) => {
|
|
156
|
-
results.push
|
|
155
|
+
results.push(...errors);
|
|
157
156
|
total++;
|
|
158
157
|
if (total === objArrLength) {
|
|
159
158
|
callback(results);
|
|
@@ -10,7 +10,7 @@ function integer_default(rule, checkValue, callback, source, options) {
|
|
|
10
10
|
return callback();
|
|
11
11
|
}
|
|
12
12
|
rules.required({ rule, checkValue, source, errors, options });
|
|
13
|
-
if (void 0 !==
|
|
13
|
+
if (checkValue !== void 0 && checkValue !== "") {
|
|
14
14
|
rules.type(rule, checkValue, source, errors, options);
|
|
15
15
|
rules.range(rule, checkValue, source, errors, options);
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ function method_default(rule, checkValue, callback, source, options) {
|
|
|
10
10
|
return callback();
|
|
11
11
|
}
|
|
12
12
|
rules.required({ rule, checkValue, source, errors, options });
|
|
13
|
-
if (void 0
|
|
13
|
+
if (checkValue !== void 0) {
|
|
14
14
|
rules.type(rule, checkValue, source, errors, options);
|
|
15
15
|
}
|
|
16
16
|
}
|
package/container/index.js
CHANGED
|
@@ -73,12 +73,28 @@ const computedFooterStyle = ({ constants, props }) => () => {
|
|
|
73
73
|
height: transferWidthOrHeight(props.footerHeight)
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
+
const computedLeftStyle = ({ constants, props }) => () => {
|
|
77
|
+
return {
|
|
78
|
+
width: transferWidthOrHeight(props.leftWidth)
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const computedShowRight = ({ constants, props }) => () => {
|
|
82
|
+
return props.pattern === constants.DEFAULT ? false : true;
|
|
83
|
+
};
|
|
84
|
+
const computedRightStyle = ({ constants, props }) => () => {
|
|
85
|
+
return {
|
|
86
|
+
width: transferWidthOrHeight(props.rightWidth)
|
|
87
|
+
};
|
|
88
|
+
};
|
|
76
89
|
export {
|
|
77
90
|
computedAsideStyle,
|
|
78
91
|
computedFooterStyle,
|
|
79
92
|
computedHeaderStyle,
|
|
93
|
+
computedLeftStyle,
|
|
80
94
|
computedMainStyle,
|
|
95
|
+
computedRightStyle,
|
|
81
96
|
computedShowAside,
|
|
82
97
|
computedShowFooter,
|
|
83
|
-
computedShowHeader
|
|
98
|
+
computedShowHeader,
|
|
99
|
+
computedShowRight
|
|
84
100
|
};
|
package/container/vue.js
CHANGED
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
computedHeaderStyle,
|
|
7
7
|
computedAsideStyle,
|
|
8
8
|
computedMainStyle,
|
|
9
|
-
computedFooterStyle
|
|
9
|
+
computedFooterStyle,
|
|
10
|
+
computedLeftStyle,
|
|
11
|
+
computedShowRight,
|
|
12
|
+
computedRightStyle
|
|
10
13
|
} from "./index";
|
|
11
14
|
const api = ["state"];
|
|
12
15
|
const renderless = (props, { computed, reactive }, { constants }) => {
|
|
@@ -18,7 +21,10 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
18
21
|
mainStyle: computed(() => api2.computedMainStyle()),
|
|
19
22
|
asideStyle: computed(() => api2.computedAsideStyle()),
|
|
20
23
|
headerStyle: computed(() => api2.computedHeaderStyle()),
|
|
21
|
-
footerStyle: computed(() => api2.computedFooterStyle())
|
|
24
|
+
footerStyle: computed(() => api2.computedFooterStyle()),
|
|
25
|
+
showRight: computed(() => api2.computedShowRight()),
|
|
26
|
+
leftStyle: computed(() => api2.computedLeftStyle()),
|
|
27
|
+
rightStyle: computed(() => api2.computedRightStyle())
|
|
22
28
|
});
|
|
23
29
|
Object.assign(api2, {
|
|
24
30
|
state,
|
|
@@ -28,7 +34,10 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
28
34
|
computedMainStyle: computedMainStyle({ constants, props }),
|
|
29
35
|
computedAsideStyle: computedAsideStyle({ constants, props }),
|
|
30
36
|
computedHeaderStyle: computedHeaderStyle({ constants, props }),
|
|
31
|
-
computedFooterStyle: computedFooterStyle({ constants, props })
|
|
37
|
+
computedFooterStyle: computedFooterStyle({ constants, props }),
|
|
38
|
+
computedLeftStyle: computedLeftStyle({ constants, props }),
|
|
39
|
+
computedShowRight: computedShowRight({ constants, props }),
|
|
40
|
+
computedRightStyle: computedRightStyle({ constants, props })
|
|
32
41
|
});
|
|
33
42
|
return api2;
|
|
34
43
|
};
|