@silver-formily/element-plus 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/esm/__builtins__/index.mjs +20 -19
  2. package/esm/__builtins__/shared/index.mjs +11 -10
  3. package/esm/__builtins__/shared/transform-component.d.ts +1 -1
  4. package/esm/__builtins__/shared/utils.d.ts +1 -0
  5. package/esm/__builtins__/shared/utils.mjs +22 -18
  6. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  7. package/esm/array-base/index.mjs +27 -27
  8. package/esm/array-base/index.mjs.map +1 -1
  9. package/esm/array-base/symbols.mjs +1 -1
  10. package/esm/array-base/symbols.mjs.map +1 -1
  11. package/esm/array-base/utils.d.ts +0 -1
  12. package/esm/array-base/utils.mjs +27 -35
  13. package/esm/array-base/utils.mjs.map +1 -1
  14. package/esm/array-cards/index.mjs +1 -1
  15. package/esm/array-cards/index.mjs.map +1 -1
  16. package/esm/array-collapse/index.mjs +2 -5
  17. package/esm/array-collapse/index.mjs.map +1 -1
  18. package/esm/array-items/index.mjs +1 -1
  19. package/esm/array-list-tabs/index.mjs +9 -9
  20. package/esm/array-table/index.mjs +7 -9
  21. package/esm/array-table/index.mjs.map +1 -1
  22. package/esm/array-tabs/index.mjs +1 -2
  23. package/esm/array-tabs/index.mjs.map +1 -1
  24. package/esm/autocomplete/autocomplete.d.ts +16 -16
  25. package/esm/autocomplete/index.d.ts +8 -8
  26. package/esm/autocomplete/index.mjs +2 -2
  27. package/esm/autocomplete/index.mjs.map +1 -1
  28. package/esm/cascader/index.mjs +2 -2
  29. package/esm/checkbox/index.d.ts +27 -27
  30. package/esm/checkbox/index.mjs +7 -12
  31. package/esm/checkbox/index.mjs.map +1 -1
  32. package/esm/editable/editable.d.ts +14 -12
  33. package/esm/editable/index.d.ts +7 -6
  34. package/esm/editable/index.mjs +57 -61
  35. package/esm/editable/index.mjs.map +1 -1
  36. package/esm/env.d.d.ts +1 -0
  37. package/esm/form/form.mjs +5 -5
  38. package/esm/form-button-group/form-button-group.d.ts +9 -0
  39. package/esm/form-button-group/index.d.ts +15 -0
  40. package/esm/form-button-group/index.mjs +33 -25
  41. package/esm/form-button-group/index.mjs.map +1 -1
  42. package/esm/form-collapse/index.mjs +1 -1
  43. package/esm/form-collapse/utils.mjs +0 -2
  44. package/esm/form-collapse/utils.mjs.map +1 -1
  45. package/esm/form-dialog/index.mjs +63 -70
  46. package/esm/form-dialog/index.mjs.map +1 -1
  47. package/esm/form-drawer/index.mjs +62 -69
  48. package/esm/form-drawer/index.mjs.map +1 -1
  49. package/esm/form-grid/form-grid.d.ts +2 -2
  50. package/esm/form-grid/hooks.d.ts +1 -2
  51. package/esm/form-grid/hooks.mjs +4 -11
  52. package/esm/form-grid/hooks.mjs.map +1 -1
  53. package/esm/form-grid/index.mjs +38 -35
  54. package/esm/form-grid/index.mjs.map +1 -1
  55. package/esm/form-item/index.d.ts +1 -0
  56. package/esm/form-item/index.mjs +102 -107
  57. package/esm/form-item/index.mjs.map +1 -1
  58. package/esm/form-item/types.d.ts +12 -6
  59. package/esm/form-layout/form-layout.mjs +2 -2
  60. package/esm/form-layout/utils.mjs +24 -24
  61. package/esm/form-layout/utils.mjs.map +1 -1
  62. package/esm/form-step/index.mjs +2 -2
  63. package/esm/form-step/utils.mjs +0 -3
  64. package/esm/form-step/utils.mjs.map +1 -1
  65. package/esm/form-tab/hooks.d.ts +2 -1
  66. package/esm/form-tab/hooks.mjs +13 -20
  67. package/esm/form-tab/hooks.mjs.map +1 -1
  68. package/esm/form-tab/index.mjs +38 -39
  69. package/esm/form-tab/index.mjs.map +1 -1
  70. package/esm/index.d.ts +2 -0
  71. package/esm/index.mjs +62 -58
  72. package/esm/index.mjs.map +1 -1
  73. package/esm/input/index.mjs +2 -2
  74. package/esm/input-number/index.d.ts +15 -15
  75. package/esm/input-tag/index.mjs +2 -2
  76. package/esm/mention/index.mjs +2 -2
  77. package/esm/pagination/pagination.mjs +1 -1
  78. package/esm/pagination/pagination.mjs.map +1 -1
  79. package/esm/preview-text/index.mjs +33 -42
  80. package/esm/preview-text/index.mjs.map +1 -1
  81. package/esm/preview-text/utils.mjs +1 -1
  82. package/esm/preview-text/utils.mjs.map +1 -1
  83. package/esm/query-form/default-components.d.ts +5 -0
  84. package/esm/query-form/default-components.mjs +47 -0
  85. package/esm/query-form/default-components.mjs.map +1 -0
  86. package/esm/query-form/hooks.d.ts +25 -0
  87. package/esm/query-form/hooks.mjs +29 -0
  88. package/esm/query-form/hooks.mjs.map +1 -0
  89. package/esm/query-form/index.d.ts +117 -0
  90. package/esm/query-form/index.mjs +331 -0
  91. package/esm/query-form/index.mjs.map +1 -0
  92. package/esm/query-form/query-form-light.d.ts +27 -0
  93. package/esm/query-form/query-form.d.ts +52 -0
  94. package/esm/query-form/types.d.ts +44 -0
  95. package/esm/query-form/types.mjs +2 -0
  96. package/esm/query-form/types.mjs.map +1 -0
  97. package/esm/query-form-item/index.d.ts +151 -0
  98. package/esm/query-form-item/index.mjs +181 -0
  99. package/esm/query-form-item/index.mjs.map +1 -0
  100. package/esm/query-form-item/query-form-item.d.ts +96 -0
  101. package/esm/query-form-item/types.d.ts +46 -0
  102. package/esm/query-form-item/types.mjs +2 -0
  103. package/esm/query-form-item/types.mjs.map +1 -0
  104. package/esm/radio/index.d.ts +18 -18
  105. package/esm/radio/index.mjs +7 -12
  106. package/esm/radio/index.mjs.map +1 -1
  107. package/esm/reset/index.mjs +2 -2
  108. package/esm/segmented/index.mjs +2 -2
  109. package/esm/select/index.d.ts +16 -16
  110. package/esm/select/index.mjs +1 -1
  111. package/esm/select-table/index.d.ts +6 -6
  112. package/esm/select-table/index.mjs +22 -24
  113. package/esm/select-table/index.mjs.map +1 -1
  114. package/esm/select-table/select-table.d.ts +2 -2
  115. package/esm/shared/overlay-elements.mjs +14 -11
  116. package/esm/shared/overlay-elements.mjs.map +1 -1
  117. package/esm/styles/form-button-group/index.css +1 -1
  118. package/esm/styles/form-grid/index.css +1 -1
  119. package/esm/styles/form-item/index.css +1 -1
  120. package/esm/styles/query-form/index.css +1 -0
  121. package/esm/styles/query-form-item/index.css +1 -0
  122. package/esm/submit/index.mjs +3 -3
  123. package/esm/submit/index.mjs.map +1 -1
  124. package/esm/switch/index.d.ts +9 -9
  125. package/esm/time-select/index.d.ts +12 -12
  126. package/esm/transfer/index.d.ts +12 -12
  127. package/esm/tree/index.mjs +3 -3
  128. package/esm/tree/utils.mjs +0 -2
  129. package/esm/tree/utils.mjs.map +1 -1
  130. package/esm/tree-select/index.mjs +2 -2
  131. package/esm/upload/index.d.ts +12 -12
  132. package/esm/upload/index.mjs +3 -3
  133. package/esm/upload/upload.d.ts +24 -24
  134. package/esm/vendor/icon.mjs.map +1 -1
  135. package/esm/vendor/lodash.mjs +777 -663
  136. package/esm/vendor/lodash.mjs.map +1 -1
  137. package/esm/vendor/runtime.mjs +23 -29
  138. package/esm/vendor/runtime.mjs.map +1 -1
  139. package/esm/vendor/shared.esm-bundler.mjs +2 -7
  140. package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
  141. package/esm/vendor/sizes.mjs.map +1 -1
  142. package/esm/vendor/types.mjs +5 -5
  143. package/esm/vendor/types.mjs.map +1 -1
  144. package/package.json +89 -115
  145. package/LICENSE +0 -21
