cabloy 5.1.72 → 5.1.73

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 (26) hide show
  1. package/.claude/skills/cabloy-backend-scaffold/SKILL.md +3 -1
  2. package/.claude/skills/cabloy-master-detail/SKILL.md +198 -0
  3. package/.claude/skills/cabloy-workflow/SKILL.md +3 -1
  4. package/CHANGELOG.md +21 -0
  5. package/cabloy-docs/.vitepress/config.mjs +5 -0
  6. package/cabloy-docs/backend/dto-guide.md +1 -1
  7. package/cabloy-docs/backend/dto-infer-generation.md +38 -0
  8. package/cabloy-docs/backend/master-detail-source-reading-map.md +260 -0
  9. package/cabloy-docs/backend/master-detail-workflow.md +174 -23
  10. package/cabloy-docs/backend/relations-guide.md +4 -0
  11. package/package.json +2 -2
  12. package/vona/packages-cli/cli/package.json +1 -1
  13. package/vona/packages-cli/cli-set-api/package.json +1 -1
  14. package/vona/packages-cli/cli-set-api/src/lib/bean/cli.bin.dev.ts +1 -0
  15. package/vona/patches/zova-core@5.1.61.patch +57 -0
  16. package/vona/pnpm-lock.yaml +135 -265
  17. package/vona/pnpm-workspace.yaml +3 -0
  18. package/vona/src/suite/a-training/modules/training-record/src/dto/recordCreate.tsx +1 -1
  19. package/vona/src/suite/a-training/modules/training-record/src/dto/recordUpdate.tsx +1 -1
  20. package/vona/src/suite/a-training/modules/training-record/src/entity/record.tsx +2 -52
  21. package/vona/src/suite/a-training/modules/training-record/src/index.ts +1 -0
  22. package/vona/src/suite/a-training/modules/training-record/src/lib/index.ts +2 -0
  23. package/vona/src/suite/a-training/modules/training-record/src/lib/onEffectForAverageScore.tsx +29 -0
  24. package/vona/src/suite/a-training/modules/training-record/src/lib/onEffectForTrainingRecordSubjects.tsx +26 -0
  25. package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordBase.tsx +2 -1
  26. package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.tabs.tsx +2 -2
@@ -49,3 +49,6 @@ allowBuilds:
49
49
  esbuild: true
50
50
  msgpackr-extract: true
51
51
  vue-demi: true
52
+
53
+ patchedDependencies:
54
+ zova-core@5.1.61: patches/zova-core@5.1.61.patch
@@ -6,7 +6,7 @@ import { Dto } from 'vona-module-a-web';
6
6
  import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
7
7
 
8
8
  import { $locale } from '../.metadata/locales.ts';
9
- import { onEffectForTrainingRecordSubjects } from '../entity/record.tsx';
9
+ import { onEffectForTrainingRecordSubjects } from '../lib/onEffectForTrainingRecordSubjects.tsx';
10
10
  import { ModelRecord } from '../model/record.ts';
11
11
  import { DtoDetailRecordSubjectMutate } from './detailRecordSubjectMutate.tsx';
12
12
  import { DtoDetailRecordSubjectResItem } from './detailRecordSubjectResItem.tsx';
@@ -6,7 +6,7 @@ import { Dto } from 'vona-module-a-web';
6
6
  import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
7
7
 
8
8
  import { $locale } from '../.metadata/locales.ts';
9
- import { onEffectForTrainingRecordSubjects } from '../entity/record.tsx';
9
+ import { onEffectForTrainingRecordSubjects } from '../lib/onEffectForTrainingRecordSubjects.tsx';
10
10
  import { ModelRecord } from '../model/record.ts';
11
11
  import { DtoDetailRecordSubjectMutate } from './detailRecordSubjectMutate.tsx';
12
12
  import { DtoDetailRecordSubjectResItem } from './detailRecordSubjectResItem.tsx';
@@ -1,66 +1,16 @@
1
1
  import type { TableIdentity } from 'table-identity';
2
2
  import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
3
3
 
4
- import { cel } from '@cabloy/utils';
5
- import React from 'react';
6
4
  import { $makeMetadata, $resourceName, Api, v } from 'vona-module-a-openapiutils';
7
5
  import { Entity, EntityBase } from 'vona-module-a-orm';
8
6
  import z from 'zod';
9
- import { ZovaCommand, ZovaEvent, ZovaRender } from 'zova-rest-cabloy-basic-admin';
7
+ import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
10
8
 
11
9
  import { $locale } from '../.metadata/locales.ts';
10
+ import { onEffectForAverageScore } from '../lib/onEffectForAverageScore.tsx';
12
11
 
13
12
  export interface IEntityOptionsRecord extends IDecoratorEntityOptions {}
14
13
 
