@silver-formily/element-plus 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.en-US.md +32 -32
- package/README.md +32 -32
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/index.mjs +12 -11
- package/esm/__builtins__/shared/index.mjs +11 -10
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.d.ts +1 -0
- package/esm/__builtins__/shared/utils.mjs +23 -17
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +56 -52
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.d.ts +0 -1
- package/esm/array-base/utils.mjs +45 -46
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +36 -33
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +39 -37
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +9 -2
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +38 -34
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +38 -36
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +12 -5
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +63 -60
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +18 -11
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +28 -25
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/index.mjs +24 -18
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +22 -18
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.mjs +20 -16
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +9 -6
- package/esm/color-picker/index.mjs.map +1 -1
- package/esm/color-picker-panel/index.mjs +9 -6
- package/esm/color-picker-panel/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +14 -11
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/date-picker/utils.mjs.map +1 -1
- package/esm/date-picker-panel/index.mjs +14 -11
- package/esm/date-picker-panel/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +2 -0
- package/esm/editable/index.d.ts +1 -0
- package/esm/editable/index.mjs +71 -66
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form/form.mjs +6 -6
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/form-button-group.d.ts +9 -0
- package/esm/form-button-group/index.d.ts +15 -0
- package/esm/form-button-group/index.mjs +47 -28
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +9 -2
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +21 -18
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +22 -22
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +21 -21
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +26 -22
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.d.ts +1 -0
- package/esm/form-item/index.mjs +102 -99
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +4 -0
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +14 -10
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +23 -23
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +30 -27
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +24 -22
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.mjs +82 -78
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs +30 -26
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.mjs +11 -8
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.mjs +20 -16
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +24 -20
- package/esm/mention/index.mjs.map +1 -1
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +57 -53
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.d.ts +5 -0
- package/esm/query-form/default-components.mjs +47 -0
- package/esm/query-form/default-components.mjs.map +1 -0
- package/esm/query-form/hooks.d.ts +25 -0
- package/esm/query-form/hooks.mjs +29 -0
- package/esm/query-form/hooks.mjs.map +1 -0
- package/esm/query-form/index.d.ts +117 -0
- package/esm/query-form/index.mjs +337 -0
- package/esm/query-form/index.mjs.map +1 -0
- package/esm/query-form/query-form-light.d.ts +27 -0
- package/esm/query-form/query-form.d.ts +52 -0
- package/esm/query-form/types.d.ts +44 -0
- package/esm/query-form/types.mjs +2 -0
- package/esm/query-form/types.mjs.map +1 -0
- package/esm/query-form-item/index.d.ts +151 -0
- package/esm/query-form-item/index.mjs +188 -0
- package/esm/query-form-item/index.mjs.map +1 -0
- package/esm/query-form-item/query-form-item.d.ts +96 -0
- package/esm/query-form-item/types.d.ts +46 -0
- package/esm/query-form-item/types.mjs +2 -0
- package/esm/query-form-item/types.mjs.map +1 -0
- package/esm/radio/index.mjs +29 -25
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +13 -10
- package/esm/rate/index.mjs.map +1 -1
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.mjs +16 -12
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.mjs +26 -22
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +36 -33
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/shared/overlay-elements.mjs +14 -11
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/slider/index.mjs +13 -10
- package/esm/slider/index.mjs.map +1 -1
- package/esm/styles/form-button-group/index.css +1 -1
- package/esm/styles/form-item/index.css +1 -1
- package/esm/styles/query-form/index.css +1 -0
- package/esm/styles/query-form-item/index.css +1 -0
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +9 -6
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.mjs +9 -6
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +33 -29
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +18 -14
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.mjs +10 -7
- package/esm/upload/index.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +751 -663
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/package.json +115 -115
|
@@ -0,0 +1,188 @@
|
|
|
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 p, onMounted as U, watch as L, createBlock as P, openBlock as S, unref as u, mergeProps as C, withCtx as G, createElementVNode as h, normalizeClass as b, createCommentVNode as H, resolveDynamicComponent as J, normalizeProps as K, guardReactiveProps as T, renderSlot 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 { stylePrefix as R } from "../__builtins__/configs/index.mjs";
|
|
8
|
+
import "@formily/reactive";
|
|
9
|
+
import "@vueuse/core";
|
|
10
|
+
import "@silver-formily/reactive-vue";
|
|
11
|
+
import { useCleanAttrs as ee } from "../__builtins__/shared/utils.mjs";
|
|
12
|
+
import { QueryForm as k } from "../query-form/index.mjs";
|
|
13
|
+
import { useQueryFormForm as te } from "../query-form/hooks.mjs";
|
|
14
|
+
import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
15
|
+
name: "FQueryFormItem",
|
|
16
|
+
inheritAttrs: !1,
|
|
17
|
+
__name: "query-form-item",
|
|
18
|
+
props: {
|
|
19
|
+
mode: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "default"
|
|
22
|
+
},
|
|
23
|
+
request: Function,
|
|
24
|
+
clearOnDataChange: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
querySchema: Object,
|
|
29
|
+
queryFormProps: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: () => ({})
|
|
32
|
+
},
|
|
33
|
+
pagination: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !0
|
|
36
|
+
},
|
|
37
|
+
paginationProps: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => ({})
|
|
40
|
+
},
|
|
41
|
+
paginationMap: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: () => ({})
|
|
44
|
+
},
|
|
45
|
+
immediate: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !0
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emits: ["requestSuccess", "requestFailed"],
|
|
51
|
+
setup(B, { emit: I }) {
|
|
52
|
+
const e = B, c = I, m = {
|
|
53
|
+
currentPage: 1,
|
|
54
|
+
pageSize: 10,
|
|
55
|
+
pageSizes: [10, 20, 50, 100],
|
|
56
|
+
layout: "total, prev, pager, next",
|
|
57
|
+
size: "small"
|
|
58
|
+
}, q = {
|
|
59
|
+
current: "current",
|
|
60
|
+
pageSize: "pageSize"
|
|
61
|
+
}, Q = j(), _ = X(), f = `${R}-query-form-item`, x = `${R}-form-item--isolated`, { props: O } = ee(), M = y(() => {
|
|
62
|
+
const {
|
|
63
|
+
currentPage: t,
|
|
64
|
+
pageSize: a,
|
|
65
|
+
...r
|
|
66
|
+
} = {
|
|
67
|
+
...m,
|
|
68
|
+
...e.paginationProps
|
|
69
|
+
};
|
|
70
|
+
return r;
|
|
71
|
+
}), n = p(e.paginationProps?.currentPage ?? m.currentPage), s = p(e.paginationProps?.pageSize ?? m.pageSize), d = p(0), l = p(0), { activeForm: F } = te({
|
|
72
|
+
formProps: y(() => e.queryFormProps),
|
|
73
|
+
fallbackForm: _
|
|
74
|
+
}), $ = y(() => ({
|
|
75
|
+
...e.queryFormProps,
|
|
76
|
+
schema: e.querySchema ?? e.queryFormProps.schema,
|
|
77
|
+
form: F.value,
|
|
78
|
+
onAutoSubmit: z,
|
|
79
|
+
resetProps: {
|
|
80
|
+
onClick: A
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
async function g() {
|
|
84
|
+
if (!e.request)
|
|
85
|
+
return;
|
|
86
|
+
const t = Q.value;
|
|
87
|
+
Array.isArray(t.dataSource) || (t.dataSource = []);
|
|
88
|
+
const a = ++l.value;
|
|
89
|
+
/* istanbul ignore next -- @preserve defensive: active query form can be temporarily undefined before form injection settles */
|
|
90
|
+
const r = F.value?.values ?? {}, i = e.pagination ? {
|
|
91
|
+
current: n.value,
|
|
92
|
+
pageSize: s.value
|
|
93
|
+
} : void 0, v = i ? {
|
|
94
|
+
...r,
|
|
95
|
+
[e.paginationMap.current ?? q.current]: i.current,
|
|
96
|
+
[e.paginationMap.pageSize ?? q.pageSize]: i.pageSize
|
|
97
|
+
} : r;
|
|
98
|
+
t.loading = !0;
|
|
99
|
+
try {
|
|
100
|
+
const o = await e.request(v);
|
|
101
|
+
if (a !== l.value)
|
|
102
|
+
return;
|
|
103
|
+
if (o.success !== !0) {
|
|
104
|
+
c("requestFailed", o);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
t.dataSource = o.data, e.clearOnDataChange && t.setValue?.(void 0), d.value = Y(o.total) ? o.total : o.data.length, c("requestSuccess", {
|
|
108
|
+
values: r,
|
|
109
|
+
pagination: i,
|
|
110
|
+
dataSource: o.data,
|
|
111
|
+
total: d.value,
|
|
112
|
+
result: o
|
|
113
|
+
});
|
|
114
|
+
} catch (o) {
|
|
115
|
+
if (a !== l.value)
|
|
116
|
+
return;
|
|
117
|
+
c("requestFailed", o);
|
|
118
|
+
} finally {
|
|
119
|
+
a === l.value && (t.loading = !1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function z() {
|
|
123
|
+
if (e.pagination && n.value !== 1) {
|
|
124
|
+
n.value = 1;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
await g();
|
|
128
|
+
}
|
|
129
|
+
function A(t) {
|
|
130
|
+
const a = e.queryFormProps.resetProps?.onClick, r = a?.(t);
|
|
131
|
+
return r === !1 ? !1 : (z(), r);
|
|
132
|
+
}
|
|
133
|
+
return U(() => {
|
|
134
|
+
e.immediate && g();
|
|
135
|
+
}), L([n, s], ([t, a], [r, i]) => {
|
|
136
|
+
/* istanbul ignore if -- @preserve defensive: watcher is retained when pagination is dynamically toggled off */
|
|
137
|
+
if (!e.pagination)
|
|
138
|
+
return;
|
|
139
|
+
const v = t !== r, o = a !== i;
|
|
140
|
+
/* istanbul ignore if -- @preserve defensive: keep guard for unexpected duplicated watcher payload */
|
|
141
|
+
if (!(!v && !o)) {
|
|
142
|
+
if (o && t !== 1) {
|
|
143
|
+
n.value = 1;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
g();
|
|
147
|
+
}
|
|
148
|
+
}), (t, a) => (S(), P(u(V), C(u(O), { "internal-form-item-class": x }), {
|
|
149
|
+
default: G(() => [
|
|
150
|
+
h("div", {
|
|
151
|
+
class: b(f)
|
|
152
|
+
}, [
|
|
153
|
+
(S(), P(J(e.mode === "light" ? u(k).Light : u(k)), K(T($.value)), null, 16)),
|
|
154
|
+
h("div", {
|
|
155
|
+
class: b(`${f}__content`)
|
|
156
|
+
}, [
|
|
157
|
+
W(t.$slots, "default")
|
|
158
|
+
], 2),
|
|
159
|
+
e.pagination ? (S(), P(u(Z), C({
|
|
160
|
+
key: 0,
|
|
161
|
+
"current-page": n.value,
|
|
162
|
+
"onUpdate:currentPage": a[0] || (a[0] = (r) => n.value = r),
|
|
163
|
+
"page-size": s.value,
|
|
164
|
+
"onUpdate:pageSize": a[1] || (a[1] = (r) => s.value = r),
|
|
165
|
+
class: `${f}__pagination`
|
|
166
|
+
}, M.value, { total: d.value }), null, 16, ["current-page", "page-size", "class", "total"])) : H("", !0)
|
|
167
|
+
])
|
|
168
|
+
]),
|
|
169
|
+
_: 3
|
|
170
|
+
}, 16));
|
|
171
|
+
}
|
|
172
|
+
}), ve = w(
|
|
173
|
+
re,
|
|
174
|
+
D(
|
|
175
|
+
{
|
|
176
|
+
validateStatus: !0,
|
|
177
|
+
title: "label",
|
|
178
|
+
required: !0,
|
|
179
|
+
description: "extra"
|
|
180
|
+
},
|
|
181
|
+
N
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
export {
|
|
185
|
+
ve as QueryFormItem,
|
|
186
|
+
ve as default
|
|
187
|
+
};
|
|
188
|
+
//# 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\">\nimport type { Field } from '@formily/core'\nimport type { ISchema } from '@formily/json-schema'\nimport type { PropType } from 'vue'\nimport type {\n QueryFormItemMode,\n QueryFormItemPaginationMap,\n QueryFormItemPaginationProps,\n QueryFormItemQueryProps,\n QueryFormItemRequest,\n QueryFormItemRequestSuccessPayload,\n} from './types'\nimport { createForm } from '@formily/core'\nimport { isNum } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ElPagination } from 'element-plus'\nimport { computed, onMounted, ref, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { FormBaseItem } from '../form-item'\nimport { QueryForm } from '../query-form'\nimport { useQueryFormForm } from '../query-form/hooks'\n\ndefineOptions({\n name: 'FQueryFormItem',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n mode: {\n type: String as PropType<QueryFormItemMode>,\n default: 'default',\n },\n request: Function as PropType<QueryFormItemRequest>,\n clearOnDataChange: {\n type: Boolean,\n default: false,\n },\n querySchema: Object as PropType<ISchema>,\n queryFormProps: {\n type: Object as PropType<QueryFormItemQueryProps>,\n default: () => ({}),\n },\n pagination: {\n type: Boolean,\n default: true,\n },\n paginationProps: {\n type: Object as PropType<QueryFormItemPaginationProps>,\n default: () => ({}),\n },\n paginationMap: {\n type: Object as PropType<QueryFormItemPaginationMap>,\n default: () => ({}),\n },\n immediate: {\n type: Boolean,\n default: true,\n },\n})\n\nconst emit = defineEmits<{\n (e: 'requestSuccess', payload: QueryFormItemRequestSuccessPayload): void\n (e: 'requestFailed', error: any): void\n}>()\n\nconst defaultPaginationProps: QueryFormItemPaginationProps = {\n currentPage: 1,\n pageSize: 10,\n pageSizes: [10, 20, 50, 100],\n layout: 'total, prev, pager, next',\n size: 'small',\n}\nconst defaultPaginationRequestMapping: Required<QueryFormItemPaginationMap> = {\n current: 'current',\n pageSize: 'pageSize',\n}\n\nconst fieldRef = useField<Field>()\nconst internalQueryForm = createForm()\nconst prefixCls = `${stylePrefix}-query-form-item`\nconst formItemInternalClass = `${stylePrefix}-form-item--isolated`\nconst { props: formItemProps } = useCleanAttrs()\n\nconst paginationBindings = computed(() => {\n const {\n currentPage,\n pageSize,\n ...bindings\n } = {\n ...defaultPaginationProps,\n ...props.paginationProps,\n }\n return bindings\n})\n\nconst currentPageRef = ref(props.paginationProps?.currentPage ?? defaultPaginationProps.currentPage)\nconst pageSizeRef = ref(props.paginationProps?.pageSize ?? defaultPaginationProps.pageSize)\nconst totalRef = ref(0)\nconst currentRequestId = ref(0)\n\nconst { activeForm: activeQueryForm } = useQueryFormForm({\n formProps: computed(() => props.queryFormProps),\n fallbackForm: internalQueryForm,\n})\n\nconst queryFormBindings = computed(() => {\n return ({\n ...props.queryFormProps,\n schema: props.querySchema ?? props.queryFormProps.schema,\n form: activeQueryForm.value,\n onAutoSubmit: handleQuerySubmit,\n resetProps: {\n onClick: handleQueryReset,\n },\n })\n})\n\nasync function executeRequest() {\n if (!props.request)\n return\n\n const field = fieldRef.value\n if (!Array.isArray(field.dataSource))\n field.dataSource = []\n\n const requestId = ++currentRequestId.value\n /* istanbul ignore next -- @preserve defensive: active query form can be temporarily undefined before form injection settles */\n const queryValues = activeQueryForm.value?.values ?? {}\n const paginationData = props.pagination\n ? {\n current: currentPageRef.value,\n pageSize: pageSizeRef.value,\n }\n : undefined\n const requestParams = paginationData\n ? {\n ...queryValues,\n [(props.paginationMap.current ?? defaultPaginationRequestMapping.current)]: paginationData.current,\n [(props.paginationMap.pageSize ?? defaultPaginationRequestMapping.pageSize)]: paginationData.pageSize,\n }\n : queryValues\n\n field.loading = true\n try {\n const result = await props.request(requestParams)\n\n if (requestId !== currentRequestId.value)\n return\n\n if (result.success !== true) {\n emit('requestFailed', result)\n return\n }\n\n field.dataSource = result.data\n if (props.clearOnDataChange) {\n field.setValue?.(undefined)\n }\n totalRef.value = isNum(result.total) ? result.total : result.data.length\n\n emit('requestSuccess', {\n values: queryValues,\n pagination: paginationData,\n dataSource: result.data,\n total: totalRef.value,\n result,\n })\n }\n catch (error) {\n if (requestId !== currentRequestId.value)\n return\n emit('requestFailed', error)\n }\n finally {\n if (requestId === currentRequestId.value)\n field.loading = false\n }\n}\n\nasync function handleQuerySubmit() {\n if (props.pagination && currentPageRef.value !== 1) {\n currentPageRef.value = 1\n return\n }\n\n await executeRequest()\n}\n\nfunction handleQueryReset(event: MouseEvent) {\n const userOnClick = props.queryFormProps.resetProps?.onClick as ((event: MouseEvent) => void | boolean) | undefined\n const result = userOnClick?.(event)\n if (result === false)\n return false\n\n void handleQuerySubmit()\n\n return result\n}\n\nonMounted(() => {\n if (props.immediate)\n void executeRequest()\n})\n\nwatch([currentPageRef, pageSizeRef], ([currentPage, pageSize], [previousPage, previousPageSize]) => {\n /* istanbul ignore if -- @preserve defensive: watcher is retained when pagination is dynamically toggled off */\n if (!props.pagination)\n return\n\n const currentChanged = currentPage !== previousPage\n const pageSizeChanged = pageSize !== previousPageSize\n\n /* istanbul ignore if -- @preserve defensive: keep guard for unexpected duplicated watcher payload */\n if (!currentChanged && !pageSizeChanged)\n return\n\n if (pageSizeChanged && currentPage !== 1) {\n currentPageRef.value = 1\n return\n }\n\n void executeRequest()\n})\n</script>\n\n<template>\n <FormBaseItem\n v-bind=\"formItemProps\"\n :internal-form-item-class=\"formItemInternalClass\"\n >\n <div :class=\"prefixCls\">\n <component\n :is=\"props.mode === 'light' ? QueryForm.Light : QueryForm\"\n v-bind=\"queryFormBindings\"\n />\n <div :class=\"`${prefixCls}__content`\">\n <slot />\n </div>\n <ElPagination\n v-if=\"props.pagination\"\n v-model:current-page=\"currentPageRef\"\n v-model:page-size=\"pageSizeRef\"\n :class=\"`${prefixCls}__pagination`\"\n v-bind=\"paginationBindings\"\n :total=\"totalRef\"\n />\n </div>\n </FormBaseItem>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { fieldFeedbackMapper } from '../form-item'\nimport QueryFormItemInner from './query-form-item.vue'\nimport './style.scss'\n\nexport type {\n IQueryFormItemProps,\n QueryFormItemMode,\n QueryFormItemPagination,\n QueryFormItemPaginationMap,\n QueryFormItemPaginationProps,\n QueryFormItemQueryProps,\n QueryFormItemRequest,\n QueryFormItemRequestResultObject,\n QueryFormItemRequestSuccessPayload,\n} from './types'\n\nexport const QueryFormItem = connect<typeof QueryFormItemInner>(\n QueryFormItemInner,\n mapProps(\n {\n validateStatus: true,\n title: 'label',\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n ),\n)\n\nexport default QueryFormItem\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,IAA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A,IAAA;AAAA,IAEfC;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ISchema } from '@formily/json-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 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/esm/radio/index.mjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
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
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
3
|
+
import "@formily/reactive";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import { defineComponent as O, computed as c, useSlots as x, createBlock as p, openBlock as t, unref as u, normalizeProps as A, guardReactiveProps as L, withCtx as i, createElementBlock as f, Fragment as d, renderList as _, resolveDynamicComponent as y, mergeProps as b, createTextVNode as h, toDisplayString as j, renderSlot as w } from "vue";
|
|
6
|
+
import { mapReadPretty as D } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
+
import { useCleanAttrs as F, composeExport as N } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { PreviewText as z } from "../preview-text/index.mjs";
|
|
9
|
+
import { isPlainObj as H } from "@formily/shared";
|
|
10
|
+
import { lt as I } from "../__builtins__/shared/simple-version-compare.mjs";
|
|
11
|
+
import "@formily/core";
|
|
12
|
+
import "@silver-formily/reactive-vue";
|
|
13
|
+
import '../styles/radio/index.css';const V = /* @__PURE__ */ O({
|
|
10
14
|
name: "FRadioGroup",
|
|
11
15
|
__name: "radio-group",
|
|
12
16
|
props: {
|
|
@@ -20,15 +24,15 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ x({
|
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
setup(P) {
|
|
23
|
-
const o = P, { props: R } =
|
|
24
|
-
function
|
|
25
|
-
return
|
|
27
|
+
const o = P, { props: R } = F(), s = c(() => o.optionType === "button" ? B : v), S = I(G, "2.6.0");
|
|
28
|
+
function l(e) {
|
|
29
|
+
return H(e);
|
|
26
30
|
}
|
|
27
31
|
function g(e, n) {
|
|
28
|
-
return
|
|
32
|
+
return l(o.options[n]) ? o.options[n].label : e.label;
|
|
29
33
|
}
|
|
30
34
|
const m = c(() => o.options.map((e) => {
|
|
31
|
-
if (!
|
|
35
|
+
if (!l(e))
|
|
32
36
|
return {
|
|
33
37
|
label: e,
|
|
34
38
|
value: e
|
|
@@ -38,17 +42,17 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ x({
|
|
|
38
42
|
...e,
|
|
39
43
|
label: e.value
|
|
40
44
|
} : e;
|
|
41
|
-
})), k =
|
|
42
|
-
return (e, n) => (t(), p(u(C), L(
|
|
43
|
-
default:
|
|
44
|
-
u(k).option ? (t(!0), f(d, { key: 1 }, _(m.value, (r, a) => (t(), p(y(
|
|
45
|
-
default:
|
|
46
|
-
|
|
45
|
+
})), k = x();
|
|
46
|
+
return (e, n) => (t(), p(u(C), A(L(u(R))), {
|
|
47
|
+
default: i(() => [
|
|
48
|
+
u(k).option ? (t(!0), f(d, { key: 1 }, _(m.value, (r, a) => (t(), p(y(s.value), b({ key: a }, { ref_for: !0 }, r), {
|
|
49
|
+
default: i(() => [
|
|
50
|
+
w(e.$slots, "option", { option: r })
|
|
47
51
|
]),
|
|
48
52
|
_: 2
|
|
49
|
-
}, 1040))), 128)) : (t(!0), f(d, { key: 0 }, _(m.value, (r, a) => (t(), p(y(
|
|
50
|
-
default:
|
|
51
|
-
j(
|
|
53
|
+
}, 1040))), 128)) : (t(!0), f(d, { key: 0 }, _(m.value, (r, a) => (t(), p(y(s.value), b({ key: a }, { ref_for: !0 }, r), {
|
|
54
|
+
default: i(() => [
|
|
55
|
+
h(j(g(r, a)), 1)
|
|
52
56
|
]),
|
|
53
57
|
_: 2
|
|
54
58
|
}, 1040))), 128))
|
|
@@ -59,12 +63,12 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ x({
|
|
|
59
63
|
}), $ = E(
|
|
60
64
|
V,
|
|
61
65
|
T({ dataSource: "options", disabled: !0 }),
|
|
62
|
-
|
|
63
|
-
),
|
|
66
|
+
D(z.Select)
|
|
67
|
+
), te = N(v, {
|
|
64
68
|
Group: $
|
|
65
69
|
});
|
|
66
70
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
te as Radio,
|
|
72
|
+
te as default
|
|
69
73
|
};
|
|
70
74
|
//# sourceMappingURL=index.mjs.map
|
package/esm/radio/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/radio/radio-group.vue","../../src/radio/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/radio/radio-group.vue","../../src/radio/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { RadioProps } from 'element-plus'\nimport type { PropType } from 'vue'\nimport { isPlainObj } from '@formily/shared'\nimport { ElRadio, ElRadioButton, ElRadioGroup, version } from 'element-plus'\nimport { computed, useSlots } from 'vue'\nimport { lt, useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FRadioGroup',\n})\n\nconst props = defineProps({\n options: {\n type: Array as PropType<Array<RadioProps | string | number>>,\n default: () => [],\n },\n optionType: {\n type: String as PropType<'default' | 'button'>,\n default: 'default',\n },\n})\n\nconst { props: radioProps } = useCleanAttrs()\n\nconst OptionType = computed(() => {\n return props.optionType === 'button' ? ElRadioButton : ElRadio\n})\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\n\nfunction isRadioPropsObject(option: any): option is RadioProps {\n return isPlainObj(option)\n}\n\nfunction getOptionLabel(option: any, index: number) {\n if (isRadioPropsObject(props.options[index])) {\n return props.options[index].label\n }\n return option.label\n}\n\nconst compatiableProps = computed(() => {\n return props.options.map((option) => {\n if (!isRadioPropsObject(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()\n</script>\n\n<template>\n <ElRadioGroup v-bind=\"radioProps\">\n <template v-if=\"!slots.option\">\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n {{ getOptionLabel(option, index) }}\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 </ElRadioGroup>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { ElRadio } from 'element-plus'\nimport { composeExport, mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FRadioGroup from './radio-group.vue'\nimport './style.scss'\n\nconst RadioGroup = connect<typeof FRadioGroup>(\n FRadioGroup,\n mapProps({ dataSource: 'options', disabled: true }),\n mapReadPretty(PreviewText.Select),\n)\nexport const Radio = composeExport(ElRadio, {\n Group: RadioGroup,\n})\n\nexport default Radio\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,KAAQC,EAAc7B,GAAS;AAAA,EAC1C,OAAOsB;AACT,CAAC;"}
|
package/esm/rate/index.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { connect as
|
|
2
|
-
import { ElRate as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { connect as r, mapProps as t } from "@silver-formily/vue";
|
|
2
|
+
import { ElRate as o } from "element-plus";
|
|
3
|
+
import "@formily/reactive";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import "vue";
|
|
6
|
+
import { mapReadPretty as e } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
+
import { PreviewText as m } from "../preview-text/index.mjs";
|
|
8
|
+
const s = r(
|
|
9
|
+
o,
|
|
10
|
+
t({ readOnly: "readonly", disabled: !0 }),
|
|
11
|
+
e(m.Rate)
|
|
9
12
|
);
|
|
10
13
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
s as Rate,
|
|
15
|
+
s as default
|
|
13
16
|
};
|
|
14
17
|
//# sourceMappingURL=index.mjs.map
|
package/esm/rate/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/rate/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/rate/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElRate } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type RateProps = typeof ElRate\n\nexport const Rate = connect<typeof ElRate>(\n ElRate,\n mapProps({ readOnly: 'readonly', disabled: true }),\n mapReadPretty(PreviewText.Rate),\n)\n\nexport default Rate\n"],"names":["Rate","connect","ElRate","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;AAOO,MAAMA,IAAOC;AAAA,EAClBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,IAAM;AAAA,EACjDC,EAAcC,EAAY,IAAI;AAChC;"}
|
package/esm/reset/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/reset/reset.vue","../../src/reset/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/reset/reset.vue","../../src/reset/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { PropType } from 'vue'\nimport { useParentForm } from '@silver-formily/vue'\nimport { ElButton } from 'element-plus'\n\ndefineOptions({\n name: 'FReset',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n onClick: Function as PropType<(e: MouseEvent) => void | boolean>,\n forceClear: {\n type: Boolean,\n default: false,\n },\n validate: {\n type: Boolean,\n default: false,\n },\n onResetValidateSuccess: Function as PropType<(payload: any) => void>,\n onResetValidateFailed: Function as PropType<(error: any) => void>,\n})\n\nconst formRef = useParentForm()\n\nfunction handleClick(e: MouseEvent) {\n if (props.onClick && (props.onClick)?.(e) === false)\n return\n\n const form = formRef?.value\n form?.reset('*', {\n forceClear: props.forceClear,\n })\n props.validate && form?.validate()\n .then(props.onResetValidateSuccess)\n .catch(error => props.onResetValidateFailed?.(error))\n}\n</script>\n\n<template>\n <ElButton v-bind=\"$attrs\" @click=\"handleClick\">\n <slot />\n </ElButton>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport FReset from './reset.vue'\n\nexport const Reset = observer(FReset)\n\nexport default Reset\n"],"names":["props","__props","formRef","useParentForm","handleClick","e","form","error","_openBlock","_createBlock","_unref","_mergeProps","_ctx","_renderSlot","Reset","observer","FReset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAUA,UAAMA,IAAQC,GAcRC,IAAUC,EAAA;AAEhB,aAASC,EAAYC,GAAe;AAClC,UAAIL,EAAM,WAAYA,EAAM,UAAWK,CAAC,MAAM;AAC5C;AAEF,YAAMC,IAAOJ,GAAS;AACtB,MAAAI,GAAM,MAAM,KAAK;AAAA,QACf,YAAYN,EAAM;AAAA,MAAA,CACnB,GACDA,EAAM,YAAYM,GAAM,SAAA,EACrB,KAAKN,EAAM,sBAAsB,EACjC,MAAM,CAAAO,MAASP,EAAM,wBAAwBO,CAAK,CAAC;AAAA,IACxD;sBAIEC,EAAA,GAAAC,EAEWC,MAFXC,EAEWC,UAFa,EAAG,SAAOR,EAAA,CAAW,GAAA;AAAA,iBAC3C,MAAQ;AAAA,QAARS,EAAQD,EAAA,QAAA,SAAA;AAAA,MAAA;;;;ICvCCE,IAAQC,EAASC,CAAM;"}
|
package/esm/segmented/index.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { connect as m, mapProps as
|
|
2
|
-
import {
|
|
1
|
+
import { connect as m, mapProps as i } from "@silver-formily/vue";
|
|
2
|
+
import { ElSegmented as a } from "element-plus";
|
|
3
|
+
import "@formily/reactive";
|
|
4
|
+
import "@vueuse/core";
|
|
3
5
|
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";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
6
|
+
import { mapReadPretty as k } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
+
import { PreviewText as v } from "../preview-text/index.mjs";
|
|
8
|
+
import "@formily/core";
|
|
9
|
+
import "@silver-formily/reactive-vue";
|
|
10
|
+
import { useCleanAttrs as x } from "../__builtins__/shared/utils.mjs";
|
|
7
11
|
const C = /* @__PURE__ */ c({
|
|
8
12
|
name: "FSegmented",
|
|
9
13
|
inheritAttrs: !1,
|
|
@@ -12,8 +16,8 @@ const C = /* @__PURE__ */ c({
|
|
|
12
16
|
options: {}
|
|
13
17
|
},
|
|
14
18
|
setup(t) {
|
|
15
|
-
const o = t, r = d(), { props: s } =
|
|
16
|
-
return (n, w) => (f(), l(e(
|
|
19
|
+
const o = t, r = d(), { props: s } = x();
|
|
20
|
+
return (n, w) => (f(), l(e(a), u(e(s), {
|
|
17
21
|
options: o.options
|
|
18
22
|
}), S({ _: 2 }, [
|
|
19
23
|
e(r).default ? {
|
|
@@ -25,13 +29,13 @@ const C = /* @__PURE__ */ c({
|
|
|
25
29
|
} : void 0
|
|
26
30
|
]), 1040, ["options"]));
|
|
27
31
|
}
|
|
28
|
-
}),
|
|
32
|
+
}), j = m(
|
|
29
33
|
C,
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
i({ dataSource: "options", disabled: !0 }),
|
|
35
|
+
k(v.Select)
|
|
32
36
|
);
|
|
33
37
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
j as Segmented,
|
|
39
|
+
j as default
|
|
36
40
|
};
|
|
37
41
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/segmented/segmented.vue","../../src/segmented/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/segmented/segmented.vue","../../src/segmented/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ElSegmented } from 'element-plus'\nimport { useSlots } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FSegmented',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: SegmentedOptions\n}>()\n\ntype SegmentedOption = NonNullable<InstanceType<typeof ElSegmented>['$props']['options']>[number]\n\ntype SegmentedOptions = SegmentedOption[]\n\nconst slots = useSlots()\nconst { props: segmentedProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElSegmented v-bind=\"segmentedProps\" :options=\"props.options\">\n <template v-if=\"slots.default\" #default=\"slotData\">\n <slot v-bind=\"slotData\" />\n </template>\n </ElSegmented>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FSegmented from './segmented.vue'\n\nexport const Segmented = connect<typeof FSegmented>(\n FSegmented,\n mapProps({ dataSource: 'options', disabled: true }),\n mapReadPretty(PreviewText.Select),\n)\n\nexport default Segmented\n"],"names":["props","__props","slots","useSlots","segmentedProps","useCleanAttrs","_createBlock","_unref","ElSegmented","_mergeProps","_withCtx","slotData","_renderSlot","_ctx","Segmented","connect","FSegmented","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,UAAMA,IAAQC,GAQRC,IAAQC,EAAA,GACR,EAAE,OAAOC,EAAA,IAAmBC,EAAA;2BAIhCC,EAIcC,EAAAC,CAAA,GAJdC,EAIcF,EAAAH,CAAA,GAJqB;AAAA,MAAG,SAASJ,EAAM;AAAA,IAAA;MACnCO,EAAAL,CAAA,EAAM;cAAU;AAAA,QAC9B,IAAAQ,EAAA,CADuCC,MAAQ;AAAA,UAC/CC,EAA0BC,yBAAZF,CAAQ,CAAA,CAAA;AAAA,QAAA;;;;;ICpBfG,IAAYC;AAAA,EACvBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,UAAU,IAAM;AAAA,EAClDC,EAAcC,EAAY,MAAM;AAClC;"}
|