cabloy 5.1.65 → 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 +44 -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 +20 -11
- 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 +25 -5
- 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 +21 -0
- 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/index.ts +149 -2
- 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 +44 -6
- 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 +29 -5
- 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 +7 -2
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockToolbarBulk/controller.tsx +3 -1
- 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 +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/zh-cn.ts +4 -0
- 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/index.ts +1 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPermissionHintDetailsActionBulk, TypeFormScene } from 'zova-module-a-openapi';
|
|
2
|
+
|
|
3
|
+
export function checkPermission(
|
|
4
|
+
formScene: TypeFormScene,
|
|
5
|
+
permissionHint?: IPermissionHintDetailsActionBulk,
|
|
6
|
+
): boolean {
|
|
7
|
+
const formSceneHint = permissionHint?.formScene;
|
|
8
|
+
if (!formSceneHint) return true;
|
|
9
|
+
if (Array.isArray(formSceneHint) && formSceneHint.includes(formScene!)) return true;
|
|
10
|
+
if (formSceneHint === formScene) return true;
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { celEnvBase } from '@cabloy/utils';
|
|
2
|
+
import { classes } from 'typestyle';
|
|
3
|
+
import { VNode } from 'vue';
|
|
4
|
+
import { BeanBase, UseScope } from 'zova';
|
|
5
|
+
import { ZovaJsx } from 'zova-jsx';
|
|
6
|
+
import { Service } from 'zova-module-a-bean';
|
|
7
|
+
import {
|
|
8
|
+
BeanControllerFormBase,
|
|
9
|
+
formMetaFromFormScene,
|
|
10
|
+
TypeFormOnSubmitData,
|
|
11
|
+
} from 'zova-module-a-form';
|
|
12
|
+
import {
|
|
13
|
+
IDetailScope,
|
|
14
|
+
IFormMeta,
|
|
15
|
+
IFormProvider,
|
|
16
|
+
IJsxRenderContextDetail,
|
|
17
|
+
ISchemaObjectExtensionField,
|
|
18
|
+
ScopeModuleAOpenapi,
|
|
19
|
+
TypeFormScene,
|
|
20
|
+
TypeFormSchemaScene,
|
|
21
|
+
} from 'zova-module-a-openapi';
|
|
22
|
+
import { AppModalItem } from 'zova-module-basic-app';
|
|
23
|
+
|
|
24
|
+
import { IDialogFormOptions } from '../types/dialogForm.js';
|
|
25
|
+
|
|
26
|
+
@Service()
|
|
27
|
+
export class ServiceDetail<TData extends {} = {}> extends BeanBase {
|
|
28
|
+
private options: IDialogFormOptions<TData>;
|
|
29
|
+
private dialogInstance: AppModalItem | undefined;
|
|
30
|
+
|
|
31
|
+
formRef: BeanControllerFormBase<TData> | undefined;
|
|
32
|
+
|
|
33
|
+
formScene: TypeFormScene;
|
|
34
|
+
schemaScene: TypeFormSchemaScene;
|
|
35
|
+
|
|
36
|
+
formMeta: IFormMeta;
|
|
37
|
+
formProvider: IFormProvider;
|
|
38
|
+
formSchema?: ISchemaObjectExtensionField;
|
|
39
|
+
formData?: TData;
|
|
40
|
+
|
|
41
|
+
jsxZova: ZovaJsx;
|
|
42
|
+
jsxCelScope: IDetailScope;
|
|
43
|
+
jsxRenderContext: IJsxRenderContextDetail<TData>;
|
|
44
|
+
|
|
45
|
+
@UseScope()
|
|
46
|
+
$$scopeOpenapi: ScopeModuleAOpenapi;
|
|
47
|
+
|
|
48
|
+
protected async __init__(options: IDialogFormOptions<TData>) {
|
|
49
|
+
this.options = options;
|
|
50
|
+
this.formScene = options.formScene;
|
|
51
|
+
this.schemaScene = options.schemaScene;
|
|
52
|
+
this.formMeta = formMetaFromFormScene(this.formScene);
|
|
53
|
+
this.formProvider = this.$$scopeOpenapi.config.formProvider;
|
|
54
|
+
this.formSchema = options.schema;
|
|
55
|
+
this.formData = options.data;
|
|
56
|
+
// jsx
|
|
57
|
+
this._prepareJsx();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private _prepareJsx() {
|
|
61
|
+
const jsxCelEnv = celEnvBase.clone();
|
|
62
|
+
this.jsxZova = this.bean._newBeanSimple(
|
|
63
|
+
ZovaJsx,
|
|
64
|
+
false,
|
|
65
|
+
this.formProvider.components,
|
|
66
|
+
jsxCelEnv,
|
|
67
|
+
);
|
|
68
|
+
this.jsxCelScope = this._prepareJsxCelScope();
|
|
69
|
+
this.jsxRenderContext = {
|
|
70
|
+
app: this.app,
|
|
71
|
+
ctx: this.ctx,
|
|
72
|
+
$scene: 'detail',
|
|
73
|
+
$host: this,
|
|
74
|
+
$celScope: this.jsxCelScope,
|
|
75
|
+
$jsx: this.jsxZova,
|
|
76
|
+
$$detail: this,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private _prepareJsxCelScope(): IDetailScope {
|
|
81
|
+
// eslint-disable-next-line
|
|
82
|
+
const self = this;
|
|
83
|
+
const $$detail = this.$customRef(() => {
|
|
84
|
+
return {
|
|
85
|
+
get() {
|
|
86
|
+
return self;
|
|
87
|
+
},
|
|
88
|
+
set(_value) {},
|
|
89
|
+
};
|
|
90
|
+
}) as any;
|
|
91
|
+
return {
|
|
92
|
+
formMeta: this.formMeta,
|
|
93
|
+
$$detail,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private _renderBlocks() {
|
|
98
|
+
const blocks = this.formSchema?.rest?.blocks;
|
|
99
|
+
if (!blocks || blocks.length === 0) return;
|
|
100
|
+
const domBlocks: VNode[] = [];
|
|
101
|
+
blocks.forEach((block, index) => {
|
|
102
|
+
const options = Object.assign({ key: index }, block.options);
|
|
103
|
+
const domBlock = this.jsxZova.render(
|
|
104
|
+
block.render!,
|
|
105
|
+
options,
|
|
106
|
+
this.jsxCelScope,
|
|
107
|
+
this.jsxRenderContext,
|
|
108
|
+
);
|
|
109
|
+
if (!domBlock) return;
|
|
110
|
+
if (Array.isArray(domBlock)) {
|
|
111
|
+
domBlocks.push(...domBlock);
|
|
112
|
+
} else {
|
|
113
|
+
domBlocks.push(domBlock);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return domBlocks;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public closeDialog() {
|
|
120
|
+
if (this.dialogInstance) {
|
|
121
|
+
this.dialogInstance.close();
|
|
122
|
+
this.dialogInstance = undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public submitData(data: TypeFormOnSubmitData<TData>) {
|
|
127
|
+
this.options.onSubmitData?.(data, this.dialogInstance!);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
openDialogForm() {
|
|
131
|
+
const options = this.options;
|
|
132
|
+
this.dialogInstance = this.$appModal.dialog(
|
|
133
|
+
{
|
|
134
|
+
icon: options.icon,
|
|
135
|
+
title: options.title,
|
|
136
|
+
slotDefault: () => {
|
|
137
|
+
return <>{this._renderBlocks()}</>;
|
|
138
|
+
},
|
|
139
|
+
slotActions: () => {
|
|
140
|
+
const isSubmitting = this.formRef?.formState.isSubmitting;
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
{isSubmitting && <span class="loading loading-spinner text-primary"></span>}
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
class="btn btn-ghost"
|
|
147
|
+
onClick={() => {
|
|
148
|
+
this.closeDialog();
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
{options.locale.Cancel()}
|
|
152
|
+
</button>
|
|
153
|
+
{this.formScene !== 'view' && (
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
class={classes('btn btn-primary', isSubmitting && 'btn-disabled')}
|
|
157
|
+
onClick={async () => {
|
|
158
|
+
if (isSubmitting) return;
|
|
159
|
+
await this.formRef?.submit();
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
{options.locale.OK()}
|
|
163
|
+
</button>
|
|
164
|
+
)}
|
|
165
|
+
</>
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
options.dialogOptions,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDetailScope } from 'zova-module-a-openapi';
|
|
2
|
+
import 'zova-module-a-form';
|
|
3
|
+
import 'zova-module-a-openapi';
|
|
4
|
+
import type { ServiceDetail } from '../service/detail.jsx';
|
|
5
|
+
|
|
6
|
+
declare module 'zova-module-a-openapi' {
|
|
7
|
+
export interface IJsxRenderContextDetail<TData extends {} = {}> {
|
|
8
|
+
$$detail: ServiceDetail<TData>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IDetailScope {
|
|
12
|
+
$$detail?: ServiceDetail;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module 'zova-module-a-form' {
|
|
17
|
+
export interface IFormScope extends IDetailScope {}
|
|
18
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import 'zova-module-a-table';
|
|
1
2
|
import 'zova-module-a-openapi';
|
|
3
|
+
import type { IDetailsScope } from 'zova-module-a-openapi';
|
|
4
|
+
|
|
2
5
|
import { ControllerBlockDetails } from '../component/blockDetails/controller.jsx';
|
|
3
6
|
|
|
4
7
|
declare module 'zova-module-a-openapi' {
|
|
5
8
|
export interface IJsxRenderContextDetails<TData extends {} = {}> {
|
|
6
9
|
$$details: ControllerBlockDetails<TData>;
|
|
7
10
|
}
|
|
11
|
+
|
|
12
|
+
export interface IDetailsScope {
|
|
13
|
+
$$details?: ControllerBlockDetails<any>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module 'zova-module-a-table' {
|
|
18
|
+
export interface ITableScope extends IDetailsScope {}
|
|
8
19
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TypeFormOnSubmitData } from 'zova-module-a-form';
|
|
2
|
+
import { IIconRecord } from 'zova-module-a-icon';
|
|
3
|
+
import { TypeFormScene, TypeFormSchemaScene } from 'zova-module-a-openapi';
|
|
4
|
+
import { AppModalItem, IModalDialogOptions } from 'zova-module-basic-app';
|
|
5
|
+
|
|
6
|
+
export interface IDialogFormOptions<TData extends {} = {}> {
|
|
7
|
+
locale: {
|
|
8
|
+
Cancel: () => string;
|
|
9
|
+
OK: () => string;
|
|
10
|
+
};
|
|
11
|
+
schema: any;
|
|
12
|
+
data: TData;
|
|
13
|
+
formScene: TypeFormScene;
|
|
14
|
+
schemaScene: TypeFormSchemaScene;
|
|
15
|
+
dialogOptions?: IModalDialogOptions;
|
|
16
|
+
icon?: keyof IIconRecord;
|
|
17
|
+
title: string;
|
|
18
|
+
onSubmitData?: (
|
|
19
|
+
data: TypeFormOnSubmitData<TData>,
|
|
20
|
+
dialogInstance: AppModalItem,
|
|
21
|
+
) => void | Promise<void>;
|
|
22
|
+
}
|
|
@@ -52,8 +52,7 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
52
52
|
|
|
53
53
|
protected async __init__() {
|
|
54
54
|
this.formMeta = this.$computed(() => {
|
|
55
|
-
|
|
56
|
-
return { ...formMetaFromFormScene(formScene), formScene };
|
|
55
|
+
return formMetaFromFormScene(this.formScene);
|
|
57
56
|
});
|
|
58
57
|
this.formProvider = this.$computed(() => {
|
|
59
58
|
return this.$$modelResource.formProvider;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-suite-a-cabloy",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.38",
|
|
4
4
|
"gitHead": "4dece229b6d3f4735930e833afcb4b95ec51bf86",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"files": [],
|
|
8
8
|
"type": "module",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"zova-module-rest-resource": "^5.1.
|
|
10
|
+
"zova-module-rest-resource": "^5.1.37"
|
|
11
11
|
},
|
|
12
12
|
"title": "a-cabloy"
|
|
13
13
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
8
|
import { BeanBase } from 'zova';
|
|
4
|
-
import { Command
|
|
9
|
+
import { Command } from 'zova-module-a-command';
|
|
5
10
|
|
|
6
11
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
7
12
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandBulkOptionsBase,
|
|
3
|
+
ICommandExecute,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
|
-
import { BeanCommandBulkBase, Command
|
|
8
|
+
import { BeanCommandBulkBase, Command } from 'zova-module-a-command';
|
|
4
9
|
|
|
5
10
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
6
11
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandDetailsRowOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
6
|
+
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
7
|
+
|
|
8
|
+
import { BeanBase } from 'zova';
|
|
9
|
+
import { Command } from 'zova-module-a-command';
|
|
10
|
+
|
|
11
|
+
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
12
|
+
|
|
13
|
+
export interface ICommandOptions<%=argv.beanNameCapitalize%> extends ICommandDetailsRowOptionsBase<TypeCommand<%=argv.beanNameCapitalize%>Result> {}
|
|
14
|
+
|
|
15
|
+
@Command<ICommandOptions<%=argv.beanNameCapitalize%>>()
|
|
16
|
+
export class Command<%=argv.beanNameCapitalize%> extends BeanBase implements ICommandExecute {
|
|
17
|
+
execute(_options: ICommandOptions<%=argv.beanNameCapitalize%>, _renderContext: IJsxRenderContextBase, next: NextCommandExecute) {
|
|
18
|
+
return next();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICommandExecute,
|
|
3
|
+
ICommandRowOptionsBase,
|
|
4
|
+
NextCommandExecute,
|
|
5
|
+
} from 'zova-module-a-command';
|
|
1
6
|
import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
|
|
2
7
|
|
|
3
|
-
import { BeanCommandRowBase, Command
|
|
8
|
+
import { BeanCommandRowBase, Command } from 'zova-module-a-command';
|
|
4
9
|
|
|
5
10
|
export type TypeCommand<%=argv.beanNameCapitalize%>Result = unknown;
|
|
6
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-command",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.30",
|
|
4
4
|
"gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"optionsGlobalInterfaceFrom": "zova-module-a-command",
|
|
59
59
|
"boilerplate": "command/boilerplate",
|
|
60
60
|
"boilerplateCommandBulk": "commandBulk/boilerplate",
|
|
61
|
-
"boilerplateCommandRow": "commandRow/boilerplate"
|
|
61
|
+
"boilerplateCommandRow": "commandRow/boilerplate",
|
|
62
|
+
"boilerplateCommandDetailsRow": "commandDetailsRow/boilerplate"
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
"capabilities": {
|
|
@@ -40,6 +40,8 @@ export interface ICommandRowOptionsBase<Result = any> extends ICommandOptionsBas
|
|
|
40
40
|
id?: TableIdentity;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export interface ICommandDetailsRowOptionsBase<Result = any> extends ICommandOptionsBase<Result> {}
|
|
44
|
+
|
|
43
45
|
declare module 'zova-module-a-bean' {
|
|
44
46
|
export interface SysOnion {
|
|
45
47
|
command: ServiceOnion<IDecoratorCommandOptions, keyof ICommandRecord>;
|
|
@@ -127,6 +127,7 @@ export class ControllerForm<
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
public async submit(submitMeta?: TSubmitMeta): Promise<boolean> {
|
|
130
|
+
if (this.formMeta?.formScene === 'view') return false;
|
|
130
131
|
const [_, error] = await catchError(() => {
|
|
131
132
|
return this.form.handleSubmit(submitMeta as any);
|
|
132
133
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-openapi",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.37",
|
|
4
4
|
"gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"postpack": "clean-package restore && npm run clean"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@cabloy/json-schema-to-zod": "^2.6.
|
|
37
|
+
"@cabloy/json-schema-to-zod": "^2.6.5",
|
|
38
38
|
"openapi3-ts": "^4.5.0",
|
|
39
39
|
"typestyle": "^2.4.0"
|
|
40
40
|
},
|
|
@@ -76,15 +76,31 @@ function _normalizeSchema(
|
|
|
76
76
|
const schemaNew = Object.assign({}, schema, { properties: {} });
|
|
77
77
|
for (const key in schema.properties) {
|
|
78
78
|
let property = schema.properties[key] as SchemaObject | undefined;
|
|
79
|
-
|
|
80
|
-
property = onGetSchema(property.$ref);
|
|
81
|
-
}
|
|
79
|
+
property = _normalizePropertySchema(property, onGetSchema);
|
|
82
80
|
if (!property) continue;
|
|
83
|
-
|
|
81
|
+
// items.$ref
|
|
82
|
+
if (property.items?.$ref) {
|
|
83
|
+
const propertyItems = _normalizePropertySchema(property.items as any, onGetSchema);
|
|
84
|
+
if (!propertyItems) continue;
|
|
85
|
+
property = { ...property, items: propertyItems };
|
|
86
|
+
}
|
|
87
|
+
// _normalizeSchema
|
|
88
|
+
schemaNew.properties[key] = property;
|
|
84
89
|
}
|
|
85
90
|
return schemaNew;
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
function _normalizePropertySchema(
|
|
94
|
+
property: SchemaObject | undefined,
|
|
95
|
+
onGetSchema: (schemaName: string) => SchemaObject | undefined,
|
|
96
|
+
) {
|
|
97
|
+
if (property?.$ref) {
|
|
98
|
+
property = onGetSchema(property.$ref);
|
|
99
|
+
}
|
|
100
|
+
if (!property) return;
|
|
101
|
+
return _normalizeSchema(property, onGetSchema);
|
|
102
|
+
}
|
|
103
|
+
|
|
88
104
|
export function getSchemaOfRequestBody(
|
|
89
105
|
operationObject?: OperationObject,
|
|
90
106
|
): SchemaObject | undefined {
|
|
@@ -21,7 +21,7 @@ export interface IJsxRenderContextPageEntry extends IJsxRenderContextBase {
|
|
|
21
21
|
|
|
22
22
|
export interface IPageEntryScope {
|
|
23
23
|
resource?: string;
|
|
24
|
-
id
|
|
24
|
+
id?: TableIdentity | null;
|
|
25
25
|
permissions?: TypeOpenapiPermissions;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -35,6 +35,7 @@ export interface IJsxRenderSceneRecord {
|
|
|
35
35
|
formField: never;
|
|
36
36
|
//
|
|
37
37
|
details: never;
|
|
38
|
+
detail: never;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export interface IPageScope {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IJsxRenderContextBase } from '../action.js';
|
|
2
|
+
import { IFormMeta } from '../formMeta.js';
|
|
3
|
+
|
|
4
|
+
export interface IDetailScope {
|
|
5
|
+
formMeta?: IFormMeta;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IJsxRenderContextDetail extends IJsxRenderContextBase {
|
|
9
|
+
$celScope: IDetailScope;
|
|
10
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { IJsxRenderContextBase } from '../action.js';
|
|
2
|
+
import { IFormMeta } from '../formMeta.js';
|
|
2
3
|
|
|
3
|
-
export interface IDetailsScope {
|
|
4
|
+
export interface IDetailsScope {
|
|
5
|
+
formMeta?: IFormMeta;
|
|
6
|
+
}
|
|
4
7
|
|
|
5
8
|
export interface IJsxRenderContextDetails extends IJsxRenderContextBase {
|
|
6
9
|
$celScope: IDetailsScope;
|
|
@@ -6,6 +6,7 @@ import 'openapi3-ts/oas30';
|
|
|
6
6
|
import 'openapi3-ts/oas31';
|
|
7
7
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
8
8
|
|
|
9
|
+
import { IResourceDetailsActionRowRecord } from './detail/detailsActionRow.js';
|
|
9
10
|
import { IResourceRenderBlockOptionsBlock } from './resource/block.js';
|
|
10
11
|
import { IResourceFormFieldRecord } from './resource/formField.js';
|
|
11
12
|
import { IResourceTableActionRowRecord } from './resource/tableActionRow.js';
|
|
@@ -112,6 +113,7 @@ export type TypeTableCellRenderComponentNormal =
|
|
|
112
113
|
| TypeRenderComponentPreset;
|
|
113
114
|
export type TypeTableCellRenderComponent =
|
|
114
115
|
| keyof IResourceTableActionRowRecord
|
|
116
|
+
| keyof IResourceDetailsActionRowRecord
|
|
115
117
|
| TypeRenderComponentJsx;
|
|
116
118
|
export type TypeTableCellRenderComponentProvider = TypeRenderComponentJsx | 'text' | string;
|
|
117
119
|
export type TypeTableBulkRenderComponentProvider =
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { TableCell } from 'zova-module-a-table';
|
|
10
|
+
|
|
11
|
+
declare module 'zova-module-a-openapi' {
|
|
12
|
+
export interface IResourceDetailsActionRowRecord {
|
|
13
|
+
'<%=argv.module%>:<%=argv.beanName%>'?: ITableCellOptions<%=argv.beanNameCapitalize%>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ITableCellOptions<%=argv.beanNameCapitalize%> extends IResourceDetailsActionRowOptionsBase {}
|
|
18
|
+
|
|
19
|
+
@TableCell<ITableCellOptions<%=argv.beanNameCapitalize%>>()
|
|
20
|
+
export class TableCell<%=argv.beanNameCapitalize%> extends BeanBase implements ITableCellRender {
|
|
21
|
+
render(_options: ITableCellOptions<%=argv.beanNameCapitalize%>, _renderContext: IJsxRenderContextTableCell, next: NextTableCellRender) {
|
|
22
|
+
return next();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-table",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.33",
|
|
4
4
|
"gitHead": "09d901d17140a80ee0764211b441cda72fd94663",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
"optionsGlobalInterfaceName": "IDecoratorTableCellOptions",
|
|
77
77
|
"optionsGlobalInterfaceFrom": "zova-module-a-table",
|
|
78
78
|
"boilerplate": "tableCell/boilerplate",
|
|
79
|
-
"boilerplateTableActionRow": "tableActionRow/boilerplate"
|
|
79
|
+
"boilerplateTableActionRow": "tableActionRow/boilerplate",
|
|
80
|
+
"boilerplateDetailsActionRow": "detailsActionRow/boilerplate"
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
CellContext,
|
|
12
12
|
createColumnHelper,
|
|
13
13
|
getCoreRowModel,
|
|
14
|
+
Row,
|
|
14
15
|
TableOptionsWithReactiveData,
|
|
15
16
|
} from '@tanstack/vue-table';
|
|
16
17
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
@@ -50,6 +51,7 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
50
51
|
tableScope?: ITableScope;
|
|
51
52
|
getColumns?: TypeTableGetColumns<TData>;
|
|
52
53
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
54
|
+
getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
@Controller()
|
|
@@ -85,11 +87,11 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
85
87
|
this._createTable();
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
get schema() {
|
|
90
|
+
public get schema() {
|
|
89
91
|
return this.$props.schema;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
get data() {
|
|
94
|
+
public get data() {
|
|
93
95
|
return this.$props.data;
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -102,7 +104,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
102
104
|
// eslint-disable-next-line
|
|
103
105
|
const self = this;
|
|
104
106
|
const tableOptions: TableOptionsWithReactiveData<TData> = {
|
|
105
|
-
getRowId: (
|
|
107
|
+
getRowId: this.$props.getRowId ?? ((originalRow: TData) => cast(originalRow).id),
|
|
106
108
|
getCoreRowModel: getCoreRowModel(),
|
|
107
109
|
renderFallbackValue: this.scope.config.renderFallbackValue,
|
|
108
110
|
manualPagination: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.74",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "zova",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"zova-jsx": "^1.1.63"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@cabloy/cli": "^3.1.
|
|
49
|
+
"@cabloy/cli": "^3.1.23",
|
|
50
50
|
"@types/luxon": "^3.7.1",
|
|
51
51
|
"clean-package": "^2.2.0",
|
|
52
52
|
"fs-extra": "^11.3.5",
|