@opentiny/vue-renderless 3.26.0 → 3.28.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/autocomplete/index.js +7 -2
- package/autocomplete/vue.js +1 -1
- package/base-select/index.js +189 -86
- package/base-select/vue.js +82 -20
- package/calendar-view/index.js +6 -3
- package/calendar-view/vue.js +9 -5
- package/color-picker/vue.js +4 -0
- package/color-select-panel/alpha-select/index.js +17 -12
- package/color-select-panel/alpha-select/vue.js +4 -2
- package/color-select-panel/hue-select/index.js +42 -11
- package/color-select-panel/hue-select/vue.js +32 -6
- package/color-select-panel/index.js +223 -39
- package/color-select-panel/linear-gradient/index.js +131 -0
- package/color-select-panel/linear-gradient/vue.js +21 -0
- package/color-select-panel/sv-select/index.js +12 -9
- package/color-select-panel/sv-select/vue.js +4 -2
- package/color-select-panel/utils/color-map.js +154 -0
- package/color-select-panel/utils/color-points.js +86 -0
- package/color-select-panel/utils/color.js +1 -1
- package/color-select-panel/utils/context.js +14 -0
- package/color-select-panel/vue.js +3 -3
- package/common/deps/infinite-scroll.js +1 -1
- package/dialog-box/index.js +3 -3
- package/dialog-box/vue.js +1 -0
- package/drawer/index.js +20 -0
- package/drawer/vue.js +9 -1
- package/dropdown/index.js +10 -4
- package/file-upload/index.js +18 -4
- package/form-item/index.js +28 -16
- package/form-item/vue.js +50 -11
- package/grid/static/array/eachTree.js +1 -0
- package/grid/utils/common.js +10 -3
- package/grid-select/index.js +418 -32
- package/grid-select/vue.js +103 -9
- package/guide/index.js +3 -3
- package/guide/vue.js +11 -1
- package/input/vue.js +2 -1
- package/package.json +3 -3
- package/picker/index.js +30 -13
- package/picker/vue.js +10 -0
- package/popover/index.js +1 -1
- package/rich-text/index.js +42 -0
- package/select/index.js +32 -15
- package/select/vue.js +31 -10
- package/select-dropdown/vue.js +8 -3
- package/select-wrapper/vue.js +134 -0
- package/slider/vue.js +7 -0
- package/space/index.js +30 -0
- package/space/vue.js +39 -0
- package/switch/vue.js +19 -0
- package/tab-nav/index.js +2 -2
- package/tabs-mf/index.js +9 -1
- package/tabs-mf/vue-nav.js +70 -22
- package/tabs-mf/vue-slider-bar.js +24 -0
- package/tabs-mf/vue.js +23 -5
- package/tag/index.js +1 -1
- package/transfer-panel/index.js +2 -1
- package/tree-menu/index.js +4 -0
- package/tree-menu/vue.js +3 -0
- package/tree-select/index.js +13 -4
- package/tree-select/vue.js +19 -3
- package/types/autocomplete.type.d.ts +2 -1
- package/types/color-select-panel.type.d.ts +197 -1
- package/types/date-picker.type.d.ts +38 -2
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-dd403065.d.ts → form.type-a54e1c06.d.ts} +2 -2
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +1 -1
- package/types/modal.type.d.ts +4 -0
- package/types/numeric.type.d.ts +1 -1
- package/types/picker.type.d.ts +42 -2
- package/types/popeditor.type.d.ts +76 -4
- package/types/popover.type.d.ts +1 -1
- package/types/space.type.d.ts +31 -0
- package/types/switch.type.d.ts +2 -1
- package/types/transfer.type.d.ts +3 -3
- package/types/tree-menu.type.d.ts +38 -2
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-36a8374a.d.ts → upload-list.type-d5ff675d.d.ts} +1 -1
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
package/space/vue.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { getGapStyle } from "./index";
|
|
3
|
+
const api = ["state", "orderedChildren"];
|
|
4
|
+
function isVNodeFn(node) {
|
|
5
|
+
return !!(node && (node.__v_isVNode || node.componentOptions));
|
|
6
|
+
}
|
|
7
|
+
const renderless = (props, hooks, { slots }) => {
|
|
8
|
+
const { reactive, computed } = hooks;
|
|
9
|
+
const state = reactive({
|
|
10
|
+
gapStyle: computed(() => getGapStyle(props))
|
|
11
|
+
});
|
|
12
|
+
const orderedChildren = computed(() => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const children = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
|
|
15
|
+
const validChildren = children.filter((v) => {
|
|
16
|
+
if (!isVNodeFn(v))
|
|
17
|
+
return false;
|
|
18
|
+
const type = v.type;
|
|
19
|
+
return type !== "Comment" && type !== Symbol.for("v-comment");
|
|
20
|
+
});
|
|
21
|
+
if (!((_b = props.order) == null ? void 0 : _b.length))
|
|
22
|
+
return validChildren;
|
|
23
|
+
const map = {};
|
|
24
|
+
validChildren.forEach((child) => {
|
|
25
|
+
var _a2, _b2, _c;
|
|
26
|
+
const key = (_c = child.key) != null ? _c : Array.isArray((_a2 = child.props) == null ? void 0 : _a2.class) ? child.props.class.join(" ") : (_b2 = child.props) == null ? void 0 : _b2.class;
|
|
27
|
+
if (key)
|
|
28
|
+
map[String(key)] = child;
|
|
29
|
+
});
|
|
30
|
+
const sorted = props.order.map((k) => map[k]).filter(Boolean);
|
|
31
|
+
const rest = validChildren.filter((v) => !props.order.includes(String(v.key)));
|
|
32
|
+
return [...sorted, ...rest];
|
|
33
|
+
});
|
|
34
|
+
return { state, orderedChildren };
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
api,
|
|
38
|
+
renderless
|
|
39
|
+
};
|
package/switch/vue.js
CHANGED
|
@@ -18,6 +18,25 @@ const renderless = (props, { computed, watch, reactive, inject }, { parent, cons
|
|
|
18
18
|
} else {
|
|
19
19
|
return props.showText;
|
|
20
20
|
}
|
|
21
|
+
}),
|
|
22
|
+
// 添加 switchStyle 计算属性
|
|
23
|
+
switchStyle: computed(() => {
|
|
24
|
+
if (props.width) {
|
|
25
|
+
return {
|
|
26
|
+
width: typeof props.width === "number" ? `${props.width}px` : props.width
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {};
|
|
30
|
+
}),
|
|
31
|
+
// 添加 displayOnlyStyle 计算属性
|
|
32
|
+
displayOnlyStyle: computed(() => {
|
|
33
|
+
if (props.width) {
|
|
34
|
+
return {
|
|
35
|
+
width: typeof props.width === "number" ? `${props.width}px` : props.width,
|
|
36
|
+
display: "inline-block"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {};
|
|
21
40
|
})
|
|
22
41
|
});
|
|
23
42
|
const api2 = {
|
package/tab-nav/index.js
CHANGED
|
@@ -301,11 +301,11 @@ const watchCurrentName = ({ nextTick, vm, state }) => () => {
|
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
303
|
const handleTitleMouseenter = ({ state, vm, props }) => (e, title) => {
|
|
304
|
-
const dom = e.target;
|
|
305
|
-
const el = title == null ? void 0 : title.el;
|
|
306
304
|
if (props.tooltipConfig) {
|
|
307
305
|
return;
|
|
308
306
|
}
|
|
307
|
+
const dom = e.target;
|
|
308
|
+
const el = title == null ? void 0 : title.el;
|
|
309
309
|
if (dom && el && el.scrollWidth > el.offsetWidth) {
|
|
310
310
|
const tooltip = vm.$refs.tooltip;
|
|
311
311
|
tooltip.state.referenceElm = dom;
|
package/tabs-mf/index.js
CHANGED
|
@@ -96,16 +96,24 @@ const clickMore = (api) => (name) => {
|
|
|
96
96
|
api.setActive(name);
|
|
97
97
|
api.scrollTo(name);
|
|
98
98
|
};
|
|
99
|
-
const removeItem = ({ props, state, emit }) => (name, silent = false) => {
|
|
99
|
+
const removeItem = ({ props, state, emit, api }) => (name, silent = false) => {
|
|
100
100
|
const itemIndex = state.items.findIndex((item) => item.name === name);
|
|
101
101
|
const navIndex = state.navs.findIndex((item) => item.name === name);
|
|
102
|
+
const isCurrent = state.currentItem && state.currentItem.name === name;
|
|
103
|
+
const nextNav = state.navs[navIndex - 1] || state.navs[navIndex + 1];
|
|
102
104
|
if (!~itemIndex)
|
|
103
105
|
return;
|
|
104
106
|
const emitEvent = () => {
|
|
107
|
+
var _a;
|
|
105
108
|
state.items.splice(itemIndex, 1);
|
|
106
109
|
state.items = [...state.items];
|
|
107
110
|
state.navs.splice(navIndex, 1);
|
|
108
111
|
state.navs = [...state.navs];
|
|
112
|
+
if (isCurrent) {
|
|
113
|
+
const nextName = nextNav ? nextNav.name : ((_a = state.items[0]) == null ? void 0 : _a.name) || "";
|
|
114
|
+
api.changeCurrentName(nextName);
|
|
115
|
+
state.currentItem = state.items.find((item) => item.name === nextName) || null;
|
|
116
|
+
}
|
|
109
117
|
if (!silent) {
|
|
110
118
|
emit("edit", name, "remove");
|
|
111
119
|
emit("close", name);
|
package/tabs-mf/vue-nav.js
CHANGED
|
@@ -1,42 +1,90 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
const api = ["state"];
|
|
3
|
-
const renderless = (props, { reactive, inject, computed, onMounted, onBeforeUnmount }, { vm }) => {
|
|
3
|
+
const renderless = (props, { reactive, inject, computed, onMounted, onBeforeUnmount, watch, nextTick }, { vm }) => {
|
|
4
4
|
const tabs = inject("tabs", null);
|
|
5
5
|
const state = reactive({
|
|
6
6
|
navItems: computed(() => tabs.state.items),
|
|
7
7
|
currentNav: computed(() => tabs.state.navs[state.currentIndex]),
|
|
8
8
|
currentIndex: computed(
|
|
9
|
-
() => tabs.state.navs.findIndex((item) => tabs.state.
|
|
9
|
+
() => tabs.state.navs.findIndex((item) => tabs.state.cacheCurrentItem && tabs.state.cacheCurrentItem.name === item.name)
|
|
10
10
|
),
|
|
11
11
|
currentWidth: 0,
|
|
12
12
|
currentPosition: 0
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const updateSliderBar = () => {
|
|
15
|
+
const nav = state.currentNav;
|
|
16
|
+
if (nav && nav.$el) {
|
|
17
|
+
state.currentWidth = nav.$el.offsetWidth || 0;
|
|
18
|
+
state.currentPosition = nav.$el.offsetLeft || 0;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
let mutationObserver;
|
|
22
|
+
let resizeObserver;
|
|
15
23
|
onMounted(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
mutationObserver = new MutationObserver(() => {
|
|
25
|
+
nextTick(() => {
|
|
26
|
+
updateSliderBar();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
mutationObserver.observe(vm.$el, { attributes: true, subtree: true, childList: true });
|
|
30
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
31
|
+
resizeObserver = new ResizeObserver(() => {
|
|
32
|
+
nextTick(() => {
|
|
33
|
+
updateSliderBar();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
const navItems = vm.$el.querySelectorAll('[data-tag="tiny-tab-nav-item"]');
|
|
37
|
+
navItems.forEach((item) => {
|
|
38
|
+
resizeObserver.observe(item);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
nextTick(() => {
|
|
42
|
+
updateSliderBar();
|
|
29
43
|
});
|
|
30
|
-
observer.observe(vm.$el, { attributes: true, subtree: true });
|
|
31
44
|
});
|
|
45
|
+
watch(
|
|
46
|
+
() => state.currentNav,
|
|
47
|
+
() => {
|
|
48
|
+
nextTick(() => {
|
|
49
|
+
updateSliderBar();
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
{ immediate: true }
|
|
53
|
+
);
|
|
54
|
+
watch(
|
|
55
|
+
() => state.navItems,
|
|
56
|
+
() => {
|
|
57
|
+
if (resizeObserver) {
|
|
58
|
+
resizeObserver.disconnect();
|
|
59
|
+
nextTick(() => {
|
|
60
|
+
const navItems = vm.$el.querySelectorAll('[data-tag="tiny-tab-nav-item"]');
|
|
61
|
+
navItems.forEach((item) => {
|
|
62
|
+
resizeObserver.observe(item);
|
|
63
|
+
});
|
|
64
|
+
updateSliderBar();
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
nextTick(() => {
|
|
68
|
+
updateSliderBar();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{ deep: true }
|
|
73
|
+
);
|
|
32
74
|
onBeforeUnmount(() => {
|
|
33
|
-
if (
|
|
34
|
-
|
|
75
|
+
if (mutationObserver) {
|
|
76
|
+
mutationObserver.disconnect();
|
|
77
|
+
mutationObserver = null;
|
|
35
78
|
}
|
|
36
|
-
|
|
37
|
-
|
|
79
|
+
if (resizeObserver) {
|
|
80
|
+
resizeObserver.disconnect();
|
|
81
|
+
resizeObserver = null;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.assign(api, {
|
|
85
|
+
state
|
|
38
86
|
});
|
|
39
|
-
return
|
|
87
|
+
return api;
|
|
40
88
|
};
|
|
41
89
|
export {
|
|
42
90
|
api,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const api = ["state"];
|
|
3
|
+
const renderless = (props, { reactive, inject, computed, onMounted, onUnmounted, onUpdated }, { vm, emit }) => {
|
|
4
|
+
const tabs = inject("tabs", null);
|
|
5
|
+
const state = reactive({
|
|
6
|
+
currentNav: computed(() => props.currentNav || null),
|
|
7
|
+
currentWidth: computed(() => props.currentWidth + "px"),
|
|
8
|
+
currentPosition: computed(() => props.currentPosition + "px")
|
|
9
|
+
});
|
|
10
|
+
const handleTransitionEnd = () => {
|
|
11
|
+
tabs.state.currentItem = tabs.state.cacheCurrentItem;
|
|
12
|
+
};
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
vm.$el.addEventListener("transitionend", handleTransitionEnd);
|
|
15
|
+
});
|
|
16
|
+
onUnmounted(() => {
|
|
17
|
+
vm.$el.removeEventListener("transitionend", handleTransitionEnd);
|
|
18
|
+
});
|
|
19
|
+
return { state };
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
api,
|
|
23
|
+
renderless
|
|
24
|
+
};
|
package/tabs-mf/vue.js
CHANGED
|
@@ -37,7 +37,8 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
37
37
|
const state = reactive({
|
|
38
38
|
items: [],
|
|
39
39
|
navs: [],
|
|
40
|
-
currentItem:
|
|
40
|
+
currentItem: null,
|
|
41
|
+
cacheCurrentItem: computed(() => state.items.find((item) => item.selected)),
|
|
41
42
|
key: computed(() => state.currentItem ? state.currentItem.name : random()),
|
|
42
43
|
separator: props.separator,
|
|
43
44
|
swipeable: computed(() => api2.computedSwipeable()),
|
|
@@ -52,7 +53,7 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
52
53
|
addItem: addItem(state),
|
|
53
54
|
addNav: addNav(state),
|
|
54
55
|
scrollTo: scrollTo({ vm, state }),
|
|
55
|
-
removeItem: removeItem({ props, state, emit }),
|
|
56
|
+
removeItem: removeItem({ props, state, emit, api: api2 }),
|
|
56
57
|
changeCurrentName: changeCurrentName({ state, emit }),
|
|
57
58
|
clickMore: clickMore(api2),
|
|
58
59
|
beforeCarouselSwipe: beforeCarouselSwipe({ api: api2, state, vm }),
|
|
@@ -81,10 +82,27 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
81
82
|
() => props.modelValue,
|
|
82
83
|
(name) => name && api2.setActive(name)
|
|
83
84
|
);
|
|
85
|
+
watch(
|
|
86
|
+
() => state.cacheCurrentItem,
|
|
87
|
+
(newItem) => {
|
|
88
|
+
if (newItem && newItem !== state.currentItem) {
|
|
89
|
+
state.currentItem = newItem;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{ immediate: true }
|
|
93
|
+
);
|
|
84
94
|
onMounted(() => {
|
|
85
|
-
nextTick(() =>
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
nextTick(() => {
|
|
96
|
+
api2.observeTabSwipeSize();
|
|
97
|
+
if (!state.currentItem && state.cacheCurrentItem) {
|
|
98
|
+
state.currentItem = state.cacheCurrentItem;
|
|
99
|
+
}
|
|
100
|
+
if (!props.activeName && !props.modelValue && state.items.length > 0 && !state.cacheCurrentItem) {
|
|
101
|
+
api2.changeCurrentName(state.items[0].name);
|
|
102
|
+
}
|
|
103
|
+
props.activeName && api2.scrollTo(props.activeName);
|
|
104
|
+
props.modelValue && api2.scrollTo(props.modelValue);
|
|
105
|
+
});
|
|
88
106
|
});
|
|
89
107
|
onBeforeUnmount(() => {
|
|
90
108
|
api2.unobserveTabSwipeSize();
|
package/tag/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const handleClose = ({ emit, props, state }) => (event) => {
|
|
|
8
8
|
props.beforeDelete ? props.beforeDelete(close) : close();
|
|
9
9
|
};
|
|
10
10
|
const handleClick = ({ emit, props, parent, state }) => (event) => {
|
|
11
|
-
if (props.
|
|
11
|
+
if (props.disabled)
|
|
12
12
|
return;
|
|
13
13
|
parent.$parent && parent.$parent.tagSelectable && event.stopPropagation();
|
|
14
14
|
state.selected = !state.selected;
|
package/transfer-panel/index.js
CHANGED
|
@@ -39,10 +39,11 @@ const getFilterData = ({ api, props, state, Table, Tree }) => () => {
|
|
|
39
39
|
return showFilterData(api.getFilterTreeData(copyArray(props.data)), "visible");
|
|
40
40
|
} else {
|
|
41
41
|
return props.data.filter((item) => {
|
|
42
|
+
var _a;
|
|
42
43
|
if (typeof props.filterMethod === "function") {
|
|
43
44
|
return props.filterMethod(state.query, item);
|
|
44
45
|
} else {
|
|
45
|
-
const label = item[state.labelProp] || item[state.keyProp].toString();
|
|
46
|
+
const label = item[state.labelProp] || ((_a = item[state.keyProp]) == null ? void 0 : _a.toString()) || "";
|
|
46
47
|
return label.toLowerCase().includes(state.query.toLowerCase());
|
|
47
48
|
}
|
|
48
49
|
});
|
package/tree-menu/index.js
CHANGED
|
@@ -56,6 +56,9 @@ const watchFilterText = ({ vm }) => (value) => {
|
|
|
56
56
|
const nodeDragStart = (emit) => (node, event) => {
|
|
57
57
|
emit("node-drag-start", node, event);
|
|
58
58
|
};
|
|
59
|
+
const inputChange = ({ emit, state }) => () => {
|
|
60
|
+
emit("input-change", state.filterText);
|
|
61
|
+
};
|
|
59
62
|
const nodeDragEnter = (emit) => (dragNode, dropNode, event) => {
|
|
60
63
|
emit("node-drag-enter", dragNode, dropNode, event);
|
|
61
64
|
};
|
|
@@ -155,6 +158,7 @@ export {
|
|
|
155
158
|
getTree,
|
|
156
159
|
handleToggleMenu,
|
|
157
160
|
initData,
|
|
161
|
+
inputChange,
|
|
158
162
|
nodeClick,
|
|
159
163
|
nodeCollapse,
|
|
160
164
|
nodeDragEnd,
|
package/tree-menu/vue.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
watchFilterText,
|
|
7
7
|
nodeDragStart,
|
|
8
8
|
nodeDragEnter,
|
|
9
|
+
inputChange,
|
|
9
10
|
nodeDragOver,
|
|
10
11
|
nodeDragEnd,
|
|
11
12
|
nodeDrop,
|
|
@@ -35,6 +36,7 @@ const api = [
|
|
|
35
36
|
"filterNode",
|
|
36
37
|
"nodeDragStart",
|
|
37
38
|
"nodeDragEnter",
|
|
39
|
+
"inputChange",
|
|
38
40
|
"nodeDragOver",
|
|
39
41
|
"nodeDragEnd",
|
|
40
42
|
"nodeDrop",
|
|
@@ -86,6 +88,7 @@ const renderless = (props, { computed, watch, reactive, onMounted }, { t, servic
|
|
|
86
88
|
nodeDragOver: nodeDragOver(emit),
|
|
87
89
|
nodeDragStart: nodeDragStart(emit),
|
|
88
90
|
nodeDragEnter: nodeDragEnter(emit),
|
|
91
|
+
inputChange: inputChange({ emit, state }),
|
|
89
92
|
currentChange: currentChange(emit),
|
|
90
93
|
watchFilterText: watchFilterText({ vm }),
|
|
91
94
|
getTitle: getTitle(props),
|
package/tree-select/index.js
CHANGED
|
@@ -87,16 +87,20 @@ const getChildValue = () => (childNodes, key) => {
|
|
|
87
87
|
return ids;
|
|
88
88
|
};
|
|
89
89
|
const mounted = ({ api, state, props, vm }) => () => {
|
|
90
|
-
if (!state.modelValue || state.modelValue.length === 0)
|
|
90
|
+
if (!state.modelValue || Array.isArray(state.modelValue) && state.modelValue.length === 0)
|
|
91
91
|
return;
|
|
92
92
|
if (props.multiple) {
|
|
93
93
|
let initialNodes = [];
|
|
94
94
|
if (Array.isArray(state.modelValue)) {
|
|
95
95
|
state.modelValue.forEach((value) => {
|
|
96
96
|
const option = api.getPluginOption(value);
|
|
97
|
-
|
|
97
|
+
if (option && option.length > 0) {
|
|
98
|
+
initialNodes = initialNodes.concat(option);
|
|
99
|
+
}
|
|
98
100
|
});
|
|
99
101
|
}
|
|
102
|
+
if (initialNodes.length === 0)
|
|
103
|
+
return;
|
|
100
104
|
const selected = initialNodes.map((node) => {
|
|
101
105
|
return __spreadProps(__spreadValues({}, node), {
|
|
102
106
|
currentLabel: node[props.textField],
|
|
@@ -106,7 +110,10 @@ const mounted = ({ api, state, props, vm }) => () => {
|
|
|
106
110
|
vm.$refs.baseSelectRef.updateSelectedData(selected);
|
|
107
111
|
state.defaultCheckedKeys = api.getCheckedData(selected);
|
|
108
112
|
} else {
|
|
109
|
-
const
|
|
113
|
+
const options = api.getPluginOption(state.modelValue);
|
|
114
|
+
const data = options && options.length > 0 ? options[0] : null;
|
|
115
|
+
if (!data)
|
|
116
|
+
return;
|
|
110
117
|
vm.$refs.baseSelectRef.updateSelectedData(__spreadProps(__spreadValues({}, data), {
|
|
111
118
|
currentLabel: data[props.textField],
|
|
112
119
|
value: data[props.valueField],
|
|
@@ -138,7 +145,9 @@ const watchValue = ({ api, props, vm, state }) => (newValue, oldValue) => {
|
|
|
138
145
|
if (Array.isArray(checkedKeys)) {
|
|
139
146
|
checkedKeys.forEach((value) => {
|
|
140
147
|
const option = api.getPluginOption(value);
|
|
141
|
-
|
|
148
|
+
if (option && option.length > 0) {
|
|
149
|
+
initialNodes = initialNodes.concat(option);
|
|
150
|
+
}
|
|
142
151
|
});
|
|
143
152
|
}
|
|
144
153
|
const selected = initialNodes.map((node) => {
|
package/tree-select/vue.js
CHANGED
|
@@ -13,12 +13,21 @@ import {
|
|
|
13
13
|
const api = ["state", "check", "filter", "nodeClick"];
|
|
14
14
|
const renderless = (props, { reactive, computed, watch, onMounted }, { vm, emit }) => {
|
|
15
15
|
const api2 = {};
|
|
16
|
+
const resolveTreeData = () => {
|
|
17
|
+
if (Array.isArray(props.treeOp)) {
|
|
18
|
+
return props.treeOp;
|
|
19
|
+
}
|
|
20
|
+
if (props.treeOp && Array.isArray(props.treeOp.data)) {
|
|
21
|
+
return props.treeOp.data;
|
|
22
|
+
}
|
|
23
|
+
return [];
|
|
24
|
+
};
|
|
16
25
|
const state = reactive({
|
|
17
26
|
childrenName: computed(() => props.treeOp.props && props.treeOp.props.children || "children"),
|
|
18
27
|
currentKey: props.modelValue,
|
|
19
28
|
defaultCheckedKeys: [],
|
|
20
29
|
remoteData: [],
|
|
21
|
-
treeData:
|
|
30
|
+
treeData: resolveTreeData(),
|
|
22
31
|
modelValue: []
|
|
23
32
|
});
|
|
24
33
|
Object.assign(api2, {
|
|
@@ -34,8 +43,15 @@ const renderless = (props, { reactive, computed, watch, onMounted }, { vm, emit
|
|
|
34
43
|
getChildValue: getChildValue()
|
|
35
44
|
});
|
|
36
45
|
watch(
|
|
37
|
-
() =>
|
|
38
|
-
|
|
46
|
+
() => {
|
|
47
|
+
var _a;
|
|
48
|
+
return Array.isArray(props.treeOp) ? props.treeOp : (_a = props.treeOp) == null ? void 0 : _a.data;
|
|
49
|
+
},
|
|
50
|
+
(data) => {
|
|
51
|
+
if (Array.isArray(data)) {
|
|
52
|
+
state.treeData = data;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
39
55
|
{ immediate: true, deep: true }
|
|
40
56
|
);
|
|
41
57
|
watch(
|
|
@@ -160,9 +160,10 @@ declare const highlight: ({ constants, vm, state }: {
|
|
|
160
160
|
declare const watchVisible: ({ suggestionState, vm }: {
|
|
161
161
|
suggestionState: IAutoCompleteApi['suggestionState'];
|
|
162
162
|
}) => (val: any) => void;
|
|
163
|
-
declare const mounted: ({ vm, state, suggestionState }: {
|
|
163
|
+
declare const mounted: ({ vm, state, suggestionState, props }: {
|
|
164
164
|
state: IAutoCompleteState;
|
|
165
165
|
suggestionState: IAutoCompleteApi['suggestionState'];
|
|
166
|
+
props: IAutoCompleteProps;
|
|
166
167
|
}) => () => void;
|
|
167
168
|
|
|
168
169
|
interface IAutoCompleteState {
|
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
interface LinearGradientState {
|
|
4
|
+
linearGradientBarBackground: string;
|
|
5
|
+
}
|
|
6
|
+
interface ColorOptions {
|
|
7
|
+
enableAlpha: boolean;
|
|
8
|
+
format: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
interface HSVColor {
|
|
12
|
+
h: number;
|
|
13
|
+
s: number;
|
|
14
|
+
v: number;
|
|
15
|
+
}
|
|
16
|
+
interface RGBColor {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
}
|
|
21
|
+
interface HSLColor {
|
|
22
|
+
hue: number;
|
|
23
|
+
sat: number;
|
|
24
|
+
light: number;
|
|
25
|
+
}
|
|
26
|
+
interface IColor {
|
|
27
|
+
enableAlpha: boolean;
|
|
28
|
+
format: string;
|
|
29
|
+
value: string;
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
get(prop: string): number;
|
|
32
|
+
set(props: {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}): void;
|
|
35
|
+
set(prop: string, value: number): void;
|
|
36
|
+
compare(color: IColor): boolean;
|
|
37
|
+
isHSL(value: string): boolean;
|
|
38
|
+
isHsv(value: string): boolean;
|
|
39
|
+
isRgb(value: string): boolean;
|
|
40
|
+
isHex(value: string): boolean;
|
|
41
|
+
onHsv(value: string): void;
|
|
42
|
+
onRgb(value: string): void;
|
|
43
|
+
onHex(value: string): void;
|
|
44
|
+
onHsl(value: string): void;
|
|
45
|
+
fromHSV(hsv: HSVColor): void;
|
|
46
|
+
fromString(value: string): void;
|
|
47
|
+
toRgb(): RGBColor;
|
|
48
|
+
onChange(): void;
|
|
49
|
+
}
|
|
50
|
+
interface ColorUtils {
|
|
51
|
+
rgb2hsv(rgb: RGBColor): HSVColor;
|
|
52
|
+
hsv2rgb(hsv: HSVColor): RGBColor;
|
|
53
|
+
hsv2hsl(hsv: {
|
|
54
|
+
hue: number;
|
|
55
|
+
sat: number;
|
|
56
|
+
val: number;
|
|
57
|
+
}): [number, number, number];
|
|
58
|
+
hsl2hsv(hsl: HSLColor): HSVColor;
|
|
59
|
+
toHex(rgb: RGBColor): string;
|
|
60
|
+
parseHex(hex: string): number;
|
|
61
|
+
hexOne(value: number): string;
|
|
62
|
+
}
|
|
63
|
+
interface IColorPoint {
|
|
64
|
+
color: IColor;
|
|
65
|
+
cursorLeft: number;
|
|
66
|
+
}
|
|
67
|
+
interface ColorPanelContext {
|
|
68
|
+
colorMode: ComputedRef<IColorSelectPanelProps['colorMode']>;
|
|
69
|
+
activeColor: Ref<IColorPoint>;
|
|
70
|
+
bar: Ref<HTMLElement | null>;
|
|
71
|
+
colorPoints: Ref<IColorPoint[]>;
|
|
72
|
+
linearGardientValue: Ref<string>;
|
|
73
|
+
deg: Ref<number>;
|
|
74
|
+
}
|
|
75
|
+
type IColorSelectPanelMaybeRef<T> = IColorSelectPanelRef<T> | T;
|
|
1
76
|
interface IColorSelectPanelRef<T> {
|
|
2
77
|
value: T;
|
|
3
78
|
}
|
|
@@ -7,6 +82,7 @@ interface IColorSelectPanelProps {
|
|
|
7
82
|
history: string[];
|
|
8
83
|
predefine: string[];
|
|
9
84
|
format: ('hsl' | 'hsv' | 'hex' | 'rgb')[];
|
|
85
|
+
colorMode: 'linear-gradient' | 'monochrome';
|
|
10
86
|
modelValue: string;
|
|
11
87
|
enableHistory: boolean;
|
|
12
88
|
enablePredefineColor: boolean;
|
|
@@ -23,5 +99,125 @@ interface IColorSelectPanelHueProps<C> {
|
|
|
23
99
|
interface IColorSelectPanelAlphaPanel<C> {
|
|
24
100
|
color: C;
|
|
25
101
|
}
|
|
102
|
+
interface UseColorPointsRet {
|
|
103
|
+
onClick: (element: Element, point: IColorPoint) => void;
|
|
104
|
+
linearGradientValue: Readonly<Ref<string>>;
|
|
105
|
+
updateDeg: (_deg: number) => void;
|
|
106
|
+
removePoint: (point: IColorPoint) => void;
|
|
107
|
+
addPoint: (point: IColorPoint) => void;
|
|
108
|
+
setActivePoint: (point: IColorPoint) => void;
|
|
109
|
+
getActviePoint: () => Ref<IColorPoint>;
|
|
110
|
+
}
|
|
111
|
+
interface ColorSelectPanelExtends {
|
|
112
|
+
parse: parse;
|
|
113
|
+
}
|
|
114
|
+
interface LinearGradientNode {
|
|
115
|
+
type: 'linear-gradient';
|
|
116
|
+
orientation?: DirectionalNode | AngularNode | undefined;
|
|
117
|
+
colorStops: ColorStop[];
|
|
118
|
+
}
|
|
119
|
+
interface RepeatingLinearGradientNode {
|
|
120
|
+
type: 'repeating-linear-gradient';
|
|
121
|
+
orientation?: DirectionalNode | AngularNode | undefined;
|
|
122
|
+
colorStops: ColorStop[];
|
|
123
|
+
}
|
|
124
|
+
interface RadialGradientNode {
|
|
125
|
+
type: 'radial-gradient';
|
|
126
|
+
orientation?: Array<ShapeNode | DefaultRadialNode | ExtentKeywordNode> | undefined;
|
|
127
|
+
colorStops: ColorStop[];
|
|
128
|
+
}
|
|
129
|
+
interface RepeatingRadialGradientNode {
|
|
130
|
+
type: 'repeating-radial-gradient';
|
|
131
|
+
orientation?: Array<ShapeNode | DefaultRadialNode | ExtentKeywordNode> | undefined;
|
|
132
|
+
colorStops: ColorStop[];
|
|
133
|
+
}
|
|
134
|
+
interface DirectionalNode {
|
|
135
|
+
type: 'directional';
|
|
136
|
+
value: 'left' | 'top' | 'bottom' | 'right' | 'left top' | 'top left' | 'left bottom' | 'bottom left' | 'right top' | 'top right' | 'right bottom' | 'bottom right';
|
|
137
|
+
}
|
|
138
|
+
interface AngularNode {
|
|
139
|
+
type: 'angular';
|
|
140
|
+
value: string;
|
|
141
|
+
}
|
|
142
|
+
interface LiteralNode {
|
|
143
|
+
type: 'literal';
|
|
144
|
+
value: string;
|
|
145
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
146
|
+
}
|
|
147
|
+
interface HexNode {
|
|
148
|
+
type: 'hex';
|
|
149
|
+
value: string;
|
|
150
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
151
|
+
}
|
|
152
|
+
interface RgbNode {
|
|
153
|
+
type: 'rgb';
|
|
154
|
+
value: [string, string, string];
|
|
155
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
156
|
+
}
|
|
157
|
+
interface RgbaNode {
|
|
158
|
+
type: 'rgba';
|
|
159
|
+
value: [string, string, string, string?];
|
|
160
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
161
|
+
}
|
|
162
|
+
interface HslNode {
|
|
163
|
+
type: 'hsl';
|
|
164
|
+
value: [string, string, string];
|
|
165
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
166
|
+
}
|
|
167
|
+
interface HslaNode {
|
|
168
|
+
type: 'hsla';
|
|
169
|
+
value: [string, string, string, string?];
|
|
170
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
171
|
+
}
|
|
172
|
+
interface VarNode {
|
|
173
|
+
type: 'var';
|
|
174
|
+
value: string;
|
|
175
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
176
|
+
}
|
|
177
|
+
interface ShapeNode {
|
|
178
|
+
type: 'shape';
|
|
179
|
+
style?: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode | undefined;
|
|
180
|
+
value: 'ellipse' | 'circle';
|
|
181
|
+
at?: PositionNode | undefined;
|
|
182
|
+
}
|
|
183
|
+
interface DefaultRadialNode {
|
|
184
|
+
type: 'default-radial';
|
|
185
|
+
at: PositionNode;
|
|
186
|
+
}
|
|
187
|
+
interface PositionKeywordNode {
|
|
188
|
+
type: 'position-keyword';
|
|
189
|
+
value: 'center' | 'left' | 'top' | 'bottom' | 'right';
|
|
190
|
+
}
|
|
191
|
+
interface PositionNode {
|
|
192
|
+
type: 'position';
|
|
193
|
+
value: {
|
|
194
|
+
x: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode;
|
|
195
|
+
y: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
interface ExtentKeywordNode {
|
|
199
|
+
type: 'extent-keyword';
|
|
200
|
+
value: 'closest-side' | 'closest-corner' | 'farthest-side' | 'farthest-corner' | 'contain' | 'cover';
|
|
201
|
+
at?: PositionNode | undefined;
|
|
202
|
+
}
|
|
203
|
+
interface PxNode {
|
|
204
|
+
type: 'px';
|
|
205
|
+
value: string;
|
|
206
|
+
}
|
|
207
|
+
interface EmNode {
|
|
208
|
+
type: 'em';
|
|
209
|
+
value: string;
|
|
210
|
+
}
|
|
211
|
+
interface PercentNode {
|
|
212
|
+
type: '%';
|
|
213
|
+
value: string;
|
|
214
|
+
}
|
|
215
|
+
interface CalcNode {
|
|
216
|
+
type: 'calc';
|
|
217
|
+
value: string;
|
|
218
|
+
}
|
|
219
|
+
type ColorStop = LiteralNode | HexNode | RgbNode | RgbaNode | HslNode | HslaNode | VarNode;
|
|
220
|
+
type GradientNode = LinearGradientNode | RepeatingLinearGradientNode | RadialGradientNode | RepeatingRadialGradientNode;
|
|
221
|
+
type parse = (value: string) => GradientNode[];
|
|
26
222
|
|
|
27
|
-
export { IColorSelectPanelAlphProps, IColorSelectPanelAlphaPanel, IColorSelectPanelHueProps, IColorSelectPanelProps, IColorSelectPanelRef, IColorSelectPanelSVProps };
|
|
223
|
+
export { AngularNode, CalcNode, ColorOptions, ColorPanelContext, ColorSelectPanelExtends, ColorStop, ColorUtils, DefaultRadialNode, DirectionalNode, EmNode, ExtentKeywordNode, GradientNode, HSLColor, HSVColor, HexNode, HslNode, HslaNode, IColor, IColorPoint, IColorSelectPanelAlphProps, IColorSelectPanelAlphaPanel, IColorSelectPanelHueProps, IColorSelectPanelMaybeRef, IColorSelectPanelProps, IColorSelectPanelRef, IColorSelectPanelSVProps, LinearGradientNode, LinearGradientState, LiteralNode, PercentNode, PositionKeywordNode, PositionNode, PxNode, RGBColor, RadialGradientNode, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbNode, RgbaNode, ShapeNode, UseColorPointsRet, VarNode, parse };
|