@nocobase/client-v2 2.1.0-alpha.40 → 2.1.0-alpha.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Application.d.ts +7 -0
- package/es/BaseApplication.d.ts +13 -0
- package/es/RouterManager.d.ts +1 -0
- package/es/collection-field-interface/CollectionFieldInterface.d.ts +51 -15
- package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +82 -3
- package/es/collection-manager/field-configure.d.ts +80 -0
- package/es/collection-manager/field-validation.d.ts +43 -0
- package/es/collection-manager/filter-operators/index.d.ts +46 -0
- package/es/collection-manager/filter-operators/operators.d.ts +30 -0
- package/es/collection-manager/interfaces/checkbox.d.ts +1 -41
- package/es/collection-manager/interfaces/checkboxGroup.d.ts +12 -44
- package/es/collection-manager/interfaces/collection.d.ts +12 -51
- package/es/collection-manager/interfaces/color.d.ts +1 -16
- package/es/collection-manager/interfaces/createdAt.d.ts +1 -44
- package/es/collection-manager/interfaces/createdBy.d.ts +0 -4
- package/es/collection-manager/interfaces/dateOnly.d.ts +7 -44
- package/es/collection-manager/interfaces/datetime.d.ts +1 -44
- package/es/collection-manager/interfaces/datetimeNoTz.d.ts +1 -44
- package/es/collection-manager/interfaces/email.d.ts +1 -29
- package/es/collection-manager/interfaces/id.d.ts +1 -16
- package/es/collection-manager/interfaces/index.d.ts +2 -3
- package/es/collection-manager/interfaces/input.d.ts +1 -102
- package/es/collection-manager/interfaces/integer.d.ts +1 -95
- package/es/collection-manager/interfaces/json.d.ts +16 -7
- package/es/collection-manager/interfaces/m2m.d.ts +11 -19
- package/es/collection-manager/interfaces/m2o.d.ts +11 -19
- package/es/collection-manager/interfaces/markdown.d.ts +1 -63
- package/es/collection-manager/interfaces/multipleSelect.d.ts +12 -44
- package/es/collection-manager/interfaces/nanoid.d.ts +1 -34
- package/es/collection-manager/interfaces/number.d.ts +1 -87
- package/es/collection-manager/interfaces/o2m.d.ts +12 -24
- package/es/collection-manager/interfaces/obo.d.ts +207 -0
- package/es/collection-manager/interfaces/oho.d.ts +207 -0
- package/es/collection-manager/interfaces/password.d.ts +1 -56
- package/es/collection-manager/interfaces/percent.d.ts +1 -84
- package/es/collection-manager/interfaces/phone.d.ts +1 -25
- package/es/collection-manager/interfaces/properties/index.d.ts +0 -28
- package/es/collection-manager/interfaces/radioGroup.d.ts +1 -29
- package/es/collection-manager/interfaces/richText.d.ts +1 -63
- package/es/collection-manager/interfaces/select.d.ts +12 -44
- package/es/collection-manager/interfaces/snowflake-id.d.ts +1 -34
- package/es/collection-manager/interfaces/tableoid.d.ts +1 -10
- package/es/collection-manager/interfaces/textarea.d.ts +1 -51
- package/es/collection-manager/interfaces/time.d.ts +1 -16
- package/es/collection-manager/interfaces/types.d.ts +3 -12
- package/es/collection-manager/interfaces/unixTimestamp.d.ts +1 -44
- package/es/collection-manager/interfaces/updatedAt.d.ts +1 -44
- package/es/collection-manager/interfaces/updatedBy.d.ts +0 -4
- package/es/collection-manager/interfaces/url.d.ts +1 -20
- package/es/collection-manager/interfaces/uuid.d.ts +1 -34
- package/es/collection-manager/template-fields.d.ts +53 -0
- package/es/components/KeepAlive.d.ts +22 -0
- package/es/components/RouterBridge.d.ts +9 -0
- package/es/components/form/DialogFormLayout.d.ts +5 -29
- package/es/components/form/VariableInput.d.ts +53 -2
- package/es/components/form/filter/CollectionFilter.d.ts +49 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +49 -0
- package/es/components/form/filter/DateFilterDynamicComponent.d.ts +57 -0
- package/es/components/form/filter/FilterValueInput.d.ts +29 -0
- package/es/components/form/filter/index.d.ts +11 -0
- package/es/components/form/filter/useFilterActionProps.d.ts +96 -0
- package/es/components/form/index.d.ts +1 -0
- package/es/data-source/ExtendCollectionsProvider.d.ts +50 -0
- package/es/data-source/index.d.ts +9 -0
- package/es/flow/FlowPage.d.ts +2 -1
- package/es/flow/admin-shell/AdminLayoutRouteCoordinator.d.ts +8 -40
- package/es/flow/admin-shell/BaseLayoutModel.d.ts +89 -0
- package/es/flow/admin-shell/BaseLayoutRouteCoordinator.d.ts +74 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +12 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutModel.d.ts +7 -92
- package/es/flow/admin-shell/admin-layout/AppListRender.d.ts +11 -0
- package/es/flow/admin-shell/admin-layout/index.d.ts +3 -0
- package/es/flow/admin-shell/admin-layout/useApplications.d.ts +3 -2
- package/es/flow/admin-shell/useAdminLayoutRoutePage.d.ts +2 -2
- package/es/flow/admin-shell/useLayoutRoutePage.d.ts +23 -0
- package/es/flow/components/FlowRoute.d.ts +10 -1
- package/es/flow/components/filter/index.d.ts +2 -0
- package/es/flow/components/filter/useFilterOptions.d.ts +66 -0
- package/es/flow/index.d.ts +4 -0
- package/es/flow/models/base/PageModel/PageModel.d.ts +3 -1
- package/es/flow/models/blocks/assign-form/assignFieldValuesFlow.d.ts +84 -0
- package/es/flow/models/blocks/assign-form/index.d.ts +1 -0
- package/es/flow/models/blocks/form/FormActionGroupModel.d.ts +1 -0
- package/es/flow/models/blocks/form/FormActionModel.d.ts +9 -2
- package/es/flow/models/blocks/table/TableBlockModel.d.ts +10 -0
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.d.ts +1 -1
- package/es/flow-compat/passwordUtils.d.ts +1 -1
- package/es/index.d.ts +6 -0
- package/es/index.mjs +552 -459
- package/es/layout-manager/LayoutContentRoute.d.ts +14 -0
- package/es/layout-manager/LayoutManager.d.ts +22 -0
- package/es/layout-manager/LayoutRoute.d.ts +14 -0
- package/es/layout-manager/index.d.ts +13 -0
- package/es/layout-manager/types.d.ts +20 -0
- package/es/layout-manager/utils.d.ts +14 -0
- package/es/nocobase-buildin-plugin/index.d.ts +3 -10
- package/es/settings-center/index.d.ts +1 -1
- package/es/settings-center/plugin-manager/BulkEnableButton.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginCard.d.ts +15 -0
- package/es/settings-center/plugin-manager/PluginDetail.d.ts +16 -0
- package/es/settings-center/{PluginManagerPage.d.ts → plugin-manager/index.d.ts} +1 -7
- package/es/settings-center/plugin-manager/types.d.ts +34 -0
- package/lib/index.js +552 -459
- package/package.json +8 -7
- package/src/Application.tsx +51 -12
- package/src/BaseApplication.tsx +32 -0
- package/src/PluginSettingsManager.ts +1 -1
- package/src/RouterManager.tsx +17 -1
- package/src/__tests__/PluginSettingsManager.test.ts +41 -2
- package/src/__tests__/app.test.tsx +17 -1
- package/src/__tests__/globalDeps.test.ts +1 -0
- package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +45 -2
- package/src/__tests__/plugin-manager.test.tsx +177 -0
- package/src/__tests__/settings-center.test.tsx +24 -2
- package/src/collection-field-interface/CollectionFieldInterface.ts +71 -77
- package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +201 -4
- package/src/collection-manager/field-configure.ts +548 -0
- package/src/collection-manager/field-validation.ts +195 -0
- package/src/collection-manager/filter-operators/index.ts +176 -0
- package/src/collection-manager/{interfaces/properties → filter-operators}/operators.ts +24 -13
- package/src/collection-manager/interfaces/checkbox.ts +2 -9
- package/src/collection-manager/interfaces/checkboxGroup.ts +2 -10
- package/src/collection-manager/interfaces/collection.ts +2 -15
- package/src/collection-manager/interfaces/color.ts +2 -2
- package/src/collection-manager/interfaces/createdAt.ts +2 -2
- package/src/collection-manager/interfaces/createdBy.ts +1 -12
- package/src/collection-manager/interfaces/dateOnly.ts +8 -2
- package/src/collection-manager/interfaces/datetime.ts +2 -2
- package/src/collection-manager/interfaces/datetimeNoTz.ts +2 -2
- package/src/collection-manager/interfaces/email.ts +2 -9
- package/src/collection-manager/interfaces/id.ts +1 -2
- package/src/collection-manager/interfaces/index.ts +2 -3
- package/src/collection-manager/interfaces/input.ts +2 -133
- package/src/collection-manager/interfaces/integer.ts +2 -71
- package/src/collection-manager/interfaces/json.tsx +17 -11
- package/src/collection-manager/interfaces/m2m.tsx +0 -21
- package/src/collection-manager/interfaces/m2o.tsx +0 -22
- package/src/collection-manager/interfaces/markdown.ts +2 -51
- package/src/collection-manager/interfaces/multipleSelect.ts +2 -14
- package/src/collection-manager/interfaces/nanoid.ts +2 -2
- package/src/collection-manager/interfaces/number.ts +2 -85
- package/src/collection-manager/interfaces/o2m.tsx +1 -22
- package/src/collection-manager/interfaces/obo.tsx +145 -0
- package/src/collection-manager/interfaces/oho.tsx +145 -0
- package/src/collection-manager/interfaces/password.ts +2 -44
- package/src/collection-manager/interfaces/percent.ts +2 -74
- package/src/collection-manager/interfaces/phone.ts +2 -2
- package/src/collection-manager/interfaces/properties/index.ts +0 -133
- package/src/collection-manager/interfaces/radioGroup.ts +2 -2
- package/src/collection-manager/interfaces/richText.ts +2 -51
- package/src/collection-manager/interfaces/select.ts +2 -14
- package/src/collection-manager/interfaces/snowflake-id.ts +2 -2
- package/src/collection-manager/interfaces/tableoid.ts +1 -2
- package/src/collection-manager/interfaces/textarea.ts +2 -51
- package/src/collection-manager/interfaces/time.ts +2 -2
- package/src/collection-manager/interfaces/types.ts +4 -12
- package/src/collection-manager/interfaces/unixTimestamp.tsx +2 -2
- package/src/collection-manager/interfaces/updatedAt.ts +2 -2
- package/src/collection-manager/interfaces/updatedBy.ts +1 -12
- package/src/collection-manager/interfaces/url.ts +2 -4
- package/src/collection-manager/interfaces/uuid.ts +2 -2
- package/src/collection-manager/template-fields.ts +109 -0
- package/src/components/KeepAlive.tsx +131 -0
- package/src/components/README.md +90 -6
- package/src/components/README.zh-CN.md +90 -7
- package/src/components/RouterBridge.tsx +28 -4
- package/src/components/__tests__/KeepAlive.test.tsx +63 -0
- package/src/components/__tests__/RouterBridge.test.tsx +27 -0
- package/src/components/form/DialogFormLayout.tsx +5 -29
- package/src/components/form/VariableInput.tsx +101 -28
- package/src/components/form/__tests__/VariableInput.test.ts +85 -0
- package/src/components/form/filter/CollectionFilter.tsx +111 -0
- package/src/components/form/filter/CollectionFilterItem.tsx +184 -0
- package/src/components/form/filter/DateFilterDynamicComponent.tsx +283 -0
- package/src/components/form/filter/FilterValueInput.tsx +198 -0
- package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +247 -0
- package/src/components/form/filter/__tests__/DateFilterDynamicComponent.test.tsx +148 -0
- package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +243 -0
- package/src/components/form/filter/__tests__/compileFilterGroup.test.ts +146 -0
- package/src/components/form/filter/index.ts +13 -0
- package/src/components/form/filter/useFilterActionProps.ts +203 -0
- package/src/components/form/index.tsx +1 -0
- package/src/data-source/ExtendCollectionsProvider.tsx +144 -0
- package/src/data-source/__tests__/ExtendCollectionsProvider.test.tsx +264 -0
- package/src/data-source/index.ts +10 -0
- package/src/flow/FlowPage.tsx +35 -7
- package/src/flow/__tests__/FlowPage.test.tsx +79 -0
- package/src/flow/__tests__/FlowRoute.test.tsx +529 -2
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +191 -0
- package/src/flow/actions/__tests__/openView.subModelKey.test.tsx +33 -0
- package/src/flow/actions/aclCheck.tsx +4 -0
- package/src/flow/actions/aclCheckRefresh.tsx +4 -0
- package/src/flow/actions/dateTimeFormat.tsx +12 -8
- package/src/flow/actions/linkageRules.tsx +122 -0
- package/src/flow/actions/openView.tsx +28 -4
- package/src/flow/admin-shell/AdminLayoutRouteCoordinator.ts +11 -329
- package/src/flow/admin-shell/BaseLayoutModel.tsx +455 -0
- package/src/flow/admin-shell/BaseLayoutRouteCoordinator.ts +502 -0
- package/src/flow/admin-shell/__tests__/AdminLayoutRouteCoordinator.test.ts +547 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +35 -7
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +160 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +0 -12
- package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +28 -201
- package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +11 -2
- package/src/flow/admin-shell/admin-layout/AppListRender.tsx +139 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +1 -26
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutModel.test.tsx +149 -27
- package/src/flow/admin-shell/admin-layout/index.ts +3 -0
- package/src/flow/admin-shell/admin-layout/useApplications.tsx +34 -1
- package/src/flow/admin-shell/useAdminLayoutRoutePage.ts +10 -26
- package/src/flow/admin-shell/useLayoutRoutePage.ts +61 -0
- package/src/flow/components/AdminLayout.tsx +4 -154
- package/src/flow/components/FlowRoute.tsx +105 -15
- package/src/flow/components/filter/index.ts +3 -0
- package/src/flow/components/filter/useFilterOptions.ts +102 -0
- package/src/flow/index.ts +4 -0
- package/src/flow/models/actions/UpdateRecordActionModel.tsx +14 -95
- package/src/flow/models/actions/UpdateRecordActionUtils.ts +4 -7
- package/src/flow/models/actions/__tests__/AssignFormRefill.test.ts +26 -1
- package/src/flow/models/base/ActionModel.tsx +8 -1
- package/src/flow/models/base/PageModel/PageModel.tsx +51 -18
- package/src/flow/models/base/PageModel/RootPageModel.tsx +6 -13
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +102 -1
- package/src/flow/models/base/RouteModel.tsx +1 -1
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +63 -2
- package/src/flow/models/blocks/assign-form/assignFieldValuesFlow.tsx +206 -0
- package/src/flow/models/blocks/assign-form/index.ts +1 -0
- package/src/flow/models/blocks/form/FormActionGroupModel.tsx +14 -0
- package/src/flow/models/blocks/form/FormActionModel.tsx +30 -3
- package/src/flow/models/blocks/form/FormItemModel.tsx +8 -1
- package/src/flow/models/blocks/form/__tests__/FormActionGroupModel.test.ts +46 -0
- package/src/flow/models/blocks/form/__tests__/submitHandler.test.ts +71 -0
- package/src/flow/models/blocks/form/submitHandler.ts +8 -1
- package/src/flow/models/blocks/form/submitValues.ts +4 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +118 -16
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.rowSelection.test.tsx +114 -0
- package/src/flow/models/fields/AssociationFieldModel/SubFormFieldModel.tsx +7 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +1 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -5
- package/src/flow/models/fields/ClickableFieldModel.tsx +9 -1
- package/src/flow/models/fields/CollectionSelectorFieldModel.tsx +8 -2
- package/src/flow/models/fields/DisplayEnumFieldModel.tsx +8 -2
- package/src/flow/models/fields/DisplayTimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/TimeFieldModel.tsx +1 -1
- package/src/flow/models/fields/__tests__/TimeFieldModel.test.tsx +61 -0
- package/src/flow/models/fields/mobile-components/MobileDatePicker.tsx +19 -3
- package/src/flow/models/fields/mobile-components/__tests__/MobileDatePicker.test.tsx +94 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +1 -1
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +91 -0
- package/src/index.ts +6 -0
- package/src/layout-manager/LayoutContentRoute.tsx +90 -0
- package/src/layout-manager/LayoutManager.tsx +185 -0
- package/src/layout-manager/LayoutRoute.tsx +138 -0
- package/src/layout-manager/__tests__/LayoutManager.test.tsx +335 -0
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +473 -0
- package/src/layout-manager/index.ts +14 -0
- package/src/layout-manager/types.ts +22 -0
- package/src/layout-manager/utils.ts +37 -0
- package/src/nocobase-buildin-plugin/index.tsx +69 -67
- package/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +1 -0
- package/src/settings-center/index.ts +1 -1
- package/src/settings-center/plugin-manager/BulkEnableButton.tsx +111 -0
- package/src/settings-center/plugin-manager/PluginCard.tsx +270 -0
- package/src/settings-center/plugin-manager/PluginDetail.tsx +195 -0
- package/src/settings-center/plugin-manager/index.tsx +254 -0
- package/src/settings-center/plugin-manager/types.ts +35 -0
- package/src/settings-center/utils.tsx +8 -1
- package/src/theme/__tests__/globalStyles.test.ts +24 -0
- package/src/theme/globalStyles.ts +10 -0
- package/src/utils/globalDeps.ts +2 -0
- package/es/collection-manager/interfaces/linkTo.d.ts +0 -90
- package/es/collection-manager/interfaces/o2o.d.ts +0 -621
- package/es/collection-manager/interfaces/properties/operators.d.ts +0 -294
- package/es/collection-manager/interfaces/subTable.d.ts +0 -172
- package/src/collection-manager/interfaces/linkTo.ts +0 -120
- package/src/collection-manager/interfaces/o2o.tsx +0 -561
- package/src/collection-manager/interfaces/subTable.ts +0 -218
- package/src/settings-center/PluginManagerPage.tsx +0 -162
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { ISchema } from '@formily/react';
|
|
11
|
-
import { uid } from '@formily/shared';
|
|
12
|
-
import { defaultProps } from './properties';
|
|
13
|
-
import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
|
|
14
|
-
|
|
15
|
-
export class SubTableFieldInterface extends CollectionFieldInterface {
|
|
16
|
-
name = 'subTable';
|
|
17
|
-
type = 'object';
|
|
18
|
-
group = 'relation';
|
|
19
|
-
order = 2;
|
|
20
|
-
title = '{{t("Sub-table")}}';
|
|
21
|
-
isAssociation = true;
|
|
22
|
-
default = {
|
|
23
|
-
type: 'hasMany',
|
|
24
|
-
uiSchema: {
|
|
25
|
-
type: 'void',
|
|
26
|
-
'x-component': 'TableField',
|
|
27
|
-
'x-component-props': {},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
availableTypes = ['hasMany'];
|
|
31
|
-
schemaInitialize(schema: ISchema, { field, readPretty }) {
|
|
32
|
-
const association = `${field.collectionName}.${field.name}`;
|
|
33
|
-
schema['type'] = 'void';
|
|
34
|
-
schema['x-component'] = 'TableField';
|
|
35
|
-
schema['properties'] = {
|
|
36
|
-
block: {
|
|
37
|
-
type: 'void',
|
|
38
|
-
'x-decorator': 'TableFieldProvider',
|
|
39
|
-
'x-acl-action': `${field.target}:list`,
|
|
40
|
-
'x-decorator-props': {
|
|
41
|
-
collection: field.target,
|
|
42
|
-
association: association,
|
|
43
|
-
resource: association,
|
|
44
|
-
action: 'list',
|
|
45
|
-
params: {
|
|
46
|
-
paginate: false,
|
|
47
|
-
},
|
|
48
|
-
showIndex: true,
|
|
49
|
-
dragSort: false,
|
|
50
|
-
},
|
|
51
|
-
properties: {
|
|
52
|
-
actions: {
|
|
53
|
-
type: 'void',
|
|
54
|
-
'x-initializer': 'subTable:configureActions',
|
|
55
|
-
'x-component': 'TableField.ActionBar',
|
|
56
|
-
'x-component-props': {},
|
|
57
|
-
},
|
|
58
|
-
[field.name]: {
|
|
59
|
-
type: 'array',
|
|
60
|
-
'x-initializer': 'table:configureColumns',
|
|
61
|
-
'x-component': 'TableV2',
|
|
62
|
-
'x-use-component-props': 'useTableFieldProps',
|
|
63
|
-
'x-component-props': {
|
|
64
|
-
rowSelection: {
|
|
65
|
-
type: 'checkbox',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
initialize = (values: any) => {
|
|
74
|
-
if (!values.target) {
|
|
75
|
-
values.target = `t_${uid()}`;
|
|
76
|
-
}
|
|
77
|
-
if (!values.foreignKey) {
|
|
78
|
-
values.foreignKey = `f_${uid()}`;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
properties = {
|
|
82
|
-
...defaultProps,
|
|
83
|
-
subtable: {
|
|
84
|
-
type: 'void',
|
|
85
|
-
'x-component': 'SubFieldDataSourceProvider',
|
|
86
|
-
properties: {
|
|
87
|
-
actions: {
|
|
88
|
-
type: 'void',
|
|
89
|
-
'x-component': 'ActionBar',
|
|
90
|
-
'x-component-props': {
|
|
91
|
-
// style: {
|
|
92
|
-
// marginBottom: 16,
|
|
93
|
-
// },
|
|
94
|
-
},
|
|
95
|
-
properties: {
|
|
96
|
-
delete: {
|
|
97
|
-
type: 'void',
|
|
98
|
-
title: '{{ t("Delete") }}',
|
|
99
|
-
'x-component': 'Action',
|
|
100
|
-
'x-component-props': {
|
|
101
|
-
useAction: '{{ ds.useBulkDestroyAction }}',
|
|
102
|
-
confirm: {
|
|
103
|
-
title: "{{t('Delete record')}}",
|
|
104
|
-
content: "{{t('Are you sure you want to delete it?')}}",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
create: {
|
|
109
|
-
type: 'void',
|
|
110
|
-
title: '{{ t("Add new") }}',
|
|
111
|
-
'x-component': 'AddSubFieldAction',
|
|
112
|
-
'x-component-props': {
|
|
113
|
-
type: 'primary',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
children: {
|
|
119
|
-
type: 'array',
|
|
120
|
-
title: '{{t("Fields")}}',
|
|
121
|
-
'x-decorator': 'FormItem',
|
|
122
|
-
'x-component': 'Table.Array',
|
|
123
|
-
'x-component-props': {
|
|
124
|
-
pagination: false,
|
|
125
|
-
expandable: {
|
|
126
|
-
childrenColumnName: '__nochildren__',
|
|
127
|
-
},
|
|
128
|
-
rowKey: 'name',
|
|
129
|
-
rowSelection: {
|
|
130
|
-
type: 'checkbox',
|
|
131
|
-
},
|
|
132
|
-
useSelectedRowKeys: '{{ ds.useSelectedRowKeys }}',
|
|
133
|
-
useDataSource: '{{ ds.useDataSource }}',
|
|
134
|
-
// scroll: { x: '100%' },
|
|
135
|
-
},
|
|
136
|
-
properties: {
|
|
137
|
-
column1: {
|
|
138
|
-
type: 'void',
|
|
139
|
-
title: '{{ t("Field display name") }}',
|
|
140
|
-
'x-component': 'Table.Column',
|
|
141
|
-
properties: {
|
|
142
|
-
'uiSchema.title': {
|
|
143
|
-
type: 'number',
|
|
144
|
-
'x-component': 'Input',
|
|
145
|
-
'x-read-pretty': true,
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
column2: {
|
|
150
|
-
type: 'void',
|
|
151
|
-
title: '{{ t("Field name") }}',
|
|
152
|
-
'x-component': 'Table.Column',
|
|
153
|
-
properties: {
|
|
154
|
-
name: {
|
|
155
|
-
'x-component': 'Input',
|
|
156
|
-
'x-read-pretty': true,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
column3: {
|
|
161
|
-
type: 'void',
|
|
162
|
-
title: '{{ t("Field interface") }}',
|
|
163
|
-
'x-component': 'Table.Column',
|
|
164
|
-
properties: {
|
|
165
|
-
interface: {
|
|
166
|
-
'x-component': 'Input',
|
|
167
|
-
'x-read-pretty': true,
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
column4: {
|
|
172
|
-
type: 'void',
|
|
173
|
-
title: '{{ t("Actions") }}',
|
|
174
|
-
'x-component': 'Table.Column',
|
|
175
|
-
properties: {
|
|
176
|
-
actions: {
|
|
177
|
-
type: 'void',
|
|
178
|
-
'x-component': 'Space',
|
|
179
|
-
'x-component-props': {
|
|
180
|
-
split: '|',
|
|
181
|
-
},
|
|
182
|
-
properties: {
|
|
183
|
-
update: {
|
|
184
|
-
type: 'void',
|
|
185
|
-
title: '{{ t("Edit") }}',
|
|
186
|
-
'x-component': 'EditSubFieldAction',
|
|
187
|
-
'x-component-props': {
|
|
188
|
-
// useAction: '{{ ds.useUpdateAction }}',
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
delete: {
|
|
192
|
-
type: 'void',
|
|
193
|
-
title: '{{ t("Delete") }}',
|
|
194
|
-
'x-component': 'Action.Link',
|
|
195
|
-
'x-component-props': {
|
|
196
|
-
useAction: '{{ ds.useDestroyAction }}',
|
|
197
|
-
confirm: {
|
|
198
|
-
title: "{{t('Delete record')}}",
|
|
199
|
-
content: "{{t('Are you sure you want to delete it?')}}",
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
// children: {
|
|
212
|
-
// type: 'array',
|
|
213
|
-
// title: '{{t("Sub-table fields")}}',
|
|
214
|
-
// 'x-decorator': 'FormItem',
|
|
215
|
-
// 'x-component': 'DatabaseField',
|
|
216
|
-
// },
|
|
217
|
-
};
|
|
218
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Alert, Table, Tag, theme, Typography } from 'antd';
|
|
11
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import { useApp } from '../hooks/useApp';
|
|
14
|
-
|
|
15
|
-
type PluginManagerRecord = {
|
|
16
|
-
name?: string;
|
|
17
|
-
packageName?: string;
|
|
18
|
-
displayName?: string;
|
|
19
|
-
enabled?: boolean;
|
|
20
|
-
builtIn?: boolean;
|
|
21
|
-
version?: string;
|
|
22
|
-
isCompatible?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `Plugin manager` 的最小只读页面。
|
|
27
|
-
*
|
|
28
|
-
* 首版只负责展示 `pm:list` 返回的插件列表和关键状态,
|
|
29
|
-
* 不承载安装、升级、删除、启停等运维操作。
|
|
30
|
-
*/
|
|
31
|
-
export const PluginManagerPage = () => {
|
|
32
|
-
const app = useApp();
|
|
33
|
-
const { token } = theme.useToken();
|
|
34
|
-
const { t } = useTranslation();
|
|
35
|
-
const [loading, setLoading] = useState(true);
|
|
36
|
-
const [dataSource, setDataSource] = useState<PluginManagerRecord[]>([]);
|
|
37
|
-
const [errorMessage, setErrorMessage] = useState<string>('');
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
let mounted = true;
|
|
41
|
-
|
|
42
|
-
const load = async () => {
|
|
43
|
-
setLoading(true);
|
|
44
|
-
setErrorMessage('');
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const response = await app.apiClient.request({
|
|
48
|
-
url: 'pm:list',
|
|
49
|
-
skipNotify: true,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (!mounted) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setDataSource(Array.isArray(response?.data?.data) ? response.data.data : []);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (!mounted) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
setErrorMessage(error?.message || t('Failed to load plugins'));
|
|
62
|
-
} finally {
|
|
63
|
-
if (mounted) {
|
|
64
|
-
setLoading(false);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
void load();
|
|
70
|
-
|
|
71
|
-
return () => {
|
|
72
|
-
mounted = false;
|
|
73
|
-
};
|
|
74
|
-
}, [app, t]);
|
|
75
|
-
|
|
76
|
-
const columns = useMemo(
|
|
77
|
-
() => [
|
|
78
|
-
{
|
|
79
|
-
title: t('Name'),
|
|
80
|
-
dataIndex: 'name',
|
|
81
|
-
key: 'name',
|
|
82
|
-
render: (value: string) => value || '-',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
title: t('Package name'),
|
|
86
|
-
dataIndex: 'packageName',
|
|
87
|
-
key: 'packageName',
|
|
88
|
-
render: (value: string) => (
|
|
89
|
-
<Typography.Text copyable={!!value} code>
|
|
90
|
-
{value || '-'}
|
|
91
|
-
</Typography.Text>
|
|
92
|
-
),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
title: t('Display name'),
|
|
96
|
-
dataIndex: 'displayName',
|
|
97
|
-
key: 'displayName',
|
|
98
|
-
render: (value: string) => value || '-',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
title: t('Enabled'),
|
|
102
|
-
dataIndex: 'enabled',
|
|
103
|
-
key: 'enabled',
|
|
104
|
-
width: 120,
|
|
105
|
-
render: (value: boolean) => <Tag color={value ? 'success' : 'default'}>{value ? t('Yes') : t('No')}</Tag>,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
title: t('Built-in'),
|
|
109
|
-
dataIndex: 'builtIn',
|
|
110
|
-
key: 'builtIn',
|
|
111
|
-
width: 120,
|
|
112
|
-
render: (value: boolean) => <Tag color={value ? 'processing' : 'default'}>{value ? t('Yes') : t('No')}</Tag>,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: t('Version'),
|
|
116
|
-
dataIndex: 'version',
|
|
117
|
-
key: 'version',
|
|
118
|
-
width: 140,
|
|
119
|
-
render: (value: string) => value || '-',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
title: t('Compatible'),
|
|
123
|
-
dataIndex: 'isCompatible',
|
|
124
|
-
key: 'isCompatible',
|
|
125
|
-
width: 140,
|
|
126
|
-
render: (value: boolean) => (
|
|
127
|
-
<Tag color={value === false ? 'error' : 'success'}>{value === false ? t('No') : t('Yes')}</Tag>
|
|
128
|
-
),
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
[t],
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<div
|
|
136
|
-
style={{
|
|
137
|
-
background: token.colorBgContainer,
|
|
138
|
-
borderRadius: token.borderRadiusLG,
|
|
139
|
-
padding: token.paddingLG,
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
{errorMessage ? (
|
|
143
|
-
<Alert
|
|
144
|
-
showIcon
|
|
145
|
-
type="error"
|
|
146
|
-
message={t('Failed to load plugins')}
|
|
147
|
-
description={errorMessage}
|
|
148
|
-
style={{ marginBottom: token.marginLG }}
|
|
149
|
-
/>
|
|
150
|
-
) : null}
|
|
151
|
-
<Table
|
|
152
|
-
rowKey={(record) => record.packageName || record.name || record.displayName || 'unknown-plugin'}
|
|
153
|
-
loading={loading}
|
|
154
|
-
dataSource={dataSource}
|
|
155
|
-
columns={columns}
|
|
156
|
-
pagination={{ pageSize: 20 }}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export default PluginManagerPage;
|