zova-module-rest-resource 5.1.13 → 5.1.17
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/dist/index.js +18 -26
- package/dist/index.js.map +1 -1
- package/dist/model/resource.d.ts +3 -4
- package/dist/model/resource.d.ts.map +1 -1
- package/dist/page/entry/controller.d.ts.map +1 -1
- package/dist/page/resource/controller.d.ts +0 -2
- package/dist/page/resource/controller.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/model/resource.ts +14 -18
- package/src/page/entry/controller.tsx +5 -6
- package/src/page/resource/controller.tsx +2 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanControllerPageBase, BeanInfo, BeanScopeBase, Use, createZovaComponentAsync, createZovaComponentPage, deepExtend, usePrepareArg } from "zova";
|
|
1
|
+
import { BeanControllerPageBase, BeanInfo, BeanScopeBase, Use, UseScope, createZovaComponentAsync, createZovaComponentPage, deepExtend, usePrepareArg } from "zova";
|
|
2
2
|
import { hashkey, isNil } from "@cabloy/utils";
|
|
3
3
|
import { formMetaFromFormScene, formSceneFromFormMeta } from "zova-module-a-form";
|
|
4
4
|
import { $QueryAutoLoad, BeanModelBase, Model } from "zova-module-a-model";
|
|
@@ -26,51 +26,47 @@ function _applyDecoratedDescriptor$2(i, e, r, n, l) {
|
|
|
26
26
|
return n(i, e, r) || r;
|
|
27
27
|
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
28
28
|
}
|
|
29
|
-
var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInfo({ module: "rest-resource" }), _dec3$3 =
|
|
29
|
+
var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInfo({ module: "rest-resource" }), _dec3$3 = UseScope("a-openapi"), _dec4$2 = Reflect.metadata("design:type", typeof ScopeModuleAOpenapi === "undefined" ? Object : ScopeModuleAOpenapi), _dec$4(_class$4 = _dec2$4(_class$4 = (_class2$2 = class ModelResource extends BeanModelBase {
|
|
30
30
|
constructor(...args) {
|
|
31
31
|
super(...args);
|
|
32
32
|
this.resource = void 0;
|
|
33
33
|
this.resourceApi = void 0;
|
|
34
34
|
this.permissions = void 0;
|
|
35
35
|
this.formProvider = void 0;
|
|
36
|
-
this.tableProvider = void 0;
|
|
37
36
|
this.schemaView = void 0;
|
|
38
37
|
this.schemaCreate = void 0;
|
|
39
38
|
this.schemaUpdate = void 0;
|
|
40
39
|
this.schemaFilter = void 0;
|
|
41
40
|
this.schemaRow = void 0;
|
|
42
41
|
this.schemaPages = void 0;
|
|
43
|
-
_initializerDefineProperty(this, "$$
|
|
42
|
+
_initializerDefineProperty(this, "$$scopeOpenapi", _descriptor, this);
|
|
44
43
|
}
|
|
45
44
|
async __init__(resource) {
|
|
46
45
|
if (!resource) throw new Error("resource not specified");
|
|
47
46
|
await super.__init__(resource);
|
|
48
47
|
this.resource = resource;
|
|
49
|
-
this.permissions = this.$
|
|
48
|
+
this.permissions = this.$computed(() => {
|
|
50
49
|
return this.$sdk.getPermissions(this.resource).data;
|
|
51
50
|
});
|
|
52
|
-
this.formProvider = this.$
|
|
53
|
-
return this.$$
|
|
51
|
+
this.formProvider = this.$computed(() => {
|
|
52
|
+
return this.$$scopeOpenapi.config.formProvider;
|
|
54
53
|
});
|
|
55
|
-
this.
|
|
56
|
-
return this.$$beanResourceProviders.tableProvider;
|
|
57
|
-
});
|
|
58
|
-
this.schemaView = this.$useComputed(() => {
|
|
54
|
+
this.schemaView = this.$computed(() => {
|
|
59
55
|
return this.apiSchemasView.responseBody;
|
|
60
56
|
});
|
|
61
|
-
this.schemaCreate = this.$
|
|
57
|
+
this.schemaCreate = this.$computed(() => {
|
|
62
58
|
return this.apiSchemasCreate.requestBody;
|
|
63
59
|
});
|
|
64
|
-
this.schemaUpdate = this.$
|
|
60
|
+
this.schemaUpdate = this.$computed(() => {
|
|
65
61
|
return this.apiSchemasUpdate.requestBody;
|
|
66
62
|
});
|
|
67
|
-
this.schemaFilter = this.$
|
|
63
|
+
this.schemaFilter = this.$computed(() => {
|
|
68
64
|
return this.apiSchemasSelect.filter;
|
|
69
65
|
});
|
|
70
|
-
this.schemaRow = this.$
|
|
66
|
+
this.schemaRow = this.$computed(() => {
|
|
71
67
|
return this.apiSchemasSelect.row;
|
|
72
68
|
});
|
|
73
|
-
this.schemaPages = this.$
|
|
69
|
+
this.schemaPages = this.$computed(() => {
|
|
74
70
|
return this.apiSchemasSelect.paged;
|
|
75
71
|
});
|
|
76
72
|
await this._bootstrap();
|
|
@@ -181,7 +177,7 @@ var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInf
|
|
|
181
177
|
if (!queryBootstrap?.data) throw new Error(`not found sdk of resource: ${this.resource}`);
|
|
182
178
|
this.resourceApi = this.sys.util.parseResourceApi(this.resource, queryBootstrap.data.apiPath);
|
|
183
179
|
}
|
|
184
|
-
}, _descriptor = _applyDecoratedDescriptor$2(_class2$2.prototype, "$$
|
|
180
|
+
}, _descriptor = _applyDecoratedDescriptor$2(_class2$2.prototype, "$$scopeOpenapi", [_dec3$3, _dec4$2], {
|
|
185
181
|
configurable: true,
|
|
186
182
|
enumerable: true,
|
|
187
183
|
writable: true,
|
|
@@ -228,24 +224,24 @@ var ControllerPageEntry = (_dec$3 = Controller(), _dec2$3 = BeanInfo({ module: "
|
|
|
228
224
|
return this.$params.formScene ?? (isNil(this.entryId) ? "create" : "view");
|
|
229
225
|
}
|
|
230
226
|
async __init__() {
|
|
231
|
-
this.formMeta = this.$
|
|
227
|
+
this.formMeta = this.$computed(() => {
|
|
232
228
|
const formScene = this.formScene;
|
|
233
229
|
return {
|
|
234
230
|
...formMetaFromFormScene(formScene),
|
|
235
231
|
formScene
|
|
236
232
|
};
|
|
237
233
|
});
|
|
238
|
-
this.formProvider = this.$
|
|
234
|
+
this.formProvider = this.$computed(() => {
|
|
239
235
|
return this.$$modelResource.formProvider;
|
|
240
236
|
});
|
|
241
|
-
this.formSchema = this.$
|
|
237
|
+
this.formSchema = this.$computed(() => {
|
|
242
238
|
return this.$$modelResource.getFormSchema(this.formMeta);
|
|
243
239
|
});
|
|
244
240
|
this._prepareJsx();
|
|
245
241
|
await $QueryAutoLoad(() => this.$$modelResource.getFormApiSchemas(this.formMeta)?.sdk);
|
|
246
242
|
}
|
|
247
243
|
_prepareJsx() {
|
|
248
|
-
this.jsxZova = this.
|
|
244
|
+
this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components);
|
|
249
245
|
}
|
|
250
246
|
render() {
|
|
251
247
|
const blocks = this.formSchema?.rest?.blocks;
|
|
@@ -293,7 +289,6 @@ var ControllerPageResourceSchemaParams = z.object({ resource: z.string() });
|
|
|
293
289
|
var ControllerPageResource = (_dec$1 = Controller(), _dec2$1 = BeanInfo({ module: "rest-resource" }), _dec3 = Use({ beanFullName: "rest-resource.model.resource" }), _dec4 = Reflect.metadata("design:type", Function), _dec5 = Reflect.metadata("design:paramtypes", []), _dec$1(_class$1 = _dec2$1(_class$1 = (_class2 = class ControllerPageResource extends BeanControllerPageBase {
|
|
294
290
|
constructor(...args) {
|
|
295
291
|
super(...args);
|
|
296
|
-
this.tableProvider = void 0;
|
|
297
292
|
this.jsxZova = void 0;
|
|
298
293
|
}
|
|
299
294
|
get $$modelResource() {
|
|
@@ -303,14 +298,11 @@ var ControllerPageResource = (_dec$1 = Controller(), _dec2$1 = BeanInfo({ module
|
|
|
303
298
|
return this.$params.resource;
|
|
304
299
|
}
|
|
305
300
|
async __init__() {
|
|
306
|
-
this.tableProvider = this.$useComputed(() => {
|
|
307
|
-
return this.$$modelResource.tableProvider;
|
|
308
|
-
});
|
|
309
301
|
this._prepareJsx();
|
|
310
302
|
await $QueryAutoLoad(() => this.$$modelResource.apiSchemasSelect.sdk);
|
|
311
303
|
}
|
|
312
304
|
_prepareJsx() {
|
|
313
|
-
this.jsxZova = this.
|
|
305
|
+
this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false);
|
|
314
306
|
}
|
|
315
307
|
get schemaRow() {
|
|
316
308
|
return this.$$modelResource.schemaRow;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isNil","z","BeanControllerPageBase","deepExtend","Use","usePrepareArg","ZovaJsx","Controller","formMetaFromFormScene","$QueryAutoLoad","_isSlot","s","Object","prototype","toString","call","_isVNode","ControllerPageEntrySchemaParams","object","resource","string","id","optional","formScene","ControllerPageEntry","_dec","_dec2","__z_BeanInfo","module","_dec3","beanFullName","_dec4","Reflect","metadata","Function","_dec5","_class","_class2","constructor","args","formMeta","formProvider","formSchema","jsxZova","$$modelResource","$params","entryId","__init__","$useComputed","getFormSchema","_prepareJsx","getFormApiSchemas","sdk","app","bean","_newBeanSimple","components","render","blocks","rest","length","domBlocks","forEach","block","index","options","key","domBlock","Array","isArray","push","_createVNode","ZPage","default","_applyDecoratedDescriptor","getOwnPropertyDescriptor","Virtual","Controller","ControllerPageEntry","ControllerPageEntrySchemaParams","ControllerPageEntryCreateSchemaParams","ControllerPageEntryCreate","_dec","_dec2","_dec3","__z_BeanInfo","module","_class","z","BeanControllerPageBase","deepExtend","Use","usePrepareArg","ZovaJsx","Controller","$QueryAutoLoad","_isSlot","s","Object","prototype","toString","call","_isVNode","ControllerPageResourceSchemaParams","object","resource","string","ControllerPageResource","_dec","_dec2","__z_BeanInfo","module","_dec3","beanFullName","_dec4","Reflect","metadata","Function","_dec5","_class","_class2","constructor","args","tableProvider","jsxZova","$$modelResource","$params","__init__","$useComputed","_prepareJsx","apiSchemasSelect","sdk","app","bean","_newBeanSimple","components","schemaRow","render","blocks","rest","length","domBlocks","forEach","block","index","options","key","domBlock","Array","isArray","push","_createVNode","ZPage","default","_applyDecoratedDescriptor","getOwnPropertyDescriptor"],"sources":["../src/model/resource.ts","../src/page/entry/controller.tsx","../src/page/entryCreate/controller.tsx","../src/page/resource/controller.tsx","../src/.metadata/page/entry.ts","../src/.metadata/page/entryCreate.ts","../src/.metadata/page/resource.ts","../src/routes.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { TableIdentity } from 'table-identity';\nimport type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';\nimport type { IFormMeta, IFormProvider, ITableProvider, ITableQuery, ITableRes, TypeOpenapiPermissions } from 'zova-module-a-openapi';\n\nimport { hashkey, isNil } from '@cabloy/utils';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { Use } from 'zova';\nimport { formSceneFromFormMeta } from 'zova-module-a-form';\nimport { $QueryAutoLoad, BeanModelBase, Model } from 'zova-module-a-model';\nimport { BeanResourceProviders, SymbolOpenapiSchemaName } from 'zova-module-a-openapi';\n\nexport interface IModelOptionsResource extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsResource>({\n enableSelector: true,\n})\nexport class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityUpdate = Partial<Entity>> extends BeanModelBase {\n public resource: string;\n public resourceApi: string;\n public permissions?: TypeOpenapiPermissions;\n public formProvider: IFormProvider;\n public tableProvider: ITableProvider;\n public schemaView?: SchemaObject;\n public schemaCreate?: SchemaObject;\n public schemaUpdate?: SchemaObject;\n public schemaFilter?: SchemaObject;\n public schemaRow?: SchemaObject;\n public schemaPages?: SchemaObject;\n\n @Use()\n $$beanResourceProviders: BeanResourceProviders;\n\n protected async __init__(resource: string) {\n if (!resource) throw new Error('resource not specified');\n await super.__init__(resource);\n this.resource = resource;\n this.permissions = this.$useComputed(() => {\n const permissions = this.$sdk.getPermissions(this.resource);\n return permissions.data;\n });\n this.formProvider = this.$useComputed(() => {\n return this.$$beanResourceProviders.formProvider;\n });\n this.tableProvider = this.$useComputed(() => {\n return this.$$beanResourceProviders.tableProvider;\n });\n this.schemaView = this.$useComputed(() => {\n return this.apiSchemasView.responseBody;\n });\n this.schemaCreate = this.$useComputed(() => {\n return this.apiSchemasCreate.requestBody;\n });\n this.schemaUpdate = this.$useComputed(() => {\n return this.apiSchemasUpdate.requestBody;\n });\n this.schemaFilter = this.$useComputed(() => {\n return this.apiSchemasSelect.filter;\n });\n this.schemaRow = this.$useComputed(() => {\n return this.apiSchemasSelect.row;\n });\n this.schemaPages = this.$useComputed(() => {\n return this.apiSchemasSelect.paged;\n });\n // bootstrap\n await this._bootstrap();\n }\n\n selectGeneral(actionPath?: string, query?: ITableQuery) {\n const queryHash = hashkey(query);\n return this.$useStateData({\n queryKey: ['select', actionPath ?? '', queryHash],\n queryFn: async () => {\n const apiPath = actionPath ? `${this.resourceApi}/${actionPath}` : this.resourceApi;\n return this.$fetch.get<any, ITableRes<Entity>>(\n this.sys.util.apiActionPathTranslate(apiPath),\n this.sys.util.apiActionConfigPrepare(undefined, { query }),\n );\n },\n });\n }\n\n select(query?: ITableQuery) {\n return this.selectGeneral(undefined, query);\n }\n\n view(id: TableIdentity) {\n if (isNil(id)) throw new Error('row id cannot empty');\n return this.$useStateData({\n queryKey: ['get', id],\n queryFn: async () => {\n const res = await this.$fetch.get<any, Entity>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n this.sys.util.apiActionConfigPrepare(),\n );\n return res ?? null;\n },\n });\n }\n\n create() {\n return this.$useMutationData<void, EntityCreate>({\n mutationKey: ['create'],\n mutationFn: async params => {\n return this.$fetch.post<any, void, EntityCreate>(\n this.sys.util.apiActionPathTranslate(this.resourceApi),\n params,\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n },\n });\n }\n\n update(id: TableIdentity) {\n return this.$useMutationData<void, EntityUpdate>({\n mutationKey: ['update', id],\n mutationFn: async params => {\n return this.$fetch.patch<any, void, EntityUpdate>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n params,\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n this.$invalidateQueries({ queryKey: ['get', id] });\n },\n });\n }\n\n delete(id: TableIdentity) {\n return this.$useMutationData<void, void>({\n mutationKey: ['delete', id],\n mutationFn: async () => {\n return this.$fetch.delete<any, void, void>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n this.$invalidateQueries({ queryKey: ['get', id] });\n },\n });\n }\n\n public get apiSchemasSelect() {\n return this.$sdk.createApiSchemas(this.resourceApi, 'get');\n }\n\n public get apiSchemasView() {\n return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, 'get');\n }\n\n public get apiSchemasCreate() {\n return this.$sdk.createApiSchemas(this.resourceApi, 'post');\n }\n\n public get apiSchemasUpdate() {\n return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, 'patch');\n }\n\n public getFormSchema(formMeta: IFormMeta) {\n const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);\n if (formScene === 'view') return this.schemaView;\n if (formScene === 'create') return this.schemaCreate;\n if (formScene === 'edit') return this.schemaUpdate;\n }\n\n public getFormApiSchemas(formMeta: IFormMeta) {\n const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);\n if (formScene === 'view') return this.apiSchemasView;\n if (formScene === 'create') return this.apiSchemasCreate;\n if (formScene === 'edit') return this.apiSchemasUpdate;\n throw new Error('invalid parameters');\n }\n\n public getFormMutationSubmit(formMeta: IFormMeta, id?: TableIdentity): DataMutation | undefined {\n if (formMeta.formMode !== 'edit') return;\n if (formMeta.editMode === 'create') {\n return this.create() as any;\n } else if (formMeta.editMode === 'update') {\n return this.update(id!) as any;\n }\n }\n\n public getFormData(formMeta: IFormMeta, id?: TableIdentity): Entity | EntityCreate | EntityUpdate | undefined {\n if (formMeta.formMode === 'edit' && formMeta.editMode === 'create') {\n return this.getQueryDataDefaultValue(this.schemaCreate);\n }\n if (isNil(id)) return undefined;\n return this.view(id).data as Entity | EntityUpdate | undefined;\n }\n\n public getQueryDataDefaultValue(schemaName?: SchemaObject | string): EntityCreate | undefined {\n if (!schemaName) return;\n if (typeof schemaName === 'object') {\n schemaName = schemaName[SymbolOpenapiSchemaName] as string;\n }\n return this.$sdk.getSchemaDefaultValue(schemaName) as EntityCreate | undefined;\n }\n\n private async _bootstrap() {\n const queryBootstrap = await $QueryAutoLoad(() => this.$sdk.getBootstrap(this.resource));\n if (!queryBootstrap?.data) {\n throw new Error(`not found sdk of resource: ${this.resource}`);\n }\n this.resourceApi = this.sys.util.parseResourceApi(this.resource, queryBootstrap.data.apiPath);\n }\n}\n","import type { IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-openapi';\n\nimport { isNil } from '@cabloy/utils';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { VNode } from 'vue';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { formMetaFromFormScene } from 'zova-module-a-form';\nimport { $QueryAutoLoad } from 'zova-module-a-model';\nimport { IResourceBlockOptionsPageEntry } from 'zova-module-basic-openapi';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nexport const ControllerPageEntrySchemaParams = z.object({\n resource: z.string(),\n id: z.string().optional(),\n formScene: z.string().optional(),\n});\n\n@Controller()\nexport class ControllerPageEntry extends BeanControllerPageBase {\n formMeta: IFormMeta;\n formProvider: IFormProvider;\n formSchema?: SchemaObject;\n jsxZova: ZovaJsx;\n\n @Use({ beanFullName: 'rest-resource.model.resource' })\n get $$modelResource(): ModelResource {\n return usePrepareArg(this.$params.resource, true);\n }\n\n get resource() {\n return this.$params.resource;\n }\n\n get entryId() {\n return this.$params.id;\n }\n\n get formScene() {\n return (this.$params.formScene as TypeFormScene | undefined) ?? (isNil(this.entryId) ? 'create' : 'view');\n }\n\n protected async __init__() {\n this.formMeta = this.$useComputed(() => {\n const formScene = this.formScene;\n return { ...formMetaFromFormScene(formScene), formScene };\n });\n this.formProvider = this.$useComputed(() => {\n return this.$$modelResource.formProvider;\n });\n this.formSchema = this.$useComputed(() => {\n return this.$$modelResource.getFormSchema(this.formMeta);\n });\n // jsx\n this._prepareJsx();\n // load schema\n await $QueryAutoLoad(() => this.$$modelResource.getFormApiSchemas(this.formMeta)?.sdk);\n }\n\n private _prepareJsx() {\n this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components);\n }\n\n protected render() {\n const blocks = this.formSchema?.rest?.blocks;\n if (!blocks || blocks.length === 0) return;\n let domBlocks: VNode[] = [];\n blocks.forEach((block, index) => {\n const options = deepExtend(\n { key: index },\n {\n resource: this.resource,\n id: this.entryId,\n formScene: this.formScene,\n } satisfies IResourceBlockOptionsPageEntry,\n block.options,\n );\n const domBlock = this.jsxZova.render(block.render!, options);\n if (!domBlock) return;\n if (Array.isArray(domBlock)) {\n domBlocks.push(...domBlock);\n } else {\n domBlocks.push(domBlock);\n }\n });\n return <ZPage>{domBlocks}</ZPage>;\n }\n}\n","import { Virtual } from 'zova-core';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { ControllerPageEntry, ControllerPageEntrySchemaParams } from '../entry/controller.jsx';\n\nexport const ControllerPageEntryCreateSchemaParams = ControllerPageEntrySchemaParams;\n\n@Controller()\n@Virtual()\nexport class ControllerPageEntryCreate extends ControllerPageEntry {}\n","import { VNode } from 'vue';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { $QueryAutoLoad } from 'zova-module-a-model';\nimport { ITableProvider } from 'zova-module-a-openapi';\nimport { IResourceBlockOptionsPage } from 'zova-module-basic-openapi';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nexport const ControllerPageResourceSchemaParams = z.object({\n resource: z.string(),\n});\n\n@Controller()\nexport class ControllerPageResource extends BeanControllerPageBase {\n tableProvider: ITableProvider;\n\n jsxZova: ZovaJsx;\n\n @Use({ beanFullName: 'rest-resource.model.resource' })\n get $$modelResource(): ModelResource {\n return usePrepareArg(this.$params.resource, true);\n }\n\n get resource() {\n return this.$params.resource;\n }\n\n protected async __init__() {\n this.tableProvider = this.$useComputed(() => {\n return this.$$modelResource.tableProvider;\n });\n // jsx\n this._prepareJsx();\n // load schema/data\n await $QueryAutoLoad(() => this.$$modelResource.apiSchemasSelect.sdk);\n }\n\n private _prepareJsx() {\n this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components);\n }\n\n get schemaRow() {\n return this.$$modelResource.schemaRow;\n }\n\n public render() {\n const blocks = this.schemaRow?.rest?.blocks;\n if (!blocks || blocks.length === 0) return;\n let domBlocks: VNode[] = [];\n blocks.forEach((block, index) => {\n const options = deepExtend(\n { key: index },\n {\n resource: this.resource,\n } satisfies IResourceBlockOptionsPage,\n block.options,\n );\n const domBlock = this.jsxZova.render(block.render!, options);\n if (!domBlock) return;\n if (Array.isArray(domBlock)) {\n domBlocks.push(...domBlock);\n } else {\n domBlocks.push(domBlock);\n }\n });\n return <ZPage>{domBlocks}</ZPage>;\n }\n}\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageEntry } from '../../page/entry/controller.jsx';\nimport { ControllerPageEntrySchemaParams } from '../../page/entry/controller.jsx';\nexport namespace NSControllerPageEntry {\n export const paramsSchema = ControllerPageEntrySchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageEntrySchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageEntrySchemaParams>;\n}\n\nexport const ZPageEntry = createZovaComponentPage(ControllerPageEntry, undefined, undefined);\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageEntryCreate } from '../../page/entryCreate/controller.jsx';\nimport { ControllerPageEntryCreateSchemaParams } from '../../page/entryCreate/controller.jsx';\nexport namespace NSControllerPageEntryCreate {\n export const paramsSchema = ControllerPageEntryCreateSchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageEntryCreateSchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageEntryCreateSchemaParams>;\n}\n\nexport const ZPageEntryCreate = createZovaComponentPage(\n ControllerPageEntryCreate,\n undefined,\n undefined,\n);\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageResource } from '../../page/resource/controller.jsx';\nimport { ControllerPageResourceSchemaParams } from '../../page/resource/controller.jsx';\nexport namespace NSControllerPageResource {\n export const paramsSchema = ControllerPageResourceSchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageResourceSchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageResourceSchemaParams>;\n}\n\nexport const ZPageResource = createZovaComponentPage(ControllerPageResource, undefined, undefined);\n","import type { IModuleRoute } from 'zova-module-a-router';\n\nimport { ZPageEntry } from './.metadata/page/entry.js';\nimport { ZPageEntryCreate } from './.metadata/page/entryCreate.js';\nimport { ZPageResource } from './.metadata/page/resource.js';\n\nexport const routes: IModuleRoute[] = [\n {\n name: 'resource',\n path: ':resource',\n component: ZPageResource,\n meta: {\n tabKey,\n },\n },\n {\n name: 'entryCreate',\n path: ':resource/create',\n component: ZPageEntryCreate,\n meta: {\n tabKey,\n },\n },\n {\n name: 'entry',\n path: ':resource/:id/:formScene?',\n component: ZPageEntry,\n meta: {\n tabKey,\n },\n },\n];\n\nfunction tabKey(route) {\n return `/rest/resource/${encodeURIComponent(route.params.resource)}`;\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/resource.js';\nimport { IModelOptionsResource } from '../model/resource.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'rest-resource:resource': IModelOptionsResource;\n }\n\n \n}\ndeclare module 'zova-module-rest-resource' {\n \n export interface ModelResource {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n }\n\n export interface ModelResource {\n get $beanFullName(): 'rest-resource.model.resource';\n get $onionName(): 'rest-resource:resource';\n get $onionOptions(): IModelOptionsResource;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelResource } from '../model/resource.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'rest-resource.model.resource': ModelResource;\n }\n}\n/** model: end */\n/** controller: begin */\nexport * from '../page/entry/controller.jsx';\nexport * from '../page/entryCreate/controller.jsx';\nexport * from '../page/resource/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-rest-resource' {\n \n export interface ControllerPageEntry {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n }\n\n export interface ControllerPageResource {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerPageEntry } from '../page/entry/controller.jsx';\nimport { ControllerPageEntryCreate } from '../page/entryCreate/controller.jsx';\nimport { ControllerPageResource } from '../page/resource/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'rest-resource.controller.pageEntry': ControllerPageEntry;\n'rest-resource.controller.pageEntryCreate': ControllerPageEntryCreate;\n'rest-resource.controller.pageResource': ControllerPageResource;\n }\n}\n/** controller: end */\n/** pages: begin */\nexport * from './page/entry.js';\nimport { NSControllerPageEntry } from './page/entry.js';\nexport * from './page/entryCreate.js';\nimport { NSControllerPageEntryCreate } from './page/entryCreate.js';\nexport * from './page/resource.js';\nimport { NSControllerPageResource } from './page/resource.js';\nexport * from '../routes.js';\nimport { TypePagePathSchema } from 'zova-module-a-router';\nimport 'zova';\ndeclare module 'zova-module-a-router' {\nexport interface IPagePathRecord {\n '/rest/resource/:resource/:id/:formScene?': TypePagePathSchema<NSControllerPageEntry.ParamsInput,undefined>;\n'/rest/resource/:resource/create': TypePagePathSchema<NSControllerPageEntryCreate.ParamsInput,undefined>;\n'/rest/resource/:resource': TypePagePathSchema<NSControllerPageResource.ParamsInput,undefined>;\n}\nexport interface IPageNameRecord {\n 'rest-resource:entry': undefined;\n'rest-resource:entryCreate': undefined;\n'rest-resource:resource': undefined;\n}\n}\nexport const pagePathSchemas = {\n\n};\nexport const pageNameSchemas = {\n'rest-resource:entry': {\n params: NSControllerPageEntry.paramsSchema,\n \n },\n'rest-resource:entryCreate': {\n params: NSControllerPageEntryCreate.paramsSchema,\n \n },\n'rest-resource:resource': {\n params: NSControllerPageResource.paramsSchema,\n \n },\n};\ndeclare module 'zova-module-rest-resource' {\n export interface ControllerPageEntry {\n $params: NSControllerPageEntry.ParamsOutput;\n }\nexport interface ControllerPageEntryCreate {\n $params: NSControllerPageEntryCreate.ParamsOutput;\n }\nexport interface ControllerPageResource {\n $params: NSControllerPageResource.ParamsOutput;\n }\n}\n/** pages: end */\n\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleRestResource extends BeanScopeBase {}\n\nexport interface ScopeModuleRestResource {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'rest-resource': ScopeModuleRestResource;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;;;;AAAA,IAAA,QAAO,SAAO,SAAA,SAAgB,UAAM,WAAM;AAC1C,SAAO,2BAAqB,GAAA,GAAA,GAAA,GAAA;AAAsB,MAAG,OAAM,eAAc,GAAM,GAAA;EAAA,YAAA,EAAA;EAAA,cAAA,EAAA;EAAA,UAAA,EAAA;EAAA,OAAA,EAAA,cAAA,EAAA,YAAA,KAAA,EAAA,GAAA,KAAA;EAAA,CAAA;;AAC/E,SAAO,4BAAkB,GAAa,GAAE,GAAA,GAAA,GAAA;CAAA,IAAgB,IAAA,EAAA;AAAA,QAAa,OAAS,KAAE,EAAA,CAAA,QAAA,SAAwB,GAAC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AAC,cACb;CACC;AAMD,IAAW,2BAAc,OAAA,OAAA,EAAA,QAAA,SAAA,EACvB,QAAQ,iBACT,CAAC,EAAE,KAAI,SAAA,MAAA,SAAA,MAAA,gCAAA,cAAA,GAAA,IAAA,OAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["isNil","z","BeanControllerPageBase","deepExtend","Use","usePrepareArg","ZovaJsx","Controller","formMetaFromFormScene","$QueryAutoLoad","_isSlot","s","Object","prototype","toString","call","_isVNode","ControllerPageEntrySchemaParams","object","resource","string","id","optional","formScene","ControllerPageEntry","_dec","_dec2","__z_BeanInfo","module","_dec3","beanFullName","_dec4","Reflect","metadata","Function","_dec5","_class","_class2","constructor","args","formMeta","formProvider","formSchema","jsxZova","$$modelResource","$params","entryId","__init__","$computed","getFormSchema","_prepareJsx","getFormApiSchemas","sdk","bean","_newBeanSimple","components","render","blocks","rest","length","domBlocks","forEach","block","index","options","key","domBlock","Array","isArray","push","_createVNode","ZPage","default","_applyDecoratedDescriptor","getOwnPropertyDescriptor","Virtual","Controller","ControllerPageEntry","ControllerPageEntrySchemaParams","ControllerPageEntryCreateSchemaParams","ControllerPageEntryCreate","_dec","_dec2","_dec3","__z_BeanInfo","module","_class","z","BeanControllerPageBase","deepExtend","Use","usePrepareArg","ZovaJsx","Controller","$QueryAutoLoad","_isSlot","s","Object","prototype","toString","call","_isVNode","ControllerPageResourceSchemaParams","object","resource","string","ControllerPageResource","_dec","_dec2","__z_BeanInfo","module","_dec3","beanFullName","_dec4","Reflect","metadata","Function","_dec5","_class","_class2","constructor","args","jsxZova","$$modelResource","$params","__init__","_prepareJsx","apiSchemasSelect","sdk","bean","_newBeanSimple","schemaRow","render","blocks","rest","length","domBlocks","forEach","block","index","options","key","domBlock","Array","isArray","push","_createVNode","ZPage","default","_applyDecoratedDescriptor","getOwnPropertyDescriptor"],"sources":["../src/model/resource.ts","../src/page/entry/controller.tsx","../src/page/entryCreate/controller.tsx","../src/page/resource/controller.tsx","../src/.metadata/page/entry.ts","../src/.metadata/page/entryCreate.ts","../src/.metadata/page/resource.ts","../src/routes.ts","../src/.metadata/index.ts"],"sourcesContent":["import type { TableIdentity } from 'table-identity';\nimport type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';\nimport type { IFormMeta, IFormProvider, ITableQuery, ITableRes, TypeOpenapiPermissions } from 'zova-module-a-openapi';\n\nimport { hashkey, isNil } from '@cabloy/utils';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { UseScope } from 'zova';\nimport { formSceneFromFormMeta } from 'zova-module-a-form';\nimport { $QueryAutoLoad, BeanModelBase, Model } from 'zova-module-a-model';\nimport { SymbolOpenapiSchemaName, ScopeModuleAOpenapi } from 'zova-module-a-openapi';\n\nexport interface IModelOptionsResource extends IDecoratorModelOptions {}\n\n@Model<IModelOptionsResource>({\n enableSelector: true,\n})\nexport class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityUpdate = Partial<Entity>> extends BeanModelBase {\n public resource: string;\n public resourceApi: string;\n public permissions?: TypeOpenapiPermissions;\n public formProvider: IFormProvider;\n public schemaView?: SchemaObject;\n public schemaCreate?: SchemaObject;\n public schemaUpdate?: SchemaObject;\n public schemaFilter?: SchemaObject;\n public schemaRow?: SchemaObject;\n public schemaPages?: SchemaObject;\n\n @UseScope()\n $$scopeOpenapi: ScopeModuleAOpenapi;\n\n protected async __init__(resource: string) {\n if (!resource) throw new Error('resource not specified');\n await super.__init__(resource);\n this.resource = resource;\n this.permissions = this.$computed(() => {\n const permissions = this.$sdk.getPermissions(this.resource);\n return permissions.data;\n });\n this.formProvider = this.$computed(() => {\n return this.$$scopeOpenapi.config.formProvider;\n });\n this.schemaView = this.$computed(() => {\n return this.apiSchemasView.responseBody;\n });\n this.schemaCreate = this.$computed(() => {\n return this.apiSchemasCreate.requestBody;\n });\n this.schemaUpdate = this.$computed(() => {\n return this.apiSchemasUpdate.requestBody;\n });\n this.schemaFilter = this.$computed(() => {\n return this.apiSchemasSelect.filter;\n });\n this.schemaRow = this.$computed(() => {\n return this.apiSchemasSelect.row;\n });\n this.schemaPages = this.$computed(() => {\n return this.apiSchemasSelect.paged;\n });\n // bootstrap\n await this._bootstrap();\n }\n\n selectGeneral(actionPath?: string, query?: ITableQuery) {\n const queryHash = hashkey(query);\n return this.$useStateData({\n queryKey: ['select', actionPath ?? '', queryHash],\n queryFn: async () => {\n const apiPath = actionPath ? `${this.resourceApi}/${actionPath}` : this.resourceApi;\n return this.$fetch.get<any, ITableRes<Entity>>(\n this.sys.util.apiActionPathTranslate(apiPath),\n this.sys.util.apiActionConfigPrepare(undefined, { query }),\n );\n },\n });\n }\n\n select(query?: ITableQuery) {\n return this.selectGeneral(undefined, query);\n }\n\n view(id: TableIdentity) {\n if (isNil(id)) throw new Error('row id cannot empty');\n return this.$useStateData({\n queryKey: ['get', id],\n queryFn: async () => {\n const res = await this.$fetch.get<any, Entity>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n this.sys.util.apiActionConfigPrepare(),\n );\n return res ?? null;\n },\n });\n }\n\n create() {\n return this.$useMutationData<void, EntityCreate>({\n mutationKey: ['create'],\n mutationFn: async params => {\n return this.$fetch.post<any, void, EntityCreate>(\n this.sys.util.apiActionPathTranslate(this.resourceApi),\n params,\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n },\n });\n }\n\n update(id: TableIdentity) {\n return this.$useMutationData<void, EntityUpdate>({\n mutationKey: ['update', id],\n mutationFn: async params => {\n return this.$fetch.patch<any, void, EntityUpdate>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n params,\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n this.$invalidateQueries({ queryKey: ['get', id] });\n },\n });\n }\n\n delete(id: TableIdentity) {\n return this.$useMutationData<void, void>({\n mutationKey: ['delete', id],\n mutationFn: async () => {\n return this.$fetch.delete<any, void, void>(\n this.sys.util.apiActionPathTranslate(`${this.resourceApi}/:id`, { id }),\n this.sys.util.apiActionConfigPrepare(),\n );\n },\n onSuccess: () => {\n this.$invalidateQueries({ queryKey: ['select'] });\n this.$invalidateQueries({ queryKey: ['get', id] });\n },\n });\n }\n\n public get apiSchemasSelect() {\n return this.$sdk.createApiSchemas(this.resourceApi, 'get');\n }\n\n public get apiSchemasView() {\n return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, 'get');\n }\n\n public get apiSchemasCreate() {\n return this.$sdk.createApiSchemas(this.resourceApi, 'post');\n }\n\n public get apiSchemasUpdate() {\n return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, 'patch');\n }\n\n public getFormSchema(formMeta: IFormMeta) {\n const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);\n if (formScene === 'view') return this.schemaView;\n if (formScene === 'create') return this.schemaCreate;\n if (formScene === 'edit') return this.schemaUpdate;\n }\n\n public getFormApiSchemas(formMeta: IFormMeta) {\n const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);\n if (formScene === 'view') return this.apiSchemasView;\n if (formScene === 'create') return this.apiSchemasCreate;\n if (formScene === 'edit') return this.apiSchemasUpdate;\n throw new Error('invalid parameters');\n }\n\n public getFormMutationSubmit(formMeta: IFormMeta, id?: TableIdentity): DataMutation | undefined {\n if (formMeta.formMode !== 'edit') return;\n if (formMeta.editMode === 'create') {\n return this.create() as any;\n } else if (formMeta.editMode === 'update') {\n return this.update(id!) as any;\n }\n }\n\n public getFormData(formMeta: IFormMeta, id?: TableIdentity): Entity | EntityCreate | EntityUpdate | undefined {\n if (formMeta.formMode === 'edit' && formMeta.editMode === 'create') {\n return this.getQueryDataDefaultValue(this.schemaCreate);\n }\n if (isNil(id)) return undefined;\n return this.view(id).data as Entity | EntityUpdate | undefined;\n }\n\n public getQueryDataDefaultValue(schemaName?: SchemaObject | string): EntityCreate | undefined {\n if (!schemaName) return;\n if (typeof schemaName === 'object') {\n schemaName = schemaName[SymbolOpenapiSchemaName] as string;\n }\n return this.$sdk.getSchemaDefaultValue(schemaName) as EntityCreate | undefined;\n }\n\n private async _bootstrap() {\n const queryBootstrap = await $QueryAutoLoad(() => this.$sdk.getBootstrap(this.resource));\n if (!queryBootstrap?.data) {\n throw new Error(`not found sdk of resource: ${this.resource}`);\n }\n this.resourceApi = this.sys.util.parseResourceApi(this.resource, queryBootstrap.data.apiPath);\n }\n}\n","import type { IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-openapi';\n\nimport { isNil } from '@cabloy/utils';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { VNode } from 'vue';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { formMetaFromFormScene } from 'zova-module-a-form';\nimport { $QueryAutoLoad } from 'zova-module-a-model';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nexport const ControllerPageEntrySchemaParams = z.object({\n resource: z.string(),\n id: z.string().optional(),\n formScene: z.string().optional(),\n});\n\n@Controller()\nexport class ControllerPageEntry extends BeanControllerPageBase {\n formMeta: IFormMeta;\n formProvider: IFormProvider;\n formSchema?: SchemaObject;\n jsxZova: ZovaJsx;\n\n @Use({ beanFullName: 'rest-resource.model.resource' })\n get $$modelResource(): ModelResource {\n return usePrepareArg(this.$params.resource, true);\n }\n\n get resource() {\n return this.$params.resource;\n }\n\n get entryId() {\n return this.$params.id;\n }\n\n get formScene() {\n return (this.$params.formScene as TypeFormScene | undefined) ?? (isNil(this.entryId) ? 'create' : 'view');\n }\n\n protected async __init__() {\n this.formMeta = this.$computed(() => {\n const formScene = this.formScene;\n return { ...formMetaFromFormScene(formScene), formScene };\n });\n this.formProvider = this.$computed(() => {\n return this.$$modelResource.formProvider;\n });\n this.formSchema = this.$computed(() => {\n return this.$$modelResource.getFormSchema(this.formMeta);\n });\n // jsx\n this._prepareJsx();\n // load schema\n await $QueryAutoLoad(() => this.$$modelResource.getFormApiSchemas(this.formMeta)?.sdk);\n }\n\n private _prepareJsx() {\n this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components);\n }\n\n protected render() {\n const blocks = this.formSchema?.rest?.blocks;\n if (!blocks || blocks.length === 0) return;\n let domBlocks: VNode[] = [];\n blocks.forEach((block, index) => {\n const options = deepExtend(\n { key: index },\n {\n resource: this.resource,\n id: this.entryId,\n formScene: this.formScene,\n },\n block.options,\n );\n const domBlock = this.jsxZova.render(block.render!, options);\n if (!domBlock) return;\n if (Array.isArray(domBlock)) {\n domBlocks.push(...domBlock);\n } else {\n domBlocks.push(domBlock);\n }\n });\n return <ZPage>{domBlocks}</ZPage>;\n }\n}\n","import { Virtual } from 'zova-core';\nimport { Controller } from 'zova-module-a-bean';\n\nimport { ControllerPageEntry, ControllerPageEntrySchemaParams } from '../entry/controller.jsx';\n\nexport const ControllerPageEntryCreateSchemaParams = ControllerPageEntrySchemaParams;\n\n@Controller()\n@Virtual()\nexport class ControllerPageEntryCreate extends ControllerPageEntry {}\n","import { VNode } from 'vue';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { $QueryAutoLoad } from 'zova-module-a-model';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nexport const ControllerPageResourceSchemaParams = z.object({\n resource: z.string(),\n});\n\n@Controller()\nexport class ControllerPageResource extends BeanControllerPageBase {\n jsxZova: ZovaJsx;\n\n @Use({ beanFullName: 'rest-resource.model.resource' })\n get $$modelResource(): ModelResource {\n return usePrepareArg(this.$params.resource, true);\n }\n\n get resource() {\n return this.$params.resource;\n }\n\n protected async __init__() {\n // jsx\n this._prepareJsx();\n // load schema/data\n await $QueryAutoLoad(() => this.$$modelResource.apiSchemasSelect.sdk);\n }\n\n private _prepareJsx() {\n this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false);\n }\n\n get schemaRow() {\n return this.$$modelResource.schemaRow;\n }\n\n public render() {\n const blocks = this.schemaRow?.rest?.blocks;\n if (!blocks || blocks.length === 0) return;\n let domBlocks: VNode[] = [];\n blocks.forEach((block, index) => {\n const options = deepExtend(\n { key: index },\n {\n resource: this.resource,\n },\n block.options,\n );\n const domBlock = this.jsxZova.render(block.render!, options);\n if (!domBlock) return;\n if (Array.isArray(domBlock)) {\n domBlocks.push(...domBlock);\n } else {\n domBlocks.push(domBlock);\n }\n });\n return <ZPage>{domBlocks}</ZPage>;\n }\n}\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageEntry } from '../../page/entry/controller.jsx';\nimport { ControllerPageEntrySchemaParams } from '../../page/entry/controller.jsx';\nexport namespace NSControllerPageEntry {\n export const paramsSchema = ControllerPageEntrySchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageEntrySchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageEntrySchemaParams>;\n}\n\nexport const ZPageEntry = createZovaComponentPage(ControllerPageEntry, undefined, undefined);\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageEntryCreate } from '../../page/entryCreate/controller.jsx';\nimport { ControllerPageEntryCreateSchemaParams } from '../../page/entryCreate/controller.jsx';\nexport namespace NSControllerPageEntryCreate {\n export const paramsSchema = ControllerPageEntryCreateSchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageEntryCreateSchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageEntryCreateSchemaParams>;\n}\n\nexport const ZPageEntryCreate = createZovaComponentPage(\n ControllerPageEntryCreate,\n undefined,\n undefined,\n);\n","import { z } from 'zod';\nimport { createZovaComponentPage } from 'zova';\n\nimport { ControllerPageResource } from '../../page/resource/controller.jsx';\nimport { ControllerPageResourceSchemaParams } from '../../page/resource/controller.jsx';\nexport namespace NSControllerPageResource {\n export const paramsSchema = ControllerPageResourceSchemaParams;\n export type ParamsInput = z.input<typeof ControllerPageResourceSchemaParams>;\n export type ParamsOutput = z.output<typeof ControllerPageResourceSchemaParams>;\n}\n\nexport const ZPageResource = createZovaComponentPage(ControllerPageResource, undefined, undefined);\n","import type { IModuleRoute } from 'zova-module-a-router';\n\nimport { ZPageEntry } from './.metadata/page/entry.js';\nimport { ZPageEntryCreate } from './.metadata/page/entryCreate.js';\nimport { ZPageResource } from './.metadata/page/resource.js';\n\nexport const routes: IModuleRoute[] = [\n {\n name: 'resource',\n path: ':resource',\n component: ZPageResource,\n meta: {\n tabKey,\n },\n },\n {\n name: 'entryCreate',\n path: ':resource/create',\n component: ZPageEntryCreate,\n meta: {\n tabKey,\n },\n },\n {\n name: 'entry',\n path: ':resource/:id/:formScene?',\n component: ZPageEntry,\n meta: {\n tabKey,\n },\n },\n];\n\nfunction tabKey(route) {\n return `/rest/resource/${encodeURIComponent(route.params.resource)}`;\n}\n","// eslint-disable\n/** model: begin */\nexport * from '../model/resource.js';\nimport { IModelOptionsResource } from '../model/resource.js';\nimport 'zova-module-a-model';\ndeclare module 'zova-module-a-model' {\n \n export interface IModelRecord {\n 'rest-resource:resource': IModelOptionsResource;\n }\n\n \n}\ndeclare module 'zova-module-rest-resource' {\n \n export interface ModelResource {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n }\n\n export interface ModelResource {\n get $beanFullName(): 'rest-resource.model.resource';\n get $onionName(): 'rest-resource:resource';\n get $onionOptions(): IModelOptionsResource;\n } \n}\n/** model: end */\n/** model: begin */\nimport { ModelResource } from '../model/resource.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'rest-resource.model.resource': ModelResource;\n }\n}\n/** model: end */\n/** controller: begin */\nexport * from '../page/entry/controller.jsx';\nexport * from '../page/entryCreate/controller.jsx';\nexport * from '../page/resource/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-rest-resource' {\n \n export interface ControllerPageEntry {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n }\n\n export interface ControllerPageResource {\n /** @internal */\n get scope(): ScopeModuleRestResource;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerPageEntry } from '../page/entry/controller.jsx';\nimport { ControllerPageEntryCreate } from '../page/entryCreate/controller.jsx';\nimport { ControllerPageResource } from '../page/resource/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'rest-resource.controller.pageEntry': ControllerPageEntry;\n'rest-resource.controller.pageEntryCreate': ControllerPageEntryCreate;\n'rest-resource.controller.pageResource': ControllerPageResource;\n }\n}\n/** controller: end */\n/** pages: begin */\nexport * from './page/entry.js';\nimport { NSControllerPageEntry } from './page/entry.js';\nexport * from './page/entryCreate.js';\nimport { NSControllerPageEntryCreate } from './page/entryCreate.js';\nexport * from './page/resource.js';\nimport { NSControllerPageResource } from './page/resource.js';\nexport * from '../routes.js';\nimport { TypePagePathSchema } from 'zova-module-a-router';\nimport 'zova';\ndeclare module 'zova-module-a-router' {\nexport interface IPagePathRecord {\n '/rest/resource/:resource/:id/:formScene?': TypePagePathSchema<NSControllerPageEntry.ParamsInput,undefined>;\n'/rest/resource/:resource/create': TypePagePathSchema<NSControllerPageEntryCreate.ParamsInput,undefined>;\n'/rest/resource/:resource': TypePagePathSchema<NSControllerPageResource.ParamsInput,undefined>;\n}\nexport interface IPageNameRecord {\n 'rest-resource:entry': undefined;\n'rest-resource:entryCreate': undefined;\n'rest-resource:resource': undefined;\n}\n}\nexport const pagePathSchemas = {\n\n};\nexport const pageNameSchemas = {\n'rest-resource:entry': {\n params: NSControllerPageEntry.paramsSchema,\n \n },\n'rest-resource:entryCreate': {\n params: NSControllerPageEntryCreate.paramsSchema,\n \n },\n'rest-resource:resource': {\n params: NSControllerPageResource.paramsSchema,\n \n },\n};\ndeclare module 'zova-module-rest-resource' {\n export interface ControllerPageEntry {\n $params: NSControllerPageEntry.ParamsOutput;\n }\nexport interface ControllerPageEntryCreate {\n $params: NSControllerPageEntryCreate.ParamsOutput;\n }\nexport interface ControllerPageResource {\n $params: NSControllerPageResource.ParamsOutput;\n }\n}\n/** pages: end */\n\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleRestResource extends BeanScopeBase {}\n\nexport interface ScopeModuleRestResource {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'rest-resource': ScopeModuleRestResource;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n"],"mappings":";;;;;;;;;;;AAAA,IAAA,QAAO,SAAO,SAAA,SAAgB,UAAM,WAAM;AAC1C,SAAO,2BAAqB,GAAA,GAAA,GAAA,GAAA;AAAsB,MAAG,OAAM,eAAc,GAAM,GAAA;EAAA,YAAA,EAAA;EAAA,cAAA,EAAA;EAAA,UAAA,EAAA;EAAA,OAAA,EAAA,cAAA,EAAA,YAAA,KAAA,EAAA,GAAA,KAAA;EAAA,CAAA;;AAC/E,SAAO,4BAAkB,GAAa,GAAE,GAAA,GAAA,GAAA;CAAY,IAAC,IAAA,EAAS;AAAE,QAAA,OAAA,KAAA,EAAA,CAAsB,QAAQ,SAAM,GAAO;AAAE,IAAA,KAAO,EAAC;GAAA,EAAA,EAAA,aAAA,CAAA,CAAA,EAAA,YAAA,EAAA,eAAA,CAAA,CAAA,EAAA,eAAA,WAAA,KAAA,EAAA,iBAAA,EAAA,WAAA,CAAA,IAAA,IAAA,EAAA,OAAA,CAAA,SAAA,CAAA,OAAA,SAAA,GAAA,GAAA;AAAA,SAAA,EAAA,GAAA,GAAA,EAAA,IAAA;IAAA,EAAA,EAAA,KAAA,KAAA,MAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,cAAA,EAAA,YAAA,KAAA,EAAA,GAAA,KAAA,GAAA,EAA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AsC,KAAA,GAAA,KAAA,EAAA;;;ACJjF,IAAS;CACT,SAAS,2BAAA;AACQ,2BAAyB,eAAA;GACxC,6BAA4B,2BAAA,EAAA,EAAA;AAC9B,IAAa,gBAAgB,wBAAc,wBAAkC,KAAA,GAAC,KAAA,EAAA;;;ACJ9E,IAAS,SAAA;CAAA;EACT,MAAQ;;EAER,WAAa;EACX,MAAA,EACE,QACD;EACF;CAAE;EACD,MAAM;EACN,MAAI;EACJ,WAAG;EACH,MAAC,EACD,QACC;EACF;CAAE;EACD,MAAE;EACF,MAAM;EACN,WAAU;EACV,MAAG,EACF,QACD;EACD;CAAC;AACF,SAAS,OAAG,OAAU;AACpB,QAAE,kBAAqB,mBAAA,MAAA,OAAA,SAAA;;;;;;AC1BzB,IAAG,MAAO,OAAA;AAgCV,IAAU,kBAAe,EAAQ;AACjC,IAAE,kBAAA;CACF,uBAAA,EACI,QAAO,sBAAK,cACb;CACH,6BAA6B,EAC7B,QAAS,4BAA0B,cACnC;6BAEA,QAAY,yBAAC,cACb;CACC;AAMD,IAAW,2BAAc,OAAA,OAAA,EAAA,QAAA,SAAA,EACvB,QAAQ,iBACT,CAAC,EAAE,KAAI,SAAA,MAAA,SAAA,MAAA,gCAAA,cAAA,GAAA,IAAA,OAAA,IAAA"}
|
package/dist/model/resource.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';
|
|
3
|
-
import type { IFormMeta, IFormProvider,
|
|
3
|
+
import type { IFormMeta, IFormProvider, ITableQuery, ITableRes, TypeOpenapiPermissions } from 'zova-module-a-openapi';
|
|
4
4
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
5
5
|
import { BeanModelBase } from 'zova-module-a-model';
|
|
6
|
-
import {
|
|
6
|
+
import { ScopeModuleAOpenapi } from 'zova-module-a-openapi';
|
|
7
7
|
export interface IModelOptionsResource extends IDecoratorModelOptions {
|
|
8
8
|
}
|
|
9
9
|
export declare class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityUpdate = Partial<Entity>> extends BeanModelBase {
|
|
@@ -11,14 +11,13 @@ export declare class ModelResource<Entity = any, EntityCreate = Partial<Entity>,
|
|
|
11
11
|
resourceApi: string;
|
|
12
12
|
permissions?: TypeOpenapiPermissions;
|
|
13
13
|
formProvider: IFormProvider;
|
|
14
|
-
tableProvider: ITableProvider;
|
|
15
14
|
schemaView?: SchemaObject;
|
|
16
15
|
schemaCreate?: SchemaObject;
|
|
17
16
|
schemaUpdate?: SchemaObject;
|
|
18
17
|
schemaFilter?: SchemaObject;
|
|
19
18
|
schemaRow?: SchemaObject;
|
|
20
19
|
schemaPages?: SchemaObject;
|
|
21
|
-
$$
|
|
20
|
+
$$scopeOpenapi: ScopeModuleAOpenapi;
|
|
22
21
|
protected __init__(resource: string): Promise<void>;
|
|
23
22
|
selectGeneral(actionPath?: string, query?: ITableQuery): import("vue").UnwrapNestedRefs<import("@tanstack/vue-query").UseQueryReturnType<ITableRes<Entity>, Error>>;
|
|
24
23
|
select(query?: ITableQuery): import("vue").UnwrapNestedRefs<import("@tanstack/vue-query").UseQueryReturnType<ITableRes<Entity>, Error>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/model/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/model/resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAA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;IAED,IAAW,gBAAgB,oDAE1B;IAEM,aAAa,CAAC,QAAQ,EAAE,SAAS;IAOjC,iBAAiB,CAAC,QAAQ,EAAE,SAAS;IAQrC,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS;IASxF,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS;IAQtG,wBAAwB,CAAC,UAAU,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS;YAQ/E,UAAU;CAOzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/entry/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAkC,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/entry/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAkC,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAO,MAAM,+BAA+B;;;;iBAI1C,CAAC;AAEH,qBACa,mBAAoB,SAAQ,sBAAsB;IAC7D,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,EAAE,aAAa,CAAC;IAC5B,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IAEjB,IACI,eAAe,IAAI,aAAa,CAEnC;IAED,IAAI,QAAQ,WAEX;IAED,IAAI,OAAO,uBAEV;IAED,IAAI,SAAS,kBAEZ;cAEe,QAAQ;IAiBxB,OAAO,CAAC,WAAW;IAInB,SAAS,CAAC,MAAM;CAwBjB"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BeanControllerPageBase } from 'zova';
|
|
3
3
|
import { ZovaJsx } from 'zova-jsx';
|
|
4
|
-
import { ITableProvider } from 'zova-module-a-openapi';
|
|
5
4
|
import type { ModelResource } from '../../model/resource.js';
|
|
6
5
|
export declare const ControllerPageResourceSchemaParams: z.ZodObject<{
|
|
7
6
|
resource: z.ZodString;
|
|
8
7
|
}, z.core.$strip>;
|
|
9
8
|
export declare class ControllerPageResource extends BeanControllerPageBase {
|
|
10
|
-
tableProvider: ITableProvider;
|
|
11
9
|
jsxZova: ZovaJsx;
|
|
12
10
|
get $$modelResource(): ModelResource;
|
|
13
11
|
get resource(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/resource/controller.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAkC,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/resource/controller.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAkC,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAO,MAAM,kCAAkC;;iBAE7C,CAAC;AAEH,qBACa,sBAAuB,SAAQ,sBAAsB;IAChE,OAAO,EAAE,OAAO,CAAC;IAEjB,IACI,eAAe,IAAI,aAAa,CAEnC;IAED,IAAI,QAAQ,WAEX;cAEe,QAAQ;IAOxB,OAAO,CAAC,WAAW;IAInB,IAAI,SAAS,yDAEZ;IAEM,MAAM;CAsBd"}
|
package/package.json
CHANGED
package/src/model/resource.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';
|
|
3
|
-
import type { IFormMeta, IFormProvider,
|
|
3
|
+
import type { IFormMeta, IFormProvider, ITableQuery, ITableRes, TypeOpenapiPermissions } from 'zova-module-a-openapi';
|
|
4
4
|
|
|
5
5
|
import { hashkey, isNil } from '@cabloy/utils';
|
|
6
6
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
7
|
-
import {
|
|
7
|
+
import { UseScope } from 'zova';
|
|
8
8
|
import { formSceneFromFormMeta } from 'zova-module-a-form';
|
|
9
9
|
import { $QueryAutoLoad, BeanModelBase, Model } from 'zova-module-a-model';
|
|
10
|
-
import {
|
|
10
|
+
import { SymbolOpenapiSchemaName, ScopeModuleAOpenapi } from 'zova-module-a-openapi';
|
|
11
11
|
|
|
12
12
|
export interface IModelOptionsResource extends IDecoratorModelOptions {}
|
|
13
13
|
|
|
@@ -19,7 +19,6 @@ export class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityU
|
|
|
19
19
|
public resourceApi: string;
|
|
20
20
|
public permissions?: TypeOpenapiPermissions;
|
|
21
21
|
public formProvider: IFormProvider;
|
|
22
|
-
public tableProvider: ITableProvider;
|
|
23
22
|
public schemaView?: SchemaObject;
|
|
24
23
|
public schemaCreate?: SchemaObject;
|
|
25
24
|
public schemaUpdate?: SchemaObject;
|
|
@@ -27,39 +26,36 @@ export class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityU
|
|
|
27
26
|
public schemaRow?: SchemaObject;
|
|
28
27
|
public schemaPages?: SchemaObject;
|
|
29
28
|
|
|
30
|
-
@
|
|
31
|
-
$$
|
|
29
|
+
@UseScope()
|
|
30
|
+
$$scopeOpenapi: ScopeModuleAOpenapi;
|
|
32
31
|
|
|
33
32
|
protected async __init__(resource: string) {
|
|
34
33
|
if (!resource) throw new Error('resource not specified');
|
|
35
34
|
await super.__init__(resource);
|
|
36
35
|
this.resource = resource;
|
|
37
|
-
this.permissions = this.$
|
|
36
|
+
this.permissions = this.$computed(() => {
|
|
38
37
|
const permissions = this.$sdk.getPermissions(this.resource);
|
|
39
38
|
return permissions.data;
|
|
40
39
|
});
|
|
41
|
-
this.formProvider = this.$
|
|
42
|
-
return this.$$
|
|
40
|
+
this.formProvider = this.$computed(() => {
|
|
41
|
+
return this.$$scopeOpenapi.config.formProvider;
|
|
43
42
|
});
|
|
44
|
-
this.
|
|
45
|
-
return this.$$beanResourceProviders.tableProvider;
|
|
46
|
-
});
|
|
47
|
-
this.schemaView = this.$useComputed(() => {
|
|
43
|
+
this.schemaView = this.$computed(() => {
|
|
48
44
|
return this.apiSchemasView.responseBody;
|
|
49
45
|
});
|
|
50
|
-
this.schemaCreate = this.$
|
|
46
|
+
this.schemaCreate = this.$computed(() => {
|
|
51
47
|
return this.apiSchemasCreate.requestBody;
|
|
52
48
|
});
|
|
53
|
-
this.schemaUpdate = this.$
|
|
49
|
+
this.schemaUpdate = this.$computed(() => {
|
|
54
50
|
return this.apiSchemasUpdate.requestBody;
|
|
55
51
|
});
|
|
56
|
-
this.schemaFilter = this.$
|
|
52
|
+
this.schemaFilter = this.$computed(() => {
|
|
57
53
|
return this.apiSchemasSelect.filter;
|
|
58
54
|
});
|
|
59
|
-
this.schemaRow = this.$
|
|
55
|
+
this.schemaRow = this.$computed(() => {
|
|
60
56
|
return this.apiSchemasSelect.row;
|
|
61
57
|
});
|
|
62
|
-
this.schemaPages = this.$
|
|
58
|
+
this.schemaPages = this.$computed(() => {
|
|
63
59
|
return this.apiSchemasSelect.paged;
|
|
64
60
|
});
|
|
65
61
|
// bootstrap
|
|
@@ -9,7 +9,6 @@ import { ZovaJsx } from 'zova-jsx';
|
|
|
9
9
|
import { Controller } from 'zova-module-a-bean';
|
|
10
10
|
import { formMetaFromFormScene } from 'zova-module-a-form';
|
|
11
11
|
import { $QueryAutoLoad } from 'zova-module-a-model';
|
|
12
|
-
import { IResourceBlockOptionsPageEntry } from 'zova-module-basic-openapi';
|
|
13
12
|
import { ZPage } from 'zova-module-home-base';
|
|
14
13
|
|
|
15
14
|
import type { ModelResource } from '../../model/resource.js';
|
|
@@ -45,14 +44,14 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
protected async __init__() {
|
|
48
|
-
this.formMeta = this.$
|
|
47
|
+
this.formMeta = this.$computed(() => {
|
|
49
48
|
const formScene = this.formScene;
|
|
50
49
|
return { ...formMetaFromFormScene(formScene), formScene };
|
|
51
50
|
});
|
|
52
|
-
this.formProvider = this.$
|
|
51
|
+
this.formProvider = this.$computed(() => {
|
|
53
52
|
return this.$$modelResource.formProvider;
|
|
54
53
|
});
|
|
55
|
-
this.formSchema = this.$
|
|
54
|
+
this.formSchema = this.$computed(() => {
|
|
56
55
|
return this.$$modelResource.getFormSchema(this.formMeta);
|
|
57
56
|
});
|
|
58
57
|
// jsx
|
|
@@ -62,7 +61,7 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
private _prepareJsx() {
|
|
65
|
-
this.jsxZova = this.
|
|
64
|
+
this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
protected render() {
|
|
@@ -76,7 +75,7 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
76
75
|
resource: this.resource,
|
|
77
76
|
id: this.entryId,
|
|
78
77
|
formScene: this.formScene,
|
|
79
|
-
}
|
|
78
|
+
},
|
|
80
79
|
block.options,
|
|
81
80
|
);
|
|
82
81
|
const domBlock = this.jsxZova.render(block.render!, options);
|
|
@@ -4,8 +4,6 @@ import { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';
|
|
|
4
4
|
import { ZovaJsx } from 'zova-jsx';
|
|
5
5
|
import { Controller } from 'zova-module-a-bean';
|
|
6
6
|
import { $QueryAutoLoad } from 'zova-module-a-model';
|
|
7
|
-
import { ITableProvider } from 'zova-module-a-openapi';
|
|
8
|
-
import { IResourceBlockOptionsPage } from 'zova-module-basic-openapi';
|
|
9
7
|
import { ZPage } from 'zova-module-home-base';
|
|
10
8
|
|
|
11
9
|
import type { ModelResource } from '../../model/resource.js';
|
|
@@ -16,8 +14,6 @@ export const ControllerPageResourceSchemaParams = z.object({
|
|
|
16
14
|
|
|
17
15
|
@Controller()
|
|
18
16
|
export class ControllerPageResource extends BeanControllerPageBase {
|
|
19
|
-
tableProvider: ITableProvider;
|
|
20
|
-
|
|
21
17
|
jsxZova: ZovaJsx;
|
|
22
18
|
|
|
23
19
|
@Use({ beanFullName: 'rest-resource.model.resource' })
|
|
@@ -30,9 +26,6 @@ export class ControllerPageResource extends BeanControllerPageBase {
|
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
protected async __init__() {
|
|
33
|
-
this.tableProvider = this.$useComputed(() => {
|
|
34
|
-
return this.$$modelResource.tableProvider;
|
|
35
|
-
});
|
|
36
29
|
// jsx
|
|
37
30
|
this._prepareJsx();
|
|
38
31
|
// load schema/data
|
|
@@ -40,7 +33,7 @@ export class ControllerPageResource extends BeanControllerPageBase {
|
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
private _prepareJsx() {
|
|
43
|
-
this.jsxZova = this.
|
|
36
|
+
this.jsxZova = this.bean._newBeanSimple(ZovaJsx, false);
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
get schemaRow() {
|
|
@@ -56,7 +49,7 @@ export class ControllerPageResource extends BeanControllerPageBase {
|
|
|
56
49
|
{ key: index },
|
|
57
50
|
{
|
|
58
51
|
resource: this.resource,
|
|
59
|
-
}
|
|
52
|
+
},
|
|
60
53
|
block.options,
|
|
61
54
|
);
|
|
62
55
|
const domBlock = this.jsxZova.render(block.render!, options);
|