@silver-formily/element-plus 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en-US.md +32 -32
- package/README.md +32 -32
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/index.mjs +18 -18
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.d.ts +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs +0 -2
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +59 -63
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +31 -38
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +33 -36
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +38 -43
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -9
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +34 -38
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +39 -41
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -12
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +63 -68
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +11 -18
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +25 -29
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +16 -16
- package/esm/autocomplete/index.d.ts +8 -8
- package/esm/autocomplete/index.mjs +18 -24
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +18 -22
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +27 -27
- package/esm/checkbox/index.mjs +21 -30
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +6 -9
- package/esm/color-picker/index.mjs.map +1 -1
- package/esm/color-picker-panel/index.mjs +6 -9
- package/esm/color-picker-panel/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +11 -14
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/date-picker/utils.mjs.map +1 -1
- package/esm/date-picker-panel/index.mjs +11 -14
- package/esm/date-picker-panel/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +12 -12
- package/esm/editable/index.d.ts +6 -6
- package/esm/editable/index.mjs +49 -58
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.d.ts +1 -0
- package/esm/form/form.mjs +10 -10
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +14 -25
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -9
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +19 -22
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs +0 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/form-grid.d.ts +2 -2
- package/esm/form-grid/hooks.d.ts +1 -2
- package/esm/form-grid/hooks.mjs +4 -11
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +39 -40
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +57 -65
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +8 -6
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +12 -16
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +2 -2
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +27 -30
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs +0 -3
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.d.ts +2 -1
- package/esm/form-tab/hooks.mjs +13 -20
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +38 -41
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.mjs +76 -76
- package/esm/input/index.mjs +26 -30
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +15 -15
- package/esm/input-number/index.mjs +8 -11
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.mjs +16 -20
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +20 -24
- package/esm/mention/index.mjs.map +1 -1
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +27 -40
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.mjs.map +1 -1
- package/esm/query-form/hooks.mjs.map +1 -1
- package/esm/query-form/index.d.ts +3 -3
- package/esm/query-form/index.mjs +55 -61
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form/query-form.d.ts +1 -1
- package/esm/query-form/types.d.ts +1 -1
- package/esm/query-form-item/index.mjs +37 -44
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.d.ts +18 -18
- package/esm/radio/index.mjs +30 -39
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +10 -13
- package/esm/rate/index.mjs.map +1 -1
- package/esm/reset/index.mjs +2 -2
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.mjs +13 -17
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.d.ts +16 -16
- package/esm/select/index.mjs +22 -26
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +6 -6
- package/esm/select-table/index.mjs +16 -21
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/slider/index.mjs +10 -13
- package/esm/slider/index.mjs.map +1 -1
- package/esm/styles/form-grid/index.css +1 -1
- package/esm/submit/index.mjs +3 -3
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +9 -9
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +6 -9
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.d.ts +12 -12
- package/esm/time-select/index.mjs +6 -9
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.d.ts +12 -12
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +29 -33
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs +0 -2
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +14 -18
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +12 -12
- package/esm/upload/index.mjs +10 -13
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +24 -24
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +111 -85
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +23 -29
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -7
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +56 -82
- package/LICENSE +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/preview-text/utils.ts"],"sourcesContent":["import type { SpaceProps, TagProps, TextProps } from 'element-plus'\nimport { computed, inject } from 'vue'\n\nexport interface PreviewTextProps {\n placeholder?: string\n tagProps?: Partial<TagProps> | Record<string, any>\n spaceProps?: Partial<SpaceProps> | Record<string, any>\n textProps?: Partial<TextProps> | Record<string, any>\n}\n\nexport const previewTextConfigKey = Symbol('previewTextConfig')\n\nexport function usePreviewConfig() {\n const previewConfig = inject(previewTextConfigKey, {}) as PreviewTextProps\n const placeholder = computed(() => previewConfig?.placeholder || 'N/A')\n const tagProps = computed<Partial<TagProps>>(() => previewConfig?.tagProps ?? { type: 'info' })\n const spaceProps = computed(() => previewConfig?.spaceProps || {})\n const textProps = computed(() => previewConfig?.textProps || {})\n return {\n placeholder,\n tagProps,\n spaceProps,\n textProps,\n }\n}\n"],"names":["previewTextConfigKey","usePreviewConfig","previewConfig","inject","placeholder","computed","tagProps","spaceProps","textProps"],"mappings":";AAUO,MAAMA,
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/preview-text/utils.ts"],"sourcesContent":["import type { SpaceProps, TagProps, TextProps } from 'element-plus'\r\nimport { computed, inject } from 'vue'\r\n\r\nexport interface PreviewTextProps {\r\n placeholder?: string\r\n tagProps?: Partial<TagProps> | Record<string, any>\r\n spaceProps?: Partial<SpaceProps> | Record<string, any>\r\n textProps?: Partial<TextProps> | Record<string, any>\r\n}\r\n\r\nexport const previewTextConfigKey = Symbol('previewTextConfig')\r\n\r\nexport function usePreviewConfig() {\r\n const previewConfig = inject(previewTextConfigKey, {}) as PreviewTextProps\r\n const placeholder = computed(() => previewConfig?.placeholder || 'N/A')\r\n const tagProps = computed<Partial<TagProps>>(() => previewConfig?.tagProps ?? { type: 'info' })\r\n const spaceProps = computed(() => previewConfig?.spaceProps || {})\r\n const textProps = computed(() => previewConfig?.textProps || {})\r\n return {\r\n placeholder,\r\n tagProps,\r\n spaceProps,\r\n textProps,\r\n }\r\n}\r\n"],"names":["previewTextConfigKey","usePreviewConfig","previewConfig","inject","placeholder","computed","tagProps","spaceProps","textProps"],"mappings":";AAUO,MAAMA,2BAA8B,mBAAmB;AAEvD,SAASC,IAAmB;AACjC,QAAMC,IAAgBC,EAAOH,GAAsB,EAAE,GAC/CI,IAAcC,EAAS,MAAMH,GAAe,eAAe,KAAK,GAChEI,IAAWD,EAA4B,MAAMH,GAAe,YAAY,EAAE,MAAM,QAAQ,GACxFK,IAAaF,EAAS,MAAMH,GAAe,cAAc,CAAA,CAAE,GAC3DM,IAAYH,EAAS,MAAMH,GAAe,aAAa,CAAA,CAAE;AAC/D,SAAO;AAAA,IACL,aAAAE;AAAA,IACA,UAAAE;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,EAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-components.mjs","sources":["../../src/query-form/default-components.ts"],"sourcesContent":["import type { Component } from 'vue'\nimport { Autocomplete } from '../autocomplete'\nimport { Cascader } from '../cascader'\nimport { Checkbox } from '../checkbox'\nimport { ColorPicker } from '../color-picker'\nimport { DatePicker } from '../date-picker'\nimport { FormItem } from '../form-item'\nimport { Input } from '../input'\nimport { InputNumber } from '../input-number'\nimport { Password } from '../password'\nimport { Radio } from '../radio'\nimport { Rate } from '../rate'\nimport { Select } from '../select'\nimport { Slider } from '../slider'\nimport { Switch } from '../switch'\nimport { TimePicker } from '../time-picker'\nimport { TimeSelect } from '../time-select'\nimport { TreeSelect } from '../tree-select'\n\nexport const queryFormAutoComponents: Record<string, Component> = {\n FormItem,\n Input,\n Autocomplete,\n InputNumber,\n Password,\n Checkbox,\n Radio,\n Select,\n TreeSelect,\n Cascader,\n Switch,\n Rate,\n Slider,\n ColorPicker,\n DatePicker,\n TimePicker,\n TimeSelect,\n}\n\nexport function mergeQueryFormComponents(components?: Record<string, Component>) {\n return {\n ...queryFormAutoComponents,\n ...components,\n }\n}\n"],"names":["queryFormAutoComponents","FormItem","Input","Autocomplete","InputNumber","Password","Checkbox","Radio","Select","TreeSelect","Cascader","Switch","Rate","Slider","ColorPicker","DatePicker","TimePicker","TimeSelect","mergeQueryFormComponents","components"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,MAAMA,IAAqD;AAAA,EAChE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF;AAEO,SAASC,EAAyBC,GAAwC;AAC/E,SAAO;AAAA,IACL,GAAGnB;AAAA,IACH,GAAGmB;AAAA,EAAA;AAEP;"}
|
|
1
|
+
{"version":3,"file":"default-components.mjs","sources":["../../src/query-form/default-components.ts"],"sourcesContent":["import type { Component } from 'vue'\r\nimport { Autocomplete } from '../autocomplete'\r\nimport { Cascader } from '../cascader'\r\nimport { Checkbox } from '../checkbox'\r\nimport { ColorPicker } from '../color-picker'\r\nimport { DatePicker } from '../date-picker'\r\nimport { FormItem } from '../form-item'\r\nimport { Input } from '../input'\r\nimport { InputNumber } from '../input-number'\r\nimport { Password } from '../password'\r\nimport { Radio } from '../radio'\r\nimport { Rate } from '../rate'\r\nimport { Select } from '../select'\r\nimport { Slider } from '../slider'\r\nimport { Switch } from '../switch'\r\nimport { TimePicker } from '../time-picker'\r\nimport { TimeSelect } from '../time-select'\r\nimport { TreeSelect } from '../tree-select'\r\n\r\nexport const queryFormAutoComponents: Record<string, Component> = {\r\n FormItem,\r\n Input,\r\n Autocomplete,\r\n InputNumber,\r\n Password,\r\n Checkbox,\r\n Radio,\r\n Select,\r\n TreeSelect,\r\n Cascader,\r\n Switch,\r\n Rate,\r\n Slider,\r\n ColorPicker,\r\n DatePicker,\r\n TimePicker,\r\n TimeSelect,\r\n}\r\n\r\nexport function mergeQueryFormComponents(components?: Record<string, Component>) {\r\n return {\r\n ...queryFormAutoComponents,\r\n ...components,\r\n }\r\n}\r\n"],"names":["queryFormAutoComponents","FormItem","Input","Autocomplete","InputNumber","Password","Checkbox","Radio","Select","TreeSelect","Cascader","Switch","Rate","Slider","ColorPicker","DatePicker","TimePicker","TimeSelect","mergeQueryFormComponents","components"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,MAAMA,IAAqD;AAAA,EAChE,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF;AAEO,SAASC,EAAyBC,GAAwC;AAC/E,SAAO;AAAA,IACL,GAAGnB;AAAA,IACH,GAAGmB;AAAA,EAAA;AAEP;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.mjs","sources":["../../src/query-form/hooks.ts"],"sourcesContent":["import type { Form } from '@formily/core'\nimport type { ISchema } from '@formily/json-schema'\nimport type { Component, ComputedRef, MaybeRefOrGetter, Slots } from 'vue'\nimport { isFn } from '@formily/shared'\nimport { createSchemaField } from '@silver-formily/vue'\nimport { computed, toValue } from 'vue'\nimport { mergeQueryFormComponents } from './default-components'\n\nfunction resolveExternalForm(form: unknown): Form | undefined {\n if (isFn(form))\n return (form as () => Form | undefined)()\n return form as Form | undefined\n}\n\ninterface UseQueryFormFormOptions {\n formProps: MaybeRefOrGetter<{ form?: unknown }>\n fallbackForm?: MaybeRefOrGetter<Form | undefined>\n}\n\nexport function useQueryFormForm(options: UseQueryFormFormOptions) {\n const externalForm = computed<Form | undefined>(() => resolveExternalForm(toValue(options.formProps)?.form))\n const activeForm = computed<Form | undefined>(() => externalForm.value ?? toValue(options.fallbackForm))\n\n return {\n externalForm,\n activeForm,\n }\n}\n\ninterface UseQueryFormSchemaFieldOptions {\n slots: Slots\n schema: ComputedRef<ISchema | undefined>\n schemaField: ComputedRef<Component | undefined>\n components: ComputedRef<Record<string, Component> | undefined>\n scope?: ComputedRef<Record<string, any> | undefined>\n}\n\nexport function useQueryFormSchemaField(options: UseQueryFormSchemaFieldOptions) {\n const hasDefaultSlot = computed(() => Boolean(options.slots.default))\n const mergedComponents = computed(() => mergeQueryFormComponents(options.components.value))\n const schemaField = computed<Component | null>(() => {\n if (hasDefaultSlot.value || !options.schema.value)\n return null\n return options.schemaField.value ?? createSchemaField({\n components: mergedComponents.value,\n scope: options.scope?.value,\n }).SchemaField\n })\n\n return {\n hasDefaultSlot,\n schemaField,\n }\n}\n"],"names":["resolveExternalForm","form","isFn","useQueryFormForm","options","externalForm","computed","toValue","activeForm","useQueryFormSchemaField","hasDefaultSlot","mergedComponents","mergeQueryFormComponents","schemaField","createSchemaField"],"mappings":";;;;AAQA,SAASA,EAAoBC,GAAiC;AAC5D,SAAIC,EAAKD,CAAI,IACHA,EAAA,IACHA;AACT;AAOO,SAASE,EAAiBC,GAAkC;AACjE,QAAMC,IAAeC,EAA2B,MAAMN,EAAoBO,EAAQH,EAAQ,SAAS,GAAG,IAAI,CAAC,GACrGI,IAAaF,EAA2B,MAAMD,EAAa,SAASE,EAAQH,EAAQ,YAAY,CAAC;AAEvG,SAAO;AAAA,IACL,cAAAC;AAAA,IACA,YAAAG;AAAA,EAAA;AAEJ;AAUO,SAASC,EAAwBL,GAAyC;AAC/E,QAAMM,IAAiBJ,EAAS,MAAM,EAAQF,EAAQ,MAAM,OAAQ,GAC9DO,IAAmBL,EAAS,MAAMM,EAAyBR,EAAQ,WAAW,KAAK,CAAC,GACpFS,IAAcP,EAA2B,MACzCI,EAAe,SAAS,CAACN,EAAQ,OAAO,QACnC,OACFA,EAAQ,YAAY,SAASU,EAAkB;AAAA,IACpD,YAAYH,EAAiB;AAAA,IAC7B,OAAOP,EAAQ,OAAO;AAAA,EAAA,CACvB,EAAE,WACJ;AAED,SAAO;AAAA,IACL,gBAAAM;AAAA,IACA,aAAAG;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sources":["../../src/query-form/hooks.ts"],"sourcesContent":["import type { Form } from '@formily/core'\r\nimport type { ISchema } from '@formily/json-schema'\r\nimport type { Component, ComputedRef, MaybeRefOrGetter, Slots } from 'vue'\r\nimport { isFn } from '@formily/shared'\r\nimport { createSchemaField } from '@silver-formily/vue'\r\nimport { computed, toValue } from 'vue'\r\nimport { mergeQueryFormComponents } from './default-components'\r\n\r\nfunction resolveExternalForm(form: unknown): Form | undefined {\r\n if (isFn(form))\r\n return (form as () => Form | undefined)()\r\n return form as Form | undefined\r\n}\r\n\r\ninterface UseQueryFormFormOptions {\r\n formProps: MaybeRefOrGetter<{ form?: unknown }>\r\n fallbackForm?: MaybeRefOrGetter<Form | undefined>\r\n}\r\n\r\nexport function useQueryFormForm(options: UseQueryFormFormOptions) {\r\n const externalForm = computed<Form | undefined>(() => resolveExternalForm(toValue(options.formProps)?.form))\r\n const activeForm = computed<Form | undefined>(() => externalForm.value ?? toValue(options.fallbackForm))\r\n\r\n return {\r\n externalForm,\r\n activeForm,\r\n }\r\n}\r\n\r\ninterface UseQueryFormSchemaFieldOptions {\r\n slots: Slots\r\n schema: ComputedRef<ISchema | undefined>\r\n schemaField: ComputedRef<Component | undefined>\r\n components: ComputedRef<Record<string, Component> | undefined>\r\n scope?: ComputedRef<Record<string, any> | undefined>\r\n}\r\n\r\nexport function useQueryFormSchemaField(options: UseQueryFormSchemaFieldOptions) {\r\n const hasDefaultSlot = computed(() => Boolean(options.slots.default))\r\n const mergedComponents = computed(() => mergeQueryFormComponents(options.components.value))\r\n const schemaField = computed<Component | null>(() => {\r\n if (hasDefaultSlot.value || !options.schema.value)\r\n return null\r\n return options.schemaField.value ?? createSchemaField({\r\n components: mergedComponents.value,\r\n scope: options.scope?.value,\r\n }).SchemaField\r\n })\r\n\r\n return {\r\n hasDefaultSlot,\r\n schemaField,\r\n }\r\n}\r\n"],"names":["resolveExternalForm","form","isFn","useQueryFormForm","options","externalForm","computed","toValue","activeForm","useQueryFormSchemaField","hasDefaultSlot","mergedComponents","mergeQueryFormComponents","schemaField","createSchemaField"],"mappings":";;;;AAQA,SAASA,EAAoBC,GAAiC;AAC5D,SAAIC,EAAKD,CAAI,IACHA,EAAA,IACHA;AACT;AAOO,SAASE,EAAiBC,GAAkC;AACjE,QAAMC,IAAeC,EAA2B,MAAMN,EAAoBO,EAAQH,EAAQ,SAAS,GAAG,IAAI,CAAC,GACrGI,IAAaF,EAA2B,MAAMD,EAAa,SAASE,EAAQH,EAAQ,YAAY,CAAC;AAEvG,SAAO;AAAA,IACL,cAAAC;AAAA,IACA,YAAAG;AAAA,EAAA;AAEJ;AAUO,SAASC,EAAwBL,GAAyC;AAC/E,QAAMM,IAAiBJ,EAAS,MAAM,EAAQF,EAAQ,MAAM,OAAQ,GAC9DO,IAAmBL,EAAS,MAAMM,EAAyBR,EAAQ,WAAW,KAAK,CAAC,GACpFS,IAAcP,EAA2B,MACzCI,EAAe,SAAS,CAACN,EAAQ,OAAO,QACnC,OACFA,EAAQ,YAAY,SAASU,EAAkB;AAAA,IACpD,YAAYH,EAAiB;AAAA,IAC7B,OAAOP,EAAQ,OAAO;AAAA,EAAA,CACvB,EAAE,WACJ;AAED,SAAO;AAAA,IACL,gBAAAM;AAAA,IACA,aAAAG;AAAA,EAAA;AAEJ;"}
|
|
@@ -2,7 +2,7 @@ export type { IQueryFormLightProps, IQueryFormProps, QueryFormVisible, QueryForm
|
|
|
2
2
|
export declare const QueryForm: {
|
|
3
3
|
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./types').IQueryFormProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
4
4
|
components: Record<string, import('vue').Component>;
|
|
5
|
-
gridProps: Omit<import('
|
|
5
|
+
gridProps: Omit<import('../../../grid/src').IGridOptions, "shouldVisible" | "maxRows">;
|
|
6
6
|
defaultExpanded: boolean;
|
|
7
7
|
showToggle: boolean;
|
|
8
8
|
actionsAtRowEnd: boolean;
|
|
@@ -21,7 +21,7 @@ export declare const QueryForm: {
|
|
|
21
21
|
Defaults: {};
|
|
22
22
|
}, Readonly<import('./types').IQueryFormProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
23
23
|
components: Record<string, import('vue').Component>;
|
|
24
|
-
gridProps: Omit<import('
|
|
24
|
+
gridProps: Omit<import('../../../grid/src').IGridOptions, "shouldVisible" | "maxRows">;
|
|
25
25
|
defaultExpanded: boolean;
|
|
26
26
|
showToggle: boolean;
|
|
27
27
|
actionsAtRowEnd: boolean;
|
|
@@ -37,7 +37,7 @@ export declare const QueryForm: {
|
|
|
37
37
|
__isSuspense?: never;
|
|
38
38
|
} & import('vue').ComponentOptionsBase<Readonly<import('./types').IQueryFormProps> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
39
39
|
components: Record<string, import('vue').Component>;
|
|
40
|
-
gridProps: Omit<import('
|
|
40
|
+
gridProps: Omit<import('../../../grid/src').IGridOptions, "shouldVisible" | "maxRows">;
|
|
41
41
|
defaultExpanded: boolean;
|
|
42
42
|
showToggle: boolean;
|
|
43
43
|
actionsAtRowEnd: boolean;
|
package/esm/query-form/index.mjs
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { reaction as
|
|
3
|
-
import "@vueuse/core";
|
|
4
|
-
import { defineComponent as Z, useSlots as ee, computed as d, onUnmounted as te, createBlock as r, openBlock as l, unref as o, mergeProps as f, withCtx as n, createElementVNode as be, normalizeClass as I, renderSlot as x, createCommentVNode as h, resolveDynamicComponent as oe, ref as K, createVNode as W, normalizeStyle as M, normalizeProps as _, createTextVNode as b, toDisplayString as g } from "vue";
|
|
5
|
-
import "@formily/core";
|
|
6
|
-
import "@silver-formily/reactive-vue";
|
|
1
|
+
import { defineComponent as Z, useSlots as ee, computed as d, onUnmounted as te, openBlock as l, createBlock as a, unref as o, mergeProps as f, withCtx as n, createElementVNode as fe, normalizeClass as G, renderSlot as x, resolveDynamicComponent as oe, createCommentVNode as h, ref as K, createVNode as W, normalizeStyle as M, normalizeProps as _, createTextVNode as b, toDisplayString as g } from "vue";
|
|
2
|
+
import { reaction as he, toJS as we, autorun as ye } from "@formily/reactive";
|
|
7
3
|
import { useForm as se, useFieldSchema as ne } from "@silver-formily/vue";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { _ as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { ArrowUp as
|
|
4
|
+
import { useQueryFormForm as le, useQueryFormSchemaField as ae } from "./hooks.mjs";
|
|
5
|
+
import { t as ve } from "../vendor/lodash.mjs";
|
|
6
|
+
import { _ as re } from "../form/form.mjs";
|
|
7
|
+
import { useCleanAttrs as ie, compatibleUnderlineProp as be, composeExport as ge } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { stylePrefix as ue } from "../__builtins__/configs/index.mjs";
|
|
9
|
+
import { ArrowUp as Fe, ArrowDown as _e } from "@element-plus/icons-vue";
|
|
14
10
|
import { Schema as X } from "@formily/json-schema";
|
|
11
|
+
import { createGrid as xe } from "@silver-formily/grid";
|
|
12
|
+
import { ElLink as Se, ElIcon as Re } from "element-plus";
|
|
15
13
|
import { FormButtonGroup as O } from "../form-button-group/index.mjs";
|
|
16
14
|
import { FormGrid as Y } from "../form-grid/index.mjs";
|
|
17
|
-
import { createFormGrid as Re } from "../form-grid/hooks.mjs";
|
|
18
15
|
import { Reset as H } from "../reset/index.mjs";
|
|
19
16
|
import { Submit as J } from "../submit/index.mjs";
|
|
20
17
|
import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
@@ -30,46 +27,46 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
30
27
|
},
|
|
31
28
|
emits: ["autoSubmit", "autoSubmitFailed"],
|
|
32
29
|
setup(q, { emit: e }) {
|
|
33
|
-
const w = q, C = e, { props:
|
|
34
|
-
formProps:
|
|
30
|
+
const w = q, C = e, { props: r } = ie(["modelValue", "onUpdate:modelValue"]), D = ee(), L = se(), z = ne(), P = `${ue}-query-form-light`, { externalForm: N, activeForm: T } = le({
|
|
31
|
+
formProps: r,
|
|
35
32
|
fallbackForm: L
|
|
36
33
|
}), A = d(() => w.schema ?? z.value), Q = d(() => ({
|
|
37
34
|
fullness: !1,
|
|
38
|
-
...
|
|
35
|
+
...r.value,
|
|
39
36
|
form: N.value
|
|
40
37
|
}));
|
|
41
38
|
function $() {
|
|
42
|
-
T.value.submit((i) => (C("autoSubmit", i),
|
|
43
|
-
C("autoSubmitFailed", i),
|
|
39
|
+
T.value.submit((i) => (C("autoSubmit", i), r.value.onAutoSubmit?.(i))).catch((i) => {
|
|
40
|
+
C("autoSubmitFailed", i), r.value.onAutoSubmitFailed?.(i);
|
|
44
41
|
});
|
|
45
42
|
}
|
|
46
|
-
const E =
|
|
43
|
+
const E = ve(() => {
|
|
47
44
|
$();
|
|
48
45
|
}, w.throttleWait, {
|
|
49
46
|
leading: !1,
|
|
50
47
|
trailing: !0
|
|
51
|
-
}), V =
|
|
48
|
+
}), V = he(() => {
|
|
52
49
|
const y = T.value;
|
|
53
50
|
if (y)
|
|
54
|
-
return
|
|
51
|
+
return we(y.values);
|
|
55
52
|
}, () => {
|
|
56
53
|
E();
|
|
57
54
|
});
|
|
58
55
|
te(() => {
|
|
59
56
|
V(), E.cancel();
|
|
60
57
|
});
|
|
61
|
-
const { hasDefaultSlot: S, schemaField: R } =
|
|
58
|
+
const { hasDefaultSlot: S, schemaField: R } = ae({
|
|
62
59
|
slots: D,
|
|
63
60
|
schema: A,
|
|
64
61
|
schemaField: d(() => w.schemaField),
|
|
65
62
|
components: d(() => w.components)
|
|
66
63
|
});
|
|
67
|
-
return (y, i) => (l(),
|
|
64
|
+
return (y, i) => (l(), a(o(re), f(Q.value, { class: P }), {
|
|
68
65
|
default: n(() => [
|
|
69
|
-
|
|
70
|
-
class:
|
|
66
|
+
fe("div", {
|
|
67
|
+
class: G(`${P}__content`)
|
|
71
68
|
}, [
|
|
72
|
-
o(S) ? x(y.$slots, "default", { key: 0 }) : o(R) ? (l(),
|
|
69
|
+
o(S) ? x(y.$slots, "default", { key: 0 }) : o(R) ? (l(), a(oe(o(R)), {
|
|
73
70
|
key: 1,
|
|
74
71
|
schema: A.value
|
|
75
72
|
}, null, 8, ["schema"])) : h("", !0)
|
|
@@ -102,7 +99,7 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
102
99
|
resetProps: {}
|
|
103
100
|
},
|
|
104
101
|
setup(q) {
|
|
105
|
-
const e = q, { props: w } =
|
|
102
|
+
const e = q, { props: w } = ie(["modelValue", "onUpdate:modelValue"]), C = ee(), r = `${ue}-query-form`, D = Y.GridColumn, L = ne(), z = se(), { externalForm: P, activeForm: N } = le({
|
|
106
103
|
formProps: w,
|
|
107
104
|
fallbackForm: z
|
|
108
105
|
}), T = d(() => ({
|
|
@@ -111,7 +108,6 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
111
108
|
form: P.value
|
|
112
109
|
})), A = d(() => {
|
|
113
110
|
const t = e.schema ?? L.value;
|
|
114
|
-
/* istanbul ignore next -- @preserve defensive: schema can be temporarily absent in external field-schema lifecycle */
|
|
115
111
|
return t ? (t instanceof X ? t : new X(t)).mapProperties((c, p) => ({
|
|
116
112
|
name: p,
|
|
117
113
|
schema: c
|
|
@@ -121,10 +117,10 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
121
117
|
return N.value?.query(t).take();
|
|
122
118
|
}
|
|
123
119
|
function $(t, s, c) {
|
|
124
|
-
const p = t.index ?? 0,
|
|
120
|
+
const p = t.index ?? 0, B = A.value[p], I = B?.schema, U = B?.name ?? I?.name;
|
|
125
121
|
return {
|
|
126
122
|
field: Q(U),
|
|
127
|
-
schema:
|
|
123
|
+
schema: I,
|
|
128
124
|
index: p,
|
|
129
125
|
node: t,
|
|
130
126
|
grid: s,
|
|
@@ -140,14 +136,14 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
140
136
|
return !1;
|
|
141
137
|
if (!(R(t.grid) > F))
|
|
142
138
|
return !0;
|
|
143
|
-
const
|
|
139
|
+
const B = t.node.shadowColumn ?? 1, I = t.node.span ?? 1, U = B + I - 1;
|
|
144
140
|
return !(s === F && U === t.grid.columns);
|
|
145
141
|
}
|
|
146
142
|
function V(t) {
|
|
147
143
|
return (e.visibleWhen ? e.visibleWhen(t) : E(t)) !== !1;
|
|
148
144
|
}
|
|
149
145
|
function S(t, s) {
|
|
150
|
-
return t.element ? t.element.dataset.queryFormActions !== void 0 : t.index === s.childSize - 1;
|
|
146
|
+
return "element" in t && t.element ? t.element.dataset.queryFormActions !== void 0 : t.index === s.childSize - 1;
|
|
151
147
|
}
|
|
152
148
|
function R(t) {
|
|
153
149
|
const s = (t.children ?? []).filter((c) => !S(c, t)).map((c) => c.shadowRow ?? 0);
|
|
@@ -158,7 +154,7 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
158
154
|
...i,
|
|
159
155
|
maxRows: e.defaultExpanded || !e.showToggle ? 1 / 0 : F,
|
|
160
156
|
shouldVisible: y
|
|
161
|
-
}, u =
|
|
157
|
+
}, u = xe(me), v = K(u.maxRows === 1 / 0), m = K("complete-wrap");
|
|
162
158
|
function ce() {
|
|
163
159
|
if (!e.showToggle) {
|
|
164
160
|
m.value = "incomplete-wrap";
|
|
@@ -168,47 +164,45 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
168
164
|
m.value = R(u) > F ? "collapsible" : "incomplete-wrap";
|
|
169
165
|
return;
|
|
170
166
|
}
|
|
171
|
-
|
|
172
|
-
/* istanbul ignore next -- @preserve layout branch depends on runtime grid measurement in browser */
|
|
173
|
-
if (s) {
|
|
167
|
+
if ((u.children ?? []).some((p) => S(p, u) ? !1 : !V($(p, u, !0)))) {
|
|
174
168
|
m.value = "collapsible";
|
|
175
169
|
return;
|
|
176
170
|
}
|
|
177
171
|
const c = u.shadowRows;
|
|
178
172
|
m.value = c < F + 1 ? "incomplete-wrap" : "complete-wrap";
|
|
179
173
|
}
|
|
180
|
-
const de =
|
|
174
|
+
const de = ye(() => {
|
|
181
175
|
v.value = u.maxRows === 1 / 0, ce();
|
|
182
176
|
});
|
|
183
177
|
te(de);
|
|
184
178
|
function k() {
|
|
185
179
|
e.showToggle && (u.maxRows = u.maxRows === 1 / 0 ? F : 1 / 0);
|
|
186
180
|
}
|
|
187
|
-
const { hasDefaultSlot: pe, schemaField: j } =
|
|
181
|
+
const { hasDefaultSlot: pe, schemaField: j } = ae({
|
|
188
182
|
slots: C,
|
|
189
183
|
schema: d(() => e.schema),
|
|
190
184
|
schemaField: d(() => e.schemaField),
|
|
191
185
|
components: d(() => e.components),
|
|
192
186
|
scope: d(() => e.scope)
|
|
193
187
|
});
|
|
194
|
-
return (t, s) => (l(),
|
|
188
|
+
return (t, s) => (l(), a(o(re), f(T.value, { class: r }), {
|
|
195
189
|
default: n(() => [
|
|
196
190
|
W(o(Y), { grid: o(u) }, {
|
|
197
191
|
default: n(() => [
|
|
198
|
-
o(pe) ? x(t.$slots, "default", { key: 0 }) : o(j) ? (l(),
|
|
192
|
+
o(pe) ? x(t.$slots, "default", { key: 0 }) : o(j) ? (l(), a(oe(o(j)), {
|
|
199
193
|
key: 1,
|
|
200
194
|
schema: e.schema
|
|
201
195
|
}, null, 8, ["schema"])) : h("", !0),
|
|
202
196
|
W(o(D), {
|
|
203
197
|
"grid-span": -1,
|
|
204
198
|
"data-query-form-actions": "",
|
|
205
|
-
class:
|
|
206
|
-
`${
|
|
207
|
-
e.actionsAtRowEnd && `${
|
|
199
|
+
class: G([
|
|
200
|
+
`${r}__actions`,
|
|
201
|
+
e.actionsAtRowEnd && `${r}__actions--row-end`
|
|
208
202
|
])
|
|
209
203
|
}, {
|
|
210
204
|
default: n(() => [
|
|
211
|
-
m.value === "incomplete-wrap" ? (l(),
|
|
205
|
+
m.value === "incomplete-wrap" ? (l(), a(o(O), {
|
|
212
206
|
key: 0,
|
|
213
207
|
align: e.actionsAtRowEnd ? "right" : "left",
|
|
214
208
|
"align-form-item": "",
|
|
@@ -221,13 +215,13 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
221
215
|
toggle: k,
|
|
222
216
|
type: m.value
|
|
223
217
|
}, () => [
|
|
224
|
-
e.showSubmit ? (l(),
|
|
218
|
+
e.showSubmit ? (l(), a(o(J), _(f({ key: 0 }, e.submitProps)), {
|
|
225
219
|
default: n(() => [
|
|
226
220
|
b(g(e.submitText), 1)
|
|
227
221
|
]),
|
|
228
222
|
_: 1
|
|
229
223
|
}, 16)) : h("", !0),
|
|
230
|
-
e.showReset ? (l(),
|
|
224
|
+
e.showReset ? (l(), a(o(H), _(f({ key: 1 }, e.resetProps)), {
|
|
231
225
|
default: n(() => [
|
|
232
226
|
b(g(e.resetText), 1)
|
|
233
227
|
]),
|
|
@@ -236,7 +230,7 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
236
230
|
])
|
|
237
231
|
]),
|
|
238
232
|
_: 3
|
|
239
|
-
}, 8, ["align", "style"])) : m.value === "collapsible" && e.showToggle ? (l(),
|
|
233
|
+
}, 8, ["align", "style"])) : m.value === "collapsible" && e.showToggle ? (l(), a(o(O), {
|
|
240
234
|
key: 1,
|
|
241
235
|
align: e.actionsAtRowEnd ? "right" : "left",
|
|
242
236
|
"align-form-item": "",
|
|
@@ -249,13 +243,13 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
249
243
|
toggle: k,
|
|
250
244
|
type: m.value
|
|
251
245
|
}, () => [
|
|
252
|
-
e.showSubmit ? (l(),
|
|
246
|
+
e.showSubmit ? (l(), a(o(J), _(f({ key: 0 }, e.submitProps)), {
|
|
253
247
|
default: n(() => [
|
|
254
248
|
b(g(e.submitText), 1)
|
|
255
249
|
]),
|
|
256
250
|
_: 1
|
|
257
251
|
}, 16)) : h("", !0),
|
|
258
|
-
e.showReset ? (l(),
|
|
252
|
+
e.showReset ? (l(), a(o(H), _(f({ key: 1 }, e.resetProps)), {
|
|
259
253
|
default: n(() => [
|
|
260
254
|
b(g(e.resetText), 1)
|
|
261
255
|
]),
|
|
@@ -267,19 +261,19 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
267
261
|
toggle: k,
|
|
268
262
|
type: m.value
|
|
269
263
|
}, () => [
|
|
270
|
-
W(o(
|
|
264
|
+
W(o(Se), {
|
|
271
265
|
type: "primary",
|
|
272
|
-
underline: o(
|
|
273
|
-
class:
|
|
266
|
+
underline: o(be)(),
|
|
267
|
+
class: G(`${r}__collapse-link`),
|
|
274
268
|
onClick: k
|
|
275
269
|
}, {
|
|
276
270
|
default: n(() => [
|
|
277
271
|
b(g(v.value ? e.collapseText : e.expandText) + " ", 1),
|
|
278
|
-
W(o(
|
|
279
|
-
class:
|
|
272
|
+
W(o(Re), {
|
|
273
|
+
class: G(`${r}__collapse-icon`)
|
|
280
274
|
}, {
|
|
281
275
|
default: n(() => [
|
|
282
|
-
v.value ? (l(),
|
|
276
|
+
v.value ? (l(), a(o(Fe), { key: 0 })) : (l(), a(o(_e), { key: 1 }))
|
|
283
277
|
]),
|
|
284
278
|
_: 1
|
|
285
279
|
}, 8, ["class"])
|
|
@@ -289,7 +283,7 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
289
283
|
])
|
|
290
284
|
]),
|
|
291
285
|
_: 3
|
|
292
|
-
}, 8, ["align", "style"])) : (l(),
|
|
286
|
+
}, 8, ["align", "style"])) : (l(), a(o(O), {
|
|
293
287
|
key: 2,
|
|
294
288
|
align: "right",
|
|
295
289
|
inline: "",
|
|
@@ -301,13 +295,13 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
301
295
|
toggle: k,
|
|
302
296
|
type: m.value
|
|
303
297
|
}, () => [
|
|
304
|
-
e.showSubmit ? (l(),
|
|
298
|
+
e.showSubmit ? (l(), a(o(J), _(f({ key: 0 }, e.submitProps)), {
|
|
305
299
|
default: n(() => [
|
|
306
300
|
b(g(e.submitText), 1)
|
|
307
301
|
]),
|
|
308
302
|
_: 1
|
|
309
303
|
}, 16)) : h("", !0),
|
|
310
|
-
e.showReset ? (l(),
|
|
304
|
+
e.showReset ? (l(), a(o(H), _(f({ key: 1 }, e.resetProps)), {
|
|
311
305
|
default: n(() => [
|
|
312
306
|
b(g(e.resetText), 1)
|
|
313
307
|
]),
|
|
@@ -327,11 +321,11 @@ import '../styles/query-form/index.css';const ke = /* @__PURE__ */ Z({
|
|
|
327
321
|
_: 3
|
|
328
322
|
}, 16));
|
|
329
323
|
}
|
|
330
|
-
}),
|
|
324
|
+
}), Oe = ge(Ce, {
|
|
331
325
|
Light: ke
|
|
332
326
|
});
|
|
333
327
|
export {
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
Oe as QueryForm,
|
|
329
|
+
Oe as default
|
|
336
330
|
};
|
|
337
331
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/query-form/query-form-light.vue","../../src/query-form/query-form.vue","../../src/query-form/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Form } from '@formily/core'\nimport type { IQueryFormLightProps } from './types'\nimport { reaction, toJS } from '@formily/reactive'\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 formProps.value.onAutoSubmit?.(values)\n })\n .catch((error) => {\n emit('autoSubmitFailed', error)\n formProps.value.onAutoSubmitFailed?.(error)\n })\n}\n\nconst triggerSubmit = throttle(() => {\n submitByChange()\n}, props.throttleWait, {\n leading: false,\n trailing: true,\n})\n\nconst dispose = reaction(() => {\n const form = activeForm.value\n if (!form)\n return\n return toJS(form.values)\n}, () => {\n triggerSubmit()\n})\n\nonUnmounted(() => {\n dispose()\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","<script setup lang=\"ts\">\nimport type { Grid, GridNode, IGridOptions } from '@formily/grid'\nimport type { ISchema } from '@formily/json-schema'\nimport type { IQueryFormProps, SchemaEntry } from './types'\nimport { ArrowDown, ArrowUp } from '@element-plus/icons-vue'\nimport { Schema } from '@formily/json-schema'\nimport { autorun } from '@formily/reactive'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { ElIcon, ElLink } from 'element-plus'\nimport { computed, onUnmounted, 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 { createFormGrid } from '../form-grid/hooks'\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 (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 internalGrid = createFormGrid(gridOptions)\nconst grid = internalGrid\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\nconst dispose = autorun(() => {\n expanded.value = grid.maxRows === Infinity\n updateType()\n})\n\nonUnmounted(dispose)\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","import { composeExport } from '../__builtins__/shared'\nimport QueryFormLightInner from './query-form-light.vue'\nimport QueryFormInner from './query-form.vue'\nimport './style.scss'\n\nexport type { IQueryFormLightProps, IQueryFormProps, QueryFormVisible, QueryFormVisibleContext } from './types'\n\nexport const QueryForm = composeExport(QueryFormInner, {\n Light: QueryFormLightInner,\n})\n\nexport default QueryForm\n"],"names":["props","__props","emit","__emit","formProps","useCleanAttrs","slots","useSlots","formRef","useForm","fieldSchemaRef","useFieldSchema","prefixCls","stylePrefix","externalForm","activeForm","useQueryFormForm","resolvedSchema","computed","innerFormProps","submitByChange","values","error","triggerSubmit","throttle","dispose","reaction","form","toJS","onUnmounted","hasDefaultSlot","schemaField","useQueryFormSchemaField","_openBlock","_createBlock","_unref","_mergeProps","_createElementVNode","_renderSlot","_ctx","_resolveDynamicComponent","COLLAPSED_ROWS","FormGridColumn","FormGrid","schemaList","rawSchema","Schema","childSchema","name","resolveField","createVisibleContext","node","grid","collapsedOverride","index","entry","schema","defaultVisibleWhen","context","shadowRow","getFieldRowCount","shadowColumn","span","endColumn","resolveVisibleWhen","isActionsNode","rows","defaultShouldVisible","restGridProps","gridOptions","createFormGrid","expanded","ref","gridType","updateType","hasHiddenInCollapsed","realRows","autorun","toggle","_createVNode","_normalizeClass","FormButtonGroup","_normalizeStyle","Submit","_normalizeProps","_createTextVNode","_toDisplayString","Reset","ElLink","compatibleUnderlineProp","ElIcon","ArrowUp","ArrowDown","QueryForm","composeExport","QueryFormInner","QueryFormLightInner"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,UAAMA,IAAQC,GAIRC,IAAOC,GAKP,EAAE,OAAOC,EAAA,IAAcC,GAAc,CAAC,cAAc,qBAAqB,CAAC,GAC1EC,IAAQC,GAAA,GACRC,IAAUC,GAAA,GACVC,IAAiBC,GAAA,GACjBC,IAAY,GAAGC,EAAW,qBAE1B,EAAE,cAAAC,GAAc,YAAAC,EAAA,IAAeC,GAAiB;AAAA,MACpD,WAAAZ;AAAA,MACA,cAAcI;AAAA,IAAA,CACf,GACKS,IAAiBC,EAAS,MAAMlB,EAAM,UAAUU,EAAe,KAAK,GAEpES,IAAiBD,EAAS,OAAO;AAAA,MACrC,UAAU;AAAA,MACV,GAAGd,EAAU;AAAA,MACb,MAAMU,EAAa;AAAA,IAAA,EACnB;AAEF,aAASM,IAAiB;AAExB,MADaL,EAAW,MAErB,OAAO,CAACM,OACPnB,EAAK,cAAcmB,CAAM,GAClBjB,EAAU,MAAM,eAAeiB,CAAM,EAC7C,EACA,MAAM,CAACC,MAAU;AAChB,QAAApB,EAAK,oBAAoBoB,CAAK,GAC9BlB,EAAU,MAAM,qBAAqBkB,CAAK;AAAA,MAC5C,CAAC;AAAA,IACL;AAEA,UAAMC,IAAgBC,GAAS,MAAM;AACnC,MAAAJ,EAAA;AAAA,IACF,GAAGpB,EAAM,cAAc;AAAA,MACrB,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,CACX,GAEKyB,IAAUC,GAAS,MAAM;AAC7B,YAAMC,IAAOZ,EAAW;AACxB,UAAKY;AAEL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AYO;AAAA,oBAZP3C,EAYOC,EAAA,QAAA,WAAA;AAAA,sBAVJ,UAAUgC,EAAA;AAAA,sBACV,QAAAO;AAAA,sBACA,MAAML,EAAA;AAAA,oBAAA,GAJT,MAYO;AAAA,sBANSzE,EAAM,mBAApBkC,EAESC,EAAAgD,CAAA,GAAAC,EAAAhD,EAAA,EAAA,KAAA,EAAA,GAF+BpC,EAAM,WAAW,CAAA,GAAA;AAAA,mCACvD,MAAsB;AAAA,0BAAnBqF,EAAAC,EAAAtF,EAAM,UAAU,GAAA,CAAA;AAAA,wBAAA;;;sBAERA,EAAM,kBAAnBkC,EAEQC,EAAAoD,CAAA,GAAAH,EAAAhD,EAAA,EAAA,KAAA,EAAA,GAF8BpC,EAAM,UAAU,CAAA,GAAA;AAAA,mCACpD,MAAqB;AAAA,0BAAlBqF,EAAAC,EAAAtF,EAAM,SAAS,GAAA,CAAA;AAAA,wBAAA;;;;;;;;;;;;;;;;;ICzSrB6F,KAAYC,GAAcC,IAAgB;AAAA,EACrD,OAAOC;AACT,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/query-form/query-form-light.vue","../../src/query-form/query-form.vue","../../src/query-form/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { Form } from '@formily/core'\r\nimport type { IQueryFormLightProps } from './types'\r\nimport { reaction, toJS } from '@formily/reactive'\r\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\r\nimport { throttle } from 'lodash-es'\r\nimport { computed, onUnmounted, useSlots } from 'vue'\r\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\r\nimport { Form as FForm } from '../form'\r\nimport { useQueryFormForm, useQueryFormSchemaField } from './hooks'\r\n\r\ndefineOptions({\r\n name: 'FQueryFormLight',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IQueryFormLightProps>(), {\r\n components: () => ({}),\r\n throttleWait: 300,\r\n})\r\nconst emit = defineEmits<{\r\n (e: 'autoSubmit', values: Form['values']): void\r\n (e: 'autoSubmitFailed', error: any): void\r\n}>()\r\n\r\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\r\nconst slots = useSlots()\r\nconst formRef = useForm()\r\nconst fieldSchemaRef = useFieldSchema()\r\nconst prefixCls = `${stylePrefix}-query-form-light`\r\n\r\nconst { externalForm, activeForm } = useQueryFormForm({\r\n formProps,\r\n fallbackForm: formRef,\r\n})\r\nconst resolvedSchema = computed(() => props.schema ?? fieldSchemaRef.value)\r\n\r\nconst innerFormProps = computed(() => ({\r\n fullness: false,\r\n ...formProps.value,\r\n form: externalForm.value,\r\n}))\r\n\r\nfunction submitByChange() {\r\n const form = activeForm.value\r\n form\r\n .submit((values) => {\r\n emit('autoSubmit', values)\r\n return formProps.value.onAutoSubmit?.(values)\r\n })\r\n .catch((error) => {\r\n emit('autoSubmitFailed', error)\r\n formProps.value.onAutoSubmitFailed?.(error)\r\n })\r\n}\r\n\r\nconst triggerSubmit = throttle(() => {\r\n submitByChange()\r\n}, props.throttleWait, {\r\n leading: false,\r\n trailing: true,\r\n})\r\n\r\nconst dispose = reaction(() => {\r\n const form = activeForm.value\r\n if (!form)\r\n return\r\n return toJS(form.values)\r\n}, () => {\r\n triggerSubmit()\r\n})\r\n\r\nonUnmounted(() => {\r\n dispose()\r\n triggerSubmit.cancel()\r\n})\r\n\r\nconst { hasDefaultSlot, schemaField } = useQueryFormSchemaField({\r\n slots,\r\n schema: resolvedSchema,\r\n schemaField: computed(() => props.schemaField),\r\n components: computed(() => props.components),\r\n})\r\n</script>\r\n\r\n<template>\r\n <FForm v-bind=\"innerFormProps\" :class=\"prefixCls\">\r\n <div :class=\"`${prefixCls}__content`\">\r\n <slot v-if=\"hasDefaultSlot\" />\r\n <component\r\n :is=\"schemaField\"\r\n v-else-if=\"schemaField\"\r\n :schema=\"resolvedSchema\"\r\n />\r\n </div>\r\n </FForm>\r\n</template>\r\n","<script setup lang=\"ts\">\r\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 { autorun } from '@formily/reactive'\nimport { createGrid } from '@silver-formily/grid'\nimport { useFieldSchema, useForm } from '@silver-formily/vue'\nimport { ElIcon, ElLink } from 'element-plus'\nimport { computed, onUnmounted, 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\r\ndefineOptions({\r\n name: 'FQueryForm',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IQueryFormProps>(), {\r\n components: () => ({}),\r\n gridProps: () => ({}),\r\n defaultExpanded: false,\r\n showToggle: true,\r\n actionsAtRowEnd: false,\r\n submitText: '查询',\r\n resetText: '重置',\r\n expandText: '展开',\r\n collapseText: '收起',\r\n showSubmit: true,\r\n showReset: true,\r\n})\r\n\r\nconst { props: formProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\r\nconst slots = useSlots()\r\nconst prefixCls = `${stylePrefix}-query-form`\r\nconst FormGridColumn = FormGrid.GridColumn\r\n\r\nconst COLLAPSED_ROWS = 1\r\nconst fieldSchemaRef = useFieldSchema()\r\nconst formRef = useForm()\r\nconst { externalForm, activeForm } = useQueryFormForm({\r\n formProps,\r\n fallbackForm: formRef,\r\n})\r\nconst innerFormProps = computed(() => ({\r\n fullness: true,\r\n ...formProps.value,\r\n form: externalForm.value,\r\n}))\r\n\r\nconst schemaList = computed<SchemaEntry[]>(() => {\r\n const rawSchema = props.schema ?? fieldSchemaRef.value\r\n /* istanbul ignore next -- @preserve defensive: schema can be temporarily absent in external field-schema lifecycle */\r\n if (!rawSchema)\r\n return []\r\n const schema = rawSchema instanceof Schema ? rawSchema : new Schema(rawSchema)\r\n return schema.mapProperties((childSchema: ISchema, name: string | number) => ({\r\n name,\r\n schema: childSchema,\r\n }))\r\n})\r\n\r\nfunction resolveField(name?: string | number) {\r\n return activeForm.value?.query(name).take()\r\n}\r\n\r\nfunction createVisibleContext(\r\n node: GridNode,\r\n grid: Grid<HTMLElement>,\r\n collapsedOverride?: boolean,\r\n) {\r\n const index = node.index ?? 0\r\n const entry = schemaList.value[index]\r\n const schema = entry?.schema\r\n const name = entry?.name ?? schema?.name\r\n return {\r\n field: resolveField(name),\r\n schema,\r\n index,\r\n node,\r\n grid,\r\n collapsed: collapsedOverride ?? grid.maxRows !== Infinity,\r\n breakpoint: grid.breakpoint,\r\n }\r\n}\r\n\r\nfunction defaultVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\r\n if (!context.collapsed)\r\n return true\r\n\r\n const shadowRow = context.node.shadowRow ?? 0\r\n const withinRows = shadowRow < COLLAPSED_ROWS + 1\r\n if (!withinRows)\r\n return false\r\n\r\n const isCollapsible = getFieldRowCount(context.grid) > COLLAPSED_ROWS\r\n if (!isCollapsible)\r\n return true\r\n const shadowColumn = context.node.shadowColumn ?? 1\r\n const span = context.node.span ?? 1\r\n const endColumn = shadowColumn + span - 1\r\n if (shadowRow === COLLAPSED_ROWS && endColumn === context.grid.columns)\r\n return false\r\n\r\n return true\r\n}\r\n\r\nfunction resolveVisibleWhen(context: ReturnType<typeof createVisibleContext>) {\r\n const visible = props.visibleWhen\r\n ? props.visibleWhen(context)\r\n : defaultVisibleWhen(context)\r\n return visible !== false\r\n}\r\n\r\nfunction isActionsNode(node: GridNode, grid: Grid<HTMLElement>) {\r\n if ('element' in node && node.element) {\r\n return node.element.dataset.queryFormActions !== undefined\r\n }\r\n return node.index === grid.childSize - 1\r\n}\r\n\r\nfunction getFieldRowCount(grid: Grid<HTMLElement>) {\r\n const rows = (grid.children ?? [])\r\n .filter(node => !isActionsNode(node, grid))\r\n .map(node => node.shadowRow ?? 0)\r\n return new Set(rows).size\r\n}\r\n\r\nconst defaultShouldVisible: IGridOptions['shouldVisible'] = (node, grid) => {\r\n if (isActionsNode(node, grid))\r\n return true\r\n return resolveVisibleWhen(createVisibleContext(node, grid))\r\n}\r\n\r\nconst restGridProps = props.gridProps ?? {}\r\nconst defaultGridProps: Partial<IGridOptions> = restGridProps.minColumns === undefined && restGridProps.maxColumns === undefined\r\n ? { maxColumns: 4 }\r\n : {}\r\n\r\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\r\nconst expanded = ref(grid.maxRows === Infinity)\r\nconst gridType = ref<'incomplete-wrap' | 'collapsible' | 'complete-wrap'>('complete-wrap')\r\n\r\nfunction updateType() {\r\n if (!props.showToggle) {\r\n gridType.value = 'incomplete-wrap'\r\n return\r\n }\r\n\r\n if (!props.visibleWhen) {\r\n gridType.value = getFieldRowCount(grid) > COLLAPSED_ROWS\r\n ? 'collapsible'\r\n : 'incomplete-wrap'\r\n return\r\n }\r\n\r\n const nodes = grid.children ?? []\r\n const hasHiddenInCollapsed = nodes.some((node) => {\r\n if (isActionsNode(node, grid))\r\n return false\r\n return !resolveVisibleWhen(createVisibleContext(node, grid, true))\r\n })\r\n /* istanbul ignore next -- @preserve layout branch depends on runtime grid measurement in browser */\r\n if (hasHiddenInCollapsed) {\r\n gridType.value = 'collapsible'\r\n return\r\n }\r\n const realRows = grid.shadowRows\r\n gridType.value = realRows < COLLAPSED_ROWS + 1 ? 'incomplete-wrap' : 'complete-wrap'\r\n}\r\n\r\nconst dispose = autorun(() => {\r\n expanded.value = grid.maxRows === Infinity\r\n updateType()\r\n})\r\n\r\nonUnmounted(dispose)\r\n\r\nfunction toggle() {\r\n if (!props.showToggle)\r\n return\r\n grid.maxRows = grid.maxRows === Infinity ? COLLAPSED_ROWS : Infinity\r\n}\r\n\r\nconst { hasDefaultSlot, schemaField } = useQueryFormSchemaField({\r\n slots,\r\n schema: computed(() => props.schema),\r\n schemaField: computed(() => props.schemaField),\r\n components: computed(() => props.components),\r\n scope: computed(() => props.scope),\r\n})\r\n</script>\r\n\r\n<template>\r\n <Form v-bind=\"innerFormProps\" :class=\"prefixCls\">\r\n <FormGrid :grid=\"grid\">\r\n <slot v-if=\"hasDefaultSlot\" />\r\n <component\r\n :is=\"schemaField\"\r\n v-else-if=\"schemaField\"\r\n :schema=\"props.schema\"\r\n />\r\n <FormGridColumn\r\n :grid-span=\"-1\"\r\n data-query-form-actions\r\n :class=\"[\r\n `${prefixCls}__actions`,\r\n props.actionsAtRowEnd && `${prefixCls}__actions--row-end`,\r\n ]\"\r\n >\r\n <template v-if=\"gridType === 'incomplete-wrap'\">\r\n <FormButtonGroup\r\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\r\n align-form-item\r\n inline\r\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\r\n >\r\n <slot\r\n name=\"actions\"\r\n :expanded=\"expanded\"\r\n :toggle=\"toggle\"\r\n :type=\"gridType\"\r\n >\r\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\r\n {{ props.submitText }}\r\n </Submit>\r\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\r\n {{ props.resetText }}\r\n </Reset>\r\n </slot>\r\n </FormButtonGroup>\r\n </template>\r\n <template v-else-if=\"gridType === 'collapsible' && props.showToggle\">\r\n <FormButtonGroup\r\n :align=\"props.actionsAtRowEnd ? 'right' : 'left'\"\r\n align-form-item\r\n inline\r\n :style=\"props.actionsAtRowEnd && { width: '100%' }\"\r\n >\r\n <slot\r\n name=\"actions\"\r\n :expanded=\"expanded\"\r\n :toggle=\"toggle\"\r\n :type=\"gridType\"\r\n >\r\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\r\n {{ props.submitText }}\r\n </Submit>\r\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\r\n {{ props.resetText }}\r\n </Reset>\r\n </slot>\r\n <slot\r\n name=\"collapse\"\r\n :expanded=\"expanded\"\r\n :toggle=\"toggle\"\r\n :type=\"gridType\"\r\n >\r\n <ElLink\r\n type=\"primary\"\r\n :underline=\"compatibleUnderlineProp()\"\r\n :class=\"`${prefixCls}__collapse-link`\"\r\n @click=\"toggle\"\r\n >\r\n {{ expanded ? props.collapseText : props.expandText }}\r\n <ElIcon :class=\"`${prefixCls}__collapse-icon`\">\r\n <ArrowUp v-if=\"expanded\" />\r\n <ArrowDown v-else />\r\n </ElIcon>\r\n </ElLink>\r\n </slot>\r\n </FormButtonGroup>\r\n </template>\r\n <template v-else>\r\n <FormButtonGroup\r\n align=\"right\"\r\n inline\r\n style=\"display: flex; width: 100%;\"\r\n >\r\n <slot\r\n name=\"actions\"\r\n :expanded=\"expanded\"\r\n :toggle=\"toggle\"\r\n :type=\"gridType\"\r\n >\r\n <Submit v-if=\"props.showSubmit\" v-bind=\"props.submitProps\">\r\n {{ props.submitText }}\r\n </Submit>\r\n <Reset v-if=\"props.showReset\" v-bind=\"props.resetProps\">\r\n {{ props.resetText }}\r\n </Reset>\r\n </slot>\r\n </FormButtonGroup>\r\n </template>\r\n </FormGridColumn>\r\n </FormGrid>\r\n </Form>\r\n</template>\r\n","import { composeExport } from '../__builtins__/shared'\r\nimport QueryFormLightInner from './query-form-light.vue'\r\nimport QueryFormInner from './query-form.vue'\r\nimport './style.scss'\r\n\r\nexport type { IQueryFormLightProps, IQueryFormProps, QueryFormVisible, QueryFormVisibleContext } from './types'\r\n\r\nexport const QueryForm = composeExport(QueryFormInner, {\r\n Light: QueryFormLightInner,\r\n})\r\n\r\nexport default QueryForm\r\n"],"names":["props","__props","emit","__emit","formProps","useCleanAttrs","slots","useSlots","formRef","useForm","fieldSchemaRef","useFieldSchema","prefixCls","stylePrefix","externalForm","activeForm","useQueryFormForm","resolvedSchema","computed","innerFormProps","submitByChange","values","error","triggerSubmit","throttle","dispose","reaction","form","toJS","onUnmounted","hasDefaultSlot","schemaField","useQueryFormSchemaField","_openBlock","_createBlock","_unref","_mergeProps","_createElementVNode","_renderSlot","_ctx","_resolveDynamicComponent","COLLAPSED_ROWS","FormGridColumn","FormGrid","schemaList","rawSchema","Schema","childSchema","name","resolveField","createVisibleContext","node","grid","collapsedOverride","index","entry","schema","defaultVisibleWhen","context","shadowRow","getFieldRowCount","shadowColumn","span","endColumn","resolveVisibleWhen","isActionsNode","rows","defaultShouldVisible","restGridProps","gridOptions","createGrid","expanded","ref","gridType","updateType","realRows","autorun","toggle","_createVNode","_normalizeClass","FormButtonGroup","_normalizeStyle","Submit","_normalizeProps","_createTextVNode","_toDisplayString","Reset","ElLink","compatibleUnderlineProp","ElIcon","ArrowUp","ArrowDown","QueryForm","composeExport","QueryFormInner","QueryFormLightInner"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,UAAMA,IAAQC,GAIRC,IAAOC,GAKP,EAAE,OAAOC,EAAA,IAAcC,GAAc,CAAC,cAAc,qBAAqB,CAAC,GAC1EC,IAAQC,GAAA,GACRC,IAAUC,GAAA,GACVC,IAAiBC,GAAA,GACjBC,IAAY,GAAGC,EAAW,qBAE1B,EAAE,cAAAC,GAAc,YAAAC,EAAA,IAAeC,GAAiB;AAAA,MACpD,WAAAZ;AAAA,MACA,cAAcI;AAAA,IAAA,CACf,GACKS,IAAiBC,EAAS,MAAMlB,EAAM,UAAUU,EAAe,KAAK,GAEpES,IAAiBD,EAAS,OAAO;AAAA,MACrC,UAAU;AAAA,MACV,GAAGd,EAAU;AAAA,MACb,MAAMU,EAAa;AAAA,IAAA,EACnB;AAEF,aAASM,IAAiB;AAExB,MADaL,EAAW,MAErB,OAAO,CAACM,OACPnB,EAAK,cAAcmB,CAAM,GAClBjB,EAAU,MAAM,eAAeiB,CAAM,EAC7C,EACA,MAAM,CAACC,MAAU;AAChB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frC,EAA2BC,EAAAuD,EAAA,GAAA,EAAA,KAAA,EAAA,CAAA,WAC3BxD,EAAoBC,EAAAwD,EAAA,GAAA,EAAA,KAAA,GAAA;AAAA,4BAAA;;;;;;;;;mDAO5BzD,EAkBkBC,EAAA6C,CAAA,GAAA;AAAA;kBAjBhB,OAAM;AAAA,kBACN,QAAA;AAAA,kBACA,OAAA,EAAA,SAAA,QAAA,OAAA,OAAA;AAAA,gBAAA;6BAEA,MAYO;AAAA,oBAZP1C,EAYOC,EAAA,QAAA,WAAA;AAAA,sBAVJ,UAAUgC,EAAA;AAAA,sBACV,QAAAM;AAAA,sBACA,MAAMJ,EAAA;AAAA,oBAAA,GAJT,MAYO;AAAA,sBANSzE,EAAM,mBAApBkC,EAESC,EAAA+C,CAAA,GAAAC,EAAA/C,EAAA,EAAA,KAAA,EAAA,GAF+BpC,EAAM,WAAW,CAAA,GAAA;AAAA,mCACvD,MAAsB;AAAA,0BAAnBoF,EAAAC,EAAArF,EAAM,UAAU,GAAA,CAAA;AAAA,wBAAA;;;sBAERA,EAAM,kBAAnBkC,EAEQC,EAAAmD,CAAA,GAAAH,EAAA/C,EAAA,EAAA,KAAA,EAAA,GAF8BpC,EAAM,UAAU,CAAA,GAAA;AAAA,mCACpD,MAAqB;AAAA,0BAAlBoF,EAAAC,EAAArF,EAAM,SAAS,GAAA,CAAA;AAAA,wBAAA;;;;;;;;;;;;;;;;;ICxSrB4F,KAAYC,GAAcC,IAAgB;AAAA,EACrD,OAAOC;AACT,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneralField } from '@formily/core';
|
|
2
|
-
import { Grid, GridNode, IGridOptions } from '@formily/grid';
|
|
3
2
|
import { ISchema } from '@formily/json-schema';
|
|
3
|
+
import { Grid, GridNode, IGridOptions } from '../../../grid/src';
|
|
4
4
|
import { Component } from 'vue';
|
|
5
5
|
export interface QueryFormVisibleContext {
|
|
6
6
|
field?: GeneralField;
|