@nocobase/client 0.9.2-alpha.2 → 0.9.2-alpha.4
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/Configuration/FilterDynamicComponent.d.ts +2 -0
- package/es/{schema-component/antd/table-v2/hooks/useUserVariable.js → acl/Configuration/FilterDynamicComponent.js} +32 -4
- package/es/acl/Configuration/schemas/scopes.js +3 -0
- package/es/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
- package/es/api-client/hooks/useRequest.d.ts +1 -14
- package/es/api-client/hooks/useRequest.js +48 -53
- package/es/application/Application.d.ts +1 -0
- package/es/application/Application.js +12 -2
- package/es/block-provider/FormFieldProvider.js +9 -1
- package/es/block-provider/TableSelectorProvider.js +3 -2
- package/es/block-provider/hooks/index.d.ts +1 -1
- package/es/block-provider/hooks/index.js +49 -35
- package/es/board/CardAdder.js +1 -1
- package/es/board/ColumnForm.js +4 -4
- package/es/board/DefaultColumnHeader.d.ts +1 -1
- package/es/board/DefaultColumnHeader.js +6 -6
- package/es/collection-manager/CollectionField.js +16 -13
- package/es/collection-manager/CollectionManagerProvider.js +10 -2
- package/es/collection-manager/Configuration/AddCollectionAction.js +1 -1
- package/es/collection-manager/Configuration/CollectionFields.d.ts +2 -0
- package/es/collection-manager/Configuration/CollectionFields.js +458 -0
- package/es/collection-manager/Configuration/CollectionFieldsTableArray.js +3 -3
- package/es/collection-manager/Configuration/ConfigurationTable.js +4 -2
- package/es/collection-manager/Configuration/ConfigurationTabs.js +6 -2
- package/es/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
- package/es/collection-manager/Configuration/EditCollectionAction.js +4 -4
- package/es/collection-manager/Configuration/EditFieldAction.js +2 -1
- package/es/collection-manager/Configuration/OverridingCollectionField.js +2 -1
- package/es/collection-manager/Configuration/schemas/collectionFields.d.ts +2 -0
- package/es/collection-manager/Configuration/schemas/collectionFields.js +1 -1
- package/es/collection-manager/Configuration/schemas/collections.js +8 -5
- package/es/collection-manager/action-hooks.d.ts +5 -43
- package/es/collection-manager/action-hooks.js +10 -7
- package/es/collection-manager/hooks/useCollectionDataSource.js +2 -2
- package/es/collection-manager/hooks/useCollectionManager.d.ts +1 -0
- package/es/collection-manager/hooks/useCollectionManager.js +2 -0
- package/es/collection-manager/interfaces/checkbox.js +7 -0
- package/es/collection-manager/interfaces/checkboxGroup.js +7 -0
- package/es/collection-manager/interfaces/components/index.js +1 -1
- package/es/collection-manager/interfaces/createdBy.js +5 -1
- package/es/collection-manager/interfaces/email.js +7 -0
- package/es/collection-manager/interfaces/linkTo.js +8 -1
- package/es/collection-manager/interfaces/m2m.js +8 -1
- package/es/collection-manager/interfaces/m2o.js +8 -1
- package/es/collection-manager/interfaces/multipleSelect.js +10 -0
- package/es/collection-manager/interfaces/o2m.js +10 -2
- package/es/collection-manager/interfaces/o2o.js +12 -3
- package/es/collection-manager/interfaces/percent.js +10 -0
- package/es/collection-manager/interfaces/select.js +10 -0
- package/es/collection-manager/interfaces/types.d.ts +2 -0
- package/es/collection-manager/interfaces/updatedBy.js +5 -1
- package/es/collection-manager/sub-table.d.ts +1 -14
- package/es/collection-manager/types.d.ts +1 -0
- package/es/filter-provider/utils.d.ts +8 -3
- package/es/filter-provider/utils.js +42 -27
- package/es/locale/en_US.d.ts +8 -1
- package/es/locale/en_US.js +9 -2
- package/es/locale/ja_JP.d.ts +16 -1
- package/es/locale/ja_JP.js +18 -3
- package/es/locale/pt_BR.d.ts +17 -1
- package/es/locale/pt_BR.js +19 -3
- package/es/locale/ru_RU.d.ts +15 -0
- package/es/locale/ru_RU.js +17 -2
- package/es/locale/tr_TR.d.ts +16 -1
- package/es/locale/tr_TR.js +18 -3
- package/es/locale/zh_CN.d.ts +17 -1
- package/es/locale/zh_CN.js +18 -2
- package/es/pm/PluginManagerLink.js +5 -3
- package/es/pm/index.js +1 -1
- package/es/schema-component/antd/action/Action.js +1 -1
- package/es/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
- package/es/schema-component/antd/association-select/AssociationSelect.js +67 -37
- package/es/schema-component/antd/association-select/useServiceOptions.js +3 -2
- package/es/schema-component/antd/checkbox/Checkbox.js +4 -3
- package/es/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -2
- package/es/schema-component/antd/collection-select/CollectionSelect.js +6 -6
- package/es/schema-component/antd/error-fallback/ErrorFallback.d.ts +3 -0
- package/es/schema-component/antd/error-fallback/ErrorFallback.js +47 -0
- package/es/schema-component/antd/error-fallback/index.d.ts +1 -0
- package/es/schema-component/antd/error-fallback/index.js +1 -0
- package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -0
- package/es/schema-component/antd/filter/useFilterActionProps.js +127 -7
- package/es/schema-component/antd/filter/useValues.js +7 -8
- package/es/schema-component/antd/form-item/FormItem.d.ts +3 -0
- package/es/schema-component/antd/form-item/FormItem.js +101 -19
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +2 -3
- package/es/schema-component/antd/form-v2/Templates.js +24 -18
- package/es/schema-component/antd/form-v2/utils.js +3 -3
- package/es/schema-component/antd/gantt/components/calendar/top-part-of-calendar.d.ts +1 -1
- package/es/schema-component/antd/gantt/components/calendar/top-part-of-calendar.js +3 -3
- package/es/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
- package/es/schema-component/antd/gantt/components/gantt/style.js +1 -1
- package/es/schema-component/antd/gantt/components/grid/grid.d.ts +2 -2
- package/es/schema-component/antd/gantt/components/grid/grid.js +2 -2
- package/es/schema-component/antd/gantt/components/grid/style.js +1 -1
- package/es/schema-component/antd/gantt/components/other/arrow.d.ts +2 -2
- package/es/schema-component/antd/gantt/components/other/arrow.js +3 -3
- package/es/schema-component/antd/gantt/components/other/horizontal-scroll.d.ts +1 -1
- package/es/schema-component/antd/gantt/components/other/horizontal-scroll.js +1 -1
- package/es/schema-component/antd/gantt/components/other/style.js +1 -1
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-display.d.ts +1 -1
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-display.js +1 -1
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.d.ts +2 -2
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.js +6 -6
- package/es/schema-component/antd/gantt/components/task-item/bar/bar.d.ts +2 -2
- package/es/schema-component/antd/gantt/components/task-item/bar/bar.js +9 -9
- package/es/schema-component/antd/gantt/components/task-item/bar/style.js +2 -2
- package/es/schema-component/antd/gantt/components/task-item/milestone/milestone.d.ts +2 -2
- package/es/schema-component/antd/gantt/components/task-item/milestone/milestone.js +2 -2
- package/es/schema-component/antd/gantt/types/bar-task.d.ts +2 -2
- package/es/schema-component/antd/gantt/types/date-setup.d.ts +1 -1
- package/es/schema-component/antd/gantt/types/gantt-task-actions.d.ts +3 -3
- package/es/schema-component/antd/gantt/types/public-types.d.ts +1 -1
- package/es/schema-component/antd/grid/Grid.js +23 -9
- package/es/schema-component/antd/icon-picker/IconPicker.js +1 -1
- package/es/schema-component/antd/input/EllipsisWithTooltip.js +21 -2
- package/es/schema-component/antd/menu/util.js +0 -1
- package/es/schema-component/antd/page/Page.js +10 -2
- package/es/schema-component/antd/pagination/index.js +1 -1
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +11 -9
- package/es/schema-component/antd/record-picker/useFieldNames.js +1 -1
- package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
- package/es/schema-component/antd/remote-select/RemoteSelect.js +75 -13
- package/es/schema-component/antd/select/ReadPretty.js +5 -2
- package/es/schema-component/antd/select/Select.js +3 -9
- package/es/schema-component/antd/table/Table.Array.js +2 -2
- package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +2 -138
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +6 -5
- package/es/schema-component/antd/table-v2/Table.js +2 -2
- package/es/schema-component/antd/upload/ReadPretty.js +2 -1
- package/es/schema-component/antd/variable/Input.js +12 -7
- package/es/schema-component/antd/variable/JSONInput.js +4 -4
- package/es/schema-component/antd/variable/TextArea.js +1 -1
- package/es/schema-component/antd/variable/Variable.d.ts +2 -0
- package/es/schema-component/antd/variable/Variable.js +7 -4
- package/es/schema-component/antd/variable/VariableSelect.js +8 -8
- package/es/schema-component/antd/variable/XButton.d.ts +1 -1
- package/es/schema-component/antd/variable/XButton.js +4 -4
- package/es/schema-component/common/utils/uitls.d.ts +9 -0
- package/es/schema-component/common/utils/uitls.js +37 -3
- package/es/schema-component/core/DesignableSwitch.js +5 -3
- package/es/schema-component/hooks/useComponent.js +2 -2
- package/es/schema-component/hooks/useDesignable.js +2 -2
- package/es/schema-component/hooks/useFieldTitle.js +4 -4
- package/es/schema-initializer/SchemaInitializer.js +2 -2
- package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +14 -7
- package/es/schema-initializer/items/DestroyActionInitializer.js +2 -2
- package/es/schema-initializer/items/FilterActionInitializer.js +2 -2
- package/es/schema-initializer/items/FormBlockInitializer.js +3 -3
- package/es/schema-initializer/items/G2PlotInitializer.js +1 -1
- package/es/schema-initializer/items/KanbanBlockInitializer.js +9 -9
- package/es/schema-initializer/items/MarkdownBlockInitializer.js +3 -3
- package/es/schema-initializer/items/PrintActionInitializer.js +2 -2
- package/es/schema-initializer/items/RecordAssociationBlockInitializer.js +5 -5
- package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +9 -9
- package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +5 -5
- package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.js +4 -4
- package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +5 -5
- package/es/schema-initializer/items/RefreshActionInitializer.js +2 -2
- package/es/schema-initializer/items/SubmitActionInitializer.js +2 -2
- package/es/schema-initializer/items/TableActionColumnInitializer.js +2 -2
- package/es/schema-initializer/items/TableCollectionFieldInitializer.js +2 -2
- package/es/schema-initializer/items/TableSelectorInitializer.js +5 -5
- package/es/schema-initializer/items/UpdateActionInitializer.js +2 -2
- package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +2 -2
- package/es/schema-initializer/items/ViewActionInitializer.js +2 -2
- package/es/schema-initializer/utils.js +54 -45
- package/es/schema-settings/DataTemplates/FormDataTemplates.js +28 -12
- package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -1
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +9 -2
- package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +2 -1
- package/es/schema-settings/SchemaSettings.d.ts +4 -1
- package/es/schema-settings/SchemaSettings.js +32 -19
- package/es/schema-settings/VariableInput/VariableInput.d.ts +14 -0
- package/es/schema-settings/VariableInput/VariableInput.js +39 -0
- package/es/schema-settings/VariableInput/hooks/useDateVariable.d.ts +4 -0
- package/es/schema-settings/VariableInput/hooks/useDateVariable.js +129 -0
- package/es/schema-settings/VariableInput/hooks/useUserVariable.d.ts +5 -0
- package/es/schema-settings/VariableInput/hooks/useUserVariable.js +68 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +1 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +18 -0
- package/es/user/VerificationCode.js +7 -8
- package/lib/acl/Configuration/FilterDynamicComponent.d.ts +2 -0
- package/lib/{schema-component/antd/table-v2/hooks/useUserVariable.js → acl/Configuration/FilterDynamicComponent.js} +32 -4
- package/lib/acl/Configuration/schemas/scopes.js +3 -0
- package/lib/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
- package/lib/api-client/hooks/useRequest.d.ts +1 -14
- package/lib/api-client/hooks/useRequest.js +48 -53
- package/lib/application/Application.d.ts +1 -0
- package/lib/application/Application.js +12 -2
- package/lib/block-provider/FormFieldProvider.js +9 -1
- package/lib/block-provider/TableSelectorProvider.js +3 -2
- package/lib/block-provider/hooks/index.d.ts +1 -1
- package/lib/block-provider/hooks/index.js +47 -33
- package/lib/board/CardAdder.js +1 -1
- package/lib/board/ColumnForm.js +4 -4
- package/lib/board/DefaultColumnHeader.d.ts +1 -1
- package/lib/board/DefaultColumnHeader.js +6 -6
- package/lib/collection-manager/CollectionField.js +16 -13
- package/lib/collection-manager/CollectionManagerProvider.js +10 -2
- package/lib/collection-manager/Configuration/AddCollectionAction.js +1 -1
- package/lib/collection-manager/Configuration/CollectionFields.d.ts +2 -0
- package/lib/collection-manager/Configuration/CollectionFields.js +468 -0
- package/lib/collection-manager/Configuration/CollectionFieldsTableArray.js +3 -3
- package/lib/collection-manager/Configuration/ConfigurationTable.js +4 -2
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +5 -1
- package/lib/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
- package/lib/collection-manager/Configuration/EditCollectionAction.js +4 -4
- package/lib/collection-manager/Configuration/EditFieldAction.js +2 -1
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +2 -1
- package/lib/collection-manager/Configuration/schemas/collectionFields.d.ts +2 -0
- package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -1
- package/lib/collection-manager/Configuration/schemas/collections.js +8 -5
- package/lib/collection-manager/action-hooks.d.ts +5 -43
- package/lib/collection-manager/action-hooks.js +13 -9
- package/lib/collection-manager/hooks/useCollectionManager.d.ts +1 -0
- package/lib/collection-manager/hooks/useCollectionManager.js +2 -0
- package/lib/collection-manager/interfaces/checkbox.js +7 -0
- package/lib/collection-manager/interfaces/checkboxGroup.js +7 -0
- package/lib/collection-manager/interfaces/components/index.js +1 -1
- package/lib/collection-manager/interfaces/createdBy.js +5 -1
- package/lib/collection-manager/interfaces/email.js +7 -0
- package/lib/collection-manager/interfaces/linkTo.js +8 -1
- package/lib/collection-manager/interfaces/m2m.js +8 -1
- package/lib/collection-manager/interfaces/m2o.js +8 -1
- package/lib/collection-manager/interfaces/multipleSelect.js +10 -0
- package/lib/collection-manager/interfaces/o2m.js +10 -2
- package/lib/collection-manager/interfaces/o2o.js +12 -3
- package/lib/collection-manager/interfaces/percent.js +10 -0
- package/lib/collection-manager/interfaces/select.js +10 -0
- package/lib/collection-manager/interfaces/types.d.ts +2 -0
- package/lib/collection-manager/interfaces/updatedBy.js +5 -1
- package/lib/collection-manager/sub-table.d.ts +1 -14
- package/lib/collection-manager/types.d.ts +1 -0
- package/lib/filter-provider/utils.d.ts +8 -3
- package/lib/filter-provider/utils.js +44 -28
- package/lib/locale/en_US.d.ts +8 -1
- package/lib/locale/en_US.js +9 -2
- package/lib/locale/ja_JP.d.ts +16 -1
- package/lib/locale/ja_JP.js +18 -3
- package/lib/locale/pt_BR.d.ts +17 -1
- package/lib/locale/pt_BR.js +19 -3
- package/lib/locale/ru_RU.d.ts +15 -0
- package/lib/locale/ru_RU.js +17 -2
- package/lib/locale/tr_TR.d.ts +16 -1
- package/lib/locale/tr_TR.js +18 -3
- package/lib/locale/zh_CN.d.ts +17 -1
- package/lib/locale/zh_CN.js +18 -2
- package/lib/pm/PluginManagerLink.js +4 -2
- package/lib/pm/index.js +1 -1
- package/lib/schema-component/antd/action/Action.js +1 -1
- package/lib/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
- package/lib/schema-component/antd/association-select/AssociationSelect.js +65 -35
- package/lib/schema-component/antd/association-select/useServiceOptions.js +3 -2
- package/lib/schema-component/antd/checkbox/Checkbox.js +4 -3
- package/lib/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -2
- package/lib/schema-component/antd/error-fallback/ErrorFallback.d.ts +3 -0
- package/lib/schema-component/antd/error-fallback/ErrorFallback.js +55 -0
- package/lib/schema-component/antd/error-fallback/index.d.ts +1 -0
- package/lib/schema-component/antd/error-fallback/index.js +16 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.d.ts +2 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +130 -8
- package/lib/schema-component/antd/filter/useValues.js +6 -7
- package/lib/schema-component/antd/form-item/FormItem.d.ts +3 -0
- package/lib/schema-component/antd/form-item/FormItem.js +102 -19
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +1 -2
- package/lib/schema-component/antd/form-v2/Templates.js +24 -18
- package/lib/schema-component/antd/form-v2/utils.js +3 -4
- package/lib/schema-component/antd/gantt/components/calendar/top-part-of-calendar.d.ts +1 -1
- package/lib/schema-component/antd/gantt/components/calendar/top-part-of-calendar.js +2 -2
- package/lib/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
- package/lib/schema-component/antd/gantt/components/gantt/style.js +1 -1
- package/lib/schema-component/antd/gantt/components/grid/grid.d.ts +2 -2
- package/lib/schema-component/antd/gantt/components/grid/style.js +1 -1
- package/lib/schema-component/antd/gantt/components/other/arrow.d.ts +2 -2
- package/lib/schema-component/antd/gantt/components/other/arrow.js +2 -2
- package/lib/schema-component/antd/gantt/components/other/horizontal-scroll.d.ts +1 -1
- package/lib/schema-component/antd/gantt/components/other/style.js +1 -1
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-display.d.ts +1 -1
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.d.ts +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.js +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar.d.ts +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar.js +4 -4
- package/lib/schema-component/antd/gantt/components/task-item/bar/style.js +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/milestone/milestone.d.ts +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/milestone/milestone.js +1 -1
- package/lib/schema-component/antd/gantt/types/bar-task.d.ts +2 -2
- package/lib/schema-component/antd/gantt/types/date-setup.d.ts +1 -1
- package/lib/schema-component/antd/gantt/types/gantt-task-actions.d.ts +3 -3
- package/lib/schema-component/antd/gantt/types/public-types.d.ts +1 -1
- package/lib/schema-component/antd/grid/Grid.js +23 -9
- package/lib/schema-component/antd/input/EllipsisWithTooltip.js +20 -1
- package/lib/schema-component/antd/menu/util.js +0 -1
- package/lib/schema-component/antd/page/Page.js +9 -1
- package/lib/schema-component/antd/pagination/index.js +1 -1
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +11 -9
- package/lib/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +75 -12
- package/lib/schema-component/antd/select/ReadPretty.js +5 -2
- package/lib/schema-component/antd/select/Select.js +3 -9
- package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +3 -139
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +6 -5
- package/lib/schema-component/antd/table-v2/Table.js +2 -2
- package/lib/schema-component/antd/upload/ReadPretty.js +2 -1
- package/lib/schema-component/antd/variable/Input.js +11 -6
- package/lib/schema-component/antd/variable/JSONInput.js +2 -2
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/antd/variable/Variable.d.ts +2 -0
- package/lib/schema-component/antd/variable/Variable.js +6 -2
- package/lib/schema-component/antd/variable/VariableSelect.js +4 -4
- package/lib/schema-component/antd/variable/XButton.d.ts +1 -1
- package/lib/schema-component/antd/variable/XButton.js +1 -1
- package/lib/schema-component/common/utils/uitls.d.ts +9 -0
- package/lib/schema-component/common/utils/uitls.js +43 -4
- package/lib/schema-component/core/DesignableSwitch.js +4 -2
- package/lib/schema-component/hooks/useComponent.js +2 -2
- package/lib/schema-component/hooks/useDesignable.js +2 -2
- package/lib/schema-initializer/SchemaInitializer.js +2 -2
- package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +14 -7
- package/lib/schema-initializer/utils.js +53 -44
- package/lib/schema-settings/DataTemplates/FormDataTemplates.js +28 -12
- package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -1
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +9 -2
- package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +2 -1
- package/lib/schema-settings/SchemaSettings.d.ts +4 -1
- package/lib/schema-settings/SchemaSettings.js +37 -21
- package/lib/schema-settings/VariableInput/VariableInput.d.ts +14 -0
- package/lib/schema-settings/VariableInput/VariableInput.js +49 -0
- package/lib/schema-settings/VariableInput/hooks/useDateVariable.d.ts +4 -0
- package/lib/schema-settings/VariableInput/hooks/useDateVariable.js +136 -0
- package/lib/schema-settings/VariableInput/hooks/useUserVariable.d.ts +5 -0
- package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +75 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +1 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +25 -0
- package/lib/user/VerificationCode.js +1 -2
- package/package.json +6 -5
- package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +0 -10
- package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +0 -10
|
@@ -13,6 +13,7 @@ var _react2 = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _reactI18next = require("react-i18next");
|
|
14
14
|
var _blockProvider = require("../../../block-provider");
|
|
15
15
|
var _collectionManager = require("../../../collection-manager");
|
|
16
|
+
var _CollectionFields = require("../../../collection-manager/Configuration/CollectionFields");
|
|
16
17
|
var _schemaSettings = require("../../../schema-settings");
|
|
17
18
|
var _hooks = require("../../hooks");
|
|
18
19
|
var _filter = require("../filter");
|
|
@@ -27,7 +28,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
28
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
28
29
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
30
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
|
-
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
31
31
|
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; }
|
|
32
32
|
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; }
|
|
33
33
|
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); }
|
|
@@ -79,16 +79,15 @@ var InternalAssociationSelect = (0, _react.connect)(function (props) {
|
|
|
79
79
|
}), (0, _react.mapReadPretty)(_ReadPretty.ReadPretty));
|
|
80
80
|
var AssociationSelect = InternalAssociationSelect;
|
|
81
81
|
exports.AssociationSelect = AssociationSelect;
|
|
82
|
-
AssociationSelect.Designer = function () {
|
|
83
|
-
var _interfaceConfig$vali, _collectionField$uiSc, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _collectionField$uiSc2, _fieldSchema$xDecora,
|
|
82
|
+
AssociationSelect.Designer = function Designer() {
|
|
83
|
+
var _interfaceConfig$vali, _collectionField$uiSc, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _field$componentProps7, _field$componentProps8;
|
|
84
84
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
85
85
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
86
86
|
getInterface = _useCollectionManager.getInterface,
|
|
87
87
|
getCollectionJoinField = _useCollectionManager.getCollectionJoinField,
|
|
88
88
|
getCollection = _useCollectionManager.getCollection;
|
|
89
89
|
var _useCollection = (0, _collectionManager.useCollection)(),
|
|
90
|
-
getField = _useCollection.getField
|
|
91
|
-
template = _useCollection.template;
|
|
90
|
+
getField = _useCollection.getField;
|
|
92
91
|
var _useFormBlockContext = (0, _blockProvider.useFormBlockContext)(),
|
|
93
92
|
form = _useFormBlockContext.form;
|
|
94
93
|
var field = (0, _react.useField)();
|
|
@@ -96,7 +95,6 @@ AssociationSelect.Designer = function () {
|
|
|
96
95
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
97
96
|
t = _useTranslation.t;
|
|
98
97
|
var tk = (0, _blockProvider.useFilterByTk)();
|
|
99
|
-
_objectDestructuringEmpty((0, _collectionManager.useCollection)());
|
|
100
98
|
var _useDesignable = (0, _hooks.useDesignable)(),
|
|
101
99
|
dn = _useDesignable.dn,
|
|
102
100
|
refresh = _useDesignable.refresh,
|
|
@@ -116,6 +114,13 @@ AssociationSelect.Designer = function () {
|
|
|
116
114
|
var defaultSort = ((_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.service) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.params) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.sort) || [];
|
|
117
115
|
var defaultFilter = ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.filter) || {};
|
|
118
116
|
var dataSource = (0, _collectionManager.useCollectionFilterOptions)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
|
|
117
|
+
// TODO: 这里 fieldSchema['x-read-pretty'] 的值为 true,但是 field.readPretty 的值却为 false,不知道什么原因
|
|
118
|
+
(0, _react2.useEffect)(function () {
|
|
119
|
+
// 没有这一步判断会出现禁用状态失效的情况
|
|
120
|
+
if (field.readPretty !== fieldSchema['x-read-pretty']) {
|
|
121
|
+
field.readPretty = !!fieldSchema['x-read-pretty'];
|
|
122
|
+
}
|
|
123
|
+
}, [fieldSchema['x-read-pretty']]);
|
|
119
124
|
var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
|
|
120
125
|
return item.startsWith('-') ? {
|
|
121
126
|
field: item.substring(1),
|
|
@@ -129,7 +134,7 @@ AssociationSelect.Designer = function () {
|
|
|
129
134
|
initialValue['required'] = field.required;
|
|
130
135
|
}
|
|
131
136
|
var options = targetFields.filter(function (field) {
|
|
132
|
-
return
|
|
137
|
+
return (0, _CollectionFields.isTitleField)(field);
|
|
133
138
|
}).map(function (field) {
|
|
134
139
|
var _field$uiSchema;
|
|
135
140
|
return {
|
|
@@ -380,21 +385,30 @@ AssociationSelect.Designer = function () {
|
|
|
380
385
|
});
|
|
381
386
|
refresh();
|
|
382
387
|
}
|
|
383
|
-
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (
|
|
388
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (0, _schemaSettings.isShowDefaultValue)(collectionField, getInterface) && !(0, _schemaSettings.isPatternDisabled)(fieldSchema) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
384
389
|
title: t('Set default value'),
|
|
385
390
|
components: {
|
|
386
391
|
ArrayCollapse: _antd.ArrayCollapse,
|
|
387
392
|
FormLayout: _antd.FormLayout
|
|
388
393
|
},
|
|
394
|
+
width: 800,
|
|
389
395
|
schema: {
|
|
390
396
|
type: 'object',
|
|
391
397
|
title: t('Set default value'),
|
|
392
398
|
properties: {
|
|
393
|
-
default: _objectSpread(_objectSpread({},
|
|
399
|
+
default: _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
|
|
400
|
+
'x-decorator': 'FormItem',
|
|
401
|
+
'x-component-props': _objectSpread(_objectSpread({}, fieldSchema['x-component-props']), {}, {
|
|
402
|
+
component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? 'AssociationSelect' : undefined,
|
|
403
|
+
service: {
|
|
404
|
+
resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
|
|
405
|
+
}
|
|
406
|
+
}),
|
|
394
407
|
name: 'default',
|
|
395
408
|
title: t('Default value'),
|
|
396
|
-
|
|
397
|
-
|
|
409
|
+
default: fieldSchema.default || collectionField.defaultValue,
|
|
410
|
+
'x-read-pretty': false,
|
|
411
|
+
'x-disabled': false
|
|
398
412
|
})
|
|
399
413
|
}
|
|
400
414
|
},
|
|
@@ -415,7 +429,7 @@ AssociationSelect.Designer = function () {
|
|
|
415
429
|
options: fieldComponentOptions,
|
|
416
430
|
value: fieldSchema['x-component'],
|
|
417
431
|
onChange: function onChange(type) {
|
|
418
|
-
var _collectionField$
|
|
432
|
+
var _collectionField$uiSc4, _interfaceConfig$sche;
|
|
419
433
|
var schema = {
|
|
420
434
|
name: collectionField.name,
|
|
421
435
|
type: 'void',
|
|
@@ -428,7 +442,7 @@ AssociationSelect.Designer = function () {
|
|
|
428
442
|
'x-validator': fieldSchema['x-validator'],
|
|
429
443
|
'x-collection-field': fieldSchema['x-collection-field'],
|
|
430
444
|
'x-decorator-props': fieldSchema['x-decorator-props'],
|
|
431
|
-
'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
445
|
+
'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
|
|
432
446
|
};
|
|
433
447
|
interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
|
|
434
448
|
field: collectionField,
|
|
@@ -451,6 +465,22 @@ AssociationSelect.Designer = function () {
|
|
|
451
465
|
}
|
|
452
466
|
});
|
|
453
467
|
}
|
|
468
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
469
|
+
key: "multiple",
|
|
470
|
+
title: t('Multiple'),
|
|
471
|
+
checked: ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.multiple) === undefined ? true : fieldSchema['x-component-props'].multiple,
|
|
472
|
+
onChange: function onChange(value) {
|
|
473
|
+
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
474
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
475
|
+
field.componentProps = field.componentProps || {};
|
|
476
|
+
fieldSchema['x-component-props'].multiple = value;
|
|
477
|
+
field.componentProps.multiple = value;
|
|
478
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
479
|
+
dn.emit('patch', {
|
|
480
|
+
schema: schema
|
|
481
|
+
});
|
|
482
|
+
refresh();
|
|
483
|
+
}
|
|
454
484
|
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
455
485
|
title: t('Set the data scope'),
|
|
456
486
|
schema: {
|
|
@@ -471,13 +501,13 @@ AssociationSelect.Designer = function () {
|
|
|
471
501
|
}
|
|
472
502
|
},
|
|
473
503
|
onSubmit: function onSubmit(_ref4) {
|
|
474
|
-
var
|
|
504
|
+
var _schema5;
|
|
475
505
|
var filter = _ref4.filter;
|
|
476
506
|
filter = (0, _filter.removeNullCondition)(filter);
|
|
477
507
|
_lodash.default.set(field.componentProps, 'service.params.filter', filter);
|
|
478
508
|
fieldSchema['x-component-props'] = field.componentProps;
|
|
479
509
|
dn.emit('patch', {
|
|
480
|
-
schema: (
|
|
510
|
+
schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-component-props', field.componentProps), _schema5)
|
|
481
511
|
});
|
|
482
512
|
}
|
|
483
513
|
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
@@ -552,7 +582,7 @@ AssociationSelect.Designer = function () {
|
|
|
552
582
|
}
|
|
553
583
|
},
|
|
554
584
|
onSubmit: function onSubmit(_ref5) {
|
|
555
|
-
var
|
|
585
|
+
var _schema6;
|
|
556
586
|
var sort = _ref5.sort;
|
|
557
587
|
var sortArr = sort.map(function (item) {
|
|
558
588
|
return item.direction === 'desc' ? "-".concat(item.field) : item.field;
|
|
@@ -560,10 +590,10 @@ AssociationSelect.Designer = function () {
|
|
|
560
590
|
_lodash.default.set(field.componentProps, 'service.params.sort', sortArr);
|
|
561
591
|
fieldSchema['x-component-props'] = field.componentProps;
|
|
562
592
|
dn.emit('patch', {
|
|
563
|
-
schema: (
|
|
593
|
+
schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
|
|
564
594
|
});
|
|
565
595
|
}
|
|
566
|
-
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (
|
|
596
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && !(0, _schemaSettings.isPatternDisabled)(fieldSchema) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
|
|
567
597
|
key: "pattern",
|
|
568
598
|
title: t('Pattern'),
|
|
569
599
|
options: [{
|
|
@@ -621,9 +651,9 @@ AssociationSelect.Designer = function () {
|
|
|
621
651
|
options: options,
|
|
622
652
|
value: field === null || field === void 0 ? void 0 : (_field$componentProps7 = field.componentProps) === null || _field$componentProps7 === void 0 ? void 0 : (_field$componentProps8 = _field$componentProps7.fieldNames) === null || _field$componentProps8 === void 0 ? void 0 : _field$componentProps8.label,
|
|
623
653
|
onChange: function onChange(label) {
|
|
624
|
-
var _collectionField$
|
|
654
|
+
var _collectionField$uiSc5, _collectionField$uiSc6;
|
|
625
655
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
626
|
-
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
656
|
+
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
|
|
627
657
|
label: label
|
|
628
658
|
});
|
|
629
659
|
field.componentProps.fieldNames = fieldNames;
|
|
@@ -650,14 +680,14 @@ AssociationSelect.Designer = function () {
|
|
|
650
680
|
* 用于筛选表单区块
|
|
651
681
|
* @returns
|
|
652
682
|
*/
|
|
653
|
-
AssociationSelect.FilterDesigner = function () {
|
|
654
|
-
var _interfaceConfig$vali2, _collectionField$
|
|
683
|
+
AssociationSelect.FilterDesigner = function FilterDesigner() {
|
|
684
|
+
var _interfaceConfig$vali2, _collectionField$uiSc7, _field$componentProps9, _field$componentProps10, _field$componentProps11, _field$componentProps12, _field$componentProps13, _field$componentProps14, _collectionField$uiSc8, _fieldSchema$xDecora2, _collectionField$uiSc10, _field$componentProps15, _field$componentProps16;
|
|
655
685
|
var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
|
|
656
686
|
getCollectionFields = _useCollectionManager2.getCollectionFields,
|
|
657
687
|
getInterface = _useCollectionManager2.getInterface,
|
|
658
688
|
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField;
|
|
659
|
-
var
|
|
660
|
-
getField =
|
|
689
|
+
var _useCollection2 = (0, _collectionManager.useCollection)(),
|
|
690
|
+
getField = _useCollection2.getField;
|
|
661
691
|
var _useFormBlockContext2 = (0, _blockProvider.useFormBlockContext)(),
|
|
662
692
|
form = _useFormBlockContext2.form;
|
|
663
693
|
var field = (0, _react.useField)();
|
|
@@ -671,7 +701,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
671
701
|
var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
672
702
|
var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
|
|
673
703
|
var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali2 = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali2 === void 0 ? void 0 : _interfaceConfig$vali2.call(interfaceConfig, fieldSchema);
|
|
674
|
-
var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
704
|
+
var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc7 = collectionField.uiSchema) === null || _collectionField$uiSc7 === void 0 ? void 0 : _collectionField$uiSc7.title;
|
|
675
705
|
var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : [];
|
|
676
706
|
var initialValue = {
|
|
677
707
|
title: field.title === originalTitle ? undefined : field.title
|
|
@@ -718,7 +748,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
718
748
|
title: {
|
|
719
749
|
title: t('Field title'),
|
|
720
750
|
default: field === null || field === void 0 ? void 0 : field.title,
|
|
721
|
-
description: "".concat(t('Original field title: ')).concat(collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
751
|
+
description: "".concat(t('Original field title: ')).concat(collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc8 = collectionField.uiSchema) === null || _collectionField$uiSc8 === void 0 ? void 0 : _collectionField$uiSc8.title),
|
|
722
752
|
'x-decorator': 'FormItem',
|
|
723
753
|
'x-component': 'Input',
|
|
724
754
|
'x-component-props': {}
|
|
@@ -883,7 +913,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
883
913
|
}
|
|
884
914
|
},
|
|
885
915
|
onSubmit: function onSubmit(v) {
|
|
886
|
-
var _collectionField$
|
|
916
|
+
var _collectionField$uiSc9;
|
|
887
917
|
var rules = [];
|
|
888
918
|
var _iterator3 = _createForOfIteratorHelper(v.rules),
|
|
889
919
|
_step3;
|
|
@@ -921,7 +951,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
921
951
|
_iterator4.f();
|
|
922
952
|
}
|
|
923
953
|
}
|
|
924
|
-
var concatValidator = _lodash.default.concat([], (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
954
|
+
var concatValidator = _lodash.default.concat([], (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc9 = collectionField.uiSchema) === null || _collectionField$uiSc9 === void 0 ? void 0 : _collectionField$uiSc9['x-validator']) || [], rules);
|
|
925
955
|
field.validator = concatValidator;
|
|
926
956
|
fieldSchema['x-validator'] = rules;
|
|
927
957
|
schema['x-validator'] = rules;
|
|
@@ -930,7 +960,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
930
960
|
});
|
|
931
961
|
refresh();
|
|
932
962
|
}
|
|
933
|
-
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
963
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc10 = collectionField.uiSchema) === null || _collectionField$uiSc10 === void 0 ? void 0 : _collectionField$uiSc10.type) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
934
964
|
title: t('Set default value'),
|
|
935
965
|
components: {
|
|
936
966
|
ArrayCollapse: _antd.ArrayCollapse,
|
|
@@ -980,13 +1010,13 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
980
1010
|
}
|
|
981
1011
|
},
|
|
982
1012
|
onSubmit: function onSubmit(_ref9) {
|
|
983
|
-
var
|
|
1013
|
+
var _schema11;
|
|
984
1014
|
var filter = _ref9.filter;
|
|
985
1015
|
filter = (0, _filter.removeNullCondition)(filter);
|
|
986
1016
|
_lodash.default.set(field.componentProps, 'service.params.filter', filter);
|
|
987
1017
|
fieldSchema['x-component-props'] = field.componentProps;
|
|
988
1018
|
dn.emit('patch', {
|
|
989
|
-
schema: (
|
|
1019
|
+
schema: (_schema11 = {}, _defineProperty(_schema11, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema11, 'x-component-props', field.componentProps), _schema11)
|
|
990
1020
|
});
|
|
991
1021
|
}
|
|
992
1022
|
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
@@ -1061,7 +1091,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
1061
1091
|
}
|
|
1062
1092
|
},
|
|
1063
1093
|
onSubmit: function onSubmit(_ref10) {
|
|
1064
|
-
var
|
|
1094
|
+
var _schema12;
|
|
1065
1095
|
var sort = _ref10.sort;
|
|
1066
1096
|
var sortArr = sort.map(function (item) {
|
|
1067
1097
|
return item.direction === 'desc' ? "-".concat(item.field) : item.field;
|
|
@@ -1069,7 +1099,7 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
1069
1099
|
_lodash.default.set(field.componentProps, 'service.params.sort', sortArr);
|
|
1070
1100
|
fieldSchema['x-component-props'] = field.componentProps;
|
|
1071
1101
|
dn.emit('patch', {
|
|
1072
|
-
schema: (
|
|
1102
|
+
schema: (_schema12 = {}, _defineProperty(_schema12, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema12, 'x-component-props', field.componentProps), _schema12)
|
|
1073
1103
|
});
|
|
1074
1104
|
}
|
|
1075
1105
|
}), (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && ['CollectionField', 'AssociationSelect'].includes(fieldSchema['x-component']) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
|
|
@@ -1078,9 +1108,9 @@ AssociationSelect.FilterDesigner = function () {
|
|
|
1078
1108
|
options: options,
|
|
1079
1109
|
value: field === null || field === void 0 ? void 0 : (_field$componentProps15 = field.componentProps) === null || _field$componentProps15 === void 0 ? void 0 : (_field$componentProps16 = _field$componentProps15.fieldNames) === null || _field$componentProps16 === void 0 ? void 0 : _field$componentProps16.label,
|
|
1080
1110
|
onChange: function onChange(label) {
|
|
1081
|
-
var _collectionField$
|
|
1111
|
+
var _collectionField$uiSc11, _collectionField$uiSc12;
|
|
1082
1112
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
1083
|
-
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
1113
|
+
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc11 = collectionField.uiSchema) === null || _collectionField$uiSc11 === void 0 ? void 0 : (_collectionField$uiSc12 = _collectionField$uiSc11['x-component-props']) === null || _collectionField$uiSc12 === void 0 ? void 0 : _collectionField$uiSc12['fieldNames']), field.componentProps.fieldNames), {}, {
|
|
1084
1114
|
label: label
|
|
1085
1115
|
});
|
|
1086
1116
|
field.componentProps.fieldNames = fieldNames;
|
|
@@ -8,6 +8,7 @@ var _react = require("@formily/react");
|
|
|
8
8
|
var _react2 = require("react");
|
|
9
9
|
var _SharedFilterProvider = require("../../../block-provider/SharedFilterProvider");
|
|
10
10
|
var _collectionManager = require("../../../collection-manager");
|
|
11
|
+
var _filterProvider = require("../../../filter-provider");
|
|
11
12
|
var _recordProvider = require("../../../record-provider");
|
|
12
13
|
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; }
|
|
13
14
|
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; }
|
|
@@ -49,9 +50,9 @@ function useServiceOptions(props) {
|
|
|
49
50
|
var sourceValue = record === null || record === void 0 ? void 0 : record[collectionField === null || collectionField === void 0 ? void 0 : collectionField.sourceKey];
|
|
50
51
|
var filter = (0, _react2.useMemo)(function () {
|
|
51
52
|
var isOToAny = ['oho', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
|
|
52
|
-
return (0, _SharedFilterProvider.mergeFilter)([(0, _SharedFilterProvider.mergeFilter)([isOToAny ? _defineProperty({}, collectionField.foreignKey, {
|
|
53
|
+
return (0, _SharedFilterProvider.mergeFilter)([(0, _SharedFilterProvider.mergeFilter)([isOToAny && !(0, _filterProvider.isInFilterFormBlock)(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
|
|
53
54
|
$is: null
|
|
54
|
-
}) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null ? _defineProperty({}, collectionField.foreignKey, {
|
|
55
|
+
}) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null && !(0, _filterProvider.isInFilterFormBlock)(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
|
|
55
56
|
$eq: sourceValue
|
|
56
57
|
}) : null, (params === null || params === void 0 ? void 0 : params.filter) && value ? _defineProperty({}, fieldNames.value, _defineProperty({}, '$in', value)) : null], '$or');
|
|
57
58
|
}, [params === null || params === void 0 ? void 0 : params.filter, getCollectionFields, collectionField, sourceValue, value, fieldNames.value]);
|
|
@@ -10,6 +10,7 @@ var _shared = require("@formily/shared");
|
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
var _uniq = _interopRequireDefault(require("lodash/uniq"));
|
|
12
12
|
var _react2 = _interopRequireDefault(require("react"));
|
|
13
|
+
var _EllipsisWithTooltip = require("../input/EllipsisWithTooltip");
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
16
|
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; }
|
|
@@ -49,12 +50,12 @@ Checkbox.Group = (0, _react.connect)(_antd.Checkbox.Group, (0, _react.mapProps)(
|
|
|
49
50
|
if (!(0, _shared.isValid)(props.value)) {
|
|
50
51
|
return null;
|
|
51
52
|
}
|
|
52
|
-
var _props$options = props.options,
|
|
53
|
-
options = _props$options === void 0 ? [] : _props$options;
|
|
54
53
|
var field = (0, _react.useField)();
|
|
55
54
|
var dataSource = field.dataSource || [];
|
|
56
55
|
var value = (0, _uniq.default)(field.value ? field.value : []);
|
|
57
|
-
return /*#__PURE__*/_react2.default.createElement(
|
|
56
|
+
return /*#__PURE__*/_react2.default.createElement(_EllipsisWithTooltip.EllipsisWithTooltip, {
|
|
57
|
+
ellipsis: props.ellipsis
|
|
58
|
+
}, dataSource.filter(function (option) {
|
|
58
59
|
return value.includes(option.value);
|
|
59
60
|
}).map(function (option, key) {
|
|
60
61
|
return /*#__PURE__*/_react2.default.createElement(_antd.Tag, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SelectProps } from
|
|
2
|
-
import React from
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
export declare type CollectionSelectProps = SelectProps<any, any> & {
|
|
4
4
|
filter?: (item: any, index: number, array: any[]) => boolean;
|
|
5
5
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ErrorFallback = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var Paragraph = _antd.Typography.Paragraph,
|
|
13
|
+
Text = _antd.Typography.Text,
|
|
14
|
+
Link = _antd.Typography.Link;
|
|
15
|
+
var ErrorFallback = function ErrorFallback(_ref) {
|
|
16
|
+
var error = _ref.error;
|
|
17
|
+
var _useErrorBoundary = (0, _reactErrorBoundary.useErrorBoundary)(),
|
|
18
|
+
resetBoundary = _useErrorBoundary.resetBoundary;
|
|
19
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
20
|
+
t = _useTranslation.t;
|
|
21
|
+
var subTitle = /*#__PURE__*/_react.default.createElement(_reactI18next.Trans, null, 'This is likely a NocoBase internals bug. Please open an issue at ', /*#__PURE__*/_react.default.createElement(Link, {
|
|
22
|
+
href: "https://github.com/nocobase/nocobase/issues"
|
|
23
|
+
}, "here"));
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
style: {
|
|
26
|
+
backgroundColor: 'white'
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Result, {
|
|
29
|
+
style: {
|
|
30
|
+
maxWidth: '60vw',
|
|
31
|
+
margin: 'auto'
|
|
32
|
+
},
|
|
33
|
+
status: "error",
|
|
34
|
+
title: t('Render Failed'),
|
|
35
|
+
subTitle: subTitle,
|
|
36
|
+
extra: [/*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
37
|
+
type: "primary",
|
|
38
|
+
key: "feedback"
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
40
|
+
href: "https://github.com/nocobase/nocobase/issues"
|
|
41
|
+
}, t('Feedback'))), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
42
|
+
key: "try",
|
|
43
|
+
onClick: resetBoundary
|
|
44
|
+
}, t('Try again'))]
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(Paragraph, {
|
|
46
|
+
copyable: true
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(Text, {
|
|
48
|
+
type: "danger",
|
|
49
|
+
style: {
|
|
50
|
+
whiteSpace: 'pre-line',
|
|
51
|
+
textAlign: 'center'
|
|
52
|
+
}
|
|
53
|
+
}, error.stack))));
|
|
54
|
+
};
|
|
55
|
+
exports.ErrorFallback = ErrorFallback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorFallback';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ErrorFallback = require("./ErrorFallback");
|
|
7
|
+
Object.keys(_ErrorFallback).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ErrorFallback[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _ErrorFallback[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export declare const useGetFilterOptions: () => (collectionName: any) => any[];
|
|
1
2
|
export declare const useFilterOptions: (collectionName: string) => any[];
|
|
3
|
+
export declare const useGetFilterFieldOptions: () => (fields: any) => any[];
|
|
2
4
|
export declare const useFilterFieldOptions: (fields: any) => any[];
|
|
3
5
|
export declare const removeNullCondition: (filter: any) => any;
|
|
4
6
|
export declare const useFilterActionProps: () => {
|
|
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useFilterOptions = exports.useFilterFieldProps = exports.useFilterFieldOptions = exports.useFilterActionProps = exports.removeNullCondition = void 0;
|
|
7
|
+
exports.useGetFilterOptions = exports.useGetFilterFieldOptions = exports.useFilterOptions = exports.useFilterFieldProps = exports.useFilterFieldOptions = exports.useFilterActionProps = exports.removeNullCondition = void 0;
|
|
8
8
|
var _react = require("@formily/react");
|
|
9
9
|
var _flat = _interopRequireDefault(require("flat"));
|
|
10
10
|
var _reactI18next = require("react-i18next");
|
|
@@ -24,15 +24,71 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
24
24
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
25
25
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
26
26
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
27
|
-
var
|
|
27
|
+
var useGetFilterOptions = function useGetFilterOptions() {
|
|
28
28
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
29
29
|
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
30
|
-
var fields = getCollectionFields(collectionName);
|
|
31
|
-
var options = useFilterFieldOptions(fields);
|
|
32
30
|
var compile = (0, _.useCompile)();
|
|
33
31
|
var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
|
|
34
32
|
getChildrenCollections = _useCollectionManager2.getChildrenCollections;
|
|
35
33
|
var collection = (0, _collectionManager.useCollection)();
|
|
34
|
+
var getFilterFieldOptions = useGetFilterFieldOptions();
|
|
35
|
+
return function (collectionName) {
|
|
36
|
+
var fields = getCollectionFields(collectionName);
|
|
37
|
+
var options = getFilterFieldOptions(fields);
|
|
38
|
+
var childrenCollections = getChildrenCollections(collection.name);
|
|
39
|
+
if (childrenCollections.length > 0 && !options.find(function (v) {
|
|
40
|
+
return v.name == 'tableoid';
|
|
41
|
+
})) {
|
|
42
|
+
options.push({
|
|
43
|
+
name: 'tableoid',
|
|
44
|
+
type: 'string',
|
|
45
|
+
title: '{{t("Table OID(Inheritance)")}}',
|
|
46
|
+
schema: {
|
|
47
|
+
'x-component': 'Select',
|
|
48
|
+
enum: [{
|
|
49
|
+
value: collection.name,
|
|
50
|
+
label: compile(collection.title)
|
|
51
|
+
}].concat(childrenCollections.map(function (v) {
|
|
52
|
+
return {
|
|
53
|
+
value: v.name,
|
|
54
|
+
label: compile(v.title)
|
|
55
|
+
};
|
|
56
|
+
}))
|
|
57
|
+
},
|
|
58
|
+
operators: [{
|
|
59
|
+
label: '{{t("contains")}}',
|
|
60
|
+
value: '$childIn',
|
|
61
|
+
schema: {
|
|
62
|
+
'x-component': 'Select',
|
|
63
|
+
'x-component-props': {
|
|
64
|
+
mode: 'tags'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
label: '{{t("does not contain")}}',
|
|
69
|
+
value: '$childNotIn',
|
|
70
|
+
schema: {
|
|
71
|
+
'x-component': 'Select',
|
|
72
|
+
'x-component-props': {
|
|
73
|
+
mode: 'tags'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return options;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.useGetFilterOptions = useGetFilterOptions;
|
|
83
|
+
var useFilterOptions = function useFilterOptions(collectionName) {
|
|
84
|
+
var _useCollectionManager3 = (0, _collectionManager.useCollectionManager)(),
|
|
85
|
+
getCollectionFields = _useCollectionManager3.getCollectionFields;
|
|
86
|
+
var compile = (0, _.useCompile)();
|
|
87
|
+
var _useCollectionManager4 = (0, _collectionManager.useCollectionManager)(),
|
|
88
|
+
getChildrenCollections = _useCollectionManager4.getChildrenCollections;
|
|
89
|
+
var collection = (0, _collectionManager.useCollection)();
|
|
90
|
+
var fields = getCollectionFields(collectionName);
|
|
91
|
+
var options = useFilterFieldOptions(fields);
|
|
36
92
|
var childrenCollections = getChildrenCollections(collection.name);
|
|
37
93
|
if (childrenCollections.length > 0 && !options.find(function (v) {
|
|
38
94
|
return v.name == 'tableoid';
|
|
@@ -77,13 +133,13 @@ var useFilterOptions = function useFilterOptions(collectionName) {
|
|
|
77
133
|
return options;
|
|
78
134
|
};
|
|
79
135
|
exports.useFilterOptions = useFilterOptions;
|
|
80
|
-
var
|
|
136
|
+
var useGetFilterFieldOptions = function useGetFilterFieldOptions() {
|
|
81
137
|
var _fieldSchema$xCompon;
|
|
82
138
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
83
139
|
var nonfilterable = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.nonfilterable) || [];
|
|
84
|
-
var
|
|
85
|
-
getCollectionFields =
|
|
86
|
-
getInterface =
|
|
140
|
+
var _useCollectionManager5 = (0, _collectionManager.useCollectionManager)(),
|
|
141
|
+
getCollectionFields = _useCollectionManager5.getCollectionFields,
|
|
142
|
+
getInterface = _useCollectionManager5.getInterface;
|
|
87
143
|
var field2option = function field2option(field, depth) {
|
|
88
144
|
var _field$uiSchema, _operators$filter;
|
|
89
145
|
if (nonfilterable.length && depth === 1 && nonfilterable.includes(field.name)) {
|
|
@@ -138,6 +194,72 @@ var useFilterFieldOptions = function useFilterFieldOptions(fields) {
|
|
|
138
194
|
});
|
|
139
195
|
return options;
|
|
140
196
|
};
|
|
197
|
+
return function (fields) {
|
|
198
|
+
return getOptions(fields, 1);
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
exports.useGetFilterFieldOptions = useGetFilterFieldOptions;
|
|
202
|
+
var useFilterFieldOptions = function useFilterFieldOptions(fields) {
|
|
203
|
+
var _fieldSchema$xCompon2;
|
|
204
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
205
|
+
var nonfilterable = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.nonfilterable) || [];
|
|
206
|
+
var _useCollectionManager6 = (0, _collectionManager.useCollectionManager)(),
|
|
207
|
+
getCollectionFields = _useCollectionManager6.getCollectionFields,
|
|
208
|
+
getInterface = _useCollectionManager6.getInterface;
|
|
209
|
+
var field2option = function field2option(field, depth) {
|
|
210
|
+
var _field$uiSchema2, _operators$filter2;
|
|
211
|
+
if (nonfilterable.length && depth === 1 && nonfilterable.includes(field.name)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (!field.interface) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
var fieldInterface = getInterface(field.interface);
|
|
218
|
+
if (!fieldInterface.filterable) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
var _fieldInterface$filte2 = fieldInterface.filterable,
|
|
222
|
+
nested = _fieldInterface$filte2.nested,
|
|
223
|
+
children = _fieldInterface$filte2.children,
|
|
224
|
+
operators = _fieldInterface$filte2.operators;
|
|
225
|
+
var option = {
|
|
226
|
+
name: field.name,
|
|
227
|
+
type: field.type,
|
|
228
|
+
target: field.target,
|
|
229
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) || field.name,
|
|
230
|
+
schema: field === null || field === void 0 ? void 0 : field.uiSchema,
|
|
231
|
+
operators: (operators === null || operators === void 0 ? void 0 : (_operators$filter2 = operators.filter) === null || _operators$filter2 === void 0 ? void 0 : _operators$filter2.call(operators, function (operator) {
|
|
232
|
+
return !(operator === null || operator === void 0 ? void 0 : operator.visible) || operator.visible(field);
|
|
233
|
+
})) || []
|
|
234
|
+
};
|
|
235
|
+
if (field.target && depth > 2) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (depth > 2) {
|
|
239
|
+
return option;
|
|
240
|
+
}
|
|
241
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
242
|
+
option['children'] = children;
|
|
243
|
+
}
|
|
244
|
+
if (nested) {
|
|
245
|
+
var _option$children2;
|
|
246
|
+
var targetFields = getCollectionFields(field.target);
|
|
247
|
+
var options = getOptions(targetFields, depth + 1).filter(Boolean);
|
|
248
|
+
option['children'] = option['children'] || [];
|
|
249
|
+
(_option$children2 = option['children']).push.apply(_option$children2, _toConsumableArray(options));
|
|
250
|
+
}
|
|
251
|
+
return option;
|
|
252
|
+
};
|
|
253
|
+
var getOptions = function getOptions(fields, depth) {
|
|
254
|
+
var options = [];
|
|
255
|
+
fields.forEach(function (field) {
|
|
256
|
+
var option = field2option(field, depth);
|
|
257
|
+
if (option) {
|
|
258
|
+
options.push(option);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return options;
|
|
262
|
+
};
|
|
141
263
|
return getOptions(fields, 1);
|
|
142
264
|
};
|
|
143
265
|
exports.useFilterFieldOptions = useFilterFieldOptions;
|