cabloy 5.1.64 → 5.1.66
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/CHANGELOG.md +50 -0
- package/cabloy-docs/.vitepress/config.mjs +1 -1
- package/cabloy-docs/backend/crud-workflow.md +33 -0
- package/cabloy-docs/backend/master-detail-workflow.md +149 -0
- package/cabloy-docs/frontend/bean-scene-authoring.md +1 -1
- package/cabloy-docs/frontend/cli.md +12 -1
- package/cabloy-docs/frontend/command-scene-authoring.md +12 -1
- package/cabloy-docs/frontend/component-guide.md +10 -0
- package/cabloy-docs/frontend/permission-formscene-action-visibility-guide.md +69 -7
- package/cabloy-docs/frontend/table-cell-cookbook.md +10 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions.md +83 -2
- package/cabloy-docs/reference/bean-scene-boilerplates.md +9 -4
- package/package.json +1 -1
- package/vona/packages-cli/cabloy-cli/package.json +1 -1
- package/vona/packages-cli/cabloy-cli/src/lib/local.helper.ts +38 -0
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoBaseName%>.tsx_ +18 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoMutateName%>.tsx_ +17 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoResItemName%>.tsx_ +60 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoViewName%>.tsx_ +17 -0
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.bean.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.module.ts +3 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.suite.ts +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.test.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.asset.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.config.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.constant.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.error.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.lib.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.locale.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.main.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.monkey.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.static.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.types.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crud.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudBasic.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudStart.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.masterDetail.ts +699 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.metadata.ts +1 -2
- package/vona/packages-cli/cli-set-api/src/lib/beans.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/command/tools.masterDetail.ts +78 -0
- package/vona/packages-cli/cli-set-api/src/lib/commands.ts +2 -0
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-core/src/lib/mappedClass/type.ts +1 -0
- package/vona/packages-vona/vona-core/src/lib/mappedClass/utils.ts +36 -14
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +29 -11
- package/vona/src/suite/a-training/modules/training-record/src/entity/record.tsx +1 -7
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordBase.tsx +8 -2
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordMutate.tsx +1 -15
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordResItem.tsx +27 -8
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordView.tsx +1 -12
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +6 -4
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +3 -6
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSummary.tsx +1 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +14 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +14 -1
- package/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx +1 -5
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +9 -4
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/const/decorator.ts +3 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/schema/makeSchemaLikes.ts +21 -17
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/utils.ts +44 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoGet.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoMutate.ts +8 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/relations_.ts +32 -16
- package/vona/src/suite-vendor/a-vona/modules/a-web/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/bean.ts +26 -5
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +3 -3
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateDetailsActionBulk/controller.tsx_ +31 -0
- package/zova/packages-cli/cli-set-front/cli/templates/rest/component.ts +24 -2
- package/zova/packages-cli/cli-set-front/cli/templates/rest/render.ts +4 -0
- package/zova/packages-cli/cli-set-front/package.json +2 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.bean.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.mock.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.module.ts +3 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.suite.ts +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.asset.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.config.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.constant.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.error.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.icon.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.lib.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.locale.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.main.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.mainSys.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.monkey.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.monkeySys.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.types.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.config.ts +1 -4
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +2 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.anotherRender.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.anotherStyle.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentEmits.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentGeneric.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentModel.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentProps.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentSlots.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.firstRender.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.firstStyle.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.pageParams.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.pageQuery.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.renameComponent.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.tools.metadata.ts +1 -2
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreateComponent.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreatePage.ts +2 -6
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +744 -884
- package/zova/src/suite/a-training/modules/training-student/package.json +2 -1
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/bean/behavior.appModal.tsx +131 -13
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/config.ts +15 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/service/appModal.ts +23 -5
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/appModal.ts +30 -4
- package/zova/src/suite/cabloy-basic/modules/basic-details/package.json +6 -1
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockForm.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockTable.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockToolbarBulk.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/index.ts +204 -9
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/command.delete.tsx +47 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionDelete.tsx +52 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionOperationsRow.tsx +72 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionUpdate.tsx +73 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionView.tsx +64 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.lineNumber.tsx +30 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/actionCreate/controller.tsx +31 -7
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockDetails/controller.tsx +28 -12
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockForm/controller.tsx +53 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockTable/controller.tsx +49 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/{blockDetailsToolbarBulk → blockToolbarBulk}/controller.tsx +6 -4
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/formFieldDetails/controller.tsx +24 -12
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/en-us.ts +5 -1
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/zh-cn.ts +5 -1
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/lib/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/lib/utils.ts +12 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/service/detail.tsx +172 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/detail.ts +18 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/details.ts +11 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/dialogForm.ts +22 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/index.ts +2 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/entry/controller.tsx +1 -2
- package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/command/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandBulk/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandDetailsRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +20 -0
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/package.json +3 -2
- package/zova/src/suite-vendor/a-zova/modules/a-command/src/types/command.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-form/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-form/src/component/form/controller.tsx +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/lib/schema.ts +20 -4
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/action.ts +2 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/detail.ts +10 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/details.ts +4 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/detailsActionRow.ts +24 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/index.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/permissions.ts +4 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/rest.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/cli/detailsActionRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +24 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +3 -2
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/controller.tsx +5 -3
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +6 -6
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockDetailsToolbarBulk.ts +0 -31
|
@@ -1,8 +1,45 @@
|
|
|
1
1
|
// eslint-disable
|
|
2
|
+
/** service: begin */
|
|
3
|
+
export * from '../service/detail.jsx';
|
|
4
|
+
|
|
5
|
+
import 'zova-module-a-bean';
|
|
6
|
+
declare module 'zova-module-a-bean' {
|
|
7
|
+
|
|
8
|
+
export interface IServiceRecord {
|
|
9
|
+
'basic-details:detail': never;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
declare module 'zova-module-basic-details' {
|
|
15
|
+
|
|
16
|
+
export interface ServiceDetail {
|
|
17
|
+
/** @internal */
|
|
18
|
+
get scope(): ScopeModuleBasicDetails;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ServiceDetail {
|
|
22
|
+
get $beanFullName(): 'basic-details.service.detail';
|
|
23
|
+
get $onionName(): 'basic-details:detail';
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** service: end */
|
|
28
|
+
/** service: begin */
|
|
29
|
+
import { ServiceDetail } from '../service/detail.jsx';
|
|
30
|
+
import 'zova';
|
|
31
|
+
declare module 'zova' {
|
|
32
|
+
export interface IBeanRecordGeneral {
|
|
33
|
+
'basic-details.service.detail': ServiceDetail;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** service: end */
|
|
2
37
|
/** controller: begin */
|
|
3
38
|
export * from '../component/actionCreate/controller.jsx';
|
|
4
39
|
export * from '../component/blockDetails/controller.jsx';
|
|
5
|
-
export * from '../component/
|
|
40
|
+
export * from '../component/blockForm/controller.jsx';
|
|
41
|
+
export * from '../component/blockTable/controller.jsx';
|
|
42
|
+
export * from '../component/blockToolbarBulk/controller.jsx';
|
|
6
43
|
export * from '../component/formFieldDetails/controller.jsx';
|
|
7
44
|
|
|
8
45
|
import 'zova';
|
|
@@ -22,7 +59,17 @@ declare module 'zova-module-basic-details' {
|
|
|
22
59
|
get scope(): ScopeModuleBasicDetails;
|
|
23
60
|
}
|
|
24
61
|
|
|
25
|
-
export interface
|
|
62
|
+
export interface ControllerBlockForm {
|
|
63
|
+
/** @internal */
|
|
64
|
+
get scope(): ScopeModuleBasicDetails;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ControllerBlockTable {
|
|
68
|
+
/** @internal */
|
|
69
|
+
get scope(): ScopeModuleBasicDetails;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ControllerBlockToolbarBulk {
|
|
26
73
|
/** @internal */
|
|
27
74
|
get scope(): ScopeModuleBasicDetails;
|
|
28
75
|
}
|
|
@@ -36,14 +83,18 @@ declare module 'zova-module-basic-details' {
|
|
|
36
83
|
/** controller: begin */
|
|
37
84
|
import { ControllerActionCreate } from '../component/actionCreate/controller.jsx';
|
|
38
85
|
import { ControllerBlockDetails } from '../component/blockDetails/controller.jsx';
|
|
39
|
-
import {
|
|
86
|
+
import { ControllerBlockForm } from '../component/blockForm/controller.jsx';
|
|
87
|
+
import { ControllerBlockTable } from '../component/blockTable/controller.jsx';
|
|
88
|
+
import { ControllerBlockToolbarBulk } from '../component/blockToolbarBulk/controller.jsx';
|
|
40
89
|
import { ControllerFormFieldDetails } from '../component/formFieldDetails/controller.jsx';
|
|
41
90
|
import 'zova';
|
|
42
91
|
declare module 'zova' {
|
|
43
92
|
export interface IBeanRecordLocal {
|
|
44
93
|
'basic-details.controller.actionCreate': ControllerActionCreate;
|
|
45
94
|
'basic-details.controller.blockDetails': ControllerBlockDetails;
|
|
46
|
-
'basic-details.controller.
|
|
95
|
+
'basic-details.controller.blockForm': ControllerBlockForm;
|
|
96
|
+
'basic-details.controller.blockTable': ControllerBlockTable;
|
|
97
|
+
'basic-details.controller.blockToolbarBulk': ControllerBlockToolbarBulk;
|
|
47
98
|
'basic-details.controller.formFieldDetails': ControllerFormFieldDetails;
|
|
48
99
|
}
|
|
49
100
|
}
|
|
@@ -54,14 +105,20 @@ export * from './component/actionCreate.js';
|
|
|
54
105
|
import { ZActionCreate } from './component/actionCreate.js';
|
|
55
106
|
export * from './component/blockDetails.js';
|
|
56
107
|
import { ZBlockDetails } from './component/blockDetails.js';
|
|
57
|
-
export * from './component/
|
|
58
|
-
import {
|
|
108
|
+
export * from './component/blockForm.js';
|
|
109
|
+
import { ZBlockForm } from './component/blockForm.js';
|
|
110
|
+
export * from './component/blockTable.js';
|
|
111
|
+
import { ZBlockTable } from './component/blockTable.js';
|
|
112
|
+
export * from './component/blockToolbarBulk.js';
|
|
113
|
+
import { ZBlockToolbarBulk } from './component/blockToolbarBulk.js';
|
|
59
114
|
export * from './component/formFieldDetails.js';
|
|
60
115
|
import { ZFormFieldDetails } from './component/formFieldDetails.js';
|
|
61
116
|
export const components = {
|
|
62
117
|
'actionCreate': ZActionCreate,
|
|
63
118
|
'blockDetails': ZBlockDetails,
|
|
64
|
-
'
|
|
119
|
+
'blockForm': ZBlockForm,
|
|
120
|
+
'blockTable': ZBlockTable,
|
|
121
|
+
'blockToolbarBulk': ZBlockToolbarBulk,
|
|
65
122
|
'formFieldDetails': ZFormFieldDetails,
|
|
66
123
|
};
|
|
67
124
|
import 'zova';
|
|
@@ -69,17 +126,155 @@ declare module 'zova' {
|
|
|
69
126
|
export interface IComponentRecord {
|
|
70
127
|
'basic-details:actionCreate': ControllerActionCreate;
|
|
71
128
|
'basic-details:blockDetails': ControllerBlockDetails;
|
|
72
|
-
'basic-details:
|
|
129
|
+
'basic-details:blockForm': ControllerBlockForm;
|
|
130
|
+
'basic-details:blockTable': ControllerBlockTable;
|
|
131
|
+
'basic-details:blockToolbarBulk': ControllerBlockToolbarBulk;
|
|
73
132
|
'basic-details:formFieldDetails': ControllerFormFieldDetails;
|
|
74
133
|
}
|
|
75
134
|
export interface IZovaComponentRecord {
|
|
76
135
|
'basic-details:actionCreate': typeof ZActionCreate;
|
|
77
136
|
'basic-details:blockDetails': typeof ZBlockDetails;
|
|
78
|
-
'basic-details:
|
|
137
|
+
'basic-details:blockForm': typeof ZBlockForm;
|
|
138
|
+
'basic-details:blockTable': typeof ZBlockTable;
|
|
139
|
+
'basic-details:blockToolbarBulk': typeof ZBlockToolbarBulk;
|
|
79
140
|
'basic-details:formFieldDetails': typeof ZFormFieldDetails;
|
|
80
141
|
}
|
|
81
142
|
}
|
|
82
143
|
/** components: end */
|
|
144
|
+
/** tableCell: begin */
|
|
145
|
+
export * from '../bean/tableCell.actionDelete.jsx';
|
|
146
|
+
export * from '../bean/tableCell.actionOperationsRow.jsx';
|
|
147
|
+
export * from '../bean/tableCell.actionUpdate.jsx';
|
|
148
|
+
export * from '../bean/tableCell.actionView.jsx';
|
|
149
|
+
export * from '../bean/tableCell.lineNumber.jsx';
|
|
150
|
+
import { ITableCellOptionsActionDelete } from '../bean/tableCell.actionDelete.jsx';
|
|
151
|
+
import { ITableCellOptionsActionOperationsRow } from '../bean/tableCell.actionOperationsRow.jsx';
|
|
152
|
+
import { ITableCellOptionsActionUpdate } from '../bean/tableCell.actionUpdate.jsx';
|
|
153
|
+
import { ITableCellOptionsActionView } from '../bean/tableCell.actionView.jsx';
|
|
154
|
+
import { ITableCellOptionsLineNumber } from '../bean/tableCell.lineNumber.jsx';
|
|
155
|
+
import 'zova-module-a-table';
|
|
156
|
+
declare module 'zova-module-a-table' {
|
|
157
|
+
|
|
158
|
+
export interface ITableCellRecord {
|
|
159
|
+
'basic-details:actionDelete': ITableCellOptionsActionDelete;
|
|
160
|
+
'basic-details:actionOperationsRow': ITableCellOptionsActionOperationsRow;
|
|
161
|
+
'basic-details:actionUpdate': ITableCellOptionsActionUpdate;
|
|
162
|
+
'basic-details:actionView': ITableCellOptionsActionView;
|
|
163
|
+
'basic-details:lineNumber': ITableCellOptionsLineNumber;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
declare module 'zova-module-basic-details' {
|
|
169
|
+
|
|
170
|
+
export interface TableCellActionDelete {
|
|
171
|
+
/** @internal */
|
|
172
|
+
get scope(): ScopeModuleBasicDetails;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface TableCellActionDelete {
|
|
176
|
+
get $beanFullName(): 'basic-details.tableCell.actionDelete';
|
|
177
|
+
get $onionName(): 'basic-details:actionDelete';
|
|
178
|
+
get $onionOptions(): ITableCellOptionsActionDelete;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface TableCellActionOperationsRow {
|
|
182
|
+
/** @internal */
|
|
183
|
+
get scope(): ScopeModuleBasicDetails;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface TableCellActionOperationsRow {
|
|
187
|
+
get $beanFullName(): 'basic-details.tableCell.actionOperationsRow';
|
|
188
|
+
get $onionName(): 'basic-details:actionOperationsRow';
|
|
189
|
+
get $onionOptions(): ITableCellOptionsActionOperationsRow;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface TableCellActionUpdate {
|
|
193
|
+
/** @internal */
|
|
194
|
+
get scope(): ScopeModuleBasicDetails;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface TableCellActionUpdate {
|
|
198
|
+
get $beanFullName(): 'basic-details.tableCell.actionUpdate';
|
|
199
|
+
get $onionName(): 'basic-details:actionUpdate';
|
|
200
|
+
get $onionOptions(): ITableCellOptionsActionUpdate;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface TableCellActionView {
|
|
204
|
+
/** @internal */
|
|
205
|
+
get scope(): ScopeModuleBasicDetails;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface TableCellActionView {
|
|
209
|
+
get $beanFullName(): 'basic-details.tableCell.actionView';
|
|
210
|
+
get $onionName(): 'basic-details:actionView';
|
|
211
|
+
get $onionOptions(): ITableCellOptionsActionView;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface TableCellLineNumber {
|
|
215
|
+
/** @internal */
|
|
216
|
+
get scope(): ScopeModuleBasicDetails;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface TableCellLineNumber {
|
|
220
|
+
get $beanFullName(): 'basic-details.tableCell.lineNumber';
|
|
221
|
+
get $onionName(): 'basic-details:lineNumber';
|
|
222
|
+
get $onionOptions(): ITableCellOptionsLineNumber;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/** tableCell: end */
|
|
226
|
+
/** tableCell: begin */
|
|
227
|
+
import { TableCellActionDelete } from '../bean/tableCell.actionDelete.jsx';
|
|
228
|
+
import { TableCellActionOperationsRow } from '../bean/tableCell.actionOperationsRow.jsx';
|
|
229
|
+
import { TableCellActionUpdate } from '../bean/tableCell.actionUpdate.jsx';
|
|
230
|
+
import { TableCellActionView } from '../bean/tableCell.actionView.jsx';
|
|
231
|
+
import { TableCellLineNumber } from '../bean/tableCell.lineNumber.jsx';
|
|
232
|
+
import 'zova';
|
|
233
|
+
declare module 'zova' {
|
|
234
|
+
export interface IBeanRecordGeneral {
|
|
235
|
+
'basic-details.tableCell.actionDelete': TableCellActionDelete;
|
|
236
|
+
'basic-details.tableCell.actionOperationsRow': TableCellActionOperationsRow;
|
|
237
|
+
'basic-details.tableCell.actionUpdate': TableCellActionUpdate;
|
|
238
|
+
'basic-details.tableCell.actionView': TableCellActionView;
|
|
239
|
+
'basic-details.tableCell.lineNumber': TableCellLineNumber;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/** tableCell: end */
|
|
243
|
+
/** command: begin */
|
|
244
|
+
export * from '../bean/command.delete.jsx';
|
|
245
|
+
import { ICommandOptionsDelete } from '../bean/command.delete.jsx';
|
|
246
|
+
import 'zova-module-a-command';
|
|
247
|
+
declare module 'zova-module-a-command' {
|
|
248
|
+
|
|
249
|
+
export interface ICommandRecord {
|
|
250
|
+
'basic-details:delete': ICommandOptionsDelete;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
declare module 'zova-module-basic-details' {
|
|
256
|
+
|
|
257
|
+
export interface CommandDelete {
|
|
258
|
+
/** @internal */
|
|
259
|
+
get scope(): ScopeModuleBasicDetails;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface CommandDelete {
|
|
263
|
+
get $beanFullName(): 'basic-details.command.delete';
|
|
264
|
+
get $onionName(): 'basic-details:delete';
|
|
265
|
+
get $onionOptions(): ICommandOptionsDelete;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/** command: end */
|
|
269
|
+
/** command: begin */
|
|
270
|
+
import { CommandDelete } from '../bean/command.delete.jsx';
|
|
271
|
+
import 'zova';
|
|
272
|
+
declare module 'zova' {
|
|
273
|
+
export interface IBeanRecordGeneral {
|
|
274
|
+
'basic-details.command.delete': CommandDelete;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** command: end */
|
|
83
278
|
/** locale: begin */
|
|
84
279
|
import { locales } from './locales.js';
|
|
85
280
|
/** locale: end */
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandDetailsRowOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
6
|
+
import type { IJsxRenderContextBase, IJsxRenderContextDetails } from 'zova-module-a-openapi';
|
|
7
|
+
import type { IJsxRenderContextTableCell } from 'zova-module-a-table';
|
|
8
|
+
|
|
9
|
+
import { isNil } from '@cabloy/utils';
|
|
10
|
+
import { BeanBase } from 'zova';
|
|
11
|
+
import { Command } from 'zova-module-a-command';
|
|
12
|
+
|
|
13
|
+
export type TypeCommandDeleteResult = unknown;
|
|
14
|
+
|
|
15
|
+
export interface ICommandOptionsDelete extends ICommandDetailsRowOptionsBase<TypeCommandDeleteResult> {}
|
|
16
|
+
|
|
17
|
+
type DetailItem = Record<string, any>;
|
|
18
|
+
|
|
19
|
+
@Command<ICommandOptionsDelete>()
|
|
20
|
+
export class CommandDelete extends BeanBase implements ICommandExecute {
|
|
21
|
+
execute(
|
|
22
|
+
_options: ICommandOptionsDelete,
|
|
23
|
+
renderContext: IJsxRenderContextBase,
|
|
24
|
+
next: NextCommandExecute,
|
|
25
|
+
) {
|
|
26
|
+
const { $celScope } = renderContext as IJsxRenderContextDetails;
|
|
27
|
+
const $$details = $celScope.$$details;
|
|
28
|
+
if (!$$details) throw new Error('should provide $$details in cell scope');
|
|
29
|
+
const { cellContext } = renderContext as IJsxRenderContextTableCell;
|
|
30
|
+
const row = cellContext?.row;
|
|
31
|
+
if (!row) throw new Error('should provide row in cell context');
|
|
32
|
+
const detailItem = row.original as DetailItem;
|
|
33
|
+
const detailItemIndex = row.index;
|
|
34
|
+
const detailItemId = detailItem.id;
|
|
35
|
+
const detailItems = $$details.data as DetailItem[];
|
|
36
|
+
if (!isNil(detailItemId)) {
|
|
37
|
+
$$details.data = detailItems.map(item => {
|
|
38
|
+
return item.id === detailItemId ? { ...item, deleted: true } : item;
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
$$details.data = detailItems.filter((_item, index) => {
|
|
42
|
+
return index !== detailItemIndex;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return next();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IResourceDetailsActionRowOptionsBase } from 'zova-module-a-openapi';
|
|
2
|
+
import type {
|
|
3
|
+
IJsxRenderContextTableCell,
|
|
4
|
+
ITableCellRender,
|
|
5
|
+
NextTableCellRender,
|
|
6
|
+
} from 'zova-module-a-table';
|
|
7
|
+
|
|
8
|
+
import { BeanBase } from 'zova';
|
|
9
|
+
import { ZIcon } from 'zova-module-a-icon';
|
|
10
|
+
import { TableCell } from 'zova-module-a-table';
|
|
11
|
+
|
|
12
|
+
import { ICommandOptionsDelete } from './command.delete.jsx';
|
|
13
|
+
|
|
14
|
+
declare module 'zova-module-a-openapi' {
|
|
15
|
+
export interface IResourceDetailsActionRowRecord {
|
|
16
|
+
'basic-details:actionDelete'?: ITableCellOptionsActionDelete;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ITableCellOptionsActionDelete extends IResourceDetailsActionRowOptionsBase {}
|
|
21
|
+
|
|
22
|
+
@TableCell<ITableCellOptionsActionDelete>({
|
|
23
|
+
class: 'btn btn-outline btn-error join-item',
|
|
24
|
+
})
|
|
25
|
+
export class TableCellActionDelete extends BeanBase implements ITableCellRender {
|
|
26
|
+
render(
|
|
27
|
+
options: ITableCellOptionsActionDelete,
|
|
28
|
+
renderContext: IJsxRenderContextTableCell,
|
|
29
|
+
_next: NextTableCellRender,
|
|
30
|
+
) {
|
|
31
|
+
const { $host } = renderContext;
|
|
32
|
+
return (
|
|
33
|
+
<button
|
|
34
|
+
class={options.class}
|
|
35
|
+
type="button"
|
|
36
|
+
onClick={async () => {
|
|
37
|
+
const confirmed = await $host.$performCommand('basic-commands:confirm', {
|
|
38
|
+
text: this.scope.locale.DeleteConfirm(),
|
|
39
|
+
});
|
|
40
|
+
if (!confirmed) return;
|
|
41
|
+
await $host.$performCommand(
|
|
42
|
+
'basic-details:delete',
|
|
43
|
+
options as Partial<ICommandOptionsDelete>,
|
|
44
|
+
renderContext,
|
|
45
|
+
);
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<ZIcon name="::delete" width={24}></ZIcon>
|
|
49
|
+
</button>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionOperationsRow.tsx
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IResourceDetailsActionRowOptionsBase,
|
|
3
|
+
IResourceRenderDetailsActionRowOptionsAction,
|
|
4
|
+
TypeTableCellRenderComponent,
|
|
5
|
+
} from 'zova-module-a-openapi';
|
|
6
|
+
import type {
|
|
7
|
+
IJsxRenderContextTableCell,
|
|
8
|
+
IJsxRenderContextTableColumn,
|
|
9
|
+
ITableCellRender,
|
|
10
|
+
NextTableCellRender,
|
|
11
|
+
} from 'zova-module-a-table';
|
|
12
|
+
|
|
13
|
+
import { VNode } from 'vue';
|
|
14
|
+
import { BeanBase } from 'zova';
|
|
15
|
+
import { TableCell } from 'zova-module-a-table';
|
|
16
|
+
|
|
17
|
+
import { checkPermission } from '../lib/utils.js';
|
|
18
|
+
|
|
19
|
+
declare module 'zova-module-a-openapi' {
|
|
20
|
+
export interface IResourceDetailsActionRowRecord {
|
|
21
|
+
'basic-details:actionOperationsRow'?: ITableCellOptionsActionOperationsRow;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ITableCellOptionsActionOperationsRow extends IResourceDetailsActionRowOptionsBase {
|
|
26
|
+
actions?: IResourceRenderDetailsActionRowOptionsAction[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@TableCell<ITableCellOptionsActionOperationsRow>({
|
|
30
|
+
class: 'join',
|
|
31
|
+
})
|
|
32
|
+
export class TableCellActionOperationsRow extends BeanBase implements ITableCellRender {
|
|
33
|
+
async checkVisible(
|
|
34
|
+
options: ITableCellOptionsActionOperationsRow,
|
|
35
|
+
renderContext: IJsxRenderContextTableColumn,
|
|
36
|
+
): Promise<boolean> {
|
|
37
|
+
const { $celScope, $$table } = renderContext;
|
|
38
|
+
const actions = options.actions;
|
|
39
|
+
if (!actions || actions.length === 0) return false;
|
|
40
|
+
// renders
|
|
41
|
+
const renders: TypeTableCellRenderComponent[] = [];
|
|
42
|
+
for (const action of actions) {
|
|
43
|
+
const actionName = action.name;
|
|
44
|
+
const actionRender = action.render;
|
|
45
|
+
const permissionHint = action.options?.permission;
|
|
46
|
+
if (checkPermission($celScope.formMeta!.formScene!, permissionHint)) {
|
|
47
|
+
if (!actionRender) throw new Error(`should specify action render: ${actionName}`);
|
|
48
|
+
renders.push(actionRender);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
await $$table.cellRenderPrepare(renders);
|
|
52
|
+
return renders.length > 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
render(
|
|
56
|
+
options: ITableCellOptionsActionOperationsRow,
|
|
57
|
+
renderContext: IJsxRenderContextTableCell,
|
|
58
|
+
_next: NextTableCellRender,
|
|
59
|
+
) {
|
|
60
|
+
const { $celScope, $$table } = renderContext;
|
|
61
|
+
const actions = options.actions;
|
|
62
|
+
if (!actions || actions.length === 0) return;
|
|
63
|
+
const domActions: VNode[] = [];
|
|
64
|
+
actions.forEach((action, index) => {
|
|
65
|
+
const permissionHint = action.options?.permission;
|
|
66
|
+
if (!checkPermission($celScope.formMeta!.formScene!, permissionHint)) return;
|
|
67
|
+
const options2 = Object.assign({ key: index }, action.options);
|
|
68
|
+
domActions.push($$table.cellRender(action.render!, options2, renderContext));
|
|
69
|
+
});
|
|
70
|
+
return <div class={options.class}>{domActions}</div>;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IResourceDetailsActionRowOptionsBase } from 'zova-module-a-openapi';
|
|
2
|
+
import type {
|
|
3
|
+
IJsxRenderContextTableCell,
|
|
4
|
+
ITableCellRender,
|
|
5
|
+
NextTableCellRender,
|
|
6
|
+
} from 'zova-module-a-table';
|
|
7
|
+
import type { AppModalItem, IModalDialogOptions } from 'zova-module-basic-app';
|
|
8
|
+
|
|
9
|
+
import { BeanBase, deepExtend } from 'zova';
|
|
10
|
+
import { TypeFormOnSubmitData } from 'zova-module-a-form';
|
|
11
|
+
import { IIconRecord, ZIcon } from 'zova-module-a-icon';
|
|
12
|
+
import { TableCell } from 'zova-module-a-table';
|
|
13
|
+
|
|
14
|
+
import { ServiceDetail } from '../service/detail.jsx';
|
|
15
|
+
import { IDialogFormOptions } from '../types/dialogForm.js';
|
|
16
|
+
|
|
17
|
+
declare module 'zova-module-a-openapi' {
|
|
18
|
+
export interface IResourceDetailsActionRowRecord {
|
|
19
|
+
'basic-details:actionUpdate'?: ITableCellOptionsActionUpdate;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ITableCellOptionsActionUpdate extends IResourceDetailsActionRowOptionsBase {
|
|
24
|
+
dialogOptions?: IModalDialogOptions & { icon?: keyof IIconRecord; title?: string };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@TableCell<ITableCellOptionsActionUpdate>({
|
|
28
|
+
class: 'btn btn-outline btn-primary join-item',
|
|
29
|
+
})
|
|
30
|
+
export class TableCellActionUpdate extends BeanBase implements ITableCellRender {
|
|
31
|
+
render(
|
|
32
|
+
options: ITableCellOptionsActionUpdate,
|
|
33
|
+
renderContext: IJsxRenderContextTableCell,
|
|
34
|
+
_next: NextTableCellRender,
|
|
35
|
+
) {
|
|
36
|
+
const { ctx, $celScope, cellContext } = renderContext;
|
|
37
|
+
return (
|
|
38
|
+
<button
|
|
39
|
+
class={options.class}
|
|
40
|
+
type="button"
|
|
41
|
+
onClick={async () => {
|
|
42
|
+
const $$details = $celScope.$$details;
|
|
43
|
+
if (!$$details) throw new Error('should provide $$details in cell scope');
|
|
44
|
+
const detailItem = cellContext.row.original as Record<string, any>;
|
|
45
|
+
const detailItemIndex = cellContext.row.index;
|
|
46
|
+
const serverDetail = await ctx.bean._newBean(ServiceDetail, true, {
|
|
47
|
+
locale: this.scope.locale,
|
|
48
|
+
schema: $$details.schemaForm,
|
|
49
|
+
data: deepExtend({}, detailItem),
|
|
50
|
+
formScene: 'edit',
|
|
51
|
+
schemaScene: 'form',
|
|
52
|
+
icon: options.dialogOptions?.icon,
|
|
53
|
+
title: options.dialogOptions?.title ?? this.scope.locale.EditDetail(),
|
|
54
|
+
dialogOptions: options.dialogOptions,
|
|
55
|
+
onSubmitData: (
|
|
56
|
+
data: TypeFormOnSubmitData<Record<string, any>>,
|
|
57
|
+
dialog: AppModalItem,
|
|
58
|
+
) => {
|
|
59
|
+
const detailItemNew = deepExtend({}, detailItem, data.value);
|
|
60
|
+
$$details.data = $$details.data.map((item, index) => {
|
|
61
|
+
return index === detailItemIndex ? detailItemNew : item;
|
|
62
|
+
});
|
|
63
|
+
dialog.close();
|
|
64
|
+
},
|
|
65
|
+
} satisfies IDialogFormOptions);
|
|
66
|
+
serverDetail.openDialogForm();
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<ZIcon name="::draft" width={24}></ZIcon>
|
|
70
|
+
</button>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { IResourceDetailsActionRowOptionsBase } from 'zova-module-a-openapi';
|
|
2
|
+
import type {
|
|
3
|
+
IJsxRenderContextTableCell,
|
|
4
|
+
ITableCellRender,
|
|
5
|
+
NextTableCellRender,
|
|
6
|
+
} from 'zova-module-a-table';
|
|
7
|
+
|
|
8
|
+
import { BeanBase } from 'zova';
|
|
9
|
+
import { IIconRecord } from 'zova-module-a-icon';
|
|
10
|
+
import { TableCell } from 'zova-module-a-table';
|
|
11
|
+
import { IModalDialogOptions } from 'zova-module-basic-app';
|
|
12
|
+
|
|
13
|
+
import { ServiceDetail } from '../service/detail.jsx';
|
|
14
|
+
import { IDialogFormOptions } from '../types/dialogForm.js';
|
|
15
|
+
|
|
16
|
+
declare module 'zova-module-a-openapi' {
|
|
17
|
+
export interface IResourceDetailsActionRowRecord {
|
|
18
|
+
'basic-details:actionView'?: ITableCellOptionsActionView;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ITableCellOptionsActionView extends IResourceDetailsActionRowOptionsBase {
|
|
23
|
+
dialogOptions?: IModalDialogOptions & { icon?: keyof IIconRecord; title?: string };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@TableCell<ITableCellOptionsActionView>({
|
|
27
|
+
class: 'hover:text-blue-500',
|
|
28
|
+
})
|
|
29
|
+
export class TableCellActionView extends BeanBase implements ITableCellRender {
|
|
30
|
+
render(
|
|
31
|
+
options: ITableCellOptionsActionView,
|
|
32
|
+
renderContext: IJsxRenderContextTableCell,
|
|
33
|
+
next: NextTableCellRender,
|
|
34
|
+
) {
|
|
35
|
+
const { ctx, $celScope, cellContext } = renderContext;
|
|
36
|
+
const value = next();
|
|
37
|
+
return (
|
|
38
|
+
<a
|
|
39
|
+
class={options.class}
|
|
40
|
+
href="#"
|
|
41
|
+
onClick={async e => {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
const $$details = $celScope.$$details;
|
|
45
|
+
if (!$$details) throw new Error('should provide $$details in cell scope');
|
|
46
|
+
const detailItem = cellContext.row.original as Record<string, any>;
|
|
47
|
+
const serverDetail = await ctx.bean._newBean(ServiceDetail, true, {
|
|
48
|
+
locale: this.scope.locale,
|
|
49
|
+
schema: $$details.schemaForm,
|
|
50
|
+
data: detailItem,
|
|
51
|
+
formScene: 'view',
|
|
52
|
+
schemaScene: 'form-view',
|
|
53
|
+
icon: options.dialogOptions?.icon,
|
|
54
|
+
title: options.dialogOptions?.title ?? this.scope.locale.EditDetail(),
|
|
55
|
+
dialogOptions: options.dialogOptions,
|
|
56
|
+
} satisfies IDialogFormOptions);
|
|
57
|
+
serverDetail.openDialogForm();
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{value}
|
|
61
|
+
</a>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IResourceTableCellOptionsBase } from 'zova-module-a-openapi';
|
|
2
|
+
import type {
|
|
3
|
+
IJsxRenderContextTableCell,
|
|
4
|
+
ITableCellRender,
|
|
5
|
+
NextTableCellRender,
|
|
6
|
+
} from 'zova-module-a-table';
|
|
7
|
+
|
|
8
|
+
import { BeanBase } from 'zova';
|
|
9
|
+
import { TableCell } from 'zova-module-a-table';
|
|
10
|
+
|
|
11
|
+
declare module 'zova-module-a-openapi' {
|
|
12
|
+
export interface IResourceTableCellRecord {
|
|
13
|
+
'basic-details:lineNumber'?: ITableCellOptionsLineNumber;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ITableCellOptionsLineNumber extends IResourceTableCellOptionsBase {}
|
|
18
|
+
|
|
19
|
+
@TableCell<ITableCellOptionsLineNumber>()
|
|
20
|
+
export class TableCellLineNumber extends BeanBase implements ITableCellRender {
|
|
21
|
+
render(
|
|
22
|
+
_options: ITableCellOptionsLineNumber,
|
|
23
|
+
renderContext: IJsxRenderContextTableCell,
|
|
24
|
+
_next: NextTableCellRender,
|
|
25
|
+
) {
|
|
26
|
+
const { cellContext } = renderContext;
|
|
27
|
+
const row = cellContext?.row;
|
|
28
|
+
return row.index + 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/actionCreate/controller.tsx
CHANGED
|
@@ -3,9 +3,15 @@ import type {
|
|
|
3
3
|
IJsxRenderContextDetails,
|
|
4
4
|
IResourceDetailsActionBulkOptionsBase,
|
|
5
5
|
} from 'zova-module-a-openapi';
|
|
6
|
+
import type { AppModalItem, IModalDialogOptions } from 'zova-module-basic-app';
|
|
6
7
|
|
|
7
8
|
import { BeanControllerBase, Use } from 'zova';
|
|
8
9
|
import { Controller } from 'zova-module-a-bean';
|
|
10
|
+
import { TypeFormOnSubmitData } from 'zova-module-a-form';
|
|
11
|
+
import { IIconRecord } from 'zova-module-a-icon';
|
|
12
|
+
|
|
13
|
+
import { ServiceDetail } from '../../service/detail.jsx';
|
|
14
|
+
import { IDialogFormOptions } from '../../types/dialogForm.js';
|
|
9
15
|
|
|
10
16
|
declare module 'zova-module-a-openapi' {
|
|
11
17
|
export interface IResourceDetailsActionBulkRecord {
|
|
@@ -13,29 +19,47 @@ declare module 'zova-module-a-openapi' {
|
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
export interface ControllerActionCreateProps extends IResourceDetailsActionBulkOptionsBase {
|
|
22
|
+
export interface ControllerActionCreateProps extends IResourceDetailsActionBulkOptionsBase {
|
|
23
|
+
dialogOptions?: IModalDialogOptions & { icon?: keyof IIconRecord; title?: string };
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
@Controller()
|
|
19
27
|
export class ControllerActionCreate extends BeanControllerBase {
|
|
20
|
-
static $propsDefault = {};
|
|
28
|
+
static $propsDefault = { class: 'btn btn-info join-item' };
|
|
21
29
|
static $componentOptions: IComponentOptions = { inheritAttrs: false, deepExtendDefault: true };
|
|
22
30
|
|
|
23
31
|
@Use({ injectionScope: 'host' })
|
|
24
32
|
$$renderContext: IJsxRenderContextDetails;
|
|
25
33
|
|
|
26
|
-
protected async __init__() {}
|
|
27
|
-
|
|
28
34
|
protected render() {
|
|
29
35
|
return (
|
|
30
36
|
<button
|
|
31
37
|
class={this.$props.class}
|
|
32
38
|
type="button"
|
|
33
39
|
onClick={async () => {
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
const { $$details } = this.$$renderContext;
|
|
41
|
+
const serverDetail = await this.bean._newBean(ServiceDetail, true, {
|
|
42
|
+
locale: this.scope.locale,
|
|
43
|
+
schema: $$details.schemaForm,
|
|
44
|
+
data: {},
|
|
45
|
+
formScene: 'create',
|
|
46
|
+
schemaScene: 'form-create',
|
|
47
|
+
icon: this.$props.dialogOptions?.icon,
|
|
48
|
+
title: this.$props.dialogOptions?.title ?? this.scope.locale.AddDetail(),
|
|
49
|
+
dialogOptions: this.$props.dialogOptions,
|
|
50
|
+
onSubmitData: (
|
|
51
|
+
data: TypeFormOnSubmitData<Record<string, any>>,
|
|
52
|
+
dialog: AppModalItem,
|
|
53
|
+
) => {
|
|
54
|
+
const detailItem = data.value;
|
|
55
|
+
$$details.data = [...$$details.data, detailItem];
|
|
56
|
+
dialog.close();
|
|
57
|
+
},
|
|
58
|
+
} satisfies IDialogFormOptions);
|
|
59
|
+
serverDetail.openDialogForm();
|
|
36
60
|
}}
|
|
37
61
|
>
|
|
38
|
-
{this.scope.locale.
|
|
62
|
+
{this.scope.locale.AddDetail()}
|
|
39
63
|
</button>
|
|
40
64
|
);
|
|
41
65
|
}
|