From d99bd8f4a543438d507aad55a7584e64901edf72 Mon Sep 17 00:00:00 2001 From: sealday Date: Thu, 13 Jun 2024 15:56:43 +0800 Subject: [PATCH] fix: workflow executions not show and format codes (#1184) Co-authored-by: sealday Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1184 --- packages/core/app/client/.umirc.ts | 12 +- .../core/app/client/public/browser-checker.js | 186 ++--- .../client/public/favicon/site.webmanifest | 12 +- packages/core/app/src/config/plugins.ts | 2 +- packages/core/app/src/index.ts | 1 + packages/core/build/src/build.ts | 27 +- packages/core/build/src/buildCjs.ts | 50 +- packages/core/build/src/buildClient.ts | 3 +- packages/core/build/src/buildEsm.ts | 20 +- packages/core/build/src/buildPlugin.ts | 128 ++-- packages/core/build/src/constant.ts | 3 +- packages/core/build/src/index.d.ts | 5 +- packages/core/build/src/index.ts | 2 +- packages/core/build/src/tarPlugin.ts | 21 +- .../core/build/src/utils/buildPluginUtils.ts | 11 +- .../core/build/src/utils/getDepsConfig.ts | 28 +- packages/core/build/src/utils/getPackages.ts | 9 +- packages/core/build/src/utils/utils.ts | 14 +- packages/core/build/tsup.config.ts | 6 +- packages/core/cli/rollup.config.js | 7 +- packages/core/cli/src/cli.ts | 6 +- packages/core/cli/src/commands/build.ts | 4 +- packages/core/cli/src/commands/clean.ts | 3 +- .../cli/src/commands/create-nginx-conf.ts | 5 +- .../core/cli/src/commands/create-plugin.ts | 2 + packages/core/cli/src/commands/dev.ts | 3 +- packages/core/cli/src/commands/e2e.ts | 12 +- packages/core/cli/src/commands/global.ts | 3 +- packages/core/cli/src/commands/index.ts | 17 +- packages/core/cli/src/commands/p-test.ts | 7 +- packages/core/cli/src/commands/pm2.ts | 1 + packages/core/cli/src/commands/postinstall.ts | 10 +- packages/core/cli/src/commands/start.ts | 6 +- packages/core/cli/src/commands/tar.ts | 4 +- packages/core/cli/src/commands/test.ts | 6 +- packages/core/cli/src/commands/umi.ts | 3 +- packages/core/cli/src/commands/upgrade.ts | 8 +- packages/core/cli/src/plugin-generator.ts | 14 +- packages/core/cli/src/util.ts | 37 +- .../api-client/__tests__/APIClient.test.tsx | 1 + .../client/src/api-client/demos/demo1.tsx | 5 +- .../client/src/api-client/demos/demo2.tsx | 5 +- .../client/src/api-client/demos/demo3.tsx | 5 +- .../__tests__/Application.test.tsx | 4 +- .../__tests__/PluginSettingsManager.test.ts | 3 +- .../__tests__/RouterManager.test.tsx | 8 +- .../__tests__/SchemaToolbar.test.tsx | 9 +- .../hoc/withDynamicSchemaProps.test.tsx | 3 +- .../src/application/__tests__/utils.test.tsx | 4 +- .../core/client/src/application/context.ts | 1 + .../schema-initializer/SchemaInitializer.tsx | 1 + .../SchemaInitializerManager.ts | 1 + .../SchemaInitializerActionModal.tsx | 5 +- .../components/SchemaInitializerButton.tsx | 4 +- .../components/SchemaInitializerChildren.tsx | 1 + .../components/SchemaInitializerDivider.tsx | 3 +- .../components/SchemaInitializerItem.tsx | 4 +- .../components/SchemaInitializerItemGroup.tsx | 4 +- .../components/SchemaInitializerItems.tsx | 6 +- .../components/SchemaInitializerSelect.tsx | 6 +- .../components/SchemaInitializerSwitch.tsx | 6 +- .../schema-initializer/context/index.ts | 1 + .../hooks/useAriaAttributeOfMenuItem.ts | 1 + .../application/schema-initializer/types.ts | 6 +- .../SchemaSettingsDefaults.tsx | 14 +- .../components/SchemaSettingsIcon.tsx | 4 +- .../components/SchemaSettingsWrapper.tsx | 8 +- .../schema-settings/context/index.ts | 1 + .../src/application/schema-settings/types.ts | 1 + .../schema-toolbar/context/index.tsx | 3 +- .../schema-toolbar/hooks/index.tsx | 1 + .../client/src/application/utils/requirejs.ts | 636 ++++++++++-------- .../CollectionProvider_deprecated.tsx | 8 +- .../Configuration/AddCollectionAction.tsx | 11 +- .../Configuration/AddFieldAction.tsx | 11 +- .../Configuration/AddSubFieldAction.tsx | 9 +- .../Configuration/EditCollectionAction.tsx | 9 +- .../Configuration/EditFieldAction.tsx | 9 +- .../Configuration/EditSubFieldAction.tsx | 9 +- .../OverridingCollectionField.tsx | 9 +- .../Configuration/SyncFieldsAction.tsx | 11 +- .../Configuration/SyncSQLFieldsAction.tsx | 14 +- .../Configuration/ViewInheritedField.tsx | 7 +- .../components/CollectionCategory.tsx | 6 +- .../CollectionFieldInterfaceTag.tsx | 6 +- .../components/CollectionTemplateTag.tsx | 6 +- .../Configuration/components/FieldSummary.tsx | 2 + .../Configuration/components/Summary.tsx | 4 +- .../components/TemplateSummary.tsx | 2 + .../Configuration/components/index.tsx | 9 +- .../Configuration/interfaces.tsx | 3 +- .../ResourceActionProvider.tsx | 6 +- .../src/collection-manager/demos/demo2.tsx | 6 +- .../src/collection-manager/demos/demo3.tsx | 1 + .../src/collection-manager/demos/demo4.tsx | 4 +- .../src/collection-manager/demos/demo5.tsx | 14 +- .../hooks/useCollectionManager_deprecated.ts | 16 +- .../hooks/useCollection_deprecated.ts | 7 +- .../interfaces/__tests__/json.tsx | 3 +- .../collection-manager/interfaces/checkbox.ts | 1 + .../interfaces/checkboxGroup.ts | 3 +- .../interfaces/chinaRegion.ts | 3 +- .../interfaces/collection.ts | 3 +- .../interfaces/components/index.tsx | 3 +- .../interfaces/createdBy.ts | 2 + .../collection-manager/interfaces/email.ts | 3 +- .../collection-manager/interfaces/input.ts | 8 +- .../collection-manager/interfaces/integer.ts | 5 +- .../collection-manager/interfaces/json.tsx | 5 +- .../collection-manager/interfaces/linkTo.ts | 4 +- .../src/collection-manager/interfaces/m2m.tsx | 4 +- .../src/collection-manager/interfaces/m2o.tsx | 1 + .../collection-manager/interfaces/markdown.ts | 3 +- .../interfaces/multipleSelect.ts | 3 +- .../collection-manager/interfaces/nanoid.ts | 1 + .../src/collection-manager/interfaces/o2m.tsx | 1 + .../src/collection-manager/interfaces/o2o.tsx | 1 + .../collection-manager/interfaces/percent.ts | 6 +- .../collection-manager/interfaces/phone.ts | 2 +- .../interfaces/properties/index.ts | 5 +- .../collection-manager/interfaces/richText.ts | 3 +- .../collection-manager/interfaces/select.ts | 3 +- .../src/collection-manager/interfaces/sort.ts | 1 + .../collection-manager/interfaces/subTable.ts | 6 +- .../collection-manager/interfaces/textarea.ts | 3 +- .../interfaces/updatedBy.ts | 2 + .../src/collection-manager/interfaces/url.ts | 3 +- .../mixins/InheritanceCollectionMixin.ts | 3 +- .../templates/components/PresetFields.tsx | 6 +- .../templates/components/PreviewFields.tsx | 4 +- .../templates/components/PreviewTable.tsx | 6 +- .../sql-collection/FieldsConfigure.tsx | 19 +- .../sql-collection/PreviewTable.tsx | 6 +- .../src/collection-manager/templates/sql.tsx | 7 +- .../src/collection-manager/templates/types.ts | 5 +- .../client/src/collection-manager/types.ts | 3 +- .../collection-field/CollectionField.test.tsx | 7 +- .../CollectionFieldProvider.test.tsx | 9 +- .../CollectionRecordProvider.test.tsx | 7 +- .../CollectionTemplateManager.test.ts | 2 +- .../collection/AssociationProvider.test.tsx | 11 +- .../__tests__/collection/Collection.test.tsx | 1 + .../collection/CollectionManager.test.tsx | 5 +- .../CollectionManagerProvider.test.tsx | 11 +- .../collection/CollectionProvider.test.tsx | 11 +- .../ExtendCollectionsProvider.test.tsx | 8 +- .../CollectionDeletedPlaceholder.test.tsx | 3 +- .../data-block/DataBlockProvider.test.tsx | 11 +- ...sociation-table-list-and-parent-record.tsx | 4 +- .../association-table-list-and-source-id.tsx | 3 +- .../collection-form-create.tsx | 4 +- .../collection-form-get-and-update.tsx | 5 +- .../collection-form-record-and-update.tsx | 6 +- .../collection-table-list.tsx | 4 +- .../data-block/data-block-demos/createApp.tsx | 10 +- .../CollectionDataSourceProvider.test.tsx | 2 +- .../__tests__/data-source/DataSource.test.ts | 2 +- .../data-source/DataSourceManager.test.ts | 1 + .../DataSourceManagerProvider.test.tsx | 3 +- .../data-source/DataSourceProvider.test.tsx | 9 +- .../src/data-source/__tests__/utils.test.ts | 3 +- .../CollectionFieldInterface.ts | 1 + .../CollectionRecordProvider.tsx | 3 +- .../collection-template/CollectionTemplate.ts | 5 +- .../collection/AssociationProvider.tsx | 3 +- .../collection/CollectionManager.ts | 10 +- .../collection/CollectionManagerProvider.tsx | 7 +- .../collection/ExtendCollectionsProvider.tsx | 5 +- .../CollectionDeletedPlaceholder.tsx | 10 +- .../DataSourceApplicationProvider.tsx | 9 +- .../filter-provider/__tests__/useFilter.tsx | 4 +- .../__tests__/flag-provider.test.tsx | 3 +- .../client/src/flag-provider/hooks/useFlag.ts | 1 + .../client/src/icon/__tests__/icon.test.tsx | 3 +- .../core/client/src/icon/demos/antd-icon.tsx | 2 +- .../client/src/icon/demos/custom-icon.tsx | 2 +- .../core/client/src/icon/demos/iconfont.tsx | 2 +- .../client/src/icon/demos/register-icon.tsx | 2 +- .../modules/actions/ActionSchemaToolbar.tsx | 1 + .../add-child/CreateChildInitializer.tsx | 2 + .../add-child/addChildActionSettings.tsx | 5 +- .../add-new/CreateActionInitializer.tsx | 1 + .../actions/add-new/addNewActionSettings.tsx | 1 + .../CustomizeAddRecordActionInitializer.tsx | 1 + .../BulkDestroyActionInitializer.tsx | 2 +- .../disassociate/__e2e__/disassociate.test.ts | 3 +- .../ExpandableActionInitializer.tsx | 1 + .../expendableActionSettings.tsx | 4 +- .../actions/filter/filterActionSettings.tsx | 2 + .../refresh/RefreshActionInitializer.tsx | 1 + .../SaveRecordActionInitializer.tsx | 3 +- .../customizeSaveRecordActionSettings.tsx | 4 +- .../submit/CreateSubmitActionInitializer.tsx | 1 + .../submit/createSubmitActionSettings.tsx | 11 +- .../submit/updateSubmitActionSettings.tsx | 4 +- .../UpdateRecordActionInitializer.tsx | 3 +- .../customizeUpdateRecordActionSettings.tsx | 4 +- .../PopupActionInitializer.tsx | 1 + .../details-multi/DetailsBlockInitializer.tsx | 6 +- .../createDetailsWithPaginationUISchema.ts | 3 +- .../detailsWithPaginationSettings.tsx | 4 +- .../setDataLoadingModeSettingsItem.tsx | 10 +- .../ReadPrettyFormItemInitializers.tsx | 4 +- .../RecordReadPrettyFormBlockInitializer.tsx | 4 +- .../__e2e__/schemaInitializer.test.ts | 2 +- .../details-single/createDetailsUISchema.ts | 3 +- .../details-single/detailsBlockSettings.ts | 3 +- .../hooks/useDetailsDecoratorProps.ts | 1 + .../form/CreateFormBlockInitializer.tsx | 3 +- .../data-blocks/form/FormBlockInitializer.tsx | 4 +- .../form/FormItemSchemaToolbar.tsx | 1 + .../form/RecordFormBlockInitializer.tsx | 4 +- .../__e2e__/form-edit/schemaSettings.test.ts | 2 +- .../createCreateFormBlockUISchema.test.ts | 2 +- .../createEditFormBlockUISchema.test.ts | 2 + .../form/createCreateFormBlockUISchema.ts | 3 +- .../form/createFormBlockSettings.tsx | 1 + .../data-blocks/form/editFormBlockSettings.ts | 1 + .../data-blocks/form/formItemInitializers.tsx | 4 +- .../hooks/useEditFormBlockDecoratorProps.ts | 1 + .../grid-card/GridCardBlockInitializer.tsx | 6 +- .../hooks/useGridCardBlockDecoratorProps.ts | 2 +- .../grid-card/hooks/useGridCardBlockParams.ts | 3 +- .../data-blocks/list/ListBlockInitializer.tsx | 6 +- .../data-blocks/list/listBlockSettings.ts | 2 + .../TableSelectorInitializer.tsx | 5 +- .../__e2e__/schemaInitializer.test.ts | 3 +- .../__e2e__/schemaSettings.test.ts | 5 +- .../table-selector/__e2e__/utils.ts | 2 +- .../tableSelectorBlockSettings.ts | 4 +- .../table/TableActionColumnInitializers.tsx | 8 +- .../table/TableActionInitializers.tsx | 1 + .../table/TableBlockInitializer.tsx | 6 +- .../table/TableColumnInitializers.tsx | 8 +- .../table/TableColumnSchemaToolbar.tsx | 1 + .../table/__e2e__/schemaInitializer.test.ts | 1 + .../table/__e2e__/schemaSettings.test.ts | 2 +- .../table/__e2e__/tree/schemaSettings.test.ts | 2 +- .../hooks/useTableBlockDecoratorProps.ts | 5 +- .../data-blocks/table/tableBlockSettings.tsx | 27 +- .../blocks/data-blocks/table/utils.tsx | 4 +- .../collapse/CollapseItemSchemaToolbar.tsx | 1 + .../FilterCollapseBlockInitializer.tsx | 7 +- .../createFilterCollapseBlockSchema.ts | 3 +- .../collapse/filterCollapseBlockSettings.ts | 2 + .../filterCollapseItemFieldSettings.ts | 4 +- .../form/FilterFormBlockInitializer.tsx | 8 +- .../form/createFilterFormBlockSchema.ts | 3 +- .../form/filterFormBlockSettings.ts | 2 + .../form/filterFormItemFieldSettings.ts | 7 +- .../form/filterFormItemInitializers.tsx | 10 +- .../markdown/MarkdownBlockInitializer.tsx | 3 +- .../markdown/MarkdownFormItemInitializer.tsx | 4 +- .../markdown/markdownBlockSettings.ts | 2 + .../dialog/__e2e__/schemaInitializer.test.ts | 3 +- .../dialog/__e2e__/schemaSettings.test.ts | 2 +- .../cascadeSelectComponentFieldSettings.tsx | 7 +- .../cascaderComponentFieldSettings.tsx | 17 +- .../DatePicker/__e2e__/schemaSettings.test.ts | 4 +- .../drawerSubTableComponentFieldSettings.tsx | 7 +- .../fileManagerComponentFieldSettings.tsx | 9 +- ...uploadAttachmentComponentFieldSettings.tsx | 5 +- .../inputNumberComponentFieldSettings.tsx | 6 +- .../Nester/subformComponentFieldSettings.tsx | 9 +- .../recordPickerComponentFieldSettings.tsx | 7 +- .../subformPopoverComponentFieldSettings.tsx | 7 +- .../Tag/tagComponentFieldSettings.tsx | 9 +- .../unixTimestampComponentFieldSettings.tsx | 3 +- .../CollectionFieldInitializer.tsx | 4 +- .../TableCollectionFieldInitializer.tsx | 2 +- .../menu/__e2e__/schemaSettings.test.ts | 2 +- .../src/modules/menu/menuItemInitializer.tsx | 2 +- .../page/__e2e__/blockInitializers.test.ts | 2 +- .../page/__e2e__/schemaSettings.test.ts | 2 +- .../antd/__builtins__/hooks/index.ts | 1 - .../antd/__builtins__/hooks/useConfig.ts | 3 +- .../antd/__builtins__/hooks/usePrefixCls.ts | 3 +- .../antd/__builtins__/index.ts | 1 - .../antd/__builtins__/portal.tsx | 6 +- .../antd/__builtins__/render.ts | 1 + .../antd/action/Action.Link.tsx | 6 +- .../antd/action/__tests__/action.test.tsx | 3 +- .../antd/action/demos/demo1.tsx | 4 +- .../antd/action/demos/demo2.tsx | 4 +- .../antd/action/demos/demo3.tsx | 8 +- .../antd/action/demos/demo4.tsx | 4 +- .../antd/action/demos/demo5.tsx | 16 +- .../antd/action/demos/demo6.tsx | 5 +- .../action/hooks/useGetAriaLabelOfAction.ts | 3 +- .../action/hooks/useGetAriaLabelOfDrawer.ts | 3 +- .../action/hooks/useGetAriaLabelOfModal.ts | 3 +- .../action/hooks/useGetAriaLabelOfPopover.ts | 3 +- .../action/hooks/useSetAriaLabelForDrawer.ts | 1 + .../action/hooks/useSetAriaLabelForModal.ts | 1 + .../action/hooks/useSetAriaLabelForPopover.ts | 1 + .../src/schema-component/antd/action/utils.ts | 2 + .../AssociationFieldProvider.tsx | 6 +- .../antd/association-field/Editable.tsx | 12 +- .../antd/association-field/FileManager.tsx | 8 +- .../InternalCascadeSelect.tsx | 18 +- .../antd/association-field/InternalTag.tsx | 8 +- .../antd/association-field/ReadPretty.tsx | 3 +- .../antd/association-field/context.ts | 2 +- .../antd/association-field/hooks.ts | 10 +- .../antd/association-field/util.ts | 8 +- .../ActionBarAssociationFilterAction.tsx | 6 +- .../AssociationFilter.BlockDesigner.tsx | 4 +- .../AssociationFilter.Item.Designer.tsx | 8 +- .../AssociationFilterDesignerDelete.tsx | 4 +- .../AssociationFilterDesignerDisplayField.tsx | 4 +- .../association-select/AssociationSelect.tsx | 20 +- .../antd/association-select/ReadPretty.tsx | 3 +- .../__tests__/association-select.test.tsx | 3 +- .../antd/association-select/demos/demo1.tsx | 3 +- .../association-select/useServiceOptions.ts | 3 +- .../antd/auto-complete/AutoComplete.tsx | 2 + .../antd/block-item/demos/demo1.tsx | 5 +- .../antd/cascader/Cascader.tsx | 10 +- .../antd/cascader/ReadPretty.tsx | 5 +- .../antd/cascader/__tests__/cascader.test.tsx | 3 +- .../antd/cascader/demos/demo1.tsx | 4 +- .../antd/cascader/demos/demo2.tsx | 9 +- .../antd/checkbox/__tests__/checkbox.test.tsx | 3 +- .../antd/checkbox/demos/checkbox.group.tsx | 4 +- .../antd/checkbox/demos/checkbox.tsx | 4 +- .../collection-select/CollectionSelect.tsx | 10 +- .../__tests__/collection-select.test.tsx | 3 +- .../antd/collection-select/demos/demo1.tsx | 5 +- .../antd/color-picker/demos/demo1.tsx | 4 +- .../antd/color-select/ColorSelect.tsx | 8 +- .../__tests__/color-select.test.tsx | 3 +- .../antd/color-select/demos/demo1.tsx | 4 +- .../schema-component/antd/cron/CronSet.tsx | 6 +- .../antd/cron/__tests__/cron-set.test.tsx | 3 +- .../antd/cron/demos/demo1.tsx | 5 +- .../antd/cron/demos/demo2.tsx | 5 +- .../antd/custom-cascader/CustomCascader.tsx | 10 +- .../antd/custom-cascader/ReadPretty.tsx | 5 +- .../antd/date-picker/ReadPretty.tsx | 4 +- .../__tests__/date-picker.test.tsx | 5 +- .../__tests__/getDateRanges.test.ts | 1 + .../__tests__/mapDatePicker.test.ts | 3 +- .../__tests__/mapRangePicker.test.ts | 3 +- .../antd/date-picker/__tests__/util.test.ts | 2 + .../antd/date-picker/demos/demo1.tsx | 4 +- .../antd/date-picker/demos/demo10.tsx | 4 +- .../antd/date-picker/demos/demo11.tsx | 4 +- .../antd/date-picker/demos/demo2.tsx | 4 +- .../antd/date-picker/demos/demo3.tsx | 4 +- .../antd/date-picker/demos/demo4.tsx | 7 +- .../antd/date-picker/demos/demo5.tsx | 7 +- .../antd/date-picker/demos/demo6.tsx | 7 +- .../antd/date-picker/demos/demo7.tsx | 4 +- .../antd/date-picker/demos/demo8.tsx | 4 +- .../antd/date-picker/demos/demo9.tsx | 4 +- .../schema-component/antd/details/Details.tsx | 8 +- .../antd/details/__tests__/details.test.tsx | 3 +- .../antd/details/demos/demo1.tsx | 4 +- .../antd/error-fallback/ErrorFallback.tsx | 3 +- .../antd/error-fallback/demos/demo1.tsx | 2 + .../expand-action/Expand.Action.Design.tsx | 4 +- .../antd/filter/DynamicComponent.tsx | 5 +- .../antd/filter/Filter.Action.Designer.tsx | 4 +- .../schema-component/antd/filter/Filter.tsx | 8 +- .../antd/filter/FilterGroup.tsx | 16 +- .../antd/filter/FilterItems.tsx | 11 +- .../schema-component/antd/filter/context.ts | 3 +- .../antd/filter/demos/demo2.tsx | 2 +- .../antd/filter/demos/demo3.tsx | 4 +- .../antd/filter/demos/demo4.tsx | 5 +- .../antd/filter/demos/demo5.tsx | 4 +- .../antd/filter/demos/demo6.tsx | 10 +- .../src/schema-component/antd/filter/index.ts | 1 - .../antd/filter/useFilterActionProps.ts | 7 +- .../antd/filter/useOperators.ts | 5 +- .../schema-component/antd/filter/useValues.ts | 7 +- .../antd/form-v2/Form.Designer.tsx | 1 + .../antd/form-v2/Form.FilterDesigner.tsx | 1 + .../antd/form-v2/Form.Settings.tsx | 4 +- .../antd/form-v2/FormField.tsx | 3 +- .../antd/form-v2/Templates.tsx | 6 +- .../antd/form-v2/__tests__/form-v2.test.tsx | 3 +- .../antd/form-v2/demos/demo1.tsx | 8 +- .../antd/form-v2/demos/demo2.tsx | 6 +- .../antd/form-v2/demos/demo3.tsx | 5 +- .../schema-component/antd/form-v2/index.ts | 1 + .../antd/form/Form.Designer.tsx | 1 + .../src/schema-component/antd/form/Form.tsx | 15 +- .../antd/form/demos/apiClient.ts | 1 + .../antd/form/demos/demo1.tsx | 4 +- .../antd/form/demos/demo2.tsx | 5 +- .../antd/form/demos/demo3.tsx | 5 +- .../antd/form/demos/demo4.tsx | 4 +- .../antd/form/demos/demo5.tsx | 10 +- .../antd/form/demos/demo6.tsx | 5 +- .../antd/form/demos/demo7.tsx | 5 +- .../antd/grid-card/GridCard.Designer.tsx | 8 +- .../grid-card/__tests__/grid-card.test.tsx | 3 +- .../src/schema-component/antd/grid/Block.tsx | 3 +- .../antd/grid/__tests__/grid.test.tsx | 3 +- .../antd/grid/demos/demo1.tsx | 6 +- .../antd/grid/demos/demo2.tsx | 7 +- .../antd/grid/demos/demo3.tsx | 7 +- .../antd/icon-picker/IconFilterInput.tsx | 3 +- .../antd/icon-picker/IconPicker.tsx | 13 +- .../__tests__/icon-picker.test.tsx | 3 +- .../antd/icon-picker/demos/icon-picker.tsx | 4 +- .../src/schema-component/antd/index.less | 5 +- .../antd/input-number/InputNumber.tsx | 6 +- .../antd/input-number/ReadPretty.tsx | 3 +- .../__tests__/input-number.test.tsx | 5 +- .../demos/addonBefore&addonAfter.tsx | 4 +- .../demos/highPrecisionDecimals.tsx | 4 +- .../antd/input-number/demos/inputNumber.tsx | 4 +- .../antd/input/EllipsisWithTooltip.tsx | 3 +- .../antd/input/demos/input.tsx | 4 +- .../antd/input/demos/json.tsx | 4 +- .../antd/input/demos/textarea.tsx | 4 +- .../schema-component/antd/input/demos/url.tsx | 4 +- .../antd/list/List.Designer.tsx | 8 +- .../antd/list/__tests__/list.test.tsx | 3 +- .../antd/markdown/Markdown.Void.Designer.tsx | 4 +- .../antd/markdown/__tests__/markdown.test.tsx | 3 +- .../antd/markdown/demos/demo1.tsx | 4 +- .../antd/markdown/demos/demo2.tsx | 5 +- .../src/schema-component/antd/markdown/md.ts | 1 + .../schema-component/antd/markdown/style.ts | 29 +- .../antd/menu/__tests__/menu.test.tsx | 3 +- .../antd/menu/demos/demo1.tsx | 4 +- .../antd/menu/demos/demo2.tsx | 4 +- .../antd/menu/demos/demo3.tsx | 7 +- .../antd/page/FixedBlockDesignerItem.tsx | 10 +- .../antd/page/Page.Settings.tsx | 4 +- .../antd/page/PageTab.Settings.tsx | 8 +- .../antd/page/PageTabDesigner.tsx | 8 +- .../antd/page/hooks/useIsBlockInPage.ts | 1 + .../antd/pagination/index.tsx | 8 +- .../antd/password/Password.tsx | 4 +- .../antd/password/PasswordStrength.tsx | 3 +- .../antd/password/__tests__/password.test.tsx | 3 +- .../antd/password/demos/demo1.tsx | 4 +- .../antd/password/demos/demo2.tsx | 4 +- .../schema-component/antd/percent/Percent.tsx | 7 +- .../antd/percent/__tests__/percent.test.tsx | 3 +- .../antd/percent/demos/percent.tsx | 4 +- .../schema-component/antd/preview/Preview.tsx | 7 +- .../antd/preview/__tests__/preview.test.tsx | 3 +- .../src/schema-component/antd/radio/Radio.tsx | 7 +- .../antd/radio/__tests__/radio.test.tsx | 3 +- .../antd/radio/demos/demo1.tsx | 4 +- .../antd/radio/demos/demo2.tsx | 4 +- .../antd/radio/demos/demo3.tsx | 4 +- .../antd/record-picker/InputRecordPicker.tsx | 7 +- .../record-picker/ReadPrettyRecordPicker.tsx | 4 +- .../antd/record-picker/RecordPicker.tsx | 1 + .../__tests__/record-picker.test.tsx | 3 +- .../antd/record-picker/demos/demo1.tsx | 7 +- .../antd/record-picker/util.ts | 9 +- .../antd/remote-select/ReadPretty.tsx | 5 +- .../antd/remote-select/RemoteSelect.tsx | 13 +- .../__tests__/remote-select.test.tsx | 3 +- .../antd/remote-select/demos/demo1.tsx | 3 +- .../antd/rich-text/RichText.tsx | 4 +- .../rich-text/__tests__/rich-text.test.tsx | 3 +- .../antd/rich-text/demos/demo1.tsx | 5 +- .../antd/select/FormulaSelect.tsx | 16 +- .../antd/select/ReadPretty.tsx | 10 +- .../schema-component/antd/select/Select.tsx | 16 +- .../antd/select/__tests__/select.test.tsx | 3 +- .../antd/select/demos/demo1.tsx | 4 +- .../antd/select/demos/demo2.tsx | 4 +- .../antd/select/demos/demo3.tsx | 4 +- .../src/schema-component/antd/select/index.ts | 1 - .../src/schema-component/antd/select/utils.ts | 1 + .../src/schema-component/antd/space/index.tsx | 5 +- .../table-v2/Table.ActionColumnDesigner.tsx | 8 +- .../antd/table-v2/Table.Column.Designer.tsx | 17 +- .../antd/table-v2/Table.Column.tsx | 2 +- .../antd/table-v2/Table.Designer.tsx | 1 + .../antd/table-v2/Table.Index.tsx | 1 + .../antd/table-v2/TableBlockDesigner.tsx | 15 +- .../antd/table-v2/TableField.tsx | 4 +- .../antd/table-v2/TableSelectorDesigner.tsx | 14 +- .../antd/table-v2/__tests__/table-v2.test.tsx | 3 +- .../components/ColumnFieldProvider.tsx | 4 +- .../antd/table-v2/demos/demo1.tsx | 8 +- .../antd/table-v2/demos/demo2.tsx | 8 +- .../antd/table/Table.Array.Designer.tsx | 1 + .../antd/table/Table.Column.Designer.tsx | 6 +- .../antd/table/Table.Column.tsx | 2 +- .../antd/table/Table.Designer.tsx | 1 + .../antd/table/Table.RowActionDesigner.tsx | 8 +- .../antd/table/Table.RowSelection.tsx | 8 +- .../antd/table/Table.Void.Designer.tsx | 4 +- .../antd/table/Table.Void.tsx | 7 +- .../antd/table/__tests__/table.test.tsx | 3 +- .../antd/table/demos/demo1.tsx | 4 +- .../antd/table/demos/demo2.tsx | 4 +- .../antd/table/demos/demo3.tsx | 4 +- .../antd/table/demos/demo4.tsx | 5 +- .../antd/tabs/Tabs.Designer.tsx | 4 +- .../antd/tabs/__tests__/tabs.test.tsx | 3 +- .../schema-component/antd/tabs/context.tsx | 3 +- .../antd/tabs/demos/demo1.tsx | 5 +- .../antd/time-picker/ReadPretty.tsx | 5 +- .../__tests__/time-picker.test.tsx | 3 +- .../antd/time-picker/demos/demo1.tsx | 4 +- .../antd/time-picker/demos/demo2.tsx | 4 +- .../antd/tree-select/ReadPretty.tsx | 7 +- .../antd/tree-select/TreeSelect.tsx | 8 +- .../__tests__/tree-select.test.tsx | 3 +- .../antd/tree-select/demos/demo1.tsx | 4 +- .../antd/unixTimestamp/UnixTimestamp.tsx | 6 +- .../antd/upload/ReadPretty.tsx | 9 +- .../antd/upload/__tests__/upload.test.tsx | 3 +- .../antd/upload/demos/demo1.tsx | 5 +- .../schema-component/antd/upload/type.d.ts | 3 +- .../common/dnd-context/index.tsx | 6 +- .../src/schema-component/demos/demo1.tsx | 6 +- .../src/schema-component/demos/demo2.tsx | 5 +- .../src/schema-component/demos/demo3.tsx | 5 +- .../src/schema-component/demos/demo4.tsx | 5 +- .../hooks/__tests__/designable.test.ts | 4 +- .../hooks/__tests__/splitWrapSchema.test.ts | 1 + .../src/schema-component/hooks/useAttach.ts | 2 +- .../schema-component/hooks/useComponent.ts | 5 +- .../hooks/useFieldComponentOptions.ts | 4 +- .../schema-component/hooks/useFieldTitle.ts | 6 +- .../schema-component/hooks/useTableSize.ts | 4 +- .../buttons/CustomFormItemInitializers.tsx | 6 +- .../buttons/FormItemInitializers.tsx | 2 + .../buttons/RecordBlockInitializers.tsx | 8 +- .../components/DeletedField.tsx | 1 + .../schema-initializer/demos/build-type.tsx | 2 +- .../demos/custom-button.tsx | 3 +- .../demos/custom-items-component.tsx | 1 + .../demos/dynamic-visible-children.tsx | 2 +- .../demos/insert-schema-action.tsx | 2 +- .../demos/insert-schema-basic.tsx | 3 +- .../demos/insert-schema-form-item.tsx | 2 +- .../schema-initializer/demos/nested-items.tsx | 7 +- .../useGetAriaLabelOfSchemaInitializer.ts | 3 +- .../items/ActionInitializer.tsx | 2 +- .../items/BlockInitializer.tsx | 3 +- .../items/InitializerWithSwitch.tsx | 4 +- .../RecordAssociationBlockInitializer.tsx | 5 +- ...cordAssociationDetailsBlockInitializer.tsx | 5 +- .../RecordAssociationFormBlockInitializer.tsx | 3 +- ...ordAssociationGridCardBlockInitializer.tsx | 7 +- .../RecordAssociationListBlockInitializer.tsx | 5 +- ...dPrettyAssociationFormBlockInitializer.tsx | 7 +- .../items/SelectActionInitializer.tsx | 1 + .../items/TableActionColumnInitializer.tsx | 1 + .../src/schema-items/GeneralSchemaItems.tsx | 7 +- .../src/schema-items/GeneralSettings.tsx | 7 +- .../LinkageRules/DynamicComponent.tsx | 5 +- .../LinkageRules/LinkageRuleActionGroup.tsx | 11 +- .../LinkageRules/Variables.tsx | 2 +- .../LinkageRules/action-hooks.ts | 1 + .../LinkageRules/components/EnableLinkage.tsx | 5 +- .../LinkageRules/components/LinkageHeader.tsx | 10 +- .../schema-settings/LinkageRules/context.ts | 3 +- .../schema-settings/LinkageRules/useValues.ts | 3 +- .../SchemaSettingsDataScope.tsx | 10 +- .../SchemaSettingsSortingRule.tsx | 12 +- .../VariableInput/hooks/useBaseVariable.tsx | 3 +- .../hooks/useContextAssociationFields.tsx | 4 +- .../VariableInput/hooks/useDateVariable.ts | 2 + .../VariableInput/hooks/useRecordVariable.ts | 4 +- .../VariableInput/hooks/useRoleVariable.ts | 2 + .../VariableInput/hooks/useUserVariable.ts | 2 + .../src/schema-settings/VariableInput/type.ts | 1 + .../src/schema-settings/demos/built-type.tsx | 3 +- .../demos/custom-component.tsx | 1 + .../src/schema-settings/demos/demo3.tsx | 3 +- .../hooks/useGetAriaLabelOfDesigner.ts | 3 +- .../hooks/useIsShowMultipleSwitch.ts | 1 + .../hooks/useParseDataScopeFilter.ts | 3 +- ...rrent-user-settings-menu-provider.test.tsx | 3 +- .../src/variables/utils/getVariableName.tsx | 1 + .../variables/utils/transformVariableValue.ts | 1 + .../core/components/src/__builtins__/dayjs.ts | 2 +- .../src/__builtins__/hooks/useClickAway.ts | 2 +- .../src/__builtins__/hooks/useConfig.ts | 3 +- .../src/__builtins__/hooks/usePrefixCls.ts | 1 + .../src/__builtins__/hooks/useToken.ts | 1 + .../components/src/__builtins__/portal.tsx | 5 +- .../core/components/src/__builtins__/style.ts | 4 +- .../components/src/__tests__/dayjs.spec.ts | 3 +- .../core/components/src/array-cards/index.tsx | 6 +- .../components/src/array-collapse/index.tsx | 6 +- .../components/src/array-collapse/style.ts | 1 + .../core/components/src/array-items/index.tsx | 6 +- .../core/components/src/array-items/style.ts | 1 + .../core/components/src/array-table/index.tsx | 6 +- .../core/components/src/array-tabs/index.tsx | 3 +- .../core/components/src/checkbox/index.tsx | 1 + .../core/components/src/editable/index.tsx | 6 +- .../core/components/src/editable/style.ts | 1 + .../src/form-button-group/index.tsx | 6 +- .../components/src/form-collapse/index.tsx | 4 +- .../core/components/src/form-dialog/index.tsx | 4 +- .../core/components/src/form-drawer/index.tsx | 4 +- .../core/components/src/form-grid/index.tsx | 7 +- .../core/components/src/form-grid/style.ts | 1 + .../src/form-item/hooks/useFormItemLayout.tsx | 4 +- .../src/form-item/hooks/useOverflow.ts | 3 +- .../src/form-item/style/animation.tsx | 1 + .../components/src/form-item/style/other.tsx | 1 + .../core/components/src/form-layout/index.tsx | 6 +- .../form-layout/useResponsiveFormLayout.ts | 3 +- .../core/components/src/form-step/index.tsx | 4 +- .../core/components/src/form-tab/index.tsx | 5 +- packages/core/components/src/form/index.tsx | 5 +- packages/core/components/src/input/index.tsx | 4 +- .../components/src/number-picker/index.tsx | 1 + .../src/password/PasswordStrength.tsx | 1 + .../core/components/src/password/index.tsx | 4 +- packages/core/components/src/radio/index.tsx | 1 + packages/core/components/src/reset/index.tsx | 3 +- .../select-table/hooks/useCheckSlackly.tsx | 2 +- .../select-table/hooks/useFilterOptions.tsx | 3 +- .../src/select-table/hooks/useTitleAddon.tsx | 2 + .../components/src/select-table/index.tsx | 4 +- .../core/components/src/select-table/utils.ts | 1 + packages/core/components/src/select/index.tsx | 4 +- packages/core/components/src/space/index.tsx | 4 +- packages/core/components/src/submit/index.tsx | 3 +- packages/core/components/src/switch/index.tsx | 2 +- .../core/components/src/tree-select/index.tsx | 4 +- packages/core/components/src/upload/index.tsx | 12 +- packages/core/devtools/umiConfig.d.ts | 2 +- packages/core/evaluators/client.js | 6 +- packages/core/evaluators/server.js | 6 +- .../src/server/__tests__/index.test.ts | 2 +- packages/core/evaluators/src/utils/index.ts | 2 +- .../src/deprecated/create-app-logger.ts | 2 + packages/core/logger/src/format.ts | 3 +- packages/core/logger/src/logger.ts | 4 +- packages/core/logger/src/request-logger.ts | 6 +- packages/core/logger/src/system-logger.ts | 7 +- packages/core/logger/src/transports.ts | 6 +- .../core/resourcer/src/__tests__/koa.test.ts | 1 + .../resourcer/src/__tests__/resourcer.test.ts | 1 + packages/core/resourcer/src/action.ts | 2 + packages/core/resourcer/src/middleware.ts | 4 +- packages/core/resourcer/src/resource.ts | 1 + packages/core/resourcer/src/resourcer.ts | 2 + packages/core/resourcer/src/utils.ts | 1 + .../src/__tests__/app-life-cycle.test.ts | 1 + .../core/server/src/__tests__/app.test.ts | 3 + .../server/src/__tests__/application.test.ts | 3 +- .../core/server/src/__tests__/command.test.ts | 1 + .../core/server/src/__tests__/cron.test.ts | 4 +- .../server/src/__tests__/dataWrapping.test.ts | 1 + .../core/server/src/__tests__/i18next.test.ts | 1 + .../server/src/__tests__/life-cycle.test.ts | 1 + .../__tests__/multiple-application.test.ts | 1 + .../core/server/src/__tests__/plugin.test.ts | 4 +- packages/core/server/src/__tests__/pm.test.ts | 6 +- packages/core/server/src/acl/index.ts | 1 + packages/core/server/src/cache/index.ts | 3 +- .../server/src/commands/create-migration.ts | 4 +- packages/core/server/src/commands/pm.ts | 1 + packages/core/server/src/commands/start.ts | 3 +- .../core/server/src/cron/cron-job-manager.ts | 1 + packages/core/server/src/gateway/errors.ts | 3 +- .../server/src/gateway/ipc-socket-client.ts | 3 +- .../server/src/gateway/ipc-socket-server.ts | 2 + packages/core/server/src/gateway/ws-server.ts | 14 +- .../server/src/helpers/application-version.ts | 2 + packages/core/server/src/migration.ts | 1 + .../20230912193824-package-name-unique.ts | 1 + .../src/plugin-manager/options/resource.ts | 4 +- .../plugin-manager-repository.ts | 2 + packages/core/test/setup/client.ts | 2 + packages/core/test/src/client/index.ts | 2 + .../core/test/src/scripts/test-db-creator.ts | 9 +- .../test/src/scripts/test-db-distributor.ts | 11 +- packages/core/test/src/server/mockServer.ts | 1 + packages/core/test/vitest.d.ts | 3 +- packages/core/test/vitest.mjs | 3 +- packages/core/utils/client.d.ts | 2 +- packages/core/utils/client.js | 6 +- packages/core/utils/server.js | 6 +- .../utils/src/__tests__/import-module.test.ts | 1 + packages/core/utils/src/assign.ts | 5 +- packages/core/utils/src/date.ts | 1 + packages/core/utils/src/index.ts | 1 + packages/core/utils/src/json-templates.ts | 2 +- packages/core/utils/src/parse-filter.ts | 1 + packages/core/utils/src/perf-hooks.ts | 2 +- .../src/typedi/container-instance.class.ts | 14 +- .../decorators/inject-many.decorator.ts | 6 +- .../src/typedi/decorators/inject.decorator.ts | 10 +- .../typedi/decorators/service.decorator.ts | 4 +- .../error/cannot-instantiate-value.error.ts | 2 +- .../typedi/error/service-not-found.error.ts | 2 +- .../typedi/types/service-identifier.type.ts | 2 +- .../src/client/approval/style/style.css | 30 +- .../approval-config/VC.AssigneesAddition.tsx | 7 +- .../approval-config/VC.AssigneesSelect.tsx | 4 +- .../Iz.ApproverActionConfig.tsx | 3 +- .../Iz.ApproverAddBlock.tsx | 3 +- .../VC.ApprovalActionConfig.tsx | 2 +- .../VC.ApprovalFormBlockProvider.tsx | 4 +- .../VC.ApproverAddBlock.tsx | 3 +- .../VC.ApproverAddBlockKit.tsx | 7 +- .../approver-interface/VC.ApproverBlock.tsx | 15 +- .../plugin-approval/src/client/constants.ts | 4 +- .../usage/approval-block/launch/Dt.Record.tsx | 2 +- .../launch/VC.ApprovalBlockLaunch.tsx | 5 +- .../launch/VC.ViewActionLaunch.tsx | 3 +- .../launch/apply-button/Pd.ActionStatus.tsx | 4 +- .../launch/apply-button/hooks/useSubmit.tsx | 3 +- .../todos/Dt.ApprovalFormBlock.tsx | 6 +- .../todos/Pd.ActionBarProvider.tsx | 2 + .../todos/Pd.ApprovalAction.tsx | 4 +- .../todos/VC.ApprovalBlockTodos.tsx | 3 +- .../todos/VC.ViewActionTodos.tsx | 1 + .../hooks/useApprovalDetailBlockProps.tsx | 3 +- .../approval-block/todos/hooks/useSubmit.tsx | 3 +- .../approval-columns/column.node.tsx | 2 +- .../approval-columns/column.status.tsx | 4 +- .../approval-columns/column.user.tsx | 2 +- .../approval-columns/column.workflow.tsx | 3 +- .../process-columns/render.status.tsx | 6 +- .../process-columns/render.taskNode.tsx | 8 +- .../plugin-approval/src/server/plugin.ts | 8 +- .../client/custom-components/DetailChecks.tsx | 8 +- .../custom-components/MovementStatus.tsx | 10 +- .../RecordFeeConvertedRead.tsx | 13 +- .../src/client/interfaces/movement.ts | 3 +- .../@hera/plugin-rental/src/client/locale.tsx | 2 +- .../src/client/schema-components/Movement.tsx | 5 +- .../AddToChecklistActionInitializer.tsx | 1 + .../actions/ColumnSwitchActionInitializer.tsx | 2 + .../PDFViewerPrintActionInitializer.tsx | 5 +- .../RecordPrintAnnotateActionInitializer.tsx | 6 +- .../RecordPrintFontSizeInitializer.tsx | 3 + .../RecordPrintSetupMargingTopInitializer.tsx | 9 +- ...SettlementExcelExportActionInitializer.tsx | 3 +- .../actions/paperSwitching.tsx | 6 +- .../blocks/UnusedRecordsBlockInitializer.tsx | 1 + .../plugin-rental/src/interfaces/record.ts | 2 +- .../plugin-rental/src/interfaces/rule.ts | 2 +- .../src/interfaces/settlement.ts | 2 +- .../migrations/update-record-all_price.ts | 1 + .../src/server/services/project-service.ts | 3 +- .../services/settlement-products-service.ts | 16 +- .../src/server/services/vehicles-service.ts | 1 + .../src/client/pages/style.less | 1 - .../build.config.ts | 2 +- .../src/client/components/Display.tsx | 8 +- .../src/client/components/Edit.tsx | 4 +- .../src/client/components/const.ts | 1 + .../src/client/components/index.tsx | 3 +- .../src/client/interfaces/markdown-vditor.tsx | 3 +- .../src/client/configuration/App.tsx | 6 +- .../src/client/configuration/Interface.tsx | 3 +- .../src/client/core/bridge/index.ts | 1 + .../container/Container.Designer.tsx | 11 +- .../components/header/Header.Designer.tsx | 5 +- .../core/schema/components/header/Header.tsx | 8 +- .../image-search/ImageSearch.initializer.tsx | 3 +- .../image-search/ImageSearch.provider.tsx | 2 +- .../image-search/ImageSearch.view.tsx | 2 +- .../ImageSearchItem.intializer.tsx | 2 +- .../search-item/ImageSearchItem.setting.tsx | 2 + .../search-item/ImageSearchItem.toolbar.tsx | 2 +- .../search-item/useProps.Optional.ts | 2 + .../search-item/useProps.Related.tsx | 3 +- .../schema/components/menu/Menu.Designer.tsx | 10 +- .../core/schema/components/menu/Menu.Item.tsx | 10 +- .../core/schema/components/menu/Menu.tsx | 6 +- .../components/menu/MenuBlockInitializer.tsx | 3 +- .../NoticeBlockInitializer.tsx | 4 +- .../schema/components/page/Page.Designer.tsx | 11 +- .../components/settings/Settings.Designer.tsx | 3 +- .../settings/SettingsBlockInitializer.tsx | 3 +- .../schema/components/swiper/SwiperBlock.tsx | 5 +- .../swiper/SwiperBlockInitializer.tsx | 3 +- .../components/swiper/SwiperFieldSettings.tsx | 2 + .../schema/components/swiper/SwiperPage.tsx | 3 +- .../components/swiper/useSwiperBlockProps.ts | 5 +- .../schema/components/tab-bar/TabBar.Item.tsx | 6 +- .../core/schema/components/tab-bar/TabBar.tsx | 7 +- .../tab-search/components/TabSearch.tsx | 3 +- .../TabSearchCollapsibleInputItem.tsx | 8 +- .../TabSearchCollapsibleInputItemAction.ts | 5 +- .../TabSearchCollapsibleInputItemChild.tsx | 2 + .../TabSearchCollapsibleInputMItem.tsx | 10 +- .../field-item/TabSearchFieldItem.tsx | 6 +- .../field-item/TabSearchFieldItemProps.ts | 4 +- .../field-item/TabSearchFieldMItem.tsx | 4 +- .../TabSerachFieldItemRelatedProps.tsx | 4 +- .../initializer/TabSearchBlockInitializer.tsx | 3 +- .../TabSearchFieldSchemaInitializerGadget.tsx | 2 +- .../tab-search/provider/TabSearchProvider.tsx | 2 +- .../settings/TabSearchItemFieldSettings.tsx | 4 +- .../src/client/core/schema/helpers/index.ts | 4 +- .../core/schema/hooks/useSchemaPatch.ts | 5 +- .../src/client/router/InterfaceRouter.tsx | 3 +- .../src/client/router/OpenInNewTab.tsx | 8 +- .../src/e2e/e2ePageObjectModel.ts | 1 + .../plugin-workflow-test/src/server/index.ts | 11 +- .../src/client/ExecutionCanvas.tsx | 11 +- packages/presets/base/client.d.ts | 1 - packages/presets/base/server.d.ts | 1 - packages/presets/base/src/server/index.ts | 1 + packages/presets/mini/client.d.ts | 1 - packages/presets/mini/server.d.ts | 1 - packages/presets/rental/client.d.ts | 1 - packages/presets/rental/server.d.ts | 1 - packages/presets/sancongtou/client.d.ts | 1 - packages/presets/sancongtou/server.d.ts | 1 - 816 files changed, 2901 insertions(+), 1942 deletions(-) diff --git a/packages/core/app/client/.umirc.ts b/packages/core/app/client/.umirc.ts index 2ea785e56..dde89a80d 100644 --- a/packages/core/app/client/.umirc.ts +++ b/packages/core/app/client/.umirc.ts @@ -1,5 +1,6 @@ -import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig'; import path from 'path'; +import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig'; + import { defineConfig } from 'umi'; const umiConfig = getUmiConfig(); @@ -10,7 +11,8 @@ process.env.DID_YOU_KNOW = 'none'; const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '').split(',').filter((item) => !item.includes('preset')); // 因为现在 preset 是直接引入的,所以不能忽略,如果以后 preset 也是动态插件的形式引入,那么这里可以去掉 const pluginDirs = (process.env.PLUGIN_PATH || 'packages/plugins/,packages/samples/,packages/pro-plugins/') - .split(',').map(item => path.join(process.cwd(), item)); + .split(',') + .map((item) => path.join(process.cwd(), item)); const outputPluginPath = path.join(__dirname, 'src', '.plugins'); const indexGenerator = new IndexGenerator(outputPluginPath, pluginDirs); @@ -36,7 +38,9 @@ export default defineConfig({ src: `${appPublicPath}browser-checker.js`, }, { - content: isDevCmd ? '' : ` + content: isDevCmd + ? '' + : ` window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}'; window['__tachybase_public_path__'] = '{{env.APP_PUBLIC_PATH}}'; window['__tachybase_api_base_url__'] = '{{env.API_BASE_URL}}'; @@ -71,7 +75,7 @@ export default defineConfig({ safari: 12, }, codeSplitting: { - jsStrategy: 'depPerChunk' + jsStrategy: 'depPerChunk', }, chainWebpack(config, { env }) { if (env === 'production') { diff --git a/packages/core/app/client/public/browser-checker.js b/packages/core/app/client/public/browser-checker.js index 0ae7fd899..aefcbc67a 100644 --- a/packages/core/app/client/public/browser-checker.js +++ b/packages/core/app/client/public/browser-checker.js @@ -39,101 +39,105 @@ function css_browser_selector(u) { (!/opera|webtv/i.test(ua) && /msie\s(\d+)/.test(ua)) || /trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.test(ua) ? 'ie ie' + (/trident\/4\.0/.test(ua) ? '8' : RegExp.$1 == '11.0' ? '11' : RegExp.$1) : is('firefox/') - ? g + - ' ' + - f + - (/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) - ? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + '_' + RegExp.$4 - : '') - : is('gecko/') - ? g - : is('opera') - ? o + - (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) - ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$4 - : /opera(\s|\/)(\d+)\.(\d+)/.test(ua) - ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$3 - : '') - : is('konqueror') - ? 'konqueror' - : is('blackberry') - ? bb + - (/Version\/(\d+)(\.(\d+)+)/i.test(ua) - ? ' ' + bb + RegExp.$1 + ' ' + bb + RegExp.$1 + RegExp.$2.replace('.', '_') - : /Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua) - ? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '') - : '') - : is('android') - ? a + - (/Version\/(\d+)(\.(\d+))+/i.test(ua) - ? ' ' + a + RegExp.$1 + ' ' + a + RegExp.$1 + RegExp.$2.replace('.', '_') - : '') + - (/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_') : '') - : is('chrome') - ? w + - ' ' + - c + - (/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) - ? ' ' + c + RegExp.$2 + (RegExp.$4 > 0 ? ' ' + c + RegExp.$2 + '_' + RegExp.$4 : '') - : '') - : is('iron') - ? w + ' iron' - : is('applewebkit/') - ? w + - ' ' + - s + - (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) - ? ' ' + s + RegExp.$2 + ' ' + s + RegExp.$2 + RegExp.$3.replace('.', '_') - : / Safari\/(\d+)/i.test(ua) - ? RegExp.$1 == '419' || RegExp.$1 == '417' || RegExp.$1 == '416' || RegExp.$1 == '412' - ? ' ' + s + '2_0' - : RegExp.$1 == '312' - ? ' ' + s + '1_3' - : RegExp.$1 == '125' - ? ' ' + s + '1_2' - : RegExp.$1 == '85' - ? ' ' + s + '1_0' - : '' - : '') - : is('mozilla/') - ? g - : '', + ? g + + ' ' + + f + + (/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) + ? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + '_' + RegExp.$4 + : '') + : is('gecko/') + ? g + : is('opera') + ? o + + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) + ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$4 + : /opera(\s|\/)(\d+)\.(\d+)/.test(ua) + ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$3 + : '') + : is('konqueror') + ? 'konqueror' + : is('blackberry') + ? bb + + (/Version\/(\d+)(\.(\d+)+)/i.test(ua) + ? ' ' + bb + RegExp.$1 + ' ' + bb + RegExp.$1 + RegExp.$2.replace('.', '_') + : /Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua) + ? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '') + : '') + : is('android') + ? a + + (/Version\/(\d+)(\.(\d+))+/i.test(ua) + ? ' ' + a + RegExp.$1 + ' ' + a + RegExp.$1 + RegExp.$2.replace('.', '_') + : '') + + (/Android (.+); (.+) Build/i.test(ua) + ? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_') + : '') + : is('chrome') + ? w + + ' ' + + c + + (/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) + ? ' ' + c + RegExp.$2 + (RegExp.$4 > 0 ? ' ' + c + RegExp.$2 + '_' + RegExp.$4 : '') + : '') + : is('iron') + ? w + ' iron' + : is('applewebkit/') + ? w + + ' ' + + s + + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) + ? ' ' + s + RegExp.$2 + ' ' + s + RegExp.$2 + RegExp.$3.replace('.', '_') + : / Safari\/(\d+)/i.test(ua) + ? RegExp.$1 == '419' || RegExp.$1 == '417' || RegExp.$1 == '416' || RegExp.$1 == '412' + ? ' ' + s + '2_0' + : RegExp.$1 == '312' + ? ' ' + s + '1_3' + : RegExp.$1 == '125' + ? ' ' + s + '1_2' + : RegExp.$1 == '85' + ? ' ' + s + '1_0' + : '' + : '') + : is('mozilla/') + ? g + : '', is('android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk') ? m : '', is('j2me') ? 'j2me' : is('ipad|ipod|iphone') - ? (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') + - ' ' + - (/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : '') - : is('playbook') - ? 'playbook' - : is('kindle|silk') - ? 'kindle' - : is('playbook') - ? 'playbook' - : is('mac') - ? 'mac' + - (/mac os x ((\d+)[.|_](\d+))/.test(ua) ? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_') : '') - : is('win') - ? 'win' + - (is('windows nt 6.2') - ? ' win8' - : is('windows nt 6.1') - ? ' win7' - : is('windows nt 6.0') - ? ' vista' - : is('windows nt 5.2') || is('windows nt 5.1') - ? ' win_xp' - : is('windows nt 5.0') - ? ' win_2k' - : is('windows nt 4.0') || is('WinNT4.0') - ? ' win_nt' - : '') - : is('freebsd') - ? 'freebsd' - : is('x11|linux') - ? 'linux' - : '', + ? (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') + + ' ' + + (/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : '') + : is('playbook') + ? 'playbook' + : is('kindle|silk') + ? 'kindle' + : is('playbook') + ? 'playbook' + : is('mac') + ? 'mac' + + (/mac os x ((\d+)[.|_](\d+))/.test(ua) + ? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_') + : '') + : is('win') + ? 'win' + + (is('windows nt 6.2') + ? ' win8' + : is('windows nt 6.1') + ? ' win7' + : is('windows nt 6.0') + ? ' vista' + : is('windows nt 5.2') || is('windows nt 5.1') + ? ' win_xp' + : is('windows nt 5.0') + ? ' win_2k' + : is('windows nt 4.0') || is('WinNT4.0') + ? ' win_nt' + : '') + : is('freebsd') + ? 'freebsd' + : is('x11|linux') + ? 'linux' + : '', /[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua) ? (lang + RegExp.$2).replace('-', '_') + (RegExp.$3 != '' ? (' ' + lang + RegExp.$1).replace('-', '_') : '') : '', diff --git a/packages/core/app/client/public/favicon/site.webmanifest b/packages/core/app/client/public/favicon/site.webmanifest index 0a037fe8a..70529ef56 100644 --- a/packages/core/app/client/public/favicon/site.webmanifest +++ b/packages/core/app/client/public/favicon/site.webmanifest @@ -1 +1,11 @@ -{"name":"","short_name":"","icons":[{"src":"./android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} +{ + "name": "", + "short_name": "", + "icons": [ + { "src": "./android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, + { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/packages/core/app/src/config/plugins.ts b/packages/core/app/src/config/plugins.ts index 01a78c63a..f165db75d 100644 --- a/packages/core/app/src/config/plugins.ts +++ b/packages/core/app/src/config/plugins.ts @@ -1,4 +1,4 @@ -import { PluginConfiguration } from '@tachybase/server'; import process from 'process'; +import { PluginConfiguration } from '@tachybase/server'; export default [process.env.PRESET_NAME ?? 'tachybase'] as PluginConfiguration[]; diff --git a/packages/core/app/src/index.ts b/packages/core/app/src/index.ts index 24ccd1dda..2eb262643 100644 --- a/packages/core/app/src/index.ts +++ b/packages/core/app/src/index.ts @@ -1,4 +1,5 @@ import { Gateway } from '@tachybase/server'; + import { getConfig } from './config'; getConfig() diff --git a/packages/core/build/src/build.ts b/packages/core/build/src/build.ts index 48f28524c..3ab1b12d0 100755 --- a/packages/core/build/src/build.ts +++ b/packages/core/build/src/build.ts @@ -1,26 +1,39 @@ import { EventEmitter } from 'events'; import path from 'path'; - - import type { Project } from '@pnpm/workspace.find-packages'; import chalk from 'chalk'; import execa from 'execa'; - - import { buildCjs } from './buildCjs'; import { buildClient } from './buildClient'; import { buildDeclaration } from './buildDeclaration'; import { buildEsm } from './buildEsm'; import { buildPlugin } from './buildPlugin'; -import { CORE_APP, CORE_CLIENT, ESM_PACKAGES, getCjsPackages, getPluginPackages, getPresetsPackages, PACKAGES_PATH, ROOT_PATH } from './constant'; +import { + CORE_APP, + CORE_CLIENT, + ESM_PACKAGES, + getCjsPackages, + getPluginPackages, + getPresetsPackages, + PACKAGES_PATH, + ROOT_PATH, +} from './constant'; import { signals } from './stats'; import { tarPlugin } from './tarPlugin'; -import { getPackageJson, getPkgLog, getUserConfig, PkgLog, readFromCache, toUnixPath, UserConfig, writeToCache } from './utils'; +import { + getPackageJson, + getPkgLog, + getUserConfig, + PkgLog, + readFromCache, + toUnixPath, + UserConfig, + writeToCache, +} from './utils'; import { getPackages } from './utils/getPackages'; - const BUILD_ERROR = 'build-error'; export async function build(pkgs: string[]) { diff --git a/packages/core/build/src/buildCjs.ts b/packages/core/build/src/buildCjs.ts index 5397d43c6..db82748b2 100644 --- a/packages/core/build/src/buildCjs.ts +++ b/packages/core/build/src/buildCjs.ts @@ -1,8 +1,10 @@ -import { build } from 'tsup'; -import fg from 'fast-glob'; import path from 'path'; + import chalk from 'chalk'; -import { globExcludeFiles, EsbuildSupportExts } from './constant'; +import fg from 'fast-glob'; +import { build } from 'tsup'; + +import { EsbuildSupportExts, globExcludeFiles } from './constant'; import { PkgLog, UserConfig } from './utils'; export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) { @@ -10,26 +12,30 @@ export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd, absolute: true }); const outDir = path.join(cwd, 'lib'); - const otherExts = Array.from(new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item)))); + const otherExts = Array.from( + new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))), + ); if (otherExts.length) { log('%s will not be processed, only be copied to the lib directory.', chalk.yellow(otherExts.join(','))); } - return build(userConfig.modifyTsupConfig({ - entry, - splitting: false, - clean: true, - bundle: false, - silent: true, - sourcemap, - treeshake: false, - target: 'node16', - keepNames: true, - outDir, - loader: { - ...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}), - '.json': 'copy', - }, - format: 'cjs', - skipNodeModulesBundle: true, - })); + return build( + userConfig.modifyTsupConfig({ + entry, + splitting: false, + clean: true, + bundle: false, + silent: true, + sourcemap, + treeshake: false, + target: 'node16', + keepNames: true, + outDir, + loader: { + ...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}), + '.json': 'copy', + }, + format: 'cjs', + skipNodeModulesBundle: true, + }), + ); } diff --git a/packages/core/build/src/buildClient.ts b/packages/core/build/src/buildClient.ts index 1ca0d7309..2ca29f5fa 100644 --- a/packages/core/build/src/buildClient.ts +++ b/packages/core/build/src/buildClient.ts @@ -1,7 +1,8 @@ +import path from 'path'; + import react from '@vitejs/plugin-react'; import fg from 'fast-glob'; import fs from 'fs-extra'; -import path from 'path'; import { build as tsupBuild } from 'tsup'; import { build as viteBuild } from 'vite'; import { libInjectCss } from 'vite-plugin-lib-inject-css'; diff --git a/packages/core/build/src/buildEsm.ts b/packages/core/build/src/buildEsm.ts index 738d5b3ac..4bfbc86f7 100644 --- a/packages/core/build/src/buildEsm.ts +++ b/packages/core/build/src/buildEsm.ts @@ -1,8 +1,9 @@ - import path from 'path'; -import { PkgLog, UserConfig } from './utils'; -import { build as viteBuild } from 'vite'; + import fg from 'fast-glob'; +import { build as viteBuild } from 'vite'; + +import { PkgLog, UserConfig } from './utils'; export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) { log('build esm'); @@ -12,7 +13,9 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b await build(cwd, indexEntry, outDir, userConfig, sourcemap, log); - const clientEntry = fg.sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0]?.replaceAll(/\\/g, '/'); + const clientEntry = fg + .sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0] + ?.replaceAll(/\\/g, '/'); const clientOutDir = path.resolve(cwd, 'es/client'); if (clientEntry) { await build(cwd, clientEntry, clientOutDir, userConfig, sourcemap, log); @@ -26,7 +29,14 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b } } -function build(cwd: string, entry: string, outDir: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) { +function build( + cwd: string, + entry: string, + outDir: string, + userConfig: UserConfig, + sourcemap: boolean = false, + log: PkgLog, +) { const cwdWin = cwd.replaceAll(/\\/g, '/'); const cwdUnix = cwd.replaceAll(/\//g, '\\'); const external = function (id: string) { diff --git a/packages/core/build/src/buildPlugin.ts b/packages/core/build/src/buildPlugin.ts index 7a0cfb01c..f5843a2df 100644 --- a/packages/core/build/src/buildPlugin.ts +++ b/packages/core/build/src/buildPlugin.ts @@ -1,15 +1,16 @@ +import path from 'path'; + import ncc from '@vercel/ncc'; import react from '@vitejs/plugin-react'; import chalk from 'chalk'; import fg from 'fast-glob'; import fs from 'fs-extra'; -import path from 'path'; import { build as tsupBuild } from 'tsup'; import { build as viteBuild } from 'vite'; import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'; import { EsbuildSupportExts, globExcludeFiles } from './constant'; -import { PkgLog, UserConfig, getPackageJson } from './utils'; +import { getPackageJson, PkgLog, UserConfig } from './utils'; import { buildCheck, checkFileSize, @@ -123,9 +124,9 @@ const external = [ 'lodash', 'china-division', ]; -const pluginPrefix = ( - process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-' -).split(','); +const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-').split( + ',', +); const target_dir = 'dist'; @@ -150,7 +151,9 @@ export function deleteServerFiles(cwd: string, log: PkgLog) { export function writeExternalPackageVersion(cwd: string, log: PkgLog) { log('write external version'); - const sourceFiles = fg.globSync(sourceGlobalFiles, { cwd, absolute: true }).map((item) => fs.readFileSync(item, 'utf-8')); + const sourceFiles = fg + .globSync(sourceGlobalFiles, { cwd, absolute: true }) + .map((item) => fs.readFileSync(item, 'utf-8')); const sourcePackages = getSourcePackages(sourceFiles); const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix); const data = excludePackages.reduce>((prev, packageName) => { @@ -171,7 +174,9 @@ export function writeExternalPackageVersion(cwd: string, log: PkgLog) { export async function buildServerDeps(cwd: string, serverFiles: string[], log: PkgLog) { log('build plugin server dependencies'); const outDir = path.join(cwd, target_dir, 'node_modules'); - const serverFileSource = serverFiles.filter(item => validExts.includes(path.extname(item))).map((item) => fs.readFileSync(item, 'utf-8')); + const serverFileSource = serverFiles + .filter((item) => validExts.includes(path.extname(item))) + .map((item) => fs.readFileSync(item, 'utf-8')); const sourcePackages = getSourcePackages(serverFileSource); const includePackages = getIncludePackages(sourcePackages, external, pluginPrefix); const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix); @@ -265,30 +270,34 @@ export async function buildPluginServer(cwd: string, userConfig: UserConfig, sou const packageJson = getPackageJson(cwd); const serverFiles = fg.globSync(serverGlobalFiles, { cwd, absolute: true }); buildCheck({ cwd, packageJson, entry: 'server', files: serverFiles, log }); - const otherExts = Array.from(new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item)))); + const otherExts = Array.from( + new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))), + ); if (otherExts.length) { log('%s will not be processed, only be copied to the dist directory.', chalk.yellow(otherExts.join(','))); } deleteServerFiles(cwd, log); - await tsupBuild(userConfig.modifyTsupConfig({ - entry: serverFiles, - splitting: false, - clean: false, - bundle: false, - silent: true, - treeshake: false, - target: 'node16', - sourcemap, - outDir: path.join(cwd, target_dir), - format: 'cjs', - skipNodeModulesBundle: true, - loader: { - ...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}), - '.json': 'copy', - }, - })); + await tsupBuild( + userConfig.modifyTsupConfig({ + entry: serverFiles, + splitting: false, + clean: false, + bundle: false, + silent: true, + treeshake: false, + target: 'node16', + sourcemap, + outDir: path.join(cwd, target_dir), + format: 'cjs', + skipNodeModulesBundle: true, + loader: { + ...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}), + '.json': 'copy', + }, + }), + ); await buildServerDeps(cwd, serverFiles, log); } @@ -316,45 +325,44 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou const entry = fg.globSync('src/client/index.{ts,tsx,js,jsx}', { absolute: true, cwd }); const outputFileName = 'index.js'; - await viteBuild(userConfig.modifyViteConfig({ - mode: process.env.NODE_ENV || 'production', - define: { - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'), - 'process.env.__TEST__': false, - 'process.env.__E2E__': process.env.__E2E__ ? true : false, - }, - logLevel: 'warn', - build: { - minify: process.env.NODE_ENV === 'production', - outDir, - cssCodeSplit: false, - emptyOutDir: true, - sourcemap, - lib: { - entry, - formats: ['umd'], - name: packageJson.name, - fileName: () => outputFileName, + await viteBuild( + userConfig.modifyViteConfig({ + mode: process.env.NODE_ENV || 'production', + define: { + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'), + 'process.env.__TEST__': false, + 'process.env.__E2E__': process.env.__E2E__ ? true : false, }, - target: ['es2015', 'edge88', 'firefox78', 'chrome87', 'safari14'], - rollupOptions: { - cache: true, - external: [...Object.keys(globals), 'react', 'react/jsx-runtime'], - output: { - exports: 'named', - globals: { - react: 'React', - 'react/jsx-runtime': 'jsxRuntime', - ...globals, + logLevel: 'warn', + build: { + minify: process.env.NODE_ENV === 'production', + outDir, + cssCodeSplit: false, + emptyOutDir: true, + sourcemap, + lib: { + entry, + formats: ['umd'], + name: packageJson.name, + fileName: () => outputFileName, + }, + target: ['es2015', 'edge88', 'firefox78', 'chrome87', 'safari14'], + rollupOptions: { + cache: true, + external: [...Object.keys(globals), 'react', 'react/jsx-runtime'], + output: { + exports: 'named', + globals: { + react: 'React', + 'react/jsx-runtime': 'jsxRuntime', + ...globals, + }, }, }, }, - }, - plugins: [ - react(), - cssInjectedByJsPlugin({ styleId: packageJson.name }), - ], - })); + plugins: [react(), cssInjectedByJsPlugin({ styleId: packageJson.name })], + }), + ); checkFileSize(outDir, log); } diff --git a/packages/core/build/src/constant.ts b/packages/core/build/src/constant.ts index 2bee2f60b..722ffda21 100644 --- a/packages/core/build/src/constant.ts +++ b/packages/core/build/src/constant.ts @@ -1,6 +1,7 @@ -import type { Project } from '@pnpm/workspace.find-packages'; import path from 'path'; +import type { Project } from '@pnpm/workspace.find-packages'; + export const globExcludeFiles = [ '!src/**/__tests__', '!src/**/__test__', diff --git a/packages/core/build/src/index.d.ts b/packages/core/build/src/index.d.ts index a7cf4e15f..e6b80b08a 100644 --- a/packages/core/build/src/index.d.ts +++ b/packages/core/build/src/index.d.ts @@ -1,6 +1,5 @@ - -import { Options as TsupConfig } from 'tsup' -import { InlineConfig as ViteConfig } from 'vite' +import { Options as TsupConfig } from 'tsup'; +import { InlineConfig as ViteConfig } from 'vite'; export type PkgLog = (msg: string, ...args: any[]) => void; diff --git a/packages/core/build/src/index.ts b/packages/core/build/src/index.ts index eb094a48f..69756e6cd 100755 --- a/packages/core/build/src/index.ts +++ b/packages/core/build/src/index.ts @@ -1,2 +1,2 @@ export * from './build'; -export * from './utils' +export * from './utils'; diff --git a/packages/core/build/src/tarPlugin.ts b/packages/core/build/src/tarPlugin.ts index bc869593b..73ca8bae3 100644 --- a/packages/core/build/src/tarPlugin.ts +++ b/packages/core/build/src/tarPlugin.ts @@ -1,10 +1,11 @@ import path from 'path'; -import tar from 'tar'; + import fg from 'fast-glob'; import fs from 'fs-extra'; +import tar from 'tar'; -import { PkgLog } from "./utils"; -import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant' +import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant'; +import { PkgLog } from './utils'; export function tarPlugin(cwd: string, log: PkgLog) { log('tar package'); @@ -12,14 +13,24 @@ export function tarPlugin(cwd: string, log: PkgLog) { const npmIgnore = path.join(cwd, '.npmignore'); let files = pkg.files || []; if (fs.existsSync(npmIgnore)) { - files = fs.readFileSync(npmIgnore, 'utf-8').split('\n').filter((item) => item.trim()).map(item => `!${item}`); + files = fs + .readFileSync(npmIgnore, 'utf-8') + .split('\n') + .filter((item) => item.trim()) + .map((item) => `!${item}`); files.push('**/*'); } // 必须包含的文件 files.push(...tarIncludesFiles); - files = files.map((item: string) => item !== '**/*' && fs.existsSync(path.join(cwd, item.replace('!', ''))) && fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory() ? `${item}/**/*` : item); + files = files.map((item: string) => + item !== '**/*' && + fs.existsSync(path.join(cwd, item.replace('!', ''))) && + fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory() + ? `${item}/**/*` + : item, + ); const tarball = path.join(TAR_OUTPUT_DIR, `${pkg.name}-${pkg.version}.tgz`); const tarFiles = fg.sync(files, { cwd }); diff --git a/packages/core/build/src/utils/buildPluginUtils.ts b/packages/core/build/src/utils/buildPluginUtils.ts index ecf2201e4..754d10807 100644 --- a/packages/core/build/src/utils/buildPluginUtils.ts +++ b/packages/core/build/src/utils/buildPluginUtils.ts @@ -1,8 +1,9 @@ import fs from 'fs'; -import chalk from 'chalk'; import { builtinModules } from 'module'; import path from 'path'; +import chalk from 'chalk'; + const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g; const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm; @@ -156,10 +157,14 @@ export function checkRequire(sourceFiles: string[], log: Log) { export function checkFileSize(outDir: string, log: Log) { const files = fs.readdirSync(outDir); - files.forEach(file => { + files.forEach((file) => { const fileSize = getFileSize(path.join(outDir, file)); if (fileSize > 1024 * 1024) { - log(`The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`, chalk.red(file), chalk.red(formatFileSize(fileSize))); + log( + `The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`, + chalk.red(file), + chalk.red(formatFileSize(fileSize)), + ); } }); } diff --git a/packages/core/build/src/utils/getDepsConfig.ts b/packages/core/build/src/utils/getDepsConfig.ts index 5e2c637d6..0e97030d4 100644 --- a/packages/core/build/src/utils/getDepsConfig.ts +++ b/packages/core/build/src/utils/getDepsConfig.ts @@ -1,4 +1,5 @@ import path from 'path'; + import fs from 'fs-extra'; export function winPath(path: string) { @@ -17,20 +18,15 @@ export function getRltExternalsFromDeps( depExternals: Record, current: { name: string; outputDir: string }, ) { - return Object.entries(depExternals).reduce>( - (r, [dep, target]) => { - // skip self - if (dep !== current.name) { - // transform dep externals path to relative path - r[dep] = winPath( - path.relative(current.outputDir, path.dirname(target)), - ); - } + return Object.entries(depExternals).reduce>((r, [dep, target]) => { + // skip self + if (dep !== current.name) { + // transform dep externals path to relative path + r[dep] = winPath(path.relative(current.outputDir, path.dirname(target))); + } - return r; - }, - {}, - ); + return r; + }, {}); } function findPackageJson(filePath) { @@ -44,7 +40,7 @@ function findPackageJson(filePath) { // 递归寻找直到根目录 return findPackageJson(directory); } else { - throw new Error('package.json not found.') + throw new Error('package.json not found.'); } } @@ -100,10 +96,10 @@ export function getDepsConfig(cwd: string, outDir: string, depsName: string[], e pkg: depPkg, outputDir, mainFile, - } + }; return acc; - }, {}) + }, {}); // process externals for deps Object.values(deps).forEach((depConfig) => { diff --git a/packages/core/build/src/utils/getPackages.ts b/packages/core/build/src/utils/getPackages.ts index b5c3c5240..e68704e97 100644 --- a/packages/core/build/src/utils/getPackages.ts +++ b/packages/core/build/src/utils/getPackages.ts @@ -1,10 +1,11 @@ -import Topo from '@hapi/topo'; -import fg from 'fast-glob'; import path from 'path'; + +import Topo from '@hapi/topo'; +import { findWorkspacePackages, type Project } from '@pnpm/workspace.find-packages'; +import fg from 'fast-glob'; + import { PACKAGES_PATH, ROOT_PATH } from '../constant'; import { toUnixPath } from './utils'; -import { findWorkspacePackages } from '@pnpm/workspace.find-packages'; -import type { Project } from '@pnpm/workspace.find-packages'; /** * 获取构建包的绝对路径,支持项目路径和 npm 两种形式 diff --git a/packages/core/build/src/utils/utils.ts b/packages/core/build/src/utils/utils.ts index fd1d3c32e..1602a8529 100644 --- a/packages/core/build/src/utils/utils.ts +++ b/packages/core/build/src/utils/utils.ts @@ -1,10 +1,12 @@ -import chalk from 'chalk'; import path from 'path'; + +import chalk from 'chalk'; +import { register } from 'esbuild-register/dist/node'; import fg from 'fast-glob'; import fs from 'fs-extra'; -import { Options as TsupConfig } from 'tsup' -import { InlineConfig as ViteConfig } from 'vite' -import { register } from 'esbuild-register/dist/node'; +import { Options as TsupConfig } from 'tsup'; +import { InlineConfig as ViteConfig } from 'vite'; + import { NODE_MODULES } from '../constant'; let previousColor = ''; @@ -73,9 +75,9 @@ export function getUserConfig(cwd: string) { throw new Error(`Multiple build configs found: ${buildConfigs.join(', ')}`); } if (buildConfigs.length === 1) { - const { unregister } = register({}) + const { unregister } = register({}); const userConfig = require(path.join(cwd, buildConfigs[0])); - unregister() + unregister(); Object.assign(config, userConfig.default || userConfig); } return config; diff --git a/packages/core/build/tsup.config.ts b/packages/core/build/tsup.config.ts index d8d4e0dd2..2b8d4a871 100644 --- a/packages/core/build/tsup.config.ts +++ b/packages/core/build/tsup.config.ts @@ -1,6 +1,8 @@ -import { defineConfig } from 'tsup'; -import fg from 'fast-glob'; import path from 'path'; + +import fg from 'fast-glob'; +import { defineConfig } from 'tsup'; + import { globExcludeFiles } from './src/constant'; const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd: __dirname, absolute: true }); diff --git a/packages/core/cli/rollup.config.js b/packages/core/cli/rollup.config.js index a682eaff9..8edcae020 100644 --- a/packages/core/cli/rollup.config.js +++ b/packages/core/cli/rollup.config.js @@ -1,11 +1,12 @@ import { builtinModules, createRequire } from 'node:module'; -import esbuild from 'rollup-plugin-esbuild'; import process from 'node:process'; -import dts from 'rollup-plugin-dts'; -import resolve from '@rollup/plugin-node-resolve'; + import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; +import resolve from '@rollup/plugin-node-resolve'; import { defineConfig } from 'rollup'; +import dts from 'rollup-plugin-dts'; +import esbuild from 'rollup-plugin-esbuild'; const require = createRequire(import.meta.url); const pkg = require('./package.json'); diff --git a/packages/core/cli/src/cli.ts b/packages/core/cli/src/cli.ts index 06484d920..9f78a42ac 100755 --- a/packages/core/cli/src/cli.ts +++ b/packages/core/cli/src/cli.ts @@ -1,11 +1,11 @@ #!/usr/bin/env node - import chalk from 'chalk'; -import { initEnv, genTsConfigPaths } from './util'; import { Command } from 'commander'; -import commands from './commands'; import semver from 'semver'; +import commands from './commands'; +import { genTsConfigPaths, initEnv } from './util'; + const cli = new Command(); cli.version((await import('../package.json')).version); diff --git a/packages/core/cli/src/commands/build.ts b/packages/core/cli/src/commands/build.ts index 41ed585c8..44118ab11 100644 --- a/packages/core/cli/src/commands/build.ts +++ b/packages/core/cli/src/commands/build.ts @@ -1,6 +1,8 @@ import { resolve } from 'path'; + import { type Command } from 'commander'; -import { run, nodeCheck, isPackageValid, buildIndexHtml } from '../util'; + +import { buildIndexHtml, isPackageValid, nodeCheck, run } from '../util'; /** * diff --git a/packages/core/cli/src/commands/clean.ts b/packages/core/cli/src/commands/clean.ts index fe5da5e37..f1dc1985d 100644 --- a/packages/core/cli/src/commands/clean.ts +++ b/packages/core/cli/src/commands/clean.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; -import { run, isDev } from '../util'; + +import { isDev, run } from '../util'; /** * diff --git a/packages/core/cli/src/commands/create-nginx-conf.ts b/packages/core/cli/src/commands/create-nginx-conf.ts index 6e03917b9..387b6caaf 100644 --- a/packages/core/cli/src/commands/create-nginx-conf.ts +++ b/packages/core/cli/src/commands/create-nginx-conf.ts @@ -1,8 +1,9 @@ -import { resolve } from 'path'; -import { Command } from 'commander'; import { readFileSync, writeFileSync } from 'fs'; +import { resolve } from 'path'; import { URL } from 'url'; +import { Command } from 'commander'; + const __dirname = new URL('.', import.meta.url).pathname; export default (cli: Command) => { diff --git a/packages/core/cli/src/commands/create-plugin.ts b/packages/core/cli/src/commands/create-plugin.ts index 32fd623c4..e18039ee1 100644 --- a/packages/core/cli/src/commands/create-plugin.ts +++ b/packages/core/cli/src/commands/create-plugin.ts @@ -1,5 +1,7 @@ import { resolve } from 'path'; + import { Command } from 'commander'; + import { PluginGenerator } from '../plugin-generator'; export default (cli: Command) => { diff --git a/packages/core/cli/src/commands/dev.ts b/packages/core/cli/src/commands/dev.ts index 7e43eb2b1..4129fd2f9 100644 --- a/packages/core/cli/src/commands/dev.ts +++ b/packages/core/cli/src/commands/dev.ts @@ -1,7 +1,8 @@ import { Command } from 'commander'; -import { run, postCheck, nodeCheck, promptForTs } from '../util'; import { getPortPromise } from 'portfinder'; +import { nodeCheck, postCheck, promptForTs, run } from '../util'; + export default (cli: Command) => { const { APP_PACKAGE_ROOT } = process.env; cli diff --git a/packages/core/cli/src/commands/e2e.ts b/packages/core/cli/src/commands/e2e.ts index 782761419..5d243d8d5 100644 --- a/packages/core/cli/src/commands/e2e.ts +++ b/packages/core/cli/src/commands/e2e.ts @@ -1,11 +1,13 @@ -import { Command } from 'commander'; -import { run, isPortReachable } from '../util'; import { execSync } from 'node:child_process'; -import axios from 'axios'; -import { pTest } from './p-test'; import { cpus } from 'os'; -import treeKill from 'tree-kill'; + +import axios from 'axios'; import chalk from 'chalk'; +import { Command } from 'commander'; +import treeKill from 'tree-kill'; + +import { isPortReachable, run } from '../util'; +import { pTest } from './p-test'; /** * 检查服务是否启动成功 diff --git a/packages/core/cli/src/commands/global.ts b/packages/core/cli/src/commands/global.ts index 48d6572e5..7cc1b729a 100644 --- a/packages/core/cli/src/commands/global.ts +++ b/packages/core/cli/src/commands/global.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; -import { run, isDev, isProd, promptForTs } from '../util'; + +import { isDev, isProd, promptForTs, run } from '../util'; export default (cli: Command) => { const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env; diff --git a/packages/core/cli/src/commands/index.ts b/packages/core/cli/src/commands/index.ts index bc4af7790..cd5530883 100644 --- a/packages/core/cli/src/commands/index.ts +++ b/packages/core/cli/src/commands/index.ts @@ -1,19 +1,20 @@ import { Command } from 'commander'; + import { generateAppDir } from '../util'; -import global from './global'; -import createNginxConf from './create-nginx-conf'; import build from './build'; -import tar from './tar'; -import dev from './dev'; -import start from './start'; -import e2e from './e2e'; import clean from './clean'; +import createNginxConf from './create-nginx-conf'; +import createPlugin from './create-plugin'; +import dev from './dev'; +import e2e from './e2e'; +import global from './global'; import pm2 from './pm2'; +import postinstall from './postinstall'; +import start from './start'; +import tar from './tar'; import test from './test'; import umi from './umi'; import upgrade from './upgrade'; -import postinstall from './postinstall'; -import createPlugin from './create-plugin'; export default async (cli: Command) => { generateAppDir(); diff --git a/packages/core/cli/src/commands/p-test.ts b/packages/core/cli/src/commands/p-test.ts index 44d0b9f97..c82e35ba8 100644 --- a/packages/core/cli/src/commands/p-test.ts +++ b/packages/core/cli/src/commands/p-test.ts @@ -1,10 +1,11 @@ -import { execa } from 'execa'; +import { existsSync, mkdirSync, readFileSync } from 'fs'; import { resolve } from 'path'; -import pAll from 'p-all'; + import { parse } from 'dotenv'; -import { existsSync, readFileSync, mkdirSync } from 'fs'; +import { execa } from 'execa'; import fastGlob from 'fast-glob'; import lodash from 'lodash'; +import pAll from 'p-all'; let ENV_FILE = resolve(process.cwd(), '.env.e2e'); diff --git a/packages/core/cli/src/commands/pm2.ts b/packages/core/cli/src/commands/pm2.ts index e4c89080b..d59120a50 100644 --- a/packages/core/cli/src/commands/pm2.ts +++ b/packages/core/cli/src/commands/pm2.ts @@ -1,4 +1,5 @@ import { Command } from 'commander'; + import { run } from '../util'; export default (cli: Command) => { diff --git a/packages/core/cli/src/commands/postinstall.ts b/packages/core/cli/src/commands/postinstall.ts index 772ad3b08..1d5f8cd67 100644 --- a/packages/core/cli/src/commands/postinstall.ts +++ b/packages/core/cli/src/commands/postinstall.ts @@ -1,9 +1,11 @@ -import { Command } from 'commander'; -import { run, isDev, isPackageValid, generatePlaywrightPath } from '../util'; -import { resolve } from 'path'; import { existsSync } from 'fs'; import { readFile, writeFile } from 'fs/promises'; -import { createStoragePluginsSymlink, createDevPluginsSymlink } from '@tachybase/utils/plugin-symlink'; +import { resolve } from 'path'; +import { createDevPluginsSymlink, createStoragePluginsSymlink } from '@tachybase/utils/plugin-symlink'; + +import { Command } from 'commander'; + +import { generatePlaywrightPath, isDev, isPackageValid, run } from '../util'; export default (cli: Command) => { const { APP_PACKAGE_ROOT } = process.env; diff --git a/packages/core/cli/src/commands/start.ts b/packages/core/cli/src/commands/start.ts index b7232bcf5..37b438de5 100644 --- a/packages/core/cli/src/commands/start.ts +++ b/packages/core/cli/src/commands/start.ts @@ -1,10 +1,12 @@ -import { Command } from 'commander'; -import { run, postCheck, promptForTs } from '../util'; import { existsSync } from 'fs'; import { resolve } from 'path'; + import chalk from 'chalk'; +import { Command } from 'commander'; import _ from 'lodash'; +import { postCheck, promptForTs, run } from '../util'; + export default (cli: Command) => { const { APP_PACKAGE_ROOT, NODE_ARGS } = process.env; cli diff --git a/packages/core/cli/src/commands/tar.ts b/packages/core/cli/src/commands/tar.ts index add49e900..b7f965b1c 100644 --- a/packages/core/cli/src/commands/tar.ts +++ b/packages/core/cli/src/commands/tar.ts @@ -1,6 +1,8 @@ import { resolve } from 'path'; + import { Command } from 'commander'; -import { run, nodeCheck, isPackageValid } from '../util'; + +import { isPackageValid, nodeCheck, run } from '../util'; export default (cli: Command) => { cli diff --git a/packages/core/cli/src/commands/test.ts b/packages/core/cli/src/commands/test.ts index 797ab8a0e..a2ec1ee23 100644 --- a/packages/core/cli/src/commands/test.ts +++ b/packages/core/cli/src/commands/test.ts @@ -1,7 +1,9 @@ -import { Command } from 'commander'; -import { run } from '../util'; import { sep } from 'path'; +import { Command } from 'commander'; + +import { run } from '../util'; + function addTestCommand(name: string, cli: Command) { return cli .command(name) diff --git a/packages/core/cli/src/commands/umi.ts b/packages/core/cli/src/commands/umi.ts index 22e60a2e3..15ab7fed6 100644 --- a/packages/core/cli/src/commands/umi.ts +++ b/packages/core/cli/src/commands/umi.ts @@ -1,5 +1,6 @@ import { Command } from 'commander'; -import { run, isDev } from '../util'; + +import { isDev, run } from '../util'; export default (cli: Command) => { const { APP_PACKAGE_ROOT } = process.env; diff --git a/packages/core/cli/src/commands/upgrade.ts b/packages/core/cli/src/commands/upgrade.ts index 47e39d730..18685c737 100644 --- a/packages/core/cli/src/commands/upgrade.ts +++ b/packages/core/cli/src/commands/upgrade.ts @@ -1,7 +1,9 @@ -import { Command } from 'commander'; -import { resolve } from 'path'; -import { run, promptForTs, runAppCommand, hasCorePackages, hasTsNode } from '../util'; import { existsSync, rmSync } from 'fs'; +import { resolve } from 'path'; + +import { Command } from 'commander'; + +import { hasCorePackages, hasTsNode, promptForTs, run, runAppCommand } from '../util'; export default (cli: Command) => { cli diff --git a/packages/core/cli/src/plugin-generator.ts b/packages/core/cli/src/plugin-generator.ts index bfd9721b5..32b6abd38 100644 --- a/packages/core/cli/src/plugin-generator.ts +++ b/packages/core/cli/src/plugin-generator.ts @@ -1,12 +1,14 @@ -import chalk from 'chalk'; import { existsSync } from 'fs'; -import { join, resolve } from 'path'; -import { Generator } from '@umijs/utils'; import { readFile } from 'fs/promises'; -import { genTsConfigPaths } from './util'; -import { execa } from 'execa'; +import { join, resolve } from 'path'; import { URL } from 'url'; +import { Generator } from '@umijs/utils'; +import chalk from 'chalk'; +import { execa } from 'execa'; + +import { genTsConfigPaths } from './util'; + const __dirname = new URL('.', import.meta.url).pathname; function camelize(str: string) { @@ -40,7 +42,7 @@ export class PluginGenerator extends Generator { ...this.context, packageName: name, packageVersion, - tachybaseVersion: "0.0.1", + tachybaseVersion: '0.0.1', pascalCaseName: capitalize(camelize(name.split('/').pop())), }; } diff --git a/packages/core/cli/src/util.ts b/packages/core/cli/src/util.ts index 5c5a840f1..82a52f17a 100644 --- a/packages/core/cli/src/util.ts +++ b/packages/core/cli/src/util.ts @@ -1,27 +1,32 @@ +import { + cpSync as _cpSync, + existsSync as _existsSync, + writeFileSync as _writeFileSync, + copyFileSync, + cpSync, + existsSync, + mkdirSync, + readFileSync, + rmSync, + symlinkSync, + unlinkSync, + writeFileSync, +} from 'fs'; +import { readFile, writeFile } from 'fs/promises'; +import { createRequire } from 'module'; import { Socket } from 'net'; +import { dirname, join, resolve, sep } from 'path'; + import chalk from 'chalk'; +import { config } from 'dotenv'; import { execa, Options } from 'execa'; import fastGlob from 'fast-glob'; -import { dirname, join, resolve, sep } from 'path'; -import { readFile, writeFile } from 'fs/promises'; -import { existsSync, mkdirSync, cpSync, writeFileSync } from 'fs'; -import { config } from 'dotenv'; -import { - unlinkSync, - symlinkSync, - existsSync as _existsSync, - rmSync, - cpSync as _cpSync, - copyFileSync, - readFileSync, - writeFileSync as _writeFileSync, -} from 'fs'; -import { createRequire } from 'module'; + const require = createRequire(import.meta.url); export function isPackageValid(pkg: string) { try { - require(pkg) + require(pkg); return true; } catch (error) { return false; diff --git a/packages/core/client/src/api-client/__tests__/APIClient.test.tsx b/packages/core/client/src/api-client/__tests__/APIClient.test.tsx index 62ab42d2c..cd226deb8 100644 --- a/packages/core/client/src/api-client/__tests__/APIClient.test.tsx +++ b/packages/core/client/src/api-client/__tests__/APIClient.test.tsx @@ -1,4 +1,5 @@ import axios from 'axios'; + import { APIClient } from '../APIClient'; describe('APIClient', () => { diff --git a/packages/core/client/src/api-client/demos/demo1.tsx b/packages/core/client/src/api-client/demos/demo1.tsx index 8d39ef282..9d8a41ab7 100644 --- a/packages/core/client/src/api-client/demos/demo1.tsx +++ b/packages/core/client/src/api-client/demos/demo1.tsx @@ -1,6 +1,7 @@ -import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client'; -import MockAdapter from 'axios-mock-adapter'; import React from 'react'; +import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client'; + +import MockAdapter from 'axios-mock-adapter'; const apiClient = new APIClient(); diff --git a/packages/core/client/src/api-client/demos/demo2.tsx b/packages/core/client/src/api-client/demos/demo2.tsx index f337e0b6c..ff036e3d4 100644 --- a/packages/core/client/src/api-client/demos/demo2.tsx +++ b/packages/core/client/src/api-client/demos/demo2.tsx @@ -1,6 +1,7 @@ -import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client'; -import MockAdapter from 'axios-mock-adapter'; import React from 'react'; +import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client'; + +import MockAdapter from 'axios-mock-adapter'; const apiClient = new APIClient(); diff --git a/packages/core/client/src/api-client/demos/demo3.tsx b/packages/core/client/src/api-client/demos/demo3.tsx index 2d1043f87..003c75e3c 100644 --- a/packages/core/client/src/api-client/demos/demo3.tsx +++ b/packages/core/client/src/api-client/demos/demo3.tsx @@ -1,8 +1,9 @@ -import { uid } from '@tachybase/schema'; +import React from 'react'; import { APIClient, APIClientProvider, useAPIClient, useRequest } from '@tachybase/client'; +import { uid } from '@tachybase/schema'; + import { Button, Input, Space, Table } from 'antd'; import MockAdapter from 'axios-mock-adapter'; -import React from 'react'; const apiClient = new APIClient(); diff --git a/packages/core/client/src/application/__tests__/Application.test.tsx b/packages/core/client/src/application/__tests__/Application.test.tsx index de44e140d..dff3f27b0 100644 --- a/packages/core/client/src/application/__tests__/Application.test.tsx +++ b/packages/core/client/src/application/__tests__/Application.test.tsx @@ -1,9 +1,11 @@ +import React, { Component } from 'react'; import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client'; + import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; -import React, { Component } from 'react'; import { Link, Outlet } from 'react-router-dom'; import { describe } from 'vitest'; + import { Application } from '../Application'; import { Plugin } from '../Plugin'; diff --git a/packages/core/client/src/application/__tests__/PluginSettingsManager.test.ts b/packages/core/client/src/application/__tests__/PluginSettingsManager.test.ts index f001237d8..f1eaa5772 100644 --- a/packages/core/client/src/application/__tests__/PluginSettingsManager.test.ts +++ b/packages/core/client/src/application/__tests__/PluginSettingsManager.test.ts @@ -1,7 +1,8 @@ -import { Application } from '../Application'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import { Application } from '../Application'; + describe('PluginSettingsManager', () => { let app: Application; diff --git a/packages/core/client/src/application/__tests__/RouterManager.test.tsx b/packages/core/client/src/application/__tests__/RouterManager.test.tsx index 57cd4e3cf..3cda70542 100644 --- a/packages/core/client/src/application/__tests__/RouterManager.test.tsx +++ b/packages/core/client/src/application/__tests__/RouterManager.test.tsx @@ -1,11 +1,13 @@ -import { render, screen, userEvent, sleep, waitFor } from '@tachybase/test/client'; +import React, { FC } from 'react'; +import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client'; + import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; -import React, { FC } from 'react'; import { Link, Outlet } from 'react-router-dom'; import { beforeAll } from 'vitest'; + import { Application } from '../Application'; -import { RouteType, RouterManager, createRouterManager } from '../RouterManager'; +import { createRouterManager, RouterManager, RouteType } from '../RouterManager'; describe('Router', () => { let app: Application; diff --git a/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx b/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx index 04124e342..02342cb1f 100644 --- a/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx +++ b/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx @@ -1,9 +1,10 @@ import React from 'react'; -import { fireEvent, render, screen, waitFor } from '@tachybase/test/client'; -import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar'; -import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component'; -import { useFieldSchema } from '@tachybase/schema'; import { Application, ApplicationContext } from '@tachybase/client'; +import { useFieldSchema } from '@tachybase/schema'; +import { fireEvent, render, screen, waitFor } from '@tachybase/test/client'; + +import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component'; +import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar'; describe('SchemaToolbar', () => { test('SchemaToolbarProvider & useSchemaToolbar', () => { diff --git a/packages/core/client/src/application/__tests__/hoc/withDynamicSchemaProps.test.tsx b/packages/core/client/src/application/__tests__/hoc/withDynamicSchemaProps.test.tsx index 35b74270b..cf8baabdd 100644 --- a/packages/core/client/src/application/__tests__/hoc/withDynamicSchemaProps.test.tsx +++ b/packages/core/client/src/application/__tests__/hoc/withDynamicSchemaProps.test.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component'; import { render } from '@tachybase/test/client'; + +import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component'; import { withDynamicSchemaProps } from '../../hoc'; const HelloComponent = withDynamicSchemaProps((props: any) => ( diff --git a/packages/core/client/src/application/__tests__/utils.test.tsx b/packages/core/client/src/application/__tests__/utils.test.tsx index 50e40402b..19b4799b1 100644 --- a/packages/core/client/src/application/__tests__/utils.test.tsx +++ b/packages/core/client/src/application/__tests__/utils.test.tsx @@ -1,6 +1,8 @@ -import { render, screen } from '@tachybase/test/client'; import React from 'react'; +import { render, screen } from '@tachybase/test/client'; + import { describe } from 'vitest'; + import { compose, normalizeContainer } from '../utils'; describe('utils', () => { diff --git a/packages/core/client/src/application/context.ts b/packages/core/client/src/application/context.ts index ada436a8e..1affc9c17 100644 --- a/packages/core/client/src/application/context.ts +++ b/packages/core/client/src/application/context.ts @@ -1,4 +1,5 @@ import { createContext } from 'react'; + import { Application } from './Application'; export const ApplicationContext = createContext(null); diff --git a/packages/core/client/src/application/schema-initializer/SchemaInitializer.tsx b/packages/core/client/src/application/schema-initializer/SchemaInitializer.tsx index 5850aa48a..b1ed448cb 100644 --- a/packages/core/client/src/application/schema-initializer/SchemaInitializer.tsx +++ b/packages/core/client/src/application/schema-initializer/SchemaInitializer.tsx @@ -1,4 +1,5 @@ import type { ButtonProps } from 'antd'; + import { SchemaInitializerItemType, SchemaInitializerItemTypeWithoutName, SchemaInitializerOptions } from './types'; export class SchemaInitializer { diff --git a/packages/core/client/src/application/schema-initializer/SchemaInitializerManager.ts b/packages/core/client/src/application/schema-initializer/SchemaInitializerManager.ts index e09233f7a..5dafb77b8 100644 --- a/packages/core/client/src/application/schema-initializer/SchemaInitializerManager.ts +++ b/packages/core/client/src/application/schema-initializer/SchemaInitializerManager.ts @@ -1,4 +1,5 @@ import { ButtonProps } from 'antd'; + import { Application } from '../Application'; import { SchemaInitializer } from './SchemaInitializer'; import { SchemaInitializerItemTypeWithoutName } from './types'; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerActionModal.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerActionModal.tsx index e0f58f1c8..1b4245666 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerActionModal.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerActionModal.tsx @@ -1,6 +1,7 @@ -import { useForm } from '@tachybase/schema'; import React, { FC, useCallback, useMemo } from 'react'; -import { useActionContext, SchemaComponent } from '../../../schema-component'; +import { useForm } from '@tachybase/schema'; + +import { SchemaComponent, useActionContext } from '../../../schema-component'; import { useSchemaInitializerItem } from '../context'; export interface SchemaInitializerActionModalProps { diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerButton.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerButton.tsx index 443fd830f..89bccc863 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerButton.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerButton.tsx @@ -1,5 +1,7 @@ -import { Button, ButtonProps } from 'antd'; import React, { FC } from 'react'; + +import { Button, ButtonProps } from 'antd'; + import { Icon } from '../../../icon'; import { useCompile } from '../../../schema-component'; import { useGetAriaLabelOfSchemaInitializer } from '../../../schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer'; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx index 8a0642af4..d5b71fb42 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerChildren.tsx @@ -3,6 +3,7 @@ import React, { FC, memo, useMemo } from 'react'; import { useFindComponent } from '../../../schema-component'; import { SchemaInitializerItemContext } from '../context'; import { SchemaInitializerItemType } from '../types'; + export const SchemaInitializerChildren: FC<{ children: SchemaInitializerItemType[] }> = (props) => { const { children } = props; if (!children) return null; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerDivider.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerDivider.tsx index 0413d813b..3acaa4319 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerDivider.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerDivider.tsx @@ -1,6 +1,7 @@ -import { Divider, theme } from 'antd'; import React from 'react'; +import { Divider, theme } from 'antd'; + export const SchemaInitializerDivider = () => { const { token } = theme.useToken(); return ; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItem.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItem.tsx index f0d81d886..03ba038a1 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItem.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItem.tsx @@ -1,6 +1,8 @@ +import React, { memo, ReactNode, useMemo } from 'react'; import { uid } from '@tachybase/schema'; + import classNames from 'classnames'; -import React, { ReactNode, memo, useMemo } from 'react'; + import { Icon } from '../../../icon'; import { useCompile } from '../../../schema-component'; import { useSchemaInitializerItem } from '../context'; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItemGroup.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItemGroup.tsx index 728f3501e..3b130ff7d 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItemGroup.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItemGroup.tsx @@ -1,5 +1,7 @@ -import { theme } from 'antd'; import React, { FC } from 'react'; + +import { theme } from 'antd'; + import { useCompile } from '../../../schema-component'; import { useSchemaInitializerItem } from '../context'; import { SchemaInitializerOptions } from '../types'; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItems.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItems.tsx index 0361cd758..a331d29b9 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItems.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerItems.tsx @@ -1,7 +1,9 @@ -import { ButtonProps } from 'antd'; import React, { FC } from 'react'; -import { SchemaInitializerChildren } from './SchemaInitializerChildren'; + +import { ButtonProps } from 'antd'; + import { SchemaInitializerOptions } from '../types'; +import { SchemaInitializerChildren } from './SchemaInitializerChildren'; export type SchemaInitializerItemsProps = P2 & { options?: SchemaInitializerOptions; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSelect.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSelect.tsx index f220bcdd1..2a6ee2ff4 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSelect.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSelect.tsx @@ -1,7 +1,9 @@ -import { Select, SelectProps } from 'antd'; import React, { FC, useCallback, useMemo, useState } from 'react'; -import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem'; + +import { Select, SelectProps } from 'antd'; + import { useSchemaInitializerItem } from '../context'; +import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem'; export interface SchemaInitializerSelectItemProps extends SchemaInitializerItemProps { options?: SelectProps['options']; diff --git a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSwitch.tsx b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSwitch.tsx index 164242c6d..b5eb3f405 100644 --- a/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSwitch.tsx +++ b/packages/core/client/src/application/schema-initializer/components/SchemaInitializerSwitch.tsx @@ -1,8 +1,10 @@ -import { Switch } from 'antd'; import React, { FC } from 'react'; -import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem'; + +import { Switch } from 'antd'; + import { useCompile } from '../../../schema-component'; import { useSchemaInitializerItem } from '../context'; +import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem'; export interface SchemaInitializerSwitchItemProps extends SchemaInitializerItemProps { checked?: boolean; diff --git a/packages/core/client/src/application/schema-initializer/context/index.ts b/packages/core/client/src/application/schema-initializer/context/index.ts index 6a1154a25..e6081d23e 100644 --- a/packages/core/client/src/application/schema-initializer/context/index.ts +++ b/packages/core/client/src/application/schema-initializer/context/index.ts @@ -1,4 +1,5 @@ import React, { createContext } from 'react'; + import { InsertType, SchemaInitializerItemType, SchemaInitializerOptions } from '../types'; export const SchemaInitializerContext = createContext<{ diff --git a/packages/core/client/src/application/schema-initializer/hooks/useAriaAttributeOfMenuItem.ts b/packages/core/client/src/application/schema-initializer/hooks/useAriaAttributeOfMenuItem.ts index b1f38193c..c2a7565a2 100644 --- a/packages/core/client/src/application/schema-initializer/hooks/useAriaAttributeOfMenuItem.ts +++ b/packages/core/client/src/application/schema-initializer/hooks/useAriaAttributeOfMenuItem.ts @@ -1,4 +1,5 @@ import { useMemo } from 'react'; + import { useSchemaInitializerSubMenuContext } from '../components/SchemaInitializerSubMenu'; /** diff --git a/packages/core/client/src/application/schema-initializer/types.ts b/packages/core/client/src/application/schema-initializer/types.ts index e7ef92202..c91e2804e 100644 --- a/packages/core/client/src/application/schema-initializer/types.ts +++ b/packages/core/client/src/application/schema-initializer/types.ts @@ -1,6 +1,8 @@ -import { ISchema } from '@tachybase/schema'; -import { ButtonProps, PopoverProps } from 'antd'; import { ComponentType, ReactNode } from 'react'; +import { ISchema } from '@tachybase/schema'; + +import { ButtonProps, PopoverProps } from 'antd'; + import type { SchemaInitializerActionModalProps, SchemaInitializerItemGroupProps, diff --git a/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx b/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx index 539ab065e..db97da38d 100644 --- a/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx +++ b/packages/core/client/src/application/schema-settings/SchemaSettingsDefaults.tsx @@ -1,10 +1,12 @@ -import { ISchema, useFieldSchema } from '@tachybase/schema'; -import { SchemaSettingsItemType } from './types'; -import { useTranslation } from 'react-i18next'; -import { createDesignable, useDesignable } from '../../schema-component'; -import { saveAs } from 'file-saver'; -import { useAPIClient } from '../../api-client'; import { useMemo } from 'react'; +import { ISchema, useFieldSchema } from '@tachybase/schema'; + +import { saveAs } from 'file-saver'; +import { useTranslation } from 'react-i18next'; + +import { useAPIClient } from '../../api-client'; +import { createDesignable, useDesignable } from '../../schema-component'; +import { SchemaSettingsItemType } from './types'; export const defaultSettingItems = [ { diff --git a/packages/core/client/src/application/schema-settings/components/SchemaSettingsIcon.tsx b/packages/core/client/src/application/schema-settings/components/SchemaSettingsIcon.tsx index cd6e6e5fa..a7387e1b6 100644 --- a/packages/core/client/src/application/schema-settings/components/SchemaSettingsIcon.tsx +++ b/packages/core/client/src/application/schema-settings/components/SchemaSettingsIcon.tsx @@ -1,5 +1,7 @@ -import { MenuOutlined } from '@ant-design/icons'; import React, { FC, useMemo } from 'react'; + +import { MenuOutlined } from '@ant-design/icons'; + import { useGetAriaLabelOfDesigner } from '../../../schema-settings/hooks/useGetAriaLabelOfDesigner'; import { SchemaSettingOptions } from '../types'; diff --git a/packages/core/client/src/application/schema-settings/components/SchemaSettingsWrapper.tsx b/packages/core/client/src/application/schema-settings/components/SchemaSettingsWrapper.tsx index e822b268c..5c2ae5bd7 100644 --- a/packages/core/client/src/application/schema-settings/components/SchemaSettingsWrapper.tsx +++ b/packages/core/client/src/application/schema-settings/components/SchemaSettingsWrapper.tsx @@ -1,11 +1,11 @@ -import { FC, useMemo } from 'react'; +import React, { FC, useMemo } from 'react'; +import { useField, useFieldSchema } from '@tachybase/schema'; + +import { useDesignable } from '../../../schema-component'; import { SchemaSettingsDropdown } from '../../../schema-settings'; import { SchemaSettingOptions } from '../types'; import { SchemaSettingsChildren } from './SchemaSettingsChildren'; import { SchemaSettingsIcon } from './SchemaSettingsIcon'; -import React from 'react'; -import { useDesignable } from '../../../schema-component'; -import { useField, useFieldSchema } from '@tachybase/schema'; /** * @internal diff --git a/packages/core/client/src/application/schema-settings/context/index.ts b/packages/core/client/src/application/schema-settings/context/index.ts index 5b197f7a6..7404bdbf3 100644 --- a/packages/core/client/src/application/schema-settings/context/index.ts +++ b/packages/core/client/src/application/schema-settings/context/index.ts @@ -1,4 +1,5 @@ import { createContext, useContext } from 'react'; + import { SchemaSettingsItemType } from '../types'; export const SchemaSettingItemContext = createContext({} as any); diff --git a/packages/core/client/src/application/schema-settings/types.ts b/packages/core/client/src/application/schema-settings/types.ts index c00971083..69aaf344e 100644 --- a/packages/core/client/src/application/schema-settings/types.ts +++ b/packages/core/client/src/application/schema-settings/types.ts @@ -1,4 +1,5 @@ import { ComponentType } from 'react'; + import { SchemaSettingsCascaderItemProps, SchemaSettingsItemProps, diff --git a/packages/core/client/src/application/schema-toolbar/context/index.tsx b/packages/core/client/src/application/schema-toolbar/context/index.tsx index 80c285ff7..a3cc8c3df 100644 --- a/packages/core/client/src/application/schema-toolbar/context/index.tsx +++ b/packages/core/client/src/application/schema-toolbar/context/index.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { createContext, useContext } from 'react'; +import React, { createContext, useContext } from 'react'; export const SchemaToolbarContext = createContext({}); SchemaToolbarContext.displayName = 'SchemaToolbarContext'; diff --git a/packages/core/client/src/application/schema-toolbar/hooks/index.tsx b/packages/core/client/src/application/schema-toolbar/hooks/index.tsx index a8e670279..66258f1a2 100644 --- a/packages/core/client/src/application/schema-toolbar/hooks/index.tsx +++ b/packages/core/client/src/application/schema-toolbar/hooks/index.tsx @@ -1,5 +1,6 @@ import React, { useMemo } from 'react'; import { ISchema } from '@tachybase/schema'; + import { useComponent, useDesignable } from '../../../schema-component'; import { SchemaToolbar, SchemaToolbarProps } from '../../../schema-settings/GeneralSchemaDesigner'; diff --git a/packages/core/client/src/application/utils/requirejs.ts b/packages/core/client/src/application/utils/requirejs.ts index 10aeddfcf..f8434beeb 100644 --- a/packages/core/client/src/application/utils/requirejs.ts +++ b/packages/core/client/src/application/utils/requirejs.ts @@ -2,12 +2,12 @@ // @ts-nocheck /* eslint-disable */ /* prettier-ignore */ -import type { Require, RequireDefine } from './types' +import type { Require, RequireDefine } from './types'; export interface RequireJS { - require: Require - requirejs: Require - define: RequireDefine + require: Require; + requirejs: Require; + define: RequireDefine; } /** @@ -15,10 +15,18 @@ export interface RequireJS { */ export function getRequireJs(): RequireJS { var requirejs, require, define; - var req, s, head, baseElement, dataMain, src, - interactiveScript, currentlyAddingScript, mainScript, subPath, + var req, + s, + head, + baseElement, + dataMain, + src, + interactiveScript, + currentlyAddingScript, + mainScript, + subPath, version = '2.3.6', - commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg, + commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, currDirRegExp = /^\.\//, @@ -31,8 +39,7 @@ export function getRequireJs(): RequireJS { //specifically. Sequence is 'loading', 'loaded', execution, // then 'complete'. The UA check is unfortunate, but not sure how //to feature test w/o causing perf issues. - readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? - /^complete$/ : /^(complete|loaded)$/, + readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? /^complete$/ : /^(complete|loaded)$/, defContextName = '_', //Oh the tragedy, detecting opera. See the usage of isOpera for reason. isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]', @@ -116,10 +123,14 @@ export function getRequireJs(): RequireJS { if (source) { eachProp(source, function (value, prop) { if (force || !hasProp(target, prop)) { - if (deepStringMixin && typeof value === 'object' && value && - !isArray(value) && !isFunction(value) && - !(value instanceof RegExp)) { - + if ( + deepStringMixin && + typeof value === 'object' && + value && + !isArray(value) && + !isFunction(value) && + !(value instanceof RegExp) + ) { if (!target[prop]) { target[prop] = {}; } @@ -203,7 +214,10 @@ export function getRequireJs(): RequireJS { } function newContext(contextName) { - var inCheckLoaded, Module, context, handlers, + var inCheckLoaded, + Module, + context, + handlers, checkLoadedTimeoutId, config = { //Defaults. Do not set a default for map @@ -215,7 +229,7 @@ export function getRequireJs(): RequireJS { bundles: {}, pkgs: {}, shim: {}, - config: {} + config: {}, }, registry = {}, //registry of just enabled modules, to speed @@ -273,9 +287,19 @@ export function getRequireJs(): RequireJS { * @returns {String} normalized name */ function normalize(name, baseName, applyMap) { - var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, - foundMap, foundI, foundStarMap, starI, normalizedBaseParts, - baseParts = (baseName && baseName.split('/')), + var pkgMain, + mapValue, + nameParts, + i, + j, + nameSegment, + lastIndex, + foundMap, + foundI, + foundStarMap, + starI, + normalizedBaseParts, + baseParts = baseName && baseName.split('/'), map = config.map, starMap = map && map['*']; @@ -364,8 +388,10 @@ export function getRequireJs(): RequireJS { function removeScript(name) { if (isBrowser) { each(scripts(), function (scriptNode) { - if (scriptNode.getAttribute('data-requiremodule') === name && - scriptNode.getAttribute('data-requirecontext') === context.contextName) { + if ( + scriptNode.getAttribute('data-requiremodule') === name && + scriptNode.getAttribute('data-requirecontext') === context.contextName + ) { scriptNode.parentNode.removeChild(scriptNode); return true; } @@ -384,7 +410,7 @@ export function getRequireJs(): RequireJS { //Custom require that does not do map translation, since //ID is "absolute", already mapped/resolved. context.makeRequire(null, { - skipMap: true + skipMap: true, })([id]); return true; @@ -420,7 +446,10 @@ export function getRequireJs(): RequireJS { * @returns {Object} */ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) { - var url, pluginModule, suffix, nameParts, + var url, + pluginModule, + suffix, + nameParts, prefix = null, parentName = parentModuleMap ? parentModuleMap.name : null, originalName = name, @@ -461,9 +490,7 @@ export function getRequireJs(): RequireJS { // loaded and all normalizations to allow for async // loading of a loader plugin. But for now, fixes the // common uses. Details in #1131 - normalizedName = name.indexOf('!') === -1 ? - normalize(name, parentName, applyMap) : - name; + normalizedName = name.indexOf('!') === -1 ? normalize(name, parentName, applyMap) : name; } } else { //A regular module. @@ -484,9 +511,7 @@ export function getRequireJs(): RequireJS { //If the id is a plugin id that cannot be determined if it needs //normalization, stamp it with a unique ID so two matching relative //ids that may conflict can be separate. - suffix = prefix && !pluginModule && !isNormalized ? - '_unnormalized' + (unnormalizedCounter += 1) : - ''; + suffix = prefix && !pluginModule && !isNormalized ? '_unnormalized' + (unnormalizedCounter += 1) : ''; return { prefix: prefix, @@ -496,9 +521,7 @@ export function getRequireJs(): RequireJS { url: url, originalName: originalName, isDefine: isDefine, - id: (prefix ? - prefix + '!' + normalizedName : - normalizedName) + suffix + id: (prefix ? prefix + '!' + normalizedName : normalizedName) + suffix, }; } @@ -517,8 +540,7 @@ export function getRequireJs(): RequireJS { var id = depMap.id, mod = getOwn(registry, id); - if (hasProp(defined, id) && - (!mod || mod.defineEmitComplete)) { + if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) { if (name === 'defined') { fn(defined[id]); } @@ -576,14 +598,14 @@ export function getRequireJs(): RequireJS { } handlers = { - 'require': function (mod) { + require: function (mod) { if (mod.require) { return mod.require; } else { return (mod.require = context.makeRequire(mod.map)); } }, - 'exports': function (mod) { + exports: function (mod) { mod.usingExports = true; if (mod.map.isDefine) { if (mod.exports) { @@ -593,7 +615,7 @@ export function getRequireJs(): RequireJS { } } }, - 'module': function (mod) { + module: function (mod) { if (mod.module) { return mod.module; } else { @@ -603,10 +625,10 @@ export function getRequireJs(): RequireJS { config: function () { return getOwn(config.config, mod.map.id) || {}; }, - exports: mod.exports || (mod.exports = {}) + exports: mod.exports || (mod.exports = {}), }); } - } + }, }; function cleanRegistry(id) { @@ -644,10 +666,11 @@ export function getRequireJs(): RequireJS { } function checkLoaded() { - var err, usingPathFallback, + var err, + usingPathFallback, waitInterval = config.waitSeconds * 1000, //It is possible to disable the wait interval by using waitSeconds of 0. - expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), + expired = waitInterval && context.startTime + waitInterval < new Date().getTime(), noLoads = [], reqCalls = [], stillLoading = false, @@ -813,7 +836,7 @@ export function getRequireJs(): RequireJS { } this.fetched = true; - context.startTime = (new Date()).getTime(); + context.startTime = new Date().getTime(); var map = this.map; @@ -821,10 +844,13 @@ export function getRequireJs(): RequireJS { //ask the plugin to load it now. if (this.shim) { context.makeRequire(this.map, { - enableBuildCallback: true - })(this.shim.deps || [], bind(this, function () { - return map.prefix ? this.callPlugin() : this.load(); - })); + enableBuildCallback: true, + })( + this.shim.deps || [], + bind(this, function () { + return map.prefix ? this.callPlugin() : this.load(); + }), + ); } else { //Regular dependency. return map.prefix ? this.callPlugin() : this.load(); @@ -850,7 +876,8 @@ export function getRequireJs(): RequireJS { return; } - var err, cjsModule, + var err, + cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, @@ -878,8 +905,7 @@ export function getRequireJs(): RequireJS { //errbacks should not be called for failures in //their callbacks (#699). However if a global //onError is set, use that. - if ((this.events.error && this.map.isDefine) || - req.onError !== defaultOnError) { + if ((this.events.error && this.map.isDefine) || req.onError !== defaultOnError) { try { exports = context.execCb(id, factory, depExports, exports); } catch (e) { @@ -908,7 +934,6 @@ export function getRequireJs(): RequireJS { err.requireType = this.map.isDefine ? 'define' : 'require'; return onError((this.error = err)); } - } else { //Just a literal value exports = factory; @@ -944,7 +969,6 @@ export function getRequireJs(): RequireJS { this.emit('defined', this.exports); this.defineEmitComplete = true; } - } }, @@ -958,148 +982,169 @@ export function getRequireJs(): RequireJS { //can be traced for cycles. this.depMaps.push(pluginMap); - on(pluginMap, 'defined', bind(this, function (plugin) { - var load, normalizedMap, normalizedMod, - bundleId = getOwn(bundlesMap, this.map.id), - name = this.map.name, - parentName = this.map.parentMap ? this.map.parentMap.name : null, - localRequire = context.makeRequire(map.parentMap, { - enableBuildCallback: true - }); + on( + pluginMap, + 'defined', + bind(this, function (plugin) { + var load, + normalizedMap, + normalizedMod, + bundleId = getOwn(bundlesMap, this.map.id), + name = this.map.name, + parentName = this.map.parentMap ? this.map.parentMap.name : null, + localRequire = context.makeRequire(map.parentMap, { + enableBuildCallback: true, + }); - //If current map is not normalized, wait for that - //normalized name to load instead of continuing. - if (this.map.unnormalized) { - //Normalize the ID if the plugin allows it. - if (plugin.normalize) { - name = plugin.normalize(name, function (name) { - return normalize(name, parentName, true); - }) || ''; + //If current map is not normalized, wait for that + //normalized name to load instead of continuing. + if (this.map.unnormalized) { + //Normalize the ID if the plugin allows it. + if (plugin.normalize) { + name = + plugin.normalize(name, function (name) { + return normalize(name, parentName, true); + }) || ''; + } + + //prefix and name should already be normalized, no need + //for applying map config again either. + normalizedMap = makeModuleMap(map.prefix + '!' + name, this.map.parentMap, true); + on( + normalizedMap, + 'defined', + bind(this, function (value) { + this.map.normalizedMap = normalizedMap; + this.init( + [], + function () { + return value; + }, + null, + { + enabled: true, + ignore: true, + }, + ); + }), + ); + + normalizedMod = getOwn(registry, normalizedMap.id); + if (normalizedMod) { + //Mark this as a dependency for this plugin, so it + //can be traced for cycles. + this.depMaps.push(normalizedMap); + + if (this.events.error) { + normalizedMod.on( + 'error', + bind(this, function (err) { + this.emit('error', err); + }), + ); + } + normalizedMod.enable(); + } + + return; } - //prefix and name should already be normalized, no need - //for applying map config again either. - normalizedMap = makeModuleMap(map.prefix + '!' + name, - this.map.parentMap, - true); - on(normalizedMap, - 'defined', bind(this, function (value) { - this.map.normalizedMap = normalizedMap; - this.init([], function () { return value; }, null, { + //If a paths config, then just load that file instead to + //resolve the plugin, as it is built into that paths layer. + if (bundleId) { + this.map.url = context.nameToUrl(bundleId); + this.load(); + return; + } + + load = bind(this, function (value) { + this.init( + [], + function () { + return value; + }, + null, + { enabled: true, - ignore: true - }); - })); - - normalizedMod = getOwn(registry, normalizedMap.id); - if (normalizedMod) { - //Mark this as a dependency for this plugin, so it - //can be traced for cycles. - this.depMaps.push(normalizedMap); - - if (this.events.error) { - normalizedMod.on('error', bind(this, function (err) { - this.emit('error', err); - })); - } - normalizedMod.enable(); - } - - return; - } - - //If a paths config, then just load that file instead to - //resolve the plugin, as it is built into that paths layer. - if (bundleId) { - this.map.url = context.nameToUrl(bundleId); - this.load(); - return; - } - - load = bind(this, function (value) { - this.init([], function () { return value; }, null, { - enabled: true - }); - }); - - load.error = bind(this, function (err) { - this.inited = true; - this.error = err; - err.requireModules = [id]; - - //Remove temp unnormalized modules for this module, - //since they will never be resolved otherwise now. - eachProp(registry, function (mod) { - if (mod.map.id.indexOf(id + '_unnormalized') === 0) { - cleanRegistry(mod.map.id); - } + }, + ); }); - onError(err); - }); + load.error = bind(this, function (err) { + this.inited = true; + this.error = err; + err.requireModules = [id]; - //Allow plugins to load other code without having to know the - //context or how to 'complete' the load. - load.fromText = bind(this, function (text, textAlt) { - /*jslint evil: true */ - var moduleName = map.name, - moduleMap = makeModuleMap(moduleName), - hasInteractive = useInteractive; + //Remove temp unnormalized modules for this module, + //since they will never be resolved otherwise now. + eachProp(registry, function (mod) { + if (mod.map.id.indexOf(id + '_unnormalized') === 0) { + cleanRegistry(mod.map.id); + } + }); - //As of 2.1.0, support just passing the text, to reinforce - //fromText only being called once per resource. Still - //support old style of passing moduleName but discard - //that moduleName in favor of the internal ref. - if (textAlt) { - text = textAlt; - } + onError(err); + }); - //Turn off interactive script matching for IE for any define - //calls in the text, then turn it back on at the end. - if (hasInteractive) { - useInteractive = false; - } + //Allow plugins to load other code without having to know the + //context or how to 'complete' the load. + load.fromText = bind(this, function (text, textAlt) { + /*jslint evil: true */ + var moduleName = map.name, + moduleMap = makeModuleMap(moduleName), + hasInteractive = useInteractive; - //Prime the system by creating a module instance for - //it. - getModule(moduleMap); + //As of 2.1.0, support just passing the text, to reinforce + //fromText only being called once per resource. Still + //support old style of passing moduleName but discard + //that moduleName in favor of the internal ref. + if (textAlt) { + text = textAlt; + } - //Transfer any config to this other module. - if (hasProp(config.config, id)) { - config.config[moduleName] = config.config[id]; - } + //Turn off interactive script matching for IE for any define + //calls in the text, then turn it back on at the end. + if (hasInteractive) { + useInteractive = false; + } - try { - req.exec(text); - } catch (e) { - return onError(makeError('fromtexteval', - 'fromText eval for ' + id + - ' failed: ' + e, - e, - [id])); - } + //Prime the system by creating a module instance for + //it. + getModule(moduleMap); - if (hasInteractive) { - useInteractive = true; - } + //Transfer any config to this other module. + if (hasProp(config.config, id)) { + config.config[moduleName] = config.config[id]; + } - //Mark this as a dependency for the plugin - //resource - this.depMaps.push(moduleMap); + try { + req.exec(text); + } catch (e) { + return onError(makeError('fromtexteval', 'fromText eval for ' + id + ' failed: ' + e, e, [id])); + } - //Support anonymous modules. - context.completeLoad(moduleName); + if (hasInteractive) { + useInteractive = true; + } - //Bind the value of that module to the value for this - //resource ID. - localRequire([moduleName], load); - }); + //Mark this as a dependency for the plugin + //resource + this.depMaps.push(moduleMap); - //Use parentName here since the plugin's name is not reliable, - //could be some weird string with no path that actually wants to - //reference the parentName's path. - plugin.load(map.name, localRequire, load, config); - })); + //Support anonymous modules. + context.completeLoad(moduleName); + + //Bind the value of that module to the value for this + //resource ID. + localRequire([moduleName], load); + }); + + //Use parentName here since the plugin's name is not reliable, + //could be some weird string with no path that actually wants to + //reference the parentName's path. + plugin.load(map.name, localRequire, load, config); + }), + ); context.enable(pluginMap, this); this.pluginMaps[pluginMap.id] = pluginMap; @@ -1116,66 +1161,77 @@ export function getRequireJs(): RequireJS { this.enabling = true; //Enable each dependency - each(this.depMaps, bind(this, function (depMap, i) { - var id, mod, handler; + each( + this.depMaps, + bind(this, function (depMap, i) { + var id, mod, handler; - if (typeof depMap === 'string') { - //Dependency needs to be converted to a depMap - //and wired up to this module. - depMap = makeModuleMap(depMap, - (this.map.isDefine ? this.map : this.map.parentMap), - false, - !this.skipMap); - this.depMaps[i] = depMap; + if (typeof depMap === 'string') { + //Dependency needs to be converted to a depMap + //and wired up to this module. + depMap = makeModuleMap(depMap, this.map.isDefine ? this.map : this.map.parentMap, false, !this.skipMap); + this.depMaps[i] = depMap; - handler = getOwn(handlers, depMap.id); + handler = getOwn(handlers, depMap.id); - if (handler) { - this.depExports[i] = handler(this); - return; - } - - this.depCount += 1; - - on(depMap, 'defined', bind(this, function (depExports) { - if (this.undefed) { + if (handler) { + this.depExports[i] = handler(this); return; } - this.defineDep(i, depExports); - this.check(); - })); - if (this.errback) { - on(depMap, 'error', bind(this, this.errback)); - } else if (this.events.error) { - // No direct errback on this module, but something - // else is listening for errors, so be sure to - // propagate the error correctly. - on(depMap, 'error', bind(this, function (err) { - this.emit('error', err); - })); + this.depCount += 1; + + on( + depMap, + 'defined', + bind(this, function (depExports) { + if (this.undefed) { + return; + } + this.defineDep(i, depExports); + this.check(); + }), + ); + + if (this.errback) { + on(depMap, 'error', bind(this, this.errback)); + } else if (this.events.error) { + // No direct errback on this module, but something + // else is listening for errors, so be sure to + // propagate the error correctly. + on( + depMap, + 'error', + bind(this, function (err) { + this.emit('error', err); + }), + ); + } } - } - id = depMap.id; - mod = registry[id]; + id = depMap.id; + mod = registry[id]; - //Skip special modules like 'require', 'exports', 'module' - //Also, don't call enable if it is already enabled, - //important in circular dependency cases. - if (!hasProp(handlers, id) && mod && !mod.enabled) { - context.enable(depMap, this); - } - })); + //Skip special modules like 'require', 'exports', 'module' + //Also, don't call enable if it is already enabled, + //important in circular dependency cases. + if (!hasProp(handlers, id) && mod && !mod.enabled) { + context.enable(depMap, this); + } + }), + ); //Enable each plugin that is used in //a dependency - eachProp(this.pluginMaps, bind(this, function (pluginMap) { - var mod = getOwn(registry, pluginMap.id); - if (mod && !mod.enabled) { - context.enable(pluginMap, this); - } - })); + eachProp( + this.pluginMaps, + bind(this, function (pluginMap) { + var mod = getOwn(registry, pluginMap.id); + if (mod && !mod.enabled) { + context.enable(pluginMap, this); + } + }), + ); this.enabling = false; @@ -1200,7 +1256,7 @@ export function getRequireJs(): RequireJS { //can stay around for a while in the registry. delete this.events[name]; } - } + }, }; function callGetModule(args) { @@ -1243,7 +1299,7 @@ export function getRequireJs(): RequireJS { return { node: node, - id: node && node.getAttribute('data-requiremodule') + id: node && node.getAttribute('data-requiremodule'), }; } @@ -1257,8 +1313,7 @@ export function getRequireJs(): RequireJS { while (defQueue.length) { args = defQueue.shift(); if (args[0] === null) { - return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + - args[args.length - 1])); + return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); } else { //args are id, deps, factory. Should be normalized by the //define() function. @@ -1308,7 +1363,7 @@ export function getRequireJs(): RequireJS { paths: true, bundles: true, config: true, - map: true + map: true, }; eachProp(cfg, function (value, prop) { @@ -1339,7 +1394,7 @@ export function getRequireJs(): RequireJS { //Normalize the structure if (isArray(value)) { value = { - deps: value + deps: value, }; } if ((value.exports || value.init) && !value.exportsFn) { @@ -1368,9 +1423,8 @@ export function getRequireJs(): RequireJS { //and remove any trailing .js, since different package //envs have different conventions: some use a module name, //some use a file name. - config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') - .replace(currDirRegExp, '') - .replace(jsSuffixRegExp, ''); + config.pkgs[name] = + pkgObj.name + '/' + (pkgObj.main || 'main').replace(currDirRegExp, '').replace(jsSuffixRegExp, ''); }); } @@ -1439,11 +1493,16 @@ export function getRequireJs(): RequireJS { id = map.id; if (!hasProp(defined, id)) { - return onError(makeError('notloaded', 'Module name "' + - id + - '" has not been loaded yet for context: ' + - contextName + - (relMap ? '' : '. Use require([])'))); + return onError( + makeError( + 'notloaded', + 'Module name "' + + id + + '" has not been loaded yet for context: ' + + contextName + + (relMap ? '' : '. Use require([])'), + ), + ); } return defined[id]; } @@ -1464,7 +1523,7 @@ export function getRequireJs(): RequireJS { requireMod.skipMap = options.skipMap; requireMod.init(deps, callback, errback, { - enabled: true + enabled: true, }); checkLoaded(); @@ -1494,8 +1553,7 @@ export function getRequireJs(): RequireJS { moduleNamePlusExt = moduleNamePlusExt.substring(0, index); } - return context.nameToUrl(normalize(moduleNamePlusExt, - relMap && relMap.id, true), ext, true); + return context.nameToUrl(normalize(moduleNamePlusExt, relMap && relMap.id, true), ext, true); }, defined: function (id) { @@ -1505,7 +1563,7 @@ export function getRequireJs(): RequireJS { specified: function (id) { id = makeModuleMap(id, relMap, false, true).id; return hasProp(defined, id) || hasProp(registry, id); - } + }, }); //Only allow undef on top level require calls @@ -1571,7 +1629,9 @@ export function getRequireJs(): RequireJS { * @param {String} moduleName the name of the module to potentially complete. */ completeLoad: function (moduleName) { - var found, args, mod, + var found, + args, + mod, shim = getOwn(config.shim, moduleName) || {}, shExports = shim.exports; @@ -1606,15 +1666,12 @@ export function getRequireJs(): RequireJS { if (hasPathFallback(moduleName)) { return; } else { - return onError(makeError('nodefine', - 'No define call for ' + moduleName, - null, - [moduleName])); + return onError(makeError('nodefine', 'No define call for ' + moduleName, null, [moduleName])); } } else { //A script that does not call define(), so just simulate //the call for it. - callGetModule([moduleName, (shim.deps || []), shim.exportsFn]); + callGetModule([moduleName, shim.deps || [], shim.exportsFn]); } } @@ -1629,8 +1686,13 @@ export function getRequireJs(): RequireJS { * internal API, not a public one. Use toUrl for the public API. */ nameToUrl: function (moduleName, ext, skipExt) { - var paths, syms, i, parentModule, url, - parentPath, bundleId, + var paths, + syms, + i, + parentModule, + url, + parentPath, + bundleId, pkgMain = getOwn(config.pkgs, moduleName); if (pkgMain) { @@ -1677,12 +1739,11 @@ export function getRequireJs(): RequireJS { //Join the path parts together, then figure out if baseUrl is needed. url = syms.join('/'); - url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js')); + url += ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'); url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; } - return config.urlArgs && !/^blob\:/.test(url) ? - url + config.urlArgs(moduleName, url) : url; + return config.urlArgs && !/^blob\:/.test(url) ? url + config.urlArgs(moduleName, url) : url; }, //Delegates to req.load. Broken out as a separate function to @@ -1712,8 +1773,7 @@ export function getRequireJs(): RequireJS { //Using currentTarget instead of target for Firefox 2.0's sake. Not //all old browsers will be supported, but this one was easy enough //to support and still makes sense. - if (evt.type === 'load' || - (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { + if (evt.type === 'load' || readyRegExp.test((evt.currentTarget || evt.srcElement).readyState)) { //Reset interactive script so a script node is not held onto for //to long. interactiveScript = null; @@ -1741,12 +1801,16 @@ export function getRequireJs(): RequireJS { }); } }); - return onError(makeError('scripterror', 'Script error for "' + data.id + - (parents.length ? - '", needed by: ' + parents.join(', ') : - '"'), evt, [data.id])); + return onError( + makeError( + 'scripterror', + 'Script error for "' + data.id + (parents.length ? '", needed by: ' + parents.join(', ') : '"'), + evt, + [data.id], + ), + ); } - } + }, }; context.require = context.makeRequire(); @@ -1768,9 +1832,9 @@ export function getRequireJs(): RequireJS { * name for minification/local scope use. */ req = requirejs = function (deps, callback, errback, optional) { - //Find the right context, use default - var context, config, + var context, + config, contextName = defContextName; // Determine if have config object in the call. @@ -1817,9 +1881,14 @@ export function getRequireJs(): RequireJS { * that have a better solution than setTimeout. * @param {Function} fn function to execute later. */ - req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) { - setTimeout(fn, 4); - } : function (fn) { fn(); }; + req.nextTick = + typeof setTimeout !== 'undefined' + ? function (fn) { + setTimeout(fn, 4); + } + : function (fn) { + fn(); + }; /** * Export require as a global, but only if it does not already exist. @@ -1835,19 +1904,14 @@ export function getRequireJs(): RequireJS { req.isBrowser = isBrowser; s = req.s = { contexts: contexts, - newContext: newContext + newContext: newContext, }; //Create default context. req({}); //Exports some context-sensitive methods on global require. - each([ - 'toUrl', - 'undef', - 'defined', - 'specified' - ], function (prop) { + each(['toUrl', 'undef', 'defined', 'specified'], function (prop) { //Reference from contexts instead of early binding to default context, //so that during builds, the latest instance of the default context //with its config gets used. @@ -1879,9 +1943,9 @@ export function getRequireJs(): RequireJS { * Creates the node for the load command. Only used in browser envs. */ req.createNode = function (config, moduleName, url) { - var node = config.xhtml ? - document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : - document.createElement('script'); + var node = config.xhtml + ? document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') + : document.createElement('script'); node.type = config.scriptType || 'text/javascript'; node.charset = 'utf-8'; node.async = true; @@ -1915,7 +1979,8 @@ export function getRequireJs(): RequireJS { //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution //UNFORTUNATELY Opera implements attachEvent but does not follow the script //script execution mode. - if (node.attachEvent && + if ( + node.attachEvent && //Check if node.attachEvent is artificially added by custom script or //natively supported by browser //read https://github.com/requirejs/requirejs/issues/187 @@ -1924,7 +1989,8 @@ export function getRequireJs(): RequireJS { //Note the test for "[native code" with no closing brace, see: //https://github.com/requirejs/requirejs/issues/273 !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && - !isOpera) { + !isOpera + ) { //Probably IE. IE (at least 6-8) do not fire //script onload right after executing the script, so //we cannot tie the anonymous define call to a name. @@ -1981,17 +2047,15 @@ export function getRequireJs(): RequireJS { // Post a task to the event loop to work around a bug in WebKit // where the worker gets garbage-collected after calling // importScripts(): https://webkit.org/b/153317 - setTimeout(function () { }, 0); + setTimeout(function () {}, 0); importScripts(url); //Account for anonymous modules context.completeLoad(moduleName); } catch (e) { - context.onError(makeError('importscripts', - 'importScripts failed for ' + - moduleName + ' at ' + url, - e, - [moduleName])); + context.onError( + makeError('importscripts', 'importScripts failed for ' + moduleName + ' at ' + url, e, [moduleName]), + ); } } }; @@ -2132,7 +2196,7 @@ export function getRequireJs(): RequireJS { }; define.amd = { - jQuery: true + jQuery: true, }; /** @@ -2150,6 +2214,8 @@ export function getRequireJs(): RequireJS { req(cfg); return { - requirejs, require, define - } + requirejs, + require, + define, + }; } diff --git a/packages/core/client/src/collection-manager/CollectionProvider_deprecated.tsx b/packages/core/client/src/collection-manager/CollectionProvider_deprecated.tsx index 56b66b26d..2bdf994be 100644 --- a/packages/core/client/src/collection-manager/CollectionProvider_deprecated.tsx +++ b/packages/core/client/src/collection-manager/CollectionProvider_deprecated.tsx @@ -1,8 +1,8 @@ -import { FC, ReactNode } from 'react'; -import { CollectionProvider } from '../data-source/collection/CollectionProvider'; -import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider'; +import React, { FC, ReactNode } from 'react'; + import { CollectionOptions } from '../data-source/collection/Collection'; -import React from 'react'; +import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider'; +import { CollectionProvider } from '../data-source/collection/CollectionProvider'; /** * @deprecated use `CollectionProvider` instead diff --git a/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx index 413055320..702d34009 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx @@ -1,17 +1,18 @@ -import { DownOutlined, PlusOutlined } from '@ant-design/icons'; +import React, { useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema, useField, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid, useField, useForm } from '@tachybase/schema'; + +import { DownOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, Dropdown, MenuProps } from 'antd'; import { cloneDeep } from 'lodash'; -import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useRequest } from '../../api-client'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import * as components from './components'; import { TemplateSummary } from './components/TemplateSummary'; diff --git a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx index d93523f7a..8e0934134 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx @@ -1,19 +1,20 @@ -import { PlusOutlined } from '@ant-design/icons'; +import React, { useCallback, useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { useField, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { uid, useField, useForm } from '@tachybase/schema'; + +import { PlusOutlined } from '@ant-design/icons'; import { Button, Dropdown, MenuProps } from 'antd'; import { cloneDeep } from 'lodash'; -import React, { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useRequest } from '../../api-client'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; import useDialect from '../hooks/useDialect'; import { IField } from '../interfaces/types'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import * as components from './components'; import { useFieldInterfaceOptions } from './interfaces'; diff --git a/packages/core/client/src/collection-manager/Configuration/AddSubFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddSubFieldAction.tsx index bfd25c7b5..092b0cfbd 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddSubFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddSubFieldAction.tsx @@ -1,11 +1,12 @@ -import { PlusOutlined } from '@ant-design/icons'; +import React, { useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; + +import { PlusOutlined } from '@ant-design/icons'; import { Button, Dropdown, MenuProps } from 'antd'; import { cloneDeep } from 'lodash'; -import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useRequest } from '../../api-client'; import { useCollectionRecordData } from '../../data-source'; import { RecordProvider } from '../../record-provider'; diff --git a/packages/core/client/src/collection-manager/Configuration/EditCollectionAction.tsx b/packages/core/client/src/collection-manager/Configuration/EditCollectionAction.tsx index 3b2793298..d8909f85e 100644 --- a/packages/core/client/src/collection-manager/Configuration/EditCollectionAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/EditCollectionAction.tsx @@ -1,17 +1,18 @@ +import React, { useEffect, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + import cloneDeep from 'lodash/cloneDeep'; import omit from 'lodash/omit'; -import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; import { IField } from '../interfaces/types'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import * as components from './components'; const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => { diff --git a/packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx index 09f673710..76efccb2f 100644 --- a/packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx @@ -1,20 +1,21 @@ +import React, { useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + import cloneDeep from 'lodash/cloneDeep'; import omit from 'lodash/omit'; import set from 'lodash/set'; -import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; import useDialect from '../hooks/useDialect'; import { IField } from '../interfaces/types'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import * as components from './components'; const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => { diff --git a/packages/core/client/src/collection-manager/Configuration/EditSubFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/EditSubFieldAction.tsx index bbc366b1c..90f9e427b 100644 --- a/packages/core/client/src/collection-manager/Configuration/EditSubFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/EditSubFieldAction.tsx @@ -1,9 +1,10 @@ -import { ArrayTable } from '@tachybase/components'; -import { ISchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import cloneDeep from 'lodash/cloneDeep'; import React, { useState } from 'react'; +import { ArrayTable } from '@tachybase/components'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + +import cloneDeep from 'lodash/cloneDeep'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent } from '../../schema-component'; diff --git a/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx b/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx index ee2ca7242..fb6e30dd2 100644 --- a/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx +++ b/packages/core/client/src/collection-manager/Configuration/OverridingCollectionField.tsx @@ -1,18 +1,19 @@ +import React, { useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid, useForm } from '@tachybase/schema'; + import { omit, set } from 'lodash'; import cloneDeep from 'lodash/cloneDeep'; -import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { useCollectionParentRecordData } from '../../data-source'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; import { IField } from '../interfaces/types'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import * as components from './components'; const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => { diff --git a/packages/core/client/src/collection-manager/Configuration/SyncFieldsAction.tsx b/packages/core/client/src/collection-manager/Configuration/SyncFieldsAction.tsx index 4a1363758..ee19998e7 100644 --- a/packages/core/client/src/collection-manager/Configuration/SyncFieldsAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/SyncFieldsAction.tsx @@ -1,18 +1,19 @@ -import { PlusOutlined } from '@ant-design/icons'; +import React, { useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { useField, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { uid, useField, useForm } from '@tachybase/schema'; + +import { PlusOutlined } from '@ant-design/icons'; import { Button } from 'antd'; import { cloneDeep } from 'lodash'; -import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks'; import { IField } from '../interfaces/types'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { PreviewFields } from '../templates/components/PreviewFields'; import { PreviewTable } from '../templates/components/PreviewTable'; import * as components from './components'; diff --git a/packages/core/client/src/collection-manager/Configuration/SyncSQLFieldsAction.tsx b/packages/core/client/src/collection-manager/Configuration/SyncSQLFieldsAction.tsx index 95a8b0764..803423f2c 100644 --- a/packages/core/client/src/collection-manager/Configuration/SyncSQLFieldsAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/SyncSQLFieldsAction.tsx @@ -1,18 +1,18 @@ -import { SyncOutlined } from '@ant-design/icons'; -import { FormLayout } from '@tachybase/components'; -import { createForm } from '@tachybase/schema'; -import { useField, useForm } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { Button } from 'antd'; import React, { useMemo, useState } from 'react'; +import { FormLayout } from '@tachybase/components'; +import { createForm, uid, useField, useForm } from '@tachybase/schema'; + +import { SyncOutlined } from '@ant-design/icons'; +import { Button } from 'antd'; import { useTranslation } from 'react-i18next'; + import { useAPIClient } from '../../api-client'; import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider'; import { RecordProvider, useRecord } from '../../record-provider'; import { ActionContextProvider, FormProvider, SchemaComponent, useActionContext } from '../../schema-component'; -import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { useCancelAction } from '../action-hooks'; import { useCollectionManager_deprecated } from '../hooks/useCollectionManager_deprecated'; +import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider'; import { FieldsConfigure, PreviewTable, SQLRequestProvider } from '../templates/components/sql-collection'; const schema = { diff --git a/packages/core/client/src/collection-manager/Configuration/ViewInheritedField.tsx b/packages/core/client/src/collection-manager/Configuration/ViewInheritedField.tsx index 6c9bdda75..329910e05 100644 --- a/packages/core/client/src/collection-manager/Configuration/ViewInheritedField.tsx +++ b/packages/core/client/src/collection-manager/Configuration/ViewInheritedField.tsx @@ -1,10 +1,11 @@ +import React, { useMemo, useState } from 'react'; import { ArrayTable } from '@tachybase/components'; -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; + import cloneDeep from 'lodash/cloneDeep'; import set from 'lodash/set'; -import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useRequest } from '../../api-client'; import { useCollectionParentRecordData } from '../../data-source'; import { RecordProvider, useRecord } from '../../record-provider'; diff --git a/packages/core/client/src/collection-manager/Configuration/components/CollectionCategory.tsx b/packages/core/client/src/collection-manager/Configuration/components/CollectionCategory.tsx index 3ec9bfc7c..8b2309c68 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/CollectionCategory.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/CollectionCategory.tsx @@ -1,6 +1,8 @@ -import { observer } from '@tachybase/schema'; -import { Tag } from 'antd'; import React from 'react'; +import { observer } from '@tachybase/schema'; + +import { Tag } from 'antd'; + import { useCompile } from '../../../schema-component'; export const CollectionCategory = observer( diff --git a/packages/core/client/src/collection-manager/Configuration/components/CollectionFieldInterfaceTag.tsx b/packages/core/client/src/collection-manager/Configuration/components/CollectionFieldInterfaceTag.tsx index f73780b05..16056afdd 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/CollectionFieldInterfaceTag.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/CollectionFieldInterfaceTag.tsx @@ -1,6 +1,8 @@ -import { observer } from '@tachybase/schema'; -import { Tag } from 'antd'; import React from 'react'; +import { observer } from '@tachybase/schema'; + +import { Tag } from 'antd'; + import { useCompile } from '../../../schema-component'; import { useCollectionManager_deprecated } from '../../hooks'; diff --git a/packages/core/client/src/collection-manager/Configuration/components/CollectionTemplateTag.tsx b/packages/core/client/src/collection-manager/Configuration/components/CollectionTemplateTag.tsx index fdb6b4a49..a5be14ff6 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/CollectionTemplateTag.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/CollectionTemplateTag.tsx @@ -1,6 +1,8 @@ -import { observer } from '@tachybase/schema'; -import { Tag } from 'antd'; import React from 'react'; +import { observer } from '@tachybase/schema'; + +import { Tag } from 'antd'; + import { useCompile } from '../../../schema-component'; import { useCollectionManager_deprecated } from '../../hooks'; diff --git a/packages/core/client/src/collection-manager/Configuration/components/FieldSummary.tsx b/packages/core/client/src/collection-manager/Configuration/components/FieldSummary.tsx index 4e4c73ea1..527438ec6 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/FieldSummary.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/FieldSummary.tsx @@ -1,5 +1,7 @@ import React, { useMemo } from 'react'; + import { useTranslation } from 'react-i18next'; + import { useCollectionManager_deprecated } from '../../hooks'; import Summary from './Summary'; diff --git a/packages/core/client/src/collection-manager/Configuration/components/Summary.tsx b/packages/core/client/src/collection-manager/Configuration/components/Summary.tsx index c0e903055..831cf8f98 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/Summary.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/Summary.tsx @@ -1,7 +1,9 @@ +import React, { useMemo } from 'react'; import { observer } from '@tachybase/schema'; + import { Tag } from 'antd'; import { useAntdToken } from 'antd-style'; -import React, { useMemo } from 'react'; + import { useCompile } from '../../../schema-component'; const Summary = observer( diff --git a/packages/core/client/src/collection-manager/Configuration/components/TemplateSummary.tsx b/packages/core/client/src/collection-manager/Configuration/components/TemplateSummary.tsx index f71f7c5fa..7c85ce3b9 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/TemplateSummary.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/TemplateSummary.tsx @@ -1,5 +1,7 @@ import React, { useMemo } from 'react'; + import { useTranslation } from 'react-i18next'; + import { useCollectionManager_deprecated } from '../../hooks'; import Summary from './Summary'; diff --git a/packages/core/client/src/collection-manager/Configuration/components/index.tsx b/packages/core/client/src/collection-manager/Configuration/components/index.tsx index 77e5e0765..54a9429e1 100644 --- a/packages/core/client/src/collection-manager/Configuration/components/index.tsx +++ b/packages/core/client/src/collection-manager/Configuration/components/index.tsx @@ -1,7 +1,8 @@ -import { Field } from '@tachybase/schema'; -import { observer, useField, useForm } from '@tachybase/schema'; -import { Select, AutoComplete } from 'antd'; -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; +import { Field, observer, useField, useForm } from '@tachybase/schema'; + +import { AutoComplete, Select } from 'antd'; + import { useRecord } from '../../../record-provider'; import { useCompile } from '../../../schema-component'; import { useCollectionManager_deprecated } from '../../hooks'; diff --git a/packages/core/client/src/collection-manager/Configuration/interfaces.tsx b/packages/core/client/src/collection-manager/Configuration/interfaces.tsx index 06b33f09f..9dde50f26 100644 --- a/packages/core/client/src/collection-manager/Configuration/interfaces.tsx +++ b/packages/core/client/src/collection-manager/Configuration/interfaces.tsx @@ -1,5 +1,6 @@ -import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { useMemo } from 'react'; + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider'; export const getOptions = ( diff --git a/packages/core/client/src/collection-manager/ResourceActionProvider.tsx b/packages/core/client/src/collection-manager/ResourceActionProvider.tsx index 858ee9445..25dbdffdb 100644 --- a/packages/core/client/src/collection-manager/ResourceActionProvider.tsx +++ b/packages/core/client/src/collection-manager/ResourceActionProvider.tsx @@ -1,6 +1,8 @@ -import { useField } from '@tachybase/schema'; -import { Result } from 'ahooks/es/useRequest/src/types'; import React, { createContext, useContext, useEffect } from 'react'; +import { useField } from '@tachybase/schema'; + +import { Result } from 'ahooks/es/useRequest/src/types'; + import { useCollectionManager_deprecated } from '.'; import { CollectionProvider_deprecated, useRecord } from '..'; import { useAPIClient, useRequest } from '../api-client'; diff --git a/packages/core/client/src/collection-manager/demos/demo2.tsx b/packages/core/client/src/collection-manager/demos/demo2.tsx index a51619e1b..22a37668c 100644 --- a/packages/core/client/src/collection-manager/demos/demo2.tsx +++ b/packages/core/client/src/collection-manager/demos/demo2.tsx @@ -1,5 +1,4 @@ -import { FormItem, Input } from '@tachybase/components'; -import { ISchema, observer, useForm } from '@tachybase/schema'; +import React from 'react'; import { Action, CollectionField, @@ -8,7 +7,8 @@ import { SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import React from 'react'; +import { FormItem, Input } from '@tachybase/components'; +import { ISchema, observer, useForm } from '@tachybase/schema'; export default observer(() => { const collection = { diff --git a/packages/core/client/src/collection-manager/demos/demo3.tsx b/packages/core/client/src/collection-manager/demos/demo3.tsx index f198f0743..11ecd26b1 100644 --- a/packages/core/client/src/collection-manager/demos/demo3.tsx +++ b/packages/core/client/src/collection-manager/demos/demo3.tsx @@ -8,6 +8,7 @@ import { RecordProvider, useCollectionField_deprecated, } from '@tachybase/client'; + import MockAdapter from 'axios-mock-adapter'; const apiClient = new APIClient(); diff --git a/packages/core/client/src/collection-manager/demos/demo4.tsx b/packages/core/client/src/collection-manager/demos/demo4.tsx index f69f5ef58..503677ea8 100644 --- a/packages/core/client/src/collection-manager/demos/demo4.tsx +++ b/packages/core/client/src/collection-manager/demos/demo4.tsx @@ -1,11 +1,11 @@ -import { ISchema } from '@tachybase/schema'; +import React from 'react'; import { AntdSchemaComponentProvider, ExtendCollectionsProvider, SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import React from 'react'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/collection-manager/demos/demo5.tsx b/packages/core/client/src/collection-manager/demos/demo5.tsx index 695f1eede..cddac99b5 100644 --- a/packages/core/client/src/collection-manager/demos/demo5.tsx +++ b/packages/core/client/src/collection-manager/demos/demo5.tsx @@ -1,14 +1,10 @@ -import { FormDrawer, FormLayout } from '@tachybase/components'; -import { createForm } from '@tachybase/schema'; -import { ISchema } from '@tachybase/schema'; -import { FormContext, SchemaOptionsContext } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { useContext } from 'react'; import { AntdSchemaComponentProvider, Application, CardItem, - CollectionManagerProvider_deprecated, CollectionManagerProvider, + CollectionManagerProvider_deprecated, CollectionProvider_deprecated, FormItem, Grid, @@ -20,13 +16,15 @@ import { SchemaComponentOptions, SchemaInitializer, SchemaInitializerItem, - useCollectionManager_deprecated, useCollectionManager, + useCollectionManager_deprecated, useSchemaInitializer, useSchemaInitializerItem, } from '@tachybase/client'; +import { FormDrawer, FormLayout } from '@tachybase/components'; +import { createForm, FormContext, ISchema, SchemaOptionsContext, uid } from '@tachybase/schema'; + import { cloneDeep } from 'lodash'; -import React, { useContext } from 'react'; const collection: any = { name: 'posts', diff --git a/packages/core/client/src/collection-manager/hooks/useCollectionManager_deprecated.ts b/packages/core/client/src/collection-manager/hooks/useCollectionManager_deprecated.ts index 631b26254..77e10895d 100644 --- a/packages/core/client/src/collection-manager/hooks/useCollectionManager_deprecated.ts +++ b/packages/core/client/src/collection-manager/hooks/useCollectionManager_deprecated.ts @@ -1,14 +1,16 @@ +import { useCallback, useMemo, useState } from 'react'; +import { uid } from '@tachybase/schema'; + import { CascaderProps } from 'antd'; import _ from 'lodash'; -import { useCallback, useMemo, useState } from 'react'; -import { useCompile, useSchemaComponentContext } from '../../schema-component'; -import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types'; -import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin'; -import { uid } from '@tachybase/schema'; + +import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider'; +import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager'; import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider'; import { useDataSource } from '../../data-source/data-source/DataSourceProvider'; -import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager'; -import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider'; +import { useCompile, useSchemaComponentContext } from '../../schema-component'; +import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin'; +import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types'; /** * @deprecated use `useCollectionManager` instead diff --git a/packages/core/client/src/collection-manager/hooks/useCollection_deprecated.ts b/packages/core/client/src/collection-manager/hooks/useCollection_deprecated.ts index e1f87650e..340165242 100644 --- a/packages/core/client/src/collection-manager/hooks/useCollection_deprecated.ts +++ b/packages/core/client/src/collection-manager/hooks/useCollection_deprecated.ts @@ -1,8 +1,9 @@ -import { SchemaKey } from '@tachybase/schema'; -import { useAPIClient } from '../../api-client'; -import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin'; import { useCallback, useMemo } from 'react'; +import { SchemaKey } from '@tachybase/schema'; + +import { useAPIClient } from '../../api-client'; import { useCollection } from '../../data-source/collection/CollectionProvider'; +import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin'; export type Collection_deprecated = ReturnType; diff --git a/packages/core/client/src/collection-manager/interfaces/__tests__/json.tsx b/packages/core/client/src/collection-manager/interfaces/__tests__/json.tsx index 96ed9882d..8f13246df 100644 --- a/packages/core/client/src/collection-manager/interfaces/__tests__/json.tsx +++ b/packages/core/client/src/collection-manager/interfaces/__tests__/json.tsx @@ -1,5 +1,6 @@ -import { render, screen, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, waitFor } from '@tachybase/test/client'; + import { CurrentAppInfoContext } from '../../../appInfo'; import { Checkbox } from '../../../schema-component/antd/checkbox'; import { Input } from '../../../schema-component/antd/input'; diff --git a/packages/core/client/src/collection-manager/interfaces/checkbox.ts b/packages/core/client/src/collection-manager/interfaces/checkbox.ts index a80bbe8e9..9083012de 100644 --- a/packages/core/client/src/collection-manager/interfaces/checkbox.ts +++ b/packages/core/client/src/collection-manager/interfaces/checkbox.ts @@ -1,4 +1,5 @@ import { ISchema } from '@tachybase/schema'; + import { defaultProps, operators } from '../'; import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; diff --git a/packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts b/packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts index d7f7e057a..c82ac2d78 100644 --- a/packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts +++ b/packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { dataSource, defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { dataSource, defaultProps, operators } from './properties'; export class CheckboxGroupFieldInterface extends CollectionFieldInterface { name = 'checkboxGroup'; diff --git a/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts b/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts index 98e6d0bcf..58fddccd7 100644 --- a/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts +++ b/packages/core/client/src/collection-manager/interfaces/chinaRegion.ts @@ -1,6 +1,7 @@ import { uid } from '@tachybase/schema'; -import { defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps, operators } from './properties'; export class ChinaRegionFieldInterface extends CollectionFieldInterface { name = 'chinaRegion'; diff --git a/packages/core/client/src/collection-manager/interfaces/collection.ts b/packages/core/client/src/collection-manager/interfaces/collection.ts index 525142488..c4397f737 100644 --- a/packages/core/client/src/collection-manager/interfaces/collection.ts +++ b/packages/core/client/src/collection-manager/interfaces/collection.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { collectionDataSource, defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { collectionDataSource, defaultProps, operators } from './properties'; export class CollectionSelectFieldInterface extends CollectionFieldInterface { name = 'collection'; diff --git a/packages/core/client/src/collection-manager/interfaces/components/index.tsx b/packages/core/client/src/collection-manager/interfaces/components/index.tsx index 9096e115a..79479b3d0 100644 --- a/packages/core/client/src/collection-manager/interfaces/components/index.tsx +++ b/packages/core/client/src/collection-manager/interfaces/components/index.tsx @@ -1,6 +1,7 @@ -import { Switch } from 'antd'; import React from 'react'; +import { Switch } from 'antd'; + export const TargetKey = () => { return
Target key
; }; diff --git a/packages/core/client/src/collection-manager/interfaces/createdBy.ts b/packages/core/client/src/collection-manager/interfaces/createdBy.ts index 4bb26ac37..77e54764c 100644 --- a/packages/core/client/src/collection-manager/interfaces/createdBy.ts +++ b/packages/core/client/src/collection-manager/interfaces/createdBy.ts @@ -1,5 +1,7 @@ import { ISchema } from '@tachybase/schema'; + import { cloneDeep } from 'lodash'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { defaultProps, recordPickerViewer } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/email.ts b/packages/core/client/src/collection-manager/interfaces/email.ts index 712362c1d..bbfaa2c23 100644 --- a/packages/core/client/src/collection-manager/interfaces/email.ts +++ b/packages/core/client/src/collection-manager/interfaces/email.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { defaultProps, operators, unique } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps, operators, unique } from './properties'; export class EmailFieldInterface extends CollectionFieldInterface { name = 'email'; diff --git a/packages/core/client/src/collection-manager/interfaces/input.ts b/packages/core/client/src/collection-manager/interfaces/input.ts index f9d5a5fed..31f3e9367 100644 --- a/packages/core/client/src/collection-manager/interfaces/input.ts +++ b/packages/core/client/src/collection-manager/interfaces/input.ts @@ -1,8 +1,8 @@ -import { ISchema } from '@tachybase/schema'; -import { defaultProps, operators, unique, primaryKey } from './properties'; -import { i18n } from '../../i18n'; -import { registerValidateRules } from '@tachybase/schema'; +import { ISchema, registerValidateRules } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { i18n } from '../../i18n'; +import { defaultProps, operators, primaryKey, unique } from './properties'; registerValidateRules({ username(value) { diff --git a/packages/core/client/src/collection-manager/interfaces/integer.ts b/packages/core/client/src/collection-manager/interfaces/integer.ts index f9c53deb7..66e868366 100644 --- a/packages/core/client/src/collection-manager/interfaces/integer.ts +++ b/packages/core/client/src/collection-manager/interfaces/integer.ts @@ -1,7 +1,8 @@ import { registerValidateFormats } from '@tachybase/schema'; -import { i18n } from '../../i18n'; -import { defaultProps, operators, unique, autoIncrement, primaryKey } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { i18n } from '../../i18n'; +import { autoIncrement, defaultProps, operators, primaryKey, unique } from './properties'; registerValidateFormats({ odd: /^-?\d*[13579]$/, diff --git a/packages/core/client/src/collection-manager/interfaces/json.tsx b/packages/core/client/src/collection-manager/interfaces/json.tsx index a729c8e26..f9da08695 100644 --- a/packages/core/client/src/collection-manager/interfaces/json.tsx +++ b/packages/core/client/src/collection-manager/interfaces/json.tsx @@ -1,8 +1,9 @@ +import React from 'react'; import { FormItem, FormLayout } from '@tachybase/components'; import { registerValidateRules } from '@tachybase/schema'; -import React from 'react'; -import { defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps, operators } from './properties'; registerValidateRules({ json(value) { diff --git a/packages/core/client/src/collection-manager/interfaces/linkTo.ts b/packages/core/client/src/collection-manager/interfaces/linkTo.ts index 34eccf598..ddb2fce94 100644 --- a/packages/core/client/src/collection-manager/interfaces/linkTo.ts +++ b/packages/core/client/src/collection-manager/interfaces/linkTo.ts @@ -1,5 +1,5 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { defaultProps } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/m2m.tsx b/packages/core/client/src/collection-manager/interfaces/m2m.tsx index 041c4cd59..685bcca54 100644 --- a/packages/core/client/src/collection-manager/interfaces/m2m.tsx +++ b/packages/core/client/src/collection-manager/interfaces/m2m.tsx @@ -1,5 +1,5 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { getUniqueKeyFromCollection } from './o2m'; import { defaultProps, relationshipType, reverseFieldProperties } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/m2o.tsx b/packages/core/client/src/collection-manager/interfaces/m2o.tsx index f5dc43772..3236e7866 100644 --- a/packages/core/client/src/collection-manager/interfaces/m2o.tsx +++ b/packages/core/client/src/collection-manager/interfaces/m2o.tsx @@ -1,4 +1,5 @@ import { ISchema } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { getUniqueKeyFromCollection } from './o2m'; import { constraintsProps, relationshipType, reverseFieldProperties } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/markdown.ts b/packages/core/client/src/collection-manager/interfaces/markdown.ts index f0433f45e..5266145e2 100644 --- a/packages/core/client/src/collection-manager/interfaces/markdown.ts +++ b/packages/core/client/src/collection-manager/interfaces/markdown.ts @@ -1,7 +1,8 @@ import { ISchema } from '@tachybase/schema'; + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { i18n } from '../../i18n'; import { defaultProps, operators } from './properties'; -import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; export class MarkdownFieldInterface extends CollectionFieldInterface { name = 'markdown'; diff --git a/packages/core/client/src/collection-manager/interfaces/multipleSelect.ts b/packages/core/client/src/collection-manager/interfaces/multipleSelect.ts index 74799da57..69f0829d1 100644 --- a/packages/core/client/src/collection-manager/interfaces/multipleSelect.ts +++ b/packages/core/client/src/collection-manager/interfaces/multipleSelect.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { dataSource, defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { dataSource, defaultProps, operators } from './properties'; export class MultipleSelectFieldInterface extends CollectionFieldInterface { name = 'multipleSelect'; diff --git a/packages/core/client/src/collection-manager/interfaces/nanoid.ts b/packages/core/client/src/collection-manager/interfaces/nanoid.ts index 594a816d1..9077c9e34 100644 --- a/packages/core/client/src/collection-manager/interfaces/nanoid.ts +++ b/packages/core/client/src/collection-manager/interfaces/nanoid.ts @@ -1,5 +1,6 @@ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { operators } from './properties'; + export class NanoidFieldInterface extends CollectionFieldInterface { name = 'nanoid'; type = 'object'; diff --git a/packages/core/client/src/collection-manager/interfaces/o2m.tsx b/packages/core/client/src/collection-manager/interfaces/o2m.tsx index 1d9eccae2..90a1def9c 100644 --- a/packages/core/client/src/collection-manager/interfaces/o2m.tsx +++ b/packages/core/client/src/collection-manager/interfaces/o2m.tsx @@ -1,4 +1,5 @@ import { ISchema } from '@tachybase/schema'; + import { Collection } from '../../data-source'; import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { constraintsProps, relationshipType, reverseFieldProperties } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/o2o.tsx b/packages/core/client/src/collection-manager/interfaces/o2o.tsx index 5e909b2c9..e437c52d5 100644 --- a/packages/core/client/src/collection-manager/interfaces/o2o.tsx +++ b/packages/core/client/src/collection-manager/interfaces/o2o.tsx @@ -1,4 +1,5 @@ import { ISchema } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { getUniqueKeyFromCollection } from './o2m'; import { constraintsProps, relationshipType, reverseFieldProperties } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/percent.ts b/packages/core/client/src/collection-manager/interfaces/percent.ts index cdfffe51b..afea0483e 100644 --- a/packages/core/client/src/collection-manager/interfaces/percent.ts +++ b/packages/core/client/src/collection-manager/interfaces/percent.ts @@ -1,8 +1,8 @@ -import { registerValidateRules } from '@tachybase/schema'; -import { ISchema } from '@tachybase/schema'; +import { ISchema, registerValidateRules } from '@tachybase/schema'; + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { i18n } from '../../i18n'; import { defaultProps, operators, unique } from './properties'; -import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; registerValidateRules({ percentMode(value, rule) { diff --git a/packages/core/client/src/collection-manager/interfaces/phone.ts b/packages/core/client/src/collection-manager/interfaces/phone.ts index a05bf3fe2..71f228f26 100644 --- a/packages/core/client/src/collection-manager/interfaces/phone.ts +++ b/packages/core/client/src/collection-manager/interfaces/phone.ts @@ -1,5 +1,5 @@ -import { defaultProps, operators, unique } from './properties'; import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps, operators, unique } from './properties'; export class PhoneFieldInterface extends CollectionFieldInterface { name = 'phone'; diff --git a/packages/core/client/src/collection-manager/interfaces/properties/index.ts b/packages/core/client/src/collection-manager/interfaces/properties/index.ts index 0de599757..e851deeaf 100644 --- a/packages/core/client/src/collection-manager/interfaces/properties/index.ts +++ b/packages/core/client/src/collection-manager/interfaces/properties/index.ts @@ -1,6 +1,5 @@ -import { Field } from '@tachybase/schema'; -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { Field, ISchema, uid } from '@tachybase/schema'; + export * as operators from './operators'; export const type: ISchema = { diff --git a/packages/core/client/src/collection-manager/interfaces/richText.ts b/packages/core/client/src/collection-manager/interfaces/richText.ts index 267c9f51a..7c209b863 100644 --- a/packages/core/client/src/collection-manager/interfaces/richText.ts +++ b/packages/core/client/src/collection-manager/interfaces/richText.ts @@ -1,7 +1,8 @@ import type { ISchema } from '@tachybase/schema'; + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { i18n } from '../../i18n'; import { defaultProps, operators } from './properties'; -import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; export class RichTextFieldInterface extends CollectionFieldInterface { name = 'richText'; diff --git a/packages/core/client/src/collection-manager/interfaces/select.ts b/packages/core/client/src/collection-manager/interfaces/select.ts index 49d937865..c62946016 100644 --- a/packages/core/client/src/collection-manager/interfaces/select.ts +++ b/packages/core/client/src/collection-manager/interfaces/select.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { dataSource, defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { dataSource, defaultProps, operators } from './properties'; export class SelectFieldInterface extends CollectionFieldInterface { name = 'select'; diff --git a/packages/core/client/src/collection-manager/interfaces/sort.ts b/packages/core/client/src/collection-manager/interfaces/sort.ts index 0148e0d91..0574b435a 100644 --- a/packages/core/client/src/collection-manager/interfaces/sort.ts +++ b/packages/core/client/src/collection-manager/interfaces/sort.ts @@ -1,6 +1,7 @@ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { i18n } from '../../i18n'; import { defaultProps, operators } from './properties'; + export class SortFieldInterface extends CollectionFieldInterface { name = 'sort'; type = 'object'; diff --git a/packages/core/client/src/collection-manager/interfaces/subTable.ts b/packages/core/client/src/collection-manager/interfaces/subTable.ts index deecc9cfe..d2725006e 100644 --- a/packages/core/client/src/collection-manager/interfaces/subTable.ts +++ b/packages/core/client/src/collection-manager/interfaces/subTable.ts @@ -1,7 +1,7 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { defaultProps } from './properties'; +import { ISchema, uid } from '@tachybase/schema'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps } from './properties'; export class SubTableFieldInterface extends CollectionFieldInterface { name = 'subTable'; diff --git a/packages/core/client/src/collection-manager/interfaces/textarea.ts b/packages/core/client/src/collection-manager/interfaces/textarea.ts index 454bf87b2..54e983039 100644 --- a/packages/core/client/src/collection-manager/interfaces/textarea.ts +++ b/packages/core/client/src/collection-manager/interfaces/textarea.ts @@ -1,7 +1,8 @@ import { ISchema } from '@tachybase/schema'; + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { i18n } from '../../i18n'; import { defaultProps, operators } from './properties'; -import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; export class TextareaFieldInterface extends CollectionFieldInterface { name = 'textarea'; diff --git a/packages/core/client/src/collection-manager/interfaces/updatedBy.ts b/packages/core/client/src/collection-manager/interfaces/updatedBy.ts index eb89a4b89..af5379442 100644 --- a/packages/core/client/src/collection-manager/interfaces/updatedBy.ts +++ b/packages/core/client/src/collection-manager/interfaces/updatedBy.ts @@ -1,5 +1,7 @@ import { ISchema } from '@tachybase/schema'; + import { cloneDeep } from 'lodash'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; import { defaultProps, recordPickerViewer } from './properties'; diff --git a/packages/core/client/src/collection-manager/interfaces/url.ts b/packages/core/client/src/collection-manager/interfaces/url.ts index 8230d171f..193639523 100644 --- a/packages/core/client/src/collection-manager/interfaces/url.ts +++ b/packages/core/client/src/collection-manager/interfaces/url.ts @@ -1,6 +1,7 @@ import { ISchema } from '@tachybase/schema'; -import { defaultProps, operators } from './properties'; + import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { defaultProps, operators } from './properties'; export class UrlFieldInterface extends CollectionFieldInterface { name = 'url'; diff --git a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts index 2d489bd11..2bc8103b1 100644 --- a/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts +++ b/packages/core/client/src/collection-manager/mixins/InheritanceCollectionMixin.ts @@ -1,6 +1,7 @@ +import _, { filter, unionBy, uniq } from 'lodash'; + import type { CollectionFieldOptions, GetCollectionFieldPredicate } from '../../data-source'; import { Collection } from '../../data-source/collection/Collection'; -import _, { filter, unionBy, uniq } from 'lodash'; export class InheritanceCollectionMixin extends Collection { protected parentCollectionsName: string[]; diff --git a/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx b/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx index da9553a18..96b05c6be 100644 --- a/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx @@ -1,7 +1,9 @@ -import { observer, useForm } from '@tachybase/schema'; -import { Table, Tag } from 'antd'; import React, { useEffect, useState } from 'react'; +import { observer, useForm } from '@tachybase/schema'; + +import { Table, Tag } from 'antd'; import { useTranslation } from 'react-i18next'; + import { useCollectionManager_deprecated } from '../../'; import { useCompile } from '../../../'; diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx index 8527b1e80..381513ea3 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx @@ -1,8 +1,10 @@ +import React, { useContext, useEffect, useState } from 'react'; import { useField, useForm } from '@tachybase/schema'; + import { Cascader, Input, Select, Spin, Table, Tag } from 'antd'; import { last, omit } from 'lodash'; -import React, { useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { ResourceActionContext, useCompile } from '../../../'; import { useAPIClient } from '../../../api-client'; import { useFieldInterfaceOptions } from '../../Configuration/interfaces'; diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx index 721db369c..b67365896 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewTable.tsx @@ -1,7 +1,9 @@ -import { RecursionField, useForm } from '@tachybase/schema'; -import { Spin, Table } from 'antd'; import React, { useEffect, useState } from 'react'; +import { RecursionField, useForm } from '@tachybase/schema'; + +import { Spin, Table } from 'antd'; import { useTranslation } from 'react-i18next'; + import { EllipsisWithTooltip, useCompile } from '../../../'; import { useAPIClient } from '../../../api-client'; import { useCollectionManager_deprecated } from '../../hooks/useCollectionManager_deprecated'; diff --git a/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx b/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx index 9007f8b37..f6123412b 100644 --- a/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx +++ b/packages/core/client/src/collection-manager/templates/components/sql-collection/FieldsConfigure.tsx @@ -1,14 +1,15 @@ -import { useTranslation } from 'react-i18next'; -import { useAsyncData } from '../../../../async-data-provider'; import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; -import { Alert, Cascader, Input, Select, Spin, Table, Tag } from 'antd'; -import { observer, useField, useForm } from '@tachybase/schema'; -import { ArrayField } from '@tachybase/schema'; -import { useFieldInterfaceOptions } from '../../../Configuration/interfaces'; -import { useCompile } from '../../../../schema-component'; -import { useCollectionManager_deprecated } from '../../../hooks'; -import dayjs from 'dayjs'; import { FieldOptions } from '@tachybase/database'; +import { ArrayField, observer, useField, useForm } from '@tachybase/schema'; + +import { Alert, Cascader, Input, Select, Spin, Table, Tag } from 'antd'; +import dayjs from 'dayjs'; +import { useTranslation } from 'react-i18next'; + +import { useAsyncData } from '../../../../async-data-provider'; +import { useCompile } from '../../../../schema-component'; +import { useFieldInterfaceOptions } from '../../../Configuration/interfaces'; +import { useCollectionManager_deprecated } from '../../../hooks'; import { ResourceActionContext } from '../../../ResourceActionProvider'; const inferInterface = (field: string, value: any) => { diff --git a/packages/core/client/src/collection-manager/templates/components/sql-collection/PreviewTable.tsx b/packages/core/client/src/collection-manager/templates/components/sql-collection/PreviewTable.tsx index a926bbd2f..bc9fe0036 100644 --- a/packages/core/client/src/collection-manager/templates/components/sql-collection/PreviewTable.tsx +++ b/packages/core/client/src/collection-manager/templates/components/sql-collection/PreviewTable.tsx @@ -1,9 +1,11 @@ -import { useAsyncData } from '../../../../async-data-provider'; import React, { useEffect } from 'react'; +import { observer, Schema, useForm } from '@tachybase/schema'; + import { Table } from 'antd'; -import { Schema, observer, useForm } from '@tachybase/schema'; import { useTranslation } from 'react-i18next'; +import { useAsyncData } from '../../../../async-data-provider'; + export const PreviewTable = observer( () => { const { data: res, loading, error } = useAsyncData(); diff --git a/packages/core/client/src/collection-manager/templates/sql.tsx b/packages/core/client/src/collection-manager/templates/sql.tsx index 34cf9ec0c..56dfb86aa 100644 --- a/packages/core/client/src/collection-manager/templates/sql.tsx +++ b/packages/core/client/src/collection-manager/templates/sql.tsx @@ -1,8 +1,9 @@ import { Field } from '@tachybase/schema'; -import { SQLInput, PreviewTable, FieldsConfigure, SQLRequestProvider } from './components/sql-collection'; -import { getConfigurableProperties } from './properties'; -import { i18n } from '../../i18n'; + import { CollectionTemplate } from '../../data-source/collection-template/CollectionTemplate'; +import { i18n } from '../../i18n'; +import { FieldsConfigure, PreviewTable, SQLInput, SQLRequestProvider } from './components/sql-collection'; +import { getConfigurableProperties } from './properties'; export class SqlCollectionTemplate extends CollectionTemplate { name = 'sql'; diff --git a/packages/core/client/src/collection-manager/templates/types.ts b/packages/core/client/src/collection-manager/templates/types.ts index 4c819698a..1bb6b5815 100644 --- a/packages/core/client/src/collection-manager/templates/types.ts +++ b/packages/core/client/src/collection-manager/templates/types.ts @@ -1,7 +1,8 @@ import type { ISchema } from '@tachybase/schema'; -import type { FieldOptions } from '../types'; + import type { Application } from '../../application'; -import type { CollectionOptions, Collection } from '../../data-source/collection/Collection'; +import type { Collection, CollectionOptions } from '../../data-source/collection/Collection'; +import type { FieldOptions } from '../types'; export interface ICollectionTemplate { name: string; diff --git a/packages/core/client/src/collection-manager/types.ts b/packages/core/client/src/collection-manager/types.ts index 3e25f6715..833f7867c 100644 --- a/packages/core/client/src/collection-manager/types.ts +++ b/packages/core/client/src/collection-manager/types.ts @@ -1,5 +1,6 @@ -import type { ISchema } from '@tachybase/schema'; import type { ReactNode } from 'react'; +import type { ISchema } from '@tachybase/schema'; + import type { CollectionManager, CollectionOptions } from '../data-source'; export type { CollectionOptions } from '../data-source'; diff --git a/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx b/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx index 70cda2508..8b562ffda 100644 --- a/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx @@ -1,15 +1,16 @@ import React from 'react'; -import { render, screen } from '@tachybase/test/client'; import { + Application, CollectionField, CollectionProvider, - Application, + DataSourceApplicationProvider, FormItem, Input, SchemaComponent, SchemaComponentProvider, - DataSourceApplicationProvider, } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; + import collections from '../collections.json'; function renderApp(fieldName: string) { diff --git a/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx index 371351e54..9e106ec50 100644 --- a/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx @@ -1,13 +1,14 @@ import React, { ComponentType } from 'react'; -import { render, screen } from '@tachybase/test/client'; import { + Application, CollectionFieldProvider, CollectionProvider, - useCollectionField, - Application, - SchemaComponentProvider, DataSourceApplicationProvider, + SchemaComponentProvider, + useCollectionField, } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; + import collections from '../collections.json'; function renderApp(Demo: ComponentType, name?: string) { diff --git a/packages/core/client/src/data-source/__tests__/collection-record/CollectionRecordProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection-record/CollectionRecordProvider.test.tsx index 5f9fe6e17..032e94a8f 100644 --- a/packages/core/client/src/data-source/__tests__/collection-record/CollectionRecordProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection-record/CollectionRecordProvider.test.tsx @@ -1,12 +1,13 @@ import React from 'react'; import { render, screen } from '@tachybase/test/client'; + import { - CollectionRecordProvider, CollectionRecord, - useCollectionParentRecordData, + CollectionRecordProvider, useCollectionParentRecord, - useCollectionRecordData, + useCollectionParentRecordData, useCollectionRecord, + useCollectionRecordData, } from '../../collection-record'; describe('CollectionRecordProvider', () => { diff --git a/packages/core/client/src/data-source/__tests__/collection-template/CollectionTemplateManager.test.ts b/packages/core/client/src/data-source/__tests__/collection-template/CollectionTemplateManager.test.ts index a29ec905b..bed4841c5 100644 --- a/packages/core/client/src/data-source/__tests__/collection-template/CollectionTemplateManager.test.ts +++ b/packages/core/client/src/data-source/__tests__/collection-template/CollectionTemplateManager.test.ts @@ -1,4 +1,4 @@ -import { Application, CollectionTemplate, CollectionTemplateManager, Collection } from '@tachybase/client'; +import { Application, Collection, CollectionTemplate, CollectionTemplateManager } from '@tachybase/client'; describe('CollectionTemplateManager', () => { let collectionTemplateManager: CollectionTemplateManager; diff --git a/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx index 86662fc8d..e7af785ce 100644 --- a/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx @@ -1,15 +1,16 @@ import React, { ComponentType } from 'react'; -import { render, screen } from '@tachybase/test/client'; import { - AssociationProvider, - useCollectionField, - useCollection, Application, + AssociationProvider, + DataSourceApplicationProvider, SchemaComponent, SchemaComponentProvider, - DataSourceApplicationProvider, + useCollection, + useCollectionField, useParentCollection, } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; + import collections from '../collections.json'; function renderApp(Demo: ComponentType, props: any = {}) { diff --git a/packages/core/client/src/data-source/__tests__/collection/Collection.test.tsx b/packages/core/client/src/data-source/__tests__/collection/Collection.test.tsx index b70da560c..105dc9e20 100644 --- a/packages/core/client/src/data-source/__tests__/collection/Collection.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/Collection.test.tsx @@ -1,4 +1,5 @@ import { Application, CollectionOptions, DEFAULT_DATA_SOURCE_KEY } from '@tachybase/client'; + import collections from '../collections.json'; function getCollection(collection: CollectionOptions) { diff --git a/packages/core/client/src/data-source/__tests__/collection/CollectionManager.test.tsx b/packages/core/client/src/data-source/__tests__/collection/CollectionManager.test.tsx index 0d289ce5f..cc3f8ff2d 100644 --- a/packages/core/client/src/data-source/__tests__/collection/CollectionManager.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/CollectionManager.test.tsx @@ -1,6 +1,7 @@ -import { Application, CollectionManager, CollectionTemplate, Collection } from '@tachybase/client'; -import collections from '../collections.json'; +import { Application, Collection, CollectionManager, CollectionTemplate } from '@tachybase/client'; + import { app } from '../../../application/demos/demo3'; +import collections from '../collections.json'; describe('CollectionManager', () => { let collectionManager: CollectionManager; diff --git a/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx index d4a18259d..33337cfb2 100644 --- a/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx @@ -1,14 +1,15 @@ import React, { ComponentType, useEffect } from 'react'; -import { render, screen } from '@tachybase/test/client'; import { + Application, CollectionManager, + CollectionManagerProvider, + DataSourceApplicationProvider, + ExtendCollectionsProvider, useCollectionManager, useCollections, - Application, - DataSourceApplicationProvider, - CollectionManagerProvider, - ExtendCollectionsProvider, } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; + import collections from '../collections.json'; function renderApp(Demo: ComponentType, dataSource?: string) { diff --git a/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx index 39ab375bd..f7ddf7091 100644 --- a/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx @@ -1,14 +1,15 @@ import React, { ComponentType } from 'react'; -import { render, screen } from '@tachybase/test/client'; import { - CollectionProvider, - useCollectionFields, - useCollection, Application, + CollectionProvider, + DataSourceApplicationProvider, SchemaComponent, SchemaComponentProvider, - DataSourceApplicationProvider, + useCollection, + useCollectionFields, } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; + import collections from '../collections.json'; function renderApp(Demo: ComponentType, props: any = {}) { diff --git a/packages/core/client/src/data-source/__tests__/collection/ExtendCollectionsProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/ExtendCollectionsProvider.test.tsx index 33d251989..80e11b7cf 100644 --- a/packages/core/client/src/data-source/__tests__/collection/ExtendCollectionsProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/collection/ExtendCollectionsProvider.test.tsx @@ -1,12 +1,14 @@ import React from 'react'; -import { render, screen } from '@testing-library/react'; import { - ExtendCollectionsProvider, Application, - DataSourceManagerProvider, CollectionManagerProvider, + DataSourceManagerProvider, + ExtendCollectionsProvider, useCollectionManager, } from '@tachybase/client'; + +import { render, screen } from '@testing-library/react'; + import { useDataSourceKey } from '../../data-source/DataSourceProvider'; describe('ExtendCollectionsProvider', () => { diff --git a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx index e2cafc25c..5995a35fd 100644 --- a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx +++ b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx @@ -1,7 +1,6 @@ import React from 'react'; - -import { render, screen } from '@tachybase/test/client'; import { CollectionDeletedPlaceholder, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { render, screen } from '@tachybase/test/client'; function renderApp(name?: any, designable?: boolean) { const schema = { diff --git a/packages/core/client/src/data-source/__tests__/data-block/DataBlockProvider.test.tsx b/packages/core/client/src/data-source/__tests__/data-block/DataBlockProvider.test.tsx index 345084df9..1a302094b 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/DataBlockProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/DataBlockProvider.test.tsx @@ -1,11 +1,12 @@ import React from 'react'; import { fireEvent, render, screen, waitFor } from '@tachybase/test/client'; -import CollectionTableListDemo from './data-block-demos/collection-table-list'; -import CollectionFormGetAndUpdateDemo from './data-block-demos/collection-form-get-and-update'; -import CollectionFormCreateDemo from './data-block-demos/collection-form-create'; -import CollectionFormRecordAndUpdateDemo from './data-block-demos/collection-form-record-and-update'; -import AssociationTableListAndSourceIdDemo from './data-block-demos/association-table-list-and-source-id'; + import AssociationTableListAndParentRecordDemo from './data-block-demos/association-table-list-and-parent-record'; +import AssociationTableListAndSourceIdDemo from './data-block-demos/association-table-list-and-source-id'; +import CollectionFormCreateDemo from './data-block-demos/collection-form-create'; +import CollectionFormGetAndUpdateDemo from './data-block-demos/collection-form-get-and-update'; +import CollectionFormRecordAndUpdateDemo from './data-block-demos/collection-form-record-and-update'; +import CollectionTableListDemo from './data-block-demos/collection-table-list'; describe('CollectionDataSourceProvider', () => { describe('collection', () => { diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-parent-record.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-parent-record.tsx index fc81dfed1..036eb4daa 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-parent-record.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-parent-record.tsx @@ -1,7 +1,9 @@ import React from 'react'; -import { Table, TableProps } from 'antd'; import { SchemaComponent, UseDataBlockProps, useDataBlockRequest, withDynamicSchemaProps } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; + +import { Table, TableProps } from 'antd'; + import { createApp } from './createApp'; const collection = 'users'; diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-source-id.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-source-id.tsx index 55e9e3004..8b8c49efc 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-source-id.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/association-table-list-and-source-id.tsx @@ -1,9 +1,10 @@ import React from 'react'; -import { Select, Table, TableProps } from 'antd'; import { SchemaComponent, UseDataBlockProps, useDataBlockRequest, withDynamicSchemaProps } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; import useUrlState from '@ahooksjs/use-url-state'; +import { Select, Table, TableProps } from 'antd'; + import { createApp } from './createApp'; const collection = 'users'; diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-create.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-create.tsx index 19776b594..1781063ef 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-create.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-create.tsx @@ -1,7 +1,9 @@ import React, { FC } from 'react'; -import { Button, Form, FormProps, Input, InputNumber, notification } from 'antd'; import { SchemaComponent, useDataBlockResource, withDynamicSchemaProps } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; + +import { Button, Form, FormProps, Input, InputNumber, notification } from 'antd'; + import { createApp } from './createApp'; interface DemoFormFieldType { diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-get-and-update.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-get-and-update.tsx index 00a2eded3..6e0b1829c 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-get-and-update.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-get-and-update.tsx @@ -1,14 +1,15 @@ import React, { FC, useEffect } from 'react'; -import { Button, Form, FormProps, Input, InputNumber, Select, notification } from 'antd'; import { SchemaComponent, + useCollectionRecordData, UseDataBlockProps, useDataBlockResource, - useCollectionRecordData, withDynamicSchemaProps, } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; + import useUrlState from '@ahooksjs/use-url-state'; +import { Button, Form, FormProps, Input, InputNumber, notification, Select } from 'antd'; import { createApp } from './createApp'; diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-record-and-update.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-record-and-update.tsx index 192fe2c7f..20cf75335 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-record-and-update.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-form-record-and-update.tsx @@ -1,14 +1,16 @@ import React, { FC, useEffect } from 'react'; -import { Button, Form, FormProps, Input, InputNumber, notification } from 'antd'; import { CollectionRecordProvider, SchemaComponent, + useCollectionRecordData, UseDataBlockProps, useDataBlockResource, - useCollectionRecordData, withDynamicSchemaProps, } from '@tachybase/client'; import { ISchema } from '@tachybase/schema'; + +import { Button, Form, FormProps, Input, InputNumber, notification } from 'antd'; + import { createApp } from './createApp'; interface DemoFormFieldType { diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-table-list.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-table-list.tsx index 1acacca42..c84c0567a 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-table-list.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/collection-table-list.tsx @@ -1,7 +1,9 @@ import React from 'react'; import { SchemaComponent, useDataBlockRequest, withDynamicSchemaProps } from '@tachybase/client'; -import { Table, TableProps } from 'antd'; import { ISchema } from '@tachybase/schema'; + +import { Table, TableProps } from 'antd'; + import { createApp } from './createApp'; const schema: ISchema = { diff --git a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/createApp.tsx b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/createApp.tsx index 8db05b6b5..fcc7f8adf 100644 --- a/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/createApp.tsx +++ b/packages/core/client/src/data-source/__tests__/data-block/data-block-demos/createApp.tsx @@ -1,16 +1,18 @@ +import { ComponentType } from 'react'; import { - ApplicationOptions, Application, + ApplicationOptions, CardItem, - Plugin, CollectionPlugin, DataBlockProvider, - LocalDataSource, DEFAULT_DATA_SOURCE_KEY, DEFAULT_DATA_SOURCE_TITLE, + LocalDataSource, + Plugin, } from '@tachybase/client'; + import MockAdapter from 'axios-mock-adapter'; -import { ComponentType } from 'react'; + import collections from '../../collections.json'; export function createApp(Demo: ComponentType, options: ApplicationOptions = {}, mocks: Record) { diff --git a/packages/core/client/src/data-source/__tests__/data-source/CollectionDataSourceProvider.test.tsx b/packages/core/client/src/data-source/__tests__/data-source/CollectionDataSourceProvider.test.tsx index 4f3c59507..38b928beb 100644 --- a/packages/core/client/src/data-source/__tests__/data-source/CollectionDataSourceProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/data-source/CollectionDataSourceProvider.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; +import { Application } from '@tachybase/client'; import { render, screen } from '@tachybase/test/client'; -import { Application } from '@tachybase/client'; import { DataSourceApplicationProvider } from '../../components/DataSourceApplicationProvider'; import { DataSourceProvider, useDataSourceKey } from '../../data-source/DataSourceProvider'; diff --git a/packages/core/client/src/data-source/__tests__/data-source/DataSource.test.ts b/packages/core/client/src/data-source/__tests__/data-source/DataSource.test.ts index 843ade5d6..879d3b3d0 100644 --- a/packages/core/client/src/data-source/__tests__/data-source/DataSource.test.ts +++ b/packages/core/client/src/data-source/__tests__/data-source/DataSource.test.ts @@ -1,4 +1,4 @@ -import { Application, DataSourceOptions, DataSource } from '@tachybase/client'; +import { Application, DataSource, DataSourceOptions } from '@tachybase/client'; describe('DataSource', () => { let dataSource: DataSource; diff --git a/packages/core/client/src/data-source/__tests__/data-source/DataSourceManager.test.ts b/packages/core/client/src/data-source/__tests__/data-source/DataSourceManager.test.ts index 494af201e..56e7c0ebf 100644 --- a/packages/core/client/src/data-source/__tests__/data-source/DataSourceManager.test.ts +++ b/packages/core/client/src/data-source/__tests__/data-source/DataSourceManager.test.ts @@ -1,4 +1,5 @@ import { Application, Collection, DEFAULT_DATA_SOURCE_KEY, LocalDataSource, Plugin } from '@tachybase/client'; + import collections from '../collections.json'; describe('DataSourceManager', () => { diff --git a/packages/core/client/src/data-source/__tests__/data-source/DataSourceManagerProvider.test.tsx b/packages/core/client/src/data-source/__tests__/data-source/DataSourceManagerProvider.test.tsx index c3f2a6ee4..efcd455f6 100644 --- a/packages/core/client/src/data-source/__tests__/data-source/DataSourceManagerProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/data-source/DataSourceManagerProvider.test.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import { render } from '@testing-library/react'; import { DataSourceManagerProvider, useDataSourceManager } from '@tachybase/client'; +import { render } from '@testing-library/react'; + describe('DataSourceManagerProvider', () => { test('should render children', () => { const dataSourceManager = {} as any; // Replace with your actual data source manager object diff --git a/packages/core/client/src/data-source/__tests__/data-source/DataSourceProvider.test.tsx b/packages/core/client/src/data-source/__tests__/data-source/DataSourceProvider.test.tsx index fbaecb50a..b436b3b13 100644 --- a/packages/core/client/src/data-source/__tests__/data-source/DataSourceProvider.test.tsx +++ b/packages/core/client/src/data-source/__tests__/data-source/DataSourceProvider.test.tsx @@ -1,16 +1,17 @@ +import React from 'react'; import { Application, - DEFAULT_DATA_SOURCE_KEY, + DataSource, DataSourceManagerProvider, DataSourceOptions, - DataSource, + DEFAULT_DATA_SOURCE_KEY, SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import { DataSourceProvider, useDataSourceKey } from '../../data-source/DataSourceProvider'; import { render, screen } from '@tachybase/test/client'; -import React from 'react'; + import { AppSchemaComponentProvider } from '../../../application/AppSchemaComponentProvider'; +import { DataSourceProvider, useDataSourceKey } from '../../data-source/DataSourceProvider'; describe('DataSourceProvider', () => { function renderComponent(dataSource?: string, status?: DataSourceOptions['status']) { diff --git a/packages/core/client/src/data-source/__tests__/utils.test.ts b/packages/core/client/src/data-source/__tests__/utils.test.ts index 4c9fe643d..e8e61fbf5 100644 --- a/packages/core/client/src/data-source/__tests__/utils.test.ts +++ b/packages/core/client/src/data-source/__tests__/utils.test.ts @@ -1,4 +1,5 @@ -import { CollectionFieldInterface, isTitleField, Application } from '@tachybase/client'; +import { Application, CollectionFieldInterface, isTitleField } from '@tachybase/client'; + import collections from './collections.json'; describe('utils', () => { diff --git a/packages/core/client/src/data-source/collection-field-interface/CollectionFieldInterface.ts b/packages/core/client/src/data-source/collection-field-interface/CollectionFieldInterface.ts index 9cf0014ad..7bacd28b6 100644 --- a/packages/core/client/src/data-source/collection-field-interface/CollectionFieldInterface.ts +++ b/packages/core/client/src/data-source/collection-field-interface/CollectionFieldInterface.ts @@ -1,4 +1,5 @@ import type { ISchema } from '@tachybase/schema'; + import type { CollectionFieldOptions } from '../collection'; import { CollectionFieldInterfaceManager } from './CollectionFieldInterfaceManager'; diff --git a/packages/core/client/src/data-source/collection-record/CollectionRecordProvider.tsx b/packages/core/client/src/data-source/collection-record/CollectionRecordProvider.tsx index d2090d650..268b9fef1 100644 --- a/packages/core/client/src/data-source/collection-record/CollectionRecordProvider.tsx +++ b/packages/core/client/src/data-source/collection-record/CollectionRecordProvider.tsx @@ -1,4 +1,5 @@ -import React, { FC, ReactNode, createContext, useContext, useMemo } from 'react'; +import React, { createContext, FC, ReactNode, useContext, useMemo } from 'react'; + import { CollectionRecord } from './CollectionRecord'; export const CollectionRecordContext = createContext>(null); diff --git a/packages/core/client/src/data-source/collection-template/CollectionTemplate.ts b/packages/core/client/src/data-source/collection-template/CollectionTemplate.ts index adb1fe3e4..4c14e6a93 100644 --- a/packages/core/client/src/data-source/collection-template/CollectionTemplate.ts +++ b/packages/core/client/src/data-source/collection-template/CollectionTemplate.ts @@ -1,7 +1,8 @@ -import type { CollectionOptions, Collection } from '../collection'; import type { ISchema } from '@tachybase/schema'; -import type { CollectionTemplateManager } from './CollectionTemplateManager'; + import type { Application } from '../../application/Application'; +import type { Collection, CollectionOptions } from '../collection'; +import type { CollectionTemplateManager } from './CollectionTemplateManager'; interface AvailableFieldInterfacesInclude { include?: any[]; diff --git a/packages/core/client/src/data-source/collection/AssociationProvider.tsx b/packages/core/client/src/data-source/collection/AssociationProvider.tsx index 5d6757786..609482bba 100644 --- a/packages/core/client/src/data-source/collection/AssociationProvider.tsx +++ b/packages/core/client/src/data-source/collection/AssociationProvider.tsx @@ -1,4 +1,5 @@ -import React, { FC, ReactNode, createContext, useContext } from 'react'; +import React, { createContext, FC, ReactNode, useContext } from 'react'; + import { CollectionFieldProvider } from '../collection-field'; import { CollectionDeletedPlaceholder } from '../components/CollectionDeletedPlaceholder'; import { Collection } from './Collection'; diff --git a/packages/core/client/src/data-source/collection/CollectionManager.ts b/packages/core/client/src/data-source/collection/CollectionManager.ts index c9959dbf4..152daf0ad 100644 --- a/packages/core/client/src/data-source/collection/CollectionManager.ts +++ b/packages/core/client/src/data-source/collection/CollectionManager.ts @@ -1,8 +1,12 @@ import type { SchemaKey } from '@tachybase/schema'; -import type { DataSource } from '../data-source'; -import type { CollectionFieldOptions, CollectionOptions, GetCollectionFieldPredicate } from './Collection'; -import { Collection } from './Collection'; +import type { DataSource } from '../data-source'; +import { + Collection, + type CollectionFieldOptions, + type CollectionOptions, + type GetCollectionFieldPredicate, +} from './Collection'; import { applyMixins, collectionTransform } from './utils'; export class CollectionManager { diff --git a/packages/core/client/src/data-source/collection/CollectionManagerProvider.tsx b/packages/core/client/src/data-source/collection/CollectionManagerProvider.tsx index c3e7669cc..08d0112f5 100644 --- a/packages/core/client/src/data-source/collection/CollectionManagerProvider.tsx +++ b/packages/core/client/src/data-source/collection/CollectionManagerProvider.tsx @@ -1,7 +1,8 @@ -import React, { FC, ReactNode, createContext, useContext, useMemo } from 'react'; -import type { CollectionManager } from './CollectionManager'; -import type { Collection } from './Collection'; +import React, { createContext, FC, ReactNode, useContext, useMemo } from 'react'; + import { DataSourceProvider, useDataSource } from '../data-source/DataSourceProvider'; +import type { Collection } from './Collection'; +import type { CollectionManager } from './CollectionManager'; import { useExtendCollections } from './ExtendCollectionsProvider'; export const CollectionManagerContext = createContext(null); diff --git a/packages/core/client/src/data-source/collection/ExtendCollectionsProvider.tsx b/packages/core/client/src/data-source/collection/ExtendCollectionsProvider.tsx index 1acfffb8e..e6f530df8 100644 --- a/packages/core/client/src/data-source/collection/ExtendCollectionsProvider.tsx +++ b/packages/core/client/src/data-source/collection/ExtendCollectionsProvider.tsx @@ -1,6 +1,7 @@ -import React, { FC, ReactNode, createContext, useContext, useMemo } from 'react'; -import { CollectionOptions } from './Collection'; +import React, { createContext, FC, ReactNode, useContext, useMemo } from 'react'; + import { useDataSourceKey } from '../data-source/DataSourceProvider'; +import { CollectionOptions } from './Collection'; import { CollectionManagerProvider } from './CollectionManagerProvider'; export const ExtendCollectionsContext = createContext(null); diff --git a/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx b/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx index 33c3d8aec..1f6cfe7f3 100644 --- a/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx +++ b/packages/core/client/src/data-source/components/CollectionDeletedPlaceholder.tsx @@ -1,11 +1,13 @@ -import { App, Button, Result, Typography } from 'antd'; import React, { FC, useMemo } from 'react'; + +import { App, Button, Result, Typography } from 'antd'; import { useTranslation } from 'react-i18next'; -import { CardItem, EllipsisWithTooltip, useCompile, useDesignable } from '../../schema-component'; -import { useDataSource } from '../data-source/DataSourceProvider'; -import { useDataSourceManager } from '../data-source'; + import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager'; +import { CardItem, EllipsisWithTooltip, useCompile, useDesignable } from '../../schema-component'; import { useCollection } from '../collection'; +import { useDataSourceManager } from '../data-source'; +import { useDataSource } from '../data-source/DataSourceProvider'; export interface CollectionDeletedPlaceholderProps { type: 'Collection' | 'Field' | 'DataSource'; diff --git a/packages/core/client/src/data-source/components/DataSourceApplicationProvider.tsx b/packages/core/client/src/data-source/components/DataSourceApplicationProvider.tsx index 4327f647d..3b14b6b9b 100644 --- a/packages/core/client/src/data-source/components/DataSourceApplicationProvider.tsx +++ b/packages/core/client/src/data-source/components/DataSourceApplicationProvider.tsx @@ -1,10 +1,11 @@ import React, { FC } from 'react'; + +import { + CollectionManagerProvider, + type CollectionManagerProviderProps, +} from '../collection/CollectionManagerProvider'; import type { DataSourceManager } from '../data-source/DataSourceManager'; import { DataSourceManagerProvider } from '../data-source/DataSourceManagerProvider'; -import { - type CollectionManagerProviderProps, - CollectionManagerProvider, -} from '../collection/CollectionManagerProvider'; interface DataSourceApplicationProviderProps extends CollectionManagerProviderProps { dataSourceManager: DataSourceManager; diff --git a/packages/core/client/src/filter-provider/__tests__/useFilter.tsx b/packages/core/client/src/filter-provider/__tests__/useFilter.tsx index 7d085c6fc..e9b091d61 100644 --- a/packages/core/client/src/filter-provider/__tests__/useFilter.tsx +++ b/packages/core/client/src/filter-provider/__tests__/useFilter.tsx @@ -1,5 +1,7 @@ -import { render } from '@testing-library/react'; import React from 'react'; + +import { render } from '@testing-library/react'; + import { FilterBlockProvider, useFilterBlock } from '../FilterProvider'; describe('useFilter', () => { diff --git a/packages/core/client/src/flag-provider/__tests__/flag-provider.test.tsx b/packages/core/client/src/flag-provider/__tests__/flag-provider.test.tsx index 462bf3b80..24cbb4a3e 100644 --- a/packages/core/client/src/flag-provider/__tests__/flag-provider.test.tsx +++ b/packages/core/client/src/flag-provider/__tests__/flag-provider.test.tsx @@ -1,5 +1,6 @@ -import { renderHook } from '@tachybase/test/client'; import React from 'react'; +import { renderHook } from '@tachybase/test/client'; + import { FlagProvider } from '../FlagProvider'; import { useFlag } from '../hooks/useFlag'; diff --git a/packages/core/client/src/flag-provider/hooks/useFlag.ts b/packages/core/client/src/flag-provider/hooks/useFlag.ts index 7b7abf5cb..c533e8c4f 100644 --- a/packages/core/client/src/flag-provider/hooks/useFlag.ts +++ b/packages/core/client/src/flag-provider/hooks/useFlag.ts @@ -1,4 +1,5 @@ import { useContext } from 'react'; + import { FlagContext } from '../FlagProvider'; export const useFlag = () => { diff --git a/packages/core/client/src/icon/__tests__/icon.test.tsx b/packages/core/client/src/icon/__tests__/icon.test.tsx index 1bc7a9782..69511dafa 100644 --- a/packages/core/client/src/icon/__tests__/icon.test.tsx +++ b/packages/core/client/src/icon/__tests__/icon.test.tsx @@ -1,5 +1,6 @@ -import { render, screen } from '@tachybase/test/client'; import React from 'react'; +import { render, screen } from '@tachybase/test/client'; + import App1 from '../demos/antd-icon'; import App3 from '../demos/custom-icon'; import App2 from '../demos/iconfont'; diff --git a/packages/core/client/src/icon/demos/antd-icon.tsx b/packages/core/client/src/icon/demos/antd-icon.tsx index ec979a7a8..1d4b089de 100644 --- a/packages/core/client/src/icon/demos/antd-icon.tsx +++ b/packages/core/client/src/icon/demos/antd-icon.tsx @@ -1,4 +1,4 @@ -import { Icon } from '@tachybase/client'; import React from 'react'; +import { Icon } from '@tachybase/client'; export default () => ; diff --git a/packages/core/client/src/icon/demos/custom-icon.tsx b/packages/core/client/src/icon/demos/custom-icon.tsx index 8aef2da28..ba4796634 100644 --- a/packages/core/client/src/icon/demos/custom-icon.tsx +++ b/packages/core/client/src/icon/demos/custom-icon.tsx @@ -1,5 +1,5 @@ -import { Icon } from '@tachybase/client'; import React from 'react'; +import { Icon } from '@tachybase/client'; const HeartSvg = () => ( diff --git a/packages/core/client/src/icon/demos/iconfont.tsx b/packages/core/client/src/icon/demos/iconfont.tsx index 801c0fbd5..a333dc278 100644 --- a/packages/core/client/src/icon/demos/iconfont.tsx +++ b/packages/core/client/src/icon/demos/iconfont.tsx @@ -1,5 +1,5 @@ -import { Icon } from '@tachybase/client'; import React from 'react'; +import { Icon } from '@tachybase/client'; Icon.createFromIconfontCN({ scriptUrl: '//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js', diff --git a/packages/core/client/src/icon/demos/register-icon.tsx b/packages/core/client/src/icon/demos/register-icon.tsx index dcd592c88..10efa569b 100644 --- a/packages/core/client/src/icon/demos/register-icon.tsx +++ b/packages/core/client/src/icon/demos/register-icon.tsx @@ -1,5 +1,5 @@ -import { Icon } from '@tachybase/client'; import React from 'react'; +import { Icon } from '@tachybase/client'; const HeartSvg = () => ( diff --git a/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx b/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx index fa57d2b84..4f1f9c076 100644 --- a/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx +++ b/packages/core/client/src/modules/actions/ActionSchemaToolbar.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { SchemaToolbar } from '../../schema-settings/GeneralSchemaDesigner'; export const ActionSchemaToolbar = (props) => { diff --git a/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx b/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx index a5673e802..1c6fc0599 100644 --- a/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-child/CreateChildInitializer.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; + export const CreateChildInitializer = (props) => { const schema = { type: 'void', diff --git a/packages/core/client/src/modules/actions/add-child/addChildActionSettings.tsx b/packages/core/client/src/modules/actions/add-child/addChildActionSettings.tsx index abdc5d02e..b728081bd 100644 --- a/packages/core/client/src/modules/actions/add-child/addChildActionSettings.tsx +++ b/packages/core/client/src/modules/actions/add-child/addChildActionSettings.tsx @@ -1,11 +1,12 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { ButtonEditor } from '../../../schema-component/antd/action/Action.Designer'; import { SchemaSettingOpenModeSchemaItems } from '../../../schema-items'; -import { SchemaSettingsLinkageRules, SchemaSettingsEnableChildCollections } from '../../../schema-settings'; +import { SchemaSettingsEnableChildCollections, SchemaSettingsLinkageRules } from '../../../schema-settings'; export const addChildActionSettings = new SchemaSettings({ name: 'actionSettings:addChild', diff --git a/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx b/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx index 39faabb53..dcb6b5efe 100644 --- a/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-new/CreateActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useSchemaInitializerItem } from '../../../application'; import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; diff --git a/packages/core/client/src/modules/actions/add-new/addNewActionSettings.tsx b/packages/core/client/src/modules/actions/add-new/addNewActionSettings.tsx index 392ea6699..df37df14d 100644 --- a/packages/core/client/src/modules/actions/add-new/addNewActionSettings.tsx +++ b/packages/core/client/src/modules/actions/add-new/addNewActionSettings.tsx @@ -1,4 +1,5 @@ import { useMemo } from 'react'; + import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; diff --git a/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx b/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx index 106e24f19..aa389c0de 100644 --- a/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/add-record/CustomizeAddRecordActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useSchemaInitializerItem } from '../../../application'; import { BlockInitializer } from '../../../schema-initializer/items/BlockInitializer'; diff --git a/packages/core/client/src/modules/actions/bulk-destroy/BulkDestroyActionInitializer.tsx b/packages/core/client/src/modules/actions/bulk-destroy/BulkDestroyActionInitializer.tsx index 372cc5bee..7146a2264 100644 --- a/packages/core/client/src/modules/actions/bulk-destroy/BulkDestroyActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/bulk-destroy/BulkDestroyActionInitializer.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { useCollection_deprecated } from '../../../collection-manager'; +import { useCollection_deprecated } from '../../../collection-manager'; import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; export const BulkDestroyActionInitializer = (props) => { diff --git a/packages/core/client/src/modules/actions/disassociate/__e2e__/disassociate.test.ts b/packages/core/client/src/modules/actions/disassociate/__e2e__/disassociate.test.ts index 72fd08105..a828848b8 100644 --- a/packages/core/client/src/modules/actions/disassociate/__e2e__/disassociate.test.ts +++ b/packages/core/client/src/modules/actions/disassociate/__e2e__/disassociate.test.ts @@ -1,4 +1,5 @@ -import { test, expect } from '@tachybase/test/e2e'; +import { expect, test } from '@tachybase/test/e2e'; + import { disassociatePage } from './templatesOfPage'; test('basic', async ({ page, mockPage, mockRecord }) => { diff --git a/packages/core/client/src/modules/actions/expand-collapse/ExpandableActionInitializer.tsx b/packages/core/client/src/modules/actions/expand-collapse/ExpandableActionInitializer.tsx index cf1fcfd81..3e18427d6 100644 --- a/packages/core/client/src/modules/actions/expand-collapse/ExpandableActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/expand-collapse/ExpandableActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; export const ExpandableActionInitializer = (props) => { diff --git a/packages/core/client/src/modules/actions/expand-collapse/expendableActionSettings.tsx b/packages/core/client/src/modules/actions/expand-collapse/expendableActionSettings.tsx index 0f4a9251e..5d36d7803 100644 --- a/packages/core/client/src/modules/actions/expand-collapse/expendableActionSettings.tsx +++ b/packages/core/client/src/modules/actions/expand-collapse/expendableActionSettings.tsx @@ -1,6 +1,8 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useDesignable } from '../../..'; import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; diff --git a/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx b/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx index f972c14d6..3f040fb02 100644 --- a/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx +++ b/packages/core/client/src/modules/actions/filter/filterActionSettings.tsx @@ -1,5 +1,7 @@ import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { FilterableFieldsSchemaSettingsItem } from '../../../schema-component/antd/filter/Filter.Action.Designer'; import { useDesignable } from '../../../schema-component/hooks'; diff --git a/packages/core/client/src/modules/actions/refresh/RefreshActionInitializer.tsx b/packages/core/client/src/modules/actions/refresh/RefreshActionInitializer.tsx index 308313a05..cef5493f8 100644 --- a/packages/core/client/src/modules/actions/refresh/RefreshActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/refresh/RefreshActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; export const RefreshActionInitializer = (props) => { diff --git a/packages/core/client/src/modules/actions/save-record/SaveRecordActionInitializer.tsx b/packages/core/client/src/modules/actions/save-record/SaveRecordActionInitializer.tsx index 561016b07..d4beb90e9 100644 --- a/packages/core/client/src/modules/actions/save-record/SaveRecordActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/save-record/SaveRecordActionInitializer.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { BlockInitializer } from '../../../schema-initializer/items'; + import { useSchemaInitializerItem } from '../../../application'; +import { BlockInitializer } from '../../../schema-initializer/items'; export const SaveRecordActionInitializer = () => { const schema = { diff --git a/packages/core/client/src/modules/actions/save-record/customizeSaveRecordActionSettings.tsx b/packages/core/client/src/modules/actions/save-record/customizeSaveRecordActionSettings.tsx index 34fa56b7c..6137eeaae 100644 --- a/packages/core/client/src/modules/actions/save-record/customizeSaveRecordActionSettings.tsx +++ b/packages/core/client/src/modules/actions/save-record/customizeSaveRecordActionSettings.tsx @@ -1,5 +1,5 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; +import { isValid, useFieldSchema } from '@tachybase/schema'; + import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { diff --git a/packages/core/client/src/modules/actions/submit/CreateSubmitActionInitializer.tsx b/packages/core/client/src/modules/actions/submit/CreateSubmitActionInitializer.tsx index e06d23e12..9dc59652a 100644 --- a/packages/core/client/src/modules/actions/submit/CreateSubmitActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/submit/CreateSubmitActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { ActionInitializer } from '../../../schema-initializer/items/ActionInitializer'; export const CreateSubmitActionInitializer = (props) => { diff --git a/packages/core/client/src/modules/actions/submit/createSubmitActionSettings.tsx b/packages/core/client/src/modules/actions/submit/createSubmitActionSettings.tsx index 0e3a530c2..abd4447cd 100644 --- a/packages/core/client/src/modules/actions/submit/createSubmitActionSettings.tsx +++ b/packages/core/client/src/modules/actions/submit/createSubmitActionSettings.tsx @@ -1,19 +1,20 @@ -import { useFieldSchema, useField, connect, mapProps, ISchema } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; import React, { useEffect, useState } from 'react'; +import { connect, ISchema, isValid, mapProps, useField, useFieldSchema } from '@tachybase/schema'; + import { Tree as AntdTree } from 'antd'; +import { useTranslation } from 'react-i18next'; + import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; +import { useCollection_deprecated } from '../../../collection-manager'; +import { useDesignable } from '../../../schema-component'; import { ButtonEditor, RemoveButton, SecondConFirm, WorkflowConfig, } from '../../../schema-component/antd/action/Action.Designer'; -import { useTranslation } from 'react-i18next'; -import { useDesignable } from '../../../schema-component'; import { useCollectionState } from '../../../schema-settings/DataTemplates/hooks/useCollectionState'; -import { useCollection_deprecated } from '../../../collection-manager'; import { SchemaSettingsModalItem } from '../../../schema-settings/SchemaSettings'; const Tree = connect( diff --git a/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx b/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx index 3694f27c1..056ef6580 100644 --- a/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx +++ b/packages/core/client/src/modules/actions/submit/updateSubmitActionSettings.tsx @@ -1,5 +1,5 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; +import { isValid, useFieldSchema } from '@tachybase/schema'; + import { isInitializersSame, useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { diff --git a/packages/core/client/src/modules/actions/update-record/UpdateRecordActionInitializer.tsx b/packages/core/client/src/modules/actions/update-record/UpdateRecordActionInitializer.tsx index 3671e390d..79fb8dc83 100644 --- a/packages/core/client/src/modules/actions/update-record/UpdateRecordActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/update-record/UpdateRecordActionInitializer.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { BlockInitializer } from '../../../schema-initializer/items'; + import { useSchemaInitializerItem } from '../../../application'; +import { BlockInitializer } from '../../../schema-initializer/items'; export const UpdateRecordActionInitializer = (props) => { const schema = { diff --git a/packages/core/client/src/modules/actions/update-record/customizeUpdateRecordActionSettings.tsx b/packages/core/client/src/modules/actions/update-record/customizeUpdateRecordActionSettings.tsx index cc68cb8a4..60d12b7c3 100644 --- a/packages/core/client/src/modules/actions/update-record/customizeUpdateRecordActionSettings.tsx +++ b/packages/core/client/src/modules/actions/update-record/customizeUpdateRecordActionSettings.tsx @@ -1,5 +1,5 @@ -import { isValid } from '@tachybase/schema'; -import { useFieldSchema } from '@tachybase/schema'; +import { isValid, useFieldSchema } from '@tachybase/schema'; + import { useSchemaToolbar } from '../../../application'; import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; import { useCollection_deprecated } from '../../../collection-manager'; diff --git a/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx b/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx index 06ae9a4ff..313a04397 100644 --- a/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx +++ b/packages/core/client/src/modules/actions/view-edit-popup/PopupActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useSchemaInitializerItem } from '../../../application'; import { BlockInitializer } from '../../../schema-initializer/items'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx index b275206e8..5737ca772 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/DetailsBlockInitializer.tsx @@ -1,9 +1,11 @@ -import { TableOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; + +import { TableOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useCollectionManager } from '../../../../data-source'; -import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; +import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { createDetailsWithPaginationUISchema } from './createDetailsWithPaginationUISchema'; export const DetailsBlockInitializer = ({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema.ts b/packages/core/client/src/modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema.ts index 350a00bba..a5f84527f 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema.ts @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; export function createDetailsWithPaginationUISchema(options: { dataSource: string; diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.tsx index 40426c7dc..a2776ab5f 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.tsx @@ -1,7 +1,10 @@ import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { SchemaSettingsItemType } from '../../../../application/schema-settings/types'; import { useFormBlockContext } from '../../../../block-provider'; import { useDetailsBlockContext } from '../../../../block-provider/DetailsBlockProvider'; import { useCollection_deprecated, useSortFields } from '../../../../collection-manager'; @@ -9,7 +12,6 @@ import { removeNullCondition, useDesignable } from '../../../../schema-component import { SchemaSettingsBlockTitleItem, SchemaSettingsTemplate } from '../../../../schema-settings'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; import { setDataLoadingModeSettingsItem, useDataLoadingMode } from './setDataLoadingModeSettingsItem'; -import { SchemaSettingsItemType } from '../../../../application/schema-settings/types'; const commonItems: SchemaSettingsItemType[] = [ { diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx index 84b40cd67..d0e2fee63 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.tsx @@ -1,11 +1,13 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; -import { useDesignable } from '../../../../schema-component'; -import { SchemaSettingsModalItem, useCollectionState } from '../../../../schema-settings'; + import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated'; import { useDataBlockProps, useDataBlockRequest } from '../../../../data-source'; +import { useDesignable } from '../../../../schema-component'; +import { SchemaSettingsModalItem, useCollectionState } from '../../../../schema-settings'; export const setDataLoadingModeSettingsItem = { name: 'setDataLoadingMode', diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx index 6e87749ba..85dcd5a4e 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/ReadPrettyFormItemInitializers.tsx @@ -1,6 +1,9 @@ import React from 'react'; + import { useTranslation } from 'react-i18next'; + import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; +import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; import { useCompile } from '../../../../schema-component'; import { gridRowColWrap, @@ -8,7 +11,6 @@ import { useFormItemInitializerFields, useInheritsFormItemInitializerFields, } from '../../../../schema-initializer/utils'; -import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; const ParentCollectionFields = () => { const inheritFields = useInheritsFormItemInitializerFields(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx index c88a1518c..c2aca7aab 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer.tsx @@ -1,5 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; + +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useBlockAssociationContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts index f3e425526..97f07ec76 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/__e2e__/schemaInitializer.test.ts @@ -1,4 +1,4 @@ -import { Page, expect, expectSettingsMenu, oneEmptyTableBlockWithActions, test } from '@tachybase/test/e2e'; +import { expect, expectSettingsMenu, oneEmptyTableBlockWithActions, Page, test } from '@tachybase/test/e2e'; test.describe('where single data details block can be added', () => { test('popup', async ({ page, mockPage, mockRecord }) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/createDetailsUISchema.ts b/packages/core/client/src/modules/blocks/data-blocks/details-single/createDetailsUISchema.ts index 160ccb2e6..771af5748 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/createDetailsUISchema.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/createDetailsUISchema.ts @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; export function createDetailsUISchema(options: { dataSource: string; diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/detailsBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/details-single/detailsBlockSettings.ts index 7f644e8e8..c90675c6c 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/detailsBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/detailsBlockSettings.ts @@ -1,8 +1,9 @@ import { useFieldSchema } from '@tachybase/schema'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { SchemaSettingsItemType } from '../../../../application/schema-settings/types'; import { useCollection_deprecated } from '../../../../collection-manager'; import { SchemaSettingsBlockTitleItem, SchemaSettingsFormItemTemplate } from '../../../../schema-settings'; -import { SchemaSettingsItemType } from '../../../../application/schema-settings/types'; const commonItems: SchemaSettingsItemType[] = [ { diff --git a/packages/core/client/src/modules/blocks/data-blocks/details-single/hooks/useDetailsDecoratorProps.ts b/packages/core/client/src/modules/blocks/data-blocks/details-single/hooks/useDetailsDecoratorProps.ts index 597f946dd..463c59a9b 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/details-single/hooks/useDetailsDecoratorProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/details-single/hooks/useDetailsDecoratorProps.ts @@ -1,4 +1,5 @@ import { useFieldSchema } from '@tachybase/schema'; + import { useParamsFromRecord } from '../../../../../block-provider/BlockProvider'; import { useCollectionParentRecordData, diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx index d5728269c..465019a19 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/CreateFormBlockInitializer.tsx @@ -1,6 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React from 'react'; +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useBlockAssociationContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx index f3f5caf86..99682128e 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/FormBlockInitializer.tsx @@ -1,5 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; + +import { FormOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/FormItemSchemaToolbar.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/FormItemSchemaToolbar.tsx index fdaa2dbfc..89e8a8332 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/FormItemSchemaToolbar.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/FormItemSchemaToolbar.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { SchemaToolbar } from '../../../../schema-settings'; export const FormItemSchemaToolbar = (props) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx index 95633faef..fe4f54688 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/RecordFormBlockInitializer.tsx @@ -1,5 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; + +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useBlockAssociationContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaSettings.test.ts index 9ffc891d4..d7cb5e5ad 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__e2e__/form-edit/schemaSettings.test.ts @@ -1,9 +1,9 @@ import { - Page, expect, expectSettingsMenu, oneEmptyFormWithActions, oneTableBlockWithActionsAndFormBlocks, + Page, test, } from '@tachybase/test/e2e'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.ts index e1daebb3b..733dc176d 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.ts @@ -1,4 +1,4 @@ -import { CreateFormBlockUISchemaOptions, createCreateFormBlockUISchema } from '../createCreateFormBlockUISchema'; +import { createCreateFormBlockUISchema, CreateFormBlockUISchemaOptions } from '../createCreateFormBlockUISchema'; vi.mock('@formily/shared', () => { return { diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.ts b/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.ts index 8a2dbf420..9e89cf785 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.ts @@ -1,5 +1,7 @@ import { ISchema } from '@tachybase/schema'; + import { vi } from 'vitest'; + import { createEditFormBlockUISchema } from '../createEditFormBlockUISchema'; vi.mock('@formily/shared', () => ({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/createCreateFormBlockUISchema.ts b/packages/core/client/src/modules/blocks/data-blocks/form/createCreateFormBlockUISchema.ts index 746124a01..33b136245 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/createCreateFormBlockUISchema.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/createCreateFormBlockUISchema.ts @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; export interface CreateFormBlockUISchemaOptions { dataSource: string; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/createFormBlockSettings.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/createFormBlockSettings.tsx index 17180e55b..0906337cf 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/createFormBlockSettings.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/createFormBlockSettings.tsx @@ -1,4 +1,5 @@ import { useFieldSchema } from '@tachybase/schema'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/editFormBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/form/editFormBlockSettings.ts index 57f631c36..0ae8b9eaa 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/editFormBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/editFormBlockSettings.ts @@ -1,4 +1,5 @@ import { useFieldSchema } from '@tachybase/schema'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; import { useCollection_deprecated } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx index 633ab1db0..c6e4ce3d4 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/form/formItemInitializers.tsx @@ -1,6 +1,6 @@ -import { gridRowColWrap, useFormItemInitializerFields } from '../../../../schema-initializer/utils'; -import { ParentCollectionFields, AssociatedFields } from '../../../../schema-initializer/buttons/FormItemInitializers'; import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; +import { AssociatedFields, ParentCollectionFields } from '../../../../schema-initializer/buttons/FormItemInitializers'; +import { gridRowColWrap, useFormItemInitializerFields } from '../../../../schema-initializer/utils'; /** * @deprecated diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.ts b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.ts index bd007cd21..fdf1bd7d9 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.ts @@ -1,5 +1,6 @@ import { useParamsFromRecord } from '../../../../../block-provider/BlockProvider'; import { useDetailsParentRecord } from '../../details-single/hooks/useDetailsDecoratorProps'; + export function useEditFormBlockDecoratorProps(props) { const params = useFormBlockParams(); let parentRecord; diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx index 6bfaa329c..a76e4de60 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/GridCardBlockInitializer.tsx @@ -1,9 +1,11 @@ -import { OrderedListOutlined } from '@ant-design/icons'; import React from 'react'; + +import { OrderedListOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useCollectionManager_deprecated } from '../../../../collection-manager'; -import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; +import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { createGridCardBlockUISchema } from './createGridCardBlockUISchema'; export const GridCardBlockInitializer = ({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockDecoratorProps.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockDecoratorProps.ts index 41b217753..e2fc62dab 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockDecoratorProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockDecoratorProps.ts @@ -1,5 +1,5 @@ -import { useGridCardBlockParams } from './useGridCardBlockParams'; import { useParentRecordCommon } from '../../../useParentRecordCommon'; +import { useGridCardBlockParams } from './useGridCardBlockParams'; export function useGridCardBlockDecoratorProps(props) { const params = useGridCardBlockParams(props); diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockParams.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockParams.ts index 1edcac117..c642b7220 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockParams.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/hooks/useGridCardBlockParams.ts @@ -1,6 +1,7 @@ -import { useParsedFilter } from '../../../../../block-provider/hooks/useParsedFilter'; import { useMemo } from 'react'; +import { useParsedFilter } from '../../../../../block-provider/hooks/useParsedFilter'; + export function useGridCardBlockParams(props) { const { params } = props; const { filter: parsedFilter } = useParsedFilter({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx index 8c9359397..d7f54c589 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/list/ListBlockInitializer.tsx @@ -1,9 +1,11 @@ -import { OrderedListOutlined } from '@ant-design/icons'; import React from 'react'; + +import { OrderedListOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useCollectionManager_deprecated } from '../../../../collection-manager'; -import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; +import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { createListBlockUISchema } from './createListBlockUISchema'; export const ListBlockInitializer = ({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts index bd9ada954..699ad25dc 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/list/listBlockSettings.ts @@ -1,7 +1,9 @@ import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; import { useCollection_deprecated, useSortFields } from '../../../../collection-manager'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/TableSelectorInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/table-selector/TableSelectorInitializer.tsx index 908a2894a..d882ccc93 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/TableSelectorInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/TableSelectorInitializer.tsx @@ -1,9 +1,10 @@ -import { FormOutlined } from '@ant-design/icons'; import React from 'react'; +import { FormOutlined } from '@ant-design/icons'; + +import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; import { useCollection_deprecated } from '../../../../collection-manager'; import { createTableSelectorUISchema } from './createTableSelectorUISchema'; -import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; export const TableSelectorInitializer = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts index 4f46545b6..0cfb978ad 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaInitializer.test.ts @@ -1,4 +1,5 @@ -import { Page, expect, test } from '@tachybase/test/e2e'; +import { expect, Page, test } from '@tachybase/test/e2e'; + import { createTable } from './utils'; test.describe('where table data selector can be added', () => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaSettings.test.ts index 0cacab0e0..9e6c1870e 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/schemaSettings.test.ts @@ -1,6 +1,7 @@ -import { expectSettingsMenu, test, expect } from '@tachybase/test/e2e'; -import { createTable } from './utils'; +import { expect, expectSettingsMenu, test } from '@tachybase/test/e2e'; + import { tableSelectorDataScopeVariable } from './templatesOfBug'; +import { createTable } from './utils'; test.describe('table data selector schema settings', () => { test('supported options', async ({ page, mockPage }) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts index 933df8e4a..aaacdcc09 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/__e2e__/utils.ts @@ -1,4 +1,4 @@ -import { NocoPage, Page, PageConfig, oneFormBlockWithAllAssociationFieldsAndSelectorMode } from '@tachybase/test/e2e'; +import { NocoPage, oneFormBlockWithAllAssociationFieldsAndSelectorMode, Page, PageConfig } from '@tachybase/test/e2e'; export async function createTable({ page, diff --git a/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts b/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts index 3deca86e0..d283c18f2 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.ts @@ -1,8 +1,10 @@ +import { useCallback } from 'react'; import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { cloneDeep } from 'lodash'; -import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { recursiveParent, useFormBlockContext, useTableSelectorContext } from '../../../../block-provider'; import { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx index 4efb200f3..801d55c00 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionColumnInitializers.tsx @@ -1,8 +1,10 @@ -import { MenuOutlined } from '@ant-design/icons'; -import { ISchema, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +import { ISchema, useFieldSchema } from '@tachybase/schema'; + +import { MenuOutlined } from '@ant-design/icons'; +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useAPIClient } from '../../../../api-client'; import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { SchemaInitializerActionModal } from '../../../../application/schema-initializer/components/SchemaInitializerActionModal'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx index babf80bc6..c618ae813 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableActionInitializers.tsx @@ -1,4 +1,5 @@ import { useFieldSchema } from '@tachybase/schema'; + import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCollection_deprecated } from '../../../../collection-manager/hooks/useCollection_deprecated'; diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx index 492a80004..f862226bd 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableBlockInitializer.tsx @@ -1,9 +1,11 @@ +import React from 'react'; + import { TableOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application/schema-initializer/context'; import { useCollectionManager_deprecated } from '../../../../collection-manager/hooks/useCollectionManager_deprecated'; -import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; -import React from 'react'; import { Collection, CollectionFieldOptions } from '../../../../data-source/collection/Collection'; +import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { createTableBlockUISchema } from './createTableBlockUISchema'; export const TableBlockInitializer = ({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx index 51a9e6467..93dcf26a1 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnInitializers.tsx @@ -1,14 +1,16 @@ -import { useFieldSchema } from '@tachybase/schema'; import React, { useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + +import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; +import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; import { useCompile } from '../../../../schema-component'; import { useAssociatedTableColumnInitializerFields, useInheritsTableColumnInitializerFields, useTableColumnInitializerFields, } from '../../../../schema-initializer/utils'; -import { SchemaInitializerChildren } from '../../../../application/schema-initializer/components/SchemaInitializerChildren'; -import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; // 表格列配置 const ParentCollectionFields = () => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnSchemaToolbar.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnSchemaToolbar.tsx index 39365850e..ee4f5a9ac 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnSchemaToolbar.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/TableColumnSchemaToolbar.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { SchemaToolbar } from '../../../../schema-settings'; export const TableColumnSchemaToolbar = (props) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts index 58d1108a9..baaad5bfd 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts @@ -1,4 +1,5 @@ import { createBlockInPage, expect, oneEmptyTable, test } from '@tachybase/test/e2e'; + import { T3686 } from './templatesOfBug'; test.describe('where table block can be added', () => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts index fe4952921..c8a00ec4a 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts @@ -1,11 +1,11 @@ import { - Page, expect, expectSettingsMenu, oneEmptyTableBlockWithActions, oneEmptyTableWithTreeCollection, oneTableBlockWithActionsAndFormBlocks, oneTableBlockWithAddNewAndViewAndEditAndBasicFields, + Page, test, twoTableWithAssociationFields, twoTableWithSameCollection, diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/tree/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/tree/schemaSettings.test.ts index de4251550..03b86b4f7 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/tree/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/tree/schemaSettings.test.ts @@ -1,4 +1,4 @@ -import { Page, expect, expectSettingsMenu, oneEmptyTableWithTreeCollection, test } from '@tachybase/test/e2e'; +import { expect, expectSettingsMenu, oneEmptyTableWithTreeCollection, Page, test } from '@tachybase/test/e2e'; test.describe('tree table block schema settings', () => { test('supported options', async ({ page, mockPage }) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockDecoratorProps.ts b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockDecoratorProps.ts index c4d692889..e4cae428f 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockDecoratorProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockDecoratorProps.ts @@ -1,6 +1,7 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { useParsedFilter } from '../../../../../block-provider/hooks/useParsedFilter'; import { useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + +import { useParsedFilter } from '../../../../../block-provider/hooks/useParsedFilter'; import { useParentRecordCommon } from '../../../useParentRecordCommon'; export const useTableBlockDecoratorProps = (props) => { diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx index 864014257..9f45ad658 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/tableBlockSettings.tsx @@ -1,26 +1,27 @@ -import { ISchema } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { useCallback } from 'react'; +import { ArrayItems } from '@tachybase/components'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import { useTranslation } from 'react-i18next'; + import { useAPIClient } from '../../../../api-client'; -import { useTableBlockContext, useFormBlockContext } from '../../../../block-provider'; +import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { useFormBlockContext, useTableBlockContext } from '../../../../block-provider'; import { - useCollectionManager_deprecated, useCollection_deprecated, + useCollectionManager_deprecated, useSortFields, } from '../../../../collection-manager'; -import { mergeFilter, FilterBlockType } from '../../../../filter-provider'; -import { useDesignable, removeNullCondition } from '../../../../schema-component'; +import { FilterBlockType, mergeFilter } from '../../../../filter-provider'; +import { removeNullCondition, useDesignable } from '../../../../schema-component'; +import { FixedBlockDesignerItem } from '../../../../schema-component/antd/page/FixedBlockDesignerItem'; import { SchemaSettingsBlockTitleItem, - SchemaSettingsSortField, - SchemaSettingsDataScope, SchemaSettingsConnectDataBlocks, + SchemaSettingsDataScope, + SchemaSettingsSortField, SchemaSettingsTemplate, } from '../../../../schema-settings'; -import { useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; -import { ArrayItems } from '@tachybase/components'; -import { FixedBlockDesignerItem } from '../../../../schema-component/antd/page/FixedBlockDesignerItem'; -import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { setDataLoadingModeSettingsItem, useDataLoadingMode } from '../details-multi/setDataLoadingModeSettingsItem'; export const tableBlockSettings = new SchemaSettings({ diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/utils.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/utils.tsx index d3d1edf44..aed44b8b4 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/utils.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/utils.tsx @@ -1,5 +1,5 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useIsFileField } from '../../../../schema-component'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/CollapseItemSchemaToolbar.tsx b/packages/core/client/src/modules/blocks/filter-blocks/collapse/CollapseItemSchemaToolbar.tsx index 17d7bbab3..447854d26 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/CollapseItemSchemaToolbar.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/CollapseItemSchemaToolbar.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { SchemaToolbar } from '../../../../schema-settings'; export const CollapseItemSchemaToolbar = (props) => { diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx b/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx index 28016afed..f475c8131 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/FilterCollapseBlockInitializer.tsx @@ -1,10 +1,11 @@ -import { TableOutlined } from '@ant-design/icons'; import React from 'react'; +import { TableOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; -import { createCollapseBlockSchema } from './createFilterCollapseBlockSchema'; -import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; import { Collection, CollectionFieldOptions } from '../../../../data-source'; +import { DataBlockInitializer } from '../../../../schema-initializer/items/DataBlockInitializer'; +import { createCollapseBlockSchema } from './createFilterCollapseBlockSchema'; export const FilterCollapseBlockInitializer = ({ filterCollections, diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/createFilterCollapseBlockSchema.ts b/packages/core/client/src/modules/blocks/filter-blocks/collapse/createFilterCollapseBlockSchema.ts index 8fc60df70..757792f18 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/createFilterCollapseBlockSchema.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/createFilterCollapseBlockSchema.ts @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; export const createCollapseBlockSchema = (options: { collectionName: string; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseBlockSettings.ts b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseBlockSettings.ts index b864326e7..8118fd148 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseBlockSettings.ts @@ -1,5 +1,7 @@ import { useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useCollection_deprecated } from '../../../../collection-manager'; import { FilterBlockType } from '../../../../filter-provider'; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts index ed7558a0e..763779d74 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.ts @@ -1,9 +1,11 @@ import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../../collection-manager'; import { useCompile, useDesignable } from '../../../../schema-component'; import { SchemaSettingsDefaultSortingRules } from '../../../../schema-settings'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx index 3263e610e..8b59bcf14 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/FilterFormBlockInitializer.tsx @@ -1,9 +1,11 @@ -import { FormOutlined } from '@ant-design/icons'; import React from 'react'; + +import { FormOutlined } from '@ant-design/icons'; + import { useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; -import { createFilterFormBlockSchema } from './createFilterFormBlockSchema'; -import { FilterBlockInitializer } from '../../../../schema-initializer/items/FilterBlockInitializer'; import { Collection, CollectionFieldOptions } from '../../../../data-source'; +import { FilterBlockInitializer } from '../../../../schema-initializer/items/FilterBlockInitializer'; +import { createFilterFormBlockSchema } from './createFilterFormBlockSchema'; export const FilterFormBlockInitializer = ({ filterCollections, diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/createFilterFormBlockSchema.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/createFilterFormBlockSchema.ts index f5b7e7ba4..4c190f34f 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/createFilterFormBlockSchema.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/createFilterFormBlockSchema.ts @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, uid } from '@tachybase/schema'; export const createFilterFormBlockSchema = (options: { collectionName: string; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormBlockSettings.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormBlockSettings.ts index 5bf47f8b3..218231541 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormBlockSettings.ts @@ -1,5 +1,7 @@ import { useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useCollection_deprecated } from '../../../../collection-manager'; import { FilterBlockType } from '../../../../filter-provider'; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.ts b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.ts index e8c0cb761..6a6cff4db 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.ts +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.ts @@ -1,11 +1,12 @@ import { ArrayCollapse, FormLayout } from '@tachybase/components'; -import { Field } from '@tachybase/schema'; -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; +import { Field, ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useApp } from '../../../../application'; import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../../collection-manager'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; import { EditOperator, useDesignable, useValidateSchema } from '../../../../schema-component'; diff --git a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx index 02ae03aa8..912c4fa8c 100644 --- a/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx +++ b/packages/core/client/src/modules/blocks/filter-blocks/form/filterFormItemInitializers.tsx @@ -1,9 +1,9 @@ -import { gridRowColWrap, useFilterFormItemInitializerFields } from '../../../../schema-initializer/utils'; -import { - FilterParentCollectionFields, - FilterAssociatedFields, -} from '../../../../schema-initializer/buttons/FormItemInitializers'; import { CompatibleSchemaInitializer } from '../../../../application/schema-initializer/CompatibleSchemaInitializer'; +import { + FilterAssociatedFields, + FilterParentCollectionFields, +} from '../../../../schema-initializer/buttons/FormItemInitializers'; +import { gridRowColWrap, useFilterFormItemInitializerFields } from '../../../../schema-initializer/utils'; /** * @deprecated diff --git a/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownBlockInitializer.tsx b/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownBlockInitializer.tsx index 4a56295e8..44cb0df03 100644 --- a/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownBlockInitializer.tsx +++ b/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownBlockInitializer.tsx @@ -1,5 +1,6 @@ -import { FormOutlined } from '@ant-design/icons'; import React from 'react'; + +import { FormOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; diff --git a/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer.tsx b/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer.tsx index 7bea997b3..ad88dee70 100644 --- a/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer.tsx +++ b/packages/core/client/src/modules/blocks/other-blocks/markdown/MarkdownFormItemInitializer.tsx @@ -1,5 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React from 'react'; + +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../../../application'; export const MarkdownFormItemInitializer = () => { diff --git a/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts b/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts index b69ad3f76..0428b31dc 100644 --- a/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts @@ -1,5 +1,7 @@ import { useField } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; export const markdownBlockSettings = new SchemaSettings({ diff --git a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts index dfd79b9d3..8bab53377 100644 --- a/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/dialog/__e2e__/schemaInitializer.test.ts @@ -6,7 +6,8 @@ import { oneFormBlockWithRolesFieldBasedUsers, test, } from '@tachybase/test/e2e'; -import { tableWithRoles, tableWithUsers, tableWithInherit, tableWithInheritWithoutAssociation } from './templatesOfBug'; + +import { tableWithInherit, tableWithInheritWithoutAssociation, tableWithRoles, tableWithUsers } from './templatesOfBug'; test.describe('where to open a popup and what can be added to it', () => { test('add new', async ({ page, mockPage }) => { diff --git a/packages/core/client/src/modules/dialog/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/dialog/__e2e__/schemaSettings.test.ts index 3c1660b44..37a615426 100644 --- a/packages/core/client/src/modules/dialog/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/dialog/__e2e__/schemaSettings.test.ts @@ -1,4 +1,4 @@ -import { NocoPage, Page, expect, oneEmptyTableBlockWithActions, test } from '@tachybase/test/e2e'; +import { expect, NocoPage, oneEmptyTableBlockWithActions, Page, test } from '@tachybase/test/e2e'; test.describe('tabs schema settings', () => { let commonPage: NocoPage; diff --git a/packages/core/client/src/modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings.tsx index 4d34ccb34..c0e7c06ab 100644 --- a/packages/core/client/src/modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings.tsx @@ -1,12 +1,13 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { useTitleFieldOptions } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { useCollectionField } from '../../../../data-source'; const fieldComponent: any = { name: 'fieldComponent', diff --git a/packages/core/client/src/modules/fields/component/Cascader/cascaderComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Cascader/cascaderComponentFieldSettings.tsx index cccd3154e..b735ed8d4 100644 --- a/packages/core/client/src/modules/fields/component/Cascader/cascaderComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Cascader/cascaderComponentFieldSettings.tsx @@ -1,16 +1,20 @@ -import { Field } from '@tachybase/schema'; -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +// import { useCollectionField } from '../utils'; +import { ArrayItems } from '@tachybase/components'; +import { Field, ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; import { - useCollectionManager_deprecated, useCollection_deprecated, + useCollectionManager_deprecated, useSortFields, } from '../../../../collection-manager'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useRecord } from '../../../../record-provider'; import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; @@ -23,16 +27,13 @@ import { } from '../../../../schema-component/antd/form-item/FormItem.Settings'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; import { + getShouldChange, SchemaSettingsModalItem, SchemaSettingsSwitchItem, VariableInput, - getShouldChange, } from '../../../../schema-settings'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; import { useLocalVariables, useVariables } from '../../../../variables'; -// import { useCollectionField } from '../utils'; -import { ArrayItems } from '@tachybase/components'; -import { useCollectionField } from '../../../../data-source'; export const SchemaSettingsSortingRule = function SortRuleConfigure(props) { const field = useField(); diff --git a/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/schemaSettings.test.ts index 27f12cd47..d45f29bd6 100644 --- a/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/fields/component/DatePicker/__e2e__/schemaSettings.test.ts @@ -1,6 +1,8 @@ import { expect, expectSettingsMenu, test } from '@tachybase/test/e2e'; + import dayjs from 'dayjs'; -import { oneTableBlockWithDatetimeFields, oneFormBlockWithDatetimeFields } from './utils'; + +import { oneFormBlockWithDatetimeFields, oneTableBlockWithDatetimeFields } from './utils'; test('Date display format in form', async ({ page, mockPage }) => { await mockPage(oneFormBlockWithDatetimeFields).goto(); diff --git a/packages/core/client/src/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.tsx index a32025a57..eb89701dd 100644 --- a/packages/core/client/src/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.tsx @@ -1,12 +1,13 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { useCollectionField } from '../../../../data-source'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; import { titleField } from '../Picker/recordPickerComponentFieldSettings'; diff --git a/packages/core/client/src/modules/fields/component/FileManager/fileManagerComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/FileManager/fileManagerComponentFieldSettings.tsx index bdcefc076..0599145a6 100644 --- a/packages/core/client/src/modules/fields/component/FileManager/fileManagerComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/FileManager/fileManagerComponentFieldSettings.tsx @@ -1,17 +1,18 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema, useForm } from '@tachybase/schema'; +import { Field, useField, useFieldSchema, useForm } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { - useIsFieldReadPretty, useIsAssociationField, + useIsFieldReadPretty, } from '../../../../schema-component/antd/form-item/FormItem.Settings'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; -import { allowMultiple } from '../Select/selectComponentFieldSettings'; import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch'; +import { allowMultiple } from '../Select/selectComponentFieldSettings'; const fieldComponent: any = { name: 'fieldComponent', diff --git a/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx index 0d9c3ec2e..804b19c7c 100644 --- a/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.tsx @@ -1,6 +1,7 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useDesignable } from '../../../../schema-component'; import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings'; diff --git a/packages/core/client/src/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.tsx index 4bceb3e97..c9f61bd4f 100644 --- a/packages/core/client/src/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.tsx @@ -1,8 +1,10 @@ import { useField, useFieldSchema, useForm } from '@tachybase/schema'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; -import { SchemaSettingsNumberFormat } from '../../../../schema-settings/SchemaSettingsNumberFormat'; -import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings'; +import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; +import { SchemaSettingsNumberFormat } from '../../../../schema-settings/SchemaSettingsNumberFormat'; + export const inputNumberComponentFieldSettings = new SchemaSettings({ name: 'fieldSettings:component:InputNumber', items: [ diff --git a/packages/core/client/src/modules/fields/component/Nester/subformComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Nester/subformComponentFieldSettings.tsx index 9f58b2de0..498f32acb 100644 --- a/packages/core/client/src/modules/fields/component/Nester/subformComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Nester/subformComponentFieldSettings.tsx @@ -1,16 +1,17 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; +import { useFormBlockType } from '../../../../block-provider'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { useIsFieldReadPretty, useIsFormReadPretty, } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { useCollectionField } from '../../../../data-source'; -import { useFormBlockType } from '../../../../block-provider'; const allowMultiple: any = { name: 'allowMultiple', diff --git a/packages/core/client/src/modules/fields/component/Picker/recordPickerComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Picker/recordPickerComponentFieldSettings.tsx index 5794c49e7..391eaa426 100644 --- a/packages/core/client/src/modules/fields/component/Picker/recordPickerComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Picker/recordPickerComponentFieldSettings.tsx @@ -1,8 +1,10 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { @@ -10,7 +12,6 @@ import { useTitleFieldOptions, } from '../../../../schema-component/antd/form-item/FormItem.Settings'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; -import { useCollectionField } from '../../../../data-source'; export const titleField: any = { name: 'titleField', diff --git a/packages/core/client/src/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.tsx index 4c4fb9398..a0d961ac8 100644 --- a/packages/core/client/src/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.tsx @@ -1,12 +1,13 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { useCollectionField } from '../../../../data-source'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; import { titleField } from '../Picker/recordPickerComponentFieldSettings'; diff --git a/packages/core/client/src/modules/fields/component/Tag/tagComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Tag/tagComponentFieldSettings.tsx index 94a89be77..15b2a0bf9 100644 --- a/packages/core/client/src/modules/fields/component/Tag/tagComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Tag/tagComponentFieldSettings.tsx @@ -1,14 +1,15 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; import { useTitleFieldOptions } from '../../../../schema-component/antd/form-item/FormItem.Settings'; -import { useColorFields } from '../../../../schema-component/antd/table-v2/Table.Column.Designer'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; -import { useCollectionField } from '../../../../data-source'; +import { useColorFields } from '../../../../schema-component/antd/table-v2/Table.Column.Designer'; const enableLink = { name: 'enableLink', diff --git a/packages/core/client/src/modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings.tsx index 575987479..a497f6e2c 100644 --- a/packages/core/client/src/modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/UnixTimestamp/unixTimestampComponentFieldSettings.tsx @@ -1,7 +1,8 @@ import { useFieldSchema } from '@tachybase/schema'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; -import { SchemaSettingsDateFormat } from '../../../../schema-settings/SchemaSettingsDateFormat'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; +import { SchemaSettingsDateFormat } from '../../../../schema-settings/SchemaSettingsDateFormat'; export const unixTimestampComponentFieldSettings = new SchemaSettings({ name: 'fieldSettings:component:UnixTimestamp', diff --git a/packages/core/client/src/modules/fields/initializer/CollectionFieldInitializer.tsx b/packages/core/client/src/modules/fields/initializer/CollectionFieldInitializer.tsx index 8f3736fb6..a48965f6e 100644 --- a/packages/core/client/src/modules/fields/initializer/CollectionFieldInitializer.tsx +++ b/packages/core/client/src/modules/fields/initializer/CollectionFieldInitializer.tsx @@ -1,8 +1,8 @@ -import { ISchema } from '@tachybase/schema'; import React from 'react'; +import { ISchema } from '@tachybase/schema'; -import { InitializerWithSwitch } from '../../../schema-initializer/items/InitializerWithSwitch'; import { useSchemaInitializerItem } from '../../../application'; +import { InitializerWithSwitch } from '../../../schema-initializer/items/InitializerWithSwitch'; export const CollectionFieldInitializer = () => { const schema: ISchema = {}; diff --git a/packages/core/client/src/modules/fields/initializer/TableCollectionFieldInitializer.tsx b/packages/core/client/src/modules/fields/initializer/TableCollectionFieldInitializer.tsx index ea68cadb0..a02fc3b94 100644 --- a/packages/core/client/src/modules/fields/initializer/TableCollectionFieldInitializer.tsx +++ b/packages/core/client/src/modules/fields/initializer/TableCollectionFieldInitializer.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { ISchema } from '@tachybase/schema'; -import { InitializerWithSwitch } from '../../../schema-initializer/items/InitializerWithSwitch'; import { useSchemaInitializerItem } from '../../../application'; +import { InitializerWithSwitch } from '../../../schema-initializer/items/InitializerWithSwitch'; export const TableCollectionFieldInitializer = () => { const schema: ISchema = {}; diff --git a/packages/core/client/src/modules/menu/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/menu/__e2e__/schemaSettings.test.ts index ded6f5001..2d2182453 100644 --- a/packages/core/client/src/modules/menu/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/menu/__e2e__/schemaSettings.test.ts @@ -1,4 +1,4 @@ -import { Page, PageConfig, expect, expectSettingsMenu, test } from '@tachybase/test/e2e'; +import { expect, expectSettingsMenu, Page, PageConfig, test } from '@tachybase/test/e2e'; test.describe('group page menus schema settings', () => { test('edit', async ({ page, mockPage }) => { diff --git a/packages/core/client/src/modules/menu/menuItemInitializer.tsx b/packages/core/client/src/modules/menu/menuItemInitializer.tsx index d9b94ec34..d52d8d341 100644 --- a/packages/core/client/src/modules/menu/menuItemInitializer.tsx +++ b/packages/core/client/src/modules/menu/menuItemInitializer.tsx @@ -1,7 +1,7 @@ import { SchemaInitializer } from '../../application/schema-initializer/SchemaInitializer'; +import { GroupItem } from './GroupItem'; import { LinkMenuItem } from './LinkMenuItem'; import { PageMenuItem } from './PageMenuItem'; -import { GroupItem } from './GroupItem'; /** * @deprecated diff --git a/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts b/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts index 1552373cb..61a988a3c 100644 --- a/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts +++ b/packages/core/client/src/modules/page/__e2e__/blockInitializers.test.ts @@ -1,4 +1,4 @@ -import { test, expect } from '@tachybase/test/e2e'; +import { expect, test } from '@tachybase/test/e2e'; test.describe('page:addBlock', () => { test('当搜索不到数据时显示空状态', async ({ page, mockPage }) => { diff --git a/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts index 71543e800..217696a27 100644 --- a/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/page/__e2e__/schemaSettings.test.ts @@ -1,4 +1,4 @@ -import { Page, expect, test } from '@tachybase/test/e2e'; +import { expect, Page, test } from '@tachybase/test/e2e'; test.describe('page schema settings', () => { const showMenu = async (page: Page) => { diff --git a/packages/core/client/src/schema-component/antd/__builtins__/hooks/index.ts b/packages/core/client/src/schema-component/antd/__builtins__/hooks/index.ts index 6d27f143d..4d423984a 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/hooks/index.ts +++ b/packages/core/client/src/schema-component/antd/__builtins__/hooks/index.ts @@ -1,4 +1,3 @@ export * from './useConfig'; export * from './usePrefixCls'; export * from './useToken'; - diff --git a/packages/core/client/src/schema-component/antd/__builtins__/hooks/useConfig.ts b/packages/core/client/src/schema-component/antd/__builtins__/hooks/useConfig.ts index b9d05bd59..971dc2df3 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/hooks/useConfig.ts +++ b/packages/core/client/src/schema-component/antd/__builtins__/hooks/useConfig.ts @@ -1,5 +1,6 @@ -import { ConfigProvider } from 'antd'; import { useContext } from 'react'; +import { ConfigProvider } from 'antd'; + const { ConfigContext } = ConfigProvider; export const useConfig = () => useContext(ConfigContext); diff --git a/packages/core/client/src/schema-component/antd/__builtins__/hooks/usePrefixCls.ts b/packages/core/client/src/schema-component/antd/__builtins__/hooks/usePrefixCls.ts index ca782364c..2b79fe94c 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/hooks/usePrefixCls.ts +++ b/packages/core/client/src/schema-component/antd/__builtins__/hooks/usePrefixCls.ts @@ -1,6 +1,7 @@ -import { ConfigProvider } from 'antd'; import { useContext } from 'react'; +import { ConfigProvider } from 'antd'; + export const usePrefixCls = ( tag?: string, props?: { diff --git a/packages/core/client/src/schema-component/antd/__builtins__/index.ts b/packages/core/client/src/schema-component/antd/__builtins__/index.ts index 8d1d516bd..d76631860 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/index.ts +++ b/packages/core/client/src/schema-component/antd/__builtins__/index.ts @@ -2,4 +2,3 @@ export * from './hooks'; export * from './loading'; export * from './portal'; export * from './style'; - diff --git a/packages/core/client/src/schema-component/antd/__builtins__/portal.tsx b/packages/core/client/src/schema-component/antd/__builtins__/portal.tsx index fb3ea5dfb..bede6f3a0 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/portal.tsx +++ b/packages/core/client/src/schema-component/antd/__builtins__/portal.tsx @@ -1,8 +1,10 @@ -import { Observer, ReactFC } from '@tachybase/schema'; -import { observable } from '@tachybase/schema'; import React, { Fragment } from 'react'; +import { observable, Observer, ReactFC } from '@tachybase/schema'; + import { createPortal } from 'react-dom'; + import { render as reactRender, unmount as reactUnmount } from './render'; + export interface IPortalProps { id?: string | symbol; } diff --git a/packages/core/client/src/schema-component/antd/__builtins__/render.ts b/packages/core/client/src/schema-component/antd/__builtins__/render.ts index f1e04482f..0b90e8d4f 100644 --- a/packages/core/client/src/schema-component/antd/__builtins__/render.ts +++ b/packages/core/client/src/schema-component/antd/__builtins__/render.ts @@ -1,4 +1,5 @@ import { ReactElement } from 'react'; + import * as ReactDOM from 'react-dom'; import type { Root } from 'react-dom/client'; diff --git a/packages/core/client/src/schema-component/antd/action/Action.Link.tsx b/packages/core/client/src/schema-component/antd/action/Action.Link.tsx index 5f8d16170..e7e4e1c1d 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Link.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Link.tsx @@ -1,9 +1,11 @@ -import { observer } from '@tachybase/schema'; import React from 'react'; +import { observer } from '@tachybase/schema'; + import classnames from 'classnames'; + +import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; import Action from './Action'; import { ComposedAction } from './types'; -import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; export const ActionLink: ComposedAction = withDynamicSchemaProps( observer((props: any) => { diff --git a/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx b/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx index 17bbc0f23..6318a01bf 100644 --- a/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx +++ b/packages/core/client/src/schema-component/antd/action/__tests__/action.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen, userEvent, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen, userEvent, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo1.tsx index b5e33ef87..fc90877fa 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo1.tsx @@ -1,4 +1,4 @@ -import { ISchema, observer, useForm } from '@tachybase/schema'; +import React from 'react'; import { Action, Form, @@ -8,7 +8,7 @@ import { SchemaComponentProvider, useActionContext, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, observer, useForm } from '@tachybase/schema'; const useCloseAction = () => { const { setVisible } = useActionContext(); diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo2.tsx index 122ac7cf5..7ea3b0cc0 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo2.tsx @@ -1,4 +1,4 @@ -import { ISchema, observer, useForm } from '@tachybase/schema'; +import React, { useState } from 'react'; import { Action, ActionContextProvider, @@ -9,7 +9,7 @@ import { SchemaComponentProvider, useActionContext, } from '@tachybase/client'; -import React, { useState } from 'react'; +import { ISchema, observer, useForm } from '@tachybase/schema'; const useCloseAction = () => { const { setVisible } = useActionContext(); diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo3.tsx index 3341f2524..a5703cbb3 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo3.tsx @@ -1,8 +1,8 @@ -import { Field } from '@tachybase/schema'; -import { ISchema, observer, useField, useFieldSchema } from '@tachybase/schema'; -import { Action, SchemaComponent, SchemaComponentProvider, useActionContext } from '@tachybase/client'; -import { Radio } from 'antd'; import React, { useRef } from 'react'; +import { Action, SchemaComponent, SchemaComponentProvider, useActionContext } from '@tachybase/client'; +import { Field, ISchema, observer, useField, useFieldSchema } from '@tachybase/schema'; + +import { Radio } from 'antd'; import _ from 'lodash'; const useCloseAction = () => { diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo4.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo4.tsx index a54c4097e..1091efcd7 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo4.tsx @@ -1,4 +1,4 @@ -import { ISchema, observer, useForm } from '@tachybase/schema'; +import React from 'react'; import { Action, Form, @@ -8,7 +8,7 @@ import { SchemaComponentProvider, useActionContext, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, observer, useForm } from '@tachybase/schema'; const useCloseAction = () => { const { setVisible } = useActionContext(); diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo5.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo5.tsx index 9b8d4be3c..5a5cac0b9 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo5.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo5.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { ArrayTable, Editable, @@ -10,10 +11,19 @@ import { NumberPicker, Submit, } from '@tachybase/components'; -import { Field, createForm, onFieldValueChange } from '@tachybase/schema'; -import { connect, createSchemaField, observer, useField, useForm, useFormEffects } from '@tachybase/schema'; +import { + connect, + createForm, + createSchemaField, + Field, + observer, + onFieldValueChange, + useField, + useForm, + useFormEffects, +} from '@tachybase/schema'; + import { Select } from 'antd'; -import React from 'react'; const ViewOptions = connect((props) => { return
{JSON.stringify(props.value)}
; diff --git a/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx index 28366552e..91ff6f8fa 100644 --- a/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx +++ b/packages/core/client/src/schema-component/antd/action/demos/demo6.tsx @@ -1,5 +1,4 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React from 'react'; import { Action, ActionBar, @@ -10,7 +9,7 @@ import { SchemaComponentProvider, SchemaInitializer, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, uid } from '@tachybase/schema'; const addActionButton = new SchemaInitializer({ name: 'addActionButton', diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfAction.ts b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfAction.ts index db6fb6db9..bc4acd0b7 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfAction.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfAction.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useBlockContext } from '../../../../block-provider/BlockProvider'; import { useCollection_deprecated } from '../../../../collection-manager'; import { useRecord, useRecordIndex } from '../../../../record-provider'; diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfDrawer.ts b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfDrawer.ts index 051a421cb..2615f5ac3 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfDrawer.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfDrawer.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated } from '../../../../collection-manager'; import { useCompile } from '../../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfModal.ts b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfModal.ts index 15d4f9587..9ce1601be 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfModal.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfModal.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated } from '../../../../collection-manager'; import { useCompile } from '../../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfPopover.ts b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfPopover.ts index 8aa4739c5..915818ee5 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfPopover.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useGetAriaLabelOfPopover.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated } from '../../../../collection-manager'; import { useCompile } from '../../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForDrawer.ts b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForDrawer.ts index 643784fb2..21339211d 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForDrawer.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForDrawer.ts @@ -1,4 +1,5 @@ import { useEffect } from 'react'; + import { useGetAriaLabelOfDrawer } from './useGetAriaLabelOfDrawer'; export function useSetAriaLabelForDrawer(visible: boolean) { diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForModal.ts b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForModal.ts index 0fca9ea08..3d58b4a94 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForModal.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForModal.ts @@ -1,4 +1,5 @@ import { useEffect } from 'react'; + import { useGetAriaLabelOfModal } from './useGetAriaLabelOfModal'; export function useSetAriaLabelForModal(visible: boolean) { diff --git a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForPopover.ts b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForPopover.ts index 12d466881..9ad3aa1cb 100644 --- a/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForPopover.ts +++ b/packages/core/client/src/schema-component/antd/action/hooks/useSetAriaLabelForPopover.ts @@ -1,4 +1,5 @@ import { useEffect } from 'react'; + import { useGetAriaLabelOfPopover } from './useGetAriaLabelOfPopover'; export function useSetAriaLabelForPopover(visible: boolean) { diff --git a/packages/core/client/src/schema-component/antd/action/utils.ts b/packages/core/client/src/schema-component/antd/action/utils.ts index 69c2d85f0..626692eed 100644 --- a/packages/core/client/src/schema-component/antd/action/utils.ts +++ b/packages/core/client/src/schema-component/antd/action/utils.ts @@ -1,5 +1,7 @@ import type { ISchema } from '@tachybase/schema'; + import { last } from 'lodash'; + import { ActionType } from '../../../schema-settings/LinkageRules/type'; import { VariableOption, VariablesContextType } from '../../../variables/types'; import { conditionAnalyses } from '../../common/utils/uitls'; diff --git a/packages/core/client/src/schema-component/antd/association-field/AssociationFieldProvider.tsx b/packages/core/client/src/schema-component/antd/association-field/AssociationFieldProvider.tsx index 67e888071..5dea980d8 100644 --- a/packages/core/client/src/schema-component/antd/association-field/AssociationFieldProvider.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/AssociationFieldProvider.tsx @@ -1,9 +1,9 @@ -import { Field } from '@tachybase/schema'; -import { observer, useField, useFieldSchema } from '@tachybase/schema'; import React, { useEffect, useMemo, useState } from 'react'; +import { Field, observer, useField, useFieldSchema } from '@tachybase/schema'; + import { useCollectionManager_deprecated } from '../../../collection-manager'; -import { AssociationFieldContext } from './context'; import { markRecordAsNew } from '../../../data-source/collection-record/isNewRecord'; +import { AssociationFieldContext } from './context'; export const AssociationFieldProvider = observer( (props) => { diff --git a/packages/core/client/src/schema-component/antd/association-field/Editable.tsx b/packages/core/client/src/schema-component/antd/association-field/Editable.tsx index 2968077e6..2e526e9fb 100644 --- a/packages/core/client/src/schema-component/antd/association-field/Editable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/Editable.tsx @@ -1,21 +1,21 @@ -import { Field } from '@tachybase/schema'; -import { observer, useField, useForm } from '@tachybase/schema'; import React from 'react'; +import { Field, observer, useField, useForm } from '@tachybase/schema'; + import { SchemaComponentOptions } from '../../'; import { useAssociationCreateActionProps as useCAP } from '../../../block-provider/hooks'; import { useCollection_deprecated } from '../../../collection-manager'; import { AssociationFieldProvider } from './AssociationFieldProvider'; import { AssociationSelect } from './AssociationSelect'; +import { CreateRecordAction } from './components/CreateRecordAction'; import { InternalFileManager } from './FileManager'; +import { useAssociationFieldContext } from './hooks'; +import { InternalCascader } from './InternalCascader'; import { InternalCascadeSelect } from './InternalCascadeSelect'; +import { InternaDrawerSubTable } from './InternalDrawerSubTable'; import { InternalNester } from './InternalNester'; import { InternalPicker } from './InternalPicker'; import { InternaPopoverNester } from './InternalPopoverNester'; import { InternalSubTable } from './InternalSubTable'; -import { CreateRecordAction } from './components/CreateRecordAction'; -import { useAssociationFieldContext } from './hooks'; -import { InternalCascader } from './InternalCascader'; -import { InternaDrawerSubTable } from './InternalDrawerSubTable'; const EditableAssociationField = observer( (props: any) => { diff --git a/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx b/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx index 9551d93c6..5950c1d8f 100644 --- a/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/FileManager.tsx @@ -1,6 +1,8 @@ -import { RecursionField, connect, useField, useFieldSchema } from '@tachybase/schema'; -import { differenceBy, unionBy } from 'lodash'; import React, { useContext, useEffect, useState } from 'react'; +import { connect, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + +import { differenceBy, unionBy } from 'lodash'; + import { FormProvider, RecordPickerContext, @@ -21,8 +23,8 @@ import { useCompile } from '../../hooks'; import { ActionContextProvider } from '../action'; import { EllipsisWithTooltip } from '../input'; import { FileSelector, Preview } from '../preview'; -import { ReadPrettyInternalViewer } from './InternalViewer'; import { useFieldNames, useInsertSchema } from './hooks'; +import { ReadPrettyInternalViewer } from './InternalViewer'; import schema from './schema'; import { flatData, getLabelFormatValue, isShowFilePicker, useLabelUiSchema } from './util'; diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalCascadeSelect.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalCascadeSelect.tsx index 5d6c4e0ab..e5a2e2c80 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalCascadeSelect.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalCascadeSelect.tsx @@ -1,11 +1,21 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { ArrayItems, FormItem } from '@tachybase/components'; -import { createForm, onFormValuesChange } from '@tachybase/schema'; -import { FormProvider, connect, createSchemaField, observer, useField, useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { + connect, + createForm, + createSchemaField, + FormProvider, + observer, + onFormValuesChange, + uid, + useField, + useFieldSchema, +} from '@tachybase/schema'; + import { Select as AntdSelect, Input, Space, Spin, Tag } from 'antd'; import dayjs from 'dayjs'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient, useCollectionManager_deprecated } from '../../../'; import { mergeFilter } from '../../../filter-provider/utils'; import { SchemaComponent, useCompile } from '../../../schema-component'; diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalTag.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalTag.tsx index 1a2db9cf3..6894347ea 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalTag.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalTag.tsx @@ -1,6 +1,6 @@ -import { observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import React, { Fragment, useRef, useState } from 'react'; +import { observer, RecursionField, toArr, useField, useFieldSchema } from '@tachybase/schema'; + import { useDesignable } from '../../'; import { BlockAssociationContext, WithoutTableFieldResource } from '../../../block-provider'; import { CollectionProvider_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; @@ -10,10 +10,10 @@ import { useCompile } from '../../hooks'; import { ActionContextProvider, useActionContext } from '../action'; import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip'; import { useAssociationFieldContext, useFieldNames, useInsertSchema } from './hooks'; -import schema from './schema'; -import { getTabFormatValue, useLabelUiSchema } from './util'; import { transformNestedData } from './InternalCascadeSelect'; import { isObject } from './InternalViewer'; +import schema from './schema'; +import { getTabFormatValue, useLabelUiSchema } from './util'; interface IEllipsisWithTooltipRef { setPopoverVisible: (boolean) => void; diff --git a/packages/core/client/src/schema-component/antd/association-field/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/association-field/ReadPretty.tsx index ee097aa16..32b27c9fa 100644 --- a/packages/core/client/src/schema-component/antd/association-field/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/ReadPretty.tsx @@ -1,5 +1,6 @@ -import { observer } from '@tachybase/schema'; import React from 'react'; +import { observer } from '@tachybase/schema'; + import { AssociationFieldProvider } from './AssociationFieldProvider'; import { FileManageReadPretty } from './FileManager'; import { useAssociationFieldContext } from './hooks'; diff --git a/packages/core/client/src/schema-component/antd/association-field/context.ts b/packages/core/client/src/schema-component/antd/association-field/context.ts index 30695cbcb..edd778e5f 100644 --- a/packages/core/client/src/schema-component/antd/association-field/context.ts +++ b/packages/core/client/src/schema-component/antd/association-field/context.ts @@ -1,5 +1,5 @@ -import { GeneralField } from '@tachybase/schema'; import { createContext } from 'react'; +import { GeneralField } from '@tachybase/schema'; export interface AssociationFieldContextProps { options?: any; diff --git a/packages/core/client/src/schema-component/antd/association-field/hooks.ts b/packages/core/client/src/schema-component/antd/association-field/hooks.ts index ad3d74aad..a1a19c9b0 100644 --- a/packages/core/client/src/schema-component/antd/association-field/hooks.ts +++ b/packages/core/client/src/schema-component/antd/association-field/hooks.ts @@ -1,11 +1,12 @@ -import { GeneralField } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; -import { reaction } from '@tachybase/schema'; +import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'; +import { GeneralField, reaction, useField, useFieldSchema } from '@tachybase/schema'; import { flatten, getValuesByPath } from '@tachybase/utils/client'; + import _, { isString } from 'lodash'; import cloneDeep from 'lodash/cloneDeep'; -import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; +import { Collection } from '../../../data-source'; import { isInFilterFormBlock } from '../../../filter-provider'; import { mergeFilter } from '../../../filter-provider/utils'; import { useRecord } from '../../../record-provider'; @@ -16,7 +17,6 @@ import { getVariableName } from '../../../variables/utils/getVariableName'; import { isVariable } from '../../../variables/utils/isVariable'; import { useDesignable } from '../../hooks'; import { AssociationFieldContext } from './context'; -import { Collection } from '../../../data-source'; export const useInsertSchema = (component) => { const fieldSchema = useFieldSchema(); diff --git a/packages/core/client/src/schema-component/antd/association-field/util.ts b/packages/core/client/src/schema-component/antd/association-field/util.ts index 6badafc74..f2c707321 100644 --- a/packages/core/client/src/schema-component/antd/association-field/util.ts +++ b/packages/core/client/src/schema-component/antd/association-field/util.ts @@ -1,11 +1,11 @@ -import { ISchema, Schema } from '@tachybase/schema'; -import { isArr } from '@tachybase/schema'; +import React from 'react'; +import { Field, isArr, ISchema, Schema } from '@tachybase/schema'; import { getDefaultFormat, str2moment } from '@tachybase/utils/client'; + import { Tag } from 'antd'; import dayjs from 'dayjs'; -import React from 'react'; + import { CollectionFieldOptions_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; -import { Field } from '@tachybase/schema'; export const useLabelUiSchemaV2 = () => { const { getCollectionJoinField } = useCollectionManager_deprecated(); diff --git a/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx b/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx index 64a2e7b88..2d7693641 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/ActionBarAssociationFilterAction.tsx @@ -1,7 +1,9 @@ -import { Schema, useFieldSchema } from '@tachybase/schema'; import React, { useContext } from 'react'; +import { Schema, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; -import { SchemaComponentContext, createDesignable } from '../..'; + +import { createDesignable, SchemaComponentContext } from '../..'; import { useAPIClient } from '../../../api-client'; import { useBlockRequestContext } from '../../../block-provider'; import { mergeFilter } from '../../../filter-provider/utils'; diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.BlockDesigner.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.BlockDesigner.tsx index 0f5f06c68..39f221e80 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.BlockDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.BlockDesigner.tsx @@ -1,6 +1,8 @@ -import { useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useCollection_deprecated } from '../../../collection-manager'; import { FilterBlockType } from '../../../filter-provider/utils'; import { diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx index 8b7866a8a..be22a1fee 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.Designer.tsx @@ -1,9 +1,11 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useFormBlockContext } from '../../../block-provider'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../collection-manager'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner, SchemaSettingsDefaultSortingRules, diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDelete.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDelete.tsx index c3dfb53a9..2120bff95 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDelete.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDelete.tsx @@ -1,8 +1,10 @@ import React, { useContext } from 'react'; import { useFieldSchema } from '@tachybase/schema'; + +import { useTranslation } from 'react-i18next'; + import { createDesignable, SchemaComponentContext } from '../..'; import { useAPIClient } from '../../../api-client'; -import { useTranslation } from 'react-i18next'; import { SchemaInitializerItem, useSchemaInitializerItem } from '../../../application'; export const AssociationFilterDesignerDelete = () => { diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDisplayField.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDisplayField.tsx index 803028f86..aa9663425 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDisplayField.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilterDesignerDisplayField.tsx @@ -1,8 +1,8 @@ -import { merge } from '@tachybase/schema'; import React from 'react'; +import { merge } from '@tachybase/schema'; -import { useCurrentSchema } from '../../../schema-initializer/utils'; import { SchemaInitializerSwitch, useSchemaInitializer, useSchemaInitializerItem } from '../../../application'; +import { useCurrentSchema } from '../../../schema-initializer/utils'; export const AssociationFilterDesignerDisplayField = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/core/client/src/schema-component/antd/association-select/AssociationSelect.tsx b/packages/core/client/src/schema-component/antd/association-select/AssociationSelect.tsx index 7c2082913..a5a2e9c90 100644 --- a/packages/core/client/src/schema-component/antd/association-select/AssociationSelect.tsx +++ b/packages/core/client/src/schema-component/antd/association-select/AssociationSelect.tsx @@ -1,14 +1,18 @@ -import { LoadingOutlined } from '@ant-design/icons'; -import { ArrayCollapse, ArrayItems, FormLayout } from '@tachybase/components'; -import { Field } from '@tachybase/schema'; -import { ISchema, connect, mapProps, mapReadPretty, useField, useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import _ from 'lodash'; import React, { useCallback, useEffect, useMemo } from 'react'; +import { ArrayCollapse, ArrayItems, FormLayout } from '@tachybase/components'; +import { connect, Field, ISchema, mapProps, mapReadPretty, uid, useField, useFieldSchema } from '@tachybase/schema'; + +import { LoadingOutlined } from '@ant-design/icons'; +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useFilterByTk, useFormBlockContext } from '../../../block-provider'; import { useCollection_deprecated, useCollectionManager_deprecated, useSortFields } from '../../../collection-manager'; import { GeneralSchemaItems } from '../../../schema-items'; +import { GeneralSchemaDesigner } from '../../../schema-settings/GeneralSchemaDesigner'; +import { useIsAllowToSetDefaultValue } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue'; +import { useIsShowMultipleSwitch } from '../../../schema-settings/hooks/useIsShowMultipleSwitch'; +import { isPatternDisabled } from '../../../schema-settings/isPatternDisabled'; import { SchemaSettingsDivider, SchemaSettingsModalItem, @@ -16,17 +20,13 @@ import { SchemaSettingsSelectItem, SchemaSettingsSwitchItem, } from '../../../schema-settings/SchemaSettings'; -import { isPatternDisabled } from '../../../schema-settings/isPatternDisabled'; import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; -import { useIsAllowToSetDefaultValue } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue'; -import { useIsShowMultipleSwitch } from '../../../schema-settings/hooks/useIsShowMultipleSwitch'; import { useCompile, useDesignable, useFieldComponentOptions, useFieldTitle } from '../../hooks'; import { removeNullCondition } from '../filter'; import { RemoteSelect, RemoteSelectProps } from '../remote-select'; import { defaultFieldNames } from '../select'; import { ReadPretty } from './ReadPretty'; import useServiceOptions from './useServiceOptions'; -import { GeneralSchemaDesigner } from '../../../schema-settings/GeneralSchemaDesigner'; export type AssociationSelectProps

= RemoteSelectProps

& { action?: string; diff --git a/packages/core/client/src/schema-component/antd/association-select/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/association-select/ReadPretty.tsx index 82192b31c..4c7fe77ba 100644 --- a/packages/core/client/src/schema-component/antd/association-select/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/association-select/ReadPretty.tsx @@ -1,5 +1,6 @@ -import { observer } from '@tachybase/schema'; import React from 'react'; +import { observer } from '@tachybase/schema'; + import { useFieldTitle } from '../../hooks'; import { RemoteSelect } from '../remote-select'; import useServiceOptions from './useServiceOptions'; diff --git a/packages/core/client/src/schema-component/antd/association-select/__tests__/association-select.test.tsx b/packages/core/client/src/schema-component/antd/association-select/__tests__/association-select.test.tsx index 63ce3bb09..3d3b7c6ce 100644 --- a/packages/core/client/src/schema-component/antd/association-select/__tests__/association-select.test.tsx +++ b/packages/core/client/src/schema-component/antd/association-select/__tests__/association-select.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, sleep, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, sleep, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('AssociationSelect', () => { diff --git a/packages/core/client/src/schema-component/antd/association-select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/association-select/demos/demo1.tsx index defa3e11d..4762430b7 100644 --- a/packages/core/client/src/schema-component/antd/association-select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/association-select/demos/demo1.tsx @@ -1,5 +1,6 @@ -import { APIClientProvider, AssociationSelect, FormProvider, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { APIClientProvider, AssociationSelect, FormProvider, SchemaComponent } from '@tachybase/client'; + import { mockAPIClient } from '../../../../testUtils'; const { apiClient, mockRequest } = mockAPIClient(); diff --git a/packages/core/client/src/schema-component/antd/association-select/useServiceOptions.ts b/packages/core/client/src/schema-component/antd/association-select/useServiceOptions.ts index b6b7f502f..cf6ac124e 100644 --- a/packages/core/client/src/schema-component/antd/association-select/useServiceOptions.ts +++ b/packages/core/client/src/schema-component/antd/association-select/useServiceOptions.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback, useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { isInFilterFormBlock } from '../../../filter-provider'; import { mergeFilter } from '../../../filter-provider/utils'; diff --git a/packages/core/client/src/schema-component/antd/auto-complete/AutoComplete.tsx b/packages/core/client/src/schema-component/antd/auto-complete/AutoComplete.tsx index e3704c484..5c3f6eadf 100644 --- a/packages/core/client/src/schema-component/antd/auto-complete/AutoComplete.tsx +++ b/packages/core/client/src/schema-component/antd/auto-complete/AutoComplete.tsx @@ -1,5 +1,7 @@ import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; + import { AutoComplete as AntdAutoComplete } from 'antd'; + import { ReadPretty } from '../input'; export const AutoComplete = connect( diff --git a/packages/core/client/src/schema-component/antd/block-item/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/block-item/demos/demo1.tsx index e3588e510..9bd87963c 100644 --- a/packages/core/client/src/schema-component/antd/block-item/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/block-item/demos/demo1.tsx @@ -1,7 +1,6 @@ -import { observer, useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { BlockItem, DndContext, DragHandler, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { BlockItem, DndContext, DragHandler, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { observer, uid, useFieldSchema } from '@tachybase/schema'; const Block = observer( () => { diff --git a/packages/core/client/src/schema-component/antd/cascader/Cascader.tsx b/packages/core/client/src/schema-component/antd/cascader/Cascader.tsx index e514d2fe0..8a19c65ac 100644 --- a/packages/core/client/src/schema-component/antd/cascader/Cascader.tsx +++ b/packages/core/client/src/schema-component/antd/cascader/Cascader.tsx @@ -1,13 +1,13 @@ +import React from 'react'; +import { ArrayField, connect, mapProps, mapReadPretty, toArr, useField } from '@tachybase/schema'; + import { LoadingOutlined } from '@ant-design/icons'; -import { ArrayField } from '@tachybase/schema'; -import { connect, mapProps, mapReadPretty, useField } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import { Cascader as AntdCascader, Space } from 'antd'; import { isBoolean, omit } from 'lodash'; -import React from 'react'; + import { useRequest } from '../../../api-client'; -import { ReadPretty } from './ReadPretty'; import { defaultFieldNames } from './defaultFieldNames'; +import { ReadPretty } from './ReadPretty'; const useDefDataSource = (options) => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/cascader/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/cascader/ReadPretty.tsx index a617e52fd..a30c25772 100644 --- a/packages/core/client/src/schema-component/antd/cascader/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/cascader/ReadPretty.tsx @@ -1,7 +1,6 @@ -import { ArrayField } from '@tachybase/schema'; -import { useField } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import React from 'react'; +import { ArrayField, toArr, useField } from '@tachybase/schema'; + import { defaultFieldNames } from './defaultFieldNames'; export const ReadPretty: React.FC = (props: any) => { diff --git a/packages/core/client/src/schema-component/antd/cascader/__tests__/cascader.test.tsx b/packages/core/client/src/schema-component/antd/cascader/__tests__/cascader.test.tsx index 2d95a410c..aaa4469c7 100644 --- a/packages/core/client/src/schema-component/antd/cascader/__tests__/cascader.test.tsx +++ b/packages/core/client/src/schema-component/antd/cascader/__tests__/cascader.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen, userEvent, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen, userEvent, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/cascader/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/cascader/demos/demo1.tsx index 3222f89d9..2cc57e521 100644 --- a/packages/core/client/src/schema-component/antd/cascader/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/cascader/demos/demo1.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Cascader, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Cascader, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/cascader/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/cascader/demos/demo2.tsx index faf5bd859..2fc1f668e 100644 --- a/packages/core/client/src/schema-component/antd/cascader/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/cascader/demos/demo2.tsx @@ -1,7 +1,4 @@ -import { FormItem } from '@tachybase/components'; -import { ArrayField } from '@tachybase/schema'; -import { useField } from '@tachybase/schema'; -import { action } from '@tachybase/schema'; +import React from 'react'; import { APIClient, APIClientProvider, @@ -10,8 +7,10 @@ import { SchemaComponentProvider, useAPIClient, } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; +import { action, ArrayField, useField } from '@tachybase/schema'; + import MockAdapter from 'axios-mock-adapter'; -import React from 'react'; const apiClient = new APIClient(); diff --git a/packages/core/client/src/schema-component/antd/checkbox/__tests__/checkbox.test.tsx b/packages/core/client/src/schema-component/antd/checkbox/__tests__/checkbox.test.tsx index 53d43a04a..27a405cc2 100644 --- a/packages/core/client/src/schema-component/antd/checkbox/__tests__/checkbox.test.tsx +++ b/packages/core/client/src/schema-component/antd/checkbox/__tests__/checkbox.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/checkbox'; import App2 from '../demos/checkbox.group'; diff --git a/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.group.tsx b/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.group.tsx index e1f3c3606..a219340c2 100644 --- a/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.group.tsx +++ b/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.group.tsx @@ -1,9 +1,9 @@ /** * title: 组 */ -import { FormItem } from '@tachybase/components'; -import { Checkbox, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Checkbox, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.tsx b/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.tsx index a856a10d4..4c2e68bc8 100644 --- a/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.tsx +++ b/packages/core/client/src/schema-component/antd/checkbox/demos/checkbox.tsx @@ -1,9 +1,9 @@ /** * title: 勾选 */ -import { FormItem } from '@tachybase/components'; -import { Checkbox, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Checkbox, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx b/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx index 052515db0..4337d2ada 100644 --- a/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx +++ b/packages/core/client/src/schema-component/antd/collection-select/CollectionSelect.tsx @@ -1,13 +1,15 @@ -import { connect, mapReadPretty, observer, useField } from '@tachybase/schema'; -import { Cascader, Select, SelectProps, Tag } from 'antd'; import React, { useCallback, useContext, useMemo } from 'react'; +import { connect, mapReadPretty, observer, useField } from '@tachybase/schema'; + +import { Cascader, Select, SelectProps, Tag } from 'antd'; import { useTranslation } from 'react-i18next'; + +import { parseCollectionName } from '../../../collection-manager'; import { useSelfAndChildrenCollections } from '../../../collection-manager/action-hooks'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager/hooks'; +import { useDataSourceManager } from '../../../data-source'; import { useCompile } from '../../hooks'; import { FilterContext } from '../filter/context'; -import { useDataSourceManager } from '../../../data-source'; -import { parseCollectionName } from '../../../collection-manager'; export type CollectionSelectProps = SelectProps & { filter?: (item: any, index: number, array: any[]) => boolean; diff --git a/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx b/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx index 56ba707bc..42292b48b 100644 --- a/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx +++ b/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe.skip('CollectionSelect', () => { diff --git a/packages/core/client/src/schema-component/antd/collection-select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/collection-select/demos/demo1.tsx index 6f2b21ebc..2a9206eb6 100644 --- a/packages/core/client/src/schema-component/antd/collection-select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/collection-select/demos/demo1.tsx @@ -1,6 +1,7 @@ -import { FormItem } from '@tachybase/components'; -import { ExtendCollectionsProvider, CollectionSelect, FormProvider, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { CollectionSelect, ExtendCollectionsProvider, FormProvider, SchemaComponent } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + import { useTranslation } from 'react-i18next'; const collections = []; diff --git a/packages/core/client/src/schema-component/antd/color-picker/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/color-picker/demos/demo1.tsx index 16fc07065..0fc12afe1 100644 --- a/packages/core/client/src/schema-component/antd/color-picker/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/color-picker/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: ColorPicker */ -import { FormItem } from '@tachybase/components'; -import { ColorPicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { ColorPicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/color-select/ColorSelect.tsx b/packages/core/client/src/schema-component/antd/color-select/ColorSelect.tsx index 1262b83a2..ca7fa65f6 100644 --- a/packages/core/client/src/schema-component/antd/color-select/ColorSelect.tsx +++ b/packages/core/client/src/schema-component/antd/color-select/ColorSelect.tsx @@ -1,7 +1,9 @@ -import { LoadingOutlined } from '@ant-design/icons'; -import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; -import { Select, Tag } from 'antd'; import React from 'react'; +import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; + +import { LoadingOutlined } from '@ant-design/icons'; +import { Select, Tag } from 'antd'; + import { useCompile } from '../../hooks/useCompile'; const colors = { diff --git a/packages/core/client/src/schema-component/antd/color-select/__tests__/color-select.test.tsx b/packages/core/client/src/schema-component/antd/color-select/__tests__/color-select.test.tsx index ee9e46e48..b2d882a82 100644 --- a/packages/core/client/src/schema-component/antd/color-select/__tests__/color-select.test.tsx +++ b/packages/core/client/src/schema-component/antd/color-select/__tests__/color-select.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen } from '@tachybase/test/client'; + import App from '../demos/demo1'; describe('ColorSelect', () => { diff --git a/packages/core/client/src/schema-component/antd/color-select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/color-select/demos/demo1.tsx index 1fd687d7b..665f3bc00 100644 --- a/packages/core/client/src/schema-component/antd/color-select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/color-select/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: 勾选 */ -import { FormItem } from '@tachybase/components'; -import { ColorSelect, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { ColorSelect, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/cron/CronSet.tsx b/packages/core/client/src/schema-component/antd/cron/CronSet.tsx index 3a914bbdc..f961d756e 100644 --- a/packages/core/client/src/schema-component/antd/cron/CronSet.tsx +++ b/packages/core/client/src/schema-component/antd/cron/CronSet.tsx @@ -1,6 +1,8 @@ -import { connect, mapReadPretty, useFieldSchema } from '@tachybase/schema'; -import { Select, SelectProps } from 'antd'; import React, { useEffect, useMemo, useState } from 'react'; +import { connect, mapReadPretty, useFieldSchema } from '@tachybase/schema'; + +import { Select, SelectProps } from 'antd'; + import { useCollection_deprecated } from '../../../collection-manager'; import { useCompile } from '../../hooks'; import { EllipsisWithTooltip } from '../input'; diff --git a/packages/core/client/src/schema-component/antd/cron/__tests__/cron-set.test.tsx b/packages/core/client/src/schema-component/antd/cron/__tests__/cron-set.test.tsx index 7a6d3b714..f3cf8d081 100644 --- a/packages/core/client/src/schema-component/antd/cron/__tests__/cron-set.test.tsx +++ b/packages/core/client/src/schema-component/antd/cron/__tests__/cron-set.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import Cron from '../demos/demo1'; import CronSet from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/cron/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/cron/demos/demo1.tsx index e1036b16d..7c9cc7ab8 100644 --- a/packages/core/client/src/schema-component/antd/cron/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/cron/demos/demo1.tsx @@ -1,6 +1,7 @@ -import { FormItem } from '@tachybase/components'; -import { Cron, FormProvider, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { Cron, FormProvider, SchemaComponent } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + import { useTranslation } from 'react-i18next'; const schema = { diff --git a/packages/core/client/src/schema-component/antd/cron/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/cron/demos/demo2.tsx index 72643e330..a21e66736 100644 --- a/packages/core/client/src/schema-component/antd/cron/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/cron/demos/demo2.tsx @@ -1,6 +1,7 @@ -import { FormItem } from '@tachybase/components'; -import { CronSet, FormProvider, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { CronSet, FormProvider, SchemaComponent } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + import { useTranslation } from 'react-i18next'; const schema = { diff --git a/packages/core/client/src/schema-component/antd/custom-cascader/CustomCascader.tsx b/packages/core/client/src/schema-component/antd/custom-cascader/CustomCascader.tsx index fc37e6f7c..a19e7a840 100644 --- a/packages/core/client/src/schema-component/antd/custom-cascader/CustomCascader.tsx +++ b/packages/core/client/src/schema-component/antd/custom-cascader/CustomCascader.tsx @@ -1,13 +1,13 @@ +import React from 'react'; +import { ArrayField, connect, mapProps, mapReadPretty, toArr, useField } from '@tachybase/schema'; + import { LoadingOutlined } from '@ant-design/icons'; -import { ArrayField } from '@tachybase/schema'; -import { connect, mapProps, mapReadPretty, useField } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import { Cascader as AntdCascader, Space } from 'antd'; import { isBoolean, omit } from 'lodash'; -import React from 'react'; + import { useRequest } from '../../../api-client'; -import { ReadPretty } from './ReadPretty'; import { defaultFieldNames } from './defaultFieldNames'; +import { ReadPretty } from './ReadPretty'; const useDefDataSource = (options) => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/custom-cascader/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/custom-cascader/ReadPretty.tsx index a617e52fd..a30c25772 100644 --- a/packages/core/client/src/schema-component/antd/custom-cascader/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/custom-cascader/ReadPretty.tsx @@ -1,7 +1,6 @@ -import { ArrayField } from '@tachybase/schema'; -import { useField } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import React from 'react'; +import { ArrayField, toArr, useField } from '@tachybase/schema'; + import { defaultFieldNames } from './defaultFieldNames'; export const ReadPretty: React.FC = (props: any) => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/date-picker/ReadPretty.tsx index cca59b7f4..62dfc9d48 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/ReadPretty.tsx @@ -1,12 +1,14 @@ +import React from 'react'; import { isArr } from '@tachybase/schema'; import { getDefaultFormat, str2moment } from '@tachybase/utils/client'; + import type { DatePickerProps as AntdDatePickerProps, RangePickerProps as AntdRangePickerProps, } from 'antd/es/date-picker'; import cls from 'classnames'; import dayjs from 'dayjs'; -import React from 'react'; + import { usePrefixCls } from '../__builtins__'; type Composed = { diff --git a/packages/core/client/src/schema-component/antd/date-picker/__tests__/date-picker.test.tsx b/packages/core/client/src/schema-component/antd/date-picker/__tests__/date-picker.test.tsx index 481a6b5cb..7cd35cb40 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/__tests__/date-picker.test.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/__tests__/date-picker.test.tsx @@ -1,7 +1,7 @@ -import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; -import App11 from '../demos/demo11'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; import App4 from '../demos/demo4'; @@ -10,6 +10,7 @@ import App6 from '../demos/demo6'; import App7 from '../demos/demo7'; import App8 from '../demos/demo8'; import App9 from '../demos/demo9'; +import App11 from '../demos/demo11'; describe('DatePicker', () => { it('basic', async () => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/__tests__/getDateRanges.test.ts b/packages/core/client/src/schema-component/antd/date-picker/__tests__/getDateRanges.test.ts index 41a0e5ae1..2aea788af 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/__tests__/getDateRanges.test.ts +++ b/packages/core/client/src/schema-component/antd/date-picker/__tests__/getDateRanges.test.ts @@ -1,4 +1,5 @@ import dayjs from 'dayjs'; + import { getDateRanges } from '../util'; describe('getDateRanges', () => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapDatePicker.test.ts b/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapDatePicker.test.ts index 2ae67697b..215408108 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapDatePicker.test.ts +++ b/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapDatePicker.test.ts @@ -1,5 +1,6 @@ -import { vi } from 'vitest'; import dayjs from 'dayjs'; +import { vi } from 'vitest'; + import { mapDatePicker } from '../util'; describe('mapDatePicker', () => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapRangePicker.test.ts b/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapRangePicker.test.ts index 883da4f3f..2c1a5c8b1 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapRangePicker.test.ts +++ b/packages/core/client/src/schema-component/antd/date-picker/__tests__/mapRangePicker.test.ts @@ -1,5 +1,6 @@ -import { vi } from 'vitest'; import dayjs from 'dayjs'; +import { vi } from 'vitest'; + import { mapRangePicker } from '../util'; describe('mapRangePicker', () => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/__tests__/util.test.ts b/packages/core/client/src/schema-component/antd/date-picker/__tests__/util.test.ts index 1bc3ee262..504e16274 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/__tests__/util.test.ts +++ b/packages/core/client/src/schema-component/antd/date-picker/__tests__/util.test.ts @@ -1,5 +1,7 @@ import { str2moment } from '@tachybase/utils/client'; + import dayjs from 'dayjs'; + import { moment2str } from '../util'; describe('str2moment', () => { diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo1.tsx index cd2e407ad..dd53e676a 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo10.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo10.tsx index feeabc8aa..599dfc180 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo10.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo10.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo11.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo11.tsx index 1f2018521..95125c7cb 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo11.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo11.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker.RangePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo2.tsx index 338d8ed5f..946e3c84f 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo2.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker (GMT) */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo3.tsx index ee57a96db..a79668306 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo3.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo4.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo4.tsx index 9a9c46591..0fee1a4c4 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo4.tsx @@ -1,10 +1,11 @@ /** * title: DatePicker.RangePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; -import dayjs from 'dayjs'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + +import dayjs from 'dayjs'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo5.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo5.tsx index 00711b389..ebd1496fd 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo5.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo5.tsx @@ -1,10 +1,11 @@ /** * title: DatePicker.RangePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; -import dayjs from 'dayjs'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + +import dayjs from 'dayjs'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo6.tsx index be778380a..1f72cc6a1 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo6.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo6.tsx @@ -1,10 +1,11 @@ /** * title: DatePicker.RangePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; -import dayjs from 'dayjs'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + +import dayjs from 'dayjs'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo7.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo7.tsx index 61851d458..21aa89f91 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo7.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo7.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo8.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo8.tsx index feeabc8aa..599dfc180 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo8.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo8.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/date-picker/demos/demo9.tsx b/packages/core/client/src/schema-component/antd/date-picker/demos/demo9.tsx index 61851d458..21aa89f91 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/demos/demo9.tsx +++ b/packages/core/client/src/schema-component/antd/date-picker/demos/demo9.tsx @@ -1,9 +1,9 @@ /** * title: DatePicker */ -import { FormItem } from '@tachybase/components'; -import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { DatePicker, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/details/Details.tsx b/packages/core/client/src/schema-component/antd/details/Details.tsx index d1641a71e..96bd67695 100644 --- a/packages/core/client/src/schema-component/antd/details/Details.tsx +++ b/packages/core/client/src/schema-component/antd/details/Details.tsx @@ -1,9 +1,11 @@ import React from 'react'; -import { FormV2 } from '../form-v2'; -import _ from 'lodash'; + import { Empty } from 'antd'; -import { useDataBlockRequest } from '../../../data-source'; +import _ from 'lodash'; + import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; +import { useDataBlockRequest } from '../../../data-source'; +import { FormV2 } from '../form-v2'; export const Details = withDynamicSchemaProps((props) => { const request = useDataBlockRequest(); diff --git a/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx b/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx index c5a7c270c..ab8dd9c25 100644 --- a/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx +++ b/packages/core/client/src/schema-component/antd/details/__tests__/details.test.tsx @@ -1,5 +1,6 @@ -import { render, screen } from '@tachybase/test/client'; import React from 'react'; +import { render, screen } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('Details', () => { diff --git a/packages/core/client/src/schema-component/antd/details/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/details/demos/demo1.tsx index a642d0e08..b030f410b 100644 --- a/packages/core/client/src/schema-component/antd/details/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/details/demos/demo1.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Details, FormProvider, Input, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { Details, FormProvider, Input, SchemaComponent } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback.tsx b/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback.tsx index 90fa648a3..c216b0478 100644 --- a/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback.tsx +++ b/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback.tsx @@ -1,5 +1,6 @@ -import { Button, Result, Typography } from 'antd'; import React from 'react'; + +import { Button, Result, Typography } from 'antd'; import { FallbackProps, useErrorBoundary } from 'react-error-boundary'; import { Trans, useTranslation } from 'react-i18next'; diff --git a/packages/core/client/src/schema-component/antd/error-fallback/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/error-fallback/demos/demo1.tsx index 183fcae57..504d26cd3 100644 --- a/packages/core/client/src/schema-component/antd/error-fallback/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/error-fallback/demos/demo1.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { ErrorBoundary } from 'react-error-boundary'; + import { ErrorFallback } from '../ErrorFallback'; const App = () => { diff --git a/packages/core/client/src/schema-component/antd/expand-action/Expand.Action.Design.tsx b/packages/core/client/src/schema-component/antd/expand-action/Expand.Action.Design.tsx index a48168aca..2e28282f8 100644 --- a/packages/core/client/src/schema-component/antd/expand-action/Expand.Action.Design.tsx +++ b/packages/core/client/src/schema-component/antd/expand-action/Expand.Action.Design.tsx @@ -1,6 +1,8 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useDesignable } from '../..'; import { GeneralSchemaDesigner, diff --git a/packages/core/client/src/schema-component/antd/filter/DynamicComponent.tsx b/packages/core/client/src/schema-component/antd/filter/DynamicComponent.tsx index 32f2c94f1..c39a5d1bc 100644 --- a/packages/core/client/src/schema-component/antd/filter/DynamicComponent.tsx +++ b/packages/core/client/src/schema-component/antd/filter/DynamicComponent.tsx @@ -1,7 +1,6 @@ -import { createForm, onFieldValueChange } from '@tachybase/schema'; -import { FieldContext, FormContext } from '@tachybase/schema'; -import { merge } from '@tachybase/schema'; import React, { useCallback, useContext, useMemo } from 'react'; +import { createForm, FieldContext, FormContext, merge, onFieldValueChange } from '@tachybase/schema'; + import { CollectionFieldOptions_deprecated } from '../../../collection-manager'; import { SchemaComponent } from '../../core'; import { useComponent } from '../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx index 48dcee1dd..9cb0c84a7 100644 --- a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx @@ -1,6 +1,8 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useDesignable } from '../..'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { diff --git a/packages/core/client/src/schema-component/antd/filter/Filter.tsx b/packages/core/client/src/schema-component/antd/filter/Filter.tsx index d1ba48676..cbe04c87e 100644 --- a/packages/core/client/src/schema-component/antd/filter/Filter.tsx +++ b/packages/core/client/src/schema-component/antd/filter/Filter.tsx @@ -1,14 +1,14 @@ -import { ObjectField as ObjectFieldModel } from '@tachybase/schema'; -import { observer, useField, useFieldSchema } from '@tachybase/schema'; import React, { useEffect } from 'react'; +import { ObjectField as ObjectFieldModel, observer, useField, useFieldSchema } from '@tachybase/schema'; + import { useRequest } from '../../../api-client'; +import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; import { useProps } from '../../hooks/useProps'; +import { FilterContext } from './context'; import { FilterActionDesigner } from './Filter.Action.Designer'; import { FilterAction } from './FilterAction'; import { FilterGroup } from './FilterGroup'; import { SaveDefaultValue } from './SaveDefaultValue'; -import { FilterContext } from './context'; -import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; const useDef = (options) => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/filter/FilterGroup.tsx b/packages/core/client/src/schema-component/antd/filter/FilterGroup.tsx index 4d6e4123d..4644cff02 100644 --- a/packages/core/client/src/schema-component/antd/filter/FilterGroup.tsx +++ b/packages/core/client/src/schema-component/antd/filter/FilterGroup.tsx @@ -1,12 +1,18 @@ -import { CloseCircleOutlined } from '@ant-design/icons'; -import { ObjectField as ObjectFieldModel } from '@tachybase/schema'; -import { ArrayFieldComponent as ArrayField, connect, useField } from '@tachybase/schema'; -import { Select, Space } from 'antd'; import React, { useContext } from 'react'; +import { + ArrayFieldComponent as ArrayField, + connect, + ObjectField as ObjectFieldModel, + useField, +} from '@tachybase/schema'; + +import { CloseCircleOutlined } from '@ant-design/icons'; +import { Select, Space } from 'antd'; import { Trans, useTranslation } from 'react-i18next'; + import { useToken } from '../__builtins__'; -import { FilterItems } from './FilterItems'; import { FilterLogicContext, RemoveConditionContext } from './context'; +import { FilterItems } from './FilterItems'; export const FilterGroup = connect((props) => { const { bordered = true, disabled } = props; diff --git a/packages/core/client/src/schema-component/antd/filter/FilterItems.tsx b/packages/core/client/src/schema-component/antd/filter/FilterItems.tsx index 21a2807d9..bdb839371 100644 --- a/packages/core/client/src/schema-component/antd/filter/FilterItems.tsx +++ b/packages/core/client/src/schema-component/antd/filter/FilterItems.tsx @@ -1,9 +1,14 @@ -import { ArrayField as ArrayFieldModel } from '@tachybase/schema'; -import { ObjectFieldComponent as ObjectField, observer, useField } from '@tachybase/schema'; import React from 'react'; +import { + ArrayField as ArrayFieldModel, + ObjectFieldComponent as ObjectField, + observer, + useField, +} from '@tachybase/schema'; + +import { RemoveConditionContext } from './context'; import { FilterGroup } from './FilterGroup'; import { FilterItem } from './FilterItem'; -import { RemoveConditionContext } from './context'; export const FilterItems = observer( (props) => { diff --git a/packages/core/client/src/schema-component/antd/filter/context.ts b/packages/core/client/src/schema-component/antd/filter/context.ts index 05aa807ad..6e5d262a8 100644 --- a/packages/core/client/src/schema-component/antd/filter/context.ts +++ b/packages/core/client/src/schema-component/antd/filter/context.ts @@ -1,6 +1,5 @@ -import { ObjectField } from '@tachybase/schema'; -import { Schema } from '@tachybase/schema'; import { createContext } from 'react'; +import { ObjectField, Schema } from '@tachybase/schema'; export interface FilterContextProps { field?: ObjectField & { collectionName?: string }; diff --git a/packages/core/client/src/schema-component/antd/filter/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/filter/demos/demo2.tsx index 26198bb2b..266c7b7f7 100644 --- a/packages/core/client/src/schema-component/antd/filter/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/filter/demos/demo2.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { AntdSchemaComponentProvider, Filter, @@ -5,7 +6,6 @@ import { SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import React from 'react'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/filter/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/filter/demos/demo3.tsx index f935b41a9..fafded128 100644 --- a/packages/core/client/src/schema-component/antd/filter/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/filter/demos/demo3.tsx @@ -1,4 +1,4 @@ -import { ISchema, useForm } from '@tachybase/schema'; +import React from 'react'; import { AntdSchemaComponentProvider, Application, @@ -8,7 +8,7 @@ import { SchemaComponentProvider, useActionContext, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, useForm } from '@tachybase/schema'; const dataSource = [ { diff --git a/packages/core/client/src/schema-component/antd/filter/demos/demo4.tsx b/packages/core/client/src/schema-component/antd/filter/demos/demo4.tsx index e69972783..cadfcd7bf 100644 --- a/packages/core/client/src/schema-component/antd/filter/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/antd/filter/demos/demo4.tsx @@ -1,4 +1,4 @@ -import { ISchema } from '@tachybase/schema'; +import React, { useState } from 'react'; import { AntdSchemaComponentProvider, Filter, @@ -7,8 +7,9 @@ import { SchemaComponentProvider, Select, } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; + import { Space } from 'antd'; -import React, { useState } from 'react'; const options: any = [ { diff --git a/packages/core/client/src/schema-component/antd/filter/demos/demo5.tsx b/packages/core/client/src/schema-component/antd/filter/demos/demo5.tsx index 9740b260a..a18474515 100644 --- a/packages/core/client/src/schema-component/antd/filter/demos/demo5.tsx +++ b/packages/core/client/src/schema-component/antd/filter/demos/demo5.tsx @@ -1,6 +1,6 @@ -import { ISchema } from '@tachybase/schema'; -import { Filter, FilterAction, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Filter, FilterAction, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/filter/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/filter/demos/demo6.tsx index 66b531d02..44f89717a 100644 --- a/packages/core/client/src/schema-component/antd/filter/demos/demo6.tsx +++ b/packages/core/client/src/schema-component/antd/filter/demos/demo6.tsx @@ -1,19 +1,21 @@ +import React, { useState } from 'react'; import { AntdSchemaComponentProvider, Application, CollectionPlugin, CollectionProvider_deprecated, + DEFAULT_DATA_SOURCE_KEY, + DEFAULT_DATA_SOURCE_TITLE, Filter, Input, LocalDataSource, + Plugin, SchemaComponent, useCollection_deprecated, - Plugin, - DEFAULT_DATA_SOURCE_KEY, - DEFAULT_DATA_SOURCE_TITLE, } from '@tachybase/client'; + import { Select } from 'antd'; -import React, { useState } from 'react'; + import { useFilterOptions } from '../useFilterActionProps'; const collections = [ diff --git a/packages/core/client/src/schema-component/antd/filter/index.ts b/packages/core/client/src/schema-component/antd/filter/index.ts index 0a0ba718f..bc4569bb4 100644 --- a/packages/core/client/src/schema-component/antd/filter/index.ts +++ b/packages/core/client/src/schema-component/antd/filter/index.ts @@ -1,4 +1,3 @@ export * from './Filter'; export * from './FilterAction'; export * from './useFilterActionProps'; - diff --git a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts index 4266d654b..23a6ddc36 100644 --- a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts +++ b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts @@ -1,12 +1,13 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import flat from 'flat'; +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useBlockRequestContext } from '../../../block-provider'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { mergeFilter } from '../../../filter-provider/utils'; import { useDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; -import _ from 'lodash'; export const useGetFilterOptions = () => { const { getCollectionFields } = useCollectionManager_deprecated(); diff --git a/packages/core/client/src/schema-component/antd/filter/useOperators.ts b/packages/core/client/src/schema-component/antd/filter/useOperators.ts index 3c389ebd3..a16b505e1 100644 --- a/packages/core/client/src/schema-component/antd/filter/useOperators.ts +++ b/packages/core/client/src/schema-component/antd/filter/useOperators.ts @@ -1,6 +1,7 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; /** * 获取当前字段所支持的操作符列表 diff --git a/packages/core/client/src/schema-component/antd/filter/useValues.ts b/packages/core/client/src/schema-component/antd/filter/useValues.ts index c079a588f..90367bfb4 100644 --- a/packages/core/client/src/schema-component/antd/filter/useValues.ts +++ b/packages/core/client/src/schema-component/antd/filter/useValues.ts @@ -1,9 +1,10 @@ -import { useField } from '@tachybase/schema'; -import { merge } from '@tachybase/schema'; +import { useCallback, useContext, useEffect, useMemo } from 'react'; +import { merge, useField } from '@tachybase/schema'; + import flat, { unflatten } from 'flat'; import cloneDeep from 'lodash/cloneDeep'; import get from 'lodash/get'; -import { useCallback, useContext, useEffect, useMemo } from 'react'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { FilterContext } from './context'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.Designer.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.Designer.tsx index 563ec10fa..15e5c01b1 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.Designer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner } from '../../../schema-settings'; import { useSchemaTemplate } from '../../../schema-templates'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.FilterDesigner.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.FilterDesigner.tsx index fd3804bc1..35e2a479b 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.FilterDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.FilterDesigner.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner } from '../../../schema-settings'; import { useSchemaTemplate } from '../../../schema-templates'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx index 2f7a4238b..f90daf704 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.Settings.tsx @@ -1,11 +1,14 @@ import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../application/schema-settings'; import { useFormBlockContext } from '../../../block-provider'; import { useDetailsBlockContext } from '../../../block-provider/DetailsBlockProvider'; import { useCollection_deprecated } from '../../../collection-manager'; import { useSortFields } from '../../../collection-manager/action-hooks'; +import { setDataLoadingModeSettingsItem } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; import { SchemaSettingsBlockTitleItem, SchemaSettingsDataTemplates, @@ -16,7 +19,6 @@ import { import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; -import { setDataLoadingModeSettingsItem } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; /** * @deprecated diff --git a/packages/core/client/src/schema-component/antd/form-v2/FormField.tsx b/packages/core/client/src/schema-component/antd/form-v2/FormField.tsx index 322df2d75..a32c9638b 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/FormField.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/FormField.tsx @@ -1,5 +1,6 @@ -import { observer, useField, useFieldSchema } from '@tachybase/schema'; import React, { useEffect } from 'react'; +import { observer, useField, useFieldSchema } from '@tachybase/schema'; + import { useFormBlockContext } from '../../../block-provider'; import { useCollection_deprecated } from '../../../collection-manager'; import { useCompile } from '../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx b/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx index 38fd20df7..fded46353 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Templates.tsx @@ -1,15 +1,17 @@ +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useFieldSchema } from '@tachybase/schema'; import { error, forEach } from '@tachybase/utils/client'; + import { Select, Space } from 'antd'; import _ from 'lodash'; -import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; + +import { useToken } from '../__builtins__'; import { useAPIClient } from '../../../api-client'; import { findFormBlock } from '../../../block-provider'; import { useFormBlockContext } from '../../../block-provider/FormBlockProvider'; import { useCollectionManager_deprecated } from '../../../collection-manager'; import { compatibleDataId } from '../../../schema-settings/DataTemplates/FormDataTemplates'; -import { useToken } from '../__builtins__'; import { RemoteSelect } from '../remote-select'; export interface ITemplate { diff --git a/packages/core/client/src/schema-component/antd/form-v2/__tests__/form-v2.test.tsx b/packages/core/client/src/schema-component/antd/form-v2/__tests__/form-v2.test.tsx index 9fcc8004e..5c5d447c5 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/__tests__/form-v2.test.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/__tests__/form-v2.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/form-v2/demos/demo1.tsx index 4bca3e19e..b681dbd18 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/demos/demo1.tsx @@ -1,4 +1,4 @@ -import { ISchema, useForm } from '@tachybase/schema'; +import React from 'react'; import { Action, Application, @@ -11,13 +11,15 @@ import { FormItem, FormV2, Input, - Plugin, LocalDataSource, + Plugin, SchemaComponent, useFormBlockContext, } from '@tachybase/client'; +import { ISchema, useForm } from '@tachybase/schema'; + import { notification } from 'antd'; -import React from 'react'; + import { useFilterByTk } from '../../../../block-provider/BlockProvider'; import { mockAPIClient } from '../../../../testUtils'; import collections from './collections'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/form-v2/demos/demo2.tsx index 50029ac21..6a34b3bb8 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/demos/demo2.tsx @@ -1,4 +1,4 @@ -import { ISchema, useForm } from '@tachybase/schema'; +import React from 'react'; import { Action, Application, @@ -18,8 +18,10 @@ import { SchemaComponent, useFormBlockContext, } from '@tachybase/client'; +import { ISchema, useForm } from '@tachybase/schema'; + import { notification } from 'antd'; -import React from 'react'; + import { useFilterByTk } from '../../../../block-provider/BlockProvider'; import { mockAPIClient } from '../../../../testUtils'; import collections from './collections'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/form-v2/demos/demo3.tsx index 7194094c7..929f7f8b4 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/demos/demo3.tsx @@ -1,4 +1,4 @@ -import { ISchema } from '@tachybase/schema'; +import React from 'react'; import { Action, Application, @@ -18,7 +18,8 @@ import { Plugin, SchemaComponent, } from '@tachybase/client'; -import React from 'react'; +import { ISchema } from '@tachybase/schema'; + import { mockAPIClient } from '../../../../testUtils'; import collections from './collections'; diff --git a/packages/core/client/src/schema-component/antd/form-v2/index.ts b/packages/core/client/src/schema-component/antd/form-v2/index.ts index df0fef47a..c15f013d6 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/index.ts +++ b/packages/core/client/src/schema-component/antd/form-v2/index.ts @@ -2,6 +2,7 @@ import { Form as FormV2 } from './Form'; import { DetailsDesigner, FormDesigner, ReadPrettyFormDesigner } from './Form.Designer'; import { FilterDesigner } from './Form.FilterDesigner'; import { Templates } from './Templates'; + export * from './Form.Settings'; FormV2.Designer = FormDesigner; diff --git a/packages/core/client/src/schema-component/antd/form/Form.Designer.tsx b/packages/core/client/src/schema-component/antd/form/Form.Designer.tsx index 4f220a52b..a064a4507 100644 --- a/packages/core/client/src/schema-component/antd/form/Form.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/form/Form.Designer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner } from '../../../schema-settings'; diff --git a/packages/core/client/src/schema-component/antd/form/Form.tsx b/packages/core/client/src/schema-component/antd/form/Form.tsx index 5725cbb09..a69c01e8e 100644 --- a/packages/core/client/src/schema-component/antd/form/Form.tsx +++ b/packages/core/client/src/schema-component/antd/form/Form.tsx @@ -1,9 +1,18 @@ +import React, { createContext, useContext, useEffect, useMemo } from 'react'; import { FormLayout } from '@tachybase/components'; -import { createForm } from '@tachybase/schema'; -import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; +import { + createForm, + FieldContext, + FormContext, + observer, + RecursionField, + useField, + useFieldSchema, +} from '@tachybase/schema'; + import { Options, Result } from 'ahooks/es/useRequest/src/types'; import { ConfigProvider, Spin } from 'antd'; -import React, { createContext, useContext, useEffect, useMemo } from 'react'; + import { useAttach, useComponent } from '../..'; import { useRequest } from '../../../api-client'; import { useCollection_deprecated } from '../../../collection-manager'; diff --git a/packages/core/client/src/schema-component/antd/form/demos/apiClient.ts b/packages/core/client/src/schema-component/antd/form/demos/apiClient.ts index f8c52b238..e407114fb 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/apiClient.ts +++ b/packages/core/client/src/schema-component/antd/form/demos/apiClient.ts @@ -1,4 +1,5 @@ import { APIClient } from '@tachybase/client'; + import MockAdapter from 'axios-mock-adapter'; export const apiClient = new APIClient(); diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo1.tsx index 98503541f..b93a4994b 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo1.tsx @@ -1,7 +1,7 @@ +import React from 'react'; +import { Action, Form, SchemaComponent, SchemaComponentProvider, useCloseAction } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, SchemaComponent, SchemaComponentProvider, useCloseAction } from '@tachybase/client'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo2.tsx index 5c2ef9a8d..3d4f02003 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo2.tsx @@ -1,8 +1,9 @@ +import React from 'react'; +import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; + import { Card } from 'antd'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo3.tsx index 31f0f24f1..98b10c079 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo3.tsx @@ -1,8 +1,9 @@ +import React from 'react'; +import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; + import { Card } from 'antd'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo4.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo4.tsx index fcc15e4ea..b652c7c6b 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo4.tsx @@ -1,7 +1,7 @@ +import React from 'react'; +import { Action, Form, SchemaComponent, SchemaComponentProvider, useCloseAction } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, SchemaComponent, SchemaComponentProvider, useCloseAction } from '@tachybase/client'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo5.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo5.tsx index e0a3ffacb..249a6d300 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo5.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo5.tsx @@ -1,15 +1,17 @@ -import { FormItem, Input } from '@tachybase/components'; -import { ISchema, observer, useForm } from '@tachybase/schema'; +import React from 'react'; import { - APIClientProvider, Action, + APIClientProvider, Form, SchemaComponent, SchemaComponentProvider, useAPIClient, } from '@tachybase/client'; +import { FormItem, Input } from '@tachybase/components'; +import { ISchema, observer, useForm } from '@tachybase/schema'; + import { Card, Space } from 'antd'; -import React from 'react'; + import { apiClient } from './apiClient'; const schema: ISchema = { diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo6.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo6.tsx index f4959cce8..920fad8e3 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo6.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo6.tsx @@ -1,8 +1,9 @@ +import React from 'react'; +import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; + import { Card } from 'antd'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo7.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo7.tsx index 0784280cd..bca8a0ad1 100644 --- a/packages/core/client/src/schema-component/antd/form/demos/demo7.tsx +++ b/packages/core/client/src/schema-component/antd/form/demos/demo7.tsx @@ -1,8 +1,9 @@ +import React from 'react'; +import { Action, Form, FormUseValues, SchemaComponent, SchemaComponentProvider, useRequest } from '@tachybase/client'; import { FormItem, Input } from '@tachybase/components'; import { ISchema, observer, useForm } from '@tachybase/schema'; -import { Action, Form, FormUseValues, SchemaComponent, SchemaComponentProvider, useRequest } from '@tachybase/client'; + import { Card } from 'antd'; -import React from 'react'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Designer.tsx b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Designer.tsx index 7851bb237..33763fd20 100644 --- a/packages/core/client/src/schema-component/antd/grid-card/GridCard.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/grid-card/GridCard.Designer.tsx @@ -1,11 +1,14 @@ +import React, { useMemo } from 'react'; import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { Slider } from 'antd'; import _ from 'lodash'; -import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; + import { useFormBlockContext } from '../../../block-provider'; import { useCollection_deprecated, useSortFields } from '../../../collection-manager'; +import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; import { useRecord } from '../../../record-provider'; import { GeneralSchemaDesigner, @@ -15,13 +18,12 @@ import { SchemaSettingsSelectItem, SchemaSettingsTemplate, } from '../../../schema-settings'; +import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { useSchemaTemplate } from '../../../schema-templates'; import { SchemaComponentOptions } from '../../core'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; import { defaultColumnCount, gridSizes, pageSizeOptions, screenSizeMaps, screenSizeTitleMaps } from './options'; -import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; -import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; const columnCountMarks = [1, 2, 3, 4, 6, 8, 12, 24].reduce((obj, cur) => { obj[cur] = cur; diff --git a/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx b/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx index be60a29cf..d6de0524c 100644 --- a/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx +++ b/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('GridCard', () => { diff --git a/packages/core/client/src/schema-component/antd/grid/Block.tsx b/packages/core/client/src/schema-component/antd/grid/Block.tsx index 7058758b5..28fef26d3 100644 --- a/packages/core/client/src/schema-component/antd/grid/Block.tsx +++ b/packages/core/client/src/schema-component/antd/grid/Block.tsx @@ -1,5 +1,6 @@ -import { observer, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { observer, useFieldSchema } from '@tachybase/schema'; + import { DragHandler } from '../../'; export const Block = observer( diff --git a/packages/core/client/src/schema-component/antd/grid/__tests__/grid.test.tsx b/packages/core/client/src/schema-component/antd/grid/__tests__/grid.test.tsx index ef0854266..622983c9f 100644 --- a/packages/core/client/src/schema-component/antd/grid/__tests__/grid.test.tsx +++ b/packages/core/client/src/schema-component/antd/grid/__tests__/grid.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/grid/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/grid/demos/demo1.tsx index 7543c9ac6..57f614ff1 100644 --- a/packages/core/client/src/schema-component/antd/grid/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/grid/demos/demo1.tsx @@ -1,14 +1,14 @@ -import { observer, useFieldSchema } from '@tachybase/schema'; +import React from 'react'; import { Application, BlockItem, - Plugin, DragHandler, Grid, + Plugin, SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import React from 'react'; +import { observer, useFieldSchema } from '@tachybase/schema'; const Block = observer( (props) => { diff --git a/packages/core/client/src/schema-component/antd/grid/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/grid/demos/demo2.tsx index b29ef8e38..30404b0eb 100644 --- a/packages/core/client/src/schema-component/antd/grid/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/grid/demos/demo2.tsx @@ -1,18 +1,17 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React from 'react'; import { APIClientProvider, + Application, CurrentUserProvider, Form, FormItem, Grid, Input, - Application, Plugin, SchemaComponent, SchemaComponentProvider, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, uid } from '@tachybase/schema'; import { mockAPIClient } from '../../../../testUtils'; diff --git a/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx index d0a29b745..fa53fd814 100644 --- a/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/grid/demos/demo3.tsx @@ -1,17 +1,16 @@ -import { ISchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React from 'react'; import { Application, CardItem, Grid, Markdown, - Plugin, MarkdownBlockInitializer, + Plugin, SchemaComponent, SchemaComponentProvider, SchemaInitializer, } from '@tachybase/client'; -import React from 'react'; +import { ISchema, uid } from '@tachybase/schema'; const gridRowColWrap = (schema) => { return { diff --git a/packages/core/client/src/schema-component/antd/icon-picker/IconFilterInput.tsx b/packages/core/client/src/schema-component/antd/icon-picker/IconFilterInput.tsx index 33a3692c1..749cb9670 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/IconFilterInput.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/IconFilterInput.tsx @@ -1,6 +1,7 @@ +import React from 'react'; + import { Input } from 'antd'; import _ from 'lodash'; -import React from 'react'; export const IconFilterInput = (props) => { const { changeFilterKey } = props; diff --git a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx index e67913c52..ef0a675ef 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/IconPicker.tsx @@ -1,11 +1,12 @@ -import { CloseOutlined, LoadingOutlined } from '@ant-design/icons'; -import { useFormLayout } from '@tachybase/components'; -import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; -import { Button, Space } from 'antd'; import React, { useMemo, useState } from 'react'; +import { useFormLayout } from '@tachybase/components'; +import { connect, isValid, mapProps, mapReadPretty } from '@tachybase/schema'; + +import { CloseOutlined, LoadingOutlined } from '@ant-design/icons'; +import { Button, Space } from 'antd'; import { useTranslation } from 'react-i18next'; -import { Icon, hasIcon } from '../../../icon'; + +import { hasIcon, Icon } from '../../../icon'; import { StablePopover } from '../popover'; import { IconFilterInput } from './IconFilterInput'; import { IconFilterList } from './IconList'; diff --git a/packages/core/client/src/schema-component/antd/icon-picker/__tests__/icon-picker.test.tsx b/packages/core/client/src/schema-component/antd/icon-picker/__tests__/icon-picker.test.tsx index af65f7e07..243dca1b4 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/__tests__/icon-picker.test.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/__tests__/icon-picker.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import App from '../demos/icon-picker'; describe('IconPicker', () => { diff --git a/packages/core/client/src/schema-component/antd/icon-picker/demos/icon-picker.tsx b/packages/core/client/src/schema-component/antd/icon-picker/demos/icon-picker.tsx index 878789591..8d891ba90 100644 --- a/packages/core/client/src/schema-component/antd/icon-picker/demos/icon-picker.tsx +++ b/packages/core/client/src/schema-component/antd/icon-picker/demos/icon-picker.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { IconPicker, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { IconPicker, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/index.less b/packages/core/client/src/schema-component/antd/index.less index 2dd5ca7e3..25faecb44 100644 --- a/packages/core/client/src/schema-component/antd/index.less +++ b/packages/core/client/src/schema-component/antd/index.less @@ -5,7 +5,7 @@ .ant-formily-item-label { color: #000000d9; - font-weight:600; + font-weight: 600; } .ant-table-pagination.ant-pagination { @@ -27,5 +27,6 @@ } html body { - --adm-font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; + --adm-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', + sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; } diff --git a/packages/core/client/src/schema-component/antd/input-number/InputNumber.tsx b/packages/core/client/src/schema-component/antd/input-number/InputNumber.tsx index b313b60d1..3c281725a 100644 --- a/packages/core/client/src/schema-component/antd/input-number/InputNumber.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/InputNumber.tsx @@ -1,6 +1,8 @@ -import { connect, mapReadPretty } from '@tachybase/schema'; -import { InputNumber as AntdNumber, InputNumberProps } from 'antd'; import React from 'react'; +import { connect, mapReadPretty } from '@tachybase/schema'; + +import { InputNumber as AntdNumber, InputNumberProps } from 'antd'; + import { ReadPretty } from './ReadPretty'; type ComposedInputNumber = React.ForwardRefExoticComponent< diff --git a/packages/core/client/src/schema-component/antd/input-number/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/input-number/ReadPretty.tsx index 17269d4b1..b470ff316 100644 --- a/packages/core/client/src/schema-component/antd/input-number/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/ReadPretty.tsx @@ -1,10 +1,11 @@ +import React, { useMemo } from 'react'; import { isValid } from '@tachybase/schema'; import { toFixedByStep } from '@tachybase/utils/client'; + import type { InputProps } from 'antd/es/input'; import type { InputNumberProps } from 'antd/es/input-number'; import { format } from 'd3-format'; import * as math from 'mathjs'; -import React, { useMemo } from 'react'; function countDecimalPlaces(value) { const number = Number(value); diff --git a/packages/core/client/src/schema-component/antd/input-number/__tests__/input-number.test.tsx b/packages/core/client/src/schema-component/antd/input-number/__tests__/input-number.test.tsx index d6a42935e..c370c28b6 100644 --- a/packages/core/client/src/schema-component/antd/input-number/__tests__/input-number.test.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/__tests__/input-number.test.tsx @@ -1,9 +1,10 @@ -import { fireEvent, render, screen } from '@tachybase/test/client'; import React from 'react'; -import { formatNumberWithSeparator, formatUnitConversion, scientificNotation } from '../ReadPretty'; +import { fireEvent, render, screen } from '@tachybase/test/client'; + import App2 from '../demos/addonBefore&addonAfter'; import App3 from '../demos/highPrecisionDecimals'; import App1 from '../demos/inputNumber'; +import { formatNumberWithSeparator, formatUnitConversion, scientificNotation } from '../ReadPretty'; describe('InputNumber', () => { it('should display the title', () => { diff --git a/packages/core/client/src/schema-component/antd/input-number/demos/addonBefore&addonAfter.tsx b/packages/core/client/src/schema-component/antd/input-number/demos/addonBefore&addonAfter.tsx index 25949bdc8..dd4d04602 100644 --- a/packages/core/client/src/schema-component/antd/input-number/demos/addonBefore&addonAfter.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/demos/addonBefore&addonAfter.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input-number/demos/highPrecisionDecimals.tsx b/packages/core/client/src/schema-component/antd/input-number/demos/highPrecisionDecimals.tsx index 298ddb532..8af79cf9b 100644 --- a/packages/core/client/src/schema-component/antd/input-number/demos/highPrecisionDecimals.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/demos/highPrecisionDecimals.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input-number/demos/inputNumber.tsx b/packages/core/client/src/schema-component/antd/input-number/demos/inputNumber.tsx index d32d60e0c..70bd8aaf7 100644 --- a/packages/core/client/src/schema-component/antd/input-number/demos/inputNumber.tsx +++ b/packages/core/client/src/schema-component/antd/input-number/demos/inputNumber.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { InputNumber, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input/EllipsisWithTooltip.tsx b/packages/core/client/src/schema-component/antd/input/EllipsisWithTooltip.tsx index 9424ff734..d9eb2830f 100644 --- a/packages/core/client/src/schema-component/antd/input/EllipsisWithTooltip.tsx +++ b/packages/core/client/src/schema-component/antd/input/EllipsisWithTooltip.tsx @@ -1,6 +1,7 @@ -import { Popover } from 'antd'; import React, { CSSProperties, forwardRef, useImperativeHandle, useRef, useState } from 'react'; +import { Popover } from 'antd'; + const getContentWidth = (element) => { if (element) { const range = document.createRange(); diff --git a/packages/core/client/src/schema-component/antd/input/demos/input.tsx b/packages/core/client/src/schema-component/antd/input/demos/input.tsx index 1ec6a3b50..99dbc1a4c 100644 --- a/packages/core/client/src/schema-component/antd/input/demos/input.tsx +++ b/packages/core/client/src/schema-component/antd/input/demos/input.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input/demos/json.tsx b/packages/core/client/src/schema-component/antd/input/demos/json.tsx index c6dbee23c..145184b68 100644 --- a/packages/core/client/src/schema-component/antd/input/demos/json.tsx +++ b/packages/core/client/src/schema-component/antd/input/demos/json.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input/demos/textarea.tsx b/packages/core/client/src/schema-component/antd/input/demos/textarea.tsx index 944a28695..205c04382 100644 --- a/packages/core/client/src/schema-component/antd/input/demos/textarea.tsx +++ b/packages/core/client/src/schema-component/antd/input/demos/textarea.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/input/demos/url.tsx b/packages/core/client/src/schema-component/antd/input/demos/url.tsx index 7edb8f0a3..256fca587 100644 --- a/packages/core/client/src/schema-component/antd/input/demos/url.tsx +++ b/packages/core/client/src/schema-component/antd/input/demos/url.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Input, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/list/List.Designer.tsx b/packages/core/client/src/schema-component/antd/list/List.Designer.tsx index 2dfb41a52..216e40116 100644 --- a/packages/core/client/src/schema-component/antd/list/List.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/list/List.Designer.tsx @@ -1,10 +1,13 @@ +import React from 'react'; import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; -import React from 'react'; import { useTranslation } from 'react-i18next'; + import { useFormBlockContext } from '../../../block-provider'; import { useCollection_deprecated, useSortFields } from '../../../collection-manager'; +import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; import { useRecord } from '../../../record-provider'; import { GeneralSchemaDesigner, @@ -15,11 +18,10 @@ import { SchemaSettingsSelectItem, SchemaSettingsTemplate, } from '../../../schema-settings'; +import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { useSchemaTemplate } from '../../../schema-templates'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; -import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; -import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; /** * @deprecated - 已使用 SchemaSettings 替代 diff --git a/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx b/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx index 9271c29c7..287fc6c99 100644 --- a/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx +++ b/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('List', () => { diff --git a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx index c5b3e6e02..f0459854b 100644 --- a/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/markdown/Markdown.Void.Designer.tsx @@ -1,6 +1,8 @@ -import { useField } from '@tachybase/schema'; import React from 'react'; +import { useField } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { GeneralSchemaDesigner, SchemaSettingsDivider, diff --git a/packages/core/client/src/schema-component/antd/markdown/__tests__/markdown.test.tsx b/packages/core/client/src/schema-component/antd/markdown/__tests__/markdown.test.tsx index 2d6351dd6..14030d214 100644 --- a/packages/core/client/src/schema-component/antd/markdown/__tests__/markdown.test.tsx +++ b/packages/core/client/src/schema-component/antd/markdown/__tests__/markdown.test.tsx @@ -1,5 +1,6 @@ -import { act, fireEvent, render } from '@tachybase/test/client'; import React from 'react'; +import { act, fireEvent, render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/markdown/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/markdown/demos/demo1.tsx index 6d1eda0c4..212ed6b17 100644 --- a/packages/core/client/src/schema-component/antd/markdown/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/markdown/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: Markdown */ -import { FormItem } from '@tachybase/components'; -import { Markdown, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Markdown, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/markdown/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/markdown/demos/demo2.tsx index 3f5f44ed6..35e9329db 100644 --- a/packages/core/client/src/schema-component/antd/markdown/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/markdown/demos/demo2.tsx @@ -1,11 +1,12 @@ /** * title: Markdown.Void */ +import React from 'react'; +import { Markdown, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import { FormItem } from '@tachybase/components'; import { observer, useField } from '@tachybase/schema'; -import { Markdown, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; + import { Button } from 'antd'; -import React from 'react'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/markdown/md.ts b/packages/core/client/src/schema-component/antd/markdown/md.ts index 18cba1ed5..925212504 100644 --- a/packages/core/client/src/schema-component/antd/markdown/md.ts +++ b/packages/core/client/src/schema-component/antd/markdown/md.ts @@ -1,5 +1,6 @@ import MarkdownIt from 'markdown-it'; import markdownItHighlightjs from 'markdown-it-highlightjs'; + import mermaidPlugin from './markdown-it-plugins/mermaidPlugin'; const md = new MarkdownIt({ diff --git a/packages/core/client/src/schema-component/antd/markdown/style.ts b/packages/core/client/src/schema-component/antd/markdown/style.ts index 7377d70d5..4fc2a8d61 100644 --- a/packages/core/client/src/schema-component/antd/markdown/style.ts +++ b/packages/core/client/src/schema-component/antd/markdown/style.ts @@ -1,4 +1,5 @@ import { TinyColor } from '@ctrl/tinycolor'; + import { genStyleHook } from './../__builtins__'; export const useStyles = genStyleHook('nb-markdown', (token, { isDarkTheme }) => { @@ -34,13 +35,15 @@ export const useStyles = genStyleHook('nb-markdown', (token, { isDarkTheme }) => '.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag': { fontWeight: 700, }, - '.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type': { - color: '#800', - }, + '.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type': + { + color: '#800', + }, '.hljs-section,.hljs-title': { color: '#800', fontWeight: 700 }, - '.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable': { - color: '#ab5656', - }, + '.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable': + { + color: '#ab5656', + }, '.hljs-literal': { color: '#695' }, '.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code': { color: '#397300', @@ -88,15 +91,17 @@ export const useStyles = genStyleHook('nb-markdown', (token, { isDarkTheme }) => borderRadius: token.borderRadiusSM, }, '.hljs': { color: '#adbac7', background: '#22272e' }, - '.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_': { - color: '#f47067', - }, + '.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_': + { + color: '#f47067', + }, '.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_': { color: '#dcbdfb', }, - '.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable': { - color: '#6cb6ff', - }, + '.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable': + { + color: '#6cb6ff', + }, '.hljs-meta .hljs-string,.hljs-regexp,.hljs-string': { color: '#96d0ff' }, '.hljs-built_in,.hljs-symbol': { color: '#f69d50' }, '.hljs-code,.hljs-comment,.hljs-formula': { color: '#768390' }, diff --git a/packages/core/client/src/schema-component/antd/menu/__tests__/menu.test.tsx b/packages/core/client/src/schema-component/antd/menu/__tests__/menu.test.tsx index aeac30ebc..da784ee76 100644 --- a/packages/core/client/src/schema-component/antd/menu/__tests__/menu.test.tsx +++ b/packages/core/client/src/schema-component/antd/menu/__tests__/menu.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent, waitFor, within } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent, waitFor, within } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/menu/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/menu/demos/demo1.tsx index 514807dc4..09f972565 100644 --- a/packages/core/client/src/schema-component/antd/menu/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/menu/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: Menu */ -import { ISchema } from '@tachybase/schema'; -import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/menu/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/menu/demos/demo2.tsx index 1b37610ef..931ca7225 100644 --- a/packages/core/client/src/schema-component/antd/menu/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/menu/demos/demo2.tsx @@ -1,9 +1,9 @@ /** * title: Menu */ -import { ISchema } from '@tachybase/schema'; -import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/menu/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/menu/demos/demo3.tsx index 285784d1f..ac685e17b 100644 --- a/packages/core/client/src/schema-component/antd/menu/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/menu/demos/demo3.tsx @@ -1,10 +1,11 @@ /** * title: Menu */ -import { ISchema } from '@tachybase/schema'; -import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; -import { Layout } from 'antd'; import React, { useRef } from 'react'; +import { Application, Menu, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; + +import { Layout } from 'antd'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/page/FixedBlockDesignerItem.tsx b/packages/core/client/src/schema-component/antd/page/FixedBlockDesignerItem.tsx index 6dea71ff8..738bdb1bf 100644 --- a/packages/core/client/src/schema-component/antd/page/FixedBlockDesignerItem.tsx +++ b/packages/core/client/src/schema-component/antd/page/FixedBlockDesignerItem.tsx @@ -1,11 +1,13 @@ -import { useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; -import { useDesignable } from '../../hooks'; -import { useIsBlockInPage } from './hooks/useIsBlockInPage'; -import { SchemaSettingsSwitchItem } from '../../../schema-settings'; + import { useBlockRequestContext } from '../../../block-provider/BlockProvider'; +import { SchemaSettingsSwitchItem } from '../../../schema-settings'; +import { useDesignable } from '../../hooks'; import { useFixedBlock } from './FixedBlock'; +import { useIsBlockInPage } from './hooks/useIsBlockInPage'; export const FixedBlockDesignerItem = () => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx b/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx index 48ea1ff06..0a89d945a 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.Settings.tsx @@ -1,5 +1,7 @@ -import { useTranslation } from 'react-i18next'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import { useTranslation } from 'react-i18next'; + import { useDesignable } from '../..'; import { SchemaSettings } from '../../../application/schema-settings'; import { useSchemaToolbar } from '../../../application/schema-toolbar'; diff --git a/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx b/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx index b0de0f3a2..f1bf3cb87 100644 --- a/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx +++ b/packages/core/client/src/schema-component/antd/page/PageTab.Settings.tsx @@ -1,9 +1,11 @@ +import { ISchema } from '@tachybase/schema'; + import { App } from 'antd'; import { useTranslation } from 'react-i18next'; -import { ISchema } from '@tachybase/schema'; -import { useDesignable } from '../../hooks'; -import { useSchemaToolbar } from '../../../application/schema-toolbar'; + import { SchemaSettings } from '../../../application/schema-settings/SchemaSettings'; +import { useSchemaToolbar } from '../../../application/schema-toolbar'; +import { useDesignable } from '../../hooks'; /** * @deprecated diff --git a/packages/core/client/src/schema-component/antd/page/PageTabDesigner.tsx b/packages/core/client/src/schema-component/antd/page/PageTabDesigner.tsx index a0304f840..0d91282b7 100644 --- a/packages/core/client/src/schema-component/antd/page/PageTabDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/page/PageTabDesigner.tsx @@ -1,7 +1,9 @@ -import { DragOutlined } from '@ant-design/icons'; -import { useFieldSchema } from '@tachybase/schema'; -import { Space } from 'antd'; import React from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + +import { DragOutlined } from '@ant-design/icons'; +import { Space } from 'antd'; + import { DragHandler, useDesignable } from '../..'; import { useSchemaSettingsRender } from '../../../application/schema-settings/hooks'; import { SchemaToolbarProvider } from '../../../application/schema-toolbar/context'; diff --git a/packages/core/client/src/schema-component/antd/page/hooks/useIsBlockInPage.ts b/packages/core/client/src/schema-component/antd/page/hooks/useIsBlockInPage.ts index 1d7b3a55f..2dcc8d9e8 100644 --- a/packages/core/client/src/schema-component/antd/page/hooks/useIsBlockInPage.ts +++ b/packages/core/client/src/schema-component/antd/page/hooks/useIsBlockInPage.ts @@ -1,4 +1,5 @@ import { useCallback } from 'react'; + import { useActionContext } from '../../action'; /** diff --git a/packages/core/client/src/schema-component/antd/pagination/index.tsx b/packages/core/client/src/schema-component/antd/pagination/index.tsx index d153dfeeb..370743eab 100644 --- a/packages/core/client/src/schema-component/antd/pagination/index.tsx +++ b/packages/core/client/src/schema-component/antd/pagination/index.tsx @@ -1,8 +1,10 @@ -import { observer } from '@tachybase/schema'; -import { Pagination as AntdPagination } from 'antd'; import React, { KeyboardEventHandler } from 'react'; -import { useProps } from '../../hooks/useProps'; +import { observer } from '@tachybase/schema'; + +import { Pagination as AntdPagination } from 'antd'; + import { withDynamicSchemaProps } from '../../../application/hoc/withDynamicSchemaProps'; +import { useProps } from '../../hooks/useProps'; export const Pagination = withDynamicSchemaProps( observer( diff --git a/packages/core/client/src/schema-component/antd/password/Password.tsx b/packages/core/client/src/schema-component/antd/password/Password.tsx index 9c4efdae0..080c2dc9a 100644 --- a/packages/core/client/src/schema-component/antd/password/Password.tsx +++ b/packages/core/client/src/schema-component/antd/password/Password.tsx @@ -1,7 +1,9 @@ +import React from 'react'; import { connect, mapReadPretty } from '@tachybase/schema'; + import { Input } from 'antd'; import { PasswordProps } from 'antd/es/input'; -import React from 'react'; + import { PasswordStrength } from './PasswordStrength'; export interface IPasswordProps extends PasswordProps { diff --git a/packages/core/client/src/schema-component/antd/password/PasswordStrength.tsx b/packages/core/client/src/schema-component/antd/password/PasswordStrength.tsx index 8c4d4659c..349b7a496 100644 --- a/packages/core/client/src/schema-component/antd/password/PasswordStrength.tsx +++ b/packages/core/client/src/schema-component/antd/password/PasswordStrength.tsx @@ -1,5 +1,6 @@ -import { isFn } from '@tachybase/schema'; import React, { Fragment } from 'react'; +import { isFn } from '@tachybase/schema'; + import { getStrength } from './utils'; type ReactRenderPropsChildren = React.ReactNode | ((props: T) => React.ReactElement); diff --git a/packages/core/client/src/schema-component/antd/password/__tests__/password.test.tsx b/packages/core/client/src/schema-component/antd/password/__tests__/password.test.tsx index 2721d895e..3e59b9f82 100644 --- a/packages/core/client/src/schema-component/antd/password/__tests__/password.test.tsx +++ b/packages/core/client/src/schema-component/antd/password/__tests__/password.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/password/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/password/demos/demo1.tsx index d110fb276..5c9ed34cb 100644 --- a/packages/core/client/src/schema-component/antd/password/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/password/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: Password */ -import { FormItem } from '@tachybase/components'; -import { Password, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Password, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/password/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/password/demos/demo2.tsx index 7986d71e7..4b88d2cad 100644 --- a/packages/core/client/src/schema-component/antd/password/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/password/demos/demo2.tsx @@ -1,9 +1,9 @@ /** * title: Check strength */ -import { FormItem } from '@tachybase/components'; -import { Password, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Password, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/percent/Percent.tsx b/packages/core/client/src/schema-component/antd/percent/Percent.tsx index 5991c3cbd..f684e8f86 100644 --- a/packages/core/client/src/schema-component/antd/percent/Percent.tsx +++ b/packages/core/client/src/schema-component/antd/percent/Percent.tsx @@ -1,8 +1,9 @@ -import { connect, mapReadPretty } from '@tachybase/schema'; -import { isNum } from '@tachybase/schema'; +import React, { useMemo } from 'react'; +import { connect, isNum, mapReadPretty } from '@tachybase/schema'; + import { InputNumber } from 'antd'; import * as math from 'mathjs'; -import React, { useMemo } from 'react'; + import { ReadPretty } from '../input-number/ReadPretty'; const isNumberLike = (index: any): index is number => isNum(index) || /^-?\d+(\.\d+)?$/.test(index); diff --git a/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx b/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx index c91337c91..89b7ad300 100644 --- a/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx +++ b/packages/core/client/src/schema-component/antd/percent/__tests__/percent.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render } from '@tachybase/test/client'; + import App from '../demos/percent'; describe('Percent', () => { diff --git a/packages/core/client/src/schema-component/antd/percent/demos/percent.tsx b/packages/core/client/src/schema-component/antd/percent/demos/percent.tsx index ac046e31b..c4208aa6c 100644 --- a/packages/core/client/src/schema-component/antd/percent/demos/percent.tsx +++ b/packages/core/client/src/schema-component/antd/percent/demos/percent.tsx @@ -1,6 +1,6 @@ -import { FormItem } from '@tachybase/components'; -import { Percent, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Percent, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/preview/Preview.tsx b/packages/core/client/src/schema-component/antd/preview/Preview.tsx index 742c866f6..4b42d8ac8 100644 --- a/packages/core/client/src/schema-component/antd/preview/Preview.tsx +++ b/packages/core/client/src/schema-component/antd/preview/Preview.tsx @@ -1,12 +1,15 @@ -import { DeleteOutlined, DownloadOutlined, PlusOutlined } from '@ant-design/icons'; +import React, { useEffect, useRef, useState } from 'react'; import { connect, mapReadPretty } from '@tachybase/schema'; + +import { DeleteOutlined, DownloadOutlined, PlusOutlined } from '@ant-design/icons'; import { Upload as AntdUpload, Button, Progress, Space, UploadFile } from 'antd'; import cls from 'classnames'; import { saveAs } from 'file-saver'; -import React, { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import Lightbox from 'react-image-lightbox'; + import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app + import { ReadPretty } from '../upload/ReadPretty'; import { isImage, toFileList, useUploadProps } from '../upload/shared'; import { useStyles } from '../upload/style'; diff --git a/packages/core/client/src/schema-component/antd/preview/__tests__/preview.test.tsx b/packages/core/client/src/schema-component/antd/preview/__tests__/preview.test.tsx index 3b850e564..5b277cda0 100644 --- a/packages/core/client/src/schema-component/antd/preview/__tests__/preview.test.tsx +++ b/packages/core/client/src/schema-component/antd/preview/__tests__/preview.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('Preview', () => { diff --git a/packages/core/client/src/schema-component/antd/radio/Radio.tsx b/packages/core/client/src/schema-component/antd/radio/Radio.tsx index 7b4d3a8e5..522db55fa 100644 --- a/packages/core/client/src/schema-component/antd/radio/Radio.tsx +++ b/packages/core/client/src/schema-component/antd/radio/Radio.tsx @@ -1,8 +1,9 @@ -import { connect, mapProps, mapReadPretty, useField } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; +import React, { useEffect, useState } from 'react'; +import { connect, isValid, mapProps, mapReadPretty, useField } from '@tachybase/schema'; + import { Radio as AntdRadio, Tag } from 'antd'; import type { RadioGroupProps, RadioProps } from 'antd/es/radio'; -import React, { useState, useEffect } from 'react'; + import { useCollectionField } from '../../../data-source/collection-field/CollectionFieldProvider'; type ComposedRadio = React.FC & { diff --git a/packages/core/client/src/schema-component/antd/radio/__tests__/radio.test.tsx b/packages/core/client/src/schema-component/antd/radio/__tests__/radio.test.tsx index 69448c743..bf3c41132 100644 --- a/packages/core/client/src/schema-component/antd/radio/__tests__/radio.test.tsx +++ b/packages/core/client/src/schema-component/antd/radio/__tests__/radio.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/radio/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/radio/demos/demo1.tsx index 1d2d52f70..931f309c8 100644 --- a/packages/core/client/src/schema-component/antd/radio/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/radio/demos/demo1.tsx @@ -2,9 +2,9 @@ * title: Basic * desc: The simplest use. */ -import { FormItem } from '@tachybase/components'; -import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/radio/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/radio/demos/demo2.tsx index 5d8ea7408..b3dbd3d5a 100644 --- a/packages/core/client/src/schema-component/antd/radio/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/radio/demos/demo2.tsx @@ -2,9 +2,9 @@ * title: Radio Group * desc: A group of radio components. */ -import { FormItem } from '@tachybase/components'; -import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/radio/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/radio/demos/demo3.tsx index 154928e04..132806e8c 100644 --- a/packages/core/client/src/schema-component/antd/radio/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/radio/demos/demo3.tsx @@ -1,9 +1,9 @@ /** * title: Radio Group with color */ -import { FormItem } from '@tachybase/components'; -import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { Radio, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx index b4d8dd2d6..dc5c74853 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx @@ -1,8 +1,9 @@ -import { ArrayField } from '@tachybase/schema'; -import { RecursionField, useField, useFieldSchema } from '@tachybase/schema'; +import React, { createContext, useContext, useEffect, useState } from 'react'; +import { ArrayField, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + import { Select } from 'antd'; import { differenceBy, unionBy } from 'lodash'; -import React, { createContext, useContext, useEffect, useState } from 'react'; + import { TableSelectorParamsProvider, useTableSelectorProps as useTsp, diff --git a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx index 80436057b..689ba7317 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx @@ -1,6 +1,6 @@ -import { observer, RecursionField, useFieldSchema } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; import React, { Fragment, useRef, useState } from 'react'; +import { observer, RecursionField, toArr, useFieldSchema } from '@tachybase/schema'; + import { WithoutTableFieldResource } from '../../../block-provider'; // TODO: 不要使用 '../../../block-provider' 这个路径引用 BlockAssociationContext,在 Vitest 中会报错,待修复 import { BlockAssociationContext } from '../../../block-provider/BlockProvider'; diff --git a/packages/core/client/src/schema-component/antd/record-picker/RecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/RecordPicker.tsx index 4fcba06bd..0610f302a 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/RecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/RecordPicker.tsx @@ -1,4 +1,5 @@ import { connect, mapReadPretty } from '@tachybase/schema'; + import { InputRecordPicker } from './InputRecordPicker'; import { ReadPrettyRecordPicker } from './ReadPrettyRecordPicker'; diff --git a/packages/core/client/src/schema-component/antd/record-picker/__tests__/record-picker.test.tsx b/packages/core/client/src/schema-component/antd/record-picker/__tests__/record-picker.test.tsx index 60544fae3..7624d7c59 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/__tests__/record-picker.test.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/__tests__/record-picker.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent, waitFor, within } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent, waitFor, within } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe.skip('RecordPicker', () => { diff --git a/packages/core/client/src/schema-component/antd/record-picker/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/record-picker/demos/demo1.tsx index 435a02080..e242faa84 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/demos/demo1.tsx @@ -1,11 +1,11 @@ /** * title: 勾选 */ -import { ISchema } from '@tachybase/schema'; +import React from 'react'; import { - APIClientProvider, Action, ActionBar, + APIClientProvider, Application, BlockItem, CollectionField, @@ -18,7 +18,8 @@ import { TableSelectorProvider, TableV2, } from '@tachybase/client'; -import React from 'react'; +import { ISchema } from '@tachybase/schema'; + import { mockAPIClient } from '../../../../testUtils'; import data from './mockData'; diff --git a/packages/core/client/src/schema-component/antd/record-picker/util.ts b/packages/core/client/src/schema-component/antd/record-picker/util.ts index 36650b191..35b2bcd05 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/util.ts +++ b/packages/core/client/src/schema-component/antd/record-picker/util.ts @@ -1,8 +1,9 @@ -import { ISchema } from '@tachybase/schema'; -import { isArr } from '@tachybase/schema'; -import { dayjs, getDefaultFormat, str2moment } from '@tachybase/utils/client'; -import { Tag } from 'antd'; import React from 'react'; +import { isArr, ISchema } from '@tachybase/schema'; +import { dayjs, getDefaultFormat, str2moment } from '@tachybase/utils/client'; + +import { Tag } from 'antd'; + import { CollectionFieldOptions_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; export const useLabelUiSchema = (collectionField: CollectionFieldOptions_deprecated, label: string): ISchema => { diff --git a/packages/core/client/src/schema-component/antd/remote-select/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/remote-select/ReadPretty.tsx index 14cbefa1b..24055b615 100644 --- a/packages/core/client/src/schema-component/antd/remote-select/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/remote-select/ReadPretty.tsx @@ -1,9 +1,10 @@ -import { observer, useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { observer, useField, useFieldSchema } from '@tachybase/schema'; + import { useRequest } from '../../../api-client'; import { useRecord } from '../../../record-provider'; import { useActionContext } from '../action'; -import { Select, defaultFieldNames } from '../select'; +import { defaultFieldNames, Select } from '../select'; import { getValues } from './shared'; export const ReadPretty = observer( diff --git a/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx b/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx index 2f2666496..bdde1db57 100644 --- a/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx +++ b/packages/core/client/src/schema-component/antd/remote-select/RemoteSelect.tsx @@ -1,17 +1,20 @@ -import { LoadingOutlined } from '@ant-design/icons'; +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { connect, mapProps, mapReadPretty, useFieldSchema } from '@tachybase/schema'; + +import { LoadingOutlined } from '@ant-design/icons'; import { Divider, SelectProps, Tag } from 'antd'; import dayjs from 'dayjs'; import { uniqBy } from 'lodash'; -import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + import { ResourceActionOptions, useRequest } from '../../../api-client'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; +import { useDataSourceKey } from '../../../data-source/data-source/DataSourceProvider'; +import { useDataSourceHeaders } from '../../../data-source/utils'; import { mergeFilter } from '../../../filter-provider/utils'; import { useCompile } from '../../hooks'; -import { Select, defaultFieldNames } from '../select'; +import { defaultFieldNames, Select } from '../select'; import { ReadPretty } from './ReadPretty'; -import { useDataSourceHeaders } from '../../../data-source/utils'; -import { useDataSourceKey } from '../../../data-source/data-source/DataSourceProvider'; + const EMPTY = 'N/A'; export type RemoteSelectProps

= SelectProps & { diff --git a/packages/core/client/src/schema-component/antd/remote-select/__tests__/remote-select.test.tsx b/packages/core/client/src/schema-component/antd/remote-select/__tests__/remote-select.test.tsx index 4dac36adf..2b07844f0 100644 --- a/packages/core/client/src/schema-component/antd/remote-select/__tests__/remote-select.test.tsx +++ b/packages/core/client/src/schema-component/antd/remote-select/__tests__/remote-select.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, sleep, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, sleep, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('RemoteSelect', () => { diff --git a/packages/core/client/src/schema-component/antd/remote-select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/remote-select/demos/demo1.tsx index d4060da2b..5fa4c47dc 100644 --- a/packages/core/client/src/schema-component/antd/remote-select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/remote-select/demos/demo1.tsx @@ -1,5 +1,6 @@ -import { APIClientProvider, FormProvider, RemoteSelect, SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { APIClientProvider, FormProvider, RemoteSelect, SchemaComponent } from '@tachybase/client'; + import { mockAPIClient } from '../../../../testUtils'; const { apiClient, mockRequest } = mockAPIClient(); diff --git a/packages/core/client/src/schema-component/antd/rich-text/RichText.tsx b/packages/core/client/src/schema-component/antd/rich-text/RichText.tsx index 43b27199a..f572c3932 100644 --- a/packages/core/client/src/schema-component/antd/rich-text/RichText.tsx +++ b/packages/core/client/src/schema-component/antd/rich-text/RichText.tsx @@ -1,6 +1,8 @@ -import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; import React from 'react'; +import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; + import ReactQuill from 'react-quill'; + import { isVariable } from '../../../variables/utils/isVariable'; import { ReadPretty as InputReadPretty } from '../input'; import { useStyles } from './style'; diff --git a/packages/core/client/src/schema-component/antd/rich-text/__tests__/rich-text.test.tsx b/packages/core/client/src/schema-component/antd/rich-text/__tests__/rich-text.test.tsx index 61c09eb34..21ad225dd 100644 --- a/packages/core/client/src/schema-component/antd/rich-text/__tests__/rich-text.test.tsx +++ b/packages/core/client/src/schema-component/antd/rich-text/__tests__/rich-text.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('RichText', () => { diff --git a/packages/core/client/src/schema-component/antd/rich-text/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/rich-text/demos/demo1.tsx index 334d8212d..92c477d1c 100644 --- a/packages/core/client/src/schema-component/antd/rich-text/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/rich-text/demos/demo1.tsx @@ -1,6 +1,7 @@ -import { FormItem } from '@tachybase/components'; -import { RichText, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; import React from 'react'; +import { RichText, SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + import 'react-quill/dist/quill.snow.css'; // ES6 const schema = { diff --git a/packages/core/client/src/schema-component/antd/select/FormulaSelect.tsx b/packages/core/client/src/schema-component/antd/select/FormulaSelect.tsx index 43458d716..790759884 100644 --- a/packages/core/client/src/schema-component/antd/select/FormulaSelect.tsx +++ b/packages/core/client/src/schema-component/antd/select/FormulaSelect.tsx @@ -1,14 +1,14 @@ -import { CloseCircleFilled, CloseOutlined } from '@ant-design/icons'; -import { useFieldSchema, useForm } from '@tachybase/schema'; -import { isValid, toArr } from '@tachybase/schema'; -import { isPlainObject } from '@tachybase/utils/client'; -import type { SelectProps } from 'antd'; -import { Select as AntdSelect, Empty, Spin, Tag } from 'antd'; import React, { useEffect, useMemo, useState } from 'react'; -import { FieldNames, getCurrentOptions } from './utils'; +import { isValid, toArr, useFieldSchema, useForm } from '@tachybase/schema'; +import { isPlainObject } from '@tachybase/utils/client'; + +import { CloseCircleFilled, CloseOutlined } from '@ant-design/icons'; import { useAsyncEffect } from 'ahooks'; -import { useCollection_deprecated } from '../../../collection-manager'; +import { Select as AntdSelect, Empty, Spin, Tag, type SelectProps } from 'antd'; + import { useAPIClient, useRequest } from '../../../api-client'; +import { useCollection_deprecated } from '../../../collection-manager'; +import { FieldNames, getCurrentOptions } from './utils'; type Props = SelectProps & { objectValue?: boolean; diff --git a/packages/core/client/src/schema-component/antd/select/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/select/ReadPretty.tsx index caed64497..af826609d 100644 --- a/packages/core/client/src/schema-component/antd/select/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/select/ReadPretty.tsx @@ -1,11 +1,11 @@ -import { isArrayField } from '@tachybase/schema'; -import { observer, useField } from '@tachybase/schema'; -import { isValid } from '@tachybase/schema'; -import { Tag } from 'antd'; import React from 'react'; +import { isArrayField, isValid, observer, useField } from '@tachybase/schema'; + +import { Tag } from 'antd'; + +import { useCollectionField } from '../../../data-source/collection-field/CollectionFieldProvider'; import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip'; import { defaultFieldNames, getCurrentOptions } from './utils'; -import { useCollectionField } from '../../../data-source/collection-field/CollectionFieldProvider'; export const ReadPretty = observer( (props: any) => { diff --git a/packages/core/client/src/schema-component/antd/select/Select.tsx b/packages/core/client/src/schema-component/antd/select/Select.tsx index 3a7b3f7fd..d203f88c6 100644 --- a/packages/core/client/src/schema-component/antd/select/Select.tsx +++ b/packages/core/client/src/schema-component/antd/select/Select.tsx @@ -1,13 +1,13 @@ -import { CloseCircleFilled, CloseOutlined, LoadingOutlined } from '@ant-design/icons'; -import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; -import { isValid, toArr } from '@tachybase/schema'; -import { isPlainObject } from '@tachybase/utils/client'; -import type { SelectProps } from 'antd'; -import { Select as AntdSelect, Empty, Spin, Tag } from 'antd'; import React from 'react'; -import { ReadPretty } from './ReadPretty'; -import { FieldNames, defaultFieldNames, getCurrentOptions } from './utils'; +import { connect, isValid, mapProps, mapReadPretty, toArr } from '@tachybase/schema'; +import { isPlainObject } from '@tachybase/utils/client'; + +import { CloseCircleFilled, CloseOutlined, LoadingOutlined } from '@ant-design/icons'; +import { Select as AntdSelect, Empty, Spin, Tag, type SelectProps } from 'antd'; + import FormulaSelect from './FormulaSelect'; +import { ReadPretty } from './ReadPretty'; +import { defaultFieldNames, FieldNames, getCurrentOptions } from './utils'; type Props = SelectProps & { objectValue?: boolean; diff --git a/packages/core/client/src/schema-component/antd/select/__tests__/select.test.tsx b/packages/core/client/src/schema-component/antd/select/__tests__/select.test.tsx index 6e0efe2f9..4b2c5aae1 100644 --- a/packages/core/client/src/schema-component/antd/select/__tests__/select.test.tsx +++ b/packages/core/client/src/schema-component/antd/select/__tests__/select.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/select/demos/demo1.tsx index 3189211d0..f06a0fc1b 100644 --- a/packages/core/client/src/schema-component/antd/select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/select/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: Select */ -import { FormItem } from '@tachybase/components'; -import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const dataSource = [ { diff --git a/packages/core/client/src/schema-component/antd/select/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/select/demos/demo2.tsx index e9b9707cc..10905be0b 100644 --- a/packages/core/client/src/schema-component/antd/select/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/select/demos/demo2.tsx @@ -1,9 +1,9 @@ /** * title: Select */ -import { FormItem } from '@tachybase/components'; -import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const dataSource = [ { diff --git a/packages/core/client/src/schema-component/antd/select/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/select/demos/demo3.tsx index d93e32aba..fc2057491 100644 --- a/packages/core/client/src/schema-component/antd/select/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/select/demos/demo3.tsx @@ -1,10 +1,10 @@ /** * title: Select */ +import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; import { FormItem } from '@tachybase/components'; import { ISchema } from '@tachybase/schema'; -import { SchemaComponent, SchemaComponentProvider, Select } from '@tachybase/client'; -import React from 'react'; const options = [ { diff --git a/packages/core/client/src/schema-component/antd/select/index.ts b/packages/core/client/src/schema-component/antd/select/index.ts index 7defbbaba..918776a5c 100644 --- a/packages/core/client/src/schema-component/antd/select/index.ts +++ b/packages/core/client/src/schema-component/antd/select/index.ts @@ -1,3 +1,2 @@ export * from './Select'; export * from './utils'; - diff --git a/packages/core/client/src/schema-component/antd/select/utils.ts b/packages/core/client/src/schema-component/antd/select/utils.ts index 5c29704ef..ae8103ab3 100644 --- a/packages/core/client/src/schema-component/antd/select/utils.ts +++ b/packages/core/client/src/schema-component/antd/select/utils.ts @@ -1,4 +1,5 @@ import { isPlainObject } from '@tachybase/utils/client'; + import { castArray } from 'lodash'; export interface FieldNames { diff --git a/packages/core/client/src/schema-component/antd/space/index.tsx b/packages/core/client/src/schema-component/antd/space/index.tsx index b8c575798..97b71321b 100644 --- a/packages/core/client/src/schema-component/antd/space/index.tsx +++ b/packages/core/client/src/schema-component/antd/space/index.tsx @@ -1,6 +1,7 @@ -import { useFormLayout } from '@tachybase/components'; -import { Space as AntdSpace, Divider, SpaceProps } from 'antd'; import React from 'react'; +import { useFormLayout } from '@tachybase/components'; + +import { Space as AntdSpace, Divider, SpaceProps } from 'antd'; export const Space: React.FC = (props) => { let { split } = props; diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.ActionColumnDesigner.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.ActionColumnDesigner.tsx index 19a7308e7..c949f47c3 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.ActionColumnDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.ActionColumnDesigner.tsx @@ -1,7 +1,9 @@ -import { DragOutlined } from '@ant-design/icons'; -import { useFieldSchema } from '@tachybase/schema'; -import { Space } from 'antd'; import React from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + +import { DragOutlined } from '@ant-design/icons'; +import { Space } from 'antd'; + import { useSchemaInitializerRender } from '../../../application'; import { DragHandler } from '../../../schema-component'; import { useGetAriaLabelOfDesigner } from '../../../schema-settings/hooks/useGetAriaLabelOfDesigner'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx index 523fbaf9d..343064d16 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx @@ -1,7 +1,9 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import { set } from 'lodash'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import _, { set } from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useFormBlockContext } from '../../../block-provider'; import { useCollectionManager_deprecated } from '../../../collection-manager'; import { @@ -13,15 +15,14 @@ import { SchemaSettingsSwitchItem, } from '../../../schema-settings'; import { useIsAllowToSetDefaultValue } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue'; +import { isPatternDisabled } from '../../../schema-settings/isPatternDisabled'; +import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; +import { SchemaSettingsDateFormat } from '../../../schema-settings/SchemaSettingsDateFormat'; +import { SchemaSettingsDefaultValue } from '../../../schema-settings/SchemaSettingsDefaultValue'; +import { SchemaSettingsSortingRule } from '../../../schema-settings/SchemaSettingsSortingRule'; import { useCompile, useDesignable, useFieldModeOptions } from '../../hooks'; import { useAssociationFieldContext } from '../association-field/hooks'; import { removeNullCondition } from '../filter'; -import { SchemaSettingsDefaultValue } from '../../../schema-settings/SchemaSettingsDefaultValue'; -import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; -import { isPatternDisabled } from '../../../schema-settings/isPatternDisabled'; -import { SchemaSettingsDateFormat } from '../../../schema-settings/SchemaSettingsDateFormat'; -import { SchemaSettingsSortingRule } from '../../../schema-settings/SchemaSettingsSortingRule'; -import _ from 'lodash'; export const useLabelFields = (collectionName?: any) => { // 需要在组件顶层调用 diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.tsx index 98e2bf7b1..f0d12dcf6 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.tsx @@ -1,5 +1,5 @@ -import { useField } from '@tachybase/schema'; import React from 'react'; +import { useField } from '@tachybase/schema'; export const TableColumn = (props) => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Designer.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Designer.tsx index 0fadf360b..20e2aaf0c 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Designer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner, SchemaSettingsRemove } from '../../../schema-settings'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Index.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Index.tsx index 47b14329d..4800ff944 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.Index.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useRecordIndex } from '../../../record-provider'; export const TableIndex = (props) => { diff --git a/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx b/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx index 6754d992c..fd5380b4d 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/TableBlockDesigner.tsx @@ -1,13 +1,16 @@ -import { ArrayItems } from '@tachybase/components'; -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import { Field } from '@tachybase/schema'; import React, { useCallback } from 'react'; +import { ArrayItems } from '@tachybase/components'; +import { Field, ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + +import { useCompile } from '../../'; import { useAPIClient } from '../../../api-client'; import { useFormBlockContext, useTableBlockContext } from '../../../block-provider'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../collection-manager'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { useSortFields } from '../../../collection-manager/action-hooks'; import { FilterBlockType, mergeFilter } from '../../../filter-provider/utils'; +import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; import { useRecord } from '../../../record-provider'; import { GeneralSchemaDesigner, @@ -20,13 +23,11 @@ import { SchemaSettingsSwitchItem, SchemaSettingsTemplate, } from '../../../schema-settings'; +import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { useSchemaTemplate } from '../../../schema-templates'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; -import { useCompile } from '../../'; -import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; import { FixedBlockDesignerItem } from '../page/FixedBlockDesignerItem'; -import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; export const EditSortField = () => { const { fields } = useCollection_deprecated(); diff --git a/packages/core/client/src/schema-component/antd/table-v2/TableField.tsx b/packages/core/client/src/schema-component/antd/table-v2/TableField.tsx index 597885705..ade6f0515 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/TableField.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/TableField.tsx @@ -1,6 +1,6 @@ -import { Field } from '@tachybase/schema'; -import { observer, useField, useFieldSchema, useForm } from '@tachybase/schema'; import React, { useEffect } from 'react'; +import { Field, observer, useField, useFieldSchema, useForm } from '@tachybase/schema'; + import { useFormBlockContext } from '../../../block-provider'; import { useCollection_deprecated } from '../../../collection-manager'; import { useCompile } from '../../hooks'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx b/packages/core/client/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx index 5feafc23b..6820b0789 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx @@ -1,14 +1,16 @@ +import React, { useContext } from 'react'; import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; -import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; + import { useFormBlockContext, useTableSelectorContext } from '../../../block-provider'; import { recursiveParent } from '../../../block-provider/TableSelectorProvider'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { useSortFields } from '../../../collection-manager/action-hooks'; +import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; import { useRecord } from '../../../record-provider'; -import { useLocalVariables, useVariables } from '../../../variables'; import { GeneralSchemaDesigner, SchemaSettingsDivider, @@ -17,13 +19,13 @@ import { SchemaSettingsSelectItem, SchemaSettingsSwitchItem, } from '../../../schema-settings'; +import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; +import { getShouldChange, VariableInput } from '../../../schema-settings/VariableInput/VariableInput'; import { useSchemaTemplate } from '../../../schema-templates'; +import { useLocalVariables, useVariables } from '../../../variables'; +import { RecordPickerContext } from '../../antd/record-picker'; import { useDesignable } from '../../hooks'; import { removeNullCondition } from '../filter'; -import { VariableInput, getShouldChange } from '../../../schema-settings/VariableInput/VariableInput'; -import { RecordPickerContext } from '../../antd/record-picker'; -import { SchemaSettingsDataScope } from '../../../schema-settings/SchemaSettingsDataScope'; -import { SetDataLoadingMode } from '../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; export const TableSelectorDesigner = () => { const { name, title } = useCollection_deprecated(); diff --git a/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx b/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx index 8c714d48c..68984f670 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx index a5415a38d..5127b11f7 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx @@ -1,7 +1,9 @@ -import { observer, RecursionField } from '@tachybase/schema'; import React from 'react'; +import { observer, RecursionField } from '@tachybase/schema'; + import { useCollectionManager_deprecated } from '../../../../collection-manager'; import { useRecord } from '../../../../record-provider'; + export const ColumnFieldProvider = observer( (props: { schema: any; basePath: any; children: any }) => { const { schema, basePath } = props; diff --git a/packages/core/client/src/schema-component/antd/table-v2/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/table-v2/demos/demo1.tsx index 79e4434e8..bd2005ee1 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/demos/demo1.tsx @@ -1,7 +1,7 @@ -import { ISchema, useForm } from '@tachybase/schema'; +import React from 'react'; import { - APIClientProvider, AntdSchemaComponentProvider, + APIClientProvider, Application, BlockSchemaComponentProvider, ExtendCollectionsProvider, @@ -10,9 +10,11 @@ import { useFormBlockContext, useTableBlockContext, } from '@tachybase/client'; +import { ISchema, useForm } from '@tachybase/schema'; + import { notification } from 'antd'; import { range } from 'lodash'; -import React from 'react'; + import { mockAPIClient } from '../../../../testUtils'; import collections from './collections'; diff --git a/packages/core/client/src/schema-component/antd/table-v2/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/table-v2/demos/demo2.tsx index 5f493d3db..071341bd3 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/demos/demo2.tsx @@ -1,8 +1,8 @@ -import { ArrayField } from '@tachybase/schema'; -import { connect, ISchema, observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; -import { SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; -import { Table, TableColumnType } from 'antd'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider } from '@tachybase/client'; +import { ArrayField, connect, ISchema, observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + +import { Table, TableColumnType } from 'antd'; const ArrayTable = observer((props: any) => { const { rowKey } = props; diff --git a/packages/core/client/src/schema-component/antd/table/Table.Array.Designer.tsx b/packages/core/client/src/schema-component/antd/table/Table.Array.Designer.tsx index 2fe52d5f3..11c85331f 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Array.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Array.Designer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { GeneralSchemaDesigner, SchemaSettingsRemove } from '../../../schema-settings'; export const TableArrayDesigner = () => { diff --git a/packages/core/client/src/schema-component/antd/table/Table.Column.Designer.tsx b/packages/core/client/src/schema-component/antd/table/Table.Column.Designer.tsx index c53c9b571..d58beb04b 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Column.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Column.Designer.tsx @@ -1,5 +1,8 @@ -import { ISchema, useField, useFieldSchema, useForm } from '@tachybase/schema'; import React from 'react'; +import { ISchema, useField, useFieldSchema, useForm } from '@tachybase/schema'; + +import _ from 'lodash'; + import { useCollectionManager_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner, @@ -10,7 +13,6 @@ import { } from '../../../schema-settings'; import { useCompile, useDesignable } from '../../hooks'; import { useActionContext } from '../action'; -import _ from 'lodash'; const useLabelFields = (collectionName?: any) => { const compile = useCompile(); diff --git a/packages/core/client/src/schema-component/antd/table/Table.Column.tsx b/packages/core/client/src/schema-component/antd/table/Table.Column.tsx index 40633081e..98ae012fa 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Column.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Column.tsx @@ -1,5 +1,5 @@ -import { useField } from '@tachybase/schema'; import React from 'react'; +import { useField } from '@tachybase/schema'; export const TableColumn = (props) => { const field = useField(); diff --git a/packages/core/client/src/schema-component/antd/table/Table.Designer.tsx b/packages/core/client/src/schema-component/antd/table/Table.Designer.tsx index 0fadf360b..20e2aaf0c 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Designer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useCollection_deprecated } from '../../../collection-manager'; import { GeneralSchemaDesigner, SchemaSettingsRemove } from '../../../schema-settings'; diff --git a/packages/core/client/src/schema-component/antd/table/Table.RowActionDesigner.tsx b/packages/core/client/src/schema-component/antd/table/Table.RowActionDesigner.tsx index bc0c01919..1e2e0dc1d 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.RowActionDesigner.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.RowActionDesigner.tsx @@ -1,7 +1,9 @@ -import { DragOutlined } from '@ant-design/icons'; -import { useFieldSchema } from '@tachybase/schema'; -import { Space } from 'antd'; import React from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + +import { DragOutlined } from '@ant-design/icons'; +import { Space } from 'antd'; + import { useSchemaInitializerRender } from '../../../application'; import { DragHandler } from '../../../schema-component'; import { useGetAriaLabelOfDesigner } from '../../../schema-settings/hooks/useGetAriaLabelOfDesigner'; diff --git a/packages/core/client/src/schema-component/antd/table/Table.RowSelection.tsx b/packages/core/client/src/schema-component/antd/table/Table.RowSelection.tsx index 51d5f40bd..5f9c99ae2 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.RowSelection.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.RowSelection.tsx @@ -1,8 +1,8 @@ -import { Field } from '@tachybase/schema'; -import { observer, useField } from '@tachybase/schema'; -import { isArr, isValid } from '@tachybase/schema'; -import { TableProps } from 'antd'; import React from 'react'; +import { Field, isArr, isValid, observer, useField } from '@tachybase/schema'; + +import { TableProps } from 'antd'; + import { TableVoid } from './Table.Void'; type Props = TableProps & { value?: any; onChange?: any; objectValue?: boolean }; diff --git a/packages/core/client/src/schema-component/antd/table/Table.Void.Designer.tsx b/packages/core/client/src/schema-component/antd/table/Table.Void.Designer.tsx index faccceed6..ab52cfb83 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Void.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Void.Designer.tsx @@ -1,7 +1,9 @@ +import React from 'react'; import { ArrayItems } from '@tachybase/components'; import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import React from 'react'; + import { useTranslation } from 'react-i18next'; + import { useCollection_deprecated, useResourceActionContext } from '../../../collection-manager'; import { useCollectionFilterOptions, useSortFields } from '../../../collection-manager/action-hooks'; import { diff --git a/packages/core/client/src/schema-component/antd/table/Table.Void.tsx b/packages/core/client/src/schema-component/antd/table/Table.Void.tsx index 6cb5d662d..763ea57f5 100644 --- a/packages/core/client/src/schema-component/antd/table/Table.Void.tsx +++ b/packages/core/client/src/schema-component/antd/table/Table.Void.tsx @@ -1,9 +1,10 @@ -import { createForm, Field } from '@tachybase/schema'; -import { FieldContext, FormContext, observer, useField, useFieldSchema } from '@tachybase/schema'; +import React, { useMemo } from 'react'; +import { createForm, Field, FieldContext, FormContext, observer, useField, useFieldSchema } from '@tachybase/schema'; + import { Options, Result } from 'ahooks/es/useRequest/src/types'; import { TablePaginationConfig, TableProps } from 'antd'; import { cloneDeep } from 'lodash'; -import React, { useMemo } from 'react'; + import { AsyncDataProvider, useAsyncData, useRequest } from '../../../'; import { useAttach } from '../../hooks'; import { TableArray } from './Table.Array'; diff --git a/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx b/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx index 104c6e592..6b329e08c 100644 --- a/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx +++ b/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; import App3 from '../demos/demo3'; diff --git a/packages/core/client/src/schema-component/antd/table/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/table/demos/demo1.tsx index 14546aec4..cd2244f43 100644 --- a/packages/core/client/src/schema-component/antd/table/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/table/demos/demo1.tsx @@ -1,6 +1,6 @@ -import { ISchema } from '@tachybase/schema'; -import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/table/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/table/demos/demo2.tsx index 77f9cfdc9..aa60832ef 100644 --- a/packages/core/client/src/schema-component/antd/table/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/table/demos/demo2.tsx @@ -1,6 +1,6 @@ -import { ISchema } from '@tachybase/schema'; -import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/table/demos/demo3.tsx b/packages/core/client/src/schema-component/antd/table/demos/demo3.tsx index c780b4d55..c05cd630b 100644 --- a/packages/core/client/src/schema-component/antd/table/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/antd/table/demos/demo3.tsx @@ -1,6 +1,6 @@ -import { ISchema } from '@tachybase/schema'; -import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; import React from 'react'; +import { Application, Input, SchemaComponent, SchemaComponentProvider, Table } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; const schema: ISchema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/table/demos/demo4.tsx b/packages/core/client/src/schema-component/antd/table/demos/demo4.tsx index 2b646ca09..092b1e755 100644 --- a/packages/core/client/src/schema-component/antd/table/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/antd/table/demos/demo4.tsx @@ -1,5 +1,4 @@ -import { ISchema, observer } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { createContext, useContext, useState } from 'react'; import { Action, Application, @@ -10,7 +9,7 @@ import { useRecord, useRequest, } from '@tachybase/client'; -import React, { createContext, useContext, useState } from 'react'; +import { ISchema, observer, uid } from '@tachybase/schema'; const DataSourceContext = createContext(null); DataSourceContext.displayName = 'DataSourceContext'; diff --git a/packages/core/client/src/schema-component/antd/tabs/Tabs.Designer.tsx b/packages/core/client/src/schema-component/antd/tabs/Tabs.Designer.tsx index a96a0fb51..63a590242 100644 --- a/packages/core/client/src/schema-component/antd/tabs/Tabs.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/tabs/Tabs.Designer.tsx @@ -1,6 +1,8 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; import React from 'react'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useDesignable } from '../..'; import { GeneralSchemaDesigner, SchemaSettingsDivider, SchemaSettingsModalItem, SchemaSettingsRemove } from '../../../'; diff --git a/packages/core/client/src/schema-component/antd/tabs/__tests__/tabs.test.tsx b/packages/core/client/src/schema-component/antd/tabs/__tests__/tabs.test.tsx index 7b1e79d72..ab8a1e6b7 100644 --- a/packages/core/client/src/schema-component/antd/tabs/__tests__/tabs.test.tsx +++ b/packages/core/client/src/schema-component/antd/tabs/__tests__/tabs.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent, waitFor } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent, waitFor } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('Tabs', () => { diff --git a/packages/core/client/src/schema-component/antd/tabs/context.tsx b/packages/core/client/src/schema-component/antd/tabs/context.tsx index e11dddba7..bf2e3d40d 100644 --- a/packages/core/client/src/schema-component/antd/tabs/context.tsx +++ b/packages/core/client/src/schema-component/antd/tabs/context.tsx @@ -1,6 +1,7 @@ -import { TabsProps } from 'antd'; import React from 'react'; +import { TabsProps } from 'antd'; + interface TabsContextProps extends TabsProps { PaneRoot?: React.FC; } diff --git a/packages/core/client/src/schema-component/antd/tabs/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/tabs/demos/demo1.tsx index eac4fc844..982deb8a8 100644 --- a/packages/core/client/src/schema-component/antd/tabs/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/tabs/demos/demo1.tsx @@ -1,9 +1,10 @@ /** * title: Tabs */ -import { ISchema } from '@tachybase/schema'; -import { Action, Application, SchemaComponent, SchemaComponentProvider, Tabs } from '@tachybase/client'; import React from 'react'; +import { Action, Application, SchemaComponent, SchemaComponentProvider, Tabs } from '@tachybase/client'; +import { ISchema } from '@tachybase/schema'; + import { AntdSchemaComponentProvider } from '../../AntdSchemaComponentProvider'; const schema: ISchema = { diff --git a/packages/core/client/src/schema-component/antd/time-picker/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/time-picker/ReadPretty.tsx index 04b5076bc..5d023df5b 100644 --- a/packages/core/client/src/schema-component/antd/time-picker/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/time-picker/ReadPretty.tsx @@ -1,9 +1,10 @@ +import React from 'react'; import { usePrefixCls } from '@tachybase/components'; import { toArr } from '@tachybase/schema'; -import dayjs from 'dayjs'; + import { TimeRangePickerProps } from 'antd/es/time-picker'; import cls from 'classnames'; -import React from 'react'; +import dayjs from 'dayjs'; export const ReadPretty: React.FC = (props: any) => { const { value, format = 'HH:mm:ss' } = props; diff --git a/packages/core/client/src/schema-component/antd/time-picker/__tests__/time-picker.test.tsx b/packages/core/client/src/schema-component/antd/time-picker/__tests__/time-picker.test.tsx index 6fdebfb5b..ff7201e84 100644 --- a/packages/core/client/src/schema-component/antd/time-picker/__tests__/time-picker.test.tsx +++ b/packages/core/client/src/schema-component/antd/time-picker/__tests__/time-picker.test.tsx @@ -1,5 +1,6 @@ -import { fireEvent, render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { fireEvent, render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/time-picker/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/time-picker/demos/demo1.tsx index 9da28cb87..e5519a211 100644 --- a/packages/core/client/src/schema-component/antd/time-picker/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/time-picker/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: TimePicker */ -import { FormItem } from '@tachybase/components'; -import { SchemaComponent, SchemaComponentProvider, TimePicker } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, TimePicker } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/time-picker/demos/demo2.tsx b/packages/core/client/src/schema-component/antd/time-picker/demos/demo2.tsx index e5a4f4eaf..ae72560bd 100644 --- a/packages/core/client/src/schema-component/antd/time-picker/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/antd/time-picker/demos/demo2.tsx @@ -1,9 +1,9 @@ /** * title: TimePicker.RangePicker */ -import { FormItem } from '@tachybase/components'; -import { SchemaComponent, SchemaComponentProvider, TimePicker } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, TimePicker } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const schema = { type: 'object', diff --git a/packages/core/client/src/schema-component/antd/tree-select/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/tree-select/ReadPretty.tsx index 18b10e039..b2e23bd9e 100644 --- a/packages/core/client/src/schema-component/antd/tree-select/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/tree-select/ReadPretty.tsx @@ -1,11 +1,10 @@ +import React from 'react'; import { usePrefixCls } from '@tachybase/components'; -import { Field } from '@tachybase/schema'; -import { observer, useField } from '@tachybase/schema'; -import { isArr } from '@tachybase/schema'; +import { Field, isArr, observer, useField } from '@tachybase/schema'; + import { Tag } from 'antd'; import { TreeSelectProps } from 'antd/es/tree-select'; import cls from 'classnames'; -import React from 'react'; export const ReadPretty: React.FC> = observer( (props) => { diff --git a/packages/core/client/src/schema-component/antd/tree-select/TreeSelect.tsx b/packages/core/client/src/schema-component/antd/tree-select/TreeSelect.tsx index fab724e89..5b25e46eb 100644 --- a/packages/core/client/src/schema-component/antd/tree-select/TreeSelect.tsx +++ b/packages/core/client/src/schema-component/antd/tree-select/TreeSelect.tsx @@ -1,7 +1,9 @@ -import { LoadingOutlined } from '@ant-design/icons'; -import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; -import { TreeSelect as AntdTreeSelect } from 'antd'; import React from 'react'; +import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; + +import { LoadingOutlined } from '@ant-design/icons'; +import { TreeSelect as AntdTreeSelect } from 'antd'; + import { ReadPretty } from './ReadPretty'; export const TreeSelect: any = connect( diff --git a/packages/core/client/src/schema-component/antd/tree-select/__tests__/tree-select.test.tsx b/packages/core/client/src/schema-component/antd/tree-select/__tests__/tree-select.test.tsx index bc84edce4..be6ebb6ab 100644 --- a/packages/core/client/src/schema-component/antd/tree-select/__tests__/tree-select.test.tsx +++ b/packages/core/client/src/schema-component/antd/tree-select/__tests__/tree-select.test.tsx @@ -1,5 +1,6 @@ -import { render, screen, userEvent } from '@tachybase/test/client'; import React from 'react'; +import { render, screen, userEvent } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; describe('TreeSelect', () => { diff --git a/packages/core/client/src/schema-component/antd/tree-select/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/tree-select/demos/demo1.tsx index 328e7459a..0b95b6cf6 100644 --- a/packages/core/client/src/schema-component/antd/tree-select/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/tree-select/demos/demo1.tsx @@ -1,9 +1,9 @@ /** * title: TreeSelect */ -import { FormItem } from '@tachybase/components'; -import { SchemaComponent, SchemaComponentProvider, TreeSelect } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, SchemaComponentProvider, TreeSelect } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; const dataSource = [ { diff --git a/packages/core/client/src/schema-component/antd/unixTimestamp/UnixTimestamp.tsx b/packages/core/client/src/schema-component/antd/unixTimestamp/UnixTimestamp.tsx index 0e4ea7f2d..caac87400 100644 --- a/packages/core/client/src/schema-component/antd/unixTimestamp/UnixTimestamp.tsx +++ b/packages/core/client/src/schema-component/antd/unixTimestamp/UnixTimestamp.tsx @@ -1,8 +1,10 @@ -import { connect, mapReadPretty } from '@tachybase/schema'; import React, { useMemo } from 'react'; -import { DatePicker } from '../date-picker'; +import { connect, mapReadPretty } from '@tachybase/schema'; + import dayjs from 'dayjs'; +import { DatePicker } from '../date-picker'; + const toValue = (value: any, accuracy) => { if (value) { return timestampToDate(value, accuracy); diff --git a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx index b43e281b5..1957911ea 100644 --- a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx @@ -1,14 +1,15 @@ -import { DownloadOutlined } from '@ant-design/icons'; -import { Field } from '@tachybase/schema'; -import { useField } from '@tachybase/schema'; +import React, { useState } from 'react'; +import { Field, useField } from '@tachybase/schema'; import { isString } from '@tachybase/utils/client'; + +import { DownloadOutlined } from '@ant-design/icons'; import { Button, Modal, Space } from 'antd'; import useUploadStyle from 'antd/es/upload/style'; import cls from 'classnames'; import { saveAs } from 'file-saver'; -import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import Lightbox from 'react-image-lightbox'; + import { useRecord } from '../../../record-provider'; import { isImage, isPdf, toArr, toImages } from './shared'; import { useStyles } from './style'; diff --git a/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx b/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx index 29e509129..c9bca62c3 100644 --- a/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx +++ b/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; diff --git a/packages/core/client/src/schema-component/antd/upload/demos/demo1.tsx b/packages/core/client/src/schema-component/antd/upload/demos/demo1.tsx index cea100471..9c6e1d77c 100644 --- a/packages/core/client/src/schema-component/antd/upload/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/antd/upload/demos/demo1.tsx @@ -1,9 +1,10 @@ /** * title: Upload */ -import { FormItem } from '@tachybase/components'; -import { APIClientProvider, SchemaComponent, SchemaComponentProvider, Upload } from '@tachybase/client'; import React from 'react'; +import { APIClientProvider, SchemaComponent, SchemaComponentProvider, Upload } from '@tachybase/client'; +import { FormItem } from '@tachybase/components'; + import apiClient from './apiClient'; const schema = { diff --git a/packages/core/client/src/schema-component/antd/upload/type.d.ts b/packages/core/client/src/schema-component/antd/upload/type.d.ts index 49eeac02a..98fcc7c60 100644 --- a/packages/core/client/src/schema-component/antd/upload/type.d.ts +++ b/packages/core/client/src/schema-component/antd/upload/type.d.ts @@ -1,6 +1,7 @@ +import React from 'react'; + import type { DraggerProps as AntdDraggerProps, UploadProps as AntdUploadProps } from 'antd/es/upload'; import { UploadFile } from 'antd/es/upload/interface'; -import React from 'react'; export type UploadProps = Omit & { onChange?: (fileList: UploadFile[]) => void; diff --git a/packages/core/client/src/schema-component/common/dnd-context/index.tsx b/packages/core/client/src/schema-component/common/dnd-context/index.tsx index b3e17d51b..422c433f2 100644 --- a/packages/core/client/src/schema-component/common/dnd-context/index.tsx +++ b/packages/core/client/src/schema-component/common/dnd-context/index.tsx @@ -1,8 +1,10 @@ +import React, { useState } from 'react'; +import { observer } from '@tachybase/schema'; + import { DndContext as DndKitContext, DragEndEvent, DragOverlay, rectIntersection } from '@dnd-kit/core'; import { Props } from '@dnd-kit/core/dist/components/DndContext/DndContext'; -import { observer } from '@tachybase/schema'; -import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useAPIClient } from '../../../'; import { createDesignable, useDesignable } from '../../hooks'; diff --git a/packages/core/client/src/schema-component/demos/demo1.tsx b/packages/core/client/src/schema-component/demos/demo1.tsx index 9ec3277fc..5f7ab96da 100644 --- a/packages/core/client/src/schema-component/demos/demo1.tsx +++ b/packages/core/client/src/schema-component/demos/demo1.tsx @@ -2,10 +2,10 @@ * title: Insert Adjacent */ import React from 'react'; -import { SchemaComponentProvider, SchemaComponent, useDesignable } from '@tachybase/client'; -import { observer, Schema, useFieldSchema } from '@tachybase/schema'; +import { SchemaComponent, SchemaComponentProvider, useDesignable } from '@tachybase/client'; +import { observer, Schema, uid, useFieldSchema } from '@tachybase/schema'; + import { Button, Space } from 'antd'; -import { uid } from '@tachybase/schema'; const Hello = observer( (props) => { diff --git a/packages/core/client/src/schema-component/demos/demo2.tsx b/packages/core/client/src/schema-component/demos/demo2.tsx index 40fad4f51..43981dc88 100644 --- a/packages/core/client/src/schema-component/demos/demo2.tsx +++ b/packages/core/client/src/schema-component/demos/demo2.tsx @@ -1,6 +1,7 @@ -import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; + +import { Button } from 'antd'; const Test = () => { const { designable, setDesignable } = useSchemaComponentContext(); diff --git a/packages/core/client/src/schema-component/demos/demo3.tsx b/packages/core/client/src/schema-component/demos/demo3.tsx index eebe9abdf..40fd28dd1 100644 --- a/packages/core/client/src/schema-component/demos/demo3.tsx +++ b/packages/core/client/src/schema-component/demos/demo3.tsx @@ -1,6 +1,7 @@ -import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; + +import { Button } from 'antd'; const Test = () => { const { designable, setDesignable } = useSchemaComponentContext(); diff --git a/packages/core/client/src/schema-component/demos/demo4.tsx b/packages/core/client/src/schema-component/demos/demo4.tsx index 3cecda8f2..ee644ec3a 100644 --- a/packages/core/client/src/schema-component/demos/demo4.tsx +++ b/packages/core/client/src/schema-component/demos/demo4.tsx @@ -1,6 +1,7 @@ -import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaComponentProvider, useSchemaComponentContext } from '@tachybase/client'; + +import { Button } from 'antd'; const Test = () => { const { designable, setDesignable } = useSchemaComponentContext(); diff --git a/packages/core/client/src/schema-component/hooks/__tests__/designable.test.ts b/packages/core/client/src/schema-component/hooks/__tests__/designable.test.ts index fb974d8cc..84d01fd82 100644 --- a/packages/core/client/src/schema-component/hooks/__tests__/designable.test.ts +++ b/packages/core/client/src/schema-component/hooks/__tests__/designable.test.ts @@ -1,5 +1,7 @@ -import { vi } from 'vitest'; import { Schema } from '@tachybase/schema'; + +import { vi } from 'vitest'; + import { createDesignable, Designable } from '../useDesignable'; describe('createDesignable', () => { diff --git a/packages/core/client/src/schema-component/hooks/__tests__/splitWrapSchema.test.ts b/packages/core/client/src/schema-component/hooks/__tests__/splitWrapSchema.test.ts index 215c65366..bef62e76a 100644 --- a/packages/core/client/src/schema-component/hooks/__tests__/splitWrapSchema.test.ts +++ b/packages/core/client/src/schema-component/hooks/__tests__/splitWrapSchema.test.ts @@ -1,4 +1,5 @@ import { Schema } from '@tachybase/schema'; + import { splitWrapSchema } from '../useDesignable'; describe('splitWrapSchema', () => { diff --git a/packages/core/client/src/schema-component/hooks/useAttach.ts b/packages/core/client/src/schema-component/hooks/useAttach.ts index fb5b55c86..335a950d2 100644 --- a/packages/core/client/src/schema-component/hooks/useAttach.ts +++ b/packages/core/client/src/schema-component/hooks/useAttach.ts @@ -1,4 +1,4 @@ -import { useRef, useEffect } from 'react'; +import { useEffect, useRef } from 'react'; interface IRecycleTarget { onMount: () => void; diff --git a/packages/core/client/src/schema-component/hooks/useComponent.ts b/packages/core/client/src/schema-component/hooks/useComponent.ts index a215ecaae..a3644c0b3 100644 --- a/packages/core/client/src/schema-component/hooks/useComponent.ts +++ b/packages/core/client/src/schema-component/hooks/useComponent.ts @@ -1,6 +1,7 @@ -import { SchemaOptionsContext } from '@tachybase/schema'; -import { get } from 'lodash'; import { useContext } from 'react'; +import { SchemaOptionsContext } from '@tachybase/schema'; + +import { get } from 'lodash'; export const useComponent = (component: any, defaults?: any) => { const { components } = useContext(SchemaOptionsContext); diff --git a/packages/core/client/src/schema-component/hooks/useFieldComponentOptions.ts b/packages/core/client/src/schema-component/hooks/useFieldComponentOptions.ts index 2db716c8c..5cd5ad87a 100644 --- a/packages/core/client/src/schema-component/hooks/useFieldComponentOptions.ts +++ b/packages/core/client/src/schema-component/hooks/useFieldComponentOptions.ts @@ -1,6 +1,8 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useMemo } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../../collection-manager'; export const useFieldComponentOptions = () => { diff --git a/packages/core/client/src/schema-component/hooks/useFieldTitle.ts b/packages/core/client/src/schema-component/hooks/useFieldTitle.ts index 9a71c58ed..2d24adff2 100644 --- a/packages/core/client/src/schema-component/hooks/useFieldTitle.ts +++ b/packages/core/client/src/schema-component/hooks/useFieldTitle.ts @@ -1,8 +1,8 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; import { useEffect } from 'react'; -import { useCompile } from './useCompile'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../../collection-manager'; +import { useCompile } from './useCompile'; export const useFieldTitle = () => { const field = useField(); diff --git a/packages/core/client/src/schema-component/hooks/useTableSize.ts b/packages/core/client/src/schema-component/hooks/useTableSize.ts index 4b9b02153..5d0830feb 100644 --- a/packages/core/client/src/schema-component/hooks/useTableSize.ts +++ b/packages/core/client/src/schema-component/hooks/useTableSize.ts @@ -1,5 +1,7 @@ -import { useEventListener } from 'ahooks'; import { useCallback, useRef, useState } from 'react'; + +import { useEventListener } from 'ahooks'; + export const useTableSize = () => { const [height, setTableHeight] = useState(0); const [width, setTableWidth] = useState(0); diff --git a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx index e224dd872..22030e4bc 100644 --- a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx @@ -1,9 +1,11 @@ import React from 'react'; + import { useTranslation } from 'react-i18next'; + +import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; +import { SchemaInitializerChildren } from '../../application/schema-initializer/components/SchemaInitializerChildren'; import { useCompile } from '../../schema-component'; import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from '../utils'; -import { SchemaInitializerChildren } from '../../application/schema-initializer/components/SchemaInitializerChildren'; -import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; // 表单里配置字段 const ParentCollectionFields = () => { diff --git a/packages/core/client/src/schema-initializer/buttons/FormItemInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/FormItemInitializers.tsx index 93183b9ca..1c6239006 100644 --- a/packages/core/client/src/schema-initializer/buttons/FormItemInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/FormItemInitializers.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { useTranslation } from 'react-i18next'; + import { SchemaInitializerChildren } from '../../application'; import { useCompile } from '../../schema-component'; import { diff --git a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx index 135db5de5..da2446ad6 100644 --- a/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/RecordBlockInitializers.tsx @@ -1,9 +1,10 @@ -import { Schema } from '@tachybase/schema'; import { useCallback, useMemo } from 'react'; +import { Schema } from '@tachybase/schema'; + import { useCollection, - useCollectionManager_deprecated, useCollection_deprecated, + useCollectionManager_deprecated, useCreateAssociationDetailsBlock, useCreateAssociationDetailsWithoutPagination, useCreateAssociationFormBlock, @@ -16,11 +17,10 @@ import { } from '../..'; import { CompatibleSchemaInitializer } from '../../application/schema-initializer/CompatibleSchemaInitializer'; import { useCreateDetailsBlock } from '../../modules/blocks/data-blocks/details-multi/DetailsBlockInitializer'; - -import { gridRowColWrap } from '../utils'; import { useCreateSingleDetailsSchema } from '../../modules/blocks/data-blocks/details-single/RecordReadPrettyFormBlockInitializer'; import { useCreateGridCardBlock } from '../../modules/blocks/data-blocks/grid-card/GridCardBlockInitializer'; import { useCreateListBlock } from '../../modules/blocks/data-blocks/list/ListBlockInitializer'; +import { gridRowColWrap } from '../utils'; const recursiveParent = (schema: Schema) => { if (!schema) return null; diff --git a/packages/core/client/src/schema-initializer/components/DeletedField.tsx b/packages/core/client/src/schema-initializer/components/DeletedField.tsx index ba341eb15..68f7ec940 100644 --- a/packages/core/client/src/schema-initializer/components/DeletedField.tsx +++ b/packages/core/client/src/schema-initializer/components/DeletedField.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { useTranslation } from 'react-i18next'; export const DeletedField = () => { diff --git a/packages/core/client/src/schema-initializer/demos/build-type.tsx b/packages/core/client/src/schema-initializer/demos/build-type.tsx index 662c39503..190e9afe9 100644 --- a/packages/core/client/src/schema-initializer/demos/build-type.tsx +++ b/packages/core/client/src/schema-initializer/demos/build-type.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Application, Plugin, @@ -5,7 +6,6 @@ import { SchemaInitializer, useSchemaInitializerRender, } from '@tachybase/client'; -import React from 'react'; const myInitializer = new SchemaInitializer({ name: 'myInitializer', diff --git a/packages/core/client/src/schema-initializer/demos/custom-button.tsx b/packages/core/client/src/schema-initializer/demos/custom-button.tsx index 0b8512680..d94676b1a 100644 --- a/packages/core/client/src/schema-initializer/demos/custom-button.tsx +++ b/packages/core/client/src/schema-initializer/demos/custom-button.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { Application, Plugin, SchemaInitializer, useSchemaInitializerRender } from '@tachybase/client'; + import { PlusOutlined } from '@ant-design/icons'; -import { Divider, Avatar, AvatarProps } from 'antd'; +import { Avatar, AvatarProps, Divider } from 'antd'; const myInitializer = new SchemaInitializer({ name: 'myInitializer', diff --git a/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx b/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx index 9f67070fc..48196a637 100644 --- a/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx +++ b/packages/core/client/src/schema-initializer/demos/custom-items-component.tsx @@ -6,6 +6,7 @@ import { SchemaInitializerItemsProps, useSchemaInitializerRender, } from '@tachybase/client'; + import { ButtonProps, Card, Divider, List, ListProps, Menu, MenuProps } from 'antd'; // 自定义 Items 渲染为 Menu diff --git a/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx b/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx index 97e760e2f..b9fac98f6 100644 --- a/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx +++ b/packages/core/client/src/schema-initializer/demos/dynamic-visible-children.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Application, Plugin, @@ -5,7 +6,6 @@ import { SchemaInitializer, useSchemaInitializerRender, } from '@tachybase/client'; -import React from 'react'; const myInitializer = new SchemaInitializer({ name: 'myInitializer', diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx index 9db4ab67c..69c26465e 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-action.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Action, ActionBar, @@ -9,7 +10,6 @@ import { SchemaInitializer, useApp, } from '@tachybase/client'; -import React from 'react'; const addActionInitializer = new SchemaInitializer({ name: 'addAction', diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx index 4115d1498..051dbe83e 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-basic.tsx @@ -9,8 +9,7 @@ import { useSchemaInitializerItem, useSchemaInitializerRender, } from '@tachybase/client'; -import { observer, useField } from '@tachybase/schema'; -import { Field } from '@tachybase/schema'; +import { Field, observer, useField } from '@tachybase/schema'; const Hello = observer(() => { const field = useField(); diff --git a/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx b/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx index 4fb055097..20e18e105 100644 --- a/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx +++ b/packages/core/client/src/schema-initializer/demos/insert-schema-form-item.tsx @@ -1,3 +1,4 @@ +import React, { FC } from 'react'; import { Application, CollectionFieldInitializer, @@ -15,7 +16,6 @@ import { useSchemaInitializerItem, useSchemaInitializerRender, } from '@tachybase/client'; -import React, { FC } from 'react'; const useFormItemInitializerFields = () => { return [ diff --git a/packages/core/client/src/schema-initializer/demos/nested-items.tsx b/packages/core/client/src/schema-initializer/demos/nested-items.tsx index 0eb219fa6..5cf701913 100644 --- a/packages/core/client/src/schema-initializer/demos/nested-items.tsx +++ b/packages/core/client/src/schema-initializer/demos/nested-items.tsx @@ -3,12 +3,13 @@ import { Application, Plugin, SchemaInitializer, - SchemaInitializerItemType, - SchemaInitializerChildren, - useSchemaInitializerItem, SchemaInitializerChild, + SchemaInitializerChildren, + SchemaInitializerItemType, + useSchemaInitializerItem, useSchemaInitializerRender, } from '@tachybase/client'; + import { Divider, Menu } from 'antd'; // TODO:这里要加上 Context diff --git a/packages/core/client/src/schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer.ts b/packages/core/client/src/schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer.ts index 78623065a..89e1a083c 100644 --- a/packages/core/client/src/schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer.ts +++ b/packages/core/client/src/schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated } from '../../collection-manager'; /** diff --git a/packages/core/client/src/schema-initializer/items/ActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/ActionInitializer.tsx index 61bbd311c..1046e62ad 100644 --- a/packages/core/client/src/schema-initializer/items/ActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/ActionInitializer.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { InitializerWithSwitch } from './InitializerWithSwitch'; import { useSchemaInitializerItem } from '../../application'; +import { InitializerWithSwitch } from './InitializerWithSwitch'; export const ActionInitializer = (props) => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/core/client/src/schema-initializer/items/BlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/BlockInitializer.tsx index b8284152a..3f68f43d7 100644 --- a/packages/core/client/src/schema-initializer/items/BlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/BlockInitializer.tsx @@ -1,5 +1,6 @@ -import { merge } from '@tachybase/schema'; import React from 'react'; +import { merge } from '@tachybase/schema'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; // Block diff --git a/packages/core/client/src/schema-initializer/items/InitializerWithSwitch.tsx b/packages/core/client/src/schema-initializer/items/InitializerWithSwitch.tsx index da517bf77..d64d7d119 100644 --- a/packages/core/client/src/schema-initializer/items/InitializerWithSwitch.tsx +++ b/packages/core/client/src/schema-initializer/items/InitializerWithSwitch.tsx @@ -1,8 +1,8 @@ -import { merge } from '@tachybase/schema'; import React from 'react'; +import { merge } from '@tachybase/schema'; -import { useCurrentSchema } from '../utils'; import { SchemaInitializerSwitch, useSchemaInitializer } from '../../application'; +import { useCurrentSchema } from '../utils'; export const InitializerWithSwitch = (props) => { const { type, schema, item, remove: passInRemove, disabled } = props; diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx index 7f3525453..763ecf653 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationBlockInitializer.tsx @@ -1,11 +1,12 @@ import React, { useCallback } from 'react'; + import { TableOutlined } from '@ant-design/icons'; +import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; +import { createTableBlockUISchema } from '../../modules/blocks/data-blocks/table/createTableBlockUISchema'; import { useSchemaTemplateManager } from '../../schema-templates'; import { useRecordCollectionDataSourceItems } from '../utils'; -import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; -import { createTableBlockUISchema } from '../../modules/blocks/data-blocks/table/createTableBlockUISchema'; /** * @deprecated diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx index 1ec34f942..6eebbf507 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationDetailsBlockInitializer.tsx @@ -1,11 +1,12 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; +import { createDetailsWithPaginationUISchema } from '../../modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema'; import { useSchemaTemplateManager } from '../../schema-templates'; import { useRecordCollectionDataSourceItems } from '../utils'; -import { createDetailsWithPaginationUISchema } from '../../modules/blocks/data-blocks/details-multi/createDetailsWithPaginationUISchema'; export const RecordAssociationDetailsBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx index a64df1e7f..d20325bb3 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationFormBlockInitializer.tsx @@ -1,6 +1,7 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback, useMemo } from 'react'; +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; import { createCreateFormBlockUISchema } from '../../modules/blocks/data-blocks/form/createCreateFormBlockUISchema'; diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx index d36a87ab9..8be5b698c 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationGridCardBlockInitializer.tsx @@ -1,11 +1,12 @@ -import { TableOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; -import { useCollectionManager_deprecated } from '../../collection-manager'; +import { TableOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; +import { useCollectionManager_deprecated } from '../../collection-manager'; +import { createGridCardBlockUISchema } from '../../modules/blocks/data-blocks/grid-card/createGridCardBlockUISchema'; import { useSchemaTemplateManager } from '../../schema-templates'; import { useRecordCollectionDataSourceItems } from '../utils'; -import { createGridCardBlockUISchema } from '../../modules/blocks/data-blocks/grid-card/createGridCardBlockUISchema'; /** * @deprecated diff --git a/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx index 377708770..0240532ee 100644 --- a/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordAssociationListBlockInitializer.tsx @@ -1,11 +1,12 @@ -import { TableOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; +import { TableOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; import { useCollectionManager_deprecated } from '../../collection-manager'; +import { createListBlockUISchema } from '../../modules/blocks/data-blocks/list/createListBlockUISchema'; import { useSchemaTemplateManager } from '../../schema-templates'; import { useRecordCollectionDataSourceItems } from '../utils'; -import { createListBlockUISchema } from '../../modules/blocks/data-blocks/list/createListBlockUISchema'; export const RecordAssociationListBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx index 9b08427b4..a9b149c09 100644 --- a/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.tsx @@ -1,11 +1,12 @@ -import { FormOutlined } from '@ant-design/icons'; import React, { useCallback } from 'react'; +import { FormOutlined } from '@ant-design/icons'; + import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '../../application'; -import { useSchemaTemplateManager } from '../../schema-templates'; -import { useRecordCollectionDataSourceItems } from '../utils'; import { useCollectionManager_deprecated } from '../../collection-manager'; import { createDetailsUISchema } from '../../modules/blocks/data-blocks/details-single/createDetailsUISchema'; +import { useSchemaTemplateManager } from '../../schema-templates'; +import { useRecordCollectionDataSourceItems } from '../utils'; /** * @deprecated diff --git a/packages/core/client/src/schema-initializer/items/SelectActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/SelectActionInitializer.tsx index a4b1b4086..c9dba9525 100644 --- a/packages/core/client/src/schema-initializer/items/SelectActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/SelectActionInitializer.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { ActionInitializer } from './ActionInitializer'; export const SelectActionInitializer = (props) => { diff --git a/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx b/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx index e9ebc4784..115d09297 100644 --- a/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/TableActionColumnInitializer.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { uid } from '@tachybase/schema'; + import { useSchemaInitializerItem } from '../../application'; import { InitializerWithSwitch } from './InitializerWithSwitch'; diff --git a/packages/core/client/src/schema-items/GeneralSchemaItems.tsx b/packages/core/client/src/schema-items/GeneralSchemaItems.tsx index eca32f4f6..c730d0051 100644 --- a/packages/core/client/src/schema-items/GeneralSchemaItems.tsx +++ b/packages/core/client/src/schema-items/GeneralSchemaItems.tsx @@ -1,8 +1,9 @@ -import { Field } from '@tachybase/schema'; -import { ISchema, observer, useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +import { Field, ISchema, observer, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager'; import { useDesignable } from '../schema-component'; import { getTempFieldState } from '../schema-component/antd/form-v2/utils'; diff --git a/packages/core/client/src/schema-items/GeneralSettings.tsx b/packages/core/client/src/schema-items/GeneralSettings.tsx index acc4d34c0..efa68ad05 100644 --- a/packages/core/client/src/schema-items/GeneralSettings.tsx +++ b/packages/core/client/src/schema-items/GeneralSettings.tsx @@ -1,10 +1,11 @@ -import { Field } from '@tachybase/schema'; -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; +import { Field, ISchema, useField, useFieldSchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; -import { useDesignable } from '../schema-component'; + import { SchemaSettingOptions } from '../application'; import { useSchemaToolbar } from '../application/schema-toolbar'; import { useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager'; +import { useDesignable } from '../schema-component'; export const generalSettingsItems: SchemaSettingOptions['items'] = [ { diff --git a/packages/core/client/src/schema-settings/LinkageRules/DynamicComponent.tsx b/packages/core/client/src/schema-settings/LinkageRules/DynamicComponent.tsx index 49b98be2f..4fe73deb3 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/DynamicComponent.tsx +++ b/packages/core/client/src/schema-settings/LinkageRules/DynamicComponent.tsx @@ -1,7 +1,6 @@ -import { createForm, onFieldValueChange } from '@tachybase/schema'; -import { FieldContext, FormContext } from '@tachybase/schema'; -import { merge } from '@tachybase/schema'; import React, { useContext, useMemo } from 'react'; +import { createForm, FieldContext, FormContext, merge, onFieldValueChange } from '@tachybase/schema'; + import { SchemaComponent } from '../../schema-component/core'; import { useComponent } from '../../schema-component/hooks'; import { FilterContext } from './context'; diff --git a/packages/core/client/src/schema-settings/LinkageRules/LinkageRuleActionGroup.tsx b/packages/core/client/src/schema-settings/LinkageRules/LinkageRuleActionGroup.tsx index 59d03553f..0368ea1e9 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/LinkageRuleActionGroup.tsx +++ b/packages/core/client/src/schema-settings/LinkageRules/LinkageRuleActionGroup.tsx @@ -1,17 +1,20 @@ -import { ArrayField as ArrayFieldModel, VoidField } from '@tachybase/schema'; +import React, { useCallback, useMemo } from 'react'; import { ArrayFieldComponent as ArrayField, + ArrayField as ArrayFieldModel, ObjectFieldComponent as ObjectField, observer, useField, + VoidField, } from '@tachybase/schema'; + import { Space } from 'antd'; -import React, { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { FormButtonLinkageRuleAction, FormFieldLinkageRuleAction } from './LinkageRuleAction'; -import { RemoveActionContext } from './context'; + import { withDynamicSchemaProps } from '../../application/hoc/withDynamicSchemaProps'; import { useProps } from '../../schema-component/hooks/useProps'; +import { RemoveActionContext } from './context'; +import { FormButtonLinkageRuleAction, FormFieldLinkageRuleAction } from './LinkageRuleAction'; export const LinkageRuleActions = observer( (props: any): any => { diff --git a/packages/core/client/src/schema-settings/LinkageRules/Variables.tsx b/packages/core/client/src/schema-settings/LinkageRules/Variables.tsx index 56616e5cc..ed5107fdf 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/Variables.tsx +++ b/packages/core/client/src/schema-settings/LinkageRules/Variables.tsx @@ -1,5 +1,5 @@ +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../collection-manager'; import { useCompile } from '../../schema-component'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../collection-manager'; const supportsType = [ 'id', diff --git a/packages/core/client/src/schema-settings/LinkageRules/action-hooks.ts b/packages/core/client/src/schema-settings/LinkageRules/action-hooks.ts index e2303b6b3..5d24699fa 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/action-hooks.ts +++ b/packages/core/client/src/schema-settings/LinkageRules/action-hooks.ts @@ -1,4 +1,5 @@ import { useTranslation } from 'react-i18next'; + import { useCollectionManager_deprecated } from '../../collection-manager'; import { ActionType } from './type'; diff --git a/packages/core/client/src/schema-settings/LinkageRules/components/EnableLinkage.tsx b/packages/core/client/src/schema-settings/LinkageRules/components/EnableLinkage.tsx index 9f2d4d9b5..f4020a2cb 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/components/EnableLinkage.tsx +++ b/packages/core/client/src/schema-settings/LinkageRules/components/EnableLinkage.tsx @@ -1,6 +1,7 @@ -import { ArrayBase } from '@tachybase/components'; -import { Switch } from 'antd'; import React from 'react'; +import { ArrayBase } from '@tachybase/components'; + +import { Switch } from 'antd'; import { useTranslation } from 'react-i18next'; export const EnableLinkage = React.forwardRef((props: any, ref) => { diff --git a/packages/core/client/src/schema-settings/LinkageRules/components/LinkageHeader.tsx b/packages/core/client/src/schema-settings/LinkageRules/components/LinkageHeader.tsx index a7ea2d712..72b2cae6e 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/components/LinkageHeader.tsx +++ b/packages/core/client/src/schema-settings/LinkageRules/components/LinkageHeader.tsx @@ -1,13 +1,13 @@ -import { CopyOutlined } from '@ant-design/icons'; +import React, { Fragment, useEffect, useState } from 'react'; import { ArrayBase } from '@tachybase/components'; -import { ArrayField } from '@tachybase/schema'; -import { ISchema, RecursionField, observer, useField, useFieldSchema } from '@tachybase/schema'; -import { toArr } from '@tachybase/schema'; +import { ArrayField, ISchema, observer, RecursionField, toArr, useField, useFieldSchema } from '@tachybase/schema'; + +import { CopyOutlined } from '@ant-design/icons'; import { Badge, Card, Collapse, CollapsePanelProps, CollapseProps, Empty, Input } from 'antd'; import cls from 'classnames'; import { cloneDeep } from 'lodash'; -import React, { Fragment, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; + import { useToken } from '../../../style'; import { useStyles } from './LinkageHeader.style'; diff --git a/packages/core/client/src/schema-settings/LinkageRules/context.ts b/packages/core/client/src/schema-settings/LinkageRules/context.ts index 3d03d6166..530feb11b 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/context.ts +++ b/packages/core/client/src/schema-settings/LinkageRules/context.ts @@ -1,6 +1,5 @@ -import { ObjectField } from '@tachybase/schema'; -import { Schema } from '@tachybase/schema'; import { createContext } from 'react'; +import { ObjectField, Schema } from '@tachybase/schema'; export interface FilterContextProps { field?: ObjectField; diff --git a/packages/core/client/src/schema-settings/LinkageRules/useValues.ts b/packages/core/client/src/schema-settings/LinkageRules/useValues.ts index c02d174e6..8db000393 100644 --- a/packages/core/client/src/schema-settings/LinkageRules/useValues.ts +++ b/packages/core/client/src/schema-settings/LinkageRules/useValues.ts @@ -1,5 +1,6 @@ +import { useContext, useEffect } from 'react'; import { useField } from '@tachybase/schema'; -import { useEffect, useContext } from 'react'; + import { LinkageLogicContext } from './context'; const findOption = (dataIndex = [], options) => { diff --git a/packages/core/client/src/schema-settings/SchemaSettingsDataScope.tsx b/packages/core/client/src/schema-settings/SchemaSettingsDataScope.tsx index 097ec19ff..1edfdc871 100644 --- a/packages/core/client/src/schema-settings/SchemaSettingsDataScope.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettingsDataScope.tsx @@ -1,16 +1,18 @@ -import { ISchema } from '@tachybase/schema'; import React, { FC, useCallback } from 'react'; +import { ISchema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { DatePickerProvider, useCollectionManager_deprecated, useRecord } from '..'; import { useFormBlockContext } from '../block-provider'; import { useCollectionFilterOptionsV2 } from '../collection-manager/action-hooks'; import { FlagProvider, useFlag } from '../flag-provider'; import { DynamicComponentProps } from '../schema-component/antd/filter/DynamicComponent'; import { useLocalVariables, useVariables } from '../variables'; -import { VariableInput, getShouldChange } from './VariableInput/VariableInput'; -import { BaseVariableProvider, IsDisabledParams } from './VariableInput/hooks/useBaseVariable'; -import { DataScopeProps } from './types'; import { SchemaSettingsModalItem } from './SchemaSettings'; +import { DataScopeProps } from './types'; +import { BaseVariableProvider, IsDisabledParams } from './VariableInput/hooks/useBaseVariable'; +import { getShouldChange, VariableInput } from './VariableInput/VariableInput'; export const SchemaSettingsDataScope: FC = function DataScopeConfigure(props) { const { t } = useTranslation(); diff --git a/packages/core/client/src/schema-settings/SchemaSettingsSortingRule.tsx b/packages/core/client/src/schema-settings/SchemaSettingsSortingRule.tsx index a69a7ace4..c34f3a409 100644 --- a/packages/core/client/src/schema-settings/SchemaSettingsSortingRule.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettingsSortingRule.tsx @@ -1,10 +1,12 @@ -import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { useCollectionManager_deprecated, useCollection_deprecated, useDesignable, useSortFields } from '..'; -import { SchemaSettingsModalItem } from './SchemaSettings'; import { ArrayItems } from '@tachybase/components'; +import { ISchema, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; +import { useTranslation } from 'react-i18next'; + +import { useCollection_deprecated, useCollectionManager_deprecated, useDesignable, useSortFields } from '..'; +import { SchemaSettingsModalItem } from './SchemaSettings'; export const SchemaSettingsSortingRule = function SortRuleConfigure(props) { const field = useField(); diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useBaseVariable.tsx b/packages/core/client/src/schema-settings/VariableInput/hooks/useBaseVariable.tsx index 3cce5358f..4003fbe08 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useBaseVariable.tsx +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useBaseVariable.tsx @@ -1,5 +1,6 @@ -import { ISchema, Schema } from '@tachybase/schema'; import React, { useContext, useMemo } from 'react'; +import { ISchema, Schema } from '@tachybase/schema'; + import { CollectionFieldOptions_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { useCompile, useGetFilterOptions } from '../../../schema-component'; import { isSpecialCaseField } from '../../../schema-component/antd/form-item/hooks/useSpecialCase'; diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx b/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx index 4cbf216ff..10eee6b75 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useContextAssociationFields.tsx @@ -1,6 +1,8 @@ -import { error } from '@tachybase/utils/client'; import { useMemo } from 'react'; +import { error } from '@tachybase/utils/client'; + import { useTranslation } from 'react-i18next'; + import { CollectionFieldOptions_deprecated, useCollectionManager_deprecated } from '../../../collection-manager'; import { useCompile, useGetFilterOptions } from '../../../schema-component'; import { FieldOption, Option } from '../type'; diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useDateVariable.ts b/packages/core/client/src/schema-settings/VariableInput/hooks/useDateVariable.ts index ccd01fbcd..dee8f96f9 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useDateVariable.ts +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useDateVariable.ts @@ -1,5 +1,7 @@ import { useMemo } from 'react'; + import { useTranslation } from 'react-i18next'; + import { getDateRanges } from '../../../schema-component/antd/date-picker/util'; interface Props { diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useRecordVariable.ts b/packages/core/client/src/schema-settings/VariableInput/hooks/useRecordVariable.ts index a1f939877..9274055c1 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useRecordVariable.ts +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useRecordVariable.ts @@ -1,9 +1,11 @@ import { Schema } from '@tachybase/schema'; + import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + +import { useFormBlockContext } from '../../../block-provider/FormBlockProvider'; import { CollectionFieldOptions_deprecated } from '../../../collection-manager'; import { useBaseVariable } from './useBaseVariable'; -import { useFormBlockContext } from '../../../block-provider/FormBlockProvider'; interface Props { collectionField?: CollectionFieldOptions_deprecated; diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useRoleVariable.ts b/packages/core/client/src/schema-settings/VariableInput/hooks/useRoleVariable.ts index 8811d35e5..116406c0e 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useRoleVariable.ts +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useRoleVariable.ts @@ -1,5 +1,7 @@ import { Schema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { useAPIClient } from '../../../api-client'; import { CollectionFieldOptions_deprecated } from '../../../collection-manager'; import { CollectionFieldOptions } from '../../../data-source/collection/Collection'; diff --git a/packages/core/client/src/schema-settings/VariableInput/hooks/useUserVariable.ts b/packages/core/client/src/schema-settings/VariableInput/hooks/useUserVariable.ts index cb494c694..3c9fbb390 100644 --- a/packages/core/client/src/schema-settings/VariableInput/hooks/useUserVariable.ts +++ b/packages/core/client/src/schema-settings/VariableInput/hooks/useUserVariable.ts @@ -1,5 +1,7 @@ import { Schema } from '@tachybase/schema'; + import { useTranslation } from 'react-i18next'; + import { CollectionFieldOptions_deprecated } from '../../../collection-manager'; import { CollectionFieldOptions } from '../../../data-source/collection/Collection'; import { DEFAULT_DATA_SOURCE_KEY } from '../../../data-source/data-source/DataSourceManager'; diff --git a/packages/core/client/src/schema-settings/VariableInput/type.ts b/packages/core/client/src/schema-settings/VariableInput/type.ts index de2b0d9a2..bbaa584d2 100644 --- a/packages/core/client/src/schema-settings/VariableInput/type.ts +++ b/packages/core/client/src/schema-settings/VariableInput/type.ts @@ -1,4 +1,5 @@ import { Schema } from '@tachybase/schema'; + import type { DefaultOptionType } from 'antd/lib/cascader'; export interface Option extends DefaultOptionType { diff --git a/packages/core/client/src/schema-settings/demos/built-type.tsx b/packages/core/client/src/schema-settings/demos/built-type.tsx index d91dca7db..942982270 100644 --- a/packages/core/client/src/schema-settings/demos/built-type.tsx +++ b/packages/core/client/src/schema-settings/demos/built-type.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { Input } from 'antd'; import { Application, FormItem, @@ -9,6 +8,8 @@ import { useSchemaSettingsRender, } from '@tachybase/client'; +import { Input } from 'antd'; + const mySchemaSetting = new SchemaSettings({ name: 'MySchemaSetting', items: [ diff --git a/packages/core/client/src/schema-settings/demos/custom-component.tsx b/packages/core/client/src/schema-settings/demos/custom-component.tsx index 17978ba32..58902c97a 100644 --- a/packages/core/client/src/schema-settings/demos/custom-component.tsx +++ b/packages/core/client/src/schema-settings/demos/custom-component.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Application, Plugin, SchemaSettings, useSchemaSettingsRender } from '@tachybase/client'; + import { Button } from 'antd'; const mySchemaSetting = new SchemaSettings({ diff --git a/packages/core/client/src/schema-settings/demos/demo3.tsx b/packages/core/client/src/schema-settings/demos/demo3.tsx index 470374816..59ac04d3f 100644 --- a/packages/core/client/src/schema-settings/demos/demo3.tsx +++ b/packages/core/client/src/schema-settings/demos/demo3.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Application, CardItem, @@ -11,8 +12,8 @@ import { useSchemaInitializer, useSchemaInitializerItem, } from '@tachybase/client'; + import { Button } from 'antd'; -import React from 'react'; const mySettings = new SchemaSettings({ name: 'mySettings', diff --git a/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts b/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts index 1b4bebf74..24524c4c3 100644 --- a/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts +++ b/packages/core/client/src/schema-settings/hooks/useGetAriaLabelOfDesigner.ts @@ -1,5 +1,6 @@ -import { useFieldSchema } from '@tachybase/schema'; import { useCallback } from 'react'; +import { useFieldSchema } from '@tachybase/schema'; + import { useCollection_deprecated } from '../../collection-manager'; /** diff --git a/packages/core/client/src/schema-settings/hooks/useIsShowMultipleSwitch.ts b/packages/core/client/src/schema-settings/hooks/useIsShowMultipleSwitch.ts index 3dff6867d..c63e0baf0 100644 --- a/packages/core/client/src/schema-settings/hooks/useIsShowMultipleSwitch.ts +++ b/packages/core/client/src/schema-settings/hooks/useIsShowMultipleSwitch.ts @@ -1,4 +1,5 @@ import { useField, useFieldSchema } from '@tachybase/schema'; + import { useCollectionManager_deprecated } from '../../collection-manager'; import { useColumnSchema } from '../../schema-component/antd/table-v2/Table.Column.Decorator'; diff --git a/packages/core/client/src/schema-settings/hooks/useParseDataScopeFilter.ts b/packages/core/client/src/schema-settings/hooks/useParseDataScopeFilter.ts index 38985d251..b69d01948 100644 --- a/packages/core/client/src/schema-settings/hooks/useParseDataScopeFilter.ts +++ b/packages/core/client/src/schema-settings/hooks/useParseDataScopeFilter.ts @@ -1,5 +1,6 @@ -import { flatten, unflatten } from '@tachybase/utils/client'; import { useCallback } from 'react'; +import { flatten, unflatten } from '@tachybase/utils/client'; + import { useLocalVariables, useVariables } from '../../variables'; import { getVariableName } from '../../variables/utils/getVariableName'; import { isVariable } from '../../variables/utils/isVariable'; diff --git a/packages/core/client/src/user/__tests__/current-user-settings-menu-provider.test.tsx b/packages/core/client/src/user/__tests__/current-user-settings-menu-provider.test.tsx index bc1a087c6..2bd2ce15e 100644 --- a/packages/core/client/src/user/__tests__/current-user-settings-menu-provider.test.tsx +++ b/packages/core/client/src/user/__tests__/current-user-settings-menu-provider.test.tsx @@ -1,5 +1,6 @@ -import { render } from '@tachybase/test/client'; import React from 'react'; +import { render } from '@tachybase/test/client'; + import { SettingsMenu } from '../CurrentUser'; import { useCurrentUserSettingsMenu } from '../CurrentUserSettingsMenuProvider'; diff --git a/packages/core/client/src/variables/utils/getVariableName.tsx b/packages/core/client/src/variables/utils/getVariableName.tsx index 6c9562f2e..c7d037e1c 100644 --- a/packages/core/client/src/variables/utils/getVariableName.tsx +++ b/packages/core/client/src/variables/utils/getVariableName.tsx @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { getPath } from './getPath'; /** diff --git a/packages/core/client/src/variables/utils/transformVariableValue.ts b/packages/core/client/src/variables/utils/transformVariableValue.ts index 2d3d157eb..43cc3286c 100644 --- a/packages/core/client/src/variables/utils/transformVariableValue.ts +++ b/packages/core/client/src/variables/utils/transformVariableValue.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { CollectionFieldOptions_deprecated } from '../../collection-manager'; interface Deps { diff --git a/packages/core/components/src/__builtins__/dayjs.ts b/packages/core/components/src/__builtins__/dayjs.ts index 2a291c2d9..def5bfa28 100644 --- a/packages/core/components/src/__builtins__/dayjs.ts +++ b/packages/core/components/src/__builtins__/dayjs.ts @@ -1,4 +1,4 @@ -import { isArr, isFn, isEmpty } from '@formily/shared'; +import { isArr, isEmpty, isFn } from '@formily/shared'; import dayjs, { ConfigType, Dayjs } from 'dayjs'; export function dayjsable(value: ConfigType, format?: string): Dayjs; diff --git a/packages/core/components/src/__builtins__/hooks/useClickAway.ts b/packages/core/components/src/__builtins__/hooks/useClickAway.ts index 9e7a31a2c..6cc7eee64 100644 --- a/packages/core/components/src/__builtins__/hooks/useClickAway.ts +++ b/packages/core/components/src/__builtins__/hooks/useClickAway.ts @@ -1,4 +1,4 @@ -import { useRef, useEffect, MutableRefObject } from 'react'; +import { MutableRefObject, useEffect, useRef } from 'react'; const defaultEvent = 'click'; diff --git a/packages/core/components/src/__builtins__/hooks/useConfig.ts b/packages/core/components/src/__builtins__/hooks/useConfig.ts index b9d05bd59..971dc2df3 100644 --- a/packages/core/components/src/__builtins__/hooks/useConfig.ts +++ b/packages/core/components/src/__builtins__/hooks/useConfig.ts @@ -1,5 +1,6 @@ -import { ConfigProvider } from 'antd'; import { useContext } from 'react'; +import { ConfigProvider } from 'antd'; + const { ConfigContext } = ConfigProvider; export const useConfig = () => useContext(ConfigContext); diff --git a/packages/core/components/src/__builtins__/hooks/usePrefixCls.ts b/packages/core/components/src/__builtins__/hooks/usePrefixCls.ts index 8acbf2845..74fde6fd1 100644 --- a/packages/core/components/src/__builtins__/hooks/usePrefixCls.ts +++ b/packages/core/components/src/__builtins__/hooks/usePrefixCls.ts @@ -1,4 +1,5 @@ import { useContext } from 'react'; + import { ConfigProvider } from 'antd'; export const usePrefixCls = ( diff --git a/packages/core/components/src/__builtins__/hooks/useToken.ts b/packages/core/components/src/__builtins__/hooks/useToken.ts index 742a1904c..6dfdc0824 100644 --- a/packages/core/components/src/__builtins__/hooks/useToken.ts +++ b/packages/core/components/src/__builtins__/hooks/useToken.ts @@ -1,3 +1,4 @@ import { theme } from 'antd'; + const { useToken } = theme; export { useToken }; diff --git a/packages/core/components/src/__builtins__/portal.tsx b/packages/core/components/src/__builtins__/portal.tsx index fb060dcbd..6c77475f1 100644 --- a/packages/core/components/src/__builtins__/portal.tsx +++ b/packages/core/components/src/__builtins__/portal.tsx @@ -1,8 +1,11 @@ +import React, { Fragment } from 'react'; + import { Observer, ReactFC } from '@formily/react'; import { observable } from '@formily/reactive'; -import React, { Fragment } from 'react'; import { createPortal } from 'react-dom'; + import { render as reactRender, unmount as reactUnmount } from './render'; + export interface IPortalProps { id?: string | symbol; } diff --git a/packages/core/components/src/__builtins__/style.ts b/packages/core/components/src/__builtins__/style.ts index 52c3f5861..a43c90170 100644 --- a/packages/core/components/src/__builtins__/style.ts +++ b/packages/core/components/src/__builtins__/style.ts @@ -1,7 +1,7 @@ -import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs'; -import { useStyleRegister } from '@ant-design/cssinjs'; +import { useStyleRegister, type CSSInterpolation, type CSSObject } from '@ant-design/cssinjs'; import { merge } from '@formily/shared'; import type { ComponentTokenMap, GlobalToken } from 'antd/es/theme/interface'; + import { useConfig, useToken } from './hooks'; export type OverrideComponent = keyof ComponentTokenMap | (string & {}); diff --git a/packages/core/components/src/__tests__/dayjs.spec.ts b/packages/core/components/src/__tests__/dayjs.spec.ts index f14878590..1255ae5b8 100644 --- a/packages/core/components/src/__tests__/dayjs.spec.ts +++ b/packages/core/components/src/__tests__/dayjs.spec.ts @@ -1,5 +1,6 @@ import dayjs from 'dayjs'; -import { formatDayjsValue, dayjsable } from '../__builtins__/dayjs'; + +import { dayjsable, formatDayjsValue } from '../__builtins__/dayjs'; test('dayjsable is usable', () => { expect(dayjs.isDayjs(dayjsable('2021-09-08'))).toBe(true); diff --git a/packages/core/components/src/array-cards/index.tsx b/packages/core/components/src/array-cards/index.tsx index 4fb87385a..c0dab2be5 100644 --- a/packages/core/components/src/array-cards/index.tsx +++ b/packages/core/components/src/array-cards/index.tsx @@ -1,11 +1,13 @@ +import React from 'react'; + import { ArrayField } from '@formily/core'; import { ISchema } from '@formily/json-schema'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import { Card, CardProps, Empty } from 'antd'; import cls from 'classnames'; -import React from 'react'; -import { ArrayBase } from '../array-base'; + import { usePrefixCls } from '../__builtins__'; +import { ArrayBase } from '../array-base'; import useStyle from './style'; const isAdditionComponent = (schema: ISchema) => { diff --git a/packages/core/components/src/array-collapse/index.tsx b/packages/core/components/src/array-collapse/index.tsx index 948403cfe..1c8e10b0b 100644 --- a/packages/core/components/src/array-collapse/index.tsx +++ b/packages/core/components/src/array-collapse/index.tsx @@ -1,11 +1,13 @@ +import React, { Fragment, useEffect, useState } from 'react'; + import { ArrayField } from '@formily/core'; import { ISchema, observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import { toArr } from '@formily/shared'; import { Badge, Card, Collapse, CollapsePanelProps, CollapseProps, Empty } from 'antd'; import cls from 'classnames'; -import React, { Fragment, useEffect, useState } from 'react'; -import ArrayBase from '../array-base'; + import { usePrefixCls } from '../__builtins__'; +import ArrayBase from '../array-base'; import useStyle from './style'; export interface IArrayCollapseProps extends CollapseProps { diff --git a/packages/core/components/src/array-collapse/style.ts b/packages/core/components/src/array-collapse/style.ts index fdf2b432b..131a5fcee 100644 --- a/packages/core/components/src/array-collapse/style.ts +++ b/packages/core/components/src/array-collapse/style.ts @@ -1,4 +1,5 @@ import { genStyleHook } from './../__builtins__'; + export default genStyleHook('', (token) => { const { componentCls } = token; return { diff --git a/packages/core/components/src/array-items/index.tsx b/packages/core/components/src/array-items/index.tsx index 99d339391..db5121283 100644 --- a/packages/core/components/src/array-items/index.tsx +++ b/packages/core/components/src/array-items/index.tsx @@ -1,10 +1,12 @@ +import React from 'react'; + import { ArrayField } from '@formily/core'; import { ISchema } from '@formily/json-schema'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import cls from 'classnames'; -import React from 'react'; -import { ArrayBase } from '../array-base'; + import { SortableContainer, SortableElement, usePrefixCls } from '../__builtins__'; +import { ArrayBase } from '../array-base'; import useStyle from './style'; const SortableItem = SortableElement((props) => { diff --git a/packages/core/components/src/array-items/style.ts b/packages/core/components/src/array-items/style.ts index 7c262d4f3..c45dac24c 100644 --- a/packages/core/components/src/array-items/style.ts +++ b/packages/core/components/src/array-items/style.ts @@ -1,4 +1,5 @@ import { genStyleHook } from './../__builtins__'; + export default genStyleHook('array-items', (token) => { const { componentCls, antCls, colorBgBase, fontSizeSM, colorBorder, colorText } = token; diff --git a/packages/core/components/src/array-table/index.tsx b/packages/core/components/src/array-table/index.tsx index b3c756ef1..4d8afae45 100644 --- a/packages/core/components/src/array-table/index.tsx +++ b/packages/core/components/src/array-table/index.tsx @@ -1,3 +1,5 @@ +import React, { createContext, Fragment, useCallback, useContext, useEffect, useRef, useState } from 'react'; + import { ArrayField, FieldDisplayTypes, GeneralField } from '@formily/core'; import { Schema } from '@formily/json-schema'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; @@ -5,9 +7,9 @@ import { isArr, isBool, isFn } from '@formily/shared'; import { Badge, Pagination, PaginationProps, Select, SelectProps, Space, Table, TableProps } from 'antd'; import { ColumnProps, ColumnsType } from 'antd/es/table'; import cls from 'classnames'; -import React, { createContext, Fragment, useCallback, useContext, useEffect, useRef, useState } from 'react'; -import { ArrayBase, ArrayBaseMixins } from '../array-base'; + import { SortableContainer, SortableElement, usePrefixCls } from '../__builtins__'; +import { ArrayBase, ArrayBaseMixins } from '../array-base'; import useStyle from './style'; interface ObservableColumnSource { diff --git a/packages/core/components/src/array-tabs/index.tsx b/packages/core/components/src/array-tabs/index.tsx index a679202cd..dac9dda9d 100644 --- a/packages/core/components/src/array-tabs/index.tsx +++ b/packages/core/components/src/array-tabs/index.tsx @@ -1,7 +1,8 @@ +import React, { Fragment, useState } from 'react'; + import { ArrayField } from '@formily/core'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import { Badge, Tabs, TabsProps } from 'antd'; -import React, { Fragment, useState } from 'react'; interface IFeedbackBadgeProps { index: number; diff --git a/packages/core/components/src/checkbox/index.tsx b/packages/core/components/src/checkbox/index.tsx index ac13ac18f..3f44728bc 100644 --- a/packages/core/components/src/checkbox/index.tsx +++ b/packages/core/components/src/checkbox/index.tsx @@ -1,5 +1,6 @@ import { connect, mapProps, mapReadPretty } from '@formily/react'; import { Checkbox as AntdCheckbox } from 'antd'; + import { PreviewText } from '../preview-text'; const InternalCheckbox = connect( diff --git a/packages/core/components/src/editable/index.tsx b/packages/core/components/src/editable/index.tsx index 12b566d47..d5d874bd8 100644 --- a/packages/core/components/src/editable/index.tsx +++ b/packages/core/components/src/editable/index.tsx @@ -1,12 +1,14 @@ +import React, { useLayoutEffect, useRef, useState } from 'react'; + import { CloseOutlined, EditOutlined, MessageOutlined } from '@ant-design/icons'; import { Field, isVoidField } from '@formily/core'; import { observer, ReactFC, useField } from '@formily/react'; import { Popover as AntdPopover } from 'antd'; import { PopoverProps } from 'antd/lib/popover'; import cls from 'classnames'; -import React, { useLayoutEffect, useRef, useState } from 'react'; -import { BaseItem, IFormItemProps } from '../form-item'; + import { useClickAway, usePrefixCls } from '../__builtins__'; +import { BaseItem, IFormItemProps } from '../form-item'; import useStyle from './style'; const useParentPattern = () => { diff --git a/packages/core/components/src/editable/style.ts b/packages/core/components/src/editable/style.ts index a274ed522..50e9c98a0 100644 --- a/packages/core/components/src/editable/style.ts +++ b/packages/core/components/src/editable/style.ts @@ -1,4 +1,5 @@ import { genStyleHook } from './../__builtins__'; + export default genStyleHook('editable', (token) => { const { antCls, componentCls, fontSizeSM, colorPrimary } = token; return { diff --git a/packages/core/components/src/form-button-group/index.tsx b/packages/core/components/src/form-button-group/index.tsx index d8e86adf3..4b9e6617e 100644 --- a/packages/core/components/src/form-button-group/index.tsx +++ b/packages/core/components/src/form-button-group/index.tsx @@ -4,14 +4,16 @@ * 3. 行内布局 * 4. 吸底布局 */ +import React, { useLayoutEffect, useRef, useState } from 'react'; + import { ReactFC } from '@formily/react'; import { Space } from 'antd'; import { SpaceProps } from 'antd/lib/space'; import cls from 'classnames'; -import React, { useLayoutEffect, useRef, useState } from 'react'; import StickyBox from 'react-sticky-box'; -import { BaseItem, IFormItemProps } from '../form-item'; + import { usePrefixCls } from '../__builtins__'; +import { BaseItem, IFormItemProps } from '../form-item'; import useStyle from './style'; interface IStickyProps extends React.ComponentProps { diff --git a/packages/core/components/src/form-collapse/index.tsx b/packages/core/components/src/form-collapse/index.tsx index d02d6308f..bf40b9a39 100644 --- a/packages/core/components/src/form-collapse/index.tsx +++ b/packages/core/components/src/form-collapse/index.tsx @@ -1,10 +1,12 @@ +import React, { Fragment, useMemo } from 'react'; + import { Schema, SchemaKey } from '@formily/json-schema'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import { markRaw, model } from '@formily/reactive'; import { toArr } from '@formily/shared'; import { Badge, Collapse, CollapsePanelProps, CollapseProps } from 'antd'; import cls from 'classnames'; -import React, { Fragment, useMemo } from 'react'; + import { usePrefixCls } from '../__builtins__'; type ActiveKeys = string | number | Array; diff --git a/packages/core/components/src/form-dialog/index.tsx b/packages/core/components/src/form-dialog/index.tsx index 0fd4e5a77..d8f871961 100644 --- a/packages/core/components/src/form-dialog/index.tsx +++ b/packages/core/components/src/form-dialog/index.tsx @@ -1,10 +1,12 @@ +import React, { Fragment, useLayoutEffect, useRef, useState } from 'react'; + import { createForm, Form, IFormProps } from '@formily/core'; import { FormProvider, Observer, observer, ReactFC } from '@formily/react'; import { toJS } from '@formily/reactive'; import { applyMiddleware, IMiddleware, isBool, isFn, isNum, isStr } from '@formily/shared'; import { Modal, ModalProps } from 'antd'; -import React, { Fragment, useLayoutEffect, useRef, useState } from 'react'; import { createPortal } from 'react-dom'; + import { createPortalProvider, createPortalRoot, loading, usePrefixCls } from '../__builtins__'; type FormDialogRenderer = React.ReactElement | ((form: Form) => React.ReactElement); diff --git a/packages/core/components/src/form-drawer/index.tsx b/packages/core/components/src/form-drawer/index.tsx index 90ac0b1a2..e40385760 100644 --- a/packages/core/components/src/form-drawer/index.tsx +++ b/packages/core/components/src/form-drawer/index.tsx @@ -1,10 +1,12 @@ +import React, { Fragment, useLayoutEffect, useRef, useState } from 'react'; + import { createForm, Form, IFormProps, onFormSubmitSuccess } from '@formily/core'; import { FormProvider, observer, ReactFC } from '@formily/react'; import { toJS } from '@formily/reactive'; import { applyMiddleware, IMiddleware, isBool, isFn, isNum, isStr } from '@formily/shared'; import { Drawer, DrawerProps } from 'antd'; -import React, { Fragment, useLayoutEffect, useRef, useState } from 'react'; import { createPortal } from 'react-dom'; + import { createPortalProvider, createPortalRoot, loading, usePrefixCls } from '../__builtins__'; type FormDrawerRenderer = React.ReactElement | ((form: Form) => React.ReactElement); diff --git a/packages/core/components/src/form-grid/index.tsx b/packages/core/components/src/form-grid/index.tsx index 3898796c9..49e0c672d 100644 --- a/packages/core/components/src/form-grid/index.tsx +++ b/packages/core/components/src/form-grid/index.tsx @@ -1,11 +1,12 @@ +import React, { useContext, useLayoutEffect, useMemo, useRef } from 'react'; + import { Grid, IGridOptions } from '@formily/grid'; import { observer } from '@formily/react'; import { markRaw } from '@formily/reactive'; import cls from 'classnames'; -import React, { useContext, useLayoutEffect, useMemo, useRef } from 'react'; -import { useFormLayout } from '../form-layout'; -import { pickDataProps, usePrefixCls } from '../__builtins__'; +import { pickDataProps, usePrefixCls } from '../__builtins__'; +import { useFormLayout } from '../form-layout'; import useStyle from './style'; const FormGridContext = React.createContext>(null as any); diff --git a/packages/core/components/src/form-grid/style.ts b/packages/core/components/src/form-grid/style.ts index 0a77c2e61..0e806d1bb 100644 --- a/packages/core/components/src/form-grid/style.ts +++ b/packages/core/components/src/form-grid/style.ts @@ -1,4 +1,5 @@ import { genStyleHook } from './../__builtins__'; + export default genStyleHook('form-grid', (token) => { const { componentCls } = token; return { diff --git a/packages/core/components/src/form-item/hooks/useFormItemLayout.tsx b/packages/core/components/src/form-item/hooks/useFormItemLayout.tsx index 4c39b9d84..d8d3ab479 100644 --- a/packages/core/components/src/form-item/hooks/useFormItemLayout.tsx +++ b/packages/core/components/src/form-item/hooks/useFormItemLayout.tsx @@ -1,5 +1,7 @@ -import { QuestionCircleOutlined } from '@ant-design/icons'; import React from 'react'; + +import { QuestionCircleOutlined } from '@ant-design/icons'; + import { useFormLayout } from '../../form-layout'; import { IFormItemProps } from '../types'; diff --git a/packages/core/components/src/form-item/hooks/useOverflow.ts b/packages/core/components/src/form-item/hooks/useOverflow.ts index 70d91c7da..d581204ad 100644 --- a/packages/core/components/src/form-item/hooks/useOverflow.ts +++ b/packages/core/components/src/form-item/hooks/useOverflow.ts @@ -1,4 +1,5 @@ -import { useState, useRef, useEffect } from 'react'; +import { useEffect, useRef, useState } from 'react'; + import { useFormLayout } from '../../form-layout'; export function useOverflow() { diff --git a/packages/core/components/src/form-item/style/animation.tsx b/packages/core/components/src/form-item/style/animation.tsx index 2fc324b7b..4e7bdb838 100644 --- a/packages/core/components/src/form-item/style/animation.tsx +++ b/packages/core/components/src/form-item/style/animation.tsx @@ -1,4 +1,5 @@ import { Keyframes } from '@ant-design/cssinjs'; + import { GenerateStyle } from '../../__builtins__'; const antShowHelpIn = new Keyframes('antShowHelpIn', { diff --git a/packages/core/components/src/form-item/style/other.tsx b/packages/core/components/src/form-item/style/other.tsx index 141ae5964..815000aa9 100644 --- a/packages/core/components/src/form-item/style/other.tsx +++ b/packages/core/components/src/form-item/style/other.tsx @@ -1,4 +1,5 @@ import { CSSProperties } from 'react'; + import { GenerateStyle } from '../../__builtins__'; export const genOtherStyle: GenerateStyle = (token) => { diff --git a/packages/core/components/src/form-layout/index.tsx b/packages/core/components/src/form-layout/index.tsx index 4e4ea5f99..2820087c5 100644 --- a/packages/core/components/src/form-layout/index.tsx +++ b/packages/core/components/src/form-layout/index.tsx @@ -1,8 +1,10 @@ import React, { createContext, useContext } from 'react'; -import { useResponsiveFormLayout } from './useResponsiveFormLayout'; -import { usePrefixCls } from '../__builtins__'; + import cls from 'classnames'; +import { usePrefixCls } from '../__builtins__'; +import { useResponsiveFormLayout } from './useResponsiveFormLayout'; + export interface IFormLayoutProps { prefixCls?: string; className?: string; diff --git a/packages/core/components/src/form-layout/useResponsiveFormLayout.ts b/packages/core/components/src/form-layout/useResponsiveFormLayout.ts index b8d6206be..eb97c9073 100644 --- a/packages/core/components/src/form-layout/useResponsiveFormLayout.ts +++ b/packages/core/components/src/form-layout/useResponsiveFormLayout.ts @@ -1,6 +1,7 @@ -import { isArr, isValid } from '@formily/shared'; import { useEffect, useRef, useState } from 'react'; +import { isArr, isValid } from '@formily/shared'; + interface IProps { breakpoints?: number[]; layout?: 'vertical' | 'horizontal' | 'inline' | ('vertical' | 'horizontal' | 'inline')[]; diff --git a/packages/core/components/src/form-step/index.tsx b/packages/core/components/src/form-step/index.tsx index 3b0d6e3c2..35a7428af 100644 --- a/packages/core/components/src/form-step/index.tsx +++ b/packages/core/components/src/form-step/index.tsx @@ -1,3 +1,5 @@ +import React, { Fragment } from 'react'; + import { Form, VoidField } from '@formily/core'; import { Schema, SchemaKey } from '@formily/json-schema'; import { connect, observer, RecursionField, useField, useFieldSchema } from '@formily/react'; @@ -5,7 +7,7 @@ import { action, define, markRaw, model, observable } from '@formily/reactive'; import { Steps } from 'antd'; import { StepProps, StepsProps } from 'antd/lib/steps'; import cls from 'classnames'; -import React, { Fragment } from 'react'; + import { usePrefixCls } from '../__builtins__'; export interface IFormStep { diff --git a/packages/core/components/src/form-tab/index.tsx b/packages/core/components/src/form-tab/index.tsx index af76d4439..e061d7964 100644 --- a/packages/core/components/src/form-tab/index.tsx +++ b/packages/core/components/src/form-tab/index.tsx @@ -1,11 +1,14 @@ +import React, { Fragment, useMemo } from 'react'; + import { Schema, SchemaKey } from '@formily/json-schema'; import { observer, ReactFC, RecursionField, useField, useFieldSchema } from '@formily/react'; import { markRaw, model } from '@formily/reactive'; import { Badge, Tabs } from 'antd'; import { TabPaneProps, TabsProps } from 'antd/lib/tabs'; import cls from 'classnames'; -import React, { Fragment, useMemo } from 'react'; + import { usePrefixCls } from '../__builtins__'; + export interface IFormTab { activeKey?: string; setActiveKey(key: string): void; diff --git a/packages/core/components/src/form/index.tsx b/packages/core/components/src/form/index.tsx index ffbfdfb04..b851a72ce 100644 --- a/packages/core/components/src/form/index.tsx +++ b/packages/core/components/src/form/index.tsx @@ -1,8 +1,11 @@ +import React from 'react'; + import { Form as FormType, IFormFeedback, isForm, ObjectField } from '@formily/core'; import { FormProvider, JSXComponent, RecordScope, useParentForm } from '@formily/react'; -import React from 'react'; + import { FormLayout, IFormLayoutProps } from '../form-layout'; import { PreviewText } from '../preview-text'; + export interface FormProps extends IFormLayoutProps { form?: FormType; component?: JSXComponent; diff --git a/packages/core/components/src/input/index.tsx b/packages/core/components/src/input/index.tsx index e36f5e7fd..9b328e959 100644 --- a/packages/core/components/src/input/index.tsx +++ b/packages/core/components/src/input/index.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { LoadingOutlined } from '@ant-design/icons'; import { connect, mapProps, mapReadPretty, ReactFC } from '@formily/react'; import { Input as AntdInput } from 'antd'; import type { InputProps } from 'antd/es/input'; -import React from 'react'; + import { PreviewText } from '../preview-text'; const InternalInput: ReactFC = connect( diff --git a/packages/core/components/src/number-picker/index.tsx b/packages/core/components/src/number-picker/index.tsx index 285782dad..b82df6a27 100644 --- a/packages/core/components/src/number-picker/index.tsx +++ b/packages/core/components/src/number-picker/index.tsx @@ -1,5 +1,6 @@ import { connect, mapReadPretty } from '@formily/react'; import { InputNumber } from 'antd'; + import { PreviewText } from '../preview-text'; export const NumberPicker = connect(InputNumber, mapReadPretty(PreviewText.NumberPicker)); diff --git a/packages/core/components/src/password/PasswordStrength.tsx b/packages/core/components/src/password/PasswordStrength.tsx index 29b7444b3..8bebaa464 100644 --- a/packages/core/components/src/password/PasswordStrength.tsx +++ b/packages/core/components/src/password/PasswordStrength.tsx @@ -1,4 +1,5 @@ import React, { Fragment } from 'react'; + import { ReactFC } from '@formily/react'; import { isFn } from '@formily/shared'; diff --git a/packages/core/components/src/password/index.tsx b/packages/core/components/src/password/index.tsx index d7414f32b..90525e69c 100644 --- a/packages/core/components/src/password/index.tsx +++ b/packages/core/components/src/password/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { connect, mapReadPretty } from '@formily/react'; import { Input } from 'antd'; import { PasswordProps } from 'antd/lib/input'; -import React from 'react'; + import { PreviewText } from '../preview-text'; import { PasswordStrength } from './PasswordStrength'; diff --git a/packages/core/components/src/radio/index.tsx b/packages/core/components/src/radio/index.tsx index d13fc7c27..c032b4a9d 100644 --- a/packages/core/components/src/radio/index.tsx +++ b/packages/core/components/src/radio/index.tsx @@ -1,5 +1,6 @@ import { connect, mapProps, mapReadPretty } from '@formily/react'; import { Radio as AntdRadio } from 'antd'; + import { PreviewText } from '../preview-text'; export const InternalRadio = connect( diff --git a/packages/core/components/src/reset/index.tsx b/packages/core/components/src/reset/index.tsx index 0b02ffbb2..bdfa65c5a 100644 --- a/packages/core/components/src/reset/index.tsx +++ b/packages/core/components/src/reset/index.tsx @@ -1,8 +1,9 @@ +import React from 'react'; + import { IFieldResetOptions, IFormFeedback } from '@formily/core'; import { useParentForm } from '@formily/react'; import { isFn } from '@formily/shared'; import { Button, ButtonProps } from 'antd'; -import React from 'react'; export interface IResetProps extends IFieldResetOptions, ButtonProps { onClick?: (e: React.MouseEvent) => any; diff --git a/packages/core/components/src/select-table/hooks/useCheckSlackly.tsx b/packages/core/components/src/select-table/hooks/useCheckSlackly.tsx index 09b9cbc7e..84e8df05b 100644 --- a/packages/core/components/src/select-table/hooks/useCheckSlackly.tsx +++ b/packages/core/components/src/select-table/hooks/useCheckSlackly.tsx @@ -1,4 +1,4 @@ -import { getTreeKeys, hasSelectedKey, completedKeys, getCompatibleAllSelected } from '../utils'; +import { completedKeys, getCompatibleAllSelected, getTreeKeys, hasSelectedKey } from '../utils'; /** * 判断该字段的 indeterminate 属性 diff --git a/packages/core/components/src/select-table/hooks/useFilterOptions.tsx b/packages/core/components/src/select-table/hooks/useFilterOptions.tsx index 844879e73..e0f8302f7 100644 --- a/packages/core/components/src/select-table/hooks/useFilterOptions.tsx +++ b/packages/core/components/src/select-table/hooks/useFilterOptions.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; -import { isFn, isArr } from '@formily/shared'; + +import { isArr, isFn } from '@formily/shared'; type IFilterOption = boolean | ((option: any, keyword: string) => boolean); diff --git a/packages/core/components/src/select-table/hooks/useTitleAddon.tsx b/packages/core/components/src/select-table/hooks/useTitleAddon.tsx index 28023d69e..71bd7e6f2 100644 --- a/packages/core/components/src/select-table/hooks/useTitleAddon.tsx +++ b/packages/core/components/src/select-table/hooks/useTitleAddon.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { Checkbox } from 'antd'; + import { completedKeys, getCompatibleAllSelected } from '../utils'; // 重写表格表头Checkbox(节点状态按全完整数据计算,节点操作按筛选数据计算) diff --git a/packages/core/components/src/select-table/index.tsx b/packages/core/components/src/select-table/index.tsx index cd8bfa98a..84036aac2 100644 --- a/packages/core/components/src/select-table/index.tsx +++ b/packages/core/components/src/select-table/index.tsx @@ -1,3 +1,5 @@ +import React, { useMemo, useState } from 'react'; + import { FieldDisplayTypes, GeneralField } from '@formily/core'; import { observer, ReactFC, RecursionField, Schema, useField, useFieldSchema } from '@formily/react'; import { isArr, isBool, isFn } from '@formily/shared'; @@ -6,7 +8,7 @@ import { ColumnsType } from 'antd/es/table'; import { SearchProps } from 'antd/lib/input'; import { ColumnProps, TableProps } from 'antd/lib/table'; import cls from 'classnames'; -import React, { useMemo, useState } from 'react'; + import { usePrefixCls } from '../__builtins__'; import { getIndeterminate, useCheckSlackly, useFilterOptions, useFlatOptions, useSize, useTitleAddon } from './hooks'; import useStyle from './style'; diff --git a/packages/core/components/src/select-table/utils.ts b/packages/core/components/src/select-table/utils.ts index 64f701a67..048e67a9f 100644 --- a/packages/core/components/src/select-table/utils.ts +++ b/packages/core/components/src/select-table/utils.ts @@ -1,4 +1,5 @@ import { isArr, isFn } from '@formily/shared'; + import { getFlatOptions } from './hooks/useFlatOptions'; /** diff --git a/packages/core/components/src/select/index.tsx b/packages/core/components/src/select/index.tsx index 2774deb2a..f135fe8a7 100644 --- a/packages/core/components/src/select/index.tsx +++ b/packages/core/components/src/select/index.tsx @@ -1,8 +1,10 @@ +import React from 'react'; + import { LoadingOutlined } from '@ant-design/icons'; import { connect, mapProps, mapReadPretty, ReactFC } from '@formily/react'; import { Select as AntdSelect } from 'antd'; import { SelectProps } from 'antd/lib/select'; -import React from 'react'; + import { PreviewText } from '../preview-text'; export const Select: ReactFC> = connect( diff --git a/packages/core/components/src/space/index.tsx b/packages/core/components/src/space/index.tsx index 798068e85..6c0d64ce2 100644 --- a/packages/core/components/src/space/index.tsx +++ b/packages/core/components/src/space/index.tsx @@ -1,5 +1,7 @@ -import { Space as AntdSpace, SpaceProps } from 'antd'; import React from 'react'; + +import { Space as AntdSpace, SpaceProps } from 'antd'; + import { useFormLayout } from '../form-layout'; export const Space: React.FC> = (props) => { diff --git a/packages/core/components/src/submit/index.tsx b/packages/core/components/src/submit/index.tsx index be7f53bda..7b21267b5 100644 --- a/packages/core/components/src/submit/index.tsx +++ b/packages/core/components/src/submit/index.tsx @@ -1,8 +1,9 @@ +import React from 'react'; + import { IFormFeedback } from '@formily/core'; import { observer, useParentForm } from '@formily/react'; import { Button } from 'antd'; import { ButtonProps } from 'antd/lib/button'; -import React from 'react'; export interface ISubmitProps extends ButtonProps { onClick?: (e: React.MouseEvent) => any; diff --git a/packages/core/components/src/switch/index.tsx b/packages/core/components/src/switch/index.tsx index 88dc58386..645c21518 100644 --- a/packages/core/components/src/switch/index.tsx +++ b/packages/core/components/src/switch/index.tsx @@ -1,5 +1,5 @@ -import { Switch as AntdSwitch } from 'antd'; import { connect, mapProps } from '@formily/react'; +import { Switch as AntdSwitch } from 'antd'; export const Switch = connect( AntdSwitch, diff --git a/packages/core/components/src/tree-select/index.tsx b/packages/core/components/src/tree-select/index.tsx index 89cbb8f13..8db90f425 100644 --- a/packages/core/components/src/tree-select/index.tsx +++ b/packages/core/components/src/tree-select/index.tsx @@ -1,7 +1,9 @@ +import React from 'react'; + import { LoadingOutlined } from '@ant-design/icons'; import { connect, mapProps, mapReadPretty } from '@formily/react'; import { TreeSelect as AntdTreeSelect } from 'antd'; -import React from 'react'; + import { PreviewText } from '../preview-text'; export const TreeSelect = connect( diff --git a/packages/core/components/src/upload/index.tsx b/packages/core/components/src/upload/index.tsx index f7fbffb6b..1703c1b4d 100644 --- a/packages/core/components/src/upload/index.tsx +++ b/packages/core/components/src/upload/index.tsx @@ -1,14 +1,16 @@ import React, { useEffect } from 'react'; + +import { InboxOutlined, UploadOutlined } from '@ant-design/icons'; import { Field } from '@formily/core'; import { connect, mapProps, useField } from '@formily/react'; -import { Upload as AntdUpload, Button } from 'antd'; -import { UploadChangeParam, UploadProps as AntdUploadProps, DraggerProps as AntdDraggerProps } from 'antd/lib/upload'; -import { InboxOutlined, UploadOutlined } from '@ant-design/icons'; import { reaction } from '@formily/reactive'; -import { UploadFile } from 'antd/lib/upload/interface'; import { isArr, toArr } from '@formily/shared'; -import { UPLOAD_PLACEHOLDER } from './placeholder'; +import { Upload as AntdUpload, Button } from 'antd'; +import { DraggerProps as AntdDraggerProps, UploadProps as AntdUploadProps, UploadChangeParam } from 'antd/lib/upload'; +import { UploadFile } from 'antd/lib/upload/interface'; + import { usePrefixCls } from '../__builtins__'; +import { UPLOAD_PLACEHOLDER } from './placeholder'; export type IUploadProps = Omit & { textContent?: React.ReactNode; diff --git a/packages/core/devtools/umiConfig.d.ts b/packages/core/devtools/umiConfig.d.ts index af30e5c4e..f3269b0c6 100644 --- a/packages/core/devtools/umiConfig.d.ts +++ b/packages/core/devtools/umiConfig.d.ts @@ -23,4 +23,4 @@ export declare function resolveTachybasePackagesAlias(config: any): {}; export declare class IndexGenerator { constructor(outputPath: string, pluginsPath: string[]): void; generate(): void; -}; +} diff --git a/packages/core/evaluators/client.js b/packages/core/evaluators/client.js index 5effcafee..c33f9e397 100644 --- a/packages/core/evaluators/client.js +++ b/packages/core/evaluators/client.js @@ -1,12 +1,12 @@ -var _useExportClient = require("./lib/client"); +var _useExportClient = require('./lib/client'); Object.keys(_useExportClient).forEach(function (key) { - if (key === "default" || key === "__esModule") return; + if (key === 'default' || key === '__esModule') return; if (key in exports && exports[key] === _useExportClient[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _useExportClient[key]; - } + }, }); }); diff --git a/packages/core/evaluators/server.js b/packages/core/evaluators/server.js index c93247d51..b4a699dc6 100644 --- a/packages/core/evaluators/server.js +++ b/packages/core/evaluators/server.js @@ -1,12 +1,12 @@ -var _useExportServer = require("./lib/server"); +var _useExportServer = require('./lib/server'); Object.keys(_useExportServer).forEach(function (key) { - if (key === "default" || key === "__esModule") return; + if (key === 'default' || key === '__esModule') return; if (key in exports && exports[key] === _useExportServer[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _useExportServer[key]; - } + }, }); }); diff --git a/packages/core/evaluators/src/server/__tests__/index.test.ts b/packages/core/evaluators/src/server/__tests__/index.test.ts index d849c78b4..b0660521c 100644 --- a/packages/core/evaluators/src/server/__tests__/index.test.ts +++ b/packages/core/evaluators/src/server/__tests__/index.test.ts @@ -1,5 +1,5 @@ -import { evaluate } from '../../utils'; import evaluators from '..'; +import { evaluate } from '../../utils'; describe('evaluate', () => { describe('pre-process', () => { diff --git a/packages/core/evaluators/src/utils/index.ts b/packages/core/evaluators/src/utils/index.ts index 38fadad7d..8590fe6e9 100644 --- a/packages/core/evaluators/src/utils/index.ts +++ b/packages/core/evaluators/src/utils/index.ts @@ -1,4 +1,4 @@ -import { get, cloneDeep } from 'lodash'; +import { cloneDeep, get } from 'lodash'; export type Scope = { [key: string]: any }; diff --git a/packages/core/logger/src/deprecated/create-app-logger.ts b/packages/core/logger/src/deprecated/create-app-logger.ts index 86befba08..7c41a6fd4 100644 --- a/packages/core/logger/src/deprecated/create-app-logger.ts +++ b/packages/core/logger/src/deprecated/create-app-logger.ts @@ -1,6 +1,8 @@ import { randomUUID } from 'crypto'; + import Koa from 'koa'; import { pick } from 'lodash'; + import { createLogger, LoggerOptions } from './create-logger'; const defaultRequestWhitelist = [ diff --git a/packages/core/logger/src/format.ts b/packages/core/logger/src/format.ts index 5a90a8605..d92c5bebe 100644 --- a/packages/core/logger/src/format.ts +++ b/packages/core/logger/src/format.ts @@ -1,8 +1,9 @@ import chalk from 'chalk'; +import { isEmpty } from 'lodash'; import winston from 'winston'; + import { getLoggerFormat } from './config'; import { LoggerOptions } from './logger'; -import { isEmpty } from 'lodash'; const DEFAULT_DELIMITER = '|'; diff --git a/packages/core/logger/src/logger.ts b/packages/core/logger/src/logger.ts index 8062c71f8..9cf069af5 100644 --- a/packages/core/logger/src/logger.ts +++ b/packages/core/logger/src/logger.ts @@ -1,8 +1,10 @@ import winston, { Logger } from 'winston'; + import 'winston-daily-rotate-file'; + import { getLoggerLevel } from './config'; -import { getTransports } from './transports'; import { consoleFormat } from './format'; +import { getTransports } from './transports'; interface LoggerOptions extends Omit { dirname?: string; diff --git a/packages/core/logger/src/request-logger.ts b/packages/core/logger/src/request-logger.ts index 5126b4e80..ffbaf0f00 100644 --- a/packages/core/logger/src/request-logger.ts +++ b/packages/core/logger/src/request-logger.ts @@ -1,6 +1,8 @@ -import { getLoggerFilePath } from './config'; -import { LoggerOptions, createLogger } from './logger'; import { pick } from 'lodash'; + +import { getLoggerFilePath } from './config'; +import { createLogger, LoggerOptions } from './logger'; + const defaultRequestWhitelist = [ 'action', 'header.x-role', diff --git a/packages/core/logger/src/system-logger.ts b/packages/core/logger/src/system-logger.ts index 03ba4d7f4..a69de7cad 100644 --- a/packages/core/logger/src/system-logger.ts +++ b/packages/core/logger/src/system-logger.ts @@ -1,8 +1,9 @@ -import winston, { Logger, format } from 'winston'; -import { LoggerOptions, createLogger } from './logger'; -import Transport from 'winston-transport'; import { SPLAT } from 'triple-beam'; +import winston, { format, Logger } from 'winston'; +import Transport from 'winston-transport'; + import { getFormat } from './format'; +import { createLogger, LoggerOptions } from './logger'; export interface SystemLoggerOptions extends LoggerOptions { seperateError?: boolean; // print error seperately, default true diff --git a/packages/core/logger/src/transports.ts b/packages/core/logger/src/transports.ts index be60b53b2..623c6cdc8 100644 --- a/packages/core/logger/src/transports.ts +++ b/packages/core/logger/src/transports.ts @@ -1,9 +1,11 @@ +import path from 'path'; + import winston from 'winston'; import { DailyRotateFileTransportOptions } from 'winston-daily-rotate-file'; -import { LoggerOptions } from './logger'; + import { getLoggerFilePath, getLoggerFormat, getLoggerTransport } from './config'; -import path from 'path'; import { getFormat } from './format'; +import { LoggerOptions } from './logger'; export const Transports = { console: (options?: winston.transports.ConsoleTransportOptions) => new winston.transports.Console(options), diff --git a/packages/core/resourcer/src/__tests__/koa.test.ts b/packages/core/resourcer/src/__tests__/koa.test.ts index 38d5efe5f..9c7c968bf 100644 --- a/packages/core/resourcer/src/__tests__/koa.test.ts +++ b/packages/core/resourcer/src/__tests__/koa.test.ts @@ -1,6 +1,7 @@ import Koa from 'koa'; import bodyParser from 'koa-bodyparser'; import supertest from 'supertest'; + import { Resourcer } from '../resourcer'; describe('koa middleware', () => { diff --git a/packages/core/resourcer/src/__tests__/resourcer.test.ts b/packages/core/resourcer/src/__tests__/resourcer.test.ts index 8e8bba319..dda6ecf97 100644 --- a/packages/core/resourcer/src/__tests__/resourcer.test.ts +++ b/packages/core/resourcer/src/__tests__/resourcer.test.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { Action, Resourcer, ResourcerContext } from '..'; import Resource from '../resource'; diff --git a/packages/core/resourcer/src/action.ts b/packages/core/resourcer/src/action.ts index 0746e7261..5076b6a43 100644 --- a/packages/core/resourcer/src/action.ts +++ b/packages/core/resourcer/src/action.ts @@ -1,6 +1,8 @@ import { assign, MergeStrategies, requireModule } from '@tachybase/utils'; + import compose from 'koa-compose'; import _ from 'lodash'; + import Middleware, { MiddlewareType } from './middleware'; import Resource from './resource'; import { HandlerType } from './resourcer'; diff --git a/packages/core/resourcer/src/middleware.ts b/packages/core/resourcer/src/middleware.ts index 491bca58a..52a6e2bd0 100644 --- a/packages/core/resourcer/src/middleware.ts +++ b/packages/core/resourcer/src/middleware.ts @@ -1,5 +1,7 @@ -import compose from 'koa-compose'; import { requireModule } from '@tachybase/utils'; + +import compose from 'koa-compose'; + import { ActionName } from './action'; import { HandlerType } from './resourcer'; diff --git a/packages/core/resourcer/src/resource.ts b/packages/core/resourcer/src/resource.ts index 6a5021ade..cb4745b2c 100644 --- a/packages/core/resourcer/src/resource.ts +++ b/packages/core/resourcer/src/resource.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import Action, { ActionName, ActionType } from './action'; import Middleware, { MiddlewareType } from './middleware'; import { HandlerType, Resourcer } from './resourcer'; diff --git a/packages/core/resourcer/src/resourcer.ts b/packages/core/resourcer/src/resourcer.ts index 7d71b6c13..9c5e46168 100644 --- a/packages/core/resourcer/src/resourcer.ts +++ b/packages/core/resourcer/src/resourcer.ts @@ -1,8 +1,10 @@ import { importModule, Toposort, ToposortOptions } from '@tachybase/utils'; + import glob from 'glob'; import compose from 'koa-compose'; import _ from 'lodash'; import { pathToRegexp } from 'path-to-regexp'; + import Action, { ActionName } from './action'; import Resource, { ResourceOptions } from './resource'; import { getNameByParams, ParsedParams, parseQuery, parseRequest } from './utils'; diff --git a/packages/core/resourcer/src/utils.ts b/packages/core/resourcer/src/utils.ts index 97e30adcd..ed20c6569 100644 --- a/packages/core/resourcer/src/utils.ts +++ b/packages/core/resourcer/src/utils.ts @@ -2,6 +2,7 @@ import _ from 'lodash'; // @ts-ignore import { pathToRegexp } from 'path-to-regexp'; import qs from 'qs'; + import { ResourceType } from './resource'; export interface ParseRequest { diff --git a/packages/core/server/src/__tests__/app-life-cycle.test.ts b/packages/core/server/src/__tests__/app-life-cycle.test.ts index 0309b295f..70a6ea407 100644 --- a/packages/core/server/src/__tests__/app-life-cycle.test.ts +++ b/packages/core/server/src/__tests__/app-life-cycle.test.ts @@ -1,4 +1,5 @@ import { vi } from 'vitest'; + import Application, { ApplicationOptions } from '../application'; import { createAppProxy } from '../helper'; import Plugin from '../plugin'; diff --git a/packages/core/server/src/__tests__/app.test.ts b/packages/core/server/src/__tests__/app.test.ts index fa6c1903e..66e5165f9 100644 --- a/packages/core/server/src/__tests__/app.test.ts +++ b/packages/core/server/src/__tests__/app.test.ts @@ -1,7 +1,10 @@ import { DataTypes } from '@tachybase/database'; import { MockServer, mockServer } from '@tachybase/test'; + import { vi } from 'vitest'; + import Plugin from '../plugin'; + describe('app destroy', () => { let app: MockServer; afterEach(async () => { diff --git a/packages/core/server/src/__tests__/application.test.ts b/packages/core/server/src/__tests__/application.test.ts index d25a2878b..4bde90e3c 100644 --- a/packages/core/server/src/__tests__/application.test.ts +++ b/packages/core/server/src/__tests__/application.test.ts @@ -1,5 +1,6 @@ -import { vi } from 'vitest'; import supertest from 'supertest'; +import { vi } from 'vitest'; + import { Application } from '../application'; import { Plugin } from '../plugin'; import longJson from './fixtures/long-json'; diff --git a/packages/core/server/src/__tests__/command.test.ts b/packages/core/server/src/__tests__/command.test.ts index 27c680a45..a9afa4835 100644 --- a/packages/core/server/src/__tests__/command.test.ts +++ b/packages/core/server/src/__tests__/command.test.ts @@ -1,4 +1,5 @@ import { mockDatabase } from '@tachybase/database'; + import Application, { ApplicationOptions } from '../application'; const mockServer = (options?: ApplicationOptions) => { diff --git a/packages/core/server/src/__tests__/cron.test.ts b/packages/core/server/src/__tests__/cron.test.ts index f8030ce6f..6b93e5a13 100644 --- a/packages/core/server/src/__tests__/cron.test.ts +++ b/packages/core/server/src/__tests__/cron.test.ts @@ -1,5 +1,7 @@ -import { vi } from 'vitest'; import { mockServer, MockServer, waitSecond } from '@tachybase/test'; + +import { vi } from 'vitest'; + import { CronJobManager } from '../cron/cron-job-manager'; describe('cron service', () => { diff --git a/packages/core/server/src/__tests__/dataWrapping.test.ts b/packages/core/server/src/__tests__/dataWrapping.test.ts index 9e6eb504b..e352fe510 100644 --- a/packages/core/server/src/__tests__/dataWrapping.test.ts +++ b/packages/core/server/src/__tests__/dataWrapping.test.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; + import { Application } from '../application'; describe('application', () => { diff --git a/packages/core/server/src/__tests__/i18next.test.ts b/packages/core/server/src/__tests__/i18next.test.ts index ae13255c4..2023c77dc 100644 --- a/packages/core/server/src/__tests__/i18next.test.ts +++ b/packages/core/server/src/__tests__/i18next.test.ts @@ -1,4 +1,5 @@ import supertest from 'supertest'; + import { Application } from '../application'; describe('i18next', () => { diff --git a/packages/core/server/src/__tests__/life-cycle.test.ts b/packages/core/server/src/__tests__/life-cycle.test.ts index 16e895f66..74217bc81 100644 --- a/packages/core/server/src/__tests__/life-cycle.test.ts +++ b/packages/core/server/src/__tests__/life-cycle.test.ts @@ -1,4 +1,5 @@ import { vi } from 'vitest'; + import Application from '../application'; import { Plugin } from '../plugin'; diff --git a/packages/core/server/src/__tests__/multiple-application.test.ts b/packages/core/server/src/__tests__/multiple-application.test.ts index 077f57a74..efb6ecaf4 100644 --- a/packages/core/server/src/__tests__/multiple-application.test.ts +++ b/packages/core/server/src/__tests__/multiple-application.test.ts @@ -1,6 +1,7 @@ import { AppSupervisor } from '@tachybase/server'; import { mockServer, MockServer } from '@tachybase/test'; import { uid } from '@tachybase/utils'; + import Application from '../application'; describe('multiple application', () => { diff --git a/packages/core/server/src/__tests__/plugin.test.ts b/packages/core/server/src/__tests__/plugin.test.ts index d199c33b5..fbb330a2d 100644 --- a/packages/core/server/src/__tests__/plugin.test.ts +++ b/packages/core/server/src/__tests__/plugin.test.ts @@ -1,5 +1,7 @@ -import { vi } from 'vitest'; import { mockServer, MockServer } from '@tachybase/test'; + +import { vi } from 'vitest'; + import { Plugin } from '../plugin'; import Plugin1 from './plugins/plugin1'; import Plugin2 from './plugins/plugin2'; diff --git a/packages/core/server/src/__tests__/pm.test.ts b/packages/core/server/src/__tests__/pm.test.ts index 0e5ae0f8e..fbf417f67 100644 --- a/packages/core/server/src/__tests__/pm.test.ts +++ b/packages/core/server/src/__tests__/pm.test.ts @@ -1,7 +1,9 @@ +import { MockServer, mockServer } from '@tachybase/test'; + +import { vi } from 'vitest'; + import Plugin from '../plugin'; import { PluginManager } from '../plugin-manager'; -import { vi } from 'vitest'; -import { MockServer, mockServer } from '@tachybase/test'; describe('pm', () => { let app: MockServer; diff --git a/packages/core/server/src/acl/index.ts b/packages/core/server/src/acl/index.ts index 6babd177b..f0b514647 100644 --- a/packages/core/server/src/acl/index.ts +++ b/packages/core/server/src/acl/index.ts @@ -1,4 +1,5 @@ import { ACL } from '@tachybase/acl'; + import { availableActions } from './available-action'; const configureResources = [ diff --git a/packages/core/server/src/cache/index.ts b/packages/core/server/src/cache/index.ts index 0ccc12dbd..8bf32ec6f 100644 --- a/packages/core/server/src/cache/index.ts +++ b/packages/core/server/src/cache/index.ts @@ -1,4 +1,5 @@ -import { CacheManagerOptions, CacheManager } from '@tachybase/cache'; +import { CacheManager, CacheManagerOptions } from '@tachybase/cache'; + import Application from '../application'; export const createCacheManager = async (app: Application, options: CacheManagerOptions) => { diff --git a/packages/core/server/src/commands/create-migration.ts b/packages/core/server/src/commands/create-migration.ts index 214e7cf14..2ddc0f738 100644 --- a/packages/core/server/src/commands/create-migration.ts +++ b/packages/core/server/src/commands/create-migration.ts @@ -1,6 +1,8 @@ -import dayjs from 'dayjs'; import fs from 'fs'; import { dirname, resolve } from 'path'; + +import dayjs from 'dayjs'; + import Application from '../application'; export default (app: Application) => { diff --git a/packages/core/server/src/commands/pm.ts b/packages/core/server/src/commands/pm.ts index 394d09fab..8404545b7 100644 --- a/packages/core/server/src/commands/pm.ts +++ b/packages/core/server/src/commands/pm.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import Application from '../application'; import { PluginCommandError } from '../errors/plugin-command-error'; diff --git a/packages/core/server/src/commands/start.ts b/packages/core/server/src/commands/start.ts index 137d732ce..a26b986d3 100644 --- a/packages/core/server/src/commands/start.ts +++ b/packages/core/server/src/commands/start.ts @@ -1,6 +1,7 @@ -import { fsExists } from '@tachybase/utils'; import fs from 'fs'; import { resolve } from 'path'; +import { fsExists } from '@tachybase/utils'; + import Application from '../application'; import { ApplicationNotInstall } from '../errors/application-not-install'; diff --git a/packages/core/server/src/cron/cron-job-manager.ts b/packages/core/server/src/cron/cron-job-manager.ts index 06736cd2a..88b18313e 100644 --- a/packages/core/server/src/cron/cron-job-manager.ts +++ b/packages/core/server/src/cron/cron-job-manager.ts @@ -1,4 +1,5 @@ import { CronJob, CronJobParameters } from 'cron'; + import Application from '../application'; export class CronJobManager { diff --git a/packages/core/server/src/gateway/errors.ts b/packages/core/server/src/gateway/errors.ts index 7557cab0c..1adf5e056 100644 --- a/packages/core/server/src/gateway/errors.ts +++ b/packages/core/server/src/gateway/errors.ts @@ -1,6 +1,7 @@ -import { AppSupervisor } from '../app-supervisor'; import lodash from 'lodash'; +import { AppSupervisor } from '../app-supervisor'; + interface AppError { status: number; message: any; diff --git a/packages/core/server/src/gateway/ipc-socket-client.ts b/packages/core/server/src/gateway/ipc-socket-client.ts index 26fb3c72f..9096bfdf7 100644 --- a/packages/core/server/src/gateway/ipc-socket-client.ts +++ b/packages/core/server/src/gateway/ipc-socket-client.ts @@ -1,6 +1,7 @@ -import { Logger, createConsoleLogger } from '@tachybase/logger'; import * as events from 'events'; import net from 'net'; +import { createConsoleLogger, Logger } from '@tachybase/logger'; + import xpipe from 'xpipe'; export const writeJSON = (socket: net.Socket, data: object) => { diff --git a/packages/core/server/src/gateway/ipc-socket-server.ts b/packages/core/server/src/gateway/ipc-socket-server.ts index 828f6475c..c0a4858eb 100644 --- a/packages/core/server/src/gateway/ipc-socket-server.ts +++ b/packages/core/server/src/gateway/ipc-socket-server.ts @@ -2,7 +2,9 @@ import { randomUUID } from 'crypto'; import fs from 'fs'; import net from 'net'; import path from 'path'; + import xpipe from 'xpipe'; + import { AppSupervisor } from '../app-supervisor'; import { writeJSON } from './ipc-socket-client'; diff --git a/packages/core/server/src/gateway/ws-server.ts b/packages/core/server/src/gateway/ws-server.ts index 68c4f5c5d..7433a6a00 100644 --- a/packages/core/server/src/gateway/ws-server.ts +++ b/packages/core/server/src/gateway/ws-server.ts @@ -1,12 +1,14 @@ -import { Gateway, IncomingRequest } from '../gateway'; -import WebSocket, { WebSocketServer } from 'ws'; -import { nanoid } from 'nanoid'; import { IncomingMessage } from 'http'; -import { AppSupervisor } from '../app-supervisor'; -import { applyErrorWithArgs, getErrorWithCode } from './errors'; -import lodash from 'lodash'; import { Logger } from '@tachybase/logger'; +import lodash from 'lodash'; +import { nanoid } from 'nanoid'; +import WebSocket, { WebSocketServer } from 'ws'; + +import { AppSupervisor } from '../app-supervisor'; +import { Gateway, IncomingRequest } from '../gateway'; +import { applyErrorWithArgs, getErrorWithCode } from './errors'; + declare class WebSocketWithId extends WebSocket { id: string; } diff --git a/packages/core/server/src/helpers/application-version.ts b/packages/core/server/src/helpers/application-version.ts index 8b1973f6c..fdce13ab5 100644 --- a/packages/core/server/src/helpers/application-version.ts +++ b/packages/core/server/src/helpers/application-version.ts @@ -1,5 +1,7 @@ import { Collection } from '@tachybase/database'; + import semver from 'semver'; + import Application from '../application'; export class ApplicationVersion { diff --git a/packages/core/server/src/migration.ts b/packages/core/server/src/migration.ts index 8c780fe3d..71f1601a6 100644 --- a/packages/core/server/src/migration.ts +++ b/packages/core/server/src/migration.ts @@ -1,4 +1,5 @@ import { Migration as DbMigration } from '@tachybase/database'; + import Application from './application'; import Plugin from './plugin'; import { PluginManager } from './plugin-manager'; diff --git a/packages/core/server/src/migrations/20230912193824-package-name-unique.ts b/packages/core/server/src/migrations/20230912193824-package-name-unique.ts index 9d05dffb0..0ce2697f2 100644 --- a/packages/core/server/src/migrations/20230912193824-package-name-unique.ts +++ b/packages/core/server/src/migrations/20230912193824-package-name-unique.ts @@ -1,4 +1,5 @@ import { DataTypes } from '@tachybase/database'; + import { Migration } from '../migration'; export default class extends Migration { diff --git a/packages/core/server/src/plugin-manager/options/resource.ts b/packages/core/server/src/plugin-manager/options/resource.ts index b46100e12..772a6fa78 100644 --- a/packages/core/server/src/plugin-manager/options/resource.ts +++ b/packages/core/server/src/plugin-manager/options/resource.ts @@ -1,9 +1,11 @@ -import { uid } from '@tachybase/utils'; import fs from 'fs'; import path from 'path'; +import { uid } from '@tachybase/utils'; + import Application from '../../application'; import { getExposeUrl } from '../clientStaticUtils'; import PluginManager from '../plugin-manager'; + //@ts-ignore export default { diff --git a/packages/core/server/src/plugin-manager/plugin-manager-repository.ts b/packages/core/server/src/plugin-manager/plugin-manager-repository.ts index e0cea71e5..c157fc11e 100644 --- a/packages/core/server/src/plugin-manager/plugin-manager-repository.ts +++ b/packages/core/server/src/plugin-manager/plugin-manager-repository.ts @@ -1,5 +1,7 @@ import { Repository } from '@tachybase/database'; + import lodash from 'lodash'; + import { PluginManager } from './plugin-manager'; export class PluginManagerRepository extends Repository { diff --git a/packages/core/test/setup/client.ts b/packages/core/test/setup/client.ts index 0d4a46622..90425c690 100644 --- a/packages/core/test/setup/client.ts +++ b/packages/core/test/setup/client.ts @@ -1,4 +1,5 @@ import '@testing-library/jest-dom/vitest'; + import { configure } from '@testing-library/react'; import dotenv from 'dotenv'; import { vi } from 'vitest'; @@ -8,6 +9,7 @@ import { vi } from 'vitest'; * 解决 ReferenceError: Worker is not defined */ import 'jsdom-worker'; + import path from 'path'; configure({ asyncUtilTimeout: 30000 }); diff --git a/packages/core/test/src/client/index.ts b/packages/core/test/src/client/index.ts index 5419aeb53..b75e67eda 100644 --- a/packages/core/test/src/client/index.ts +++ b/packages/core/test/src/client/index.ts @@ -1,5 +1,7 @@ import React from 'react'; + import { render } from '@testing-library/react'; + export { renderHook } from '@testing-library/react-hooks'; export type { queries } from '@testing-library/dom'; diff --git a/packages/core/test/src/scripts/test-db-creator.ts b/packages/core/test/src/scripts/test-db-creator.ts index a44739d7a..a428f49ec 100644 --- a/packages/core/test/src/scripts/test-db-creator.ts +++ b/packages/core/test/src/scripts/test-db-creator.ts @@ -1,10 +1,11 @@ import http from 'http'; -import url from 'url'; -import pg from 'pg'; -import dotenv from 'dotenv'; import path from 'path'; -import mysql from 'mysql2/promise'; +import url from 'url'; + +import dotenv from 'dotenv'; import mariadb from 'mariadb'; +import mysql from 'mysql2/promise'; +import pg from 'pg'; dotenv.config({ path: path.resolve(process.cwd(), '.env.test') }); diff --git a/packages/core/test/src/scripts/test-db-distributor.ts b/packages/core/test/src/scripts/test-db-distributor.ts index b82f84773..bc95707e7 100644 --- a/packages/core/test/src/scripts/test-db-distributor.ts +++ b/packages/core/test/src/scripts/test-db-distributor.ts @@ -1,9 +1,10 @@ -import http from 'http'; -import url from 'url'; -import pg from 'pg'; -import dotenv from 'dotenv'; -import path from 'path'; import fs from 'fs'; +import http from 'http'; +import path from 'path'; +import url from 'url'; + +import dotenv from 'dotenv'; +import pg from 'pg'; dotenv.config({ path: path.resolve(process.cwd(), '.env.test') }); const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/core/test/src/server/mockServer.ts b/packages/core/test/src/server/mockServer.ts index 15ac52139..668533c07 100644 --- a/packages/core/test/src/server/mockServer.ts +++ b/packages/core/test/src/server/mockServer.ts @@ -1,5 +1,6 @@ import { mockDatabase } from '@tachybase/database'; import { Application, ApplicationOptions, AppSupervisor, Gateway, PluginManager } from '@tachybase/server'; + import jwt from 'jsonwebtoken'; import qs from 'qs'; import supertest, { SuperAgentTest } from 'supertest'; diff --git a/packages/core/test/vitest.d.ts b/packages/core/test/vitest.d.ts index f8f46ea77..9868d3624 100644 --- a/packages/core/test/vitest.d.ts +++ b/packages/core/test/vitest.d.ts @@ -1,3 +1,5 @@ +import { type UserConfig } from 'vitest/config'; + declare global { const suite: (typeof import('vitest'))['suite']; const test: (typeof import('vitest'))['test']; @@ -15,7 +17,6 @@ declare global { const afterEach: (typeof import('vitest'))['afterEach']; } -import { type UserConfig } from 'vitest/config'; export declare const defineConfig: ( config?: UserConfig & { server: boolean; diff --git a/packages/core/test/vitest.mjs b/packages/core/test/vitest.mjs index 48abbf25a..36f7b7168 100644 --- a/packages/core/test/vitest.mjs +++ b/packages/core/test/vitest.mjs @@ -1,7 +1,8 @@ -import react from '@vitejs/plugin-react'; import fs from 'fs'; import path, { resolve } from 'path'; import { URL } from 'url'; + +import react from '@vitejs/plugin-react'; import { defineConfig as vitestConfig } from 'vitest/config'; const __dirname = new URL('.', import.meta.url).pathname; diff --git a/packages/core/utils/client.d.ts b/packages/core/utils/client.d.ts index 2cdddd926..d472744e5 100644 --- a/packages/core/utils/client.d.ts +++ b/packages/core/utils/client.d.ts @@ -1,2 +1,2 @@ // @ts-nocheck -export * from './lib/client'; \ No newline at end of file +export * from './lib/client'; diff --git a/packages/core/utils/client.js b/packages/core/utils/client.js index 5effcafee..c33f9e397 100644 --- a/packages/core/utils/client.js +++ b/packages/core/utils/client.js @@ -1,12 +1,12 @@ -var _useExportClient = require("./lib/client"); +var _useExportClient = require('./lib/client'); Object.keys(_useExportClient).forEach(function (key) { - if (key === "default" || key === "__esModule") return; + if (key === 'default' || key === '__esModule') return; if (key in exports && exports[key] === _useExportClient[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _useExportClient[key]; - } + }, }); }); diff --git a/packages/core/utils/server.js b/packages/core/utils/server.js index c93247d51..b4a699dc6 100644 --- a/packages/core/utils/server.js +++ b/packages/core/utils/server.js @@ -1,12 +1,12 @@ -var _useExportServer = require("./lib/server"); +var _useExportServer = require('./lib/server'); Object.keys(_useExportServer).forEach(function (key) { - if (key === "default" || key === "__esModule") return; + if (key === 'default' || key === '__esModule') return; if (key in exports && exports[key] === _useExportServer[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _useExportServer[key]; - } + }, }); }); diff --git a/packages/core/utils/src/__tests__/import-module.test.ts b/packages/core/utils/src/__tests__/import-module.test.ts index 9c306259e..c417348b0 100644 --- a/packages/core/utils/src/__tests__/import-module.test.ts +++ b/packages/core/utils/src/__tests__/import-module.test.ts @@ -1,4 +1,5 @@ import path from 'path'; + import { importModule } from '../requireModule'; describe('import module', () => { diff --git a/packages/core/utils/src/assign.ts b/packages/core/utils/src/assign.ts index c7ff6921f..d975cf349 100644 --- a/packages/core/utils/src/assign.ts +++ b/packages/core/utils/src/assign.ts @@ -1,5 +1,6 @@ import deepmerge from 'deepmerge'; import lodash from 'lodash'; + import { isPlainObject } from './common'; type MergeStrategyType = 'merge' | 'deepMerge' | 'overwrite' | 'andMerge' | 'orMerge' | 'intersect' | 'union'; @@ -13,7 +14,9 @@ export interface MergeStrategies { function getEnumerableOwnPropertySymbols(target: any): any[] { return Object.getOwnPropertySymbols - ? Object.getOwnPropertySymbols(target).filter((symbol) => target.propertyIsEnumerable(symbol)) + ? Object.getOwnPropertySymbols(target).filter((symbol) => + Object.prototype.propertyIsEnumerable.call(target, symbol), + ) : []; } diff --git a/packages/core/utils/src/date.ts b/packages/core/utils/src/date.ts index dcf1c4a41..8f172e2a1 100644 --- a/packages/core/utils/src/date.ts +++ b/packages/core/utils/src/date.ts @@ -1,4 +1,5 @@ import _ from 'lodash'; + import { dayjs } from './dayjs'; export interface Str2momentOptions { diff --git a/packages/core/utils/src/index.ts b/packages/core/utils/src/index.ts index 2319b5346..9bfff7de0 100644 --- a/packages/core/utils/src/index.ts +++ b/packages/core/utils/src/index.ts @@ -1,4 +1,5 @@ import lodash from 'lodash'; + import { dayjs } from './dayjs'; export * from './assign'; diff --git a/packages/core/utils/src/json-templates.ts b/packages/core/utils/src/json-templates.ts index baad0ca02..acee720db 100644 --- a/packages/core/utils/src/json-templates.ts +++ b/packages/core/utils/src/json-templates.ts @@ -3,8 +3,8 @@ // // Created by Curran Kelleher and Chrostophe Serafin. // Contributions from Paul Brewer and Javier Blanco Martinez. -import { get } from 'lodash'; import dedupe from 'dedupe'; +import { get } from 'lodash'; // An enhanced version of `typeof` that handles arrays and dates as well. function type(value) { diff --git a/packages/core/utils/src/parse-filter.ts b/packages/core/utils/src/parse-filter.ts index 72435dd14..10df2839d 100644 --- a/packages/core/utils/src/parse-filter.ts +++ b/packages/core/utils/src/parse-filter.ts @@ -1,5 +1,6 @@ import _ from 'lodash'; import set from 'lodash/set'; + import { offsetFromString } from './date'; import { dayjs } from './dayjs'; import { getValuesByPath } from './getValuesByPath'; diff --git a/packages/core/utils/src/perf-hooks.ts b/packages/core/utils/src/perf-hooks.ts index d9d3ae351..42dc7b3e6 100644 --- a/packages/core/utils/src/perf-hooks.ts +++ b/packages/core/utils/src/perf-hooks.ts @@ -1,4 +1,4 @@ -import { RecordableHistogram, performance } from 'perf_hooks'; +import { performance, RecordableHistogram } from 'perf_hooks'; export const prePerfHooksWrap = (handler: any, options?: { name?: string }) => { const { name } = options || {}; diff --git a/packages/core/utils/src/typedi/container-instance.class.ts b/packages/core/utils/src/typedi/container-instance.class.ts index 8eb175e1a..ba7d77ce6 100644 --- a/packages/core/utils/src/typedi/container-instance.class.ts +++ b/packages/core/utils/src/typedi/container-instance.class.ts @@ -1,15 +1,15 @@ -import { ServiceNotFoundError } from './error/service-not-found.error'; +import { ContainerRegistry } from './container-registry.class'; +import { EMPTY_VALUE } from './empty.const'; import { CannotInstantiateValueError } from './error/cannot-instantiate-value.error'; -import { Token } from './token.class'; -import { Constructable } from './types/constructable.type'; -import { ServiceIdentifier } from './types/service-identifier.type'; +import { ServiceNotFoundError } from './error/service-not-found.error'; +import { Handler } from './interfaces/handler.interface'; import { ServiceMetadata } from './interfaces/service-metadata.interface'; import { ServiceOptions } from './interfaces/service-options.interface'; -import { EMPTY_VALUE } from './empty.const'; +import { Token } from './token.class'; +import { Constructable } from './types/constructable.type'; import { ContainerIdentifier } from './types/container-identifier.type'; -import { Handler } from './interfaces/handler.interface'; -import { ContainerRegistry } from './container-registry.class'; import { ContainerScope } from './types/container-scope.type'; +import { ServiceIdentifier } from './types/service-identifier.type'; /** * TypeDI can have multiple containers. diff --git a/packages/core/utils/src/typedi/decorators/inject-many.decorator.ts b/packages/core/utils/src/typedi/decorators/inject-many.decorator.ts index 371855d5e..ccd47d85d 100644 --- a/packages/core/utils/src/typedi/decorators/inject-many.decorator.ts +++ b/packages/core/utils/src/typedi/decorators/inject-many.decorator.ts @@ -1,9 +1,9 @@ -import { Token } from '../token.class'; +import { ContainerInstance } from '../container-instance.class'; import { CannotInjectValueError } from '../error/cannot-inject-value.error'; -import { resolveToTypeWrapper } from '../utils/resolve-to-type-wrapper.util'; +import { Token } from '../token.class'; import { Constructable } from '../types/constructable.type'; import { ServiceIdentifier } from '../types/service-identifier.type'; -import { ContainerInstance } from '../container-instance.class'; +import { resolveToTypeWrapper } from '../utils/resolve-to-type-wrapper.util'; /** * Injects a list of services into a class property or constructor parameter. diff --git a/packages/core/utils/src/typedi/decorators/inject.decorator.ts b/packages/core/utils/src/typedi/decorators/inject.decorator.ts index 0b5580a56..d0ce09e25 100644 --- a/packages/core/utils/src/typedi/decorators/inject.decorator.ts +++ b/packages/core/utils/src/typedi/decorators/inject.decorator.ts @@ -1,9 +1,9 @@ -import { Token } from '../token.class'; -import { CannotInjectValueError } from '../error/cannot-inject-value.error'; -import { ServiceIdentifier } from '../types/service-identifier.type'; -import { Constructable } from '../types/constructable.type'; -import { resolveToTypeWrapper } from '../utils/resolve-to-type-wrapper.util'; import { ContainerInstance } from '../container-instance.class'; +import { CannotInjectValueError } from '../error/cannot-inject-value.error'; +import { Token } from '../token.class'; +import { Constructable } from '../types/constructable.type'; +import { ServiceIdentifier } from '../types/service-identifier.type'; +import { resolveToTypeWrapper } from '../utils/resolve-to-type-wrapper.util'; /** * Injects a service into a class property or constructor parameter. diff --git a/packages/core/utils/src/typedi/decorators/service.decorator.ts b/packages/core/utils/src/typedi/decorators/service.decorator.ts index 49f56167b..dd0730f30 100644 --- a/packages/core/utils/src/typedi/decorators/service.decorator.ts +++ b/packages/core/utils/src/typedi/decorators/service.decorator.ts @@ -1,8 +1,8 @@ +import { ContainerInstance } from '../container-instance.class'; +import { EMPTY_VALUE } from '../empty.const'; import { ServiceMetadata } from '../interfaces/service-metadata.interface'; import { ServiceOptions } from '../interfaces/service-options.interface'; -import { EMPTY_VALUE } from '../empty.const'; import { Constructable } from '../types/constructable.type'; -import { ContainerInstance } from '../container-instance.class'; /** * Marks class as a service that can be injected using Container. diff --git a/packages/core/utils/src/typedi/error/cannot-instantiate-value.error.ts b/packages/core/utils/src/typedi/error/cannot-instantiate-value.error.ts index 9d784cac3..38bbb12d4 100644 --- a/packages/core/utils/src/typedi/error/cannot-instantiate-value.error.ts +++ b/packages/core/utils/src/typedi/error/cannot-instantiate-value.error.ts @@ -1,5 +1,5 @@ -import { ServiceIdentifier } from '../types/service-identifier.type'; import { Token } from '../token.class'; +import { ServiceIdentifier } from '../types/service-identifier.type'; /** * Thrown when DI cannot inject value into property decorated by @Inject decorator. diff --git a/packages/core/utils/src/typedi/error/service-not-found.error.ts b/packages/core/utils/src/typedi/error/service-not-found.error.ts index 741c14264..e83e6829a 100644 --- a/packages/core/utils/src/typedi/error/service-not-found.error.ts +++ b/packages/core/utils/src/typedi/error/service-not-found.error.ts @@ -1,5 +1,5 @@ -import { ServiceIdentifier } from '../types/service-identifier.type'; import { Token } from '../token.class'; +import { ServiceIdentifier } from '../types/service-identifier.type'; /** * Thrown when requested service was not found. diff --git a/packages/core/utils/src/typedi/types/service-identifier.type.ts b/packages/core/utils/src/typedi/types/service-identifier.type.ts index f0f886a82..0612cea08 100644 --- a/packages/core/utils/src/typedi/types/service-identifier.type.ts +++ b/packages/core/utils/src/typedi/types/service-identifier.type.ts @@ -1,6 +1,6 @@ import { Token } from '../token.class'; -import { Constructable } from './constructable.type'; import { AbstractConstructable } from './abstract-constructable.type'; +import { Constructable } from './constructable.type'; /** * Unique service identifier. diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css index 1d62ed15f..6b2548167 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css @@ -1,4 +1,4 @@ -.tabsBarStyle{ +.tabsBarStyle { position: fixed; bottom: 0; z-index: 2; @@ -7,7 +7,7 @@ background-color: #ffffff; } -.navBarStyle{ +.navBarStyle { background-color: #ffffff; position: fixed; z-index: 2; @@ -15,17 +15,17 @@ width: 100vw; } -.approvalContext{ +.approvalContext { margin: 7vh 0 7vh 0; } -.todosSpacStyle{ - width:100%; +.todosSpacStyle { + width: 100%; font-size: 10px; color: #8e8e8e; } -.userInitiationsStyle{ +.userInitiationsStyle { width: 100%; padding: 10px 0 10px 0; background-color: #ffffff; @@ -33,26 +33,22 @@ color: #8e8e8e; } -.adm-tabs-tab-list{ +.adm-tabs-tab-list { background-color: #ffffff; font-size: 12px; } -.blockItem{ +.blockItem { background-color: #f3f3f3; } - .adm-card-body { - padding: 0; - } +.adm-card-body { + padding: 0; +} - .initiationsItemCard{ +.initiationsItemCard { padding: 0px; border-radius: 0px; overflow: hidden; background-color: #f3f3f3; - } - - - - +} diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesAddition.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesAddition.tsx index 2b4d98b7e..d6c654a08 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesAddition.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesAddition.tsx @@ -1,9 +1,10 @@ -import React from 'react'; -import { PlusOutlined } from '@ant-design/icons'; +import React, { useCallback, useState } from 'react'; import { ArrayItems } from '@tachybase/components'; import { useWorkflowExecuted } from '@tachybase/plugin-workflow/client'; + +import { PlusOutlined } from '@ant-design/icons'; import { Button, Popover, Space } from 'antd'; -import { useCallback, useState } from 'react'; + import { useTranslation } from '../../../locale'; // 添加审批人(选择/查询) diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesSelect.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesSelect.tsx index 0251c0e2a..17a950cd2 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesSelect.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approval-config/VC.AssigneesSelect.tsx @@ -1,7 +1,7 @@ -import { RemoteSelect, SchemaComponent, Variable, useCollectionFilterOptions, useToken } from '@tachybase/client'; +import { default as React } from 'react'; +import { RemoteSelect, SchemaComponent, useCollectionFilterOptions, useToken, Variable } from '@tachybase/client'; import { FilterDynamicComponent, useWorkflowVariableOptions } from '@tachybase/plugin-workflow/client'; import { useField } from '@tachybase/schema'; -import { default as React } from 'react'; // 添加审批人-选择器 export const AssigneesSelect = (props) => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverActionConfig.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverActionConfig.tsx index d4aafeaef..2d2c22137 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverActionConfig.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverActionConfig.tsx @@ -1,6 +1,7 @@ import { SchemaInitializer } from '@tachybase/client'; -import { NAMESPACE } from '../../../locale'; + import { APPROVAL_ACTION_STATUS } from '../../../constants'; +import { NAMESPACE } from '../../../locale'; import { ApprovalActionConfigComponent } from './VC.ApprovalActionConfig'; export const ApproverActionConfigInitializer = new SchemaInitializer({ diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverAddBlock.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverAddBlock.tsx index 9434b3a3b..f518b541c 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverAddBlock.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/Iz.ApproverAddBlock.tsx @@ -1,10 +1,11 @@ -import { SchemaInitializer, gridRowColWrap, usePlugin } from '@tachybase/client'; +import { gridRowColWrap, SchemaInitializer, usePlugin } from '@tachybase/client'; import PluginWorkflow, { useAvailableUpstreams, useFlowContext, useNodeContext, useTrigger, } from '@tachybase/plugin-workflow/client'; + import { NAMESPACE } from '../../../locale'; import { ApproverAddBlockComponent } from './VC.ApproverAddBlock'; import { ApproverAddBlockKit } from './VC.ApproverAddBlockKit'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalActionConfig.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalActionConfig.tsx index 2b08a1d75..a95c641cd 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalActionConfig.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalActionConfig.tsx @@ -1,5 +1,5 @@ -import { ActionInitializer, useSchemaInitializerItem } from '@tachybase/client'; import React from 'react'; +import { ActionInitializer, useSchemaInitializerItem } from '@tachybase/client'; export const ApprovalActionConfigComponent = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalFormBlockProvider.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalFormBlockProvider.tsx index 8963b9297..0d810a6f9 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalFormBlockProvider.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApprovalFormBlockProvider.tsx @@ -1,3 +1,4 @@ +import React, { Fragment, useContext, useMemo, useRef } from 'react'; import { BlockRequestContext_deprecated, CollectionProvider_deprecated, @@ -9,8 +10,7 @@ import { useAssociationNames, useDesignable, } from '@tachybase/client'; -import { RecursionField, createForm, useField, useFieldSchema } from '@tachybase/schema'; -import React, { Fragment, useContext, useMemo, useRef } from 'react'; +import { createForm, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; export const ApprovalFormBlockProvider = (props) => { const fieldSchema = useFieldSchema(); diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlock.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlock.tsx index 402fa0374..2ed8f96d4 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlock.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlock.tsx @@ -1,14 +1,15 @@ import React from 'react'; import { - SchemaInitializerItem, createReadPrettyFormBlockSchema, parseCollectionName, + SchemaInitializerItem, useRecordCollectionDataSourceItems, useSchemaInitializer, useSchemaInitializerItem, useSchemaTemplateManager, } from '@tachybase/client'; import { useFlowContext } from '@tachybase/plugin-workflow/client'; + import _ from 'lodash'; export const ApproverAddBlockComponent = () => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlockKit.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlockKit.tsx index 4c0e1380c..0c5602ef7 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlockKit.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverAddBlockKit.tsx @@ -1,9 +1,10 @@ import React from 'react'; -import { InitializerWithSwitch, createFormBlockSchema, useSchemaInitializerItem } from '@tachybase/client'; +import { createFormBlockSchema, InitializerWithSwitch, useSchemaInitializerItem } from '@tachybase/client'; + import _ from 'lodash'; + +import { APPROVAL_ACTION_STATUS, flatSchemaArray } from '../../../constants'; import { NAMESPACE } from '../../../locale'; -import { APPROVAL_ACTION_STATUS } from '../../../constants'; -import { flatSchemaArray } from '../../../constants'; // 创建区块-操作switch export const ApproverAddBlockKit = () => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverBlock.tsx b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverBlock.tsx index 850612f24..59ce86a6c 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverBlock.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/configuration/instruction/approver-interface/VC.ApproverBlock.tsx @@ -1,18 +1,19 @@ -import { SchemaComponent, useAPIClient, useFormBlockContext, useRequest } from '@tachybase/client'; -import { uid } from '@tachybase/utils/client'; import { default as React, useCallback, useContext } from 'react'; +import { SchemaComponent, useAPIClient, useFormBlockContext, useRequest } from '@tachybase/client'; +import { DetailsBlockProvider, SimpleDesigner } from '@tachybase/plugin-workflow/client'; import { useForm } from '@tachybase/schema'; -import { Spin } from 'antd'; -import { flatSchemaArray } from '../../../constants'; +import { uid } from '@tachybase/utils/client'; + +import { Spin } from 'antd'; -import { ApprovalFormBlockProvider } from './VC.ApprovalFormBlockProvider'; import { FormBlockProvider } from '../../../common/Pd.FormBlock'; +import { flatSchemaArray } from '../../../constants'; +import { ContextApproverConfig } from '../Pd.ContextApproverConfig'; import { ActionBarProvider } from './Pd.ActionBarProvider'; import { ApprovalActionProvider } from './Pd.ApprovalActionProvider'; -import { DetailsBlockProvider, SimpleDesigner } from '@tachybase/plugin-workflow/client'; import { ContextApproverBlock } from './Pd.SchemaConfigButtonContext'; import { useApprovalFormBlockProps } from './useApprovalFormBlockProps'; -import { ContextApproverConfig } from '../Pd.ContextApproverConfig'; +import { ApprovalFormBlockProvider } from './VC.ApprovalFormBlockProvider'; export const ApproverBlock = ({ value: srcID, onChange }) => { const apiClient = useAPIClient(); diff --git a/packages/plugins/@hera/plugin-approval/src/client/constants.ts b/packages/plugins/@hera/plugin-approval/src/client/constants.ts index c356e7c41..bd346d24d 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/constants.ts +++ b/packages/plugins/@hera/plugin-approval/src/client/constants.ts @@ -1,5 +1,7 @@ import { JOB_STATUS } from '@tachybase/plugin-workflow/client'; -import { NAMESPACE, lang } from './locale'; + +import { lang, NAMESPACE } from './locale'; + // 审批状态 export const APPROVAL_STATUS = { DRAFT: 0, diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Dt.Record.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Dt.Record.tsx index c5e318f07..b44c21e6a 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Dt.Record.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/Dt.Record.tsx @@ -1,5 +1,5 @@ -import { RecordProvider, useRecord } from '@tachybase/client'; import React from 'react'; +import { RecordProvider, useRecord } from '@tachybase/client'; export function RecordDecorator(props) { const { latestExecutionId } = useRecord(); diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ApprovalBlockLaunch.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ApprovalBlockLaunch.tsx index 30e9691cf..39c1be2e4 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ApprovalBlockLaunch.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ApprovalBlockLaunch.tsx @@ -1,10 +1,11 @@ import React from 'react'; import { SchemaComponent } from '@tachybase/client'; + +import { NodeColumn } from '../../approval-common/approval-columns/column.node'; import { UserColumn } from '../../approval-common/approval-columns/column.user'; import { WorkflowColumn } from '../../approval-common/approval-columns/column.workflow'; -import { NodeColumn } from '../../approval-common/approval-columns/column.node'; -import { SchemaApprovalBlockLaunch } from './Sm.ApprovalBlockLaunch'; import { ApplyButton } from './apply-button/VC.ApplyButton'; +import { SchemaApprovalBlockLaunch } from './Sm.ApprovalBlockLaunch'; // 审批-发起: 区块表格 export const ApprovalBlockLaunch = () => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ViewActionLaunch.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ViewActionLaunch.tsx index 1bf434341..67570c548 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ViewActionLaunch.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/VC.ViewActionLaunch.tsx @@ -1,5 +1,6 @@ -import { SchemaComponent, useRecord } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent, useRecord } from '@tachybase/client'; + import { RecordDecorator } from './Dt.Record'; import { ViewActionLaunchContent } from './VC.ViewActionLaunchContent'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/Pd.ActionStatus.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/Pd.ActionStatus.tsx index 3911144a7..bf5eba609 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/Pd.ActionStatus.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/Pd.ActionStatus.tsx @@ -1,5 +1,5 @@ -import React, { useContext } from 'react'; -import { createContext } from 'react'; +import React, { createContext, useContext } from 'react'; + import { APPROVAL_STATUS } from '../../../../constants'; const ContextApprovalStatus = createContext(APPROVAL_STATUS.SUBMITTED); diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/hooks/useSubmit.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/hooks/useSubmit.tsx index 1b2857e55..6f6d2ec61 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/hooks/useSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/launch/apply-button/hooks/useSubmit.tsx @@ -1,12 +1,13 @@ import { joinCollectionName, - useAPIClient, useActionContext, + useAPIClient, useBlockRequestContext, useCollection_deprecated, } from '@tachybase/client'; import { useFlowContext } from '@tachybase/plugin-workflow/client'; import { useField, useForm } from '@tachybase/schema'; + import { useContextApprovalStatus } from '../Pd.ActionStatus'; export function useSubmit() { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Dt.ApprovalFormBlock.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Dt.ApprovalFormBlock.tsx index 2d67a5351..1b2b2d0f4 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Dt.ApprovalFormBlock.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Dt.ApprovalFormBlock.tsx @@ -1,3 +1,4 @@ +import React, { Fragment, useContext, useMemo, useRef } from 'react'; import { BlockRequestContext_deprecated, CollectionProvider_deprecated, @@ -11,9 +12,10 @@ import { useDesignable, } from '@tachybase/client'; import { useFlowContext } from '@tachybase/plugin-workflow/client'; -import { RecursionField, createForm, useField, useFieldSchema } from '@tachybase/schema'; +import { createForm, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; -import React, { Fragment, useContext, useMemo, useRef } from 'react'; + import { useContextApprovalExecutions } from './Pd.ApprovalExecutions'; export function ApprovalFormBlockDecorator(props) { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ActionBarProvider.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ActionBarProvider.tsx index 0eb1a09bd..268aa7ae7 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ActionBarProvider.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ActionBarProvider.tsx @@ -1,7 +1,9 @@ import React from 'react'; import { ActionBarProvider as ClientActionBarProvider, useCompile } from '@tachybase/client'; import { str2moment } from '@tachybase/utils/client'; + import { Space, Tag } from 'antd'; + import { approvalStatusConfigObj } from '../../../constants'; import { useContextApprovalExecutions } from './Pd.ApprovalExecutions'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ApprovalAction.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ApprovalAction.tsx index bd4a70723..c392e86e9 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ApprovalAction.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/Pd.ApprovalAction.tsx @@ -1,5 +1,5 @@ -import React, { useContext } from 'react'; -import { createContext } from 'react'; +import React, { createContext, useContext } from 'react'; + import { useContextApprovalExecutions } from './Pd.ApprovalExecutions'; export interface ApprovalAction { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ApprovalBlockTodos.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ApprovalBlockTodos.tsx index 25bcf7cd4..100db1f55 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ApprovalBlockTodos.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ApprovalBlockTodos.tsx @@ -1,5 +1,6 @@ -import { SchemaComponent } from '@tachybase/client'; import React from 'react'; +import { SchemaComponent } from '@tachybase/client'; + import { NodeColumn } from '../../approval-common/approval-columns/column.node'; import { ApprovalRecordStatusColumn } from '../../approval-common/approval-columns/column.status'; import { UserColumn } from '../../approval-common/approval-columns/column.user'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ViewActionTodos.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ViewActionTodos.tsx index ff224d896..2aded9af9 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ViewActionTodos.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/VC.ViewActionTodos.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { SchemaComponent, useRecord } from '@tachybase/client'; + import { ViewActionTodosContent } from './VC.ViewActionTodosContent'; // 审批-待办: 操作-查看 diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useApprovalDetailBlockProps.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useApprovalDetailBlockProps.tsx index fa4d89e3b..211ba9f7a 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useApprovalDetailBlockProps.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useApprovalDetailBlockProps.tsx @@ -1,5 +1,6 @@ -import { useFormBlockContext } from '@tachybase/client'; import { useEffect } from 'react'; +import { useFormBlockContext } from '@tachybase/client'; + import { useContextApprovalExecutions } from '../Pd.ApprovalExecutions'; export function useApprovalDetailBlockProps() { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useSubmit.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useSubmit.tsx index 5d5cd325f..6d0d88ff4 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-block/todos/hooks/useSubmit.tsx @@ -1,5 +1,6 @@ -import { useAPIClient, useActionContext, useRefreshActionProps } from '@tachybase/client'; +import { useActionContext, useAPIClient, useRefreshActionProps } from '@tachybase/client'; import { useField, useForm } from '@tachybase/schema'; + import { useContextApprovalAction } from '../Pd.ApprovalAction'; import { useContextApprovalExecutions } from '../Pd.ApprovalExecutions'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.node.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.node.tsx index 3fe17ecf1..6b8f53613 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.node.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.node.tsx @@ -1,4 +1,4 @@ -import { observer, useField, Field } from '@tachybase/schema'; +import { Field, observer, useField } from '@tachybase/schema'; export const NodeColumn = observer( () => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.status.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.status.tsx index 9e6a5c5d8..1cc0411c9 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.status.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.status.tsx @@ -1,8 +1,10 @@ +import React from 'react'; import { useCompile, useRecord } from '@tachybase/client'; import { Field, observer, useField } from '@tachybase/schema'; + import { Tag } from 'antd'; import _ from 'lodash'; -import React from 'react'; + import { APPROVAL_ACTION_STATUS, approvalStatusConfigObj } from '../../../constants'; import { useTranslation } from '../../../locale'; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.user.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.user.tsx index a9b56f4fc..fbbbe2cc5 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.user.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.user.tsx @@ -1,4 +1,4 @@ -import { observer, useField, Field } from '@tachybase/schema'; +import { Field, observer, useField } from '@tachybase/schema'; export const UserColumn = observer( () => { diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.workflow.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.workflow.tsx index 86a4295fc..2ce1646ae 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.workflow.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/approval-columns/column.workflow.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { css } from '@tachybase/client'; -import { observer, useField, Field } from '@tachybase/schema'; +import { Field, observer, useField } from '@tachybase/schema'; + import { useTranslation } from '../../../locale'; export const WorkflowColumn = observer( diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.status.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.status.tsx index 5e12c796d..2e6583958 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.status.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.status.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { useCompile } from '@tachybase/client'; + import { Tag } from 'antd'; -import { approvalStatusConfigObj } from '../../../constants'; + +import { APPROVAL_STATUS, approvalStatusConfigObj, ApprovalStatusEnumDict } from '../../../constants'; import { ColumnStatusComponent } from '../approval-columns/column.status'; -import { ApprovalStatusEnumDict } from '../../../constants'; -import { APPROVAL_STATUS } from '../../../constants'; export function renderColumnStatus(value, record, exist) { // return null; diff --git a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.taskNode.tsx b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.taskNode.tsx index c13927016..cc08c8d4a 100644 --- a/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.taskNode.tsx +++ b/packages/plugins/@hera/plugin-approval/src/client/usage/approval-common/process-columns/render.taskNode.tsx @@ -1,11 +1,13 @@ -import { css, useCompile } from '@tachybase/client'; -import { Progress, Tag } from 'antd'; import React from 'react'; +import { css, useCompile } from '@tachybase/client'; + +import { Progress, Tag } from 'antd'; + import { APPROVAL_ACTION_STATUS, + approvalStatusConfigObj, JobStatusEnums, VoteCategoryEnums, - approvalStatusConfigObj, voteOption, } from '../../../constants'; diff --git a/packages/plugins/@hera/plugin-approval/src/server/plugin.ts b/packages/plugins/@hera/plugin-approval/src/server/plugin.ts index 4d4f39856..e8af2ccf3 100644 --- a/packages/plugins/@hera/plugin-approval/src/server/plugin.ts +++ b/packages/plugins/@hera/plugin-approval/src/server/plugin.ts @@ -1,9 +1,11 @@ import path from 'path'; -import { Plugin } from '@tachybase/server'; import WorkflowPlugin from '@tachybase/plugin-workflow'; -import ApprovalTrigger from './ApprovalTrigger'; -import ApprovalInstruction from './ApprovalInstruction'; +import { Plugin } from '@tachybase/server'; + import { init } from './actions'; +import ApprovalInstruction from './ApprovalInstruction'; +import ApprovalTrigger from './ApprovalTrigger'; + export class PluginWorkflowApproval extends Plugin { workflow; afterAdd() {} diff --git a/packages/plugins/@hera/plugin-rental/src/client/custom-components/DetailChecks.tsx b/packages/plugins/@hera/plugin-rental/src/client/custom-components/DetailChecks.tsx index 30ef1551f..07730b6d3 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/custom-components/DetailChecks.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/custom-components/DetailChecks.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import _ from 'lodash'; -import { CustomComponentType, CustomFunctionComponent } from '@hera/plugin-core/client'; -import { useField, useFieldSchema, useForm } from '@tachybase/schema'; -import { FormPath } from '@tachybase/schema'; import { useRequest } from '@tachybase/client'; +import { FormPath, useField, useFieldSchema, useForm } from '@tachybase/schema'; + +import { CustomComponentType, CustomFunctionComponent } from '@hera/plugin-core/client'; import { Space, Spin, Tag } from 'antd'; +import _ from 'lodash'; export const DetailChecks: CustomFunctionComponent = () => { const form = useForm(); diff --git a/packages/plugins/@hera/plugin-rental/src/client/custom-components/MovementStatus.tsx b/packages/plugins/@hera/plugin-rental/src/client/custom-components/MovementStatus.tsx index 8d4fce3c2..520d53627 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/custom-components/MovementStatus.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/custom-components/MovementStatus.tsx @@ -1,9 +1,11 @@ -import { ArrowRightOutlined } from '@ant-design/icons'; -import { observer, useField, useForm } from '@tachybase/schema'; -import { Col, Row, Tag } from 'antd'; import React from 'react'; -import { useCompany } from '../hooks'; import { css, useCollectionManager } from '@tachybase/client'; +import { observer, useField, useForm } from '@tachybase/schema'; + +import { ArrowRightOutlined } from '@ant-design/icons'; +import { Col, Row, Tag } from 'antd'; + +import { useCompany } from '../hooks'; export const MovementStatus = observer( (props: any) => { diff --git a/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordFeeConvertedRead.tsx b/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordFeeConvertedRead.tsx index 95602f3c0..bb001d376 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordFeeConvertedRead.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordFeeConvertedRead.tsx @@ -1,10 +1,11 @@ -import { onFieldInit, onFieldValueChange } from '@tachybase/schema'; -import { useForm, useFormEffects } from '@tachybase/schema'; -import { CustomComponentType, CustomFunctionComponent } from '@hera/plugin-core/client'; -import { useRequest } from '@tachybase/client'; -import _ from 'lodash'; import React, { useEffect, useState } from 'react'; -import { ConversionLogics, Movement, countCource } from '../../utils/constants'; +import { useRequest } from '@tachybase/client'; +import { onFieldInit, onFieldValueChange, useForm, useFormEffects } from '@tachybase/schema'; + +import { CustomComponentType, CustomFunctionComponent } from '@hera/plugin-core/client'; +import _ from 'lodash'; + +import { ConversionLogics, countCource, Movement } from '../../utils/constants'; export const ReadFeeConvertedAmount: CustomFunctionComponent = () => { // 查数据,查里面的费用关联的数据 diff --git a/packages/plugins/@hera/plugin-rental/src/client/interfaces/movement.ts b/packages/plugins/@hera/plugin-rental/src/client/interfaces/movement.ts index 19a088779..521d63175 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/interfaces/movement.ts +++ b/packages/plugins/@hera/plugin-rental/src/client/interfaces/movement.ts @@ -1,7 +1,8 @@ import { CollectionFieldInterface, dataSource, defaultProps, operators } from '@tachybase/client'; -import { tval } from '../locale'; import { Field, uid } from '@tachybase/schema'; +import { tval } from '../locale'; + export class MovementFieldInterface extends CollectionFieldInterface { name = 'movement'; type = 'object'; diff --git a/packages/plugins/@hera/plugin-rental/src/client/locale.tsx b/packages/plugins/@hera/plugin-rental/src/client/locale.tsx index f58b138d4..a9559a933 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/locale.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/locale.tsx @@ -1,4 +1,4 @@ -import { Application, useApp, tval as nTval } from '@tachybase/client'; +import { Application, tval as nTval, useApp } from '@tachybase/client'; const NAMESPACE = '@hera/plugin-rental'; diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-components/Movement.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-components/Movement.tsx index c279711ae..159686e8f 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-components/Movement.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-components/Movement.tsx @@ -1,8 +1,9 @@ +import React, { useEffect } from 'react'; import { useCollectionField } from '@tachybase/client'; import { connect, isValid, mapProps, mapReadPretty, useField } from '@tachybase/schema'; + import { Tag } from 'antd'; -import React from 'react'; -import { useEffect } from 'react'; + import { MovementStatus } from '../custom-components/MovementStatus'; export const Movement = connect( diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/AddToChecklistActionInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/AddToChecklistActionInitializer.tsx index 4420eed9a..46feea43f 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/AddToChecklistActionInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/AddToChecklistActionInitializer.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { ActionInitializer } from '@tachybase/client'; + import { tval } from '../../locale'; export const AddToChecklistActionInitializer = (props) => { diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/ColumnSwitchActionInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/ColumnSwitchActionInitializer.tsx index 15247ed19..954775553 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/ColumnSwitchActionInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/ColumnSwitchActionInitializer.tsx @@ -1,6 +1,8 @@ import React, { useContext, useEffect, useState } from 'react'; import { ActionInitializer, useRequest } from '@tachybase/client'; + import { Radio } from 'antd'; + import { PdfIsDoubleContext } from '../../hooks/usePdfPath'; export const ColumnSwitchAction = (props) => { diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/PDFViewerPrintActionInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/PDFViewerPrintActionInitializer.tsx index bba9fd68c..224d47b0b 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/PDFViewerPrintActionInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/PDFViewerPrintActionInitializer.tsx @@ -1,6 +1,7 @@ -import { usePDFViewerRef } from '@hera/plugin-core/client'; -import { Action, ActionInitializer, useAPIClient, useRecord } from '@tachybase/client'; import React, { createContext, useContext, useState } from 'react'; +import { Action, ActionInitializer, useAPIClient, useRecord } from '@tachybase/client'; + +import { usePDFViewerRef } from '@hera/plugin-core/client'; const PrintCounterContext = createContext(null); diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintAnnotateActionInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintAnnotateActionInitializer.tsx index af621fab4..d1e1be65b 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintAnnotateActionInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintAnnotateActionInitializer.tsx @@ -1,8 +1,10 @@ import React, { useContext, useEffect, useState } from 'react'; -import { ActionInitializer } from '@tachybase/client'; +import { ActionInitializer, useRequest } from '@tachybase/client'; + import { Switch } from 'antd'; -import { useRequest } from '@tachybase/client'; + import { AnnotateContext } from '../../hooks/usePdfPath'; + export const Annotate = (props) => { const { setAnnotate } = useContext(AnnotateContext); return ( diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintFontSizeInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintFontSizeInitializer.tsx index 2edcc9f17..25674987c 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintFontSizeInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintFontSizeInitializer.tsx @@ -1,8 +1,11 @@ import React, { useContext, useState } from 'react'; import { ActionInitializer } from '@tachybase/client'; + import { Input } from 'antd'; import { debounce } from 'lodash'; + import { FontSizeContext } from '../../hooks/usePdfPath'; + export const PrintFontSize = (props) => { const [value, setValue] = useState('9'); const { setSize } = useContext(FontSizeContext); diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintSetupMargingTopInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintSetupMargingTopInitializer.tsx index 7ea5b12a7..517f0051b 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintSetupMargingTopInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/RecordPrintSetupMargingTopInitializer.tsx @@ -1,10 +1,11 @@ import React, { useContext, useEffect, useState } from 'react'; -import { ActionInitializer, useAPIClient } from '@tachybase/client'; +import { ActionInitializer, useAPIClient, useCurrentUserContext, useRequest } from '@tachybase/client'; + import { Input } from 'antd'; -import { useRequest } from '@tachybase/client'; -import { PdfMargingTopContext } from '../../hooks/usePdfPath'; import { debounce } from 'lodash'; -import { useCurrentUserContext } from '@tachybase/client'; + +import { PdfMargingTopContext } from '../../hooks/usePdfPath'; + export const PrintSetupMargingTop = (props) => { const { data } = useCurrentUserContext(); const userId = data.data?.id; diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExcelExportActionInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExcelExportActionInitializer.tsx index 854731939..b20cfa2a4 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExcelExportActionInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/SettlementExcelExportActionInitializer.tsx @@ -1,8 +1,9 @@ import React, { useContext } from 'react'; import { ActionInitializer, useAPIClient, useRecord } from '@tachybase/client'; import { useField } from '@tachybase/schema'; -import { SettlementStyleContext } from './SettlementStyleSwitchActionInitializer'; + import { ExportToExcel } from './SettlementExportExcel'; +import { SettlementStyleContext } from './SettlementStyleSwitchActionInitializer'; export const useSettlementExcelExportActionProps = () => { const actionField = useField(); diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/paperSwitching.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/paperSwitching.tsx index de44ea8b1..5cf7b1bac 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/paperSwitching.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/actions/paperSwitching.tsx @@ -1,8 +1,10 @@ import React, { useContext, useEffect, useRef, useState } from 'react'; import { ActionInitializer, useRequest } from '@tachybase/client'; -import { Button, Divider, Input, InputRef, Radio, Select, Space } from 'antd'; -import { PdfPaperSwitchingContext } from '../../hooks/usePdfPath'; + import { PlusOutlined } from '@ant-design/icons'; +import { Button, Divider, Input, InputRef, Radio, Select, Space } from 'antd'; + +import { PdfPaperSwitchingContext } from '../../hooks/usePdfPath'; export const PaperSwitching = (props) => { const { setPaper } = useContext(PdfPaperSwitchingContext); diff --git a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/blocks/UnusedRecordsBlockInitializer.tsx b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/blocks/UnusedRecordsBlockInitializer.tsx index 5cfd027e0..196679fcc 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/blocks/UnusedRecordsBlockInitializer.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/schema-initializer/blocks/UnusedRecordsBlockInitializer.tsx @@ -9,6 +9,7 @@ import { useSchemaInitializerItem, } from '@tachybase/client'; import { useFieldSchema } from '@tachybase/schema'; + import { ToolOutlined } from '@ant-design/icons'; import { Tag } from 'antd'; diff --git a/packages/plugins/@hera/plugin-rental/src/interfaces/record.ts b/packages/plugins/@hera/plugin-rental/src/interfaces/record.ts index ea24acf2b..b809b6261 100644 --- a/packages/plugins/@hera/plugin-rental/src/interfaces/record.ts +++ b/packages/plugins/@hera/plugin-rental/src/interfaces/record.ts @@ -1,5 +1,5 @@ import { RecordCategory } from '../utils/constants'; -import { RecordItems, Record_fee_item } from './records'; +import { Record_fee_item, RecordItems } from './records'; export interface Record { weight_items: any; diff --git a/packages/plugins/@hera/plugin-rental/src/interfaces/rule.ts b/packages/plugins/@hera/plugin-rental/src/interfaces/rule.ts index 4f617c21b..392b3abfb 100644 --- a/packages/plugins/@hera/plugin-rental/src/interfaces/rule.ts +++ b/packages/plugins/@hera/plugin-rental/src/interfaces/rule.ts @@ -1,5 +1,5 @@ -import { Product } from './records'; import { ConversionLogics, countCource } from '../utils/constants'; +import { Product } from './records'; export interface FeeRule extends LeaseRule { id: number; diff --git a/packages/plugins/@hera/plugin-rental/src/interfaces/settlement.ts b/packages/plugins/@hera/plugin-rental/src/interfaces/settlement.ts index a07c0ff18..a830dc2a2 100644 --- a/packages/plugins/@hera/plugin-rental/src/interfaces/settlement.ts +++ b/packages/plugins/@hera/plugin-rental/src/interfaces/settlement.ts @@ -1,5 +1,5 @@ -import { Record } from './record'; import { Contract } from './contract'; +import { Record } from './record'; export interface Settlement { settlement_summary_items: any[]; diff --git a/packages/plugins/@hera/plugin-rental/src/server/migrations/update-record-all_price.ts b/packages/plugins/@hera/plugin-rental/src/server/migrations/update-record-all_price.ts index 0435431f3..a3a2d9e7c 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/migrations/update-record-all_price.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/migrations/update-record-all_price.ts @@ -1,4 +1,5 @@ import { Migration } from '@tachybase/server'; + import { ConversionLogics } from '../../utils/constants'; export default class extends Migration { diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/project-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/project-service.ts index ba7968c5b..e950f626f 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/project-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/project-service.ts @@ -1,6 +1,7 @@ import Database, { CreateOptions, MagicAttributeModel } from '@tachybase/database'; +import { Db, Inject, Service } from '@tachybase/utils'; + import { SqlLoader } from '@hera/plugin-core'; -import { Db, Service, Inject } from '@tachybase/utils'; @Service() export class ProjectService { diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-products-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-products-service.ts index e8cc48011..339944889 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/settlement-products-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/settlement-products-service.ts @@ -1,21 +1,23 @@ -import { Db, Service } from '@tachybase/utils'; import Database from '@tachybase/database'; +import { Db, Service } from '@tachybase/utils'; + import dayjs from 'dayjs'; + +import { Record } from '../../interfaces/record'; +import { RecordItems } from '../../interfaces/records'; +import { FeeRule, LeaseRule } from '../../interfaces/rule'; +import { Settlement } from '../../interfaces/settlement'; import { AddItemsCategory, CalcDateType, ConversionLogics, + countCource, Itemcategory, RulesNumber, - countCource, } from '../../utils/constants'; +import { formatQuantity } from '../../utils/currencyUtils'; import { converDate } from '../../utils/daysUtils'; import { converUnitCount } from '../../utils/unitUtils'; -import { Settlement } from '../../interfaces/settlement'; -import { FeeRule, LeaseRule } from '../../interfaces/rule'; -import { Record } from '../../interfaces/record'; -import { RecordItems } from '../../interfaces/records'; -import { formatQuantity } from '../../utils/currencyUtils'; @Service() export class SettlementProductsService { diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/vehicles-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/vehicles-service.ts index 91a4d6c63..95cfe4752 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/vehicles-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/vehicles-service.ts @@ -1,5 +1,6 @@ import Database, { CreateOptions, MagicAttributeModel } from '@tachybase/database'; import { Db, Service } from '@tachybase/utils'; + import validateLicensePlate from '../../utils/validateLIcensePlate'; @Service() diff --git a/packages/plugins/@hera/plugin-sancongtou/src/client/pages/style.less b/packages/plugins/@hera/plugin-sancongtou/src/client/pages/style.less index a8234d6bc..4905f7339 100644 --- a/packages/plugins/@hera/plugin-sancongtou/src/client/pages/style.less +++ b/packages/plugins/@hera/plugin-sancongtou/src/client/pages/style.less @@ -16,4 +16,3 @@ --height: 50%; --border-radius: 8px; } - diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/build.config.ts b/packages/plugins/@tachybase/plugin-field-markdown-vditor/build.config.ts index 2eacb1a5a..a414c2086 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/build.config.ts +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/build.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from '@tachybase/build'; import fs from 'fs/promises'; import path from 'path'; +import { defineConfig } from '@tachybase/build'; const vditor = path.dirname(require.resolve('vditor')); diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Display.tsx b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Display.tsx index 50f732a6c..aee944b2b 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Display.tsx +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Display.tsx @@ -1,8 +1,10 @@ -import { Field, useField } from '@tachybase/schema'; -import { withDynamicSchemaProps } from '@tachybase/client'; -import { Popover } from 'antd'; import React, { CSSProperties, useCallback, useEffect, useRef, useState } from 'react'; +import { withDynamicSchemaProps } from '@tachybase/client'; +import { Field, useField } from '@tachybase/schema'; + +import { Popover } from 'antd'; import Vditor from 'vditor'; + import { useCDN } from './const'; import useStyle from './style'; diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Edit.tsx b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Edit.tsx index e6839b564..1593398e8 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Edit.tsx +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/Edit.tsx @@ -1,6 +1,8 @@ -import { useAPIClient, useApp, withDynamicSchemaProps } from '@tachybase/client'; import React, { useEffect, useLayoutEffect, useRef } from 'react'; +import { useAPIClient, useApp, withDynamicSchemaProps } from '@tachybase/client'; + import Vditor from 'vditor'; + import { defaultToolbar } from '../interfaces/markdown-vditor'; import { useCDN } from './const'; import useStyle from './style'; diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/const.ts b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/const.ts index a5ee31c48..d5954a1a5 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/const.ts +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/const.ts @@ -1,4 +1,5 @@ import { usePlugin } from '@tachybase/client'; + import { PluginFieldMarkdownVditorClient } from '../'; export const useCDN = () => { diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/index.tsx b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/index.tsx index 586e57082..d97e02a9c 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/index.tsx +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/components/index.tsx @@ -1,5 +1,6 @@ -import { connect, mapReadPretty } from '@tachybase/schema'; import { withDynamicSchemaProps } from '@tachybase/client'; +import { connect, mapReadPretty } from '@tachybase/schema'; + import { Display } from './Display'; import { Edit } from './Edit'; diff --git a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/interfaces/markdown-vditor.tsx b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/interfaces/markdown-vditor.tsx index b55afca24..777ce384f 100644 --- a/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/interfaces/markdown-vditor.tsx +++ b/packages/plugins/@tachybase/plugin-field-markdown-vditor/src/client/interfaces/markdown-vditor.tsx @@ -1,7 +1,8 @@ import { CollectionFieldInterface, interfacesProperties } from '@tachybase/client'; -import { generateNTemplate } from '../locale'; import { ISchema } from '@tachybase/schema'; +import { generateNTemplate } from '../locale'; + const { defaultProps, operators } = interfacesProperties; export const defaultToolbar = [ diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/App.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/App.tsx index 9022208bb..3cf71a26f 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/App.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/App.tsx @@ -1,6 +1,8 @@ -import { useApp } from '@tachybase/client'; -import { Card, Form, Input } from 'antd'; import React, { useMemo } from 'react'; +import { useApp } from '@tachybase/client'; + +import { Card, Form, Input } from 'antd'; + import { useTranslation } from '../locale'; export const AppConfiguration = () => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/Interface.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/Interface.tsx index 12901da98..a3c892935 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/Interface.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/configuration/Interface.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { InterfaceRouter } from '../router'; + import { MobileDevice } from '../devices'; +import { InterfaceRouter } from '../router'; export const InterfaceConfiguration = () => { return ( diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/bridge/index.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/bridge/index.ts index 4cae9d3a1..48c8015ae 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/bridge/index.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/bridge/index.ts @@ -1,2 +1,3 @@ import './native-call'; + export * from './injects'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/container/Container.Designer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/container/Container.Designer.tsx index 6d000ee99..cdc90954f 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/container/Container.Designer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/container/Container.Designer.tsx @@ -1,10 +1,11 @@ -import { MenuOutlined } from '@ant-design/icons'; -import { useField, useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { SchemaSettingsDropdown, SchemaSettingsSwitchItem, useDesignable } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaSettingsDropdown, SchemaSettingsSwitchItem, useDesignable } from '@tachybase/client'; +import { uid, useField, useFieldSchema } from '@tachybase/schema'; + +import { MenuOutlined } from '@ant-design/icons'; +import { Button } from 'antd'; import { useNavigate } from 'react-router-dom'; + import { generateNTemplate, useTranslation } from '../../../../locale'; import { findSchema } from '../../helpers'; import { useSchemaPatch } from '../../hooks'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.Designer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.Designer.tsx index e0f919a9e..f599afc4b 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.Designer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.Designer.tsx @@ -1,7 +1,8 @@ +import React from 'react'; +import { GeneralSchemaDesigner, SchemaSettingsModalItem } from '@tachybase/client'; import { Switch } from '@tachybase/components'; import { useField } from '@tachybase/schema'; -import { GeneralSchemaDesigner, SchemaSettingsModalItem } from '@tachybase/client'; -import React from 'react'; + import { useTranslation } from '../../../../locale'; import { useSchemaPatch } from '../../hooks'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.tsx index 11d37d344..94b267123 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/header/Header.tsx @@ -1,8 +1,10 @@ -import { useField } from '@tachybase/schema'; -import { cx, SortableItem, useCompile, useDesigner, useDocumentTitle, useToken } from '@tachybase/client'; -import { NavBar, NavBarProps } from 'antd-mobile'; import React, { useEffect, useMemo } from 'react'; +import { cx, SortableItem, useCompile, useDesigner, useDocumentTitle, useToken } from '@tachybase/client'; +import { useField } from '@tachybase/schema'; + +import { NavBar, NavBarProps } from 'antd-mobile'; import { useNavigate } from 'react-router-dom'; + import { generateNTemplate } from '../../../../locale'; import { HeaderDesigner } from './Header.Designer'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.initializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.initializer.tsx index 11ac830c5..1b0415618 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.initializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.initializer.tsx @@ -1,5 +1,6 @@ -import { DataBlockInitializer, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; import React from 'react'; +import { DataBlockInitializer, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; + import { createSchemaImageSearchBlock } from './ImageSearch.schema'; interface ItemConfig { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.provider.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.provider.tsx index 6c832a2f9..de5c62d10 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.provider.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.provider.tsx @@ -1,5 +1,5 @@ -import { DataBlockProvider } from '@tachybase/client'; import React from 'react'; +import { DataBlockProvider } from '@tachybase/client'; export const ImageSearchProvider = ({ collection, children }) => { return {children}; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.view.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.view.tsx index c8793bf49..c82b6e1c1 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.view.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/ImageSearch.view.tsx @@ -1,6 +1,6 @@ +import React from 'react'; import { useDesigner, useSchemaInitializerRender } from '@tachybase/client'; import { RecursionField, useFieldSchema } from '@tachybase/schema'; -import React from 'react'; export const ImageSearchView = () => { const Designer = useDesigner(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.intializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.intializer.tsx index 4c9b7aad7..41745bc93 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.intializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.intializer.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { SchemaInitializerSwitch, useCurrentSchema, @@ -5,7 +6,6 @@ import { useSchemaInitializerItem, } from '@tachybase/client'; import { merge } from '@tachybase/schema'; -import React from 'react'; export const ImageSearchItemIntializer = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.setting.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.setting.tsx index ce0b39d71..2c035ed5f 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.setting.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.setting.tsx @@ -8,7 +8,9 @@ import { useFormBlockContext, } from '@tachybase/client'; import { useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; + import { useTranslation } from '../../../../../locale'; import { isTabSearchCollapsibleInputItem } from '../../tab-search/utils'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.toolbar.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.toolbar.tsx index d9b5446d4..964cc42f4 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.toolbar.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/ImageSearchItem.toolbar.tsx @@ -1,5 +1,5 @@ -import { SchemaToolbar } from '@tachybase/client'; import React from 'react'; +import { SchemaToolbar } from '@tachybase/client'; export const ImageSearchItemToolbar = (props) => { return ; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Optional.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Optional.ts index 6f277b8ec..8ded94542 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Optional.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Optional.ts @@ -1,7 +1,9 @@ import { useMemo } from 'react'; import { useCollection, useCollectionManager } from '@tachybase/client'; import { useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; + import { useTabSearchCollapsibleInputItem } from '../../tab-search/components/field-item/hooks'; import { canBeOptionalField } from '../../tab-search/utils'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Related.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Related.tsx index 962ba1dbc..c3d42415f 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Related.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/image-search/search-item/useProps.Related.tsx @@ -1,7 +1,8 @@ // 关系字段类型 +import { useEffect, useMemo } from 'react'; import { useCollection, useCollectionManager, useDataSourceHeaders, useRequest } from '@tachybase/client'; import { useField, useFieldSchema } from '@tachybase/schema'; -import { useEffect, useMemo } from 'react'; + import { canBeRelatedField } from '../../tab-search/utils'; import { useGetSelected } from '../hooks/useSelect'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Designer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Designer.tsx index 91547cd6d..023e075a8 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Designer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Designer.tsx @@ -1,8 +1,10 @@ -import { MenuOutlined } from '@ant-design/icons'; -import { useField, useFieldSchema } from '@tachybase/schema'; -import { SchemaSettingsDropdown, SchemaSettingsRemove, useDesignable } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaSettingsDropdown, SchemaSettingsRemove, useDesignable } from '@tachybase/client'; +import { useField, useFieldSchema } from '@tachybase/schema'; + +import { MenuOutlined } from '@ant-design/icons'; +import { Button } from 'antd'; + import { useTranslation } from '../../../../locale'; export const MenuDesigner: React.FC = (props) => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Item.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Item.tsx index 1918e457f..b05b8bcb4 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Item.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.Item.tsx @@ -1,18 +1,20 @@ -import { useField, useFieldSchema } from '@tachybase/schema'; +import React from 'react'; import { + css, + cx, GeneralSchemaDesigner, Icon, SchemaSettingsModalItem, SchemaSettingsRemove, SortableItem, - css, - cx, useCompile, useDesigner, } from '@tachybase/client'; +import { useField, useFieldSchema } from '@tachybase/schema'; + import { List, ListItemProps } from 'antd-mobile'; -import React from 'react'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; + import { useTranslation } from '../../../../locale'; import { useSchemaPatch } from '../../hooks'; import { menuItemSchema } from './schema'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.tsx index 84eb3bbe0..eea2f2882 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/Menu.tsx @@ -1,4 +1,4 @@ -import { useFieldSchema } from '@tachybase/schema'; +import React from 'react'; import { cx, DndContext, @@ -8,8 +8,10 @@ import { useDesignable, useDesigner, } from '@tachybase/client'; +import { useFieldSchema } from '@tachybase/schema'; + import { List } from 'antd-mobile'; -import React from 'react'; + import { useTranslation } from '../../../../locale'; import { PageSchema } from '../../common'; import { MenuDesigner } from './Menu.Designer'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/MenuBlockInitializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/MenuBlockInitializer.tsx index 9aeeb1d91..e2fd7859b 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/MenuBlockInitializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/menu/MenuBlockInitializer.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import { MenuOutlined } from '@ant-design/icons'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; +import { MenuOutlined } from '@ant-design/icons'; + export const MMenuBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { insert } = useSchemaInitializer(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/notice/schema-initializer/NoticeBlockInitializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/notice/schema-initializer/NoticeBlockInitializer.tsx index ebb8ed9f9..729943272 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/notice/schema-initializer/NoticeBlockInitializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/notice/schema-initializer/NoticeBlockInitializer.tsx @@ -6,9 +6,11 @@ import { useSchemaInitializer, useSchemaInitializerItem, } from '@tachybase/client'; + import { NoticeBar } from 'antd-mobile'; -import { createGridCardBlockSchema } from '../schema-create/createGridCardBlockSchma'; + import { NoticeIcon } from '../../../../assets/svg'; +import { createGridCardBlockSchema } from '../schema-create/createGridCardBlockSchma'; export const NoticeBlock = () => { return ; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx index 7fe34dfdc..3ffb3bf4b 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/page/Page.Designer.tsx @@ -1,9 +1,10 @@ -import { MenuOutlined } from '@ant-design/icons'; -import { useField, useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; -import { SchemaSettingsDropdown, SchemaSettingsSwitchItem, useDesignable } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { SchemaSettingsDropdown, SchemaSettingsSwitchItem, useDesignable } from '@tachybase/client'; +import { uid, useField, useFieldSchema } from '@tachybase/schema'; + +import { MenuOutlined } from '@ant-design/icons'; +import { Button } from 'antd'; + import { generateNTemplate, useTranslation } from '../../../../locale'; import { findGridSchema } from '../../helpers'; import { useSchemaPatch } from '../../hooks'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/Settings.Designer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/Settings.Designer.tsx index 0a01a4c10..180a36a29 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/Settings.Designer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/Settings.Designer.tsx @@ -1,5 +1,6 @@ -import { GeneralSchemaDesigner, SchemaSettingsRemove } from '@tachybase/client'; import React from 'react'; +import { GeneralSchemaDesigner, SchemaSettingsRemove } from '@tachybase/client'; + import { useTranslation } from '../../../../locale'; export const SettingsDesigner = () => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx index 207f844a6..06503fef9 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/settings/SettingsBlockInitializer.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import { SettingOutlined } from '@ant-design/icons'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; +import { SettingOutlined } from '@ant-design/icons'; + export const MSettingsBlockInitializer = () => { const itemConfig = useSchemaInitializerItem(); const { insert } = useSchemaInitializer(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlock.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlock.tsx index 37cafd3e6..e839c25e2 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlock.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlock.tsx @@ -1,6 +1,7 @@ -import { BlockItem, css, useDesignable, useRequest, withDynamicSchemaProps } from '@tachybase/client'; -import { Swiper } from 'antd-mobile'; import React from 'react'; +import { BlockItem, css, useDesignable, useRequest, withDynamicSchemaProps } from '@tachybase/client'; + +import { Swiper } from 'antd-mobile'; export const SwiperBlock = withDynamicSchemaProps((props) => { const { fieldValue, data, changeNav } = props; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlockInitializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlockInitializer.tsx index 9173a24e5..f01bd5f56 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlockInitializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperBlockInitializer.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { DataBlockInitializer, Icon, @@ -5,8 +6,8 @@ import { useSchemaInitializer, useSchemaInitializerItem, } from '@tachybase/client'; -import React from 'react'; import { ISchema } from '@tachybase/schema'; + import { Toast } from 'antd-mobile'; export const SwiperBlockInitializer = () => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperFieldSettings.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperFieldSettings.tsx index 2014ea7d9..638b57926 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperFieldSettings.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperFieldSettings.tsx @@ -7,7 +7,9 @@ import { useFormBlockContext, } from '@tachybase/client'; import { useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; + import { useTranslation } from '../../../../locale'; export const SwiperFieldSettings = new SchemaSettings({ diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperPage.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperPage.tsx index afed96093..2e0250778 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperPage.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/SwiperPage.tsx @@ -1,5 +1,6 @@ -import { CollectionRecordProvider, DataBlockProvider, RemoteSchemaComponent } from '@tachybase/client'; import React from 'react'; +import { CollectionRecordProvider, DataBlockProvider, RemoteSchemaComponent } from '@tachybase/client'; + import { useParams } from 'react-router-dom'; export const SwiperPage = () => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/useSwiperBlockProps.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/useSwiperBlockProps.ts index 6488c3c50..39604aac1 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/useSwiperBlockProps.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/swiper/useSwiperBlockProps.ts @@ -1,7 +1,8 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { useNavigate } from 'react-router-dom'; import React, { useEffect } from 'react'; import { useCollection, useDesignable, useRequest } from '@tachybase/client'; +import { useFieldSchema } from '@tachybase/schema'; + +import { useNavigate } from 'react-router-dom'; export const useSwiperBlockProps = () => { const fieldSchema = useFieldSchema(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.Item.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.Item.tsx index 0168cef31..37f67911c 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.Item.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.Item.tsx @@ -1,4 +1,4 @@ -import { useField, useFieldSchema } from '@tachybase/schema'; +import React from 'react'; import { css, cx, @@ -8,8 +8,10 @@ import { SortableItem, useDesigner, } from '@tachybase/client'; +import { useField, useFieldSchema } from '@tachybase/schema'; + import { TabBarItemProps } from 'antd-mobile'; -import React from 'react'; + import { useTranslation } from '../../../../locale'; import { useSchemaPatch } from '../../hooks'; import { tabItemSchema } from './schema'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.tsx index 36d969617..972f2ab33 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-bar/TabBar.tsx @@ -1,5 +1,4 @@ -import { useFieldSchema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import React, { useCallback } from 'react'; import { css, cx, @@ -11,9 +10,11 @@ import { useCompile, useDesignable, } from '@tachybase/client'; +import { uid, useFieldSchema } from '@tachybase/schema'; + import { TabBar } from 'antd-mobile'; -import React, { useCallback } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; + import { useTranslation } from '../../../../locale'; import { PageSchema } from '../../common'; import { tabItemSchema } from './schema'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/TabSearch.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/TabSearch.tsx index 42aefa4cf..6d8d56be1 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/TabSearch.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/TabSearch.tsx @@ -1,6 +1,7 @@ import React from 'react'; -import { RecursionField, useFieldSchema } from '@tachybase/schema'; import { useDesigner, useSchemaInitializerRender } from '@tachybase/client'; +import { RecursionField, useFieldSchema } from '@tachybase/schema'; + import { isTabSearchCollapsibleInputItem } from '../utils'; export const TabSearch = () => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItem.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItem.tsx index f1f933591..f545eafe8 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItem.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItem.tsx @@ -1,8 +1,10 @@ -import { SortableItem, withDynamicSchemaProps } from '@tachybase/client'; -import { ConfigProvider, Row } from 'antd'; import React from 'react'; -import { IButton, IInput, ISelect } from './TabSearchCollapsibleInputItemChild'; +import { SortableItem, withDynamicSchemaProps } from '@tachybase/client'; + +import { ConfigProvider, Row } from 'antd'; + import { useTabSearchCollapsibleInputItemAction } from './TabSearchCollapsibleInputItemAction'; +import { IButton, IInput, ISelect } from './TabSearchCollapsibleInputItemChild'; export const TabSearchCollapsibleInputItem = withDynamicSchemaProps( (props) => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemAction.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemAction.ts index b5f09104c..389666b8b 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemAction.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemAction.ts @@ -1,6 +1,8 @@ import { useMemo, useRef, useState } from 'react'; -import { useFieldSchema } from '@tachybase/schema'; import { useCollection, useCollectionManager, useDesignable, useDesigner } from '@tachybase/client'; +import { useFieldSchema } from '@tachybase/schema'; +import { dayjs } from '@tachybase/utils/client'; + import { canBeCalculatedField, canBeDataField, @@ -9,7 +11,6 @@ import { isTabSearchCollapsibleInputItem, } from '../../utils'; import { useTabSearchCollapsibleInputItem } from './hooks'; -import { dayjs } from '@tachybase/utils/client'; export const useTabSearchCollapsibleInputItemAction = (props) => { const { onSelected } = useTabSearchCollapsibleInputItem(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemChild.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemChild.tsx index cafea7c01..36e8a3bef 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemChild.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputItemChild.tsx @@ -1,5 +1,7 @@ import React from 'react'; + import { Button, Col, Divider, Input, Select } from 'antd'; + import { useTranslation } from '../../../../../../locale'; export const ISelect = (props) => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputMItem.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputMItem.tsx index f50a063d6..b9f1aec11 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputMItem.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchCollapsibleInputMItem.tsx @@ -1,10 +1,12 @@ -import { SortableItem, css, withDynamicSchemaProps } from '@tachybase/client'; -import { Checkbox, Grid, Switch } from 'antd-mobile'; import React from 'react'; +import { css, SortableItem, withDynamicSchemaProps } from '@tachybase/client'; + +import { Checkbox, Grid, Switch } from 'antd-mobile'; + +import { useTranslation } from '../../../../../../locale'; +import { canBeDataField } from '../../utils'; import { useTabSearchCollapsibleInputItemAction } from './TabSearchCollapsibleInputItemAction'; import { IButton, IDatePicker, IInput, ISelect } from './TabSearchCollapsibleInputMItemChild'; -import { canBeDataField } from '../../utils'; -import { useTranslation } from '../../../../../../locale'; export const TabSearchCollapsibleInputMItem = withDynamicSchemaProps( (props) => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItem.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItem.tsx index f2f2d9765..cca3cab51 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItem.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItem.tsx @@ -1,6 +1,8 @@ -import { SortableItem, withDynamicSchemaProps } from '@tachybase/client'; -import { ConfigProvider, Menu } from 'antd'; import React from 'react'; +import { SortableItem, withDynamicSchemaProps } from '@tachybase/client'; + +import { ConfigProvider, Menu } from 'antd'; + import { useAction } from './TabSearchFieldMItem'; export const TabSearchFieldItem = withDynamicSchemaProps( diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItemProps.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItemProps.ts index 0993372ca..7e288f660 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItemProps.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldItemProps.ts @@ -1,9 +1,11 @@ import { useMemo } from 'react'; import { useCollection, useCollectionManager } from '@tachybase/client'; import { useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; -import { useTabSearchCollapsibleInputItem } from './hooks'; + import { canBeOptionalField } from '../../utils'; +import { useTabSearchCollapsibleInputItem } from './hooks'; export const useTabSearchFieldItemProps = () => { const fieldSchema = useFieldSchema(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldMItem.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldMItem.tsx index f8f1aca59..f5b2b17e1 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldMItem.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSearchFieldMItem.tsx @@ -1,8 +1,10 @@ +import React from 'react'; import { SortableItem, useCollection, useDesigner, withDynamicSchemaProps } from '@tachybase/client'; import { useFieldSchema } from '@tachybase/schema'; + import { MenuProps } from 'antd'; import { Tabs } from 'antd-mobile'; -import React from 'react'; + import { useTranslation } from '../../../../../../locale'; export const TabSearchFieldMItem = withDynamicSchemaProps( diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx index f48f06a1c..a3110f16a 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/components/field-item/TabSerachFieldItemRelatedProps.tsx @@ -2,9 +2,11 @@ import { useEffect, useMemo } from 'react'; import { useCollection, useCollectionManager, useDataSourceHeaders, useRequest } from '@tachybase/client'; import { useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; -import { useTabSearchCollapsibleInputItem } from './hooks'; + import { canBeRelatedField } from '../../utils'; +import { useTabSearchCollapsibleInputItem } from './hooks'; export const useTabSearchFieldItemRelatedProps = () => { const fieldSchema = useFieldSchema(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchBlockInitializer.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchBlockInitializer.tsx index 00daebbcc..e5d9048d0 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchBlockInitializer.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchBlockInitializer.tsx @@ -1,5 +1,6 @@ -import { DataBlockInitializer, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; import React from 'react'; +import { DataBlockInitializer, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; + import { createTabSearchBlockSchema } from '../create/createTabSearchBlockSchema'; export const TabSearchBlockInitializer = (props) => { diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchFieldSchemaInitializerGadget.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchFieldSchemaInitializerGadget.tsx index 2df5af17b..739888c4c 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchFieldSchemaInitializerGadget.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/initializer/TabSearchFieldSchemaInitializerGadget.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { SchemaInitializerSwitch, useCurrentSchema, @@ -5,7 +6,6 @@ import { useSchemaInitializerItem, } from '@tachybase/client'; import { merge } from '@tachybase/schema'; -import React from 'react'; export const TabSearchFieldSchemaInitializerGadget = () => { const itemConfig = useSchemaInitializerItem(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/provider/TabSearchProvider.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/provider/TabSearchProvider.tsx index 99b6803e4..252b9b885 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/provider/TabSearchProvider.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/provider/TabSearchProvider.tsx @@ -1,5 +1,5 @@ -import { DataBlockProvider } from '@tachybase/client'; import React from 'react'; +import { DataBlockProvider } from '@tachybase/client'; export const TabSearchProvider = (props) => { return {props.children}; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/settings/TabSearchItemFieldSettings.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/settings/TabSearchItemFieldSettings.tsx index 20ab55b17..937a25bb0 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/settings/TabSearchItemFieldSettings.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/tab-search/settings/TabSearchItemFieldSettings.tsx @@ -7,9 +7,11 @@ import { useDesignable, useFormBlockContext, } from '@tachybase/client'; -import { useTranslation } from '../../../../../locale'; import { useField, useFieldSchema } from '@tachybase/schema'; + import _ from 'lodash'; + +import { useTranslation } from '../../../../../locale'; import { isTabSearchCollapsibleInputItem } from '../utils'; export const TabSearchItemFieldSettings = new SchemaSettings({ diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/helpers/index.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/helpers/index.ts index eb759ac49..b376689be 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/helpers/index.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/helpers/index.ts @@ -1,5 +1,5 @@ -import { ISchema, Schema } from '@tachybase/schema'; -import { uid } from '@tachybase/schema'; +import { ISchema, Schema, uid } from '@tachybase/schema'; + export const gridItemWrap = (schema: ISchema) => { return { type: 'void', diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/hooks/useSchemaPatch.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/hooks/useSchemaPatch.ts index ea04ad7c8..95b25260b 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/hooks/useSchemaPatch.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/hooks/useSchemaPatch.ts @@ -1,7 +1,8 @@ -import { useField, useFieldSchema } from '@tachybase/schema'; import { useDesignable } from '@tachybase/client'; -import lodash from 'lodash'; +import { useField, useFieldSchema } from '@tachybase/schema'; + import { useMemoizedFn } from 'ahooks'; +import lodash from 'lodash'; export const useSchemaPatch = () => { const { dn } = useDesignable(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/InterfaceRouter.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/InterfaceRouter.tsx index e43871e8e..d1ce36bc7 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/InterfaceRouter.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/InterfaceRouter.tsx @@ -1,5 +1,6 @@ -import { css, usePlugin } from '@tachybase/client'; import React from 'react'; +import { css, usePlugin } from '@tachybase/client'; + import { MobileClientPlugin } from '../index'; import { InterfaceProvider } from './InterfaceProvider'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/OpenInNewTab.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/OpenInNewTab.tsx index 774f1c20b..e39869daf 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/OpenInNewTab.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/router/OpenInNewTab.tsx @@ -1,7 +1,9 @@ -import { LinkOutlined } from '@ant-design/icons'; -import { css, useApp } from '@tachybase/client'; -import { Button } from 'antd'; import React from 'react'; +import { css, useApp } from '@tachybase/client'; + +import { LinkOutlined } from '@ant-design/icons'; +import { Button } from 'antd'; + import { useTranslation } from '../locale'; export const OpenInNewTab = () => { diff --git a/packages/plugins/@tachybase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts b/packages/plugins/@tachybase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts index 150749e87..b648a0b87 100644 --- a/packages/plugins/@tachybase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts +++ b/packages/plugins/@tachybase/plugin-workflow-test/src/e2e/e2ePageObjectModel.ts @@ -1,4 +1,5 @@ import { Locator, Page } from '@tachybase/test/e2e'; + export class CreateWorkFlow { readonly page: Page; name: Locator; diff --git a/packages/plugins/@tachybase/plugin-workflow-test/src/server/index.ts b/packages/plugins/@tachybase/plugin-workflow-test/src/server/index.ts index 435e2e5ed..056d478f9 100644 --- a/packages/plugins/@tachybase/plugin-workflow-test/src/server/index.ts +++ b/packages/plugins/@tachybase/plugin-workflow-test/src/server/index.ts @@ -1,14 +1,13 @@ import path from 'path'; - +import { SequelizeDataSource } from '@tachybase/data-source-manager'; +import { Resourcer } from '@tachybase/resourcer'; import { ApplicationOptions, Plugin } from '@tachybase/server'; -import { MockServer, createMockServer, mockDatabase } from '@tachybase/test'; +import { createMockServer, mockDatabase, MockServer } from '@tachybase/test'; +import { uid } from '@tachybase/utils'; import functions from './functions'; -import triggers from './triggers'; import instructions from './instructions'; -import { Resourcer } from '@tachybase/resourcer'; -import { SequelizeDataSource } from '@tachybase/data-source-manager'; -import { uid } from '@tachybase/utils'; +import triggers from './triggers'; export interface MockServerOptions extends ApplicationOptions { collectionsPath?: string; diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/ExecutionCanvas.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/ExecutionCanvas.tsx index e6e30b1c3..92b6256ec 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/ExecutionCanvas.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/ExecutionCanvas.tsx @@ -1,5 +1,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { + ActionAreaProvider, + ActionAreaStub, ActionContextProvider, cx, SchemaComponent, @@ -290,7 +292,14 @@ export function ExecutionCanvas() { - + +

+ +
+ +
+
+ ); diff --git a/packages/presets/base/client.d.ts b/packages/presets/base/client.d.ts index d515d1feb..6ffb028c7 100644 --- a/packages/presets/base/client.d.ts +++ b/packages/presets/base/client.d.ts @@ -1,3 +1,2 @@ export * from './src/client'; export { default } from './src/client'; - diff --git a/packages/presets/base/server.d.ts b/packages/presets/base/server.d.ts index b55e6f70d..63111b12d 100644 --- a/packages/presets/base/server.d.ts +++ b/packages/presets/base/server.d.ts @@ -1,3 +1,2 @@ export * from './src/server'; export { default } from './src/server'; - diff --git a/packages/presets/base/src/server/index.ts b/packages/presets/base/src/server/index.ts index 5a235d7f6..f1ab47652 100644 --- a/packages/presets/base/src/server/index.ts +++ b/packages/presets/base/src/server/index.ts @@ -1,4 +1,5 @@ import { Plugin, PluginManager } from '@tachybase/server'; + import _ from 'lodash'; export class PresetTachyBase extends Plugin { diff --git a/packages/presets/mini/client.d.ts b/packages/presets/mini/client.d.ts index d515d1feb..6ffb028c7 100644 --- a/packages/presets/mini/client.d.ts +++ b/packages/presets/mini/client.d.ts @@ -1,3 +1,2 @@ export * from './src/client'; export { default } from './src/client'; - diff --git a/packages/presets/mini/server.d.ts b/packages/presets/mini/server.d.ts index b55e6f70d..63111b12d 100644 --- a/packages/presets/mini/server.d.ts +++ b/packages/presets/mini/server.d.ts @@ -1,3 +1,2 @@ export * from './src/server'; export { default } from './src/server'; - diff --git a/packages/presets/rental/client.d.ts b/packages/presets/rental/client.d.ts index d515d1feb..6ffb028c7 100644 --- a/packages/presets/rental/client.d.ts +++ b/packages/presets/rental/client.d.ts @@ -1,3 +1,2 @@ export * from './src/client'; export { default } from './src/client'; - diff --git a/packages/presets/rental/server.d.ts b/packages/presets/rental/server.d.ts index b55e6f70d..63111b12d 100644 --- a/packages/presets/rental/server.d.ts +++ b/packages/presets/rental/server.d.ts @@ -1,3 +1,2 @@ export * from './src/server'; export { default } from './src/server'; - diff --git a/packages/presets/sancongtou/client.d.ts b/packages/presets/sancongtou/client.d.ts index d515d1feb..6ffb028c7 100644 --- a/packages/presets/sancongtou/client.d.ts +++ b/packages/presets/sancongtou/client.d.ts @@ -1,3 +1,2 @@ export * from './src/client'; export { default } from './src/client'; - diff --git a/packages/presets/sancongtou/server.d.ts b/packages/presets/sancongtou/server.d.ts index b55e6f70d..63111b12d 100644 --- a/packages/presets/sancongtou/server.d.ts +++ b/packages/presets/sancongtou/server.d.ts @@ -1,3 +1,2 @@ export * from './src/server'; export { default } from './src/server'; -