cabloy 5.1.167 → 5.1.168
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/repo-e2e/specs/cabloy-basic.spec.ts +75 -0
- package/vona/pnpm-lock.yaml +235 -48
- package/vona/src/suite/a-training/modules/training-record/src/entity/record.tsx +2 -0
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +113 -84
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/.metadata/component/routedDialog.ts +2 -1
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/component/routedDialog/controller.tsx +6 -2
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/service/appModal.ts +60 -8
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/appModal.ts +40 -8
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/.metadata/index.ts +6 -6
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockPage/controller.tsx +95 -10
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/config/locale/en-us.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/config/locale/zh-cn.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-page/src/lib/selection.ts +35 -0
- package/zova/src/suite/cabloy-basic/modules/basic-page/test/lib/selection.test.ts +24 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/.metadata/component/blockResourcePickerActions.ts +34 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/.metadata/index.ts +30 -8
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/.metadata/locales.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/component/blockResourcePickerActions/controller.tsx +92 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/component/formFieldResourcePicker/controller.tsx +219 -11
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/config/locale/en-us.ts +8 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/config/locale/zh-cn.ts +7 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/index.ts +2 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/src/lib/resourcePicker.ts +29 -0
- package/zova/src/suite/cabloy-basic/modules/basic-resource/test/lib/resourcePicker.test.ts +32 -0
- package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/render.tsx +18 -12
- 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/.metadata/component/resourcePickerContext.ts +31 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/.metadata/index.ts +48 -5
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/.metadata/page/resourcePicker.ts +16 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/component/resourcePickerContext/controller.tsx +26 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/index.ts +2 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/lib/resourcePicker.ts +1 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/resourcePicker/controller.tsx +144 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/routes.ts +9 -0
- package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-bean/cli/controller/metadata/generateFileComponent.ts +40 -1
- package/zova/src/suite-vendor/a-zova/modules/a-bean/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-router/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-router/src/lib/routerViewBase.tsx +5 -0
- package/zova/src/suite-vendor/a-zova/modules/a-routerstack/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-routerstack/src/component/routerViewStack/controller.tsx +7 -1
- 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 +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/render.tsx +13 -10
- package/zova/src/suite-vendor/a-zova/package.json +5 -5
|
@@ -26,7 +26,7 @@ declare module 'zova-module-rest-resource' {
|
|
|
26
26
|
}
|
|
27
27
|
/** model: end */
|
|
28
28
|
/** model: begin */
|
|
29
|
-
import { ModelResource } from '../model/resource.js';
|
|
29
|
+
import type { ModelResource } from '../model/resource.js';
|
|
30
30
|
import 'zova';
|
|
31
31
|
declare module 'zova' {
|
|
32
32
|
export interface IBeanRecordGeneral {
|
|
@@ -35,9 +35,11 @@ declare module 'zova' {
|
|
|
35
35
|
}
|
|
36
36
|
/** model: end */
|
|
37
37
|
/** controller: begin */
|
|
38
|
+
export * from '../component/resourcePickerContext/controller.jsx';
|
|
38
39
|
export * from '../page/entry/controller.jsx';
|
|
39
40
|
export * from '../page/entryCreate/controller.jsx';
|
|
40
41
|
export * from '../page/resource/controller.jsx';
|
|
42
|
+
export * from '../page/resourcePicker/controller.jsx';
|
|
41
43
|
|
|
42
44
|
import 'zova';
|
|
43
45
|
declare module 'zova' {
|
|
@@ -46,6 +48,11 @@ declare module 'zova' {
|
|
|
46
48
|
}
|
|
47
49
|
declare module 'zova-module-rest-resource' {
|
|
48
50
|
|
|
51
|
+
export interface ControllerResourcePickerContext {
|
|
52
|
+
/** @internal */
|
|
53
|
+
get scope(): ScopeModuleRestResource;
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
export interface ControllerPageEntry {
|
|
50
57
|
/** @internal */
|
|
51
58
|
get scope(): ScopeModuleRestResource;
|
|
@@ -55,18 +62,27 @@ declare module 'zova-module-rest-resource' {
|
|
|
55
62
|
/** @internal */
|
|
56
63
|
get scope(): ScopeModuleRestResource;
|
|
57
64
|
}
|
|
65
|
+
|
|
66
|
+
export interface ControllerPageResourcePicker {
|
|
67
|
+
/** @internal */
|
|
68
|
+
get scope(): ScopeModuleRestResource;
|
|
69
|
+
}
|
|
58
70
|
}
|
|
59
71
|
/** controller: end */
|
|
60
72
|
/** controller: begin */
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
73
|
+
import type { ControllerResourcePickerContext } from '../component/resourcePickerContext/controller.jsx';
|
|
74
|
+
import type { ControllerPageEntry } from '../page/entry/controller.jsx';
|
|
75
|
+
import type { ControllerPageEntryCreate } from '../page/entryCreate/controller.jsx';
|
|
76
|
+
import type { ControllerPageResource } from '../page/resource/controller.jsx';
|
|
77
|
+
import type { ControllerPageResourcePicker } from '../page/resourcePicker/controller.jsx';
|
|
64
78
|
import 'zova';
|
|
65
79
|
declare module 'zova' {
|
|
66
80
|
export interface IBeanRecordLocal {
|
|
67
|
-
'rest-resource.controller.
|
|
81
|
+
'rest-resource.controller.resourcePickerContext': ControllerResourcePickerContext;
|
|
82
|
+
'rest-resource.controller.pageEntry': ControllerPageEntry;
|
|
68
83
|
'rest-resource.controller.pageEntryCreate': ControllerPageEntryCreate;
|
|
69
84
|
'rest-resource.controller.pageResource': ControllerPageResource;
|
|
85
|
+
'rest-resource.controller.pageResourcePicker': ControllerPageResourcePicker;
|
|
70
86
|
}
|
|
71
87
|
}
|
|
72
88
|
/** controller: end */
|
|
@@ -77,6 +93,8 @@ export * from './page/entryCreate.js';
|
|
|
77
93
|
import { NSControllerPageEntryCreate } from './page/entryCreate.js';
|
|
78
94
|
export * from './page/resource.js';
|
|
79
95
|
import { NSControllerPageResource } from './page/resource.js';
|
|
96
|
+
export * from './page/resourcePicker.js';
|
|
97
|
+
import { NSControllerPageResourcePicker } from './page/resourcePicker.js';
|
|
80
98
|
export * from '../routes.js';
|
|
81
99
|
import { TypePagePathSchema } from 'zova-module-a-router';
|
|
82
100
|
import 'zova';
|
|
@@ -85,11 +103,13 @@ export interface IPagePathRecord {
|
|
|
85
103
|
'/rest/resource/:resource/:id/:formScene?': TypePagePathSchema<NSControllerPageEntry.ParamsInput,undefined>;
|
|
86
104
|
'/rest/resource/:resource/create': TypePagePathSchema<NSControllerPageEntryCreate.ParamsInput,undefined>;
|
|
87
105
|
'/rest/resource/:resource': TypePagePathSchema<NSControllerPageResource.ParamsInput,undefined>;
|
|
106
|
+
'/rest/resource/:resource/picker': TypePagePathSchema<NSControllerPageResourcePicker.ParamsInput,undefined>;
|
|
88
107
|
}
|
|
89
108
|
export interface IPageNameRecord {
|
|
90
109
|
'rest-resource:entry': TypePagePathSchema<NSControllerPageEntry.ParamsInput,undefined>;
|
|
91
110
|
'rest-resource:entryCreate': TypePagePathSchema<NSControllerPageEntryCreate.ParamsInput,undefined>;
|
|
92
111
|
'rest-resource:resource': TypePagePathSchema<NSControllerPageResource.ParamsInput,undefined>;
|
|
112
|
+
'rest-resource:resourcePicker': TypePagePathSchema<NSControllerPageResourcePicker.ParamsInput,undefined>;
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
export const pagePathSchemas = {
|
|
@@ -107,6 +127,10 @@ export const pageNameSchemas = {
|
|
|
107
127
|
'rest-resource:resource': {
|
|
108
128
|
params: NSControllerPageResource.paramsSchema,
|
|
109
129
|
|
|
130
|
+
},
|
|
131
|
+
'rest-resource:resourcePicker': {
|
|
132
|
+
params: NSControllerPageResourcePicker.paramsSchema,
|
|
133
|
+
|
|
110
134
|
},
|
|
111
135
|
};
|
|
112
136
|
declare module 'zova-module-rest-resource' {
|
|
@@ -119,9 +143,28 @@ export interface ControllerPageEntryCreate {
|
|
|
119
143
|
export interface ControllerPageResource {
|
|
120
144
|
$params: NSControllerPageResource.ParamsOutput;
|
|
121
145
|
}
|
|
146
|
+
export interface ControllerPageResourcePicker {
|
|
147
|
+
$params: NSControllerPageResourcePicker.ParamsOutput;
|
|
148
|
+
}
|
|
122
149
|
}
|
|
123
150
|
/** pages: end */
|
|
124
151
|
|
|
152
|
+
/** components: begin */
|
|
153
|
+
export * from './component/resourcePickerContext.js';
|
|
154
|
+
import { ZResourcePickerContext } from './component/resourcePickerContext.js';
|
|
155
|
+
export const components = {
|
|
156
|
+
'resourcePickerContext': ZResourcePickerContext,
|
|
157
|
+
};
|
|
158
|
+
import 'zova';
|
|
159
|
+
declare module 'zova' {
|
|
160
|
+
export interface IComponentRecord {
|
|
161
|
+
'rest-resource:resourcePickerContext': ControllerResourcePickerContext;
|
|
162
|
+
}
|
|
163
|
+
export interface IZovaComponentRecord {
|
|
164
|
+
'rest-resource:resourcePickerContext': typeof ZResourcePickerContext;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** components: end */
|
|
125
168
|
/** scope: begin */
|
|
126
169
|
import { BeanScopeBase, type BeanScopeUtil } from 'zova';
|
|
127
170
|
import { Scope } from 'zova-module-a-bean';
|
package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/.metadata/page/resourcePicker.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createZovaComponentPage } from 'zova';
|
|
3
|
+
|
|
4
|
+
import { ControllerPageResourcePicker } from '../../page/resourcePicker/controller.jsx';
|
|
5
|
+
import { ControllerPageResourcePickerSchemaParams } from '../../page/resourcePicker/controller.jsx';
|
|
6
|
+
export namespace NSControllerPageResourcePicker {
|
|
7
|
+
export const paramsSchema = ControllerPageResourcePickerSchemaParams;
|
|
8
|
+
export type ParamsInput = z.input<typeof ControllerPageResourcePickerSchemaParams>;
|
|
9
|
+
export type ParamsOutput = z.output<typeof ControllerPageResourcePickerSchemaParams>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ZPageResourcePicker = createZovaComponentPage(
|
|
13
|
+
ControllerPageResourcePicker,
|
|
14
|
+
undefined,
|
|
15
|
+
undefined,
|
|
16
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BeanControllerBase } from 'zova';
|
|
2
|
+
import { Controller } from 'zova-module-a-bean';
|
|
3
|
+
|
|
4
|
+
import type { IResourcePickerPageContext } from '../../page/resourcePicker/controller.js';
|
|
5
|
+
|
|
6
|
+
import { resourcePickerPageContextKey } from '../../lib/resourcePicker.js';
|
|
7
|
+
|
|
8
|
+
export interface ControllerResourcePickerContextProps {
|
|
9
|
+
context: IResourcePickerPageContext;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Controller()
|
|
13
|
+
export class ControllerResourcePickerContext extends BeanControllerBase {
|
|
14
|
+
static $propsDefault = {};
|
|
15
|
+
|
|
16
|
+
protected async __init__() {
|
|
17
|
+
this.bean._setBean(
|
|
18
|
+
resourcePickerPageContextKey,
|
|
19
|
+
(this.$props as ControllerResourcePickerContextProps).context,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
protected render() {
|
|
24
|
+
return this.$slotDefault?.();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const resourcePickerPageContextKey = '$resourcePickerPageContext';
|
package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/resourcePicker/controller.tsx
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { VNode } from 'vue';
|
|
3
|
+
import type {
|
|
4
|
+
IResourceBlockOptionsBase,
|
|
5
|
+
IResourceRenderBlockOptionsBlock,
|
|
6
|
+
IResourceTableSelectionPayload,
|
|
7
|
+
ITableQuery,
|
|
8
|
+
} from 'zova-module-a-openapi';
|
|
9
|
+
import type { IRoutedDialogContext } from 'zova-module-basic-app';
|
|
10
|
+
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';
|
|
13
|
+
import { ZovaJsx } from 'zova-jsx';
|
|
14
|
+
import { Controller } from 'zova-module-a-bean';
|
|
15
|
+
import { $QueryEnsureLoaded } from 'zova-module-a-model';
|
|
16
|
+
import { routedDialogContextKey } from 'zova-module-basic-app';
|
|
17
|
+
import { ZPage } from 'zova-module-home-base';
|
|
18
|
+
|
|
19
|
+
import type { ModelResource } from '../../model/resource.js';
|
|
20
|
+
|
|
21
|
+
import { ZResourcePickerContext } from '../../.metadata/component/resourcePickerContext.js';
|
|
22
|
+
|
|
23
|
+
export const ControllerPageResourcePickerSchemaParams = z.object({
|
|
24
|
+
resource: z.string(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export interface IResourcePickerPageOptions extends Record<string, unknown> {
|
|
28
|
+
resource: string;
|
|
29
|
+
actionPath?: string;
|
|
30
|
+
query?: ITableQuery;
|
|
31
|
+
selectionMode: 'single' | 'multiple';
|
|
32
|
+
selectionMax?: number;
|
|
33
|
+
selectedIds?: readonly TableIdentity[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface IResourcePickerPageSession {
|
|
37
|
+
selectedIds: TableIdentity[];
|
|
38
|
+
selectedRows: Record<string, unknown>[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IResourcePickerPageContext {
|
|
42
|
+
options: IResourcePickerPageOptions;
|
|
43
|
+
session: IResourcePickerPageSession;
|
|
44
|
+
dialog: IRoutedDialogContext<
|
|
45
|
+
IResourceTableSelectionPayload,
|
|
46
|
+
IResourcePickerPageOptions,
|
|
47
|
+
IResourcePickerPageSession
|
|
48
|
+
>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Controller()
|
|
52
|
+
export class ControllerPageResourcePicker extends BeanControllerPageBase {
|
|
53
|
+
jsxZova: ZovaJsx;
|
|
54
|
+
|
|
55
|
+
@Use({ beanFullName: 'rest-resource.model.resource' })
|
|
56
|
+
get $$modelResource(): ModelResource {
|
|
57
|
+
return usePrepareArg(this.resource, true);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Use({ name: routedDialogContextKey, injectionScope: 'host' })
|
|
61
|
+
$$routedDialogContext: IRoutedDialogContext<
|
|
62
|
+
IResourceTableSelectionPayload,
|
|
63
|
+
IResourcePickerPageOptions,
|
|
64
|
+
IResourcePickerPageSession
|
|
65
|
+
>;
|
|
66
|
+
|
|
67
|
+
get resource() {
|
|
68
|
+
return this.$params.resource;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get pickerContext(): IResourcePickerPageContext {
|
|
72
|
+
const options = this.$$routedDialogContext.props;
|
|
73
|
+
const session = this.$$routedDialogContext.session;
|
|
74
|
+
if (!options || !session || options.resource !== this.resource) {
|
|
75
|
+
throw new Error('resource picker context does not match route resource');
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
options,
|
|
79
|
+
session,
|
|
80
|
+
dialog: this.$$routedDialogContext,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected async __init__() {
|
|
85
|
+
this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false);
|
|
86
|
+
await $QueryEnsureLoaded(() => this.$$modelResource.apiSchemasSelect.sdk);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get schemaRow() {
|
|
90
|
+
return this.$$modelResource.schemaRow;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public render() {
|
|
94
|
+
const blocks = this._prepareBlocks(this.schemaRow?.rest?.blocks);
|
|
95
|
+
if (!blocks || blocks.length === 0) return;
|
|
96
|
+
const domBlocks: VNode[] = [];
|
|
97
|
+
blocks.forEach((block, index) => {
|
|
98
|
+
const options = deepExtend({ key: index }, { resource: this.resource }, block.options);
|
|
99
|
+
const domBlock = this.jsxZova.render(block.render!, options);
|
|
100
|
+
if (!domBlock) return;
|
|
101
|
+
if (Array.isArray(domBlock)) domBlocks.push(...domBlock);
|
|
102
|
+
else domBlocks.push(domBlock);
|
|
103
|
+
});
|
|
104
|
+
return (
|
|
105
|
+
<ZResourcePickerContext context={this.pickerContext}>
|
|
106
|
+
<ZPage>{domBlocks}</ZPage>
|
|
107
|
+
</ZResourcePickerContext>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private _prepareBlocks(blocks: IResourceRenderBlockOptionsBlock[] | undefined) {
|
|
112
|
+
if (!blocks) return;
|
|
113
|
+
return blocks.map(block => {
|
|
114
|
+
if (block.render !== 'basic-page:blockPage') return block;
|
|
115
|
+
const pickerContext = this.pickerContext;
|
|
116
|
+
return {
|
|
117
|
+
...block,
|
|
118
|
+
options: deepExtend({}, block.options, {
|
|
119
|
+
actionPath: pickerContext.options.actionPath,
|
|
120
|
+
queryFixed: pickerContext.options.query,
|
|
121
|
+
selectionPolicy: 'always',
|
|
122
|
+
selectionMode: pickerContext.options.selectionMode,
|
|
123
|
+
selectionMax: pickerContext.options.selectionMax,
|
|
124
|
+
selectedIds: pickerContext.session.selectedIds,
|
|
125
|
+
selectedRows: pickerContext.session.selectedRows,
|
|
126
|
+
onSelectionChange: (selection: IResourceTableSelectionPayload) => {
|
|
127
|
+
pickerContext.session.selectedIds = [...selection.ids];
|
|
128
|
+
pickerContext.session.selectedRows = selection.rows.map(row => ({ ...row }));
|
|
129
|
+
},
|
|
130
|
+
blocks: [
|
|
131
|
+
...((
|
|
132
|
+
block.options as IResourceBlockOptionsBase & {
|
|
133
|
+
blocks?: IResourceRenderBlockOptionsBlock[];
|
|
134
|
+
}
|
|
135
|
+
).blocks ?? []),
|
|
136
|
+
{
|
|
137
|
+
render: 'basic-resource:blockResourcePickerActions',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
}),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { IModuleRoute } from 'zova-module-a-router';
|
|
|
3
3
|
import { ZPageEntry } from './.metadata/page/entry.js';
|
|
4
4
|
import { ZPageEntryCreate } from './.metadata/page/entryCreate.js';
|
|
5
5
|
import { ZPageResource } from './.metadata/page/resource.js';
|
|
6
|
+
import { ZPageResourcePicker } from './.metadata/page/resourcePicker.js';
|
|
6
7
|
import { resourceRouteMeta, resourceTabKey } from './lib/resourceRouteMeta.js';
|
|
7
8
|
|
|
8
9
|
export const routes: IModuleRoute[] = [
|
|
@@ -21,6 +22,14 @@ export const routes: IModuleRoute[] = [
|
|
|
21
22
|
ssrProfile: 'session',
|
|
22
23
|
},
|
|
23
24
|
},
|
|
25
|
+
{
|
|
26
|
+
name: 'resourcePicker',
|
|
27
|
+
path: ':resource/picker',
|
|
28
|
+
component: ZPageResourcePicker,
|
|
29
|
+
meta: {
|
|
30
|
+
ssrProfile: 'session',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
24
33
|
{
|
|
25
34
|
name: 'entry',
|
|
26
35
|
path: ':resource/:id/:formScene?',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-suite-a-cabloy",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.54",
|
|
4
4
|
"gitHead": "4dece229b6d3f4735930e833afcb4b95ec51bf86",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"zova-module-a-rbac": "^5.0.1",
|
|
11
|
-
"zova-module-rest-resource": "^5.1.
|
|
11
|
+
"zova-module-rest-resource": "^5.1.53"
|
|
12
12
|
},
|
|
13
13
|
"title": "a-cabloy"
|
|
14
14
|
}
|
package/zova/src/suite-vendor/a-zova/modules/a-bean/cli/controller/metadata/generateFileComponent.ts
CHANGED
|
@@ -13,6 +13,7 @@ export async function generateFileComponent(
|
|
|
13
13
|
const { moduleName } = options;
|
|
14
14
|
const { className } = globFile;
|
|
15
15
|
const {
|
|
16
|
+
type,
|
|
16
17
|
name,
|
|
17
18
|
nameCapitalize,
|
|
18
19
|
controllerExtJs,
|
|
@@ -63,6 +64,12 @@ export async function generateFileComponent(
|
|
|
63
64
|
`import type { ${_contentImportTypeController.join(', ')} } from '../../component/${name}/controller${controllerExtJs}';`,
|
|
64
65
|
);
|
|
65
66
|
}
|
|
67
|
+
if (type === 'component' && name === 'routedDialog') {
|
|
68
|
+
contentImports.push(
|
|
69
|
+
"import { routeLocationKey, routerKey, routerViewLocationKey, viewDepthKey } from '@cabloy/vue-router';",
|
|
70
|
+
"import { computed, provide, shallowReactive } from 'vue';",
|
|
71
|
+
);
|
|
72
|
+
}
|
|
66
73
|
contentImports.push("import { defineComponent } from 'vue'");
|
|
67
74
|
contentImports.push("import { prepareComponentOptions, useController } from 'zova';");
|
|
68
75
|
// controller
|
|
@@ -137,7 +144,39 @@ export async function generateFileComponent(
|
|
|
137
144
|
}`;
|
|
138
145
|
}
|
|
139
146
|
// component
|
|
140
|
-
const contentComponent =
|
|
147
|
+
const contentComponent =
|
|
148
|
+
type === 'component' && name === 'routedDialog'
|
|
149
|
+
? `export const Z${nameCapitalize} = defineComponent(
|
|
150
|
+
${genericDeclare}(props: ${typeControllerPublicPropsName}${genericArguments}) => {
|
|
151
|
+
const router = props.item.state.router;
|
|
152
|
+
if (router) {
|
|
153
|
+
const currentRoute = router.currentRoute;
|
|
154
|
+
const reactiveRoute = {} as Record<string, unknown>;
|
|
155
|
+
for (const key in currentRoute.value) {
|
|
156
|
+
Object.defineProperty(reactiveRoute, key, {
|
|
157
|
+
get: () => currentRoute.value[key],
|
|
158
|
+
enumerable: true,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
provide(routerKey, router.router);
|
|
162
|
+
provide(routeLocationKey, shallowReactive(reactiveRoute) as any);
|
|
163
|
+
provide(routerViewLocationKey, currentRoute);
|
|
164
|
+
provide(
|
|
165
|
+
viewDepthKey,
|
|
166
|
+
computed(() => router.getEmbeddedRouterViewDepth(currentRoute.value)),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
|
|
170
|
+
return () => {};
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
...prepareComponentOptions(${componentOptions}),
|
|
174
|
+
props: {
|
|
175
|
+
item: { type: Object, required: true },
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
);`
|
|
179
|
+
: `export const Z${nameCapitalize} = defineComponent(
|
|
141
180
|
${genericDeclare}(_props: ${typeControllerPublicPropsName}${genericArguments}) => {
|
|
142
181
|
useController(${className}, ${hasRenderFirst ? classNameRenderFirst : undefined}, ${hasStyleFirst ? classNameStyleFirst : undefined});
|
|
143
182
|
return () => {};
|
|
@@ -39,6 +39,10 @@ export class BeanRouterViewBase extends BeanControllerBase implements IRouterVie
|
|
|
39
39
|
throw new Error('Not Implemented');
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
protected getPageHostProviders(): Record<string, unknown> | undefined {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
protected render() {
|
|
43
47
|
const slots = {
|
|
44
48
|
default: (component: IRouterViewSlotParams) => {
|
|
@@ -50,6 +54,7 @@ export class BeanRouterViewBase extends BeanControllerBase implements IRouterVie
|
|
|
50
54
|
route: component.route,
|
|
51
55
|
});
|
|
52
56
|
cast(vnode).zovaHostProviders = {
|
|
57
|
+
...this.getPageHostProviders(),
|
|
53
58
|
[pageRouteKey]: component.route,
|
|
54
59
|
'a-router.bean.router': this.$router,
|
|
55
60
|
};
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import type { ModelStack } from '../../model/stack.js';
|
|
11
11
|
|
|
12
|
-
export interface ControllerRouterViewStackProps extends IRouterViewPropsBase {
|
|
12
|
+
export interface ControllerRouterViewStackProps extends IRouterViewPropsBase {
|
|
13
|
+
pageHostProviders?: Record<string, unknown>;
|
|
14
|
+
}
|
|
13
15
|
|
|
14
16
|
@Controller()
|
|
15
17
|
export class ControllerRouterViewStack extends BeanRouterViewBase {
|
|
@@ -35,4 +37,8 @@ export class ControllerRouterViewStack extends BeanRouterViewBase {
|
|
|
35
37
|
protected getKeepAliveInclude(): string[] | undefined {
|
|
36
38
|
return this.$$modelStack.keepAliveInclude;
|
|
37
39
|
}
|
|
40
|
+
|
|
41
|
+
protected getPageHostProviders(): Record<string, unknown> | undefined {
|
|
42
|
+
return this.$props.pageHostProviders;
|
|
43
|
+
}
|
|
38
44
|
}
|
|
@@ -57,6 +57,7 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
57
57
|
sorting?: SortingState;
|
|
58
58
|
onSortingChange?: OnChangeFn<SortingState>;
|
|
59
59
|
enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
|
|
60
|
+
selectionMode?: 'single' | 'multiple';
|
|
60
61
|
rowSelection?: RowSelectionState;
|
|
61
62
|
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
62
63
|
tableScope?: ITableScope;
|
|
@@ -139,6 +140,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
139
140
|
enableMultiSort: false,
|
|
140
141
|
enableSortingRemoval: false,
|
|
141
142
|
enableRowSelection: row => self._canSelectRow(row),
|
|
143
|
+
enableMultiRowSelection: this.$props.selectionMode !== 'single',
|
|
142
144
|
state: {
|
|
143
145
|
get sorting() {
|
|
144
146
|
return self.sorting;
|
|
@@ -25,6 +25,7 @@ export class RenderTable extends BeanRenderBase {
|
|
|
25
25
|
|
|
26
26
|
private _renderTableDefault() {
|
|
27
27
|
const table = this.table;
|
|
28
|
+
const selectionMode = this.$props.selectionMode ?? 'multiple';
|
|
28
29
|
return (
|
|
29
30
|
<table class="table">
|
|
30
31
|
<thead>
|
|
@@ -37,15 +38,17 @@ export class RenderTable extends BeanRenderBase {
|
|
|
37
38
|
const headerDefinition = column.columnDef.header;
|
|
38
39
|
const selection = column.id === TableColumnIdSelection;
|
|
39
40
|
const headerContent = selection ? (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
selectionMode === 'single' ? null : (
|
|
42
|
+
<input
|
|
43
|
+
type="checkbox"
|
|
44
|
+
checked={table.getIsAllPageRowsSelected()}
|
|
45
|
+
indeterminate={table.getIsSomePageRowsSelected()}
|
|
46
|
+
aria-checked={table.getIsSomePageRowsSelected() ? 'mixed' : undefined}
|
|
47
|
+
aria-label="Select all rows on this page"
|
|
48
|
+
disabled={table.getRowModel().rows.every(row => !row.getCanSelect())}
|
|
49
|
+
onChange={table.getToggleAllPageRowsSelectedHandler()}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
49
52
|
) : (
|
|
50
53
|
<FlexRender render={headerDefinition} props={header.getContext()}></FlexRender>
|
|
51
54
|
);
|
|
@@ -98,7 +101,7 @@ export class RenderTable extends BeanRenderBase {
|
|
|
98
101
|
>
|
|
99
102
|
{selection ? (
|
|
100
103
|
<input
|
|
101
|
-
type=
|
|
104
|
+
type={selectionMode === 'single' ? 'radio' : 'checkbox'}
|
|
102
105
|
checked={row.getIsSelected()}
|
|
103
106
|
disabled={!row.getCanSelect()}
|
|
104
107
|
aria-label={`Select row ${row.id}`}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-suite-a-zova",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.159",
|
|
4
4
|
"gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
|
|
5
5
|
"description": "zova",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"zova-module-a-api": "^5.1.22",
|
|
12
12
|
"zova-module-a-app": "^5.1.26",
|
|
13
|
-
"zova-module-a-bean": "^5.1.
|
|
13
|
+
"zova-module-a-bean": "^5.1.34",
|
|
14
14
|
"zova-module-a-behavior": "^5.1.26",
|
|
15
15
|
"zova-module-a-behaviors": "^5.1.22",
|
|
16
16
|
"zova-module-a-boundary": "^5.1.22",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"zova-module-a-meta": "^5.1.22",
|
|
24
24
|
"zova-module-a-model": "^5.1.36",
|
|
25
25
|
"zova-module-a-openapi": "^5.1.53",
|
|
26
|
-
"zova-module-a-router": "^5.1.
|
|
27
|
-
"zova-module-a-routerstack": "^5.1.
|
|
26
|
+
"zova-module-a-router": "^5.1.36",
|
|
27
|
+
"zova-module-a-routerstack": "^5.1.28",
|
|
28
28
|
"zova-module-a-routertabs": "^5.1.34",
|
|
29
29
|
"zova-module-a-ssr": "^5.1.38",
|
|
30
30
|
"zova-module-a-ssrhmr": "^5.1.23",
|
|
31
31
|
"zova-module-a-ssrserver": "^5.1.26",
|
|
32
32
|
"zova-module-a-style": "^5.1.35",
|
|
33
|
-
"zova-module-a-table": "^5.1.
|
|
33
|
+
"zova-module-a-table": "^5.1.41",
|
|
34
34
|
"zova-module-a-zod": "^5.1.37",
|
|
35
35
|
"zova-module-a-zova": "^5.1.104"
|
|
36
36
|
},
|