@silver-formily/element-plus 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__builtins__/shared/loading.mjs +1 -1
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.mjs +57 -16
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
- package/esm/array-base/index.mjs +21 -22
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/utils.mjs +17 -18
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +11 -12
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +26 -27
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +3 -4
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +20 -21
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +28 -29
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -6
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +52 -53
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +10 -11
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +40 -43
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/index.mjs +4 -5
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +7 -8
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.mjs +4 -5
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +1 -1
- package/esm/color-picker-panel/index.mjs +1 -1
- package/esm/date-picker/index.mjs +1 -1
- package/esm/date-picker-panel/index.mjs +1 -1
- package/esm/editable/index.mjs +28 -29
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +8 -9
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +3 -4
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +4 -5
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-grid/index.mjs +3 -4
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +4 -5
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +3 -4
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-step/index.mjs +12 -13
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-tab/index.mjs +19 -20
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/input/index.mjs +13 -14
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.mjs +1 -1
- package/esm/input-tag/index.mjs +12 -13
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +12 -13
- package/esm/mention/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +4 -5
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/query-form/index.mjs +135 -136
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form-item/index.mjs +23 -24
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.mjs +4 -5
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +1 -1
- package/esm/segmented/index.mjs +4 -5
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.mjs +13 -14
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +4 -5
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/slider/index.mjs +1 -1
- package/esm/time-picker/index.mjs +1 -1
- package/esm/time-select/index.d.ts +8 -8
- package/esm/time-select/index.mjs +1 -1
- package/esm/tree/index.mjs +8 -9
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree-select/index.mjs +4 -5
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.mjs +36 -40
- package/esm/upload/index.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -5,13 +5,12 @@ 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
7
|
import { stylePrefix as R } from "../__builtins__/configs/index.mjs";
|
|
8
|
-
import "@formily/reactive";
|
|
9
|
-
import "@vueuse/core";
|
|
10
8
|
import "@silver-formily/reactive-vue";
|
|
9
|
+
import "@vueuse/core";
|
|
11
10
|
import { useCleanAttrs as ee } from "../__builtins__/shared/utils.mjs";
|
|
12
11
|
import { QueryForm as k } from "../query-form/index.mjs";
|
|
13
12
|
import { useQueryFormForm as te } from "../query-form/hooks.mjs";
|
|
14
|
-
import '../styles/query-form-item/index.css';const
|
|
13
|
+
import '../styles/query-form-item/index.css';const ae = /* @__PURE__ */ E({
|
|
15
14
|
name: "FQueryFormItem",
|
|
16
15
|
inheritAttrs: !1,
|
|
17
16
|
__name: "query-form-item",
|
|
@@ -61,13 +60,13 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
61
60
|
}, Q = j(), _ = X(), f = `${R}-query-form-item`, x = `${R}-form-item--isolated`, { props: O } = ee(), M = y(() => {
|
|
62
61
|
const {
|
|
63
62
|
currentPage: t,
|
|
64
|
-
pageSize:
|
|
65
|
-
...
|
|
63
|
+
pageSize: r,
|
|
64
|
+
...a
|
|
66
65
|
} = {
|
|
67
66
|
...m,
|
|
68
67
|
...e.paginationProps
|
|
69
68
|
};
|
|
70
|
-
return
|
|
69
|
+
return a;
|
|
71
70
|
}), n = p(e.paginationProps?.currentPage ?? m.currentPage), s = p(e.paginationProps?.pageSize ?? m.pageSize), d = p(0), l = p(0), { activeForm: F } = te({
|
|
72
71
|
formProps: y(() => e.queryFormProps),
|
|
73
72
|
fallbackForm: _
|
|
@@ -85,36 +84,36 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
85
84
|
return;
|
|
86
85
|
const t = Q.value;
|
|
87
86
|
Array.isArray(t.dataSource) || (t.dataSource = []);
|
|
88
|
-
const
|
|
87
|
+
const r = ++l.value, a = F.value?.values ?? {}, i = e.pagination ? {
|
|
89
88
|
current: n.value,
|
|
90
89
|
pageSize: s.value
|
|
91
90
|
} : void 0, v = i ? {
|
|
92
|
-
...
|
|
91
|
+
...a,
|
|
93
92
|
[e.paginationMap.current ?? q.current]: i.current,
|
|
94
93
|
[e.paginationMap.pageSize ?? q.pageSize]: i.pageSize
|
|
95
|
-
} :
|
|
94
|
+
} : a;
|
|
96
95
|
t.loading = !0;
|
|
97
96
|
try {
|
|
98
97
|
const o = await e.request(v);
|
|
99
|
-
if (
|
|
98
|
+
if (r !== l.value)
|
|
100
99
|
return;
|
|
101
100
|
if (o.success !== !0) {
|
|
102
101
|
c("requestFailed", o);
|
|
103
102
|
return;
|
|
104
103
|
}
|
|
105
104
|
t.dataSource = o.data, e.clearOnDataChange && t.setValue?.(void 0), d.value = Y(o.total) ? o.total : o.data.length, c("requestSuccess", {
|
|
106
|
-
values:
|
|
105
|
+
values: a,
|
|
107
106
|
pagination: i,
|
|
108
107
|
dataSource: o.data,
|
|
109
108
|
total: d.value,
|
|
110
109
|
result: o
|
|
111
110
|
});
|
|
112
111
|
} catch (o) {
|
|
113
|
-
if (
|
|
112
|
+
if (r !== l.value)
|
|
114
113
|
return;
|
|
115
114
|
c("requestFailed", o);
|
|
116
115
|
} finally {
|
|
117
|
-
|
|
116
|
+
r === l.value && (t.loading = !1);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
async function z() {
|
|
@@ -125,15 +124,15 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
125
124
|
await g();
|
|
126
125
|
}
|
|
127
126
|
function A(t) {
|
|
128
|
-
const
|
|
129
|
-
return
|
|
127
|
+
const r = e.queryFormProps.resetProps?.onClick, a = r?.(t);
|
|
128
|
+
return a === !1 ? !1 : (z(), a);
|
|
130
129
|
}
|
|
131
130
|
return U(() => {
|
|
132
131
|
e.immediate && g();
|
|
133
|
-
}), L([n, s], ([t,
|
|
132
|
+
}), L([n, s], ([t, r], [a, i]) => {
|
|
134
133
|
if (!e.pagination)
|
|
135
134
|
return;
|
|
136
|
-
const v = t !==
|
|
135
|
+
const v = t !== a, o = r !== i;
|
|
137
136
|
if (!(!v && !o)) {
|
|
138
137
|
if (o && t !== 1) {
|
|
139
138
|
n.value = 1;
|
|
@@ -141,7 +140,7 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
141
140
|
}
|
|
142
141
|
g();
|
|
143
142
|
}
|
|
144
|
-
}), (t,
|
|
143
|
+
}), (t, r) => (P(), S(u(V), C(u(O), { "internal-form-item-class": x }), {
|
|
145
144
|
default: G(() => [
|
|
146
145
|
h("div", {
|
|
147
146
|
class: b(f)
|
|
@@ -155,9 +154,9 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
155
154
|
e.pagination ? (P(), S(u(Z), C({
|
|
156
155
|
key: 0,
|
|
157
156
|
"current-page": n.value,
|
|
158
|
-
"onUpdate:currentPage":
|
|
157
|
+
"onUpdate:currentPage": r[0] || (r[0] = (a) => n.value = a),
|
|
159
158
|
"page-size": s.value,
|
|
160
|
-
"onUpdate:pageSize":
|
|
159
|
+
"onUpdate:pageSize": r[1] || (r[1] = (a) => s.value = a),
|
|
161
160
|
class: `${f}__pagination`
|
|
162
161
|
}, M.value, { total: d.value }), null, 16, ["current-page", "page-size", "class", "total"])) : W("", !0)
|
|
163
162
|
])
|
|
@@ -165,8 +164,8 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
165
164
|
_: 3
|
|
166
165
|
}, 16));
|
|
167
166
|
}
|
|
168
|
-
}),
|
|
169
|
-
|
|
167
|
+
}), ge = w(
|
|
168
|
+
ae,
|
|
170
169
|
D(
|
|
171
170
|
{
|
|
172
171
|
validateStatus: !0,
|
|
@@ -178,7 +177,7 @@ import '../styles/query-form-item/index.css';const re = /* @__PURE__ */ E({
|
|
|
178
177
|
)
|
|
179
178
|
);
|
|
180
179
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
ge as QueryFormItem,
|
|
181
|
+
ge as default
|
|
183
182
|
};
|
|
184
183
|
//# 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;AAA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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\">\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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AgBC;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;"}
|
package/esm/radio/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import { defineComponent as O, computed as c, useSlots as x, openBlock as t, createBlock as p, 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
6
|
import { mapReadPretty as D } from "../__builtins__/shared/transform-component.mjs";
|
|
@@ -9,7 +9,6 @@ import { PreviewText as z } from "../preview-text/index.mjs";
|
|
|
9
9
|
import { isPlainObj as H } from "@formily/shared";
|
|
10
10
|
import { lt as I } from "../__builtins__/shared/simple-version-compare.mjs";
|
|
11
11
|
import "@formily/core";
|
|
12
|
-
import "@silver-formily/reactive-vue";
|
|
13
12
|
import '../styles/radio/index.css';const V = /* @__PURE__ */ O({
|
|
14
13
|
name: "FRadioGroup",
|
|
15
14
|
__name: "radio-group",
|
|
@@ -59,11 +58,11 @@ import '../styles/radio/index.css';const V = /* @__PURE__ */ O({
|
|
|
59
58
|
V,
|
|
60
59
|
T({ dataSource: "options", disabled: !0 }),
|
|
61
60
|
D(z.Select)
|
|
62
|
-
),
|
|
61
|
+
), re = N(v, {
|
|
63
62
|
Group: $
|
|
64
63
|
});
|
|
65
64
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
re as Radio,
|
|
66
|
+
re as default
|
|
68
67
|
};
|
|
69
68
|
//# 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\">\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,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,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,6 +1,6 @@
|
|
|
1
1
|
import { connect as r, mapProps as t } from "@silver-formily/vue";
|
|
2
2
|
import { ElRate as o } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "vue";
|
|
6
6
|
import { mapReadPretty as e } from "../__builtins__/shared/transform-component.mjs";
|
package/esm/segmented/index.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { connect as m, mapProps as i } from "@silver-formily/vue";
|
|
2
2
|
import { ElSegmented as a } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
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";
|
|
6
6
|
import { mapReadPretty as k } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { PreviewText as v } from "../preview-text/index.mjs";
|
|
8
8
|
import "@formily/core";
|
|
9
|
-
import "@silver-formily/reactive-vue";
|
|
10
9
|
import { useCleanAttrs as x } from "../__builtins__/shared/utils.mjs";
|
|
11
10
|
const C = /* @__PURE__ */ c({
|
|
12
11
|
name: "FSegmented",
|
|
@@ -29,13 +28,13 @@ const C = /* @__PURE__ */ c({
|
|
|
29
28
|
} : void 0
|
|
30
29
|
]), 1040, ["options"]));
|
|
31
30
|
}
|
|
32
|
-
}),
|
|
31
|
+
}), $ = m(
|
|
33
32
|
C,
|
|
34
33
|
i({ dataSource: "options", disabled: !0 }),
|
|
35
34
|
k(v.Select)
|
|
36
35
|
);
|
|
37
36
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
$ as Segmented,
|
|
38
|
+
$ as default
|
|
40
39
|
};
|
|
41
40
|
//# 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\">\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;"}
|
package/esm/select/index.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useField as S, connect as b, mapProps as P } from "@silver-formily/vue";
|
|
2
2
|
import { ElSelect as h, ElOptionGroup as C, ElOption as y } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
-
import { defineComponent as E, useSlots as K, openBlock as s, createBlock as
|
|
5
|
+
import { defineComponent as E, useSlots as K, openBlock as s, createBlock as f, unref as e, normalizeProps as _, guardReactiveProps as B, createSlots as F, withCtx as t, createElementBlock as m, Fragment as u, renderList as c, mergeProps as d, renderSlot as n, createCommentVNode as k } from "vue";
|
|
6
6
|
import { mapReadPretty as R } from "../__builtins__/shared/transform-component.mjs";
|
|
7
7
|
import { PreviewText as w } from "../preview-text/index.mjs";
|
|
8
8
|
import "@formily/core";
|
|
9
|
-
import "@silver-formily/reactive-vue";
|
|
10
9
|
import { useCleanAttrs as A } from "../__builtins__/shared/utils.mjs";
|
|
11
10
|
import { o as G } from "../vendor/lodash.mjs";
|
|
12
11
|
const O = /* @__PURE__ */ E({
|
|
@@ -17,21 +16,21 @@ const O = /* @__PURE__ */ E({
|
|
|
17
16
|
options: {}
|
|
18
17
|
},
|
|
19
18
|
setup(v) {
|
|
20
|
-
const g = v, l = K(), { props: i } = A(),
|
|
19
|
+
const g = v, l = K(), { props: i } = A(), p = S();
|
|
21
20
|
function $(o) {
|
|
22
21
|
return o.options !== void 0;
|
|
23
22
|
}
|
|
24
|
-
return (o, z) => (s(),
|
|
23
|
+
return (o, z) => (s(), f(e(h), _(B(e(i))), F({
|
|
25
24
|
default: t(() => [
|
|
26
25
|
(s(!0), m(u, null, c(g.options, (r) => (s(), m(u, null, [
|
|
27
|
-
$(r) ? (s(),
|
|
26
|
+
$(r) ? (s(), f(e(C), d({
|
|
28
27
|
key: 0,
|
|
29
28
|
ref_for: !0
|
|
30
29
|
}, e(G)(r, "options"), {
|
|
31
30
|
key: r.label
|
|
32
31
|
}), {
|
|
33
32
|
default: t(() => [
|
|
34
|
-
(s(!0), m(u, null, c(r.options, (a) => (s(),
|
|
33
|
+
(s(!0), m(u, null, c(r.options, (a) => (s(), f(e(y), d({
|
|
35
34
|
key: e(i).valueKey ? a[e(i).valueKey] : a.label
|
|
36
35
|
}, { ref_for: !0 }, a), {
|
|
37
36
|
default: t(() => [
|
|
@@ -44,7 +43,7 @@ const O = /* @__PURE__ */ E({
|
|
|
44
43
|
}, 1040))), 128))
|
|
45
44
|
]),
|
|
46
45
|
_: 2
|
|
47
|
-
}, 1040)) : (s(),
|
|
46
|
+
}, 1040)) : (s(), f(e(y), d({
|
|
48
47
|
key: 1,
|
|
49
48
|
ref_for: !0
|
|
50
49
|
}, r, {
|
|
@@ -65,14 +64,14 @@ const O = /* @__PURE__ */ E({
|
|
|
65
64
|
l.header ? {
|
|
66
65
|
name: "header",
|
|
67
66
|
fn: t(() => [
|
|
68
|
-
n(o.$slots, "header", { field: e(
|
|
67
|
+
n(o.$slots, "header", { field: e(p) })
|
|
69
68
|
]),
|
|
70
69
|
key: "0"
|
|
71
70
|
} : void 0,
|
|
72
71
|
l.footer ? {
|
|
73
72
|
name: "footer",
|
|
74
73
|
fn: t(() => [
|
|
75
|
-
n(o.$slots, "footer", { field: e(
|
|
74
|
+
n(o.$slots, "footer", { field: e(p) })
|
|
76
75
|
]),
|
|
77
76
|
key: "1"
|
|
78
77
|
} : void 0,
|
|
@@ -93,7 +92,7 @@ const O = /* @__PURE__ */ E({
|
|
|
93
92
|
l.tag ? {
|
|
94
93
|
name: "tag",
|
|
95
94
|
fn: t(() => [
|
|
96
|
-
n(o.$slots, "tag", { field: e(
|
|
95
|
+
n(o.$slots, "tag", { field: e(p) })
|
|
97
96
|
]),
|
|
98
97
|
key: "4"
|
|
99
98
|
} : void 0,
|
|
@@ -116,13 +115,13 @@ const O = /* @__PURE__ */ E({
|
|
|
116
115
|
} : void 0
|
|
117
116
|
]), 1040));
|
|
118
117
|
}
|
|
119
|
-
}),
|
|
118
|
+
}), M = b(
|
|
120
119
|
O,
|
|
121
120
|
P({ dataSource: "options", loading: !0, disabled: !0 }),
|
|
122
121
|
R(w.Select)
|
|
123
122
|
);
|
|
124
123
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
M as Select,
|
|
125
|
+
M as default
|
|
127
126
|
};
|
|
128
127
|
//# sourceMappingURL=index.mjs.map
|
package/esm/select/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/select/select.vue","../../src/select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useField } from '@silver-formily/vue'\nimport { ElOption, ElOptionGroup, ElSelect } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelect',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: Array<OptionType | OptionGroupType>\n}>()\n\nconst slots = defineSlots<{\n option?: (props: { option: OptionType }) => any\n header?: () => any\n footer?: () => any\n prefix?: () => any\n empty?: () => any\n tag?: () => any\n loading?: () => any\n label?: () => any\n}>()\n\ntype OptionType = InstanceType<typeof ElOption>['$props']\ntype OptionGroupType = InstanceType<typeof ElOptionGroup>['$props'] & {\n options: OptionType[]\n}\n\nconst { props: selectProps } = useCleanAttrs()\n\nconst fieldRef = useField()\n\nfunction isGroup(option: OptionType | OptionGroupType): option is OptionGroupType {\n return (option as OptionGroupType).options !== undefined\n}\n</script>\n\n<template>\n <ElSelect v-bind=\"selectProps\">\n <template v-for=\"option of props.options\">\n <template v-if=\"isGroup(option)\">\n <ElOptionGroup v-bind=\"omit(option, 'options')\" :key=\"option.label\">\n <ElOption v-for=\"i of option.options\" :key=\"selectProps.valueKey ? i[selectProps.valueKey] : i.label\" v-bind=\"i\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"i\" />\n </ElOption>\n </ElOptionGroup>\n </template>\n <ElOption v-else v-bind=\"option\" :key=\"selectProps.valueKey ? option[selectProps.valueKey] : option.label\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"option\" />\n </ElOption>\n </template>\n <template v-if=\"slots.header\" #header>\n <slot name=\"header\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.footer\" #footer>\n <slot name=\"footer\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n <template v-if=\"slots.tag\" #tag>\n <slot name=\"tag\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.loading\" #loading>\n <slot name=\"loading\" />\n </template>\n <template v-if=\"slots.label\" #label=\"{ label, value: labelValue }\">\n <slot name=\"label\" :label=\"label\" :value=\"labelValue\" />\n </template>\n </ElSelect>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FSelect from './select.vue'\n\nexport const Select = connect<typeof FSelect>(\n FSelect,\n mapProps({ dataSource: 'options', loading: true, disabled: true }),\n mapReadPretty(PreviewText.Select),\n)\n\nexport default Select\n"],"names":["props","__props","slots","_useSlots","selectProps","useCleanAttrs","fieldRef","useField","isGroup","option","_openBlock","_createBlock","_unref","_createSlots","_createElementBlock","_Fragment","_renderList","_mergeProps","omit","i","_renderSlot","_ctx","label","labelValue","Select","connect","FSelect","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/select/select.vue","../../src/select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useField } from '@silver-formily/vue'\nimport { ElOption, ElOptionGroup, ElSelect } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelect',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: Array<OptionType | OptionGroupType>\n}>()\n\nconst slots = defineSlots<{\n option?: (props: { option: OptionType }) => any\n header?: () => any\n footer?: () => any\n prefix?: () => any\n empty?: () => any\n tag?: () => any\n loading?: () => any\n label?: () => any\n}>()\n\ntype OptionType = InstanceType<typeof ElOption>['$props']\ntype OptionGroupType = InstanceType<typeof ElOptionGroup>['$props'] & {\n options: OptionType[]\n}\n\nconst { props: selectProps } = useCleanAttrs()\n\nconst fieldRef = useField()\n\nfunction isGroup(option: OptionType | OptionGroupType): option is OptionGroupType {\n return (option as OptionGroupType).options !== undefined\n}\n</script>\n\n<template>\n <ElSelect v-bind=\"selectProps\">\n <template v-for=\"option of props.options\">\n <template v-if=\"isGroup(option)\">\n <ElOptionGroup v-bind=\"omit(option, 'options')\" :key=\"option.label\">\n <ElOption v-for=\"i of option.options\" :key=\"selectProps.valueKey ? i[selectProps.valueKey] : i.label\" v-bind=\"i\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"i\" />\n </ElOption>\n </ElOptionGroup>\n </template>\n <ElOption v-else v-bind=\"option\" :key=\"selectProps.valueKey ? option[selectProps.valueKey] : option.label\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"option\" />\n </ElOption>\n </template>\n <template v-if=\"slots.header\" #header>\n <slot name=\"header\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.footer\" #footer>\n <slot name=\"footer\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n <template v-if=\"slots.tag\" #tag>\n <slot name=\"tag\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.loading\" #loading>\n <slot name=\"loading\" />\n </template>\n <template v-if=\"slots.label\" #label=\"{ label, value: labelValue }\">\n <slot name=\"label\" :label=\"label\" :value=\"labelValue\" />\n </template>\n </ElSelect>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FSelect from './select.vue'\n\nexport const Select = connect<typeof FSelect>(\n FSelect,\n mapProps({ dataSource: 'options', loading: true, disabled: true }),\n mapReadPretty(PreviewText.Select),\n)\n\nexport default Select\n"],"names":["props","__props","slots","_useSlots","selectProps","useCleanAttrs","fieldRef","useField","isGroup","option","_openBlock","_createBlock","_unref","_createSlots","_createElementBlock","_Fragment","_renderList","_mergeProps","omit","i","_renderSlot","_ctx","label","labelValue","Select","connect","FSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAgBR,EAAE,OAAOC,EAAA,IAAgBC,EAAA,GAEzBC,IAAWC,EAAA;AAEjB,aAASC,EAAQC,GAAiE;AAChF,aAAQA,EAA2B,YAAY;AAAA,IACjD;sBAIEC,EAAA,GAAAC,EAkCWC,UAlCOA,EAAAR,CAAA,CAAW,CAAA,GAAAS,EAAA;AAAA,iBACjB,MAA+B;AAAA,SAAzCH,EAAA,EAAA,GAAAI,EAWWC,GAAA,MAAAC,EAXgBhB,EAAM,UAAhBS;UACCD,EAAQC,CAAM,KAC5BC,EAAA,GAAAC,EAIgBC,MAJhBK,EAIgB;AAAA;;aAJOL,EAAAM,CAAA,EAAKT,GAAM,SAAA,GAAA;AAAA,YAAe,KAAKA,EAAO;AAAA,UAAA;uBACjD,MAA2B;AAAA,eAArCC,EAAA,EAAA,GAAAI,EAEWC,GAAA,MAAAC,EAFWP,EAAO,UAAZU,OAAjBT,KAAAC,EAEWC,MAFXK,EAEW;AAAA,gBAF4B,KAAKL,EAAAR,CAAA,EAAY,WAAWe,EAAEP,EAAAR,CAAA,EAAY,QAAQ,IAAIe,EAAE;AAAA,cAAA,oBAAeA,CAAC,GAAA;AAAA,2BAC7G,MAAsD;AAAA,kBAA1CjB,EAAM,SAAlBkB,EAAsDC,EAAA,QAAA,UAAA;AAAA;oBAAb,QAAQF;AAAA,kBAAA;;;;;;uBAIvD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,UAAU,IAAM;AAAA,EACjEC,EAAcC,EAAY,MAAM;AAClC;"}
|
|
@@ -3,11 +3,10 @@ import { defineComponent as U, ref as g, computed as j, watch as R, nextTick as
|
|
|
3
3
|
import { isValid as te, isEqual as oe, isFn as ae } from "@formily/shared";
|
|
4
4
|
import { useAttrs as re, ElLink as ne, version as E, ElTable as ue, ElTableColumn as b, ElRadioGroup as ie, ElRadio as se, vLoading as ce } from "element-plus";
|
|
5
5
|
import { stylePrefix as x } from "../__builtins__/configs/index.mjs";
|
|
6
|
-
import "@formily/reactive";
|
|
6
|
+
import "@silver-formily/reactive-vue";
|
|
7
7
|
import "@vueuse/core";
|
|
8
8
|
import { lt as K } from "../__builtins__/shared/simple-version-compare.mjs";
|
|
9
9
|
import "@formily/core";
|
|
10
|
-
import "@silver-formily/reactive-vue";
|
|
11
10
|
import { u as L, x as de, d as me, a as fe, r as pe } from "../vendor/lodash.mjs";
|
|
12
11
|
import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
|
|
13
12
|
name: "FSelectTable",
|
|
@@ -194,12 +193,12 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
|
|
|
194
193
|
])
|
|
195
194
|
], 2));
|
|
196
195
|
}
|
|
197
|
-
}),
|
|
196
|
+
}), Ae = z(
|
|
198
197
|
ye,
|
|
199
198
|
G({ dataSource: "dataSource", loading: "loading" })
|
|
200
199
|
);
|
|
201
200
|
export {
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
Ae as SelectTable,
|
|
202
|
+
Ae as default
|
|
204
203
|
};
|
|
205
204
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nconst elTableRef = ref<TableInstance>()\nconst rowKey = props.rowKey\nfunction getInitialSelectedList() {\n if (props.mode === 'multiple') {\n return props.modelValue?.map((item) => {\n if (!props.optionAsValue) {\n return {\n [rowKey]: item,\n }\n }\n return item\n }) ?? []\n }\n else {\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst radioSelectedKey = ref()\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => item[rowKey]),\n )\n await nextTick()\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\n ? value?.map(item => item[rowKey])\n : value ?? []\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(item[rowKey]),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n if (diffItems.includes(tableItem[rowKey])) {\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n /* istanbul ignore if -- @preserve */\n if (!rowKey) {\n throw new Error('rowKey is required')\n }\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n radioSelectedKey.value = item[rowKey]\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n radioSelectedKey.value = null\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n \n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSlot","_ctx","_Fragment","_renderList","colItem","vLoading","SelectTable","connect","InnerSelectTable","mapProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAMA,IAAQC,GAYRC,IAAOC,GAEPC,I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AAA;AAAA;YAZd,OAAM;AAAA,UAAA;YAEK,SAAOC,EAChB,CAOe,EARK,KAAAtB,QAAG;AAAA,cACvBc,EAOeJ,EAAAa,EAAA,GAAA;AAAA,4BAPQnD,EAAA;AAAA,8DAAAA,EAAgB,QAAAoD;AAAA,gBAAE,OAAA,EAAA,OAAA,OAAA;AAAA,cAAA;2BACvC,MAKU;AAAA,kBALVV,EAKUJ,OALVU,EAKU5D,EAJqBwC,EAAIU,EAAA5C,CAAA,CAAM,CAAA,GAAA;AAAA,oBACtC,UAAM,MAAQc,EAAaoB,CAAG;AAAA,kBAAA;+BAChC,MAED,CAAA,GAAAgB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,wBAFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;ICpPxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nconst elTableRef = ref<TableInstance>()\nconst rowKey = props.rowKey\nfunction getInitialSelectedList() {\n if (props.mode === 'multiple') {\n return props.modelValue?.map((item) => {\n if (!props.optionAsValue) {\n return {\n [rowKey]: item,\n }\n }\n return item\n }) ?? []\n }\n else {\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst radioSelectedKey = ref()\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => item[rowKey]),\n )\n await nextTick()\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\n ? value?.map(item => item[rowKey])\n : value ?? []\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(item[rowKey]),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n if (diffItems.includes(tableItem[rowKey])) {\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n /* istanbul ignore if -- @preserve */\n if (!rowKey) {\n throw new Error('rowKey is required')\n }\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n radioSelectedKey.value = item[rowKey]\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n radioSelectedKey.value = null\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n \n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSlot","_ctx","_Fragment","_renderList","colItem","vLoading","SelectTable","connect","InnerSelectTable","mapProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAMA,IAAQC,GAYRC,IAAOC,GAEPC,IAAeC,GAAA,GACfC,IAAQC,EAAA;AAEd,aAASC,EAAqBC,GAAa;AACzC,aAAOC,EAAGC,GAA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AA,cACvBc,EAOeJ,EAAAa,EAAA,GAAA;AAAA,4BAPQnD,EAAA;AAAA,8DAAAA,EAAgB,QAAAoD;AAAA,gBAAE,OAAA,EAAA,OAAA,OAAA;AAAA,cAAA;2BACvC,MAKU;AAAA,kBALVV,EAKUJ,OALVU,EAKU5D,EAJqBwC,EAAIU,EAAA5C,CAAA,CAAM,CAAA,GAAA;AAAA,oBACtC,UAAM,MAAQc,EAAaoB,CAAG;AAAA,kBAAA;+BAChC,MAED,CAAA,GAAAgB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,wBAFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;ICpPxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
|
package/esm/slider/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect as r, mapProps as o } from "@silver-formily/vue";
|
|
2
2
|
import { ElSlider as t } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "vue";
|
|
6
6
|
import { mapReadPretty as e } from "../__builtins__/shared/transform-component.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect as r, mapProps as e } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimePicker as m } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "vue";
|
|
6
6
|
import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
|
|
@@ -12,6 +12,10 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
12
12
|
name: {
|
|
13
13
|
type: import('vue').PropType<string>;
|
|
14
14
|
};
|
|
15
|
+
effect: {
|
|
16
|
+
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
15
19
|
format: {
|
|
16
20
|
type: import('vue').PropType<string>;
|
|
17
21
|
default: string;
|
|
@@ -24,10 +28,6 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
24
28
|
type: import('vue').PropType<boolean>;
|
|
25
29
|
default: undefined;
|
|
26
30
|
};
|
|
27
|
-
effect: {
|
|
28
|
-
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
29
|
-
default: string;
|
|
30
|
-
};
|
|
31
31
|
placeholder: {
|
|
32
32
|
type: import('vue').PropType<string>;
|
|
33
33
|
};
|
|
@@ -98,6 +98,10 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
98
98
|
name: {
|
|
99
99
|
type: import('vue').PropType<string>;
|
|
100
100
|
};
|
|
101
|
+
effect: {
|
|
102
|
+
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
103
|
+
default: string;
|
|
104
|
+
};
|
|
101
105
|
format: {
|
|
102
106
|
type: import('vue').PropType<string>;
|
|
103
107
|
default: string;
|
|
@@ -110,10 +114,6 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
110
114
|
type: import('vue').PropType<boolean>;
|
|
111
115
|
default: undefined;
|
|
112
116
|
};
|
|
113
|
-
effect: {
|
|
114
|
-
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
115
|
-
default: string;
|
|
116
|
-
};
|
|
117
117
|
placeholder: {
|
|
118
118
|
type: import('vue').PropType<string>;
|
|
119
119
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { connect as e, mapProps as t } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimeSelect as m } from "element-plus";
|
|
3
|
-
import "@formily/reactive";
|
|
3
|
+
import "@silver-formily/reactive-vue";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "vue";
|
|
6
6
|
import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
|