@nocobase/client 0.9.3-alpha.1 → 0.9.4-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/hooks/index.js +81 -60
- 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 +1 -3
- package/es/collection-manager/Configuration/ConfigurationTabs.js +7 -6
- package/es/collection-manager/hooks/useCollection.d.ts +1 -1
- package/es/collection-manager/hooks/useCollectionDataSource.js +4 -4
- package/es/collection-manager/interfaces/m2m.js +1 -1
- package/es/collection-manager/interfaces/m2o.js +1 -1
- package/es/collection-manager/interfaces/o2m.js +1 -1
- package/es/collection-manager/interfaces/o2o.js +2 -2
- package/es/collection-manager/templates/expression.js +1 -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 +16 -1
- package/es/locale/en_US.js +17 -2
- package/es/locale/es_ES.d.ts +692 -0
- package/es/locale/es_ES.js +691 -0
- package/es/locale/ja_JP.d.ts +5 -1
- package/es/locale/ja_JP.js +6 -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 +25 -2
- package/es/locale/zh_CN.js +26 -3
- package/es/pm/PluginManagerLink.js +22 -14
- 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 +6 -3
- package/es/schema-component/antd/action/Action.Drawer.js +5 -2
- package/es/schema-component/antd/action/Action.js +2 -2
- package/es/schema-component/antd/action/ActionBar.js +25 -18
- package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -2
- package/es/schema-component/antd/association-field/AssociationFieldProvider.js +62 -9
- package/es/schema-component/antd/association-field/AssociationSelect.js +10 -65
- package/es/schema-component/antd/association-field/Editable.d.ts +1 -1
- package/es/schema-component/antd/association-field/Editable.js +32 -40
- package/es/schema-component/antd/association-field/InternalNester.js +4 -3
- package/es/schema-component/antd/association-field/InternalPicker.js +29 -60
- package/es/schema-component/antd/association-field/InternalViewer.js +9 -12
- package/es/schema-component/antd/association-field/Nester.js +19 -21
- package/es/schema-component/antd/association-field/ReadPretty.d.ts +1 -1
- package/es/schema-component/antd/association-field/ReadPretty.js +9 -25
- 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 +5 -2
- package/es/schema-component/antd/association-field/context.js +1 -1
- package/es/schema-component/antd/association-field/hooks.d.ts +3 -0
- package/es/schema-component/antd/association-field/hooks.js +10 -10
- 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/filter/FilterAction.js +2 -2
- package/es/schema-component/antd/form/Form.js +4 -4
- package/es/schema-component/antd/form-item/FormItem.js +126 -145
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +3 -3
- 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 +42 -12
- 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/icon-picker/IconPicker.js +2 -2
- package/es/schema-component/antd/index.d.ts +2 -0
- package/es/schema-component/antd/index.js +2 -0
- package/es/schema-component/antd/input/EllipsisWithTooltip.js +2 -2
- 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/remote-select/RemoteSelect.js +12 -10
- package/es/schema-component/antd/select/Select.js +15 -4
- package/es/schema-component/antd/table/Table.Void.Designer.js +1 -0
- 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/variable/Input.js +6 -3
- package/es/schema-component/common/dnd-context/index.js +2 -2
- package/es/schema-component/common/sortable-item/SortableItem.js +3 -4
- package/es/schema-component/core/SchemaComponentProvider.js +2 -2
- 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 +1 -0
- package/es/schema-initializer/components/CreateRecordAction.js +51 -30
- 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/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/index.d.ts +3 -1
- package/es/schema-initializer/items/index.js +4 -2
- package/es/schema-initializer/utils.d.ts +112 -0
- package/es/schema-initializer/utils.js +206 -32
- 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/AsDefaultTemplate.js +1 -1
- package/es/schema-settings/DataTemplates/components/DataTemplateTitle.js +9 -13
- 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/SchemaSettings.d.ts +1 -1
- package/es/schema-settings/SchemaSettings.js +54 -30
- 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/settings-form/SettingsForm.js +2 -2
- package/es/user/CurrentUser.js +120 -12
- 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/hooks/index.js +80 -59
- 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 +1 -3
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +7 -6
- package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
- package/lib/collection-manager/hooks/useCollectionDataSource.js +4 -4
- package/lib/collection-manager/interfaces/m2m.js +1 -1
- package/lib/collection-manager/interfaces/m2o.js +1 -1
- package/lib/collection-manager/interfaces/o2m.js +1 -1
- package/lib/collection-manager/interfaces/o2o.js +2 -2
- package/lib/collection-manager/templates/expression.js +1 -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 +16 -1
- package/lib/locale/en_US.js +17 -2
- package/lib/locale/es_ES.d.ts +692 -0
- package/lib/locale/es_ES.js +698 -0
- package/lib/locale/ja_JP.d.ts +5 -1
- package/lib/locale/ja_JP.js +6 -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 +25 -2
- package/lib/locale/zh_CN.js +26 -3
- package/lib/pm/PluginManagerLink.js +21 -13
- 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 +6 -3
- package/lib/schema-component/antd/action/Action.Drawer.js +5 -2
- package/lib/schema-component/antd/action/Action.js +2 -2
- package/lib/schema-component/antd/action/ActionBar.js +23 -16
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -2
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +62 -8
- package/lib/schema-component/antd/association-field/AssociationSelect.js +9 -66
- package/lib/schema-component/antd/association-field/Editable.d.ts +1 -1
- package/lib/schema-component/antd/association-field/Editable.js +33 -42
- package/lib/schema-component/antd/association-field/InternalNester.js +2 -2
- package/lib/schema-component/antd/association-field/InternalPicker.js +25 -56
- package/lib/schema-component/antd/association-field/InternalViewer.js +7 -10
- package/lib/schema-component/antd/association-field/Nester.js +19 -21
- package/lib/schema-component/antd/association-field/ReadPretty.d.ts +1 -1
- package/lib/schema-component/antd/association-field/ReadPretty.js +10 -27
- 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 +5 -2
- package/lib/schema-component/antd/association-field/context.js +1 -1
- package/lib/schema-component/antd/association-field/hooks.d.ts +3 -0
- package/lib/schema-component/antd/association-field/hooks.js +10 -10
- 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/filter/FilterAction.js +2 -2
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.js +122 -141
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +3 -3
- 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 +41 -11
- 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/icon-picker/IconPicker.js +2 -2
- package/lib/schema-component/antd/index.d.ts +2 -0
- package/lib/schema-component/antd/index.js +22 -0
- package/lib/schema-component/antd/input/EllipsisWithTooltip.js +2 -2
- 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/remote-select/RemoteSelect.js +11 -9
- package/lib/schema-component/antd/select/Select.js +14 -3
- package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -0
- 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/variable/Input.js +6 -3
- package/lib/schema-component/common/dnd-context/index.js +2 -2
- package/lib/schema-component/common/sortable-item/SortableItem.js +3 -4
- package/lib/schema-component/core/SchemaComponentProvider.js +2 -2
- 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 +1 -0
- package/lib/schema-initializer/components/CreateRecordAction.js +54 -32
- 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/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/index.d.ts +3 -1
- package/lib/schema-initializer/items/index.js +33 -11
- package/lib/schema-initializer/utils.d.ts +112 -0
- package/lib/schema-initializer/utils.js +209 -33
- 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/AsDefaultTemplate.js +1 -1
- package/lib/schema-settings/DataTemplates/components/DataTemplateTitle.js +10 -14
- 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/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/settings-form/SettingsForm.js +2 -2
- package/lib/user/CurrentUser.js +118 -10
- package/package.json +5 -5
- package/tsconfig.json +8 -0
|
@@ -14,7 +14,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
14
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
15
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
16
|
import { useFieldSchema } from '@formily/react';
|
|
17
|
-
import { forEach } from '@nocobase/utils/client';
|
|
17
|
+
import { error, forEach } from '@nocobase/utils/client';
|
|
18
18
|
import { Select } from 'antd';
|
|
19
19
|
import _ from 'lodash';
|
|
20
20
|
import React, { useCallback, useEffect } from 'react';
|
|
@@ -31,6 +31,24 @@ var useDataTemplates = function useDataTemplates() {
|
|
|
31
31
|
items = _findDataTemplates$it === void 0 ? [] : _findDataTemplates$it,
|
|
32
32
|
_findDataTemplates$di = _findDataTemplates.display,
|
|
33
33
|
display = _findDataTemplates$di === void 0 ? true : _findDataTemplates$di;
|
|
34
|
+
var _useCollectionManager = useCollectionManager(),
|
|
35
|
+
getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
|
|
36
|
+
// 过滤掉已经被删除的字段
|
|
37
|
+
items.forEach(function (item) {
|
|
38
|
+
try {
|
|
39
|
+
var _item$fields;
|
|
40
|
+
item.fields = (_item$fields = item.fields) === null || _item$fields === void 0 ? void 0 : _item$fields.map(function (field) {
|
|
41
|
+
var joinField = getCollectionJoinField("".concat(item.collection, ".").concat(field));
|
|
42
|
+
if (joinField) {
|
|
43
|
+
return field;
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
}).filter(Boolean);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
error(err);
|
|
49
|
+
item.fields = [];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
34
52
|
var templates = [{
|
|
35
53
|
key: 'none',
|
|
36
54
|
title: t('None')
|
|
@@ -46,7 +64,9 @@ var useDataTemplates = function useDataTemplates() {
|
|
|
46
64
|
templates: templates,
|
|
47
65
|
display: display,
|
|
48
66
|
defaultTemplate: defaultTemplate,
|
|
49
|
-
enabled: items.length > 0
|
|
67
|
+
enabled: items.length > 0 && items.every(function (item) {
|
|
68
|
+
return item.dataId !== undefined;
|
|
69
|
+
})
|
|
50
70
|
};
|
|
51
71
|
};
|
|
52
72
|
export var Templates = function Templates(_ref) {
|
|
@@ -58,8 +78,6 @@ export var Templates = function Templates(_ref) {
|
|
|
58
78
|
display = _useDataTemplates.display,
|
|
59
79
|
enabled = _useDataTemplates.enabled,
|
|
60
80
|
defaultTemplate = _useDataTemplates.defaultTemplate;
|
|
61
|
-
var _useCollectionManager = useCollectionManager(),
|
|
62
|
-
getCollectionField = _useCollectionManager.getCollectionField;
|
|
63
81
|
var _React$useState = React.useState((defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.key) || 'none'),
|
|
64
82
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
65
83
|
value = _React$useState2[0],
|
|
@@ -68,15 +86,16 @@ export var Templates = function Templates(_ref) {
|
|
|
68
86
|
var _useTranslation2 = useTranslation(),
|
|
69
87
|
t = _useTranslation2.t;
|
|
70
88
|
useEffect(function () {
|
|
71
|
-
if (defaultTemplate) {
|
|
72
|
-
fetchTemplateData(api, defaultTemplate).then(function (data) {
|
|
73
|
-
if (form) {
|
|
89
|
+
if (enabled && defaultTemplate) {
|
|
90
|
+
fetchTemplateData(api, defaultTemplate, t).then(function (data) {
|
|
91
|
+
if (form && data) {
|
|
74
92
|
forEach(data, function (value, key) {
|
|
75
93
|
if (value) {
|
|
76
94
|
form.values[key] = value;
|
|
77
95
|
}
|
|
78
96
|
});
|
|
79
97
|
}
|
|
98
|
+
return data;
|
|
80
99
|
}).catch(function (err) {
|
|
81
100
|
console.error(err);
|
|
82
101
|
});
|
|
@@ -89,14 +108,19 @@ export var Templates = function Templates(_ref) {
|
|
|
89
108
|
case 0:
|
|
90
109
|
setValue(value);
|
|
91
110
|
if (option.key !== 'none') {
|
|
92
|
-
fetchTemplateData(api, option).then(function (data) {
|
|
93
|
-
if (form) {
|
|
111
|
+
fetchTemplateData(api, option, t).then(function (data) {
|
|
112
|
+
if (form && data) {
|
|
113
|
+
// 切换之前先把之前的数据清空
|
|
114
|
+
form.reset();
|
|
94
115
|
forEach(data, function (value, key) {
|
|
95
116
|
if (value) {
|
|
96
117
|
form.values[key] = value;
|
|
97
118
|
}
|
|
98
119
|
});
|
|
99
120
|
}
|
|
121
|
+
return data;
|
|
122
|
+
}).catch(function (err) {
|
|
123
|
+
console.error(err);
|
|
100
124
|
});
|
|
101
125
|
} else {
|
|
102
126
|
form === null || form === void 0 ? void 0 : form.reset();
|
|
@@ -148,14 +172,20 @@ function findDataTemplates(fieldSchema) {
|
|
|
148
172
|
}
|
|
149
173
|
return {};
|
|
150
174
|
}
|
|
151
|
-
function fetchTemplateData(_x4, _x5) {
|
|
175
|
+
function fetchTemplateData(_x4, _x5, _x6) {
|
|
152
176
|
return _fetchTemplateData.apply(this, arguments);
|
|
153
177
|
}
|
|
154
178
|
function _fetchTemplateData() {
|
|
155
|
-
_fetchTemplateData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api, template) {
|
|
179
|
+
_fetchTemplateData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api, template, t) {
|
|
156
180
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
157
181
|
while (1) switch (_context2.prev = _context2.next) {
|
|
158
182
|
case 0:
|
|
183
|
+
if (!(template.fields.length === 0)) {
|
|
184
|
+
_context2.next = 2;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
return _context2.abrupt("return");
|
|
188
|
+
case 2:
|
|
159
189
|
return _context2.abrupt("return", api.resource(template.collection).get({
|
|
160
190
|
filterByTk: template.dataId,
|
|
161
191
|
fields: template.fields,
|
|
@@ -164,7 +194,7 @@ function _fetchTemplateData() {
|
|
|
164
194
|
var _data$data;
|
|
165
195
|
return (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.data;
|
|
166
196
|
}));
|
|
167
|
-
case
|
|
197
|
+
case 3:
|
|
168
198
|
case "end":
|
|
169
199
|
return _context2.stop();
|
|
170
200
|
}
|
|
@@ -17,7 +17,7 @@ import { css } from '@emotion/css';
|
|
|
17
17
|
import { observer, RecursionField, Schema, useField, useFieldSchema } from '@formily/react';
|
|
18
18
|
import { uid } from '@formily/shared';
|
|
19
19
|
import cls from 'classnames';
|
|
20
|
-
import React, { createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
20
|
+
import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import { useDesignable, useFormBlockContext, useSchemaInitializer } from '../../../';
|
|
22
22
|
import { DndContext } from '../../common/dnd-context';
|
|
23
23
|
var GridRowContext = /*#__PURE__*/createContext({});
|
|
@@ -233,21 +233,25 @@ var wrapColSchema = function wrapColSchema(schema) {
|
|
|
233
233
|
};
|
|
234
234
|
var useRowProperties = function useRowProperties() {
|
|
235
235
|
var fieldSchema = useFieldSchema();
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
return useMemo(function () {
|
|
237
|
+
return fieldSchema.reduceProperties(function (buf, s) {
|
|
238
|
+
if (s['x-component'] === 'Grid.Row' && !s['x-hidden']) {
|
|
239
|
+
buf.push(s);
|
|
240
|
+
}
|
|
241
|
+
return buf;
|
|
242
|
+
}, []);
|
|
243
|
+
}, [Object.keys(fieldSchema.properties || {}).join(',')]);
|
|
242
244
|
};
|
|
243
245
|
var useColProperties = function useColProperties() {
|
|
244
246
|
var fieldSchema = useFieldSchema();
|
|
245
|
-
return
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
return useMemo(function () {
|
|
248
|
+
return fieldSchema.reduceProperties(function (buf, s) {
|
|
249
|
+
if (s['x-component'] === 'Grid.Col' && !s['x-hidden']) {
|
|
250
|
+
buf.push(s);
|
|
251
|
+
}
|
|
252
|
+
return buf;
|
|
253
|
+
}, []);
|
|
254
|
+
}, [Object.keys(fieldSchema.properties || {}).join(',')]);
|
|
251
255
|
};
|
|
252
256
|
var DndWrapper = function DndWrapper(props) {
|
|
253
257
|
if (props.dndContext === false) {
|
|
@@ -266,7 +270,8 @@ export var Grid = observer(function (props) {
|
|
|
266
270
|
var field = useField();
|
|
267
271
|
var fieldSchema = useFieldSchema();
|
|
268
272
|
var _useSchemaInitializer = useSchemaInitializer(fieldSchema['x-initializer']),
|
|
269
|
-
render = _useSchemaInitializer.render
|
|
273
|
+
render = _useSchemaInitializer.render,
|
|
274
|
+
InitializerComponent = _useSchemaInitializer.InitializerComponent;
|
|
270
275
|
var addr = field.address.toString();
|
|
271
276
|
var rows = useRowProperties();
|
|
272
277
|
var _useFormBlockContext = useFormBlockContext(),
|
|
@@ -278,7 +283,8 @@ export var Grid = observer(function (props) {
|
|
|
278
283
|
value: {
|
|
279
284
|
ref: gridRef,
|
|
280
285
|
fieldSchema: fieldSchema,
|
|
281
|
-
renderSchemaInitializer: render
|
|
286
|
+
renderSchemaInitializer: render,
|
|
287
|
+
InitializerComponent: InitializerComponent
|
|
282
288
|
}
|
|
283
289
|
}, /*#__PURE__*/React.createElement("div", {
|
|
284
290
|
className: 'nb-grid',
|
|
@@ -300,7 +306,7 @@ export var Grid = observer(function (props) {
|
|
|
300
306
|
}
|
|
301
307
|
}), rows.map(function (schema, index) {
|
|
302
308
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
303
|
-
key:
|
|
309
|
+
key: index
|
|
304
310
|
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
305
311
|
name: schema.name,
|
|
306
312
|
schema: schema
|
|
@@ -315,7 +321,7 @@ export var Grid = observer(function (props) {
|
|
|
315
321
|
schema: schema
|
|
316
322
|
}
|
|
317
323
|
}));
|
|
318
|
-
})),
|
|
324
|
+
})), /*#__PURE__*/React.createElement(InitializerComponent, null)));
|
|
319
325
|
});
|
|
320
326
|
Grid.Row = observer(function () {
|
|
321
327
|
var field = useField();
|
|
@@ -341,7 +347,7 @@ Grid.Row = observer(function () {
|
|
|
341
347
|
}
|
|
342
348
|
}), cols.map(function (schema, index) {
|
|
343
349
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
344
|
-
key:
|
|
350
|
+
key: index
|
|
345
351
|
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
346
352
|
name: schema.name,
|
|
347
353
|
schema: schema
|
|
@@ -360,17 +366,21 @@ Grid.Row = observer(function () {
|
|
|
360
366
|
})));
|
|
361
367
|
});
|
|
362
368
|
Grid.Col = observer(function (props) {
|
|
369
|
+
var _schema$xComponentP2;
|
|
363
370
|
var _useContext = useContext(GridRowContext),
|
|
364
371
|
_useContext$cols = _useContext.cols,
|
|
365
372
|
cols = _useContext$cols === void 0 ? [] : _useContext$cols;
|
|
366
373
|
var schema = useFieldSchema();
|
|
367
374
|
var field = useField();
|
|
368
|
-
var width =
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
375
|
+
var width = useMemo(function () {
|
|
376
|
+
var width = '';
|
|
377
|
+
if (cols === null || cols === void 0 ? void 0 : cols.length) {
|
|
378
|
+
var _schema$xComponentP;
|
|
379
|
+
var w = (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP = schema['x-component-props']) === null || _schema$xComponentP === void 0 ? void 0 : _schema$xComponentP['width']) || 100 / cols.length;
|
|
380
|
+
width = "calc(".concat(w, "% - var(--nb-spacing) * ").concat((cols.length + 1) / cols.length, ")");
|
|
381
|
+
}
|
|
382
|
+
return width;
|
|
383
|
+
}, [cols === null || cols === void 0 ? void 0 : cols.length, schema === null || schema === void 0 ? void 0 : (_schema$xComponentP2 = schema['x-component-props']) === null || _schema$xComponentP2 === void 0 ? void 0 : _schema$xComponentP2['width']]);
|
|
374
384
|
var _useDroppable3 = useDroppable({
|
|
375
385
|
id: field.address.toString(),
|
|
376
386
|
data: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const GridCardBlockContext: React.Context<any>;
|
|
3
|
+
export declare const GridCardBlockProvider: (props: any) => JSX.Element;
|
|
4
|
+
export declare const useGridCardBlockContext: () => any;
|
|
5
|
+
export declare const useGridCardItemProps: () => {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _templateObject;
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
9
|
+
import { createForm } from '@formily/core';
|
|
10
|
+
import { FormContext, useField } from '@formily/react';
|
|
11
|
+
import React, { createContext, useContext, useEffect, useMemo } from 'react';
|
|
12
|
+
import { BlockProvider, useBlockRequestContext } from '../../../block-provider';
|
|
13
|
+
import { FormLayout } from '@formily/antd';
|
|
14
|
+
import { css } from '@emotion/css';
|
|
15
|
+
import { useAssociationNames } from '../../../block-provider/hooks';
|
|
16
|
+
export var GridCardBlockContext = /*#__PURE__*/createContext({});
|
|
17
|
+
var InternalGridCardBlockProvider = function InternalGridCardBlockProvider(props) {
|
|
18
|
+
var _service$data2;
|
|
19
|
+
var _useBlockRequestConte = useBlockRequestContext(),
|
|
20
|
+
resource = _useBlockRequestConte.resource,
|
|
21
|
+
service = _useBlockRequestConte.service;
|
|
22
|
+
var field = useField();
|
|
23
|
+
var form = useMemo(function () {
|
|
24
|
+
return createForm({
|
|
25
|
+
readPretty: true
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
if (!(service === null || service === void 0 ? void 0 : service.loading)) {
|
|
30
|
+
var _service$data;
|
|
31
|
+
form.setValuesIn(field.address.concat('list').toString(), service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data);
|
|
32
|
+
}
|
|
33
|
+
}, [service === null || service === void 0 ? void 0 : (_service$data2 = service.data) === null || _service$data2 === void 0 ? void 0 : _service$data2.data, service === null || service === void 0 ? void 0 : service.loading]);
|
|
34
|
+
return /*#__PURE__*/React.createElement(GridCardBlockContext.Provider, {
|
|
35
|
+
value: {
|
|
36
|
+
service: service,
|
|
37
|
+
resource: resource,
|
|
38
|
+
columnCount: props.columnCount
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
41
|
+
value: form
|
|
42
|
+
}, /*#__PURE__*/React.createElement(FormLayout, {
|
|
43
|
+
layout: 'vertical'
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > .nb-block-item {\n margin-bottom: var(--nb-spacing);\n & > .nb-action-bar:has(:first-child:not(:empty)) {\n padding: var(--nb-spacing);\n background: #fff;\n }\n .ant-list-pagination {\n padding: var(--nb-spacing);\n background: #fff;\n }\n }\n "])))
|
|
46
|
+
}, props.children))));
|
|
47
|
+
};
|
|
48
|
+
export var GridCardBlockProvider = function GridCardBlockProvider(props) {
|
|
49
|
+
var params = _objectSpread({}, props.params);
|
|
50
|
+
var collection = props.collection;
|
|
51
|
+
var _useAssociationNames = useAssociationNames(collection),
|
|
52
|
+
appends = _useAssociationNames.appends;
|
|
53
|
+
if (!Object.keys(params).includes('appends')) {
|
|
54
|
+
params['appends'] = appends;
|
|
55
|
+
}
|
|
56
|
+
return /*#__PURE__*/React.createElement(BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
57
|
+
params: params
|
|
58
|
+
}), /*#__PURE__*/React.createElement(InternalGridCardBlockProvider, _objectSpread({}, props)));
|
|
59
|
+
};
|
|
60
|
+
export var useGridCardBlockContext = function useGridCardBlockContext() {
|
|
61
|
+
return useContext(GridCardBlockContext);
|
|
62
|
+
};
|
|
63
|
+
export var useGridCardItemProps = function useGridCardItemProps() {
|
|
64
|
+
return {};
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GridCardDesigner: () => JSX.Element;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import { useFieldSchema, useField } from '@formily/react';
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
|
+
import { ArrayItems } from '@formily/antd';
|
|
10
|
+
import { Slider } from 'antd';
|
|
11
|
+
import _ from 'lodash';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { useCollection, useCollectionFilterOptions, useSortFields } from '../../../collection-manager';
|
|
14
|
+
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
|
15
|
+
import { useSchemaTemplate } from '../../../schema-templates';
|
|
16
|
+
import { useDesignable } from '../../hooks';
|
|
17
|
+
import { removeNullCondition } from '../filter';
|
|
18
|
+
import { FilterDynamicComponent } from '../table-v2/FilterDynamicComponent';
|
|
19
|
+
import { SchemaComponentOptions } from '../../core';
|
|
20
|
+
import { defaultColumnCount, gridSizes, pageSizeOptions, screenSizeMaps, screenSizeTitleMaps } from './options';
|
|
21
|
+
Slider;
|
|
22
|
+
var columnCountMarks = [1, 2, 3, 4, 6, 8, 12, 24].reduce(function (obj, cur) {
|
|
23
|
+
obj[cur] = cur;
|
|
24
|
+
return obj;
|
|
25
|
+
}, {});
|
|
26
|
+
export var GridCardDesigner = function GridCardDesigner() {
|
|
27
|
+
var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3, _fieldSchema$xDecora4, _field$decoratorProps, _field$decoratorProps2;
|
|
28
|
+
var _useCollection = useCollection(),
|
|
29
|
+
name = _useCollection.name,
|
|
30
|
+
title = _useCollection.title;
|
|
31
|
+
var template = useSchemaTemplate();
|
|
32
|
+
var _useTranslation = useTranslation(),
|
|
33
|
+
t = _useTranslation.t;
|
|
34
|
+
var fieldSchema = useFieldSchema();
|
|
35
|
+
var field = useField();
|
|
36
|
+
var dataSource = useCollectionFilterOptions(name);
|
|
37
|
+
var _useDesignable = useDesignable(),
|
|
38
|
+
dn = _useDesignable.dn;
|
|
39
|
+
var sortFields = useSortFields(name);
|
|
40
|
+
var defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : (_fieldSchema$xDecora$ = _fieldSchema$xDecora.params) === null || _fieldSchema$xDecora$ === void 0 ? void 0 : _fieldSchema$xDecora$.filter) || {};
|
|
41
|
+
var defaultSort = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora2 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora2 === void 0 ? void 0 : (_fieldSchema$xDecora3 = _fieldSchema$xDecora2.params) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3.sort) || [];
|
|
42
|
+
var defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora4 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora4 === void 0 ? void 0 : _fieldSchema$xDecora4.resource;
|
|
43
|
+
var columnCount = field.decoratorProps.columnCount || defaultColumnCount;
|
|
44
|
+
var columnCountSchema = useMemo(function () {
|
|
45
|
+
return {
|
|
46
|
+
'x-component': 'Slider',
|
|
47
|
+
'x-decorator': 'FormItem',
|
|
48
|
+
'x-component-props': {
|
|
49
|
+
min: 1,
|
|
50
|
+
max: 24,
|
|
51
|
+
marks: columnCountMarks,
|
|
52
|
+
tooltip: {
|
|
53
|
+
formatter: function formatter(value) {
|
|
54
|
+
return "".concat(value).concat(t('Column'));
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
step: null
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, [t]);
|
|
61
|
+
var columnCountProperties = useMemo(function () {
|
|
62
|
+
return gridSizes.reduce(function (o, k) {
|
|
63
|
+
o[k] = _objectSpread(_objectSpread({}, columnCountSchema), {}, {
|
|
64
|
+
title: t(screenSizeTitleMaps[k]),
|
|
65
|
+
description: "".concat(t('Screen size'), " ").concat(screenSizeMaps[k], " ").concat(t('pixels'))
|
|
66
|
+
});
|
|
67
|
+
return o;
|
|
68
|
+
}, {});
|
|
69
|
+
}, [columnCountSchema, t]);
|
|
70
|
+
var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
|
|
71
|
+
return item.startsWith('-') ? {
|
|
72
|
+
field: item.substring(1),
|
|
73
|
+
direction: 'desc'
|
|
74
|
+
} : {
|
|
75
|
+
field: item,
|
|
76
|
+
direction: 'asc'
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, {
|
|
80
|
+
template: template,
|
|
81
|
+
title: title || name
|
|
82
|
+
}, /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
83
|
+
components: {
|
|
84
|
+
Slider: Slider
|
|
85
|
+
}
|
|
86
|
+
}, /*#__PURE__*/React.createElement(SchemaSettings.BlockTitleItem, null), /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
87
|
+
title: t('Set the count of columns displayed in a row'),
|
|
88
|
+
initialValues: columnCount,
|
|
89
|
+
schema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
title: t('Set the count of columns displayed in a row'),
|
|
92
|
+
properties: columnCountProperties
|
|
93
|
+
},
|
|
94
|
+
onSubmit: function onSubmit(columnCount) {
|
|
95
|
+
var _schema;
|
|
96
|
+
_.set(fieldSchema, 'x-decorator-props.columnCount', columnCount);
|
|
97
|
+
field.decoratorProps.columnCount = columnCount;
|
|
98
|
+
dn.emit('patch', {
|
|
99
|
+
schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}), /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
103
|
+
title: t('Set the data scope'),
|
|
104
|
+
schema: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
title: t('Set the data scope'),
|
|
107
|
+
properties: {
|
|
108
|
+
filter: {
|
|
109
|
+
default: defaultFilter,
|
|
110
|
+
// title: '数据范围',
|
|
111
|
+
enum: dataSource,
|
|
112
|
+
'x-component': 'Filter',
|
|
113
|
+
'x-component-props': {
|
|
114
|
+
dynamicComponent: function dynamicComponent(props) {
|
|
115
|
+
return FilterDynamicComponent(_objectSpread({}, props));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
onSubmit: function onSubmit(_ref) {
|
|
122
|
+
var _schema2;
|
|
123
|
+
var filter = _ref.filter;
|
|
124
|
+
filter = removeNullCondition(filter);
|
|
125
|
+
_.set(fieldSchema, 'x-decorator-props.params.filter', filter);
|
|
126
|
+
field.decoratorProps.params = _objectSpread({}, fieldSchema['x-decorator-props'].params);
|
|
127
|
+
dn.emit('patch', {
|
|
128
|
+
schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema2)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}), /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
132
|
+
title: t('Set default sorting rules'),
|
|
133
|
+
components: {
|
|
134
|
+
ArrayItems: ArrayItems
|
|
135
|
+
},
|
|
136
|
+
schema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
title: t('Set default sorting rules'),
|
|
139
|
+
properties: {
|
|
140
|
+
sort: {
|
|
141
|
+
type: 'array',
|
|
142
|
+
default: sort,
|
|
143
|
+
'x-component': 'ArrayItems',
|
|
144
|
+
'x-decorator': 'FormItem',
|
|
145
|
+
items: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
space: {
|
|
149
|
+
type: 'void',
|
|
150
|
+
'x-component': 'Space',
|
|
151
|
+
properties: {
|
|
152
|
+
sort: {
|
|
153
|
+
type: 'void',
|
|
154
|
+
'x-decorator': 'FormItem',
|
|
155
|
+
'x-component': 'ArrayItems.SortHandle'
|
|
156
|
+
},
|
|
157
|
+
field: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
enum: sortFields,
|
|
160
|
+
required: true,
|
|
161
|
+
'x-decorator': 'FormItem',
|
|
162
|
+
'x-component': 'Select',
|
|
163
|
+
'x-component-props': {
|
|
164
|
+
style: {
|
|
165
|
+
width: 260
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
direction: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
'x-decorator': 'FormItem',
|
|
172
|
+
'x-component': 'Radio.Group',
|
|
173
|
+
'x-component-props': {
|
|
174
|
+
optionType: 'button'
|
|
175
|
+
},
|
|
176
|
+
enum: [{
|
|
177
|
+
label: t('ASC'),
|
|
178
|
+
value: 'asc'
|
|
179
|
+
}, {
|
|
180
|
+
label: t('DESC'),
|
|
181
|
+
value: 'desc'
|
|
182
|
+
}]
|
|
183
|
+
},
|
|
184
|
+
remove: {
|
|
185
|
+
type: 'void',
|
|
186
|
+
'x-decorator': 'FormItem',
|
|
187
|
+
'x-component': 'ArrayItems.Remove'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
properties: {
|
|
194
|
+
add: {
|
|
195
|
+
type: 'void',
|
|
196
|
+
title: t('Add sort field'),
|
|
197
|
+
'x-component': 'ArrayItems.Addition'
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
onSubmit: function onSubmit(_ref2) {
|
|
204
|
+
var _schema3;
|
|
205
|
+
var sort = _ref2.sort;
|
|
206
|
+
var sortArr = sort.map(function (item) {
|
|
207
|
+
return item.direction === 'desc' ? "-".concat(item.field) : item.field;
|
|
208
|
+
});
|
|
209
|
+
_.set(fieldSchema, 'x-decorator-props.params.sort', sortArr);
|
|
210
|
+
field.decoratorProps.params = _objectSpread({}, fieldSchema['x-decorator-props'].params);
|
|
211
|
+
dn.emit('patch', {
|
|
212
|
+
schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema3)
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
216
|
+
title: t('Records per page'),
|
|
217
|
+
value: ((_field$decoratorProps = field.decoratorProps) === null || _field$decoratorProps === void 0 ? void 0 : (_field$decoratorProps2 = _field$decoratorProps.params) === null || _field$decoratorProps2 === void 0 ? void 0 : _field$decoratorProps2.pageSize) || 20,
|
|
218
|
+
options: pageSizeOptions.map(function (v) {
|
|
219
|
+
return {
|
|
220
|
+
value: v
|
|
221
|
+
};
|
|
222
|
+
}),
|
|
223
|
+
onChange: function onChange(pageSize) {
|
|
224
|
+
var _schema4;
|
|
225
|
+
_.set(fieldSchema, 'x-decorator-props.params.pageSize', pageSize);
|
|
226
|
+
field.decoratorProps.params = _objectSpread(_objectSpread({}, fieldSchema['x-decorator-props'].params), {}, {
|
|
227
|
+
page: 1
|
|
228
|
+
});
|
|
229
|
+
dn.emit('patch', {
|
|
230
|
+
schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema4)
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}), /*#__PURE__*/React.createElement(SchemaSettings.Template, {
|
|
234
|
+
componentName: 'GridCard',
|
|
235
|
+
collectionName: name,
|
|
236
|
+
resourceName: defaultResource
|
|
237
|
+
}), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
|
|
238
|
+
removeParentsIfNoChildren: true,
|
|
239
|
+
breakRemoveOn: {
|
|
240
|
+
'x-component': 'Grid'
|
|
241
|
+
}
|
|
242
|
+
})));
|
|
243
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GridCardItem: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Card } from 'antd';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
6
|
+
import { useField } from '@formily/react';
|
|
7
|
+
import { RecordSimpleProvider } from '../../../record-provider';
|
|
8
|
+
var itemCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n justify-content: space-between;\n gap: 8px;\n"])));
|
|
9
|
+
export var GridCardItem = function GridCardItem(props) {
|
|
10
|
+
var field = useField();
|
|
11
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
12
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &,\n & .ant-card-body {\n height: 100%;\n }\n "])))
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: itemCss
|
|
15
|
+
}, /*#__PURE__*/React.createElement(RecordSimpleProvider, {
|
|
16
|
+
value: field.value
|
|
17
|
+
}, props.children)));
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GridCardItem } from './GridCard.Item';
|
|
2
|
+
import { GridCardBlockProvider } from './GridCard.Decorator';
|
|
3
|
+
import { GridCardDesigner } from './GridCard.Designer';
|
|
4
|
+
export declare const GridCard: ((props: any) => JSX.Element) & {
|
|
5
|
+
Item: typeof GridCardItem;
|
|
6
|
+
Designer: typeof GridCardDesigner;
|
|
7
|
+
Decorator: typeof GridCardBlockProvider;
|
|
8
|
+
};
|