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
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
IModalAlertOptions,
|
|
11
11
|
IModalConfirmOptionsInner,
|
|
12
12
|
IModalDialogOptions,
|
|
13
|
+
IModalDialogRenderContext,
|
|
14
|
+
IModalDialogRenderOptions,
|
|
13
15
|
IModalItem,
|
|
16
|
+
IModalMessageOptions,
|
|
14
17
|
IModalPromptOptionsInner,
|
|
15
18
|
ModalType,
|
|
16
19
|
} from '../types/appModal.js';
|
|
@@ -27,7 +30,8 @@ interface IRenderDialogBaseOptions {
|
|
|
27
30
|
iconName?: keyof IIconRecord;
|
|
28
31
|
title: string;
|
|
29
32
|
body?: VNode;
|
|
30
|
-
actions
|
|
33
|
+
actions?: VNode;
|
|
34
|
+
showCloseButton?: boolean;
|
|
31
35
|
onClose: () => void;
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -37,6 +41,51 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
37
41
|
IBehaviorPropsInputAppModal,
|
|
38
42
|
IBehaviorPropsOutputAppModal
|
|
39
43
|
> {
|
|
44
|
+
private _windowKeydownHandler?: (event: KeyboardEvent) => void;
|
|
45
|
+
|
|
46
|
+
protected async __init__() {
|
|
47
|
+
if (!process.env.CLIENT) return;
|
|
48
|
+
this._windowKeydownHandler = event => {
|
|
49
|
+
if (event.key !== 'Escape' || event.defaultPrevented) return;
|
|
50
|
+
const modalItems = this.$appModal.modalItems;
|
|
51
|
+
if (modalItems.length === 0) return;
|
|
52
|
+
const modalItem = modalItems[modalItems.length - 1];
|
|
53
|
+
if (!modalItem) return;
|
|
54
|
+
const dialogOptions = this._prepareDialogOptions(modalItem.type, modalItem.dialogOptions);
|
|
55
|
+
if (!dialogOptions.closeOnEscape) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
this._closeModalByEscape(modalItem);
|
|
59
|
+
};
|
|
60
|
+
window.addEventListener('keydown', this._windowKeydownHandler);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected __dispose__() {
|
|
64
|
+
if (this._windowKeydownHandler) {
|
|
65
|
+
window.removeEventListener('keydown', this._windowKeydownHandler);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private _closeModalByEscape(modalItem: IModalItem) {
|
|
70
|
+
if (modalItem.type === 'alert') {
|
|
71
|
+
this.$appModal.close(modalItem.id);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (modalItem.type === 'confirm') {
|
|
75
|
+
const options = modalItem.options as IModalConfirmOptionsInner | undefined;
|
|
76
|
+
this.$appModal.close(modalItem.id);
|
|
77
|
+
options?.onCallback?.(false);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (modalItem.type === 'prompt') {
|
|
81
|
+
const options = modalItem.options as IModalPromptOptionsInner | undefined;
|
|
82
|
+
this.$appModal.close(modalItem.id);
|
|
83
|
+
options?.onCallback?.(undefined);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.$appModal.close(modalItem.id);
|
|
87
|
+
}
|
|
88
|
+
|
|
40
89
|
protected render(
|
|
41
90
|
_props: IBehaviorPropsInputAppModal,
|
|
42
91
|
next: NextBehavior<IBehaviorPropsOutputAppModal>,
|
|
@@ -58,7 +107,8 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
58
107
|
private _renderAppModal(modalItem: IModalItem) {
|
|
59
108
|
if (modalItem.type === 'alert') return this._renderAppModalAlert(modalItem);
|
|
60
109
|
if (modalItem.type === 'confirm') return this._renderAppModalConfirm(modalItem);
|
|
61
|
-
return this._renderAppModalPrompt(modalItem);
|
|
110
|
+
if (modalItem.type === 'prompt') return this._renderAppModalPrompt(modalItem);
|
|
111
|
+
return this._renderAppModalDialog(modalItem);
|
|
62
112
|
}
|
|
63
113
|
|
|
64
114
|
private _renderAppModalAlert(modalItem: IModalItem) {
|
|
@@ -85,6 +135,7 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
85
135
|
{this.scope.locale.Close()}
|
|
86
136
|
</button>
|
|
87
137
|
),
|
|
138
|
+
showCloseButton: dialogOptions.showCloseButton,
|
|
88
139
|
onClose: () => {
|
|
89
140
|
this.$appModal.close(modalItem.id);
|
|
90
141
|
},
|
|
@@ -127,6 +178,7 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
127
178
|
</button>
|
|
128
179
|
</>
|
|
129
180
|
),
|
|
181
|
+
showCloseButton: dialogOptions.showCloseButton,
|
|
130
182
|
onClose: () => {
|
|
131
183
|
this.$appModal.close(modalItem.id);
|
|
132
184
|
options?.onCallback?.(false);
|
|
@@ -189,6 +241,7 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
189
241
|
</button>
|
|
190
242
|
</>
|
|
191
243
|
),
|
|
244
|
+
showCloseButton: dialogOptions.showCloseButton,
|
|
192
245
|
onClose: () => {
|
|
193
246
|
this.$appModal.close(modalItem.id);
|
|
194
247
|
options?.onCallback?.(undefined);
|
|
@@ -196,6 +249,25 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
196
249
|
});
|
|
197
250
|
}
|
|
198
251
|
|
|
252
|
+
private _renderAppModalDialog(modalItem: IModalItem) {
|
|
253
|
+
const options = modalItem.options as IModalDialogRenderOptions | undefined;
|
|
254
|
+
const dialogOptions = this._prepareDialogOptions(modalItem.type, modalItem.dialogOptions);
|
|
255
|
+
const dialog = this._createDialogRenderContext(modalItem);
|
|
256
|
+
const title = options?.title ?? this.sys.env.APP_TITLE ?? '';
|
|
257
|
+
return this._renderDialogBase({
|
|
258
|
+
modalItem,
|
|
259
|
+
dialogOptions,
|
|
260
|
+
iconName: options?.icon,
|
|
261
|
+
title,
|
|
262
|
+
body: options?.slotDefault?.(dialog),
|
|
263
|
+
actions: options?.slotActions?.(dialog),
|
|
264
|
+
showCloseButton: dialogOptions.showCloseButton,
|
|
265
|
+
onClose: () => {
|
|
266
|
+
this.$appModal.close(modalItem.id);
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
199
271
|
private _renderDialogBase({
|
|
200
272
|
modalItem,
|
|
201
273
|
dialogOptions,
|
|
@@ -203,6 +275,7 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
203
275
|
title,
|
|
204
276
|
body,
|
|
205
277
|
actions,
|
|
278
|
+
showCloseButton,
|
|
206
279
|
onClose,
|
|
207
280
|
}: IRenderDialogBaseOptions) {
|
|
208
281
|
const style = this._dialogStyle(dialogOptions);
|
|
@@ -216,38 +289,83 @@ export class BehaviorAppModal extends BeanBehaviorBase<
|
|
|
216
289
|
}
|
|
217
290
|
}}
|
|
218
291
|
></div>
|
|
219
|
-
<div
|
|
220
|
-
|
|
221
|
-
|
|
292
|
+
<div
|
|
293
|
+
class="card bg-base-100 shadow-2xl relative w-full max-h-[calc(100vh-2rem)]"
|
|
294
|
+
style={style}
|
|
295
|
+
>
|
|
296
|
+
<div class="card-body flex max-h-full min-h-0 flex-col gap-4">
|
|
297
|
+
<div class="flex items-start gap-3 shrink-0">
|
|
222
298
|
{!!iconName && (
|
|
223
299
|
<ZIcon class="text-primary mt-1 shrink-0" name={iconName} width={24}></ZIcon>
|
|
224
300
|
)}
|
|
225
301
|
<div class="flex-1 min-w-0">
|
|
226
302
|
<h3 class="card-title">{title}</h3>
|
|
227
|
-
{!!body && <div class="mt-2">{body}</div>}
|
|
228
303
|
</div>
|
|
304
|
+
{!!showCloseButton && (
|
|
305
|
+
<button
|
|
306
|
+
type="button"
|
|
307
|
+
class="btn btn-ghost btn-sm btn-circle shrink-0 transition-colors hover:bg-base-300"
|
|
308
|
+
onClick={() => {
|
|
309
|
+
onClose();
|
|
310
|
+
}}
|
|
311
|
+
>
|
|
312
|
+
<ZIcon name="::close" width={18} height={18}></ZIcon>
|
|
313
|
+
</button>
|
|
314
|
+
)}
|
|
229
315
|
</div>
|
|
230
|
-
<div class="
|
|
316
|
+
{!!body && <div class="min-h-0 flex-1 overflow-y-auto p-2">{body}</div>}
|
|
317
|
+
{!!actions && <div class="card-actions justify-end shrink-0">{actions}</div>}
|
|
231
318
|
</div>
|
|
232
319
|
</div>
|
|
233
320
|
</div>
|
|
234
321
|
);
|
|
235
322
|
}
|
|
236
323
|
|
|
237
|
-
private
|
|
238
|
-
const defaults = this.scope.config.model[type].default;
|
|
324
|
+
private _createDialogRenderContext(modalItem: IModalItem): IModalDialogRenderContext {
|
|
239
325
|
return {
|
|
326
|
+
id: modalItem.id,
|
|
327
|
+
close: () => {
|
|
328
|
+
this.$appModal.close(modalItem.id);
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
private _prepareDialogOptions(
|
|
334
|
+
type: ModalType,
|
|
335
|
+
dialogOptions?: IModalDialogOptions | IModalMessageOptions,
|
|
336
|
+
) {
|
|
337
|
+
const defaults = this.scope.config.model[type].default as
|
|
338
|
+
| IModalDialogOptions
|
|
339
|
+
| IModalMessageOptions;
|
|
340
|
+
const options = {
|
|
240
341
|
maxWidth: dialogOptions?.maxWidth ?? defaults.maxWidth,
|
|
342
|
+
maxHeight: dialogOptions?.maxHeight ?? defaults.maxHeight,
|
|
241
343
|
closeOnBackdrop: dialogOptions?.closeOnBackdrop ?? defaults.closeOnBackdrop,
|
|
344
|
+
closeOnEscape: dialogOptions?.closeOnEscape ?? defaults.closeOnEscape,
|
|
345
|
+
showCloseButton: false,
|
|
346
|
+
};
|
|
347
|
+
if (type !== 'dialog') return options;
|
|
348
|
+
const defaultsDialog = defaults as IModalDialogOptions;
|
|
349
|
+
return {
|
|
350
|
+
...options,
|
|
351
|
+
showCloseButton:
|
|
352
|
+
(dialogOptions as IModalDialogOptions | undefined)?.showCloseButton ??
|
|
353
|
+
defaultsDialog.showCloseButton ??
|
|
354
|
+
false,
|
|
242
355
|
};
|
|
243
356
|
}
|
|
244
357
|
|
|
245
358
|
private _dialogStyle(dialogOptions: IModalDialogOptions) {
|
|
359
|
+
const style = {} as Record<string, string>;
|
|
246
360
|
const maxWidth = dialogOptions.maxWidth;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
maxWidth
|
|
250
|
-
}
|
|
361
|
+
const maxHeight = dialogOptions.maxHeight;
|
|
362
|
+
if (maxWidth) {
|
|
363
|
+
style.maxWidth = typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;
|
|
364
|
+
}
|
|
365
|
+
if (maxHeight) {
|
|
366
|
+
style.maxHeight = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;
|
|
367
|
+
}
|
|
368
|
+
return Object.keys(style).length > 0 ? style : undefined;
|
|
251
369
|
}
|
|
252
370
|
|
|
253
371
|
private _getButtonClass(type: AlertType, primary?: boolean) {
|
|
@@ -14,6 +14,8 @@ export const config = (_sys: ZovaSys) => {
|
|
|
14
14
|
default: {
|
|
15
15
|
maxWidth: 360,
|
|
16
16
|
closeOnBackdrop: true,
|
|
17
|
+
closeOnEscape: true,
|
|
18
|
+
showCloseButton: false,
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
21
|
confirm: {
|
|
@@ -23,6 +25,8 @@ export const config = (_sys: ZovaSys) => {
|
|
|
23
25
|
default: {
|
|
24
26
|
maxWidth: 360,
|
|
25
27
|
closeOnBackdrop: true,
|
|
28
|
+
closeOnEscape: true,
|
|
29
|
+
showCloseButton: false,
|
|
26
30
|
},
|
|
27
31
|
},
|
|
28
32
|
prompt: {
|
|
@@ -32,6 +36,17 @@ export const config = (_sys: ZovaSys) => {
|
|
|
32
36
|
default: {
|
|
33
37
|
maxWidth: 360,
|
|
34
38
|
closeOnBackdrop: true,
|
|
39
|
+
closeOnEscape: true,
|
|
40
|
+
showCloseButton: false,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
dialog: {
|
|
44
|
+
default: {
|
|
45
|
+
maxWidth: 640,
|
|
46
|
+
maxHeight: 'calc(100vh - 2rem)',
|
|
47
|
+
closeOnBackdrop: false,
|
|
48
|
+
closeOnEscape: true,
|
|
49
|
+
showCloseButton: true,
|
|
35
50
|
},
|
|
36
51
|
},
|
|
37
52
|
},
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
IModalAlertOptions,
|
|
7
7
|
IModalConfirmOptions,
|
|
8
8
|
IModalDialogOptions,
|
|
9
|
+
IModalDialogRenderOptions,
|
|
9
10
|
IModalItem,
|
|
11
|
+
IModalMessageOptions,
|
|
10
12
|
IModalPromptOptions,
|
|
11
13
|
} from '../types/appModal.js';
|
|
12
14
|
|
|
@@ -21,7 +23,7 @@ export class ServiceAppModal extends BeanBase {
|
|
|
21
23
|
return ++this.modalItemIdCounter;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
public alert(options?: IModalAlertOptions, dialogOptions?:
|
|
26
|
+
public alert(options?: IModalAlertOptions, dialogOptions?: IModalMessageOptions) {
|
|
25
27
|
const id = this.newModalItemId();
|
|
26
28
|
const modalItem: IModalItem = {
|
|
27
29
|
id,
|
|
@@ -35,7 +37,7 @@ export class ServiceAppModal extends BeanBase {
|
|
|
35
37
|
|
|
36
38
|
public confirm(
|
|
37
39
|
options?: IModalConfirmOptions,
|
|
38
|
-
dialogOptions?:
|
|
40
|
+
dialogOptions?: IModalMessageOptions,
|
|
39
41
|
): Promise<boolean> {
|
|
40
42
|
return new Promise(resolve => {
|
|
41
43
|
const id = this.newModalItemId();
|
|
@@ -56,7 +58,7 @@ export class ServiceAppModal extends BeanBase {
|
|
|
56
58
|
|
|
57
59
|
public prompt(
|
|
58
60
|
options?: IModalPromptOptions,
|
|
59
|
-
dialogOptions?:
|
|
61
|
+
dialogOptions?: IModalMessageOptions,
|
|
60
62
|
): Promise<string | undefined> {
|
|
61
63
|
return new Promise(resolve => {
|
|
62
64
|
const id = this.newModalItemId();
|
|
@@ -75,10 +77,26 @@ export class ServiceAppModal extends BeanBase {
|
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
public dialog(options?: IModalDialogRenderOptions, dialogOptions?: IModalDialogOptions) {
|
|
81
|
+
const id = this.newModalItemId();
|
|
82
|
+
const modalItem: IModalItem = {
|
|
83
|
+
id,
|
|
84
|
+
type: 'dialog',
|
|
85
|
+
options,
|
|
86
|
+
dialogOptions,
|
|
87
|
+
};
|
|
88
|
+
this.modalItems.push(modalItem);
|
|
89
|
+
return new AppModalItem(this, modalItem);
|
|
90
|
+
}
|
|
91
|
+
|
|
78
92
|
public close(id: number) {
|
|
79
|
-
const [index] = this.findModalItem(id);
|
|
80
|
-
if (index === -1) return;
|
|
93
|
+
const [index, modalItem] = this.findModalItem(id);
|
|
94
|
+
if (index === -1 || !modalItem) return;
|
|
81
95
|
this.modalItems.splice(index, 1);
|
|
96
|
+
if (modalItem.type === 'dialog') {
|
|
97
|
+
const options = modalItem.options as IModalDialogRenderOptions | undefined;
|
|
98
|
+
options?.onClose?.();
|
|
99
|
+
}
|
|
82
100
|
}
|
|
83
101
|
|
|
84
102
|
protected findModalItem(id: number): [number, IModalItem | undefined] {
|
|
@@ -1,13 +1,35 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
1
2
|
import type { IIconRecord } from 'zova-module-a-icon';
|
|
2
3
|
|
|
3
4
|
import type { ServiceAppModal } from '../service/appModal.js';
|
|
4
5
|
|
|
5
|
-
export type ModalType = 'alert' | 'confirm' | 'prompt';
|
|
6
|
+
export type ModalType = 'alert' | 'confirm' | 'prompt' | 'dialog';
|
|
6
7
|
export type AlertType = 'success' | 'info' | 'warning' | 'error';
|
|
7
8
|
|
|
8
|
-
export interface
|
|
9
|
+
export interface IModalBaseOptions {
|
|
9
10
|
maxWidth?: number | string;
|
|
11
|
+
maxHeight?: number | string;
|
|
10
12
|
closeOnBackdrop?: boolean;
|
|
13
|
+
closeOnEscape?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IModalDialogOptions extends IModalBaseOptions {
|
|
17
|
+
showCloseButton?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IModalMessageOptions extends IModalBaseOptions {}
|
|
21
|
+
|
|
22
|
+
export interface IModalDialogRenderContext {
|
|
23
|
+
id: number;
|
|
24
|
+
close: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IModalDialogRenderOptions {
|
|
28
|
+
icon?: keyof IIconRecord;
|
|
29
|
+
title?: string;
|
|
30
|
+
slotDefault?: (dialog: IModalDialogRenderContext) => VNode;
|
|
31
|
+
slotActions?: (dialog: IModalDialogRenderContext) => VNode;
|
|
32
|
+
onClose?: () => void;
|
|
11
33
|
}
|
|
12
34
|
|
|
13
35
|
export interface IModalAlertOptions {
|
|
@@ -41,8 +63,12 @@ export interface IModalPromptOptionsInner extends IModalPromptOptions {
|
|
|
41
63
|
export interface IModalItem {
|
|
42
64
|
id: number;
|
|
43
65
|
type: ModalType;
|
|
44
|
-
options?:
|
|
45
|
-
|
|
66
|
+
options?:
|
|
67
|
+
| IModalAlertOptions
|
|
68
|
+
| IModalConfirmOptionsInner
|
|
69
|
+
| IModalPromptOptionsInner
|
|
70
|
+
| IModalDialogRenderOptions;
|
|
71
|
+
dialogOptions?: IModalDialogOptions | IModalMessageOptions;
|
|
46
72
|
}
|
|
47
73
|
|
|
48
74
|
declare module 'zova' {
|
package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockForm.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TypeControllerInnerProps } from 'zova';
|
|
2
|
+
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
import { prepareComponentOptions, useController } from 'zova';
|
|
5
|
+
|
|
6
|
+
import type { ControllerBlockFormProps } from '../../component/blockForm/controller.jsx';
|
|
7
|
+
|
|
8
|
+
import { ControllerBlockForm } from '../../component/blockForm/controller.jsx';
|
|
9
|
+
export type ZBlockFormProps = {
|
|
10
|
+
controllerRef?: (ref: ControllerBlockForm) => void;
|
|
11
|
+
} & ControllerBlockFormProps;
|
|
12
|
+
|
|
13
|
+
type ControllerInnerProps = TypeControllerInnerProps<
|
|
14
|
+
ControllerBlockFormProps,
|
|
15
|
+
keyof typeof ControllerBlockForm.$propsDefault
|
|
16
|
+
>;
|
|
17
|
+
declare module 'zova-module-basic-details' {
|
|
18
|
+
export interface ControllerBlockForm {
|
|
19
|
+
$props: ControllerInnerProps;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ZBlockForm = defineComponent((_props: ZBlockFormProps) => {
|
|
24
|
+
useController(ControllerBlockForm, undefined, undefined);
|
|
25
|
+
return () => {};
|
|
26
|
+
}, prepareComponentOptions(ControllerBlockForm.$componentOptions));
|
|
27
|
+
declare module 'zova-module-a-bean' {
|
|
28
|
+
export interface IVonaComponentRecord {
|
|
29
|
+
'basic-details:blockForm': ControllerBlockFormProps;
|
|
30
|
+
}
|
|
31
|
+
}
|
package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockTable.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TypeControllerInnerProps } from 'zova';
|
|
2
|
+
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
import { prepareComponentOptions, useController } from 'zova';
|
|
5
|
+
|
|
6
|
+
import type { ControllerBlockTableProps } from '../../component/blockTable/controller.jsx';
|
|
7
|
+
|
|
8
|
+
import { ControllerBlockTable } from '../../component/blockTable/controller.jsx';
|
|
9
|
+
export type ZBlockTableProps = {
|
|
10
|
+
controllerRef?: (ref: ControllerBlockTable) => void;
|
|
11
|
+
} & ControllerBlockTableProps;
|
|
12
|
+
|
|
13
|
+
type ControllerInnerProps = TypeControllerInnerProps<
|
|
14
|
+
ControllerBlockTableProps,
|
|
15
|
+
keyof typeof ControllerBlockTable.$propsDefault
|
|
16
|
+
>;
|
|
17
|
+
declare module 'zova-module-basic-details' {
|
|
18
|
+
export interface ControllerBlockTable {
|
|
19
|
+
$props: ControllerInnerProps;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ZBlockTable = defineComponent((_props: ZBlockTableProps) => {
|
|
24
|
+
useController(ControllerBlockTable, undefined, undefined);
|
|
25
|
+
return () => {};
|
|
26
|
+
}, prepareComponentOptions(ControllerBlockTable.$componentOptions));
|
|
27
|
+
declare module 'zova-module-a-bean' {
|
|
28
|
+
export interface IVonaComponentRecord {
|
|
29
|
+
'basic-details:blockTable': ControllerBlockTableProps;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TypeControllerInnerProps } from 'zova';
|
|
2
|
+
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
import { prepareComponentOptions, useController } from 'zova';
|
|
5
|
+
|
|
6
|
+
import type { ControllerBlockToolbarBulkProps } from '../../component/blockToolbarBulk/controller.jsx';
|
|
7
|
+
|
|
8
|
+
import { ControllerBlockToolbarBulk } from '../../component/blockToolbarBulk/controller.jsx';
|
|
9
|
+
export type ZBlockToolbarBulkProps = {
|
|
10
|
+
controllerRef?: (ref: ControllerBlockToolbarBulk) => void;
|
|
11
|
+
} & ControllerBlockToolbarBulkProps;
|
|
12
|
+
|
|
13
|
+
type ControllerInnerProps = TypeControllerInnerProps<
|
|
14
|
+
ControllerBlockToolbarBulkProps,
|
|
15
|
+
keyof typeof ControllerBlockToolbarBulk.$propsDefault
|
|
16
|
+
>;
|
|
17
|
+
declare module 'zova-module-basic-details' {
|
|
18
|
+
export interface ControllerBlockToolbarBulk {
|
|
19
|
+
$props: ControllerInnerProps;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ZBlockToolbarBulk = defineComponent((_props: ZBlockToolbarBulkProps) => {
|
|
24
|
+
useController(ControllerBlockToolbarBulk, undefined, undefined);
|
|
25
|
+
return () => {};
|
|
26
|
+
}, prepareComponentOptions(ControllerBlockToolbarBulk.$componentOptions));
|
|
27
|
+
declare module 'zova-module-a-bean' {
|
|
28
|
+
export interface IVonaComponentRecord {
|
|
29
|
+
'basic-details:blockToolbarBulk': ControllerBlockToolbarBulkProps;
|
|
30
|
+
}
|
|
31
|
+
}
|