@v-c/select 1.0.8 → 1.0.10
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/dist/BaseSelect/index.js +27 -13
- package/dist/SelectInput/Content/SingleContent.js +32 -26
- package/dist/SelectInput/index.js +5 -7
- package/dist/SelectTrigger.d.ts +1 -0
- package/dist/SelectTrigger.js +8 -2
- package/dist/hooks/useBaseProps.d.ts +2 -0
- package/dist/hooks/useOpen.d.ts +3 -3
- package/dist/hooks/useOpen.js +18 -17
- package/dist/hooks/useSelectTriggerControl.d.ts +3 -1
- package/dist/hooks/useSelectTriggerControl.js +6 -2
- package/package.json +6 -6
- package/dist/BaseSelect/Polite.cjs +0 -40
- package/dist/BaseSelect/index.cjs +0 -769
- package/dist/OptGroup.cjs +0 -8
- package/dist/Option.cjs +0 -8
- package/dist/OptionList.cjs +0 -258
- package/dist/Select.cjs +0 -838
- package/dist/SelectContext.cjs +0 -12
- package/dist/SelectInput/Affix.cjs +0 -19
- package/dist/SelectInput/Content/MultipleContent.cjs +0 -145
- package/dist/SelectInput/Content/Placeholder.cjs +0 -36
- package/dist/SelectInput/Content/SingleContent.cjs +0 -83
- package/dist/SelectInput/Content/index.cjs +0 -43
- package/dist/SelectInput/Input.cjs +0 -179
- package/dist/SelectInput/context.cjs +0 -12
- package/dist/SelectInput/index.cjs +0 -343
- package/dist/SelectTrigger.cjs +0 -192
- package/dist/TransBtn.cjs +0 -72
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/hooks/index.cjs +0 -24
- package/dist/hooks/useAllowClear.cjs +0 -18
- package/dist/hooks/useBaseProps.cjs +0 -15
- package/dist/hooks/useCache.cjs +0 -39
- package/dist/hooks/useComponents.cjs +0 -18
- package/dist/hooks/useFilterOptions.cjs +0 -42
- package/dist/hooks/useLock.cjs +0 -29
- package/dist/hooks/useOpen.cjs +0 -62
- package/dist/hooks/useOptions.cjs +0 -41
- package/dist/hooks/useRefFunc.cjs +0 -15
- package/dist/hooks/useSearchConfig.cjs +0 -26
- package/dist/hooks/useSelectTriggerControl.cjs +0 -21
- package/dist/index.cjs +0 -22
- package/dist/interface.cjs +0 -1
- package/dist/utils/commonUtil.cjs +0 -38
- package/dist/utils/keyUtil.cjs +0 -37
- package/dist/utils/legacyUtil.cjs +0 -33
- package/dist/utils/platformUtil.cjs +0 -6
- package/dist/utils/valueUtil.cjs +0 -80
package/dist/hooks/useCache.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useCache(labeledValues, valueOptions) {
|
|
8
|
-
const cacheRef = (0, vue.shallowRef)({
|
|
9
|
-
values: /* @__PURE__ */ new Map(),
|
|
10
|
-
options: /* @__PURE__ */ new Map()
|
|
11
|
-
});
|
|
12
|
-
const filledLabeledValues = (0, vue.computed)(() => {
|
|
13
|
-
const { values: prevValueCache, options: prevOptionCache } = cacheRef.value;
|
|
14
|
-
const patchedValues = labeledValues.value.map((item) => {
|
|
15
|
-
if (item.label === void 0) return {
|
|
16
|
-
...item,
|
|
17
|
-
label: prevValueCache.get(item.value)?.label
|
|
18
|
-
};
|
|
19
|
-
return item;
|
|
20
|
-
});
|
|
21
|
-
const valueCache = /* @__PURE__ */ new Map();
|
|
22
|
-
const optionCache = /* @__PURE__ */ new Map();
|
|
23
|
-
patchedValues.forEach((item) => {
|
|
24
|
-
valueCache.set(item.value, item);
|
|
25
|
-
const option = valueOptions.value.get(item.value) || prevOptionCache.get(item.value);
|
|
26
|
-
if (option) optionCache.set(item.value, option);
|
|
27
|
-
});
|
|
28
|
-
cacheRef.value = {
|
|
29
|
-
values: valueCache,
|
|
30
|
-
options: optionCache
|
|
31
|
-
};
|
|
32
|
-
return patchedValues;
|
|
33
|
-
});
|
|
34
|
-
const getOption = (val) => {
|
|
35
|
-
return valueOptions.value.get(val) || cacheRef.value.options.get(val);
|
|
36
|
-
};
|
|
37
|
-
return [filledLabeledValues, getOption];
|
|
38
|
-
}
|
|
39
|
-
exports.default = useCache;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useComponents(components, getInputElement, getRawInputElement) {
|
|
8
|
-
return (0, vue.computed)(() => {
|
|
9
|
-
let { root, input } = components.value || {};
|
|
10
|
-
if (getRawInputElement?.value) root = getRawInputElement.value?.();
|
|
11
|
-
if (getInputElement?.value) input = getInputElement.value?.();
|
|
12
|
-
return {
|
|
13
|
-
root,
|
|
14
|
-
input
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
exports.default = useComponents;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_commonUtil = require("../utils/commonUtil.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
function includes(test, search) {
|
|
9
|
-
return require_commonUtil.toArray(test).join("").toUpperCase().includes(search);
|
|
10
|
-
}
|
|
11
|
-
function useFilterOptions(options, fieldNames, searchValue, filterOption, optionFilterProp) {
|
|
12
|
-
return (0, vue.computed)(() => {
|
|
13
|
-
if (!searchValue.value || filterOption.value === false) return options.value;
|
|
14
|
-
const { options: fieldOptions, label: fieldLabel, value: fieldValue } = fieldNames.value;
|
|
15
|
-
const filteredOptions = [];
|
|
16
|
-
const customizeFilter = typeof filterOption.value === "function";
|
|
17
|
-
const upperSearch = searchValue.value.toUpperCase();
|
|
18
|
-
const defaultFilter = (_, option) => {
|
|
19
|
-
if (optionFilterProp.value && option) return includes(option[optionFilterProp.value], upperSearch);
|
|
20
|
-
if (option && option[fieldOptions]) return includes(option[fieldLabel !== "children" ? fieldLabel : "label"], upperSearch);
|
|
21
|
-
return option ? includes(option[fieldValue], upperSearch) : false;
|
|
22
|
-
};
|
|
23
|
-
const filterFunc = customizeFilter ? filterOption.value : defaultFilter;
|
|
24
|
-
const wrapOption = customizeFilter ? (opt) => require_commonUtil.injectPropsWithOption(opt) : (opt) => opt;
|
|
25
|
-
options.value.forEach((item) => {
|
|
26
|
-
if (item[fieldOptions]) {
|
|
27
|
-
if (filterFunc(searchValue.value, wrapOption(item))) filteredOptions.push(item);
|
|
28
|
-
else {
|
|
29
|
-
const subOptions = item[fieldOptions].filter((subItem) => filterFunc(searchValue.value, wrapOption(subItem)));
|
|
30
|
-
if (subOptions.length) filteredOptions.push({
|
|
31
|
-
...item,
|
|
32
|
-
[fieldOptions]: subOptions
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (filterFunc(searchValue.value, wrapOption(item))) filteredOptions.push(item);
|
|
38
|
-
});
|
|
39
|
-
return filteredOptions;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
exports.default = useFilterOptions;
|
package/dist/hooks/useLock.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useLock(duration = 250) {
|
|
8
|
-
const lockRef = (0, vue.shallowRef)(null);
|
|
9
|
-
const timeoutRef = (0, vue.shallowRef)(null);
|
|
10
|
-
function cleanup() {
|
|
11
|
-
if (timeoutRef.value !== null) {
|
|
12
|
-
window.clearTimeout(timeoutRef.value);
|
|
13
|
-
timeoutRef.value = null;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
(0, vue.onUnmounted)(() => {
|
|
17
|
-
cleanup();
|
|
18
|
-
});
|
|
19
|
-
function doLock(locked) {
|
|
20
|
-
if (locked || lockRef.value === null) lockRef.value = locked;
|
|
21
|
-
cleanup();
|
|
22
|
-
timeoutRef.value = window.setTimeout(() => {
|
|
23
|
-
lockRef.value = null;
|
|
24
|
-
timeoutRef.value = null;
|
|
25
|
-
}, duration);
|
|
26
|
-
}
|
|
27
|
-
return [() => !!lockRef.value, doLock];
|
|
28
|
-
}
|
|
29
|
-
exports.default = useLock;
|
package/dist/hooks/useOpen.cjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function internalMacroTask(fn) {
|
|
8
|
-
const channel = new MessageChannel();
|
|
9
|
-
channel.port1.onmessage = fn;
|
|
10
|
-
channel.port2.postMessage(null);
|
|
11
|
-
}
|
|
12
|
-
function macroTask(fn, times = 1) {
|
|
13
|
-
if (times <= 0) {
|
|
14
|
-
fn();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
internalMacroTask(() => {
|
|
18
|
-
macroTask(fn, times - 1);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function useOpen(propOpen, onOpen, postOpen) {
|
|
22
|
-
const rendered = (0, vue.shallowRef)(propOpen.value ?? false);
|
|
23
|
-
(0, vue.onMounted)(() => {
|
|
24
|
-
rendered.value = true;
|
|
25
|
-
});
|
|
26
|
-
const stateOpen = (0, vue.shallowRef)(propOpen.value ?? false);
|
|
27
|
-
(0, vue.watch)(propOpen, () => {
|
|
28
|
-
stateOpen.value = propOpen.value;
|
|
29
|
-
});
|
|
30
|
-
const ssrSafeOpen = (0, vue.computed)(() => rendered.value ? stateOpen.value : false);
|
|
31
|
-
const mergedOpen = (0, vue.computed)(() => postOpen(ssrSafeOpen.value));
|
|
32
|
-
const taskIdRef = (0, vue.shallowRef)(0);
|
|
33
|
-
const taskLockRef = (0, vue.shallowRef)(false);
|
|
34
|
-
const triggerEvent = (nextOpen) => {
|
|
35
|
-
if (onOpen && mergedOpen.value !== nextOpen) onOpen(nextOpen);
|
|
36
|
-
if (propOpen.value !== void 0) return;
|
|
37
|
-
stateOpen.value = nextOpen;
|
|
38
|
-
};
|
|
39
|
-
const toggleOpen = (nextOpen, config = {}) => {
|
|
40
|
-
const { ignoreNext = false, lazy = false } = config;
|
|
41
|
-
taskIdRef.value += 1;
|
|
42
|
-
const id = taskIdRef.value;
|
|
43
|
-
const nextOpenVal = typeof nextOpen === "boolean" ? nextOpen : !mergedOpen.value;
|
|
44
|
-
if (nextOpenVal !== lazy) {
|
|
45
|
-
if (!taskLockRef.value) {
|
|
46
|
-
triggerEvent(nextOpenVal);
|
|
47
|
-
if (ignoreNext) {
|
|
48
|
-
taskLockRef.value = ignoreNext;
|
|
49
|
-
macroTask(() => {
|
|
50
|
-
taskLockRef.value = false;
|
|
51
|
-
}, 2);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
macroTask(() => {
|
|
57
|
-
if (id === taskIdRef.value && !taskLockRef.value) triggerEvent(nextOpenVal);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
return [mergedOpen, toggleOpen];
|
|
61
|
-
}
|
|
62
|
-
exports.default = useOpen;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useOptions(options, childrenOptions, fieldNames, optionFilterProp, optionLabelProp) {
|
|
8
|
-
return (0, vue.computed)(() => {
|
|
9
|
-
let mergedOptions = [];
|
|
10
|
-
if (options.value && options.value.length > 0) mergedOptions = options.value;
|
|
11
|
-
else if (childrenOptions.value && childrenOptions.value.length > 0) mergedOptions = childrenOptions.value;
|
|
12
|
-
const valueOptions = /* @__PURE__ */ new Map();
|
|
13
|
-
const labelOptions = /* @__PURE__ */ new Map();
|
|
14
|
-
const setLabelOptions = (labelOptionsMap, option, key) => {
|
|
15
|
-
if (key && typeof key === "string") labelOptionsMap.set(option[key], option);
|
|
16
|
-
};
|
|
17
|
-
const dig = (optionList, isChildren = false) => {
|
|
18
|
-
if (!Array.isArray(optionList)) return;
|
|
19
|
-
for (let i = 0; i < optionList.length; i += 1) {
|
|
20
|
-
const option = optionList[i];
|
|
21
|
-
if (!option) continue;
|
|
22
|
-
const optionsKey = fieldNames.value?.options || "options";
|
|
23
|
-
const valueKey = fieldNames.value?.value || "value";
|
|
24
|
-
const labelKey = fieldNames.value?.label || "label";
|
|
25
|
-
if (!option[optionsKey] || isChildren) {
|
|
26
|
-
valueOptions.set(option[valueKey], option);
|
|
27
|
-
setLabelOptions(labelOptions, option, labelKey);
|
|
28
|
-
setLabelOptions(labelOptions, option, optionFilterProp.value);
|
|
29
|
-
setLabelOptions(labelOptions, option, optionLabelProp.value);
|
|
30
|
-
} else dig(option[optionsKey], true);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
dig(mergedOptions);
|
|
34
|
-
return {
|
|
35
|
-
options: mergedOptions,
|
|
36
|
-
valueOptions,
|
|
37
|
-
labelOptions
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
exports.default = useOptions;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useRefFunc(callback) {
|
|
8
|
-
const funcRef = (0, vue.shallowRef)(callback);
|
|
9
|
-
funcRef.value = callback;
|
|
10
|
-
const cacheFn = (...args) => {
|
|
11
|
-
return funcRef.value(...args);
|
|
12
|
-
};
|
|
13
|
-
return cacheFn;
|
|
14
|
-
}
|
|
15
|
-
exports.default = useRefFunc;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useSearchConfig(showSearch, props, mode) {
|
|
8
|
-
const { filterOption, searchValue, optionFilterProp, filterSort, onSearch, autoClearSearchValue } = props;
|
|
9
|
-
return [(0, vue.computed)(() => {
|
|
10
|
-
return typeof showSearch.value === "object" || mode.value === "combobox" || mode.value === "tags" || mode.value === "multiple" && showSearch.value === void 0 ? true : showSearch.value;
|
|
11
|
-
}), (0, vue.computed)(() => {
|
|
12
|
-
const isObject = typeof showSearch.value === "object";
|
|
13
|
-
const config = {
|
|
14
|
-
filterOption: filterOption?.value,
|
|
15
|
-
searchValue: searchValue?.value,
|
|
16
|
-
optionFilterProp: optionFilterProp?.value,
|
|
17
|
-
filterSort: filterSort?.value,
|
|
18
|
-
onSearch: onSearch?.value,
|
|
19
|
-
autoClearSearchValue: autoClearSearchValue?.value,
|
|
20
|
-
...isObject ? showSearch.value : {}
|
|
21
|
-
};
|
|
22
|
-
if (config.autoClearSearchValue === void 0) config.autoClearSearchValue = true;
|
|
23
|
-
return config;
|
|
24
|
-
})];
|
|
25
|
-
}
|
|
26
|
-
exports.default = useSearchConfig;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useSelectTriggerControl(elements, open, triggerOpen, customizedTrigger) {
|
|
8
|
-
const onGlobalMouseDown = (event) => {
|
|
9
|
-
if (customizedTrigger.value) return;
|
|
10
|
-
let target = event.target;
|
|
11
|
-
if (target.shadowRoot && event.composed) target = event.composedPath()[0] || target;
|
|
12
|
-
if (open.value && elements().filter((element) => element).every((element) => !element.contains(target) && element !== target)) triggerOpen(false);
|
|
13
|
-
};
|
|
14
|
-
(0, vue.onMounted)(() => {
|
|
15
|
-
window.addEventListener("mousedown", onGlobalMouseDown);
|
|
16
|
-
(0, vue.onUnmounted)(() => {
|
|
17
|
-
window.removeEventListener("mousedown", onGlobalMouseDown);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
exports.default = useSelectTriggerControl;
|
package/dist/index.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_OptGroup = require("./OptGroup.cjs");
|
|
6
|
-
const require_Option = require("./Option.cjs");
|
|
7
|
-
const require_useBaseProps = require("./hooks/useBaseProps.cjs");
|
|
8
|
-
const require_SelectContext = require("./SelectContext.cjs");
|
|
9
|
-
const require_OptionList = require("./OptionList.cjs");
|
|
10
|
-
require("./hooks/index.cjs");
|
|
11
|
-
const require_index$1 = require("./BaseSelect/index.cjs");
|
|
12
|
-
const require_Select = require("./Select.cjs");
|
|
13
|
-
var src_default = require_Select.default;
|
|
14
|
-
exports.BaseSelect = require_index$1.BaseSelect;
|
|
15
|
-
exports.OptGroup = require_OptGroup.default;
|
|
16
|
-
exports.Option = require_Option.default;
|
|
17
|
-
exports.OptionList = require_OptionList.default;
|
|
18
|
-
exports.Select = require_Select.default;
|
|
19
|
-
exports.default = src_default;
|
|
20
|
-
exports.useBaseProps = require_useBaseProps.default;
|
|
21
|
-
exports.useSelectContext = require_SelectContext.useSelectContext;
|
|
22
|
-
exports.useSelectProvider = require_SelectContext.useSelectProvider;
|
package/dist/interface.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
function toArray(value) {
|
|
3
|
-
if (value === null || value === void 0) return [];
|
|
4
|
-
return Array.isArray(value) ? value : [value];
|
|
5
|
-
}
|
|
6
|
-
function isTitleType(title) {
|
|
7
|
-
return ["string", "number"].includes(typeof title);
|
|
8
|
-
}
|
|
9
|
-
function injectPropsWithOption(option) {
|
|
10
|
-
return { ...option };
|
|
11
|
-
}
|
|
12
|
-
function toVueNode(value) {
|
|
13
|
-
return toArray(value);
|
|
14
|
-
}
|
|
15
|
-
function getTitle(item) {
|
|
16
|
-
let title;
|
|
17
|
-
if (item) {
|
|
18
|
-
if (isTitleType(item.title)) title = item.title.toString();
|
|
19
|
-
else if (isTitleType(item.label)) title = item.label.toString();
|
|
20
|
-
}
|
|
21
|
-
return title;
|
|
22
|
-
}
|
|
23
|
-
const isClient = typeof window !== "undefined" && window.document && window.document.documentElement;
|
|
24
|
-
const isBrowserClient = typeof process !== "undefined" && process.env.NODE_ENV !== "test" && isClient;
|
|
25
|
-
function hasValue(value) {
|
|
26
|
-
return value !== void 0 && value !== null;
|
|
27
|
-
}
|
|
28
|
-
function isComboNoValue(value) {
|
|
29
|
-
return !value && value !== 0;
|
|
30
|
-
}
|
|
31
|
-
exports.getTitle = getTitle;
|
|
32
|
-
exports.hasValue = hasValue;
|
|
33
|
-
exports.injectPropsWithOption = injectPropsWithOption;
|
|
34
|
-
exports.isBrowserClient = isBrowserClient;
|
|
35
|
-
exports.isClient = isClient;
|
|
36
|
-
exports.isComboNoValue = isComboNoValue;
|
|
37
|
-
exports.toArray = toArray;
|
|
38
|
-
exports.toVueNode = toVueNode;
|
package/dist/utils/keyUtil.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
4
|
-
_v_c_util_dist_KeyCode = require_rolldown_runtime.__toESM(_v_c_util_dist_KeyCode);
|
|
5
|
-
function isValidateOpenKey(currentKeyCode) {
|
|
6
|
-
return !!currentKeyCode && ![
|
|
7
|
-
_v_c_util_dist_KeyCode.default.ESC,
|
|
8
|
-
_v_c_util_dist_KeyCode.default.SHIFT,
|
|
9
|
-
_v_c_util_dist_KeyCode.default.BACKSPACE,
|
|
10
|
-
_v_c_util_dist_KeyCode.default.TAB,
|
|
11
|
-
_v_c_util_dist_KeyCode.default.WIN_KEY,
|
|
12
|
-
_v_c_util_dist_KeyCode.default.ALT,
|
|
13
|
-
_v_c_util_dist_KeyCode.default.META,
|
|
14
|
-
_v_c_util_dist_KeyCode.default.WIN_KEY_RIGHT,
|
|
15
|
-
_v_c_util_dist_KeyCode.default.CTRL,
|
|
16
|
-
_v_c_util_dist_KeyCode.default.SEMICOLON,
|
|
17
|
-
_v_c_util_dist_KeyCode.default.EQUALS,
|
|
18
|
-
_v_c_util_dist_KeyCode.default.CAPS_LOCK,
|
|
19
|
-
_v_c_util_dist_KeyCode.default.CONTEXT_MENU,
|
|
20
|
-
_v_c_util_dist_KeyCode.default.UP,
|
|
21
|
-
_v_c_util_dist_KeyCode.default.LEFT,
|
|
22
|
-
_v_c_util_dist_KeyCode.default.RIGHT,
|
|
23
|
-
_v_c_util_dist_KeyCode.default.F1,
|
|
24
|
-
_v_c_util_dist_KeyCode.default.F2,
|
|
25
|
-
_v_c_util_dist_KeyCode.default.F3,
|
|
26
|
-
_v_c_util_dist_KeyCode.default.F4,
|
|
27
|
-
_v_c_util_dist_KeyCode.default.F5,
|
|
28
|
-
_v_c_util_dist_KeyCode.default.F6,
|
|
29
|
-
_v_c_util_dist_KeyCode.default.F7,
|
|
30
|
-
_v_c_util_dist_KeyCode.default.F8,
|
|
31
|
-
_v_c_util_dist_KeyCode.default.F9,
|
|
32
|
-
_v_c_util_dist_KeyCode.default.F10,
|
|
33
|
-
_v_c_util_dist_KeyCode.default.F11,
|
|
34
|
-
_v_c_util_dist_KeyCode.default.F12
|
|
35
|
-
].includes(currentKeyCode);
|
|
36
|
-
}
|
|
37
|
-
exports.isValidateOpenKey = isValidateOpenKey;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
function convertNodeToOption(node) {
|
|
5
|
-
const { key, props, children } = node;
|
|
6
|
-
const { value, label, ...restProps } = props || {};
|
|
7
|
-
let finalChildren = children;
|
|
8
|
-
if (typeof children === "function") finalChildren = children();
|
|
9
|
-
else if (children && typeof children === "object" && "default" in children) finalChildren = typeof children.default === "function" ? children.default() : children.default;
|
|
10
|
-
const finalLabel = label ?? restProps.children ?? finalChildren;
|
|
11
|
-
return {
|
|
12
|
-
key,
|
|
13
|
-
value: value !== void 0 ? value : key,
|
|
14
|
-
label: finalLabel,
|
|
15
|
-
...restProps
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function convertChildrenToData(nodes, optionOnly = false) {
|
|
19
|
-
return (0, vue.toRaw)(nodes).map((node, index) => {
|
|
20
|
-
if (!(0, vue.isVNode)(node) || !node.type) return null;
|
|
21
|
-
const { type, key, props } = node;
|
|
22
|
-
const isSelectOptGroup = type?.isSelectOptGroup;
|
|
23
|
-
if (optionOnly || !isSelectOptGroup) return convertNodeToOption(node);
|
|
24
|
-
const { children, ...restProps } = props || {};
|
|
25
|
-
return {
|
|
26
|
-
key: `__VC_SELECT_GRP__${key === null ? index : String(key)}__`,
|
|
27
|
-
label: key,
|
|
28
|
-
...restProps,
|
|
29
|
-
options: convertChildrenToData(children || [])
|
|
30
|
-
};
|
|
31
|
-
}).filter((data) => data !== null);
|
|
32
|
-
}
|
|
33
|
-
exports.convertChildrenToData = convertChildrenToData;
|
package/dist/utils/valueUtil.cjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
function getKey(data, index) {
|
|
3
|
-
const { key } = data;
|
|
4
|
-
let value;
|
|
5
|
-
if ("value" in data) value = data.value;
|
|
6
|
-
if (key !== null && key !== void 0) return key;
|
|
7
|
-
if (value !== void 0) return value;
|
|
8
|
-
return `vc-index-key-${index}`;
|
|
9
|
-
}
|
|
10
|
-
function isValidCount(value) {
|
|
11
|
-
return typeof value !== "undefined" && !Number.isNaN(value);
|
|
12
|
-
}
|
|
13
|
-
function fillFieldNames(fieldNames, childrenAsData) {
|
|
14
|
-
const { label, value, options, groupLabel } = fieldNames || {};
|
|
15
|
-
const mergedLabel = label || (childrenAsData ? "children" : "label");
|
|
16
|
-
return {
|
|
17
|
-
label: mergedLabel,
|
|
18
|
-
value: value || "value",
|
|
19
|
-
options: options || "options",
|
|
20
|
-
groupLabel: groupLabel || mergedLabel
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function flattenOptions(options, { fieldNames, childrenAsData } = {}) {
|
|
24
|
-
const flattenList = [];
|
|
25
|
-
const { label: fieldLabel, value: fieldValue, options: fieldOptions, groupLabel } = fillFieldNames(fieldNames, false);
|
|
26
|
-
function dig(list, isGroupOption) {
|
|
27
|
-
if (!Array.isArray(list)) return;
|
|
28
|
-
list.forEach((data) => {
|
|
29
|
-
if (isGroupOption || !(fieldOptions in data)) {
|
|
30
|
-
const value = data[fieldValue];
|
|
31
|
-
flattenList.push({
|
|
32
|
-
key: getKey(data, flattenList.length),
|
|
33
|
-
groupOption: isGroupOption,
|
|
34
|
-
data,
|
|
35
|
-
label: data[fieldLabel],
|
|
36
|
-
value
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
let grpLabel = data[groupLabel];
|
|
40
|
-
if (grpLabel === void 0 && childrenAsData) grpLabel = data.label;
|
|
41
|
-
flattenList.push({
|
|
42
|
-
key: getKey(data, flattenList.length),
|
|
43
|
-
group: true,
|
|
44
|
-
data,
|
|
45
|
-
label: grpLabel
|
|
46
|
-
});
|
|
47
|
-
dig(data[fieldOptions], true);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
dig(options, false);
|
|
52
|
-
return flattenList;
|
|
53
|
-
}
|
|
54
|
-
function injectPropsWithOption(option) {
|
|
55
|
-
if (!option) return option;
|
|
56
|
-
const newOption = { ...option };
|
|
57
|
-
if (!("props" in newOption)) Object.defineProperty(newOption, "props", { get() {
|
|
58
|
-
console.warn("Return type is option instead of Option instance. Please read value directly instead of reading from `props`.");
|
|
59
|
-
return newOption;
|
|
60
|
-
} });
|
|
61
|
-
return newOption;
|
|
62
|
-
}
|
|
63
|
-
function getSeparatedContent(text, tokens, end) {
|
|
64
|
-
if (!tokens || !tokens.length) return null;
|
|
65
|
-
let match = false;
|
|
66
|
-
const separate = (str, [token, ...restTokens]) => {
|
|
67
|
-
if (!token) return [str];
|
|
68
|
-
const list$1 = str.split(token);
|
|
69
|
-
match = match || list$1.length > 1;
|
|
70
|
-
return list$1.reduce((prevList, unitStr) => [...prevList, ...separate(unitStr, restTokens)], []).filter(Boolean);
|
|
71
|
-
};
|
|
72
|
-
const list = separate(text, tokens);
|
|
73
|
-
if (match) return typeof end !== "undefined" ? list.slice(0, end) : list;
|
|
74
|
-
else return null;
|
|
75
|
-
}
|
|
76
|
-
exports.fillFieldNames = fillFieldNames;
|
|
77
|
-
exports.flattenOptions = flattenOptions;
|
|
78
|
-
exports.getSeparatedContent = getSeparatedContent;
|
|
79
|
-
exports.injectPropsWithOption = injectPropsWithOption;
|
|
80
|
-
exports.isValidCount = isValidCount;
|