zova-module-rest-resource 5.1.10 → 5.1.12
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/.metadata/page/entryCreate.d.ts.map +1 -1
- package/dist/index.js +52 -126
- package/dist/index.js.map +1 -1
- package/dist/model/resource.d.ts +3 -9
- package/dist/model/resource.d.ts.map +1 -1
- package/dist/page/entry/controller.d.ts +6 -13
- package/dist/page/entry/controller.d.ts.map +1 -1
- package/dist/page/resource/controller.d.ts +6 -14
- package/dist/page/resource/controller.d.ts.map +1 -1
- package/dist/types/pageEntryWrapper.d.ts +5 -12
- package/dist/types/pageEntryWrapper.d.ts.map +1 -1
- package/dist/types/pageWrapper.d.ts +5 -10
- package/dist/types/pageWrapper.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/.metadata/page/entryCreate.ts +5 -1
- package/src/model/resource.ts +8 -31
- package/src/page/entry/controller.tsx +41 -65
- package/src/page/resource/controller.tsx +38 -65
- package/src/types/pageEntryWrapper.ts +5 -19
- package/src/types/pageWrapper.ts +5 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryCreate.d.ts","sourceRoot":"","sources":["../../../src/.metadata/page/entryCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,yBAAiB,2BAA2B,CAAC;IACpC,MAAM,YAAY;;;;qBAAwC,CAAC;IAClE,KAAY,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;IAChF,KAAY,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qCAAqC,CAAC,CAAC;CACnF;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"entryCreate.d.ts","sourceRoot":"","sources":["../../../src/.metadata/page/entryCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,yBAAiB,2BAA2B,CAAC;IACpC,MAAM,YAAY;;;;qBAAwC,CAAC;IAClE,KAAY,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;IAChF,KAAY,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qCAAqC,CAAC,CAAC;CACnF;AAED,eAAO,MAAM,gBAAgB,wHAI5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BeanControllerPageBase, BeanInfo, BeanScopeBase, Use,
|
|
2
|
-
import {
|
|
1
|
+
import { BeanControllerPageBase, BeanInfo, BeanScopeBase, Use, createZovaComponentAsync, createZovaComponentPage, deepExtend, usePrepareArg } from "zova";
|
|
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";
|
|
5
5
|
import { SymbolOpenapiSchemaName } from "zova-module-a-openapi";
|
|
@@ -26,12 +26,11 @@ 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 = Use("a-openapi.bean.resourceProviders"), _dec4$2 = Reflect.metadata("design:type", typeof BeanResourceProviders === "undefined" ? Object : BeanResourceProviders), _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
|
-
this.resourceMeta = void 0;
|
|
35
34
|
this.permissions = void 0;
|
|
36
35
|
this.formProvider = void 0;
|
|
37
36
|
this.tableProvider = void 0;
|
|
@@ -41,24 +40,20 @@ var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInf
|
|
|
41
40
|
this.schemaFilter = void 0;
|
|
42
41
|
this.schemaRow = void 0;
|
|
43
42
|
this.schemaPages = void 0;
|
|
44
|
-
_initializerDefineProperty(this, "$$
|
|
43
|
+
_initializerDefineProperty(this, "$$beanResourceProviders", _descriptor, this);
|
|
45
44
|
}
|
|
46
45
|
async __init__(resource) {
|
|
47
46
|
if (!resource) throw new Error("resource not specified");
|
|
48
47
|
await super.__init__(resource);
|
|
49
48
|
this.resource = resource;
|
|
50
|
-
this.resourceMeta = this.$useComputed(() => {
|
|
51
|
-
const resourceMeta = this.$sdk.getBootstrap(this.resource);
|
|
52
|
-
return deepExtend({}, this.$$scopeModuleAOpenapi.config.resourceMeta, resourceMeta.data?.resourceMeta);
|
|
53
|
-
});
|
|
54
49
|
this.permissions = this.$useComputed(() => {
|
|
55
50
|
return this.$sdk.getPermissions(this.resource).data;
|
|
56
51
|
});
|
|
57
52
|
this.formProvider = this.$useComputed(() => {
|
|
58
|
-
return
|
|
53
|
+
return this.$$beanResourceProviders.formProvider;
|
|
59
54
|
});
|
|
60
55
|
this.tableProvider = this.$useComputed(() => {
|
|
61
|
-
return
|
|
56
|
+
return this.$$beanResourceProviders.tableProvider;
|
|
62
57
|
});
|
|
63
58
|
this.schemaView = this.$useComputed(() => {
|
|
64
59
|
return this.apiSchemasView.responseBody;
|
|
@@ -153,18 +148,6 @@ var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInf
|
|
|
153
148
|
get apiSchemasUpdate() {
|
|
154
149
|
return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, "patch");
|
|
155
150
|
}
|
|
156
|
-
get componentRestPage() {
|
|
157
|
-
return this.resourceMeta.provider.components.restPage;
|
|
158
|
-
}
|
|
159
|
-
get componentRestPageEntry() {
|
|
160
|
-
return this.resourceMeta.provider.components.restPageEntry;
|
|
161
|
-
}
|
|
162
|
-
get componentTable() {
|
|
163
|
-
return this.resourceMeta.provider.components.table;
|
|
164
|
-
}
|
|
165
|
-
get componentForm() {
|
|
166
|
-
return this.resourceMeta.provider.components.form;
|
|
167
|
-
}
|
|
168
151
|
getFormSchema(formMeta) {
|
|
169
152
|
const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);
|
|
170
153
|
if (formScene === "view") return this.schemaView;
|
|
@@ -198,7 +181,7 @@ var ModelResource = (_dec$4 = Model({ enableSelector: true }), _dec2$4 = BeanInf
|
|
|
198
181
|
if (!queryBootstrap?.data) throw new Error(`not found sdk of resource: ${this.resource}`);
|
|
199
182
|
this.resourceApi = this.sys.util.parseResourceApi(this.resource, queryBootstrap.data.apiPath);
|
|
200
183
|
}
|
|
201
|
-
}, _descriptor = _applyDecoratedDescriptor$2(_class2$2.prototype, "$$
|
|
184
|
+
}, _descriptor = _applyDecoratedDescriptor$2(_class2$2.prototype, "$$beanResourceProviders", [_dec3$3, _dec4$2], {
|
|
202
185
|
configurable: true,
|
|
203
186
|
enumerable: true,
|
|
204
187
|
writable: true,
|
|
@@ -229,9 +212,8 @@ var ControllerPageEntry = (_dec$3 = Controller(), _dec2$3 = BeanInfo({ module: "
|
|
|
229
212
|
super(...args);
|
|
230
213
|
this.formMeta = void 0;
|
|
231
214
|
this.formProvider = void 0;
|
|
232
|
-
this.
|
|
233
|
-
this.
|
|
234
|
-
this.pageEntryWrapperCelEnv = void 0;
|
|
215
|
+
this.formSchema = void 0;
|
|
216
|
+
this.jsxZova = void 0;
|
|
235
217
|
}
|
|
236
218
|
get $$modelResource() {
|
|
237
219
|
return usePrepareArg(this.$params.resource, true);
|
|
@@ -246,7 +228,6 @@ var ControllerPageEntry = (_dec$3 = Controller(), _dec2$3 = BeanInfo({ module: "
|
|
|
246
228
|
return this.$params.formScene ?? (isNil(this.entryId) ? "create" : "view");
|
|
247
229
|
}
|
|
248
230
|
async __init__() {
|
|
249
|
-
this.bean._setBean("$$pageEntryWrapper", this);
|
|
250
231
|
this.formMeta = this.$useComputed(() => {
|
|
251
232
|
const formScene = this.formScene;
|
|
252
233
|
return {
|
|
@@ -257,56 +238,31 @@ var ControllerPageEntry = (_dec$3 = Controller(), _dec2$3 = BeanInfo({ module: "
|
|
|
257
238
|
this.formProvider = this.$useComputed(() => {
|
|
258
239
|
return this.$$modelResource.formProvider;
|
|
259
240
|
});
|
|
260
|
-
this.
|
|
261
|
-
|
|
262
|
-
this.zovaJsx = this.app.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components, this.formProvider.actions, this.pageEntryWrapperCelEnv);
|
|
263
|
-
}
|
|
264
|
-
async onActionTable(_action) {}
|
|
265
|
-
async onActionRow(action) {
|
|
266
|
-
if (!this.entryId) return;
|
|
267
|
-
if (action === "delete") await this.$$modelResource.delete(this.entryId).mutateAsync();
|
|
268
|
-
}
|
|
269
|
-
_getPageEntryWrapperScope() {
|
|
270
|
-
const self = this;
|
|
271
|
-
const permissions = useCustomRef(() => {
|
|
272
|
-
return {
|
|
273
|
-
get() {
|
|
274
|
-
return self.$$modelResource.permissions;
|
|
275
|
-
},
|
|
276
|
-
set(_value) {}
|
|
277
|
-
};
|
|
241
|
+
this.formSchema = this.$useComputed(() => {
|
|
242
|
+
return this.$$modelResource.getFormSchema(this.formMeta);
|
|
278
243
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return this.onActionTable(action);
|
|
285
|
-
},
|
|
286
|
-
onActionRow: (action) => {
|
|
287
|
-
return this.onActionRow(action);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
_getPageEntryWrapperCelEnv() {
|
|
292
|
-
return celEnvBase.clone();
|
|
293
|
-
}
|
|
294
|
-
getJsxRenderContextPageEntryWrapper(celScope) {
|
|
295
|
-
return {
|
|
296
|
-
app: this.app,
|
|
297
|
-
ctx: this.ctx,
|
|
298
|
-
$scene: "pageEntryWrapper",
|
|
299
|
-
$host: this,
|
|
300
|
-
$celScope: celScope,
|
|
301
|
-
$jsx: this.zovaJsx,
|
|
302
|
-
$$pageEntryWrapper: this
|
|
303
|
-
};
|
|
244
|
+
this._prepareJsx();
|
|
245
|
+
await $QueryAutoLoad(() => this.$$modelResource.getFormApiSchemas(this.formMeta)?.sdk);
|
|
246
|
+
}
|
|
247
|
+
_prepareJsx() {
|
|
248
|
+
this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components, this.formProvider.actions);
|
|
304
249
|
}
|
|
305
250
|
render() {
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
251
|
+
const blocks = this.formSchema?.rest?.blocks;
|
|
252
|
+
if (!blocks || blocks.length === 0) return;
|
|
253
|
+
let domBlocks = [];
|
|
254
|
+
blocks.forEach((block, index) => {
|
|
255
|
+
const options = deepExtend({ key: index }, {
|
|
256
|
+
resource: this.resource,
|
|
257
|
+
id: this.entryId,
|
|
258
|
+
formScene: this.formScene
|
|
259
|
+
}, block.options);
|
|
260
|
+
const domBlock = this.jsxZova.render(block.render, options);
|
|
261
|
+
if (!domBlock) return;
|
|
262
|
+
if (Array.isArray(domBlock)) domBlocks.push(...domBlock);
|
|
263
|
+
else domBlocks.push(domBlock);
|
|
264
|
+
});
|
|
265
|
+
return createVNode(ZPage$1, null, _isSlot$1(domBlocks) ? domBlocks : { default: () => [domBlocks] });
|
|
310
266
|
}
|
|
311
267
|
}, _applyDecoratedDescriptor$1(_class2$1.prototype, "$$modelResource", [
|
|
312
268
|
_dec3$2,
|
|
@@ -338,69 +294,39 @@ var ControllerPageResource = (_dec$1 = Controller(), _dec2$1 = BeanInfo({ module
|
|
|
338
294
|
constructor(...args) {
|
|
339
295
|
super(...args);
|
|
340
296
|
this.tableProvider = void 0;
|
|
341
|
-
this.
|
|
342
|
-
this.zovaJsx = void 0;
|
|
343
|
-
this.pageWrapperCelEnv = void 0;
|
|
297
|
+
this.jsxZova = void 0;
|
|
344
298
|
}
|
|
345
299
|
get $$modelResource() {
|
|
346
300
|
return usePrepareArg(this.$params.resource, true);
|
|
347
301
|
}
|
|
302
|
+
get resource() {
|
|
303
|
+
return this.$params.resource;
|
|
304
|
+
}
|
|
348
305
|
async __init__() {
|
|
349
|
-
this.bean._setBean("$$pageWrapper", this);
|
|
350
306
|
this.tableProvider = this.$useComputed(() => {
|
|
351
307
|
return this.$$modelResource.tableProvider;
|
|
352
308
|
});
|
|
353
|
-
this.
|
|
354
|
-
|
|
355
|
-
this.zovaJsx = this.app.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components, this.tableProvider.actions, this.pageWrapperCelEnv);
|
|
309
|
+
this._prepareJsx();
|
|
310
|
+
await $QueryAutoLoad(() => this.$$modelResource.apiSchemasSelect.sdk);
|
|
356
311
|
}
|
|
357
|
-
|
|
358
|
-
|
|
312
|
+
_prepareJsx() {
|
|
313
|
+
this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components, this.tableProvider.actions);
|
|
359
314
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (action === "delete") await this.$$modelResource.delete(id).mutateAsync();
|
|
363
|
-
}
|
|
364
|
-
_getPageWrapperScope() {
|
|
365
|
-
const self = this;
|
|
366
|
-
const permissions = useCustomRef(() => {
|
|
367
|
-
return {
|
|
368
|
-
get() {
|
|
369
|
-
return self.$$modelResource.permissions;
|
|
370
|
-
},
|
|
371
|
-
set(_value) {}
|
|
372
|
-
};
|
|
373
|
-
});
|
|
374
|
-
return {
|
|
375
|
-
resource: this.$$modelResource.resource,
|
|
376
|
-
permissions,
|
|
377
|
-
onActionTable: (action) => {
|
|
378
|
-
return this.onActionTable(action);
|
|
379
|
-
},
|
|
380
|
-
onActionRow: (action, id) => {
|
|
381
|
-
return this.onActionRow(action, id);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
_getPageWrapperCelEnv() {
|
|
386
|
-
return celEnvBase.clone();
|
|
387
|
-
}
|
|
388
|
-
getJsxRenderContextPageWrapper(celScope) {
|
|
389
|
-
return {
|
|
390
|
-
app: this.app,
|
|
391
|
-
ctx: this.ctx,
|
|
392
|
-
$scene: "pageWrapper",
|
|
393
|
-
$host: this,
|
|
394
|
-
$celScope: celScope,
|
|
395
|
-
$jsx: this.zovaJsx,
|
|
396
|
-
$$pageWrapper: this
|
|
397
|
-
};
|
|
315
|
+
get schemaRow() {
|
|
316
|
+
return this.$$modelResource.schemaRow;
|
|
398
317
|
}
|
|
399
318
|
render() {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
319
|
+
const blocks = this.schemaRow?.rest?.blocks;
|
|
320
|
+
if (!blocks || blocks.length === 0) return;
|
|
321
|
+
let domBlocks = [];
|
|
322
|
+
blocks.forEach((block, index) => {
|
|
323
|
+
const options = deepExtend({ key: index }, { resource: this.resource }, block.options);
|
|
324
|
+
const domBlock = this.jsxZova.render(block.render, options);
|
|
325
|
+
if (!domBlock) return;
|
|
326
|
+
if (Array.isArray(domBlock)) domBlocks.push(...domBlock);
|
|
327
|
+
else domBlocks.push(domBlock);
|
|
328
|
+
});
|
|
329
|
+
return createVNode(ZPage, null, _isSlot(domBlocks) ? domBlocks : { default: () => [domBlocks] });
|
|
404
330
|
}
|
|
405
331
|
}, _applyDecoratedDescriptor(_class2.prototype, "$$modelResource", [
|
|
406
332
|
_dec3,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["celEnvBase","isNil","z","BeanControllerPageBase","Use","useCustomRef","usePrepareArg","ZovaJsx","Controller","formMetaFromFormScene","_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","pageEntryWrapperScope","zovaJsx","pageEntryWrapperCelEnv","$$modelResource","$params","entryId","__init__","bean","_setBean","$useComputed","_getPageEntryWrapperScope","_getPageEntryWrapperCelEnv","app","_newBeanSimple","components","actions","onActionTable","_action","onActionRow","action","mutation","delete","mutateAsync","self","permissions","get","set","_value","celEnv","clone","getJsxRenderContextPageEntryWrapper","celScope","ctx","$scene","$host","$celScope","$jsx","$$pageEntryWrapper","render","jsxRenderContext","domRestPageEntry","componentRestPageEntry","_createVNode","ZPage","default","_applyDecoratedDescriptor","getOwnPropertyDescriptor","Virtual","Controller","ControllerPageEntry","ControllerPageEntrySchemaParams","ControllerPageEntryCreateSchemaParams","ControllerPageEntryCreate","_dec","_dec2","_dec3","__z_BeanInfo","module","_class","celEnvBase","z","BeanControllerPageBase","Use","useCustomRef","usePrepareArg","ZovaJsx","Controller","_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","pageWrapperScope","zovaJsx","pageWrapperCelEnv","$$modelResource","$params","__init__","bean","_setBean","$useComputed","_getPageWrapperScope","_getPageWrapperCelEnv","app","_newBeanSimple","components","actions","onActionTable","_action","onActionRow","action","id","mutation","delete","mutateAsync","self","permissions","get","set","_value","celEnv","clone","getJsxRenderContextPageWrapper","celScope","ctx","$scene","$host","$celScope","$jsx","$$pageWrapper","render","jsxRenderContext","domRestPage","componentRestPage","_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 { IOpenapiOptionsResourceMeta, ITableQuery, ITableRes, ScopeModuleAOpenapi, TypeOpenapiPermissions } from 'zova-module-a-openapi';\n\nimport { hashkey, isNil } from '@cabloy/utils';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { deepExtend, UseScope } from 'zova';\nimport { formSceneFromFormMeta, IFormMeta, IFormProvider } from 'zova-module-a-form';\nimport { $QueryAutoLoad, BeanModelBase, Model } from 'zova-module-a-model';\nimport { SymbolOpenapiSchemaName } from 'zova-module-a-openapi';\nimport { ITableProvider } from 'zova-module-a-table';\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 resourceMeta: IOpenapiOptionsResourceMeta;\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 @UseScope('a-openapi')\n $$scopeModuleAOpenapi: 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 // resourceMeta\n this.resourceMeta = this.$useComputed(() => {\n const resourceMeta = this.$sdk.getBootstrap(this.resource);\n return deepExtend({}, this.$$scopeModuleAOpenapi.config.resourceMeta, resourceMeta.data?.resourceMeta);\n });\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 deepExtend({}, this.resourceMeta.provider, this.resourceMeta.form?.provider);\n });\n this.tableProvider = this.$useComputed(() => {\n return deepExtend({}, this.resourceMeta.provider, this.resourceMeta.table?.provider);\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 get componentRestPage() {\n return this.resourceMeta.provider!.components!.restPage!;\n }\n\n public get componentRestPageEntry() {\n return this.resourceMeta.provider!.components!.restPageEntry!;\n }\n\n public get componentTable() {\n return this.resourceMeta.provider!.components!.table!;\n }\n\n public get componentForm() {\n return this.resourceMeta.provider!.components!.form!;\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 { celEnvBase, isNil } from '@cabloy/utils';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, Use, useCustomRef, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { formMetaFromFormScene, IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-form';\nimport { TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'zova-module-a-openapi';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nimport { IJsxRenderContextPageEntryWrapper, IPageEntryWrapperScope } from '../../types/pageEntryWrapper.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 pageEntryWrapperScope: IPageEntryWrapperScope;\n zovaJsx: ZovaJsx;\n pageEntryWrapperCelEnv: typeof celEnvBase;\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.bean._setBean('$$pageEntryWrapper', this);\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.pageEntryWrapperScope = this._getPageEntryWrapperScope();\n // jsx\n this.pageEntryWrapperCelEnv = this._getPageEntryWrapperCelEnv();\n this.zovaJsx = this.app.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components, this.formProvider.actions, this.pageEntryWrapperCelEnv);\n }\n\n async onActionTable(_action: keyof TypeResourceActionTableRecord) {}\n\n async onActionRow(action: keyof TypeResourceActionRowRecord) {\n if (!this.entryId) return;\n if (action === 'delete') {\n const mutation = this.$$modelResource.delete(this.entryId);\n await mutation.mutateAsync();\n }\n }\n\n private _getPageEntryWrapperScope(): IPageEntryWrapperScope {\n const self = this;\n const permissions = useCustomRef(() => {\n return {\n get() {\n return self.$$modelResource.permissions;\n },\n set(_value) {},\n };\n }) as any;\n return {\n resource: this.$params.resource,\n id: this.entryId,\n permissions,\n onActionTable: (action: keyof TypeResourceActionTableRecord) => {\n return this.onActionTable(action);\n },\n onActionRow: (action: keyof TypeResourceActionRowRecord) => {\n return this.onActionRow(action);\n },\n };\n }\n\n private _getPageEntryWrapperCelEnv(): typeof celEnvBase {\n const celEnv = celEnvBase.clone();\n return celEnv;\n }\n\n public getJsxRenderContextPageEntryWrapper(celScope: IPageEntryWrapperScope): IJsxRenderContextPageEntryWrapper {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'pageEntryWrapper',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$pageEntryWrapper: this,\n };\n }\n\n protected render() {\n const celScope = this.pageEntryWrapperScope;\n const jsxRenderContext = this.getJsxRenderContextPageEntryWrapper(celScope);\n const domRestPageEntry = this.zovaJsx.render(this.$$modelResource.componentRestPageEntry, {}, celScope, jsxRenderContext);\n return <ZPage>{domRestPageEntry}</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 { celEnvBase } from '@cabloy/utils';\nimport { z } from 'zod';\nimport { BeanControllerPageBase, Use, useCustomRef, usePrepareArg } from 'zova';\nimport { ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'zova-module-a-openapi';\nimport { ITableProvider } from 'zova-module-a-table';\nimport { ZPage } from 'zova-module-home-base';\n\nimport type { ModelResource } from '../../model/resource.js';\n\nimport { IJsxRenderContextPageWrapper, IPageWrapperScope } from '../../types/pageWrapper.js';\n\nexport const ControllerPageResourceSchemaParams = z.object({\n resource: z.string(),\n});\n\n@Controller()\nexport class ControllerPageResource extends BeanControllerPageBase {\n tableProvider: ITableProvider;\n pageWrapperScope: IPageWrapperScope;\n zovaJsx: ZovaJsx;\n pageWrapperCelEnv: typeof celEnvBase;\n\n @Use({ beanFullName: 'rest-resource.model.resource' })\n get $$modelResource(): ModelResource {\n return usePrepareArg(this.$params.resource, true);\n }\n\n protected async __init__() {\n this.bean._setBean('$$pageWrapper', this);\n this.tableProvider = this.$useComputed(() => {\n return this.$$modelResource.tableProvider;\n });\n this.pageWrapperScope = this._getPageWrapperScope();\n // jsx\n this.pageWrapperCelEnv = this._getPageWrapperCelEnv();\n this.zovaJsx = this.app.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components, this.tableProvider.actions, this.pageWrapperCelEnv);\n }\n\n get resource() {\n return this.$params.resource;\n }\n\n async onActionTable(_action: keyof TypeResourceActionTableRecord) {}\n\n async onActionRow(action: keyof TypeResourceActionRowRecord, id: string) {\n if (action === 'delete') {\n const mutation = this.$$modelResource.delete(id);\n await mutation.mutateAsync();\n }\n }\n\n private _getPageWrapperScope(): IPageWrapperScope {\n const self = this;\n const permissions = useCustomRef(() => {\n return {\n get() {\n return self.$$modelResource.permissions;\n },\n set(_value) {},\n };\n }) as any;\n return {\n resource: this.$$modelResource.resource,\n permissions,\n onActionTable: (action: keyof TypeResourceActionTableRecord) => {\n return this.onActionTable(action);\n },\n onActionRow: (action: keyof TypeResourceActionRowRecord, id: string) => {\n return this.onActionRow(action, id);\n },\n };\n }\n\n private _getPageWrapperCelEnv(): typeof celEnvBase {\n const celEnv = celEnvBase.clone();\n return celEnv;\n }\n\n public getJsxRenderContextPageWrapper(celScope: IPageWrapperScope): IJsxRenderContextPageWrapper {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'pageWrapper',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$pageWrapper: this,\n };\n }\n\n public render() {\n const celScope = this.pageWrapperScope;\n const jsxRenderContext = this.getJsxRenderContextPageWrapper(celScope);\n const domRestPage = this.zovaJsx.render(this.$$modelResource.componentRestPage, {}, celScope, jsxRenderContext);\n return <ZPage>{domRestPage}</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(ControllerPageEntryCreate, undefined, undefined);\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 {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,eAAA;GACrC,0BAA2B,wBAAC,EAAA,EAAA;AAC9B,IAAa,aAAa,wBAAiB,qBAAA,KAAA,GAAgC,KAAA,EAAA;;;ACJ3E,IAAS;CACT,SAAS,8BAAA;AACQ,8BAA4B,eAAA;GAC3C,gCAA4B,8BAAA,EAAqC,EAAA;AACnE,IAAa,mBAAiB,wBAAa,2BAAsC,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"}
|
|
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","actions","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","actions","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, this.formProvider.actions);\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, this.tableProvider.actions);\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;AAAI,IAAE,KAAK,EAAA;GAAQ,EAAC,EAAA,aAAQ,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,EA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AAAD,SAAA,IAAAA;;;ACpED,IAAS;CACT,SAAS,wBAAA;AACQ,wBAAsB,eAAA;GACrC,0BAA2B,wBAAC,EAAA,EAAA;AAC9B,IAAa,aAAa,wBAAiB,qBAAA,KAAA,GAAgC,KAAA,EAAA;;;ACJ3E,IAAS;CACT,SAAS,8BAAA;AACQ,8BAA4B,eAAA;GAC3C,gCAA4B,8BAAA,EAAqC,EAAA;AACnE,IAAa,mBAAiB,wBAAa,2BAAsC,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,16 +1,14 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFormMeta, IFormProvider, ITableProvider, ITableQuery, ITableRes, TypeOpenapiPermissions } from 'zova-module-a-openapi';
|
|
4
4
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
5
|
-
import { IFormMeta, IFormProvider } from 'zova-module-a-form';
|
|
6
5
|
import { BeanModelBase } from 'zova-module-a-model';
|
|
7
|
-
import {
|
|
6
|
+
import { BeanResourceProviders } from 'zova-module-a-openapi';
|
|
8
7
|
export interface IModelOptionsResource extends IDecoratorModelOptions {
|
|
9
8
|
}
|
|
10
9
|
export declare class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityUpdate = Partial<Entity>> extends BeanModelBase {
|
|
11
10
|
resource: string;
|
|
12
11
|
resourceApi: string;
|
|
13
|
-
resourceMeta: IOpenapiOptionsResourceMeta;
|
|
14
12
|
permissions?: TypeOpenapiPermissions;
|
|
15
13
|
formProvider: IFormProvider;
|
|
16
14
|
tableProvider: ITableProvider;
|
|
@@ -20,7 +18,7 @@ export declare class ModelResource<Entity = any, EntityCreate = Partial<Entity>,
|
|
|
20
18
|
schemaFilter?: SchemaObject;
|
|
21
19
|
schemaRow?: SchemaObject;
|
|
22
20
|
schemaPages?: SchemaObject;
|
|
23
|
-
$$
|
|
21
|
+
$$beanResourceProviders: BeanResourceProviders;
|
|
24
22
|
protected __init__(resource: string): Promise<void>;
|
|
25
23
|
selectGeneral(actionPath?: string, query?: ITableQuery): import("vue").UnwrapNestedRefs<import("@tanstack/vue-query").UseQueryReturnType<ITableRes<Entity>, Error>>;
|
|
26
24
|
select(query?: ITableQuery): import("vue").UnwrapNestedRefs<import("@tanstack/vue-query").UseQueryReturnType<ITableRes<Entity>, Error>>;
|
|
@@ -32,10 +30,6 @@ export declare class ModelResource<Entity = any, EntityCreate = Partial<Entity>,
|
|
|
32
30
|
get apiSchemasView(): import("zova-module-a-openapi").IOpenapiSchemas;
|
|
33
31
|
get apiSchemasCreate(): import("zova-module-a-openapi").IOpenapiSchemas;
|
|
34
32
|
get apiSchemasUpdate(): import("zova-module-a-openapi").IOpenapiSchemas;
|
|
35
|
-
get componentRestPage(): "basic-restpage:restPage";
|
|
36
|
-
get componentRestPageEntry(): "basic-restpage:restPageEntry";
|
|
37
|
-
get componentTable(): import("zova-core").TypeComponentRecordSelectorKeysStrict<"table">;
|
|
38
|
-
get componentForm(): "a-form:form";
|
|
39
33
|
getFormSchema(formMeta: IFormMeta): SchemaObject | undefined;
|
|
40
34
|
getFormApiSchemas(formMeta: IFormMeta): import("zova-module-a-openapi").IOpenapiSchemas;
|
|
41
35
|
getFormMutationSubmit(formMeta: IFormMeta, id?: TableIdentity): DataMutation | undefined;
|
|
@@ -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,
|
|
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,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGtI,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAkB,aAAa,EAAS,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAA2B,MAAM,uBAAuB,CAAC;AAEvF,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;CAAG;AAExE,qBAGa,aAAa,CAAC,MA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,CAAC,UAAU,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS;YAQ/E,UAAU;CAOzB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-openapi';
|
|
2
|
+
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
import { BeanControllerPageBase } from 'zova';
|
|
4
5
|
import { ZovaJsx } from 'zova-jsx';
|
|
5
|
-
import { IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-form';
|
|
6
|
-
import { TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'zova-module-a-openapi';
|
|
7
6
|
import type { ModelResource } from '../../model/resource.js';
|
|
8
|
-
import { IJsxRenderContextPageEntryWrapper, IPageEntryWrapperScope } from '../../types/pageEntryWrapper.js';
|
|
9
7
|
export declare const ControllerPageEntrySchemaParams: z.ZodObject<{
|
|
10
8
|
resource: z.ZodString;
|
|
11
9
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -14,19 +12,14 @@ export declare const ControllerPageEntrySchemaParams: z.ZodObject<{
|
|
|
14
12
|
export declare class ControllerPageEntry extends BeanControllerPageBase {
|
|
15
13
|
formMeta: IFormMeta;
|
|
16
14
|
formProvider: IFormProvider;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
pageEntryWrapperCelEnv: typeof celEnvBase;
|
|
15
|
+
formSchema?: SchemaObject;
|
|
16
|
+
jsxZova: ZovaJsx;
|
|
20
17
|
get $$modelResource(): ModelResource;
|
|
21
18
|
get resource(): string;
|
|
22
19
|
get entryId(): string | undefined;
|
|
23
20
|
get formScene(): TypeFormScene;
|
|
24
21
|
protected __init__(): Promise<void>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
private _getPageEntryWrapperScope;
|
|
28
|
-
private _getPageEntryWrapperCelEnv;
|
|
29
|
-
getJsxRenderContextPageEntryWrapper(celScope: IPageEntryWrapperScope): IJsxRenderContextPageEntryWrapper;
|
|
30
|
-
protected render(): import("vue/jsx-runtime").JSX.Element;
|
|
22
|
+
private _prepareJsx;
|
|
23
|
+
protected render(): import("vue/jsx-runtime").JSX.Element | undefined;
|
|
31
24
|
}
|
|
32
25
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/entry/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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;AAOnC,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,27 +1,19 @@
|
|
|
1
|
-
import { celEnvBase } from '@cabloy/utils';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { BeanControllerPageBase } from 'zova';
|
|
4
3
|
import { ZovaJsx } from 'zova-jsx';
|
|
5
|
-
import {
|
|
6
|
-
import { ITableProvider } from 'zova-module-a-table';
|
|
4
|
+
import { ITableProvider } from 'zova-module-a-openapi';
|
|
7
5
|
import type { ModelResource } from '../../model/resource.js';
|
|
8
|
-
import { IJsxRenderContextPageWrapper, IPageWrapperScope } from '../../types/pageWrapper.js';
|
|
9
6
|
export declare const ControllerPageResourceSchemaParams: z.ZodObject<{
|
|
10
7
|
resource: z.ZodString;
|
|
11
8
|
}, z.core.$strip>;
|
|
12
9
|
export declare class ControllerPageResource extends BeanControllerPageBase {
|
|
13
10
|
tableProvider: ITableProvider;
|
|
14
|
-
|
|
15
|
-
zovaJsx: ZovaJsx;
|
|
16
|
-
pageWrapperCelEnv: typeof celEnvBase;
|
|
11
|
+
jsxZova: ZovaJsx;
|
|
17
12
|
get $$modelResource(): ModelResource;
|
|
18
|
-
protected __init__(): Promise<void>;
|
|
19
13
|
get resource(): string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
getJsxRenderContextPageWrapper(celScope: IPageWrapperScope): IJsxRenderContextPageWrapper;
|
|
25
|
-
render(): import("vue/jsx-runtime").JSX.Element;
|
|
14
|
+
protected __init__(): Promise<void>;
|
|
15
|
+
private _prepareJsx;
|
|
16
|
+
get schemaRow(): import("openapi3-ts/oas31").SchemaObject | undefined;
|
|
17
|
+
render(): import("vue/jsx-runtime").JSX.Element | undefined;
|
|
26
18
|
}
|
|
27
19
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/page/resource/controller.tsx"],"names":[],"mappings":"
|
|
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;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAO,MAAM,kCAAkC;;iBAE7C,CAAC;AAEH,qBACa,sBAAuB,SAAQ,sBAAsB;IAChE,aAAa,EAAE,cAAc,CAAC;IAE9B,OAAO,EAAE,OAAO,CAAC;IAEjB,IACI,eAAe,IAAI,aAAa,CAEnC;IAED,IAAI,QAAQ,WAEX;cAEe,QAAQ;IAUxB,OAAO,CAAC,WAAW;IAInB,IAAI,SAAS,yDAEZ;IAEM,MAAM;CAsBd"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import type { TableIdentity } from 'table-identity';
|
|
2
|
-
import type { IJsxRenderContextBase, TypeOpenapiPermissions, TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'zova-module-a-openapi';
|
|
3
1
|
import type { ControllerPageEntry } from '../page/entry/controller.jsx';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onActionRow?: (action: keyof TypeResourceActionRowRecord) => Promise<any> | any;
|
|
10
|
-
}
|
|
11
|
-
export interface IJsxRenderContextPageEntryWrapper extends IJsxRenderContextBase {
|
|
12
|
-
$celScope: IPageEntryWrapperScope;
|
|
13
|
-
$$pageEntryWrapper: ControllerPageEntry;
|
|
2
|
+
import 'zova-module-a-openapi';
|
|
3
|
+
declare module 'zova-module-a-openapi' {
|
|
4
|
+
interface IJsxRenderContextPageEntryWrapper {
|
|
5
|
+
$$pageEntryWrapper: ControllerPageEntry;
|
|
6
|
+
}
|
|
14
7
|
}
|
|
15
8
|
//# sourceMappingURL=pageEntryWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageEntryWrapper.d.ts","sourceRoot":"","sources":["../../src/types/pageEntryWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pageEntryWrapper.d.ts","sourceRoot":"","sources":["../../src/types/pageEntryWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,uBAAuB,CAAC;AAE/B,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAiB,iCAAiC;QAChD,kBAAkB,EAAE,mBAAmB,CAAC;KACzC;CACF"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type { IJsxRenderContextBase, TypeOpenapiPermissions, TypeResourceActionRowRecord, TypeResourceActionTableRecord } from 'zova-module-a-openapi';
|
|
2
1
|
import type { ControllerPageResource } from '../page/resource/controller.jsx';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export interface IJsxRenderContextPageWrapper extends IJsxRenderContextBase {
|
|
10
|
-
$celScope: IPageWrapperScope;
|
|
11
|
-
$$pageWrapper: ControllerPageResource;
|
|
2
|
+
import 'zova-module-a-openapi';
|
|
3
|
+
declare module 'zova-module-a-openapi' {
|
|
4
|
+
interface IJsxRenderContextPageWrapper {
|
|
5
|
+
$$pageWrapper: ControllerPageResource;
|
|
6
|
+
}
|
|
12
7
|
}
|
|
13
8
|
//# sourceMappingURL=pageWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageWrapper.d.ts","sourceRoot":"","sources":["../../src/types/pageWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pageWrapper.d.ts","sourceRoot":"","sources":["../../src/types/pageWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,uBAAuB,CAAC;AAE/B,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAiB,4BAA4B;QAC3C,aAAa,EAAE,sBAAsB,CAAC;KACvC;CACF"}
|
package/package.json
CHANGED
|
@@ -9,4 +9,8 @@ export namespace NSControllerPageEntryCreate {
|
|
|
9
9
|
export type ParamsOutput = z.output<typeof ControllerPageEntryCreateSchemaParams>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const ZPageEntryCreate = createZovaComponentPage(
|
|
12
|
+
export const ZPageEntryCreate = createZovaComponentPage(
|
|
13
|
+
ControllerPageEntryCreate,
|
|
14
|
+
undefined,
|
|
15
|
+
undefined,
|
|
16
|
+
);
|
package/src/model/resource.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { DataMutation, IDecoratorModelOptions } from 'zova-module-a-model';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IFormMeta, IFormProvider, ITableProvider, 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 {
|
|
8
|
-
import { formSceneFromFormMeta
|
|
7
|
+
import { Use } from 'zova';
|
|
8
|
+
import { formSceneFromFormMeta } from 'zova-module-a-form';
|
|
9
9
|
import { $QueryAutoLoad, BeanModelBase, Model } from 'zova-module-a-model';
|
|
10
|
-
import { SymbolOpenapiSchemaName } from 'zova-module-a-openapi';
|
|
11
|
-
import { ITableProvider } from 'zova-module-a-table';
|
|
10
|
+
import { BeanResourceProviders, SymbolOpenapiSchemaName } from 'zova-module-a-openapi';
|
|
12
11
|
|
|
13
12
|
export interface IModelOptionsResource extends IDecoratorModelOptions {}
|
|
14
13
|
|
|
@@ -18,7 +17,6 @@ export interface IModelOptionsResource extends IDecoratorModelOptions {}
|
|
|
18
17
|
export class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityUpdate = Partial<Entity>> extends BeanModelBase {
|
|
19
18
|
public resource: string;
|
|
20
19
|
public resourceApi: string;
|
|
21
|
-
public resourceMeta: IOpenapiOptionsResourceMeta;
|
|
22
20
|
public permissions?: TypeOpenapiPermissions;
|
|
23
21
|
public formProvider: IFormProvider;
|
|
24
22
|
public tableProvider: ITableProvider;
|
|
@@ -29,27 +27,22 @@ export class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityU
|
|
|
29
27
|
public schemaRow?: SchemaObject;
|
|
30
28
|
public schemaPages?: SchemaObject;
|
|
31
29
|
|
|
32
|
-
@
|
|
33
|
-
$$
|
|
30
|
+
@Use()
|
|
31
|
+
$$beanResourceProviders: BeanResourceProviders;
|
|
34
32
|
|
|
35
33
|
protected async __init__(resource: string) {
|
|
36
34
|
if (!resource) throw new Error('resource not specified');
|
|
37
35
|
await super.__init__(resource);
|
|
38
36
|
this.resource = resource;
|
|
39
|
-
// resourceMeta
|
|
40
|
-
this.resourceMeta = this.$useComputed(() => {
|
|
41
|
-
const resourceMeta = this.$sdk.getBootstrap(this.resource);
|
|
42
|
-
return deepExtend({}, this.$$scopeModuleAOpenapi.config.resourceMeta, resourceMeta.data?.resourceMeta);
|
|
43
|
-
});
|
|
44
37
|
this.permissions = this.$useComputed(() => {
|
|
45
38
|
const permissions = this.$sdk.getPermissions(this.resource);
|
|
46
39
|
return permissions.data;
|
|
47
40
|
});
|
|
48
41
|
this.formProvider = this.$useComputed(() => {
|
|
49
|
-
return
|
|
42
|
+
return this.$$beanResourceProviders.formProvider;
|
|
50
43
|
});
|
|
51
44
|
this.tableProvider = this.$useComputed(() => {
|
|
52
|
-
return
|
|
45
|
+
return this.$$beanResourceProviders.tableProvider;
|
|
53
46
|
});
|
|
54
47
|
this.schemaView = this.$useComputed(() => {
|
|
55
48
|
return this.apiSchemasView.responseBody;
|
|
@@ -170,22 +163,6 @@ export class ModelResource<Entity = any, EntityCreate = Partial<Entity>, EntityU
|
|
|
170
163
|
return this.$sdk.createApiSchemas(`${this.resourceApi}/:id`, 'patch');
|
|
171
164
|
}
|
|
172
165
|
|
|
173
|
-
public get componentRestPage() {
|
|
174
|
-
return this.resourceMeta.provider!.components!.restPage!;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
public get componentRestPageEntry() {
|
|
178
|
-
return this.resourceMeta.provider!.components!.restPageEntry!;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
public get componentTable() {
|
|
182
|
-
return this.resourceMeta.provider!.components!.table!;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
public get componentForm() {
|
|
186
|
-
return this.resourceMeta.provider!.components!.form!;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
166
|
public getFormSchema(formMeta: IFormMeta) {
|
|
190
167
|
const formScene = formMeta.formScene ?? formSceneFromFormMeta(formMeta);
|
|
191
168
|
if (formScene === 'view') return this.schemaView;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IFormMeta, IFormProvider, TypeFormScene } from 'zova-module-a-openapi';
|
|
2
|
+
|
|
3
|
+
import { isNil } from '@cabloy/utils';
|
|
4
|
+
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
5
|
+
import { VNode } from 'vue';
|
|
2
6
|
import { z } from 'zod';
|
|
3
|
-
import { BeanControllerPageBase,
|
|
7
|
+
import { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';
|
|
4
8
|
import { ZovaJsx } from 'zova-jsx';
|
|
5
9
|
import { Controller } from 'zova-module-a-bean';
|
|
6
|
-
import { formMetaFromFormScene
|
|
7
|
-
import {
|
|
10
|
+
import { formMetaFromFormScene } from 'zova-module-a-form';
|
|
11
|
+
import { $QueryAutoLoad } from 'zova-module-a-model';
|
|
12
|
+
import { IResourceBlockOptionsPageEntry } from 'zova-module-basic-openapi';
|
|
8
13
|
import { ZPage } from 'zova-module-home-base';
|
|
9
14
|
|
|
10
15
|
import type { ModelResource } from '../../model/resource.js';
|
|
11
16
|
|
|
12
|
-
import { IJsxRenderContextPageEntryWrapper, IPageEntryWrapperScope } from '../../types/pageEntryWrapper.js';
|
|
13
|
-
|
|
14
17
|
export const ControllerPageEntrySchemaParams = z.object({
|
|
15
18
|
resource: z.string(),
|
|
16
19
|
id: z.string().optional(),
|
|
@@ -21,9 +24,8 @@ export const ControllerPageEntrySchemaParams = z.object({
|
|
|
21
24
|
export class ControllerPageEntry extends BeanControllerPageBase {
|
|
22
25
|
formMeta: IFormMeta;
|
|
23
26
|
formProvider: IFormProvider;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
pageEntryWrapperCelEnv: typeof celEnvBase;
|
|
27
|
+
formSchema?: SchemaObject;
|
|
28
|
+
jsxZova: ZovaJsx;
|
|
27
29
|
|
|
28
30
|
@Use({ beanFullName: 'rest-resource.model.resource' })
|
|
29
31
|
get $$modelResource(): ModelResource {
|
|
@@ -43,7 +45,6 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
protected async __init__() {
|
|
46
|
-
this.bean._setBean('$$pageEntryWrapper', this);
|
|
47
48
|
this.formMeta = this.$useComputed(() => {
|
|
48
49
|
const formScene = this.formScene;
|
|
49
50
|
return { ...formMetaFromFormScene(formScene), formScene };
|
|
@@ -51,66 +52,41 @@ export class ControllerPageEntry extends BeanControllerPageBase {
|
|
|
51
52
|
this.formProvider = this.$useComputed(() => {
|
|
52
53
|
return this.$$modelResource.formProvider;
|
|
53
54
|
});
|
|
54
|
-
this.
|
|
55
|
+
this.formSchema = this.$useComputed(() => {
|
|
56
|
+
return this.$$modelResource.getFormSchema(this.formMeta);
|
|
57
|
+
});
|
|
55
58
|
// jsx
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
async onActionTable(_action: keyof TypeResourceActionTableRecord) {}
|
|
61
|
-
|
|
62
|
-
async onActionRow(action: keyof TypeResourceActionRowRecord) {
|
|
63
|
-
if (!this.entryId) return;
|
|
64
|
-
if (action === 'delete') {
|
|
65
|
-
const mutation = this.$$modelResource.delete(this.entryId);
|
|
66
|
-
await mutation.mutateAsync();
|
|
67
|
-
}
|
|
59
|
+
this._prepareJsx();
|
|
60
|
+
// load schema
|
|
61
|
+
await $QueryAutoLoad(() => this.$$modelResource.getFormApiSchemas(this.formMeta)?.sdk);
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
const permissions = useCustomRef(() => {
|
|
73
|
-
return {
|
|
74
|
-
get() {
|
|
75
|
-
return self.$$modelResource.permissions;
|
|
76
|
-
},
|
|
77
|
-
set(_value) {},
|
|
78
|
-
};
|
|
79
|
-
}) as any;
|
|
80
|
-
return {
|
|
81
|
-
resource: this.$params.resource,
|
|
82
|
-
id: this.entryId,
|
|
83
|
-
permissions,
|
|
84
|
-
onActionTable: (action: keyof TypeResourceActionTableRecord) => {
|
|
85
|
-
return this.onActionTable(action);
|
|
86
|
-
},
|
|
87
|
-
onActionRow: (action: keyof TypeResourceActionRowRecord) => {
|
|
88
|
-
return this.onActionRow(action);
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private _getPageEntryWrapperCelEnv(): typeof celEnvBase {
|
|
94
|
-
const celEnv = celEnvBase.clone();
|
|
95
|
-
return celEnv;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public getJsxRenderContextPageEntryWrapper(celScope: IPageEntryWrapperScope): IJsxRenderContextPageEntryWrapper {
|
|
99
|
-
return {
|
|
100
|
-
app: this.app,
|
|
101
|
-
ctx: this.ctx,
|
|
102
|
-
$scene: 'pageEntryWrapper',
|
|
103
|
-
$host: this,
|
|
104
|
-
$celScope: celScope,
|
|
105
|
-
$jsx: this.zovaJsx,
|
|
106
|
-
$$pageEntryWrapper: this,
|
|
107
|
-
};
|
|
64
|
+
private _prepareJsx() {
|
|
65
|
+
this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.formProvider.components, this.formProvider.actions);
|
|
108
66
|
}
|
|
109
67
|
|
|
110
68
|
protected render() {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
69
|
+
const blocks = this.formSchema?.rest?.blocks;
|
|
70
|
+
if (!blocks || blocks.length === 0) return;
|
|
71
|
+
let domBlocks: VNode[] = [];
|
|
72
|
+
blocks.forEach((block, index) => {
|
|
73
|
+
const options = deepExtend(
|
|
74
|
+
{ key: index },
|
|
75
|
+
{
|
|
76
|
+
resource: this.resource,
|
|
77
|
+
id: this.entryId,
|
|
78
|
+
formScene: this.formScene,
|
|
79
|
+
} satisfies IResourceBlockOptionsPageEntry,
|
|
80
|
+
block.options,
|
|
81
|
+
);
|
|
82
|
+
const domBlock = this.jsxZova.render(block.render!, options);
|
|
83
|
+
if (!domBlock) return;
|
|
84
|
+
if (Array.isArray(domBlock)) {
|
|
85
|
+
domBlocks.push(...domBlock);
|
|
86
|
+
} else {
|
|
87
|
+
domBlocks.push(domBlock);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return <ZPage>{domBlocks}</ZPage>;
|
|
115
91
|
}
|
|
116
92
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { BeanControllerPageBase,
|
|
3
|
+
import { BeanControllerPageBase, deepExtend, Use, usePrepareArg } from 'zova';
|
|
4
4
|
import { ZovaJsx } from 'zova-jsx';
|
|
5
5
|
import { Controller } from 'zova-module-a-bean';
|
|
6
|
-
import {
|
|
7
|
-
import { ITableProvider } from 'zova-module-a-
|
|
6
|
+
import { $QueryAutoLoad } from 'zova-module-a-model';
|
|
7
|
+
import { ITableProvider } from 'zova-module-a-openapi';
|
|
8
|
+
import { IResourceBlockOptionsPage } from 'zova-module-basic-openapi';
|
|
8
9
|
import { ZPage } from 'zova-module-home-base';
|
|
9
10
|
|
|
10
11
|
import type { ModelResource } from '../../model/resource.js';
|
|
11
12
|
|
|
12
|
-
import { IJsxRenderContextPageWrapper, IPageWrapperScope } from '../../types/pageWrapper.js';
|
|
13
|
-
|
|
14
13
|
export const ControllerPageResourceSchemaParams = z.object({
|
|
15
14
|
resource: z.string(),
|
|
16
15
|
});
|
|
@@ -18,82 +17,56 @@ export const ControllerPageResourceSchemaParams = z.object({
|
|
|
18
17
|
@Controller()
|
|
19
18
|
export class ControllerPageResource extends BeanControllerPageBase {
|
|
20
19
|
tableProvider: ITableProvider;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
pageWrapperCelEnv: typeof celEnvBase;
|
|
20
|
+
|
|
21
|
+
jsxZova: ZovaJsx;
|
|
24
22
|
|
|
25
23
|
@Use({ beanFullName: 'rest-resource.model.resource' })
|
|
26
24
|
get $$modelResource(): ModelResource {
|
|
27
25
|
return usePrepareArg(this.$params.resource, true);
|
|
28
26
|
}
|
|
29
27
|
|
|
28
|
+
get resource() {
|
|
29
|
+
return this.$params.resource;
|
|
30
|
+
}
|
|
31
|
+
|
|
30
32
|
protected async __init__() {
|
|
31
|
-
this.bean._setBean('$$pageWrapper', this);
|
|
32
33
|
this.tableProvider = this.$useComputed(() => {
|
|
33
34
|
return this.$$modelResource.tableProvider;
|
|
34
35
|
});
|
|
35
|
-
this.pageWrapperScope = this._getPageWrapperScope();
|
|
36
36
|
// jsx
|
|
37
|
-
this.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
get resource() {
|
|
42
|
-
return this.$params.resource;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async onActionTable(_action: keyof TypeResourceActionTableRecord) {}
|
|
46
|
-
|
|
47
|
-
async onActionRow(action: keyof TypeResourceActionRowRecord, id: string) {
|
|
48
|
-
if (action === 'delete') {
|
|
49
|
-
const mutation = this.$$modelResource.delete(id);
|
|
50
|
-
await mutation.mutateAsync();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private _getPageWrapperScope(): IPageWrapperScope {
|
|
55
|
-
const self = this;
|
|
56
|
-
const permissions = useCustomRef(() => {
|
|
57
|
-
return {
|
|
58
|
-
get() {
|
|
59
|
-
return self.$$modelResource.permissions;
|
|
60
|
-
},
|
|
61
|
-
set(_value) {},
|
|
62
|
-
};
|
|
63
|
-
}) as any;
|
|
64
|
-
return {
|
|
65
|
-
resource: this.$$modelResource.resource,
|
|
66
|
-
permissions,
|
|
67
|
-
onActionTable: (action: keyof TypeResourceActionTableRecord) => {
|
|
68
|
-
return this.onActionTable(action);
|
|
69
|
-
},
|
|
70
|
-
onActionRow: (action: keyof TypeResourceActionRowRecord, id: string) => {
|
|
71
|
-
return this.onActionRow(action, id);
|
|
72
|
-
},
|
|
73
|
-
};
|
|
37
|
+
this._prepareJsx();
|
|
38
|
+
// load schema/data
|
|
39
|
+
await $QueryAutoLoad(() => this.$$modelResource.apiSchemasSelect.sdk);
|
|
74
40
|
}
|
|
75
41
|
|
|
76
|
-
private
|
|
77
|
-
|
|
78
|
-
return celEnv;
|
|
42
|
+
private _prepareJsx() {
|
|
43
|
+
this.jsxZova = this.app.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components, this.tableProvider.actions);
|
|
79
44
|
}
|
|
80
45
|
|
|
81
|
-
|
|
82
|
-
return
|
|
83
|
-
app: this.app,
|
|
84
|
-
ctx: this.ctx,
|
|
85
|
-
$scene: 'pageWrapper',
|
|
86
|
-
$host: this,
|
|
87
|
-
$celScope: celScope,
|
|
88
|
-
$jsx: this.zovaJsx,
|
|
89
|
-
$$pageWrapper: this,
|
|
90
|
-
};
|
|
46
|
+
get schemaRow() {
|
|
47
|
+
return this.$$modelResource.schemaRow;
|
|
91
48
|
}
|
|
92
49
|
|
|
93
50
|
public render() {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
51
|
+
const blocks = this.schemaRow?.rest?.blocks;
|
|
52
|
+
if (!blocks || blocks.length === 0) return;
|
|
53
|
+
let domBlocks: VNode[] = [];
|
|
54
|
+
blocks.forEach((block, index) => {
|
|
55
|
+
const options = deepExtend(
|
|
56
|
+
{ key: index },
|
|
57
|
+
{
|
|
58
|
+
resource: this.resource,
|
|
59
|
+
} satisfies IResourceBlockOptionsPage,
|
|
60
|
+
block.options,
|
|
61
|
+
);
|
|
62
|
+
const domBlock = this.jsxZova.render(block.render!, options);
|
|
63
|
+
if (!domBlock) return;
|
|
64
|
+
if (Array.isArray(domBlock)) {
|
|
65
|
+
domBlocks.push(...domBlock);
|
|
66
|
+
} else {
|
|
67
|
+
domBlocks.push(domBlock);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return <ZPage>{domBlocks}</ZPage>;
|
|
98
71
|
}
|
|
99
72
|
}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import type { TableIdentity } from 'table-identity';
|
|
2
|
-
import type {
|
|
3
|
-
IJsxRenderContextBase,
|
|
4
|
-
TypeOpenapiPermissions,
|
|
5
|
-
TypeResourceActionRowRecord,
|
|
6
|
-
TypeResourceActionTableRecord,
|
|
7
|
-
} from 'zova-module-a-openapi';
|
|
8
|
-
|
|
9
1
|
import type { ControllerPageEntry } from '../page/entry/controller.jsx';
|
|
2
|
+
import 'zova-module-a-openapi';
|
|
10
3
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onActionTable?: (action: keyof TypeResourceActionTableRecord) => Promise<any> | any;
|
|
16
|
-
onActionRow?: (action: keyof TypeResourceActionRowRecord) => Promise<any> | any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IJsxRenderContextPageEntryWrapper extends IJsxRenderContextBase {
|
|
20
|
-
$celScope: IPageEntryWrapperScope;
|
|
21
|
-
$$pageEntryWrapper: ControllerPageEntry;
|
|
4
|
+
declare module 'zova-module-a-openapi' {
|
|
5
|
+
export interface IJsxRenderContextPageEntryWrapper {
|
|
6
|
+
$$pageEntryWrapper: ControllerPageEntry;
|
|
7
|
+
}
|
|
22
8
|
}
|
package/src/types/pageWrapper.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IJsxRenderContextBase,
|
|
3
|
-
TypeOpenapiPermissions,
|
|
4
|
-
TypeResourceActionRowRecord,
|
|
5
|
-
TypeResourceActionTableRecord,
|
|
6
|
-
} from 'zova-module-a-openapi';
|
|
7
|
-
|
|
8
1
|
import type { ControllerPageResource } from '../page/resource/controller.jsx';
|
|
2
|
+
import 'zova-module-a-openapi';
|
|
9
3
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onActionRow?: (action: keyof TypeResourceActionRowRecord, id: string) => Promise<any> | any;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface IJsxRenderContextPageWrapper extends IJsxRenderContextBase {
|
|
18
|
-
$celScope: IPageWrapperScope;
|
|
19
|
-
$$pageWrapper: ControllerPageResource;
|
|
4
|
+
declare module 'zova-module-a-openapi' {
|
|
5
|
+
export interface IJsxRenderContextPageWrapper {
|
|
6
|
+
$$pageWrapper: ControllerPageResource;
|
|
7
|
+
}
|
|
20
8
|
}
|