cabloy 5.1.62 → 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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cabloy-docs/frontend/form-guide.md +10 -4
  3. package/cabloy-docs/frontend/table-cell-cookbook.md +4 -1
  4. package/package.json +1 -1
  5. package/zova/pnpm-lock.yaml +17 -2
  6. package/zova/src/suite/a-demo/modules/demo-basic/src/page/toolOne/render.tsx +5 -3
  7. package/zova/src/suite/a-home/modules/home-login/src/page/login/render.tsx +5 -3
  8. package/zova/src/suite/a-training/modules/training-student/package.json +6 -1
  9. package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionDeleteForce.tsx +13 -11
  10. package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionSummary.tsx +1 -1
  11. package/zova/src/suite/cabloy-basic/modules/basic-app/package.json +60 -0
  12. package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/index.ts +137 -0
  13. package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/locales.ts +7 -0
  14. package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/this.ts +2 -0
  15. package/zova/src/suite/cabloy-basic/modules/basic-app/src/bean/behavior.appModal.tsx +260 -0
  16. package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/config.ts +39 -0
  17. package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/locale/en-us.ts +7 -0
  18. package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/locale/zh-cn.ts +7 -0
  19. package/zova/src/suite/cabloy-basic/modules/basic-app/src/index.ts +4 -0
  20. package/zova/src/suite/cabloy-basic/modules/basic-app/src/lib/appModalItem.ts +16 -0
  21. package/zova/src/suite/cabloy-basic/modules/basic-app/src/lib/index.ts +1 -0
  22. package/zova/src/suite/cabloy-basic/modules/basic-app/src/monkey.ts +38 -0
  23. package/zova/src/suite/cabloy-basic/modules/basic-app/src/monkeySys.ts +14 -0
  24. package/zova/src/suite/cabloy-basic/modules/basic-app/src/service/appModal.ts +89 -0
  25. package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/appModal.ts +52 -0
  26. package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/index.ts +1 -0
  27. package/zova/src/suite/cabloy-basic/modules/basic-app/tsconfig.build.json +13 -0
  28. package/zova/src/suite/cabloy-basic/modules/basic-app/tsconfig.json +5 -0
  29. package/zova/src/suite/cabloy-basic/modules/basic-commands/package.json +6 -1
  30. package/zova/src/suite/cabloy-basic/modules/basic-commands/src/.metadata/index.ts +16 -0
  31. package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.alert.tsx +8 -14
  32. package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.confirm.tsx +10 -7
  33. package/zova/src/suite/cabloy-basic/modules/basic-commands/src/bean/command.prompt.tsx +30 -0
  34. package/zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockForm/controller.tsx +5 -3
  35. package/zova/src/suite/cabloy-basic/modules/basic-table/package.json +6 -1
  36. package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionDelete.tsx +4 -2
  37. package/zova/src/suite/cabloy-basic/package.json +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.63
4
+
5
+ ### Features
6
+
7
+ - Add the `basic-app` modal module.
8
+ - Add update functionality.
9
+
10
+ ### Improvements
11
+
12
+ - Update the force-delete action modal flow.
13
+ - Unify modal command usage.
14
+ - Migrate remaining confirmation dialogs to `basic-app`.
15
+
3
16
  ## 5.1.62
4
17
 
5
18
  ### Features
@@ -276,8 +276,11 @@ Use `onShowError` when you want a centralized user-facing error handler.
276
276
 
277
277
  ```tsx
278
278
  <ZForm
279
- onShowError={({ error }) => {
280
- window.alert(error.message);
279
+ onShowError={async ({ error }) => {
280
+ await this.$performCommand('basic-commands:alert', {
281
+ type: 'error',
282
+ text: error.message,
283
+ });
281
284
  }}
282
285
  ></ZForm>
283
286
  ```
@@ -583,8 +586,11 @@ Once the Student model side is prepared, the render side can stay thin:
583
586
  formMeta={this.studentFormMeta}
584
587
  formProvider={this.studentFormProvider}
585
588
  onSubmitData={data => this.submitStudent(data)}
