@opentiny/vue-renderless 3.16.1 → 3.17.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/action-sheet/index.js +0 -1
- package/base-select/index.js +1510 -0
- package/base-select/vue.js +555 -0
- package/breadcrumb-item/vue.js +4 -2
- package/card/index.js +15 -0
- package/card/vue.js +6 -3
- package/carousel/index.js +89 -17
- package/carousel/vue.js +29 -24
- package/carousel-item/index.js +24 -9
- package/carousel-item/vue.js +10 -9
- package/cascader/vue.js +2 -1
- package/cascader-panel/index.js +8 -1
- package/cascader-panel/vue.js +1 -1
- package/cascader-select/column-index.js +11 -6
- package/cascader-select/column.js +8 -5
- package/cascader-select/usePicker.js +3 -2
- package/checkbox/index.js +0 -17
- package/checkbox/vue.js +4 -10
- package/collapse-item/vue.js +4 -2
- package/common/deps/clickoutside.js +15 -8
- package/common/deps/popper.js +15 -1
- package/common/deps/throttle.js +7 -0
- package/common/deps/touch-emulator.js +1 -1
- package/common/deps/tree-model/node.js +1 -0
- package/common/deps/tree-model/tree-store.js +4 -1
- package/common/deps/useEventListener.js +9 -2
- package/common/deps/useInstanceSlots.js +22 -0
- package/common/deps/useRelation.js +72 -0
- package/common/deps/vue-popper.js +1 -0
- package/common/function.js +28 -0
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/common/type.js +2 -0
- package/dialog-box/index.js +0 -22
- package/dialog-box/vue.js +1 -4
- package/drawer/index.js +27 -29
- package/drawer/vue.js +6 -10
- package/file-upload/index.js +1 -1
- package/fluent-editor/index.js +679 -0
- package/fluent-editor/options.js +234 -0
- package/fluent-editor/vue.js +192 -0
- package/form/index.js +5 -1
- package/grid/utils/column.js +4 -2
- package/grid/utils/common.js +18 -29
- package/grid/utils/event.js +14 -9
- package/guide/index.js +6 -5
- package/guide/vue.js +2 -2
- package/input/index.js +32 -2
- package/input/vue.js +21 -2
- package/nav-menu/index.js +1 -1
- package/numeric/index.js +4 -1
- package/option/vue.js +6 -6
- package/package.json +1 -1
- package/picker/mb.js +6 -1
- package/picker/vue.js +2 -1
- package/select/index.js +65 -40
- package/select/vue.js +1 -1
- package/split/index.js +16 -9
- package/split/vue.js +7 -2
- package/statistic/index.js +7 -0
- package/tabs-mf/index.js +116 -13
- package/tabs-mf/vue-bar.js +6 -0
- package/tabs-mf/vue-nav-item.js +1 -1
- package/tabs-mf/vue.js +42 -7
- package/tag-group/vue.js +7 -1
- package/time/index.js +1 -1
- package/time-line/index.js +2 -2
- package/time-line/vue.js +4 -13
- package/timeline-item/index.js +5 -5
- package/timeline-item/vue.js +13 -6
- package/tree/index.js +29 -2
- package/tree/vue.js +5 -2
- package/tree-node/vue.js +2 -1
- package/types/cascader-menu.type.d.ts +1 -1
- package/types/cascader-node.type.d.ts +1 -1
- package/types/{cascader-panel.type-2bd03be3.d.ts → cascader-panel.type-8f58e628.d.ts} +1 -1
- package/types/cascader-panel.type.d.ts +1 -1
- package/types/cascader.type.d.ts +1 -1
- package/types/collapse-item.type.d.ts +3 -0
- package/types/dialog-box.type.d.ts +2 -6
- package/types/drawer.type.d.ts +28 -30
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-8e30b25c.d.ts → form.type-33aa784a.d.ts} +4 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +4 -0
- package/types/ip-address.type.d.ts +1 -6
- package/types/numeric.type.d.ts +1 -0
- package/types/search.type.d.ts +1 -3
- package/types/{time-line.type-1b501c41.d.ts → time-line.type-9fb16096.d.ts} +7 -5
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/user/index.js +10 -4
- package/year-table/index.js +5 -3
- package/year-table/vue.js +1 -1
- package/common/deps/letter-only.js +0 -19
- package/common/deps/number-only.js +0 -20
package/split/index.js
CHANGED
|
@@ -10,13 +10,18 @@ const getComputedThresholdValue = ({ api, props, vm, state }) => (type) => {
|
|
|
10
10
|
};
|
|
11
11
|
const getleftTopMin = (state) => ({ oldvalue, newvalue }) => state.valueIsPx ? `${Math.min(parseFloat(oldvalue), parseFloat(newvalue))}px` : Math.min(oldvalue, newvalue);
|
|
12
12
|
const getrightBottomMin = (state) => ({ oldvalue, newvalue }) => state.valueIsPx ? `${Math.max(parseFloat(oldvalue), parseFloat(newvalue))}px` : Math.max(oldvalue, newvalue);
|
|
13
|
-
const getAnotherOffset = ({ vm, state }) => (value) =>
|
|
13
|
+
const getAnotherOffset = ({ vm, state }) => (value, isPercent) => {
|
|
14
|
+
return isPercent ? 100 - value : state.valueIsPx ? `${vm.$refs.outerWrapper[state.offsetSize] - parseFloat(value)}px` : 1 - value;
|
|
15
|
+
};
|
|
14
16
|
const handleMove = ({ api, emit, props, vm, state }) => (event) => {
|
|
15
17
|
const pageOffset = state.isHorizontal ? event.pageX : event.pageY;
|
|
16
18
|
const offset = pageOffset - state.initOffset;
|
|
17
19
|
const outerWidth = vm.$refs.outerWrapper[state.offsetSize];
|
|
18
20
|
let value = state.valueIsPx ? `${parseFloat(state.oldOffset) + offset}px` : api.px2percent({ numerator: outerWidth * state.oldOffset + offset, denominator: outerWidth });
|
|
19
|
-
const anotherValue = api.getAnotherOffset(value);
|
|
21
|
+
const anotherValue = props.rightBottomValue ? value : api.getAnotherOffset(value);
|
|
22
|
+
if (props.rightBottomValue) {
|
|
23
|
+
value = api.getAnotherOffset(value);
|
|
24
|
+
}
|
|
20
25
|
if (parseFloat(value) <= parseFloat(state.computedleftTopMin)) {
|
|
21
26
|
value = api.getrightBottomMin({
|
|
22
27
|
oldvalue: value,
|
|
@@ -57,7 +62,7 @@ const handleMousedown = ({ api, emit, on, props, state, vm }) => (event) => {
|
|
|
57
62
|
state.oldOffset = val;
|
|
58
63
|
emit("update:modelValue", val);
|
|
59
64
|
} else {
|
|
60
|
-
state.oldOffset = props.modelValue;
|
|
65
|
+
state.oldOffset = props.rightBottomValue ? api.getAnotherOffset(props.modelValue) : props.modelValue;
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
state.isMoving = true;
|
|
@@ -75,9 +80,9 @@ const buttonLeftTopClick = ({ emit, props, state }) => () => {
|
|
|
75
80
|
emit("update:modelValue", state.lastmodelValue);
|
|
76
81
|
} else if (state.offset !== 0) {
|
|
77
82
|
state.lastClickOffset = state.offset;
|
|
78
|
-
state.offset = 0;
|
|
83
|
+
state.offset = props.rightBottomValue ? 100 : 0;
|
|
79
84
|
state.lastmodelValue = props.modelValue;
|
|
80
|
-
emit("update:modelValue", 0);
|
|
85
|
+
emit("update:modelValue", props.rightBottomValue ? 1 : 0);
|
|
81
86
|
}
|
|
82
87
|
emit("left-top-click");
|
|
83
88
|
};
|
|
@@ -87,9 +92,9 @@ const buttonRightBottomClick = ({ emit, props, state }) => () => {
|
|
|
87
92
|
emit("update:modelValue", state.lastmodelValue);
|
|
88
93
|
} else if (state.offset !== 100) {
|
|
89
94
|
state.lastClickOffset = state.offset;
|
|
90
|
-
state.offset = 100;
|
|
95
|
+
state.offset = props.rightBottomValue ? 0 : 100;
|
|
91
96
|
state.lastmodelValue = props.modelValue;
|
|
92
|
-
emit("update:modelValue", 1);
|
|
97
|
+
emit("update:modelValue", props.rightBottomValue ? 0 : 1);
|
|
93
98
|
}
|
|
94
99
|
emit("right-bottom-click");
|
|
95
100
|
};
|
|
@@ -102,13 +107,15 @@ const computeOffset = ({ api, nextTick, props, vm, state }) => () => {
|
|
|
102
107
|
});
|
|
103
108
|
if (state.valueIsPx) {
|
|
104
109
|
nextTick(() => {
|
|
105
|
-
|
|
110
|
+
const offset = api.px2percent({
|
|
106
111
|
numerator: props.modelValue,
|
|
107
112
|
denominator: vm.$refs.outerWrapper && vm.$refs.outerWrapper[state.offsetSize]
|
|
108
113
|
}) * 1e4 / 100;
|
|
114
|
+
state.offset = props.rightBottomValue ? api.getAnotherOffset(offset, true) : offset;
|
|
109
115
|
});
|
|
110
116
|
} else {
|
|
111
|
-
|
|
117
|
+
const offset = props.modelValue * 1e4 / 100;
|
|
118
|
+
state.offset = props.rightBottomValue ? api.getAnotherOffset(offset, true) : offset;
|
|
112
119
|
}
|
|
113
120
|
};
|
|
114
121
|
export {
|
package/split/vue.js
CHANGED
|
@@ -31,7 +31,11 @@ const renderless = (props, hooks, { vm, nextTick, emit, constants }) => {
|
|
|
31
31
|
prefix: constants.PREFIX,
|
|
32
32
|
computedleftTopMin: computed(() => api2.getComputedThresholdValue("leftTopMin")),
|
|
33
33
|
computedrightBottomMin: computed(() => api2.getComputedThresholdValue("rightBottomMin")),
|
|
34
|
-
wrapperClasses: computed(() => [
|
|
34
|
+
wrapperClasses: computed(() => [
|
|
35
|
+
`${state.prefix}-wrapper`,
|
|
36
|
+
state.isMoving ? "no-select" : "",
|
|
37
|
+
props.border ? "" : "no-border"
|
|
38
|
+
]),
|
|
35
39
|
paneClasses: computed(() => [
|
|
36
40
|
`${state.prefix}-pane ${props.scrollable ? "tiny-split-scroll" : ""}`,
|
|
37
41
|
{ [`${state.prefix}-pane-moving`]: state.isMoving }
|
|
@@ -67,7 +71,8 @@ const useOffset = ({ nextTick, props, vm, constants, hooks }) => {
|
|
|
67
71
|
});
|
|
68
72
|
Object.assign(api2, {
|
|
69
73
|
px2percent,
|
|
70
|
-
computeOffset: computeOffset({ api: api2, nextTick, props, vm, state })
|
|
74
|
+
computeOffset: computeOffset({ api: api2, nextTick, props, vm, state }),
|
|
75
|
+
getAnotherOffset: getAnotherOffset({ vm, state })
|
|
71
76
|
});
|
|
72
77
|
watch(() => props.modelValue, api2.computeOffset, { immediate: true });
|
|
73
78
|
onMounted(() => {
|
package/statistic/index.js
CHANGED
|
@@ -14,6 +14,13 @@ const getIntegerAndDecimal = ({ props }) => () => {
|
|
|
14
14
|
let displayValue = props.value ? String(props.value).split(".") : "";
|
|
15
15
|
let integer = (_a = displayValue[0]) == null ? void 0 : _a.replace(/\B(?=(\d{3})+(?!\d))/g, props.groupSeparator);
|
|
16
16
|
let decimal = (_b = displayValue[1]) == null ? void 0 : _b.padEnd(props.precision, "0").slice(0, props.precision > 0 ? props.precision : 0);
|
|
17
|
+
if (!displayValue) {
|
|
18
|
+
integer = "0";
|
|
19
|
+
}
|
|
20
|
+
if (!decimal && props.precision) {
|
|
21
|
+
let display = "0";
|
|
22
|
+
decimal = display.padEnd(props.precision, "0");
|
|
23
|
+
}
|
|
17
24
|
return [integer, decimal].join(decimal ? "." : "");
|
|
18
25
|
};
|
|
19
26
|
export {
|
package/tabs-mf/index.js
CHANGED
|
@@ -2,21 +2,42 @@ import "../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import { random } from "../common/string";
|
|
3
3
|
import debounce from "../common/deps/debounce";
|
|
4
4
|
import { fastdom } from "../common/deps/fastdom";
|
|
5
|
-
const setActive = ({ state,
|
|
5
|
+
const setActive = ({ state, api }) => (name) => {
|
|
6
6
|
const current = state.currentItem ? state.currentItem.name : "";
|
|
7
|
-
if (current && current !== name
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
before.then(() => {
|
|
7
|
+
if (current && current !== name) {
|
|
8
|
+
api.canLeave(name, current).then((result) => {
|
|
9
|
+
if (result) {
|
|
11
10
|
api.changeCurrentName(name);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
api.changeCurrentName(name);
|
|
15
|
-
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
16
13
|
} else {
|
|
17
14
|
api.changeCurrentName(name);
|
|
18
15
|
}
|
|
19
16
|
};
|
|
17
|
+
const canLeave = (props) => (newTab, oldTab) => {
|
|
18
|
+
if (typeof props.beforeLeave === "function") {
|
|
19
|
+
const before = props.beforeLeave(newTab, oldTab);
|
|
20
|
+
if (before && before.then) {
|
|
21
|
+
return {
|
|
22
|
+
then: (cb) => {
|
|
23
|
+
before.then(cb).catch(() => cb(false));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
} else {
|
|
27
|
+
return {
|
|
28
|
+
then: (cb) => {
|
|
29
|
+
cb(before);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
return {
|
|
35
|
+
then: (cb) => {
|
|
36
|
+
cb(true);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
20
41
|
const changeCurrentName = ({ emit, state }) => (name) => {
|
|
21
42
|
state.items.forEach((item) => item.selected = item.name === name);
|
|
22
43
|
emit("update:activeName", name);
|
|
@@ -52,10 +73,12 @@ const clickMore = (api) => (name) => {
|
|
|
52
73
|
api.setActive(name);
|
|
53
74
|
api.scrollTo(name);
|
|
54
75
|
};
|
|
55
|
-
const removeItem = ({ state, emit }) => (name, silent = false) => {
|
|
76
|
+
const removeItem = ({ props, state, emit }) => (name, silent = false) => {
|
|
56
77
|
const itemIndex = state.items.findIndex((item) => item.name === name);
|
|
57
78
|
const navIndex = state.navs.findIndex((item) => item.name === name);
|
|
58
|
-
if (
|
|
79
|
+
if (!~itemIndex)
|
|
80
|
+
return;
|
|
81
|
+
const emitEvent = () => {
|
|
59
82
|
state.items.splice(itemIndex, 1);
|
|
60
83
|
state.items = [...state.items];
|
|
61
84
|
state.navs.splice(navIndex, 1);
|
|
@@ -64,6 +87,72 @@ const removeItem = ({ state, emit }) => (name, silent = false) => {
|
|
|
64
87
|
emit("edit", name, "remove");
|
|
65
88
|
emit("close", name);
|
|
66
89
|
}
|
|
90
|
+
};
|
|
91
|
+
if (typeof props.beforeClose === "function") {
|
|
92
|
+
const beforeCloseResult = props.beforeClose(name);
|
|
93
|
+
if (beforeCloseResult && beforeCloseResult.then) {
|
|
94
|
+
beforeCloseResult.then((res) => res && emitEvent());
|
|
95
|
+
} else {
|
|
96
|
+
beforeCloseResult && emitEvent();
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
emitEvent();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const beforeCarouselSwipe = ({ api, state, vm }) => (newIndex, oldIndex) => {
|
|
103
|
+
const [newTab, oldTab] = [newIndex, oldIndex].map((index) => state.items[index] ? state.items[index].name : "");
|
|
104
|
+
return api.canLeave(newTab, oldTab).then((result) => {
|
|
105
|
+
if (result) {
|
|
106
|
+
vm.setActive(newTab);
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const clearOtherTabSwipeScroll = ({ state, vm }) => (name) => {
|
|
112
|
+
if (!state.swipeable)
|
|
113
|
+
return;
|
|
114
|
+
state.items.forEach((tab, i) => {
|
|
115
|
+
const tabName = tab ? tab.name : "";
|
|
116
|
+
if (tabName !== name) {
|
|
117
|
+
const tabSwipeVm = vm.$refs[`tabSwipe${i}`];
|
|
118
|
+
tabSwipeVm && tabSwipeVm.clearScroll();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
const computedSwipeable = ({ props, state }) => () => state.items.every((item) => !item.lazy) && props.swipeable;
|
|
123
|
+
const observeTabSwipeSize = ({ state, vm }) => () => {
|
|
124
|
+
if (!state.swipeable)
|
|
125
|
+
return;
|
|
126
|
+
state._resizeObserver = new ResizeObserver((entries) => {
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
let sizeEntry, blockSize;
|
|
129
|
+
if (entry.borderBoxSize && entry.borderBoxSize.length > 0) {
|
|
130
|
+
sizeEntry = entry.borderBoxSize[0];
|
|
131
|
+
blockSize = sizeEntry.blockSize;
|
|
132
|
+
} else {
|
|
133
|
+
sizeEntry = entry.contentRect;
|
|
134
|
+
blockSize = sizeEntry.height;
|
|
135
|
+
}
|
|
136
|
+
if (blockSize > state.maxTabSwipeHeight) {
|
|
137
|
+
state.maxTabSwipeHeight = blockSize;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
state.items.forEach((_, i) => {
|
|
142
|
+
const tabSwipeVm = vm.$refs[`tabSwipe${i}`];
|
|
143
|
+
tabSwipeVm && state._resizeObserver.observe(tabSwipeVm.$el);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const unobserveTabSwipeSize = ({ state, vm }) => () => {
|
|
147
|
+
if (!state.swipeable)
|
|
148
|
+
return;
|
|
149
|
+
if (state._resizeObserver) {
|
|
150
|
+
state.items.forEach((_, i) => {
|
|
151
|
+
const tabSwipeVm = vm.$refs[`tabSwipe${i}`];
|
|
152
|
+
tabSwipeVm && state._resizeObserver.unobserve(tabSwipeVm.$el);
|
|
153
|
+
});
|
|
154
|
+
state._resizeObserver.disconnect();
|
|
155
|
+
state._resizeObserver = null;
|
|
67
156
|
}
|
|
68
157
|
};
|
|
69
158
|
const wheelListener = ({ vm, api, tabs, state }) => debounce(10, (e) => {
|
|
@@ -97,8 +186,16 @@ const emitAdd = (tabs) => () => {
|
|
|
97
186
|
tabs.$emit("edit", null, "add");
|
|
98
187
|
tabs.$emit("add");
|
|
99
188
|
};
|
|
100
|
-
const handleNavItemClick = ({ tabs, props }) => () => {
|
|
101
|
-
tabs.
|
|
189
|
+
const handleNavItemClick = ({ tabs, props, vm }) => () => {
|
|
190
|
+
const index = tabs.state.navs.indexOf(vm);
|
|
191
|
+
const newTab = props.navItem.name;
|
|
192
|
+
const oldTab = tabs.state.currentItem ? tabs.state.currentItem.name : "";
|
|
193
|
+
tabs.setActive(newTab);
|
|
194
|
+
props.swipeable && tabs.canLeave(newTab, oldTab).then((result) => {
|
|
195
|
+
if (result) {
|
|
196
|
+
tabs.$refs.swipe && tabs.$refs.swipe.setActiveItem(index);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
102
199
|
tabs.$emit("click", props.navItem);
|
|
103
200
|
};
|
|
104
201
|
const getBoundRectNV = ({ vm, props }) => () => ({
|
|
@@ -112,8 +209,12 @@ const handleNavItemClose = ({ tabs, props }) => (e) => {
|
|
|
112
209
|
export {
|
|
113
210
|
addItem,
|
|
114
211
|
addNav,
|
|
212
|
+
beforeCarouselSwipe,
|
|
213
|
+
canLeave,
|
|
115
214
|
changeCurrentName,
|
|
215
|
+
clearOtherTabSwipeScroll,
|
|
116
216
|
clickMore,
|
|
217
|
+
computedSwipeable,
|
|
117
218
|
emitAdd,
|
|
118
219
|
getBoundRect,
|
|
119
220
|
getBoundRectNV,
|
|
@@ -121,8 +222,10 @@ export {
|
|
|
121
222
|
handleNavItemClick,
|
|
122
223
|
handleNavItemClose,
|
|
123
224
|
key,
|
|
225
|
+
observeTabSwipeSize,
|
|
124
226
|
removeItem,
|
|
125
227
|
scrollTo,
|
|
126
228
|
setActive,
|
|
229
|
+
unobserveTabSwipeSize,
|
|
127
230
|
wheelListener
|
|
128
231
|
};
|
package/tabs-mf/vue-bar.js
CHANGED
|
@@ -33,6 +33,12 @@ const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject
|
|
|
33
33
|
state.moreOptions = state.moreList.map((name) => tabs.state.items.find((item) => item.name === name));
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
|
+
watch(
|
|
37
|
+
() => tabs.state.navs,
|
|
38
|
+
() => {
|
|
39
|
+
api2.wheelListener();
|
|
40
|
+
}
|
|
41
|
+
);
|
|
36
42
|
onMounted(() => {
|
|
37
43
|
addWheelListener(vm.$refs.scroll, api2.wheelListener);
|
|
38
44
|
addResizeListener(vm.$el, api2.wheelListener);
|
package/tabs-mf/vue-nav-item.js
CHANGED
|
@@ -11,7 +11,7 @@ const renderless = (props, { inject, markRaw, reactive, computed }, { vm }) => {
|
|
|
11
11
|
});
|
|
12
12
|
const api2 = {
|
|
13
13
|
state,
|
|
14
|
-
handleNavItemClick: handleNavItemClick({ tabs, props }),
|
|
14
|
+
handleNavItemClick: handleNavItemClick({ tabs, props, vm }),
|
|
15
15
|
getBoundRect: getBoundRectNV({ vm, props }),
|
|
16
16
|
handleNavItemClose: handleNavItemClose({ tabs, props })
|
|
17
17
|
};
|
package/tabs-mf/vue.js
CHANGED
|
@@ -1,25 +1,58 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { random } from "../common/string";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
setActive,
|
|
5
|
+
addItem,
|
|
6
|
+
addNav,
|
|
7
|
+
scrollTo,
|
|
8
|
+
clickMore,
|
|
9
|
+
removeItem,
|
|
10
|
+
changeCurrentName,
|
|
11
|
+
beforeCarouselSwipe,
|
|
12
|
+
canLeave,
|
|
13
|
+
clearOtherTabSwipeScroll,
|
|
14
|
+
computedSwipeable,
|
|
15
|
+
observeTabSwipeSize,
|
|
16
|
+
unobserveTabSwipeSize
|
|
17
|
+
} from "./index";
|
|
18
|
+
const api = [
|
|
19
|
+
"state",
|
|
20
|
+
"setActive",
|
|
21
|
+
"addItem",
|
|
22
|
+
"addNav",
|
|
23
|
+
"scrollTo",
|
|
24
|
+
"clickMore",
|
|
25
|
+
"removeItem",
|
|
26
|
+
"beforeCarouselSwipe",
|
|
27
|
+
"canLeave",
|
|
28
|
+
"clearOtherTabSwipeScroll"
|
|
29
|
+
];
|
|
30
|
+
const renderless = (props, { onMounted, onBeforeUnmount, provide, reactive, watch, computed, nextTick }, { vm, emit }) => {
|
|
6
31
|
const state = reactive({
|
|
7
32
|
items: [],
|
|
8
33
|
navs: [],
|
|
9
34
|
currentItem: computed(() => state.items.find((item) => item.selected)),
|
|
10
35
|
key: computed(() => state.currentItem ? state.currentItem.name : random()),
|
|
11
|
-
separator: props.separator
|
|
36
|
+
separator: props.separator,
|
|
37
|
+
swipeable: computed(() => api2.computedSwipeable()),
|
|
38
|
+
maxTabSwipeHeight: 0
|
|
12
39
|
});
|
|
13
40
|
const api2 = {};
|
|
14
41
|
Object.assign(api2, {
|
|
15
42
|
state,
|
|
16
|
-
setActive: setActive({ api: api2
|
|
43
|
+
setActive: setActive({ state, api: api2 }),
|
|
17
44
|
addItem: addItem(state),
|
|
18
45
|
addNav: addNav(state),
|
|
19
46
|
scrollTo: scrollTo({ vm, state }),
|
|
20
|
-
removeItem: removeItem({ state, emit }),
|
|
47
|
+
removeItem: removeItem({ props, state, emit }),
|
|
21
48
|
changeCurrentName: changeCurrentName({ state, emit }),
|
|
22
|
-
clickMore: clickMore(api2)
|
|
49
|
+
clickMore: clickMore(api2),
|
|
50
|
+
beforeCarouselSwipe: beforeCarouselSwipe({ api: api2, state, vm }),
|
|
51
|
+
canLeave: canLeave(props),
|
|
52
|
+
clearOtherTabSwipeScroll: clearOtherTabSwipeScroll({ state, vm }),
|
|
53
|
+
computedSwipeable: computedSwipeable({ props, state }),
|
|
54
|
+
observeTabSwipeSize: observeTabSwipeSize({ state, vm }),
|
|
55
|
+
unobserveTabSwipeSize: unobserveTabSwipeSize({ state, vm })
|
|
23
56
|
});
|
|
24
57
|
provide("tabs", vm);
|
|
25
58
|
watch(
|
|
@@ -31,10 +64,12 @@ const renderless = (props, { onMounted, onBeforeUnmount, provide, reactive, watc
|
|
|
31
64
|
(name) => name && api2.setActive(name)
|
|
32
65
|
);
|
|
33
66
|
onMounted(() => {
|
|
67
|
+
nextTick(() => api2.observeTabSwipeSize());
|
|
34
68
|
props.activeName && api2.scrollTo(props.activeName);
|
|
35
69
|
props.modelValue && api2.scrollTo(props.modelValue);
|
|
36
70
|
});
|
|
37
71
|
onBeforeUnmount(() => {
|
|
72
|
+
api2.unobserveTabSwipeSize();
|
|
38
73
|
state.navs.forEach((n, i) => state.navs[i] = null);
|
|
39
74
|
state.navs.length = 0;
|
|
40
75
|
});
|
package/tag-group/vue.js
CHANGED
|
@@ -3,7 +3,7 @@ import { addResizeListener, removeResizeListener } from "../common/deps/resize-e
|
|
|
3
3
|
import debounce from "../common/deps/debounce";
|
|
4
4
|
import { getHiddenTags, handelItemClick } from "./index";
|
|
5
5
|
const api = ["state", "handelItemClick"];
|
|
6
|
-
const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm, emit }) => {
|
|
6
|
+
const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch }, { vm, emit }) => {
|
|
7
7
|
const delay = 100;
|
|
8
8
|
const state = reactive({
|
|
9
9
|
showMore: false,
|
|
@@ -19,6 +19,12 @@ const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm, emit
|
|
|
19
19
|
api2.debouncedGetHiddenTags = debounce(delay, api2.getHiddenTags);
|
|
20
20
|
addResizeListener(vm.$refs.tagGroup, debounce(delay, api2.debouncedGetHiddenTags));
|
|
21
21
|
});
|
|
22
|
+
watch(
|
|
23
|
+
() => props.data.length,
|
|
24
|
+
() => {
|
|
25
|
+
api2.getHiddenTags();
|
|
26
|
+
}
|
|
27
|
+
);
|
|
22
28
|
onBeforeUnmount(() => {
|
|
23
29
|
removeResizeListener(vm.$refs.tagGroup, api2.debouncedGetHiddenTags);
|
|
24
30
|
});
|
package/time/index.js
CHANGED
|
@@ -15,8 +15,8 @@ const watchValue = ({ api, nextTick, state }) => (value) => {
|
|
|
15
15
|
};
|
|
16
16
|
const watchVisible = ({ nextTick, vm, state, api }) => (value) => {
|
|
17
17
|
if (value) {
|
|
18
|
-
state.oldValue = state.value;
|
|
19
18
|
nextTick(() => {
|
|
19
|
+
state.oldValue = state.value;
|
|
20
20
|
vm.$refs.spinner.emitSelectRange("hours");
|
|
21
21
|
api.adjustSpinners();
|
|
22
22
|
});
|
package/time-line/index.js
CHANGED
|
@@ -39,10 +39,10 @@ const getStatusCls = ({ constants, state }) => (index, node) => {
|
|
|
39
39
|
return cls;
|
|
40
40
|
};
|
|
41
41
|
const computedData = ({ props, state }) => () => {
|
|
42
|
-
if (props.data) {
|
|
42
|
+
if (props.data && props.data.length > 0) {
|
|
43
43
|
return state.isReverse ? props.data.map((item, i) => __spreadProps(__spreadValues({}, props.data[props.data.length - 1 - i]), { index: i })) : props.data.map((item, i) => __spreadProps(__spreadValues({}, item), { index: i }));
|
|
44
44
|
}
|
|
45
|
-
return state.
|
|
45
|
+
return state.itemsArray;
|
|
46
46
|
};
|
|
47
47
|
const computedCurrent = ({ props, state }) => () => state.isReverse ? state.nodes.length - props.active - 1 : props.active;
|
|
48
48
|
const computedIsReverse = (props) => () => props.reverse && props.vertical;
|
package/time-line/vue.js
CHANGED
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
toggleFold
|
|
15
15
|
} from "./index";
|
|
16
16
|
const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus", "toggleFold"];
|
|
17
|
-
const renderless = (props, { computed, reactive, provide, watch }, { t, emit, constants
|
|
17
|
+
const renderless = (props, { computed, reactive, provide, watch }, { t, emit, constants }) => {
|
|
18
18
|
const api2 = {};
|
|
19
19
|
const state = reactive({
|
|
20
|
+
// 当标签式使用时,记录有多少个 item 的标签
|
|
21
|
+
itemsArray: [],
|
|
20
22
|
nodes: computed(() => api2.computedData()),
|
|
21
|
-
timelineItems: [],
|
|
22
23
|
current: computed(() => api2.computedCurrent()),
|
|
23
24
|
isReverse: computed(() => api2.computedIsReverse()),
|
|
24
25
|
stackNodes: computed(() => state.showAll ? state.nodes : api2.computedStackNodes()),
|
|
@@ -42,17 +43,7 @@ const renderless = (props, { computed, reactive, provide, watch }, { t, emit, co
|
|
|
42
43
|
computedWrapperClass: computedWrapperClass({ props }),
|
|
43
44
|
toggleFold: toggleFold({ props })
|
|
44
45
|
});
|
|
45
|
-
provide("nodesInject", {
|
|
46
|
-
watch(
|
|
47
|
-
() => state.timelineItems,
|
|
48
|
-
(newVal) => {
|
|
49
|
-
newVal.forEach((item, i) => item.index = i);
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
immediate: true,
|
|
53
|
-
deep: true
|
|
54
|
-
}
|
|
55
|
-
);
|
|
46
|
+
provide("nodesInject", { state, props });
|
|
56
47
|
return api2;
|
|
57
48
|
};
|
|
58
49
|
export {
|
package/timeline-item/index.js
CHANGED
|
@@ -11,14 +11,14 @@ const getStatus = ({ state, t }) => (value) => {
|
|
|
11
11
|
const computedWidth = () => (width) => {
|
|
12
12
|
return /^\d+$/.test(String(width)) ? `${width}px` : width || "";
|
|
13
13
|
};
|
|
14
|
-
const handleClick = ({ emit, state }) => (node) => {
|
|
15
|
-
const
|
|
14
|
+
const handleClick = ({ emit, state, props }) => (node) => {
|
|
15
|
+
const index = props.nodeIndex;
|
|
16
16
|
if (!node.disabled) {
|
|
17
17
|
emit("click", state.isReverse ? state.nodesLength - index - 1 : index, node);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const getStatusCls = ({ constants, state }) => (node) => {
|
|
21
|
-
const
|
|
20
|
+
const getStatusCls = ({ constants, state, props }) => (node) => {
|
|
21
|
+
const index = props.nodeIndex;
|
|
22
22
|
const { PROCESS_DONE_CLS, PROCESS_CUR_CLS, PROCESS_WAIT_CLS, PROCESS_DISABLED_CLS, PROCESS_ERROR_CLS } = constants;
|
|
23
23
|
const cls = {};
|
|
24
24
|
const reverse = state.isReverse;
|
|
@@ -64,7 +64,7 @@ const computedIconClass = ({ props, api }) => () => {
|
|
|
64
64
|
return iconClass;
|
|
65
65
|
};
|
|
66
66
|
const computedItemStyle = ({ props, state, api }) => () => {
|
|
67
|
-
const
|
|
67
|
+
const index = props.nodeIndex;
|
|
68
68
|
const { computedSpace, nodesLength } = state;
|
|
69
69
|
const { textPosition, vertical } = api.rootProps;
|
|
70
70
|
if (vertical) {
|
package/timeline-item/vue.js
CHANGED
|
@@ -12,12 +12,19 @@ import {
|
|
|
12
12
|
computedIconClass
|
|
13
13
|
} from "./index";
|
|
14
14
|
const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "rootProps"];
|
|
15
|
-
const renderless = (props, { computed, reactive, inject }, { t, emit, constants }) => {
|
|
15
|
+
const renderless = (props, { computed, reactive, inject, onUnmounted }, { t, emit, constants }) => {
|
|
16
16
|
const api2 = {};
|
|
17
|
-
const {
|
|
18
|
-
|
|
17
|
+
const { state: rootState, props: rootProps } = inject("nodesInject");
|
|
18
|
+
if (!rootState.itemsArray.includes(props.node)) {
|
|
19
|
+
rootState.itemsArray.push(props.node);
|
|
20
|
+
}
|
|
21
|
+
onUnmounted(() => {
|
|
22
|
+
if (rootState.itemsArray.includes(props.node)) {
|
|
23
|
+
rootState.itemsArray.splice(rootState.itemsArray.indexOf(props.node), 1);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
19
26
|
const state = reactive({
|
|
20
|
-
nodesLength: computed(() => nodes.length),
|
|
27
|
+
nodesLength: computed(() => rootState.nodes.length),
|
|
21
28
|
current: computed(() => api2.computedCurrent()),
|
|
22
29
|
isReverse: computed(() => api2.computedIsReverse()),
|
|
23
30
|
computedSpace: computed(() => api2.computedWidth(props.space || api2.rootProps.space)),
|
|
@@ -36,8 +43,8 @@ const renderless = (props, { computed, reactive, inject }, { t, emit, constants
|
|
|
36
43
|
computedItemStyle: computedItemStyle({ props, state, api: api2 }),
|
|
37
44
|
computedWidth: computedWidth(),
|
|
38
45
|
getStatus: getStatus({ state, t }),
|
|
39
|
-
handleClick: handleClick({ emit, state }),
|
|
40
|
-
getStatusCls: getStatusCls({ constants, state }),
|
|
46
|
+
handleClick: handleClick({ emit, state, props }),
|
|
47
|
+
getStatusCls: getStatusCls({ constants, state, props }),
|
|
41
48
|
computedIconClass: computedIconClass({ props, api: api2 })
|
|
42
49
|
});
|
|
43
50
|
return api2;
|
package/tree/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { addClass, removeClass } from "../common/deps/dom";
|
|
|
6
6
|
import { on, off } from "../common/deps/dom";
|
|
7
7
|
import { getDataset } from "../common/dataset";
|
|
8
8
|
import { copyArray } from "../common/object";
|
|
9
|
+
import { log } from "../common";
|
|
9
10
|
const setChildren = (props) => (data) => props.data = data;
|
|
10
11
|
const getChildren = () => (props) => props.data;
|
|
11
12
|
const computedTreeItemArray = () => (props, state) => Array.prototype.slice.call(state.treeItems);
|
|
@@ -540,8 +541,19 @@ const saveNode = ({ state, emit, api }) => () => {
|
|
|
540
541
|
}
|
|
541
542
|
state.action.node = null;
|
|
542
543
|
};
|
|
543
|
-
const addNode = ({ api }) => (node) => {
|
|
544
|
-
|
|
544
|
+
const addNode = ({ api, props, state }) => (node) => {
|
|
545
|
+
let nodeId = 0;
|
|
546
|
+
if (typeof props.editConfig.initNodeIdMethod === "function") {
|
|
547
|
+
nodeId = props.editConfig.initNodeIdMethod(node);
|
|
548
|
+
} else {
|
|
549
|
+
nodeId = state.newNodeId;
|
|
550
|
+
state.newNodeId++;
|
|
551
|
+
}
|
|
552
|
+
if (state.allNodeKeys.includes(nodeId) && !props.editConfig.noWarning) {
|
|
553
|
+
log.logger.warn(`the ${props.nodeKey || "id"} ${nodeId} is already exists. Please check.`);
|
|
554
|
+
}
|
|
555
|
+
state.allNodeKeys.push(nodeId);
|
|
556
|
+
const newNode = { label: "", [props.nodeKey || "id"]: nodeId };
|
|
545
557
|
const isLeafField = node.store && node.store.props.isLeaf;
|
|
546
558
|
if (isLeafField) {
|
|
547
559
|
newNode[isLeafField] = true;
|
|
@@ -609,9 +621,24 @@ const deleteConfirm = ({ state, props, api }) => (event2, node) => {
|
|
|
609
621
|
const openEdit = ({ props, state, api, emit }) => () => {
|
|
610
622
|
state.action.show = true;
|
|
611
623
|
state.action.data = copyArray(props.data);
|
|
624
|
+
if (!state.allNodeKeys.length) {
|
|
625
|
+
getAllNodeKeys(state.action.data, state.allNodeKeys, props.nodeKey || "id", props.props.children || "children");
|
|
626
|
+
}
|
|
612
627
|
api.watchData(state.action.data);
|
|
613
628
|
emit("open-edit");
|
|
614
629
|
};
|
|
630
|
+
const getAllNodeKeys = (node, nodeKeys, nodeKey, children) => {
|
|
631
|
+
if (Array.isArray(node)) {
|
|
632
|
+
node.forEach((item) => {
|
|
633
|
+
if (item[nodeKey] || item[nodeKey] !== 0) {
|
|
634
|
+
nodeKeys.push(item[nodeKey]);
|
|
635
|
+
}
|
|
636
|
+
if (item[children]) {
|
|
637
|
+
getAllNodeKeys(item[children], nodeKeys, nodeKey, children);
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
};
|
|
615
642
|
const closeEdit = ({ props, state, api, emit }) => () => {
|
|
616
643
|
state.action.show = false;
|
|
617
644
|
state.action.popoverVisible = false;
|
package/tree/vue.js
CHANGED
|
@@ -68,6 +68,7 @@ import {
|
|
|
68
68
|
handleClickPlainNode,
|
|
69
69
|
setCheckedByNodeKey
|
|
70
70
|
} from "./index";
|
|
71
|
+
import { random } from "../common/string";
|
|
71
72
|
const api = [
|
|
72
73
|
"state",
|
|
73
74
|
"closeMenu",
|
|
@@ -160,7 +161,9 @@ const initState = ({ reactive, emitter, props, computed, api: api2 }) => {
|
|
|
160
161
|
deleteData: [],
|
|
161
162
|
editData: []
|
|
162
163
|
},
|
|
163
|
-
|
|
164
|
+
newNodeId: Math.floor(random() * 1e4),
|
|
165
|
+
plainNodeStore: {},
|
|
166
|
+
allNodeKeys: []
|
|
164
167
|
});
|
|
165
168
|
return state;
|
|
166
169
|
};
|
|
@@ -252,7 +255,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, watch, pr
|
|
|
252
255
|
cancelDelete: cancelDelete({ state }),
|
|
253
256
|
openEdit: openEdit({ props, state, api: api2, emit }),
|
|
254
257
|
saveNode: saveNode({ state, emit, api: api2 }),
|
|
255
|
-
addNode: addNode({ api: api2 }),
|
|
258
|
+
addNode: addNode({ api: api2, props, state }),
|
|
256
259
|
editNode: editNode({ state }),
|
|
257
260
|
closeEdit: closeEdit({ props, state, api: api2, emit }),
|
|
258
261
|
saveEdit: saveEdit({ props, state, emit }),
|
package/tree-node/vue.js
CHANGED
|
@@ -65,6 +65,7 @@ const initState = ({ reactive, treeRoot, props, emitter, $parentEmitter, vm, api
|
|
|
65
65
|
emitter: emitter(),
|
|
66
66
|
parentEmitter: $parentEmitter,
|
|
67
67
|
isSaaSTheme: (props.theme || vm.theme) === "saas",
|
|
68
|
+
props: treeRoot.props,
|
|
68
69
|
computedExpandIcon: computed(() => api2.computedExpandIcon(treeRoot, state)),
|
|
69
70
|
computedIndent: computed(() => api2.computedIndent(props, state))
|
|
70
71
|
});
|
|
@@ -94,7 +95,7 @@ const initApi = ({ api: api2, state, dispatch, broadcast, vm, props, treeRoot, n
|
|
|
94
95
|
watchIndeterminate: watchIndeterminate({ api: api2, props }),
|
|
95
96
|
watchChecked: watchChecked({ api: api2, props }),
|
|
96
97
|
openEdit: openEdit({ state, vm }),
|
|
97
|
-
addNode: addNode({ state, props, api: api2 }),
|
|
98
|
+
addNode: debounce(500, true, addNode({ state, props, api: api2 })),
|
|
98
99
|
saveEdit: saveEdit({ state }),
|
|
99
100
|
deleteNode: deleteNode({ state }),
|
|
100
101
|
handleChildNodeExpand: handleChildNodeExpand(state),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISharedRenderlessFunctionParams, ISharedRenderlessParamUtils } from './shared.type.js';
|
|
2
|
-
import { I as ICascaderPanelNode, a as ICascaderPanelApi } from './cascader-panel.type-
|
|
2
|
+
import { I as ICascaderPanelNode, a as ICascaderPanelApi } from './cascader-panel.type-8f58e628.js';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
|
-
import { I as ICascaderPanelNode, b as ICascaderPanelConfig, c as ICascaderPanelNodeValue, d as ICascaderPanelNodePropValue, a as ICascaderPanelApi } from './cascader-panel.type-
|
|
2
|
+
import { I as ICascaderPanelNode, b as ICascaderPanelConfig, c as ICascaderPanelNodeValue, d as ICascaderPanelNodePropValue, a as ICascaderPanelApi } from './cascader-panel.type-8f58e628.js';
|
|
3
3
|
import { ISharedRenderlessFunctionParams } from './shared.type.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -129,7 +129,7 @@ declare const checkNode: (api: ICascaderPanelApi) => (el: HTMLElement) => void;
|
|
|
129
129
|
declare const handleKeyDown: ({ api, emit, menus }: Pick<ICascaderPanelRenderlessParams, 'api' | 'emit' | 'menus'>) => (event: KeyboardEvent) => void;
|
|
130
130
|
declare const handleExpand: ({ emit, state }: Pick<ICascaderPanelRenderlessParams, 'emit' | 'state'>) => (node: ICascaderPanelNode, silent?: boolean) => void;
|
|
131
131
|
declare const handleCheckChange: (state: ICascaderPanelState) => (value: ICascaderPanelNodePropValue) => void;
|
|
132
|
-
declare const lazyLoad: ({ api, $parent, state, Store }: Pick<ICascaderPanelRenderlessParams, 'api' | '$parent' | 'state' | 'Store'>) => (currentNode?: ICascaderPanelNode, onFullfiled?: ((dataList: ICascaderPanelData[]) => void) | undefined) => void;
|
|
132
|
+
declare const lazyLoad: ({ api, $parent, state, Store, emit }: Pick<ICascaderPanelRenderlessParams, 'api' | '$parent' | 'state' | 'Store' | 'emit'>) => (currentNode?: ICascaderPanelNode, onFullfiled?: ((dataList: ICascaderPanelData[]) => void) | undefined) => void;
|
|
133
133
|
declare const calculateMultiCheckedValue: ({ api, state }: Pick<ICascaderPanelRenderlessParams, 'api' | 'state'>) => () => void;
|
|
134
134
|
declare const scrollIntoView: ({ menus }: Pick<ICascaderPanelRenderlessParams, 'menus'>) => () => void;
|
|
135
135
|
declare const getNodeByValue: (state: ICascaderPanelState) => (val: ICascaderPanelNodePropValue | null) => ICascaderPanelNode | null;
|