cabloy 5.1.157 → 5.1.159
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/.cabloy-version +1 -1
- package/.claude/skills/cabloy-contract-loop/SKILL.md +24 -7
- package/.claude/skills/cabloy-contract-loop/evals/evals.json +12 -0
- package/.claude/skills/cabloy-contract-loop/references/contract-loop-map.md +28 -0
- package/.claude/skills/cabloy-contract-loop/references/verification-checklist.md +19 -2
- package/.claude/skills/cabloy-resource-field-update/SKILL.md +18 -0
- package/.claude/skills/cabloy-zova-source-reading/SKILL.md +14 -0
- package/.claude/skills/cabloy-zova-source-reading/references/core-reading-paths.md +10 -0
- package/.github/workflows/docs-pages.yml +18 -2
- package/CHANGELOG.md +26 -0
- package/CONTRIBUTING.md +84 -0
- package/LICENSES.md +5 -0
- package/package.json +2 -1
- package/repo-docs/.vitepress/config.mjs +34 -4
- package/repo-docs/.vitepress/theme/components/GitHubRepositoriesNav.vue +255 -0
- package/repo-docs/.vitepress/theme/custom.css +21 -0
- package/repo-docs/.vitepress/theme/index.js +7 -1
- package/repo-docs/backend/resource-field-update.md +48 -1
- package/repo-docs/blogs/index.md +2 -0
- package/repo-docs/frontend/form-layout-guide.md +6 -6
- package/repo-docs/frontend/page-guide.md +12 -0
- package/repo-docs/frontend/page-meta-guide.md +27 -0
- package/repo-docs/frontend/ssr-architecture-overview.md +4 -0
- package/repo-docs/frontend/ssr-build-deploy-guide.md +1 -1
- package/repo-docs/frontend/zova-form-source-reading-map.md +2 -2
- package/repo-docs/frontend/zova-form-under-the-hood.md +1 -1
- package/repo-docs/frontend/zova-reactivity-under-the-hood.md +65 -9
- package/repo-docs/fullstack/contract-loop-playbook.md +2 -0
- package/repo-docs/fullstack/ssr-site-and-flavor-setup.md +198 -0
- package/repo-docs/fullstack/vona-zova-integration.md +2 -0
- package/repo-e2e/docs/playwright.config.ts +37 -0
- package/repo-e2e/docs/specs/blogs-index.spec.ts +180 -0
- package/repo-e2e/docs/specs/github-repositories-nav.spec.ts +69 -0
- package/repo-e2e/docs/test-results/.last-run.json +4 -0
- package/repo-e2e/specs/cabloy-basic.spec.ts +136 -2
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/entity/{{resourceName}}.tsx_ +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/entity/{{resourceName}}.tsx_ +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/pnpm-lock.yaml +21 -80
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productCreate.tsx +2 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productUpdate.tsx +2 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productView.tsx +2 -0
- package/vona/src/suite/a-training/modules/training-record/src/dto/recordCreate.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-record/src/dto/recordSelectReq.tsx +3 -7
- package/vona/src/suite/a-training/modules/training-record/src/dto/recordUpdate.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-record/src/dto/recordView.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-record/src/entity/record.tsx +8 -0
- package/vona/src/suite/a-training/modules/training-record/test/record.test.ts +51 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectResItem.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +1 -0
- package/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx +10 -1
- package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +99 -1
- package/vona/src/suite-vendor/a-cabloy/modules/a-rbac/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/package.json +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/pipe.filter.ts +85 -57
- 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/rest/render.ts +2 -0
- package/zova/packages-cli/cli-set-front/cli/templates/rest/rest.ts +13 -3
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx +31 -11
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx +3 -0
- package/zova/src/suite/cabloy-basic/modules/basic-pageentry/src/component/blockPageEntry/controller.tsx +1 -1
- package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/render.tsx +68 -8
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/model/resource.ts +4 -0
- package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-form/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-form/src/lib/formLayout.ts +0 -6
- package/zova/src/suite-vendor/a-zova/modules/a-form/test/lib/formLayout.test.ts +16 -9
- 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/model/sdk.ts +4 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/rest.ts +13 -2
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/schema.ts +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 +50 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/render.tsx +60 -7
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/types/table.ts +6 -4
- package/zova/src/suite-vendor/a-zova/package.json +4 -4
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { DtoDetailRecordResItem } from '../src/dto/detailRecordResItem.tsx';
|
|
14
14
|
import { DtoStudentSummary } from '../src/dto/studentSummary.tsx';
|
|
15
15
|
|
|
16
|
-
describe('student.test.ts', () => {
|
|
16
|
+
describe('student.test.ts', { concurrency: false }, () => {
|
|
17
17
|
it('action:student:formLayoutMetadata', async () => {
|
|
18
18
|
await app.bean.executor.mockCtx(async () => {
|
|
19
19
|
for (const DtoClass of [DtoStudentCreate, DtoStudentUpdate, DtoStudentView]) {
|
|
@@ -95,6 +95,104 @@ describe('student.test.ts', () => {
|
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
+
it('action:student:tableColumnMetadata', async () => {
|
|
99
|
+
await app.bean.executor.mockCtx(async () => {
|
|
100
|
+
const apiJson = await app.bean.openapi.generateJsonOfClass(DtoStudentSelectResItem);
|
|
101
|
+
const component = Object.values(apiJson.components!.schemas as any).find(item => {
|
|
102
|
+
return (item as any).properties?._operationsRow;
|
|
103
|
+
}) as any;
|
|
104
|
+
assert.deepEqual(
|
|
105
|
+
{
|
|
106
|
+
align: component.properties.name.rest.table.align,
|
|
107
|
+
width: component.properties.name.rest.table.width,
|
|
108
|
+
fixed: component.properties.name.rest.table.fixed,
|
|
109
|
+
enableSorting: component.properties.name.rest.table.enableSorting,
|
|
110
|
+
},
|
|
111
|
+
{ align: 'left', width: 240, fixed: 'left', enableSorting: true },
|
|
112
|
+
);
|
|
113
|
+
assert.deepEqual(
|
|
114
|
+
{
|
|
115
|
+
align: component.properties.level.rest.table.align,
|
|
116
|
+
width: component.properties.level.rest.table.width,
|
|
117
|
+
enableSorting: component.properties.level.rest.table.enableSorting,
|
|
118
|
+
},
|
|
119
|
+
{ align: 'center', width: 140, enableSorting: true },
|
|
120
|
+
);
|
|
121
|
+
assert.deepEqual(
|
|
122
|
+
{
|
|
123
|
+
align: component.properties.createdAt.rest.table.align,
|
|
124
|
+
width: component.properties.createdAt.rest.table.width,
|
|
125
|
+
enableSorting: component.properties.createdAt.rest.table.enableSorting,
|
|
126
|
+
},
|
|
127
|
+
{ align: 'center', width: 180, enableSorting: true },
|
|
128
|
+
);
|
|
129
|
+
assert.deepEqual(
|
|
130
|
+
{
|
|
131
|
+
align: component.properties._operationsRow.rest.table.align,
|
|
132
|
+
width: component.properties._operationsRow.rest.table.width,
|
|
133
|
+
fixed: component.properties._operationsRow.rest.table.fixed,
|
|
134
|
+
},
|
|
135
|
+
{ align: 'center', width: 360, fixed: 'right' },
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('action:student:serverSorting', async () => {
|
|
141
|
+
await app.bean.executor.mockCtx(async () => {
|
|
142
|
+
await app.bean.passport.signinMock();
|
|
143
|
+
const studentIds: string[] = [];
|
|
144
|
+
const names = ['__StudentSortA__', '__StudentSortZ__'];
|
|
145
|
+
try {
|
|
146
|
+
for (const [index, name] of names.entries()) {
|
|
147
|
+
const studentId = await app.bean.executor.performAction('post', '/training/student', {
|
|
148
|
+
body: {
|
|
149
|
+
name,
|
|
150
|
+
mobile: `13812345${678 + index}`,
|
|
151
|
+
level: 1,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
studentIds.push(studentId);
|
|
155
|
+
}
|
|
156
|
+
const ascending: DtoStudentSelectRes = await app.bean.executor.performAction(
|
|
157
|
+
'get',
|
|
158
|
+
'/training/student',
|
|
159
|
+
{ query: { orders: [['name', 'asc']] } },
|
|
160
|
+
);
|
|
161
|
+
const descending: DtoStudentSelectRes = await app.bean.executor.performAction(
|
|
162
|
+
'get',
|
|
163
|
+
'/training/student',
|
|
164
|
+
{ query: { orders: [['name', 'desc']] } },
|
|
165
|
+
);
|
|
166
|
+
const ascendingIndexes = names.map(name =>
|
|
167
|
+
ascending.list.findIndex(item => item.name === name),
|
|
168
|
+
);
|
|
169
|
+
const descendingIndexes = names.map(name =>
|
|
170
|
+
descending.list.findIndex(item => item.name === name),
|
|
171
|
+
);
|
|
172
|
+
assert.equal(
|
|
173
|
+
ascendingIndexes.every(index => index >= 0),
|
|
174
|
+
true,
|
|
175
|
+
);
|
|
176
|
+
assert.equal(
|
|
177
|
+
descendingIndexes.every(index => index >= 0),
|
|
178
|
+
true,
|
|
179
|
+
);
|
|
180
|
+
assert.equal(ascendingIndexes[0] < ascendingIndexes[1], true);
|
|
181
|
+
assert.equal(descendingIndexes[0] > descendingIndexes[1], true);
|
|
182
|
+
} finally {
|
|
183
|
+
for (const studentId of studentIds.reverse()) {
|
|
184
|
+
await app
|
|
185
|
+
.scope('training-student')
|
|
186
|
+
.model.studentContent.delete({ studentId }, { disableDeleted: true });
|
|
187
|
+
await app
|
|
188
|
+
.scope('training-student')
|
|
189
|
+
.model.student.deleteById(studentId, { disableDeleted: true });
|
|
190
|
+
}
|
|
191
|
+
await app.bean.passport.signout();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
98
196
|
it('action:student:emittedDtoSchemas', async () => {
|
|
99
197
|
await app.bean.executor.mockCtx(async () => {
|
|
100
198
|
const summaryApiJson = await app.bean.openapi.generateJsonOfClass(DtoStudentSummary);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-suite-a-cabloy",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.51",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"vona-module-a-cabloy": "workspace:^",
|
|
11
11
|
"vona-module-a-markdown": "^5.0.3",
|
|
12
|
-
"vona-module-a-rbac": "^5.0.
|
|
12
|
+
"vona-module-a-rbac": "^5.0.5",
|
|
13
13
|
"vona-module-a-socket": "workspace:^",
|
|
14
14
|
"vona-module-a-ssr": "workspace:^",
|
|
15
15
|
"vona-module-a-ssrhmr": "workspace:^"
|
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
export type TypePipeFilterData = ITableQuery;
|
|
26
26
|
|
|
27
27
|
export type TypePipeFilterResult = TypeQueryParamsPatch;
|
|
28
|
+
type TypeQueryJoin = NonNullable<TypeQueryParamsPatch['joins']>[number];
|
|
28
29
|
|
|
29
30
|
export interface IPipeOptionsFilter
|
|
30
31
|
extends IDecoratorPipeOptions, IDecoratorPipeOptionsArgument, ValidatorOptions {}
|
|
@@ -68,10 +69,13 @@ export class PipeFilter
|
|
|
68
69
|
private async _transform(value: TypePipeFilterData, options: IPipeOptionsFilter) {
|
|
69
70
|
// 1. system: columns/where/orders/pageNo/pageSize
|
|
70
71
|
const params = this._transformSystem(value);
|
|
72
|
+
const rootOpenapi = ZodMetadata.getOpenapiMetadata(options.schema!) as
|
|
73
|
+
| ISchemaObjectExtensionField
|
|
74
|
+
| undefined;
|
|
71
75
|
// 2. fields
|
|
72
|
-
await this._transformFields(params, value, options);
|
|
76
|
+
await this._transformFields(params, value, options, rootOpenapi);
|
|
73
77
|
// 3. system: orders
|
|
74
|
-
this._transformOrders(params, options);
|
|
78
|
+
this._transformOrders(params, options, rootOpenapi);
|
|
75
79
|
// ok
|
|
76
80
|
return params;
|
|
77
81
|
}
|
|
@@ -104,32 +108,75 @@ export class PipeFilter
|
|
|
104
108
|
return params;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
|
-
private _transformOrders(
|
|
111
|
+
private _transformOrders(
|
|
112
|
+
params: TypeQueryParamsPatch,
|
|
113
|
+
options: IPipeOptionsFilter,
|
|
114
|
+
rootOpenapi: ISchemaObjectExtensionField | undefined,
|
|
115
|
+
) {
|
|
108
116
|
if (!params.orders) return;
|
|
109
|
-
// openapi
|
|
110
|
-
const openapi: ISchemaObjectExtensionField | undefined = ZodMetadata.getOpenapiMetadata(
|
|
111
|
-
options.schema!,
|
|
112
|
-
) as ISchemaObjectExtensionField | undefined;
|
|
113
|
-
const table = openapi?.filter?.table;
|
|
114
|
-
// loop
|
|
115
117
|
for (const order of params.orders) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
tableCurrent = openapi?.filter?.table;
|
|
127
|
-
}
|
|
128
|
-
if (openapi?.filter?.originalName) {
|
|
129
|
-
fieldCurrent = openapi?.filter?.originalName;
|
|
130
|
-
}
|
|
118
|
+
if (!Array.isArray(order) || order.length !== 2) {
|
|
119
|
+
throw new Error('invalid order');
|
|
120
|
+
}
|
|
121
|
+
const [key, direction] = order;
|
|
122
|
+
if (typeof key !== 'string' || (direction !== 'asc' && direction !== 'desc')) {
|
|
123
|
+
throw new Error('invalid order');
|
|
124
|
+
}
|
|
125
|
+
const info = this._resolveField(key, options, rootOpenapi);
|
|
126
|
+
if (!info || info.openapi?.filter?.capabilities?.order === false) {
|
|
127
|
+
throw new Error(`invalid order field: ${key}`);
|
|
131
128
|
}
|
|
132
|
-
cast(order)[0] =
|
|
129
|
+
cast(order)[0] = info.orderFullName;
|
|
130
|
+
this._addJoin(params, info.joinInfo);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private _resolveField(
|
|
135
|
+
key: string,
|
|
136
|
+
options: IPipeOptionsFilter,
|
|
137
|
+
rootOpenapi: ISchemaObjectExtensionField | undefined,
|
|
138
|
+
) {
|
|
139
|
+
const fieldSchema = ZodMetadata.getFieldSchema(options.schema!, key);
|
|
140
|
+
if (!fieldSchema) {
|
|
141
|
+
if (!rootOpenapi?.filter?.table) {
|
|
142
|
+
return { orderFullName: key };
|
|
143
|
+
}
|
|
144
|
+
const keyParts = key.split('.');
|
|
145
|
+
const [table, field] = keyParts;
|
|
146
|
+
if (!table || !field || keyParts.length !== 2) return;
|
|
147
|
+
const resolved = this._resolveField(field, options, rootOpenapi);
|
|
148
|
+
if (!resolved || resolved.orderFullName !== key) return;
|
|
149
|
+
return resolved;
|
|
150
|
+
}
|
|
151
|
+
const fieldSchemaInner = ZodMetadata.unwrapChained(fieldSchema);
|
|
152
|
+
const openapi: ISchemaObjectExtensionField | undefined = ZodMetadata.getOpenapiMetadata(
|
|
153
|
+
fieldSchema,
|
|
154
|
+
) as ISchemaObjectExtensionField | undefined;
|
|
155
|
+
const originalName = openapi?.filter?.originalName ?? key;
|
|
156
|
+
const table = openapi?.filter?.table ?? rootOpenapi?.filter?.table;
|
|
157
|
+
const joinInfo = openapi?.filter?.joinOn
|
|
158
|
+
? ([
|
|
159
|
+
openapi.filter.joinType ?? 'innerJoin',
|
|
160
|
+
openapi.filter.table,
|
|
161
|
+
openapi.filter.joinOn,
|
|
162
|
+
] as TypeQueryJoin)
|
|
163
|
+
: undefined;
|
|
164
|
+
return {
|
|
165
|
+
fieldSchema,
|
|
166
|
+
fieldSchemaInner,
|
|
167
|
+
openapi,
|
|
168
|
+
originalName,
|
|
169
|
+
fullName: joinInfo ? `${openapi?.filter?.table}.${originalName}` : originalName,
|
|
170
|
+
orderFullName: table ? `${table}.${originalName}` : originalName,
|
|
171
|
+
joinInfo,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private _addJoin(params: TypeQueryParamsPatch, joinInfo: TypeQueryJoin | undefined) {
|
|
176
|
+
if (!joinInfo) return;
|
|
177
|
+
if (!params.joins) params.joins = [];
|
|
178
|
+
if (params.joins.findIndex(item => item[1] === joinInfo[1]) === -1) {
|
|
179
|
+
params.joins.push(joinInfo);
|
|
133
180
|
}
|
|
134
181
|
}
|
|
135
182
|
|
|
@@ -139,36 +186,21 @@ export class PipeFilter
|
|
|
139
186
|
params: TypeQueryParamsPatch,
|
|
140
187
|
value: any,
|
|
141
188
|
options: IPipeOptionsFilter,
|
|
189
|
+
rootOpenapi: ISchemaObjectExtensionField | undefined,
|
|
142
190
|
) {
|
|
143
191
|
if (__FieldsSystem.includes(key)) return;
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
-
const fieldSchemaInner =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const [transformName] = openapi?.filter?.transform ?? ['a-web:base', undefined];
|
|
192
|
+
const info = this._resolveField(key, options, rootOpenapi);
|
|
193
|
+
if (!info) return;
|
|
194
|
+
const { fieldSchema, fieldSchemaInner, openapi, originalName, fullName, joinInfo } = info;
|
|
195
|
+
const [transformName, transformOptions] = openapi?.filter?.transform ?? [
|
|
196
|
+
'a-web:base',
|
|
197
|
+
undefined,
|
|
198
|
+
];
|
|
152
199
|
const fieldNullable = fieldValue === null && isNullableSchema(fieldSchema);
|
|
153
200
|
if (isNilOrEmptyString(fieldValue) && !fieldNullable) return;
|
|
154
|
-
// name
|
|
155
|
-
const originalName = openapi?.filter?.originalName ?? key;
|
|
156
|
-
let fullName: string;
|
|
157
|
-
// joins
|
|
158
|
-
let joinInfo;
|
|
159
|
-
if (openapi?.filter?.joinOn) {
|
|
160
|
-
const joinType = openapi.filter.joinType ?? 'innerJoin';
|
|
161
|
-
const joinTable = openapi.filter.table;
|
|
162
|
-
const joinOn = openapi.filter.joinOn;
|
|
163
|
-
joinInfo = [joinType, joinTable, joinOn];
|
|
164
|
-
fullName = `${joinTable}.${originalName}`;
|
|
165
|
-
} else {
|
|
166
|
-
fullName = originalName;
|
|
167
|
-
}
|
|
168
201
|
// check where
|
|
169
202
|
if (Object.prototype.hasOwnProperty.call(params.where, fullName)) return;
|
|
170
203
|
// filter transform
|
|
171
|
-
const [, transformOptions] = openapi?.filter?.transform ?? ['a-web:base', undefined];
|
|
172
204
|
const transformOptions2 = this.bean.onion.filterTransform.getOnionOptionsDynamic(
|
|
173
205
|
transformName as keyof IFilterTransformRecord,
|
|
174
206
|
transformOptions,
|
|
@@ -182,7 +214,7 @@ export class PipeFilter
|
|
|
182
214
|
if (!beanInstance.where) {
|
|
183
215
|
throw new Error(`filterTransform.where not found: ${beanFullName}`);
|
|
184
216
|
}
|
|
185
|
-
const
|
|
217
|
+
const transformInfo = {
|
|
186
218
|
params,
|
|
187
219
|
query: value,
|
|
188
220
|
options,
|
|
@@ -194,17 +226,12 @@ export class PipeFilter
|
|
|
194
226
|
schema: fieldSchema,
|
|
195
227
|
openapi,
|
|
196
228
|
};
|
|
197
|
-
const resTransform = await beanInstance.where(
|
|
229
|
+
const resTransform = await beanInstance.where(transformInfo, transformOptions2);
|
|
198
230
|
if (resTransform !== undefined) {
|
|
199
231
|
// where
|
|
200
232
|
params.where[fullName] = resTransform;
|
|
201
233
|
// join
|
|
202
|
-
|
|
203
|
-
if (!params.joins) params.joins = [];
|
|
204
|
-
if (params.joins.findIndex(item => item[1] === joinInfo.joinTable) === -1) {
|
|
205
|
-
params.joins.push(joinInfo);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
234
|
+
this._addJoin(params, joinInfo);
|
|
208
235
|
}
|
|
209
236
|
}
|
|
210
237
|
|
|
@@ -212,10 +239,11 @@ export class PipeFilter
|
|
|
212
239
|
params: TypeQueryParamsPatch,
|
|
213
240
|
value: any,
|
|
214
241
|
options: IPipeOptionsFilter,
|
|
242
|
+
rootOpenapi: ISchemaObjectExtensionField | undefined,
|
|
215
243
|
) {
|
|
216
244
|
// loop
|
|
217
245
|
for (const key in value) {
|
|
218
|
-
await this._transformField(key, value[key], params, value, options);
|
|
246
|
+
await this._transformField(key, value[key], params, value, options, rootOpenapi);
|
|
219
247
|
}
|
|
220
248
|
}
|
|
221
249
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.106",
|
|
4
4
|
"gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
|
|
5
5
|
"description": "zova cli",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@cabloy/process-helper": "^3.1.8",
|
|
45
45
|
"fs-extra": "^11.3.5",
|
|
46
46
|
"semver": "^7.6.2",
|
|
47
|
-
"zova-cli-set-front": "^1.2.
|
|
47
|
+
"zova-cli-set-front": "^1.2.104"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"clean-package": "^2.2.0",
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
schemaRenderTableActionRowJsx,
|
|
18
18
|
} from './component.ts';
|
|
19
19
|
import {
|
|
20
|
+
schemaRenderColumn,
|
|
20
21
|
schemaRenderDisableNotifyChanged,
|
|
21
22
|
schemaRenderFieldSource,
|
|
22
23
|
schemaRenderLayout,
|
|
@@ -35,6 +36,7 @@ export const ZovaRender = {
|
|
|
35
36
|
disableNotifyChanged: schemaRenderDisableNotifyChanged,
|
|
36
37
|
onEffect: schemaRenderOnEffect,
|
|
37
38
|
fieldSource: schemaRenderFieldSource,
|
|
39
|
+
column: schemaRenderColumn,
|
|
38
40
|
// component
|
|
39
41
|
field: schemaRenderField,
|
|
40
42
|
fieldJsx: schemaRenderFieldJsx,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type z from 'zod';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type {
|
|
4
|
+
IResourceFormFieldLayoutOptions,
|
|
5
|
+
ITableColumnOptions,
|
|
6
|
+
TypeFormFieldOnEffect,
|
|
7
|
+
TypeFormSchemaScene,
|
|
8
|
+
TypeSchemaScene,
|
|
9
|
+
} from 'zova-module-a-openapi';
|
|
6
10
|
import type { TypeSchemaOrderLevel } from 'zova-module-a-openapi';
|
|
7
11
|
|
|
8
12
|
import { _generalSchemaRest, _order } from './inner.ts';
|
|
@@ -78,3 +82,9 @@ export function schemaRenderOrder<T extends z.ZodType>(
|
|
|
78
82
|
return _generalSchemaRest(schema, options, scene);
|
|
79
83
|
};
|
|
80
84
|
}
|
|
85
|
+
|
|
86
|
+
export function schemaRenderColumn<T extends z.ZodType>(options: ITableColumnOptions) {
|
|
87
|
+
return function (schema: T): T {
|
|
88
|
+
return schema.openapi({ rest: { table: options } });
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.156",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "A vue3 framework with ioc",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zova-core": "^5.1.88",
|
|
49
|
-
"zova-suite-a-zova": "^5.1.
|
|
49
|
+
"zova-suite-a-zova": "^5.1.155"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"clean-package": "^2.2.0",
|
package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SortingState } from '@tanstack/vue-table';
|
|
1
2
|
import type { IComponentOptions } from 'zova';
|
|
2
3
|
import type {
|
|
3
4
|
IJsxRenderContextPage,
|
|
@@ -10,6 +11,7 @@ import type {
|
|
|
10
11
|
} from 'zova-module-a-openapi';
|
|
11
12
|
|
|
12
13
|
import { celEnvBase } from '@cabloy/utils';
|
|
14
|
+
import { functionalUpdate } from '@tanstack/vue-table';
|
|
13
15
|
import { VNode } from 'vue';
|
|
14
16
|
import { BeanControllerBase, deepEqual } from 'zova';
|
|
15
17
|
import { ZovaJsx } from 'zova-jsx';
|
|
@@ -49,8 +51,9 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
49
51
|
|
|
50
52
|
queryFixedData: ITableQuery;
|
|
51
53
|
queryFilterData: ITableQuery;
|
|
54
|
+
querySortingData: ITableQuery;
|
|
55
|
+
sorting: SortingState;
|
|
52
56
|
queryPaged: ITablePaged;
|
|
53
|
-
query: ITableQuery;
|
|
54
57
|
|
|
55
58
|
$$modelResource: ModelResource<TData>;
|
|
56
59
|
|
|
@@ -65,6 +68,8 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
65
68
|
// query
|
|
66
69
|
this.queryFixedData = this.$props.queryFixed ?? {};
|
|
67
70
|
this.queryFilterData = {};
|
|
71
|
+
this.querySortingData = {};
|
|
72
|
+
this.sorting = [];
|
|
68
73
|
this.$watch(
|
|
69
74
|
() => this.$props.queryFixed,
|
|
70
75
|
queryFixed => {
|
|
@@ -72,16 +77,6 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
72
77
|
},
|
|
73
78
|
);
|
|
74
79
|
this.queryPaged = { pageNo: 1, pageSize: this.$props.pageSize };
|
|
75
|
-
this.query = this.$computed(() => {
|
|
76
|
-
const { where: whereFixed, ...queryFixed } = this.queryFixedData;
|
|
77
|
-
const { where: whereFilter, ...queryFilter } = this.queryFilterData;
|
|
78
|
-
return {
|
|
79
|
-
...queryFixed,
|
|
80
|
-
...queryFilter,
|
|
81
|
-
where: { ...whereFilter, ...whereFixed },
|
|
82
|
-
...this.queryPaged,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
80
|
// load schema/data
|
|
86
81
|
await $QueriesEnsureLoaded(
|
|
87
82
|
() => this.$$modelResource.apiSchemasSelect.sdk,
|
|
@@ -101,6 +96,18 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
101
96
|
return this.$props.resource;
|
|
102
97
|
}
|
|
103
98
|
|
|
99
|
+
get query() {
|
|
100
|
+
const { where: whereFixed, ...queryFixed } = this.queryFixedData;
|
|
101
|
+
const { where: whereFilter, ...queryFilter } = this.queryFilterData;
|
|
102
|
+
return {
|
|
103
|
+
...queryFixed,
|
|
104
|
+
...queryFilter,
|
|
105
|
+
...this.querySortingData,
|
|
106
|
+
where: { ...whereFilter, ...whereFixed },
|
|
107
|
+
...this.queryPaged,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
104
111
|
get queryData() {
|
|
105
112
|
return this.$$modelResource.select(this.query);
|
|
106
113
|
}
|
|
@@ -117,6 +124,10 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
117
124
|
return this.$$modelResource.schemaFilter;
|
|
118
125
|
}
|
|
119
126
|
|
|
127
|
+
get schemaOrder() {
|
|
128
|
+
return this.$$modelResource.schemaOrder;
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
get schemaRow() {
|
|
121
132
|
return this.$$modelResource.schemaRow;
|
|
122
133
|
}
|
|
@@ -147,6 +158,15 @@ export class ControllerBlockPage<TData extends {} = {}> extends BeanControllerBa
|
|
|
147
158
|
this.queryPaged.pageNo = 1;
|
|
148
159
|
}
|
|
149
160
|
|
|
161
|
+
onSortingChange(updater: SortingState | ((old: SortingState) => SortingState)) {
|
|
162
|
+
this.sorting = functionalUpdate(updater, this.sorting).slice(0, 1);
|
|
163
|
+
const sorting = this.sorting[0];
|
|
164
|
+
this.querySortingData = sorting
|
|
165
|
+
? { orders: [[sorting.id, sorting.desc ? 'desc' : 'asc']] }
|
|
166
|
+
: {};
|
|
167
|
+
this.queryPaged.pageNo = 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
150
170
|
public setTableRef(tableRef: BeanControllerTableBase<TData> | undefined) {
|
|
151
171
|
this.tableRef = tableRef;
|
|
152
172
|
if (!tableRef || !this._tableMetaRefreshPending) return;
|
package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx
CHANGED
|
@@ -44,6 +44,9 @@ export class ControllerBlockTable<TData extends {} = {}> extends BeanControllerB
|
|
|
44
44
|
}}
|
|
45
45
|
data={$$page.data as unknown as TData[]}
|
|
46
46
|
schema={$$page.schemaRow}
|
|
47
|
+
schemaOrder={$$page.schemaOrder}
|
|
48
|
+
sorting={$$page.sorting}
|
|
49
|
+
onSortingChange={updater => $$page.onSortingChange(updater)}
|
|
47
50
|
tableScope={$$page.jsxCelScope}
|
|
48
51
|
></ZTable>
|
|
49
52
|
</div>
|
|
@@ -167,7 +167,7 @@ export class ControllerBlockPageEntry<TData extends {} = {}> extends BeanControl
|
|
|
167
167
|
|
|
168
168
|
setPageMeta(data: any | undefined, pageDirty?: boolean) {
|
|
169
169
|
if (!this.$pageRoute) return;
|
|
170
|
-
const pageTitle = data?.[this.$props.pageTitleKey];
|
|
170
|
+
const pageTitle = data?.[this.$props.pageTitleKey] || this.formSchema?.title;
|
|
171
171
|
this.$router.setPageMeta(this.$pageRoute, { pageTitle, pageDirty, formMeta: this.formMeta });
|
|
172
172
|
}
|
|
173
173
|
|