@silver-formily/element-plus 2.4.0 → 3.0.1
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/esm/__builtins__/shared/transform-component.d.ts +1 -1
- package/esm/__builtins__/shared/utils.mjs +0 -2
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +11 -11
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +0 -1
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +1 -1
- package/esm/array-collapse/index.mjs +2 -5
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-items/index.mjs +1 -1
- package/esm/array-list-tabs/index.mjs +9 -9
- package/esm/array-table/index.mjs +7 -10
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +1 -2
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +16 -16
- package/esm/autocomplete/index.d.ts +8 -8
- package/esm/autocomplete/index.mjs +2 -4
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +2 -2
- package/esm/checkbox/index.d.ts +27 -27
- package/esm/checkbox/index.mjs +7 -12
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +12 -12
- package/esm/editable/index.d.ts +6 -6
- package/esm/editable/index.mjs +27 -33
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.d.ts +1 -0
- package/esm/form/form.mjs +5 -5
- package/esm/form-button-group/index.mjs +5 -12
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +1 -1
- package/esm/form-collapse/utils.mjs +0 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +13 -5
- package/esm/form-drawer/index.d.ts +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +13 -5
- package/esm/form-grid/form-grid.d.ts +2 -2
- package/esm/form-grid/hooks.d.ts +1 -2
- package/esm/form-grid/hooks.mjs +4 -11
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +34 -32
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +25 -31
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +8 -6
- package/esm/form-layout/form-layout.mjs +2 -2
- package/esm/form-layout/utils.mjs +2 -2
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +2 -2
- package/esm/form-step/utils.mjs +0 -3
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.d.ts +2 -1
- package/esm/form-tab/hooks.mjs +13 -20
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +39 -40
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/index.mjs +9 -9
- package/esm/input/index.mjs +2 -2
- package/esm/input-number/index.d.ts +15 -15
- package/esm/input-tag/index.mjs +2 -2
- package/esm/mention/index.mjs +2 -2
- package/esm/pagination/pagination.mjs +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/preview-text/index.mjs +2 -11
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/index.d.ts +3 -3
- package/esm/query-form/index.mjs +28 -31
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form/query-form.d.ts +1 -1
- package/esm/query-form/types.d.ts +1 -1
- package/esm/query-form-item/index.mjs +7 -11
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.d.ts +18 -18
- package/esm/radio/index.mjs +7 -12
- package/esm/radio/index.mjs.map +1 -1
- package/esm/reset/index.mjs +2 -2
- package/esm/segmented/index.mjs +2 -2
- package/esm/select/index.d.ts +16 -16
- package/esm/select/index.mjs +1 -1
- package/esm/select-table/index.d.ts +6 -6
- package/esm/select-table/index.mjs +4 -5
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/styles/form-grid/index.css +1 -1
- package/esm/submit/index.mjs +3 -3
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +9 -9
- package/esm/time-select/index.d.ts +12 -12
- package/esm/transfer/index.d.ts +12 -12
- package/esm/tree/index.mjs +3 -3
- package/esm/tree/utils.mjs +0 -2
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +2 -2
- package/esm/upload/index.d.ts +12 -12
- package/esm/upload/index.mjs +3 -3
- package/esm/upload/upload.d.ts +24 -24
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +111 -85
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +23 -29
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -7
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +57 -82
- package/LICENSE +0 -21
|
@@ -82,8 +82,8 @@ declare function __VLS_template(): {
|
|
|
82
82
|
readonly form?: string;
|
|
83
83
|
readonly name?: string;
|
|
84
84
|
readonly disabled?: boolean;
|
|
85
|
-
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
86
85
|
readonly id?: string;
|
|
86
|
+
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
87
87
|
readonly placeholder?: string;
|
|
88
88
|
readonly ariaLabel?: string;
|
|
89
89
|
readonly popperClass?: import('element-plus').ElTooltipContentProps["popperClass"];
|
|
@@ -152,12 +152,12 @@ declare function __VLS_template(): {
|
|
|
152
152
|
type: import('vue').PropType<boolean>;
|
|
153
153
|
default: undefined;
|
|
154
154
|
};
|
|
155
|
-
resize: {
|
|
156
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
157
|
-
};
|
|
158
155
|
id: {
|
|
159
156
|
type: import('vue').PropType<string>;
|
|
160
157
|
};
|
|
158
|
+
resize: {
|
|
159
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
160
|
+
};
|
|
161
161
|
placeholder: {
|
|
162
162
|
type: import('vue').PropType<string>;
|
|
163
163
|
};
|
|
@@ -421,12 +421,12 @@ declare function __VLS_template(): {
|
|
|
421
421
|
type: import('vue').PropType<boolean>;
|
|
422
422
|
default: undefined;
|
|
423
423
|
};
|
|
424
|
-
resize: {
|
|
425
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
426
|
-
};
|
|
427
424
|
id: {
|
|
428
425
|
type: import('vue').PropType<string>;
|
|
429
426
|
};
|
|
427
|
+
resize: {
|
|
428
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
429
|
+
};
|
|
430
430
|
placeholder: {
|
|
431
431
|
type: import('vue').PropType<string>;
|
|
432
432
|
};
|
|
@@ -588,7 +588,7 @@ declare function __VLS_template(): {
|
|
|
588
588
|
onChange?: ((value: string | number) => any) | undefined;
|
|
589
589
|
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
590
590
|
onClear?: (() => any) | undefined;
|
|
591
|
-
}, "type" | "placement" | "
|
|
591
|
+
}, "type" | "placement" | "activated" | "disabled" | "loading" | "blur" | "close" | "focus" | "modelValue" | "tabindex" | "teleported" | "modelModifiers" | "autocomplete" | "clearIcon" | "wordLimitPosition" | "validateEvent" | "inputStyle" | "rows" | "debounce" | "valueKey" | "popperRef" | "inputRef" | "fetchSuggestions" | "triggerOnFocus" | "loopNavigation" | "highlightedIndex" | "suggestions" | "handleSelect" | "handleKeyEnter" | "highlight" | "getData"> & import('vue').ShallowUnwrapRef<{
|
|
592
592
|
highlightedIndex: import('vue').Ref<number>;
|
|
593
593
|
activated: import('vue').Ref<boolean>;
|
|
594
594
|
loading: import('vue').Ref<boolean>;
|
|
@@ -671,8 +671,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
671
671
|
readonly form?: string;
|
|
672
672
|
readonly name?: string;
|
|
673
673
|
readonly disabled?: boolean;
|
|
674
|
-
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
675
674
|
readonly id?: string;
|
|
675
|
+
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
676
676
|
readonly placeholder?: string;
|
|
677
677
|
readonly ariaLabel?: string;
|
|
678
678
|
readonly popperClass?: import('element-plus').ElTooltipContentProps["popperClass"];
|
|
@@ -741,12 +741,12 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
741
741
|
type: import('vue').PropType<boolean>;
|
|
742
742
|
default: undefined;
|
|
743
743
|
};
|
|
744
|
-
resize: {
|
|
745
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
746
|
-
};
|
|
747
744
|
id: {
|
|
748
745
|
type: import('vue').PropType<string>;
|
|
749
746
|
};
|
|
747
|
+
resize: {
|
|
748
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
749
|
+
};
|
|
750
750
|
placeholder: {
|
|
751
751
|
type: import('vue').PropType<string>;
|
|
752
752
|
};
|
|
@@ -1010,12 +1010,12 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
1010
1010
|
type: import('vue').PropType<boolean>;
|
|
1011
1011
|
default: undefined;
|
|
1012
1012
|
};
|
|
1013
|
-
resize: {
|
|
1014
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
1015
|
-
};
|
|
1016
1013
|
id: {
|
|
1017
1014
|
type: import('vue').PropType<string>;
|
|
1018
1015
|
};
|
|
1016
|
+
resize: {
|
|
1017
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
1018
|
+
};
|
|
1019
1019
|
placeholder: {
|
|
1020
1020
|
type: import('vue').PropType<string>;
|
|
1021
1021
|
};
|
|
@@ -1177,7 +1177,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
1177
1177
|
onChange?: ((value: string | number) => any) | undefined;
|
|
1178
1178
|
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
1179
1179
|
onClear?: (() => any) | undefined;
|
|
1180
|
-
}, "type" | "placement" | "
|
|
1180
|
+
}, "type" | "placement" | "activated" | "disabled" | "loading" | "blur" | "close" | "focus" | "modelValue" | "tabindex" | "teleported" | "modelModifiers" | "autocomplete" | "clearIcon" | "wordLimitPosition" | "validateEvent" | "inputStyle" | "rows" | "debounce" | "valueKey" | "popperRef" | "inputRef" | "fetchSuggestions" | "triggerOnFocus" | "loopNavigation" | "highlightedIndex" | "suggestions" | "handleSelect" | "handleKeyEnter" | "highlight" | "getData"> & import('vue').ShallowUnwrapRef<{
|
|
1181
1181
|
highlightedIndex: import('vue').Ref<number>;
|
|
1182
1182
|
activated: import('vue').Ref<boolean>;
|
|
1183
1183
|
loading: import('vue').Ref<boolean>;
|
|
@@ -45,8 +45,8 @@ export declare const Autocomplete: {
|
|
|
45
45
|
readonly form?: string;
|
|
46
46
|
readonly name?: string;
|
|
47
47
|
readonly disabled?: boolean;
|
|
48
|
-
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
49
48
|
readonly id?: string;
|
|
49
|
+
readonly resize?: "none" | "both" | "horizontal" | "vertical";
|
|
50
50
|
readonly placeholder?: string;
|
|
51
51
|
readonly ariaLabel?: string;
|
|
52
52
|
readonly popperClass?: import('element-plus').ElTooltipContentProps["popperClass"];
|
|
@@ -115,12 +115,12 @@ export declare const Autocomplete: {
|
|
|
115
115
|
type: import('vue').PropType<boolean>;
|
|
116
116
|
default: undefined;
|
|
117
117
|
};
|
|
118
|
-
resize: {
|
|
119
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
120
|
-
};
|
|
121
118
|
id: {
|
|
122
119
|
type: import('vue').PropType<string>;
|
|
123
120
|
};
|
|
121
|
+
resize: {
|
|
122
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
123
|
+
};
|
|
124
124
|
placeholder: {
|
|
125
125
|
type: import('vue').PropType<string>;
|
|
126
126
|
};
|
|
@@ -384,12 +384,12 @@ export declare const Autocomplete: {
|
|
|
384
384
|
type: import('vue').PropType<boolean>;
|
|
385
385
|
default: undefined;
|
|
386
386
|
};
|
|
387
|
-
resize: {
|
|
388
|
-
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
389
|
-
};
|
|
390
387
|
id: {
|
|
391
388
|
type: import('vue').PropType<string>;
|
|
392
389
|
};
|
|
390
|
+
resize: {
|
|
391
|
+
type: import('vue').PropType<"none" | "horizontal" | "vertical" | "both">;
|
|
392
|
+
};
|
|
393
393
|
placeholder: {
|
|
394
394
|
type: import('vue').PropType<string>;
|
|
395
395
|
};
|
|
@@ -551,7 +551,7 @@ export declare const Autocomplete: {
|
|
|
551
551
|
onChange?: ((value: string | number) => any) | undefined;
|
|
552
552
|
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
553
553
|
onClear?: (() => any) | undefined;
|
|
554
|
-
}, "type" | "placement" | "
|
|
554
|
+
}, "type" | "placement" | "activated" | "disabled" | "loading" | "blur" | "close" | "focus" | "modelValue" | "tabindex" | "teleported" | "modelModifiers" | "autocomplete" | "clearIcon" | "wordLimitPosition" | "validateEvent" | "inputStyle" | "rows" | "debounce" | "valueKey" | "popperRef" | "inputRef" | "fetchSuggestions" | "triggerOnFocus" | "loopNavigation" | "highlightedIndex" | "suggestions" | "handleSelect" | "handleKeyEnter" | "highlight" | "getData"> & import('vue').ShallowUnwrapRef<{
|
|
555
555
|
highlightedIndex: import('vue').Ref<number>;
|
|
556
556
|
activated: import('vue').Ref<boolean>;
|
|
557
557
|
loading: import('vue').Ref<boolean>;
|
|
@@ -2,7 +2,7 @@ import { useField as S, connect as $, mapProps as P } from "@silver-formily/vue"
|
|
|
2
2
|
import { ElAutocomplete as A } from "element-plus";
|
|
3
3
|
import "@formily/reactive";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as R, useSlots as w, ref as C, computed as d,
|
|
5
|
+
import { defineComponent as R, useSlots as w, ref as C, computed as d, openBlock as F, createBlock as x, unref as p, mergeProps as z, createSlots as B, withCtx as n, renderSlot as r, normalizeProps as E, guardReactiveProps as K } from "vue";
|
|
6
6
|
import { mapReadPretty as L } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { PreviewText as O } from "../preview-text/index.mjs";
|
|
8
8
|
import "@formily/core";
|
|
@@ -24,7 +24,6 @@ const j = /* @__PURE__ */ R({
|
|
|
24
24
|
const e = i.value.fetchSuggestions;
|
|
25
25
|
if (e)
|
|
26
26
|
return ((a, s) => e(a, s, t.value));
|
|
27
|
-
/* istanbul ignore next -- @preserve defensive: allow autocomplete to run without options and remote fetch */
|
|
28
27
|
if (u.options)
|
|
29
28
|
return (a, s) => {
|
|
30
29
|
t.value.loading = !0;
|
|
@@ -34,7 +33,6 @@ const j = /* @__PURE__ */ R({
|
|
|
34
33
|
});
|
|
35
34
|
function v(e, a, s) {
|
|
36
35
|
const l = e?.[a];
|
|
37
|
-
/* istanbul ignore next -- @preserve defensive: tolerate invalid option shape from external data source */
|
|
38
36
|
return l == null ? !1 : String(l).toLowerCase().includes(s);
|
|
39
37
|
}
|
|
40
38
|
const g = d(() => ({
|
|
@@ -42,7 +40,7 @@ const j = /* @__PURE__ */ R({
|
|
|
42
40
|
loading: i.value.loading ?? t.value?.loading,
|
|
43
41
|
fetchSuggestions: c.value
|
|
44
42
|
}));
|
|
45
|
-
return (e, a) => (
|
|
43
|
+
return (e, a) => (F(), x(p(A), z({
|
|
46
44
|
ref_key: "autocompleteRef",
|
|
47
45
|
ref: f
|
|
48
46
|
}, g.value), B({ _: 2 }, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/autocomplete/autocomplete.vue","../../src/autocomplete/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@formily/core'\nimport type { AutocompleteInstance } from 'element-plus'\nimport type { AutocompleteData, AutocompleteFetchSuggestions } from 'element-plus/es/components/autocomplete'\nimport { useField } from '@silver-formily/vue'\nimport { ElAutocomplete } from 'element-plus'\nimport { computed, ref } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FAutocomplete',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: AutocompleteData\n}>()\n\nconst slots = defineSlots<{\n default?: (scope: { item: AutocompleteData[number], field: Field | undefined }) => any\n header?: (scope: { field: Field | undefined }) => any\n footer?: (scope: { field: Field | undefined }) => any\n loading?: () => any\n prefix?: () => any\n suffix?: () => any\n prepend?: () => any\n append?: () => any\n}>()\n\nconst { props: attrs } = useCleanAttrs()\nconst fieldRef = useField<Field>()\nconst autocompleteRef = ref<AutocompleteInstance>()\n\nfieldRef.value?.inject({\n getElAutocompleteRef: () => autocompleteRef,\n})\n\nconst normalizedFetchSuggestions = computed<AutocompleteFetchSuggestions | undefined>(() => {\n const attrFetch = attrs.value.fetchSuggestions as AutocompleteFetchSuggestions | undefined\n if (attrFetch) {\n return ((queryString, cb) => {\n return (attrFetch as (...args: any[]) => any)(queryString, cb, fieldRef.value)\n }) as AutocompleteFetchSuggestions\n }\n\n /* istanbul ignore next -- @preserve defensive: allow autocomplete to run without options and remote fetch */\n if (!props.options) {\n return\n }\n\n return (queryString: string, cb) => {\n fieldRef.value.loading = true\n const keyword = (queryString ?? '').toLowerCase()\n const valueKey = (attrs.value.valueKey ?? 'value') as string\n const results = keyword\n ? props.options!.filter(option => matchOption(option, valueKey, keyword))\n : props.options!\n cb(results)\n fieldRef.value.loading = false\n }\n})\n\nfunction matchOption(option: AutocompleteData[number], valueKey: string, keyword: string) {\n const target = option?.[valueKey]\n /* istanbul ignore next -- @preserve defensive: tolerate invalid option shape from external data source */\n if (target === undefined || target === null) {\n return false\n }\n return String(target).toLowerCase().includes(keyword)\n}\n\nconst autocompleteProps = computed(() => ({\n ...attrs.value,\n loading: attrs.value.loading ?? fieldRef.value?.loading,\n fetchSuggestions: normalizedFetchSuggestions.value,\n}))\n</script>\n\n<template>\n <ElAutocomplete ref=\"autocompleteRef\" v-bind=\"autocompleteProps\">\n <template v-if=\"slots.default\" #default=\"slotProps\">\n <slot name=\"default\" v-bind=\"{ ...slotProps, field: fieldRef }\" />\n </template>\n <template v-if=\"slots.header\" #header>\n <slot name=\"header\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.footer\" #footer>\n <slot name=\"footer\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.suffix\" #suffix>\n <slot name=\"suffix\" />\n </template>\n <template v-if=\"slots.prepend\" #prepend>\n <slot name=\"prepend\" />\n </template>\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n <template v-if=\"slots.loading\" #loading>\n <slot name=\"loading\" />\n </template>\n </ElAutocomplete>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FAutocomplete from './autocomplete.vue'\n\nexport const Autocomplete = connect<typeof FAutocomplete>(\n FAutocomplete,\n mapProps({ dataSource: 'options', readOnly: 'readonly', disabled: true }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport default Autocomplete\n"],"names":["props","__props","slots","_useSlots","attrs","useCleanAttrs","fieldRef","useField","autocompleteRef","ref","normalizedFetchSuggestions","computed","attrFetch","queryString","cb","keyword","valueKey","results","option","matchOption","target","autocompleteProps","_openBlock","_createBlock","_unref","_mergeProps","_createSlots","_withCtx","slotProps","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","Autocomplete","connect","FAutocomplete","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAWR,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAWC,EAAA,GACXC,IAAkBC,EAAA;AAExB,IAAAH,EAAS,OAAO,OAAO;AAAA,MACrB,sBAAsB,MAAME;AAAA,IAAA,CAC7B;AAED,UAAME,IAA6BC,EAAmD,MAAM;AAC1F,YAAMC,IAAYR,EAAM,MAAM;AAC9B,UAAIQ;AACF,gBAAQ,CAACC,GAAaC,MACZF,EAAsCC,GAAaC,GAAIR,EAAS,KAAK;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/autocomplete/autocomplete.vue","../../src/autocomplete/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@formily/core'\nimport type { AutocompleteInstance } from 'element-plus'\nimport type { AutocompleteData, AutocompleteFetchSuggestions } from 'element-plus/es/components/autocomplete'\nimport { useField } from '@silver-formily/vue'\nimport { ElAutocomplete } from 'element-plus'\nimport { computed, ref } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FAutocomplete',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: AutocompleteData\n}>()\n\nconst slots = defineSlots<{\n default?: (scope: { item: AutocompleteData[number], field: Field | undefined }) => any\n header?: (scope: { field: Field | undefined }) => any\n footer?: (scope: { field: Field | undefined }) => any\n loading?: () => any\n prefix?: () => any\n suffix?: () => any\n prepend?: () => any\n append?: () => any\n}>()\n\nconst { props: attrs } = useCleanAttrs()\nconst fieldRef = useField<Field>()\nconst autocompleteRef = ref<AutocompleteInstance>()\n\nfieldRef.value?.inject({\n getElAutocompleteRef: () => autocompleteRef,\n})\n\nconst normalizedFetchSuggestions = computed<AutocompleteFetchSuggestions | undefined>(() => {\n const attrFetch = attrs.value.fetchSuggestions as AutocompleteFetchSuggestions | undefined\n if (attrFetch) {\n return ((queryString, cb) => {\n return (attrFetch as (...args: any[]) => any)(queryString, cb, fieldRef.value)\n }) as AutocompleteFetchSuggestions\n }\n\n /* istanbul ignore next -- @preserve defensive: allow autocomplete to run without options and remote fetch */\n if (!props.options) {\n return\n }\n\n return (queryString: string, cb) => {\n fieldRef.value.loading = true\n const keyword = (queryString ?? '').toLowerCase()\n const valueKey = (attrs.value.valueKey ?? 'value') as string\n const results = keyword\n ? props.options!.filter(option => matchOption(option, valueKey, keyword))\n : props.options!\n cb(results)\n fieldRef.value.loading = false\n }\n})\n\nfunction matchOption(option: AutocompleteData[number], valueKey: string, keyword: string) {\n const target = option?.[valueKey]\n /* istanbul ignore next -- @preserve defensive: tolerate invalid option shape from external data source */\n if (target === undefined || target === null) {\n return false\n }\n return String(target).toLowerCase().includes(keyword)\n}\n\nconst autocompleteProps = computed(() => ({\n ...attrs.value,\n loading: attrs.value.loading ?? fieldRef.value?.loading,\n fetchSuggestions: normalizedFetchSuggestions.value,\n}))\n</script>\n\n<template>\n <ElAutocomplete ref=\"autocompleteRef\" v-bind=\"autocompleteProps\">\n <template v-if=\"slots.default\" #default=\"slotProps\">\n <slot name=\"default\" v-bind=\"{ ...slotProps, field: fieldRef }\" />\n </template>\n <template v-if=\"slots.header\" #header>\n <slot name=\"header\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.footer\" #footer>\n <slot name=\"footer\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.suffix\" #suffix>\n <slot name=\"suffix\" />\n </template>\n <template v-if=\"slots.prepend\" #prepend>\n <slot name=\"prepend\" />\n </template>\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n <template v-if=\"slots.loading\" #loading>\n <slot name=\"loading\" />\n </template>\n </ElAutocomplete>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FAutocomplete from './autocomplete.vue'\n\nexport const Autocomplete = connect<typeof FAutocomplete>(\n FAutocomplete,\n mapProps({ dataSource: 'options', readOnly: 'readonly', disabled: true }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport default Autocomplete\n"],"names":["props","__props","slots","_useSlots","attrs","useCleanAttrs","fieldRef","useField","autocompleteRef","ref","normalizedFetchSuggestions","computed","attrFetch","queryString","cb","keyword","valueKey","results","option","matchOption","target","autocompleteProps","_openBlock","_createBlock","_unref","_mergeProps","_createSlots","_withCtx","slotProps","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","Autocomplete","connect","FAutocomplete","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAWR,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAWC,EAAA,GACXC,IAAkBC,EAAA;AAExB,IAAAH,EAAS,OAAO,OAAO;AAAA,MACrB,sBAAsB,MAAME;AAAA,IAAA,CAC7B;AAED,UAAME,IAA6BC,EAAmD,MAAM;AAC1F,YAAMC,IAAYR,EAAM,MAAM;AAC9B,UAAIQ;AACF,gBAAQ,CAACC,GAAaC,MACZF,EAAsCC,GAAaC,GAAIR,EAAS,KAAK;AAKjF,UAAKN,EAAM;AAIX,eAAO,CAACa,GAAqBC,MAAO;AAClC,UAAAR,EAAS,MAAM,UAAU;AACzB,gBAAMS,KAAWF,KAAe,IAAI,YAAA,GAC9BG,IAAYZ,EAAM,MAAM,YAAY,SACpCa,IAAUF,IACZf,EAAM,QAAS,OAAO,CAAAkB,MAAUC,EAAYD,GAAQF,GAAUD,CAAO,CAAC,IACtEf,EAAM;AACV,UAAAc,EAAGG,CAAO,GACVX,EAAS,MAAM,UAAU;AAAA,QAC3B;AAAA,IACF,CAAC;AAED,aAASa,EAAYD,GAAkCF,GAAkBD,GAAiB;AACxF,YAAMK,IAASF,IAASF,CAAQ;AAEhC,aAA4BI,KAAW,OAC9B,KAEF,OAAOA,CAAM,EAAE,YAAA,EAAc,SAASL,CAAO;AAAA,IACtD;AAEA,UAAMM,IAAoBV,EAAS,OAAO;AAAA,MACxC,GAAGP,EAAM;AAAA,MACT,SAASA,EAAM,MAAM,WAAWE,EAAS,OAAO;AAAA,MAChD,kBAAkBI,EAA2B;AAAA,IAAA,EAC7C;sBAIAY,KAAAC,EAyBiBC,MAzBjBC,EAyBiB;AAAA,eAzBG;AAAA,MAAJ,KAAIjB;AAAA,IAAA,GAA0Ba,EAAA,KAAiB,GAAAK,EAAA,EAAA,GAAA,KAAA;AAAA,MAC7CxB,EAAM;cAAU;AAAA,QAC9B,IAAAyB,EAAA,CADuCC,MAAS;AAAA,UAChDC,EAAkEC,EAAA,QAAA,WAAAC,EAAAC,EAAA,EAAA,GAAhCJ,GAAS,OAASJ,EAAAlB,CAAA,EAAA,CAAQ,CAAA,CAAA;AAAA,QAAA;;;MAE9CJ,EAAM;cAAS;AAAA,cAC7B,MAAwC;AAAA,UAAxC2B,EAAwCC,EAAA,QAAA,UAAA,EAAnB,OAAON,EAAAlB,CAAA,EAAA,CAAQ;AAAA,QAAA;;;MAEtBJ,EAAM;cAAS;AAAA,cAC7B,MAAwC;AAAA,UAAxC2B,EAAwCC,EAAA,QAAA,UAAA,EAAnB,OAAON,EAAAlB,CAAA,EAAA,CAAQ;AAAA,QAAA;;;MAEtBJ,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtB2B,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;MAER5B,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtB2B,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;MAER5B,EAAM;cAAU;AAAA,cAC9B,MAAuB;AAAA,UAAvB2B,EAAuBC,EAAA,QAAA,SAAA;AAAA,QAAA;;;MAET5B,EAAM;cAAS;AAAA,cAC7B,MAAsB;AAAA,UAAtB2B,EAAsBC,EAAA,QAAA,QAAA;AAAA,QAAA;;;MAER5B,EAAM;cAAU;AAAA,cAC9B,MAAuB;AAAA,UAAvB2B,EAAuBC,EAAA,QAAA,SAAA;AAAA,QAAA;;;;;ICjGhBG,IAAeC;AAAA,EAC1BC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,UAAU,YAAY,UAAU,IAAM;AAAA,EACxEC,EAAcC,EAAY,KAAK;AACjC;"}
|
package/esm/cascader/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { connect as i, mapProps as c } from "@silver-formily/vue";
|
|
|
2
2
|
import { ElCascader as d } from "element-plus";
|
|
3
3
|
import "@formily/reactive";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as f,
|
|
5
|
+
import { defineComponent as f, openBlock as l, createBlock as u, unref as e, mergeProps as C, createSlots as y, withCtx as t, renderSlot as r } from "vue";
|
|
6
6
|
import { mapReadPretty as P } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { PreviewText as k } from "../preview-text/index.mjs";
|
|
8
8
|
import "@formily/core";
|
|
@@ -17,7 +17,7 @@ const h = /* @__PURE__ */ f({
|
|
|
17
17
|
},
|
|
18
18
|
setup(s) {
|
|
19
19
|
const a = s, { props: p } = $();
|
|
20
|
-
return (o, v) => (
|
|
20
|
+
return (o, v) => (l(), u(e(d), C(e(p), {
|
|
21
21
|
options: a.options
|
|
22
22
|
}), y({ _: 2 }, [
|
|
23
23
|
o.$slots.default ? {
|
package/esm/checkbox/index.d.ts
CHANGED
|
@@ -542,12 +542,8 @@ export declare const Checkbox: {
|
|
|
542
542
|
max: {
|
|
543
543
|
type: import('vue').PropType<number>;
|
|
544
544
|
};
|
|
545
|
-
|
|
546
|
-
type: import('vue').PropType<
|
|
547
|
-
};
|
|
548
|
-
disabled: {
|
|
549
|
-
type: import('vue').PropType<boolean>;
|
|
550
|
-
default: undefined;
|
|
545
|
+
min: {
|
|
546
|
+
type: import('vue').PropType<number>;
|
|
551
547
|
};
|
|
552
548
|
props: {
|
|
553
549
|
type: import('vue').PropType<{
|
|
@@ -561,6 +557,13 @@ export declare const Checkbox: {
|
|
|
561
557
|
disabled?: string;
|
|
562
558
|
}>;
|
|
563
559
|
};
|
|
560
|
+
disabled: {
|
|
561
|
+
type: import('vue').PropType<boolean>;
|
|
562
|
+
default: undefined;
|
|
563
|
+
};
|
|
564
|
+
fill: {
|
|
565
|
+
type: import('vue').PropType<string>;
|
|
566
|
+
};
|
|
564
567
|
modelValue: {
|
|
565
568
|
type: import('vue').PropType<import('element-plus').CheckboxGroupValueType>;
|
|
566
569
|
default: () => never[];
|
|
@@ -576,9 +579,6 @@ export declare const Checkbox: {
|
|
|
576
579
|
type: import('vue').PropType<boolean>;
|
|
577
580
|
default: boolean;
|
|
578
581
|
};
|
|
579
|
-
min: {
|
|
580
|
-
type: import('vue').PropType<number>;
|
|
581
|
-
};
|
|
582
582
|
options: {
|
|
583
583
|
type: import('vue').PropType<import('element-plus').CheckboxOption[]>;
|
|
584
584
|
};
|
|
@@ -620,12 +620,8 @@ export declare const Checkbox: {
|
|
|
620
620
|
max: {
|
|
621
621
|
type: import('vue').PropType<number>;
|
|
622
622
|
};
|
|
623
|
-
|
|
624
|
-
type: import('vue').PropType<
|
|
625
|
-
};
|
|
626
|
-
disabled: {
|
|
627
|
-
type: import('vue').PropType<boolean>;
|
|
628
|
-
default: undefined;
|
|
623
|
+
min: {
|
|
624
|
+
type: import('vue').PropType<number>;
|
|
629
625
|
};
|
|
630
626
|
props: {
|
|
631
627
|
type: import('vue').PropType<{
|
|
@@ -639,6 +635,13 @@ export declare const Checkbox: {
|
|
|
639
635
|
disabled?: string;
|
|
640
636
|
}>;
|
|
641
637
|
};
|
|
638
|
+
disabled: {
|
|
639
|
+
type: import('vue').PropType<boolean>;
|
|
640
|
+
default: undefined;
|
|
641
|
+
};
|
|
642
|
+
fill: {
|
|
643
|
+
type: import('vue').PropType<string>;
|
|
644
|
+
};
|
|
642
645
|
modelValue: {
|
|
643
646
|
type: import('vue').PropType<import('element-plus').CheckboxGroupValueType>;
|
|
644
647
|
default: () => never[];
|
|
@@ -654,9 +657,6 @@ export declare const Checkbox: {
|
|
|
654
657
|
type: import('vue').PropType<boolean>;
|
|
655
658
|
default: boolean;
|
|
656
659
|
};
|
|
657
|
-
min: {
|
|
658
|
-
type: import('vue').PropType<number>;
|
|
659
|
-
};
|
|
660
660
|
options: {
|
|
661
661
|
type: import('vue').PropType<import('element-plus').CheckboxOption[]>;
|
|
662
662
|
};
|
|
@@ -692,12 +692,8 @@ export declare const Checkbox: {
|
|
|
692
692
|
max: {
|
|
693
693
|
type: import('vue').PropType<number>;
|
|
694
694
|
};
|
|
695
|
-
|
|
696
|
-
type: import('vue').PropType<
|
|
697
|
-
};
|
|
698
|
-
disabled: {
|
|
699
|
-
type: import('vue').PropType<boolean>;
|
|
700
|
-
default: undefined;
|
|
695
|
+
min: {
|
|
696
|
+
type: import('vue').PropType<number>;
|
|
701
697
|
};
|
|
702
698
|
props: {
|
|
703
699
|
type: import('vue').PropType<{
|
|
@@ -711,6 +707,13 @@ export declare const Checkbox: {
|
|
|
711
707
|
disabled?: string;
|
|
712
708
|
}>;
|
|
713
709
|
};
|
|
710
|
+
disabled: {
|
|
711
|
+
type: import('vue').PropType<boolean>;
|
|
712
|
+
default: undefined;
|
|
713
|
+
};
|
|
714
|
+
fill: {
|
|
715
|
+
type: import('vue').PropType<string>;
|
|
716
|
+
};
|
|
714
717
|
modelValue: {
|
|
715
718
|
type: import('vue').PropType<import('element-plus').CheckboxGroupValueType>;
|
|
716
719
|
default: () => never[];
|
|
@@ -726,9 +729,6 @@ export declare const Checkbox: {
|
|
|
726
729
|
type: import('vue').PropType<boolean>;
|
|
727
730
|
default: boolean;
|
|
728
731
|
};
|
|
729
|
-
min: {
|
|
730
|
-
type: import('vue').PropType<number>;
|
|
731
|
-
};
|
|
732
732
|
options: {
|
|
733
733
|
type: import('vue').PropType<import('element-plus').CheckboxOption[]>;
|
|
734
734
|
};
|
package/esm/checkbox/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { connect as _, mapProps as y } from "@silver-formily/vue";
|
|
|
2
2
|
import { ElCheckboxButton as S, ElCheckbox as h, ElCheckboxGroup as g, version as E } from "element-plus";
|
|
3
3
|
import "@formily/reactive";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as T, computed as c, useSlots as A,
|
|
5
|
+
import { defineComponent as T, computed as c, useSlots as A, openBlock as o, createBlock as a, unref as n, normalizeProps as B, guardReactiveProps as G, withCtx as l, createElementBlock as m, Fragment as i, renderList as f, resolveDynamicComponent as b, mergeProps as d, createTextVNode as w, toDisplayString as D, renderSlot as F } from "vue";
|
|
6
6
|
import { mapReadPretty as I } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { useCleanAttrs as L, composeExport as N } from "../__builtins__/shared/utils.mjs";
|
|
8
8
|
import { PreviewText as O } from "../preview-text/index.mjs";
|
|
@@ -25,17 +25,12 @@ const j = /* @__PURE__ */ T({
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
setup(x) {
|
|
28
|
-
const p = x, s = c(() => p.optionType === "button" ? S : h), C = R(E, "2.6.0"), u = c(() => p.options.map((e) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* istanbul ignore if -- @preserve */
|
|
35
|
-
return C ? {
|
|
36
|
-
...e,
|
|
37
|
-
label: e.value
|
|
38
|
-
} : e;
|
|
28
|
+
const p = x, s = c(() => p.optionType === "button" ? S : h), C = R(E, "2.6.0"), u = c(() => p.options.map((e) => k(e) ? C ? {
|
|
29
|
+
...e,
|
|
30
|
+
label: e.value
|
|
31
|
+
} : e : {
|
|
32
|
+
label: e,
|
|
33
|
+
value: e
|
|
39
34
|
})), v = A(), { props: P } = L();
|
|
40
35
|
return (e, V) => (o(), a(n(g), B(G(n(P))), {
|
|
41
36
|
default: l(() => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/checkbox/checkbox-group.vue","../../src/checkbox/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxProps } from 'element-plus'\nimport type { PropType } from 'vue'\nimport { isPlainObj } from '@formily/shared'\nimport { ElCheckbox, ElCheckboxButton, ElCheckboxGroup, version } from 'element-plus'\nimport { computed, useSlots } from 'vue'\nimport { lt, useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FCheckboxGroup',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n options: {\n type: Array as PropType<Array<CheckboxProps>>,\n default: () => [],\n },\n optionType: {\n type: String as PropType<'default' | 'button'>,\n default: 'default',\n },\n})\n\nconst OptionType = computed(() => {\n return props.optionType === 'button' ? ElCheckboxButton : ElCheckbox\n})\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\nconst compatiableProps = computed(() => {\n return props.options.map((option) => {\n if (!isPlainObj(option)) {\n return {\n label: option,\n value: option,\n }\n }\n /* istanbul ignore if -- @preserve */\n if (IS_LESS_THAN_2_6_0) {\n return {\n ...option,\n label: option.value,\n }\n }\n return option\n })\n})\n\nconst slots = useSlots()\nconst { props: checkboxProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElCheckboxGroup v-bind=\"checkboxProps\">\n <template v-if=\"!slots.option\">\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n {{ isPlainObj(props.options[index]) ? props.options[index]?.label : option.label }}\n </component>\n </template>\n <template v-else>\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n <slot name=\"option\" :option=\"option\" />\n </component>\n </template>\n </ElCheckboxGroup>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { ElCheckbox } from 'element-plus'\nimport { composeExport, mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FCheckboxGroup from './checkbox-group.vue'\n\nconst CheckboxGroup = connect<typeof FCheckboxGroup>(\n FCheckboxGroup,\n mapProps({ dataSource: 'options', disabled: true }),\n mapReadPretty(PreviewText.Select, {\n multiple: true,\n }),\n)\n\nconst InnerCheckbox = connect<typeof ElCheckbox>(\n ElCheckbox,\n mapProps({\n disabled: true,\n }),\n)\n\nexport const Checkbox = composeExport(InnerCheckbox, {\n Group: CheckboxGroup,\n})\n\nexport default Checkbox\n"],"names":["props","__props","OptionType","computed","ElCheckboxButton","ElCheckbox","IS_LESS_THAN_2_6_0","lt","version","compatiableProps","option","isPlainObj","slots","useSlots","checkboxProps","useCleanAttrs","_openBlock","_createBlock","_unref","_createElementBlock","_Fragment","_renderList","index","_resolveDynamicComponent","_mergeProps","_renderSlot","_ctx","_createTextVNode","_toDisplayString","CheckboxGroup","connect","FCheckboxGroup","mapProps","mapReadPretty","PreviewText","InnerCheckbox","Checkbox","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,UAAMA,IAAQC,GAWRC,IAAaC,EAAS,MACnBH,EAAM,eAAe,WAAWI,IAAmBC,CAC3D,GACKC,IAAqBC,EAAGC,GAAS,OAAO,GACxCC,IAAmBN,EAAS,MACzBH,EAAM,QAAQ,IAAI,CAACU,
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/checkbox/checkbox-group.vue","../../src/checkbox/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { CheckboxProps } from 'element-plus'\nimport type { PropType } from 'vue'\nimport { isPlainObj } from '@formily/shared'\nimport { ElCheckbox, ElCheckboxButton, ElCheckboxGroup, version } from 'element-plus'\nimport { computed, useSlots } from 'vue'\nimport { lt, useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FCheckboxGroup',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n options: {\n type: Array as PropType<Array<CheckboxProps>>,\n default: () => [],\n },\n optionType: {\n type: String as PropType<'default' | 'button'>,\n default: 'default',\n },\n})\n\nconst OptionType = computed(() => {\n return props.optionType === 'button' ? ElCheckboxButton : ElCheckbox\n})\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\nconst compatiableProps = computed(() => {\n return props.options.map((option) => {\n if (!isPlainObj(option)) {\n return {\n label: option,\n value: option,\n }\n }\n /* istanbul ignore if -- @preserve */\n if (IS_LESS_THAN_2_6_0) {\n return {\n ...option,\n label: option.value,\n }\n }\n return option\n })\n})\n\nconst slots = useSlots()\nconst { props: checkboxProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElCheckboxGroup v-bind=\"checkboxProps\">\n <template v-if=\"!slots.option\">\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n {{ isPlainObj(props.options[index]) ? props.options[index]?.label : option.label }}\n </component>\n </template>\n <template v-else>\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n <slot name=\"option\" :option=\"option\" />\n </component>\n </template>\n </ElCheckboxGroup>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { ElCheckbox } from 'element-plus'\nimport { composeExport, mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FCheckboxGroup from './checkbox-group.vue'\n\nconst CheckboxGroup = connect<typeof FCheckboxGroup>(\n FCheckboxGroup,\n mapProps({ dataSource: 'options', disabled: true }),\n mapReadPretty(PreviewText.Select, {\n multiple: true,\n }),\n)\n\nconst InnerCheckbox = connect<typeof ElCheckbox>(\n ElCheckbox,\n mapProps({\n disabled: true,\n }),\n)\n\nexport const Checkbox = composeExport(InnerCheckbox, {\n Group: CheckboxGroup,\n})\n\nexport default Checkbox\n"],"names":["props","__props","OptionType","computed","ElCheckboxButton","ElCheckbox","IS_LESS_THAN_2_6_0","lt","version","compatiableProps","option","isPlainObj","slots","useSlots","checkboxProps","useCleanAttrs","_openBlock","_createBlock","_unref","_createElementBlock","_Fragment","_renderList","index","_resolveDynamicComponent","_mergeProps","_renderSlot","_ctx","_createTextVNode","_toDisplayString","CheckboxGroup","connect","FCheckboxGroup","mapProps","mapReadPretty","PreviewText","InnerCheckbox","Checkbox","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,UAAMA,IAAQC,GAWRC,IAAaC,EAAS,MACnBH,EAAM,eAAe,WAAWI,IAAmBC,CAC3D,GACKC,IAAqBC,EAAGC,GAAS,OAAO,GACxCC,IAAmBN,EAAS,MACzBH,EAAM,QAAQ,IAAI,CAACU,MACnBC,EAAWD,CAAM,IAOlBJ,IACK;AAAA,MACL,GAAGI;AAAA,MACH,OAAOA,EAAO;AAAA,IAAA,IAGXA,IAZE;AAAA,MACL,OAAOA;AAAA,MACP,OAAOA;AAAA,IAAA,CAWZ,CACF,GAEKE,IAAQC,EAAA,GACR,EAAE,OAAOC,EAAA,IAAkBC,EAAA;sBAI/BC,EAAA,GAAAC,EAWkBC,UAXOA,EAAAJ,CAAA,CAAa,CAAA,GAAA;AAAA,iBACpC,MAIW;AAAA,QAJMI,EAAAN,CAAA,EAAM,UAMrBI,EAAA,EAAA,GAAAG,EAEYC,GAAA,EAAA,KAAA,KAAAC,EAF0CZ,EAAA,OAAgB,CAAlCC,GAAQY,YAA5CL,EAEYM,EAFIrB,OAAU,GAA1BsB,EAEY,EAF6D,KAAKF,KAAK,EAAA,SAAA,GAAA,GAAUZ,CAAM,GAAA;AAAA,qBACjG,MAAuC;AAAA,YAAvCe,EAAuCC,EAAA,QAAA,UAAA,EAAlB,QAAAhB,GAAc;AAAA,UAAA;;6BANrCM,EAAA,EAAA,GAAAG,EAEYC,GAAA,EAAA,KAAA,KAAAC,EAF0CZ,EAAA,OAAgB,CAAlCC,GAAQY,YAA5CL,EAEYM,EAFIrB,OAAU,GAA1BsB,EAEY,EAF6D,KAAKF,KAAK,EAAA,SAAA,GAAA,GAAUZ,CAAM,GAAA;AAAA,qBACjG,MAAmF;AAAA,YAAhFiB,EAAAC,EAAAV,EAAAP,CAAA,EAAWX,EAAM,QAAQsB,CAAK,CAAA,IAAKtB,EAAM,QAAQsB,CAAK,GAAG,QAAQZ,EAAO,KAAK,GAAA,CAAA;AAAA,UAAA;;;;;;;ICjDlFmB,IAAgBC;AAAA,EACpBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,UAAU,IAAM;AAAA,EAClDC,EAAcC,EAAY,QAAQ;AAAA,IAChC,UAAU;AAAA,EAAA,CACX;AACH,GAEMC,IAAgBL;AAAA,EACpBzB;AAAA,EACA2B,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH,GAEaI,KAAWC,EAAcF,GAAe;AAAA,EACnD,OAAON;AACT,CAAC;"}
|
|
@@ -20,13 +20,13 @@ declare function __VLS_template(): {
|
|
|
20
20
|
fullness: boolean;
|
|
21
21
|
}> & Omit<{
|
|
22
22
|
readonly internalFormItemClass?: string;
|
|
23
|
-
readonly label?:
|
|
23
|
+
readonly label?: import('../form-item/types').FormItemContent;
|
|
24
24
|
readonly for?: string;
|
|
25
|
-
readonly tooltip?:
|
|
26
|
-
readonly addonBefore?:
|
|
27
|
-
readonly addonAfter?:
|
|
28
|
-
readonly extra?:
|
|
29
|
-
readonly feedbackText?:
|
|
25
|
+
readonly tooltip?: import('../form-item/types').FormItemContent;
|
|
26
|
+
readonly addonBefore?: import('../form-item/types').FormItemContent;
|
|
27
|
+
readonly addonAfter?: import('../form-item/types').FormItemContent;
|
|
28
|
+
readonly extra?: import('../form-item/types').FormItemContent;
|
|
29
|
+
readonly feedbackText?: import('../form-item/types').FormItemContent;
|
|
30
30
|
readonly feedbackStatus?: "error" | "warning" | "success" | "pending";
|
|
31
31
|
readonly asterisk?: boolean;
|
|
32
32
|
readonly colon?: boolean;
|
|
@@ -111,13 +111,13 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
111
111
|
fullness: boolean;
|
|
112
112
|
}> & Omit<{
|
|
113
113
|
readonly internalFormItemClass?: string;
|
|
114
|
-
readonly label?:
|
|
114
|
+
readonly label?: import('../form-item/types').FormItemContent;
|
|
115
115
|
readonly for?: string;
|
|
116
|
-
readonly tooltip?:
|
|
117
|
-
readonly addonBefore?:
|
|
118
|
-
readonly addonAfter?:
|
|
119
|
-
readonly extra?:
|
|
120
|
-
readonly feedbackText?:
|
|
116
|
+
readonly tooltip?: import('../form-item/types').FormItemContent;
|
|
117
|
+
readonly addonBefore?: import('../form-item/types').FormItemContent;
|
|
118
|
+
readonly addonAfter?: import('../form-item/types').FormItemContent;
|
|
119
|
+
readonly extra?: import('../form-item/types').FormItemContent;
|
|
120
|
+
readonly feedbackText?: import('../form-item/types').FormItemContent;
|
|
121
121
|
readonly feedbackStatus?: "error" | "warning" | "success" | "pending";
|
|
122
122
|
readonly asterisk?: boolean;
|
|
123
123
|
readonly colon?: boolean;
|
package/esm/editable/index.d.ts
CHANGED
|
@@ -20,13 +20,13 @@ export declare const Editable: {
|
|
|
20
20
|
fullness: boolean;
|
|
21
21
|
}> & Omit<{
|
|
22
22
|
readonly internalFormItemClass?: string;
|
|
23
|
-
readonly label?:
|
|
23
|
+
readonly label?: import('../form-item/types').FormItemContent;
|
|
24
24
|
readonly for?: string;
|
|
25
|
-
readonly tooltip?:
|
|
26
|
-
readonly addonBefore?:
|
|
27
|
-
readonly addonAfter?:
|
|
28
|
-
readonly extra?:
|
|
29
|
-
readonly feedbackText?:
|
|
25
|
+
readonly tooltip?: import('../form-item/types').FormItemContent;
|
|
26
|
+
readonly addonBefore?: import('../form-item/types').FormItemContent;
|
|
27
|
+
readonly addonAfter?: import('../form-item/types').FormItemContent;
|
|
28
|
+
readonly extra?: import('../form-item/types').FormItemContent;
|
|
29
|
+
readonly feedbackText?: import('../form-item/types').FormItemContent;
|
|
30
30
|
readonly feedbackStatus?: "error" | "warning" | "success" | "pending";
|
|
31
31
|
readonly asterisk?: boolean;
|
|
32
32
|
readonly colon?: boolean;
|
package/esm/editable/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useField as E, connect as h, mapProps as w } from "@silver-formily/vue";
|
|
2
|
-
import { ElPopover as
|
|
2
|
+
import { ElPopover as W, ElText as S, ClickOutside as R } from "element-plus";
|
|
3
3
|
import { reaction as V } from "@formily/reactive";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as z, ref as m,
|
|
5
|
+
import { defineComponent as z, ref as m, openBlock as n, createElementBlock as f, normalizeClass as i, createVNode as u, unref as t, mergeProps as P, withCtx as d, withDirectives as F, createBlock as C, createElementVNode as _, createTextVNode as q, toDisplayString as D, renderSlot as T, computed as g, Fragment as N, createCommentVNode as M, nextTick as x } from "vue";
|
|
6
6
|
import "@formily/core";
|
|
7
7
|
import "@silver-formily/reactive-vue";
|
|
8
8
|
import { composeExport as j } from "../__builtins__/shared/utils.mjs";
|
|
@@ -41,16 +41,10 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
|
|
|
41
41
|
tooltipLayout: {}
|
|
42
42
|
},
|
|
43
43
|
setup(b) {
|
|
44
|
-
const a = b, e = E(),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} else
|
|
49
|
-
e.value.data = {}, e.value.data.readPretty = !0;
|
|
50
|
-
function v(r) {
|
|
51
|
-
const p = s.value.parentElement;
|
|
52
|
-
/* istanbul ignore else -- @preserve */
|
|
53
|
-
p.contains(r.target) || (l.value = !1);
|
|
44
|
+
const a = b, e = E(), r = `${L}-editable`, s = m(), l = m(!1);
|
|
45
|
+
$(e.value.data) ? $(e.value.data.readPretty) || (e.value.data.readPretty = !0) : (e.value.data = {}, e.value.data.readPretty = !0);
|
|
46
|
+
function v(o) {
|
|
47
|
+
s.value.parentElement.contains(o.target) || (l.value = !1);
|
|
54
48
|
}
|
|
55
49
|
function y() {
|
|
56
50
|
l.value = !0;
|
|
@@ -60,15 +54,15 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
|
|
|
60
54
|
type: "error",
|
|
61
55
|
address: `${e.value.address.entire}.*`
|
|
62
56
|
}),
|
|
63
|
-
(
|
|
64
|
-
|
|
57
|
+
(o) => {
|
|
58
|
+
o.length > 0 && (l.value = !0);
|
|
65
59
|
}
|
|
66
|
-
), (
|
|
67
|
-
class: i(
|
|
60
|
+
), (o, p) => (n(), f("div", {
|
|
61
|
+
class: i(r)
|
|
68
62
|
}, [
|
|
69
|
-
u(t(
|
|
63
|
+
u(t(W), P(o.$attrs, {
|
|
70
64
|
visible: l.value,
|
|
71
|
-
title:
|
|
65
|
+
title: o.$attrs.title || t(e).title,
|
|
72
66
|
trigger: "click",
|
|
73
67
|
width: "auto"
|
|
74
68
|
}), {
|
|
@@ -76,28 +70,28 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
|
|
|
76
70
|
_("div", {
|
|
77
71
|
ref_key: "contentRef",
|
|
78
72
|
ref: s,
|
|
79
|
-
class: i(`${
|
|
73
|
+
class: i(`${r}-popover-wrapper`)
|
|
80
74
|
}, [
|
|
81
|
-
T(
|
|
75
|
+
T(o.$slots, "default")
|
|
82
76
|
], 2)
|
|
83
77
|
]),
|
|
84
78
|
reference: d(() => [
|
|
85
79
|
F((n(), C(t(c), P(a, {
|
|
86
|
-
class: `${
|
|
80
|
+
class: `${r}-trigger`
|
|
87
81
|
}), {
|
|
88
82
|
default: d(() => [
|
|
89
83
|
_("div", {
|
|
90
|
-
class: i(`${
|
|
84
|
+
class: i(`${r}-content`),
|
|
91
85
|
onClick: y
|
|
92
86
|
}, [
|
|
93
87
|
u(t(S), null, {
|
|
94
88
|
default: d(() => [
|
|
95
|
-
q(
|
|
89
|
+
q(D(t(e).title), 1)
|
|
96
90
|
]),
|
|
97
91
|
_: 1
|
|
98
92
|
}),
|
|
99
93
|
u(t(I), {
|
|
100
|
-
class: i(`${
|
|
94
|
+
class: i(`${r}-edit-btn`)
|
|
101
95
|
}, null, 8, ["class"])
|
|
102
96
|
], 2)
|
|
103
97
|
]),
|
|
@@ -140,22 +134,22 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
|
|
|
140
134
|
editProps: {}
|
|
141
135
|
},
|
|
142
136
|
setup(b) {
|
|
143
|
-
const a = b, e = E(),
|
|
144
|
-
function
|
|
137
|
+
const a = b, e = E(), r = m(null), s = `${L}-editable`, l = m(null), v = g(() => k(a, "editProps")), y = g(() => H(a.editProps) ? { ...k(a, "editProps"), ...a.editProps } : k(a, "editProps"));
|
|
138
|
+
function o() {
|
|
145
139
|
$(e.value.data) || (e.value.data = {});
|
|
146
140
|
}
|
|
147
|
-
|
|
141
|
+
o(), e.value.data.readPretty = !0;
|
|
148
142
|
async function p() {
|
|
149
|
-
e.value.disabled || (
|
|
143
|
+
e.value.disabled || (o(), e.value.data.readPretty = !1, await x(), l.value.feedbackTooltipRef.updatePopper(), r.value?.querySelector("input")?.focus());
|
|
150
144
|
}
|
|
151
145
|
function B() {
|
|
152
|
-
e.value.data?.readPretty !== !0 && (
|
|
146
|
+
e.value.data?.readPretty !== !0 && (o(), setTimeout(async () => {
|
|
153
147
|
e.value.data.readPretty = !0, await x(), l.value?.feedbackTooltipRef.updatePopper();
|
|
154
148
|
}, 0));
|
|
155
149
|
}
|
|
156
|
-
return (
|
|
150
|
+
return (O, X) => (n(), f("div", {
|
|
157
151
|
ref_key: "innerRef",
|
|
158
|
-
ref:
|
|
152
|
+
ref: r,
|
|
159
153
|
class: i([s, t(e).disabled && "is-disabled"])
|
|
160
154
|
}, [
|
|
161
155
|
F((n(), f("div", {
|
|
@@ -167,12 +161,12 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
|
|
|
167
161
|
}, t(e).data?.readPretty === !1 ? y.value : v.value, { onClick: p }), {
|
|
168
162
|
default: d(() => [
|
|
169
163
|
_("div", null, [
|
|
170
|
-
T(
|
|
164
|
+
T(O.$slots, "default")
|
|
171
165
|
])
|
|
172
166
|
]),
|
|
173
167
|
_: 3
|
|
174
168
|
}, 16),
|
|
175
|
-
t(e).disabled ?
|
|
169
|
+
t(e).disabled ? M("", !0) : (n(), f(N, { key: 0 }, [
|
|
176
170
|
t(e).data?.readPretty === !0 ? (n(), C(t(c), {
|
|
177
171
|
key: 0,
|
|
178
172
|
size: a.size,
|