@nocobase/client 0.9.2-alpha.4 → 0.9.4-alpha.1
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/es/acl/ACLProvider.js +2 -2
- package/es/acl/Configuration/RoleConfigure.js +15 -8
- package/es/api-client/APIClient.d.ts +2 -0
- package/es/api-client/APIClient.js +11 -0
- package/es/block-provider/BlockProvider.js +58 -17
- package/es/block-provider/DetailsBlockProvider.js +13 -1
- package/es/block-provider/FormBlockProvider.js +30 -13
- package/es/block-provider/hooks/index.d.ts +10 -0
- package/es/block-provider/hooks/index.js +521 -283
- package/es/collection-manager/CollectionField.js +3 -3
- package/es/collection-manager/CollectionFieldProvider.js +2 -1
- package/es/collection-manager/Configuration/AddFieldAction.js +3 -3
- package/es/collection-manager/Configuration/CollectionFields.d.ts +1 -1
- package/es/collection-manager/Configuration/CollectionFields.js +2 -5
- package/es/collection-manager/Configuration/ConfigurationTabs.js +7 -6
- package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/es/collection-manager/action-hooks.d.ts +1 -1
- package/es/collection-manager/action-hooks.js +18 -7
- package/es/collection-manager/hooks/useCollection.d.ts +1 -1
- package/es/collection-manager/hooks/useCollectionDataSource.js +4 -4
- package/es/collection-manager/interfaces/createdBy.js +1 -1
- package/es/collection-manager/interfaces/linkTo.js +3 -39
- package/es/collection-manager/interfaces/m2m.js +4 -38
- package/es/collection-manager/interfaces/m2o.js +4 -38
- package/es/collection-manager/interfaces/o2m.js +4 -68
- package/es/collection-manager/interfaces/o2o.js +25 -119
- package/es/collection-manager/interfaces/updatedBy.js +1 -1
- package/es/collection-manager/templates/expression.js +1 -1
- package/es/collection-manager/templates/tree.js +2 -2
- package/es/filter-provider/FilterProvider.js +3 -1
- package/es/filter-provider/utils.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locale/en_US.d.ts +19 -1
- package/es/locale/en_US.js +22 -4
- package/es/locale/es_ES.d.ts +692 -0
- package/es/locale/es_ES.js +691 -0
- package/es/locale/ja_JP.d.ts +8 -1
- package/es/locale/ja_JP.js +9 -2
- package/es/locale/pt_BR.d.ts +5 -1
- package/es/locale/pt_BR.js +6 -2
- package/es/locale/ru_RU.d.ts +5 -1
- package/es/locale/ru_RU.js +6 -2
- package/es/locale/tr_TR.d.ts +5 -1
- package/es/locale/tr_TR.js +6 -2
- package/es/locale/zh_CN.d.ts +27 -1
- package/es/locale/zh_CN.js +28 -2
- package/es/record-provider/index.d.ts +4 -0
- package/es/record-provider/index.js +3 -0
- package/es/schema-component/antd/action/Action.Designer.js +10 -8
- package/es/schema-component/antd/action/Action.Drawer.js +4 -1
- package/es/schema-component/antd/action/ActionBar.js +25 -18
- package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/es/schema-component/antd/association-field/AssociationFieldProvider.js +30 -0
- package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/es/schema-component/antd/association-field/AssociationSelect.js +63 -0
- package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/es/schema-component/antd/association-field/Editable.js +112 -0
- package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/es/schema-component/antd/association-field/FileManager.js +243 -0
- package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalNester.js +29 -0
- package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalPicker.js +236 -0
- package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
- package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalViewer.js +112 -0
- package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/es/schema-component/antd/association-field/Nester.js +71 -0
- package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/es/schema-component/antd/association-field/ReadPretty.js +22 -0
- package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/SubTable.js +25 -0
- package/es/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
- package/es/schema-component/antd/association-field/components/CreateRecordAction.js +61 -0
- package/es/schema-component/antd/association-field/context.d.ts +8 -0
- package/es/schema-component/antd/association-field/context.js +2 -0
- package/es/schema-component/antd/association-field/hooks.d.ts +9 -0
- package/es/schema-component/antd/association-field/hooks.js +96 -0
- package/es/schema-component/antd/association-field/index.d.ts +1 -0
- package/es/schema-component/antd/association-field/index.js +14 -0
- package/es/schema-component/antd/association-field/schema.d.ts +142 -0
- package/es/schema-component/antd/association-field/schema.js +141 -0
- package/es/schema-component/antd/association-field/util.d.ts +8 -0
- package/es/schema-component/antd/association-field/util.js +84 -0
- package/es/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
- package/es/schema-component/antd/association-select/AssociationSelect.js +49 -231
- package/es/schema-component/antd/association-select/useServiceOptions.js +2 -2
- package/es/schema-component/antd/collection-select/CollectionSelect.js +5 -0
- package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
- package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
- package/es/schema-component/antd/expand-action/index.d.ts +1 -0
- package/es/schema-component/antd/expand-action/index.js +5 -0
- package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/es/schema-component/antd/filter/FilterItem.js +1 -1
- package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/es/schema-component/antd/form/Form.js +4 -4
- package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/es/schema-component/antd/form-item/FormItem.js +263 -168
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +39 -61
- package/es/schema-component/antd/form-v2/Form.Designer.js +1 -0
- package/es/schema-component/antd/form-v2/Templates.d.ts +20 -0
- package/es/schema-component/antd/form-v2/Templates.js +40 -12
- package/es/schema-component/antd/form-v2/utils.js +3 -1
- package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/es/schema-component/antd/grid/Grid.js +34 -24
- package/es/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
- package/es/schema-component/antd/grid-card/GridCard.Decorator.js +65 -0
- package/es/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
- package/es/schema-component/antd/grid-card/GridCard.Designer.js +243 -0
- package/es/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
- package/es/schema-component/antd/grid-card/GridCard.Item.js +18 -0
- package/es/schema-component/antd/grid-card/GridCard.d.ts +8 -0
- package/es/schema-component/antd/grid-card/GridCard.js +103 -0
- package/es/schema-component/antd/grid-card/hooks.d.ts +4 -0
- package/es/schema-component/antd/grid-card/hooks.js +9 -0
- package/es/schema-component/antd/grid-card/index.d.ts +1 -0
- package/es/schema-component/antd/grid-card/index.js +1 -0
- package/es/schema-component/antd/grid-card/options.d.ts +20 -0
- package/es/schema-component/antd/grid-card/options.js +20 -0
- package/es/schema-component/antd/index.d.ts +5 -1
- package/es/schema-component/antd/index.js +5 -1
- package/es/schema-component/antd/list/List.Decorator.d.ts +5 -0
- package/es/schema-component/antd/list/List.Decorator.js +59 -0
- package/es/schema-component/antd/list/List.Designer.d.ts +1 -0
- package/es/schema-component/antd/list/List.Designer.js +205 -0
- package/es/schema-component/antd/list/List.Item.d.ts +1 -0
- package/es/schema-component/antd/list/List.Item.js +15 -0
- package/es/schema-component/antd/list/List.d.ts +8 -0
- package/es/schema-component/antd/list/List.js +83 -0
- package/es/schema-component/antd/list/hooks.d.ts +4 -0
- package/es/schema-component/antd/list/hooks.js +9 -0
- package/es/schema-component/antd/list/index.d.ts +1 -0
- package/es/schema-component/antd/list/index.js +1 -0
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
- package/es/schema-component/antd/remote-select/RemoteSelect.js +23 -23
- package/es/schema-component/antd/select/Select.js +2 -0
- package/es/schema-component/antd/table/Table.Void.Designer.js +1 -0
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
- package/es/schema-component/antd/table-v2/Table.js +9 -5
- package/es/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
- package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
- package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
- package/es/schema-component/antd/table-v2/hooks/useUserVariable.js +65 -0
- package/es/schema-component/antd/table-v2/index.js +3 -1
- package/es/schema-component/antd/table-v2/utils.js +1 -1
- package/es/schema-component/antd/variable/Input.js +11 -8
- package/es/schema-component/antd/variable/TextArea.js +2 -5
- package/es/schema-component/common/dnd-context/index.js +3 -2
- package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-component/core/SchemaComponentProvider.js +2 -2
- package/es/schema-component/hooks/index.d.ts +1 -0
- package/es/schema-component/hooks/index.js +2 -1
- package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
- package/es/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
- package/es/schema-initializer/SchemaInitializerProvider.js +23 -10
- package/es/schema-initializer/buttons/BlockInitializers.js +10 -0
- package/es/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
- package/es/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
- package/es/schema-initializer/buttons/FormActionInitializers.js +106 -100
- package/es/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
- package/es/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
- package/es/schema-initializer/buttons/GridCardActionInitializers.js +278 -0
- package/es/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
- package/es/schema-initializer/buttons/ListActionInitializers.js +278 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/es/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
- package/es/schema-initializer/buttons/TableActionInitializers.js +29 -35
- package/es/schema-initializer/buttons/TableColumnInitializers.js +4 -1
- package/es/schema-initializer/buttons/index.d.ts +3 -0
- package/es/schema-initializer/buttons/index.js +3 -0
- package/es/schema-initializer/components/BulkEditField.js +7 -5
- package/es/schema-initializer/components/CreateRecordAction.d.ts +2 -1
- package/es/schema-initializer/components/CreateRecordAction.js +55 -33
- package/es/schema-initializer/components/DeletedField.d.ts +1 -0
- package/es/schema-initializer/components/DeletedField.js +11 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.js +35 -23
- package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
- package/es/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/GridCardBlockInitializer.js +47 -0
- package/es/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/ListBlockInitializer.js +47 -0
- package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
- package/es/schema-initializer/items/index.d.ts +3 -0
- package/es/schema-initializer/items/index.js +3 -0
- package/es/schema-initializer/utils.d.ts +112 -0
- package/es/schema-initializer/utils.js +224 -38
- package/es/schema-items/GeneralSchemaItems.d.ts +4 -0
- package/es/schema-items/GeneralSchemaItems.js +148 -0
- package/es/schema-items/index.d.ts +1 -0
- package/es/schema-items/index.js +2 -1
- package/es/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
- package/es/schema-settings/DataTemplates/FormDataTemplates.js +117 -42
- package/es/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
- package/es/schema-settings/DataTemplates/components/Designer.js +179 -0
- package/es/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
- package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -96
- package/es/schema-settings/GeneralSchemaDesigner.js +19 -15
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/es/schema-settings/LinkageRules/Variables.js +7 -4
- package/es/schema-settings/SchemaSettings.d.ts +1 -1
- package/es/schema-settings/SchemaSettings.js +53 -29
- package/es/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
- package/es/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
- package/es/schema-settings/hooks/useIsShowMultipleSwitch.js +18 -0
- package/es/schema-templates/BlockTemplateDetails.js +1 -1
- package/es/user/CurrentUser.js +118 -10
- package/lib/acl/ACLProvider.js +2 -2
- package/lib/acl/Configuration/RoleConfigure.js +15 -8
- package/lib/api-client/APIClient.d.ts +2 -0
- package/lib/api-client/APIClient.js +11 -0
- package/lib/block-provider/BlockProvider.js +57 -16
- package/lib/block-provider/DetailsBlockProvider.js +13 -1
- package/lib/block-provider/FormBlockProvider.js +31 -15
- package/lib/block-provider/hooks/index.d.ts +10 -0
- package/lib/block-provider/hooks/index.js +531 -290
- package/lib/collection-manager/CollectionField.js +3 -3
- package/lib/collection-manager/CollectionFieldProvider.js +2 -1
- package/lib/collection-manager/Configuration/AddFieldAction.js +2 -2
- package/lib/collection-manager/Configuration/CollectionFields.d.ts +1 -1
- package/lib/collection-manager/Configuration/CollectionFields.js +2 -5
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +7 -6
- package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/lib/collection-manager/action-hooks.d.ts +1 -1
- package/lib/collection-manager/action-hooks.js +18 -7
- package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
- package/lib/collection-manager/hooks/useCollectionDataSource.js +4 -4
- package/lib/collection-manager/interfaces/createdBy.js +1 -1
- package/lib/collection-manager/interfaces/linkTo.js +2 -38
- package/lib/collection-manager/interfaces/m2m.js +3 -37
- package/lib/collection-manager/interfaces/m2o.js +3 -37
- package/lib/collection-manager/interfaces/o2m.js +6 -70
- package/lib/collection-manager/interfaces/o2o.js +30 -124
- package/lib/collection-manager/interfaces/updatedBy.js +1 -1
- package/lib/collection-manager/templates/expression.js +1 -1
- package/lib/collection-manager/templates/tree.js +2 -2
- package/lib/filter-provider/FilterProvider.js +3 -1
- package/lib/filter-provider/utils.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -0
- package/lib/locale/en_US.d.ts +19 -1
- package/lib/locale/en_US.js +22 -4
- package/lib/locale/es_ES.d.ts +692 -0
- package/lib/locale/es_ES.js +698 -0
- package/lib/locale/ja_JP.d.ts +8 -1
- package/lib/locale/ja_JP.js +9 -2
- package/lib/locale/pt_BR.d.ts +5 -1
- package/lib/locale/pt_BR.js +6 -2
- package/lib/locale/ru_RU.d.ts +5 -1
- package/lib/locale/ru_RU.js +6 -2
- package/lib/locale/tr_TR.d.ts +5 -1
- package/lib/locale/tr_TR.js +6 -2
- package/lib/locale/zh_CN.d.ts +27 -1
- package/lib/locale/zh_CN.js +28 -2
- package/lib/record-provider/index.d.ts +4 -0
- package/lib/record-provider/index.js +5 -1
- package/lib/schema-component/antd/action/Action.Designer.js +10 -8
- package/lib/schema-component/antd/action/Action.Drawer.js +4 -1
- package/lib/schema-component/antd/action/ActionBar.js +23 -16
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +40 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.js +72 -0
- package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/lib/schema-component/antd/association-field/Editable.js +121 -0
- package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/lib/schema-component/antd/association-field/FileManager.js +253 -0
- package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
- package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalPicker.js +246 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
- package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalViewer.js +123 -0
- package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/Nester.js +80 -0
- package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/lib/schema-component/antd/association-field/ReadPretty.js +30 -0
- package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/SubTable.js +33 -0
- package/lib/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
- package/lib/schema-component/antd/association-field/components/CreateRecordAction.js +71 -0
- package/lib/schema-component/antd/association-field/context.d.ts +8 -0
- package/lib/schema-component/antd/association-field/context.js +9 -0
- package/lib/schema-component/antd/association-field/hooks.d.ts +9 -0
- package/lib/schema-component/antd/association-field/hooks.js +107 -0
- package/lib/schema-component/antd/association-field/index.d.ts +1 -0
- package/lib/schema-component/antd/association-field/index.js +21 -0
- package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
- package/lib/schema-component/antd/association-field/schema.js +148 -0
- package/lib/schema-component/antd/association-field/util.d.ts +8 -0
- package/lib/schema-component/antd/association-field/util.js +98 -0
- package/lib/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
- package/lib/schema-component/antd/association-select/AssociationSelect.js +49 -231
- package/lib/schema-component/antd/association-select/useServiceOptions.js +2 -2
- package/lib/schema-component/antd/collection-select/CollectionSelect.js +5 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
- package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/index.js +12 -0
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/lib/schema-component/antd/filter/FilterItem.js +1 -1
- package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/lib/schema-component/antd/form-item/FormItem.js +258 -162
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +37 -59
- package/lib/schema-component/antd/form-v2/Form.Designer.js +1 -0
- package/lib/schema-component/antd/form-v2/Templates.d.ts +20 -0
- package/lib/schema-component/antd/form-v2/Templates.js +39 -11
- package/lib/schema-component/antd/form-v2/utils.js +3 -1
- package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/lib/schema-component/antd/grid/Grid.js +33 -23
- package/lib/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
- package/lib/schema-component/antd/grid-card/GridCard.Decorator.js +77 -0
- package/lib/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +253 -0
- package/lib/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +26 -0
- package/lib/schema-component/antd/grid-card/GridCard.d.ts +8 -0
- package/lib/schema-component/antd/grid-card/GridCard.js +112 -0
- package/lib/schema-component/antd/grid-card/hooks.d.ts +4 -0
- package/lib/schema-component/antd/grid-card/hooks.js +16 -0
- package/lib/schema-component/antd/grid-card/index.d.ts +1 -0
- package/lib/schema-component/antd/grid-card/index.js +16 -0
- package/lib/schema-component/antd/grid-card/options.d.ts +20 -0
- package/lib/schema-component/antd/grid-card/options.js +31 -0
- package/lib/schema-component/antd/index.d.ts +5 -1
- package/lib/schema-component/antd/index.js +55 -11
- package/lib/schema-component/antd/list/List.Decorator.d.ts +5 -0
- package/lib/schema-component/antd/list/List.Decorator.js +71 -0
- package/lib/schema-component/antd/list/List.Designer.d.ts +1 -0
- package/lib/schema-component/antd/list/List.Designer.js +213 -0
- package/lib/schema-component/antd/list/List.Item.d.ts +1 -0
- package/lib/schema-component/antd/list/List.Item.js +23 -0
- package/lib/schema-component/antd/list/List.d.ts +8 -0
- package/lib/schema-component/antd/list/List.js +92 -0
- package/lib/schema-component/antd/list/hooks.d.ts +4 -0
- package/lib/schema-component/antd/list/hooks.js +16 -0
- package/lib/schema-component/antd/list/index.d.ts +1 -0
- package/lib/schema-component/antd/list/index.js +16 -0
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +22 -22
- package/lib/schema-component/antd/select/Select.js +2 -0
- package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -0
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
- package/lib/schema-component/antd/table-v2/Table.js +9 -5
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
- package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
- package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
- package/lib/schema-component/antd/table-v2/hooks/useUserVariable.js +73 -0
- package/lib/schema-component/antd/table-v2/index.js +3 -1
- package/lib/schema-component/antd/table-v2/utils.js +1 -1
- package/lib/schema-component/antd/variable/Input.js +11 -8
- package/lib/schema-component/antd/variable/TextArea.js +2 -5
- package/lib/schema-component/common/dnd-context/index.js +3 -2
- package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/lib/schema-component/common/utils/uitls.js +1 -1
- package/lib/schema-component/core/SchemaComponentProvider.js +2 -2
- package/lib/schema-component/hooks/index.d.ts +1 -0
- package/lib/schema-component/hooks/index.js +11 -0
- package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
- package/lib/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
- package/lib/schema-initializer/SchemaInitializerProvider.js +22 -9
- package/lib/schema-initializer/buttons/BlockInitializers.js +10 -0
- package/lib/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
- package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
- package/lib/schema-initializer/buttons/FormActionInitializers.js +106 -100
- package/lib/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
- package/lib/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
- package/lib/schema-initializer/buttons/GridCardActionInitializers.js +285 -0
- package/lib/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
- package/lib/schema-initializer/buttons/ListActionInitializers.js +285 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
- package/lib/schema-initializer/buttons/TableActionInitializers.js +29 -35
- package/lib/schema-initializer/buttons/TableColumnInitializers.js +4 -1
- package/lib/schema-initializer/buttons/index.d.ts +3 -0
- package/lib/schema-initializer/buttons/index.js +22 -0
- package/lib/schema-initializer/components/BulkEditField.js +7 -5
- package/lib/schema-initializer/components/CreateRecordAction.d.ts +2 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +58 -35
- package/lib/schema-initializer/components/DeletedField.d.ts +1 -0
- package/lib/schema-initializer/components/DeletedField.js +19 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +34 -22
- package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
- package/lib/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/GridCardBlockInitializer.js +55 -0
- package/lib/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/ListBlockInitializer.js +55 -0
- package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
- package/lib/schema-initializer/items/index.d.ts +3 -0
- package/lib/schema-initializer/items/index.js +33 -0
- package/lib/schema-initializer/utils.d.ts +112 -0
- package/lib/schema-initializer/utils.js +227 -39
- package/lib/schema-items/GeneralSchemaItems.d.ts +4 -0
- package/lib/schema-items/GeneralSchemaItems.js +156 -0
- package/lib/schema-items/index.d.ts +1 -0
- package/lib/schema-items/index.js +11 -0
- package/lib/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
- package/lib/schema-settings/DataTemplates/FormDataTemplates.js +119 -41
- package/lib/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
- package/lib/schema-settings/DataTemplates/components/Designer.js +188 -0
- package/lib/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
- package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -95
- package/lib/schema-settings/GeneralSchemaDesigner.js +21 -15
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/lib/schema-settings/LinkageRules/Variables.js +7 -4
- package/lib/schema-settings/SchemaSettings.d.ts +1 -1
- package/lib/schema-settings/SchemaSettings.js +53 -29
- package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
- package/lib/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
- package/lib/schema-settings/hooks/useIsShowMultipleSwitch.js +24 -0
- package/lib/user/CurrentUser.js +116 -8
- package/package.json +5 -6
- package/tsconfig.json +8 -0
|
@@ -13,10 +13,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
13
13
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
14
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
15
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
16
|
-
import { SchemaExpressionScopeContext, useField, useFieldSchema, useForm } from '@formily/react';
|
|
16
|
+
import { Schema, SchemaExpressionScopeContext, useField, useFieldSchema, useForm } from '@formily/react';
|
|
17
|
+
import { parse } from '@nocobase/utils/client';
|
|
17
18
|
import { Modal, message } from 'antd';
|
|
18
|
-
import
|
|
19
|
-
import { cloneDeep } from 'lodash';
|
|
19
|
+
import { cloneDeep, uniq } from 'lodash';
|
|
20
20
|
import get from 'lodash/get';
|
|
21
21
|
import omit from 'lodash/omit';
|
|
22
22
|
import { useContext, useEffect } from 'react';
|
|
@@ -31,6 +31,7 @@ import { transformToFilter } from '../../filter-provider/utils';
|
|
|
31
31
|
import { useRecord } from '../../record-provider';
|
|
32
32
|
import { removeNullCondition, useActionContext, useCompile } from '../../schema-component';
|
|
33
33
|
import { BulkEditFormItemValueType } from '../../schema-initializer/components';
|
|
34
|
+
import { useSchemaTemplateManager } from '../../schema-templates';
|
|
34
35
|
import { useCurrentUserContext } from '../../user';
|
|
35
36
|
import { useBlockRequestContext, useFilterByTk } from '../BlockProvider';
|
|
36
37
|
import { useDetailsBlockContext } from '../DetailsBlockProvider';
|
|
@@ -173,7 +174,7 @@ export var useCreateActionProps = function useCreateActionProps() {
|
|
|
173
174
|
onClick: function onClick() {
|
|
174
175
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
175
176
|
var _actionSchema$xActio, _fieldSchema$xCompon;
|
|
176
|
-
var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre;
|
|
177
|
+
var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre, data;
|
|
177
178
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
178
179
|
while (1) switch (_context2.prev = _context2.next) {
|
|
179
180
|
case 0:
|
|
@@ -194,7 +195,7 @@ export var useCreateActionProps = function useCreateActionProps() {
|
|
|
194
195
|
_context2.next = 7;
|
|
195
196
|
return form.submit();
|
|
196
197
|
case 7:
|
|
197
|
-
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
198
|
+
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource); // const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
|
|
198
199
|
if (addChild) {
|
|
199
200
|
treeParentField = getTreeParentField();
|
|
200
201
|
values[(_treeParentField$name = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name !== void 0 ? _treeParentField$name : 'parent'] = currentRecord;
|
|
@@ -208,15 +209,17 @@ export var useCreateActionProps = function useCreateActionProps() {
|
|
|
208
209
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
|
|
209
210
|
});
|
|
210
211
|
case 14:
|
|
212
|
+
data = _context2.sent;
|
|
211
213
|
actionField.data.loading = false;
|
|
214
|
+
actionField.data.data = data;
|
|
212
215
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service = __parent.service) === null || _parent$service === void 0 ? void 0 : (_parent$service$refre = _parent$service.refresh) === null || _parent$service$refre === void 0 ? void 0 : _parent$service$refre.call(_parent$service);
|
|
213
216
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
214
217
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
215
|
-
_context2.next =
|
|
218
|
+
_context2.next = 21;
|
|
216
219
|
break;
|
|
217
220
|
}
|
|
218
221
|
return _context2.abrupt("return");
|
|
219
|
-
case
|
|
222
|
+
case 21:
|
|
220
223
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
221
224
|
Modal.success({
|
|
222
225
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
@@ -250,17 +253,103 @@ export var useCreateActionProps = function useCreateActionProps() {
|
|
|
250
253
|
} else {
|
|
251
254
|
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
252
255
|
}
|
|
253
|
-
_context2.next =
|
|
256
|
+
_context2.next = 27;
|
|
254
257
|
break;
|
|
255
|
-
case
|
|
256
|
-
_context2.prev =
|
|
258
|
+
case 24:
|
|
259
|
+
_context2.prev = 24;
|
|
257
260
|
_context2.t0 = _context2["catch"](11);
|
|
258
261
|
actionField.data.loading = false;
|
|
259
|
-
case
|
|
262
|
+
case 27:
|
|
260
263
|
case "end":
|
|
261
264
|
return _context2.stop();
|
|
262
265
|
}
|
|
263
|
-
}, _callee2, null, [[11,
|
|
266
|
+
}, _callee2, null, [[11, 24]]);
|
|
267
|
+
}))();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
export var useAssociationCreateActionProps = function useAssociationCreateActionProps() {
|
|
272
|
+
var _currentUserContext$d2;
|
|
273
|
+
var form = useForm();
|
|
274
|
+
var _useBlockRequestConte2 = useBlockRequestContext(),
|
|
275
|
+
field = _useBlockRequestConte2.field,
|
|
276
|
+
resource = _useBlockRequestConte2.resource;
|
|
277
|
+
var _useActionContext2 = useActionContext(),
|
|
278
|
+
setVisible = _useActionContext2.setVisible,
|
|
279
|
+
fieldSchema = _useActionContext2.fieldSchema;
|
|
280
|
+
var actionSchema = useFieldSchema();
|
|
281
|
+
var actionField = useField();
|
|
282
|
+
var _useCollection2 = useCollection(),
|
|
283
|
+
fields = _useCollection2.fields,
|
|
284
|
+
getField = _useCollection2.getField,
|
|
285
|
+
getTreeParentField = _useCollection2.getTreeParentField;
|
|
286
|
+
var compile = useCompile();
|
|
287
|
+
var filterByTk = useFilterByTk();
|
|
288
|
+
var currentRecord = useRecord();
|
|
289
|
+
var currentUserContext = useCurrentUserContext();
|
|
290
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
|
|
291
|
+
return {
|
|
292
|
+
onClick: function onClick() {
|
|
293
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
294
|
+
var _actionSchema$xActio2, _fieldSchema$xCompon2;
|
|
295
|
+
var fieldNames, _ref2, _ref2$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name2, _treeParentField$fore2, treeParentField, data;
|
|
296
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
297
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
298
|
+
case 0:
|
|
299
|
+
fieldNames = fields.map(function (field) {
|
|
300
|
+
return field.name;
|
|
301
|
+
});
|
|
302
|
+
_ref2 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref2$assignedValues = _ref2.assignedValues, originalAssignedValues = _ref2$assignedValues === void 0 ? {} : _ref2$assignedValues, onSuccess = _ref2.onSuccess, overwriteValues = _ref2.overwriteValues, skipValidator = _ref2.skipValidator;
|
|
303
|
+
addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.addChild;
|
|
304
|
+
assignedValues = parse(originalAssignedValues)({
|
|
305
|
+
currentTime: new Date(),
|
|
306
|
+
currentRecord: currentRecord,
|
|
307
|
+
currentUser: currentUser
|
|
308
|
+
});
|
|
309
|
+
if (skipValidator) {
|
|
310
|
+
_context3.next = 7;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
_context3.next = 7;
|
|
314
|
+
return form.submit();
|
|
315
|
+
case 7:
|
|
316
|
+
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
317
|
+
if (addChild) {
|
|
318
|
+
treeParentField = getTreeParentField();
|
|
319
|
+
values[(_treeParentField$name2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name2 !== void 0 ? _treeParentField$name2 : 'parent'] = currentRecord;
|
|
320
|
+
values[(_treeParentField$fore2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.foreignKey) !== null && _treeParentField$fore2 !== void 0 ? _treeParentField$fore2 : 'parentId'] = currentRecord.id;
|
|
321
|
+
}
|
|
322
|
+
actionField.data = field.data || {};
|
|
323
|
+
actionField.data.loading = true;
|
|
324
|
+
_context3.prev = 11;
|
|
325
|
+
_context3.next = 14;
|
|
326
|
+
return resource.create({
|
|
327
|
+
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
|
|
328
|
+
});
|
|
329
|
+
case 14:
|
|
330
|
+
data = _context3.sent;
|
|
331
|
+
actionField.data.loading = false;
|
|
332
|
+
actionField.data.data = data;
|
|
333
|
+
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
334
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
335
|
+
_context3.next = 20;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
return _context3.abrupt("return");
|
|
339
|
+
case 20:
|
|
340
|
+
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
341
|
+
_context3.next = 27;
|
|
342
|
+
break;
|
|
343
|
+
case 23:
|
|
344
|
+
_context3.prev = 23;
|
|
345
|
+
_context3.t0 = _context3["catch"](11);
|
|
346
|
+
actionField.data.data = null;
|
|
347
|
+
actionField.data.loading = false;
|
|
348
|
+
case 27:
|
|
349
|
+
case "end":
|
|
350
|
+
return _context3.stop();
|
|
351
|
+
}
|
|
352
|
+
}, _callee3, null, [[11, 23]]);
|
|
264
353
|
}))();
|
|
265
354
|
}
|
|
266
355
|
};
|
|
@@ -292,37 +381,37 @@ export var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
292
381
|
var fieldSchema = useFieldSchema();
|
|
293
382
|
var _useFilterBlock = useFilterBlock(),
|
|
294
383
|
getDataBlocks = _useFilterBlock.getDataBlocks;
|
|
295
|
-
var
|
|
296
|
-
name =
|
|
384
|
+
var _useCollection3 = useCollection(),
|
|
385
|
+
name = _useCollection3.name;
|
|
297
386
|
var _useCollectionManager = useCollectionManager(),
|
|
298
387
|
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
299
388
|
actionField.data = actionField.data || {};
|
|
300
389
|
return {
|
|
301
390
|
onClick: function onClick() {
|
|
302
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
391
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
303
392
|
var _findFilterTargets, _findFilterTargets$ta, targets, uid;
|
|
304
|
-
return _regeneratorRuntime().wrap(function
|
|
305
|
-
while (1) switch (
|
|
393
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
394
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
306
395
|
case 0:
|
|
307
396
|
_findFilterTargets = findFilterTargets(fieldSchema), _findFilterTargets$ta = _findFilterTargets.targets, targets = _findFilterTargets$ta === void 0 ? [] : _findFilterTargets$ta, uid = _findFilterTargets.uid;
|
|
308
397
|
actionField.data.loading = true;
|
|
309
|
-
|
|
310
|
-
|
|
398
|
+
_context5.prev = 2;
|
|
399
|
+
_context5.next = 5;
|
|
311
400
|
return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
|
|
312
|
-
var
|
|
401
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(block) {
|
|
313
402
|
var _block$service$params, _block$service$params2, _block$service$params3;
|
|
314
403
|
var target, param, storedFilter, mergedFilter;
|
|
315
|
-
return _regeneratorRuntime().wrap(function
|
|
316
|
-
while (1) switch (
|
|
404
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
405
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
317
406
|
case 0:
|
|
318
407
|
target = targets.find(function (target) {
|
|
319
408
|
return target.uid === block.uid;
|
|
320
409
|
});
|
|
321
410
|
if (target) {
|
|
322
|
-
|
|
411
|
+
_context4.next = 3;
|
|
323
412
|
break;
|
|
324
413
|
}
|
|
325
|
-
return
|
|
414
|
+
return _context4.abrupt("return");
|
|
326
415
|
case 3:
|
|
327
416
|
param = ((_block$service$params = block.service.params) === null || _block$service$params === void 0 ? void 0 : _block$service$params[0]) || {}; // 保留原有的 filter
|
|
328
417
|
storedFilter = ((_block$service$params2 = block.service.params) === null || _block$service$params2 === void 0 ? void 0 : (_block$service$params3 = _block$service$params2[1]) === null || _block$service$params3 === void 0 ? void 0 : _block$service$params3.filters) || {};
|
|
@@ -330,7 +419,7 @@ export var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
330
419
|
mergedFilter = mergeFilter([].concat(_toConsumableArray(Object.values(storedFilter).map(function (filter) {
|
|
331
420
|
return removeNullCondition(filter);
|
|
332
421
|
})), [block.defaultFilter]));
|
|
333
|
-
return
|
|
422
|
+
return _context4.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
|
|
334
423
|
page: 1,
|
|
335
424
|
filter: mergedFilter
|
|
336
425
|
}), {
|
|
@@ -338,28 +427,28 @@ export var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
338
427
|
}));
|
|
339
428
|
case 8:
|
|
340
429
|
case "end":
|
|
341
|
-
return
|
|
430
|
+
return _context4.stop();
|
|
342
431
|
}
|
|
343
|
-
},
|
|
432
|
+
}, _callee4);
|
|
344
433
|
}));
|
|
345
434
|
return function (_x) {
|
|
346
|
-
return
|
|
435
|
+
return _ref3.apply(this, arguments);
|
|
347
436
|
};
|
|
348
437
|
}()));
|
|
349
438
|
case 5:
|
|
350
439
|
actionField.data.loading = false;
|
|
351
|
-
|
|
440
|
+
_context5.next = 12;
|
|
352
441
|
break;
|
|
353
442
|
case 8:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
console.error(
|
|
443
|
+
_context5.prev = 8;
|
|
444
|
+
_context5.t0 = _context5["catch"](2);
|
|
445
|
+
console.error(_context5.t0);
|
|
357
446
|
actionField.data.loading = false;
|
|
358
447
|
case 12:
|
|
359
448
|
case "end":
|
|
360
|
-
return
|
|
449
|
+
return _context5.stop();
|
|
361
450
|
}
|
|
362
|
-
},
|
|
451
|
+
}, _callee5, null, [[2, 8]]);
|
|
363
452
|
}))();
|
|
364
453
|
}
|
|
365
454
|
};
|
|
@@ -373,37 +462,37 @@ export var useResetBlockActionProps = function useResetBlockActionProps() {
|
|
|
373
462
|
actionField.data = actionField.data || {};
|
|
374
463
|
return {
|
|
375
464
|
onClick: function onClick() {
|
|
376
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
465
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
377
466
|
var _findFilterTargets2, targets, uid;
|
|
378
|
-
return _regeneratorRuntime().wrap(function
|
|
379
|
-
while (1) switch (
|
|
467
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
468
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
380
469
|
case 0:
|
|
381
470
|
_findFilterTargets2 = findFilterTargets(fieldSchema), targets = _findFilterTargets2.targets, uid = _findFilterTargets2.uid;
|
|
382
471
|
form.reset();
|
|
383
472
|
actionField.data.loading = true;
|
|
384
|
-
|
|
385
|
-
|
|
473
|
+
_context7.prev = 3;
|
|
474
|
+
_context7.next = 6;
|
|
386
475
|
return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
|
|
387
|
-
var
|
|
476
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(block) {
|
|
388
477
|
var _block$service$params4, _block$service$params5, _block$service$params6;
|
|
389
478
|
var target, param, storedFilter, mergedFilter;
|
|
390
|
-
return _regeneratorRuntime().wrap(function
|
|
391
|
-
while (1) switch (
|
|
479
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
480
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
392
481
|
case 0:
|
|
393
482
|
target = targets.find(function (target) {
|
|
394
483
|
return target.uid === block.uid;
|
|
395
484
|
});
|
|
396
485
|
if (target) {
|
|
397
|
-
|
|
486
|
+
_context6.next = 3;
|
|
398
487
|
break;
|
|
399
488
|
}
|
|
400
|
-
return
|
|
489
|
+
return _context6.abrupt("return");
|
|
401
490
|
case 3:
|
|
402
491
|
param = ((_block$service$params4 = block.service.params) === null || _block$service$params4 === void 0 ? void 0 : _block$service$params4[0]) || {}; // 保留原有的 filter
|
|
403
492
|
storedFilter = ((_block$service$params5 = block.service.params) === null || _block$service$params5 === void 0 ? void 0 : (_block$service$params6 = _block$service$params5[1]) === null || _block$service$params6 === void 0 ? void 0 : _block$service$params6.filters) || {};
|
|
404
493
|
delete storedFilter[uid];
|
|
405
494
|
mergedFilter = mergeFilter([].concat(_toConsumableArray(Object.values(storedFilter)), [block.defaultFilter]));
|
|
406
|
-
return
|
|
495
|
+
return _context6.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
|
|
407
496
|
page: 1,
|
|
408
497
|
filter: mergedFilter
|
|
409
498
|
}), {
|
|
@@ -411,67 +500,67 @@ export var useResetBlockActionProps = function useResetBlockActionProps() {
|
|
|
411
500
|
}));
|
|
412
501
|
case 8:
|
|
413
502
|
case "end":
|
|
414
|
-
return
|
|
503
|
+
return _context6.stop();
|
|
415
504
|
}
|
|
416
|
-
},
|
|
505
|
+
}, _callee6);
|
|
417
506
|
}));
|
|
418
507
|
return function (_x2) {
|
|
419
|
-
return
|
|
508
|
+
return _ref4.apply(this, arguments);
|
|
420
509
|
};
|
|
421
510
|
}()));
|
|
422
511
|
case 6:
|
|
423
512
|
actionField.data.loading = false;
|
|
424
|
-
|
|
513
|
+
_context7.next = 12;
|
|
425
514
|
break;
|
|
426
515
|
case 9:
|
|
427
|
-
|
|
428
|
-
|
|
516
|
+
_context7.prev = 9;
|
|
517
|
+
_context7.t0 = _context7["catch"](3);
|
|
429
518
|
actionField.data.loading = false;
|
|
430
519
|
case 12:
|
|
431
520
|
case "end":
|
|
432
|
-
return
|
|
521
|
+
return _context7.stop();
|
|
433
522
|
}
|
|
434
|
-
},
|
|
523
|
+
}, _callee7, null, [[3, 9]]);
|
|
435
524
|
}))();
|
|
436
525
|
}
|
|
437
526
|
};
|
|
438
527
|
};
|
|
439
528
|
export var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
440
|
-
var _currentUserContext$
|
|
441
|
-
var
|
|
442
|
-
resource =
|
|
443
|
-
__parent =
|
|
444
|
-
service =
|
|
529
|
+
var _currentUserContext$d3;
|
|
530
|
+
var _useBlockRequestConte3 = useBlockRequestContext(),
|
|
531
|
+
resource = _useBlockRequestConte3.resource,
|
|
532
|
+
__parent = _useBlockRequestConte3.__parent,
|
|
533
|
+
service = _useBlockRequestConte3.service;
|
|
445
534
|
var filterByTk = useFilterByTk();
|
|
446
535
|
var actionSchema = useFieldSchema();
|
|
447
536
|
var currentRecord = useRecord();
|
|
448
537
|
var currentUserContext = useCurrentUserContext();
|
|
449
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
538
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
|
|
450
539
|
var history = useHistory();
|
|
451
540
|
var compile = useCompile();
|
|
452
541
|
var form = useForm();
|
|
453
542
|
return {
|
|
454
543
|
onClick: function onClick() {
|
|
455
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
456
|
-
var _actionSchema$
|
|
457
|
-
var
|
|
458
|
-
return _regeneratorRuntime().wrap(function
|
|
459
|
-
while (1) switch (
|
|
544
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
545
|
+
var _actionSchema$xActio3, _service$refresh;
|
|
546
|
+
var _ref5, _ref5$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
|
|
547
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
548
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
460
549
|
case 0:
|
|
461
|
-
|
|
550
|
+
_ref5 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref5$assignedValues = _ref5.assignedValues, originalAssignedValues = _ref5$assignedValues === void 0 ? {} : _ref5$assignedValues, onSuccess = _ref5.onSuccess, skipValidator = _ref5.skipValidator;
|
|
462
551
|
assignedValues = parse(originalAssignedValues)({
|
|
463
552
|
currentTime: new Date(),
|
|
464
553
|
currentRecord: currentRecord,
|
|
465
554
|
currentUser: currentUser
|
|
466
555
|
});
|
|
467
556
|
if (!(skipValidator === false)) {
|
|
468
|
-
|
|
557
|
+
_context9.next = 5;
|
|
469
558
|
break;
|
|
470
559
|
}
|
|
471
|
-
|
|
560
|
+
_context9.next = 5;
|
|
472
561
|
return form.submit();
|
|
473
562
|
case 5:
|
|
474
|
-
|
|
563
|
+
_context9.next = 7;
|
|
475
564
|
return resource.update({
|
|
476
565
|
filterByTk: filterByTk,
|
|
477
566
|
values: _objectSpread({}, assignedValues)
|
|
@@ -482,18 +571,18 @@ export var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProp
|
|
|
482
571
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service2 = __parent.service) === null || _parent$service2 === void 0 ? void 0 : (_parent$service2$refr = _parent$service2.refresh) === null || _parent$service2$refr === void 0 ? void 0 : _parent$service2$refr.call(_parent$service2);
|
|
483
572
|
}
|
|
484
573
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
485
|
-
|
|
574
|
+
_context9.next = 11;
|
|
486
575
|
break;
|
|
487
576
|
}
|
|
488
|
-
return
|
|
577
|
+
return _context9.abrupt("return");
|
|
489
578
|
case 11:
|
|
490
579
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
491
580
|
Modal.success({
|
|
492
581
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
493
582
|
onOk: function () {
|
|
494
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
495
|
-
return _regeneratorRuntime().wrap(function
|
|
496
|
-
while (1) switch (
|
|
583
|
+
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
585
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
497
586
|
case 0:
|
|
498
587
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
499
588
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -504,9 +593,9 @@ export var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProp
|
|
|
504
593
|
}
|
|
505
594
|
case 1:
|
|
506
595
|
case "end":
|
|
507
|
-
return
|
|
596
|
+
return _context8.stop();
|
|
508
597
|
}
|
|
509
|
-
},
|
|
598
|
+
}, _callee8);
|
|
510
599
|
}));
|
|
511
600
|
function onOk() {
|
|
512
601
|
return _onOk2.apply(this, arguments);
|
|
@@ -519,27 +608,27 @@ export var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProp
|
|
|
519
608
|
}
|
|
520
609
|
case 12:
|
|
521
610
|
case "end":
|
|
522
|
-
return
|
|
611
|
+
return _context9.stop();
|
|
523
612
|
}
|
|
524
|
-
},
|
|
613
|
+
}, _callee9);
|
|
525
614
|
}))();
|
|
526
615
|
}
|
|
527
616
|
};
|
|
528
617
|
};
|
|
529
618
|
export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionProps() {
|
|
530
|
-
var
|
|
531
|
-
var
|
|
532
|
-
field =
|
|
533
|
-
resource =
|
|
534
|
-
__parent =
|
|
535
|
-
service =
|
|
619
|
+
var _ref6, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d4;
|
|
620
|
+
var _useBlockRequestConte4 = useBlockRequestContext(),
|
|
621
|
+
field = _useBlockRequestConte4.field,
|
|
622
|
+
resource = _useBlockRequestConte4.resource,
|
|
623
|
+
__parent = _useBlockRequestConte4.__parent,
|
|
624
|
+
service = _useBlockRequestConte4.service;
|
|
536
625
|
var expressionScope = useContext(SchemaExpressionScopeContext);
|
|
537
626
|
var actionSchema = useFieldSchema();
|
|
538
627
|
var tableBlockContext = useTableBlockContext();
|
|
539
628
|
var rowKey = tableBlockContext.rowKey;
|
|
540
|
-
var selectedRecordKeys = (
|
|
629
|
+
var selectedRecordKeys = (_ref6 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : (_tableBlockContext$fi3 = _tableBlockContext$fi2.data) === null || _tableBlockContext$fi3 === void 0 ? void 0 : _tableBlockContext$fi3.selectedRowKeys) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref6 !== void 0 ? _ref6 : {};
|
|
541
630
|
var currentUserContext = useCurrentUserContext();
|
|
542
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
631
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
|
|
543
632
|
var history = useHistory();
|
|
544
633
|
var compile = useCompile();
|
|
545
634
|
var _useTranslation2 = useTranslation(),
|
|
@@ -547,13 +636,13 @@ export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateAc
|
|
|
547
636
|
var actionField = useField();
|
|
548
637
|
return {
|
|
549
638
|
onClick: function onClick() {
|
|
550
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
551
|
-
var _actionSchema$
|
|
552
|
-
var
|
|
553
|
-
return _regeneratorRuntime().wrap(function
|
|
554
|
-
while (1) switch (
|
|
639
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
640
|
+
var _actionSchema$xActio4;
|
|
641
|
+
var _ref7, _ref7$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
|
|
642
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
643
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
555
644
|
case 0:
|
|
556
|
-
|
|
645
|
+
_ref7 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, _ref7$assignedValues = _ref7.assignedValues, originalAssignedValues = _ref7$assignedValues === void 0 ? {} : _ref7$assignedValues, onSuccess = _ref7.onSuccess, updateMode = _ref7.updateMode;
|
|
557
646
|
actionField.data = field.data || {};
|
|
558
647
|
actionField.data.loading = true;
|
|
559
648
|
assignedValues = parse(originalAssignedValues)({
|
|
@@ -564,29 +653,29 @@ export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateAc
|
|
|
564
653
|
title: t('Bulk update'),
|
|
565
654
|
content: updateMode === 'selected' ? t('Update selected data?') : t('Update all data?'),
|
|
566
655
|
onOk: function onOk() {
|
|
567
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
656
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
568
657
|
var _service$params$, _service$params, _service$refresh2;
|
|
569
|
-
var
|
|
570
|
-
return _regeneratorRuntime().wrap(function
|
|
571
|
-
while (1) switch (
|
|
658
|
+
var _ref8, filter, updateData, _parent$service3, _parent$service3$refr;
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
660
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
572
661
|
case 0:
|
|
573
|
-
|
|
662
|
+
_ref8 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref8.filter;
|
|
574
663
|
updateData = {
|
|
575
664
|
values: _objectSpread({}, assignedValues),
|
|
576
665
|
filter: filter,
|
|
577
666
|
forceUpdate: false
|
|
578
667
|
};
|
|
579
668
|
if (!(updateMode === 'selected')) {
|
|
580
|
-
|
|
669
|
+
_context11.next = 8;
|
|
581
670
|
break;
|
|
582
671
|
}
|
|
583
672
|
if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
|
|
584
|
-
|
|
673
|
+
_context11.next = 7;
|
|
585
674
|
break;
|
|
586
675
|
}
|
|
587
676
|
message.error(t('Please select the records to be updated'));
|
|
588
677
|
actionField.data.loading = false;
|
|
589
|
-
return
|
|
678
|
+
return _context11.abrupt("return");
|
|
590
679
|
case 7:
|
|
591
680
|
updateData.filter = {
|
|
592
681
|
$and: [_defineProperty({}, rowKey || 'id', {
|
|
@@ -597,37 +686,37 @@ export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateAc
|
|
|
597
686
|
if (!updateData.filter) {
|
|
598
687
|
updateData.forceUpdate = true;
|
|
599
688
|
}
|
|
600
|
-
|
|
601
|
-
|
|
689
|
+
_context11.prev = 9;
|
|
690
|
+
_context11.next = 12;
|
|
602
691
|
return resource.update(updateData);
|
|
603
692
|
case 12:
|
|
604
|
-
|
|
693
|
+
_context11.next = 16;
|
|
605
694
|
break;
|
|
606
695
|
case 14:
|
|
607
|
-
|
|
608
|
-
|
|
696
|
+
_context11.prev = 14;
|
|
697
|
+
_context11.t0 = _context11["catch"](9);
|
|
609
698
|
case 16:
|
|
610
|
-
|
|
699
|
+
_context11.prev = 16;
|
|
611
700
|
actionField.data.loading = false;
|
|
612
|
-
return
|
|
701
|
+
return _context11.finish(16);
|
|
613
702
|
case 19:
|
|
614
703
|
service === null || service === void 0 ? void 0 : (_service$refresh2 = service.refresh) === null || _service$refresh2 === void 0 ? void 0 : _service$refresh2.call(service);
|
|
615
704
|
if (!(resource instanceof TableFieldResource)) {
|
|
616
705
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service3 = __parent.service) === null || _parent$service3 === void 0 ? void 0 : (_parent$service3$refr = _parent$service3.refresh) === null || _parent$service3$refr === void 0 ? void 0 : _parent$service3$refr.call(_parent$service3);
|
|
617
706
|
}
|
|
618
707
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
619
|
-
|
|
708
|
+
_context11.next = 23;
|
|
620
709
|
break;
|
|
621
710
|
}
|
|
622
|
-
return
|
|
711
|
+
return _context11.abrupt("return");
|
|
623
712
|
case 23:
|
|
624
713
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
625
714
|
Modal.success({
|
|
626
715
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
627
716
|
onOk: function () {
|
|
628
|
-
var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
629
|
-
return _regeneratorRuntime().wrap(function
|
|
630
|
-
while (1) switch (
|
|
717
|
+
var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
718
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
719
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
631
720
|
case 0:
|
|
632
721
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
633
722
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -638,9 +727,9 @@ export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateAc
|
|
|
638
727
|
}
|
|
639
728
|
case 1:
|
|
640
729
|
case "end":
|
|
641
|
-
return
|
|
730
|
+
return _context10.stop();
|
|
642
731
|
}
|
|
643
|
-
},
|
|
732
|
+
}, _callee10);
|
|
644
733
|
}));
|
|
645
734
|
function onOk() {
|
|
646
735
|
return _onOk3.apply(this, arguments);
|
|
@@ -653,43 +742,43 @@ export var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateAc
|
|
|
653
742
|
}
|
|
654
743
|
case 24:
|
|
655
744
|
case "end":
|
|
656
|
-
return
|
|
745
|
+
return _context11.stop();
|
|
657
746
|
}
|
|
658
|
-
},
|
|
747
|
+
}, _callee11, null, [[9, 14, 16, 19]]);
|
|
659
748
|
}))();
|
|
660
749
|
},
|
|
661
750
|
onCancel: function onCancel() {
|
|
662
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
663
|
-
return _regeneratorRuntime().wrap(function
|
|
664
|
-
while (1) switch (
|
|
751
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
752
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
753
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
665
754
|
case 0:
|
|
666
755
|
actionField.data.loading = false;
|
|
667
756
|
case 1:
|
|
668
757
|
case "end":
|
|
669
|
-
return
|
|
758
|
+
return _context12.stop();
|
|
670
759
|
}
|
|
671
|
-
},
|
|
760
|
+
}, _callee12);
|
|
672
761
|
}))();
|
|
673
762
|
}
|
|
674
763
|
});
|
|
675
764
|
case 5:
|
|
676
765
|
case "end":
|
|
677
|
-
return
|
|
766
|
+
return _context13.stop();
|
|
678
767
|
}
|
|
679
|
-
},
|
|
768
|
+
}, _callee13);
|
|
680
769
|
}))();
|
|
681
770
|
}
|
|
682
771
|
};
|
|
683
772
|
};
|
|
684
773
|
export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps() {
|
|
685
|
-
var
|
|
774
|
+
var _ref10, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
|
|
686
775
|
var form = useForm();
|
|
687
776
|
var _useTranslation3 = useTranslation(),
|
|
688
777
|
t = _useTranslation3.t;
|
|
689
|
-
var
|
|
690
|
-
field =
|
|
691
|
-
resource =
|
|
692
|
-
__parent =
|
|
778
|
+
var _useBlockRequestConte5 = useBlockRequestContext(),
|
|
779
|
+
field = _useBlockRequestConte5.field,
|
|
780
|
+
resource = _useBlockRequestConte5.resource,
|
|
781
|
+
__parent = _useBlockRequestConte5.__parent;
|
|
693
782
|
var expressionScope = useContext(SchemaExpressionScopeContext);
|
|
694
783
|
var actionContext = useActionContext();
|
|
695
784
|
var history = useHistory();
|
|
@@ -697,24 +786,24 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
697
786
|
var actionField = useField();
|
|
698
787
|
var tableBlockContext = useTableBlockContext();
|
|
699
788
|
var rowKey = tableBlockContext.rowKey;
|
|
700
|
-
var selectedRecordKeys = (
|
|
789
|
+
var selectedRecordKeys = (_ref10 = (_tableBlockContext$fi4 = (_tableBlockContext$fi5 = tableBlockContext.field) === null || _tableBlockContext$fi5 === void 0 ? void 0 : (_tableBlockContext$fi6 = _tableBlockContext$fi5.data) === null || _tableBlockContext$fi6 === void 0 ? void 0 : _tableBlockContext$fi6.selectedRowKeys) !== null && _tableBlockContext$fi4 !== void 0 ? _tableBlockContext$fi4 : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref10 !== void 0 ? _ref10 : {};
|
|
701
790
|
var setVisible = actionContext.setVisible,
|
|
702
791
|
actionSchema = actionContext.fieldSchema;
|
|
703
792
|
return {
|
|
704
793
|
onClick: function onClick() {
|
|
705
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
706
|
-
var _actionSchema$
|
|
707
|
-
var
|
|
708
|
-
return _regeneratorRuntime().wrap(function
|
|
709
|
-
while (1) switch (
|
|
794
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
795
|
+
var _actionSchema$xActio5, _parent$service$para, _parent$service$para2;
|
|
796
|
+
var _ref11, onSuccess, skipValidator, updateMode, _ref12, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
|
|
797
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
798
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
710
799
|
case 0:
|
|
711
|
-
|
|
712
|
-
|
|
800
|
+
_ref11 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, onSuccess = _ref11.onSuccess, skipValidator = _ref11.skipValidator, updateMode = _ref11.updateMode;
|
|
801
|
+
_ref12 = (_parent$service$para = (_parent$service$para2 = __parent.service.params) === null || _parent$service$para2 === void 0 ? void 0 : _parent$service$para2[0]) !== null && _parent$service$para !== void 0 ? _parent$service$para : {}, filter = _ref12.filter;
|
|
713
802
|
if (skipValidator) {
|
|
714
|
-
|
|
803
|
+
_context15.next = 5;
|
|
715
804
|
break;
|
|
716
805
|
}
|
|
717
|
-
|
|
806
|
+
_context15.next = 5;
|
|
718
807
|
return form.submit();
|
|
719
808
|
case 5:
|
|
720
809
|
values = cloneDeep(form.values);
|
|
@@ -732,22 +821,22 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
732
821
|
}
|
|
733
822
|
}
|
|
734
823
|
}
|
|
735
|
-
|
|
824
|
+
_context15.prev = 9;
|
|
736
825
|
updateData = {
|
|
737
826
|
values: values,
|
|
738
827
|
filter: filter,
|
|
739
828
|
forceUpdate: false
|
|
740
829
|
};
|
|
741
830
|
if (!(updateMode === 'selected')) {
|
|
742
|
-
|
|
831
|
+
_context15.next = 16;
|
|
743
832
|
break;
|
|
744
833
|
}
|
|
745
834
|
if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
|
|
746
|
-
|
|
835
|
+
_context15.next = 15;
|
|
747
836
|
break;
|
|
748
837
|
}
|
|
749
838
|
message.error(t('Please select the records to be updated'));
|
|
750
|
-
return
|
|
839
|
+
return _context15.abrupt("return");
|
|
751
840
|
case 15:
|
|
752
841
|
updateData.filter = {
|
|
753
842
|
$and: [_defineProperty({}, rowKey || 'id', {
|
|
@@ -758,7 +847,7 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
758
847
|
if (!updateData.filter) {
|
|
759
848
|
updateData.forceUpdate = true;
|
|
760
849
|
}
|
|
761
|
-
|
|
850
|
+
_context15.next = 19;
|
|
762
851
|
return resource.update(updateData);
|
|
763
852
|
case 19:
|
|
764
853
|
actionField.data.loading = false;
|
|
@@ -768,20 +857,20 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
768
857
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service4 = __parent.service) === null || _parent$service4 === void 0 ? void 0 : (_parent$service4$refr = _parent$service4.refresh) === null || _parent$service4$refr === void 0 ? void 0 : _parent$service4$refr.call(_parent$service4);
|
|
769
858
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
770
859
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
771
|
-
|
|
860
|
+
_context15.next = 25;
|
|
772
861
|
break;
|
|
773
862
|
}
|
|
774
|
-
return
|
|
863
|
+
return _context15.abrupt("return");
|
|
775
864
|
case 25:
|
|
776
865
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
777
866
|
Modal.success({
|
|
778
867
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
779
868
|
onOk: function () {
|
|
780
|
-
var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
781
|
-
return _regeneratorRuntime().wrap(function
|
|
782
|
-
while (1) switch (
|
|
869
|
+
var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
870
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
871
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
783
872
|
case 0:
|
|
784
|
-
|
|
873
|
+
_context14.next = 2;
|
|
785
874
|
return form.reset();
|
|
786
875
|
case 2:
|
|
787
876
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
@@ -793,9 +882,9 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
793
882
|
}
|
|
794
883
|
case 3:
|
|
795
884
|
case "end":
|
|
796
|
-
return
|
|
885
|
+
return _context14.stop();
|
|
797
886
|
}
|
|
798
|
-
},
|
|
887
|
+
}, _callee14);
|
|
799
888
|
}));
|
|
800
889
|
function onOk() {
|
|
801
890
|
return _onOk4.apply(this, arguments);
|
|
@@ -807,61 +896,61 @@ export var useCustomizeBulkEditActionProps = function useCustomizeBulkEditAction
|
|
|
807
896
|
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
808
897
|
}
|
|
809
898
|
case 26:
|
|
810
|
-
|
|
899
|
+
_context15.prev = 26;
|
|
811
900
|
actionField.data.loading = false;
|
|
812
|
-
return
|
|
901
|
+
return _context15.finish(26);
|
|
813
902
|
case 29:
|
|
814
903
|
case "end":
|
|
815
|
-
return
|
|
904
|
+
return _context15.stop();
|
|
816
905
|
}
|
|
817
|
-
},
|
|
906
|
+
}, _callee15, null, [[9,, 26, 29]]);
|
|
818
907
|
}))();
|
|
819
908
|
}
|
|
820
909
|
};
|
|
821
910
|
};
|
|
822
911
|
export var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
823
|
-
var _currentUserContext$
|
|
912
|
+
var _currentUserContext$d5;
|
|
824
913
|
var apiClient = useAPIClient();
|
|
825
914
|
var history = useHistory();
|
|
826
915
|
var filterByTk = useFilterByTk();
|
|
827
916
|
var actionSchema = useFieldSchema();
|
|
828
917
|
var compile = useCompile();
|
|
829
918
|
var form = useForm();
|
|
830
|
-
var
|
|
831
|
-
fields =
|
|
832
|
-
getField =
|
|
833
|
-
var
|
|
834
|
-
field =
|
|
835
|
-
resource =
|
|
836
|
-
__parent =
|
|
837
|
-
service =
|
|
919
|
+
var _useCollection4 = useCollection(),
|
|
920
|
+
fields = _useCollection4.fields,
|
|
921
|
+
getField = _useCollection4.getField;
|
|
922
|
+
var _useBlockRequestConte6 = useBlockRequestContext(),
|
|
923
|
+
field = _useBlockRequestConte6.field,
|
|
924
|
+
resource = _useBlockRequestConte6.resource,
|
|
925
|
+
__parent = _useBlockRequestConte6.__parent,
|
|
926
|
+
service = _useBlockRequestConte6.service;
|
|
838
927
|
var currentRecord = useRecord();
|
|
839
928
|
var currentUserContext = useCurrentUserContext();
|
|
840
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
929
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
|
|
841
930
|
var actionField = useField();
|
|
842
|
-
var
|
|
843
|
-
setVisible =
|
|
931
|
+
var _useActionContext3 = useActionContext(),
|
|
932
|
+
setVisible = _useActionContext3.setVisible;
|
|
844
933
|
return {
|
|
845
934
|
onClick: function onClick() {
|
|
846
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
847
|
-
var _actionSchema$
|
|
848
|
-
var
|
|
849
|
-
return _regeneratorRuntime().wrap(function
|
|
850
|
-
while (1) switch (
|
|
935
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
936
|
+
var _actionSchema$xActio6;
|
|
937
|
+
var _ref14, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
|
|
938
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
939
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
851
940
|
case 0:
|
|
852
|
-
|
|
941
|
+
_ref14 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, skipValidator = _ref14.skipValidator, onSuccess = _ref14.onSuccess, requestSettings = _ref14.requestSettings;
|
|
853
942
|
xAction = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action'];
|
|
854
943
|
if (requestSettings['url']) {
|
|
855
|
-
|
|
944
|
+
_context17.next = 4;
|
|
856
945
|
break;
|
|
857
946
|
}
|
|
858
|
-
return
|
|
947
|
+
return _context17.abrupt("return");
|
|
859
948
|
case 4:
|
|
860
949
|
if (!(skipValidator !== true && xAction === 'customize:form:request')) {
|
|
861
|
-
|
|
950
|
+
_context17.next = 7;
|
|
862
951
|
break;
|
|
863
952
|
}
|
|
864
|
-
|
|
953
|
+
_context17.next = 7;
|
|
865
954
|
return form.submit();
|
|
866
955
|
case 7:
|
|
867
956
|
headers = requestSettings['headers'] ? JSON.parse(requestSettings['headers']) : {};
|
|
@@ -896,8 +985,8 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
896
985
|
};
|
|
897
986
|
actionField.data = field.data || {};
|
|
898
987
|
actionField.data.loading = true;
|
|
899
|
-
|
|
900
|
-
|
|
988
|
+
_context17.prev = 15;
|
|
989
|
+
_context17.next = 18;
|
|
901
990
|
return apiClient.request(_objectSpread({}, requestBody));
|
|
902
991
|
case 18:
|
|
903
992
|
actionField.data.loading = false;
|
|
@@ -909,18 +998,18 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
909
998
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
910
999
|
}
|
|
911
1000
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
912
|
-
|
|
1001
|
+
_context17.next = 24;
|
|
913
1002
|
break;
|
|
914
1003
|
}
|
|
915
|
-
return
|
|
1004
|
+
return _context17.abrupt("return");
|
|
916
1005
|
case 24:
|
|
917
1006
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
918
1007
|
Modal.success({
|
|
919
1008
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
920
1009
|
onOk: function () {
|
|
921
|
-
var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
922
|
-
return _regeneratorRuntime().wrap(function
|
|
923
|
-
while (1) switch (
|
|
1010
|
+
var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1011
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1012
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
924
1013
|
case 0:
|
|
925
1014
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
926
1015
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -931,9 +1020,9 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
931
1020
|
}
|
|
932
1021
|
case 1:
|
|
933
1022
|
case "end":
|
|
934
|
-
return
|
|
1023
|
+
return _context16.stop();
|
|
935
1024
|
}
|
|
936
|
-
},
|
|
1025
|
+
}, _callee16);
|
|
937
1026
|
}));
|
|
938
1027
|
function onOk() {
|
|
939
1028
|
return _onOk5.apply(this, arguments);
|
|
@@ -945,59 +1034,59 @@ export var useCustomizeRequestActionProps = function useCustomizeRequestActionPr
|
|
|
945
1034
|
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
946
1035
|
}
|
|
947
1036
|
case 25:
|
|
948
|
-
|
|
1037
|
+
_context17.prev = 25;
|
|
949
1038
|
actionField.data.loading = false;
|
|
950
|
-
return
|
|
1039
|
+
return _context17.finish(25);
|
|
951
1040
|
case 28:
|
|
952
1041
|
case "end":
|
|
953
|
-
return
|
|
1042
|
+
return _context17.stop();
|
|
954
1043
|
}
|
|
955
|
-
},
|
|
1044
|
+
}, _callee17, null, [[15,, 25, 28]]);
|
|
956
1045
|
}))();
|
|
957
1046
|
}
|
|
958
1047
|
};
|
|
959
1048
|
};
|
|
960
1049
|
export var useUpdateActionProps = function useUpdateActionProps() {
|
|
961
|
-
var _currentUserContext$
|
|
1050
|
+
var _currentUserContext$d6;
|
|
962
1051
|
var form = useForm();
|
|
963
1052
|
var filterByTk = useFilterByTk();
|
|
964
|
-
var
|
|
965
|
-
field =
|
|
966
|
-
resource =
|
|
967
|
-
__parent =
|
|
968
|
-
var
|
|
969
|
-
setVisible =
|
|
1053
|
+
var _useBlockRequestConte7 = useBlockRequestContext(),
|
|
1054
|
+
field = _useBlockRequestConte7.field,
|
|
1055
|
+
resource = _useBlockRequestConte7.resource,
|
|
1056
|
+
__parent = _useBlockRequestConte7.__parent;
|
|
1057
|
+
var _useActionContext4 = useActionContext(),
|
|
1058
|
+
setVisible = _useActionContext4.setVisible;
|
|
970
1059
|
var actionSchema = useFieldSchema();
|
|
971
1060
|
var history = useHistory();
|
|
972
|
-
var
|
|
973
|
-
fields =
|
|
974
|
-
getField =
|
|
1061
|
+
var _useCollection5 = useCollection(),
|
|
1062
|
+
fields = _useCollection5.fields,
|
|
1063
|
+
getField = _useCollection5.getField;
|
|
975
1064
|
var compile = useCompile();
|
|
976
1065
|
var actionField = useField();
|
|
977
1066
|
var _useFormBlockContext = useFormBlockContext(),
|
|
978
1067
|
updateAssociationValues = _useFormBlockContext.updateAssociationValues;
|
|
979
1068
|
var currentRecord = useRecord();
|
|
980
1069
|
var currentUserContext = useCurrentUserContext();
|
|
981
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
1070
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d6 = currentUserContext.data) === null || _currentUserContext$d6 === void 0 ? void 0 : _currentUserContext$d6.data;
|
|
982
1071
|
return {
|
|
983
1072
|
onClick: function onClick() {
|
|
984
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
985
|
-
var _actionSchema$
|
|
986
|
-
var
|
|
987
|
-
return _regeneratorRuntime().wrap(function
|
|
988
|
-
while (1) switch (
|
|
1073
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1074
|
+
var _actionSchema$xActio7;
|
|
1075
|
+
var _ref15, _ref15$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr;
|
|
1076
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1077
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
989
1078
|
case 0:
|
|
990
|
-
|
|
1079
|
+
_ref15 = (_actionSchema$xActio7 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio7 !== void 0 ? _actionSchema$xActio7 : {}, _ref15$assignedValues = _ref15.assignedValues, originalAssignedValues = _ref15$assignedValues === void 0 ? {} : _ref15$assignedValues, onSuccess = _ref15.onSuccess, overwriteValues = _ref15.overwriteValues, skipValidator = _ref15.skipValidator;
|
|
991
1080
|
assignedValues = parse(originalAssignedValues)({
|
|
992
1081
|
currentTime: new Date(),
|
|
993
1082
|
currentRecord: currentRecord,
|
|
994
1083
|
currentUser: currentUser
|
|
995
1084
|
});
|
|
996
1085
|
if (skipValidator) {
|
|
997
|
-
|
|
1086
|
+
_context19.next = 5;
|
|
998
1087
|
break;
|
|
999
1088
|
}
|
|
1000
|
-
|
|
1089
|
+
_context19.next = 5;
|
|
1001
1090
|
return form.submit();
|
|
1002
1091
|
case 5:
|
|
1003
1092
|
fieldNames = fields.map(function (field) {
|
|
@@ -1006,8 +1095,8 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1006
1095
|
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
1007
1096
|
actionField.data = field.data || {};
|
|
1008
1097
|
actionField.data.loading = true;
|
|
1009
|
-
|
|
1010
|
-
|
|
1098
|
+
_context19.prev = 9;
|
|
1099
|
+
_context19.next = 12;
|
|
1011
1100
|
return resource.update({
|
|
1012
1101
|
filterByTk: filterByTk,
|
|
1013
1102
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
|
|
@@ -1015,26 +1104,23 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1015
1104
|
});
|
|
1016
1105
|
case 12:
|
|
1017
1106
|
actionField.data.loading = false;
|
|
1018
|
-
if (!(resource instanceof TableFieldResource)) {
|
|
1019
|
-
__parent === null || __parent === void 0 ? void 0 : (_parent$__parent2 = __parent.__parent) === null || _parent$__parent2 === void 0 ? void 0 : (_parent$__parent2$ser = _parent$__parent2.service) === null || _parent$__parent2$ser === void 0 ? void 0 : (_parent$__parent2$ser2 = _parent$__parent2$ser.refresh) === null || _parent$__parent2$ser2 === void 0 ? void 0 : _parent$__parent2$ser2.call(_parent$__parent2$ser);
|
|
1020
|
-
}
|
|
1021
1107
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service6 = __parent.service) === null || _parent$service6 === void 0 ? void 0 : (_parent$service6$refr = _parent$service6.refresh) === null || _parent$service6$refr === void 0 ? void 0 : _parent$service6$refr.call(_parent$service6);
|
|
1022
1108
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
1023
1109
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
1024
|
-
|
|
1110
|
+
_context19.next = 17;
|
|
1025
1111
|
break;
|
|
1026
1112
|
}
|
|
1027
|
-
return
|
|
1028
|
-
case
|
|
1113
|
+
return _context19.abrupt("return");
|
|
1114
|
+
case 17:
|
|
1029
1115
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
1030
1116
|
Modal.success({
|
|
1031
1117
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
1032
1118
|
onOk: function () {
|
|
1033
|
-
var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1034
|
-
return _regeneratorRuntime().wrap(function
|
|
1035
|
-
while (1) switch (
|
|
1119
|
+
var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1120
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1121
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1036
1122
|
case 0:
|
|
1037
|
-
|
|
1123
|
+
_context18.next = 2;
|
|
1038
1124
|
return form.reset();
|
|
1039
1125
|
case 2:
|
|
1040
1126
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
@@ -1046,9 +1132,9 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1046
1132
|
}
|
|
1047
1133
|
case 3:
|
|
1048
1134
|
case "end":
|
|
1049
|
-
return
|
|
1135
|
+
return _context18.stop();
|
|
1050
1136
|
}
|
|
1051
|
-
},
|
|
1137
|
+
}, _callee18);
|
|
1052
1138
|
}));
|
|
1053
1139
|
function onOk() {
|
|
1054
1140
|
return _onOk6.apply(this, arguments);
|
|
@@ -1059,44 +1145,44 @@ export var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1059
1145
|
} else {
|
|
1060
1146
|
message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
1061
1147
|
}
|
|
1062
|
-
|
|
1148
|
+
_context19.next = 23;
|
|
1063
1149
|
break;
|
|
1064
|
-
case
|
|
1065
|
-
|
|
1066
|
-
|
|
1150
|
+
case 20:
|
|
1151
|
+
_context19.prev = 20;
|
|
1152
|
+
_context19.t0 = _context19["catch"](9);
|
|
1067
1153
|
actionField.data.loading = false;
|
|
1068
|
-
case
|
|
1154
|
+
case 23:
|
|
1069
1155
|
case "end":
|
|
1070
|
-
return
|
|
1156
|
+
return _context19.stop();
|
|
1071
1157
|
}
|
|
1072
|
-
},
|
|
1158
|
+
}, _callee19, null, [[9, 20]]);
|
|
1073
1159
|
}))();
|
|
1074
1160
|
}
|
|
1075
1161
|
};
|
|
1076
1162
|
};
|
|
1077
1163
|
export var useDestroyActionProps = function useDestroyActionProps() {
|
|
1078
1164
|
var filterByTk = useFilterByTk();
|
|
1079
|
-
var
|
|
1080
|
-
resource =
|
|
1081
|
-
service =
|
|
1082
|
-
block =
|
|
1083
|
-
__parent =
|
|
1084
|
-
var
|
|
1085
|
-
setVisible =
|
|
1165
|
+
var _useBlockRequestConte8 = useBlockRequestContext(),
|
|
1166
|
+
resource = _useBlockRequestConte8.resource,
|
|
1167
|
+
service = _useBlockRequestConte8.service,
|
|
1168
|
+
block = _useBlockRequestConte8.block,
|
|
1169
|
+
__parent = _useBlockRequestConte8.__parent;
|
|
1170
|
+
var _useActionContext5 = useActionContext(),
|
|
1171
|
+
setVisible = _useActionContext5.setVisible;
|
|
1086
1172
|
return {
|
|
1087
1173
|
onClick: function onClick() {
|
|
1088
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1174
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1089
1175
|
var _service$data;
|
|
1090
|
-
var
|
|
1091
|
-
return _regeneratorRuntime().wrap(function
|
|
1092
|
-
while (1) switch (
|
|
1176
|
+
var _ref16, _ref16$count, count, _ref16$page, page, _ref16$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
|
|
1177
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1178
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1093
1179
|
case 0:
|
|
1094
|
-
|
|
1180
|
+
_context20.next = 2;
|
|
1095
1181
|
return resource.destroy({
|
|
1096
1182
|
filterByTk: filterByTk
|
|
1097
1183
|
});
|
|
1098
1184
|
case 2:
|
|
1099
|
-
|
|
1185
|
+
_ref16 = (service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.meta) || {}, _ref16$count = _ref16.count, count = _ref16$count === void 0 ? 0 : _ref16$count, _ref16$page = _ref16.page, page = _ref16$page === void 0 ? 0 : _ref16$page, _ref16$pageSize = _ref16.pageSize, pageSize = _ref16$pageSize === void 0 ? 0 : _ref16$pageSize;
|
|
1100
1186
|
if (count % pageSize === 1) {
|
|
1101
1187
|
service.run(_objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2[0]), {}, {
|
|
1102
1188
|
page: page - 1
|
|
@@ -1110,9 +1196,32 @@ export var useDestroyActionProps = function useDestroyActionProps() {
|
|
|
1110
1196
|
}
|
|
1111
1197
|
case 5:
|
|
1112
1198
|
case "end":
|
|
1113
|
-
return
|
|
1199
|
+
return _context20.stop();
|
|
1114
1200
|
}
|
|
1115
|
-
},
|
|
1201
|
+
}, _callee20);
|
|
1202
|
+
}))();
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
export var useRemoveActionProps = function useRemoveActionProps(associationName) {
|
|
1207
|
+
var filterByTk = useFilterByTk();
|
|
1208
|
+
var api = useAPIClient();
|
|
1209
|
+
var resource = api.resource(associationName, filterByTk);
|
|
1210
|
+
return {
|
|
1211
|
+
onClick: function onClick(value) {
|
|
1212
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1213
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1214
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1215
|
+
case 0:
|
|
1216
|
+
_context21.next = 2;
|
|
1217
|
+
return resource.remove({
|
|
1218
|
+
values: [value.id]
|
|
1219
|
+
});
|
|
1220
|
+
case 2:
|
|
1221
|
+
case "end":
|
|
1222
|
+
return _context21.stop();
|
|
1223
|
+
}
|
|
1224
|
+
}, _callee21);
|
|
1116
1225
|
}))();
|
|
1117
1226
|
}
|
|
1118
1227
|
};
|
|
@@ -1128,40 +1237,40 @@ export var useDetailPrintActionProps = function useDetailPrintActionProps() {
|
|
|
1128
1237
|
});
|
|
1129
1238
|
return {
|
|
1130
1239
|
onClick: function onClick() {
|
|
1131
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1132
|
-
return _regeneratorRuntime().wrap(function
|
|
1133
|
-
while (1) switch (
|
|
1240
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1241
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1242
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1134
1243
|
case 0:
|
|
1135
1244
|
printHandler();
|
|
1136
1245
|
case 1:
|
|
1137
1246
|
case "end":
|
|
1138
|
-
return
|
|
1247
|
+
return _context22.stop();
|
|
1139
1248
|
}
|
|
1140
|
-
},
|
|
1249
|
+
}, _callee22);
|
|
1141
1250
|
}))();
|
|
1142
1251
|
}
|
|
1143
1252
|
};
|
|
1144
1253
|
};
|
|
1145
1254
|
export var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
1146
|
-
var _useBlockRequestConte8 = useBlockRequestContext(),
|
|
1147
|
-
field = _useBlockRequestConte8.field;
|
|
1148
1255
|
var _useBlockRequestConte9 = useBlockRequestContext(),
|
|
1149
|
-
|
|
1150
|
-
|
|
1256
|
+
field = _useBlockRequestConte9.field;
|
|
1257
|
+
var _useBlockRequestConte10 = useBlockRequestContext(),
|
|
1258
|
+
resource = _useBlockRequestConte10.resource,
|
|
1259
|
+
service = _useBlockRequestConte10.service;
|
|
1151
1260
|
return {
|
|
1152
1261
|
onClick: function onClick() {
|
|
1153
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1262
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1154
1263
|
var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
|
|
1155
|
-
return _regeneratorRuntime().wrap(function
|
|
1156
|
-
while (1) switch (
|
|
1264
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1265
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1157
1266
|
case 0:
|
|
1158
1267
|
if (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : (_field$data2$selected = _field$data2.selectedRowKeys) === null || _field$data2$selected === void 0 ? void 0 : _field$data2$selected.length) {
|
|
1159
|
-
|
|
1268
|
+
_context23.next = 2;
|
|
1160
1269
|
break;
|
|
1161
1270
|
}
|
|
1162
|
-
return
|
|
1271
|
+
return _context23.abrupt("return");
|
|
1163
1272
|
case 2:
|
|
1164
|
-
|
|
1273
|
+
_context23.next = 4;
|
|
1165
1274
|
return resource.destroy({
|
|
1166
1275
|
filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
|
|
1167
1276
|
});
|
|
@@ -1170,29 +1279,29 @@ export var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
1170
1279
|
service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
|
|
1171
1280
|
case 6:
|
|
1172
1281
|
case "end":
|
|
1173
|
-
return
|
|
1282
|
+
return _context23.stop();
|
|
1174
1283
|
}
|
|
1175
|
-
},
|
|
1284
|
+
}, _callee23);
|
|
1176
1285
|
}))();
|
|
1177
1286
|
}
|
|
1178
1287
|
};
|
|
1179
1288
|
};
|
|
1180
1289
|
export var useRefreshActionProps = function useRefreshActionProps() {
|
|
1181
|
-
var
|
|
1182
|
-
service =
|
|
1290
|
+
var _useBlockRequestConte11 = useBlockRequestContext(),
|
|
1291
|
+
service = _useBlockRequestConte11.service;
|
|
1183
1292
|
return {
|
|
1184
1293
|
onClick: function onClick() {
|
|
1185
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1294
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1186
1295
|
var _service$refresh6;
|
|
1187
|
-
return _regeneratorRuntime().wrap(function
|
|
1188
|
-
while (1) switch (
|
|
1296
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1297
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1189
1298
|
case 0:
|
|
1190
1299
|
service === null || service === void 0 ? void 0 : (_service$refresh6 = service.refresh) === null || _service$refresh6 === void 0 ? void 0 : _service$refresh6.call(service);
|
|
1191
1300
|
case 1:
|
|
1192
1301
|
case "end":
|
|
1193
|
-
return
|
|
1302
|
+
return _context24.stop();
|
|
1194
1303
|
}
|
|
1195
|
-
},
|
|
1304
|
+
}, _callee24);
|
|
1196
1305
|
}))();
|
|
1197
1306
|
}
|
|
1198
1307
|
};
|
|
@@ -1208,11 +1317,11 @@ export var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1208
1317
|
total: count,
|
|
1209
1318
|
pageSize: 1,
|
|
1210
1319
|
onChange: function onChange(page) {
|
|
1211
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1320
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1212
1321
|
var _ctx$service3, _ctx$service3$params;
|
|
1213
1322
|
var params;
|
|
1214
|
-
return _regeneratorRuntime().wrap(function
|
|
1215
|
-
while (1) switch (
|
|
1323
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1324
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1216
1325
|
case 0:
|
|
1217
1326
|
params = (_ctx$service3 = ctx.service) === null || _ctx$service3 === void 0 ? void 0 : (_ctx$service3$params = _ctx$service3.params) === null || _ctx$service3$params === void 0 ? void 0 : _ctx$service3$params[0];
|
|
1218
1327
|
ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1220,9 +1329,9 @@ export var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1220
1329
|
}));
|
|
1221
1330
|
case 2:
|
|
1222
1331
|
case "end":
|
|
1223
|
-
return
|
|
1332
|
+
return _context25.stop();
|
|
1224
1333
|
}
|
|
1225
|
-
},
|
|
1334
|
+
}, _callee25);
|
|
1226
1335
|
}))();
|
|
1227
1336
|
},
|
|
1228
1337
|
style: {
|
|
@@ -1232,14 +1341,14 @@ export var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1232
1341
|
};
|
|
1233
1342
|
};
|
|
1234
1343
|
export var useAssociationFilterProps = function useAssociationFilterProps() {
|
|
1235
|
-
var _fieldSchema$
|
|
1344
|
+
var _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps, _field$componentProps2;
|
|
1236
1345
|
var collectionField = AssociationFilter.useAssociationField();
|
|
1237
|
-
var
|
|
1238
|
-
service =
|
|
1239
|
-
blockProps =
|
|
1346
|
+
var _useBlockRequestConte12 = useBlockRequestContext(),
|
|
1347
|
+
service = _useBlockRequestConte12.service,
|
|
1348
|
+
blockProps = _useBlockRequestConte12.props;
|
|
1240
1349
|
var fieldSchema = useFieldSchema();
|
|
1241
1350
|
var valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
|
|
1242
|
-
var labelKey = ((_fieldSchema$
|
|
1351
|
+
var labelKey = ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : (_fieldSchema$xCompon4 = _fieldSchema$xCompon3.fieldNames) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.label) || valueKey;
|
|
1243
1352
|
var field = useField();
|
|
1244
1353
|
var collectionFieldName = collectionField.name;
|
|
1245
1354
|
var _useRequest = useRequest({
|
|
@@ -1289,9 +1398,9 @@ export var useAssociationFilterProps = function useAssociationFilterProps() {
|
|
|
1289
1398
|
};
|
|
1290
1399
|
};
|
|
1291
1400
|
export var useOptionalFieldList = function useOptionalFieldList() {
|
|
1292
|
-
var
|
|
1293
|
-
|
|
1294
|
-
currentFields =
|
|
1401
|
+
var _useCollection6 = useCollection(),
|
|
1402
|
+
_useCollection6$curre = _useCollection6.currentFields,
|
|
1403
|
+
currentFields = _useCollection6$curre === void 0 ? [] : _useCollection6$curre;
|
|
1295
1404
|
return currentFields.filter(function (field) {
|
|
1296
1405
|
return isOptionalField(field) && field.uiSchema.enum;
|
|
1297
1406
|
});
|
|
@@ -1301,7 +1410,7 @@ var isOptionalField = function isOptionalField(field) {
|
|
|
1301
1410
|
return optionalInterfaces.includes(field.interface);
|
|
1302
1411
|
};
|
|
1303
1412
|
export var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
|
|
1304
|
-
var _fieldSchema$
|
|
1413
|
+
var _fieldSchema$xCompon5, _fieldSchema$xCompon6, _field$componentProps3, _field$componentProps4;
|
|
1305
1414
|
var collectionField = AssociationFilter.useAssociationField();
|
|
1306
1415
|
var fieldSchema = useFieldSchema();
|
|
1307
1416
|
var optionalFieldList = useOptionalFieldList();
|
|
@@ -1311,7 +1420,7 @@ export var useAssociationFilterBlockProps = function useAssociationFilterBlockPr
|
|
|
1311
1420
|
var field = useField();
|
|
1312
1421
|
var list, onSelected, handleSearchInput, params, run, data, valueKey, labelKey, filterKey;
|
|
1313
1422
|
valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
|
|
1314
|
-
labelKey = ((_fieldSchema$
|
|
1423
|
+
labelKey = ((_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : (_fieldSchema$xCompon6 = _fieldSchema$xCompon5.fieldNames) === null || _fieldSchema$xCompon6 === void 0 ? void 0 : _fieldSchema$xCompon6.label) || valueKey;
|
|
1315
1424
|
var _useRequest2 = useRequest({
|
|
1316
1425
|
resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
|
|
1317
1426
|
action: 'list',
|
|
@@ -1412,4 +1521,133 @@ export var useAssociationFilterBlockProps = function useAssociationFilterBlockPr
|
|
|
1412
1521
|
valueKey: valueKey,
|
|
1413
1522
|
labelKey: labelKey
|
|
1414
1523
|
};
|
|
1524
|
+
};
|
|
1525
|
+
var getTemplateSchema = function getTemplateSchema(schema) {
|
|
1526
|
+
var conf = {
|
|
1527
|
+
url: "/uiSchemas:getJsonSchema/".concat(schema === null || schema === void 0 ? void 0 : schema.uid)
|
|
1528
|
+
};
|
|
1529
|
+
var _useRequest3 = useRequest(conf, {
|
|
1530
|
+
manual: true
|
|
1531
|
+
}),
|
|
1532
|
+
data = _useRequest3.data,
|
|
1533
|
+
loading = _useRequest3.loading,
|
|
1534
|
+
run = _useRequest3.run;
|
|
1535
|
+
if (loading) {}
|
|
1536
|
+
useEffect(function () {
|
|
1537
|
+
if (schema === null || schema === void 0 ? void 0 : schema.uid) {
|
|
1538
|
+
run();
|
|
1539
|
+
}
|
|
1540
|
+
}, [schema === null || schema === void 0 ? void 0 : schema.uid]);
|
|
1541
|
+
return (schema === null || schema === void 0 ? void 0 : schema.uid) ? new Schema(data === null || data === void 0 ? void 0 : data.data) : null;
|
|
1542
|
+
};
|
|
1543
|
+
export var useAssociationNames = function useAssociationNames(collection) {
|
|
1544
|
+
var _templateSchema$xCom;
|
|
1545
|
+
var _useCollectionManager2 = useCollectionManager(),
|
|
1546
|
+
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField;
|
|
1547
|
+
var _useSchemaTemplateMan = useSchemaTemplateManager(),
|
|
1548
|
+
getTemplateById = _useSchemaTemplateMan.getTemplateById;
|
|
1549
|
+
var fieldSchema = useFieldSchema();
|
|
1550
|
+
var associationValues = [];
|
|
1551
|
+
var formSchema = fieldSchema.reduceProperties(function (buf, schema) {
|
|
1552
|
+
if (['FormV2', 'Details', 'List', 'GridCard'].includes(schema['x-component'])) {
|
|
1553
|
+
return schema;
|
|
1554
|
+
}
|
|
1555
|
+
return buf;
|
|
1556
|
+
}, new Schema({}));
|
|
1557
|
+
var templateSchema = formSchema.reduceProperties(function (buf, schema) {
|
|
1558
|
+
if (schema['x-component'] === 'BlockTemplate') {
|
|
1559
|
+
return schema;
|
|
1560
|
+
}
|
|
1561
|
+
return buf;
|
|
1562
|
+
}, null);
|
|
1563
|
+
var getAssociationAppends = function getAssociationAppends(schema) {
|
|
1564
|
+
var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1565
|
+
var data = schema.reduceProperties(function (buf, s) {
|
|
1566
|
+
var collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
|
|
1567
|
+
if (collectionfield && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(collectionfield.type) && s['x-component'] !== 'TableField') {
|
|
1568
|
+
var _s$xComponentProps;
|
|
1569
|
+
buf.push(s.name);
|
|
1570
|
+
if (['Nester', 'SubTable'].includes((_s$xComponentProps = s['x-component-props']) === null || _s$xComponentProps === void 0 ? void 0 : _s$xComponentProps.mode)) {
|
|
1571
|
+
associationValues.push(s.name);
|
|
1572
|
+
}
|
|
1573
|
+
if (s['x-component-props'].mode === 'Nester') {
|
|
1574
|
+
return getAssociationAppends(s, buf);
|
|
1575
|
+
}
|
|
1576
|
+
return buf;
|
|
1577
|
+
} else {
|
|
1578
|
+
if (s['x-component'] === 'Grid.Row') {
|
|
1579
|
+
var _buf$concat;
|
|
1580
|
+
var kk = buf === null || buf === void 0 ? void 0 : (_buf$concat = buf.concat) === null || _buf$concat === void 0 ? void 0 : _buf$concat.call(buf);
|
|
1581
|
+
return getNesterAppends(s, kk || []);
|
|
1582
|
+
} else {
|
|
1583
|
+
var _s$xComponent;
|
|
1584
|
+
return !((_s$xComponent = s['x-component']) === null || _s$xComponent === void 0 ? void 0 : _s$xComponent.includes('Action.')) && s['x-component'] !== 'TableField' ? getAssociationAppends(s, buf) : buf;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}, arr);
|
|
1588
|
+
return data || [];
|
|
1589
|
+
};
|
|
1590
|
+
function flattenNestedList(nestedList) {
|
|
1591
|
+
var flattenedList = [];
|
|
1592
|
+
function flattenHelper(list, prefix) {
|
|
1593
|
+
for (var i = 0; i < list.length; i++) {
|
|
1594
|
+
if (Array.isArray(list[i])) {
|
|
1595
|
+
"".concat(prefix) !== "".concat(list[i][0]) && flattenHelper(list[i], "".concat(prefix, ".").concat(list[i][0]));
|
|
1596
|
+
} else {
|
|
1597
|
+
var searchTerm = ".".concat(list[i]);
|
|
1598
|
+
var lastIndex = prefix.lastIndexOf(searchTerm);
|
|
1599
|
+
var str = '';
|
|
1600
|
+
if (lastIndex !== -1) {
|
|
1601
|
+
str = prefix.slice(0, lastIndex) + prefix.slice(lastIndex + searchTerm.length);
|
|
1602
|
+
}
|
|
1603
|
+
if (!str) {
|
|
1604
|
+
!list.includes(str) && flattenedList.push("".concat(list[i]));
|
|
1605
|
+
} else {
|
|
1606
|
+
!list.includes(str) ? flattenedList.push("".concat(str, ".").concat(list[i])) : flattenedList.push(str);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
for (var i = 0; i < nestedList.length; i++) {
|
|
1612
|
+
flattenHelper(nestedList[i], nestedList[i][0]);
|
|
1613
|
+
}
|
|
1614
|
+
return uniq(flattenedList.filter(function (obj) {
|
|
1615
|
+
return !(obj === null || obj === void 0 ? void 0 : obj.startsWith('.'));
|
|
1616
|
+
}));
|
|
1617
|
+
}
|
|
1618
|
+
var getNesterAppends = function getNesterAppends(gridSchema, data) {
|
|
1619
|
+
gridSchema.reduceProperties(function (buf, s) {
|
|
1620
|
+
buf.push(getAssociationAppends(s));
|
|
1621
|
+
return buf;
|
|
1622
|
+
}, data);
|
|
1623
|
+
return data.filter(function (g) {
|
|
1624
|
+
return g.length;
|
|
1625
|
+
});
|
|
1626
|
+
};
|
|
1627
|
+
var template = getTemplateById(templateSchema === null || templateSchema === void 0 ? void 0 : (_templateSchema$xCom = templateSchema['x-component-props']) === null || _templateSchema$xCom === void 0 ? void 0 : _templateSchema$xCom.templateId);
|
|
1628
|
+
var schema = getTemplateSchema(template);
|
|
1629
|
+
if (schema) {
|
|
1630
|
+
var associations = getAssociationAppends(schema);
|
|
1631
|
+
var appends = flattenNestedList(associations);
|
|
1632
|
+
return {
|
|
1633
|
+
appends: appends,
|
|
1634
|
+
updateAssociationValues: appends.filter(function (item) {
|
|
1635
|
+
return associationValues.some(function (suffix) {
|
|
1636
|
+
return item.endsWith(suffix);
|
|
1637
|
+
});
|
|
1638
|
+
})
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
if (!schema) {
|
|
1642
|
+
var _associations = getAssociationAppends(formSchema);
|
|
1643
|
+
var _appends = flattenNestedList(_associations);
|
|
1644
|
+
return {
|
|
1645
|
+
appends: _appends,
|
|
1646
|
+
updateAssociationValues: _appends.filter(function (item) {
|
|
1647
|
+
return associationValues.some(function (suffix) {
|
|
1648
|
+
return item.endsWith(suffix);
|
|
1649
|
+
});
|
|
1650
|
+
})
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1415
1653
|
};
|