@varlet/ui 3.13.1 → 3.14.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/README.md +0 -10
- package/es/action-sheet/style/index.mjs +1 -1
- package/es/field-decorator/fieldDecorator.css +1 -1
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/en-US.mjs +3 -1
- package/es/locale/fa-IR.mjs +3 -1
- package/es/locale/ja-JP.mjs +3 -1
- package/es/locale/zh-CN.mjs +3 -1
- package/es/locale/zh-TW.mjs +3 -1
- package/es/option/Option.mjs +31 -2
- package/es/select/Select.mjs +258 -45
- package/es/select/SelectFilter.mjs +61 -0
- package/es/select/props.mjs +4 -0
- package/es/select/select.css +1 -1
- package/es/select/useOptionsMutationObserver.mjs +73 -0
- package/es/select/useSelectFilterSize.mjs +27 -0
- package/es/themes/dark/fieldDecorator.mjs +1 -1
- package/es/themes/dark/select.mjs +4 -1
- package/es/themes/md3-dark/fieldDecorator.mjs +1 -1
- package/es/themes/md3-dark/select.mjs +4 -1
- package/es/themes/md3-light/fieldDecorator.mjs +1 -1
- package/es/themes/md3-light/select.mjs +4 -1
- package/es/varlet.css +1 -1
- package/es/varlet.esm.js +7925 -7607
- package/highlight/web-types.en-US.json +23 -1
- package/highlight/web-types.zh-CN.json +23 -1
- package/lib/varlet.cjs.js +2236 -1832
- package/lib/varlet.css +1 -1
- package/package.json +7 -7
- package/types/index.d.ts +2 -2
- package/types/select.d.ts +5 -0
- package/types/styleVars.d.ts +3 -0
- package/umd/varlet.js +8 -8
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { nextTick, ref, watch } from "vue";
|
|
22
|
+
import { getStyle } from "@varlet/shared";
|
|
23
|
+
import { onSmartUnmounted } from "@varlet/use";
|
|
24
|
+
function useOptionsMutationObserver(container, showContainer, options) {
|
|
25
|
+
const showEmpty = ref(false);
|
|
26
|
+
let observer = null;
|
|
27
|
+
watch(
|
|
28
|
+
() => showContainer.value,
|
|
29
|
+
() => __async(this, null, function* () {
|
|
30
|
+
disconnectObserver();
|
|
31
|
+
if (!showContainer.value) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
yield nextTick();
|
|
35
|
+
connectObserver();
|
|
36
|
+
handler();
|
|
37
|
+
}),
|
|
38
|
+
{ immediate: true }
|
|
39
|
+
);
|
|
40
|
+
onSmartUnmounted(disconnectObserver);
|
|
41
|
+
function handler() {
|
|
42
|
+
var _a;
|
|
43
|
+
const el = container.value;
|
|
44
|
+
const optionEls = el == null ? void 0 : el.querySelectorAll(".var-option");
|
|
45
|
+
showEmpty.value = !(optionEls == null ? void 0 : optionEls.length) ? true : Array.from(optionEls).every((option) => getStyle(option).display === "none");
|
|
46
|
+
(_a = options == null ? void 0 : options.onAfterUpdate) == null ? void 0 : _a.call(options);
|
|
47
|
+
}
|
|
48
|
+
function connectObserver() {
|
|
49
|
+
if (!container.value) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
observer = new MutationObserver(() => __async(this, null, function* () {
|
|
53
|
+
yield nextTick();
|
|
54
|
+
handler();
|
|
55
|
+
}));
|
|
56
|
+
observer.observe(container.value, {
|
|
57
|
+
childList: true,
|
|
58
|
+
subtree: true,
|
|
59
|
+
attributes: true,
|
|
60
|
+
attributeFilter: ["style", "class"]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function disconnectObserver() {
|
|
64
|
+
observer == null ? void 0 : observer.disconnect();
|
|
65
|
+
observer = null;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
showEmpty
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
useOptionsMutationObserver
|
|
73
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { computed, nextTick, ref, shallowRef, unref, watch } from "vue";
|
|
2
|
+
const MINIMUM_FILTER_WIDTH = 11;
|
|
3
|
+
function useSelectFilterSize(value) {
|
|
4
|
+
const calculatorRef = shallowRef();
|
|
5
|
+
const calculatorWidth = ref(0);
|
|
6
|
+
const filterStyle = computed(() => ({
|
|
7
|
+
minWidth: `${Math.max(calculatorWidth.value, MINIMUM_FILTER_WIDTH)}px`
|
|
8
|
+
}));
|
|
9
|
+
const resize = () => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
|
|
12
|
+
};
|
|
13
|
+
watch(
|
|
14
|
+
() => unref(value),
|
|
15
|
+
() => {
|
|
16
|
+
nextTick(resize);
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
return {
|
|
20
|
+
calculatorRef,
|
|
21
|
+
filterStyle,
|
|
22
|
+
resize
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
useSelectFilterSize
|
|
27
|
+
};
|
|
@@ -15,7 +15,7 @@ var stdin_default = {
|
|
|
15
15
|
"--field-decorator-standard-normal-icon-margin-bottom": "4px",
|
|
16
16
|
"--field-decorator-standard-normal-non-hint-margin-top": "4px",
|
|
17
17
|
"--field-decorator-standard-small-margin-top": "18px",
|
|
18
|
-
"--field-decorator-standard-small-margin-bottom": "
|
|
18
|
+
"--field-decorator-standard-small-margin-bottom": "0",
|
|
19
19
|
"--field-decorator-standard-small-icon-margin-top": "18px",
|
|
20
20
|
"--field-decorator-standard-small-icon-margin-bottom": "4px",
|
|
21
21
|
"--field-decorator-standard-small-non-hint-margin-top": "2px",
|
|
@@ -9,7 +9,10 @@ var stdin_default = {
|
|
|
9
9
|
"--select-chip-background-color": "#555",
|
|
10
10
|
"--select-arrow-size": "20px",
|
|
11
11
|
"--select-standard-menu-margin": `calc(var(--field-decorator-placeholder-size) * 0.75 + 12px) 0 0 0`,
|
|
12
|
-
"--select-label-font-size": "16px"
|
|
12
|
+
"--select-label-font-size": "16px",
|
|
13
|
+
"--select-empty-text-color": "#aaaaaa",
|
|
14
|
+
"--select-empty-height": "38px",
|
|
15
|
+
"--select-empty-font-size": "14px"
|
|
13
16
|
};
|
|
14
17
|
export {
|
|
15
18
|
stdin_default as default
|
|
@@ -15,7 +15,7 @@ var stdin_default = {
|
|
|
15
15
|
"--field-decorator-standard-normal-icon-margin-bottom": "4px",
|
|
16
16
|
"--field-decorator-standard-normal-non-hint-margin-top": "4px",
|
|
17
17
|
"--field-decorator-standard-small-margin-top": "18px",
|
|
18
|
-
"--field-decorator-standard-small-margin-bottom": "
|
|
18
|
+
"--field-decorator-standard-small-margin-bottom": "0",
|
|
19
19
|
"--field-decorator-standard-small-icon-margin-top": "18px",
|
|
20
20
|
"--field-decorator-standard-small-icon-margin-bottom": "4px",
|
|
21
21
|
"--field-decorator-standard-small-non-hint-margin-top": "2px",
|
|
@@ -9,7 +9,10 @@ var stdin_default = {
|
|
|
9
9
|
"--select-chip-background-color": "var(--color-surface-container-highest)",
|
|
10
10
|
"--select-arrow-size": "20px",
|
|
11
11
|
"--select-standard-menu-margin": `calc(var(--field-decorator-placeholder-size) * 0.75 + 12px) 0 0 0`,
|
|
12
|
-
"--select-label-font-size": "16px"
|
|
12
|
+
"--select-label-font-size": "16px",
|
|
13
|
+
"--select-empty-text-color": "var(--color-on-surface-variant)",
|
|
14
|
+
"--select-empty-height": "38px",
|
|
15
|
+
"--select-empty-font-size": "14px"
|
|
13
16
|
};
|
|
14
17
|
export {
|
|
15
18
|
stdin_default as default
|
|
@@ -15,7 +15,7 @@ var stdin_default = {
|
|
|
15
15
|
"--field-decorator-standard-normal-icon-margin-bottom": "4px",
|
|
16
16
|
"--field-decorator-standard-normal-non-hint-margin-top": "4px",
|
|
17
17
|
"--field-decorator-standard-small-margin-top": "18px",
|
|
18
|
-
"--field-decorator-standard-small-margin-bottom": "
|
|
18
|
+
"--field-decorator-standard-small-margin-bottom": "0",
|
|
19
19
|
"--field-decorator-standard-small-icon-margin-top": "18px",
|
|
20
20
|
"--field-decorator-standard-small-icon-margin-bottom": "4px",
|
|
21
21
|
"--field-decorator-standard-small-non-hint-margin-top": "2px",
|
|
@@ -9,7 +9,10 @@ var stdin_default = {
|
|
|
9
9
|
"--select-chip-background-color": "rgb(218, 212, 219)",
|
|
10
10
|
"--select-arrow-size": "20px",
|
|
11
11
|
"--select-standard-menu-margin": `calc(var(--field-decorator-placeholder-size) * 0.75 + 12px) 0 0 0`,
|
|
12
|
-
"--select-label-font-size": "16px"
|
|
12
|
+
"--select-label-font-size": "16px",
|
|
13
|
+
"--select-empty-text-color": "var(--color-on-surface-variant)",
|
|
14
|
+
"--select-empty-height": "38px",
|
|
15
|
+
"--select-empty-font-size": "14px"
|
|
13
16
|
};
|
|
14
17
|
export {
|
|
15
18
|
stdin_default as default
|