586
- onShowError={({ error }) => {
587
- window.alert(error.message);
589
+ onShowError={async ({ error }) => {
590
+ await this.$performCommand('basic-commands:alert', {
591
+ type: 'error',
592
+ text: error.message,
593
+ });
588
594
  }}
589
595
  ></ZForm>
590
596
  ```
@@ -310,7 +310,10 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
310
310
  class={options.class}
311
311
  type="button"
312
312
  onClick={async () => {
313
- if (!window.confirm(this.scope.locale.DeleteConfirm())) return;
313
+ const confirmed = await $host.$performCommand('basic-commands:confirm', {
314
+ text: this.scope.locale.DeleteConfirm(),
315
+ });
316
+ if (!confirmed) return;
314
317
  await $host.$performCommand('basic-commands:delete', options, renderContext);
315
318
  }}
316
319
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cabloy",
3
- "version": "5.1.62",
3
+ "version": "5.1.63",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "A Node.js fullstack framework",
6
6
  "keywords": [
@@ -213,6 +213,9 @@ importers:
213
213
  zova-module-basic-adapter:
214
214
  specifier: workspace:^
215
215
  version: link:src/suite/cabloy-basic/modules/basic-adapter
216
+ zova-module-basic-app:
217
+ specifier: workspace:^
218
+ version: link:src/suite/cabloy-basic/modules/basic-app
216
219
  zova-module-basic-captcha:
217
220
  specifier: workspace:^
218
221
  version: link:src/suite/cabloy-basic/modules/basic-captcha
@@ -807,7 +810,7 @@ importers:
807
810
  specifier: ^5.1.57
808
811
  version: link:../zova-core
809
812
  zova-suite-a-zova:
810
- specifier: ^5.1.102
813
+ specifier: ^5.1.103
811
814
  version: link:../../src/suite-vendor/a-zova
812
815
  devDependencies:
813
816
  clean-package:
@@ -986,7 +989,7 @@ importers:
986
989
  specifier: ^5.1.29
987
990
  version: link:modules/a-style
988
991
  zova-module-a-table:
989
- specifier: ^5.1.31
992
+ specifier: ^5.1.32
990
993
  version: link:modules/a-table
991
994
  zova-module-a-zod:
992
995
  specifier: ^5.1.30
@@ -1550,6 +1553,9 @@ importers:
1550
1553
  zova-module-basic-adapter:
1551
1554
  specifier: ^5.0.5
1552
1555
  version: link:modules/basic-adapter
1556
+ zova-module-basic-app:
1557
+ specifier: ^5.0.0
1558
+ version: link:modules/basic-app
1553
1559
  zova-module-basic-captcha:
1554
1560
  specifier: ^5.0.8
1555
1561
  version: link:modules/basic-captcha
@@ -1599,6 +1605,15 @@ importers:
1599
1605
  specifier: ^6.1.3
1600
1606
  version: 6.1.3
1601
1607
 
1608
+ src/suite/cabloy-basic/modules/basic-app:
1609
+ devDependencies:
1610
+ clean-package:
1611
+ specifier: ^2.2.0
1612
+ version: 2.2.0
1613
+ rimraf:
1614
+ specifier: ^6.1.3
1615
+ version: 6.1.3
1616
+
1602
1617
  src/suite/cabloy-basic/modules/basic-captcha:
1603
1618
  devDependencies:
1604
1619
  clean-package:
@@ -17,9 +17,11 @@ export class RenderPageToolOne extends BeanRenderBase {
17
17
  schema={this.schemaUpdate}
18
18
  formMeta={this.formMeta}
19
19
  onSubmitData={data => this.submitData(data)}
20
- onShowError={({ error }) => {
21
- // eslint-disable-next-line no-alert
22
- window.alert(error.message);
20
+ onShowError={async ({ error }) => {
21
+ await this.$performCommand('basic-commands:alert', {
22
+ type: 'error',
23
+ text: error.message,
24
+ });
23
25
  }}
24
26
  slotFooter={$$form => {
25
27
  return (
@@ -45,9 +45,11 @@ export class RenderPageLogin extends BeanRenderBase {
45
45
  onSubmitData={data => {
46
46
  return this.submitLogin(data);
47
47
  }}
48
- onShowError={({ error }) => {
49
- // eslint-disable-next-line no-alert
50
- window.alert(error.message);
48
+ onShowError={async ({ error }) => {
49
+ await this.$performCommand('basic-commands:alert', {
50
+ type: 'error',
51
+ text: error.message,
52
+ });
51
53
  }}
52
54
  >
53
55
  <ZFormFieldPreset
@@ -48,5 +48,10 @@
48
48
  "exports.\\..import"
49
49
  ]
50
50
  },
51
- "title": "training-student"
51
+ "title": "training-student",
52
+ "zovaModule": {
53
+ "dependencies": {
54
+ "basic-app": "5.0.0"
55
+ }
56
+ }
52
57
  }
@@ -5,6 +5,7 @@ import type {
5
5
  NextTableCellRender,
6
6
  } from 'zova-module-a-table';
7
7
 
8
+ import { TableIdentity } from 'table-identity';
8
9
  import { BeanBase } from 'zova';
9
10
  import { TableCell } from 'zova-module-a-table';
10
11
 
@@ -27,25 +28,26 @@ export class TableCellActionDeleteForce extends BeanBase implements ITableCellRe
27
28
  renderContext: IJsxRenderContextTableCell,
28
29
  _next: NextTableCellRender,
29
30
  ) {
31
+ const { $host, cellContext, ctx } = renderContext;
30
32
  return (
31
33
  <button
32
34
  class={options.class}
33
35
  type="button"
34
- onClick={async e => {
35
- e.preventDefault();
36
- e.stopPropagation();
37
- // eslint-disable-next-line no-alert
38
- if (!window.confirm(this.scope.locale.ForceDeleteConfirm())) return;
39
- const modelStudent = await this._getModelStudent();
40
- await modelStudent.deleteForce(renderContext.cellContext.row.id).mutateAsync();
36
+ onClick={async () => {
37
+ const confirmed = await $host.$performCommand('basic-commands:confirm', {
38
+ text: this.scope.locale.ForceDeleteConfirm(),
39
+ });
40
+ if (!confirmed) return;
41
+ const id = cellContext.row.id as TableIdentity;
42
+ const modelStudent = (await ctx.bean._getBean(
43
+ 'training-student.model.student',
44
+ true,
45
+ )) as ModelStudent;
46
+ await modelStudent.deleteForce(id).mutateAsync();
41
47
  }}
42
48
  >
43
49
  {this.scope.locale.ForceDelete()}
44
50
  </button>
45
51
  );
46
52
  }
47
-
48
- private async _getModelStudent() {
49
- return (await this.bean._getBean('training-student.model.student', true)) as ModelStudent;
50
- }
51
53
  }
@@ -46,7 +46,7 @@ export class TableCellActionSummary extends BeanBase implements ITableCellRender
46
46
  `${this.scope.locale.Level()}: ${summary?.level ?? '-'}`,
47
47
  `${this.scope.locale.Description()}: ${summary?.description ?? '-'}`,
48
48
  ].join('\n');
49
- await $host.$performCommand('basic-commands:alert', { message }, renderContext);
49
+ await $host.$performCommand('basic-commands:alert', { text: message }, renderContext);
50
50
  }}
51
51
  >
52
52
  {this.scope.locale.Summary()}
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "zova-module-basic-app",
3
+ "version": "5.0.0",
4
+ "description": "",
5
+ "keywords": [
6
+ "Zova Module"
7
+ ],
8
+ "author": "",
9
+ "files": [
10
+ "mock",
11
+ "dist",
12
+ "src",
13
+ "icons",
14
+ "assets"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "types": [
20
+ "./src/index.ts",
21
+ "./dist/index.d.ts"
22
+ ],
23
+ "import": "./src/index.ts",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./*": "./*"
27
+ },
28
+ "scripts": {
29
+ "clean": "rimraf dist tsconfig.build.tsbuildinfo",
30
+ "tsc:publish": "npm run clean && node ../../../../../packages-cli/cli/src/bin/zova.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
31
+ "prepublishOnly": "npm run tsc:publish",
32
+ "prepack": "clean-package",
33
+ "postpack": "clean-package restore && npm run clean"
34
+ },
35
+ "dependencies": {},
36
+ "devDependencies": {
37
+ "clean-package": "^2.2.0",
38
+ "rimraf": "^6.1.3"
39
+ },
40
+ "clean-package": {
41
+ "indent": 2,
42
+ "replace": {
43
+ "exports.\\..types": "./dist/index.d.ts"
44
+ },
45
+ "remove": [
46
+ "clean-package",
47
+ "devDependencies",
48
+ "exports.\\..import"
49
+ ]
50
+ },
51
+ "title": "basic-app",
52
+ "zovaModule": {
53
+ "capabilities": {
54
+ "monkey": true
55
+ },
56
+ "dependencies": {
57
+ "a-zova": "5.0.0"
58
+ }
59
+ }
60
+ }
@@ -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,7 @@
1
+ import locale_en_us from '../config/locale/en-us.js';
2
+ import locale_zh_cn from '../config/locale/zh-cn.js';
3
+
4
+ export const locales = {
5
+ 'en-us': locale_en_us,
6
+ 'zh-cn': locale_zh_cn,
7
+ };
@@ -0,0 +1,2 @@
1
+ export const __ThisModule__ = 'basic-app';
2
+ export { ScopeModuleBasicApp as ScopeModule } from './index.js';
@@ -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,7 @@
1
+ export default {
2
+ Close: 'Close',
3
+ Yes: 'Yes',
4
+ No: 'No',
5
+ Cancel: 'Cancel',
6
+ Ok: 'Ok',
7
+ };
@@ -0,0 +1,7 @@
1
+ export default {
2
+ Close: '关闭',
3
+ Yes: '是',
4
+ No: '否',
5
+ Cancel: '取消',
6
+ Ok: '确认',
7
+ };
@@ -0,0 +1,4 @@
1
+ export * from './.metadata/index.js';
2
+ export * from './.metadata/locales.js';
3
+ export * from './lib/index.js';
4
+ export * from './types/index.js';
@@ -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';
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig.base",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true,
9
+ "allowImportingTsExtensions": true,
10
+ "noEmit": false
11
+ },
12
+ "include": ["src", "src/.metadata/**/*"]
13
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../tsconfig.base",
3
+ "compilerOptions": {},
4
+ "include": ["src", "src/.metadata/**/*"]
5
+ }
@@ -48,5 +48,10 @@
48
48
  "exports.\\..import"
49
49
  ]
50
50
  },
51
- "title": "basic-commands"
51
+ "title": "basic-commands",
52
+ "zovaModule": {
53
+ "dependencies": {
54
+ "basic-app": "5.0.0"
55
+ }
56
+ }
52
57
  }
@@ -6,6 +6,7 @@ export * from '../bean/command.copy.jsx';
6
6
  export * from '../bean/command.create.jsx';
7
7
  export * from '../bean/command.delete.jsx';
8
8
  export * from '../bean/command.edit.jsx';
9
+ export * from '../bean/command.prompt.jsx';
9
10
  export * from '../bean/command.setValue.jsx';
10
11
  export * from '../bean/command.view.jsx';
11
12
  import { ICommandOptionsAlert } from '../bean/command.alert.jsx';
@@ -14,6 +15,7 @@ import { ICommandOptionsCopy } from '../bean/command.copy.jsx';
14
15
  import { ICommandOptionsCreate } from '../bean/command.create.jsx';
15
16
  import { ICommandOptionsDelete } from '../bean/command.delete.jsx';
16
17
  import { ICommandOptionsEdit } from '../bean/command.edit.jsx';
18
+ import { ICommandOptionsPrompt } from '../bean/command.prompt.jsx';
17
19
  import { ICommandOptionsSetValue } from '../bean/command.setValue.jsx';
18
20
  import { ICommandOptionsView } from '../bean/command.view.jsx';
19
21
  import 'zova-module-a-command';
@@ -26,6 +28,7 @@ declare module 'zova-module-a-command' {
26
28
  'basic-commands:create': ICommandOptionsCreate;
27
29
  'basic-commands:delete': ICommandOptionsDelete;
28
30
  'basic-commands:edit': ICommandOptionsEdit;
31
+ 'basic-commands:prompt': ICommandOptionsPrompt;
29
32
  'basic-commands:setValue': ICommandOptionsSetValue;
30
33
  'basic-commands:view': ICommandOptionsView;
31
34
  }
@@ -100,6 +103,17 @@ declare module 'zova-module-basic-commands' {
100
103
  get $onionOptions(): ICommandOptionsEdit;
101
104
  }
102
105
 
106
+ export interface CommandPrompt {
107
+ /** @internal */
108
+ get scope(): ScopeModuleBasicCommands;
109
+ }
110
+
111
+ export interface CommandPrompt {
112
+ get $beanFullName(): 'basic-commands.command.prompt';
113
+ get $onionName(): 'basic-commands:prompt';
114
+ get $onionOptions(): ICommandOptionsPrompt;
115
+ }
116
+
103
117
  export interface CommandSetValue {
104
118
  /** @internal */
105
119
  get scope(): ScopeModuleBasicCommands;
@@ -130,6 +144,7 @@ import { CommandCopy } from '../bean/command.copy.jsx';
130
144
  import { CommandCreate } from '../bean/command.create.jsx';
131
145
  import { CommandDelete } from '../bean/command.delete.jsx';
132
146
  import { CommandEdit } from '../bean/command.edit.jsx';
147
+ import { CommandPrompt } from '../bean/command.prompt.jsx';
133
148
  import { CommandSetValue } from '../bean/command.setValue.jsx';
134
149
  import { CommandView } from '../bean/command.view.jsx';
135
150
  import 'zova';
@@ -141,6 +156,7 @@ declare module 'zova' {
141
156
  'basic-commands.command.create': CommandCreate;
142
157
  'basic-commands.command.delete': CommandDelete;
143
158
  'basic-commands.command.edit': CommandEdit;
159
+ 'basic-commands.command.prompt': CommandPrompt;
144
160
  'basic-commands.command.setValue': CommandSetValue;
145
161
  'basic-commands.command.view': CommandView;
146
162
  }
@@ -1,33 +1,27 @@
1
1
  import type { ICommandExecute, ICommandOptionsBase } from 'zova-module-a-command';
2
2
  import type { NextCommandExecute } from 'zova-module-a-command';
3
3
  import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
4
+ import type { IModalAlertOptions, IModalDialogOptions } from 'zova-module-basic-app';
4
5
 
5
6
  import { BeanBase } from 'zova';
6
7
  import { Command } from 'zova-module-a-command';
7
8
 
8
9
  export type TypeCommandAlertResult = unknown;
9
10
 
10
- export interface ICommandOptionsAlert extends ICommandOptionsBase<TypeCommandAlertResult> {
11
- message: string;
12
- wait?: boolean;
11
+ export interface ICommandOptionsAlert
12
+ extends ICommandOptionsBase<TypeCommandAlertResult>, IModalAlertOptions {
13
+ dialogOptions?: IModalDialogOptions;
13
14
  }
14
15
 
15
- @Command<ICommandOptionsAlert>({ wait: true })
16
+ @Command<ICommandOptionsAlert>()
16
17
  export class CommandAlert extends BeanBase implements ICommandExecute {
17
18
  execute(
18
19
  options: ICommandOptionsAlert,
19
- _renderContext: IJsxRenderContextBase,
20
+ renderContext: IJsxRenderContextBase,
20
21
  next: NextCommandExecute,
21
22
  ) {
22
- if (options.wait) {
23
- // eslint-disable-next-line no-alert
24
- window.alert(options.message);
25
- } else {
26
- setTimeout(() => {
27
- // eslint-disable-next-line no-alert
28
- window.alert(options.message);
29
- }, 0);
30
- }
23
+ const { $host } = renderContext;
24
+ $host.$appModal.alert(options, options.dialogOptions);
31
25
  return next();
32
26
  }
33
27
  }
@@ -1,3 +1,5 @@
1
+ import type { IModalConfirmOptions, IModalDialogOptions } from 'zova-module-basic-app';
2
+
1
3
  import { BeanBase } from 'zova';
2
4
  import {
3
5
  Command,
@@ -7,21 +9,22 @@ import {
7
9
  } from 'zova-module-a-command';
8
10
  import { IJsxRenderContextBase } from 'zova-module-a-openapi';
9
11
 
10
- export type TypeCommandConfirmResult = boolean;
12
+ export type TypeCommandConfirmResult = Promise<boolean>;
11
13
 
12
- export interface ICommandOptionsConfirm extends ICommandOptionsBase<TypeCommandConfirmResult> {
13
- message: string;
14
+ export interface ICommandOptionsConfirm
15
+ extends ICommandOptionsBase<TypeCommandConfirmResult>, IModalConfirmOptions {
16
+ dialogOptions?: IModalDialogOptions;
14
17
  }
15
18
 
16
19
  @Command<ICommandOptionsConfirm>()
17
20
  export class CommandConfirm extends BeanBase implements ICommandExecute {
18
- execute(
21
+ async execute(
19
22
  options: ICommandOptionsConfirm,
20
- _renderContext: IJsxRenderContextBase,
23
+ renderContext: IJsxRenderContextBase,
21
24
  next: NextCommandExecute,
22
25
  ) {
23
- // eslint-disable-next-line no-alert
24
- const res = window.confirm(options.message);
26
+ const { $host } = renderContext;
27
+ const res = await $host.$appModal.confirm(options, options.dialogOptions);
25
28
  return next(res);
26
29
  }
27
30
  }
@@ -0,0 +1,30 @@
1
+ import type {
2
+ ICommandExecute,
3
+ ICommandOptionsBase,
4
+ NextCommandExecute,
5
+ } from 'zova-module-a-command';
6
+ import type { IJsxRenderContextBase } from 'zova-module-a-openapi';
7
+ import type { IModalDialogOptions, IModalPromptOptions } from 'zova-module-basic-app';
8
+
9
+ import { BeanBase } from 'zova';
10
+ import { Command } from 'zova-module-a-command';
11
+
12
+ export type TypeCommandPromptResult = unknown;
13
+
14
+ export interface ICommandOptionsPrompt
15
+ extends ICommandOptionsBase<TypeCommandPromptResult>, IModalPromptOptions {
16
+ dialogOptions?: IModalDialogOptions;
17
+ }
18
+
19
+ @Command<ICommandOptionsPrompt>()
20
+ export class CommandPrompt extends BeanBase implements ICommandExecute {
21
+ async execute(
22
+ options: ICommandOptionsPrompt,
23
+ renderContext: IJsxRenderContextBase,
24
+ next: NextCommandExecute,
25
+ ) {
26
+ const { $host } = renderContext;
27
+ const res = await $host.$appModal.prompt(options, options.dialogOptions);
28
+ return next(res);
29
+ }
30
+ }
@@ -42,9 +42,11 @@ export class ControllerBlockForm extends BeanControllerBase {
42
42
  formProvider={$$pageEntry.formProvider}
43
43
  formScope={$$pageEntry.jsxCelScope}
44
44
  onSubmitData={data => $$pageEntry.submitData(data)}
45
- onShowError={({ error }) => {
46
- // eslint-disable-next-line no-alert
47
- window.alert(error.message);
45
+ onShowError={async ({ error }) => {
46
+ await this.$performCommand('basic-commands:alert', {
47
+ type: 'error',
48
+ text: error.message,
49
+ });
48
50
  }}
49
51
  onChanged={data => {
50
52
  $$pageEntry.setPageMeta(data, true);
@@ -48,5 +48,10 @@
48
48
  "exports.\\..import"
49
49
  ]
50
50
  },
51
- "title": "basic-table"
51
+ "title": "basic-table",
52
+ "zovaModule": {
53
+ "dependencies": {
54
+ "basic-app": "5.0.0"
55
+ }
56
+ }
52
57
  }
@@ -32,8 +32,10 @@ export class TableCellActionDelete extends BeanBase implements ITableCellRender
32
32
  class={options.class}
33
33
  type="button"
34
34
  onClick={async () => {
35
- // eslint-disable-next-line no-alert
36
- if (!window.confirm(this.scope.locale.DeleteConfirm())) return;
35
+ const confirmed = await $host.$performCommand('basic-commands:confirm', {
36
+ text: this.scope.locale.DeleteConfirm(),
37
+ });
38
+ if (!confirmed) return;
37
39
  await $host.$performCommand('basic-commands:delete', options, renderContext);
38
40
  }}
39
41
  >
@@ -8,6 +8,7 @@
8
8
  "type": "module",
9
9
  "dependencies": {
10
10
  "zova-module-basic-adapter": "^5.0.5",
11
+ "zova-module-basic-app": "^5.0.0",
11
12
  "zova-module-basic-captcha": "^5.0.8",
12
13
  "zova-module-basic-commands": "^5.1.15",
13
14
  "zova-module-basic-commandssync": "^5.0.5",