@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
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useCompile } from '../../../schema-component';
|
|
2
|
+
export var useDateVariable = function useDateVariable(_ref) {
|
|
3
|
+
var operator = _ref.operator,
|
|
4
|
+
schema = _ref.schema;
|
|
5
|
+
var compile = useCompile();
|
|
6
|
+
var operatorValue = (operator === null || operator === void 0 ? void 0 : operator.value) || '';
|
|
7
|
+
if (!operator || !schema) return null;
|
|
8
|
+
var disabled = !['DatePicker', 'DatePicker.RangePicker'].includes(schema['x-component']);
|
|
9
|
+
var dateOptions = [{
|
|
10
|
+
key: 'now',
|
|
11
|
+
value: 'now',
|
|
12
|
+
label: "{{t(\"Now\")}}",
|
|
13
|
+
disabled: schema['x-component'] !== 'DatePicker' || operatorValue === '$dateBetween'
|
|
14
|
+
}, {
|
|
15
|
+
key: 'yesterday',
|
|
16
|
+
value: 'yesterday',
|
|
17
|
+
label: "{{t(\"Yesterday\")}}",
|
|
18
|
+
disabled: disabled
|
|
19
|
+
}, {
|
|
20
|
+
key: 'today',
|
|
21
|
+
value: 'today',
|
|
22
|
+
label: "{{t(\"Today\")}}",
|
|
23
|
+
disabled: disabled
|
|
24
|
+
}, {
|
|
25
|
+
key: 'tomorrow',
|
|
26
|
+
value: 'tomorrow',
|
|
27
|
+
label: "{{t(\"Tomorrow\")}}",
|
|
28
|
+
disabled: disabled
|
|
29
|
+
}, {
|
|
30
|
+
key: 'lastIsoWeek',
|
|
31
|
+
value: 'lastIsoWeek',
|
|
32
|
+
label: "{{t(\"Last week\")}}",
|
|
33
|
+
disabled: disabled
|
|
34
|
+
}, {
|
|
35
|
+
key: 'thisIsoWeek',
|
|
36
|
+
value: 'thisIsoWeek',
|
|
37
|
+
label: "{{t(\"This week\")}}",
|
|
38
|
+
disabled: disabled
|
|
39
|
+
}, {
|
|
40
|
+
key: 'nextIsoWeek',
|
|
41
|
+
value: 'nextIsoWeek',
|
|
42
|
+
label: "{{t(\"Next week\")}}",
|
|
43
|
+
disabled: disabled
|
|
44
|
+
}, {
|
|
45
|
+
key: 'lastMonth',
|
|
46
|
+
value: 'lastMonth',
|
|
47
|
+
label: "{{t(\"Last month\")}}",
|
|
48
|
+
disabled: disabled
|
|
49
|
+
}, {
|
|
50
|
+
key: 'thisMonth',
|
|
51
|
+
value: 'thisMonth',
|
|
52
|
+
label: "{{t(\"This month\")}}",
|
|
53
|
+
disabled: disabled
|
|
54
|
+
}, {
|
|
55
|
+
key: 'nextMonth',
|
|
56
|
+
value: 'nextMonth',
|
|
57
|
+
label: "{{t(\"Next month\")}}",
|
|
58
|
+
disabled: disabled
|
|
59
|
+
}, {
|
|
60
|
+
key: 'lastQuarter',
|
|
61
|
+
value: 'lastQuarter',
|
|
62
|
+
label: "{{t(\"Last quarter\")}}",
|
|
63
|
+
disabled: disabled
|
|
64
|
+
}, {
|
|
65
|
+
key: 'thisQuarter',
|
|
66
|
+
value: 'thisQuarter',
|
|
67
|
+
label: "{{t(\"This quarter\")}}",
|
|
68
|
+
disabled: disabled
|
|
69
|
+
}, {
|
|
70
|
+
key: 'nextQuarter',
|
|
71
|
+
value: 'nextQuarter',
|
|
72
|
+
label: "{{t(\"Next quarter\")}}",
|
|
73
|
+
disabled: disabled
|
|
74
|
+
}, {
|
|
75
|
+
key: 'lastYear',
|
|
76
|
+
value: 'lastYear',
|
|
77
|
+
label: "{{t(\"Last year\")}}",
|
|
78
|
+
disabled: disabled
|
|
79
|
+
}, {
|
|
80
|
+
key: 'thisYear',
|
|
81
|
+
value: 'thisYear',
|
|
82
|
+
label: "{{t(\"This year\")}}",
|
|
83
|
+
disabled: disabled
|
|
84
|
+
}, {
|
|
85
|
+
key: 'nextYear',
|
|
86
|
+
value: 'nextYear',
|
|
87
|
+
label: "{{t(\"Next year\")}}",
|
|
88
|
+
disabled: disabled
|
|
89
|
+
}, {
|
|
90
|
+
key: 'last7Days',
|
|
91
|
+
value: 'last7Days',
|
|
92
|
+
label: "{{t(\"Last 7 days\")}}",
|
|
93
|
+
disabled: disabled
|
|
94
|
+
}, {
|
|
95
|
+
key: 'next7Days',
|
|
96
|
+
value: 'next7Days',
|
|
97
|
+
label: "{{t(\"Next 7 days\")}}",
|
|
98
|
+
disabled: disabled
|
|
99
|
+
}, {
|
|
100
|
+
key: 'last30Days',
|
|
101
|
+
value: 'last30Days',
|
|
102
|
+
label: "{{t(\"Last 30 days\")}}",
|
|
103
|
+
disabled: disabled
|
|
104
|
+
}, {
|
|
105
|
+
key: 'next30Days',
|
|
106
|
+
value: 'next30Days',
|
|
107
|
+
label: "{{t(\"Next 30 days\")}}",
|
|
108
|
+
disabled: disabled
|
|
109
|
+
}, {
|
|
110
|
+
key: 'last90Days',
|
|
111
|
+
value: 'last90Days',
|
|
112
|
+
label: "{{t(\"Last 90 days\")}}",
|
|
113
|
+
disabled: disabled
|
|
114
|
+
}, {
|
|
115
|
+
key: 'next90Days',
|
|
116
|
+
value: 'next90Days',
|
|
117
|
+
label: "{{t(\"Next 90 days\")}}",
|
|
118
|
+
disabled: disabled
|
|
119
|
+
}];
|
|
120
|
+
return compile({
|
|
121
|
+
label: "{{t(\"Date variables\")}}",
|
|
122
|
+
value: '$date',
|
|
123
|
+
key: '$date',
|
|
124
|
+
disabled: dateOptions.every(function (option) {
|
|
125
|
+
return option.disabled;
|
|
126
|
+
}),
|
|
127
|
+
children: dateOptions
|
|
128
|
+
});
|
|
129
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useCompile, useGetFilterOptions } from '../../../schema-component';
|
|
3
|
+
var getChildren = function getChildren(options, _ref) {
|
|
4
|
+
var schema = _ref.schema,
|
|
5
|
+
operator = _ref.operator,
|
|
6
|
+
maxDepth = _ref.maxDepth,
|
|
7
|
+
_ref$count = _ref.count,
|
|
8
|
+
count = _ref$count === void 0 ? 1 : _ref$count,
|
|
9
|
+
getFilterOptions = _ref.getFilterOptions;
|
|
10
|
+
if (count > maxDepth) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
var result = options.map(function (option) {
|
|
14
|
+
if (option.type !== 'belongsTo' && option.type !== 'hasOne' || !option.target) {
|
|
15
|
+
var _option$schema;
|
|
16
|
+
return {
|
|
17
|
+
key: option.name,
|
|
18
|
+
value: option.name,
|
|
19
|
+
label: option.title,
|
|
20
|
+
// TODO: 现在是通过组件的名称来过滤能够被选择的选项,这样的坏处是不够精确,后续可以优化
|
|
21
|
+
disabled: (schema === null || schema === void 0 ? void 0 : schema['x-component']) !== ((_option$schema = option.schema) === null || _option$schema === void 0 ? void 0 : _option$schema['x-component'])
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
var children = getChildren(getFilterOptions(option.target), {
|
|
25
|
+
schema: schema,
|
|
26
|
+
operator: operator,
|
|
27
|
+
maxDepth: maxDepth,
|
|
28
|
+
count: count + 1,
|
|
29
|
+
getFilterOptions: getFilterOptions
|
|
30
|
+
}) || [];
|
|
31
|
+
return {
|
|
32
|
+
key: option.name,
|
|
33
|
+
value: option.name,
|
|
34
|
+
label: option.title,
|
|
35
|
+
children: children,
|
|
36
|
+
disabled: children.every(function (child) {
|
|
37
|
+
return child.disabled;
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
export var useUserVariable = function useUserVariable(_ref2) {
|
|
44
|
+
var operator = _ref2.operator,
|
|
45
|
+
schema = _ref2.schema,
|
|
46
|
+
level = _ref2.level;
|
|
47
|
+
var compile = useCompile();
|
|
48
|
+
var getFilterOptions = useGetFilterOptions();
|
|
49
|
+
var children = useMemo(function () {
|
|
50
|
+
return getChildren(getFilterOptions('users'), {
|
|
51
|
+
schema: schema,
|
|
52
|
+
operator: operator,
|
|
53
|
+
maxDepth: level || 3,
|
|
54
|
+
getFilterOptions: getFilterOptions
|
|
55
|
+
}) || [];
|
|
56
|
+
}, [operator, schema]);
|
|
57
|
+
return useMemo(function () {
|
|
58
|
+
return compile({
|
|
59
|
+
label: "{{t(\"Current user\")}}",
|
|
60
|
+
value: '$user',
|
|
61
|
+
key: '$user',
|
|
62
|
+
disabled: children.every(function (option) {
|
|
63
|
+
return option.disabled;
|
|
64
|
+
}),
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
}, [children]);
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useVariableOptions: () => any[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useValues } from '../../../schema-component/antd/filter/useValues';
|
|
2
|
+
import { useDateVariable } from './useDateVariable';
|
|
3
|
+
import { useUserVariable } from './useUserVariable';
|
|
4
|
+
export var useVariableOptions = function useVariableOptions() {
|
|
5
|
+
var _useValues = useValues(),
|
|
6
|
+
operator = _useValues.operator,
|
|
7
|
+
schema = _useValues.schema;
|
|
8
|
+
var userVariable = useUserVariable({
|
|
9
|
+
operator: operator,
|
|
10
|
+
schema: schema
|
|
11
|
+
});
|
|
12
|
+
var dateVariable = useDateVariable({
|
|
13
|
+
operator: operator,
|
|
14
|
+
schema: schema
|
|
15
|
+
});
|
|
16
|
+
if (!operator || !schema) return [];
|
|
17
|
+
return [userVariable, dateVariable];
|
|
18
|
+
};
|
|
@@ -10,13 +10,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { useTranslation } from
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { css } from '@emotion/css';
|
|
15
|
-
import { useAPIClient } from
|
|
16
|
-
import { useForm } from
|
|
17
|
-
import { useEffect, useRef, useState } from
|
|
18
|
-
import { Button, Input, message } from
|
|
19
|
-
import React from
|
|
15
|
+
import { useAPIClient } from '../api-client';
|
|
16
|
+
import { useForm } from '@formily/react';
|
|
17
|
+
import { useEffect, useRef, useState } from 'react';
|
|
18
|
+
import { Button, Input, message } from 'antd';
|
|
19
|
+
import React from 'react';
|
|
20
20
|
export default function VerificationCode(_ref) {
|
|
21
21
|
var _ref$targetFieldName = _ref.targetFieldName,
|
|
22
22
|
targetFieldName = _ref$targetFieldName === void 0 ? 'phone' : _ref$targetFieldName,
|
|
@@ -88,9 +88,8 @@ export default function VerificationCode(_ref) {
|
|
|
88
88
|
}));
|
|
89
89
|
return _onGetCode.apply(this, arguments);
|
|
90
90
|
}
|
|
91
|
-
;
|
|
92
91
|
return /*#__PURE__*/React.createElement("fieldset", {
|
|
93
|
-
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
92
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 0.5em;\n "])))
|
|
94
93
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
95
94
|
value: value,
|
|
96
95
|
onChange: onChange,
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
6
|
+
exports.FilterDynamicComponent = FilterDynamicComponent;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _schemaComponent = require("../../schema-component");
|
|
9
|
+
var _filter = require("../../schema-component/antd/filter");
|
|
10
|
+
var _useValues2 = require("../../schema-component/antd/filter/useValues");
|
|
11
|
+
var _variable = require("../../schema-component/antd/variable");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
13
|
var useOptions = function useOptions(collectionName, _ref) {
|
|
9
14
|
var schema = _ref.schema,
|
|
10
15
|
operator = _ref.operator,
|
|
@@ -48,7 +53,7 @@ var useUserVariable = function useUserVariable(_ref2) {
|
|
|
48
53
|
var options = useOptions('users', {
|
|
49
54
|
schema: schema,
|
|
50
55
|
operator: operator,
|
|
51
|
-
maxDepth:
|
|
56
|
+
maxDepth: 1
|
|
52
57
|
}) || [];
|
|
53
58
|
return {
|
|
54
59
|
label: "{{t(\"Current user\")}}",
|
|
@@ -60,4 +65,27 @@ var useUserVariable = function useUserVariable(_ref2) {
|
|
|
60
65
|
children: options
|
|
61
66
|
};
|
|
62
67
|
};
|
|
63
|
-
|
|
68
|
+
var useVariableOptions = function useVariableOptions() {
|
|
69
|
+
var _useValues = (0, _useValues2.useValues)(),
|
|
70
|
+
operator = _useValues.operator,
|
|
71
|
+
schema = _useValues.schema;
|
|
72
|
+
var userVariable = useUserVariable({
|
|
73
|
+
schema: schema,
|
|
74
|
+
operator: operator
|
|
75
|
+
});
|
|
76
|
+
if (!operator || !schema) return [];
|
|
77
|
+
return [userVariable];
|
|
78
|
+
};
|
|
79
|
+
function FilterDynamicComponent(props) {
|
|
80
|
+
var value = props.value,
|
|
81
|
+
onChange = props.onChange,
|
|
82
|
+
renderSchemaComponent = props.renderSchemaComponent;
|
|
83
|
+
var options = useVariableOptions();
|
|
84
|
+
var compile = (0, _schemaComponent.useCompile)();
|
|
85
|
+
var scope = compile(options);
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_variable.Variable.Input, {
|
|
87
|
+
value: value,
|
|
88
|
+
onChange: onChange,
|
|
89
|
+
scope: scope
|
|
90
|
+
}, renderSchemaComponent());
|
|
91
|
+
}
|
|
@@ -7,6 +7,7 @@ exports.scopesSchema = exports.rolesResourcesScopesCollection = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _blockProvider = require("../../../block-provider");
|
|
9
9
|
var _schemaComponent = require("../../../schema-component");
|
|
10
|
+
var _FilterDynamicComponent = require("../FilterDynamicComponent");
|
|
10
11
|
var _RolesResourcesActions = require("../RolesResourcesActions");
|
|
11
12
|
var rolesResourcesScopesCollection = {
|
|
12
13
|
name: 'rolesResourcesScopes',
|
|
@@ -146,6 +147,7 @@ var scopesSchema = {
|
|
|
146
147
|
'x-decorator': 'FormItem',
|
|
147
148
|
'x-component': 'Filter',
|
|
148
149
|
'x-component-props': {
|
|
150
|
+
dynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
|
|
149
151
|
useProps: function useProps() {
|
|
150
152
|
var ctx = (0, _react.useContext)(_RolesResourcesActions.RoleResourceCollectionContext);
|
|
151
153
|
var options = (0, _schemaComponent.useFilterOptions)(ctx.name);
|
|
@@ -274,6 +276,7 @@ var scopesSchema = {
|
|
|
274
276
|
'x-decorator': 'FormItem',
|
|
275
277
|
'x-component': 'Filter',
|
|
276
278
|
'x-component-props': {
|
|
279
|
+
dynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
|
|
277
280
|
useProps: function useProps() {
|
|
278
281
|
var ctx = (0, _react.useContext)(_RolesResourcesActions.RoleResourceCollectionContext);
|
|
279
282
|
var options = (0, _schemaComponent.useFilterOptions)(ctx.name);
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export declare const useRoleResourceValues: (options: any) =>
|
|
2
|
-
state: {};
|
|
3
|
-
setState: import("ahooks/lib/useSetState").SetState<{}>;
|
|
4
|
-
loading: boolean;
|
|
5
|
-
data?: any;
|
|
6
|
-
error?: Error;
|
|
7
|
-
params: any;
|
|
8
|
-
cancel: () => void;
|
|
9
|
-
refresh: () => void;
|
|
10
|
-
refreshAsync: () => Promise<any>;
|
|
11
|
-
run: (...params: any) => void;
|
|
12
|
-
runAsync: (...params: any) => Promise<any>;
|
|
13
|
-
mutate: (data?: any) => void;
|
|
14
|
-
};
|
|
1
|
+
export declare const useRoleResourceValues: (options: any) => any;
|
|
@@ -9,18 +9,5 @@ export declare type ResourceActionOptions<P = any> = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function useRequest<P>(service: AxiosRequestConfig<P> | ResourceActionOptions<P> | FunctionService, options?: Options<any, any> & {
|
|
11
11
|
uid?: string;
|
|
12
|
-
}):
|
|
13
|
-
state: {};
|
|
14
|
-
setState: import("ahooks/lib/useSetState").SetState<{}>;
|
|
15
|
-
loading: boolean;
|
|
16
|
-
data?: any;
|
|
17
|
-
error?: Error;
|
|
18
|
-
params: any;
|
|
19
|
-
cancel: () => void;
|
|
20
|
-
refresh: () => void;
|
|
21
|
-
refreshAsync: () => Promise<any>;
|
|
22
|
-
run: (...params: any) => void;
|
|
23
|
-
runAsync: (...params: any) => Promise<any>;
|
|
24
|
-
mutate: (data?: any) => void;
|
|
25
|
-
};
|
|
12
|
+
}): any;
|
|
26
13
|
export {};
|
|
@@ -13,14 +13,14 @@ var _react = require("react");
|
|
|
13
13
|
var _context2 = require("../context");
|
|
14
14
|
var _assign = require("./assign");
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
17
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
19
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; }
|
|
20
17
|
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; }
|
|
21
18
|
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; }
|
|
22
19
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
20
|
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); }
|
|
21
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
22
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
26
|
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); }
|
|
@@ -35,64 +35,59 @@ function useRequest(service) {
|
|
|
35
35
|
state = _useSetState2[0],
|
|
36
36
|
setState = _useSetState2[1];
|
|
37
37
|
var api = (0, _react.useContext)(_context2.APIClientContext);
|
|
38
|
+
var tempOptions, tempService;
|
|
38
39
|
if (typeof service === 'function') {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (resource) {
|
|
69
|
-
args.params = args.params || {};
|
|
70
|
-
(0, _assign.assign)(args.params, params);
|
|
71
|
-
} else {
|
|
72
|
-
args = (0, _shared.merge)(args, params);
|
|
40
|
+
tempService = service;
|
|
41
|
+
} else {
|
|
42
|
+
tempService = /*#__PURE__*/function () {
|
|
43
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
44
|
+
var params,
|
|
45
|
+
resource,
|
|
46
|
+
args,
|
|
47
|
+
response,
|
|
48
|
+
_args = arguments;
|
|
49
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
|
+
while (1) switch (_context.prev = _context.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
53
|
+
resource = service.resource;
|
|
54
|
+
args = (0, _cloneDeep.default)(service);
|
|
55
|
+
if (resource) {
|
|
56
|
+
args.params = args.params || {};
|
|
57
|
+
(0, _assign.assign)(args.params, params);
|
|
58
|
+
} else {
|
|
59
|
+
args = (0, _shared.merge)(args, params);
|
|
60
|
+
}
|
|
61
|
+
_context.next = 6;
|
|
62
|
+
return api.request(args);
|
|
63
|
+
case 6:
|
|
64
|
+
response = _context.sent;
|
|
65
|
+
return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
|
66
|
+
case 8:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context.stop();
|
|
73
69
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}, _callee);
|
|
84
|
-
})), _objectSpread(_objectSpread({}, options), {}, {
|
|
70
|
+
}, _callee);
|
|
71
|
+
}));
|
|
72
|
+
return function tempService() {
|
|
73
|
+
return _ref.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
}
|
|
77
|
+
tempOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
85
78
|
onSuccess: function onSuccess() {
|
|
86
|
-
var _options$
|
|
87
|
-
for (var
|
|
88
|
-
args[
|
|
79
|
+
var _options$onSuccess;
|
|
80
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
81
|
+
args[_key] = arguments[_key];
|
|
89
82
|
}
|
|
90
|
-
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
(_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call.apply(_options$onSuccess, [options].concat(args));
|
|
91
85
|
if (options.uid) {
|
|
92
86
|
api.services[options.uid] = result;
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
|
-
})
|
|
89
|
+
});
|
|
90
|
+
var result = (0, _useRequest.default)(tempService, tempOptions);
|
|
96
91
|
return _objectSpread(_objectSpread({}, result), {}, {
|
|
97
92
|
state: state,
|
|
98
93
|
setState: setState
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getCurrentTimezone = exports.Application = void 0;
|
|
8
8
|
var _antd = require("antd");
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
10
11
|
var _reactI18next = require("react-i18next");
|
|
11
12
|
var _reactRouterDom = require("react-router-dom");
|
|
12
13
|
var _acl = require("../acl");
|
|
@@ -19,6 +20,7 @@ var _pluginManager = require("../plugin-manager");
|
|
|
19
20
|
var _pm = _interopRequireWildcard(require("../pm"));
|
|
20
21
|
var _routeSwitch = require("../route-switch");
|
|
21
22
|
var _schemaComponent = require("../schema-component");
|
|
23
|
+
var _errorFallback = require("../schema-component/antd/error-fallback");
|
|
22
24
|
var _schemaInitializer = require("../schema-initializer");
|
|
23
25
|
var _schemaTemplates = require("../schema-templates");
|
|
24
26
|
var _systemSettings = require("../system-settings");
|
|
@@ -165,6 +167,11 @@ var Application = /*#__PURE__*/function () {
|
|
|
165
167
|
value: function plugin(_plugin) {
|
|
166
168
|
this.plugins.push(_plugin);
|
|
167
169
|
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "handleErrors",
|
|
172
|
+
value: function handleErrors(error) {
|
|
173
|
+
console.error(error);
|
|
174
|
+
}
|
|
168
175
|
}, {
|
|
169
176
|
key: "render",
|
|
170
177
|
value: function render() {
|
|
@@ -235,9 +242,12 @@ var Application = /*#__PURE__*/function () {
|
|
|
235
242
|
if (loading) {
|
|
236
243
|
return /*#__PURE__*/_react.default.createElement(_antd.Spin, null);
|
|
237
244
|
}
|
|
238
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
245
|
+
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
246
|
+
FallbackComponent: _errorFallback.ErrorFallback,
|
|
247
|
+
onError: _this.handleErrors
|
|
248
|
+
}, /*#__PURE__*/_react.default.createElement(App, {
|
|
239
249
|
providers: _this.providers
|
|
240
|
-
});
|
|
250
|
+
}));
|
|
241
251
|
};
|
|
242
252
|
}
|
|
243
253
|
}]);
|
|
@@ -7,6 +7,7 @@ exports.useFormFieldProps = exports.useFormFieldContext = exports.WithoutFormFie
|
|
|
7
7
|
var _core = require("@formily/core");
|
|
8
8
|
var _react = require("@formily/react");
|
|
9
9
|
var _reactive = require("@formily/reactive");
|
|
10
|
+
var _client = require("@nocobase/utils/client");
|
|
10
11
|
var _antd = require("antd");
|
|
11
12
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _recordProvider = require("../record-provider");
|
|
@@ -48,7 +49,14 @@ var InternalFormFieldProvider = function InternalFormFieldProvider(props) {
|
|
|
48
49
|
(0, _react2.useEffect)(function () {
|
|
49
50
|
var dispose = (0, _reactive.autorun)(function () {
|
|
50
51
|
var _formBlockCtx$form2;
|
|
51
|
-
|
|
52
|
+
var data = (formBlockCtx === null || formBlockCtx === void 0 ? void 0 : (_formBlockCtx$form2 = formBlockCtx.form) === null || _formBlockCtx$form2 === void 0 ? void 0 : _formBlockCtx$form2.values[fieldName]) || {};
|
|
53
|
+
// 先清空表单值,再赋值,避免当值为空时,表单未被清空
|
|
54
|
+
form.reset();
|
|
55
|
+
(0, _client.forEach)(data, function (value, key) {
|
|
56
|
+
if (value) {
|
|
57
|
+
form.values[key] = value;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
52
60
|
});
|
|
53
61
|
return dispose;
|
|
54
62
|
}, []);
|