cabloy 5.1.61 → 5.1.63
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/.claude/skills/cabloy-backend-scaffold/SKILL.md +2 -0
- package/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +1 -1
- package/.claude/skills/cabloy-domain-planning/SKILL.md +212 -0
- package/.claude/skills/cabloy-frontend-scaffold/SKILL.md +2 -0
- package/CHANGELOG.md +55 -0
- package/CLAUDE.md +1 -0
- package/cabloy-docs/.vitepress/config.mjs +158 -12
- package/cabloy-docs/ai/docs-skills-rules-mapping.md +8 -0
- package/cabloy-docs/ai/future-skill-roadmap.md +2 -0
- package/cabloy-docs/ai/skills.md +1 -0
- package/cabloy-docs/backend/backend-contract-emission-output-inspection.md +189 -0
- package/cabloy-docs/backend/backend-contract-emission-source-reading-map.md +160 -0
- package/cabloy-docs/backend/backend-contract-emission-specimen.md +170 -0
- package/cabloy-docs/backend/backend-resource-module-contract-chain.md +323 -0
- package/cabloy-docs/backend/backend-source-reading-debug-checklist.md +173 -0
- package/cabloy-docs/backend/backend-source-reading-roadmap.md +129 -0
- package/cabloy-docs/backend/backend-source-reading-verify-playbook.md +166 -0
- package/cabloy-docs/backend/bean-scene-authoring.md +4 -4
- package/cabloy-docs/backend/broadcast-guide.md +3 -3
- package/cabloy-docs/backend/cli.md +20 -11
- package/cabloy-docs/backend/config-guide.md +4 -4
- package/cabloy-docs/backend/controller-aop-guide.md +10 -10
- package/cabloy-docs/backend/controller-guide.md +12 -2
- package/cabloy-docs/backend/crud-workflow.md +7 -3
- package/cabloy-docs/backend/dto-guide.md +12 -2
- package/cabloy-docs/backend/dto-infer-generation.md +201 -25
- package/cabloy-docs/backend/election-guide.md +2 -2
- package/cabloy-docs/backend/entity-guide.md +12 -3
- package/cabloy-docs/backend/error-guide.md +3 -3
- package/cabloy-docs/backend/event-guide.md +4 -4
- package/cabloy-docs/backend/external-aop-guide.md +2 -2
- package/cabloy-docs/backend/field-indexes.md +9 -3
- package/cabloy-docs/backend/foundation.md +8 -8
- package/cabloy-docs/backend/i18n-guide.md +6 -6
- package/cabloy-docs/backend/internal-aop-guide.md +2 -2
- package/cabloy-docs/backend/introduction.md +13 -0
- package/cabloy-docs/backend/migration-and-changes.md +3 -3
- package/cabloy-docs/backend/model-guide.md +16 -6
- package/cabloy-docs/backend/openapi-guide.md +3 -0
- package/cabloy-docs/backend/queue-guide.md +3 -3
- package/cabloy-docs/backend/redlock-guide.md +2 -2
- package/cabloy-docs/backend/schedule-guide.md +2 -2
- package/cabloy-docs/backend/scripts.md +8 -0
- package/cabloy-docs/backend/serialization-guide.md +2 -2
- package/cabloy-docs/backend/service-guide.md +18 -9
- package/cabloy-docs/backend/startup-guide.md +5 -5
- package/cabloy-docs/backend/status-guide.md +7 -7
- package/cabloy-docs/backend/unit-testing.md +3 -3
- package/cabloy-docs/backend/vona-source-reading-map.md +157 -0
- package/cabloy-docs/backend/websocket-protocol-guide.md +5 -5
- package/cabloy-docs/backend/websocket-usage-guide.md +15 -8
- package/cabloy-docs/frontend/a-model-under-the-hood.md +281 -0
- package/cabloy-docs/frontend/a-openapi-under-the-hood.md +248 -0
- package/cabloy-docs/frontend/a-router-guide.md +307 -0
- package/cabloy-docs/frontend/api-guide.md +4 -4
- package/cabloy-docs/frontend/api-schema-guide.md +1 -0
- package/cabloy-docs/frontend/app-startup-guide.md +7 -4
- package/cabloy-docs/frontend/bean-scene-authoring.md +1 -1
- package/cabloy-docs/frontend/behavior-guide.md +16 -16
- package/cabloy-docs/frontend/cli.md +5 -5
- package/cabloy-docs/frontend/command-scene-authoring.md +17 -8
- package/cabloy-docs/frontend/component-guide.md +5 -5
- package/cabloy-docs/frontend/component-props-guide.md +1 -1
- package/cabloy-docs/frontend/component-v-model-guide.md +2 -2
- package/cabloy-docs/frontend/filter-query-select-data-flow-guide.md +260 -0
- package/cabloy-docs/frontend/form-guide.md +27 -30
- package/cabloy-docs/frontend/form-scene-to-page-meta-guide.md +303 -0
- package/cabloy-docs/frontend/foundation.md +10 -6
- package/cabloy-docs/frontend/frontend-source-reading-roadmap.md +249 -0
- package/cabloy-docs/frontend/generated-contract-consumption-debug-checklist.md +190 -0
- package/cabloy-docs/frontend/generated-contract-consumption-entry-branch.md +205 -0
- package/cabloy-docs/frontend/generated-contract-consumption-list-branch.md +157 -0
- package/cabloy-docs/frontend/generated-contract-consumption-specimen.md +203 -0
- package/cabloy-docs/frontend/generated-contract-consumption-verify-playbook.md +189 -0
- package/cabloy-docs/frontend/generic-component-guide.md +1 -1
- package/cabloy-docs/frontend/introduction.md +29 -7
- package/cabloy-docs/frontend/model-architecture.md +38 -2
- package/cabloy-docs/frontend/model-resource-cookbook.md +11 -8
- package/cabloy-docs/frontend/model-resource-internals-deep-dive.md +238 -0
- package/cabloy-docs/frontend/model-resource-owner-pattern.md +22 -2
- package/cabloy-docs/frontend/model-resource-usage-guide.md +22 -6
- package/cabloy-docs/frontend/model-state-guide.md +12 -9
- package/cabloy-docs/frontend/module-scope.md +8 -8
- package/cabloy-docs/frontend/modules-and-suites.md +2 -1
- package/cabloy-docs/frontend/navigation-guards-guide.md +7 -0
- package/cabloy-docs/frontend/openapi-sdk-guide.md +12 -4
- package/cabloy-docs/frontend/page-guide.md +9 -9
- package/cabloy-docs/frontend/page-meta-guide.md +466 -0
- package/cabloy-docs/frontend/page-params-guide.md +3 -3
- package/cabloy-docs/frontend/page-query-guide.md +2 -2
- package/cabloy-docs/frontend/page-route-guide.md +6 -0
- package/cabloy-docs/frontend/permission-formscene-action-visibility-guide.md +263 -0
- package/cabloy-docs/frontend/quickstart.md +14 -2
- package/cabloy-docs/frontend/resource-entry-page-deep-dive.md +271 -0
- package/cabloy-docs/frontend/resource-list-page-deep-dive.md +279 -0
- package/cabloy-docs/frontend/rest-resource-source-reading-map.md +522 -0
- package/cabloy-docs/frontend/rest-resource-under-the-hood.md +622 -0
- package/cabloy-docs/frontend/root-behaviors-guide.md +282 -0
- package/cabloy-docs/frontend/route-alias-guide.md +6 -0
- package/cabloy-docs/frontend/router-stack-guide.md +229 -0
- package/cabloy-docs/frontend/router-tabs-introduction.md +26 -3
- package/cabloy-docs/frontend/router-tabs-layout-integration.md +367 -0
- package/cabloy-docs/frontend/router-tabs-mechanism.md +6 -0
- package/cabloy-docs/frontend/router-tabs-route-meta-cookbook.md +7 -0
- package/cabloy-docs/frontend/router-tabs-vs-stack.md +167 -0
- package/cabloy-docs/frontend/router-view-hosts-guide.md +450 -0
- package/cabloy-docs/frontend/server-data.md +2 -1
- package/cabloy-docs/frontend/system-startup-guide.md +2 -2
- package/cabloy-docs/frontend/table-action-visibility-permission-flow-guide.md +263 -0
- package/cabloy-docs/frontend/table-cell-cookbook.md +571 -0
- package/cabloy-docs/frontend/table-guide.md +373 -0
- package/cabloy-docs/frontend/table-resource-crud-cookbook.md +496 -0
- package/cabloy-docs/frontend/zova-app-guide.md +251 -0
- package/cabloy-docs/frontend/zova-form-source-reading-map.md +7 -9
- package/cabloy-docs/frontend/zova-form-under-the-hood.md +5 -0
- package/cabloy-docs/frontend/zova-router-under-the-hood.md +561 -0
- package/cabloy-docs/frontend/zova-source-reading-map.md +101 -7
- package/cabloy-docs/frontend/zova-table-controller-render-supplement.md +225 -0
- package/cabloy-docs/frontend/zova-table-source-reading-map.md +317 -0
- package/cabloy-docs/frontend/zova-table-under-the-hood.md +532 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-debug-checklist.md +245 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-source-reading-map.md +139 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions-verify-playbook.md +248 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions.md +511 -0
- package/cabloy-docs/fullstack/contract-loop-playbook.md +8 -2
- package/cabloy-docs/fullstack/edition-collaboration-differences.md +6 -0
- package/cabloy-docs/fullstack/frontend-metadata-to-backend.md +181 -48
- package/cabloy-docs/fullstack/introduction.md +3 -0
- package/cabloy-docs/fullstack/openapi-to-sdk.md +116 -2
- package/cabloy-docs/fullstack/suites-and-modules.md +333 -0
- package/cabloy-docs/fullstack/tutorial-1-first-module.md +3 -0
- package/cabloy-docs/fullstack/tutorial-2-first-crud.md +4 -0
- package/cabloy-docs/fullstack/tutorial-3-frontend-metadata-sharing.md +4 -0
- package/cabloy-docs/fullstack/tutorial-4-custom-level-renderers.md +31 -19
- package/cabloy-docs/fullstack/tutorial-5-backend-contract-sharing.md +5 -0
- package/cabloy-docs/fullstack/tutorial-6-one-contract-four-uses.md +4 -0
- package/cabloy-docs/fullstack/tutorials-overview.md +1 -1
- package/cabloy-docs/reference/bean-scene-boilerplates.md +13 -13
- package/cabloy-docs/reference/package-map.md +4 -3
- package/package.json +1 -1
- package/vona/pnpm-lock.yaml +22 -258
- package/vona/src/suite/a-training/modules/training-student/package.json +53 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/index.ts +400 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/locales.ts +18 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/this.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/meta.index.ts +12 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/meta.version.ts +21 -0
- package/vona/src/suite/a-training/modules/training-student/src/bean/ssrMenu.student.ts +29 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +15 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +15 -0
- package/vona/src/suite/a-training/modules/training-student/src/controller/student.ts +74 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +28 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +44 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectRes.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectResItem.tsx +45 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSummary.tsx +42 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +28 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +25 -0
- package/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx +84 -0
- package/vona/src/suite/a-training/modules/training-student/src/index.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/model/student.ts +10 -0
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +57 -0
- package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +173 -0
- package/vona/src/suite/a-training/modules/training-student/tsconfig.build.json +11 -0
- package/vona/src/suite/a-training/modules/training-student/tsconfig.json +7 -0
- package/vona/src/suite/a-training/package.json +12 -0
- package/vona/src/suite/a-training/tsconfig.base.json +4 -0
- package/vona/src/suite/a-training/tsconfig.json +10 -0
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +423 -682
- package/zova/src/suite/a-demo/modules/demo-basic/src/page/toolOne/render.tsx +5 -3
- package/zova/src/suite/a-home/modules/home-login/src/page/login/render.tsx +5 -3
- package/zova/src/suite/a-training/modules/training-student/cli/openapi.config.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/package.json +57 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/component/formFieldLevel.ts +31 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/index.ts +258 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/locales.ts +7 -0
- package/zova/src/suite/a-training/modules/training-student/src/.metadata/this.ts +2 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/index.ts +3 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +196 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +4146 -0
- package/zova/src/suite/a-training/modules/training-student/src/api/trainingStudent.ts +151 -0
- package/zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts +43 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionDeleteForce.tsx +53 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionSummary.tsx +56 -0
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.level.tsx +63 -0
- package/zova/src/suite/a-training/modules/training-student/src/component/formFieldLevel/controller.tsx +117 -0
- package/zova/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +9 -0
- package/zova/src/suite/a-training/modules/training-student/src/index.ts +2 -0
- package/zova/src/suite/a-training/modules/training-student/src/model/student.ts +42 -0
- package/zova/src/suite/a-training/modules/training-student/tsconfig.build.json +13 -0
- package/zova/src/suite/a-training/modules/training-student/tsconfig.json +5 -0
- package/zova/src/suite/a-training/package.json +12 -0
- package/zova/src/suite/a-training/tsconfig.base.json +4 -0
- package/zova/src/suite/a-training/tsconfig.json +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/package.json +60 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/index.ts +137 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/locales.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/this.ts +2 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/bean/behavior.appModal.tsx +260 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/config.ts +39 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/locale/en-us.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/locale/zh-cn.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/index.ts +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/lib/appModalItem.ts +16 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/lib/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/monkey.ts +38 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/monkeySys.ts +14 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/service/appModal.ts +89 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/appModal.ts +52 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/tsconfig.build.json +13 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/tsconfig.json +5 -0
- package/zova/src/suite/cabloy-basic/modules/basic-commands/package.json +6 -1
- package/zova/src/suite/cabloy-basic/modules/basic-commands/src/.metadata/index.ts +16 -0
- package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.alert.tsx +8 -14
- package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.confirm.tsx +10 -7
- package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.prompt.tsx +30 -0
- package/zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockForm/controller.tsx +5 -3
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/formFieldSelect/controller.tsx +29 -7
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/select/controller.tsx +34 -11
- package/zova/src/suite/cabloy-basic/modules/basic-table/package.json +6 -1
- package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionDelete.tsx +4 -2
- package/zova/src/suite/cabloy-basic/package.json +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/controller.tsx +3 -3
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/lib/tableCell.ts +1 -1
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// eslint-disable
|
|
2
|
+
/** service: begin */
|
|
3
|
+
export * from '../service/appModal.js';
|
|
4
|
+
|
|
5
|
+
import 'zova-module-a-bean';
|
|
6
|
+
declare module 'zova-module-a-bean' {
|
|
7
|
+
|
|
8
|
+
export interface IServiceRecord {
|
|
9
|
+
'basic-app:appModal': never;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
declare module 'zova-module-basic-app' {
|
|
15
|
+
|
|
16
|
+
export interface ServiceAppModal {
|
|
17
|
+
/** @internal */
|
|
18
|
+
get scope(): ScopeModuleBasicApp;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ServiceAppModal {
|
|
22
|
+
get $beanFullName(): 'basic-app.service.appModal';
|
|
23
|
+
get $onionName(): 'basic-app:appModal';
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** service: end */
|
|
28
|
+
/** service: begin */
|
|
29
|
+
import { ServiceAppModal } from '../service/appModal.js';
|
|
30
|
+
import 'zova';
|
|
31
|
+
declare module 'zova' {
|
|
32
|
+
export interface IBeanRecordGeneral {
|
|
33
|
+
'basic-app.service.appModal': ServiceAppModal;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** service: end */
|
|
37
|
+
/** behavior: begin */
|
|
38
|
+
export * from '../bean/behavior.appModal.jsx';
|
|
39
|
+
import { IBehaviorOptionsAppModal } from '../bean/behavior.appModal.jsx';
|
|
40
|
+
import 'zova-module-a-behavior';
|
|
41
|
+
declare module 'zova-module-a-behavior' {
|
|
42
|
+
|
|
43
|
+
export interface IBehaviorRecord {
|
|
44
|
+
'basic-app:appModal': IBehaviorOptionsAppModal;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
declare module 'zova-module-basic-app' {
|
|
50
|
+
|
|
51
|
+
export interface BehaviorAppModal {
|
|
52
|
+
/** @internal */
|
|
53
|
+
get scope(): ScopeModuleBasicApp;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface BehaviorAppModal {
|
|
57
|
+
get $beanFullName(): 'basic-app.behavior.appModal';
|
|
58
|
+
get $onionName(): 'basic-app:appModal';
|
|
59
|
+
get $onionOptions(): IBehaviorOptionsAppModal;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** behavior: end */
|
|
63
|
+
/** behavior: begin */
|
|
64
|
+
import { BehaviorAppModal } from '../bean/behavior.appModal.jsx';
|
|
65
|
+
import 'zova';
|
|
66
|
+
declare module 'zova' {
|
|
67
|
+
export interface IBeanRecordLocal {
|
|
68
|
+
'basic-app.behavior.appModal': BehaviorAppModal;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** behavior: end */
|
|
72
|
+
/** behaviors: begin */
|
|
73
|
+
import 'vue';
|
|
74
|
+
import 'vue/jsx-runtime';
|
|
75
|
+
|
|
76
|
+
declare module 'vue' {
|
|
77
|
+
export interface InputHTMLAttributes {
|
|
78
|
+
'bs-basic-app-appModal'?: IBehaviorOptionsAppModal | '' | boolean;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare module 'vue/jsx-runtime' {
|
|
83
|
+
namespace JSX {
|
|
84
|
+
// need define class/style in IntrinsicAttributes
|
|
85
|
+
export interface IntrinsicAttributes {
|
|
86
|
+
'bs-basic-app-appModal'?: IBehaviorOptionsAppModal | '' | boolean;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** behaviors: end */
|
|
91
|
+
/** config: begin */
|
|
92
|
+
export * from '../config/config.js';
|
|
93
|
+
import { config } from '../config/config.js';
|
|
94
|
+
/** config: end */
|
|
95
|
+
/** locale: begin */
|
|
96
|
+
import { locales } from './locales.js';
|
|
97
|
+
/** locale: end */
|
|
98
|
+
/** monkey: begin */
|
|
99
|
+
export * from '../monkey.js';
|
|
100
|
+
/** monkey: end */
|
|
101
|
+
/** monkeySys: begin */
|
|
102
|
+
export * from '../monkeySys.js';
|
|
103
|
+
/** monkeySys: end */
|
|
104
|
+
/** scope: begin */
|
|
105
|
+
import { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig, TypeModuleLocales, TypeLocaleBase } from 'zova';
|
|
106
|
+
import { Scope } from 'zova-module-a-bean';
|
|
107
|
+
|
|
108
|
+
@Scope()
|
|
109
|
+
export class ScopeModuleBasicApp extends BeanScopeBase {}
|
|
110
|
+
|
|
111
|
+
export interface ScopeModuleBasicApp {
|
|
112
|
+
util: BeanScopeUtil;
|
|
113
|
+
config: TypeModuleConfig<typeof config>;
|
|
114
|
+
locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
import 'zova';
|
|
118
|
+
declare module 'zova' {
|
|
119
|
+
export interface IBeanScopeRecord {
|
|
120
|
+
'basic-app': ScopeModuleBasicApp;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface IBeanScopeConfig {
|
|
124
|
+
'basic-app': ReturnType<typeof config>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface IBeanScopeLocale {
|
|
128
|
+
'basic-app': (typeof locales)[TypeLocaleBase];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): `basic-app::${K}` {
|
|
135
|
+
return `basic-app::${key}`;
|
|
136
|
+
}
|
|
137
|
+
/** scope: end */
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
import type { IDecoratorBehaviorOptions, NextBehavior } from 'zova-module-a-behavior';
|
|
3
|
+
import type { IIconRecord } from 'zova-module-a-icon';
|
|
4
|
+
|
|
5
|
+
import { BeanBehaviorBase, Behavior } from 'zova-module-a-behavior';
|
|
6
|
+
import { ZIcon } from 'zova-module-a-icon';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
AlertType,
|
|
10
|
+
IModalAlertOptions,
|
|
11
|
+
IModalConfirmOptionsInner,
|
|
12
|
+
IModalDialogOptions,
|
|
13
|
+
IModalItem,
|
|
14
|
+
IModalPromptOptionsInner,
|
|
15
|
+
ModalType,
|
|
16
|
+
} from '../types/appModal.js';
|
|
17
|
+
|
|
18
|
+
export interface IBehaviorPropsInputAppModal {}
|
|
19
|
+
|
|
20
|
+
export interface IBehaviorPropsOutputAppModal extends IBehaviorPropsInputAppModal {}
|
|
21
|
+
|
|
22
|
+
export interface IBehaviorOptionsAppModal extends IDecoratorBehaviorOptions {}
|
|
23
|
+
|
|
24
|
+
interface IRenderDialogBaseOptions {
|
|
25
|
+
modalItem: IModalItem;
|
|
26
|
+
dialogOptions: IModalDialogOptions;
|
|
27
|
+
iconName?: keyof IIconRecord;
|
|
28
|
+
title: string;
|
|
29
|
+
body?: VNode;
|
|
30
|
+
actions: VNode;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Behavior<IBehaviorOptionsAppModal>()
|
|
35
|
+
export class BehaviorAppModal extends BeanBehaviorBase<
|
|
36
|
+
IBehaviorOptionsAppModal,
|
|
37
|
+
IBehaviorPropsInputAppModal,
|
|
38
|
+
IBehaviorPropsOutputAppModal
|
|
39
|
+
> {
|
|
40
|
+
protected render(
|
|
41
|
+
_props: IBehaviorPropsInputAppModal,
|
|
42
|
+
next: NextBehavior<IBehaviorPropsOutputAppModal>,
|
|
43
|
+
): VNode {
|
|
44
|
+
const vnodeDefault = next();
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{vnodeDefault}
|
|
48
|
+
{this._renderAppModals()}
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private _renderAppModals() {
|
|
54
|
+
if (this.$appModal.modalItems.length === 0) return;
|
|
55
|
+
return <>{this.$appModal.modalItems.map(modalItem => this._renderAppModal(modalItem))}</>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private _renderAppModal(modalItem: IModalItem) {
|
|
59
|
+
if (modalItem.type === 'alert') return this._renderAppModalAlert(modalItem);
|
|
60
|
+
if (modalItem.type === 'confirm') return this._renderAppModalConfirm(modalItem);
|
|
61
|
+
return this._renderAppModalPrompt(modalItem);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private _renderAppModalAlert(modalItem: IModalItem) {
|
|
65
|
+
const options = modalItem.options as IModalAlertOptions | undefined;
|
|
66
|
+
const dialogOptions = this._prepareDialogOptions(modalItem.type, modalItem.dialogOptions);
|
|
67
|
+
const type = options?.type ?? 'info';
|
|
68
|
+
const iconName = options?.icon ?? this.scope.config.model.alert.icons[type];
|
|
69
|
+
const title = options?.title ?? this.sys.env.APP_TITLE ?? '';
|
|
70
|
+
const text = options?.text;
|
|
71
|
+
return this._renderDialogBase({
|
|
72
|
+
modalItem,
|
|
73
|
+
dialogOptions,
|
|
74
|
+
iconName,
|
|
75
|
+
title,
|
|
76
|
+
body: text ? <p class="whitespace-pre-wrap leading-6">{text}</p> : undefined,
|
|
77
|
+
actions: (
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
class={this._getButtonClass(type, true)}
|
|
81
|
+
onClick={() => {
|
|
82
|
+
this.$appModal.close(modalItem.id);
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{this.scope.locale.Close()}
|
|
86
|
+
</button>
|
|
87
|
+
),
|
|
88
|
+
onClose: () => {
|
|
89
|
+
this.$appModal.close(modalItem.id);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private _renderAppModalConfirm(modalItem: IModalItem) {
|
|
95
|
+
const options = modalItem.options as IModalConfirmOptionsInner | undefined;
|
|
96
|
+
const dialogOptions = this._prepareDialogOptions(modalItem.type, modalItem.dialogOptions);
|
|
97
|
+
const iconName = options?.icon ?? this.scope.config.model.confirm.icons.confirm;
|
|
98
|
+
const title = options?.title ?? this.sys.env.APP_TITLE ?? '';
|
|
99
|
+
const text = options?.text;
|
|
100
|
+
return this._renderDialogBase({
|
|
101
|
+
modalItem,
|
|
102
|
+
dialogOptions,
|
|
103
|
+
iconName,
|
|
104
|
+
title,
|
|
105
|
+
body: text ? <p class="whitespace-pre-wrap leading-6">{text}</p> : undefined,
|
|
106
|
+
actions: (
|
|
107
|
+
<>
|
|
108
|
+
<button
|
|
109
|
+
type="button"
|
|
110
|
+
class="btn btn-ghost"
|
|
111
|
+
onClick={() => {
|
|
112
|
+
this.$appModal.close(modalItem.id);
|
|
113
|
+
options?.onCallback?.(false);
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{this.scope.locale.No()}
|
|
117
|
+
</button>
|
|
118
|
+
<button
|
|
119
|
+
type="button"
|
|
120
|
+
class="btn btn-primary"
|
|
121
|
+
onClick={() => {
|
|
122
|
+
this.$appModal.close(modalItem.id);
|
|
123
|
+
options?.onCallback?.(true);
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
{this.scope.locale.Yes()}
|
|
127
|
+
</button>
|
|
128
|
+
</>
|
|
129
|
+
),
|
|
130
|
+
onClose: () => {
|
|
131
|
+
this.$appModal.close(modalItem.id);
|
|
132
|
+
options?.onCallback?.(false);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private _renderAppModalPrompt(modalItem: IModalItem) {
|
|
138
|
+
const options = modalItem.options as IModalPromptOptionsInner | undefined;
|
|
139
|
+
const dialogOptions = this._prepareDialogOptions(modalItem.type, modalItem.dialogOptions);
|
|
140
|
+
const iconName = options?.icon ?? this.scope.config.model.prompt.icons.prompt;
|
|
141
|
+
const title = options?.title ?? this.sys.env.APP_TITLE ?? '';
|
|
142
|
+
const text = options?.text;
|
|
143
|
+
return this._renderDialogBase({
|
|
144
|
+
modalItem,
|
|
145
|
+
dialogOptions,
|
|
146
|
+
iconName,
|
|
147
|
+
title,
|
|
148
|
+
body: (
|
|
149
|
+
<fieldset class="fieldset gap-3">
|
|
150
|
+
{!!text && <legend class="fieldset-legend text-base-content/80">{text}</legend>}
|
|
151
|
+
<input
|
|
152
|
+
class="input input-bordered w-full"
|
|
153
|
+
type="text"
|
|
154
|
+
autofocus={true}
|
|
155
|
+
value={options?.defaultValue ?? ''}
|
|
156
|
+
onInput={event => {
|
|
157
|
+
options!.defaultValue = (event.target as HTMLInputElement).value;
|
|
158
|
+
}}
|
|
159
|
+
onKeydown={event => {
|
|
160
|
+
if (event.key === 'Enter') {
|
|
161
|
+
this.$appModal.close(modalItem.id);
|
|
162
|
+
options?.onCallback?.(options?.defaultValue ?? '');
|
|
163
|
+
}
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
</fieldset>
|
|
167
|
+
),
|
|
168
|
+
actions: (
|
|
169
|
+
<>
|
|
170
|
+
<button
|
|
171
|
+
type="button"
|
|
172
|
+
class="btn btn-ghost"
|
|
173
|
+
onClick={() => {
|
|
174
|
+
this.$appModal.close(modalItem.id);
|
|
175
|
+
options?.onCallback?.(undefined);
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
{this.scope.locale.Cancel()}
|
|
179
|
+
</button>
|
|
180
|
+
<button
|
|
181
|
+
type="button"
|
|
182
|
+
class="btn btn-primary"
|
|
183
|
+
onClick={() => {
|
|
184
|
+
this.$appModal.close(modalItem.id);
|
|
185
|
+
options?.onCallback?.(options?.defaultValue ?? '');
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
{this.scope.locale.Ok()}
|
|
189
|
+
</button>
|
|
190
|
+
</>
|
|
191
|
+
),
|
|
192
|
+
onClose: () => {
|
|
193
|
+
this.$appModal.close(modalItem.id);
|
|
194
|
+
options?.onCallback?.(undefined);
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private _renderDialogBase({
|
|
200
|
+
modalItem,
|
|
201
|
+
dialogOptions,
|
|
202
|
+
iconName,
|
|
203
|
+
title,
|
|
204
|
+
body,
|
|
205
|
+
actions,
|
|
206
|
+
onClose,
|
|
207
|
+
}: IRenderDialogBaseOptions) {
|
|
208
|
+
const style = this._dialogStyle(dialogOptions);
|
|
209
|
+
return (
|
|
210
|
+
<div key={modalItem.id} class="fixed inset-0 z-50 flex items-center justify-center p-4">
|
|
211
|
+
<div
|
|
212
|
+
class="absolute inset-0 bg-base-content/30"
|
|
213
|
+
onClick={() => {
|
|
214
|
+
if (dialogOptions.closeOnBackdrop) {
|
|
215
|
+
onClose();
|
|
216
|
+
}
|
|
217
|
+
}}
|
|
218
|
+
></div>
|
|
219
|
+
<div class="card bg-base-100 shadow-2xl relative w-full" style={style}>
|
|
220
|
+
<div class="card-body gap-4">
|
|
221
|
+
<div class="flex items-start gap-3">
|
|
222
|
+
{!!iconName && (
|
|
223
|
+
<ZIcon class="text-primary mt-1 shrink-0" name={iconName} width={24}></ZIcon>
|
|
224
|
+
)}
|
|
225
|
+
<div class="flex-1 min-w-0">
|
|
226
|
+
<h3 class="card-title">{title}</h3>
|
|
227
|
+
{!!body && <div class="mt-2">{body}</div>}
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
<div class="card-actions justify-end">{actions}</div>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private _prepareDialogOptions(type: ModalType, dialogOptions?: IModalDialogOptions) {
|
|
238
|
+
const defaults = this.scope.config.model[type].default;
|
|
239
|
+
return {
|
|
240
|
+
maxWidth: dialogOptions?.maxWidth ?? defaults.maxWidth,
|
|
241
|
+
closeOnBackdrop: dialogOptions?.closeOnBackdrop ?? defaults.closeOnBackdrop,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private _dialogStyle(dialogOptions: IModalDialogOptions) {
|
|
246
|
+
const maxWidth = dialogOptions.maxWidth;
|
|
247
|
+
if (!maxWidth) return undefined;
|
|
248
|
+
return {
|
|
249
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
private _getButtonClass(type: AlertType, primary?: boolean) {
|
|
254
|
+
if (!primary) return 'btn btn-ghost';
|
|
255
|
+
if (type === 'success') return 'btn btn-success';
|
|
256
|
+
if (type === 'warning') return 'btn btn-warning';
|
|
257
|
+
if (type === 'error') return 'btn btn-error';
|
|
258
|
+
return 'btn btn-primary';
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ZovaSys } from 'zova';
|
|
2
|
+
import type { IIconRecord } from 'zova-module-a-icon';
|
|
3
|
+
|
|
4
|
+
export const config = (_sys: ZovaSys) => {
|
|
5
|
+
return {
|
|
6
|
+
model: {
|
|
7
|
+
alert: {
|
|
8
|
+
icons: {
|
|
9
|
+
success: ':outline:check-circle-outline' as keyof IIconRecord,
|
|
10
|
+
info: ':outline:alert-outline' as keyof IIconRecord,
|
|
11
|
+
warning: ':outline:alert-outline' as keyof IIconRecord,
|
|
12
|
+
error: ':outline:alert-outline' as keyof IIconRecord,
|
|
13
|
+
},
|
|
14
|
+
default: {
|
|
15
|
+
maxWidth: 360,
|
|
16
|
+
closeOnBackdrop: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
confirm: {
|
|
20
|
+
icons: {
|
|
21
|
+
confirm: ':outline:alert-outline' as keyof IIconRecord,
|
|
22
|
+
},
|
|
23
|
+
default: {
|
|
24
|
+
maxWidth: 360,
|
|
25
|
+
closeOnBackdrop: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
prompt: {
|
|
29
|
+
icons: {
|
|
30
|
+
prompt: ':outline:alert-outline' as keyof IIconRecord,
|
|
31
|
+
},
|
|
32
|
+
default: {
|
|
33
|
+
maxWidth: 360,
|
|
34
|
+
closeOnBackdrop: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ServiceAppModal } from '../service/appModal.js';
|
|
2
|
+
import type { IModalItem } from '../types/appModal.js';
|
|
3
|
+
|
|
4
|
+
export class AppModalItem {
|
|
5
|
+
private serviceAppModal: ServiceAppModal;
|
|
6
|
+
private modalItem: IModalItem;
|
|
7
|
+
|
|
8
|
+
constructor(serviceAppModal: ServiceAppModal, modalItem: IModalItem) {
|
|
9
|
+
this.serviceAppModal = serviceAppModal;
|
|
10
|
+
this.modalItem = modalItem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public close() {
|
|
14
|
+
this.serviceAppModal.close(this.modalItem.id);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './appModalItem.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IModule } from '@cabloy/module-info';
|
|
2
|
+
import type { BeanBase, BeanContainer, IMonkeyBeanInit, IMonkeyModule } from 'zova';
|
|
3
|
+
|
|
4
|
+
import { BeanSimple } from 'zova';
|
|
5
|
+
|
|
6
|
+
import type { ServiceAppModal } from './service/appModal.js';
|
|
7
|
+
|
|
8
|
+
export class Monkey extends BeanSimple implements IMonkeyModule, IMonkeyBeanInit {
|
|
9
|
+
private _moduleSelf: IModule;
|
|
10
|
+
private _serviceAppModal: ServiceAppModal;
|
|
11
|
+
|
|
12
|
+
constructor(moduleSelf: IModule) {
|
|
13
|
+
super();
|
|
14
|
+
this._moduleSelf = moduleSelf;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async moduleLoading(_module: IModule) {}
|
|
18
|
+
async moduleLoaded(module: IModule) {
|
|
19
|
+
if (this._moduleSelf === module) {
|
|
20
|
+
await this._loadServiceAppModal();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async beanInit(bean: BeanContainer, beanInstance: BeanBase) {
|
|
25
|
+
const self = this;
|
|
26
|
+
bean.defineProperty(beanInstance, '$appModal', {
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true,
|
|
29
|
+
get() {
|
|
30
|
+
return self._serviceAppModal;
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private async _loadServiceAppModal() {
|
|
36
|
+
this._serviceAppModal = await this.app.bean._getBean('basic-app.service.appModal', true);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IMonkeySysInitialize } from 'zova';
|
|
2
|
+
import type { IBehaviorItem } from 'zova-module-a-behavior';
|
|
3
|
+
|
|
4
|
+
import { BeanSimple, deepExtend } from 'zova';
|
|
5
|
+
|
|
6
|
+
export class MonkeySys extends BeanSimple implements IMonkeySysInitialize {
|
|
7
|
+
async sysInitialize() {
|
|
8
|
+
const configCustom: IBehaviorItem = {
|
|
9
|
+
'basic-app:appModal': {},
|
|
10
|
+
};
|
|
11
|
+
const scopeAppConfig = this.sys.util.getModuleConfigSafe('a-app');
|
|
12
|
+
scopeAppConfig.behaviors = deepExtend({}, scopeAppConfig.behaviors, configCustom);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BeanBase } from 'zova';
|
|
2
|
+
import { Service } from 'zova-module-a-bean';
|
|
3
|
+
|
|
4
|
+
import { AppModalItem } from '../lib/appModalItem.js';
|
|
5
|
+
import {
|
|
6
|
+
IModalAlertOptions,
|
|
7
|
+
IModalConfirmOptions,
|
|
8
|
+
IModalDialogOptions,
|
|
9
|
+
IModalItem,
|
|
10
|
+
IModalPromptOptions,
|
|
11
|
+
} from '../types/appModal.js';
|
|
12
|
+
|
|
13
|
+
@Service()
|
|
14
|
+
export class ServiceAppModal extends BeanBase {
|
|
15
|
+
public modalItems: IModalItem[] = [];
|
|
16
|
+
private modalItemIdCounter: number = 0;
|
|
17
|
+
|
|
18
|
+
protected async __init__() {}
|
|
19
|
+
|
|
20
|
+
private newModalItemId() {
|
|
21
|
+
return ++this.modalItemIdCounter;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public alert(options?: IModalAlertOptions, dialogOptions?: IModalDialogOptions) {
|
|
25
|
+
const id = this.newModalItemId();
|
|
26
|
+
const modalItem: IModalItem = {
|
|
27
|
+
id,
|
|
28
|
+
type: 'alert',
|
|
29
|
+
options,
|
|
30
|
+
dialogOptions,
|
|
31
|
+
};
|
|
32
|
+
this.modalItems.push(modalItem);
|
|
33
|
+
return new AppModalItem(this, modalItem);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public confirm(
|
|
37
|
+
options?: IModalConfirmOptions,
|
|
38
|
+
dialogOptions?: IModalDialogOptions,
|
|
39
|
+
): Promise<boolean> {
|
|
40
|
+
return new Promise(resolve => {
|
|
41
|
+
const id = this.newModalItemId();
|
|
42
|
+
const modalItem: IModalItem = {
|
|
43
|
+
id,
|
|
44
|
+
type: 'confirm',
|
|
45
|
+
options: {
|
|
46
|
+
...options,
|
|
47
|
+
onCallback: (yes: boolean) => {
|
|
48
|
+
return resolve(yes);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
dialogOptions,
|
|
52
|
+
};
|
|
53
|
+
this.modalItems.push(modalItem);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public prompt(
|
|
58
|
+
options?: IModalPromptOptions,
|
|
59
|
+
dialogOptions?: IModalDialogOptions,
|
|
60
|
+
): Promise<string | undefined> {
|
|
61
|
+
return new Promise(resolve => {
|
|
62
|
+
const id = this.newModalItemId();
|
|
63
|
+
const modalItem: IModalItem = {
|
|
64
|
+
id,
|
|
65
|
+
type: 'prompt',
|
|
66
|
+
options: {
|
|
67
|
+
...options,
|
|
68
|
+
onCallback: (res: string | undefined) => {
|
|
69
|
+
return resolve(res);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
dialogOptions,
|
|
73
|
+
};
|
|
74
|
+
this.modalItems.push(modalItem);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public close(id: number) {
|
|
79
|
+
const [index] = this.findModalItem(id);
|
|
80
|
+
if (index === -1) return;
|
|
81
|
+
this.modalItems.splice(index, 1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected findModalItem(id: number): [number, IModalItem | undefined] {
|
|
85
|
+
const index = this.modalItems.findIndex(item => item.id === id);
|
|
86
|
+
if (index === -1) return [index, undefined];
|
|
87
|
+
return [index, this.modalItems[index]];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IIconRecord } from 'zova-module-a-icon';
|
|
2
|
+
|
|
3
|
+
import type { ServiceAppModal } from '../service/appModal.js';
|
|
4
|
+
|
|
5
|
+
export type ModalType = 'alert' | 'confirm' | 'prompt';
|
|
6
|
+
export type AlertType = 'success' | 'info' | 'warning' | 'error';
|
|
7
|
+
|
|
8
|
+
export interface IModalDialogOptions {
|
|
9
|
+
maxWidth?: number | string;
|
|
10
|
+
closeOnBackdrop?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IModalAlertOptions {
|
|
14
|
+
type?: AlertType;
|
|
15
|
+
icon?: keyof IIconRecord;
|
|
16
|
+
title?: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IModalConfirmOptions {
|
|
21
|
+
icon?: keyof IIconRecord;
|
|
22
|
+
title?: string;
|
|
23
|
+
text?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IModalConfirmOptionsInner extends IModalConfirmOptions {
|
|
27
|
+
onCallback?: (yes: boolean) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IModalPromptOptions {
|
|
31
|
+
icon?: keyof IIconRecord;
|
|
32
|
+
title?: string;
|
|
33
|
+
text?: string;
|
|
34
|
+
defaultValue?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IModalPromptOptionsInner extends IModalPromptOptions {
|
|
38
|
+
onCallback?: (res: string | undefined) => void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IModalItem {
|
|
42
|
+
id: number;
|
|
43
|
+
type: ModalType;
|
|
44
|
+
options?: IModalAlertOptions | IModalConfirmOptionsInner | IModalPromptOptionsInner;
|
|
45
|
+
dialogOptions?: IModalDialogOptions;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare module 'zova' {
|
|
49
|
+
export interface BeanBase {
|
|
50
|
+
$appModal: ServiceAppModal;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './appModal.js';
|