@acorex-platform/module-platform-management-client 0.0.38 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/fesm2022/{acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-BGVhn6wv.mjs → acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-YuJijjKh.mjs} +465 -101
  2. package/fesm2022/acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-YuJijjKh.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-command-definition.mjs +20 -0
  4. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-command-definition.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-entity-access-policy.mjs +20 -0
  6. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-entity-access-policy.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-entity-definition.mjs +1499 -30
  8. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-entity-definition.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-module-definition.mjs +396 -0
  10. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-module-definition.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-plugin-definition.mjs +20 -0
  12. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-plugin-definition.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-query-definition.mjs +49 -1
  14. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-query-definition.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-token.mjs +20 -0
  16. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-token.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-widget.mjs +20 -0
  18. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entities-widget.mjs.map +1 -1
  19. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-acorex-platform-module-platform-management-client-contracts-entity-catalog-BOwC5Ns9.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-acorex-platform-module-platform-management-client-contracts-entity-catalog-HWczTPH2.mjs} +15 -8
  20. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-acorex-platform-module-platform-management-client-contracts-entity-catalog-HWczTPH2.mjs.map +1 -0
  21. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-command-definition.entity-CdvQlwAk.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-command-definition.entity-C3B1_QMs.mjs} +16 -2
  22. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-command-definition.entity-C3B1_QMs.mjs.map +1 -0
  23. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-access-policy.entity-Dye4aSKE.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-access-policy.entity-BPkJloHy.mjs} +16 -2
  24. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-access-policy.entity-BPkJloHy.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-definition.entity-BL1I9pmK.mjs +1621 -0
  26. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-definition.entity-BL1I9pmK.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-module-definition.entity-Cknl0vbc.mjs +299 -0
  28. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-module-definition.entity-Cknl0vbc.mjs.map +1 -0
  29. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-plugin-definition.entity-CwU5hMjI.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-plugin-definition.entity-BxABTl8L.mjs} +16 -2
  30. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-plugin-definition.entity-BxABTl8L.mjs.map +1 -0
  31. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-query-definition.entity-DGK684Q1.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-query-definition.entity-Cv6HVQOU.mjs} +45 -3
  32. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-query-definition.entity-Cv6HVQOU.mjs.map +1 -0
  33. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-token.entity-DI_k6-ha.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-token.entity-BV8iSuoK.mjs} +16 -2
  34. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-token.entity-BV8iSuoK.mjs.map +1 -0
  35. package/fesm2022/{acorex-platform-module-platform-management-client-contracts-entity-catalog-widget.entity-C18msniH.mjs → acorex-platform-module-platform-management-client-contracts-entity-catalog-widget.entity-BYH6SIqU.mjs} +16 -2
  36. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-widget.entity-BYH6SIqU.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog.mjs +1 -1
  38. package/fesm2022/acorex-platform-module-platform-management-client-contracts.mjs +1664 -1
  39. package/fesm2022/acorex-platform-module-platform-management-client-contracts.mjs.map +1 -1
  40. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query-contract.util-D_af2BUi.mjs +586 -0
  41. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query-contract.util-D_af2BUi.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-module-platform-management-client-create-user-query.command-9Ku7C1BC.mjs → acorex-platform-module-platform-management-client-create-user-query.command-Bh49QHkl.mjs} +374 -324
  43. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.command-Bh49QHkl.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-module-platform-management-client-entity-definition-form-page.component-BgBWob9p.mjs +329 -0
  45. package/fesm2022/acorex-platform-module-platform-management-client-entity-definition-form-page.component-BgBWob9p.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-module-platform-management-client-entity-definition-form-page.provider-hLzgoJu3.mjs +23 -0
  47. package/fesm2022/acorex-platform-module-platform-management-client-entity-definition-form-page.provider-hLzgoJu3.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-CZM6JQou.mjs +197 -0
  49. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-CZM6JQou.mjs.map +1 -0
  50. package/fesm2022/acorex-platform-module-platform-management-client-local-entities.mjs +1 -0
  51. package/fesm2022/acorex-platform-module-platform-management-client-local-entities.mjs.map +1 -1
  52. package/fesm2022/{acorex-platform-module-platform-management-client-menu-list.component-uF5w1c7t.mjs → acorex-platform-module-platform-management-client-menu-list.component-iMEnFPEY.mjs} +2 -2
  53. package/fesm2022/{acorex-platform-module-platform-management-client-menu-list.component-uF5w1c7t.mjs.map → acorex-platform-module-platform-management-client-menu-list.component-iMEnFPEY.mjs.map} +1 -1
  54. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-column.component-COfOzMGh.mjs +45 -0
  55. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-column.component-COfOzMGh.mjs.map +1 -0
  56. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-edit.component-BW2pBOeg.mjs +166 -0
  57. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-edit.component-BW2pBOeg.mjs.map +1 -0
  58. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-view.component-DD9ETjFD.mjs +45 -0
  59. package/fesm2022/acorex-platform-module-platform-management-client-query-contract-widget-view.component-DD9ETjFD.mjs.map +1 -0
  60. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-B0g6dweQ.mjs → acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-DRkE2a7n.mjs} +2 -2
  61. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-B0g6dweQ.mjs.map → acorex-platform-module-platform-management-client-rest-api-generator-widget-column.component-DRkE2a7n.mjs.map} +1 -1
  62. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-A0v5MWRU.mjs → acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-CXI6fJi3.mjs} +2 -3
  63. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-A0v5MWRU.mjs.map → acorex-platform-module-platform-management-client-rest-api-generator-widget-edit.component-CXI6fJi3.mjs.map} +1 -1
  64. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-RR5zcsnI.mjs → acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-C3iHgoC2.mjs} +2 -2
  65. package/fesm2022/{acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-RR5zcsnI.mjs.map → acorex-platform-module-platform-management-client-rest-api-generator-widget-view.component-C3iHgoC2.mjs.map} +1 -1
  66. package/fesm2022/acorex-platform-module-platform-management-client-run-user-query.command-BzNa3B48.mjs +144 -0
  67. package/fesm2022/acorex-platform-module-platform-management-client-run-user-query.command-BzNa3B48.mjs.map +1 -0
  68. package/fesm2022/acorex-platform-module-platform-management-client.mjs +1 -1
  69. package/package.json +7 -3
  70. package/types/acorex-platform-module-platform-management-client-contracts-entities-module-definition.d.ts +5 -0
  71. package/types/acorex-platform-module-platform-management-client-contracts.d.ts +225 -5
  72. package/types/acorex-platform-module-platform-management-client.d.ts +35 -3
  73. package/fesm2022/acorex-platform-module-platform-management-client-acorex-platform-module-platform-management-client-BGVhn6wv.mjs.map +0 -1
  74. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-acorex-platform-module-platform-management-client-contracts-entity-catalog-BOwC5Ns9.mjs.map +0 -1
  75. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-command-definition.entity-CdvQlwAk.mjs.map +0 -1
  76. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-access-policy.entity-Dye4aSKE.mjs.map +0 -1
  77. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-definition.entity-CcJ58vfr.mjs +0 -158
  78. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-entity-definition.entity-CcJ58vfr.mjs.map +0 -1
  79. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-plugin-definition.entity-CwU5hMjI.mjs.map +0 -1
  80. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-query-definition.entity-DGK684Q1.mjs.map +0 -1
  81. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-token.entity-DI_k6-ha.mjs.map +0 -1
  82. package/fesm2022/acorex-platform-module-platform-management-client-contracts-entity-catalog-widget.entity-C18msniH.mjs.map +0 -1
  83. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.command-9Ku7C1BC.mjs.map +0 -1
  84. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.types-DdygAori.mjs +0 -71
  85. package/fesm2022/acorex-platform-module-platform-management-client-create-user-query.types-DdygAori.mjs.map +0 -1
  86. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs +0 -136
  87. package/fesm2022/acorex-platform-module-platform-management-client-list-registered-entities.query-DjStd3a8.mjs.map +0 -1
