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

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