@@ -0,0 +1,181 @@
1
+ import { useField as j, connect as w, mapProps as D } from "@silver-formily/vue";
2
+ import { FormBaseItem as V, fieldFeedbackMapper as N } from "../form-item/index.mjs";
3
+ import { defineComponent as E, computed as y, ref as c, onMounted as U, watch as L, openBlock as P, createBlock as S, unref as u, mergeProps as C, withCtx as G, createElementVNode as h, normalizeClass as b, resolveDynamicComponent as H, normalizeProps as J, guardReactiveProps as K, renderSlot as T, createCommentVNode as W } from "vue";
4
+ import { createForm as X } from "@formily/core";
5
+ import { isNum as Y } from "@formily/shared";
6
+ import { ElPagination as Z } from "element-plus";
7
+ import { QueryForm as R } from "../query-form/index.mjs";
8
+ import { useQueryFormForm as ee } from "../query-form/hooks.mjs";
9
+ import { useCleanAttrs as te } from "../__builtins__/shared/utils.mjs";
10
+ import { stylePrefix as k } from "../__builtins__/configs/index.mjs";
11
+ import '../styles/query-form-item/index.css';const ae = /* @__PURE__ */ E({
12
+ name: "FQueryFormItem",
13
+ inheritAttrs: !1,
14
+ __name: "query-form-item",
15
+ props: {
16
+ mode: {
17
+ type: String,
18
+ default: "default"
19
+ },
20
+ request: Function,
21
+ clearOnDataChange: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ querySchema: Object,
26
+ queryFormProps: {
27
+ type: Object,
28
+ default: () => ({})
29
+ },
30
+ pagination: {
31
+ type: Boolean,
32
+ default: !0
33
+ },
34
+ paginationProps: {
35
+ type: Object,
36
+ default: () => ({})
37
+ },
38
+ paginationMap: {
39
+ type: Object,
40
+ default: () => ({})
41
+ },
42
+ immediate: {
43
+ type: Boolean,
44
+ default: !0
45
+ }
46
+ },
47
+ emits: ["requestSuccess", "requestFailed"],
48
+ setup(B, { emit: I }) {
49
+ const e = B, p = I, m = {
50
+ currentPage: 1,
51
+ pageSize: 10,
52
+ pageSizes: [10, 20, 50, 100],
53
+ layout: "total, prev, pager, next",
54
+ size: "small"
55
+ }, q = {
56
+ current: "current",
57
+ pageSize: "pageSize"
58
+ }, Q = j(), _ = X(), f = `${k}-query-form-item`, x = `${k}-form-item--isolated`, { props: O } = te(), M = y(() => {
59
+ const {
60
+ currentPage: t,
61
+ pageSize: r,
62
+ ...a
63
+ } = {
64
+ ...m,
65
+ ...e.paginationProps
66
+ };
67
+ return a;
68
+ }), n = c(e.paginationProps?.currentPage ?? m.currentPage), s = c(e.paginationProps?.pageSize ?? m.pageSize), d = c(0), l = c(0), { activeForm: F } = ee({
69
+ formProps: y(() => e.queryFormProps),
70
+ fallbackForm: _
71
+ }), $ = y(() => ({
72
+ ...e.queryFormProps,
73
+ schema: e.querySchema ?? e.queryFormProps.schema,
74
+ form: F.value,
75
+ onAutoSubmit: z,
76
+ resetProps: {
77
+ onClick: A
78
+ }
79
+ }));
80
+ async function g() {
81
+ if (!e.request)
82
+ return;
83
+ const t = Q.value;
84
+ Array.isArray(t.dataSource) || (t.dataSource = []);
85
+ const r = ++l.value, a = F.value?.values ?? {}, i = e.pagination ? {
86
+ current: n.value,
87
+ pageSize: s.value
88
+ } : void 0, v = i ? {
89
+ ...a,
90
+ [e.paginationMap.current ?? q.current]: i.current,
91
+ [e.paginationMap.pageSize ?? q.pageSize]: i.pageSize
92
+ } : a;
93
+ t.loading = !0;
94
+ try {
95
+ const o = await e.request(v);
96
+ if (r !== l.value)
97
+ return;
98
+ if (o.success !== !0) {
99
+ p("requestFailed", o);
100
+ return;
101
+ }
102
+ t.dataSource = o.data, e.clearOnDataChange && t.setValue?.(void 0), d.value = Y(o.total) ? o.total : o.data.length, p("requestSuccess", {
103
+ values: a,
104
+ pagination: i,
105
+ dataSource: o.data,
106
+ total: d.value,
107
+ result: o
108
+ });
109
+ } catch (o) {
110
+ if (r !== l.value)
111
+ return;
112
+ p("requestFailed", o);
113
+ } finally {
114
+ r === l.value && (t.loading = !1);
115
+ }
116
+ }
117
+ async function z() {
118
+ if (e.pagination && n.value !== 1) {
119
+ n.value = 1;
120
+ return;
121
+ }
122
+ await g();
123
+ }
124
+ function A(t) {
125
+ const r = e.queryFormProps.resetProps?.onClick, a = r?.(t);
126
+ return a === !1 ? !1 : (z(), a);
127
+ }
128
+ return U(() => {
129
+ e.immediate && g();
130
+ }), L([n, s], ([t, r], [a, i]) => {
131
+ if (!e.pagination)
132
+ return;
133
+ const v = t !== a, o = r !== i;
134
+ if (!(!v && !o)) {
135
+ if (o && t !== 1) {
136
+ n.value = 1;
137
+ return;
138
+ }
139
+ g();
140
+ }
141
+ }), (t, r) => (P(), S(u(V), C(u(O), { "internal-form-item-class": x }), {
142
+ default: G(() => [
143
+ h("div", {
144
+ class: b(f)
145
+ }, [
146
+ (P(), S(H(e.mode === "light" ? u(R).Light : u(R)), J(K($.value)), null, 16)),
147
+ h("div", {
148
+ class: b(`${f}__content`)
149
+ }, [
150
+ T(t.$slots, "default")
151
+ ], 2),
152
+ e.pagination ? (P(), S(u(Z), C({
153
+ key: 0,
154
+ "current-page": n.value,
155
+ "onUpdate:currentPage": r[0] || (r[0] = (a) => n.value = a),
156
+ "page-size": s.value,
157
+ "onUpdate:pageSize": r[1] || (r[1] = (a) => s.value = a),
158
+ class: `${f}__pagination`
159
+ }, M.value, { total: d.value }), null, 16, ["current-page", "page-size", "class", "total"])) : W("", !0)
160
+ ])
161
+ ]),
162
+ _: 3
163
+ }, 16));
164
+ }
165
+ }), fe = w(
166
+ ae,
167
+ D(
168
+ {
169
+ validateStatus: !0,
170
+ title: "label",
171
+ required: !0,
172
+ description: "extra"
173
+ },
174
+ N
175
+ )
176
+ );
177
+ export {
178
+ fe as QueryFormItem,
179
+ fe as default
180
+ };
181
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/query-form-item/query-form-item.vue","../../src/query-form-item/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { Field } from '@formily/core'\r\nimport type { ISchema } from '@formily/json-schema'\r\nimport type { PropType } from 'vue'\r\nimport type {\r\n QueryFormItemMode,\r\n QueryFormItemPaginationMap,\r\n QueryFormItemPaginationProps,\r\n QueryFormItemQueryProps,\r\n QueryFormItemRequest,\r\n QueryFormItemRequestSuccessPayload,\r\n} from './types'\r\nimport { createForm } from '@formily/core'\r\nimport { isNum } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElPagination } from 'element-plus'\r\nimport { computed, onMounted, ref, watch } from 'vue'\r\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\r\nimport { FormBaseItem } from '../form-item'\r\nimport { QueryForm } from '../query-form'\r\nimport { useQueryFormForm } from '../query-form/hooks'\r\n\r\ndefineOptions({\r\n name: 'FQueryFormItem',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\r\n mode: {\r\n type: String as PropType<QueryFormItemMode>,\r\n default: 'default',\r\n },\r\n request: Function as PropType<QueryFormItemRequest>,\r\n clearOnDataChange: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n querySchema: Object as PropType<ISchema>,\r\n queryFormProps: {\r\n type: Object as PropType<QueryFormItemQueryProps>,\r\n default: () => ({}),\r\n },\r\n pagination: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n paginationProps: {\r\n type: Object as PropType<QueryFormItemPaginationProps>,\r\n default: () => ({}),\r\n },\r\n paginationMap: {\r\n type: Object as PropType<QueryFormItemPaginationMap>,\r\n default: () => ({}),\r\n },\r\n immediate: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n})\r\n\r\nconst emit = defineEmits<{\r\n (e: 'requestSuccess', payload: QueryFormItemRequestSuccessPayload): void\r\n (e: 'requestFailed', error: any): void\r\n}>()\r\n\r\nconst defaultPaginationProps: QueryFormItemPaginationProps = {\r\n currentPage: 1,\r\n pageSize: 10,\r\n pageSizes: [10, 20, 50, 100],\r\n layout: 'total, prev, pager, next',\r\n size: 'small',\r\n}\r\nconst defaultPaginationRequestMapping: Required<QueryFormItemPaginationMap> = {\r\n current: 'current',\r\n pageSize: 'pageSize',\r\n}\r\n\r\nconst fieldRef = useField<Field>()\r\nconst internalQueryForm = createForm()\r\nconst prefixCls = `${stylePrefix}-query-form-item`\r\nconst formItemInternalClass = `${stylePrefix}-form-item--isolated`\r\nconst { props: formItemProps } = useCleanAttrs()\r\n\r\nconst paginationBindings = computed(() => {\r\n const {\r\n currentPage,\r\n pageSize,\r\n ...bindings\r\n } = {\r\n ...defaultPaginationProps,\r\n ...props.paginationProps,\r\n }\r\n return bindings\r\n})\r\n\r\nconst currentPageRef = ref(props.paginationProps?.currentPage ?? defaultPaginationProps.currentPage)\r\nconst pageSizeRef = ref(props.paginationProps?.pageSize ?? defaultPaginationProps.pageSize)\r\nconst totalRef = ref(0)\r\nconst currentRequestId = ref(0)\r\n\r\nconst { activeForm: activeQueryForm } = useQueryFormForm({\r\n formProps: computed(() => props.queryFormProps),\r\n fallbackForm: internalQueryForm,\r\n})\r\n\r\nconst queryFormBindings = computed(() => {\r\n return ({\r\n ...props.queryFormProps,\r\n schema: props.querySchema ?? props.queryFormProps.schema,\r\n form: activeQueryForm.value,\r\n onAutoSubmit: handleQuerySubmit,\r\n resetProps: {\r\n onClick: handleQueryReset,\r\n },\r\n })\r\n})\r\n\r\nasync function executeRequest() {\r\n if (!props.request)\r\n return\r\n\r\n const field = fieldRef.value\r\n if (!Array.isArray(field.dataSource))\r\n field.dataSource = []\r\n\r\n const requestId = ++currentRequestId.value\r\n /* istanbul ignore next -- @preserve defensive: active query form can be temporarily undefined before form injection settles */\r\n const queryValues = activeQueryForm.value?.values ?? {}\r\n const paginationData = props.pagination\r\n ? {\r\n current: currentPageRef.value,\r\n pageSize: pageSizeRef.value,\r\n }\r\n : undefined\r\n const requestParams = paginationData\r\n ? {\r\n ...queryValues,\r\n [(props.paginationMap.current ?? defaultPaginationRequestMapping.current)]: paginationData.current,\r\n [(props.paginationMap.pageSize ?? defaultPaginationRequestMapping.pageSize)]: paginationData.pageSize,\r\n }\r\n : queryValues\r\n\r\n field.loading = true\r\n try {\r\n const result = await props.request(requestParams)\r\n\r\n if (requestId !== currentRequestId.value)\r\n return\r\n\r\n if (result.success !== true) {\r\n emit('requestFailed', result)\r\n return\r\n }\r\n\r\n field.dataSource = result.data\r\n if (props.clearOnDataChange) {\r\n field.setValue?.(undefined)\r\n }\r\n totalRef.value = isNum(result.total) ? result.total : result.data.length\r\n\r\n emit('requestSuccess', {\r\n values: queryValues,\r\n pagination: paginationData,\r\n dataSource: result.data,\r\n total: totalRef.value,\r\n result,\r\n })\r\n }\r\n catch (error) {\r\n if (requestId !== currentRequestId.value)\r\n return\r\n emit('requestFailed', error)\r\n }\r\n finally {\r\n if (requestId === currentRequestId.value)\r\n field.loading = false\r\n }\r\n}\r\n\r\nasync function handleQuerySubmit() {\r\n if (props.pagination && currentPageRef.value !== 1) {\r\n currentPageRef.value = 1\r\n return\r\n }\r\n\r\n await executeRequest()\r\n}\r\n\r\nfunction handleQueryReset(event: MouseEvent) {\r\n const userOnClick = props.queryFormProps.resetProps?.onClick as ((event: MouseEvent) => void | boolean) | undefined\r\n const result = userOnClick?.(event)\r\n if (result === false)\r\n return false\r\n\r\n void handleQuerySubmit()\r\n\r\n return result\r\n}\r\n\r\nonMounted(() => {\r\n if (props.immediate)\r\n void executeRequest()\r\n})\r\n\r\nwatch([currentPageRef, pageSizeRef], ([currentPage, pageSize], [previousPage, previousPageSize]) => {\r\n /* istanbul ignore if -- @preserve defensive: watcher is retained when pagination is dynamically toggled off */\r\n if (!props.pagination)\r\n return\r\n\r\n const currentChanged = currentPage !== previousPage\r\n const pageSizeChanged = pageSize !== previousPageSize\r\n\r\n /* istanbul ignore if -- @preserve defensive: keep guard for unexpected duplicated watcher payload */\r\n if (!currentChanged && !pageSizeChanged)\r\n return\r\n\r\n if (pageSizeChanged && currentPage !== 1) {\r\n currentPageRef.value = 1\r\n return\r\n }\r\n\r\n void executeRequest()\r\n})\r\n</script>\r\n\r\n<template>\r\n <FormBaseItem\r\n v-bind=\"formItemProps\"\r\n :internal-form-item-class=\"formItemInternalClass\"\r\n >\r\n <div :class=\"prefixCls\">\r\n <component\r\n :is=\"props.mode === 'light' ? QueryForm.Light : QueryForm\"\r\n v-bind=\"queryFormBindings\"\r\n />\r\n <div :class=\"`${prefixCls}__content`\">\r\n <slot />\r\n </div>\r\n <ElPagination\r\n v-if=\"props.pagination\"\r\n v-model:current-page=\"currentPageRef\"\r\n v-model:page-size=\"pageSizeRef\"\r\n :class=\"`${prefixCls}__pagination`\"\r\n v-bind=\"paginationBindings\"\r\n :total=\"totalRef\"\r\n />\r\n </div>\r\n </FormBaseItem>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { fieldFeedbackMapper } from '../form-item'\r\nimport QueryFormItemInner from './query-form-item.vue'\r\nimport './style.scss'\r\n\r\nexport type {\r\n IQueryFormItemProps,\r\n QueryFormItemMode,\r\n QueryFormItemPagination,\r\n QueryFormItemPaginationMap,\r\n QueryFormItemPaginationProps,\r\n QueryFormItemQueryProps,\r\n QueryFormItemRequest,\r\n QueryFormItemRequestResultObject,\r\n QueryFormItemRequestSuccessPayload,\r\n} from './types'\r\n\r\nexport const QueryFormItem = connect<typeof QueryFormItemInner>(\r\n QueryFormItemInner,\r\n mapProps(\r\n {\r\n validateStatus: true,\r\n title: 'label',\r\n required: true,\r\n description: 'extra',\r\n },\r\n fieldFeedbackMapper,\r\n ),\r\n)\r\n\r\nexport default QueryFormItem\r\n"],"names":["props","__props","emit","__emit","defaultPaginationProps","defaultPaginationRequestMapping","fieldRef","useField","internalQueryForm","createForm","prefixCls","stylePrefix","formItemInternalClass","formItemProps","useCleanAttrs","paginationBindings","computed","currentPage","pageSize","bindings","currentPageRef","ref","pageSizeRef","totalRef","currentRequestId","activeQueryForm","useQueryFormForm","queryFormBindings","handleQuerySubmit","handleQueryReset","executeRequest","field","requestId","queryValues","paginationData","requestParams","result","isNum","error","event","userOnClick","onMounted","watch","previousPage","previousPageSize","currentChanged","pageSizeChanged","_openBlock","_createBlock","_unref","_mergeProps","_createElementVNode","_resolveDynamicComponent","QueryForm","_normalizeProps","_guardReactiveProps","_renderSlot","_ctx","$event","QueryFormItem","connect","QueryFormItemInner","mapProps","fieldFeedbackMapper"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,UAAMA,IAAQC,GAiCRC,IAAOC,GAKPC,IAAuD;AAAA,MAC3D,aAAa;AAAA,MACb,UAAU;AAAA,MACV,WAAW,CAAC,IAAI,IAAI,IAAI,GAAG;AAAA,MAC3B,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA,GAEFC,IAAwE;AAAA,MAC5E,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,GAGNC,IAAWC,EAAA,GACXC,IAAoBC,EAAA,GACpBC,IAAY,GA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schema';
2
+ import { PropType } from 'vue';
3
+ import { QueryFormItemMode, QueryFormItemPaginationMap, QueryFormItemPaginationProps, QueryFormItemQueryProps, QueryFormItemRequest, QueryFormItemRequestSuccessPayload } from './types';
4
+ declare function __VLS_template(): {
5
+ attrs: Partial<{}>;
6
+ slots: {
7
+ default?(_: {}): any;
8
+ };
9
+ refs: {};
10
+ rootEl: any;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
14
+ mode: {
15
+ type: PropType<QueryFormItemMode>;
16
+ default: string;
17
+ };
18
+ request: PropType<QueryFormItemRequest>;
19
+ clearOnDataChange: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ querySchema: PropType<ISchema>;
24
+ queryFormProps: {
25
+ type: PropType<QueryFormItemQueryProps>;
26
+ default: () => {};
27
+ };
28
+ pagination: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ paginationProps: {
33
+ type: PropType<QueryFormItemPaginationProps>;
34
+ default: () => {};
35
+ };
36
+ paginationMap: {
37
+ type: PropType<QueryFormItemPaginationMap>;
38
+ default: () => {};
39
+ };
40
+ immediate: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
45
+ requestSuccess: (payload: QueryFormItemRequestSuccessPayload) => any;
46
+ requestFailed: (error: any) => any;
47
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
48
+ mode: {
49
+ type: PropType<QueryFormItemMode>;
50
+ default: string;
51
+ };
52
+ request: PropType<QueryFormItemRequest>;
53
+ clearOnDataChange: {
54
+ type: BooleanConstructor;
55
+ default: boolean;
56
+ };
57
+ querySchema: PropType<ISchema>;
58
+ queryFormProps: {
59
+ type: PropType<QueryFormItemQueryProps>;
60
+ default: () => {};
61
+ };
62
+ pagination: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ paginationProps: {
67
+ type: PropType<QueryFormItemPaginationProps>;
68
+ default: () => {};
69
+ };
70
+ paginationMap: {
71
+ type: PropType<QueryFormItemPaginationMap>;
72
+ default: () => {};
73
+ };
74
+ immediate: {
75
+ type: BooleanConstructor;
76
+ default: boolean;
77
+ };
78
+ }>> & Readonly<{
79
+ onRequestSuccess?: (payload: QueryFormItemRequestSuccessPayload) => any;
80
+ onRequestFailed?: (error: any) => any;
81
+ }>, {
82
+ mode: QueryFormItemMode;
83
+ immediate: boolean;
84
+ pagination: boolean;
85
+ paginationProps: Partial<import('element-plus').PaginationProps>;
86
+ clearOnDataChange: boolean;
87
+ queryFormProps: QueryFormItemQueryProps;
88
+ paginationMap: QueryFormItemPaginationMap;
89
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
90
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
91
+ export default _default;
92
+ type __VLS_WithTemplateSlots<T, S> = T & {
93
+ new (): {
94
+ $slots: S;
95
+ };
96
+ };
@@ -0,0 +1,46 @@
1
+ import { Form } from '@formily/core';
2
+ import { ISchema } from '@formily/json-schema';
3
+ import { PaginationProps } from 'element-plus';
4
+ import { IFormItemProps } from '../form-item';
5
+ import { IQueryFormLightProps, IQueryFormProps } from '../query-form';
6
+ export type QueryFormItemMode = 'default' | 'light';
7
+ export interface QueryFormItemPagination {
8
+ current: number;
9
+ pageSize: number;
10
+ }
11
+ export interface QueryFormItemPaginationMap {
12
+ current?: string;
13
+ pageSize?: string;
14
+ }
15
+ export interface QueryFormItemRequestResultObject {
16
+ data: any[];
17
+ success: boolean;
18
+ total?: number;
19
+ }
20
+ export type QueryFormItemRequest = (params: Record<string, any> & Partial<QueryFormItemPagination>) => Promise<QueryFormItemRequestResultObject>;
21
+ export type QueryFormItemPaginationProps = Partial<PaginationProps>;
22
+ type QueryFormDefaultProps = Omit<IQueryFormProps, 'schema'>;
23
+ type QueryFormLightProps = Omit<IQueryFormLightProps, 'schema'>;
24
+ export type QueryFormItemQueryProps = Partial<QueryFormDefaultProps & QueryFormLightProps> & {
25
+ form?: Form | (() => Form | undefined);
26
+ schema?: ISchema;
27
+ };
28
+ export interface IQueryFormItemProps extends IFormItemProps {
29
+ mode?: QueryFormItemMode;
30
+ request?: QueryFormItemRequest;
31
+ clearOnDataChange?: boolean;
32
+ querySchema?: ISchema;
33
+ queryFormProps?: QueryFormItemQueryProps;
34
+ pagination?: boolean;
35
+ paginationProps?: QueryFormItemPaginationProps;
36
+ paginationMap?: QueryFormItemPaginationMap;
37
+ immediate?: boolean;
38
+ }
39
+ export interface QueryFormItemRequestSuccessPayload {
40
+ values: Record<string, any>;
41
+ pagination?: QueryFormItemPagination;
42
+ dataSource: any[];
43
+ total?: number;
44
+ result: QueryFormItemRequestResultObject;
45
+ }
46
+ export {};
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -255,17 +255,17 @@ export declare const Radio: {
255
255
  type: import('vue').PropType<string>;
256
256
  default: undefined;
257
257
  };
258
- fill: {
259
- type: import('vue').PropType<string>;
260
- default: "";
258
+ props: {
259
+ type: import('vue').PropType<import('element-plus').radioOptionProp>;
260
+ default: () => Required<import('element-plus').radioOptionProp>;
261
261
  };
262
262
  disabled: {
263
263
  type: import('vue').PropType<boolean>;
264
264
  default: undefined;
265
265
  };
266
- props: {
267
- type: import('vue').PropType<import('element-plus').radioOptionProp>;
268
- default: () => Required<import('element-plus').radioOptionProp>;
266
+ fill: {
267
+ type: import('vue').PropType<string>;
268
+ default: "";
269
269
  };
270
270
  id: {
271
271
  type: import('vue').PropType<string>;
@@ -324,17 +324,17 @@ export declare const Radio: {
324
324
  type: import('vue').PropType<string>;
325
325
  default: undefined;
326
326
  };
327
- fill: {
328
- type: import('vue').PropType<string>;
329
- default: "";
327
+ props: {
328
+ type: import('vue').PropType<import('element-plus').radioOptionProp>;
329
+ default: () => Required<import('element-plus').radioOptionProp>;
330
330
  };
331
331
  disabled: {
332
332
  type: import('vue').PropType<boolean>;
333
333
  default: undefined;
334
334
  };
335
- props: {
336
- type: import('vue').PropType<import('element-plus').radioOptionProp>;
337
- default: () => Required<import('element-plus').radioOptionProp>;
335
+ fill: {
336
+ type: import('vue').PropType<string>;
337
+ default: "";
338
338
  };
339
339
  id: {
340
340
  type: import('vue').PropType<string>;
@@ -387,17 +387,17 @@ export declare const Radio: {
387
387
  type: import('vue').PropType<string>;
388
388
  default: undefined;
389
389
  };
390
- fill: {
391
- type: import('vue').PropType<string>;
392
- default: "";
390
+ props: {
391
+ type: import('vue').PropType<import('element-plus').radioOptionProp>;
392
+ default: () => Required<import('element-plus').radioOptionProp>;
393
393
  };
394
394
  disabled: {
395
395
  type: import('vue').PropType<boolean>;
396
396
  default: undefined;
397
397
  };
398
- props: {
399
- type: import('vue').PropType<import('element-plus').radioOptionProp>;
400
- default: () => Required<import('element-plus').radioOptionProp>;
398
+ fill: {
399
+ type: import('vue').PropType<string>;
400
+ default: "";
401
401
  };
402
402
  id: {
403
403
  type: import('vue').PropType<string>;
@@ -1,7 +1,7 @@
1
1
  import { connect as E, mapProps as T } from "@silver-formily/vue";
2
2
  import { ElRadioButton as B, ElRadio as v, ElRadioGroup as C, version as G } from "element-plus";
3
3
  import { PreviewText as O } from "../preview-text/index.mjs";
4
- import { defineComponent as x, computed as c, useSlots as A, createBlock as p, openBlock as t, unref as u, normalizeProps as L, guardReactiveProps as h, withCtx as s, createElementBlock as f, Fragment as d, renderList as _, resolveDynamicComponent as y, mergeProps as b, createTextVNode as j, toDisplayString as w, renderSlot as D } from "vue";
4
+ import { defineComponent as x, computed as c, useSlots as A, openBlock as t, createBlock as p, unref as u, normalizeProps as L, guardReactiveProps as h, withCtx as s, createElementBlock as f, Fragment as d, renderList as _, resolveDynamicComponent as y, mergeProps as b, createTextVNode as j, toDisplayString as w, renderSlot as D } from "vue";
5
5
  import { isPlainObj as F } from "@formily/shared";
6
6
  import { useCleanAttrs as N, composeExport as z } from "../__builtins__/shared/utils.mjs";
7
7
  import { lt as H } from "../__builtins__/shared/simple-version-compare.mjs";
@@ -27,17 +27,12 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ x({
27
27
  function g(e, n) {
28
28
  return i(o.options[n]) ? o.options[n].label : e.label;
29
29
  }
30
- const m = c(() => o.options.map((e) => {
31
- if (!i(e))
32
- return {
33
- label: e,
34
- value: e
35
- };
36
- /* istanbul ignore if -- @preserve */
37
- return S ? {
38
- ...e,
39
- label: e.value
40
- } : e;
30
+ const m = c(() => o.options.map((e) => i(e) ? S ? {
31
+ ...e,
32
+ label: e.value
33
+ } : e : {
34
+ label: e,
35
+ value: e
41
36
  })), k = A();
42
37
  return (e, n) => (t(), p(u(C), L(h(u(R))), {
43
38
  default: s(() => [
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/radio/radio-group.vue","../../src/radio/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { RadioProps } from 'element-plus'\r\nimport type { PropType } from 'vue'\r\nimport { isPlainObj } from '@formily/shared'\r\nimport { ElRadio, ElRadioButton, ElRadioGroup, version } from 'element-plus'\r\nimport { computed, useSlots } from 'vue'\r\nimport { lt, useCleanAttrs } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FRadioGroup',\r\n})\r\n\r\nconst props = defineProps({\r\n options: {\r\n type: Array as PropType<Array<RadioProps | string | number>>,\r\n default: () => [],\r\n },\r\n optionType: {\r\n type: String as PropType<'default' | 'button'>,\r\n default: 'default',\r\n },\r\n})\r\n\r\nconst { props: radioProps } = useCleanAttrs()\r\n\r\nconst OptionType = computed(() => {\r\n return props.optionType === 'button' ? ElRadioButton : ElRadio\r\n})\r\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\r\n\r\nfunction isRadioPropsObject(option: any): option is RadioProps {\r\n return isPlainObj(option)\r\n}\r\n\r\nfunction getOptionLabel(option: any, index: number) {\r\n if (isRadioPropsObject(props.options[index])) {\r\n return props.options[index].label\r\n }\r\n return option.label\r\n}\r\n\r\nconst compatiableProps = computed(() => {\r\n return props.options.map((option) => {\r\n if (!isRadioPropsObject(option)) {\r\n return {\r\n label: option,\r\n value: option,\r\n }\r\n }\r\n /* istanbul ignore if -- @preserve */\r\n if (IS_LESS_THAN_2_6_0) {\r\n return {\r\n ...option,\r\n label: option.value,\r\n }\r\n }\r\n return option\r\n })\r\n})\r\n\r\nconst slots = useSlots()\r\n</script>\r\n\r\n<template>\r\n <ElRadioGroup v-bind=\"radioProps\">\r\n <template v-if=\"!slots.option\">\r\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\r\n {{ getOptionLabel(option, index) }}\r\n </component>\r\n </template>\r\n <template v-else>\r\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\r\n <slot name=\"option\" :option=\"option\" />\r\n </component>\r\n </template>\r\n </ElRadioGroup>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElRadio } from 'element-plus'\r\nimport { composeExport, mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FRadioGroup from './radio-group.vue'\r\nimport './style.scss'\r\n\r\nconst RadioGroup = connect<typeof FRadioGroup>(\r\n FRadioGroup,\r\n mapProps({ dataSource: 'options', disabled: true }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\nexport const Radio = composeExport(ElRadio, {\r\n Group: RadioGroup,\r\n})\r\n\r\nexport default Radio\r\n"],"names":["props","__props","radioProps","useCleanAttrs","OptionType","computed","ElRadioButton","ElRadio","IS_LESS_THAN_2_6_0","lt","version","isRadioPropsObject","option","isPlainObj","getOptionLabel","index","compatiableProps","slots","useSlots","_openBlock","_createBlock","_unref","_createElementBlock","_Fragment","_renderList","_resolveDynamicComponent","_mergeProps","_renderSlot","_ctx","RadioGroup","connect","FRadioGroup","mapProps","mapReadPretty","PreviewText","Radio","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,UAAMA,IAAQC,GAWR,EAAE,OAAOC,EAAA,IAAeC,EAAA,GAExBC,IAAaC,EAAS,MACnBL,EAAM,eAAe,WAAWM,IAAgBC,CACxD,GACKC,IAAqBC,EAAGC,GAAS,OAAO;AAE9C,aAASC,EAAmBC,GAAmC;AAC7D,aAAOC,EAAWD,CAAM;AAAA,IAC1B;AAEA,aAASE,EAAeF,GAAaG,GAAe;AAClD,aAAIJ,EAAmBX,EAAM,QAAQe,CAAK,CAAC,IAClCf,EAAM,QAAQe,CAAK,EAAE,QAEvBH,EAAO;AAAA,IAChB;AAEA,UAAMI,IAAmBX,EAAS,MACzBL,EAAM,QAAQ,IAAI,CAACY,MAAW;AACnC,UAAI,CAACD,EAAmBC,CAAM;AAC5B,eAAO;AAAA,UACL,OAAOA;AAAA,UACP,OAAOA;AAAA,QAAA;AAAA,MAEX;AAEA,aAAIJ,IACK;AAAA,QACL,GAAGI;AAAA,QACH,OAAOA,EAAO;AAAA,MAAA,IAGXA;AAAA,IACT,CAAC,CACF,GAEKK,IAAQC,EAAA;sBAIZC,EAAA,GAAAC,EAWeC,UAXOA,EAAAnB,CAAA,CAAU,CAAA,GAAA;AAAA,iBAC9B,MAIW;AAAA,QAJMmB,EAAAJ,CAAA,EAAM,UAMrBE,EAAA,EAAA,GAAAG,EAEYC,GAAA,EAAA,KAAA,KAAAC,EAF0CR,EAAA,OAAgB,CAAlCJ,GAAQG,YAA5CK,EAEYK,EAFIrB,OAAU,GAA1BsB,EAEY,EAF6D,KAAKX,KAAK,EAAA,SAAA,GAAA,GAAUH,CAAM,GAAA;AAAA,qBACjG,MAAuC;AAAA,YAAvCe,EAAuCC,EAAA,QAAA,UAAA,EAAlB,QAAAhB,GAAc;AAAA,UAAA;;6BANrCO,EAAA,EAAA,GAAAG,EAEYC,GAAA,EAAA,KAAA,KAAAC,EAF0CR,EAAA,OAAgB,CAAlCJ,GAAQG,YAA5CK,EAEYK,EAFIrB,OAAU,GAA1BsB,EAEY,EAF6D,KAAKX,KAAK,EAAA,SAAA,GAAA,GAAUH,CAAM,GAAA;AAAA,qBACjG,MAAmC;AAAA,gBAAhCE,EAAeF,GAAQG,CAAK,CAAA,GAAA,CAAA;AAAA,UAAA;;;;;;;IC5DjCc,IAAaC;AAAA,EACjBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,UAAU,IAAM;AAAA,EAClDC,EAAcC,EAAY,MAAM;AAClC,GACaC,IAAQC,EAAc7B,GAAS;AAAA,EAC1C,OAAOsB;AACT,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/radio/radio-group.vue","../../src/radio/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { RadioProps } from 'element-plus'\r\nimport type { PropType } from 'vue'\r\nimport { isPlainObj } from '@formily/shared'\r\nimport { ElRadio, ElRadioButton, ElRadioGroup, version } from 'element-plus'\r\nimport { computed, useSlots } from 'vue'\r\nimport { lt, useCleanAttrs } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FRadioGroup',\r\n})\r\n\r\nconst props = defineProps({\r\n options: {\r\n type: Array as PropType<Array<RadioProps | string | number>>,\r\n default: () => [],\r\n },\r\n optionType: {\r\n type: String as PropType<'default' | 'button'>,\r\n default: 'default',\r\n },\r\n})\r\n\r\nconst { props: radioProps } = useCleanAttrs()\r\n\r\nconst OptionType = computed(() => {\r\n return props.optionType === 'button' ? ElRadioButton : ElRadio\r\n})\r\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\r\n\r\nfunction isRadioPropsObject(option: any): option is RadioProps {\r\n return isPlainObj(option)\r\n}\r\n\r\nfunction getOptionLabel(option: any, index: number) {\r\n if (isRadioPropsObject(props.options[index])) {\r\n return props.options[index].label\r\n }\r\n return option.label\r\n}\r\n\r\nconst compatiableProps = computed(() => {\r\n return props.options.map((option) => {\r\n if (!isRadioPropsObject(option)) {\r\n return {\r\n label: option,\r\n value: option,\r\n }\r\n }\r\n /* istanbul ignore if -- @preserve */\r\n if (IS_LESS_THAN_2_6_0) {\r\n return {\r\n ...option,\r\n label: option.value,\r\n }\r\n }\r\n return option\r\n })\r\n})\r\n\r\nconst slots = useSlots()\r\n</script>\r\n\r\n<template>\r\n <ElRadioGroup v-bind=\"radioProps\">\r\n <template v-if=\"!slots.option\">\r\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\r\n {{ getOptionLabel(option, index) }}\r\n </component>\r\n </template>\r\n <template v-else>\r\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\r\n <slot name=\"option\" :option=\"option\" />\r\n </component>\r\n </template>\r\n </ElRadioGroup>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElRadio } from 'element-plus'\r\nimport { composeExport, mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FRadioGroup from './radio-group.vue'\r\nimport './style.scss'\r\n\r\nconst RadioGroup = connect<typeof FRadioGroup>(\r\n FRadioGroup,\r\n mapProps({ dataSource: 'options', disabled: true }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\nexport const Radio = composeExport(ElRadio, {\r\n Group: RadioGroup,\r\n})\r\n\r\nexport default Radio\r\n"],"names":["props","__props","radioProps","useCleanAttrs","OptionType","computed","ElRadioButton","ElRadio","IS_LESS_THAN_2_6_0","lt","version","isRadioPropsObject","option","isPlainObj","getOptionLabel","index","compatiableProps","slots","useSlots","_openBlock","_createBlock","_unref","_createElementBlock","_Fragment","_renderList","_resolveDynamicComponent","_mergeProps","_renderSlot","_ctx","RadioGroup","connect","FRadioGroup","mapProps","mapReadPretty","PreviewText","Radio","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,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qBACjG,MAAmC;AAAA,gBAAhCE,EAAeF,GAAQG,CAAK,CAAA,GAAA,CAAA;AAAA,UAAA;;;;;;;IC5DjCc,IAAaC;AAAA,EACjBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,UAAU,IAAM;AAAA,EAClDC,EAAcC,EAAY,MAAM;AAClC,GACaC,IAAQC,EAAc7B,GAAS;AAAA,EAC1C,OAAOsB;AACT,CAAC;"}
@@ -1,5 +1,5 @@
1
1
  import { observer as s } from "@silver-formily/reactive-vue";
2
- import { defineComponent as c, createBlock as i, openBlock as f, unref as u, mergeProps as d, withCtx as m, renderSlot as p } from "vue";
2
+ import { defineComponent as c, openBlock as i, createBlock as f, unref as u, mergeProps as d, withCtx as m, renderSlot as p } from "vue";
3
3
  import { useParentForm as C } from "@silver-formily/vue";
4
4
  import { ElButton as k } from "element-plus";
5
5
  const F = /* @__PURE__ */ c({
@@ -29,7 +29,7 @@ const F = /* @__PURE__ */ c({
29
29
  forceClear: e.forceClear
30
30
  }), e.validate && o?.validate().then(e.onResetValidateSuccess).catch((l) => e.onResetValidateFailed?.(l));
31
31
  }
32
- return (t, o) => (f(), i(u(k), d(t.$attrs, { onClick: r }), {
32
+ return (t, o) => (i(), f(u(k), d(t.$attrs, { onClick: r }), {
33
33
  default: m(() => [
34
34
  p(t.$slots, "default")
35
35
  ]),
@@ -1,6 +1,6 @@
1
1
  import { connect as m, mapProps as a } from "@silver-formily/vue";
2
2
  import { PreviewText as i } from "../preview-text/index.mjs";
3
- import { defineComponent as c, useSlots as d, createBlock as l, openBlock as f, unref as e, mergeProps as u, createSlots as S, withCtx as g, renderSlot as P, normalizeProps as _, guardReactiveProps as h } from "vue";
3
+ import { defineComponent as c, useSlots as d, openBlock as l, createBlock as f, unref as e, mergeProps as u, createSlots as S, withCtx as g, renderSlot as P, normalizeProps as _, guardReactiveProps as h } from "vue";
4
4
  import { ElSegmented as k } from "element-plus";
5
5
  import { useCleanAttrs as v } from "../__builtins__/shared/utils.mjs";
6
6
  import { mapReadPretty as x } from "../__builtins__/shared/transform-component.mjs";
@@ -13,7 +13,7 @@ const C = /* @__PURE__ */ c({
13
13
  },
14
14
  setup(t) {
15
15
  const o = t, r = d(), { props: s } = v();
16
- return (n, w) => (f(), l(e(k), u(e(s), {
16
+ return (n, w) => (l(), f(e(k), u(e(s), {
17
17
  options: o.options
18
18
  }), S({ _: 2 }, [
19
19
  e(r).default ? {
@@ -4,11 +4,11 @@ export declare const Select: {
4
4
  disabled: boolean;
5
5
  created: boolean;
6
6
  }> & Omit<{
7
+ readonly created: boolean;
7
8
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
8
9
  readonly disabled: boolean;
9
- readonly created: boolean;
10
10
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
11
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">) | (Partial<{
11
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">) | (Partial<{
12
12
  disabled: boolean;
13
13
  }> & Omit<{
14
14
  readonly disabled: boolean;
@@ -18,11 +18,11 @@ export declare const Select: {
18
18
  disabled: boolean;
19
19
  created: boolean;
20
20
  }> & Omit<{
21
+ readonly created: boolean;
21
22
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
22
23
  readonly disabled: boolean;
23
- readonly created: boolean;
24
24
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
25
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">)[];
25
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">)[];
26
26
  })>;
27
27
  }> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
28
28
  P: {};
@@ -36,11 +36,11 @@ export declare const Select: {
36
36
  disabled: boolean;
37
37
  created: boolean;
38
38
  }> & Omit<{
39
+ readonly created: boolean;
39
40
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
40
41
  readonly disabled: boolean;
41
- readonly created: boolean;
42
42
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
43
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">) | (Partial<{
43
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">) | (Partial<{
44
44
  disabled: boolean;
45
45
  }> & Omit<{
46
46
  readonly disabled: boolean;
@@ -50,11 +50,11 @@ export declare const Select: {
50
50
  disabled: boolean;
51
51
  created: boolean;
52
52
  }> & Omit<{
53
+ readonly created: boolean;
53
54
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
54
55
  readonly disabled: boolean;
55
- readonly created: boolean;
56
56
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
57
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">)[];
57
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">)[];
58
58
  })>;
59
59
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
60
60
  __isFragment?: never;
@@ -65,11 +65,11 @@ export declare const Select: {
65
65
  disabled: boolean;
66
66
  created: boolean;
67
67
  }> & Omit<{
68
+ readonly created: boolean;
68
69
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
69
70
  readonly disabled: boolean;
70
- readonly created: boolean;
71
71
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
72
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">) | (Partial<{
72
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">) | (Partial<{
73
73
  disabled: boolean;
74
74
  }> & Omit<{
75
75
  readonly disabled: boolean;
@@ -79,11 +79,11 @@ export declare const Select: {
79
79
  disabled: boolean;
80
80
  created: boolean;
81
81
  }> & Omit<{
82
+ readonly created: boolean;
82
83
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
83
84
  readonly disabled: boolean;
84
- readonly created: boolean;
85
85
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
86
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">)[];
86
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">)[];
87
87
  })>;
88
88
  }> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
89
89
  $slots: Readonly<{
@@ -92,11 +92,11 @@ export declare const Select: {
92
92
  disabled: boolean;
93
93
  created: boolean;
94
94
  }> & Omit<{
95
+ readonly created: boolean;
95
96
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
96
97
  readonly disabled: boolean;
97
- readonly created: boolean;
98
98
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
99
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">;
99
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">;
100
100
  }) => any;
101
101
  header?: () => any;
102
102
  footer?: () => any;
@@ -111,11 +111,11 @@ export declare const Select: {
111
111
  disabled: boolean;
112
112
  created: boolean;
113
113
  }> & Omit<{
114
+ readonly created: boolean;
114
115
  readonly value: import('element-plus/es/utils/index.mjs').EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>;
115
116
  readonly disabled: boolean;
116
- readonly created: boolean;
117
117
  readonly label?: import('element-plus/es/utils/index.mjs').EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
118
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "disabled" | "created">;
118
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "created" | "disabled">;
119
119
  }) => any;
120
120
  header?: () => any;
121
121
  footer?: () => any;