15
- export const onEffectForTrainingRecordSubjects = (
16
- <ZovaEvent>
17
- <ZovaCommand
18
- name="basic-commands:setValue"
19
- options={{
20
- name: 'subjectCount',
21
- value: cel(
22
- 'int(getValue("trainingRecordSubjects",[]).filter(item, get(item, "deleted")!=true).size())',
23
- ),
24
- }}
25
- ></ZovaCommand>
26
- <ZovaCommand
27
- name="basic-commands:setValue"
28
- options={{
29
- name: 'totalScore',
30
- value: cel(
31
- 'sum(getValue("trainingRecordSubjects",[]).filter(item, get(item, "deleted")!=true).map(item, int(get(item, "score")==null ? 0 : get(item, "score"))))',
32
- ),
33
- }}
34
- ></ZovaCommand>
35
- </ZovaEvent>
36
- );
37
-
38
- const onEffectForAverageScore = (
39
- <ZovaEvent>
40
- <ZovaCommand
41
- name="basic-commandssync:expr"
42
- res="subjectCount"
43
- options={{
44
- expression: cel('int(getValue("subjectCount",0))'),
45
- }}
46
- ></ZovaCommand>
47
- <ZovaCommand
48
- name="basic-commandssync:expr"
49
- res="totalScore"
50
- options={{
51
- expression: cel('int(getValue("totalScore",0))'),
52
- }}
53
- ></ZovaCommand>
54
- <ZovaCommand
55
- name="basic-commands:setValue"
56
- options={{
57
- name: 'averageScore',
58
- value: cel('subjectCount==0 ? "" : toFixed(double(totalScore) / double(subjectCount), 2)'),
59
- }}
60
- ></ZovaCommand>
61
- </ZovaEvent>
62
- );
63
-
64
14
  @Entity<IEntityOptionsRecord>('trainingRecord', {
65
15
  openapi: { title: $locale('TrainingRecord') },
66
16
  fields: {
@@ -1,2 +1,3 @@
1
+ export * from './lib/index.ts';
1
2
  export * from './.metadata/locales.ts';
2
3
  export * from './.metadata/index.ts';
@@ -0,0 +1,2 @@
1
+ export * from './onEffectForAverageScore.tsx';
2
+ export * from './onEffectForTrainingRecordSubjects.tsx';
@@ -0,0 +1,29 @@
1
+ import { cel } from '@cabloy/utils';
2
+ import React from 'react';
3
+ import { ZovaCommand, ZovaEvent } from 'zova-rest-cabloy-basic-admin';
4
+
5
+ export const onEffectForAverageScore = (
6
+ <ZovaEvent>
7
+ <ZovaCommand
8
+ name="basic-commandssync:expr"
9
+ res="subjectCount"
10
+ options={{
11
+ expression: cel('int(getValue("subjectCount",0))'),
12
+ }}
13
+ ></ZovaCommand>
14
+ <ZovaCommand
15
+ name="basic-commandssync:expr"
16
+ res="totalScore"
17
+ options={{
18
+ expression: cel('int(getValue("totalScore",0))'),
19
+ }}
20
+ ></ZovaCommand>
21
+ <ZovaCommand
22
+ name="basic-commands:setValue"
23
+ options={{
24
+ name: 'averageScore',
25
+ value: cel('subjectCount==0 ? "" : toFixed(double(totalScore) / double(subjectCount), 2)'),
26
+ }}
27
+ ></ZovaCommand>
28
+ </ZovaEvent>
29
+ );
@@ -0,0 +1,26 @@
1
+ import { cel } from '@cabloy/utils';
2
+ import React from 'react';
3
+ import { ZovaCommand, ZovaEvent } from 'zova-rest-cabloy-basic-admin';
4
+
5
+ export const onEffectForTrainingRecordSubjects = (
6
+ <ZovaEvent>
7
+ <ZovaCommand
8
+ name="basic-commands:setValue"
9
+ options={{
10
+ name: 'subjectCount',
11
+ value: cel(
12
+ 'int(getValue("trainingRecordSubjects",[]).filter(item, get(item, "deleted")!=true).size())',
13
+ ),
14
+ }}
15
+ ></ZovaCommand>
16
+ <ZovaCommand
17
+ name="basic-commands:setValue"
18
+ options={{
19
+ name: 'totalScore',
20
+ value: cel(
21
+ 'sum(getValue("trainingRecordSubjects",[]).filter(item, get(item, "deleted")!=true).map(item, int(get(item, "score", 0))))',
22
+ ),
23
+ }}
24
+ ></ZovaCommand>
25
+ </ZovaEvent>
26
+ );
@@ -3,7 +3,7 @@ import type { IDecoratorDtoOptions } from 'vona-module-a-web';
3
3
  import { $makeMetadata, v } from 'vona-module-a-openapiutils';
4
4
  import { $Dto } from 'vona-module-a-orm';
5
5
  import { Dto } from 'vona-module-a-web';
6
- import { ModelRecord } from 'vona-module-training-record';
6
+ import { ModelRecord, onEffectForTrainingRecordSubjects } from 'vona-module-training-record';
7
7
  import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
8
8
 
9
9
  import { $locale } from '../.metadata/locales.ts';
@@ -17,6 +17,7 @@ export interface IDtoOptionsDetailRecordBase extends IDecoratorDtoOptions {}
17
17
  v.title($locale('TrainingRecordSubjects')),
18
18
  ZovaRender.order(8),
19
19
  ZovaRender.field('basic-details:formFieldDetails'),
20
+ ZovaRender.onEffect(onEffectForTrainingRecordSubjects),
20
21
  v.optional(),
21
22
  ),
22
23
  },
@@ -122,8 +122,8 @@ export class RenderTabs extends BeanRenderBase {
122
122
  public getTabItemIcon(tabItem: IRouteViewRouteItem): keyof IIconRecord | '' {
123
123
  const { pageMeta } = tabItem;
124
124
  if (pageMeta?.pageDirty) return '::asterisk';
125
- if (pageMeta?.formMeta?.formScene === 'create') return '::draft-add';
126
- if (pageMeta?.formMeta?.formScene === 'edit') return '::draft-edit';
125
+ if (pageMeta?.formMeta?.formScene === 'create') return '::add';
126
+ if (pageMeta?.formMeta?.formScene === 'edit') return '::edit';
127
127
  return '';
128
128
  }
129
129