@silver-formily/element-plus 2.4.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.
- 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 +18 -18
- 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.d.ts +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.mjs +0 -2
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +59 -63
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +31 -38
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +33 -36
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +38 -43
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -9
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +34 -38
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +39 -41
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -12
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +63 -68
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +11 -18
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +25 -29
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +16 -16
- package/esm/autocomplete/index.d.ts +8 -8
- package/esm/autocomplete/index.mjs +18 -24
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +18 -22
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +27 -27
- package/esm/checkbox/index.mjs +21 -30
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +6 -9
- package/esm/color-picker/index.mjs.map +1 -1
- package/esm/color-picker-panel/index.mjs +6 -9
- package/esm/color-picker-panel/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +11 -14
- 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 +11 -14
- package/esm/date-picker-panel/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +12 -12
- package/esm/editable/index.d.ts +6 -6
- package/esm/editable/index.mjs +49 -58
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.d.ts +1 -0
- package/esm/form/form.mjs +10 -10
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +14 -25
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -9
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +19 -22
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs +0 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/form-grid.d.ts +2 -2
- package/esm/form-grid/hooks.d.ts +1 -2
- package/esm/form-grid/hooks.mjs +4 -11
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +39 -40
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +57 -65
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +8 -6
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +12 -16
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +2 -2
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +27 -30
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs +0 -3
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.d.ts +2 -1
- package/esm/form-tab/hooks.mjs +13 -20
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +38 -41
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.mjs +76 -76
- package/esm/input/index.mjs +26 -30
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +15 -15
- package/esm/input-number/index.mjs +8 -11
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.mjs +16 -20
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +20 -24
- 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 +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +27 -40
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.mjs.map +1 -1
- package/esm/query-form/hooks.mjs.map +1 -1
- package/esm/query-form/index.d.ts +3 -3
- package/esm/query-form/index.mjs +55 -61
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form/query-form.d.ts +1 -1
- package/esm/query-form/types.d.ts +1 -1
- package/esm/query-form-item/index.mjs +37 -44
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.d.ts +18 -18
- package/esm/radio/index.mjs +30 -39
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +10 -13
- package/esm/rate/index.mjs.map +1 -1
- package/esm/reset/index.mjs +2 -2
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.mjs +13 -17
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.d.ts +16 -16
- package/esm/select/index.mjs +22 -26
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +6 -6
- package/esm/select-table/index.mjs +16 -21
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/slider/index.mjs +10 -13
- package/esm/slider/index.mjs.map +1 -1
- package/esm/styles/form-grid/index.css +1 -1
- package/esm/submit/index.mjs +3 -3
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +9 -9
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +6 -9
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.d.ts +12 -12
- package/esm/time-select/index.mjs +6 -9
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.d.ts +12 -12
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +29 -33
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs +0 -2
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +14 -18
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +12 -12
- package/esm/upload/index.mjs +10 -13
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +24 -24
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +111 -85
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +23 -29
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -7
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +56 -82
- package/LICENSE +0 -21
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { useField as j, connect as w, mapProps as D } from "@silver-formily/vue";
|
|
2
2
|
import { FormBaseItem as V, fieldFeedbackMapper as N } from "../form-item/index.mjs";
|
|
3
|
-
import { defineComponent as E, computed as y, ref as
|
|
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
4
|
import { createForm as X } from "@formily/core";
|
|
5
5
|
import { isNum as Y } from "@formily/shared";
|
|
6
6
|
import { ElPagination as Z } from "element-plus";
|
|
7
|
-
import {
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import
|
|
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({
|
|
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({
|
|
15
12
|
name: "FQueryFormItem",
|
|
16
13
|
inheritAttrs: !1,
|
|
17
14
|
__name: "query-form-item",
|
|
@@ -49,7 +46,7 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
49
46
|
},
|
|
50
47
|
emits: ["requestSuccess", "requestFailed"],
|
|
51
48
|
setup(B, { emit: I }) {
|
|
52
|
-
const e = B,
|
|
49
|
+
const e = B, p = I, m = {
|
|
53
50
|
currentPage: 1,
|
|
54
51
|
pageSize: 10,
|
|
55
52
|
pageSizes: [10, 20, 50, 100],
|
|
@@ -58,17 +55,17 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
58
55
|
}, q = {
|
|
59
56
|
current: "current",
|
|
60
57
|
pageSize: "pageSize"
|
|
61
|
-
}, Q = j(), _ = X(), f = `${
|
|
58
|
+
}, Q = j(), _ = X(), f = `${k}-query-form-item`, x = `${k}-form-item--isolated`, { props: O } = te(), M = y(() => {
|
|
62
59
|
const {
|
|
63
60
|
currentPage: t,
|
|
64
|
-
pageSize:
|
|
65
|
-
...
|
|
61
|
+
pageSize: r,
|
|
62
|
+
...a
|
|
66
63
|
} = {
|
|
67
64
|
...m,
|
|
68
65
|
...e.paginationProps
|
|
69
66
|
};
|
|
70
|
-
return
|
|
71
|
-
}), n =
|
|
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({
|
|
72
69
|
formProps: y(() => e.queryFormProps),
|
|
73
70
|
fallbackForm: _
|
|
74
71
|
}), $ = y(() => ({
|
|
@@ -85,38 +82,36 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
85
82
|
return;
|
|
86
83
|
const t = Q.value;
|
|
87
84
|
Array.isArray(t.dataSource) || (t.dataSource = []);
|
|
88
|
-
const
|
|
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 ? {
|
|
85
|
+
const r = ++l.value, a = F.value?.values ?? {}, i = e.pagination ? {
|
|
91
86
|
current: n.value,
|
|
92
87
|
pageSize: s.value
|
|
93
88
|
} : void 0, v = i ? {
|
|
94
|
-
...
|
|
89
|
+
...a,
|
|
95
90
|
[e.paginationMap.current ?? q.current]: i.current,
|
|
96
91
|
[e.paginationMap.pageSize ?? q.pageSize]: i.pageSize
|
|
97
|
-
} :
|
|
92
|
+
} : a;
|
|
98
93
|
t.loading = !0;
|
|
99
94
|
try {
|
|
100
95
|
const o = await e.request(v);
|
|
101
|
-
if (
|
|
96
|
+
if (r !== l.value)
|
|
102
97
|
return;
|
|
103
98
|
if (o.success !== !0) {
|
|
104
|
-
|
|
99
|
+
p("requestFailed", o);
|
|
105
100
|
return;
|
|
106
101
|
}
|
|
107
|
-
t.dataSource = o.data, e.clearOnDataChange && t.setValue?.(void 0), d.value = Y(o.total) ? o.total : o.data.length,
|
|
108
|
-
values:
|
|
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,
|
|
109
104
|
pagination: i,
|
|
110
105
|
dataSource: o.data,
|
|
111
106
|
total: d.value,
|
|
112
107
|
result: o
|
|
113
108
|
});
|
|
114
109
|
} catch (o) {
|
|
115
|
-
if (
|
|
110
|
+
if (r !== l.value)
|
|
116
111
|
return;
|
|
117
|
-
|
|
112
|
+
p("requestFailed", o);
|
|
118
113
|
} finally {
|
|
119
|
-
|
|
114
|
+
r === l.value && (t.loading = !1);
|
|
120
115
|
}
|
|
121
116
|
}
|
|
122
117
|
async function z() {
|
|
@@ -127,17 +122,15 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
127
122
|
await g();
|
|
128
123
|
}
|
|
129
124
|
function A(t) {
|
|
130
|
-
const
|
|
131
|
-
return
|
|
125
|
+
const r = e.queryFormProps.resetProps?.onClick, a = r?.(t);
|
|
126
|
+
return a === !1 ? !1 : (z(), a);
|
|
132
127
|
}
|
|
133
128
|
return U(() => {
|
|
134
129
|
e.immediate && g();
|
|
135
|
-
}), L([n, s], ([t,
|
|
136
|
-
/* istanbul ignore if -- @preserve defensive: watcher is retained when pagination is dynamically toggled off */
|
|
130
|
+
}), L([n, s], ([t, r], [a, i]) => {
|
|
137
131
|
if (!e.pagination)
|
|
138
132
|
return;
|
|
139
|
-
const v = t !==
|
|
140
|
-
/* istanbul ignore if -- @preserve defensive: keep guard for unexpected duplicated watcher payload */
|
|
133
|
+
const v = t !== a, o = r !== i;
|
|
141
134
|
if (!(!v && !o)) {
|
|
142
135
|
if (o && t !== 1) {
|
|
143
136
|
n.value = 1;
|
|
@@ -145,32 +138,32 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
145
138
|
}
|
|
146
139
|
g();
|
|
147
140
|
}
|
|
148
|
-
}), (t,
|
|
141
|
+
}), (t, r) => (P(), S(u(V), C(u(O), { "internal-form-item-class": x }), {
|
|
149
142
|
default: G(() => [
|
|
150
143
|
h("div", {
|
|
151
144
|
class: b(f)
|
|
152
145
|
}, [
|
|
153
|
-
(
|
|
146
|
+
(P(), S(H(e.mode === "light" ? u(R).Light : u(R)), J(K($.value)), null, 16)),
|
|
154
147
|
h("div", {
|
|
155
148
|
class: b(`${f}__content`)
|
|
156
149
|
}, [
|
|
157
|
-
|
|
150
|
+
T(t.$slots, "default")
|
|
158
151
|
], 2),
|
|
159
|
-
e.pagination ? (
|
|
152
|
+
e.pagination ? (P(), S(u(Z), C({
|
|
160
153
|
key: 0,
|
|
161
154
|
"current-page": n.value,
|
|
162
|
-
"onUpdate:currentPage":
|
|
155
|
+
"onUpdate:currentPage": r[0] || (r[0] = (a) => n.value = a),
|
|
163
156
|
"page-size": s.value,
|
|
164
|
-
"onUpdate:pageSize":
|
|
157
|
+
"onUpdate:pageSize": r[1] || (r[1] = (a) => s.value = a),
|
|
165
158
|
class: `${f}__pagination`
|
|
166
|
-
}, M.value, { total: d.value }), null, 16, ["current-page", "page-size", "class", "total"])) :
|
|
159
|
+
}, M.value, { total: d.value }), null, 16, ["current-page", "page-size", "class", "total"])) : W("", !0)
|
|
167
160
|
])
|
|
168
161
|
]),
|
|
169
162
|
_: 3
|
|
170
163
|
}, 16));
|
|
171
164
|
}
|
|
172
|
-
}),
|
|
173
|
-
|
|
165
|
+
}), fe = w(
|
|
166
|
+
ae,
|
|
174
167
|
D(
|
|
175
168
|
{
|
|
176
169
|
validateStatus: !0,
|
|
@@ -182,7 +175,7 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
182
175
|
)
|
|
183
176
|
);
|
|
184
177
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
fe as QueryFormItem,
|
|
179
|
+
fe as default
|
|
187
180
|
};
|
|
188
181
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +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,IAAWC,EAAA,GACXC,IAAoBC,EAAA,GACpBC,IAAY,GAAGC,CAAW,oBAC1BC,IAAwB,GAAGD,CAAW,wBACtC,EAAE,OAAOE,EAAA,IAAkBC,GAAA,GAE3BC,IAAqBC,EAAS,MAAM;AACxC,YAAM;AAAA,QACJ,aAAAC;AAAA,QACA,UAAAC;AAAA,QACA,GAAGC;AAAA,MAAA,IACD;AAAA,QACF,GAAGf;AAAA,QACH,GAAGJ,EAAM;AAAA,MAAA;AAEX,aAAOmB;AAAA,IACT,CAAC,GAEKC,IAAiBC,EAAIrB,EAAM,iBAAiB,eAAeI,EAAuB,WAAW,GAC7FkB,IAAcD,EAAIrB,EAAM,iBAAiB,YAAYI,EAAuB,QAAQ,GACpFmB,IAAWF,EAAI,CAAC,GAChBG,IAAmBH,EAAI,CAAC,GAExB,EAAE,YAAYI,EAAA,IAAoBC,GAAiB;AAAA,MACvD,WAAWV,EAAS,MAAMhB,EAAM,cAAc;AAAA,MAC9C,cAAcQ;AAAA,IAAA,CACf,GAEKmB,IAAoBX,EAAS,OACzB;AAAA,MACN,GAAGhB,EAAM;AAAA,MACT,QAAQA,EAAM,eAAeA,EAAM,eAAe;AAAA,MAClD,MAAMyB,E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,EAAA,QAAA,SAAA;AAAA,UAAA;UAGFzD,EAAM,cADd+C,EAAA,GAAAC,EAOEC,MAPFC,EAOE;AAAA;YALQ,gBAAc9B,EAAA;AAAA,2DAAAA,EAAc,QAAAsC;AAAA,YAC5B,aAAWpC,EAAA;AAAA,wDAAAA,EAAW,QAAAoC;AAAA,YAC7B,UAAUhD,CAAS;AAAA,UAAA,GACZK,EAAA,OAAkB,EACzB,OAAOQ,EAAA,MAAA,CAAQ,GAAA,MAAA,IAAA,CAAA,gBAAA,aAAA,SAAA,OAAA,CAAA;;;;;;ICnOXoC,KAAgBC;AAAA,EAC3BC;AAAAA,EACAC;AAAA,IACE;AAAA,MACE,gBAAgB;AAAA,MAChB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEfC;AAAA,EAAA;AAEJ;"}
|
|
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,GAAGC,CAAW,oBAC1BC,IAAwB,GAA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|
type: import('vue').PropType<string>;
|
|
256
256
|
default: undefined;
|
|
257
257
|
};
|
|
258
|
-
|
|
259
|
-
type: import('vue').PropType<
|
|
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
|
-
|
|
267
|
-
type: import('vue').PropType<
|
|
268
|
-
default:
|
|
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
|
-
|
|
328
|
-
type: import('vue').PropType<
|
|
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
|
-
|
|
336
|
-
type: import('vue').PropType<
|
|
337
|
-
default:
|
|
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
|
-
|
|
391
|
-
type: import('vue').PropType<
|
|
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
|
-
|
|
399
|
-
type: import('vue').PropType<
|
|
400
|
-
default:
|
|
398
|
+
fill: {
|
|
399
|
+
type: import('vue').PropType<string>;
|
|
400
|
+
default: "";
|
|
401
401
|
};
|
|
402
402
|
id: {
|
|
403
403
|
type: import('vue').PropType<string>;
|
package/esm/radio/index.mjs
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
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
|
|
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({
|
|
3
|
+
import { PreviewText as O } from "../preview-text/index.mjs";
|
|
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
|
+
import { isPlainObj as F } from "@formily/shared";
|
|
6
|
+
import { useCleanAttrs as N, composeExport as z } from "../__builtins__/shared/utils.mjs";
|
|
7
|
+
import { lt as H } from "../__builtins__/shared/simple-version-compare.mjs";
|
|
8
|
+
import { mapReadPretty as I } from "../__builtins__/shared/transform-component.mjs";
|
|
9
|
+
import '../styles/radio/index.css';const V = /* @__PURE__ */ x({
|
|
14
10
|
name: "FRadioGroup",
|
|
15
11
|
__name: "radio-group",
|
|
16
12
|
props: {
|
|
@@ -24,35 +20,30 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ O({
|
|
|
24
20
|
}
|
|
25
21
|
},
|
|
26
22
|
setup(P) {
|
|
27
|
-
const o = P, { props: R } =
|
|
28
|
-
function
|
|
29
|
-
return
|
|
23
|
+
const o = P, { props: R } = N(), l = c(() => o.optionType === "button" ? B : v), S = H(G, "2.6.0");
|
|
24
|
+
function i(e) {
|
|
25
|
+
return F(e);
|
|
30
26
|
}
|
|
31
27
|
function g(e, n) {
|
|
32
|
-
return
|
|
28
|
+
return i(o.options[n]) ? o.options[n].label : e.label;
|
|
33
29
|
}
|
|
34
|
-
const m = c(() => o.options.map((e) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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 })
|
|
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
|
|
36
|
+
})), k = A();
|
|
37
|
+
return (e, n) => (t(), p(u(C), L(h(u(R))), {
|
|
38
|
+
default: s(() => [
|
|
39
|
+
u(k).option ? (t(!0), f(d, { key: 1 }, _(m.value, (r, a) => (t(), p(y(l.value), b({ key: a }, { ref_for: !0 }, r), {
|
|
40
|
+
default: s(() => [
|
|
41
|
+
D(e.$slots, "option", { option: r })
|
|
51
42
|
]),
|
|
52
43
|
_: 2
|
|
53
|
-
}, 1040))), 128)) : (t(!0), f(d, { key: 0 }, _(m.value, (r, a) => (t(), p(y(
|
|
54
|
-
default:
|
|
55
|
-
|
|
44
|
+
}, 1040))), 128)) : (t(!0), f(d, { key: 0 }, _(m.value, (r, a) => (t(), p(y(l.value), b({ key: a }, { ref_for: !0 }, r), {
|
|
45
|
+
default: s(() => [
|
|
46
|
+
j(w(g(r, a)), 1)
|
|
56
47
|
]),
|
|
57
48
|
_: 2
|
|
58
49
|
}, 1040))), 128))
|
|
@@ -63,12 +54,12 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ O({
|
|
|
63
54
|
}), $ = E(
|
|
64
55
|
V,
|
|
65
56
|
T({ dataSource: "options", disabled: !0 }),
|
|
66
|
-
|
|
67
|
-
),
|
|
57
|
+
I(O.Select)
|
|
58
|
+
), Y = z(v, {
|
|
68
59
|
Group: $
|
|
69
60
|
});
|
|
70
61
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
Y as Radio,
|
|
63
|
+
Y as default
|
|
73
64
|
};
|
|
74
65
|
//# 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\">\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":"
|
|
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,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
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
o,
|
|
10
|
-
t({ readOnly: "readonly", disabled: !0 }),
|
|
11
|
-
e(m.Rate)
|
|
1
|
+
import { connect as e, mapProps as r } from "@silver-formily/vue";
|
|
2
|
+
import { ElRate as t } from "element-plus";
|
|
3
|
+
import { PreviewText as o } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as a } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const f = e(
|
|
6
|
+
t,
|
|
7
|
+
r({ readOnly: "readonly", disabled: !0 }),
|
|
8
|
+
a(o.Rate)
|
|
12
9
|
);
|
|
13
10
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
f as Rate,
|
|
12
|
+
f as default
|
|
16
13
|
};
|
|
17
14
|
//# 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'\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":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/rate/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElRate } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport type RateProps = typeof ElRate\r\n\r\nexport const Rate = connect<typeof ElRate>(\r\n ElRate,\r\n mapProps({ readOnly: 'readonly', disabled: true }),\r\n mapReadPretty(PreviewText.Rate),\r\n)\r\n\r\nexport default Rate\r\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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { observer as s } from "@silver-formily/reactive-vue";
|
|
2
|
-
import { defineComponent as c,
|
|
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) => (
|
|
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
|
]),
|
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>\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;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/reset/reset.vue","../../src/reset/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { PropType } from 'vue'\r\nimport { useParentForm } from '@silver-formily/vue'\r\nimport { ElButton } from 'element-plus'\r\n\r\ndefineOptions({\r\n name: 'FReset',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\r\n onClick: Function as PropType<(e: MouseEvent) => void | boolean>,\r\n forceClear: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n validate: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n onResetValidateSuccess: Function as PropType<(payload: any) => void>,\r\n onResetValidateFailed: Function as PropType<(error: any) => void>,\r\n})\r\n\r\nconst formRef = useParentForm()\r\n\r\nfunction handleClick(e: MouseEvent) {\r\n if (props.onClick && (props.onClick)?.(e) === false)\r\n return\r\n\r\n const form = formRef?.value\r\n form?.reset('*', {\r\n forceClear: props.forceClear,\r\n })\r\n props.validate && form?.validate()\r\n .then(props.onResetValidateSuccess)\r\n .catch(error => props.onResetValidateFailed?.(error))\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElButton v-bind=\"$attrs\" @click=\"handleClick\">\r\n <slot />\r\n </ElButton>\r\n</template>\r\n","import { observer } from '@silver-formily/reactive-vue'\r\nimport FReset from './reset.vue'\r\n\r\nexport const Reset = observer(FReset)\r\n\r\nexport default Reset\r\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,13 +1,9 @@
|
|
|
1
|
-
import { connect as m, mapProps as
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import { mapReadPretty as
|
|
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";
|
|
1
|
+
import { connect as m, mapProps as a } from "@silver-formily/vue";
|
|
2
|
+
import { PreviewText as i } from "../preview-text/index.mjs";
|
|
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
|
+
import { ElSegmented as k } from "element-plus";
|
|
5
|
+
import { useCleanAttrs as v } from "../__builtins__/shared/utils.mjs";
|
|
6
|
+
import { mapReadPretty as x } from "../__builtins__/shared/transform-component.mjs";
|
|
11
7
|
const C = /* @__PURE__ */ c({
|
|
12
8
|
name: "FSegmented",
|
|
13
9
|
inheritAttrs: !1,
|
|
@@ -16,8 +12,8 @@ const C = /* @__PURE__ */ c({
|
|
|
16
12
|
options: {}
|
|
17
13
|
},
|
|
18
14
|
setup(t) {
|
|
19
|
-
const o = t, r = d(), { props: s } =
|
|
20
|
-
return (n, w) => (
|
|
15
|
+
const o = t, r = d(), { props: s } = v();
|
|
16
|
+
return (n, w) => (l(), f(e(k), u(e(s), {
|
|
21
17
|
options: o.options
|
|
22
18
|
}), S({ _: 2 }, [
|
|
23
19
|
e(r).default ? {
|
|
@@ -29,13 +25,13 @@ const C = /* @__PURE__ */ c({
|
|
|
29
25
|
} : void 0
|
|
30
26
|
]), 1040, ["options"]));
|
|
31
27
|
}
|
|
32
|
-
}),
|
|
28
|
+
}), E = m(
|
|
33
29
|
C,
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
a({ dataSource: "options", disabled: !0 }),
|
|
31
|
+
x(i.Select)
|
|
36
32
|
);
|
|
37
33
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
E as Segmented,
|
|
35
|
+
E as default
|
|
40
36
|
};
|
|
41
37
|
//# 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\">\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":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/segmented/segmented.vue","../../src/segmented/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { ElSegmented } from 'element-plus'\r\nimport { useSlots } from 'vue'\r\nimport { useCleanAttrs } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FSegmented',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps<{\r\n options?: SegmentedOptions\r\n}>()\r\n\r\ntype SegmentedOption = NonNullable<InstanceType<typeof ElSegmented>['$props']['options']>[number]\r\n\r\ntype SegmentedOptions = SegmentedOption[]\r\n\r\nconst slots = useSlots()\r\nconst { props: segmentedProps } = useCleanAttrs()\r\n</script>\r\n\r\n<template>\r\n <ElSegmented v-bind=\"segmentedProps\" :options=\"props.options\">\r\n <template v-if=\"slots.default\" #default=\"slotData\">\r\n <slot v-bind=\"slotData\" />\r\n </template>\r\n </ElSegmented>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FSegmented from './segmented.vue'\r\n\r\nexport const Segmented = connect<typeof FSegmented>(\r\n FSegmented,\r\n mapProps({ dataSource: 'options', disabled: true }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\n\r\nexport default Segmented\r\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;"}
|