@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
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { preventDefault } from "../common/deps/dom";
|
|
3
|
+
const getOffsetPosition = ({ touch, state }) => {
|
|
4
|
+
let offsetY = 0;
|
|
5
|
+
let offsetX = 0;
|
|
6
|
+
if (state.current === "default" && state.isFullscreen) {
|
|
7
|
+
offsetY = state.canvasRect.width - touch.clientX + (state.canvasRect.left || 0);
|
|
8
|
+
offsetX = touch.clientY - (state.canvasRect.top || 0);
|
|
9
|
+
} else {
|
|
10
|
+
offsetX = touch.clientX - (state.canvasRect.left || 0);
|
|
11
|
+
offsetY = touch.clientY - (state.canvasRect.top || 0);
|
|
12
|
+
}
|
|
13
|
+
return { offsetX, offsetY };
|
|
14
|
+
};
|
|
15
|
+
const redraw = ({ state, props, nextTick }) => ({ oldWidth, oldHeight }) => {
|
|
16
|
+
if (Date.now() - state.lastRedrawDate < 100) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
state.lastRedrawDate = Date.now();
|
|
20
|
+
nextTick(() => {
|
|
21
|
+
const context = state.ctx;
|
|
22
|
+
context.lineWidth = props.lineWidth;
|
|
23
|
+
context.strokeStyle = props.penColor;
|
|
24
|
+
context.beginPath();
|
|
25
|
+
state.ctx.lineJoin = "round";
|
|
26
|
+
state.paths.forEach((point) => {
|
|
27
|
+
point.offsetX *= state.width / oldWidth;
|
|
28
|
+
point.offsetY *= state.height / oldHeight;
|
|
29
|
+
if (point.isStart) {
|
|
30
|
+
context.moveTo(point.offsetX, point.offsetY);
|
|
31
|
+
} else {
|
|
32
|
+
context.lineTo(point.offsetX, point.offsetY);
|
|
33
|
+
context.stroke();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const touchStart = ({ emit, props, state, vm, api, useRect }) => () => {
|
|
39
|
+
if (!state.ctx) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (!state.isBeginWrite) {
|
|
43
|
+
api.rewrite(true);
|
|
44
|
+
}
|
|
45
|
+
state.canvasRect = useRect(vm.$refs.canvasRef);
|
|
46
|
+
state.ctx.lineWidth = props.lineWidth;
|
|
47
|
+
state.ctx.strokeStyle = props.penColor;
|
|
48
|
+
const touch = event.touches[0];
|
|
49
|
+
if (!touch.offsetX) {
|
|
50
|
+
const pos = getOffsetPosition({ touch, state });
|
|
51
|
+
touch.offsetX = pos.offsetX;
|
|
52
|
+
touch.offsetY = pos.offsetY;
|
|
53
|
+
}
|
|
54
|
+
state.isDrawing = true;
|
|
55
|
+
const point = {
|
|
56
|
+
isStart: true,
|
|
57
|
+
offsetX: touch.offsetX,
|
|
58
|
+
offsetY: touch.offsetY
|
|
59
|
+
};
|
|
60
|
+
state.paths.push(point);
|
|
61
|
+
state.ctx.beginPath();
|
|
62
|
+
state.ctx.lineJoin = "round";
|
|
63
|
+
state.ctx.moveTo(touch.offsetX, touch.offsetY);
|
|
64
|
+
emit("start");
|
|
65
|
+
};
|
|
66
|
+
const touchMove = ({ emit, state }) => (e) => {
|
|
67
|
+
if (!state.ctx) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
preventDefault(e);
|
|
71
|
+
const touch = event.touches[0];
|
|
72
|
+
if (state.isDrawing) {
|
|
73
|
+
if (!touch.offsetX) {
|
|
74
|
+
const pos = getOffsetPosition({ touch, state });
|
|
75
|
+
touch.offsetX = pos.offsetX;
|
|
76
|
+
touch.offsetY = pos.offsetY;
|
|
77
|
+
}
|
|
78
|
+
state.ctx.lineTo(touch.offsetX, touch.offsetY);
|
|
79
|
+
state.ctx.stroke();
|
|
80
|
+
const point = {
|
|
81
|
+
isStart: false,
|
|
82
|
+
offsetX: touch.offsetX,
|
|
83
|
+
offsetY: touch.offsetY
|
|
84
|
+
};
|
|
85
|
+
state.paths.push(point);
|
|
86
|
+
}
|
|
87
|
+
emit("signing", event);
|
|
88
|
+
};
|
|
89
|
+
const touchEnd = ({ emit, state }) => (event2) => {
|
|
90
|
+
state.isDrawing = false;
|
|
91
|
+
preventDefault(event2);
|
|
92
|
+
emit("end");
|
|
93
|
+
};
|
|
94
|
+
const isCanvasEmpty = (canvas, props) => {
|
|
95
|
+
const empty = document.createElement("canvas");
|
|
96
|
+
const ctx = empty.getContext("2d");
|
|
97
|
+
empty.width = canvas.width;
|
|
98
|
+
empty.height = canvas.height;
|
|
99
|
+
ctx.font = "16px PingFangSC";
|
|
100
|
+
ctx.textAlign = "center";
|
|
101
|
+
ctx.fillStyle = "#AEAEAE";
|
|
102
|
+
ctx.fillText(props.placeholder, empty.width / 2, empty.height / 2);
|
|
103
|
+
return canvas.toDataURL() === empty.toDataURL();
|
|
104
|
+
};
|
|
105
|
+
const setCanvasBgColor = ({ props, state }) => () => {
|
|
106
|
+
if (state.ctx && props.backgroundColor) {
|
|
107
|
+
state.ctx.fillStyle = props.backgroundColor;
|
|
108
|
+
state.ctx.fillRect(0, 0, state.width, state.height);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const setPlaceholder = ({ props, state }) => () => {
|
|
112
|
+
if (state.ctx) {
|
|
113
|
+
state.ctx.font = "16px PingFangSC";
|
|
114
|
+
state.ctx.textAlign = "center";
|
|
115
|
+
state.ctx.fillStyle = "#AEAEAE";
|
|
116
|
+
state.ctx.fillText(props.placeholder, state.width / 2, state.height / 2);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const getSignatureImage = ({ props, vm, Modal, t }) => () => {
|
|
120
|
+
const canvas = vm.$refs.canvasRef;
|
|
121
|
+
if (!canvas) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const isEmpty = isCanvasEmpty(canvas, props);
|
|
125
|
+
let image = "";
|
|
126
|
+
if (isEmpty) {
|
|
127
|
+
Modal.message(t("ui.signature.tips"));
|
|
128
|
+
} else {
|
|
129
|
+
const types = {
|
|
130
|
+
jpg: () => canvas.toDataURL("image/jpeg", 0.8),
|
|
131
|
+
jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
|
|
132
|
+
};
|
|
133
|
+
let type = types[props.type];
|
|
134
|
+
if (type) {
|
|
135
|
+
image = type();
|
|
136
|
+
} else {
|
|
137
|
+
image = canvas.toDataURL(`image/${props.type}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { image, canvas };
|
|
141
|
+
};
|
|
142
|
+
const submit = ({ emit, api }) => () => {
|
|
143
|
+
const { image, canvas } = api.getSignatureImage();
|
|
144
|
+
emit("submit", { image, canvas });
|
|
145
|
+
};
|
|
146
|
+
const rewrite = ({ api, emit, state }) => (isBeginWrite) => {
|
|
147
|
+
if (state.ctx) {
|
|
148
|
+
state.value = false;
|
|
149
|
+
state.ctx.clearRect(0, 0, state.width, state.height);
|
|
150
|
+
state.ctx.closePath();
|
|
151
|
+
api.setCanvasBgColor();
|
|
152
|
+
state.isBeginWrite = true;
|
|
153
|
+
if (isBeginWrite === true)
|
|
154
|
+
return;
|
|
155
|
+
api.setPlaceholder();
|
|
156
|
+
state.isBeginWrite = false;
|
|
157
|
+
state.paths.length = 0;
|
|
158
|
+
emit("rewrite");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const cancel = ({ api, emit }) => () => {
|
|
162
|
+
api.toggleFullscreen();
|
|
163
|
+
emit("cancel");
|
|
164
|
+
};
|
|
165
|
+
const tranformImage = ({ api, vm, props, nextTick }) => ({ oldWidth, oldHeight }) => {
|
|
166
|
+
const canvas = vm.$refs.canvasRef;
|
|
167
|
+
if (isCanvasEmpty(canvas, props)) {
|
|
168
|
+
nextTick(() => {
|
|
169
|
+
api.setPlaceholder();
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
nextTick(() => {
|
|
173
|
+
api.redraw({ oldWidth, oldHeight });
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const toggleFullscreen = ({ nextTick, api, state }) => () => {
|
|
178
|
+
const clientWidth = document.documentElement.clientWidth;
|
|
179
|
+
const clientHeight = document.documentElement.clientHeight;
|
|
180
|
+
const oldWidth = state.width;
|
|
181
|
+
const oldHeight = state.height;
|
|
182
|
+
state.isFullscreen = !state.isFullscreen;
|
|
183
|
+
nextTick(() => {
|
|
184
|
+
if (state.current.value === "default" && state.isFullscreen) {
|
|
185
|
+
state.width = clientHeight;
|
|
186
|
+
state.height = clientWidth;
|
|
187
|
+
} else {
|
|
188
|
+
api.initCanvas();
|
|
189
|
+
}
|
|
190
|
+
api.tranformImage({ oldWidth, oldHeight });
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
const initCanvas = ({ props, state, vm }) => () => {
|
|
194
|
+
const canvas = vm.$refs.canvasRef;
|
|
195
|
+
const wrap = vm.$refs.wrapRef;
|
|
196
|
+
const width = wrap.offsetWidth || 0;
|
|
197
|
+
const height = wrap.offsetHeight || 0;
|
|
198
|
+
state.ctx = canvas.getContext("2d");
|
|
199
|
+
state.width = width;
|
|
200
|
+
state.height = props.height || height;
|
|
201
|
+
};
|
|
202
|
+
const mounted = ({ vm, state, api, nextTick, markRaw }) => () => {
|
|
203
|
+
const wrap = vm.$refs.wrapRef;
|
|
204
|
+
const resizeObserver = new ResizeObserver((ResizeObserverEntryArr) => {
|
|
205
|
+
const [{ contentRect }] = ResizeObserverEntryArr;
|
|
206
|
+
if (contentRect.width && contentRect.height) {
|
|
207
|
+
api.initCanvas();
|
|
208
|
+
if (state.paths.length) {
|
|
209
|
+
api.redraw({ oldWidth: contentRect.width, oldHeight: contentRect.height });
|
|
210
|
+
} else {
|
|
211
|
+
nextTick(() => {
|
|
212
|
+
api.setCanvasBgColor();
|
|
213
|
+
api.setPlaceholder();
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
state.resizeObserver = markRaw(resizeObserver);
|
|
219
|
+
state.resizeObserver.observe(wrap);
|
|
220
|
+
};
|
|
221
|
+
const beforeUnmount = ({ vm, state }) => () => {
|
|
222
|
+
const wrap = vm.$refs.wrapRef;
|
|
223
|
+
state.resizeObserver.unobserve(wrap);
|
|
224
|
+
};
|
|
225
|
+
export {
|
|
226
|
+
beforeUnmount,
|
|
227
|
+
cancel,
|
|
228
|
+
getSignatureImage,
|
|
229
|
+
initCanvas,
|
|
230
|
+
mounted,
|
|
231
|
+
redraw,
|
|
232
|
+
rewrite,
|
|
233
|
+
setCanvasBgColor,
|
|
234
|
+
setPlaceholder,
|
|
235
|
+
submit,
|
|
236
|
+
toggleFullscreen,
|
|
237
|
+
touchEnd,
|
|
238
|
+
touchMove,
|
|
239
|
+
touchStart,
|
|
240
|
+
tranformImage
|
|
241
|
+
};
|
package/signature/vue.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import emulate from "../common/deps/touch-emulator";
|
|
3
|
+
import { useRect as _useRect } from "../common/deps/useRect";
|
|
4
|
+
import {
|
|
5
|
+
touchStart,
|
|
6
|
+
touchMove,
|
|
7
|
+
touchEnd,
|
|
8
|
+
setCanvasBgColor,
|
|
9
|
+
submit,
|
|
10
|
+
cancel,
|
|
11
|
+
rewrite,
|
|
12
|
+
mounted,
|
|
13
|
+
beforeUnmount,
|
|
14
|
+
setPlaceholder,
|
|
15
|
+
toggleFullscreen,
|
|
16
|
+
initCanvas,
|
|
17
|
+
tranformImage,
|
|
18
|
+
redraw,
|
|
19
|
+
getSignatureImage
|
|
20
|
+
} from "./index";
|
|
21
|
+
emulate();
|
|
22
|
+
const api = [
|
|
23
|
+
"state",
|
|
24
|
+
"touchStart",
|
|
25
|
+
"touchMove",
|
|
26
|
+
"touchEnd",
|
|
27
|
+
"rewrite",
|
|
28
|
+
"submit",
|
|
29
|
+
"toggleFullscreen",
|
|
30
|
+
"initCanvas",
|
|
31
|
+
"cancel",
|
|
32
|
+
"tranformImage",
|
|
33
|
+
"redraw",
|
|
34
|
+
"getSignatureImage"
|
|
35
|
+
];
|
|
36
|
+
const renderless = (props, { unref, reactive, onMounted, onBeforeUnmount, watch, markRaw }, { emit, vm, nextTick, t, useBreakpoint }, { Modal }) => {
|
|
37
|
+
const { current } = useBreakpoint();
|
|
38
|
+
const state = reactive({
|
|
39
|
+
width: 0,
|
|
40
|
+
height: 0,
|
|
41
|
+
ctx: null,
|
|
42
|
+
isBeginWrite: false,
|
|
43
|
+
isFullscreen: false,
|
|
44
|
+
current,
|
|
45
|
+
canvasRect: null,
|
|
46
|
+
isDrawing: false,
|
|
47
|
+
paths: markRaw([]),
|
|
48
|
+
resizeObserver: null,
|
|
49
|
+
value: props.value,
|
|
50
|
+
lastRedrawDate: 0
|
|
51
|
+
});
|
|
52
|
+
watch(
|
|
53
|
+
() => props.value,
|
|
54
|
+
(newValue) => {
|
|
55
|
+
if (newValue) {
|
|
56
|
+
state.value = newValue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const useRect = _useRect(unref);
|
|
61
|
+
const api2 = {
|
|
62
|
+
state,
|
|
63
|
+
touchMove: touchMove({ emit, state }),
|
|
64
|
+
touchEnd: touchEnd({ emit, state }),
|
|
65
|
+
setCanvasBgColor: setCanvasBgColor({ props, state }),
|
|
66
|
+
setPlaceholder: setPlaceholder({ props, state }),
|
|
67
|
+
getSignatureImage: getSignatureImage({ props, vm, Modal, t })
|
|
68
|
+
};
|
|
69
|
+
Object.assign(api2, {
|
|
70
|
+
touchStart: touchStart({ emit, props, state, vm, api: api2, useRect }),
|
|
71
|
+
rewrite: rewrite({ api: api2, emit, state }),
|
|
72
|
+
mounted: mounted({ state, api: api2, vm, nextTick, markRaw }),
|
|
73
|
+
onBeforeUnmount: beforeUnmount({ state, vm }),
|
|
74
|
+
initCanvas: initCanvas({ props, state, vm }),
|
|
75
|
+
toggleFullscreen: toggleFullscreen({ api: api2, nextTick, state }),
|
|
76
|
+
cancel: cancel({ api: api2, emit }),
|
|
77
|
+
redraw: redraw({ props, state, nextTick }),
|
|
78
|
+
tranformImage: tranformImage({ api: api2, vm, props, nextTick }),
|
|
79
|
+
submit: submit({ emit, api: api2 })
|
|
80
|
+
});
|
|
81
|
+
onMounted(() => api2.mounted());
|
|
82
|
+
onBeforeUnmount(() => api2.onBeforeUnmount());
|
|
83
|
+
return api2;
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
api,
|
|
87
|
+
renderless
|
|
88
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { isNumber, isNull } from "../common/type";
|
|
3
|
+
const toPxStyle = (value) => {
|
|
4
|
+
if (isNull(value)) {
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
if (isNumber(value)) {
|
|
8
|
+
return `${value}px`;
|
|
9
|
+
}
|
|
10
|
+
return String(value);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
toPxStyle
|
|
14
|
+
};
|
package/skeleton/vue.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { toPxStyle } from "./index";
|
|
3
|
+
const api = ["toPxStyle"];
|
|
4
|
+
const renderless = (props, { toRefs, provide }) => {
|
|
5
|
+
const { active } = toRefs(props);
|
|
6
|
+
provide("active", active);
|
|
7
|
+
const api2 = {
|
|
8
|
+
toPxStyle
|
|
9
|
+
};
|
|
10
|
+
return api2;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
api,
|
|
14
|
+
renderless
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const api = ["state"];
|
|
3
|
+
const renderless = (props, { reactive, inject }) => {
|
|
4
|
+
const state = reactive({
|
|
5
|
+
isActive: inject("active", false)
|
|
6
|
+
});
|
|
7
|
+
const api2 = {
|
|
8
|
+
state
|
|
9
|
+
};
|
|
10
|
+
return api2;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
api,
|
|
14
|
+
renderless
|
|
15
|
+
};
|
package/slider/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const bindKeyDown = ({ api, props, state }) => (event) => {
|
|
|
17
17
|
if (state.disabled || state.activeIndex < 0) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
+
event.preventDefault();
|
|
20
21
|
let currentValue = 0;
|
|
21
22
|
switch (event.keyCode) {
|
|
22
23
|
case KEY_CODE.Home:
|
|
@@ -114,7 +115,9 @@ const bindMouseUp = ({ api, emit, state }) => () => {
|
|
|
114
115
|
if (state.disabled || !state.isDrag) {
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
|
-
state.
|
|
118
|
+
if (state.mouseOuterBtn) {
|
|
119
|
+
state.showTip = false;
|
|
120
|
+
}
|
|
118
121
|
state.isDrag = false;
|
|
119
122
|
off(window, "mouseup", api.bindMouseUp);
|
|
120
123
|
off(window, "mousemove", api.bindMouseMove);
|
|
@@ -123,6 +126,7 @@ const bindMouseUp = ({ api, emit, state }) => () => {
|
|
|
123
126
|
emit("stop", api.getActiveButtonValue());
|
|
124
127
|
};
|
|
125
128
|
const displayTip = ({ api, nextTick, state }) => (event) => {
|
|
129
|
+
state.mouseOuterBtn = false;
|
|
126
130
|
if (!state.showTip) {
|
|
127
131
|
state.showTip = true;
|
|
128
132
|
api.changeActiveValue(api.getActiveButtonIndex(event) === 0);
|
|
@@ -131,7 +135,10 @@ const displayTip = ({ api, nextTick, state }) => (event) => {
|
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
137
|
};
|
|
134
|
-
const hideTip = (state) => () =>
|
|
138
|
+
const hideTip = (state) => () => {
|
|
139
|
+
state.mouseOuterBtn = true;
|
|
140
|
+
!state.isDrag && (state.showTip = false);
|
|
141
|
+
};
|
|
135
142
|
const setTipStyle = ({
|
|
136
143
|
constants,
|
|
137
144
|
mode,
|
|
@@ -278,17 +285,14 @@ const initSlider = ({ api, props, state }) => (value) => {
|
|
|
278
285
|
state.rightBtnValue = Math.min(Number(item), props.max);
|
|
279
286
|
state.rightBtnShow = true;
|
|
280
287
|
}
|
|
281
|
-
|
|
282
|
-
api.changeActiveValue(index === 0);
|
|
283
|
-
}
|
|
288
|
+
api.changeActiveValue(index === 0);
|
|
284
289
|
api.setButtonStyle();
|
|
285
290
|
});
|
|
286
|
-
state.isInit = false;
|
|
287
291
|
api.setBarStyle();
|
|
288
292
|
};
|
|
289
293
|
const calculateValue = ({ props, state, vm }) => (event) => {
|
|
290
294
|
let currentValue = 0;
|
|
291
|
-
if (state.sliderSize
|
|
295
|
+
if (state.sliderSize === 0) {
|
|
292
296
|
const handleEl = vm.$refs.slider;
|
|
293
297
|
state.sliderSize = handleEl["client" + (props.vertical ? "Height" : "Width")];
|
|
294
298
|
state.sliderOffset = handleEl.getBoundingClientRect();
|
|
@@ -362,6 +366,9 @@ const watchActiveValue = ({ api, emit, props, state }) => (newValue, oldValue) =
|
|
|
362
366
|
} else {
|
|
363
367
|
state.activeValue = nNewValue || 0;
|
|
364
368
|
}
|
|
369
|
+
if (!state.isSlotTyping) {
|
|
370
|
+
state.slotValue = state.activeValue;
|
|
371
|
+
}
|
|
365
372
|
};
|
|
366
373
|
const watchModelValue = ({ api, state }) => (value) => {
|
|
367
374
|
if (!state.innerTrigger) {
|
|
@@ -417,6 +424,16 @@ const inputValueChange = ({ props, state, api }) => ($event, pos) => {
|
|
|
417
424
|
}
|
|
418
425
|
api.initSlider([Math.min(...state.inputValue), Math.max(...state.inputValue)]);
|
|
419
426
|
};
|
|
427
|
+
const handleSlotInputFocus = (state) => () => {
|
|
428
|
+
state.isSlotTyping = true;
|
|
429
|
+
};
|
|
430
|
+
const handleSlotInputBlur = (state) => () => {
|
|
431
|
+
state.isSlotTyping = false;
|
|
432
|
+
state.slotValue = state.activeValue;
|
|
433
|
+
};
|
|
434
|
+
const handleSlotInput = (state) => (event) => {
|
|
435
|
+
state.activeValue = Number(event.target.value);
|
|
436
|
+
};
|
|
420
437
|
export {
|
|
421
438
|
autoSlider,
|
|
422
439
|
bindEvent,
|
|
@@ -436,6 +453,9 @@ export {
|
|
|
436
453
|
getActiveButtonValue,
|
|
437
454
|
getLabels,
|
|
438
455
|
getPoints,
|
|
456
|
+
handleSlotInput,
|
|
457
|
+
handleSlotInputBlur,
|
|
458
|
+
handleSlotInputFocus,
|
|
439
459
|
hideTip,
|
|
440
460
|
initSlider,
|
|
441
461
|
inputValueChange,
|
package/slider/vue.js
CHANGED
|
@@ -27,7 +27,10 @@ import {
|
|
|
27
27
|
watchModelValue,
|
|
28
28
|
getPoints,
|
|
29
29
|
getLabels,
|
|
30
|
-
inputValueChange
|
|
30
|
+
inputValueChange,
|
|
31
|
+
handleSlotInputFocus,
|
|
32
|
+
handleSlotInputBlur,
|
|
33
|
+
handleSlotInput
|
|
31
34
|
} from "./index";
|
|
32
35
|
const api = [
|
|
33
36
|
"state",
|
|
@@ -54,7 +57,10 @@ const api = [
|
|
|
54
57
|
"customBeforeAppearHook",
|
|
55
58
|
"customAppearHook",
|
|
56
59
|
"customAfterAppearHook",
|
|
57
|
-
"inputValueChange"
|
|
60
|
+
"inputValueChange",
|
|
61
|
+
"handleSlotInputFocus",
|
|
62
|
+
"handleSlotInputBlur",
|
|
63
|
+
"handleSlotInput"
|
|
58
64
|
];
|
|
59
65
|
const initState = ({ reactive, computed, props, api: api2, parent, inject }) => {
|
|
60
66
|
const state = reactive({
|
|
@@ -64,7 +70,6 @@ const initState = ({ reactive, computed, props, api: api2, parent, inject }) =>
|
|
|
64
70
|
moveStyle: [],
|
|
65
71
|
points: [],
|
|
66
72
|
labels: [],
|
|
67
|
-
isInit: true,
|
|
68
73
|
inputValue: [0, 0],
|
|
69
74
|
isDrag: false,
|
|
70
75
|
sliderSize: 0,
|
|
@@ -85,7 +90,10 @@ const initState = ({ reactive, computed, props, api: api2, parent, inject }) =>
|
|
|
85
90
|
rangeDiff: computed(() => props.max - props.min),
|
|
86
91
|
tipValue: computed(() => api2.formatTipValue(state.activeValue)),
|
|
87
92
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
88
|
-
disabled: computed(() => props.disabled || state.formDisabled)
|
|
93
|
+
disabled: computed(() => props.disabled || state.formDisabled),
|
|
94
|
+
slotValue: "",
|
|
95
|
+
isSlotTyping: false,
|
|
96
|
+
mouseOuterBtn: false
|
|
89
97
|
});
|
|
90
98
|
return state;
|
|
91
99
|
};
|
|
@@ -122,9 +130,21 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
122
130
|
watchActiveValue: watchActiveValue({ api: api2, emit, props, state }),
|
|
123
131
|
getPoints: getPoints({ props, state }),
|
|
124
132
|
getLabels: getLabels({ props, state }),
|
|
125
|
-
inputValueChange: inputValueChange({ props, api: api2, state })
|
|
133
|
+
inputValueChange: inputValueChange({ props, api: api2, state }),
|
|
134
|
+
handleSlotInputFocus: handleSlotInputFocus(state),
|
|
135
|
+
handleSlotInputBlur: handleSlotInputBlur(state),
|
|
136
|
+
handleSlotInput: handleSlotInput(state)
|
|
126
137
|
});
|
|
127
|
-
watch(
|
|
138
|
+
watch(
|
|
139
|
+
() => props.modelValue,
|
|
140
|
+
(value) => {
|
|
141
|
+
if (props.max < props.min) {
|
|
142
|
+
throw new Error("Slider min should not be greater than max.");
|
|
143
|
+
}
|
|
144
|
+
api2.watchModelValue(value);
|
|
145
|
+
},
|
|
146
|
+
{ immediate: true }
|
|
147
|
+
);
|
|
128
148
|
watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
|
|
129
149
|
watch(
|
|
130
150
|
() => props.min,
|
|
@@ -142,7 +162,6 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
142
162
|
api2.setActiveButtonValue(value);
|
|
143
163
|
}
|
|
144
164
|
);
|
|
145
|
-
watch(() => state.activeValue, api2.watchActiveValue, { immediate: true });
|
|
146
165
|
watch(
|
|
147
166
|
() => state.leftBtnValue,
|
|
148
167
|
(newVal) => {
|
package/split/index.js
CHANGED
|
@@ -44,7 +44,7 @@ const handleUp = ({ api, emit, off, state }) => () => {
|
|
|
44
44
|
emit("moveend");
|
|
45
45
|
};
|
|
46
46
|
const handleMousedown = ({ api, emit, on, props, state, vm }) => (event) => {
|
|
47
|
-
if (
|
|
47
|
+
if (!props.disabled) {
|
|
48
48
|
state.initOffset = state.isHorizontal ? event.pageX : event.pageY;
|
|
49
49
|
if (state.offset === 0) {
|
|
50
50
|
state.oldOffset = 0;
|
package/split/vue.js
CHANGED
|
@@ -32,12 +32,10 @@ const renderless = (props, hooks, { vm, nextTick, emit, constants }) => {
|
|
|
32
32
|
computedleftTopMin: computed(() => api2.getComputedThresholdValue("leftTopMin")),
|
|
33
33
|
computedrightBottomMin: computed(() => api2.getComputedThresholdValue("rightBottomMin")),
|
|
34
34
|
wrapperClasses: computed(() => [`${state.prefix}-wrapper`, state.isMoving ? "no-select" : ""]),
|
|
35
|
-
paneClasses: computed(() => [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
collapseRightBottom: props.collapseRightBottom,
|
|
40
|
-
isThreeAreas: props.threeAreas
|
|
35
|
+
paneClasses: computed(() => [
|
|
36
|
+
`${state.prefix}-pane ${props.scrollable ? "tiny-split-scroll" : ""}`,
|
|
37
|
+
{ [`${state.prefix}-pane-moving`]: state.isMoving }
|
|
38
|
+
])
|
|
41
39
|
}, getUseOffset.state));
|
|
42
40
|
Object.assign(api2, __spreadProps(__spreadValues({
|
|
43
41
|
state,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-G2ADBYYC.js";
|
|
2
5
|
const handleEnterDesc = ({ state, props }) => ($event) => {
|
|
3
6
|
const target = $event.target;
|
|
4
7
|
if (target && target.scrollHeight > target.offsetHeight) {
|
|
@@ -17,7 +20,18 @@ const handleTitleClick = ({ props }) => () => {
|
|
|
17
20
|
return;
|
|
18
21
|
props.titleOption.click();
|
|
19
22
|
};
|
|
23
|
+
const computedOptions = ({ props }) => () => {
|
|
24
|
+
return props.options.filter((item) => {
|
|
25
|
+
const hidden = typeof item.hidden === "function" ? item.hidden(props.data) : item.hidden;
|
|
26
|
+
return !hidden;
|
|
27
|
+
}).map((op) => {
|
|
28
|
+
return __spreadProps(__spreadValues({}, op), {
|
|
29
|
+
disabled: typeof op.disabled === "function" ? op.disabled(props.data) : op.disabled
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
20
33
|
export {
|
|
34
|
+
computedOptions,
|
|
21
35
|
handelIconClick,
|
|
22
36
|
handleEnterDesc,
|
|
23
37
|
handleTitleClick
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { handleEnterDesc, handelIconClick, handleTitleClick } from "./index";
|
|
3
|
-
const api = ["state", "handelIconClick", "handleEnterDesc", "handleTitleClick"];
|
|
2
|
+
import { handleEnterDesc, handelIconClick, handleTitleClick, computedOptions } from "./index";
|
|
3
|
+
const api = ["state", "handelIconClick", "handleEnterDesc", "handleTitleClick", "computedOptions"];
|
|
4
4
|
const renderless = (props, { computed, reactive }, { emit }) => {
|
|
5
|
+
const api2 = {};
|
|
5
6
|
const state = reactive({
|
|
6
7
|
descTooltip: "",
|
|
7
8
|
sliceNum: 2,
|
|
8
9
|
iconNum: 3,
|
|
9
|
-
effectOptions: computed(() =>
|
|
10
|
+
effectOptions: computed(() => api2.computedOptions())
|
|
10
11
|
});
|
|
11
|
-
const api2 = {};
|
|
12
12
|
Object.assign(api2, {
|
|
13
13
|
state,
|
|
14
14
|
handleTitleClick: handleTitleClick({ props }),
|
|
15
15
|
handelIconClick: handelIconClick({ emit }),
|
|
16
|
-
handleEnterDesc: handleEnterDesc({ state, props })
|
|
16
|
+
handleEnterDesc: handleEnterDesc({ state, props }),
|
|
17
|
+
computedOptions: computedOptions({ props })
|
|
17
18
|
});
|
|
18
19
|
return api2;
|
|
19
20
|
};
|
package/steps/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { omitText } from "../common/string";
|
|
2
3
|
const updateStartIndex = ({ state, props }) => () => {
|
|
3
4
|
const { visibleNum, active } = props;
|
|
4
5
|
const maxStartIndex = Math.min(props.data.length - visibleNum, active - Math.floor(visibleNum / 2));
|
|
@@ -23,9 +24,29 @@ const computedRightNodePos = ({ state, props }) => () => {
|
|
|
23
24
|
right: -(index + 1) * 4 + "px"
|
|
24
25
|
}));
|
|
25
26
|
};
|
|
27
|
+
const handleMouseenter = ({ state, vm }) => (e, placement) => {
|
|
28
|
+
const ele = e.target;
|
|
29
|
+
const text = ele.textContent;
|
|
30
|
+
const font = window.getComputedStyle(ele).font;
|
|
31
|
+
const rect = ele.getBoundingClientRect();
|
|
32
|
+
const res = omitText(text, font, rect.width);
|
|
33
|
+
const popover = vm.$refs.popover;
|
|
34
|
+
if (res.o) {
|
|
35
|
+
popover.state.referenceElm = ele;
|
|
36
|
+
popover.state.popperElm && (popover.state.popperElm.style.display = "none");
|
|
37
|
+
popover.doDestroy();
|
|
38
|
+
state.popoverContent = text;
|
|
39
|
+
state.popoverVisible = true;
|
|
40
|
+
state.popoverPlacement = placement;
|
|
41
|
+
setTimeout(popover.updatePopper, 20);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const handleMouseleave = (state) => () => {
|
|
45
|
+
state.popoverVisible = false;
|
|
46
|
+
};
|
|
26
47
|
const computedSpace = ({ props }) => {
|
|
27
|
-
const { space } = props;
|
|
28
|
-
if (/^\d+$/.test(space)) {
|
|
48
|
+
const { space = "" } = props;
|
|
49
|
+
if (/^\d+$/.test(String(space))) {
|
|
29
50
|
return `${space}px`;
|
|
30
51
|
}
|
|
31
52
|
return space;
|
|
@@ -33,6 +54,8 @@ const computedSpace = ({ props }) => {
|
|
|
33
54
|
export {
|
|
34
55
|
computedRightNodePos,
|
|
35
56
|
computedSpace,
|
|
57
|
+
handleMouseenter,
|
|
58
|
+
handleMouseleave,
|
|
36
59
|
isVisibleHandler,
|
|
37
60
|
updateStartIndex
|
|
38
61
|
};
|
package/steps/slide-bar.js
CHANGED
|
@@ -45,7 +45,14 @@ const rightSlideHandler = ({ state, api: api2 }) => () => {
|
|
|
45
45
|
const updatePosition = ({ state, vm, props, api: api2 }) => debounce(10, (isInit) => {
|
|
46
46
|
state.positionList = props.data.map((item, index) => {
|
|
47
47
|
const blockRef = vm.$refs["block" + index];
|
|
48
|
-
|
|
48
|
+
let position = {};
|
|
49
|
+
if (blockRef) {
|
|
50
|
+
if (Array.isArray(blockRef)) {
|
|
51
|
+
position = blockRef[0] && blockRef[0].getBoundingClientRect();
|
|
52
|
+
} else {
|
|
53
|
+
position = blockRef.getBoundingClientRect();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
49
56
|
return Object.assign(position, { index });
|
|
50
57
|
});
|
|
51
58
|
state.slideMainPostion = vm.$refs.slideMain.getBoundingClientRect();
|