cabloy 5.1.62 → 5.1.64
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 +19 -0
- package/cabloy-docs/frontend/form-guide.md +10 -4
- package/cabloy-docs/frontend/table-cell-cookbook.md +4 -1
- package/package.json +1 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/pnpm-lock.yaml +78 -2
- package/vona/src/suite/a-training/modules/training-record/package.json +53 -0
- package/vona/src/suite/a-training/modules/training-record/src/.metadata/index.ts +198 -0
- package/vona/src/suite/a-training/modules/training-record/src/.metadata/locales.ts +18 -0
- package/vona/src/suite/a-training/modules/training-record/src/.metadata/this.ts +2 -0
- package/vona/src/suite/a-training/modules/training-record/src/bean/meta.index.ts +12 -0
- package/vona/src/suite/a-training/modules/training-record/src/bean/meta.version.ts +21 -0
- package/vona/src/suite/a-training/modules/training-record/src/config/locale/en-us.ts +7 -0
- package/vona/src/suite/a-training/modules/training-record/src/config/locale/zh-cn.ts +7 -0
- package/vona/src/suite/a-training/modules/training-record/src/entity/record.tsx +48 -0
- package/vona/src/suite/a-training/modules/training-record/src/index.ts +2 -0
- package/vona/src/suite/a-training/modules/training-record/src/model/record.ts +10 -0
- package/vona/src/suite/a-training/modules/training-record/tsconfig.build.json +11 -0
- package/vona/src/suite/a-training/modules/training-record/tsconfig.json +7 -0
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/index.ts +39 -3
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordBase.tsx +12 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordMutate.tsx +31 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordResItem.tsx +41 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordView.tsx +28 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +16 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +4 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +4 -1
- package/vona/src/suite/a-training/modules/training-student/src/model/student.ts +9 -2
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +1 -1
- package/vona/src/suite/a-training/package.json +1 -0
- package/vona/src/suite/a-training/tsconfig.json +3 -0
- 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/dto.ts +2 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoGet.ts +3 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoMutate.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/dto/dtoGet.ts +3 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/dto/dtoMutate.ts +2 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/modelGeneral.ts +3 -0
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateBlockPage/controller.tsx_ +6 -2
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateBlockPageEntry/controller.tsx_ +6 -2
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateFormActionRow/controller.tsx_ +6 -2
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateFormField/controller.tsx_ +2 -1
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateTableActionBulk/controller.tsx_ +6 -2
- package/zova/packages-cli/cli-set-front/cli/templates/rest/component.ts +22 -0
- package/zova/packages-cli/cli-set-front/cli/templates/rest/render.ts +4 -0
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +32 -2
- 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/package.json +6 -1
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionDeleteForce.tsx +13 -11
- package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionSummary.tsx +1 -1
- 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-details/package.json +52 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/actionCreate.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockDetails.ts +34 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockDetailsToolbarBulk.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/formFieldDetails.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/index.ts +116 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/locales.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/this.ts +2 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/actionCreate/controller.tsx +42 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockDetails/controller.tsx +114 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockDetailsToolbarBulk/controller.tsx +61 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/formFieldDetails/controller.tsx +105 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/en-us.ts +3 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/zh-cn.ts +3 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/index.ts +3 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/details.ts +8 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/tsconfig.build.json +13 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/tsconfig.json +5 -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-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 +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/action.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/details.ts +7 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/detailsActionBulk.ts +24 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/index.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/index.ts +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/permissions.ts +6 -0
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
package/zova/pnpm-lock.yaml
CHANGED
|
@@ -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
|
|
@@ -228,6 +231,9 @@ importers:
|
|
|
228
231
|
zova-module-basic-date:
|
|
229
232
|
specifier: workspace:^
|
|
230
233
|
version: link:src/suite/cabloy-basic/modules/basic-date
|
|
234
|
+
zova-module-basic-details:
|
|
235
|
+
specifier: workspace:^
|
|
236
|
+
version: link:src/suite/cabloy-basic/modules/basic-details
|
|
231
237
|
zova-module-basic-form:
|
|
232
238
|
specifier: workspace:^
|
|
233
239
|
version: link:src/suite/cabloy-basic/modules/basic-form
|
|
@@ -807,7 +813,7 @@ importers:
|
|
|
807
813
|
specifier: ^5.1.57
|
|
808
814
|
version: link:../zova-core
|
|
809
815
|
zova-suite-a-zova:
|
|
810
|
-
specifier: ^5.1.
|
|
816
|
+
specifier: ^5.1.103
|
|
811
817
|
version: link:../../src/suite-vendor/a-zova
|
|
812
818
|
devDependencies:
|
|
813
819
|
clean-package:
|
|
@@ -986,7 +992,7 @@ importers:
|
|
|
986
992
|
specifier: ^5.1.29
|
|
987
993
|
version: link:modules/a-style
|
|
988
994
|
zova-module-a-table:
|
|
989
|
-
specifier: ^5.1.
|
|
995
|
+
specifier: ^5.1.32
|
|
990
996
|
version: link:modules/a-table
|
|
991
997
|
zova-module-a-zod:
|
|
992
998
|
specifier: ^5.1.30
|
|
@@ -1550,6 +1556,9 @@ importers:
|
|
|
1550
1556
|
zova-module-basic-adapter:
|
|
1551
1557
|
specifier: ^5.0.5
|
|
1552
1558
|
version: link:modules/basic-adapter
|
|
1559
|
+
zova-module-basic-app:
|
|
1560
|
+
specifier: ^5.0.0
|
|
1561
|
+
version: link:modules/basic-app
|
|
1553
1562
|
zova-module-basic-captcha:
|
|
1554
1563
|
specifier: ^5.0.8
|
|
1555
1564
|
version: link:modules/basic-captcha
|
|
@@ -1565,6 +1574,9 @@ importers:
|
|
|
1565
1574
|
zova-module-basic-date:
|
|
1566
1575
|
specifier: ^5.0.6
|
|
1567
1576
|
version: link:modules/basic-date
|
|
1577
|
+
zova-module-basic-details:
|
|
1578
|
+
specifier: ^5.0.0
|
|
1579
|
+
version: link:modules/basic-details
|
|
1568
1580
|
zova-module-basic-form:
|
|
1569
1581
|
specifier: ^5.0.7
|
|
1570
1582
|
version: link:modules/basic-form
|
|
@@ -1599,6 +1611,15 @@ importers:
|
|
|
1599
1611
|
specifier: ^6.1.3
|
|
1600
1612
|
version: 6.1.3
|
|
1601
1613
|
|
|
1614
|
+
src/suite/cabloy-basic/modules/basic-app:
|
|
1615
|
+
devDependencies:
|
|
1616
|
+
clean-package:
|
|
1617
|
+
specifier: ^2.2.0
|
|
1618
|
+
version: 2.2.0
|
|
1619
|
+
rimraf:
|
|
1620
|
+
specifier: ^6.1.3
|
|
1621
|
+
version: 6.1.3
|
|
1622
|
+
|
|
1602
1623
|
src/suite/cabloy-basic/modules/basic-captcha:
|
|
1603
1624
|
devDependencies:
|
|
1604
1625
|
clean-package:
|
|
@@ -1648,6 +1669,15 @@ importers:
|
|
|
1648
1669
|
specifier: ^6.1.3
|
|
1649
1670
|
version: 6.1.3
|
|
1650
1671
|
|
|
1672
|
+
src/suite/cabloy-basic/modules/basic-details:
|
|
1673
|
+
devDependencies:
|
|
1674
|
+
clean-package:
|
|
1675
|
+
specifier: ^2.2.0
|
|
1676
|
+
version: 2.2.0
|
|
1677
|
+
rimraf:
|
|
1678
|
+
specifier: ^6.1.3
|
|
1679
|
+
version: 6.1.3
|
|
1680
|
+
|
|
1651
1681
|
src/suite/cabloy-basic/modules/basic-form:
|
|
1652
1682
|
devDependencies:
|
|
1653
1683
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionDeleteForce.tsx
CHANGED
|
@@ -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
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (!
|
|
39
|
-
const
|
|
40
|
-
|
|
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
|
}
|
package/zova/src/suite/a-training/modules/training-student/src/bean/tableCell.actionSummary.tsx
CHANGED
|
@@ -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,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
|
+
}
|