@@ -1,3 +1,7 @@
1
+ import { AXPWidgetsCatalog, AXPWidgetsList } from '@acorex-platform/framework-shared/core';
2
+ import { entityMasterCrudActions, entityMasterRecordActions, createAllQueryView, entityMasterCreateAction, entityMasterViewAction } from '@acorex-platform/framework-shared/entity';
3
+ import { ENTITY_CREATE_UI, ENTITY_EDIT_UI, ENTITY_REMOVE_UI } from '@acorex-platform/framework-shared/runtime';
4
+
1
5
  const AXPPlatformManagementFeatureKeys = {
2
6
  MenuCustomization: 'PlatformManagement:Feature:menu-customization',
3
7
  AutoCheckUpdates: 'PlatformManagement:Feature:auto-check-updates',
@@ -11,6 +15,7 @@ const AXPPlatformManagementMenuKeys = {
11
15
  Glossary: 'platform-management:menu:glossary',
12
16
  UserMenuManagement: 'platform-management:user:menus',
13
17
  MenuManagement: 'platform-management:menus',
18
+ ModuleDefinitions: 'platform-management:menu:module-definitions',
14
19
  EntityDefinitions: 'platform-management:menu:entity-definitions',
15
20
  CommandDefinitions: 'platform-management:menu:command-definitions',
16
21
  QueryDefinitions: 'platform-management:menu:query-definitions',
@@ -81,6 +86,12 @@ const RootConfig = {
81
86
  title: `@${config.i18n}:tokens.entities.token.title`,
82
87
  icon: 'fa-light fa-object-exclude',
83
88
  },
89
+ moduleDefinition: {
90
+ name: 'ModuleDefinition',
91
+ title: `@${config.i18n}:module-definitions.entities.module-definition.title`,
92
+ titlePlural: `@${config.i18n}:module-definitions.entities.module-definition.title-plural`,
93
+ icon: 'fa-light fa-layer-group',
94
+ },
84
95
  commandDefinition: {
85
96
  name: 'CommandDefinition',
86
97
  title: `@${config.i18n}:command-definitions.entities.command-definition.title`,
@@ -147,6 +158,31 @@ const RootConfig = {
147
158
  },
148
159
  };
149
160
 
161
+ //#region ---- Imports ----
162
+ //#endregion
163
+ //#region ---- Manifest Definition ----
164
+ /**
165
+ * Platform Management Module Manifest.
166
+ * Defines module metadata, features, and provider references.
167
+ */
168
+ const PlatformManagementManifest = {
169
+ name: RootConfig.module.name,
170
+ version: '1.0.0',
171
+ title: RootConfig.module.title,
172
+ icon: RootConfig.module.icon,
173
+ i18n: RootConfig.config.i18n,
174
+ type: 'platform',
175
+ domain: 'platform',
176
+ dependencies: [
177
+ 'SecurityManagement',
178
+ 'ApplicationManagement',
179
+ 'SystemInsight',
180
+ 'TenantManagement',
181
+ 'SubscriptionManagement',
182
+ ],
183
+ };
184
+ //#endregion
185
+
150
186
  //#region ----- Reload runtime memory contracts -----
151
187
  /** Public server command: reload in-memory entity schemas from domain definitions. */
152
188
  const AXM_RELOAD_RUNTIME_MEMORY_COMMAND_KEY = 'PlatformManagement:ReloadRuntimeMemory';
@@ -191,11 +227,1638 @@ const AXM_TOKEN_RESOLVE_COMMAND_KEY = 'PlatformManagement.Tokens:Resolve';
191
227
 
192
228
  //#endregion
193
229
 
230
+ //#region ----- Entity definition wizard page keys -----
231
+ /** Schema step: plugins, groups, and properties. */
232
+ const ENTITY_DEFINITION_SCHEMA_PAGE_COMPONENT_KEY = 'entity-definition-schema-page';
233
+ /** Surfaces step: columns, layouts, actions, related entities. */
234
+ const ENTITY_DEFINITION_SURFACES_PAGE_COMPONENT_KEY = 'entity-definition-surfaces-page';
235
+ const ENTITY_DEFINITION_SCHEMA_PROPERTY_NAMES = ['plugins', 'groups', 'properties'];
236
+ const ENTITY_DEFINITION_SURFACES_PROPERTY_NAMES = [
237
+ 'columns',
238
+ 'relatedEntities',
239
+ 'createSections',
240
+ 'createProperties',
241
+ 'listActions',
242
+ 'singleActions',
243
+ 'pages',
244
+ 'rules',
245
+ 'validations',
246
+ 'commandsJson',
247
+ 'queriesJson',
248
+ ];
249
+ const ENTITY_DEFINITION_DESIGNER_FORM_KEYS = [
250
+ 'title',
251
+ 'icon',
252
+ 'module',
253
+ 'parentKey',
254
+ 'searchTags',
255
+ 'formatIndividual',
256
+ 'formatPlural',
257
+ 'formatDisplayName',
258
+ 'formatSearchTitle',
259
+ 'formatSearchDescription',
260
+ 'categoryEntity',
261
+ 'categoryTextField',
262
+ 'categoryValueField',
263
+ 'plugins',
264
+ 'groups',
265
+ 'properties',
266
+ 'columns',
267
+ 'relatedEntities',
268
+ 'createSections',
269
+ 'createProperties',
270
+ 'listActions',
271
+ 'singleActions',
272
+ 'pages',
273
+ 'rules',
274
+ 'validations',
275
+ 'commandsJson',
276
+ 'queriesJson',
277
+ ];
278
+ //#endregion
279
+
280
+ //#region ----- Imports -----
281
+ //#endregion
282
+ //#region ----- Constants -----
283
+ const i18n$1 = RootConfig.config.i18n;
284
+ const ENTITY_DEFINITION_CREATE_ERROR = {
285
+ nameRequired: `@${i18n$1}:entity-definitions.messages.name-required`,
286
+ moduleRequired: `@${i18n$1}:entity-definitions.messages.module-required`,
287
+ nameInvalid: `@${i18n$1}:entity-definitions.messages.name-invalid`,
288
+ nameDuplicate: `@${i18n$1}:entity-definitions.messages.name-duplicate`,
289
+ };
290
+ const ENTITY_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9]*$/;
291
+ const DEFAULT_ENTITY_ICON = 'fa-light fa-cube';
292
+ const WIDGET_DATA_TYPE = {
293
+ 'number-editor': 'number',
294
+ 'number-unit-editor': 'number',
295
+ 'toggle-editor': 'boolean',
296
+ 'checkbox-editor': 'boolean',
297
+ 'date-time-editor': 'date',
298
+ 'repeater-layout': 'array',
299
+ 'tag-editor': 'array',
300
+ 'lookup-editor': 'uuid',
301
+ 'contact-editor': 'object',
302
+ attachments: 'array',
303
+ 'widget-field-configurator': 'object',
304
+ };
305
+ //#endregion
306
+ //#region ----- Assemble store row -----
307
+ /**
308
+ * Turns a create/update-form payload into the EntityDefinition store shape
309
+ * `{ name: Module.Entity, content: AXPEntity }`.
310
+ */
311
+ function assembleEntityDefinitionStoreRecord(input, previous) {
312
+ const merged = { ...(previous ?? {}), ...input };
313
+ const previousContent = readContent(previous ?? {}) ?? readContent(merged);
314
+ const moduleName = readTrimmed(merged['module']) || readTrimmed(previousContent?.['module']);
315
+ const rawName = readTrimmed(merged['name']) || readTrimmed(previousContent?.['name']);
316
+ const title = readTrimmed(merged['title']) ||
317
+ readTrimmed(previousContent?.['title']) ||
318
+ rawName;
319
+ const icon = readTrimmed(merged['icon']) ||
320
+ readTrimmed(previousContent?.['icon']) ||
321
+ DEFAULT_ENTITY_ICON;
322
+ if (!rawName) {
323
+ return {
324
+ ok: false,
325
+ message: ENTITY_DEFINITION_CREATE_ERROR.nameRequired,
326
+ code: 'ENTITY_DEFINITION_NAME_REQUIRED',
327
+ };
328
+ }
329
+ if (!moduleName) {
330
+ return {
331
+ ok: false,
332
+ message: ENTITY_DEFINITION_CREATE_ERROR.moduleRequired,
333
+ code: 'ENTITY_DEFINITION_MODULE_REQUIRED',
334
+ };
335
+ }
336
+ const parsed = parseEntityName(rawName, moduleName);
337
+ if (!ENTITY_NAME_PATTERN.test(parsed.entityName)) {
338
+ return {
339
+ ok: false,
340
+ message: ENTITY_DEFINITION_CREATE_ERROR.nameInvalid,
341
+ code: 'ENTITY_DEFINITION_NAME_INVALID',
342
+ };
343
+ }
344
+ const identity = {
345
+ module: parsed.moduleName,
346
+ name: parsed.entityName,
347
+ title: title || parsed.entityName,
348
+ icon,
349
+ };
350
+ const content = overlayDesignerFields(previousContent ?? buildStubEntityContent(identity), merged, identity);
351
+ const record = omitDesignerFormFields(merged);
352
+ record['name'] = parsed.storeName;
353
+ record['content'] = content;
354
+ return { ok: true, record };
355
+ }
356
+ //#endregion
357
+ //#region ----- Overlay designer fields -----
358
+ function overlayDesignerFields(existing, input, identity) {
359
+ const groups = readArray(input['groups']);
360
+ const propertyRows = readArray(input['properties']);
361
+ const pluginRows = input['plugins'] !== undefined ? readArray(input['plugins']) : undefined;
362
+ const columnRows = input['columns'] !== undefined ? readArray(input['columns']) : undefined;
363
+ const relatedRows = input['relatedEntities'] !== undefined ? readArray(input['relatedEntities']) : undefined;
364
+ const createSections = input['createSections'] !== undefined ? readArray(input['createSections']) : undefined;
365
+ const createProperties = input['createProperties'] !== undefined ? readArray(input['createProperties']) : undefined;
366
+ const listActions = input['listActions'] !== undefined ? readArray(input['listActions']) : undefined;
367
+ const singleActions = input['singleActions'] !== undefined ? readArray(input['singleActions']) : undefined;
368
+ const pages = input['pages'] !== undefined ? readArray(input['pages']) : undefined;
369
+ const mappedGroups = groups.length
370
+ ? groups.map(mapGroup)
371
+ : readExistingArray(existing['groups']);
372
+ const mappedProperties = propertyRows.length
373
+ ? propertyRows.map((row) => mapProperty(row, mappedGroups))
374
+ : readExistingArray(existing['properties']);
375
+ const content = {
376
+ ...existing,
377
+ module: identity.module,
378
+ name: identity.name,
379
+ title: identity.title,
380
+ icon: identity.icon,
381
+ };
382
+ const parentKey = readTrimmed(input['parentKey']);
383
+ if (parentKey) {
384
+ content['parentKey'] = parentKey;
385
+ }
386
+ else if (input['parentKey'] !== undefined) {
387
+ delete content['parentKey'];
388
+ }
389
+ const searchTags = input['searchTags'];
390
+ if (searchTags !== undefined) {
391
+ content['searchTags'] = Array.isArray(searchTags)
392
+ ? searchTags.filter((tag) => typeof tag === 'string' && tag.trim())
393
+ : [];
394
+ }
395
+ overlayFormats(content, input, identity.title);
396
+ overlayCategory(content, input);
397
+ if (pluginRows) {
398
+ content['plugins'] = pluginRows.map(mapPlugin).filter((plugin) => plugin.name);
399
+ }
400
+ if (mappedGroups.length) {
401
+ content['groups'] = mappedGroups;
402
+ }
403
+ if (mappedProperties.length) {
404
+ content['properties'] = mappedProperties;
405
+ }
406
+ const resolvedProperties = content['properties'] ?? [];
407
+ if (columnRows) {
408
+ content['columns'] = columnRows.length
409
+ ? columnRows.map((row) => mapColumn(row, resolvedProperties))
410
+ : defaultColumns(resolvedProperties);
411
+ }
412
+ else if (!Array.isArray(existing['columns']) && resolvedProperties.length) {
413
+ content['columns'] = defaultColumns(resolvedProperties);
414
+ }
415
+ if (relatedRows) {
416
+ content['relatedEntities'] = relatedRows.map(mapRelatedEntity).filter((row) => row.entity);
417
+ }
418
+ const schemaChanged = groups.length > 0 || propertyRows.length > 0;
419
+ const layoutExplicit = createSections !== undefined || createProperties !== undefined;
420
+ const actionsExplicit = listActions !== undefined || singleActions !== undefined;
421
+ if (schemaChanged || layoutExplicit || actionsExplicit) {
422
+ overlayInterfaces(content, {
423
+ groups: content['groups'] ?? [],
424
+ properties: resolvedProperties,
425
+ createSections,
426
+ createProperties,
427
+ listActions,
428
+ singleActions,
429
+ schemaChanged,
430
+ layoutExplicit,
431
+ });
432
+ }
433
+ if (pages) {
434
+ content['pages'] = pages.map(mapPage).filter((page) => page['componentKey']);
435
+ }
436
+ overlayJsonKey(content, input, 'rules', 'rules');
437
+ overlayJsonKey(content, input, 'validations', 'validations');
438
+ overlayJsonKey(content, input, 'commandsJson', 'commands');
439
+ overlayJsonKey(content, input, 'queriesJson', 'queries');
440
+ return content;
441
+ }
442
+ function overlayFormats(content, input, fallbackTitle) {
443
+ const current = content['formats'] ?? {};
444
+ const individual = readTrimmed(input['formatIndividual']) || String(current['individual'] ?? fallbackTitle);
445
+ const plural = readTrimmed(input['formatPlural']) || String(current['plural'] ?? fallbackTitle);
446
+ const displayName = readTrimmed(input['formatDisplayName']) ||
447
+ (typeof current['displayName'] === 'string' ? current['displayName'] : undefined);
448
+ const searchTitle = readTrimmed(input['formatSearchTitle']) ||
449
+ String(current['searchResult']?.['title'] ?? '{{ name }}');
450
+ const searchDescription = readTrimmed(input['formatSearchDescription']) ||
451
+ String(current['searchResult']?.['description'] ??
452
+ String(content['module'] ?? ''));
453
+ content['formats'] = {
454
+ ...current,
455
+ individual,
456
+ plural,
457
+ ...(displayName ? { displayName } : {}),
458
+ searchResult: {
459
+ title: searchTitle,
460
+ description: searchDescription,
461
+ },
462
+ };
463
+ }
464
+ function overlayCategory(content, input) {
465
+ const entityName = readTrimmed(input['categoryEntity']);
466
+ if (!entityName) {
467
+ if (input['categoryEntity'] !== undefined) {
468
+ delete content['category'];
469
+ }
470
+ return;
471
+ }
472
+ content['category'] = {
473
+ entity: entityName,
474
+ textField: readTrimmed(input['categoryTextField']) || 'title',
475
+ valueField: readTrimmed(input['categoryValueField']) || 'id',
476
+ };
477
+ }
478
+ function overlayInterfaces(content, args) {
479
+ const existing = content['interfaces'] ?? {};
480
+ const master = existing['master'] ?? {};
481
+ const existingList = master['list'] ?? {};
482
+ const existingCreate = master['create'] ?? {};
483
+ const existingSingle = master['single'] ?? {};
484
+ let sections = existingCreate['sections'];
485
+ let propertyLayouts = existingCreate['properties'];
486
+ if (args.layoutExplicit || args.schemaChanged) {
487
+ const sectionIds = resolveSectionIds(args.createSections, args.groups);
488
+ sections = sectionIds.map((id) => ({
489
+ id,
490
+ layout: { positions: { lg: { colSpan: 12 } } },
491
+ }));
492
+ propertyLayouts = resolvePropertyLayouts(args.createProperties, args.properties);
493
+ }
494
+ const listActions = args.listActions
495
+ ? args.listActions.map(mapAction).filter((action) => action.command)
496
+ : (existingList['actions'] ?? [...entityMasterCrudActions()]);
497
+ const singleActions = args.singleActions
498
+ ? args.singleActions.map(mapAction).filter((action) => action.command)
499
+ : (existingSingle['actions'] ?? [...entityMasterRecordActions()]);
500
+ content['interfaces'] = {
501
+ ...existing,
502
+ master: {
503
+ ...master,
504
+ list: {
505
+ ...existingList,
506
+ views: existingList['views'] ?? [createAllQueryView({ sorts: [{ name: 'name', dir: 'asc' }] })],
507
+ actions: listActions.length ? listActions : [...entityMasterCrudActions()],
508
+ },
509
+ create: {
510
+ ...existingCreate,
511
+ sections,
512
+ properties: propertyLayouts,
513
+ },
514
+ update: {
515
+ ...(master['update'] ?? {}),
516
+ sections,
517
+ properties: propertyLayouts,
518
+ },
519
+ single: {
520
+ ...existingSingle,
521
+ title: String(existingSingle['title'] ?? '{{ title || name }}') || '{{ title || name }}',
522
+ sections,
523
+ properties: propertyLayouts,
524
+ actions: singleActions.length ? singleActions : [...entityMasterRecordActions()],
525
+ },
526
+ },
527
+ };
528
+ }
529
+ function overlayJsonKey(content, input, formKey, contentKey) {
530
+ if (input[formKey] === undefined) {
531
+ return;
532
+ }
533
+ const parsed = parseJsonValue(input[formKey]);
534
+ if (parsed === undefined) {
535
+ return;
536
+ }
537
+ content[contentKey] = parsed;
538
+ }
539
+ //#endregion
540
+ //#region ----- Row mappers -----
541
+ function mapGroup(row) {
542
+ const id = readTrimmed(row['id']);
543
+ return {
544
+ id,
545
+ title: readTrimmed(row['title']) || id,
546
+ ...(readTrimmed(row['description']) ? { description: readTrimmed(row['description']) } : {}),
547
+ ...(readTrimmed(row['icon']) ? { icon: readTrimmed(row['icon']) } : {}),
548
+ };
549
+ }
550
+ function mapProperty(row, groups) {
551
+ const name = readTrimmed(row['name']);
552
+ const widget = mapWidgetInterface(row['interface']);
553
+ const dataType = readTrimmed(row['dataType']) || inferDataType(widget?.type) || 'string';
554
+ const required = row['required'] === true;
555
+ const unique = row['unique'] === true;
556
+ const groupId = readTrimmed(row['groupId']) || groups[0]?.id || 'basic-info';
557
+ const defaultValue = row['defaultValue'];
558
+ return {
559
+ name,
560
+ title: readTrimmed(row['title']) || name,
561
+ ...(readTrimmed(row['description']) ? { description: readTrimmed(row['description']) } : {}),
562
+ groupId,
563
+ schema: {
564
+ dataType,
565
+ ...(row['nullable'] === true ? { nullable: true } : {}),
566
+ ...(row['readonly'] === true ? { readonly: true } : {}),
567
+ ...(row['visible'] === false ? { visible: false } : {}),
568
+ ...(defaultValue !== undefined && defaultValue !== '' ? { defaultValue } : {}),
569
+ ...(unique ? { unique: { enabled: true } } : {}),
570
+ ...(widget ? { interface: widget } : { interface: { type: AXPWidgetsCatalog.text } }),
571
+ },
572
+ ...(required ? { validations: [{ rule: 'required' }] } : {}),
573
+ options: {
574
+ filter: { inline: { enabled: true }, advance: { enabled: true } },
575
+ sort: { enabled: true },
576
+ },
577
+ };
578
+ }
579
+ function mapWidgetInterface(value) {
580
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
581
+ return null;
582
+ }
583
+ const node = value;
584
+ const type = readTrimmed(node['type']);
585
+ if (!type) {
586
+ return null;
587
+ }
588
+ const mapped = { type };
589
+ if (node['options'] && typeof node['options'] === 'object' && !Array.isArray(node['options'])) {
590
+ mapped.options = node['options'];
591
+ }
592
+ if (Array.isArray(node['children'])) {
593
+ mapped.children = node['children'];
594
+ }
595
+ if (node['mode'] === 'view' || node['mode'] === 'edit') {
596
+ mapped.mode = node['mode'];
597
+ }
598
+ return mapped;
599
+ }
600
+ function inferDataType(widgetType) {
601
+ if (!widgetType) {
602
+ return undefined;
603
+ }
604
+ return WIDGET_DATA_TYPE[widgetType];
605
+ }
606
+ function mapPlugin(row) {
607
+ if (typeof row === 'string') {
608
+ return { name: row.trim() };
609
+ }
610
+ if (!row || typeof row !== 'object' || Array.isArray(row)) {
611
+ return { name: '' };
612
+ }
613
+ const record = row;
614
+ const name = readTrimmed(record['name']);
615
+ const options = parseJsonValue(record['options']);
616
+ if (options && typeof options === 'object' && !Array.isArray(options)) {
617
+ return { name, options: options };
618
+ }
619
+ return { name };
620
+ }
621
+ function mapColumn(row, properties) {
622
+ const name = readTrimmed(row['name']);
623
+ const property = properties.find((item) => item.name === name);
624
+ const title = readTrimmed(row['title']) || property?.title || name;
625
+ const widgetType = readTrimmed(row['widgetType']) ||
626
+ String(property?.schema?.interface?.type ?? AXPWidgetsCatalog.text);
627
+ return {
628
+ name,
629
+ title,
630
+ showAs: { type: widgetType },
631
+ };
632
+ }
633
+ function defaultColumns(properties) {
634
+ return properties
635
+ .filter((property) => property.schema?.visible !== false)
636
+ .slice(0, 6)
637
+ .map((property) => ({
638
+ name: property.name,
639
+ title: property.title,
640
+ showAs: { type: property.schema?.interface?.type || AXPWidgetsCatalog.text },
641
+ }));
642
+ }
643
+ function mapRelatedEntity(row) {
644
+ const layoutType = readTrimmed(row['layoutType']) || 'page-list';
645
+ const related = {
646
+ entity: readTrimmed(row['entity']),
647
+ ...(readTrimmed(row['title']) ? { title: readTrimmed(row['title']) } : {}),
648
+ ...(readTrimmed(row['icon']) ? { icon: readTrimmed(row['icon']) } : {}),
649
+ layout: {
650
+ type: layoutType,
651
+ position: 'after',
652
+ },
653
+ };
654
+ const persistence = {};
655
+ const foreignKey = readTrimmed(row['foreignKeyField']);
656
+ const dataPath = readTrimmed(row['dataPath']);
657
+ const idField = readTrimmed(row['idField']);
658
+ const strategy = readTrimmed(row['persistenceStrategy']);
659
+ if (foreignKey) {
660
+ persistence.foreignKeyField = foreignKey;
661
+ }
662
+ if (dataPath) {
663
+ persistence.dataPath = dataPath;
664
+ }
665
+ if (idField) {
666
+ persistence.idField = idField;
667
+ }
668
+ if (strategy === 'embedded' || strategy === 'referenced') {
669
+ persistence.strategy = strategy;
670
+ }
671
+ if (Object.keys(persistence).length) {
672
+ related.persistence = persistence;
673
+ }
674
+ if (row['appearOnCreate'] === true || row['appearOnUpdate'] === true) {
675
+ related.appearOn = {
676
+ ...(row['appearOnCreate'] === true ? { create: true } : {}),
677
+ ...(row['appearOnUpdate'] === true ? { update: true } : {}),
678
+ };
679
+ }
680
+ return related;
681
+ }
682
+ function mapAction(row) {
683
+ const command = readTrimmed(row['command']);
684
+ return {
685
+ title: readTrimmed(row['title']) || command,
686
+ command,
687
+ type: (readTrimmed(row['type']) || 'view'),
688
+ priority: (readTrimmed(row['priority']) || 'secondary'),
689
+ scope: (readTrimmed(row['scope']) || 'individual'),
690
+ ...(readTrimmed(row['icon']) ? { icon: readTrimmed(row['icon']) } : {}),
691
+ };
692
+ }
693
+ function mapPage(row) {
694
+ const order = Number(row['order']);
695
+ return {
696
+ componentKey: readTrimmed(row['componentKey']),
697
+ ...(readTrimmed(row['title']) ? { title: readTrimmed(row['title']) } : {}),
698
+ ...(readTrimmed(row['icon']) ? { icon: readTrimmed(row['icon']) } : {}),
699
+ ...(readTrimmed(row['field']) ? { field: readTrimmed(row['field']) } : {}),
700
+ ...(Number.isFinite(order) ? { layout: { order, position: 'after' } } : {}),
701
+ ...(row['appearOnCreate'] === true || row['appearOnUpdate'] === true
702
+ ? {
703
+ appearOn: {
704
+ ...(row['appearOnCreate'] === true ? { create: true } : {}),
705
+ ...(row['appearOnUpdate'] === true ? { update: true } : {}),
706
+ },
707
+ }
708
+ : {}),
709
+ };
710
+ }
711
+ function resolveSectionIds(createSections, groups) {
712
+ if (createSections?.length) {
713
+ return createSections.map((row) => readTrimmed(row['id'])).filter(Boolean);
714
+ }
715
+ if (groups.length) {
716
+ return groups.map((group) => group.id);
717
+ }
718
+ return ['basic-info'];
719
+ }
720
+ function resolvePropertyLayouts(createProperties, properties) {
721
+ const source = createProperties?.length
722
+ ? createProperties
723
+ : properties
724
+ .filter((property) => property.schema?.visible !== false)
725
+ .map((property) => ({ name: property.name, colSpan: 6 }));
726
+ return source
727
+ .map((row) => {
728
+ const name = readTrimmed(row['name']);
729
+ const colSpan = Number(row['colSpan']);
730
+ return {
731
+ name,
732
+ layout: {
733
+ positions: { lg: { colSpan: Number.isFinite(colSpan) && colSpan > 0 ? colSpan : 6 } },
734
+ },
735
+ };
736
+ })
737
+ .filter((row) => row.name);
738
+ }
739
+ //#endregion
740
+ //#region ----- Stub content -----
741
+ function buildStubEntityContent(identity) {
742
+ const sections = [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }];
743
+ const propertyLayouts = [
744
+ { name: 'name', layout: { positions: { lg: { colSpan: 6 } } } },
745
+ { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
746
+ ];
747
+ const stub = {
748
+ module: identity.module,
749
+ name: identity.name,
750
+ title: identity.title,
751
+ icon: identity.icon,
752
+ plugins: [],
753
+ formats: {
754
+ individual: identity.title,
755
+ plural: identity.title,
756
+ searchResult: {
757
+ title: '{{ name }}',
758
+ description: identity.module,
759
+ },
760
+ },
761
+ groups: [{ id: 'basic-info', title: '@general:terms.interface.basic-info' }],
762
+ properties: [
763
+ {
764
+ name: 'name',
765
+ title: '@general:terms.common.name',
766
+ groupId: 'basic-info',
767
+ schema: {
768
+ dataType: 'string',
769
+ interface: { type: AXPWidgetsCatalog.text },
770
+ },
771
+ validations: [{ rule: 'required' }],
772
+ },
773
+ {
774
+ name: 'title',
775
+ title: '@general:terms.common.title',
776
+ groupId: 'basic-info',
777
+ schema: {
778
+ dataType: 'string',
779
+ interface: { type: AXPWidgetsCatalog.text },
780
+ },
781
+ validations: [{ rule: 'required' }],
782
+ },
783
+ ],
784
+ columns: [
785
+ { name: 'name', title: '@general:terms.common.name', showAs: { type: AXPWidgetsCatalog.text } },
786
+ { name: 'title', title: '@general:terms.common.title', showAs: { type: AXPWidgetsCatalog.text } },
787
+ ],
788
+ interfaces: {
789
+ master: {
790
+ list: {
791
+ views: [createAllQueryView({ sorts: [{ name: 'name', dir: 'asc' }] })],
792
+ actions: [...entityMasterCrudActions()],
793
+ },
794
+ create: {
795
+ sections,
796
+ properties: propertyLayouts,
797
+ },
798
+ single: {
799
+ title: '{{ title || name }}',
800
+ sections,
801
+ properties: propertyLayouts,
802
+ actions: [...entityMasterRecordActions()],
803
+ },
804
+ },
805
+ },
806
+ };
807
+ return stub;
808
+ }
809
+ function parseEntityName(rawName, moduleName) {
810
+ if (!rawName.includes('.')) {
811
+ return {
812
+ moduleName,
813
+ entityName: rawName,
814
+ storeName: `${moduleName}.${rawName}`,
815
+ };
816
+ }
817
+ const lastDot = rawName.lastIndexOf('.');
818
+ const maybeModule = rawName.slice(0, lastDot).trim();
819
+ const entityName = rawName.slice(lastDot + 1).trim();
820
+ const resolvedModule = moduleName || maybeModule;
821
+ return {
822
+ moduleName: resolvedModule,
823
+ entityName,
824
+ storeName: `${resolvedModule}.${entityName}`,
825
+ };
826
+ }
827
+ function readContent(input) {
828
+ const value = input['content'];
829
+ if (typeof value === 'string' && value.trim()) {
830
+ try {
831
+ const parsed = JSON.parse(value);
832
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
833
+ return parsed;
834
+ }
835
+ }
836
+ catch {
837
+ return null;
838
+ }
839
+ }
840
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
841
+ return value;
842
+ }
843
+ return null;
844
+ }
845
+ function omitDesignerFormFields(input) {
846
+ const next = { ...input };
847
+ for (const key of ENTITY_DEFINITION_DESIGNER_FORM_KEYS) {
848
+ delete next[key];
849
+ }
850
+ return next;
851
+ }
852
+ function readArray(value) {
853
+ if (!Array.isArray(value)) {
854
+ return [];
855
+ }
856
+ return value.filter((item) => item && typeof item === 'object' && !Array.isArray(item));
857
+ }
858
+ function readExistingArray(value) {
859
+ return Array.isArray(value) ? value : [];
860
+ }
861
+ function parseJsonValue(value) {
862
+ if (value == null || value === '') {
863
+ return undefined;
864
+ }
865
+ if (typeof value === 'string') {
866
+ const trimmed = value.trim();
867
+ if (!trimmed) {
868
+ return undefined;
869
+ }
870
+ try {
871
+ return JSON.parse(trimmed);
872
+ }
873
+ catch {
874
+ return undefined;
875
+ }
876
+ }
877
+ return value;
878
+ }
879
+ function readTrimmed(value) {
880
+ return typeof value === 'string' ? value.trim() : '';
881
+ }
882
+ //#endregion
883
+ //#region ----- Flatten content to designer form -----
884
+ /**
885
+ * Maps stored `AXPEntity` content back onto the wizard form fields
886
+ * (repeaters, JSON editors, identity extras).
887
+ */
888
+ function flattenEntityContentToDesignerForm(content) {
889
+ if (!content) {
890
+ return {};
891
+ }
892
+ const formats = asRecord(content['formats']);
893
+ const searchResult = asRecord(formats['searchResult']);
894
+ const category = asRecord(content['category']);
895
+ const interfaces = asRecord(content['interfaces']);
896
+ const master = asRecord(interfaces['master']);
897
+ const create = asRecord(master['create']);
898
+ const list = asRecord(master['list']);
899
+ const single = asRecord(master['single']);
900
+ return {
901
+ parentKey: readTrimmed(content['parentKey']),
902
+ searchTags: Array.isArray(content['searchTags']) ? content['searchTags'] : [],
903
+ formatIndividual: readTrimmed(formats['individual']),
904
+ formatPlural: readTrimmed(formats['plural']),
905
+ formatDisplayName: readTrimmed(formats['displayName']),
906
+ formatSearchTitle: readTrimmed(searchResult['title']),
907
+ formatSearchDescription: readTrimmed(searchResult['description']),
908
+ categoryEntity: readTrimmed(category['entity']),
909
+ categoryTextField: readTrimmed(category['textField']) || 'title',
910
+ categoryValueField: readTrimmed(category['valueField']) || 'id',
911
+ plugins: flattenPlugins(content['plugins']),
912
+ groups: readArray(content['groups']),
913
+ properties: flattenProperties(content['properties']),
914
+ columns: flattenColumns(content['columns']),
915
+ relatedEntities: flattenRelatedEntities(content['relatedEntities']),
916
+ createSections: flattenSections(create['sections']),
917
+ createProperties: flattenPropertyLayouts(create['properties']),
918
+ listActions: flattenActions(list['actions']),
919
+ singleActions: flattenActions(single['actions']),
920
+ pages: flattenPages(content['pages']),
921
+ rules: stringifyJson(content['rules']),
922
+ validations: stringifyJson(content['validations']),
923
+ commandsJson: stringifyJson(content['commands']),
924
+ queriesJson: stringifyJson(content['queries']),
925
+ };
926
+ }
927
+ function flattenProperties(value) {
928
+ return readArray(value).map((row) => {
929
+ const schema = asRecord(row['schema']);
930
+ if (!Object.keys(schema).length) {
931
+ return row;
932
+ }
933
+ const unique = asRecord(schema['unique']);
934
+ const validations = Array.isArray(row['validations']) ? row['validations'] : [];
935
+ const required = validations.some((item) => item && typeof item === 'object' && item['rule'] === 'required');
936
+ return {
937
+ name: readTrimmed(row['name']),
938
+ title: readTrimmed(row['title']) || readTrimmed(row['name']),
939
+ description: readTrimmed(row['description']),
940
+ groupId: readTrimmed(row['groupId']),
941
+ interface: schema['interface'] ?? { type: AXPWidgetsCatalog.text },
942
+ dataType: readTrimmed(schema['dataType']) || 'string',
943
+ required,
944
+ nullable: schema['nullable'] === true,
945
+ readonly: schema['readonly'] === true,
946
+ unique: unique['enabled'] === true,
947
+ visible: schema['visible'] !== false,
948
+ defaultValue: schema['defaultValue'] ?? '',
949
+ };
950
+ });
951
+ }
952
+ function flattenPlugins(value) {
953
+ if (!Array.isArray(value)) {
954
+ return [];
955
+ }
956
+ const rows = [];
957
+ for (const item of value) {
958
+ if (typeof item === 'string') {
959
+ const name = item.trim();
960
+ if (name) {
961
+ rows.push({ name, options: '' });
962
+ }
963
+ continue;
964
+ }
965
+ if (!item || typeof item !== 'object' || Array.isArray(item)) {
966
+ continue;
967
+ }
968
+ const row = item;
969
+ const name = readTrimmed(row['name']);
970
+ if (!name) {
971
+ continue;
972
+ }
973
+ rows.push({
974
+ name,
975
+ options: stringifyJson(row['options']),
976
+ });
977
+ }
978
+ return rows;
979
+ }
980
+ function flattenColumns(value) {
981
+ return readArray(value).map((row) => {
982
+ const showAs = asRecord(row['showAs']);
983
+ return {
984
+ name: readTrimmed(row['name']),
985
+ title: readTrimmed(row['title']),
986
+ widgetType: readTrimmed(row['widgetType']) || readTrimmed(showAs['type']),
987
+ };
988
+ });
989
+ }
990
+ function flattenRelatedEntities(value) {
991
+ return readArray(value).map((row) => {
992
+ const layout = asRecord(row['layout']);
993
+ const persistence = asRecord(row['persistence']);
994
+ const appearOn = asRecord(row['appearOn']);
995
+ return {
996
+ entity: readTrimmed(row['entity']),
997
+ title: readTrimmed(row['title']),
998
+ icon: readTrimmed(row['icon']),
999
+ layoutType: readTrimmed(layout['type']) || 'page-list',
1000
+ foreignKeyField: readTrimmed(persistence['foreignKeyField']),
1001
+ dataPath: readTrimmed(persistence['dataPath']),
1002
+ idField: readTrimmed(persistence['idField']),
1003
+ persistenceStrategy: readTrimmed(persistence['strategy']),
1004
+ appearOnCreate: appearOn['create'] === true,
1005
+ appearOnUpdate: appearOn['update'] === true,
1006
+ };
1007
+ });
1008
+ }
1009
+ function flattenSections(value) {
1010
+ return readArray(value).map((row) => ({ id: readTrimmed(row['id']) })).filter((row) => row.id);
1011
+ }
1012
+ function flattenPropertyLayouts(value) {
1013
+ return readArray(value).map((row) => {
1014
+ const layout = asRecord(row['layout']);
1015
+ const positions = asRecord(layout['positions']);
1016
+ const lg = asRecord(positions['lg']);
1017
+ const colSpan = Number(lg['colSpan']);
1018
+ return {
1019
+ name: readTrimmed(row['name']),
1020
+ colSpan: Number.isFinite(colSpan) && colSpan > 0 ? colSpan : 6,
1021
+ };
1022
+ });
1023
+ }
1024
+ function flattenActions(value) {
1025
+ return readArray(value).map((row) => {
1026
+ const command = row['command'];
1027
+ const commandName = typeof command === 'string'
1028
+ ? command
1029
+ : command && typeof command === 'object' && !Array.isArray(command)
1030
+ ? readTrimmed(command['name'])
1031
+ : '';
1032
+ return {
1033
+ title: readTrimmed(row['title']),
1034
+ command: commandName,
1035
+ icon: readTrimmed(row['icon']),
1036
+ type: readTrimmed(row['type']) || 'view',
1037
+ priority: readTrimmed(row['priority']) || 'secondary',
1038
+ scope: readTrimmed(row['scope']) || 'individual',
1039
+ };
1040
+ });
1041
+ }
1042
+ function flattenPages(value) {
1043
+ return readArray(value).map((row) => {
1044
+ const appearOn = asRecord(row['appearOn']);
1045
+ const layout = asRecord(row['layout']);
1046
+ return {
1047
+ componentKey: readTrimmed(row['componentKey']),
1048
+ title: readTrimmed(row['title']),
1049
+ icon: readTrimmed(row['icon']),
1050
+ field: readTrimmed(row['field']),
1051
+ order: layout['order'] ?? '',
1052
+ appearOnCreate: appearOn['create'] === true,
1053
+ appearOnUpdate: appearOn['update'] === true,
1054
+ };
1055
+ });
1056
+ }
1057
+ function stringifyJson(value) {
1058
+ if (value == null || value === '') {
1059
+ return '';
1060
+ }
1061
+ if (typeof value === 'string') {
1062
+ return value;
1063
+ }
1064
+ try {
1065
+ return JSON.stringify(value, null, 2);
1066
+ }
1067
+ catch {
1068
+ return '';
1069
+ }
1070
+ }
1071
+ function asRecord(value) {
1072
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
1073
+ return value;
1074
+ }
1075
+ return {};
1076
+ }
1077
+ //#endregion
1078
+
1079
+ //#region ----- Imports -----
1080
+ //#endregion
1081
+ //#region ----- Constants -----
1082
+ const i18n = RootConfig.config.i18n;
1083
+ const field = (name) => `@${i18n}:entity-definitions.entities.entity-definition.fields.${name}.title`;
1084
+ const PLUGIN_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.pluginDefinition.name}`;
1085
+ const ENTITY_DEFINITION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.entityDefinition.name}`;
1086
+ const MODULE_DEFINITION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.moduleDefinition.name}`;
1087
+ const PROPERTIES_DATASOURCE = "{{ context.eval('properties') || [] }}";
1088
+ const GROUPS_DATASOURCE = "{{ context.eval('groups') || [] }}";
1089
+ //#endregion
1090
+ //#region ----- Layout helpers -----
1091
+ function gridRow(children) {
1092
+ return {
1093
+ type: AXPWidgetsList.Layouts.GridLayout,
1094
+ mode: 'edit',
1095
+ options: {
1096
+ grid: {
1097
+ default: { columns: 12, gap: '0.75rem' },
1098
+ },
1099
+ },
1100
+ children,
1101
+ };
1102
+ }
1103
+ function gridItem(colSpan, child) {
1104
+ return {
1105
+ type: AXPWidgetsList.Layouts.GridItemLayout,
1106
+ mode: 'edit',
1107
+ options: { colSpan },
1108
+ children: [child],
1109
+ };
1110
+ }
1111
+ function formField(label, editor) {
1112
+ return {
1113
+ type: AXPWidgetsList.Layouts.FormField,
1114
+ mode: 'edit',
1115
+ options: { label, showLabel: true },
1116
+ children: [editor],
1117
+ };
1118
+ }
1119
+ function textEditor(path, required = false) {
1120
+ return {
1121
+ type: AXPWidgetsList.Editors.TextBox,
1122
+ mode: 'edit',
1123
+ path,
1124
+ name: path,
1125
+ options: required ? { required: true } : {},
1126
+ };
1127
+ }
1128
+ function largeTextEditor(path, rows = 2) {
1129
+ return {
1130
+ type: AXPWidgetsList.Editors.LargeTextBox,
1131
+ mode: 'edit',
1132
+ path,
1133
+ name: path,
1134
+ options: { rows },
1135
+ };
1136
+ }
1137
+ function toggleEditor(path) {
1138
+ return {
1139
+ type: AXPWidgetsList.Editors.ToggleSwitch,
1140
+ mode: 'edit',
1141
+ path,
1142
+ name: path,
1143
+ };
1144
+ }
1145
+ function numberEditor(path, defaultValue) {
1146
+ return {
1147
+ type: AXPWidgetsList.Editors.NumberBox,
1148
+ mode: 'edit',
1149
+ path,
1150
+ name: path,
1151
+ options: defaultValue == null ? {} : { defaultValue },
1152
+ };
1153
+ }
1154
+ function iconEditor(path) {
1155
+ return {
1156
+ type: AXPWidgetsList.Theme.IconChooser,
1157
+ mode: 'edit',
1158
+ path,
1159
+ name: path,
1160
+ };
1161
+ }
1162
+ function codeEditor(path, height = 'h-32') {
1163
+ return {
1164
+ type: AXPWidgetsList.Advanced.CodeEditor,
1165
+ mode: 'edit',
1166
+ path,
1167
+ name: path,
1168
+ options: { language: 'json', height },
1169
+ };
1170
+ }
1171
+ function selectEditor(path, options) {
1172
+ return {
1173
+ type: AXPWidgetsList.Editors.SelectBox,
1174
+ mode: 'edit',
1175
+ path,
1176
+ name: path,
1177
+ options: {
1178
+ valueField: options.valueField,
1179
+ textField: options.textField,
1180
+ dataSource: options.dataSource,
1181
+ allowSearch: options.allowSearch ?? true,
1182
+ required: options.required ?? false,
1183
+ },
1184
+ };
1185
+ }
1186
+ function lookupEditor(path, options) {
1187
+ return {
1188
+ type: AXPWidgetsList.Editors.LookupBox,
1189
+ mode: 'edit',
1190
+ path,
1191
+ name: path,
1192
+ options: {
1193
+ entity: options.entity,
1194
+ valueField: options.valueField,
1195
+ textField: options.textField,
1196
+ look: 'select',
1197
+ allowSearch: true,
1198
+ columns: options.columns,
1199
+ },
1200
+ };
1201
+ }
1202
+ //#endregion
1203
+ //#region ----- Repeater children -----
1204
+ const PLUGIN_REPEATER_CHILDREN = [
1205
+ gridRow([
1206
+ gridItem(6, formField(field('plugin-name'), lookupEditor('name', {
1207
+ entity: PLUGIN_ENTITY,
1208
+ valueField: 'name',
1209
+ textField: 'catalogTitle',
1210
+ columns: ['catalogTitle', 'name'],
1211
+ }))),
1212
+ gridItem(6, formField(field('plugin-options'), codeEditor('options'))),
1213
+ ]),
1214
+ ];
1215
+ const GROUP_REPEATER_CHILDREN = [
1216
+ gridRow([
1217
+ gridItem(4, formField(field('group-id'), textEditor('id', true))),
1218
+ gridItem(5, formField(field('group-title'), textEditor('title', true))),
1219
+ gridItem(3, formField(field('group-icon'), iconEditor('icon'))),
1220
+ gridItem(12, formField(field('group-description'), largeTextEditor('description', 2))),
1221
+ ]),
1222
+ ];
1223
+ const PROPERTY_REPEATER_CHILDREN = [
1224
+ gridRow([
1225
+ gridItem(4, formField('@general:terms.common.name', textEditor('name', true))),
1226
+ gridItem(4, formField('@general:terms.common.title', textEditor('title', true))),
1227
+ gridItem(4, formField(field('group-id'), selectEditor('groupId', {
1228
+ dataSource: GROUPS_DATASOURCE,
1229
+ valueField: 'id',
1230
+ textField: 'title',
1231
+ }))),
1232
+ gridItem(12, formField('@general:terms.common.description', largeTextEditor('description', 2))),
1233
+ gridItem(12, formField(field('property-interface'), {
1234
+ type: AXPWidgetsList.Advanced.WidgetFieldConfigurator,
1235
+ mode: 'edit',
1236
+ path: 'interface',
1237
+ name: 'interface',
1238
+ options: {
1239
+ fieldName: "{{ context.eval('name') }}",
1240
+ fieldTitle: "{{ context.eval('title') }}",
1241
+ },
1242
+ })),
1243
+ gridItem(3, formField(field('property-data-type'), selectEditor('dataType', {
1244
+ dataSource: [
1245
+ { value: 'string', text: field('data-type-string') },
1246
+ { value: 'number', text: field('data-type-number') },
1247
+ { value: 'boolean', text: field('data-type-boolean') },
1248
+ { value: 'date', text: field('data-type-date') },
1249
+ { value: 'uuid', text: field('data-type-uuid') },
1250
+ { value: 'object', text: field('data-type-object') },
1251
+ { value: 'array', text: field('data-type-array') },
1252
+ ],
1253
+ valueField: 'value',
1254
+ textField: 'text',
1255
+ allowSearch: false,
1256
+ }))),
1257
+ gridItem(3, formField(field('property-required'), toggleEditor('required'))),
1258
+ gridItem(3, formField(field('property-nullable'), toggleEditor('nullable'))),
1259
+ gridItem(3, formField(field('property-readonly'), toggleEditor('readonly'))),
1260
+ gridItem(3, formField(field('property-unique'), toggleEditor('unique'))),
1261
+ gridItem(3, formField(field('property-visible'), toggleEditor('visible'))),
1262
+ gridItem(9, formField(field('property-default-value'), textEditor('defaultValue'))),
1263
+ ]),
1264
+ ];
1265
+ const COLUMN_REPEATER_CHILDREN = [
1266
+ gridRow([
1267
+ gridItem(4, formField(field('column-name'), selectEditor('name', {
1268
+ dataSource: PROPERTIES_DATASOURCE,
1269
+ valueField: 'name',
1270
+ textField: 'title',
1271
+ required: true,
1272
+ }))),
1273
+ gridItem(4, formField('@general:terms.common.title', textEditor('title'))),
1274
+ gridItem(4, formField(field('column-widget'), selectEditor('widgetType', {
1275
+ dataSource: 'PlatformManagement:ListEditorWidgets',
1276
+ valueField: 'name',
1277
+ textField: 'title',
1278
+ }))),
1279
+ ]),
1280
+ ];
1281
+ const RELATED_ENTITY_REPEATER_CHILDREN = [
1282
+ gridRow([
1283
+ gridItem(6, formField(field('related-entity'), lookupEditor('entity', {
1284
+ entity: ENTITY_DEFINITION_ENTITY,
1285
+ valueField: 'name',
1286
+ textField: 'name',
1287
+ columns: ['name'],
1288
+ }))),
1289
+ gridItem(4, formField('@general:terms.common.title', textEditor('title'))),
1290
+ gridItem(2, formField('@general:terms.common.icon', iconEditor('icon'))),
1291
+ gridItem(4, formField(field('related-layout-type'), selectEditor('layoutType', {
1292
+ dataSource: [
1293
+ { value: 'page-list', text: field('layout-type-page-list') },
1294
+ { value: 'tab-list', text: field('layout-type-tab-list') },
1295
+ { value: 'merge-detail', text: field('layout-type-merge-detail') },
1296
+ { value: 'page-detail', text: field('layout-type-page-detail') },
1297
+ { value: 'tab-detail', text: field('layout-type-tab-detail') },
1298
+ ],
1299
+ valueField: 'value',
1300
+ textField: 'text',
1301
+ allowSearch: false,
1302
+ }))),
1303
+ gridItem(4, formField(field('related-persistence-strategy'), selectEditor('persistenceStrategy', {
1304
+ dataSource: [
1305
+ { value: 'referenced', text: field('persistence-referenced') },
1306
+ { value: 'embedded', text: field('persistence-embedded') },
1307
+ ],
1308
+ valueField: 'value',
1309
+ textField: 'text',
1310
+ allowSearch: false,
1311
+ }))),
1312
+ gridItem(4, formField(field('related-foreign-key'), textEditor('foreignKeyField'))),
1313
+ gridItem(4, formField(field('related-data-path'), textEditor('dataPath'))),
1314
+ gridItem(4, formField(field('related-id-field'), textEditor('idField'))),
1315
+ gridItem(2, formField(field('appear-on-create'), toggleEditor('appearOnCreate'))),
1316
+ gridItem(2, formField(field('appear-on-update'), toggleEditor('appearOnUpdate'))),
1317
+ ]),
1318
+ ];
1319
+ const CREATE_SECTION_REPEATER_CHILDREN = [
1320
+ gridRow([
1321
+ gridItem(12, formField(field('section-id'), selectEditor('id', {
1322
+ dataSource: GROUPS_DATASOURCE,
1323
+ valueField: 'id',
1324
+ textField: 'title',
1325
+ required: true,
1326
+ }))),
1327
+ ]),
1328
+ ];
1329
+ const CREATE_PROPERTY_LAYOUT_REPEATER_CHILDREN = [
1330
+ gridRow([
1331
+ gridItem(8, formField(field('layout-property-name'), selectEditor('name', {
1332
+ dataSource: PROPERTIES_DATASOURCE,
1333
+ valueField: 'name',
1334
+ textField: 'title',
1335
+ required: true,
1336
+ }))),
1337
+ gridItem(4, formField(field('layout-col-span'), numberEditor('colSpan', 6))),
1338
+ ]),
1339
+ ];
1340
+ const ACTION_COMMAND_DATASOURCE = [
1341
+ { value: ENTITY_CREATE_UI, text: '@general:actions.create.title' },
1342
+ { value: 'Entity:OpenDetails', text: '@general:actions.view.title' },
1343
+ { value: ENTITY_EDIT_UI, text: '@general:actions.edit.title' },
1344
+ { value: ENTITY_REMOVE_UI, text: '@general:actions.delete.title' },
1345
+ ];
1346
+ const ACTION_TYPE_DATASOURCE = [
1347
+ { value: 'create', text: '@general:actions.create.title' },
1348
+ { value: 'view', text: '@general:actions.view.title' },
1349
+ { value: 'update', text: '@general:actions.edit.title' },
1350
+ { value: 'delete', text: '@general:actions.delete.title' },
1351
+ ];
1352
+ const ACTION_PRIORITY_DATASOURCE = [
1353
+ { value: 'primary', text: field('priority-primary') },
1354
+ { value: 'secondary', text: field('priority-secondary') },
1355
+ { value: 'none', text: field('priority-none') },
1356
+ ];
1357
+ const ACTION_SCOPE_DATASOURCE = [
1358
+ { value: 'typeLevel', text: field('scope-type-level') },
1359
+ { value: 'individual', text: field('scope-individual') },
1360
+ { value: 'selected', text: field('scope-selected') },
1361
+ ];
1362
+ const ACTION_REPEATER_CHILDREN = [
1363
+ gridRow([
1364
+ gridItem(4, formField('@general:terms.common.title', textEditor('title', true))),
1365
+ gridItem(4, formField(field('action-command'), selectEditor('command', {
1366
+ dataSource: ACTION_COMMAND_DATASOURCE,
1367
+ valueField: 'value',
1368
+ textField: 'text',
1369
+ required: true,
1370
+ }))),
1371
+ gridItem(4, formField(field('action-icon'), iconEditor('icon'))),
1372
+ gridItem(4, formField(field('action-type'), selectEditor('type', {
1373
+ dataSource: ACTION_TYPE_DATASOURCE,
1374
+ valueField: 'value',
1375
+ textField: 'text',
1376
+ allowSearch: false,
1377
+ }))),
1378
+ gridItem(4, formField(field('action-priority'), selectEditor('priority', {
1379
+ dataSource: ACTION_PRIORITY_DATASOURCE,
1380
+ valueField: 'value',
1381
+ textField: 'text',
1382
+ allowSearch: false,
1383
+ }))),
1384
+ gridItem(4, formField(field('action-scope'), selectEditor('scope', {
1385
+ dataSource: ACTION_SCOPE_DATASOURCE,
1386
+ valueField: 'value',
1387
+ textField: 'text',
1388
+ allowSearch: false,
1389
+ }))),
1390
+ ]),
1391
+ ];
1392
+ const PAGE_REPEATER_CHILDREN = [
1393
+ gridRow([
1394
+ gridItem(4, formField(field('page-component-key'), textEditor('componentKey', true))),
1395
+ gridItem(4, formField('@general:terms.common.title', textEditor('title'))),
1396
+ gridItem(4, formField('@general:terms.common.icon', iconEditor('icon'))),
1397
+ gridItem(4, formField(field('page-field'), textEditor('field'))),
1398
+ gridItem(4, formField(field('page-order'), numberEditor('order', 1))),
1399
+ gridItem(2, formField(field('appear-on-create'), toggleEditor('appearOnCreate'))),
1400
+ gridItem(2, formField(field('appear-on-update'), toggleEditor('appearOnUpdate'))),
1401
+ ]),
1402
+ ];
1403
+ //#endregion
1404
+
1405
+ //#region ----- Imports -----
1406
+ //#endregion
1407
+ //#region ----- Constants -----
1408
+ const LIST_FILTER_SORT = {
1409
+ filter: { inline: { enabled: true }, advance: { enabled: true } },
1410
+ sort: { enabled: true },
1411
+ };
1412
+ const i18nScope = RootConfig.config.i18n;
1413
+ function fieldTitle(name) {
1414
+ return `@${i18nScope}:entity-definitions.entities.entity-definition.fields.${name}.title`;
1415
+ }
1416
+ function groupTitle(name) {
1417
+ return `@${i18nScope}:entity-definitions.entities.entity-definition.groups.${name}`;
1418
+ }
1419
+ function pageTitle(name) {
1420
+ return `@${i18nScope}:entity-definitions.entities.entity-definition.pages.${name}.title`;
1421
+ }
1422
+ function repeaterProperty(name, groupId, children) {
1423
+ return {
1424
+ name,
1425
+ title: fieldTitle(name),
1426
+ groupId,
1427
+ schema: {
1428
+ dataType: 'array',
1429
+ defaultValue: [],
1430
+ interface: {
1431
+ type: AXPWidgetsList.Layouts.RepeaterLayout,
1432
+ options: { hasControls: true, allowReorder: true },
1433
+ children: children,
1434
+ },
1435
+ },
1436
+ };
1437
+ }
1438
+ //#endregion
1439
+ //#region ----- Entity -----
1440
+ function buildEntityDefinitionEntity() {
1441
+ const identityLayout = [
1442
+ { name: 'name', layout: { positions: { lg: { colSpan: 6 } } } },
1443
+ { name: 'module', layout: { positions: { lg: { colSpan: 6 } } } },
1444
+ { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
1445
+ { name: 'icon', layout: { positions: { lg: { colSpan: 6 } } } },
1446
+ { name: 'parentKey', layout: { positions: { lg: { colSpan: 6 } } } },
1447
+ { name: 'searchTags', layout: { positions: { lg: { colSpan: 6 } } } },
1448
+ { name: 'formatIndividual', layout: { positions: { lg: { colSpan: 6 } } } },
1449
+ { name: 'formatPlural', layout: { positions: { lg: { colSpan: 6 } } } },
1450
+ { name: 'formatDisplayName', layout: { positions: { lg: { colSpan: 6 } } } },
1451
+ { name: 'formatSearchTitle', layout: { positions: { lg: { colSpan: 6 } } } },
1452
+ { name: 'formatSearchDescription', layout: { positions: { lg: { colSpan: 12 } } } },
1453
+ { name: 'categoryEntity', layout: { positions: { lg: { colSpan: 6 } } } },
1454
+ { name: 'categoryTextField', layout: { positions: { lg: { colSpan: 3 } } } },
1455
+ { name: 'categoryValueField', layout: { positions: { lg: { colSpan: 3 } } } },
1456
+ ];
1457
+ const entityDef = {
1458
+ module: RootConfig.module.name,
1459
+ name: RootConfig.entities.entityDefinition.name,
1460
+ title: RootConfig.entities.entityDefinition.title,
1461
+ icon: RootConfig.entities.entityDefinition.icon,
1462
+ formats: {
1463
+ individual: RootConfig.entities.entityDefinition.title,
1464
+ plural: RootConfig.entities.entityDefinition.titlePlural,
1465
+ searchResult: {
1466
+ title: '{{ name }}',
1467
+ description: '{{ content.module }}',
1468
+ },
1469
+ },
1470
+ plugins: [],
1471
+ pages: [
1472
+ {
1473
+ componentKey: ENTITY_DEFINITION_SCHEMA_PAGE_COMPONENT_KEY,
1474
+ field: 'properties',
1475
+ title: pageTitle('schema'),
1476
+ icon: 'fa-light fa-list',
1477
+ layout: { order: 1, position: 'after' },
1478
+ appearOn: { create: true, update: true },
1479
+ options: { propertyNames: [...ENTITY_DEFINITION_SCHEMA_PROPERTY_NAMES] },
1480
+ },
1481
+ {
1482
+ componentKey: ENTITY_DEFINITION_SURFACES_PAGE_COMPONENT_KEY,
1483
+ field: 'interfaces',
1484
+ title: pageTitle('surfaces'),
1485
+ icon: 'fa-light fa-table-columns',
1486
+ layout: { order: 2, position: 'after' },
1487
+ appearOn: { create: true, update: true },
1488
+ options: { propertyNames: [...ENTITY_DEFINITION_SURFACES_PROPERTY_NAMES] },
1489
+ },
1490
+ ],
1491
+ groups: [
1492
+ { id: 'basic-info', title: groupTitle('basic-info') },
1493
+ { id: 'formats', title: groupTitle('formats') },
1494
+ { id: 'category', title: groupTitle('category') },
1495
+ { id: 'plugins', title: groupTitle('plugins') },
1496
+ { id: 'groups', title: groupTitle('groups') },
1497
+ { id: 'properties', title: groupTitle('properties') },
1498
+ { id: 'columns', title: groupTitle('columns') },
1499
+ { id: 'related-entities', title: groupTitle('related-entities') },
1500
+ { id: 'layouts', title: groupTitle('layouts') },
1501
+ { id: 'actions', title: groupTitle('actions') },
1502
+ { id: 'advanced', title: groupTitle('advanced') },
1503
+ { id: 'schema', title: groupTitle('schema') },
1504
+ ],
1505
+ properties: [
1506
+ {
1507
+ name: 'id',
1508
+ title: '@general:terms.common.id',
1509
+ schema: {
1510
+ dataType: 'uuid',
1511
+ visible: false,
1512
+ nullable: false,
1513
+ readonly: true,
1514
+ unique: { enabled: true },
1515
+ },
1516
+ },
1517
+ {
1518
+ name: 'name',
1519
+ title: '@general:terms.common.name',
1520
+ groupId: 'basic-info',
1521
+ schema: {
1522
+ dataType: 'string',
1523
+ interface: { type: AXPWidgetsCatalog.text },
1524
+ },
1525
+ validations: [{ rule: 'required' }],
1526
+ options: LIST_FILTER_SORT,
1527
+ },
1528
+ {
1529
+ name: 'module',
1530
+ title: fieldTitle('module-id'),
1531
+ groupId: 'basic-info',
1532
+ schema: {
1533
+ dataType: 'string',
1534
+ interface: {
1535
+ type: AXPWidgetsCatalog.lookup,
1536
+ options: {
1537
+ entity: MODULE_DEFINITION_ENTITY,
1538
+ textField: 'title',
1539
+ valueField: 'name',
1540
+ look: 'select',
1541
+ allowSearch: true,
1542
+ columns: ['title', 'name'],
1543
+ },
1544
+ },
1545
+ },
1546
+ validations: [{ rule: 'required' }],
1547
+ options: LIST_FILTER_SORT,
1548
+ },
1549
+ {
1550
+ name: 'title',
1551
+ title: '@general:terms.common.title',
1552
+ groupId: 'basic-info',
1553
+ schema: {
1554
+ dataType: 'string',
1555
+ interface: { type: AXPWidgetsCatalog.text },
1556
+ },
1557
+ validations: [{ rule: 'required' }],
1558
+ options: LIST_FILTER_SORT,
1559
+ },
1560
+ {
1561
+ name: 'icon',
1562
+ title: '@general:terms.common.icon',
1563
+ groupId: 'basic-info',
1564
+ schema: {
1565
+ dataType: 'string',
1566
+ interface: { type: AXPWidgetsCatalog.iconChooser },
1567
+ },
1568
+ },
1569
+ {
1570
+ name: 'parentKey',
1571
+ title: fieldTitle('parent-key'),
1572
+ groupId: 'basic-info',
1573
+ schema: {
1574
+ dataType: 'string',
1575
+ interface: { type: AXPWidgetsCatalog.text },
1576
+ },
1577
+ },
1578
+ {
1579
+ name: 'searchTags',
1580
+ title: fieldTitle('search-tags'),
1581
+ groupId: 'basic-info',
1582
+ schema: {
1583
+ dataType: 'array',
1584
+ defaultValue: [],
1585
+ interface: { type: AXPWidgetsList.Editors.TagEditor },
1586
+ },
1587
+ },
1588
+ {
1589
+ name: 'formatIndividual',
1590
+ title: fieldTitle('format-individual'),
1591
+ groupId: 'formats',
1592
+ schema: {
1593
+ dataType: 'string',
1594
+ interface: { type: AXPWidgetsCatalog.text },
1595
+ },
1596
+ },
1597
+ {
1598
+ name: 'formatPlural',
1599
+ title: fieldTitle('format-plural'),
1600
+ groupId: 'formats',
1601
+ schema: {
1602
+ dataType: 'string',
1603
+ interface: { type: AXPWidgetsCatalog.text },
1604
+ },
1605
+ },
1606
+ {
1607
+ name: 'formatDisplayName',
1608
+ title: fieldTitle('format-display-name'),
1609
+ groupId: 'formats',
1610
+ schema: {
1611
+ dataType: 'string',
1612
+ interface: { type: AXPWidgetsCatalog.text },
1613
+ },
1614
+ },
1615
+ {
1616
+ name: 'formatSearchTitle',
1617
+ title: fieldTitle('format-search-title'),
1618
+ groupId: 'formats',
1619
+ schema: {
1620
+ dataType: 'string',
1621
+ interface: { type: AXPWidgetsCatalog.text },
1622
+ },
1623
+ },
1624
+ {
1625
+ name: 'formatSearchDescription',
1626
+ title: fieldTitle('format-search-description'),
1627
+ groupId: 'formats',
1628
+ schema: {
1629
+ dataType: 'string',
1630
+ interface: { type: AXPWidgetsCatalog.largeText, options: { rows: 2 } },
1631
+ },
1632
+ },
1633
+ {
1634
+ name: 'categoryEntity',
1635
+ title: fieldTitle('category-entity'),
1636
+ groupId: 'category',
1637
+ schema: {
1638
+ dataType: 'string',
1639
+ interface: {
1640
+ type: AXPWidgetsCatalog.lookup,
1641
+ options: {
1642
+ entity: `${RootConfig.module.name}.${RootConfig.entities.entityDefinition.name}`,
1643
+ textField: 'name',
1644
+ valueField: 'name',
1645
+ look: 'select',
1646
+ allowSearch: true,
1647
+ columns: ['name'],
1648
+ },
1649
+ },
1650
+ },
1651
+ },
1652
+ {
1653
+ name: 'categoryTextField',
1654
+ title: fieldTitle('category-text-field'),
1655
+ groupId: 'category',
1656
+ schema: {
1657
+ dataType: 'string',
1658
+ defaultValue: 'title',
1659
+ interface: { type: AXPWidgetsCatalog.text },
1660
+ },
1661
+ },
1662
+ {
1663
+ name: 'categoryValueField',
1664
+ title: fieldTitle('category-value-field'),
1665
+ groupId: 'category',
1666
+ schema: {
1667
+ dataType: 'string',
1668
+ defaultValue: 'id',
1669
+ interface: { type: AXPWidgetsCatalog.text },
1670
+ },
1671
+ },
1672
+ {
1673
+ ...repeaterProperty('plugins', 'plugins', PLUGIN_REPEATER_CHILDREN),
1674
+ },
1675
+ {
1676
+ ...repeaterProperty('groups', 'groups', GROUP_REPEATER_CHILDREN),
1677
+ },
1678
+ {
1679
+ ...repeaterProperty('properties', 'properties', PROPERTY_REPEATER_CHILDREN),
1680
+ },
1681
+ {
1682
+ ...repeaterProperty('columns', 'columns', COLUMN_REPEATER_CHILDREN),
1683
+ },
1684
+ {
1685
+ ...repeaterProperty('relatedEntities', 'related-entities', RELATED_ENTITY_REPEATER_CHILDREN),
1686
+ title: fieldTitle('related-entities'),
1687
+ },
1688
+ {
1689
+ ...repeaterProperty('createSections', 'layouts', CREATE_SECTION_REPEATER_CHILDREN),
1690
+ title: fieldTitle('create-sections'),
1691
+ },
1692
+ {
1693
+ ...repeaterProperty('createProperties', 'layouts', CREATE_PROPERTY_LAYOUT_REPEATER_CHILDREN),
1694
+ title: fieldTitle('create-properties'),
1695
+ },
1696
+ {
1697
+ ...repeaterProperty('listActions', 'actions', ACTION_REPEATER_CHILDREN),
1698
+ title: fieldTitle('list-actions'),
1699
+ },
1700
+ {
1701
+ ...repeaterProperty('singleActions', 'actions', ACTION_REPEATER_CHILDREN),
1702
+ title: fieldTitle('single-actions'),
1703
+ },
1704
+ {
1705
+ ...repeaterProperty('pages', 'advanced', PAGE_REPEATER_CHILDREN),
1706
+ title: fieldTitle('pages'),
1707
+ },
1708
+ {
1709
+ name: 'rules',
1710
+ title: fieldTitle('rules'),
1711
+ groupId: 'advanced',
1712
+ schema: {
1713
+ dataType: 'object',
1714
+ interface: {
1715
+ type: AXPWidgetsList.Advanced.CodeEditor,
1716
+ options: { language: 'json', height: 'h-40' },
1717
+ },
1718
+ },
1719
+ },
1720
+ {
1721
+ name: 'validations',
1722
+ title: fieldTitle('validations'),
1723
+ groupId: 'advanced',
1724
+ schema: {
1725
+ dataType: 'object',
1726
+ interface: {
1727
+ type: AXPWidgetsList.Advanced.CodeEditor,
1728
+ options: { language: 'json', height: 'h-40' },
1729
+ },
1730
+ },
1731
+ },
1732
+ {
1733
+ name: 'commandsJson',
1734
+ title: fieldTitle('commands'),
1735
+ groupId: 'advanced',
1736
+ schema: {
1737
+ dataType: 'object',
1738
+ interface: {
1739
+ type: AXPWidgetsList.Advanced.CodeEditor,
1740
+ options: { language: 'json', height: 'h-40' },
1741
+ },
1742
+ },
1743
+ },
1744
+ {
1745
+ name: 'queriesJson',
1746
+ title: fieldTitle('queries'),
1747
+ groupId: 'advanced',
1748
+ schema: {
1749
+ dataType: 'object',
1750
+ interface: {
1751
+ type: AXPWidgetsList.Advanced.CodeEditor,
1752
+ options: { language: 'json', height: 'h-40' },
1753
+ },
1754
+ },
1755
+ },
1756
+ {
1757
+ name: 'content',
1758
+ title: fieldTitle('content'),
1759
+ groupId: 'schema',
1760
+ schema: {
1761
+ dataType: 'object',
1762
+ readonly: true,
1763
+ interface: {
1764
+ type: AXPWidgetsList.Advanced.CodeEditor,
1765
+ options: { language: 'json', readOnly: true, height: 'h-96' },
1766
+ },
1767
+ },
1768
+ },
1769
+ ],
1770
+ columns: [
1771
+ { name: 'name', title: '@general:terms.common.name', showAs: { type: AXPWidgetsCatalog.text } },
1772
+ {
1773
+ name: 'module',
1774
+ title: fieldTitle('module-id'),
1775
+ showAs: { type: AXPWidgetsCatalog.text },
1776
+ options: { dataPath: 'content.module' },
1777
+ },
1778
+ {
1779
+ name: 'title',
1780
+ title: '@general:terms.common.title',
1781
+ showAs: { type: AXPWidgetsCatalog.text },
1782
+ options: { dataPath: 'content.title' },
1783
+ },
1784
+ {
1785
+ name: 'icon',
1786
+ title: '@general:terms.common.icon',
1787
+ showAs: { type: AXPWidgetsCatalog.iconChooser },
1788
+ options: { dataPath: 'content.icon' },
1789
+ },
1790
+ ],
1791
+ interfaces: {
1792
+ master: {
1793
+ list: {
1794
+ views: [createAllQueryView({ sorts: [{ name: 'name', dir: 'asc' }] })],
1795
+ actions: [entityMasterCreateAction(), entityMasterViewAction()],
1796
+ },
1797
+ create: {
1798
+ sections: [
1799
+ { id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } },
1800
+ { id: 'formats', layout: { positions: { lg: { colSpan: 12 } } } },
1801
+ { id: 'category', layout: { positions: { lg: { colSpan: 12 } } } },
1802
+ ],
1803
+ properties: identityLayout,
1804
+ },
1805
+ update: {
1806
+ sections: [
1807
+ { id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } },
1808
+ { id: 'formats', layout: { positions: { lg: { colSpan: 12 } } } },
1809
+ { id: 'category', layout: { positions: { lg: { colSpan: 12 } } } },
1810
+ ],
1811
+ properties: identityLayout,
1812
+ },
1813
+ single: {
1814
+ title: '{{ name }}',
1815
+ sections: [
1816
+ { id: 'basic-info' },
1817
+ { id: 'formats' },
1818
+ { id: 'schema' },
1819
+ ],
1820
+ properties: [
1821
+ { name: 'name', dataPath: 'content.name', layout: { positions: { lg: { colSpan: 6 } } } },
1822
+ { name: 'module', dataPath: 'content.module', layout: { positions: { lg: { colSpan: 6 } } } },
1823
+ { name: 'title', dataPath: 'content.title', layout: { positions: { lg: { colSpan: 6 } } } },
1824
+ { name: 'icon', dataPath: 'content.icon', layout: { positions: { lg: { colSpan: 6 } } } },
1825
+ {
1826
+ name: 'parentKey',
1827
+ dataPath: 'content.parentKey',
1828
+ layout: { positions: { lg: { colSpan: 6 } } },
1829
+ },
1830
+ { name: 'content', layout: { positions: { lg: { colSpan: 12 } } } },
1831
+ ],
1832
+ actions: [...entityMasterRecordActions()],
1833
+ },
1834
+ },
1835
+ },
1836
+ };
1837
+ return entityDef;
1838
+ }
1839
+ async function entityDefinitionEntityFactory() {
1840
+ return buildEntityDefinitionEntity();
1841
+ }
1842
+ //#endregion
1843
+
1844
+ //#endregion
1845
+
1846
+ //#region ----- Platform explorer runtime keys -----
1847
+ const AXMPlatformExplorerQueryKeys = {
1848
+ ListModules: 'PlatformManagement:Explorer:ListModules',
1849
+ GetModule: 'PlatformManagement:Explorer:GetModule',
1850
+ GetEntity: 'PlatformManagement:Explorer:GetEntity',
1851
+ GetCatalogItem: 'PlatformManagement:Explorer:GetCatalogItem',
1852
+ };
1853
+ //#endregion
1854
+
1855
+ //#endregion
1856
+
194
1857
  //#region ---- Contracts barrel ----
195
1858
 
196
1859
  /**
197
1860
  * Generated bundle index. Do not edit.
198
1861
  */
199
1862
 
200
- export { AXM_REINDEX_QUICK_SEARCH_CHECKPOINT_OVERLAP_HOURS, AXM_REINDEX_QUICK_SEARCH_COMMAND_KEY, AXM_REINDEX_QUICK_SEARCH_JOB_CAPABILITIES, AXM_REINDEX_QUICK_SEARCH_LOOKBACK_HOURS, AXM_REINDEX_QUICK_SEARCH_SCHEDULE_CRON, AXM_RELOAD_RUNTIME_MEMORY_COMMAND_KEY, AXM_TOKEN_RESOLVE_COMMAND_KEY, AXPApplicationsPlatformPermissionKeys, AXPPlatformManagementFeatureKeys, AXPPlatformManagementMenuKeys, AXPPlatformManagementPermissionKeys, RootConfig };
1863
+ export { AXMPlatformExplorerQueryKeys, AXM_REINDEX_QUICK_SEARCH_CHECKPOINT_OVERLAP_HOURS, AXM_REINDEX_QUICK_SEARCH_COMMAND_KEY, AXM_REINDEX_QUICK_SEARCH_JOB_CAPABILITIES, AXM_REINDEX_QUICK_SEARCH_LOOKBACK_HOURS, AXM_REINDEX_QUICK_SEARCH_SCHEDULE_CRON, AXM_RELOAD_RUNTIME_MEMORY_COMMAND_KEY, AXM_TOKEN_RESOLVE_COMMAND_KEY, AXPApplicationsPlatformPermissionKeys, AXPPlatformManagementFeatureKeys, AXPPlatformManagementMenuKeys, AXPPlatformManagementPermissionKeys, ENTITY_DEFINITION_CREATE_ERROR, ENTITY_DEFINITION_DESIGNER_FORM_KEYS, ENTITY_DEFINITION_SCHEMA_PAGE_COMPONENT_KEY, ENTITY_DEFINITION_SCHEMA_PROPERTY_NAMES, ENTITY_DEFINITION_SURFACES_PAGE_COMPONENT_KEY, ENTITY_DEFINITION_SURFACES_PROPERTY_NAMES, PlatformManagementManifest, RootConfig, assembleEntityDefinitionStoreRecord, buildEntityDefinitionEntity, entityDefinitionEntityFactory, flattenEntityContentToDesignerForm, flattenProperties };
201
1864
  //# sourceMappingURL=acorex-platform-module-platform-management-client-contracts.mjs.map