@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
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
|
|
6
|
+
exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRemoveActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationNames = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.useAssociationCreateActionProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
|
|
7
7
|
var _react = require("@formily/react");
|
|
8
|
+
var _client = require("@nocobase/utils/client");
|
|
8
9
|
var _antd = require("antd");
|
|
9
|
-
var _jsonTemplates = _interopRequireDefault(require("json-templates"));
|
|
10
10
|
var _lodash = require("lodash");
|
|
11
11
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
12
12
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
@@ -22,6 +22,7 @@ var _utils = require("../../filter-provider/utils");
|
|
|
22
22
|
var _recordProvider = require("../../record-provider");
|
|
23
23
|
var _schemaComponent = require("../../schema-component");
|
|
24
24
|
var _components = require("../../schema-initializer/components");
|
|
25
|
+
var _schemaTemplates = require("../../schema-templates");
|
|
25
26
|
var _user = require("../../user");
|
|
26
27
|
var _BlockProvider = require("../BlockProvider");
|
|
27
28
|
var _DetailsBlockProvider = require("../DetailsBlockProvider");
|
|
@@ -181,7 +182,7 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
181
182
|
onClick: function onClick() {
|
|
182
183
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
183
184
|
var _actionSchema$xActio, _fieldSchema$xCompon;
|
|
184
|
-
var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre;
|
|
185
|
+
var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre, data;
|
|
185
186
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
186
187
|
while (1) switch (_context2.prev = _context2.next) {
|
|
187
188
|
case 0:
|
|
@@ -190,7 +191,7 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
190
191
|
});
|
|
191
192
|
_ref = (_actionSchema$xActio = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio !== void 0 ? _actionSchema$xActio : {}, _ref$assignedValues = _ref.assignedValues, originalAssignedValues = _ref$assignedValues === void 0 ? {} : _ref$assignedValues, onSuccess = _ref.onSuccess, overwriteValues = _ref.overwriteValues, skipValidator = _ref.skipValidator;
|
|
192
193
|
addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.addChild;
|
|
193
|
-
assignedValues = (0,
|
|
194
|
+
assignedValues = (0, _client.parse)(originalAssignedValues)({
|
|
194
195
|
currentTime: new Date(),
|
|
195
196
|
currentRecord: currentRecord,
|
|
196
197
|
currentUser: currentUser
|
|
@@ -202,7 +203,7 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
202
203
|
_context2.next = 7;
|
|
203
204
|
return form.submit();
|
|
204
205
|
case 7:
|
|
205
|
-
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
206
|
+
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource); // const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
|
|
206
207
|
if (addChild) {
|
|
207
208
|
treeParentField = getTreeParentField();
|
|
208
209
|
values[(_treeParentField$name = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name !== void 0 ? _treeParentField$name : 'parent'] = currentRecord;
|
|
@@ -216,15 +217,17 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
216
217
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
|
|
217
218
|
});
|
|
218
219
|
case 14:
|
|
220
|
+
data = _context2.sent;
|
|
219
221
|
actionField.data.loading = false;
|
|
222
|
+
actionField.data.data = data;
|
|
220
223
|
__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);
|
|
221
224
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
222
225
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
223
|
-
_context2.next =
|
|
226
|
+
_context2.next = 21;
|
|
224
227
|
break;
|
|
225
228
|
}
|
|
226
229
|
return _context2.abrupt("return");
|
|
227
|
-
case
|
|
230
|
+
case 21:
|
|
228
231
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
229
232
|
_antd.Modal.success({
|
|
230
233
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
@@ -258,22 +261,109 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
258
261
|
} else {
|
|
259
262
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
260
263
|
}
|
|
261
|
-
_context2.next =
|
|
264
|
+
_context2.next = 27;
|
|
262
265
|
break;
|
|
263
|
-
case
|
|
264
|
-
_context2.prev =
|
|
266
|
+
case 24:
|
|
267
|
+
_context2.prev = 24;
|
|
265
268
|
_context2.t0 = _context2["catch"](11);
|
|
266
269
|
actionField.data.loading = false;
|
|
267
|
-
case
|
|
270
|
+
case 27:
|
|
268
271
|
case "end":
|
|
269
272
|
return _context2.stop();
|
|
270
273
|
}
|
|
271
|
-
}, _callee2, null, [[11,
|
|
274
|
+
}, _callee2, null, [[11, 24]]);
|
|
272
275
|
}))();
|
|
273
276
|
}
|
|
274
277
|
};
|
|
275
278
|
};
|
|
276
279
|
exports.useCreateActionProps = useCreateActionProps;
|
|
280
|
+
var useAssociationCreateActionProps = function useAssociationCreateActionProps() {
|
|
281
|
+
var _currentUserContext$d2;
|
|
282
|
+
var form = (0, _react.useForm)();
|
|
283
|
+
var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
284
|
+
field = _useBlockRequestConte2.field,
|
|
285
|
+
resource = _useBlockRequestConte2.resource;
|
|
286
|
+
var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
|
|
287
|
+
setVisible = _useActionContext2.setVisible,
|
|
288
|
+
fieldSchema = _useActionContext2.fieldSchema;
|
|
289
|
+
var actionSchema = (0, _react.useFieldSchema)();
|
|
290
|
+
var actionField = (0, _react.useField)();
|
|
291
|
+
var _useCollection2 = (0, _collectionManager.useCollection)(),
|
|
292
|
+
fields = _useCollection2.fields,
|
|
293
|
+
getField = _useCollection2.getField,
|
|
294
|
+
getTreeParentField = _useCollection2.getTreeParentField;
|
|
295
|
+
var compile = (0, _schemaComponent.useCompile)();
|
|
296
|
+
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
297
|
+
var currentRecord = (0, _recordProvider.useRecord)();
|
|
298
|
+
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
299
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
|
|
300
|
+
return {
|
|
301
|
+
onClick: function onClick() {
|
|
302
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
303
|
+
var _actionSchema$xActio2, _fieldSchema$xCompon2;
|
|
304
|
+
var fieldNames, _ref2, _ref2$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name2, _treeParentField$fore2, treeParentField, data;
|
|
305
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
306
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
307
|
+
case 0:
|
|
308
|
+
fieldNames = fields.map(function (field) {
|
|
309
|
+
return field.name;
|
|
310
|
+
});
|
|
311
|
+
_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;
|
|
312
|
+
addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.addChild;
|
|
313
|
+
assignedValues = (0, _client.parse)(originalAssignedValues)({
|
|
314
|
+
currentTime: new Date(),
|
|
315
|
+
currentRecord: currentRecord,
|
|
316
|
+
currentUser: currentUser
|
|
317
|
+
});
|
|
318
|
+
if (skipValidator) {
|
|
319
|
+
_context3.next = 7;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
_context3.next = 7;
|
|
323
|
+
return form.submit();
|
|
324
|
+
case 7:
|
|
325
|
+
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
326
|
+
if (addChild) {
|
|
327
|
+
treeParentField = getTreeParentField();
|
|
328
|
+
values[(_treeParentField$name2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name2 !== void 0 ? _treeParentField$name2 : 'parent'] = currentRecord;
|
|
329
|
+
values[(_treeParentField$fore2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.foreignKey) !== null && _treeParentField$fore2 !== void 0 ? _treeParentField$fore2 : 'parentId'] = currentRecord.id;
|
|
330
|
+
}
|
|
331
|
+
actionField.data = field.data || {};
|
|
332
|
+
actionField.data.loading = true;
|
|
333
|
+
_context3.prev = 11;
|
|
334
|
+
_context3.next = 14;
|
|
335
|
+
return resource.create({
|
|
336
|
+
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
|
|
337
|
+
});
|
|
338
|
+
case 14:
|
|
339
|
+
data = _context3.sent;
|
|
340
|
+
actionField.data.loading = false;
|
|
341
|
+
actionField.data.data = data;
|
|
342
|
+
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
343
|
+
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
344
|
+
_context3.next = 20;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
return _context3.abrupt("return");
|
|
348
|
+
case 20:
|
|
349
|
+
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
350
|
+
_context3.next = 27;
|
|
351
|
+
break;
|
|
352
|
+
case 23:
|
|
353
|
+
_context3.prev = 23;
|
|
354
|
+
_context3.t0 = _context3["catch"](11);
|
|
355
|
+
actionField.data.data = null;
|
|
356
|
+
actionField.data.loading = false;
|
|
357
|
+
case 27:
|
|
358
|
+
case "end":
|
|
359
|
+
return _context3.stop();
|
|
360
|
+
}
|
|
361
|
+
}, _callee3, null, [[11, 23]]);
|
|
362
|
+
}))();
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
exports.useAssociationCreateActionProps = useAssociationCreateActionProps;
|
|
277
367
|
var findFilterTargets = function findFilterTargets(fieldSchema) {
|
|
278
368
|
while (fieldSchema) {
|
|
279
369
|
if (fieldSchema['x-filter-targets']) {
|
|
@@ -303,37 +393,37 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
303
393
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
304
394
|
var _useFilterBlock = (0, _FilterProvider.useFilterBlock)(),
|
|
305
395
|
getDataBlocks = _useFilterBlock.getDataBlocks;
|
|
306
|
-
var
|
|
307
|
-
name =
|
|
396
|
+
var _useCollection3 = (0, _collectionManager.useCollection)(),
|
|
397
|
+
name = _useCollection3.name;
|
|
308
398
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
309
399
|
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
310
400
|
actionField.data = actionField.data || {};
|
|
311
401
|
return {
|
|
312
402
|
onClick: function onClick() {
|
|
313
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
403
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
314
404
|
var _findFilterTargets, _findFilterTargets$ta, targets, uid;
|
|
315
|
-
return _regeneratorRuntime().wrap(function
|
|
316
|
-
while (1) switch (
|
|
405
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
406
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
317
407
|
case 0:
|
|
318
408
|
_findFilterTargets = findFilterTargets(fieldSchema), _findFilterTargets$ta = _findFilterTargets.targets, targets = _findFilterTargets$ta === void 0 ? [] : _findFilterTargets$ta, uid = _findFilterTargets.uid;
|
|
319
409
|
actionField.data.loading = true;
|
|
320
|
-
|
|
321
|
-
|
|
410
|
+
_context5.prev = 2;
|
|
411
|
+
_context5.next = 5;
|
|
322
412
|
return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
|
|
323
|
-
var
|
|
413
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(block) {
|
|
324
414
|
var _block$service$params, _block$service$params2, _block$service$params3;
|
|
325
415
|
var target, param, storedFilter, mergedFilter;
|
|
326
|
-
return _regeneratorRuntime().wrap(function
|
|
327
|
-
while (1) switch (
|
|
416
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
417
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
328
418
|
case 0:
|
|
329
419
|
target = targets.find(function (target) {
|
|
330
420
|
return target.uid === block.uid;
|
|
331
421
|
});
|
|
332
422
|
if (target) {
|
|
333
|
-
|
|
423
|
+
_context4.next = 3;
|
|
334
424
|
break;
|
|
335
425
|
}
|
|
336
|
-
return
|
|
426
|
+
return _context4.abrupt("return");
|
|
337
427
|
case 3:
|
|
338
428
|
param = ((_block$service$params = block.service.params) === null || _block$service$params === void 0 ? void 0 : _block$service$params[0]) || {}; // 保留原有的 filter
|
|
339
429
|
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) || {};
|
|
@@ -341,7 +431,7 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
341
431
|
mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter).map(function (filter) {
|
|
342
432
|
return (0, _schemaComponent.removeNullCondition)(filter);
|
|
343
433
|
})), [block.defaultFilter]));
|
|
344
|
-
return
|
|
434
|
+
return _context4.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
|
|
345
435
|
page: 1,
|
|
346
436
|
filter: mergedFilter
|
|
347
437
|
}), {
|
|
@@ -349,28 +439,28 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
|
|
|
349
439
|
}));
|
|
350
440
|
case 8:
|
|
351
441
|
case "end":
|
|
352
|
-
return
|
|
442
|
+
return _context4.stop();
|
|
353
443
|
}
|
|
354
|
-
},
|
|
444
|
+
}, _callee4);
|
|
355
445
|
}));
|
|
356
446
|
return function (_x) {
|
|
357
|
-
return
|
|
447
|
+
return _ref3.apply(this, arguments);
|
|
358
448
|
};
|
|
359
449
|
}()));
|
|
360
450
|
case 5:
|
|
361
451
|
actionField.data.loading = false;
|
|
362
|
-
|
|
452
|
+
_context5.next = 12;
|
|
363
453
|
break;
|
|
364
454
|
case 8:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
console.error(
|
|
455
|
+
_context5.prev = 8;
|
|
456
|
+
_context5.t0 = _context5["catch"](2);
|
|
457
|
+
console.error(_context5.t0);
|
|
368
458
|
actionField.data.loading = false;
|
|
369
459
|
case 12:
|
|
370
460
|
case "end":
|
|
371
|
-
return
|
|
461
|
+
return _context5.stop();
|
|
372
462
|
}
|
|
373
|
-
},
|
|
463
|
+
}, _callee5, null, [[2, 8]]);
|
|
374
464
|
}))();
|
|
375
465
|
}
|
|
376
466
|
};
|
|
@@ -385,37 +475,37 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
|
|
|
385
475
|
actionField.data = actionField.data || {};
|
|
386
476
|
return {
|
|
387
477
|
onClick: function onClick() {
|
|
388
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
478
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
389
479
|
var _findFilterTargets2, targets, uid;
|
|
390
|
-
return _regeneratorRuntime().wrap(function
|
|
391
|
-
while (1) switch (
|
|
480
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
481
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
392
482
|
case 0:
|
|
393
483
|
_findFilterTargets2 = findFilterTargets(fieldSchema), targets = _findFilterTargets2.targets, uid = _findFilterTargets2.uid;
|
|
394
484
|
form.reset();
|
|
395
485
|
actionField.data.loading = true;
|
|
396
|
-
|
|
397
|
-
|
|
486
|
+
_context7.prev = 3;
|
|
487
|
+
_context7.next = 6;
|
|
398
488
|
return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
|
|
399
|
-
var
|
|
489
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(block) {
|
|
400
490
|
var _block$service$params4, _block$service$params5, _block$service$params6;
|
|
401
491
|
var target, param, storedFilter, mergedFilter;
|
|
402
|
-
return _regeneratorRuntime().wrap(function
|
|
403
|
-
while (1) switch (
|
|
492
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
493
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
404
494
|
case 0:
|
|
405
495
|
target = targets.find(function (target) {
|
|
406
496
|
return target.uid === block.uid;
|
|
407
497
|
});
|
|
408
498
|
if (target) {
|
|
409
|
-
|
|
499
|
+
_context6.next = 3;
|
|
410
500
|
break;
|
|
411
501
|
}
|
|
412
|
-
return
|
|
502
|
+
return _context6.abrupt("return");
|
|
413
503
|
case 3:
|
|
414
504
|
param = ((_block$service$params4 = block.service.params) === null || _block$service$params4 === void 0 ? void 0 : _block$service$params4[0]) || {}; // 保留原有的 filter
|
|
415
505
|
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) || {};
|
|
416
506
|
delete storedFilter[uid];
|
|
417
507
|
mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter)), [block.defaultFilter]));
|
|
418
|
-
return
|
|
508
|
+
return _context6.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
|
|
419
509
|
page: 1,
|
|
420
510
|
filter: mergedFilter
|
|
421
511
|
}), {
|
|
@@ -423,68 +513,68 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
|
|
|
423
513
|
}));
|
|
424
514
|
case 8:
|
|
425
515
|
case "end":
|
|
426
|
-
return
|
|
516
|
+
return _context6.stop();
|
|
427
517
|
}
|
|
428
|
-
},
|
|
518
|
+
}, _callee6);
|
|
429
519
|
}));
|
|
430
520
|
return function (_x2) {
|
|
431
|
-
return
|
|
521
|
+
return _ref4.apply(this, arguments);
|
|
432
522
|
};
|
|
433
523
|
}()));
|
|
434
524
|
case 6:
|
|
435
525
|
actionField.data.loading = false;
|
|
436
|
-
|
|
526
|
+
_context7.next = 12;
|
|
437
527
|
break;
|
|
438
528
|
case 9:
|
|
439
|
-
|
|
440
|
-
|
|
529
|
+
_context7.prev = 9;
|
|
530
|
+
_context7.t0 = _context7["catch"](3);
|
|
441
531
|
actionField.data.loading = false;
|
|
442
532
|
case 12:
|
|
443
533
|
case "end":
|
|
444
|
-
return
|
|
534
|
+
return _context7.stop();
|
|
445
535
|
}
|
|
446
|
-
},
|
|
536
|
+
}, _callee7, null, [[3, 9]]);
|
|
447
537
|
}))();
|
|
448
538
|
}
|
|
449
539
|
};
|
|
450
540
|
};
|
|
451
541
|
exports.useResetBlockActionProps = useResetBlockActionProps;
|
|
452
542
|
var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
453
|
-
var _currentUserContext$
|
|
454
|
-
var
|
|
455
|
-
resource =
|
|
456
|
-
__parent =
|
|
457
|
-
service =
|
|
543
|
+
var _currentUserContext$d3;
|
|
544
|
+
var _useBlockRequestConte3 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
545
|
+
resource = _useBlockRequestConte3.resource,
|
|
546
|
+
__parent = _useBlockRequestConte3.__parent,
|
|
547
|
+
service = _useBlockRequestConte3.service;
|
|
458
548
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
459
549
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
460
550
|
var currentRecord = (0, _recordProvider.useRecord)();
|
|
461
551
|
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
462
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
552
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
|
|
463
553
|
var history = (0, _reactRouterDom.useHistory)();
|
|
464
554
|
var compile = (0, _schemaComponent.useCompile)();
|
|
465
555
|
var form = (0, _react.useForm)();
|
|
466
556
|
return {
|
|
467
557
|
onClick: function onClick() {
|
|
468
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
469
|
-
var _actionSchema$
|
|
470
|
-
var
|
|
471
|
-
return _regeneratorRuntime().wrap(function
|
|
472
|
-
while (1) switch (
|
|
558
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
559
|
+
var _actionSchema$xActio3, _service$refresh;
|
|
560
|
+
var _ref5, _ref5$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
|
|
561
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
562
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
473
563
|
case 0:
|
|
474
|
-
|
|
475
|
-
assignedValues = (0,
|
|
564
|
+
_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;
|
|
565
|
+
assignedValues = (0, _client.parse)(originalAssignedValues)({
|
|
476
566
|
currentTime: new Date(),
|
|
477
567
|
currentRecord: currentRecord,
|
|
478
568
|
currentUser: currentUser
|
|
479
569
|
});
|
|
480
570
|
if (!(skipValidator === false)) {
|
|
481
|
-
|
|
571
|
+
_context9.next = 5;
|
|
482
572
|
break;
|
|
483
573
|
}
|
|
484
|
-
|
|
574
|
+
_context9.next = 5;
|
|
485
575
|
return form.submit();
|
|
486
576
|
case 5:
|
|
487
|
-
|
|
577
|
+
_context9.next = 7;
|
|
488
578
|
return resource.update({
|
|
489
579
|
filterByTk: filterByTk,
|
|
490
580
|
values: _objectSpread({}, assignedValues)
|
|
@@ -495,18 +585,18 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
495
585
|
__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);
|
|
496
586
|
}
|
|
497
587
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
498
|
-
|
|
588
|
+
_context9.next = 11;
|
|
499
589
|
break;
|
|
500
590
|
}
|
|
501
|
-
return
|
|
591
|
+
return _context9.abrupt("return");
|
|
502
592
|
case 11:
|
|
503
593
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
504
594
|
_antd.Modal.success({
|
|
505
595
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
506
596
|
onOk: function () {
|
|
507
|
-
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
508
|
-
return _regeneratorRuntime().wrap(function
|
|
509
|
-
while (1) switch (
|
|
597
|
+
var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
598
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
599
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
510
600
|
case 0:
|
|
511
601
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
512
602
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -517,9 +607,9 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
517
607
|
}
|
|
518
608
|
case 1:
|
|
519
609
|
case "end":
|
|
520
|
-
return
|
|
610
|
+
return _context8.stop();
|
|
521
611
|
}
|
|
522
|
-
},
|
|
612
|
+
}, _callee8);
|
|
523
613
|
}));
|
|
524
614
|
function onOk() {
|
|
525
615
|
return _onOk2.apply(this, arguments);
|
|
@@ -532,28 +622,28 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
532
622
|
}
|
|
533
623
|
case 12:
|
|
534
624
|
case "end":
|
|
535
|
-
return
|
|
625
|
+
return _context9.stop();
|
|
536
626
|
}
|
|
537
|
-
},
|
|
627
|
+
}, _callee9);
|
|
538
628
|
}))();
|
|
539
629
|
}
|
|
540
630
|
};
|
|
541
631
|
};
|
|
542
632
|
exports.useCustomizeUpdateActionProps = useCustomizeUpdateActionProps;
|
|
543
633
|
var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionProps() {
|
|
544
|
-
var
|
|
545
|
-
var
|
|
546
|
-
field =
|
|
547
|
-
resource =
|
|
548
|
-
__parent =
|
|
549
|
-
service =
|
|
634
|
+
var _ref6, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d4;
|
|
635
|
+
var _useBlockRequestConte4 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
636
|
+
field = _useBlockRequestConte4.field,
|
|
637
|
+
resource = _useBlockRequestConte4.resource,
|
|
638
|
+
__parent = _useBlockRequestConte4.__parent,
|
|
639
|
+
service = _useBlockRequestConte4.service;
|
|
550
640
|
var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
|
|
551
641
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
552
642
|
var tableBlockContext = (0, _2.useTableBlockContext)();
|
|
553
643
|
var rowKey = tableBlockContext.rowKey;
|
|
554
|
-
var selectedRecordKeys = (
|
|
644
|
+
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 : {};
|
|
555
645
|
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
556
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
646
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
|
|
557
647
|
var history = (0, _reactRouterDom.useHistory)();
|
|
558
648
|
var compile = (0, _schemaComponent.useCompile)();
|
|
559
649
|
var _useTranslation2 = (0, _reactI18next.useTranslation)(),
|
|
@@ -561,16 +651,16 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
|
|
|
561
651
|
var actionField = (0, _react.useField)();
|
|
562
652
|
return {
|
|
563
653
|
onClick: function onClick() {
|
|
564
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
565
|
-
var _actionSchema$
|
|
566
|
-
var
|
|
567
|
-
return _regeneratorRuntime().wrap(function
|
|
568
|
-
while (1) switch (
|
|
654
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
655
|
+
var _actionSchema$xActio4;
|
|
656
|
+
var _ref7, _ref7$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
|
|
657
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
658
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
569
659
|
case 0:
|
|
570
|
-
|
|
660
|
+
_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;
|
|
571
661
|
actionField.data = field.data || {};
|
|
572
662
|
actionField.data.loading = true;
|
|
573
|
-
assignedValues = (0,
|
|
663
|
+
assignedValues = (0, _client.parse)(originalAssignedValues)({
|
|
574
664
|
currentTime: new Date(),
|
|
575
665
|
currentUser: currentUser
|
|
576
666
|
});
|
|
@@ -578,29 +668,29 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
|
|
|
578
668
|
title: t('Bulk update'),
|
|
579
669
|
content: updateMode === 'selected' ? t('Update selected data?') : t('Update all data?'),
|
|
580
670
|
onOk: function onOk() {
|
|
581
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
671
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
582
672
|
var _service$params$, _service$params, _service$refresh2;
|
|
583
|
-
var
|
|
584
|
-
return _regeneratorRuntime().wrap(function
|
|
585
|
-
while (1) switch (
|
|
673
|
+
var _ref8, filter, updateData, _parent$service3, _parent$service3$refr;
|
|
674
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
675
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
586
676
|
case 0:
|
|
587
|
-
|
|
677
|
+
_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;
|
|
588
678
|
updateData = {
|
|
589
679
|
values: _objectSpread({}, assignedValues),
|
|
590
680
|
filter: filter,
|
|
591
681
|
forceUpdate: false
|
|
592
682
|
};
|
|
593
683
|
if (!(updateMode === 'selected')) {
|
|
594
|
-
|
|
684
|
+
_context11.next = 8;
|
|
595
685
|
break;
|
|
596
686
|
}
|
|
597
687
|
if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
|
|
598
|
-
|
|
688
|
+
_context11.next = 7;
|
|
599
689
|
break;
|
|
600
690
|
}
|
|
601
691
|
_antd.message.error(t('Please select the records to be updated'));
|
|
602
692
|
actionField.data.loading = false;
|
|
603
|
-
return
|
|
693
|
+
return _context11.abrupt("return");
|
|
604
694
|
case 7:
|
|
605
695
|
updateData.filter = {
|
|
606
696
|
$and: [_defineProperty({}, rowKey || 'id', {
|
|
@@ -611,37 +701,37 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
|
|
|
611
701
|
if (!updateData.filter) {
|
|
612
702
|
updateData.forceUpdate = true;
|
|
613
703
|
}
|
|
614
|
-
|
|
615
|
-
|
|
704
|
+
_context11.prev = 9;
|
|
705
|
+
_context11.next = 12;
|
|
616
706
|
return resource.update(updateData);
|
|
617
707
|
case 12:
|
|
618
|
-
|
|
708
|
+
_context11.next = 16;
|
|
619
709
|
break;
|
|
620
710
|
case 14:
|
|
621
|
-
|
|
622
|
-
|
|
711
|
+
_context11.prev = 14;
|
|
712
|
+
_context11.t0 = _context11["catch"](9);
|
|
623
713
|
case 16:
|
|
624
|
-
|
|
714
|
+
_context11.prev = 16;
|
|
625
715
|
actionField.data.loading = false;
|
|
626
|
-
return
|
|
716
|
+
return _context11.finish(16);
|
|
627
717
|
case 19:
|
|
628
718
|
service === null || service === void 0 ? void 0 : (_service$refresh2 = service.refresh) === null || _service$refresh2 === void 0 ? void 0 : _service$refresh2.call(service);
|
|
629
719
|
if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
|
|
630
720
|
__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);
|
|
631
721
|
}
|
|
632
722
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
633
|
-
|
|
723
|
+
_context11.next = 23;
|
|
634
724
|
break;
|
|
635
725
|
}
|
|
636
|
-
return
|
|
726
|
+
return _context11.abrupt("return");
|
|
637
727
|
case 23:
|
|
638
728
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
639
729
|
_antd.Modal.success({
|
|
640
730
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
641
731
|
onOk: function () {
|
|
642
|
-
var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
643
|
-
return _regeneratorRuntime().wrap(function
|
|
644
|
-
while (1) switch (
|
|
732
|
+
var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
734
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
645
735
|
case 0:
|
|
646
736
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
647
737
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -652,9 +742,9 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
|
|
|
652
742
|
}
|
|
653
743
|
case 1:
|
|
654
744
|
case "end":
|
|
655
|
-
return
|
|
745
|
+
return _context10.stop();
|
|
656
746
|
}
|
|
657
|
-
},
|
|
747
|
+
}, _callee10);
|
|
658
748
|
}));
|
|
659
749
|
function onOk() {
|
|
660
750
|
return _onOk3.apply(this, arguments);
|
|
@@ -667,44 +757,44 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
|
|
|
667
757
|
}
|
|
668
758
|
case 24:
|
|
669
759
|
case "end":
|
|
670
|
-
return
|
|
760
|
+
return _context11.stop();
|
|
671
761
|
}
|
|
672
|
-
},
|
|
762
|
+
}, _callee11, null, [[9, 14, 16, 19]]);
|
|
673
763
|
}))();
|
|
674
764
|
},
|
|
675
765
|
onCancel: function onCancel() {
|
|
676
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
677
|
-
return _regeneratorRuntime().wrap(function
|
|
678
|
-
while (1) switch (
|
|
766
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
767
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
768
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
679
769
|
case 0:
|
|
680
770
|
actionField.data.loading = false;
|
|
681
771
|
case 1:
|
|
682
772
|
case "end":
|
|
683
|
-
return
|
|
773
|
+
return _context12.stop();
|
|
684
774
|
}
|
|
685
|
-
},
|
|
775
|
+
}, _callee12);
|
|
686
776
|
}))();
|
|
687
777
|
}
|
|
688
778
|
});
|
|
689
779
|
case 5:
|
|
690
780
|
case "end":
|
|
691
|
-
return
|
|
781
|
+
return _context13.stop();
|
|
692
782
|
}
|
|
693
|
-
},
|
|
783
|
+
}, _callee13);
|
|
694
784
|
}))();
|
|
695
785
|
}
|
|
696
786
|
};
|
|
697
787
|
};
|
|
698
788
|
exports.useCustomizeBulkUpdateActionProps = useCustomizeBulkUpdateActionProps;
|
|
699
789
|
var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps() {
|
|
700
|
-
var
|
|
790
|
+
var _ref10, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
|
|
701
791
|
var form = (0, _react.useForm)();
|
|
702
792
|
var _useTranslation3 = (0, _reactI18next.useTranslation)(),
|
|
703
793
|
t = _useTranslation3.t;
|
|
704
|
-
var
|
|
705
|
-
field =
|
|
706
|
-
resource =
|
|
707
|
-
__parent =
|
|
794
|
+
var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
795
|
+
field = _useBlockRequestConte5.field,
|
|
796
|
+
resource = _useBlockRequestConte5.resource,
|
|
797
|
+
__parent = _useBlockRequestConte5.__parent;
|
|
708
798
|
var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
|
|
709
799
|
var actionContext = (0, _schemaComponent.useActionContext)();
|
|
710
800
|
var history = (0, _reactRouterDom.useHistory)();
|
|
@@ -712,24 +802,24 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
712
802
|
var actionField = (0, _react.useField)();
|
|
713
803
|
var tableBlockContext = (0, _2.useTableBlockContext)();
|
|
714
804
|
var rowKey = tableBlockContext.rowKey;
|
|
715
|
-
var selectedRecordKeys = (
|
|
805
|
+
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 : {};
|
|
716
806
|
var setVisible = actionContext.setVisible,
|
|
717
807
|
actionSchema = actionContext.fieldSchema;
|
|
718
808
|
return {
|
|
719
809
|
onClick: function onClick() {
|
|
720
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
721
|
-
var _actionSchema$
|
|
722
|
-
var
|
|
723
|
-
return _regeneratorRuntime().wrap(function
|
|
724
|
-
while (1) switch (
|
|
810
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
811
|
+
var _actionSchema$xActio5, _parent$service$para, _parent$service$para2;
|
|
812
|
+
var _ref11, onSuccess, skipValidator, updateMode, _ref12, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
|
|
813
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
814
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
725
815
|
case 0:
|
|
726
|
-
|
|
727
|
-
|
|
816
|
+
_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;
|
|
817
|
+
_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;
|
|
728
818
|
if (skipValidator) {
|
|
729
|
-
|
|
819
|
+
_context15.next = 5;
|
|
730
820
|
break;
|
|
731
821
|
}
|
|
732
|
-
|
|
822
|
+
_context15.next = 5;
|
|
733
823
|
return form.submit();
|
|
734
824
|
case 5:
|
|
735
825
|
values = (0, _lodash.cloneDeep)(form.values);
|
|
@@ -747,22 +837,22 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
747
837
|
}
|
|
748
838
|
}
|
|
749
839
|
}
|
|
750
|
-
|
|
840
|
+
_context15.prev = 9;
|
|
751
841
|
updateData = {
|
|
752
842
|
values: values,
|
|
753
843
|
filter: filter,
|
|
754
844
|
forceUpdate: false
|
|
755
845
|
};
|
|
756
846
|
if (!(updateMode === 'selected')) {
|
|
757
|
-
|
|
847
|
+
_context15.next = 16;
|
|
758
848
|
break;
|
|
759
849
|
}
|
|
760
850
|
if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
|
|
761
|
-
|
|
851
|
+
_context15.next = 15;
|
|
762
852
|
break;
|
|
763
853
|
}
|
|
764
854
|
_antd.message.error(t('Please select the records to be updated'));
|
|
765
|
-
return
|
|
855
|
+
return _context15.abrupt("return");
|
|
766
856
|
case 15:
|
|
767
857
|
updateData.filter = {
|
|
768
858
|
$and: [_defineProperty({}, rowKey || 'id', {
|
|
@@ -773,7 +863,7 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
773
863
|
if (!updateData.filter) {
|
|
774
864
|
updateData.forceUpdate = true;
|
|
775
865
|
}
|
|
776
|
-
|
|
866
|
+
_context15.next = 19;
|
|
777
867
|
return resource.update(updateData);
|
|
778
868
|
case 19:
|
|
779
869
|
actionField.data.loading = false;
|
|
@@ -783,20 +873,20 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
783
873
|
__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);
|
|
784
874
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
785
875
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
786
|
-
|
|
876
|
+
_context15.next = 25;
|
|
787
877
|
break;
|
|
788
878
|
}
|
|
789
|
-
return
|
|
879
|
+
return _context15.abrupt("return");
|
|
790
880
|
case 25:
|
|
791
881
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
792
882
|
_antd.Modal.success({
|
|
793
883
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
794
884
|
onOk: function () {
|
|
795
|
-
var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
796
|
-
return _regeneratorRuntime().wrap(function
|
|
797
|
-
while (1) switch (
|
|
885
|
+
var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
886
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
887
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
798
888
|
case 0:
|
|
799
|
-
|
|
889
|
+
_context14.next = 2;
|
|
800
890
|
return form.reset();
|
|
801
891
|
case 2:
|
|
802
892
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
@@ -808,9 +898,9 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
808
898
|
}
|
|
809
899
|
case 3:
|
|
810
900
|
case "end":
|
|
811
|
-
return
|
|
901
|
+
return _context14.stop();
|
|
812
902
|
}
|
|
813
|
-
},
|
|
903
|
+
}, _callee14);
|
|
814
904
|
}));
|
|
815
905
|
function onOk() {
|
|
816
906
|
return _onOk4.apply(this, arguments);
|
|
@@ -822,62 +912,62 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
|
|
|
822
912
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
823
913
|
}
|
|
824
914
|
case 26:
|
|
825
|
-
|
|
915
|
+
_context15.prev = 26;
|
|
826
916
|
actionField.data.loading = false;
|
|
827
|
-
return
|
|
917
|
+
return _context15.finish(26);
|
|
828
918
|
case 29:
|
|
829
919
|
case "end":
|
|
830
|
-
return
|
|
920
|
+
return _context15.stop();
|
|
831
921
|
}
|
|
832
|
-
},
|
|
922
|
+
}, _callee15, null, [[9,, 26, 29]]);
|
|
833
923
|
}))();
|
|
834
924
|
}
|
|
835
925
|
};
|
|
836
926
|
};
|
|
837
927
|
exports.useCustomizeBulkEditActionProps = useCustomizeBulkEditActionProps;
|
|
838
928
|
var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
839
|
-
var _currentUserContext$
|
|
929
|
+
var _currentUserContext$d5;
|
|
840
930
|
var apiClient = (0, _apiClient.useAPIClient)();
|
|
841
931
|
var history = (0, _reactRouterDom.useHistory)();
|
|
842
932
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
843
933
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
844
934
|
var compile = (0, _schemaComponent.useCompile)();
|
|
845
935
|
var form = (0, _react.useForm)();
|
|
846
|
-
var
|
|
847
|
-
fields =
|
|
848
|
-
getField =
|
|
849
|
-
var
|
|
850
|
-
field =
|
|
851
|
-
resource =
|
|
852
|
-
__parent =
|
|
853
|
-
service =
|
|
936
|
+
var _useCollection4 = (0, _collectionManager.useCollection)(),
|
|
937
|
+
fields = _useCollection4.fields,
|
|
938
|
+
getField = _useCollection4.getField;
|
|
939
|
+
var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
940
|
+
field = _useBlockRequestConte6.field,
|
|
941
|
+
resource = _useBlockRequestConte6.resource,
|
|
942
|
+
__parent = _useBlockRequestConte6.__parent,
|
|
943
|
+
service = _useBlockRequestConte6.service;
|
|
854
944
|
var currentRecord = (0, _recordProvider.useRecord)();
|
|
855
945
|
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
856
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
946
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
|
|
857
947
|
var actionField = (0, _react.useField)();
|
|
858
|
-
var
|
|
859
|
-
setVisible =
|
|
948
|
+
var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
|
|
949
|
+
setVisible = _useActionContext3.setVisible;
|
|
860
950
|
return {
|
|
861
951
|
onClick: function onClick() {
|
|
862
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
863
|
-
var _actionSchema$
|
|
864
|
-
var
|
|
865
|
-
return _regeneratorRuntime().wrap(function
|
|
866
|
-
while (1) switch (
|
|
952
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
953
|
+
var _actionSchema$xActio6;
|
|
954
|
+
var _ref14, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
|
|
955
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
956
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
867
957
|
case 0:
|
|
868
|
-
|
|
958
|
+
_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;
|
|
869
959
|
xAction = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action'];
|
|
870
960
|
if (requestSettings['url']) {
|
|
871
|
-
|
|
961
|
+
_context17.next = 4;
|
|
872
962
|
break;
|
|
873
963
|
}
|
|
874
|
-
return
|
|
964
|
+
return _context17.abrupt("return");
|
|
875
965
|
case 4:
|
|
876
966
|
if (!(skipValidator !== true && xAction === 'customize:form:request')) {
|
|
877
|
-
|
|
967
|
+
_context17.next = 7;
|
|
878
968
|
break;
|
|
879
969
|
}
|
|
880
|
-
|
|
970
|
+
_context17.next = 7;
|
|
881
971
|
return form.submit();
|
|
882
972
|
case 7:
|
|
883
973
|
headers = requestSettings['headers'] ? JSON.parse(requestSettings['headers']) : {};
|
|
@@ -897,23 +987,23 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
897
987
|
currentUser: currentUser
|
|
898
988
|
}),
|
|
899
989
|
method: requestSettings['method'],
|
|
900
|
-
headers: (0,
|
|
990
|
+
headers: (0, _client.parse)(headers)({
|
|
901
991
|
currentRecord: currentRecord,
|
|
902
992
|
currentUser: currentUser
|
|
903
993
|
}),
|
|
904
|
-
params: (0,
|
|
994
|
+
params: (0, _client.parse)(params)({
|
|
905
995
|
currentRecord: currentRecord,
|
|
906
996
|
currentUser: currentUser
|
|
907
997
|
}),
|
|
908
|
-
data: (0,
|
|
998
|
+
data: (0, _client.parse)(data)({
|
|
909
999
|
currentRecord: currentRecord,
|
|
910
1000
|
currentUser: currentUser
|
|
911
1001
|
})
|
|
912
1002
|
};
|
|
913
1003
|
actionField.data = field.data || {};
|
|
914
1004
|
actionField.data.loading = true;
|
|
915
|
-
|
|
916
|
-
|
|
1005
|
+
_context17.prev = 15;
|
|
1006
|
+
_context17.next = 18;
|
|
917
1007
|
return apiClient.request(_objectSpread({}, requestBody));
|
|
918
1008
|
case 18:
|
|
919
1009
|
actionField.data.loading = false;
|
|
@@ -925,18 +1015,18 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
925
1015
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
926
1016
|
}
|
|
927
1017
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
928
|
-
|
|
1018
|
+
_context17.next = 24;
|
|
929
1019
|
break;
|
|
930
1020
|
}
|
|
931
|
-
return
|
|
1021
|
+
return _context17.abrupt("return");
|
|
932
1022
|
case 24:
|
|
933
1023
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
934
1024
|
_antd.Modal.success({
|
|
935
1025
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
936
1026
|
onOk: function () {
|
|
937
|
-
var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
938
|
-
return _regeneratorRuntime().wrap(function
|
|
939
|
-
while (1) switch (
|
|
1027
|
+
var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1028
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1029
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
940
1030
|
case 0:
|
|
941
1031
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
942
1032
|
if (isURL(onSuccess.redirectTo)) {
|
|
@@ -947,9 +1037,9 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
947
1037
|
}
|
|
948
1038
|
case 1:
|
|
949
1039
|
case "end":
|
|
950
|
-
return
|
|
1040
|
+
return _context16.stop();
|
|
951
1041
|
}
|
|
952
|
-
},
|
|
1042
|
+
}, _callee16);
|
|
953
1043
|
}));
|
|
954
1044
|
function onOk() {
|
|
955
1045
|
return _onOk5.apply(this, arguments);
|
|
@@ -961,60 +1051,60 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
961
1051
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
962
1052
|
}
|
|
963
1053
|
case 25:
|
|
964
|
-
|
|
1054
|
+
_context17.prev = 25;
|
|
965
1055
|
actionField.data.loading = false;
|
|
966
|
-
return
|
|
1056
|
+
return _context17.finish(25);
|
|
967
1057
|
case 28:
|
|
968
1058
|
case "end":
|
|
969
|
-
return
|
|
1059
|
+
return _context17.stop();
|
|
970
1060
|
}
|
|
971
|
-
},
|
|
1061
|
+
}, _callee17, null, [[15,, 25, 28]]);
|
|
972
1062
|
}))();
|
|
973
1063
|
}
|
|
974
1064
|
};
|
|
975
1065
|
};
|
|
976
1066
|
exports.useCustomizeRequestActionProps = useCustomizeRequestActionProps;
|
|
977
1067
|
var useUpdateActionProps = function useUpdateActionProps() {
|
|
978
|
-
var _currentUserContext$
|
|
1068
|
+
var _currentUserContext$d6;
|
|
979
1069
|
var form = (0, _react.useForm)();
|
|
980
1070
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
981
|
-
var
|
|
982
|
-
field =
|
|
983
|
-
resource =
|
|
984
|
-
__parent =
|
|
985
|
-
var
|
|
986
|
-
setVisible =
|
|
1071
|
+
var _useBlockRequestConte7 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1072
|
+
field = _useBlockRequestConte7.field,
|
|
1073
|
+
resource = _useBlockRequestConte7.resource,
|
|
1074
|
+
__parent = _useBlockRequestConte7.__parent;
|
|
1075
|
+
var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
|
|
1076
|
+
setVisible = _useActionContext4.setVisible;
|
|
987
1077
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
988
1078
|
var history = (0, _reactRouterDom.useHistory)();
|
|
989
|
-
var
|
|
990
|
-
fields =
|
|
991
|
-
getField =
|
|
1079
|
+
var _useCollection5 = (0, _collectionManager.useCollection)(),
|
|
1080
|
+
fields = _useCollection5.fields,
|
|
1081
|
+
getField = _useCollection5.getField;
|
|
992
1082
|
var compile = (0, _schemaComponent.useCompile)();
|
|
993
1083
|
var actionField = (0, _react.useField)();
|
|
994
1084
|
var _useFormBlockContext = (0, _2.useFormBlockContext)(),
|
|
995
1085
|
updateAssociationValues = _useFormBlockContext.updateAssociationValues;
|
|
996
1086
|
var currentRecord = (0, _recordProvider.useRecord)();
|
|
997
1087
|
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
998
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
1088
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d6 = currentUserContext.data) === null || _currentUserContext$d6 === void 0 ? void 0 : _currentUserContext$d6.data;
|
|
999
1089
|
return {
|
|
1000
1090
|
onClick: function onClick() {
|
|
1001
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1002
|
-
var _actionSchema$
|
|
1003
|
-
var
|
|
1004
|
-
return _regeneratorRuntime().wrap(function
|
|
1005
|
-
while (1) switch (
|
|
1091
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1092
|
+
var _actionSchema$xActio7;
|
|
1093
|
+
var _ref15, _ref15$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr;
|
|
1094
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1095
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1006
1096
|
case 0:
|
|
1007
|
-
|
|
1008
|
-
assignedValues = (0,
|
|
1097
|
+
_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;
|
|
1098
|
+
assignedValues = (0, _client.parse)(originalAssignedValues)({
|
|
1009
1099
|
currentTime: new Date(),
|
|
1010
1100
|
currentRecord: currentRecord,
|
|
1011
1101
|
currentUser: currentUser
|
|
1012
1102
|
});
|
|
1013
1103
|
if (skipValidator) {
|
|
1014
|
-
|
|
1104
|
+
_context19.next = 5;
|
|
1015
1105
|
break;
|
|
1016
1106
|
}
|
|
1017
|
-
|
|
1107
|
+
_context19.next = 5;
|
|
1018
1108
|
return form.submit();
|
|
1019
1109
|
case 5:
|
|
1020
1110
|
fieldNames = fields.map(function (field) {
|
|
@@ -1023,8 +1113,8 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1023
1113
|
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
1024
1114
|
actionField.data = field.data || {};
|
|
1025
1115
|
actionField.data.loading = true;
|
|
1026
|
-
|
|
1027
|
-
|
|
1116
|
+
_context19.prev = 9;
|
|
1117
|
+
_context19.next = 12;
|
|
1028
1118
|
return resource.update({
|
|
1029
1119
|
filterByTk: filterByTk,
|
|
1030
1120
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
|
|
@@ -1032,26 +1122,23 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1032
1122
|
});
|
|
1033
1123
|
case 12:
|
|
1034
1124
|
actionField.data.loading = false;
|
|
1035
|
-
if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
|
|
1036
|
-
__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);
|
|
1037
|
-
}
|
|
1038
1125
|
__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);
|
|
1039
1126
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
1040
1127
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
1041
|
-
|
|
1128
|
+
_context19.next = 17;
|
|
1042
1129
|
break;
|
|
1043
1130
|
}
|
|
1044
|
-
return
|
|
1045
|
-
case
|
|
1131
|
+
return _context19.abrupt("return");
|
|
1132
|
+
case 17:
|
|
1046
1133
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
1047
1134
|
_antd.Modal.success({
|
|
1048
1135
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
1049
1136
|
onOk: function () {
|
|
1050
|
-
var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1051
|
-
return _regeneratorRuntime().wrap(function
|
|
1052
|
-
while (1) switch (
|
|
1137
|
+
var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1138
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1139
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1053
1140
|
case 0:
|
|
1054
|
-
|
|
1141
|
+
_context18.next = 2;
|
|
1055
1142
|
return form.reset();
|
|
1056
1143
|
case 2:
|
|
1057
1144
|
if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
|
|
@@ -1063,9 +1150,9 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1063
1150
|
}
|
|
1064
1151
|
case 3:
|
|
1065
1152
|
case "end":
|
|
1066
|
-
return
|
|
1153
|
+
return _context18.stop();
|
|
1067
1154
|
}
|
|
1068
|
-
},
|
|
1155
|
+
}, _callee18);
|
|
1069
1156
|
}));
|
|
1070
1157
|
function onOk() {
|
|
1071
1158
|
return _onOk6.apply(this, arguments);
|
|
@@ -1076,17 +1163,17 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1076
1163
|
} else {
|
|
1077
1164
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
1078
1165
|
}
|
|
1079
|
-
|
|
1166
|
+
_context19.next = 23;
|
|
1080
1167
|
break;
|
|
1081
|
-
case
|
|
1082
|
-
|
|
1083
|
-
|
|
1168
|
+
case 20:
|
|
1169
|
+
_context19.prev = 20;
|
|
1170
|
+
_context19.t0 = _context19["catch"](9);
|
|
1084
1171
|
actionField.data.loading = false;
|
|
1085
|
-
case
|
|
1172
|
+
case 23:
|
|
1086
1173
|
case "end":
|
|
1087
|
-
return
|
|
1174
|
+
return _context19.stop();
|
|
1088
1175
|
}
|
|
1089
|
-
},
|
|
1176
|
+
}, _callee19, null, [[9, 20]]);
|
|
1090
1177
|
}))();
|
|
1091
1178
|
}
|
|
1092
1179
|
};
|
|
@@ -1094,27 +1181,27 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
1094
1181
|
exports.useUpdateActionProps = useUpdateActionProps;
|
|
1095
1182
|
var useDestroyActionProps = function useDestroyActionProps() {
|
|
1096
1183
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
1097
|
-
var
|
|
1098
|
-
resource =
|
|
1099
|
-
service =
|
|
1100
|
-
block =
|
|
1101
|
-
__parent =
|
|
1102
|
-
var
|
|
1103
|
-
setVisible =
|
|
1184
|
+
var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1185
|
+
resource = _useBlockRequestConte8.resource,
|
|
1186
|
+
service = _useBlockRequestConte8.service,
|
|
1187
|
+
block = _useBlockRequestConte8.block,
|
|
1188
|
+
__parent = _useBlockRequestConte8.__parent;
|
|
1189
|
+
var _useActionContext5 = (0, _schemaComponent.useActionContext)(),
|
|
1190
|
+
setVisible = _useActionContext5.setVisible;
|
|
1104
1191
|
return {
|
|
1105
1192
|
onClick: function onClick() {
|
|
1106
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1193
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1107
1194
|
var _service$data;
|
|
1108
|
-
var
|
|
1109
|
-
return _regeneratorRuntime().wrap(function
|
|
1110
|
-
while (1) switch (
|
|
1195
|
+
var _ref16, _ref16$count, count, _ref16$page, page, _ref16$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
|
|
1196
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1197
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1111
1198
|
case 0:
|
|
1112
|
-
|
|
1199
|
+
_context20.next = 2;
|
|
1113
1200
|
return resource.destroy({
|
|
1114
1201
|
filterByTk: filterByTk
|
|
1115
1202
|
});
|
|
1116
1203
|
case 2:
|
|
1117
|
-
|
|
1204
|
+
_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;
|
|
1118
1205
|
if (count % pageSize === 1) {
|
|
1119
1206
|
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]), {}, {
|
|
1120
1207
|
page: page - 1
|
|
@@ -1128,14 +1215,38 @@ var useDestroyActionProps = function useDestroyActionProps() {
|
|
|
1128
1215
|
}
|
|
1129
1216
|
case 5:
|
|
1130
1217
|
case "end":
|
|
1131
|
-
return
|
|
1218
|
+
return _context20.stop();
|
|
1132
1219
|
}
|
|
1133
|
-
},
|
|
1220
|
+
}, _callee20);
|
|
1134
1221
|
}))();
|
|
1135
1222
|
}
|
|
1136
1223
|
};
|
|
1137
1224
|
};
|
|
1138
1225
|
exports.useDestroyActionProps = useDestroyActionProps;
|
|
1226
|
+
var useRemoveActionProps = function useRemoveActionProps(associationName) {
|
|
1227
|
+
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
1228
|
+
var api = (0, _apiClient.useAPIClient)();
|
|
1229
|
+
var resource = api.resource(associationName, filterByTk);
|
|
1230
|
+
return {
|
|
1231
|
+
onClick: function onClick(value) {
|
|
1232
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1233
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1234
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1235
|
+
case 0:
|
|
1236
|
+
_context21.next = 2;
|
|
1237
|
+
return resource.remove({
|
|
1238
|
+
values: [value.id]
|
|
1239
|
+
});
|
|
1240
|
+
case 2:
|
|
1241
|
+
case "end":
|
|
1242
|
+
return _context21.stop();
|
|
1243
|
+
}
|
|
1244
|
+
}, _callee21);
|
|
1245
|
+
}))();
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
exports.useRemoveActionProps = useRemoveActionProps;
|
|
1139
1250
|
var useDetailPrintActionProps = function useDetailPrintActionProps() {
|
|
1140
1251
|
var _useFormBlockContext2 = (0, _2.useFormBlockContext)(),
|
|
1141
1252
|
formBlockRef = _useFormBlockContext2.formBlockRef;
|
|
@@ -1147,41 +1258,41 @@ var useDetailPrintActionProps = function useDetailPrintActionProps() {
|
|
|
1147
1258
|
});
|
|
1148
1259
|
return {
|
|
1149
1260
|
onClick: function onClick() {
|
|
1150
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1151
|
-
return _regeneratorRuntime().wrap(function
|
|
1152
|
-
while (1) switch (
|
|
1261
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1262
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1263
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1153
1264
|
case 0:
|
|
1154
1265
|
printHandler();
|
|
1155
1266
|
case 1:
|
|
1156
1267
|
case "end":
|
|
1157
|
-
return
|
|
1268
|
+
return _context22.stop();
|
|
1158
1269
|
}
|
|
1159
|
-
},
|
|
1270
|
+
}, _callee22);
|
|
1160
1271
|
}))();
|
|
1161
1272
|
}
|
|
1162
1273
|
};
|
|
1163
1274
|
};
|
|
1164
1275
|
exports.useDetailPrintActionProps = useDetailPrintActionProps;
|
|
1165
1276
|
var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
1166
|
-
var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1167
|
-
field = _useBlockRequestConte8.field;
|
|
1168
1277
|
var _useBlockRequestConte9 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1169
|
-
|
|
1170
|
-
|
|
1278
|
+
field = _useBlockRequestConte9.field;
|
|
1279
|
+
var _useBlockRequestConte10 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1280
|
+
resource = _useBlockRequestConte10.resource,
|
|
1281
|
+
service = _useBlockRequestConte10.service;
|
|
1171
1282
|
return {
|
|
1172
1283
|
onClick: function onClick() {
|
|
1173
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1284
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1174
1285
|
var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
|
|
1175
|
-
return _regeneratorRuntime().wrap(function
|
|
1176
|
-
while (1) switch (
|
|
1286
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1287
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1177
1288
|
case 0:
|
|
1178
1289
|
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) {
|
|
1179
|
-
|
|
1290
|
+
_context23.next = 2;
|
|
1180
1291
|
break;
|
|
1181
1292
|
}
|
|
1182
|
-
return
|
|
1293
|
+
return _context23.abrupt("return");
|
|
1183
1294
|
case 2:
|
|
1184
|
-
|
|
1295
|
+
_context23.next = 4;
|
|
1185
1296
|
return resource.destroy({
|
|
1186
1297
|
filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
|
|
1187
1298
|
});
|
|
@@ -1190,30 +1301,30 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
1190
1301
|
service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
|
|
1191
1302
|
case 6:
|
|
1192
1303
|
case "end":
|
|
1193
|
-
return
|
|
1304
|
+
return _context23.stop();
|
|
1194
1305
|
}
|
|
1195
|
-
},
|
|
1306
|
+
}, _callee23);
|
|
1196
1307
|
}))();
|
|
1197
1308
|
}
|
|
1198
1309
|
};
|
|
1199
1310
|
};
|
|
1200
1311
|
exports.useBulkDestroyActionProps = useBulkDestroyActionProps;
|
|
1201
1312
|
var useRefreshActionProps = function useRefreshActionProps() {
|
|
1202
|
-
var
|
|
1203
|
-
service =
|
|
1313
|
+
var _useBlockRequestConte11 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1314
|
+
service = _useBlockRequestConte11.service;
|
|
1204
1315
|
return {
|
|
1205
1316
|
onClick: function onClick() {
|
|
1206
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1317
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1207
1318
|
var _service$refresh6;
|
|
1208
|
-
return _regeneratorRuntime().wrap(function
|
|
1209
|
-
while (1) switch (
|
|
1319
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1320
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1210
1321
|
case 0:
|
|
1211
1322
|
service === null || service === void 0 ? void 0 : (_service$refresh6 = service.refresh) === null || _service$refresh6 === void 0 ? void 0 : _service$refresh6.call(service);
|
|
1212
1323
|
case 1:
|
|
1213
1324
|
case "end":
|
|
1214
|
-
return
|
|
1325
|
+
return _context24.stop();
|
|
1215
1326
|
}
|
|
1216
|
-
},
|
|
1327
|
+
}, _callee24);
|
|
1217
1328
|
}))();
|
|
1218
1329
|
}
|
|
1219
1330
|
};
|
|
@@ -1230,11 +1341,11 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1230
1341
|
total: count,
|
|
1231
1342
|
pageSize: 1,
|
|
1232
1343
|
onChange: function onChange(page) {
|
|
1233
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1344
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1234
1345
|
var _ctx$service3, _ctx$service3$params;
|
|
1235
1346
|
var params;
|
|
1236
|
-
return _regeneratorRuntime().wrap(function
|
|
1237
|
-
while (1) switch (
|
|
1347
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1348
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1238
1349
|
case 0:
|
|
1239
1350
|
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];
|
|
1240
1351
|
ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -1242,9 +1353,9 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1242
1353
|
}));
|
|
1243
1354
|
case 2:
|
|
1244
1355
|
case "end":
|
|
1245
|
-
return
|
|
1356
|
+
return _context25.stop();
|
|
1246
1357
|
}
|
|
1247
|
-
},
|
|
1358
|
+
}, _callee25);
|
|
1248
1359
|
}))();
|
|
1249
1360
|
},
|
|
1250
1361
|
style: {
|
|
@@ -1255,14 +1366,14 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
1255
1366
|
};
|
|
1256
1367
|
exports.useDetailsPaginationProps = useDetailsPaginationProps;
|
|
1257
1368
|
var useAssociationFilterProps = function useAssociationFilterProps() {
|
|
1258
|
-
var _fieldSchema$
|
|
1369
|
+
var _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps, _field$componentProps2;
|
|
1259
1370
|
var collectionField = _2.AssociationFilter.useAssociationField();
|
|
1260
|
-
var
|
|
1261
|
-
service =
|
|
1262
|
-
blockProps =
|
|
1371
|
+
var _useBlockRequestConte12 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
1372
|
+
service = _useBlockRequestConte12.service,
|
|
1373
|
+
blockProps = _useBlockRequestConte12.props;
|
|
1263
1374
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1264
1375
|
var valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
|
|
1265
|
-
var labelKey = ((_fieldSchema$
|
|
1376
|
+
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;
|
|
1266
1377
|
var field = (0, _react.useField)();
|
|
1267
1378
|
var collectionFieldName = collectionField.name;
|
|
1268
1379
|
var _useRequest = (0, _apiClient.useRequest)({
|
|
@@ -1313,9 +1424,9 @@ var useAssociationFilterProps = function useAssociationFilterProps() {
|
|
|
1313
1424
|
};
|
|
1314
1425
|
exports.useAssociationFilterProps = useAssociationFilterProps;
|
|
1315
1426
|
var useOptionalFieldList = function useOptionalFieldList() {
|
|
1316
|
-
var
|
|
1317
|
-
|
|
1318
|
-
currentFields =
|
|
1427
|
+
var _useCollection6 = (0, _collectionManager.useCollection)(),
|
|
1428
|
+
_useCollection6$curre = _useCollection6.currentFields,
|
|
1429
|
+
currentFields = _useCollection6$curre === void 0 ? [] : _useCollection6$curre;
|
|
1319
1430
|
return currentFields.filter(function (field) {
|
|
1320
1431
|
return isOptionalField(field) && field.uiSchema.enum;
|
|
1321
1432
|
});
|
|
@@ -1326,7 +1437,7 @@ var isOptionalField = function isOptionalField(field) {
|
|
|
1326
1437
|
return optionalInterfaces.includes(field.interface);
|
|
1327
1438
|
};
|
|
1328
1439
|
var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
|
|
1329
|
-
var _fieldSchema$
|
|
1440
|
+
var _fieldSchema$xCompon5, _fieldSchema$xCompon6, _field$componentProps3, _field$componentProps4;
|
|
1330
1441
|
var collectionField = _2.AssociationFilter.useAssociationField();
|
|
1331
1442
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1332
1443
|
var optionalFieldList = useOptionalFieldList();
|
|
@@ -1336,7 +1447,7 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
|
|
|
1336
1447
|
var field = (0, _react.useField)();
|
|
1337
1448
|
var list, onSelected, handleSearchInput, params, run, data, valueKey, labelKey, filterKey;
|
|
1338
1449
|
valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
|
|
1339
|
-
labelKey = ((_fieldSchema$
|
|
1450
|
+
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;
|
|
1340
1451
|
var _useRequest2 = (0, _apiClient.useRequest)({
|
|
1341
1452
|
resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
|
|
1342
1453
|
action: 'list',
|
|
@@ -1438,4 +1549,134 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
|
|
|
1438
1549
|
labelKey: labelKey
|
|
1439
1550
|
};
|
|
1440
1551
|
};
|
|
1441
|
-
exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
|
|
1552
|
+
exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
|
|
1553
|
+
var getTemplateSchema = function getTemplateSchema(schema) {
|
|
1554
|
+
var conf = {
|
|
1555
|
+
url: "/uiSchemas:getJsonSchema/".concat(schema === null || schema === void 0 ? void 0 : schema.uid)
|
|
1556
|
+
};
|
|
1557
|
+
var _useRequest3 = (0, _apiClient.useRequest)(conf, {
|
|
1558
|
+
manual: true
|
|
1559
|
+
}),
|
|
1560
|
+
data = _useRequest3.data,
|
|
1561
|
+
loading = _useRequest3.loading,
|
|
1562
|
+
run = _useRequest3.run;
|
|
1563
|
+
if (loading) {}
|
|
1564
|
+
(0, _react2.useEffect)(function () {
|
|
1565
|
+
if (schema === null || schema === void 0 ? void 0 : schema.uid) {
|
|
1566
|
+
run();
|
|
1567
|
+
}
|
|
1568
|
+
}, [schema === null || schema === void 0 ? void 0 : schema.uid]);
|
|
1569
|
+
return (schema === null || schema === void 0 ? void 0 : schema.uid) ? new _react.Schema(data === null || data === void 0 ? void 0 : data.data) : null;
|
|
1570
|
+
};
|
|
1571
|
+
var useAssociationNames = function useAssociationNames(collection) {
|
|
1572
|
+
var _templateSchema$xCom;
|
|
1573
|
+
var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
|
|
1574
|
+
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField;
|
|
1575
|
+
var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
1576
|
+
getTemplateById = _useSchemaTemplateMan.getTemplateById;
|
|
1577
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1578
|
+
var associationValues = [];
|
|
1579
|
+
var formSchema = fieldSchema.reduceProperties(function (buf, schema) {
|
|
1580
|
+
if (['FormV2', 'Details', 'List', 'GridCard'].includes(schema['x-component'])) {
|
|
1581
|
+
return schema;
|
|
1582
|
+
}
|
|
1583
|
+
return buf;
|
|
1584
|
+
}, new _react.Schema({}));
|
|
1585
|
+
var templateSchema = formSchema.reduceProperties(function (buf, schema) {
|
|
1586
|
+
if (schema['x-component'] === 'BlockTemplate') {
|
|
1587
|
+
return schema;
|
|
1588
|
+
}
|
|
1589
|
+
return buf;
|
|
1590
|
+
}, null);
|
|
1591
|
+
var getAssociationAppends = function getAssociationAppends(schema) {
|
|
1592
|
+
var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1593
|
+
var data = schema.reduceProperties(function (buf, s) {
|
|
1594
|
+
var collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
|
|
1595
|
+
if (collectionfield && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(collectionfield.type) && s['x-component'] !== 'TableField') {
|
|
1596
|
+
var _s$xComponentProps;
|
|
1597
|
+
buf.push(s.name);
|
|
1598
|
+
if (['Nester', 'SubTable'].includes((_s$xComponentProps = s['x-component-props']) === null || _s$xComponentProps === void 0 ? void 0 : _s$xComponentProps.mode)) {
|
|
1599
|
+
associationValues.push(s.name);
|
|
1600
|
+
}
|
|
1601
|
+
if (s['x-component-props'].mode === 'Nester') {
|
|
1602
|
+
return getAssociationAppends(s, buf);
|
|
1603
|
+
}
|
|
1604
|
+
return buf;
|
|
1605
|
+
} else {
|
|
1606
|
+
if (s['x-component'] === 'Grid.Row') {
|
|
1607
|
+
var _buf$concat;
|
|
1608
|
+
var kk = buf === null || buf === void 0 ? void 0 : (_buf$concat = buf.concat) === null || _buf$concat === void 0 ? void 0 : _buf$concat.call(buf);
|
|
1609
|
+
return getNesterAppends(s, kk || []);
|
|
1610
|
+
} else {
|
|
1611
|
+
var _s$xComponent;
|
|
1612
|
+
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;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}, arr);
|
|
1616
|
+
return data || [];
|
|
1617
|
+
};
|
|
1618
|
+
function flattenNestedList(nestedList) {
|
|
1619
|
+
var flattenedList = [];
|
|
1620
|
+
function flattenHelper(list, prefix) {
|
|
1621
|
+
for (var i = 0; i < list.length; i++) {
|
|
1622
|
+
if (Array.isArray(list[i])) {
|
|
1623
|
+
"".concat(prefix) !== "".concat(list[i][0]) && flattenHelper(list[i], "".concat(prefix, ".").concat(list[i][0]));
|
|
1624
|
+
} else {
|
|
1625
|
+
var searchTerm = ".".concat(list[i]);
|
|
1626
|
+
var lastIndex = prefix.lastIndexOf(searchTerm);
|
|
1627
|
+
var str = '';
|
|
1628
|
+
if (lastIndex !== -1) {
|
|
1629
|
+
str = prefix.slice(0, lastIndex) + prefix.slice(lastIndex + searchTerm.length);
|
|
1630
|
+
}
|
|
1631
|
+
if (!str) {
|
|
1632
|
+
!list.includes(str) && flattenedList.push("".concat(list[i]));
|
|
1633
|
+
} else {
|
|
1634
|
+
!list.includes(str) ? flattenedList.push("".concat(str, ".").concat(list[i])) : flattenedList.push(str);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
for (var i = 0; i < nestedList.length; i++) {
|
|
1640
|
+
flattenHelper(nestedList[i], nestedList[i][0]);
|
|
1641
|
+
}
|
|
1642
|
+
return (0, _lodash.uniq)(flattenedList.filter(function (obj) {
|
|
1643
|
+
return !(obj === null || obj === void 0 ? void 0 : obj.startsWith('.'));
|
|
1644
|
+
}));
|
|
1645
|
+
}
|
|
1646
|
+
var getNesterAppends = function getNesterAppends(gridSchema, data) {
|
|
1647
|
+
gridSchema.reduceProperties(function (buf, s) {
|
|
1648
|
+
buf.push(getAssociationAppends(s));
|
|
1649
|
+
return buf;
|
|
1650
|
+
}, data);
|
|
1651
|
+
return data.filter(function (g) {
|
|
1652
|
+
return g.length;
|
|
1653
|
+
});
|
|
1654
|
+
};
|
|
1655
|
+
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);
|
|
1656
|
+
var schema = getTemplateSchema(template);
|
|
1657
|
+
if (schema) {
|
|
1658
|
+
var associations = getAssociationAppends(schema);
|
|
1659
|
+
var appends = flattenNestedList(associations);
|
|
1660
|
+
return {
|
|
1661
|
+
appends: appends,
|
|
1662
|
+
updateAssociationValues: appends.filter(function (item) {
|
|
1663
|
+
return associationValues.some(function (suffix) {
|
|
1664
|
+
return item.endsWith(suffix);
|
|
1665
|
+
});
|
|
1666
|
+
})
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
if (!schema) {
|
|
1670
|
+
var _associations = getAssociationAppends(formSchema);
|
|
1671
|
+
var _appends = flattenNestedList(_associations);
|
|
1672
|
+
return {
|
|
1673
|
+
appends: _appends,
|
|
1674
|
+
updateAssociationValues: _appends.filter(function (item) {
|
|
1675
|
+
return associationValues.some(function (suffix) {
|
|
1676
|
+
return item.endsWith(suffix);
|
|
1677
|
+
});
|
|
1678
|
+
})
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
exports.useAssociationNames = useAssociationNames;
|