@veltra/desktop 1.2.21 → 1.2.23
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/components/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/action/style2.css +0 -12
- package/dist/components/auto-complete/auto-complete.js +5 -6
- package/dist/components/auto-complete/auto-complete.js.map +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
- package/dist/components/batch-edit/batch-edit.vue.d.ts +2 -2
- package/dist/components/batch-edit/style2.css +2 -2
- package/dist/components/cascade/cascade.js +7 -7
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +7 -7
- package/dist/components/checkbox/checkbox-button.js +5 -5
- package/dist/components/checkbox/checkbox-button.js.map +1 -1
- package/dist/components/checkbox/checkbox-button.vue.d.ts +2 -2
- package/dist/components/checkbox/checkbox.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +8 -10
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
- package/dist/components/code-editor/code-editor.vue.d.ts +1 -1
- package/dist/components/collapse/style2.css +5 -5
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +6 -6
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +3 -3
- package/dist/components/date-range-picker/date-range-picker.js +6 -6
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +3 -3
- package/dist/components/file-viewer/style2.css +24 -9
- package/dist/components/form-item/style2.css +0 -15
- package/dist/components/group-input/group-input.js +3 -5
- package/dist/components/group-input/group-input.js.map +1 -1
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.vue.d.ts +4 -4
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/kbd/style2.css +1 -1
- package/dist/components/loading/style2.css +3 -3
- package/dist/components/multi-select/multi-select.js +6 -6
- package/dist/components/multi-select/multi-select.js.map +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +4 -4
- package/dist/components/multi-tree-select/multi-tree-select.js +6 -6
- package/dist/components/multi-tree-select/multi-tree-select.js.map +1 -1
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
- package/dist/components/nav/nav-sub.js +1 -1
- package/dist/components/nav/nav-sub.js.map +1 -1
- package/dist/components/nav/style2.css +3 -5
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.js +8 -5
- package/dist/components/number-input/number-input.js.map +1 -1
- package/dist/components/number-input/number-input.vue.d.ts +4 -4
- package/dist/components/number-range-input/number-range-input.js +3 -5
- package/dist/components/number-range-input/number-range-input.js.map +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
- package/dist/components/palette/palette.vue.d.ts +1 -1
- package/dist/components/password-input/password-input.vue.d.ts +2 -2
- package/dist/components/radio-group/radio-group.js +8 -10
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +2 -2
- package/dist/components/select/select.js +5 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.vue.d.ts +4 -4
- package/dist/components/steps/steps.vue.d.ts +2 -2
- package/dist/components/switch/switch.vue.d.ts +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +4 -4
- package/dist/components/tree-select/tree-select.js +5 -5
- package/dist/components/tree-select/tree-select.js.map +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +6 -6
- package/dist/components/watermark/watermark.vue.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/action/style.scss +0 -11
- package/src/components/auto-complete/auto-complete.vue +1 -0
- package/src/components/batch-edit/style.scss +3 -7
- package/src/components/cascade/cascade.vue +2 -1
- package/src/components/checkbox/checkbox-button.vue +2 -2
- package/src/components/checkbox-group/checkbox-group.vue +2 -2
- package/src/components/collapse/style.scss +5 -25
- package/src/components/date-picker/date-picker.vue +3 -2
- package/src/components/date-range-picker/date-range-picker.vue +3 -2
- package/src/components/file-viewer/style.scss +24 -9
- package/src/components/form-item/style.scss +0 -11
- package/src/components/group-input/group-input.vue +2 -2
- package/src/components/input/input.vue +3 -2
- package/src/components/kbd/style.scss +3 -4
- package/src/components/loading/style.scss +3 -3
- package/src/components/multi-select/multi-select.vue +2 -1
- package/src/components/multi-tree-select/multi-tree-select.vue +2 -1
- package/src/components/nav/nav-sub.vue +1 -1
- package/src/components/nav/style.scss +3 -5
- package/src/components/number-input/number-input.vue +8 -5
- package/src/components/number-range-input/number-range-input.vue +2 -2
- package/src/components/radio-group/radio-group.vue +2 -2
- package/src/components/select/select.vue +2 -1
- package/src/components/tree-select/tree-select.vue +2 -1
|
@@ -10,8 +10,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
readonly: boolean;
|
|
14
13
|
disabled: boolean;
|
|
14
|
+
readonly: boolean;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
declare const _default: typeof __VLS_export;
|
|
17
17
|
//#endregion
|
|
@@ -13,9 +13,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
13
13
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
14
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
15
15
|
}>, {
|
|
16
|
-
readonly: boolean;
|
|
17
|
-
disabled: boolean;
|
|
18
16
|
clearable: boolean;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
21
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _sfc_main$1 from "../radio/radio.js";
|
|
2
|
-
import { Fragment, createBlock, createElementBlock, createTextVNode, defineComponent, mergeModels,
|
|
2
|
+
import { Fragment, createBlock, createElementBlock, createTextVNode, defineComponent, mergeModels, mergeProps, openBlock, renderList, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
3
3
|
import { useFormFallbackProps } from "@veltra/compositions";
|
|
4
4
|
import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
|
|
5
5
|
//#region src/components/radio-group/radio-group.vue
|
|
6
6
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "URadioGroup",
|
|
8
|
+
inheritAttrs: false,
|
|
8
9
|
__name: "radio-group",
|
|
9
10
|
props: /*@__PURE__*/ mergeModels({
|
|
10
11
|
modelValue: {},
|
|
@@ -48,14 +49,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
48
49
|
emit("change", item);
|
|
49
50
|
};
|
|
50
51
|
return (_ctx, _cache) => {
|
|
51
|
-
return !unref(readonly) ? (openBlock(), createElementBlock("div", {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
unref(cls).m(unref(size))
|
|
57
|
-
])
|
|
58
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
52
|
+
return !unref(readonly) ? (openBlock(), createElementBlock("div", mergeProps({ key: 0 }, _ctx.$attrs, { class: [
|
|
53
|
+
unref(cls).b,
|
|
54
|
+
unref(bem).is("block", __props.block),
|
|
55
|
+
unref(cls).m(unref(size))
|
|
56
|
+
] }), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
59
57
|
return openBlock(), createBlock(_sfc_main$1, {
|
|
60
58
|
key: item[__props.valueKey],
|
|
61
59
|
value: item[__props.valueKey],
|
|
@@ -73,7 +71,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
73
71
|
"disabled",
|
|
74
72
|
"size"
|
|
75
73
|
]);
|
|
76
|
-
}), 128))],
|
|
74
|
+
}), 128))], 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(__props.items.find((item) => item[__props.valueKey] === model.value)?.[__props.labelKey] || unref(FORM_EMPTY_CONTENT)), 1)], 64));
|
|
77
75
|
};
|
|
78
76
|
}
|
|
79
77
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","names":[],"sources":["../../../src/components/radio-group/radio-group.vue"],"sourcesContent":["<template>\n <div :class=\"[cls.b, bem.is('block', block), cls.m(size)]\"
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":["$attrs"],"sources":["../../../src/components/radio-group/radio-group.vue"],"sourcesContent":["<template>\n <div v-if=\"!readonly\" v-bind=\"$attrs\" :class=\"[cls.b, bem.is('block', block), cls.m(size)]\">\n <u-radio\n v-for=\"item of items\"\n :key=\"item[valueKey]\"\n :value=\"item[valueKey]\"\n :model-value=\"model\"\n @update:model-value=\"handleUpdate($event, item)\"\n :disabled=\"disabledItem?.(item) || disabled\"\n :size=\"size\"\n >\n {{ item[labelKey] }}\n </u-radio>\n </div>\n\n <template v-else>\n {{ items.find((item) => item[valueKey] === model)?.[labelKey] || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFormFallbackProps } from '@veltra/compositions'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\n\nimport type { RadioGroupProps, RadioGroupEmits } from '../../types'\nimport URadio from '../radio/radio.vue'\n\ndefineOptions({ name: 'URadioGroup', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<RadioGroupProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n disabled: undefined,\n readonly: undefined\n})\n\nconst model = defineModel<any>()\n\nconst emit = defineEmits<RadioGroupEmits>()\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst cls = bem('radio-group')\n\nconst handleUpdate = (value: any, item: Record<string, any>) => {\n model.value = value\n emit('change', item)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,QAAQ;EAOd,MAAM,QAAQ,SAAgB,SAAA,YAAC;EAE/B,MAAM,OAAO;EAEb,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,MAAM,IAAI,aAAa;EAE7B,MAAM,gBAAgB,OAAY,SAA8B;GAC9D,MAAM,QAAQ;GACd,KAAK,UAAU,IAAI;EACrB;;WArDc,MAAA,QAAA,KAAA,UAAA,GAAZ,mBAYM,OAZN,WAYM,EAAA,KAAA,EAAA,GAZwBA,KAAAA,QAAM,EAAG,OAAK;IAAG,MAAA,GAAA,CAAG,CAAC;IAAG,MAAA,GAAA,CAAG,CAAC,GAAE,SAAU,QAAA,KAAK;IAAG,MAAA,GAAA,CAAG,CAAC,EAAE,MAAA,IAAA,CAAI;GAAA,EAAA,CAAA,GAAA,EAAA,UAAA,IAAA,GACtF,mBAUU,UAAA,MAAA,WATO,QAAA,QAAR,SAAI;wBADb,YAUU,aAAA;KARP,KAAK,KAAK,QAAA;KACV,OAAO,KAAK,QAAA;KACZ,eAAa,MAAA;KACb,wBAAkB,WAAE,aAAa,QAAQ,IAAI;KAC7C,UAAU,QAAA,eAAe,IAAI,KAAK,MAAA,QAAA;KAClC,MAAM,MAAA,IAAA;;4BAEa,CAAA,gBAAA,gBAAjB,KAAK,QAAA,SAAQ,GAAA,CAAA,CAAA,CAAA;;;;;;;;;oCAIpB,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,QAAA,MAAM,MAAM,SAAS,KAAK,QAAA,cAAc,MAAA,KAAK,CAAA,GAAI,QAAA,aAAa,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
14
14
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
15
15
|
onChange?: ((item: Record<string, any>) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
-
readonly: boolean;
|
|
18
|
-
disabled: boolean;
|
|
19
17
|
labelKey: string;
|
|
20
18
|
valueKey: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
readonly: boolean;
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
//#endregion
|
|
@@ -10,9 +10,9 @@ declare const __VLS_export: import("vue").DefineComponent<RichTextEditorProps &
|
|
|
10
10
|
}> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
-
readonly: boolean;
|
|
14
|
-
disabled: boolean;
|
|
15
13
|
placeholder: string;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
readonly: boolean;
|
|
16
16
|
format: RichTextFormat;
|
|
17
17
|
toolbar: ToolbarItem[];
|
|
18
18
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -20,6 +20,7 @@ const _hoisted_2 = [
|
|
|
20
20
|
];
|
|
21
21
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
22
22
|
name: "USelect",
|
|
23
|
+
inheritAttrs: false,
|
|
23
24
|
__name: "select",
|
|
24
25
|
props: /*@__PURE__*/ mergeModels({
|
|
25
26
|
modelValue: {},
|
|
@@ -185,10 +186,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
185
186
|
getCurrentEl
|
|
186
187
|
});
|
|
187
188
|
return (_ctx, _cache) => {
|
|
188
|
-
return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$4), {
|
|
189
|
-
key: 0,
|
|
189
|
+
return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$4), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
190
190
|
trigger: "click",
|
|
191
|
-
class:
|
|
191
|
+
class: [unref(cls).b, unref(bem).is("disabled", unref(disabled))],
|
|
192
192
|
ref_key: "dropdownRef",
|
|
193
193
|
ref: dropdownRef,
|
|
194
194
|
visible: dropdownVisible.value,
|
|
@@ -203,7 +203,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
203
203
|
"min-width": __props.minWidth,
|
|
204
204
|
width: __props.width,
|
|
205
205
|
onKeydown: unref(handleKeydown)
|
|
206
|
-
}, {
|
|
206
|
+
}), {
|
|
207
207
|
trigger: withCtx(() => [createVNode(unref(input_default), {
|
|
208
208
|
size: unref(size),
|
|
209
209
|
disabled: unref(disabled),
|
|
@@ -301,7 +301,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
301
301
|
}, [createVNode(unref(_sfc_main$2))], 2))
|
|
302
302
|
]),
|
|
303
303
|
_: 3
|
|
304
|
-
},
|
|
304
|
+
}, 16, [
|
|
305
305
|
"class",
|
|
306
306
|
"visible",
|
|
307
307
|
"content-class",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["$slots"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n trigger=\"click\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n ref=\"dropdownRef\"\n v-model:visible=\"dropdownVisible\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n :disabled=\"disabled\"\n :min-width=\"minWidth\"\n :width=\"width\"\n @keydown=\"handleKeydown\"\n @update:visible=\"handleDropdownVisible\"\n >\n <!-- 触发 -->\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"displayedValue\"\n @clear=\"handleClear\"\n @keydown=\"handleKeydown\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\">\n <ArrowDown />\n </u-icon>\n </template>\n </u-input>\n </template>\n\n <!-- 下拉内容 -->\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"cls.e('content-filter')\">\n <u-input placeholder=\"输入关键字进行搜索\" tabindex=\"0\" v-focus v-model=\"queryString\">\n <template #suffix>\n <u-icon>\n <Search />\n </u-icon>\n </template>\n </u-input>\n </div>\n\n <!--\n 单选列表。虚拟化启用时,内容容器 height 由 useVirtualizer 命令式写入;\n 此处 content-style 仅承担 grid 相关样式,避免 height 变化触发模板重渲染。\n -->\n <u-scroll\n v-if=\"options.length\"\n tag=\"ul\"\n :class=\"cls.e('options')\"\n ref=\"scrollRef\"\n :content-class=\"[\n cls.e('options-wrap'),\n bem.is('virtual', virtualEnabled),\n bem.is('grid', !!grid)\n ]\"\n :content-style=\"{\n gridTemplateColumns: grid ? `repeat(${grid.cols}, minmax(0px, 1fr))` : undefined,\n gridGap: grid ? withUnit(grid.gap, 'px') : undefined\n }\"\n >\n <template v-if=\"virtualEnabled\">\n <!-- @vue-ignore -->\n <li\n v-for=\"{ option, index, val, label, key, offset } of virtualOptions\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :key=\"key\"\n :style=\"{ transform: `translateY(${offset}px)` }\"\n :data-index=\"index\"\n :ref=\"(el) => measureElement(index, el as Element | null)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ label }}\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li\n v-for=\"(option, index) of options\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :data-index=\"index\"\n :title=\"o(option).get(labelKey)\"\n :key=\"o(option).get(valueKey)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ o(option).get(labelKey) }}\n </slot>\n </li>\n </template>\n </u-scroll>\n\n <div v-else :class=\"cls.e('empty')\">\n <UEmpty />\n </div>\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedValue || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'\nimport { vFocus } from '@veltra/directives'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type {\n SelectEmits,\n SelectProps,\n _SelectExposed,\n DropdownExposed,\n ScrollExposed\n} from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UEmpty } from '../empty'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UScroll } from '../scroll'\nimport { useKeyboard } from './use-keyboard'\nimport { useOptions } from './use-options'\n\ndefineOptions({ name: 'USelect' })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<SelectEmits>()\n\ndefineSlots<{\n /** 前缀插槽 */\n prefix?: () => any\n /** 默认插槽 */\n default?: (scope: { option: Record<string, any>; index: number }) => any\n}>()\n\nconst cls = bem('select')\n\nconst optionClass = cls.e('option')\n\nconst { formProps } = injectFormContext()\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst currentIndex = shallowRef(-1)\nconst label = defineModel('text')\nconst selected = shallowRef<Record<string, any>>()\n\nconst displayedValue = computed(() => {\n if (label.value) return label.value\n\n return selected.value ? o(selected.value).get(props.labelKey) : String(props.modelValue ?? '')\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\nconst scrollRef = shallowRef<ScrollExposed>()\n\nconst filterable = computed(() => {\n return props.filterable || typeof props.options === 'function'\n})\n\nconst { queryString, options, temOptionsToCreatedOptions, clearCreatedOptions } = useOptions({\n props\n})\n\n// TODO: 优化\nlet userSelecting = false\nfunction lock() {\n userSelecting = true\n}\n\nfunction unlock() {\n nextTick(() => {\n userSelecting = false\n })\n}\n\n// 回显\nwatch(\n [() => props.modelValue, options],\n ([modelValue, options]) => {\n if (userSelecting) return\n\n if (!options?.length) return\n\n const { valueKey, labelKey } = props\n\n if (modelValue !== undefined && modelValue !== null && modelValue !== '') {\n currentIndex.value = options.findIndex((option) => o(option).get(valueKey) === modelValue)\n selected.value = currentIndex.value >= 0 ? options[currentIndex.value] : undefined\n label.value = selected.value ? o(selected.value).get(labelKey) : undefined\n } else {\n currentIndex.value = -1\n selected.value = undefined\n label.value = undefined\n }\n },\n { immediate: true }\n)\n\nconst baseVirtualEnabled = computed(() => options.value.length > 80)\nconst virtualEnabled = computed(() => baseVirtualEnabled.value && !props.grid)\n\nconst { virtualizer, items } = useVirtualizer({\n count: computed(() => options.value.length),\n scrollEl: () => scrollRef.value?.containerRef ?? null,\n contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null),\n gap: 4,\n estimateSize: () => 40\n})\n\nconst virtualOptions = computed(() => {\n const _options = options.value\n const { labelKey, valueKey } = props\n return items.value.map((item) => {\n const option = _options[item.index]!\n return {\n option,\n index: item.index,\n label: o(option).get(labelKey),\n val: o(option).get(valueKey),\n key: item.index,\n offset: item.start\n }\n })\n})\n\nconst measureElement: (index: number, el: Element | null) => void = (index, el) =>\n virtualizer.measureElement(index, el)\n\nfunction scrollTo(index: number): void {\n virtualizer.scrollToIndex(index, { align: 'center' })\n}\n\nwatch([scrollRef, virtualEnabled], ([scroll, virtualEnabled]) => {\n if (!scroll || !props.modelValue) return\n\n if (virtualEnabled) {\n const index = options.value.findIndex((option) => option === selected.value)\n index !== -1 && dropdownVisible.value && nextTick(() => scrollTo(index))\n } else {\n const selectedEl = scroll?.contentRef?.getElementsByClassName('is-selected')[0]\n if (selectedEl) {\n scrollIntoContainerView(selectedEl as HTMLElement, scroll.containerRef ?? null)\n }\n }\n})\n\nconst dropdownVisible = shallowRef(false)\n\nwatch(dropdownVisible, (v) => {\n if (!v) {\n queryString.value = ''\n }\n})\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n queryString.value = ''\n }\n}\n\n/** 单选 */\nconst handleSelect = (option: Record<string, any>, index: number) => {\n lock()\n selected.value = option\n\n emit('update:modelValue', option?.[props.valueKey])\n label.value = option?.[props.labelKey]\n emit('change', option)\n if (option.__isTemp) {\n temOptionsToCreatedOptions()\n }\n currentIndex.value = index\n dropdownRef.value?.close()\n\n unlock()\n}\n\n/** 清除选项 */\nconst handleClear = () => {\n lock()\n selected.value = undefined\n clearCreatedOptions()\n emit('update:modelValue', undefined)\n emit('change', undefined)\n unlock()\n}\n\nfunction getCurrentEl() {\n return scrollRef.value?.contentRef?.querySelector('li.is-selected') as HTMLElement | undefined\n}\n\nconst { handleKeydown } = useKeyboard({\n options,\n currentIndex,\n selectOption: handleSelect,\n getCurrentEl\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAQ;QAC7B,KAAK,MAAA,CAAA,CAAC,CAAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ;WAE5B,WAEO,KAAA,QAAA,WAFP,WAEO,EAAA,SAAA,KAAA,GAAA;QAFS;QAAQ;OAAK,CAAA,SAEtB,CAAA,gBAAA,gBADF,MAAA,CAAA,CAAC,CAAC,MAAM,CAAA,CAAE,IAAI,QAAA,QAAQ,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,IAAA,UAAA;;;;;;;yBAMjC,mBAEM,OAAA;;MAFO,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;SACvB,YAAU,MAAA,WAAA,CAAA,CAAA,GAAA,CAAA;;;;;;;;;;;;uBAKhB,mBAEW,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"select.js","names":["$attrs","$slots"],"sources":["../../../src/components/select/select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n trigger=\"click\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n ref=\"dropdownRef\"\n v-model:visible=\"dropdownVisible\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n :disabled=\"disabled\"\n :min-width=\"minWidth\"\n :width=\"width\"\n @keydown=\"handleKeydown\"\n @update:visible=\"handleDropdownVisible\"\n >\n <!-- 触发 -->\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"displayedValue\"\n @clear=\"handleClear\"\n @keydown=\"handleKeydown\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\">\n <ArrowDown />\n </u-icon>\n </template>\n </u-input>\n </template>\n\n <!-- 下拉内容 -->\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"cls.e('content-filter')\">\n <u-input placeholder=\"输入关键字进行搜索\" tabindex=\"0\" v-focus v-model=\"queryString\">\n <template #suffix>\n <u-icon>\n <Search />\n </u-icon>\n </template>\n </u-input>\n </div>\n\n <!--\n 单选列表。虚拟化启用时,内容容器 height 由 useVirtualizer 命令式写入;\n 此处 content-style 仅承担 grid 相关样式,避免 height 变化触发模板重渲染。\n -->\n <u-scroll\n v-if=\"options.length\"\n tag=\"ul\"\n :class=\"cls.e('options')\"\n ref=\"scrollRef\"\n :content-class=\"[\n cls.e('options-wrap'),\n bem.is('virtual', virtualEnabled),\n bem.is('grid', !!grid)\n ]\"\n :content-style=\"{\n gridTemplateColumns: grid ? `repeat(${grid.cols}, minmax(0px, 1fr))` : undefined,\n gridGap: grid ? withUnit(grid.gap, 'px') : undefined\n }\"\n >\n <template v-if=\"virtualEnabled\">\n <!-- @vue-ignore -->\n <li\n v-for=\"{ option, index, val, label, key, offset } of virtualOptions\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :key=\"key\"\n :style=\"{ transform: `translateY(${offset}px)` }\"\n :data-index=\"index\"\n :ref=\"(el) => measureElement(index, el as Element | null)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ label }}\n </slot>\n </li>\n </template>\n\n <template v-else>\n <li\n v-for=\"(option, index) of options\"\n :class=\"[optionClass, bem.is('selected', index === currentIndex)]\"\n @click=\"handleSelect(option, index)\"\n :data-index=\"index\"\n :title=\"o(option).get(labelKey)\"\n :key=\"o(option).get(valueKey)\"\n >\n <slot v-bind=\"{ option, index }\">\n {{ o(option).get(labelKey) }}\n </slot>\n </li>\n </template>\n </u-scroll>\n\n <div v-else :class=\"cls.e('empty')\">\n <UEmpty />\n </div>\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedValue || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'\nimport { vFocus } from '@veltra/directives'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView, withUnit } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type {\n SelectEmits,\n SelectProps,\n _SelectExposed,\n DropdownExposed,\n ScrollExposed\n} from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UEmpty } from '../empty'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UScroll } from '../scroll'\nimport { useKeyboard } from './use-keyboard'\nimport { useOptions } from './use-options'\n\ndefineOptions({ name: 'USelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n clearable: true,\n disabled: undefined,\n readonly: undefined\n})\n\nconst emit = defineEmits<SelectEmits>()\n\ndefineSlots<{\n /** 前缀插槽 */\n prefix?: () => any\n /** 默认插槽 */\n default?: (scope: { option: Record<string, any>; index: number }) => any\n}>()\n\nconst cls = bem('select')\n\nconst optionClass = cls.e('option')\n\nconst { formProps } = injectFormContext()\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst currentIndex = shallowRef(-1)\nconst label = defineModel('text')\nconst selected = shallowRef<Record<string, any>>()\n\nconst displayedValue = computed(() => {\n if (label.value) return label.value\n\n return selected.value ? o(selected.value).get(props.labelKey) : String(props.modelValue ?? '')\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\nconst scrollRef = shallowRef<ScrollExposed>()\n\nconst filterable = computed(() => {\n return props.filterable || typeof props.options === 'function'\n})\n\nconst { queryString, options, temOptionsToCreatedOptions, clearCreatedOptions } = useOptions({\n props\n})\n\n// TODO: 优化\nlet userSelecting = false\nfunction lock() {\n userSelecting = true\n}\n\nfunction unlock() {\n nextTick(() => {\n userSelecting = false\n })\n}\n\n// 回显\nwatch(\n [() => props.modelValue, options],\n ([modelValue, options]) => {\n if (userSelecting) return\n\n if (!options?.length) return\n\n const { valueKey, labelKey } = props\n\n if (modelValue !== undefined && modelValue !== null && modelValue !== '') {\n currentIndex.value = options.findIndex((option) => o(option).get(valueKey) === modelValue)\n selected.value = currentIndex.value >= 0 ? options[currentIndex.value] : undefined\n label.value = selected.value ? o(selected.value).get(labelKey) : undefined\n } else {\n currentIndex.value = -1\n selected.value = undefined\n label.value = undefined\n }\n },\n { immediate: true }\n)\n\nconst baseVirtualEnabled = computed(() => options.value.length > 80)\nconst virtualEnabled = computed(() => baseVirtualEnabled.value && !props.grid)\n\nconst { virtualizer, items } = useVirtualizer({\n count: computed(() => options.value.length),\n scrollEl: () => scrollRef.value?.containerRef ?? null,\n contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null),\n gap: 4,\n estimateSize: () => 40\n})\n\nconst virtualOptions = computed(() => {\n const _options = options.value\n const { labelKey, valueKey } = props\n return items.value.map((item) => {\n const option = _options[item.index]!\n return {\n option,\n index: item.index,\n label: o(option).get(labelKey),\n val: o(option).get(valueKey),\n key: item.index,\n offset: item.start\n }\n })\n})\n\nconst measureElement: (index: number, el: Element | null) => void = (index, el) =>\n virtualizer.measureElement(index, el)\n\nfunction scrollTo(index: number): void {\n virtualizer.scrollToIndex(index, { align: 'center' })\n}\n\nwatch([scrollRef, virtualEnabled], ([scroll, virtualEnabled]) => {\n if (!scroll || !props.modelValue) return\n\n if (virtualEnabled) {\n const index = options.value.findIndex((option) => option === selected.value)\n index !== -1 && dropdownVisible.value && nextTick(() => scrollTo(index))\n } else {\n const selectedEl = scroll?.contentRef?.getElementsByClassName('is-selected')[0]\n if (selectedEl) {\n scrollIntoContainerView(selectedEl as HTMLElement, scroll.containerRef ?? null)\n }\n }\n})\n\nconst dropdownVisible = shallowRef(false)\n\nwatch(dropdownVisible, (v) => {\n if (!v) {\n queryString.value = ''\n }\n})\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n queryString.value = ''\n }\n}\n\n/** 单选 */\nconst handleSelect = (option: Record<string, any>, index: number) => {\n lock()\n selected.value = option\n\n emit('update:modelValue', option?.[props.valueKey])\n label.value = option?.[props.labelKey]\n emit('change', option)\n if (option.__isTemp) {\n temOptionsToCreatedOptions()\n }\n currentIndex.value = index\n dropdownRef.value?.close()\n\n unlock()\n}\n\n/** 清除选项 */\nconst handleClear = () => {\n lock()\n selected.value = undefined\n clearCreatedOptions()\n emit('update:modelValue', undefined)\n emit('change', undefined)\n unlock()\n}\n\nfunction getCurrentEl() {\n return scrollRef.value?.contentRef?.querySelector('li.is-selected') as HTMLElement | undefined\n}\n\nconst { handleKeydown } = useKeyboard({\n options,\n currentIndex,\n selectOption: handleSelect,\n getCurrentEl\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8IA,MAAM,QAAQ;EASd,MAAM,OAAO;EASb,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,cAAc,IAAI,EAAE,QAAQ;EAElC,MAAM,EAAE,cAAc,kBAAkB;EACxC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,eAAe,WAAW,EAAE;EAClC,MAAM,QAAQ,SAAW,SAAC,MAAM;EAChC,MAAM,WAAW,WAAgC;EAEjD,MAAM,iBAAiB,eAAe;GACpC,IAAI,MAAM,OAAO,OAAO,MAAM;GAE9B,OAAO,SAAS,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC,IAAI,MAAM,QAAQ,IAAI,OAAO,MAAM,cA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AA,gBAAA,gBADN,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -24,12 +24,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
24
24
|
"onUpdate:text"?: ((value: any) => any) | undefined;
|
|
25
25
|
"onUpdate:label"?: ((label?: string | undefined) => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
|
-
readonly: boolean;
|
|
28
|
-
disabled: boolean;
|
|
29
|
-
placeholder: string;
|
|
30
|
-
clearable: boolean;
|
|
31
27
|
labelKey: string;
|
|
32
28
|
valueKey: string;
|
|
29
|
+
placeholder: string;
|
|
30
|
+
clearable: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
readonly: boolean;
|
|
33
33
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
34
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
35
|
declare const _default: typeof __VLS_export;
|
|
@@ -6,11 +6,11 @@ type __VLS_Slots = {
|
|
|
6
6
|
tip?: (scope: StepsSlotScope) => any;
|
|
7
7
|
};
|
|
8
8
|
declare const __VLS_base: import("vue").DefineComponent<StepsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
-
"item-click": (item: Record<string, any>, index: number) => any;
|
|
10
9
|
"update:current": (value?: string | number | undefined) => any;
|
|
10
|
+
"item-click": (item: Record<string, any>, index: number) => any;
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<StepsProps> & Readonly<{
|
|
12
|
-
"onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
|
|
13
12
|
"onUpdate:current"?: ((value?: string | number | undefined) => any) | undefined;
|
|
13
|
+
"onItem-click"?: ((item: Record<string, any>, index: number) => any) | undefined;
|
|
14
14
|
}>, {
|
|
15
15
|
labelKey: string;
|
|
16
16
|
direction: "horizontal" | "vertical";
|
|
@@ -14,8 +14,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
14
14
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
15
|
onChange?: ((value: boolean) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
|
-
readonly: boolean;
|
|
18
17
|
disabled: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: typeof __VLS_export;
|
|
21
21
|
//#endregion
|
|
@@ -9,21 +9,21 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
9
9
|
"update:modelValue": (value: string | undefined) => any;
|
|
10
10
|
} & {
|
|
11
11
|
"update:modelValue": (value: string) => any;
|
|
12
|
-
clear: () => any;
|
|
13
12
|
change: (value: string) => any;
|
|
13
|
+
clear: () => any;
|
|
14
14
|
focus: () => any;
|
|
15
15
|
blur: () => any;
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
18
|
-
onClear?: (() => any) | undefined;
|
|
19
18
|
onChange?: ((value: string) => any) | undefined;
|
|
19
|
+
onClear?: (() => any) | undefined;
|
|
20
20
|
onFocus?: (() => any) | undefined;
|
|
21
21
|
onBlur?: (() => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
|
-
readonly: boolean;
|
|
24
|
-
disabled: boolean;
|
|
25
23
|
placeholder: string;
|
|
26
24
|
clearable: boolean;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
readonly: boolean;
|
|
27
27
|
resize: boolean;
|
|
28
28
|
autosize: boolean;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -10,6 +10,7 @@ import { dfs, o } from "@cat-kit/core";
|
|
|
10
10
|
//#region src/components/tree-select/tree-select.vue
|
|
11
11
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
12
|
name: "UTreeSelect",
|
|
13
|
+
inheritAttrs: false,
|
|
13
14
|
__name: "tree-select",
|
|
14
15
|
props: /*@__PURE__*/ mergeModels({
|
|
15
16
|
modelValue: {},
|
|
@@ -139,9 +140,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
139
140
|
if (!visible) qs.value = "";
|
|
140
141
|
};
|
|
141
142
|
return (_ctx, _cache) => {
|
|
142
|
-
return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), {
|
|
143
|
-
|
|
144
|
-
class: normalizeClass([unref(cls).b, unref(bem).is("disabled", unref(disabled))]),
|
|
143
|
+
return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
144
|
+
class: [unref(cls).b, unref(bem).is("disabled", unref(disabled))],
|
|
145
145
|
trigger: "click",
|
|
146
146
|
"content-class": [
|
|
147
147
|
unref(cls).e("panel"),
|
|
@@ -155,7 +155,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
155
155
|
width: __props.width,
|
|
156
156
|
disabled: unref(disabled),
|
|
157
157
|
"onUpdate:visible": handleDropdownVisible
|
|
158
|
-
}, {
|
|
158
|
+
}), {
|
|
159
159
|
trigger: withCtx(() => [createVNode(unref(input_default), {
|
|
160
160
|
size: unref(size),
|
|
161
161
|
disabled: unref(disabled),
|
|
@@ -210,7 +210,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
210
210
|
}), null, 16, ["selected", "class"])
|
|
211
211
|
]),
|
|
212
212
|
_: 3
|
|
213
|
-
},
|
|
213
|
+
}, 16, [
|
|
214
214
|
"class",
|
|
215
215
|
"content-class",
|
|
216
216
|
"content-style",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-select.js","names":["$slots"],"sources":["../../../src/components/tree-select/tree-select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n trigger=\"click\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n ref=\"dropdownRef\"\n :min-width=\"minWidth\"\n :width=\"width\"\n :disabled=\"disabled\"\n @update:visible=\"handleDropdownVisible\"\n >\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"text ?? (model ? label : undefined)\"\n @clear=\"handleClear\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\"><ArrowDown /></u-icon>\n </template>\n </u-input>\n </template>\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"[cls.e('content-filter'), cls.m(size)]\">\n <u-input placeholder=\"输入关键字进行过滤\" v-model=\"qs\">\n <template #suffix>\n <u-icon><Search /></u-icon>\n </template>\n </u-input>\n </div>\n <!-- 菜单列表 -->\n\n <u-tree\n v-bind=\"treeProps\"\n :selected=\"model\"\n @update:selected=\"handleSelect\"\n ref=\"treeRef\"\n selectable\n :class=\"cls.e('content-tree')\"\n :slots=\"slots\"\n scroll-to-view\n />\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ text || label || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { dfs, o } from '@cat-kit/core'\nimport { useFormFallbackProps } from '@veltra/compositions'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type { TreeSelectProps, TreeSelectEmits, TreeExposed } from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UTree } from '../tree'\nimport type { TreeSlotsScope } from '../tree/di'\n\ndefineOptions({ name: 'UTreeSelect' })\n\nconst props = withDefaults(defineProps<TreeSelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n expandAll: false,\n clearable: true,\n disabled: undefined,\n readonly: undefined,\n filterable: false,\n minWidth: '280px'\n})\n\nconst emit = defineEmits<TreeSelectEmits>()\n\nconst slots = defineSlots<{\n /** 默认插槽 */\n default?: (props: TreeSlotsScope) => any\n /** 前缀插槽 */\n prefix?: () => any\n}>()\n\nconst treeProps = computed(() => {\n return o(props as Record<string, any>).omit([\n 'tips',\n 'field',\n 'placeholder',\n 'disabled',\n 'label',\n 'readonly',\n 'contentClass',\n 'contentStyle',\n 'minWidth',\n 'width'\n ])\n})\n\nconst cls = bem('tree-select')\n\n/**过滤 */\nconst qs = shallowRef('')\nwatch(qs, (qs) => {\n treeRef.value?.filter(qs)\n})\n\nconst model = defineModel<string | number>()\n\nconst label = shallowRef<string>()\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst treeRef = shallowRef<TreeExposed>()\n\nconst dropdownRef = shallowRef<InstanceType<typeof UDropdown>>()\n\n/**清空 */\nconst handleClear = () => {\n model.value = ''\n label.value = undefined\n emit('clear')\n emit('change', undefined)\n emit('update:text', '')\n}\n\nlet changedByEvent = false\nwatch(\n [() => props.data, model],\n ([data, model]) => {\n if (changedByEvent) return\n if (!data?.length || model === undefined) {\n label.value = undefined\n model = undefined\n return\n }\n\n let founded = false\n const childrenKey = props.childrenKey ?? 'children'\n data.some((item) => {\n dfs(\n item,\n (v) => {\n if (v[props.valueKey] === model) {\n label.value = v[props.labelKey]\n founded = true\n return true\n }\n },\n childrenKey\n )\n\n return founded\n })\n },\n { immediate: true }\n)\n\nconst handleSelect = (selected?: string | number, selectedData?: Record<string, any>) => {\n changedByEvent = true\n nextTick(() => {\n changedByEvent = false\n })\n\n model.value = selected ?? ''\n\n if (selectedData) {\n label.value = o(selectedData).get(props.labelKey)\n } else {\n label.value = ''\n }\n\n emit('change', selectedData)\n emit('update:text', label.value)\n dropdownRef.value?.close()\n}\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n qs.value = ''\n }\n}\n</script>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree-select.js","names":["$attrs","$slots"],"sources":["../../../src/components/tree-select/tree-select.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n :class=\"[cls.b, bem.is('disabled', disabled)]\"\n trigger=\"click\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size), contentClass]\"\n :content-style=\"contentStyle\"\n ref=\"dropdownRef\"\n :min-width=\"minWidth\"\n :width=\"width\"\n :disabled=\"disabled\"\n @update:visible=\"handleDropdownVisible\"\n >\n <template #trigger>\n <u-input\n :size=\"size\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n :clearable=\"clearable\"\n :model-value=\"text ?? (model ? label : undefined)\"\n @clear=\"handleClear\"\n native-readonly\n >\n <template #prefix v-if=\"$slots.prefix\">\n <slot name=\"prefix\" />\n </template>\n <template #suffix>\n <u-icon :class=\"cls.e('arrow')\"><ArrowDown /></u-icon>\n </template>\n </u-input>\n </template>\n <template #content>\n <!-- 过滤器 -->\n <div v-if=\"filterable\" :class=\"[cls.e('content-filter'), cls.m(size)]\">\n <u-input placeholder=\"输入关键字进行过滤\" v-model=\"qs\">\n <template #suffix>\n <u-icon><Search /></u-icon>\n </template>\n </u-input>\n </div>\n <!-- 菜单列表 -->\n\n <u-tree\n v-bind=\"treeProps\"\n :selected=\"model\"\n @update:selected=\"handleSelect\"\n ref=\"treeRef\"\n selectable\n :class=\"cls.e('content-tree')\"\n :slots=\"slots\"\n scroll-to-view\n />\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ text || label || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { dfs, o } from '@cat-kit/core'\nimport { useFormFallbackProps } from '@veltra/compositions'\nimport { ArrowDown, Search } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, nextTick, shallowRef, watch } from 'vue'\n\nimport type { TreeSelectProps, TreeSelectEmits, TreeExposed } from '../../types'\nimport { UDropdown } from '../dropdown'\nimport { UIcon } from '../icon'\nimport { UInput } from '../input'\nimport { UTree } from '../tree'\nimport type { TreeSlotsScope } from '../tree/di'\n\ndefineOptions({ name: 'UTreeSelect', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TreeSelectProps>(), {\n labelKey: 'label',\n valueKey: 'value',\n placeholder: '请选择',\n expandAll: false,\n clearable: true,\n disabled: undefined,\n readonly: undefined,\n filterable: false,\n minWidth: '280px'\n})\n\nconst emit = defineEmits<TreeSelectEmits>()\n\nconst slots = defineSlots<{\n /** 默认插槽 */\n default?: (props: TreeSlotsScope) => any\n /** 前缀插槽 */\n prefix?: () => any\n}>()\n\nconst treeProps = computed(() => {\n return o(props as Record<string, any>).omit([\n 'tips',\n 'field',\n 'placeholder',\n 'disabled',\n 'label',\n 'readonly',\n 'contentClass',\n 'contentStyle',\n 'minWidth',\n 'width'\n ])\n})\n\nconst cls = bem('tree-select')\n\n/**过滤 */\nconst qs = shallowRef('')\nwatch(qs, (qs) => {\n treeRef.value?.filter(qs)\n})\n\nconst model = defineModel<string | number>()\n\nconst label = shallowRef<string>()\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])\n\nconst treeRef = shallowRef<TreeExposed>()\n\nconst dropdownRef = shallowRef<InstanceType<typeof UDropdown>>()\n\n/**清空 */\nconst handleClear = () => {\n model.value = ''\n label.value = undefined\n emit('clear')\n emit('change', undefined)\n emit('update:text', '')\n}\n\nlet changedByEvent = false\nwatch(\n [() => props.data, model],\n ([data, model]) => {\n if (changedByEvent) return\n if (!data?.length || model === undefined) {\n label.value = undefined\n model = undefined\n return\n }\n\n let founded = false\n const childrenKey = props.childrenKey ?? 'children'\n data.some((item) => {\n dfs(\n item,\n (v) => {\n if (v[props.valueKey] === model) {\n label.value = v[props.labelKey]\n founded = true\n return true\n }\n },\n childrenKey\n )\n\n return founded\n })\n },\n { immediate: true }\n)\n\nconst handleSelect = (selected?: string | number, selectedData?: Record<string, any>) => {\n changedByEvent = true\n nextTick(() => {\n changedByEvent = false\n })\n\n model.value = selected ?? ''\n\n if (selectedData) {\n label.value = o(selectedData).get(props.labelKey)\n } else {\n label.value = ''\n }\n\n emit('change', selectedData)\n emit('update:text', label.value)\n dropdownRef.value?.close()\n}\n\nconst handleDropdownVisible = (visible: boolean) => {\n if (!visible) {\n qs.value = ''\n }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8EA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,QAAQ,SAAA;EAOd,MAAM,YAAY,eAAe;GAC/B,OAAO,EAAE,KAA4B,CAAC,CAAC,KAAK;IAC1C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAAC;EACH,CAAC;EAED,MAAM,MAAM,IAAI,aAAa;;EAG7B,MAAM,KAAK,WAAW,EAAE;EACxB,MAAM,KAAK,OAAO;GAChB,QAAQ,OAAO,OAAO,EAAE;EAC1B,CAAC;EAED,MAAM,QAAQ,SAA4B,SAAA,YAAC;EAE3C,MAAM,QAAQ,WAAmB;EAEjC,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;EAElF,MAAM,UAAU,WAAwB;EAExC,MAAM,cAAc,WAA2C;;EAG/D,MAAM,oBAAoB;GACxB,MAAM,QAAQ;GACd,MAAM,QAAQ,KAAA;GACd,KA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W,UAAA,EAAA,KAAA,EAAA,GAAA,CAAA,gBAAA,gBADN,QAAA,QAAQ,MAAA,SAAS,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
|
|
@@ -15,22 +15,22 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
15
15
|
"update:modelValue": (value: string | number | undefined) => any;
|
|
16
16
|
} & {
|
|
17
17
|
"update:modelValue": (value?: string | number | undefined) => any;
|
|
18
|
-
clear: () => any;
|
|
19
18
|
change: (selectedData?: Record<string, any> | undefined) => any;
|
|
19
|
+
clear: () => any;
|
|
20
20
|
"update:text": (text?: string | undefined) => any;
|
|
21
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
22
|
"onUpdate:modelValue"?: ((value?: string | number | undefined) => any) | undefined;
|
|
23
|
-
onClear?: (() => any) | undefined;
|
|
24
23
|
onChange?: ((selectedData?: Record<string, any> | undefined) => any) | undefined;
|
|
24
|
+
onClear?: (() => any) | undefined;
|
|
25
25
|
"onUpdate:text"?: ((text?: string | undefined) => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
|
-
readonly: boolean;
|
|
28
|
-
disabled: boolean;
|
|
29
|
-
placeholder: string;
|
|
30
|
-
clearable: boolean;
|
|
31
27
|
expandAll: boolean;
|
|
32
28
|
labelKey: string;
|
|
33
29
|
valueKey: string;
|
|
30
|
+
placeholder: string;
|
|
31
|
+
clearable: boolean;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
readonly: boolean;
|
|
34
34
|
filterable: boolean;
|
|
35
35
|
minWidth: string;
|
|
36
36
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -5,8 +5,8 @@ type __VLS_Slots = {} & {
|
|
|
5
5
|
default?: (props: typeof __VLS_7) => any;
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<WatermarkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<WatermarkProps> & Readonly<{}>, {
|
|
8
|
-
fontSize: number;
|
|
9
8
|
route: number;
|
|
9
|
+
fontSize: number;
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
12
|
declare const _default: typeof __VLS_export;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/desktop",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.23",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src"
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"@cat-kit/core": ">=1.1.8",
|
|
58
58
|
"@cat-kit/excel": ">=1.0.0",
|
|
59
59
|
"@cat-kit/fe": "^1.1.8",
|
|
60
|
-
"@veltra/compositions": "1.2.
|
|
61
|
-
"@veltra/directives": "1.2.
|
|
62
|
-
"@veltra/icons": "1.2.
|
|
63
|
-
"@veltra/styles": "1.2.
|
|
64
|
-
"@veltra/utils": "1.2.
|
|
60
|
+
"@veltra/compositions": "1.2.23",
|
|
61
|
+
"@veltra/directives": "1.2.23",
|
|
62
|
+
"@veltra/icons": "1.2.23",
|
|
63
|
+
"@veltra/styles": "1.2.23",
|
|
64
|
+
"@veltra/utils": "1.2.23",
|
|
65
65
|
"vue": ">=3.5.39"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
@@ -5,17 +5,6 @@ $root-name: action;
|
|
|
5
5
|
$group-name: action-group;
|
|
6
6
|
|
|
7
7
|
@include m.b($group-name) {
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
vertical-align: middle;
|
|
11
|
-
gap: 2px;
|
|
12
|
-
padding: 2px 4px;
|
|
13
|
-
border-radius: 999px;
|
|
14
|
-
background-color: color-mix(in srgb, #{fn.use-var(bg-color, top)} 70%, transparent);
|
|
15
|
-
backdrop-filter: fn.use-var(bg-filter);
|
|
16
|
-
-webkit-backdrop-filter: fn.use-var(bg-filter);
|
|
17
|
-
box-shadow: 0 1px 4px color-mix(in srgb, #{fn.use-var(shadow, color)} 35%, transparent);
|
|
18
|
-
|
|
19
8
|
@include m.e(more) {
|
|
20
9
|
flex-shrink: 0;
|
|
21
10
|
}
|
|
@@ -52,8 +52,8 @@ $root-name: batch-edit;
|
|
|
52
52
|
background-color: fn.use-var(bg-color, top);
|
|
53
53
|
border-radius: var(--u-batch-edit-form-radius);
|
|
54
54
|
box-shadow:
|
|
55
|
-
0 1px 2px
|
|
56
|
-
0 12px 32px -16px
|
|
55
|
+
0 1px 2px fn.color-a(shadow, 40, color),
|
|
56
|
+
0 12px 32px -16px fn.color-a(shadow, 50, color);
|
|
57
57
|
overflow: hidden;
|
|
58
58
|
isolation: isolate;
|
|
59
59
|
min-height: 0;
|
|
@@ -65,11 +65,7 @@ $root-name: batch-edit;
|
|
|
65
65
|
gap: 12px;
|
|
66
66
|
padding: 10px 14px;
|
|
67
67
|
border-bottom: 1px solid fn.use-var(border-color);
|
|
68
|
-
background-color:
|
|
69
|
-
in srgb,
|
|
70
|
-
#{fn.use-var(bg-color, top)} 96%,
|
|
71
|
-
#{fn.use-var(bg-color, hover)}
|
|
72
|
-
);
|
|
68
|
+
background-color: fn.component-var(batch-edit, form-header-bg);
|
|
73
69
|
flex-shrink: 0;
|
|
74
70
|
}
|
|
75
71
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<u-dropdown
|
|
3
3
|
v-if="!readonly"
|
|
4
|
+
v-bind="$attrs"
|
|
4
5
|
:class="[cls.b, bem.is('disabled', disabled), bem.is('multiple', multiple), cls.m(size)]"
|
|
5
6
|
:content-class="[cls.e('panel'), cls.em('panel', size)]"
|
|
6
7
|
trigger="click"
|
|
@@ -124,7 +125,7 @@ import { useCheck } from './use-check'
|
|
|
124
125
|
import { useDataMap } from './use-data-map'
|
|
125
126
|
import { useSelect } from './use-select'
|
|
126
127
|
|
|
127
|
-
defineOptions({ name: 'UCascade' })
|
|
128
|
+
defineOptions({ name: 'UCascade', inheritAttrs: false })
|
|
128
129
|
|
|
129
130
|
const props = withDefaults(defineProps<CascadeProps>(), {
|
|
130
131
|
labelKey: 'label',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="!readonly" :class="className" @click="handleInput">
|
|
2
|
+
<div v-if="!readonly" v-bind="$attrs" :class="className" @click="handleInput">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ import { computed } from 'vue'
|
|
|
21
21
|
import type { CheckboxButtonProps, CheckboxButtonEmits } from '../../types'
|
|
22
22
|
import { UTag } from '../tag'
|
|
23
23
|
|
|
24
|
-
defineOptions({ name: 'UCheckboxButton' })
|
|
24
|
+
defineOptions({ name: 'UCheckboxButton', inheritAttrs: false })
|
|
25
25
|
|
|
26
26
|
const props = withDefaults(defineProps<CheckboxButtonProps>(), {
|
|
27
27
|
disabled: undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="[cls.b, cls.m(size), bem.is('block', block)]"
|
|
2
|
+
<div v-if="!readonly" v-bind="$attrs" :class="[cls.b, cls.m(size), bem.is('block', block)]">
|
|
3
3
|
<u-checkbox
|
|
4
4
|
v-for="item of items"
|
|
5
5
|
:key="item[valueKey]"
|
|
@@ -34,7 +34,7 @@ import type { CheckboxGroupProps, CheckboxGroupEmits } from '../../types'
|
|
|
34
34
|
import { UCheckbox } from '../checkbox'
|
|
35
35
|
import { UTag } from '../tag'
|
|
36
36
|
|
|
37
|
-
defineOptions({ name: 'UCheckboxGroup' })
|
|
37
|
+
defineOptions({ name: 'UCheckboxGroup', inheritAttrs: false })
|
|
38
38
|
|
|
39
39
|
const props = withDefaults(defineProps<CheckboxGroupProps>(), {
|
|
40
40
|
labelKey: 'label',
|
|
@@ -7,31 +7,11 @@ $root-name: collapse;
|
|
|
7
7
|
$ease: cubic-bezier(0.4, 0, 0.2, 1);
|
|
8
8
|
$transition-fast: 0.18s $ease;
|
|
9
9
|
$transition-normal: 0.24s $ease;
|
|
10
|
-
$item-bg: fn.component-var(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
$item-hover-bg: fn.component-var(
|
|
16
|
-
collapse,
|
|
17
|
-
item-hover-bg,
|
|
18
|
-
color-mix(in srgb, #{fn.use-var(color, primary)} 4%, #{$item-bg})
|
|
19
|
-
);
|
|
20
|
-
$item-active-bg: fn.component-var(
|
|
21
|
-
collapse,
|
|
22
|
-
item-active-bg,
|
|
23
|
-
color-mix(in srgb, #{fn.use-var(color, primary)} 5%, #{$item-bg})
|
|
24
|
-
);
|
|
25
|
-
$header-active-bg: fn.component-var(
|
|
26
|
-
collapse,
|
|
27
|
-
header-active-bg,
|
|
28
|
-
color-mix(in srgb, #{fn.use-var(color, primary)} 8%, #{$item-bg})
|
|
29
|
-
);
|
|
30
|
-
$content-bg: fn.component-var(
|
|
31
|
-
collapse,
|
|
32
|
-
content-bg,
|
|
33
|
-
color-mix(in srgb, #{$item-active-bg} 42%, #{fn.use-var(bg-color, top)})
|
|
34
|
-
);
|
|
10
|
+
$item-bg: fn.component-var(collapse, item-bg);
|
|
11
|
+
$item-hover-bg: fn.component-var(collapse, item-hover-bg);
|
|
12
|
+
$item-active-bg: fn.component-var(collapse, item-active-bg);
|
|
13
|
+
$header-active-bg: fn.component-var(collapse, header-active-bg);
|
|
14
|
+
$content-bg: fn.component-var(collapse, content-bg);
|
|
35
15
|
$active-title-color: fn.component-var(collapse, active-title-color, fn.use-var(color, primary));
|
|
36
16
|
|
|
37
17
|
@include m.b($root-name) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<u-dropdown
|
|
3
|
+
v-if="!readonly"
|
|
4
|
+
v-bind="$attrs"
|
|
3
5
|
:class="className"
|
|
4
6
|
trigger="click"
|
|
5
7
|
width="auto"
|
|
6
8
|
ref="dropdownRef"
|
|
7
9
|
@update:visible=""
|
|
8
10
|
:disabled="disabled"
|
|
9
|
-
v-if="!readonly"
|
|
10
11
|
>
|
|
11
12
|
<template #trigger>
|
|
12
13
|
<u-input
|
|
@@ -49,7 +50,7 @@ import { UDropdown } from '../dropdown'
|
|
|
49
50
|
import { UIcon } from '../icon'
|
|
50
51
|
import { UInput } from '../input'
|
|
51
52
|
|
|
52
|
-
defineOptions({ name: 'UDatePicker' })
|
|
53
|
+
defineOptions({ name: 'UDatePicker', inheritAttrs: false })
|
|
53
54
|
|
|
54
55
|
const props = withDefaults(defineProps<DatePickerProps>(), {
|
|
55
56
|
placeholder: '选择日期',
|