@silver-formily/element-plus 4.0.2 → 5.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/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.mjs +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs +11 -6
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/array-base-inner.mjs.map +1 -1
- package/esm/array-base/array-base-move-down.mjs +1 -1
- package/esm/array-base/array-base-move-down.mjs.map +1 -1
- package/esm/array-base/array-base-move-up.mjs +1 -1
- package/esm/array-base/array-base-move-up.mjs.map +1 -1
- package/esm/array-base/array-base-remove.mjs +1 -1
- package/esm/array-base/array-base-remove.mjs.map +1 -1
- package/esm/array-base/types.d.ts +2 -2
- package/esm/array-base/utils.d.ts +1 -1
- package/esm/array-base/utils.mjs +1 -1
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/array-cards.mjs +1 -1
- package/esm/array-cards/array-cards.mjs.map +1 -1
- package/esm/array-collapse/array-collapse-item.mjs +1 -1
- package/esm/array-collapse/array-collapse-item.mjs.map +1 -1
- package/esm/array-collapse/array-collapse.mjs +3 -4
- package/esm/array-collapse/array-collapse.mjs.map +1 -1
- package/esm/array-items/array-items.mjs +3 -8
- package/esm/array-items/array-items.mjs.map +1 -1
- package/esm/array-list-tabs/array-list-tabs.mjs +57 -51
- package/esm/array-list-tabs/array-list-tabs.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/array-table.mjs +4 -18
- package/esm/array-table/array-table.mjs.map +1 -1
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/array-tabs.mjs +1 -1
- package/esm/array-tabs/array-tabs.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.mjs.map +1 -1
- package/esm/autocomplete/index.d.ts +3 -4
- package/esm/checkbox/checkbox-group.mjs +1 -1
- package/esm/checkbox/checkbox-group.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +57 -57
- package/esm/color-picker/index.d.ts +20 -20
- package/esm/color-picker-panel/index.d.ts +9 -9
- package/esm/date-picker-panel/index.d.ts +1 -1
- package/esm/editable/editable-popover.mjs +1 -1
- package/esm/editable/editable-popover.mjs.map +1 -1
- package/esm/editable/editable.mjs +1 -1
- package/esm/editable/editable.mjs.map +1 -1
- package/esm/form/form.mjs.map +1 -1
- package/esm/form/form.vue.d.ts +1 -1
- package/esm/form-collapse/form-collapse.mjs +1 -1
- package/esm/form-collapse/form-collapse.mjs.map +1 -1
- package/esm/form-collapse/utils.d.ts +2 -2
- package/esm/form-collapse/utils.mjs +2 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/dialog-content.mjs +1 -1
- package/esm/form-dialog/dialog-content.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +3 -3
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +2 -2
- package/esm/form-drawer/drawer-content.mjs +1 -1
- package/esm/form-drawer/drawer-content.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +3 -3
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +2 -2
- package/esm/form-grid/form-grid-column.mjs +6 -4
- package/esm/form-grid/form-grid-column.mjs.map +1 -1
- package/esm/form-item/form-item.mjs +1 -1
- package/esm/form-item/form-item.mjs.map +1 -1
- package/esm/form-item/index.mjs +1 -1
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/utils.mjs +1 -1
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +1 -1
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/form-layout.vue.d.ts +1 -1
- package/esm/form-layout/utils.mjs +1 -1
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/form-step.mjs +1 -1
- package/esm/form-step/form-step.mjs.map +1 -1
- package/esm/form-step/types.d.ts +1 -1
- package/esm/form-step/utils.d.ts +1 -1
- package/esm/form-step/utils.mjs +1 -1
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/utils.mjs +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/input-number/index.d.ts +21 -21
- package/esm/input-tag/index.d.ts +1 -2
- package/esm/input-tag/input-tag.mjs.map +1 -1
- package/esm/mention/index.d.ts +3 -4
- package/esm/mention/mention.mjs.map +1 -1
- package/esm/pagination/components/pager2.mjs.map +1 -1
- package/esm/pagination/components/sizes2.mjs +1 -1
- package/esm/pagination/components/sizes2.mjs.map +1 -1
- package/esm/picker-select/picker-select.mjs +1 -1
- package/esm/picker-select/picker-select.mjs.map +1 -1
- package/esm/picker-select/types.d.ts +1 -1
- package/esm/preview-text/cascader.mjs.map +1 -1
- package/esm/preview-text/color-picker.mjs +1 -1
- package/esm/preview-text/color-picker.mjs.map +1 -1
- package/esm/preview-text/input.mjs +1 -1
- package/esm/preview-text/input.mjs.map +1 -1
- package/esm/preview-text/rate.mjs +1 -1
- package/esm/preview-text/rate.mjs.map +1 -1
- package/esm/preview-text/select.mjs +9 -4
- package/esm/preview-text/select.mjs.map +1 -1
- package/esm/preview-text/time-picker.mjs +1 -1
- package/esm/preview-text/time-picker.mjs.map +1 -1
- package/esm/preview-text/tree.mjs.map +1 -1
- package/esm/query-form/hooks.mjs +1 -1
- package/esm/query-form/hooks.mjs.map +1 -1
- package/esm/query-form/index.d.ts +5 -5
- package/esm/query-form/query-form-light.mjs +14 -7
- package/esm/query-form/query-form-light.mjs.map +1 -1
- package/esm/query-form/query-form.mjs +14 -7
- package/esm/query-form/query-form.mjs.map +1 -1
- package/esm/query-form/types.d.ts +9 -2
- package/esm/query-form-item/index.d.ts +4 -4
- package/esm/query-form-item/query-form-item.mjs +2 -2
- package/esm/query-form-item/query-form-item.mjs.map +1 -1
- package/esm/query-form-item/types.d.ts +2 -2
- package/esm/radio/index.d.ts +60 -60
- package/esm/radio/radio-group.mjs +5 -3
- package/esm/radio/radio-group.mjs.map +1 -1
- package/esm/rate/index.d.ts +10 -10
- package/esm/select/index.d.ts +7 -7
- package/esm/select-table/index.d.ts +3 -3
- package/esm/select-table/select-table.mjs +1 -1
- package/esm/select-table/select-table.mjs.map +1 -1
- package/esm/select-table/types.d.ts +1 -1
- package/esm/submit/submit.mjs.map +1 -1
- package/esm/switch/index.d.ts +27 -27
- package/esm/time-select/index.d.ts +20 -20
- package/esm/transfer/index.d.ts +21 -21
- package/esm/tree/tree.mjs +1 -1
- package/esm/tree/tree.mjs.map +1 -1
- package/esm/tree-select/tree-select.mjs.map +1 -1
- package/esm/upload/upload.mjs +1 -1
- package/esm/upload/upload.mjs.map +1 -1
- package/package.json +18 -14
|
@@ -6,18 +6,21 @@ import { reactionWatch } from "@silver-formily/reactive-vue";
|
|
|
6
6
|
import { computed, createBlock, createCommentVNode, createElementVNode, defineComponent, mergeProps, normalizeClass, onUnmounted, openBlock, renderSlot, resolveDynamicComponent, unref, useSlots, withCtx } from "vue";
|
|
7
7
|
import { useFieldSchema, useForm } from "@silver-formily/vue";
|
|
8
8
|
import { throttle } from "lodash-es";
|
|
9
|
-
import { toJS } from "@formily/reactive";
|
|
9
|
+
import { toJS } from "@silver-formily/reactive";
|
|
10
10
|
//#region src/query-form/query-form-light.vue
|
|
11
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
name: "FQueryFormLight",
|
|
13
13
|
inheritAttrs: false,
|
|
14
14
|
__name: "query-form-light",
|
|
15
15
|
props: {
|
|
16
|
+
form: {},
|
|
16
17
|
schema: {},
|
|
17
18
|
schemaField: {},
|
|
18
19
|
components: { default: () => ({}) },
|
|
19
20
|
scope: {},
|
|
20
|
-
throttleWait: { default: 300 }
|
|
21
|
+
throttleWait: { default: 300 },
|
|
22
|
+
onAutoSubmit: {},
|
|
23
|
+
onAutoSubmitFailed: {}
|
|
21
24
|
},
|
|
22
25
|
emits: ["autoSubmit", "autoSubmitFailed"],
|
|
23
26
|
setup(__props, { emit: __emit }) {
|
|
@@ -29,22 +32,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
32
|
const fieldSchemaRef = useFieldSchema();
|
|
30
33
|
const prefixCls = `${stylePrefix}-query-form-light`;
|
|
31
34
|
const { externalForm, activeForm } = useQueryFormForm({
|
|
32
|
-
formProps,
|
|
35
|
+
formProps: computed(() => ({ form: props.form })),
|
|
33
36
|
fallbackForm: formRef
|
|
34
37
|
});
|
|
35
38
|
const resolvedSchema = computed(() => props.schema ?? fieldSchemaRef.value);
|
|
36
39
|
const innerFormProps = computed(() => ({
|
|
37
40
|
fullness: false,
|
|
38
41
|
...formProps.value,
|
|
39
|
-
form: externalForm.value
|
|
42
|
+
form: externalForm.value,
|
|
43
|
+
onAutoSubmit: props.onAutoSubmit,
|
|
44
|
+
onAutoSubmitFailed: props.onAutoSubmitFailed
|
|
40
45
|
}));
|
|
41
46
|
function submitByChange() {
|
|
42
|
-
activeForm.value
|
|
47
|
+
const form = activeForm.value;
|
|
48
|
+
if (!form) return;
|
|
49
|
+
form.submit((values) => {
|
|
43
50
|
emit("autoSubmit", values);
|
|
44
|
-
return
|
|
51
|
+
return props.onAutoSubmit?.(values);
|
|
45
52
|
}).catch((error) => {
|
|
46
53
|
emit("autoSubmitFailed", error);
|
|
47
|
-
|
|
54
|
+
props.onAutoSubmitFailed?.(error);
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
57
|
const triggerSubmit = throttle(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-form-light.mjs","names":[],"sources":["../../src/query-form/query-form-light.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Form } from '@formily/core'\nimport type { IQueryFormLightProps } from './types'\nimport { toJS } from '@formily/reactive'\nimport { reactionWatch } from '@silver-formily/reactive-vue'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { throttle } from 'lodash-es'\nimport { computed, onUnmounted, useSlots } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { Form as FForm } from '../form'\nimport { useQueryFormForm, useQueryFormSchemaField } from './hooks'\n\ndefineOptions({\n name: 'FQueryFormLight',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IQueryFormLightProps>(), {\n components: () => ({}),\n throttleWait: 300,\n})\nconst emit = defineEmits<{\n (e: 'autoSubmit', values: Form['values']): void\n (e: 'autoSubmitFailed', error: any): void\n}>()\n\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\nconst slots = useSlots()\nconst formRef = useForm()\nconst fieldSchemaRef = useFieldSchema()\nconst prefixCls = `${stylePrefix}-query-form-light`\n\nconst { externalForm, activeForm } = useQueryFormForm({\n formProps,\n fallbackForm: formRef,\n})\nconst resolvedSchema = computed(() => props.schema ?? fieldSchemaRef.value)\n\nconst innerFormProps = computed(() => ({\n fullness: false,\n ...formProps.value,\n form: externalForm.value,\n}))\n\nfunction submitByChange() {\n const form = activeForm.value\n form\n .submit((values) => {\n emit('autoSubmit', values)\n return
|
|
1
|
+
{"version":3,"file":"query-form-light.mjs","names":[],"sources":["../../src/query-form/query-form-light.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Form } from '@silver-formily/core'\nimport type { IQueryFormLightProps } from './types'\nimport { toJS } from '@silver-formily/reactive'\nimport { reactionWatch } from '@silver-formily/reactive-vue'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { throttle } from 'lodash-es'\nimport { computed, onUnmounted, useSlots } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { Form as FForm } from '../form'\nimport { useQueryFormForm, useQueryFormSchemaField } from './hooks'\n\ndefineOptions({\n name: 'FQueryFormLight',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IQueryFormLightProps>(), {\n components: () => ({}),\n throttleWait: 300,\n})\nconst emit = defineEmits<{\n (e: 'autoSubmit', values: Form['values']): void\n (e: 'autoSubmitFailed', error: any): void\n}>()\n\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\nconst slots = useSlots()\nconst formRef = useForm()\nconst fieldSchemaRef = useFieldSchema()\nconst prefixCls = `${stylePrefix}-query-form-light`\n\nconst { externalForm, activeForm } = useQueryFormForm({\n formProps: computed(() => ({ form: props.form })),\n fallbackForm: formRef,\n})\nconst resolvedSchema = computed(() => props.schema ?? fieldSchemaRef.value)\n\nconst innerFormProps = computed(() => ({\n fullness: false,\n ...formProps.value,\n form: externalForm.value,\n onAutoSubmit: props.onAutoSubmit,\n onAutoSubmitFailed: props.onAutoSubmitFailed,\n}))\n\nfunction submitByChange() {\n const form = activeForm.value\n if (!form)\n return\n form\n .submit((values) => {\n emit('autoSubmit', values)\n return props.onAutoSubmit?.(values)\n })\n .catch((error) => {\n emit('autoSubmitFailed', error)\n props.onAutoSubmitFailed?.(error)\n })\n}\n\nconst triggerSubmit = throttle(() => {\n submitByChange()\n}, props.throttleWait, {\n leading: false,\n trailing: true,\n})\n\nreactionWatch(() => {\n const form = activeForm.value\n if (!form)\n return\n return toJS(form.values)\n}, () => {\n triggerSubmit()\n})\n\nonUnmounted(() => {\n triggerSubmit.cancel()\n})\n\nconst { hasDefaultSlot, schemaField } = useQueryFormSchemaField({\n slots,\n schema: resolvedSchema,\n schemaField: computed(() => props.schemaField),\n components: computed(() => props.components),\n})\n</script>\n\n<template>\n <FForm v-bind=\"innerFormProps\" :class=\"prefixCls\">\n <div :class=\"`${prefixCls}__content`\">\n <slot v-if=\"hasDefaultSlot\" />\n <component\n :is=\"schemaField\"\n v-else-if=\"schemaField\"\n :schema=\"resolvedSchema\"\n />\n </div>\n </FForm>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAiBA,MAAM,QAAQ;EAId,MAAM,OAAO;EAKb,MAAM,EAAE,OAAO,cAAc,cAAc,CAAC,cA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AA,GAAA,CAAA,GAGjB,MAAA,YAAW,IAAA,WAAA,EAFxB,YAIE,wBAHK,MAAA,YAAW,CAAA,EAAA;;KAEf,QAAQ,eAAA"}
|
|
@@ -12,7 +12,7 @@ import { computed, createBlock, createCommentVNode, createTextVNode, createVNode
|
|
|
12
12
|
import { useFieldSchema, useForm } from "@silver-formily/vue";
|
|
13
13
|
import { ArrowDown, ArrowUp } from "@element-plus/icons-vue";
|
|
14
14
|
import { createGrid } from "@silver-formily/grid";
|
|
15
|
-
import { Schema } from "@formily/json-schema";
|
|
15
|
+
import { Schema } from "@silver-formily/json-schema";
|
|
16
16
|
//#region src/query-form/query-form.vue
|
|
17
17
|
const COLLAPSED_ROWS = 1;
|
|
18
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -20,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20
20
|
inheritAttrs: false,
|
|
21
21
|
__name: "query-form",
|
|
22
22
|
props: {
|
|
23
|
+
form: {},
|
|
23
24
|
schema: {},
|
|
24
25
|
schemaField: {},
|
|
25
26
|
components: { default: () => ({}) },
|
|
@@ -51,7 +52,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
51
52
|
default: true
|
|
52
53
|
},
|
|
53
54
|
submitProps: {},
|
|
54
|
-
resetProps: {}
|
|
55
|
+
resetProps: {},
|
|
56
|
+
onAutoSubmit: {},
|
|
57
|
+
onAutoSubmitFailed: {}
|
|
55
58
|
},
|
|
56
59
|
setup(__props) {
|
|
57
60
|
const props = __props;
|
|
@@ -60,14 +63,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
63
|
const prefixCls = `${stylePrefix}-query-form`;
|
|
61
64
|
const FormGridColumn = FormGrid.GridColumn;
|
|
62
65
|
const fieldSchemaRef = useFieldSchema();
|
|
66
|
+
const formRef = useForm();
|
|
63
67
|
const { externalForm, activeForm } = useQueryFormForm({
|
|
64
|
-
formProps,
|
|
65
|
-
fallbackForm:
|
|
68
|
+
formProps: computed(() => ({ form: props.form })),
|
|
69
|
+
fallbackForm: formRef
|
|
66
70
|
});
|
|
67
71
|
const innerFormProps = computed(() => ({
|
|
68
72
|
fullness: true,
|
|
69
73
|
...formProps.value,
|
|
70
|
-
form: externalForm.value
|
|
74
|
+
form: externalForm.value,
|
|
75
|
+
onAutoSubmit: props.onAutoSubmit,
|
|
76
|
+
onAutoSubmitFailed: props.onAutoSubmitFailed
|
|
71
77
|
}));
|
|
72
78
|
const schemaList = computed(() => {
|
|
73
79
|
const rawSchema = props.schema ?? fieldSchemaRef.value;
|
|
@@ -108,8 +114,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
108
114
|
return (props.visibleWhen ? props.visibleWhen(context) : defaultVisibleWhen(context)) !== false;
|
|
109
115
|
}
|
|
110
116
|
function isActionsNode(node, grid) {
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
const isLastNode = node.index === grid.childSize - 1;
|
|
118
|
+
if ("element" in node && node.element) return node.element.dataset.queryFormActions !== void 0 || isLastNode;
|
|
119
|
+
return isLastNode;
|
|
113
120
|
}
|
|
114
121
|
function getFieldRowCount(grid) {
|
|
115
122
|
const rows = (grid.children ?? []).filter((node) => !isActionsNode(node, grid)).map((node) => node.shadowRow ?? 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-form.mjs","names":[],"sources":["../../src/query-form/query-form.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ISchema } from '@formily/json-schema'\nimport type { Grid, GridNode, IGridOptions } from '@silver-formily/grid'\nimport type { IQueryFormProps, SchemaEntry } from './types'\nimport { ArrowDown, ArrowUp } from '@element-plus/icons-vue'\nimport { Schema } from '@formily/json-schema'\nimport { createGrid } from '@silver-formily/grid'\nimport { autorunEffect } from '@silver-formily/reactive-vue'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { ElIcon, ElLink } from 'element-plus'\nimport { computed, ref, useSlots } from 'vue'\nimport { compatibleUnderlineProp, stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { Form } from '../form'\nimport { FormButtonGroup } from '../form-button-group'\nimport { FormGrid } from '../form-grid'\nimport { Reset } from '../reset'\nimport { Submit } from '../submit'\nimport { useQueryFormForm, useQueryFormSchemaField } from './hooks'\n\ndefineOptions({\n name: 'FQueryForm',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IQueryFormProps>(), {\n components: () => ({}),\n gridProps: () => ({}),\n defaultExpanded: false,\n showToggle: true,\n actionsAtRowEnd: false,\n submitText: '查询',\n resetText: '重置',\n expandText: '展开',\n collapseText: '收起',\n showSubmit: true,\n showReset: true,\n})\n\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\nconst slots = useSlots()\nconst prefixCls = `${stylePrefix}-query-form`\nconst FormGridColumn = FormGrid.GridColumn\n\nconst COLLAPSED_ROWS = 1\nconst fieldSchemaRef = useFieldSchema()\nconst formRef = useForm()\nconst { externalForm, activeForm } = useQueryFormForm({\n formProps,\n fallbackForm: formRef,\n})\nconst innerFormProps = computed(() => ({\n fullness: true,\n ...formProps.value,\n form: externalForm.value,\n}))\n\nconst schemaList = computed<SchemaEntry[]>(() => {\n const rawSchema = props.schema ?? fieldSchemaRef.value\n /* istanbul ignore next -- @preserve defensive: schema can be temporarily absent in external field-schema lifecycle */\n if (!rawSchema)\n return []\n const schema = rawSchema instanceof Schema ? rawSchema : new Schema(rawSchema)\n return schema.mapProperties((childSchema: ISchema, name: string | number) => ({\n name,\n schema: childSchema,\n }))\n})\n\nfunction resolveField(name?: string | number) {\n return activeForm.value?.query(name).take()\n}\n\nfunction createVisibleContext(\n node: GridNode,\n grid: Grid<HTMLElement>,\n collapsedOverride?: boolean,\n) {\n const index = node.index ?? 0\n const entry = schemaList.value[index]\n const schema = entry?.schema\n const name = entry?.name ?? schema?.name\n return {\n field: resolveField(name),\n schema,\n index,\n node,\n grid,\n collapsed: collapsedOverride ?? grid.maxRows !== Infinity,\n breakpoint: grid.breakpoint,\n }\n}\n\nfunction defaultVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\n if (!context.collapsed)\n return true\n\n const shadowRow = context.node.shadowRow ?? 0\n const withinRows = shadowRow < COLLAPSED_ROWS + 1\n if (!withinRows)\n return false\n\n const isCollapsible = getFieldRowCount(context.grid) > COLLAPSED_ROWS\n if (!isCollapsible)\n return true\n const shadowColumn = context.node.shadowColumn ?? 1\n const span = context.node.span ?? 1\n const endColumn = shadowColumn + span - 1\n if (shadowRow === COLLAPSED_ROWS && endColumn === context.grid.columns)\n return false\n\n return true\n}\n\nfunction resolveVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\n const visible = props.visibleWhen\n ? props.visibleWhen(context)\n : defaultVisibleWhen(context)\n return visible !== false\n}\n\nfunction isActionsNode(node: GridNode, grid: Grid<HTMLElement>) {\n if ('element' in node && node.element) {\n return node.element.dataset.queryFormActions !== undefined\n }\n return node.index === grid.childSize - 1\n}\n\nfunction getFieldRowCount(grid: Grid<HTMLElement>) {\n const rows = (grid.children ?? [])\n .filter(node => !isActionsNode(node, grid))\n .map(node => node.shadowRow ?? 0)\n return new Set(rows).size\n}\n\nconst defaultShouldVisible: IGridOptions['shouldVisible'] = (node, grid) => {\n if (isActionsNode(node, grid))\n return true\n return resolveVisibleWhen(createVisibleContext(node, grid))\n}\n\nconst restGridProps = props.gridProps ?? {}\nconst defaultGridProps: Partial<IGridOptions> = restGridProps.minColumns === undefined && restGridProps.maxColumns === undefined\n ? { maxColumns: 4 }\n : {}\n\nconst gridOptions: IGridOptions = {\n ...defaultGridProps,\n ...restGridProps,\n maxRows: (props.defaultExpanded || !props.showToggle) ? Infinity : COLLAPSED_ROWS,\n shouldVisible: defaultShouldVisible,\n}\n\nconst grid = createGrid(gridOptions)\n\nconst expanded = ref(grid.maxRows === Infinity)\nconst gridType = ref<'incomplete-wrap' | 'collapsible' | 'complete-wrap'>('complete-wrap')\n\nfunction updateType() {\n if (!props.showToggle) {\n gridType.value = 'incomplete-wrap'\n return\n }\n\n if (!props.visibleWhen) {\n gridType.value = getFieldRowCount(grid) > COLLAPSED_ROWS\n ? 'collapsible'\n : 'incomplete-wrap'\n return\n }\n\n const nodes = grid.children ?? []\n const hasHiddenInCollapsed = nodes.some((node) => {\n if (isActionsNode(node, grid))\n return false\n return !resolveVisibleWhen(createVisibleContext(node, grid, true))\n })\n /* istanbul ignore next -- @preserve layout branch depends on runtime grid measurement in browser */\n if (hasHiddenInCollapsed) {\n gridType.value = 'collapsible'\n return\n }\n const realRows = grid.shadowRows\n gridType.value = realRows < COLLAPSED_ROWS + 1 ? 'incomplete-wrap' : 'complete-wrap'\n}\n\nautorunEffect(() => {\n expanded.value = grid.maxRows === Infinity\n updateType()\n})\n\nfunction toggle() {\n if (!props.showToggle)\n return\n grid.maxRows = grid.maxRows === Infinity ? COLLAPSED_ROWS : Infinity\n}\n\nconst { hasDefaultSlot, schemaField } = useQueryFormSchemaField({\n slots,\n schema: computed(() => props.schema),\n schemaField: computed(() => props.schemaField),\n components: computed(() => props.components),\n scope: computed(() => props.scope),\n})\n</script>\n\n<template>\n <Form v-bind=\"innerFormProps\" :class=\"prefixCls\">\n <FormGrid :grid=\"grid\">\n <slot v-if=\"hasDefaultSlot\" />\n <component\n :is=\"schemaField\"\n v-else-if=\"schemaField\"\n :schema=\"props.schema\"\n />\n <FormGridColumn\n :grid-span=\"-1\"\n data-query-form-actions\n :class=\"[\n `${prefixCls}__actions`,\n props.actionsAtRowEnd && `${prefixCls}__actions--row-end`,\n ]\"\n >\n <template v-if=\"gridType === 'incomplete-wrap'\">\n <FormButtonGroup\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\n align-form-item\n inline\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n </FormButtonGroup>\n </template>\n <template v-else-if=\"gridType === 'collapsible' && props.showToggle\">\n <FormButtonGroup\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\n align-form-item\n inline\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n <slot\n name=\"collapse\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <ElLink\n type=\"primary\"\n :underline=\"compatibleUnderlineProp()\"\n :class=\"`${prefixCls}__collapse-link`\"\n @click=\"toggle\"\n >\n {{ expanded ? props.collapseText : props.expandText }}\n <ElIcon :class=\"`${prefixCls}__collapse-icon`\">\n <ArrowUp v-if=\"expanded\" />\n <ArrowDown v-else />\n </ElIcon>\n </ElLink>\n </slot>\n </FormButtonGroup>\n </template>\n <template v-else>\n <FormButtonGroup\n align=\"right\"\n inline\n style=\"display: flex; width: 100%;\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n </FormButtonGroup>\n </template>\n </FormGridColumn>\n </FormGrid>\n </Form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnBvB,MAAM,QAAQ;EAcd,MAAM,EAAE,OA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AA,EAAA,EAHA,OAAK,eAAA,GAAK,UAAS,iBAAA,EAAA,EAAA;gCACC,CAAZ,SAAA,SAAA,WAAA,EAAf,YAA2B,MAAA,QAAA,EAAA,EAAA,KAAA,GAAA,CAAA,KAAA,WAAA,EAC3B,YAAoB,MAAA,UAAA,EAAA,EAAA,KAAA,GAAA,CAAA,EAAA,CAAA;;;;;;iDAO5B,YAkBkB,MAAA,gBAAA,EAAA;;OAjBhB,OAAM;OACN,QAAA;OACA,OAAA;QAAA,WAAA;QAAA,SAAA;QAAmC;;8BAc5B,CAZP,WAYO,KAAA,QAAA,WAAA;QAVJ,UAAU,SAAA;QACF;QACR,MAAM,SAAA;gBAQF,CANS,MAAM,cAAA,WAAA,EAApB,YAES,MAAA,OAAA,EAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAF+B,MAAM,YAAW,CAAA,EAAA;+BACjC,CAAA,gBAAA,gBAAnB,MAAM,WAAU,EAAA,EAAA,CAAA,CAAA;;mDAER,MAAM,aAAA,WAAA,EAAnB,YAEQ,MAAA,MAAA,EAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAF8B,MAAM,WAAU,CAAA,EAAA;+BAC/B,CAAA,gBAAA,gBAAlB,MAAM,UAAS,EAAA,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"query-form.mjs","names":[],"sources":["../../src/query-form/query-form.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Grid, GridNode, IGridOptions } from '@silver-formily/grid'\nimport type { ISchema } from '@silver-formily/json-schema'\nimport type { IQueryFormProps, SchemaEntry } from './types'\nimport { ArrowDown, ArrowUp } from '@element-plus/icons-vue'\nimport { createGrid } from '@silver-formily/grid'\nimport { Schema } from '@silver-formily/json-schema'\nimport { autorunEffect } from '@silver-formily/reactive-vue'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { ElIcon, ElLink } from 'element-plus'\nimport { computed, ref, useSlots } from 'vue'\nimport { compatibleUnderlineProp, stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { Form } from '../form'\nimport { FormButtonGroup } from '../form-button-group'\nimport { FormGrid } from '../form-grid'\nimport { Reset } from '../reset'\nimport { Submit } from '../submit'\nimport { useQueryFormForm, useQueryFormSchemaField } from './hooks'\n\ndefineOptions({\n name: 'FQueryForm',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IQueryFormProps>(), {\n components: () => ({}),\n gridProps: () => ({}),\n defaultExpanded: false,\n showToggle: true,\n actionsAtRowEnd: false,\n submitText: '查询',\n resetText: '重置',\n expandText: '展开',\n collapseText: '收起',\n showSubmit: true,\n showReset: true,\n})\n\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\nconst slots = useSlots()\nconst prefixCls = `${stylePrefix}-query-form`\nconst FormGridColumn = FormGrid.GridColumn\n\nconst COLLAPSED_ROWS = 1\nconst fieldSchemaRef = useFieldSchema()\nconst formRef = useForm()\nconst { externalForm, activeForm } = useQueryFormForm({\n formProps: computed(() => ({ form: props.form })),\n fallbackForm: formRef,\n})\nconst innerFormProps = computed(() => ({\n fullness: true,\n ...formProps.value,\n form: externalForm.value,\n onAutoSubmit: props.onAutoSubmit,\n onAutoSubmitFailed: props.onAutoSubmitFailed,\n}))\n\nconst schemaList = computed<SchemaEntry[]>(() => {\n const rawSchema = props.schema ?? fieldSchemaRef.value\n /* istanbul ignore next -- @preserve defensive: schema can be temporarily absent in external field-schema lifecycle */\n if (!rawSchema)\n return []\n const schema = rawSchema instanceof Schema ? rawSchema : new Schema(rawSchema)\n return schema.mapProperties((childSchema: ISchema, name: string | number) => ({\n name,\n schema: childSchema,\n }))\n})\n\nfunction resolveField(name?: string | number) {\n return activeForm.value?.query(name).take()\n}\n\nfunction createVisibleContext(\n node: GridNode,\n grid: Grid<HTMLElement>,\n collapsedOverride?: boolean,\n) {\n const index = node.index ?? 0\n const entry = schemaList.value[index]\n const schema = entry?.schema\n const name = entry?.name ?? schema?.name\n return {\n field: resolveField(name),\n schema,\n index,\n node,\n grid,\n collapsed: collapsedOverride ?? grid.maxRows !== Infinity,\n breakpoint: grid.breakpoint,\n }\n}\n\nfunction defaultVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\n if (!context.collapsed)\n return true\n\n const shadowRow = context.node.shadowRow ?? 0\n const withinRows = shadowRow < COLLAPSED_ROWS + 1\n if (!withinRows)\n return false\n\n const isCollapsible = getFieldRowCount(context.grid) > COLLAPSED_ROWS\n if (!isCollapsible)\n return true\n const shadowColumn = context.node.shadowColumn ?? 1\n const span = context.node.span ?? 1\n const endColumn = shadowColumn + span - 1\n if (shadowRow === COLLAPSED_ROWS && endColumn === context.grid.columns)\n return false\n\n return true\n}\n\nfunction resolveVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\n const visible = props.visibleWhen\n ? props.visibleWhen(context)\n : defaultVisibleWhen(context)\n return visible !== false\n}\n\nfunction isActionsNode(node: GridNode, grid: Grid<HTMLElement>) {\n const isLastNode = node.index === grid.childSize - 1\n if ('element' in node && node.element) {\n return node.element.dataset.queryFormActions !== undefined || isLastNode\n }\n return isLastNode\n}\n\nfunction getFieldRowCount(grid: Grid<HTMLElement>) {\n const rows = (grid.children ?? [])\n .filter(node => !isActionsNode(node, grid))\n .map(node => node.shadowRow ?? 0)\n return new Set(rows).size\n}\n\nconst defaultShouldVisible: IGridOptions['shouldVisible'] = (node, grid) => {\n if (isActionsNode(node, grid))\n return true\n return resolveVisibleWhen(createVisibleContext(node, grid))\n}\n\nconst restGridProps = props.gridProps ?? {}\nconst defaultGridProps: Partial<IGridOptions> = restGridProps.minColumns === undefined && restGridProps.maxColumns === undefined\n ? { maxColumns: 4 }\n : {}\n\nconst gridOptions: IGridOptions = {\n ...defaultGridProps,\n ...restGridProps,\n maxRows: (props.defaultExpanded || !props.showToggle) ? Infinity : COLLAPSED_ROWS,\n shouldVisible: defaultShouldVisible,\n}\n\nconst grid = createGrid(gridOptions)\n\nconst expanded = ref(grid.maxRows === Infinity)\nconst gridType = ref<'incomplete-wrap' | 'collapsible' | 'complete-wrap'>('complete-wrap')\n\nfunction updateType() {\n if (!props.showToggle) {\n gridType.value = 'incomplete-wrap'\n return\n }\n\n if (!props.visibleWhen) {\n gridType.value = getFieldRowCount(grid) > COLLAPSED_ROWS\n ? 'collapsible'\n : 'incomplete-wrap'\n return\n }\n\n const nodes = grid.children ?? []\n const hasHiddenInCollapsed = nodes.some((node) => {\n if (isActionsNode(node, grid))\n return false\n return !resolveVisibleWhen(createVisibleContext(node, grid, true))\n })\n /* istanbul ignore next -- @preserve layout branch depends on runtime grid measurement in browser */\n if (hasHiddenInCollapsed) {\n gridType.value = 'collapsible'\n return\n }\n const realRows = grid.shadowRows\n gridType.value = realRows < COLLAPSED_ROWS + 1 ? 'incomplete-wrap' : 'complete-wrap'\n}\n\nautorunEffect(() => {\n expanded.value = grid.maxRows === Infinity\n updateType()\n})\n\nfunction toggle() {\n if (!props.showToggle)\n return\n grid.maxRows = grid.maxRows === Infinity ? COLLAPSED_ROWS : Infinity\n}\n\nconst { hasDefaultSlot, schemaField } = useQueryFormSchemaField({\n slots,\n schema: computed(() => props.schema),\n schemaField: computed(() => props.schemaField),\n components: computed(() => props.components),\n scope: computed(() => props.scope),\n})\n</script>\n\n<template>\n <Form v-bind=\"innerFormProps\" :class=\"prefixCls\">\n <FormGrid :grid=\"grid\">\n <slot v-if=\"hasDefaultSlot\" />\n <component\n :is=\"schemaField\"\n v-else-if=\"schemaField\"\n :schema=\"props.schema\"\n />\n <FormGridColumn\n :grid-span=\"-1\"\n data-query-form-actions\n :class=\"[\n `${prefixCls}__actions`,\n props.actionsAtRowEnd && `${prefixCls}__actions--row-end`,\n ]\"\n >\n <template v-if=\"gridType === 'incomplete-wrap'\">\n <FormButtonGroup\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\n align-form-item\n inline\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n </FormButtonGroup>\n </template>\n <template v-else-if=\"gridType === 'collapsible' && props.showToggle\">\n <FormButtonGroup\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\n align-form-item\n inline\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n <slot\n name=\"collapse\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <ElLink\n type=\"primary\"\n :underline=\"compatibleUnderlineProp()\"\n :class=\"`${prefixCls}__collapse-link`\"\n @click=\"toggle\"\n >\n {{ expanded ? props.collapseText : props.expandText }}\n <ElIcon :class=\"`${prefixCls}__collapse-icon`\">\n <ArrowUp v-if=\"expanded\" />\n <ArrowDown v-else />\n </ElIcon>\n </ElLink>\n </slot>\n </FormButtonGroup>\n </template>\n <template v-else>\n <FormButtonGroup\n align=\"right\"\n inline\n style=\"display: flex; width: 100%;\"\n >\n <slot\n name=\"actions\"\n :expanded=\"expanded\"\n :toggle=\"toggle\"\n :type=\"gridType\"\n >\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\n {{ props.submitText }}\n </Submit>\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\n {{ props.resetText }}\n </Reset>\n </slot>\n </FormButtonGroup>\n </template>\n </FormGridColumn>\n </FormGrid>\n </Form>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,MAAM,iBAAiB;;;;;;;;;;;;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A;QAVP,MAAK;QACJ,WAAW,MAAA,wBAAuB,EAAA;QAClC,OAAK,eAAA,GAAK,UAAS,iBAAA;QACnB,SAAO;;+BAE8C,CAAA,gBAAA,gBAAnD,SAAA,QAAW,MAAM,eAAe,MAAM,WAAU,GAAG,KACtD,EAAA,EAAA,YAGS,MAAA,OAAA,EAAA,EAHA,OAAK,eAAA,GAAK,UAAS,iBAAA,EAAA,EAAA;gCACC,CAAZ,SAAA,SAAA,WAAA,EAAf,YAA2B,MAAA,QAAA,EAAA,EAAA,KAAA,GAAA,CAAA,KAAA,WAAA,EAC3B,YAAoB,MAAA,UAAA,EAAA,EAAA,KAAA,GAAA,CAAA,EAAA,CAAA;;;;;;iDAO5B,YAkBkB,MAAA,gBAAA,EAAA;;OAjBhB,OAAM;OACN,QAAA;OACA,OAAA;QAAA,WAAA;QAAA,SAAA;QAAmC;;8BAc5B,CAZP,WAYO,KAAA,QAAA,WAAA;QAVJ,UAAU,SAAA;QACF;QACR,MAAM,SAAA;gBAQF,CANS,MAAM,cAAA,WAAA,EAApB,YAES,MAAA,OAAA,EAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAF+B,MAAM,YAAW,CAAA,EAAA;+BACjC,CAAA,gBAAA,gBAAnB,MAAM,WAAU,EAAA,EAAA,CAAA,CAAA;;mDAER,MAAM,aAAA,WAAA,EAAnB,YAEQ,MAAA,MAAA,EAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAF8B,MAAM,WAAU,CAAA,EAAA;+BAC/B,CAAA,gBAAA,gBAAlB,MAAM,UAAS,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Component } from "vue";
|
|
2
|
-
import { GeneralField } from "@formily/core";
|
|
2
|
+
import { Form, GeneralField, IFormFeedback } from "@silver-formily/core";
|
|
3
3
|
import { Grid, GridNode, IGridOptions } from "@silver-formily/grid";
|
|
4
|
-
import { ISchema } from "@formily/json-schema";
|
|
4
|
+
import { ISchema } from "@silver-formily/json-schema";
|
|
5
5
|
|
|
6
6
|
//#region src/query-form/types.d.ts
|
|
7
|
+
type QueryFormFormProvider = Form | (() => Form | undefined);
|
|
7
8
|
interface QueryFormVisibleContext {
|
|
8
9
|
field?: GeneralField;
|
|
9
10
|
schema?: ISchema;
|
|
@@ -15,6 +16,7 @@ interface QueryFormVisibleContext {
|
|
|
15
16
|
}
|
|
16
17
|
type QueryFormVisible = (context: QueryFormVisibleContext) => boolean;
|
|
17
18
|
interface IQueryFormProps {
|
|
19
|
+
form?: QueryFormFormProvider;
|
|
18
20
|
schema?: ISchema;
|
|
19
21
|
schemaField?: Component;
|
|
20
22
|
components?: Record<string, Component>;
|
|
@@ -32,13 +34,18 @@ interface IQueryFormProps {
|
|
|
32
34
|
showReset?: boolean;
|
|
33
35
|
submitProps?: Record<string, any>;
|
|
34
36
|
resetProps?: Record<string, any>;
|
|
37
|
+
onAutoSubmit?: (values: Form['values']) => Promise<any>;
|
|
38
|
+
onAutoSubmitFailed?: (error: IFormFeedback[]) => void;
|
|
35
39
|
}
|
|
36
40
|
interface IQueryFormLightProps {
|
|
41
|
+
form?: QueryFormFormProvider;
|
|
37
42
|
schema?: ISchema;
|
|
38
43
|
schemaField?: Component;
|
|
39
44
|
components?: Record<string, Component>;
|
|
40
45
|
scope?: Record<string, any>;
|
|
41
46
|
throttleWait?: number;
|
|
47
|
+
onAutoSubmit?: (values: Form['values']) => Promise<any>;
|
|
48
|
+
onAutoSubmitFailed?: (error: any) => void;
|
|
42
49
|
}
|
|
43
50
|
//#endregion
|
|
44
51
|
export { IQueryFormLightProps, IQueryFormProps, QueryFormVisible, QueryFormVisibleContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IQueryFormItemProps, QueryFormItemMode, QueryFormItemPagination, QueryFormItemPaginationMap, QueryFormItemPaginationProps, QueryFormItemQueryProps, QueryFormItemRequest, QueryFormItemRequestResultObject, QueryFormItemRequestSuccessPayload } from "./types.js";
|
|
2
2
|
import * as _$element_plus0 from "element-plus";
|
|
3
3
|
import * as _$vue from "vue";
|
|
4
|
-
import * as _$
|
|
4
|
+
import * as _$_silver_formily_json_schema0 from "@silver-formily/json-schema";
|
|
5
5
|
|
|
6
6
|
//#region src/query-form-item/index.d.ts
|
|
7
7
|
declare const QueryFormItem: {
|
|
@@ -15,7 +15,7 @@ declare const QueryFormItem: {
|
|
|
15
15
|
type: BooleanConstructor;
|
|
16
16
|
default: boolean;
|
|
17
17
|
};
|
|
18
|
-
querySchema: _$vue.PropType<_$
|
|
18
|
+
querySchema: _$vue.PropType<_$_silver_formily_json_schema0.ISchema>;
|
|
19
19
|
queryFormProps: {
|
|
20
20
|
type: _$vue.PropType<QueryFormItemQueryProps>;
|
|
21
21
|
default: () => {};
|
|
@@ -67,7 +67,7 @@ declare const QueryFormItem: {
|
|
|
67
67
|
type: BooleanConstructor;
|
|
68
68
|
default: boolean;
|
|
69
69
|
};
|
|
70
|
-
querySchema: _$vue.PropType<_$
|
|
70
|
+
querySchema: _$vue.PropType<_$_silver_formily_json_schema0.ISchema>;
|
|
71
71
|
queryFormProps: {
|
|
72
72
|
type: _$vue.PropType<QueryFormItemQueryProps>;
|
|
73
73
|
default: () => {};
|
|
@@ -113,7 +113,7 @@ declare const QueryFormItem: {
|
|
|
113
113
|
type: BooleanConstructor;
|
|
114
114
|
default: boolean;
|
|
115
115
|
};
|
|
116
|
-
querySchema: _$vue.PropType<_$
|
|
116
|
+
querySchema: _$vue.PropType<_$_silver_formily_json_schema0.ISchema>;
|
|
117
117
|
queryFormProps: {
|
|
118
118
|
type: _$vue.PropType<QueryFormItemQueryProps>;
|
|
119
119
|
default: () => {};
|
|
@@ -5,9 +5,9 @@ import { useQueryFormForm } from "../query-form/hooks.mjs";
|
|
|
5
5
|
import QueryForm from "../query-form/index.mjs";
|
|
6
6
|
import { ElPagination } from "element-plus";
|
|
7
7
|
import { computed, createBlock, createCommentVNode, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, unref, watch, withCtx } from "vue";
|
|
8
|
-
import { createForm } from "@formily/core";
|
|
8
|
+
import { createForm } from "@silver-formily/core";
|
|
9
9
|
import { useField } from "@silver-formily/vue";
|
|
10
|
-
import { isNum } from "@formily/shared";
|
|
10
|
+
import { isNum } from "@silver-formily/shared";
|
|
11
11
|
//#region src/query-form-item/query-form-item.vue
|
|
12
12
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
13
|
name: "FQueryFormItem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-form-item.mjs","names":[],"sources":["../../src/query-form-item/query-form-item.vue"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAiCd,MAAM,OAAO;EAKb,MAAM,yBAAuD;GAC3D,aAAa;GACb,UAAU;GACV,WAAW;IAAC;IAAI;IAAI;IAAI;IAAI;GAC5B,QAAQ;GACR,MAAM;GACR;EACA,MAAM,kCAAwE;GAC5E,SAAS;GACT,UAAU;GACZ;EAEA,MAAM,WAAW,UAAgB;EACjC,MAAM,oBAAoB,YAAW;EACrC,MAAM,YAAY,GAAG,YAAY;EACjC,MAAM,wBAAwB,GAAG,YAAY;EAC7C,MAAM,EAAE,OAAO,kBAAkB,eAAc;EAE/C,MAAM,qBAAqB,eAAe;GACxC,MAAM,EACJ,aACA,UACA,GAAG,aACD;IACF,GAAG;IACH,GAAG,MAAM;IACX;AACA,UAAO;IACR;EAED,MAAM,iBAAiB,IAAI,MAAM,iBAAiB,eAAe,uBAAuB,YAAW;EACnG,MAAM,cAAc,IAAI,MAAM,iBAAiB,YAAY,uBAAuB,SAAQ;EAC1F,MAAM,WAAW,IAAI,EAAC;EACtB,MAAM,mBAAmB,IAAI,EAAC;EAE9B,MAAM,EAAE,YAAY,oBAAoB,iBAAiB;GACvD,WAAW,eAAe,MAAM,eAAe;GAC/C,cAAc;GACf,CAAA;EAED,MAAM,oBAAoB,eAAe;AACvC,UAAQ;IACN,GAAG,MAAM;IACT,QAAQ,MAAM,eAAe,MAAM,eAAe;IAClD,MAAM,gBAAgB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AAK;AAClC,OAAI,WAAW,MACb,QAAO;AAEJ,sBAAkB;AAEvB,UAAO;;AAGT,kBAAgB;AACd,OAAI,MAAM,UACH,iBAAe;IACvB;AAED,QAAM,CAAC,gBAAgB,YAAY,GAAG,CAAC,aAAa,WAAW,CAAC,cAAc,sBAAsB;;AAElG,OAAI,CAAC,MAAM,WACT;GAEF,MAAM,iBAAiB,gBAAgB;GACvC,MAAM,kBAAkB,aAAa;;AAGrC,OAAI,CAAC,kBAAkB,CAAC,gBACtB;AAEF,OAAI,mBAAmB,gBAAgB,GAAG;AACxC,mBAAe,QAAQ;AACvB;;AAGG,mBAAe;IACrB;;uBAIC,YAqBe,MAAA,YAAA,EArBf,WACU,MAoBK,cApBQ,EAAA,EACpB,4BAA0B,uBAAqB,CAAA,EAAA;2BAkB1C,CAhBN,mBAgBM,OAAA,EAhBA,OAAK,eAAE,UAAS,EAAA,EAAA;mBACpB,YAGE,wBAFK,MAAM,SAAI,UAAe,MAAA,UAAS,CAAC,QAAQ,MAAA,UAAS,CAAA,EAAA,eAAA,mBACjD,kBAAA,MAAiB,CAAA,EAAA,MAAA,GAAA;KAE3B,mBAEM,OAAA,EAFA,OAAK,eAAA,GAAK,UAAS,WAAA,EAAA,EAAA,CACvB,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA;KAGF,MAAM,cAAA,WAAA,EADd,YAOE,MAAA,aAAA,EAPF,WAOE;;MALQ,gBAAc,eAAA;oEAAA,eAAc,QAAA;MAC5B,aAAW,YAAA;iEAAA,YAAW,QAAA;MAC7B,OAAK,GAAK,UAAS;QACZ,mBAAA,OAAkB,EACzB,OAAO,SAAA,OAAQ,CAAA,EAAA,MAAA,IAAA;MAAA;MAAA;MAAA;MAAA;MAAA,CAAA,IAAA,mBAAA,QAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"query-form-item.mjs","names":[],"sources":["../../src/query-form-item/query-form-item.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@silver-formily/core'\nimport type { ISchema } from '@silver-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 '@silver-formily/core'\nimport { isNum } from '@silver-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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,QAAQ;EAiCd,MAAM,OAAO;EAKb,MAAM,yBAAuD;GAC3D,aAAa;GACb,UAAU;GACV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,EACpB,4BAA0B,uBAAqB,CAAA,EAAA;2BAkB1C,CAhBN,mBAgBM,OAAA,EAhBA,OAAK,eAAE,UAAS,EAAA,EAAA;mBACpB,YAGE,wBAFK,MAAM,SAAI,UAAe,MAAA,UAAS,CAAC,QAAQ,MAAA,UAAS,CAAA,EAAA,eAAA,mBACjD,kBAAA,MAAiB,CAAA,EAAA,MAAA,GAAA;KAE3B,mBAEM,OAAA,EAFA,OAAK,eAAA,GAAK,UAAS,WAAA,EAAA,EAAA,CACvB,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,EAAA;KAGF,MAAM,cAAA,WAAA,EADd,YAOE,MAAA,aAAA,EAPF,WAOE;;MALQ,gBAAc,eAAA;oEAAA,eAAc,QAAA;MAC5B,aAAW,YAAA;iEAAA,YAAW,QAAA;MAC7B,OAAK,GAAK,UAAS;QACZ,mBAAA,OAAkB,EACzB,OAAO,SAAA,OAAQ,CAAA,EAAA,MAAA,IAAA;MAAA;MAAA;MAAA;MAAA;MAAA,CAAA,IAAA,mBAAA,QAAA,KAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IFormItemProps } from "../form-item/types.js";
|
|
2
2
|
import { IQueryFormLightProps, IQueryFormProps } from "../query-form/types.js";
|
|
3
3
|
import { PaginationProps } from "element-plus";
|
|
4
|
-
import { Form } from "@formily/core";
|
|
5
|
-
import { ISchema } from "@formily/json-schema";
|
|
4
|
+
import { Form } from "@silver-formily/core";
|
|
5
|
+
import { ISchema } from "@silver-formily/json-schema";
|
|
6
6
|
|
|
7
7
|
//#region src/query-form-item/types.d.ts
|
|
8
8
|
type QueryFormItemMode = 'default' | 'light';
|
package/esm/radio/index.d.ts
CHANGED
|
@@ -4,10 +4,6 @@ import * as _$vue from "vue";
|
|
|
4
4
|
//#region src/radio/index.d.ts
|
|
5
5
|
declare const Radio: {
|
|
6
6
|
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
|
|
7
|
-
modelValue: {
|
|
8
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
9
|
-
default: undefined;
|
|
10
|
-
};
|
|
11
7
|
value: {
|
|
12
8
|
type: _$vue.PropType<string | number | boolean>;
|
|
13
9
|
default: undefined;
|
|
@@ -16,12 +12,16 @@ declare const Radio: {
|
|
|
16
12
|
type: _$vue.PropType<string>;
|
|
17
13
|
default: undefined;
|
|
18
14
|
};
|
|
15
|
+
size: {
|
|
16
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
17
|
+
};
|
|
19
18
|
disabled: {
|
|
20
19
|
type: _$vue.PropType<boolean>;
|
|
21
20
|
default: undefined;
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
type: _$vue.PropType<
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
24
|
+
default: undefined;
|
|
25
25
|
};
|
|
26
26
|
label: {
|
|
27
27
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -52,10 +52,6 @@ declare const Radio: {
|
|
|
52
52
|
M: {};
|
|
53
53
|
Defaults: {};
|
|
54
54
|
}, Readonly<_$vue.ExtractPropTypes<{
|
|
55
|
-
modelValue: {
|
|
56
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
57
|
-
default: undefined;
|
|
58
|
-
};
|
|
59
55
|
value: {
|
|
60
56
|
type: _$vue.PropType<string | number | boolean>;
|
|
61
57
|
default: undefined;
|
|
@@ -64,12 +60,16 @@ declare const Radio: {
|
|
|
64
60
|
type: _$vue.PropType<string>;
|
|
65
61
|
default: undefined;
|
|
66
62
|
};
|
|
63
|
+
size: {
|
|
64
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
65
|
+
};
|
|
67
66
|
disabled: {
|
|
68
67
|
type: _$vue.PropType<boolean>;
|
|
69
68
|
default: undefined;
|
|
70
69
|
};
|
|
71
|
-
|
|
72
|
-
type: _$vue.PropType<
|
|
70
|
+
modelValue: {
|
|
71
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
72
|
+
default: undefined;
|
|
73
73
|
};
|
|
74
74
|
label: {
|
|
75
75
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -94,10 +94,6 @@ declare const Radio: {
|
|
|
94
94
|
__isTeleport?: never;
|
|
95
95
|
__isSuspense?: never;
|
|
96
96
|
} & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
|
|
97
|
-
modelValue: {
|
|
98
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
99
|
-
default: undefined;
|
|
100
|
-
};
|
|
101
97
|
value: {
|
|
102
98
|
type: _$vue.PropType<string | number | boolean>;
|
|
103
99
|
default: undefined;
|
|
@@ -106,12 +102,16 @@ declare const Radio: {
|
|
|
106
102
|
type: _$vue.PropType<string>;
|
|
107
103
|
default: undefined;
|
|
108
104
|
};
|
|
105
|
+
size: {
|
|
106
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
107
|
+
};
|
|
109
108
|
disabled: {
|
|
110
109
|
type: _$vue.PropType<boolean>;
|
|
111
110
|
default: undefined;
|
|
112
111
|
};
|
|
113
|
-
|
|
114
|
-
type: _$vue.PropType<
|
|
112
|
+
modelValue: {
|
|
113
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
114
|
+
default: undefined;
|
|
115
115
|
};
|
|
116
116
|
label: {
|
|
117
117
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -141,10 +141,6 @@ declare const Radio: {
|
|
|
141
141
|
}) & _$vue.ObjectPlugin & {
|
|
142
142
|
RadioButton: {
|
|
143
143
|
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
|
|
144
|
-
modelValue: {
|
|
145
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
146
|
-
default: undefined;
|
|
147
|
-
};
|
|
148
144
|
value: {
|
|
149
145
|
type: _$vue.PropType<string | number | boolean>;
|
|
150
146
|
default: undefined;
|
|
@@ -153,12 +149,16 @@ declare const Radio: {
|
|
|
153
149
|
type: _$vue.PropType<string>;
|
|
154
150
|
default: undefined;
|
|
155
151
|
};
|
|
152
|
+
size: {
|
|
153
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
154
|
+
};
|
|
156
155
|
disabled: {
|
|
157
156
|
type: _$vue.PropType<boolean>;
|
|
158
157
|
default: undefined;
|
|
159
158
|
};
|
|
160
|
-
|
|
161
|
-
type: _$vue.PropType<
|
|
159
|
+
modelValue: {
|
|
160
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
161
|
+
default: undefined;
|
|
162
162
|
};
|
|
163
163
|
label: {
|
|
164
164
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -178,10 +178,6 @@ declare const Radio: {
|
|
|
178
178
|
M: {};
|
|
179
179
|
Defaults: {};
|
|
180
180
|
}, Readonly<_$vue.ExtractPropTypes<{
|
|
181
|
-
modelValue: {
|
|
182
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
183
|
-
default: undefined;
|
|
184
|
-
};
|
|
185
181
|
value: {
|
|
186
182
|
type: _$vue.PropType<string | number | boolean>;
|
|
187
183
|
default: undefined;
|
|
@@ -190,12 +186,16 @@ declare const Radio: {
|
|
|
190
186
|
type: _$vue.PropType<string>;
|
|
191
187
|
default: undefined;
|
|
192
188
|
};
|
|
189
|
+
size: {
|
|
190
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
191
|
+
};
|
|
193
192
|
disabled: {
|
|
194
193
|
type: _$vue.PropType<boolean>;
|
|
195
194
|
default: undefined;
|
|
196
195
|
};
|
|
197
|
-
|
|
198
|
-
type: _$vue.PropType<
|
|
196
|
+
modelValue: {
|
|
197
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
198
|
+
default: undefined;
|
|
199
199
|
};
|
|
200
200
|
label: {
|
|
201
201
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -212,10 +212,6 @@ declare const Radio: {
|
|
|
212
212
|
__isTeleport?: never;
|
|
213
213
|
__isSuspense?: never;
|
|
214
214
|
} & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
|
|
215
|
-
modelValue: {
|
|
216
|
-
type: _$vue.PropType<string | number | boolean>;
|
|
217
|
-
default: undefined;
|
|
218
|
-
};
|
|
219
215
|
value: {
|
|
220
216
|
type: _$vue.PropType<string | number | boolean>;
|
|
221
217
|
default: undefined;
|
|
@@ -224,12 +220,16 @@ declare const Radio: {
|
|
|
224
220
|
type: _$vue.PropType<string>;
|
|
225
221
|
default: undefined;
|
|
226
222
|
};
|
|
223
|
+
size: {
|
|
224
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
225
|
+
};
|
|
227
226
|
disabled: {
|
|
228
227
|
type: _$vue.PropType<boolean>;
|
|
229
228
|
default: undefined;
|
|
230
229
|
};
|
|
231
|
-
|
|
232
|
-
type: _$vue.PropType<
|
|
230
|
+
modelValue: {
|
|
231
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
232
|
+
default: undefined;
|
|
233
233
|
};
|
|
234
234
|
label: {
|
|
235
235
|
type: _$vue.PropType<string | number | boolean>;
|
|
@@ -248,9 +248,9 @@ declare const Radio: {
|
|
|
248
248
|
});
|
|
249
249
|
RadioGroup: {
|
|
250
250
|
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
|
|
251
|
-
|
|
252
|
-
type: _$vue.PropType<string
|
|
253
|
-
default:
|
|
251
|
+
fill: {
|
|
252
|
+
type: _$vue.PropType<string>;
|
|
253
|
+
default: "";
|
|
254
254
|
};
|
|
255
255
|
props: {
|
|
256
256
|
type: _$vue.PropType<_$element_plus0.radioOptionProp>;
|
|
@@ -264,16 +264,16 @@ declare const Radio: {
|
|
|
264
264
|
type: _$vue.PropType<string>;
|
|
265
265
|
default: undefined;
|
|
266
266
|
};
|
|
267
|
-
|
|
268
|
-
type: _$vue.PropType<
|
|
269
|
-
default: "";
|
|
267
|
+
size: {
|
|
268
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
270
269
|
};
|
|
271
270
|
disabled: {
|
|
272
271
|
type: _$vue.PropType<boolean>;
|
|
273
272
|
default: undefined;
|
|
274
273
|
};
|
|
275
|
-
|
|
276
|
-
type: _$vue.PropType<
|
|
274
|
+
modelValue: {
|
|
275
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
276
|
+
default: undefined;
|
|
277
277
|
};
|
|
278
278
|
options: {
|
|
279
279
|
type: _$vue.PropType<_$element_plus0.radioOption[]>;
|
|
@@ -317,9 +317,9 @@ declare const Radio: {
|
|
|
317
317
|
M: {};
|
|
318
318
|
Defaults: {};
|
|
319
319
|
}, Readonly<_$vue.ExtractPropTypes<{
|
|
320
|
-
|
|
321
|
-
type: _$vue.PropType<string
|
|
322
|
-
default:
|
|
320
|
+
fill: {
|
|
321
|
+
type: _$vue.PropType<string>;
|
|
322
|
+
default: "";
|
|
323
323
|
};
|
|
324
324
|
props: {
|
|
325
325
|
type: _$vue.PropType<_$element_plus0.radioOptionProp>;
|
|
@@ -333,16 +333,16 @@ declare const Radio: {
|
|
|
333
333
|
type: _$vue.PropType<string>;
|
|
334
334
|
default: undefined;
|
|
335
335
|
};
|
|
336
|
-
|
|
337
|
-
type: _$vue.PropType<
|
|
338
|
-
default: "";
|
|
336
|
+
size: {
|
|
337
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
339
338
|
};
|
|
340
339
|
disabled: {
|
|
341
340
|
type: _$vue.PropType<boolean>;
|
|
342
341
|
default: undefined;
|
|
343
342
|
};
|
|
344
|
-
|
|
345
|
-
type: _$vue.PropType<
|
|
343
|
+
modelValue: {
|
|
344
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
345
|
+
default: undefined;
|
|
346
346
|
};
|
|
347
347
|
options: {
|
|
348
348
|
type: _$vue.PropType<_$element_plus0.radioOption[]>;
|
|
@@ -380,9 +380,9 @@ declare const Radio: {
|
|
|
380
380
|
__isTeleport?: never;
|
|
381
381
|
__isSuspense?: never;
|
|
382
382
|
} & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
|
|
383
|
-
|
|
384
|
-
type: _$vue.PropType<string
|
|
385
|
-
default:
|
|
383
|
+
fill: {
|
|
384
|
+
type: _$vue.PropType<string>;
|
|
385
|
+
default: "";
|
|
386
386
|
};
|
|
387
387
|
props: {
|
|
388
388
|
type: _$vue.PropType<_$element_plus0.radioOptionProp>;
|
|
@@ -396,16 +396,16 @@ declare const Radio: {
|
|
|
396
396
|
type: _$vue.PropType<string>;
|
|
397
397
|
default: undefined;
|
|
398
398
|
};
|
|
399
|
-
|
|
400
|
-
type: _$vue.PropType<
|
|
401
|
-
default: "";
|
|
399
|
+
size: {
|
|
400
|
+
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
402
401
|
};
|
|
403
402
|
disabled: {
|
|
404
403
|
type: _$vue.PropType<boolean>;
|
|
405
404
|
default: undefined;
|
|
406
405
|
};
|
|
407
|
-
|
|
408
|
-
type: _$vue.PropType<
|
|
406
|
+
modelValue: {
|
|
407
|
+
type: _$vue.PropType<string | number | boolean>;
|
|
408
|
+
default: undefined;
|
|
409
409
|
};
|
|
410
410
|
options: {
|
|
411
411
|
type: _$vue.PropType<_$element_plus0.radioOption[]>;
|