@opentiny/vue-renderless 3.27.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/drawer/index.js +20 -0
- package/drawer/vue.js +9 -1
- package/dropdown/index.js +10 -4
- package/file-upload/index.js +18 -5
- 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/vue.js +11 -1
- package/package.json +3 -3
- package/picker/index.js +30 -13
- package/popover/index.js +1 -1
- package/rich-text/index.js +42 -0
- package/select/index.js +2 -2
- package/select/vue.js +2 -1
- package/select-dropdown/vue.js +8 -3
- package/select-wrapper/vue.js +134 -0
- package/switch/vue.js +19 -0
- package/tabs-mf/index.js +9 -1
- package/tabs-mf/vue-nav.js +66 -9
- package/tabs-mf/vue.js +21 -5
- package/transfer-panel/index.js +2 -1
- package/tree-select/index.js +13 -4
- package/tree-select/vue.js +19 -3
- package/types/autocomplete.type.d.ts +2 -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/picker.type.d.ts +38 -2
- package/types/popeditor.type.d.ts +76 -4
- package/types/popover.type.d.ts +1 -1
- package/types/switch.type.d.ts +1 -0
- 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/picker/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__spreadProps,
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
|
-
import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone } from "@opentiny/utils";
|
|
5
|
+
import { toDate1, getDateWithNewTimezone, getStrTimezone, getLocalTimezone, parseIso8601 } from "@opentiny/utils";
|
|
6
6
|
import { isNumber, isDate } from "@opentiny/utils";
|
|
7
7
|
import { userPopper } from "@opentiny/vue-hooks";
|
|
8
8
|
import { DATEPICKER } from "@opentiny/utils";
|
|
@@ -127,6 +127,24 @@ const parseAsFormatAndType = ({ api }) => (value, customFormat, type, rangeSepar
|
|
|
127
127
|
const format = customFormat || DATEPICKER.DateFormats[type];
|
|
128
128
|
return parser(value, format, rangeSeparator);
|
|
129
129
|
};
|
|
130
|
+
const ignoreTimezone = (value) => {
|
|
131
|
+
let res = value;
|
|
132
|
+
const ignoreTimezoneFn = (value2) => {
|
|
133
|
+
let date = value2;
|
|
134
|
+
const iso8601 = parseIso8601(value2);
|
|
135
|
+
if (iso8601) {
|
|
136
|
+
const { year, month, day, hours, minutes, seconds } = iso8601;
|
|
137
|
+
date = new Date(year, month, day, hours, minutes, seconds);
|
|
138
|
+
}
|
|
139
|
+
return date;
|
|
140
|
+
};
|
|
141
|
+
if (Array.isArray(res)) {
|
|
142
|
+
res = res.map((item) => ignoreTimezoneFn(item));
|
|
143
|
+
} else {
|
|
144
|
+
res = ignoreTimezoneFn(res);
|
|
145
|
+
}
|
|
146
|
+
return res;
|
|
147
|
+
};
|
|
130
148
|
const parsedValue = ({ api, props, state, t }) => () => {
|
|
131
149
|
if (!props.modelValue) {
|
|
132
150
|
return props.modelValue;
|
|
@@ -139,17 +157,16 @@ const parsedValue = ({ api, props, state, t }) => () => {
|
|
|
139
157
|
if (valueIsDateObject && !isServiceTimezone) {
|
|
140
158
|
return props.modelValue;
|
|
141
159
|
}
|
|
160
|
+
let value = ignoreTimezone(props.modelValue);
|
|
142
161
|
if (state.valueFormat) {
|
|
143
|
-
let date =
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
date = formatDate(date, state.valueFormat, t);
|
|
152
|
-
}
|
|
162
|
+
let date = value;
|
|
163
|
+
if (Array.isArray(date)) {
|
|
164
|
+
date = [].concat(date).map((item) => {
|
|
165
|
+
return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
if (state.valueFormat !== DATEPICKER.TimesTamp && isDate(date)) {
|
|
169
|
+
date = formatDate(date, state.valueFormat, t);
|
|
153
170
|
}
|
|
154
171
|
}
|
|
155
172
|
const result = api.parseAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
|
|
@@ -158,7 +175,7 @@ const parsedValue = ({ api, props, state, t }) => () => {
|
|
|
158
175
|
}
|
|
159
176
|
return getDateWithNewTimezone(result || props.modelValue, from, to, timezoneOffset);
|
|
160
177
|
}
|
|
161
|
-
const trans = (
|
|
178
|
+
const trans = (value2) => typeof value2 === "string" || isNumber(value2) ? toDate1(value2) : value2;
|
|
162
179
|
const values = [].concat(props.modelValue).map((val) => getDateWithNewTimezone(trans(val), from, to, timezoneOffset));
|
|
163
180
|
return values.length > 1 ? values : values[0];
|
|
164
181
|
};
|
|
@@ -1019,7 +1036,7 @@ const emitDbTime = ({ emit, state, t }) => (date) => {
|
|
|
1019
1036
|
if (isDate(item)) {
|
|
1020
1037
|
hasDate = true;
|
|
1021
1038
|
let currentDate = getDateWithNewTimezone(item, getLocalTimezone(), from);
|
|
1022
|
-
if (state.valueFormat) {
|
|
1039
|
+
if (state.valueFormat && state.valueFormat !== DATEPICKER.TimesTamp) {
|
|
1023
1040
|
currentDate = formatDate(currentDate, state.valueFormat, t);
|
|
1024
1041
|
}
|
|
1025
1042
|
return currentDate;
|
package/popover/index.js
CHANGED
|
@@ -123,7 +123,7 @@ const handleDocumentClick = ({ vm, state }) => (event) => {
|
|
|
123
123
|
const popperElm = state.popperElm;
|
|
124
124
|
const $el = vm.$refs.root;
|
|
125
125
|
let target = event.target;
|
|
126
|
-
if ((target == null ? void 0 : target.shadowRoot) && popperElm) {
|
|
126
|
+
if ((target == null ? void 0 : target.shadowRoot) && target.shadowRoot.contains($el) && popperElm) {
|
|
127
127
|
target = state.webCompEventTarget;
|
|
128
128
|
}
|
|
129
129
|
if (!$el || !reference || $el.contains(target) || reference.contains(target) || !popperElm || popperElm.contains(target)) {
|
package/rich-text/index.js
CHANGED
|
@@ -4,6 +4,21 @@ import { xss } from "@opentiny/utils";
|
|
|
4
4
|
import { getToolbarTips, defaultOptions } from "./options";
|
|
5
5
|
import registerTableModule from "./table-module";
|
|
6
6
|
import registerCustomClipboard from "./clipboard";
|
|
7
|
+
const registerCustomSize = (Quill, sizeConfig) => {
|
|
8
|
+
if (!sizeConfig || !Array.isArray(sizeConfig)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const hasPixelValues = sizeConfig.some((item) => {
|
|
12
|
+
return item && typeof item === "string" && item.includes("px");
|
|
13
|
+
});
|
|
14
|
+
if (!hasPixelValues) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const SizeStyle = Quill.import("attributors/style/size");
|
|
18
|
+
const whitelist = sizeConfig.filter((item) => item !== false);
|
|
19
|
+
SizeStyle.whitelist = whitelist;
|
|
20
|
+
Quill.register("formats/size", SizeStyle, true);
|
|
21
|
+
};
|
|
7
22
|
const initContent = ({ state, props, nextTick }) => () => {
|
|
8
23
|
if (state.quill) {
|
|
9
24
|
const flag = state.quill.selection.hasFocus();
|
|
@@ -24,7 +39,34 @@ const initContent = ({ state, props, nextTick }) => () => {
|
|
|
24
39
|
}
|
|
25
40
|
};
|
|
26
41
|
const initQuill = ({ api, emit, props, vm, service, state, Quill, ImageDrop, ImageUpload, FileUpload }) => () => {
|
|
42
|
+
var _a, _b;
|
|
27
43
|
state.innerOptions = extend(true, {}, defaultOptions, props.globalOptions, props.options);
|
|
44
|
+
const toolbarConfig = ((_b = (_a = state.innerOptions.modules) == null ? void 0 : _a.toolbar) == null ? void 0 : _b.container) || [];
|
|
45
|
+
const findSizeConfig = (config) => {
|
|
46
|
+
if (!config)
|
|
47
|
+
return null;
|
|
48
|
+
if (Array.isArray(config)) {
|
|
49
|
+
for (let i = 0; i < config.length; i++) {
|
|
50
|
+
const result = findSizeConfig(config[i]);
|
|
51
|
+
if (result)
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
} else if (typeof config === "object" && config !== null) {
|
|
55
|
+
if (config.size && Array.isArray(config.size)) {
|
|
56
|
+
return config.size;
|
|
57
|
+
}
|
|
58
|
+
for (const key in config) {
|
|
59
|
+
const result = findSizeConfig(config[key]);
|
|
60
|
+
if (result)
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
const sizeConfig = findSizeConfig(toolbarConfig);
|
|
67
|
+
if (sizeConfig) {
|
|
68
|
+
registerCustomSize(Quill, sizeConfig);
|
|
69
|
+
}
|
|
28
70
|
if (document.caretRangeFromPoint) {
|
|
29
71
|
if (props.imageDrop) {
|
|
30
72
|
Quill.register("modules/imageDrop", ImageDrop, true);
|
package/select/index.js
CHANGED
|
@@ -53,13 +53,13 @@ const showTip = ({ props, state, vm }) => (show) => {
|
|
|
53
53
|
state.showTip = show && overflow && !!state.tips && !state.visible;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
const gridOnQueryChange = ({ props, vm, constants, state }) => (value) => {
|
|
56
|
+
const gridOnQueryChange = ({ props, vm, constants, state }) => async (value) => {
|
|
57
57
|
const { multiple, valueField, filterMethod, remote, remoteMethod } = props;
|
|
58
58
|
if ((props.filterable || props.searchable) && typeof filterMethod === "function") {
|
|
59
59
|
const table = vm.$refs.selectGrid.$refs.tinyTable;
|
|
60
60
|
const fullData = table.getTableData().fullData;
|
|
61
61
|
vm.$refs.selectGrid.scrollTo(null, 0);
|
|
62
|
-
table.
|
|
62
|
+
await table.loadData(filterMethod(value, fullData) || []);
|
|
63
63
|
vm.$refs.selectGrid.handleTableData(!value).then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper));
|
|
64
64
|
state.previousQuery = value;
|
|
65
65
|
} else if (remote && typeof remoteMethod === "function") {
|
package/select/vue.js
CHANGED
|
@@ -289,7 +289,8 @@ const initState = ({
|
|
|
289
289
|
rootAutoTipConfig: computed(() => __spreadValues({
|
|
290
290
|
content: state.displayOnlyContent,
|
|
291
291
|
always: !!state.displayOnlyContent
|
|
292
|
-
}, props.tooltipConfig))
|
|
292
|
+
}, props.tooltipConfig)),
|
|
293
|
+
ariaListId: "tiny-select-" + crypto.randomUUID().slice(-8)
|
|
293
294
|
}));
|
|
294
295
|
return state;
|
|
295
296
|
};
|
package/select-dropdown/vue.js
CHANGED
|
@@ -74,12 +74,17 @@ const initApi = ({ api: api2, popper, state, selectEmitter, constants, selectVm,
|
|
|
74
74
|
mounted: mounted({ selectEmitter, constants, state, selectVm, updatePopper, destroyPopper, parent })
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
const initWatch = ({ watch, selectVm, state, nextTick }) => {
|
|
77
|
+
const initWatch = ({ watch, selectVm, state, nextTick, props }) => {
|
|
78
78
|
watch(
|
|
79
79
|
() => !isServer ? selectVm.state.inputWidth : void 0,
|
|
80
80
|
(val) => {
|
|
81
81
|
nextTick(() => {
|
|
82
82
|
state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width || val) + "px";
|
|
83
|
+
if (props.isDropInheritWidth) {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
state.minWidth = (selectVm && selectVm.$el && selectVm.$el.getBoundingClientRect().width || val) + "px";
|
|
86
|
+
}, 210);
|
|
87
|
+
}
|
|
83
88
|
});
|
|
84
89
|
},
|
|
85
90
|
{ immediate: true }
|
|
@@ -129,9 +134,9 @@ const renderless = (props, { computed, onBeforeUnmount, onDeactivated, onMounted
|
|
|
129
134
|
toRefs,
|
|
130
135
|
watch
|
|
131
136
|
});
|
|
132
|
-
const state = initState({ reactive, computed, popper,
|
|
137
|
+
const state = initState({ reactive, computed, popper, selectVm });
|
|
133
138
|
initApi({ api: api2, popper, state, selectEmitter, constants, selectVm, parent, nextTick, props, isMobileFirstMode });
|
|
134
|
-
initWatch({ watch, selectVm, state, nextTick,
|
|
139
|
+
initWatch({ watch, selectVm, state, nextTick, props });
|
|
135
140
|
onBeforeUnmount(() => {
|
|
136
141
|
popper.destroyPopper("remove");
|
|
137
142
|
state.popperElm = null;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../chunk-G2ADBYYC.js";
|
|
6
|
+
const api = [
|
|
7
|
+
"state",
|
|
8
|
+
"resolvedComponent",
|
|
9
|
+
"mergedProps",
|
|
10
|
+
"listeners",
|
|
11
|
+
"slotNames",
|
|
12
|
+
"hasScopedDefault",
|
|
13
|
+
"focus",
|
|
14
|
+
"blur"
|
|
15
|
+
];
|
|
16
|
+
const renderless = (props, { reactive, computed, useAttrs }, { constants, vm, components }) => {
|
|
17
|
+
const api2 = {};
|
|
18
|
+
const resolvedComponent = computed(() => computedResolvedComponent({ props, constants, vm, components }));
|
|
19
|
+
const mergedProps = computed(() => {
|
|
20
|
+
const runtimeAttrs = typeof useAttrs === "function" ? useAttrs() : null;
|
|
21
|
+
const attrs = runtimeAttrs || vm.$attrs || {};
|
|
22
|
+
const className = attrs.class;
|
|
23
|
+
const classArray = Array.isArray(className) ? ["tiny-select", ...className] : className ? ["tiny-select", className] : ["tiny-select"];
|
|
24
|
+
const _a = attrs, { class: _omitClass } = _a, restAttrs = __objRest(_a, ["class"]);
|
|
25
|
+
return __spreadProps(__spreadValues(__spreadValues({}, props), restAttrs), {
|
|
26
|
+
class: Array.from(new Set(classArray)),
|
|
27
|
+
dataTag: "tiny-select"
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
const slotNames = computed(() => Object.keys(vm.$slots || {}).filter((name) => name && name !== "default"));
|
|
31
|
+
const hasScopedDefault = computed(() => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const scoped = (_a = vm.$scopedSlots) == null ? void 0 : _a.default;
|
|
34
|
+
if (scoped && scoped.length) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
const slot = (_b = vm.$slots) == null ? void 0 : _b.default;
|
|
38
|
+
return typeof slot === "function" && slot.length > 0;
|
|
39
|
+
});
|
|
40
|
+
const listeners = computed(() => {
|
|
41
|
+
if (vm.$listeners) {
|
|
42
|
+
return vm.$listeners;
|
|
43
|
+
}
|
|
44
|
+
return {};
|
|
45
|
+
});
|
|
46
|
+
const getChildComponent = () => {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = vm.$refs) == null ? void 0 : _a.childComponent;
|
|
49
|
+
};
|
|
50
|
+
const state = new Proxy(
|
|
51
|
+
{},
|
|
52
|
+
{
|
|
53
|
+
get(target, prop) {
|
|
54
|
+
var _a;
|
|
55
|
+
const child = getChildComponent();
|
|
56
|
+
return (_a = child == null ? void 0 : child.state) == null ? void 0 : _a[prop];
|
|
57
|
+
},
|
|
58
|
+
set(target, prop, value) {
|
|
59
|
+
const child = getChildComponent();
|
|
60
|
+
if (child == null ? void 0 : child.state) {
|
|
61
|
+
child.state[prop] = value;
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
},
|
|
66
|
+
has(target, prop) {
|
|
67
|
+
const child = getChildComponent();
|
|
68
|
+
return prop in ((child == null ? void 0 : child.state) || {});
|
|
69
|
+
},
|
|
70
|
+
ownKeys(target) {
|
|
71
|
+
const child = getChildComponent();
|
|
72
|
+
return Object.keys((child == null ? void 0 : child.state) || {});
|
|
73
|
+
},
|
|
74
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
75
|
+
const child = getChildComponent();
|
|
76
|
+
const childState = (child == null ? void 0 : child.state) || {};
|
|
77
|
+
if (prop in childState) {
|
|
78
|
+
return {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
value: childState[prop]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const focus = () => {
|
|
89
|
+
const child = getChildComponent();
|
|
90
|
+
child && typeof child.focus === "function" && child.focus();
|
|
91
|
+
};
|
|
92
|
+
const blur = () => {
|
|
93
|
+
const child = getChildComponent();
|
|
94
|
+
child && typeof child.blur === "function" && child.blur();
|
|
95
|
+
};
|
|
96
|
+
const hasData = (value) => {
|
|
97
|
+
if (!value) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(value)) {
|
|
101
|
+
return value.length > 0;
|
|
102
|
+
}
|
|
103
|
+
if (typeof value === "object") {
|
|
104
|
+
return Object.keys(value).length > 0;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
const computedResolvedComponent = ({ props: props2, constants: constants2, vm: vm2, components: components2 }) => {
|
|
109
|
+
var _a;
|
|
110
|
+
const comps = components2 || ((_a = vm2.$options) == null ? void 0 : _a.components) || {};
|
|
111
|
+
if (props2.renderType === constants2.TYPE.Tree || hasData(props2.treeOp)) {
|
|
112
|
+
return comps.TinyTreeSelect || "TinyTreeSelect";
|
|
113
|
+
}
|
|
114
|
+
if (props2.renderType === constants2.TYPE.Grid || hasData(props2.gridOp)) {
|
|
115
|
+
return comps.TinyGridSelect || "TinyGridSelect";
|
|
116
|
+
}
|
|
117
|
+
return comps.TinyBaseSelect || "TinyBaseSelect";
|
|
118
|
+
};
|
|
119
|
+
Object.assign(api2, {
|
|
120
|
+
state,
|
|
121
|
+
resolvedComponent,
|
|
122
|
+
mergedProps,
|
|
123
|
+
listeners,
|
|
124
|
+
slotNames,
|
|
125
|
+
hasScopedDefault,
|
|
126
|
+
focus,
|
|
127
|
+
blur
|
|
128
|
+
});
|
|
129
|
+
return api2;
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
api,
|
|
133
|
+
renderless
|
|
134
|
+
};
|
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/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,6 +1,6 @@
|
|
|
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),
|
|
@@ -11,18 +11,75 @@ const renderless = (props, { reactive, inject, computed, onMounted, onBeforeUnmo
|
|
|
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
|
-
|
|
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();
|
|
20
43
|
});
|
|
21
|
-
observer.observe(vm.$el, { attributes: true, subtree: true });
|
|
22
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
|
+
);
|
|
23
74
|
onBeforeUnmount(() => {
|
|
24
|
-
|
|
25
|
-
|
|
75
|
+
if (mutationObserver) {
|
|
76
|
+
mutationObserver.disconnect();
|
|
77
|
+
mutationObserver = null;
|
|
78
|
+
}
|
|
79
|
+
if (resizeObserver) {
|
|
80
|
+
resizeObserver.disconnect();
|
|
81
|
+
resizeObserver = null;
|
|
82
|
+
}
|
|
26
83
|
});
|
|
27
84
|
Object.assign(api, {
|
|
28
85
|
state
|
package/tabs-mf/vue.js
CHANGED
|
@@ -53,7 +53,7 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
53
53
|
addItem: addItem(state),
|
|
54
54
|
addNav: addNav(state),
|
|
55
55
|
scrollTo: scrollTo({ vm, state }),
|
|
56
|
-
removeItem: removeItem({ props, state, emit }),
|
|
56
|
+
removeItem: removeItem({ props, state, emit, api: api2 }),
|
|
57
57
|
changeCurrentName: changeCurrentName({ state, emit }),
|
|
58
58
|
clickMore: clickMore(api2),
|
|
59
59
|
beforeCarouselSwipe: beforeCarouselSwipe({ api: api2, state, vm }),
|
|
@@ -82,11 +82,27 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
82
82
|
() => props.modelValue,
|
|
83
83
|
(name) => name && api2.setActive(name)
|
|
84
84
|
);
|
|
85
|
+
watch(
|
|
86
|
+
() => state.cacheCurrentItem,
|
|
87
|
+
(newItem) => {
|
|
88
|
+
if (newItem && newItem !== state.currentItem) {
|
|
89
|
+
state.currentItem = newItem;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{ immediate: true }
|
|
93
|
+
);
|
|
85
94
|
onMounted(() => {
|
|
86
|
-
nextTick(() =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
});
|
|
90
106
|
});
|
|
91
107
|
onBeforeUnmount(() => {
|
|
92
108
|
api2.unobserveTabSwipeSize();
|
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-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 {
|