@farris/jit-engine 1.3.329 → 1.3.331

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 (37) hide show
  1. package/README.md +12 -0
  2. package/lib/domstructure/devkit/viewmodel/component/component.js +221 -221
  3. package/lib/domstructure/devkit/viewmodel/component/component.js.map +1 -1
  4. package/lib/domstructure/devkit/viewmodel/viewmodel.js +135 -134
  5. package/lib/domstructure/devkit/viewmodel/viewmodel.js.map +1 -1
  6. package/lib/domstructure/ui/commands/toolbar.js +47 -45
  7. package/lib/domstructure/ui/commands/toolbar.js.map +1 -1
  8. package/lib/domstructure/ui/section/index.js +14 -14
  9. package/lib/domstructure/ui/section/section-html.js +6 -6
  10. package/lib/domstructure/ui/section/section.js +139 -137
  11. package/lib/domstructure/ui/section/section.js.map +1 -1
  12. package/lib/domstructure/ui/tabs/farris-tabs.js +98 -96
  13. package/lib/domstructure/ui/tabs/farris-tabs.js.map +1 -1
  14. package/lib/utility/config-hepler.js +73 -64
  15. package/lib/utility/config-hepler.js.map +1 -1
  16. package/lib/utility/declaration-trigger.js +304 -294
  17. package/lib/utility/declaration-trigger.js.map +1 -1
  18. package/lib/utility/devkit/component-parameter-collector/toolbar-collector.js +15 -10
  19. package/lib/utility/devkit/component-parameter-collector/toolbar-collector.js.map +1 -1
  20. package/lib/utility/devkit/devkit-creator.js +29 -28
  21. package/lib/utility/devkit/devkit-creator.js.map +1 -1
  22. package/lib/utility/devkit/external-component/external-component-creator.js +2 -1
  23. package/lib/utility/devkit/external-component/external-component-creator.js.map +1 -1
  24. package/lib/utility/devkit/form-file-executor.js +425 -416
  25. package/lib/utility/devkit/form-file-executor.js.map +1 -1
  26. package/lib/utility/devkit/toolbar/toolbar-item.js +2 -2
  27. package/lib/utility/devkit/toolbar/toolbar.js +2 -2
  28. package/lib/utility/devkit/toolbar/toolbaritem-state.js +2 -2
  29. package/lib/utility/template-generator/devkit/component-generator/component-events-parameter-generator.js +112 -112
  30. package/lib/utility/template-generator/devkit/component-generator/component-events-parameter-generator.js.map +1 -1
  31. package/lib/utility/template-generator/devkit/component-generator/component-farristabs-parameter-generator.js +210 -149
  32. package/lib/utility/template-generator/devkit/component-generator/component-farristabs-parameter-generator.js.map +1 -1
  33. package/lib/utility/template-generator/devkit/component-generator/component-section-parameter-generator.js +213 -161
  34. package/lib/utility/template-generator/devkit/component-generator/component-section-parameter-generator.js.map +1 -1
  35. package/lib/utility/template-generator/devkit/component-generator/component-toolbar-parameter-generator.js +219 -219
  36. package/lib/utility/template-generator/devkit/component-generator/component-toolbar-parameter-generator.js.map +1 -1
  37. package/package.json +1 -1
@@ -1,417 +1,426 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormFileExecutor = void 0;
4
- const __1 = require("..");
5
- const declaration_trigger_1 = require("../declaration-trigger");
6
- const devkit_object_name_creator_1 = require("./devkit-object-name-creator");
7
- const entities_creator_1 = require("./entities-creator");
8
- const repository_creator_1 = require("./repository-creator");
9
- const viewmodels_creator_1 = require("./viewmodels-creator");
10
- const routing_creator_1 = require("./routing-creator");
11
- const module_creator_1 = require("./module-creator");
12
- const declarationevents_modifier_1 = require("./declarationevents-modifier");
13
- const external_components_creator_1 = require("./external-component/external-components-creator");
14
- const qdp_jointsearch_generator_1 = require("../qdp-jointsearch-generator");
15
- const external_component_1 = require("./external-component");
16
- const qdpForm_checker_1 = require("../qdpForm-checker");
17
- const form_resource_json_reader_1 = require("./form-resource-json-reader");
18
- const file_operation_1 = require("../file-operation");
19
- const jit_constant_1 = require("../jit-constant");
20
- const component_children_routes_creator_1 = require("./component-children-routes-creator");
21
- const primeng_treegrid_checker_1 = require("../primeng-treegrid-checker");
22
- const portlet_checker_1 = require("../portlet-checker");
23
- const event_token_generator_1 = require("../event-token-generator");
24
- const progress_steps_checker_1 = require("../progress-steps-checker");
25
- const personnel_selector_checker_1 = require("../personnel-selector-checker");
26
- const approval_logs_check_1 = require("../approval-logs-check");
27
- const ext_intergration_checker_1 = require("../ext-intergration-checker");
28
- const organization_selector_checker_1 = require("../organization-selector-checker");
29
- const city_selector_checker_1 = require("../city-selector-checker");
30
- const approval_comments_checker_1 = require("../approval-comments-checker");
31
- const oa_relation_checker_1 = require("../oa-relation-checker");
32
- const employee_selector_checker_1 = require("../employee-selector-checker");
33
- const adminorganization_selector_checker_1 = require("../adminorganization-selector-checker");
34
- const image_upload_checker_1 = require("../image-upload-checker");
35
- const appointment_calendar_checker_1 = require("../appointment-calendar-checker");
36
- const multi_textbox_checker_1 = require("../multi-textbox-checker");
37
- const qrcode_selector_checker_1 = require("../qrcode-selector-checker");
38
- const aif_check_1 = require("../aif-check");
39
- const behavior_1 = require("../behavior");
40
- class FormFileExecutor {
41
- constructor() {
42
- }
43
- static getSingleInstance() {
44
- if (!this.instance) {
45
- this.instance = new FormFileExecutor();
46
- }
47
- return this.instance;
48
- }
49
- execute(value) {
50
- var _a, _b, _c, _d, _e, _f, _g;
51
- let entities, repository, viewmodels, routing, modules;
52
- if (value.externalComponent &&
53
- value.externalComponent.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType &&
54
- value.externalComponent.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl) {
55
- viewmodels = [];
56
- return {
57
- devkit: {
58
- viewmodels: viewmodels
59
- }
60
- };
61
- }
62
- let ui, vo, eapi;
63
- let externalComponents = [];
64
- const sm = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.StateMachine);
65
- const cmd = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Command);
66
- ui = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Frm);
67
- if (ui && ui.module) {
68
- qdpForm_checker_1.QdpFormChecker.checkIsQdpForm(ui, value.qdpForm);
69
- const qdpJoinSearch = { isJointSearch: false };
70
- qdp_jointsearch_generator_1.QDPJointSearchGenerator.checkIsQdpJoinSearch(ui, qdpJoinSearch);
71
- const hasPrimengTreeGrid = { isPrimengTreeGrid: false };
72
- primeng_treegrid_checker_1.PrimengTreeGridChecker.checkIsPrimengTreeGrid(ui, hasPrimengTreeGrid);
73
- const hasCitySelector = { isCitySelector: false };
74
- city_selector_checker_1.CitySelectorChecker.checkIsPrimengTreeGrid(ui, hasCitySelector);
75
- const hasApprovalComments = { isApprovalComments: false };
76
- approval_comments_checker_1.ApprovalCommentsChecker.checkIsPrimengTreeGrid(ui, hasApprovalComments);
77
- const hasUseComments = { useComments: false };
78
- multi_textbox_checker_1.MultiTextBoxChecker.checkMultiTextBox(ui, hasUseComments);
79
- const hasImageUpload = { isImageUpload: false };
80
- image_upload_checker_1.ImageUploadChecker.checkIsPrimengTreeGrid(ui, hasImageUpload);
81
- const hasPersonnelSelector = { isPersonnelSelector: false, isGridPersonnelSelector: false };
82
- personnel_selector_checker_1.PersonnelSelectorChecker.checkIsPersonnelSelector(ui, hasPersonnelSelector);
83
- const hasOrganizationSelector = { isOrganizationSelector: false, isGridOrganizationSelector: false };
84
- organization_selector_checker_1.OrganizationSelectorChecker.checkIsOrganizationSelector(ui, hasOrganizationSelector);
85
- const hasEmployeeSelector = { isEmployeeSelector: false, isGridEmployeeSelector: false };
86
- employee_selector_checker_1.EmployeeSelectorChecker.checkIsEmployeeSelector(ui, hasEmployeeSelector);
87
- const hasAdminOrganizationSelector = { isAdminOrganizationSelector: false, isGridAdminOrganizationSelector: false };
88
- adminorganization_selector_checker_1.AdminOrganizationSelectorChecker.checkIsAdminOrganizationSelector(ui, hasAdminOrganizationSelector);
89
- const hasQrCode = { isQrCode: false, isGridQrCode: false };
90
- qrcode_selector_checker_1.QrCodeChecker.checkIsQrCode(ui, hasQrCode);
91
- const hasAppointmentCalendar = { isAppointmentCalendar: false, isGridAppointmentCalendar: false };
92
- appointment_calendar_checker_1.AppointmentCalendarChecker.checkIsAppointmentCalendar(ui, hasAppointmentCalendar);
93
- const hasApproveLogs = { isApprovalLogs: false };
94
- approval_logs_check_1.ApprovalLogsCheck.checkIsApprovalLogs(ui, hasApproveLogs);
95
- const hasOaRelation = { isOaRelation: false };
96
- oa_relation_checker_1.OaRelationCheck.checkIsOaRelation(ui, hasOaRelation);
97
- const hasExtIntergration = { isExtIntergration: false, isGridExtIntergration: false };
98
- ext_intergration_checker_1.ExtIntergrationChecker.checkIsExternalIntegration(ui, hasExtIntergration);
99
- const hasProgressStep = { isProgressStep: false };
100
- progress_steps_checker_1.ProgressStepsChecker.check(ui, hasProgressStep);
101
- const hasPortlet = { hasPortlet: false };
102
- portlet_checker_1.PortletChecker.checkHasPortlet(ui, hasPortlet);
103
- const hasAif = { hasAif: false };
104
- aif_check_1.AifChecker.checkEnableAif(ui, hasAif);
105
- behavior_1.BehaviorManager.checkHasComponents(ui.module, value, value.formSaveInfo);
106
- if (ui.module.declarations && ui.module.components) {
107
- declaration_trigger_1.DeclarationTrigger.getNewInstance().modifyComponentCommand(ui.module.declarations, ui.module.components, ui.module.viewmodels);
108
- }
109
- if (ui.module.code && __1.ToolHelper.isArray(ui.module.schemas, false) && __1.ToolHelper.isArray(ui.module.components, false)) {
110
- this.modifyDeclarationEvents(ui, value);
111
- const mainEntityCode = ui.module.schemas[0].entities[0].code;
112
- eapi = this.readEapiJSONFileAndReturnFirst(ui, value, mainEntityCode);
113
- vo = ui.module.schemas[0];
114
- let enableStdTimeFormat = false;
115
- if (vo.extendProperties) {
116
- enableStdTimeFormat = __1.ToolHelper.isNullOrUndefined(vo.extendProperties.enableStdTimeFormat) ? false : vo.extendProperties.enableStdTimeFormat;
117
- }
118
- entities = entities_creator_1.EntitiesCreator.getSingleInstance().createEntites(vo, enableStdTimeFormat);
119
- repository = repository_creator_1.RepositoryCreator.getNewInstance().createRepository({
120
- mainEntityCode: mainEntityCode,
121
- restUri: ui.module.schemas[0].sourceUri,
122
- viewModels: ui.module.viewmodels,
123
- eapi: eapi,
124
- entities: vo.entities,
125
- isGroupForm: value.isGroupForm
126
- });
127
- viewmodels = viewmodels_creator_1.ViewModelsCreator.getNewInstance().createViewModels({
128
- ui: ui,
129
- sm: sm,
130
- cmd: cmd || {},
131
- entity: entities,
132
- mainEntityCode: mainEntityCode,
133
- eapi: eapi,
134
- parentExternalComponent: value.externalComponent,
135
- isJointSearch: qdpJoinSearch.isJointSearch,
136
- parentModule: value.externalComponent && value.externalComponent.parentModule ? value.externalComponent.parentModule : null,
137
- metaDataConfig: value.inputOptions,
138
- i18nResourcePrefix: value.i18nResourcePrefix,
139
- externalComponentNameSpace: value.externalComponentNameSpace
140
- });
141
- const componentChildRoutes = component_children_routes_creator_1.ComponentChildrenRoutesCreator.getNewInstance().create(ui);
142
- routing = routing_creator_1.RoutingCreator.createRouting({
143
- code: ui.module.code,
144
- componentId: ui.module.components[0].id,
145
- componentName: __1.ToolHelper.tf(ui.module.components[0].id),
146
- currentPageInfo: value.currentPageInfo,
147
- componentChildrenRoutes: componentChildRoutes
148
- });
149
- const resourceJson = this.getFormResourceJson(value, ui);
150
- modules = module_creator_1.ModuleCreator.getNewInstance().createModule({
151
- code: ui.module.code,
152
- ctrlLangs: resourceJson,
153
- viewmodels: viewmodels,
154
- repository: repository,
155
- ip: value.inputOptions.ip, port: value.inputOptions.port,
156
- serviceRefs: ui.module.serviceRefs,
157
- commands: ui.module.webcmds,
158
- extraImports: ui.module.extraImports,
159
- isGroupForm: value.isGroupForm,
160
- eapi: eapi,
161
- isJointSearch: qdpJoinSearch.isJointSearch,
162
- isPrimengTreeGrid: hasPrimengTreeGrid.isPrimengTreeGrid,
163
- isCitySelector: hasCitySelector.isCitySelector,
164
- isApprovalComments: hasApprovalComments.isApprovalComments,
165
- isImageUpload: hasImageUpload.isImageUpload,
166
- isPersonnelSelector: hasPersonnelSelector.isPersonnelSelector,
167
- isGridPersonnelSelector: hasPersonnelSelector.isGridPersonnelSelector,
168
- isOrganizationSelector: hasOrganizationSelector.isOrganizationSelector,
169
- isGridOrganizationSelector: hasOrganizationSelector.isGridOrganizationSelector,
170
- isEmployeeSelector: hasEmployeeSelector.isEmployeeSelector,
171
- isGridEmployeeSelector: hasEmployeeSelector.isGridEmployeeSelector,
172
- isQrCode: hasQrCode.isQrCode,
173
- isGridQrCode: hasQrCode.isGridQrCode,
174
- isAppointmentCalendar: hasAppointmentCalendar.isAppointmentCalendar,
175
- isGridAppointmentCalendar: hasAppointmentCalendar.isGridAppointmentCalendar,
176
- multiTextboxUseComments: hasUseComments.useComments,
177
- isAdminOrganizationSelector: hasAdminOrganizationSelector.isAdminOrganizationSelector,
178
- isGridAdminOrganizationSelector: hasAdminOrganizationSelector.isGridAdminOrganizationSelector,
179
- isExtIntergration: hasExtIntergration.isExtIntergration,
180
- isGridExtIntergration: hasExtIntergration.isGridExtIntergration,
181
- isApprovalLogs: hasApproveLogs.isApprovalLogs,
182
- isOaRelation: hasOaRelation.isOaRelation,
183
- isProgressStep: hasProgressStep.isProgressStep,
184
- isPortlet: hasPortlet.hasPortlet,
185
- moduleReference: ui.module.moduleReference,
186
- innerComponents: ui.module.innerComponents,
187
- currentPageInfo: value.currentPageInfo,
188
- beforeTemplateScript: ui.module.beforeTemplateScript,
189
- hasAif: hasAif.hasAif
190
- });
191
- }
192
- }
193
- else {
194
- __1.LoggerHelper.log(`form file has none module data, the form file path is ${__1.ToolHelper.pathJoinAndnormalize(value.metaFilePath, value.metaFileName + jit_constant_1.JITConstant.JsonExtension)}!`);
195
- return;
196
- }
197
- if (__1.ToolHelper.isArray(ui.module.externalComponents, false)) {
198
- const i18nResourcePrefix = value.i18nResourcePrefix;
199
- externalComponents = external_components_creator_1.ExternalComponentsCreator.getInstance().createExternalComponents(ui.module, value.inputOptions, viewmodels, value.inputOptions.eapiPath, value.projectName, value.isExternalComponent ? true : false, value.allPages, value.qdpForm, value.metaFilePath, i18nResourcePrefix, value.formSaveInfo);
200
- if (__1.ToolHelper.isArray(externalComponents, false)) {
201
- externalComponents.forEach((item) => {
202
- if (item.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType && item.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl) {
203
- }
204
- else {
205
- const externalComponentModule = this.getExternalComponentModulePath(item);
206
- if (externalComponentModule) {
207
- modules.dependencies.push(externalComponentModule.dependency);
208
- modules.imports.push(externalComponentModule.import);
209
- }
210
- }
211
- });
212
- }
213
- }
214
- viewmodels.forEach((viewModelItem) => {
215
- const externalContainerParameters = viewModelItem["component"] ? viewModelItem["component"]["externalContainerParameters"] : [];
216
- if (__1.ToolHelper.isArray(externalContainerParameters, false)) {
217
- externalContainerParameters.forEach((externalContainerParameter) => {
218
- const externalComponentId = externalContainerParameter.id;
219
- const externalComponentCode = externalContainerParameter.code;
220
- if (externalContainerParameter.declarations && __1.ToolHelper.isArray(externalContainerParameter.declarations.events, false)) {
221
- externalContainerParameter.declarations.events.forEach((externalContainerEvent) => {
222
- const externalContainerEventCode = externalContainerEvent.code;
223
- viewmodels.forEach((childViewModel) => {
224
- const childComponentSubscriptions = childViewModel["component"] ? childViewModel["component"]["componentSubscriptions"] : [];
225
- if (__1.ToolHelper.isArray(childComponentSubscriptions, false)) {
226
- childComponentSubscriptions.forEach((childComponentSubscription) => {
227
- if (childComponentSubscription.sourceComponent == externalComponentId && childComponentSubscription.subscribeOn == externalContainerEventCode) {
228
- if (__1.ToolHelper.isNullOrUndefined(childComponentSubscription.token) == true) {
229
- childComponentSubscription.token = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
230
- }
231
- externalContainerEvent.token = childComponentSubscription.token;
232
- }
233
- });
234
- }
235
- });
236
- if (__1.ToolHelper.isArray(externalComponents, false)) {
237
- externalComponents.forEach((externalComponentItem) => {
238
- const metadataDevkit = externalComponentItem["metaDataDevkit"] ? externalComponentItem["metaDataDevkit"]["devkit"] : {};
239
- const externalViewModels = metadataDevkit["viewmodels"];
240
- if (__1.ToolHelper.isArray(externalViewModels, false)) {
241
- externalViewModels.forEach((externalViewModelItem) => {
242
- const externalComponentSubscriptions = externalViewModelItem["component"] ? externalViewModelItem["component"]["componentSubscriptions"] : [];
243
- if (__1.ToolHelper.isArray(externalComponentSubscriptions, false)) {
244
- const findExternalComponentSubscription = externalComponentSubscriptions.find((externalComponentSubscriptionItem) => {
245
- return externalComponentSubscriptionItem.sourceComponent == externalComponentId && externalComponentSubscriptionItem.subscribeOn == externalContainerEventCode;
246
- });
247
- if (findExternalComponentSubscription) {
248
- let externalComponentToken = findExternalComponentSubscription.token ? findExternalComponentSubscription.token : externalContainerEvent.token;
249
- if (!externalComponentToken) {
250
- externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(externalComponentCode, findExternalComponentSubscription.targetComponent, "-");
251
- }
252
- findExternalComponentSubscription.token = externalContainerEvent.token = externalComponentToken;
253
- }
254
- }
255
- });
256
- }
257
- });
258
- }
259
- externalContainerParameters.forEach((exParameter) => {
260
- if (__1.ToolHelper.isArray(exParameter.subscriptions, false)) {
261
- exParameter.subscriptions.forEach((subscriptionParameter) => {
262
- const subscriptionSourceComponent = subscriptionParameter["sourceComponent"];
263
- const subscriptionOn = subscriptionParameter["subscribeOn"];
264
- if (externalComponentId == subscriptionSourceComponent && externalContainerEventCode == subscriptionOn) {
265
- let externalComponentToken = externalContainerEvent.token ? externalContainerEvent.token : subscriptionParameter.token;
266
- if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
267
- externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(externalComponentCode, subscriptionParameter["targetComponent"], "-");
268
- }
269
- externalContainerEvent.token = subscriptionParameter.token = externalComponentToken;
270
- }
271
- });
272
- }
273
- });
274
- });
275
- }
276
- if (__1.ToolHelper.isArray(externalContainerParameter.subscriptions, false)) {
277
- externalContainerParameter.subscriptions.forEach((subscriptionItem) => {
278
- if (ui.module.declarations && __1.ToolHelper.isArray(ui.module.declarations.events, false)) {
279
- const findDeclarationEvent = ui.module.declarations.events.find((declarationEventItem) => {
280
- return declarationEventItem["code"] == subscriptionItem["subscribeOn"] && ui.module.code == subscriptionItem["sourceComponent"];
281
- });
282
- if (findDeclarationEvent) {
283
- let externalComponentToken = findDeclarationEvent.token ? findDeclarationEvent.token : subscriptionItem.token;
284
- if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
285
- externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
286
- }
287
- findDeclarationEvent.token = subscriptionItem.token = externalComponentToken;
288
- }
289
- }
290
- externalContainerParameters.forEach((exParameter) => {
291
- if (exParameter.declarations && __1.ToolHelper.isArray(exParameter.declarations.events, false)) {
292
- exParameter.declarations.events.forEach((declarationEventParameter) => {
293
- const findDeclarationEvent = exParameter.declarations.events.find((declarationEventItem) => {
294
- return declarationEventParameter["code"] == subscriptionItem["subscribeOn"] && exParameter.code == subscriptionItem["sourceComponent"];
295
- });
296
- if (findDeclarationEvent) {
297
- let externalComponentToken = findDeclarationEvent.token ? findDeclarationEvent.token : subscriptionItem.token;
298
- if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
299
- externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
300
- }
301
- findDeclarationEvent.token = subscriptionItem.token = externalComponentToken;
302
- }
303
- });
304
- }
305
- });
306
- });
307
- }
308
- });
309
- }
310
- });
311
- const enableDynamicForm = value.inputOptions.isEnableDynamicForm && __1.ToolHelper.convertStringToBoolean(((_a = ui.options) === null || _a === void 0 ? void 0 : _a.renderMode) === 'dynamic', false);
312
- const enableDeleteSourceCode = __1.ToolHelper.convertStringToBoolean((_b = ui.options) === null || _b === void 0 ? void 0 : _b.enableDeleteSourceCode, false);
313
- const changeSetPolicy = (_c = ui.options) === null || _c === void 0 ? void 0 : _c.changeSetPolicy;
314
- const enableServerSideChangeDetection = __1.ToolHelper.convertStringToBoolean((_d = ui.options) === null || _d === void 0 ? void 0 : _d.enableServerSideChangeDetection, false);
315
- const enableAif = __1.ToolHelper.convertStringToBoolean((_e = ui.options) === null || _e === void 0 ? void 0 : _e.enableAif, false);
316
- let pushMode = '';
317
- if (ui.options && ui.options.formRulePushMode) {
318
- pushMode = ui.options.formRulePushMode;
319
- }
320
- return {
321
- devkit: {
322
- entities: entities,
323
- repository: repository,
324
- viewmodels: viewmodels,
325
- module: modules,
326
- routing: routing,
327
- eapi: eapi,
328
- externalComponents: externalComponents,
329
- declarations: ui.module.declarations || {},
330
- projectName: value.projectName,
331
- moduleReference: ui.module.moduleReference,
332
- innerComponents: ui.module.innerComponents,
333
- enableDynamicForm: enableDynamicForm,
334
- isApproveFormat: (_f = value.currentPageInfo) === null || _f === void 0 ? void 0 : _f.isApproveFormat,
335
- formCode: (_g = value.currentPageInfo) === null || _g === void 0 ? void 0 : _g.code,
336
- enableDeleteSourceCode: enableDeleteSourceCode,
337
- enableServerSideChangeDetection: enableServerSideChangeDetection,
338
- changeSetPolicy: changeSetPolicy,
339
- enableAif: enableAif,
340
- pushMode: pushMode
341
- }
342
- };
343
- }
344
- getFormResourceJson(value, ui) {
345
- if (value.inputOptions.useI18nResource == false) {
346
- return { "zh-CHS": [] };
347
- }
348
- let resourceJson = form_resource_json_reader_1.FormResourceJsonReader.read(value.metaFileName, value.metaFilePath);
349
- if (!resourceJson) {
350
- if (ui.module.ctrlLangs) {
351
- const ctrlLangs = ui.module.ctrlLangs;
352
- ctrlLangs["zh-CHS"] = ctrlLangs["ch"];
353
- resourceJson = ctrlLangs;
354
- }
355
- else {
356
- resourceJson = { "zh-CHS": [] };
357
- }
358
- }
359
- return resourceJson;
360
- }
361
- modifyDeclarationEvents(ui, value) {
362
- if (ui.module.declarations) {
363
- const externalParentModule = value.externalComponent ? value.externalComponent.parentModule : null;
364
- const parentDeclarations = externalParentModule ? externalParentModule.declarations : null;
365
- if (!externalParentModule) {
366
- declarationevents_modifier_1.DeclarationEventsModifier.modifyDeclarationEvents(ui.module.declarations, null, ui.module, parentDeclarations);
367
- }
368
- else {
369
- declarationevents_modifier_1.DeclarationEventsModifier.modifyDeclarationEvents(ui.module.declarations, externalParentModule, value.externalComponent, parentDeclarations);
370
- }
371
- }
372
- }
373
- getExternalComponentModulePath(externalComponent) {
374
- if (!externalComponent || (externalComponent.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType && externalComponent.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl)) {
375
- return;
376
- }
377
- if (!externalComponent.metaDataDevkit) {
378
- __1.LoggerHelper.log(`external component has none value,the external form is :${externalComponent.code}, external component id is ${externalComponent.id}`);
379
- return;
380
- }
381
- else {
382
- const externalComponentUniqueCode = __1.ToolHelper.addPrefixWhenFirstNumber(externalComponent.containerId ? externalComponent.containerId : externalComponent.code);
383
- const externalComponentModulePath = "./" + external_component_1.ExternalComponentConstant.DefaultExternalComponentFirstPath + "/" + externalComponentUniqueCode.toLowerCase() + "/" + externalComponent.metaDataDevkit.devkit.module.code.toLowerCase() + "/" + externalComponent.metaDataDevkit.devkit.module.code.toLowerCase() + ".module";
384
- const externalComponentPrefix = __1.ToolHelper.tf(`${externalComponentUniqueCode.toLowerCase()}${externalComponent.metaDataDevkit.devkit.module.code.toLowerCase()}`);
385
- const usePrefix = externalComponent.parentIsExternal ? false : true;
386
- return {
387
- "dependency": {
388
- name: `${externalComponentPrefix}${externalComponent.metaDataDevkit.devkit.module.code}Module`,
389
- path: externalComponentModulePath,
390
- usePrefix: usePrefix
391
- },
392
- "import": { "name": `${externalComponentPrefix + externalComponent.metaDataDevkit.devkit.module.code}Module` }
393
- };
394
- }
395
- }
396
- readEapiJSONFileAndReturnFirst(ui, value, mainEntityCode) {
397
- const eapiFileName = ui.module.schemas[0].eapiFileName ? ui.module.schemas[0].eapiFileName : value.metaFileName;
398
- const arrEapi = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Eapi);
399
- if (arrEapi && __1.ToolHelper.isArray(arrEapi, false)) {
400
- const eapi = arrEapi[0];
401
- eapi.name = mainEntityCode;
402
- eapi.proxyName = devkit_object_name_creator_1.DevkitObjectNameCreator.getDevkitObjectNameWithType("befProxy", __1.ToolHelper.tf(mainEntityCode));
403
- eapi.restUri = ui.module.schemas[0].sourceUri;
404
- if (eapi.Service && !eapi.Content) {
405
- eapi.Content = {};
406
- eapi.Content.Service = eapi.Service;
407
- }
408
- return eapi;
409
- }
410
- else {
411
- __1.LoggerHelper.log(`the form:${value.metaFileName} has none eapi file: ${eapiFileName} or has no data!`, __1.LoggerLevel.Warning);
412
- }
413
- }
414
- }
415
- exports.FormFileExecutor = FormFileExecutor;
416
- FormFileExecutor.instance = new FormFileExecutor();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormFileExecutor = void 0;
4
+ const __1 = require("..");
5
+ const declaration_trigger_1 = require("../declaration-trigger");
6
+ const devkit_object_name_creator_1 = require("./devkit-object-name-creator");
7
+ const entities_creator_1 = require("./entities-creator");
8
+ const repository_creator_1 = require("./repository-creator");
9
+ const viewmodels_creator_1 = require("./viewmodels-creator");
10
+ const routing_creator_1 = require("./routing-creator");
11
+ const module_creator_1 = require("./module-creator");
12
+ const declarationevents_modifier_1 = require("./declarationevents-modifier");
13
+ const external_components_creator_1 = require("./external-component/external-components-creator");
14
+ const qdp_jointsearch_generator_1 = require("../qdp-jointsearch-generator");
15
+ const external_component_1 = require("./external-component");
16
+ const qdpForm_checker_1 = require("../qdpForm-checker");
17
+ const form_resource_json_reader_1 = require("./form-resource-json-reader");
18
+ const file_operation_1 = require("../file-operation");
19
+ const jit_constant_1 = require("../jit-constant");
20
+ const component_children_routes_creator_1 = require("./component-children-routes-creator");
21
+ const primeng_treegrid_checker_1 = require("../primeng-treegrid-checker");
22
+ const portlet_checker_1 = require("../portlet-checker");
23
+ const event_token_generator_1 = require("../event-token-generator");
24
+ const progress_steps_checker_1 = require("../progress-steps-checker");
25
+ const personnel_selector_checker_1 = require("../personnel-selector-checker");
26
+ const approval_logs_check_1 = require("../approval-logs-check");
27
+ const ext_intergration_checker_1 = require("../ext-intergration-checker");
28
+ const organization_selector_checker_1 = require("../organization-selector-checker");
29
+ const city_selector_checker_1 = require("../city-selector-checker");
30
+ const approval_comments_checker_1 = require("../approval-comments-checker");
31
+ const oa_relation_checker_1 = require("../oa-relation-checker");
32
+ const employee_selector_checker_1 = require("../employee-selector-checker");
33
+ const adminorganization_selector_checker_1 = require("../adminorganization-selector-checker");
34
+ const image_upload_checker_1 = require("../image-upload-checker");
35
+ const appointment_calendar_checker_1 = require("../appointment-calendar-checker");
36
+ const multi_textbox_checker_1 = require("../multi-textbox-checker");
37
+ const qrcode_selector_checker_1 = require("../qrcode-selector-checker");
38
+ const aif_check_1 = require("../aif-check");
39
+ const behavior_1 = require("../behavior");
40
+ class FormFileExecutor {
41
+ constructor() {
42
+ }
43
+ static getSingleInstance() {
44
+ if (!this.instance) {
45
+ this.instance = new FormFileExecutor();
46
+ }
47
+ return this.instance;
48
+ }
49
+ execute(value) {
50
+ var _a, _b, _c, _d, _e, _f, _g;
51
+ let entities, repository, viewmodels, routing, modules;
52
+ if (value.externalComponent &&
53
+ value.externalComponent.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType &&
54
+ value.externalComponent.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl) {
55
+ viewmodels = [];
56
+ return {
57
+ devkit: {
58
+ viewmodels: viewmodels
59
+ }
60
+ };
61
+ }
62
+ let ui, vo, eapi;
63
+ let externalComponents = [];
64
+ const sm = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.StateMachine);
65
+ const cmd = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Command);
66
+ ui = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Frm);
67
+ if (ui && ui.module) {
68
+ this.dealRouteForm(ui, value.isRouteForm);
69
+ qdpForm_checker_1.QdpFormChecker.checkIsQdpForm(ui, value.qdpForm);
70
+ const qdpJoinSearch = { isJointSearch: false };
71
+ qdp_jointsearch_generator_1.QDPJointSearchGenerator.checkIsQdpJoinSearch(ui, qdpJoinSearch);
72
+ const hasPrimengTreeGrid = { isPrimengTreeGrid: false };
73
+ primeng_treegrid_checker_1.PrimengTreeGridChecker.checkIsPrimengTreeGrid(ui, hasPrimengTreeGrid);
74
+ const hasCitySelector = { isCitySelector: false };
75
+ city_selector_checker_1.CitySelectorChecker.checkIsPrimengTreeGrid(ui, hasCitySelector);
76
+ const hasApprovalComments = { isApprovalComments: false };
77
+ approval_comments_checker_1.ApprovalCommentsChecker.checkIsPrimengTreeGrid(ui, hasApprovalComments);
78
+ const hasUseComments = { useComments: false };
79
+ multi_textbox_checker_1.MultiTextBoxChecker.checkMultiTextBox(ui, hasUseComments);
80
+ const hasImageUpload = { isImageUpload: false };
81
+ image_upload_checker_1.ImageUploadChecker.checkIsPrimengTreeGrid(ui, hasImageUpload);
82
+ const hasPersonnelSelector = { isPersonnelSelector: false, isGridPersonnelSelector: false };
83
+ personnel_selector_checker_1.PersonnelSelectorChecker.checkIsPersonnelSelector(ui, hasPersonnelSelector);
84
+ const hasOrganizationSelector = { isOrganizationSelector: false, isGridOrganizationSelector: false };
85
+ organization_selector_checker_1.OrganizationSelectorChecker.checkIsOrganizationSelector(ui, hasOrganizationSelector);
86
+ const hasEmployeeSelector = { isEmployeeSelector: false, isGridEmployeeSelector: false };
87
+ employee_selector_checker_1.EmployeeSelectorChecker.checkIsEmployeeSelector(ui, hasEmployeeSelector);
88
+ const hasAdminOrganizationSelector = { isAdminOrganizationSelector: false, isGridAdminOrganizationSelector: false };
89
+ adminorganization_selector_checker_1.AdminOrganizationSelectorChecker.checkIsAdminOrganizationSelector(ui, hasAdminOrganizationSelector);
90
+ const hasQrCode = { isQrCode: false, isGridQrCode: false };
91
+ qrcode_selector_checker_1.QrCodeChecker.checkIsQrCode(ui, hasQrCode);
92
+ const hasAppointmentCalendar = { isAppointmentCalendar: false, isGridAppointmentCalendar: false };
93
+ appointment_calendar_checker_1.AppointmentCalendarChecker.checkIsAppointmentCalendar(ui, hasAppointmentCalendar);
94
+ const hasApproveLogs = { isApprovalLogs: false };
95
+ approval_logs_check_1.ApprovalLogsCheck.checkIsApprovalLogs(ui, hasApproveLogs);
96
+ const hasOaRelation = { isOaRelation: false };
97
+ oa_relation_checker_1.OaRelationCheck.checkIsOaRelation(ui, hasOaRelation);
98
+ const hasExtIntergration = { isExtIntergration: false, isGridExtIntergration: false };
99
+ ext_intergration_checker_1.ExtIntergrationChecker.checkIsExternalIntegration(ui, hasExtIntergration);
100
+ const hasProgressStep = { isProgressStep: false };
101
+ progress_steps_checker_1.ProgressStepsChecker.check(ui, hasProgressStep);
102
+ const hasPortlet = { hasPortlet: false };
103
+ portlet_checker_1.PortletChecker.checkHasPortlet(ui, hasPortlet);
104
+ const hasAif = { hasAif: false };
105
+ aif_check_1.AifChecker.checkEnableAif(ui, hasAif);
106
+ behavior_1.BehaviorManager.checkHasComponents(ui.module, value, value.formSaveInfo);
107
+ if (ui.module.declarations && ui.module.components) {
108
+ declaration_trigger_1.DeclarationTrigger.getNewInstance().modifyComponentCommand(ui.module.declarations, ui.module.components, ui.module.toolbar, ui.module.viewmodels);
109
+ }
110
+ if (ui.module.code && __1.ToolHelper.isArray(ui.module.schemas, false) && __1.ToolHelper.isArray(ui.module.components, false)) {
111
+ this.modifyDeclarationEvents(ui, value);
112
+ const mainEntityCode = ui.module.schemas[0].entities[0].code;
113
+ eapi = this.readEapiJSONFileAndReturnFirst(ui, value, mainEntityCode);
114
+ vo = ui.module.schemas[0];
115
+ let enableStdTimeFormat = false;
116
+ if (vo.extendProperties) {
117
+ enableStdTimeFormat = __1.ToolHelper.isNullOrUndefined(vo.extendProperties.enableStdTimeFormat) ? false : vo.extendProperties.enableStdTimeFormat;
118
+ }
119
+ entities = entities_creator_1.EntitiesCreator.getSingleInstance().createEntites(vo, enableStdTimeFormat);
120
+ repository = repository_creator_1.RepositoryCreator.getNewInstance().createRepository({
121
+ mainEntityCode: mainEntityCode,
122
+ restUri: ui.module.schemas[0].sourceUri,
123
+ viewModels: ui.module.viewmodels,
124
+ eapi: eapi,
125
+ entities: vo.entities,
126
+ isGroupForm: value.isGroupForm
127
+ });
128
+ viewmodels = viewmodels_creator_1.ViewModelsCreator.getNewInstance().createViewModels({
129
+ ui: ui,
130
+ sm: sm,
131
+ cmd: cmd || {},
132
+ entity: entities,
133
+ mainEntityCode: mainEntityCode,
134
+ eapi: eapi,
135
+ parentExternalComponent: value.externalComponent,
136
+ isJointSearch: qdpJoinSearch.isJointSearch,
137
+ parentModule: value.externalComponent && value.externalComponent.parentModule ? value.externalComponent.parentModule : null,
138
+ metaDataConfig: value.inputOptions,
139
+ i18nResourcePrefix: value.i18nResourcePrefix,
140
+ externalComponentNameSpace: value.externalComponentNameSpace
141
+ });
142
+ const componentChildRoutes = component_children_routes_creator_1.ComponentChildrenRoutesCreator.getNewInstance().create(ui);
143
+ routing = routing_creator_1.RoutingCreator.createRouting({
144
+ code: ui.module.code,
145
+ componentId: ui.module.components[0].id,
146
+ componentName: __1.ToolHelper.tf(ui.module.components[0].id),
147
+ currentPageInfo: value.currentPageInfo,
148
+ componentChildrenRoutes: componentChildRoutes
149
+ });
150
+ const resourceJson = this.getFormResourceJson(value, ui);
151
+ modules = module_creator_1.ModuleCreator.getNewInstance().createModule({
152
+ code: ui.module.code,
153
+ ctrlLangs: resourceJson,
154
+ viewmodels: viewmodels,
155
+ repository: repository,
156
+ ip: value.inputOptions.ip, port: value.inputOptions.port,
157
+ serviceRefs: ui.module.serviceRefs,
158
+ commands: ui.module.webcmds,
159
+ extraImports: ui.module.extraImports,
160
+ isGroupForm: value.isGroupForm,
161
+ eapi: eapi,
162
+ isJointSearch: qdpJoinSearch.isJointSearch,
163
+ isPrimengTreeGrid: hasPrimengTreeGrid.isPrimengTreeGrid,
164
+ isCitySelector: hasCitySelector.isCitySelector,
165
+ isApprovalComments: hasApprovalComments.isApprovalComments,
166
+ isImageUpload: hasImageUpload.isImageUpload,
167
+ isPersonnelSelector: hasPersonnelSelector.isPersonnelSelector,
168
+ isGridPersonnelSelector: hasPersonnelSelector.isGridPersonnelSelector,
169
+ isOrganizationSelector: hasOrganizationSelector.isOrganizationSelector,
170
+ isGridOrganizationSelector: hasOrganizationSelector.isGridOrganizationSelector,
171
+ isEmployeeSelector: hasEmployeeSelector.isEmployeeSelector,
172
+ isGridEmployeeSelector: hasEmployeeSelector.isGridEmployeeSelector,
173
+ isQrCode: hasQrCode.isQrCode,
174
+ isGridQrCode: hasQrCode.isGridQrCode,
175
+ isAppointmentCalendar: hasAppointmentCalendar.isAppointmentCalendar,
176
+ isGridAppointmentCalendar: hasAppointmentCalendar.isGridAppointmentCalendar,
177
+ multiTextboxUseComments: hasUseComments.useComments,
178
+ isAdminOrganizationSelector: hasAdminOrganizationSelector.isAdminOrganizationSelector,
179
+ isGridAdminOrganizationSelector: hasAdminOrganizationSelector.isGridAdminOrganizationSelector,
180
+ isExtIntergration: hasExtIntergration.isExtIntergration,
181
+ isGridExtIntergration: hasExtIntergration.isGridExtIntergration,
182
+ isApprovalLogs: hasApproveLogs.isApprovalLogs,
183
+ isOaRelation: hasOaRelation.isOaRelation,
184
+ isProgressStep: hasProgressStep.isProgressStep,
185
+ isPortlet: hasPortlet.hasPortlet,
186
+ moduleReference: ui.module.moduleReference,
187
+ innerComponents: ui.module.innerComponents,
188
+ currentPageInfo: value.currentPageInfo,
189
+ beforeTemplateScript: ui.module.beforeTemplateScript,
190
+ hasAif: hasAif.hasAif
191
+ });
192
+ }
193
+ }
194
+ else {
195
+ __1.LoggerHelper.log(`form file has none module data, the form file path is ${__1.ToolHelper.pathJoinAndnormalize(value.metaFilePath, value.metaFileName + jit_constant_1.JITConstant.JsonExtension)}!`);
196
+ return;
197
+ }
198
+ if (__1.ToolHelper.isArray(ui.module.externalComponents, false)) {
199
+ const i18nResourcePrefix = value.i18nResourcePrefix;
200
+ externalComponents = external_components_creator_1.ExternalComponentsCreator.getInstance().createExternalComponents(ui.module, value.inputOptions, viewmodels, value.inputOptions.eapiPath, value.projectName, value.isExternalComponent ? true : false, value.allPages, value.qdpForm, value.metaFilePath, i18nResourcePrefix, value.formSaveInfo);
201
+ if (__1.ToolHelper.isArray(externalComponents, false)) {
202
+ externalComponents.forEach((item) => {
203
+ if (item.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType && item.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl) {
204
+ }
205
+ else {
206
+ const externalComponentModule = this.getExternalComponentModulePath(item);
207
+ if (externalComponentModule) {
208
+ modules.dependencies.push(externalComponentModule.dependency);
209
+ modules.imports.push(externalComponentModule.import);
210
+ }
211
+ }
212
+ });
213
+ }
214
+ }
215
+ viewmodels.forEach((viewModelItem) => {
216
+ const externalContainerParameters = viewModelItem["component"] ? viewModelItem["component"]["externalContainerParameters"] : [];
217
+ if (__1.ToolHelper.isArray(externalContainerParameters, false)) {
218
+ externalContainerParameters.forEach((externalContainerParameter) => {
219
+ const externalComponentId = externalContainerParameter.id;
220
+ const externalComponentCode = externalContainerParameter.code;
221
+ if (externalContainerParameter.declarations && __1.ToolHelper.isArray(externalContainerParameter.declarations.events, false)) {
222
+ externalContainerParameter.declarations.events.forEach((externalContainerEvent) => {
223
+ const externalContainerEventCode = externalContainerEvent.code;
224
+ viewmodels.forEach((childViewModel) => {
225
+ const childComponentSubscriptions = childViewModel["component"] ? childViewModel["component"]["componentSubscriptions"] : [];
226
+ if (__1.ToolHelper.isArray(childComponentSubscriptions, false)) {
227
+ childComponentSubscriptions.forEach((childComponentSubscription) => {
228
+ if (childComponentSubscription.sourceComponent == externalComponentId && childComponentSubscription.subscribeOn == externalContainerEventCode) {
229
+ if (__1.ToolHelper.isNullOrUndefined(childComponentSubscription.token) == true) {
230
+ childComponentSubscription.token = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
231
+ }
232
+ externalContainerEvent.token = childComponentSubscription.token;
233
+ }
234
+ });
235
+ }
236
+ });
237
+ if (__1.ToolHelper.isArray(externalComponents, false)) {
238
+ externalComponents.forEach((externalComponentItem) => {
239
+ const metadataDevkit = externalComponentItem["metaDataDevkit"] ? externalComponentItem["metaDataDevkit"]["devkit"] : {};
240
+ const externalViewModels = metadataDevkit["viewmodels"];
241
+ if (__1.ToolHelper.isArray(externalViewModels, false)) {
242
+ externalViewModels.forEach((externalViewModelItem) => {
243
+ const externalComponentSubscriptions = externalViewModelItem["component"] ? externalViewModelItem["component"]["componentSubscriptions"] : [];
244
+ if (__1.ToolHelper.isArray(externalComponentSubscriptions, false)) {
245
+ const findExternalComponentSubscription = externalComponentSubscriptions.find((externalComponentSubscriptionItem) => {
246
+ return externalComponentSubscriptionItem.sourceComponent == externalComponentId && externalComponentSubscriptionItem.subscribeOn == externalContainerEventCode;
247
+ });
248
+ if (findExternalComponentSubscription) {
249
+ let externalComponentToken = findExternalComponentSubscription.token ? findExternalComponentSubscription.token : externalContainerEvent.token;
250
+ if (!externalComponentToken) {
251
+ externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(externalComponentCode, findExternalComponentSubscription.targetComponent, "-");
252
+ }
253
+ findExternalComponentSubscription.token = externalContainerEvent.token = externalComponentToken;
254
+ }
255
+ }
256
+ });
257
+ }
258
+ });
259
+ }
260
+ externalContainerParameters.forEach((exParameter) => {
261
+ if (__1.ToolHelper.isArray(exParameter.subscriptions, false)) {
262
+ exParameter.subscriptions.forEach((subscriptionParameter) => {
263
+ const subscriptionSourceComponent = subscriptionParameter["sourceComponent"];
264
+ const subscriptionOn = subscriptionParameter["subscribeOn"];
265
+ if (externalComponentId == subscriptionSourceComponent && externalContainerEventCode == subscriptionOn) {
266
+ let externalComponentToken = externalContainerEvent.token ? externalContainerEvent.token : subscriptionParameter.token;
267
+ if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
268
+ externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(externalComponentCode, subscriptionParameter["targetComponent"], "-");
269
+ }
270
+ externalContainerEvent.token = subscriptionParameter.token = externalComponentToken;
271
+ }
272
+ });
273
+ }
274
+ });
275
+ });
276
+ }
277
+ if (__1.ToolHelper.isArray(externalContainerParameter.subscriptions, false)) {
278
+ externalContainerParameter.subscriptions.forEach((subscriptionItem) => {
279
+ if (ui.module.declarations && __1.ToolHelper.isArray(ui.module.declarations.events, false)) {
280
+ const findDeclarationEvent = ui.module.declarations.events.find((declarationEventItem) => {
281
+ return declarationEventItem["code"] == subscriptionItem["subscribeOn"] && ui.module.code == subscriptionItem["sourceComponent"];
282
+ });
283
+ if (findDeclarationEvent) {
284
+ let externalComponentToken = findDeclarationEvent.token ? findDeclarationEvent.token : subscriptionItem.token;
285
+ if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
286
+ externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
287
+ }
288
+ findDeclarationEvent.token = subscriptionItem.token = externalComponentToken;
289
+ }
290
+ }
291
+ externalContainerParameters.forEach((exParameter) => {
292
+ if (exParameter.declarations && __1.ToolHelper.isArray(exParameter.declarations.events, false)) {
293
+ exParameter.declarations.events.forEach((declarationEventParameter) => {
294
+ const findDeclarationEvent = exParameter.declarations.events.find((declarationEventItem) => {
295
+ return declarationEventParameter["code"] == subscriptionItem["subscribeOn"] && exParameter.code == subscriptionItem["sourceComponent"];
296
+ });
297
+ if (findDeclarationEvent) {
298
+ let externalComponentToken = findDeclarationEvent.token ? findDeclarationEvent.token : subscriptionItem.token;
299
+ if (__1.ToolHelper.isNullOrUndefined(externalComponentToken)) {
300
+ externalComponentToken = event_token_generator_1.EventTokenGenerator.generateToken(ui.module.code, externalComponentCode, "-");
301
+ }
302
+ findDeclarationEvent.token = subscriptionItem.token = externalComponentToken;
303
+ }
304
+ });
305
+ }
306
+ });
307
+ });
308
+ }
309
+ });
310
+ }
311
+ });
312
+ const enableDynamicForm = value.inputOptions.isEnableDynamicForm && __1.ToolHelper.convertStringToBoolean(((_a = ui.options) === null || _a === void 0 ? void 0 : _a.renderMode) === 'dynamic', false);
313
+ const enableDeleteSourceCode = __1.ToolHelper.convertStringToBoolean((_b = ui.options) === null || _b === void 0 ? void 0 : _b.enableDeleteSourceCode, false);
314
+ const changeSetPolicy = (_c = ui.options) === null || _c === void 0 ? void 0 : _c.changeSetPolicy;
315
+ const enableServerSideChangeDetection = __1.ToolHelper.convertStringToBoolean((_d = ui.options) === null || _d === void 0 ? void 0 : _d.enableServerSideChangeDetection, false);
316
+ const enableAif = __1.ToolHelper.convertStringToBoolean((_e = ui.options) === null || _e === void 0 ? void 0 : _e.enableAif, false);
317
+ let pushMode = '';
318
+ if (ui.options && ui.options.formRulePushMode) {
319
+ pushMode = ui.options.formRulePushMode;
320
+ }
321
+ return {
322
+ devkit: {
323
+ entities: entities,
324
+ repository: repository,
325
+ viewmodels: viewmodels,
326
+ module: modules,
327
+ routing: routing,
328
+ eapi: eapi,
329
+ externalComponents: externalComponents,
330
+ declarations: ui.module.declarations || {},
331
+ projectName: value.projectName,
332
+ moduleReference: ui.module.moduleReference,
333
+ innerComponents: ui.module.innerComponents,
334
+ enableDynamicForm: enableDynamicForm,
335
+ isApproveFormat: (_f = value.currentPageInfo) === null || _f === void 0 ? void 0 : _f.isApproveFormat,
336
+ formCode: (_g = value.currentPageInfo) === null || _g === void 0 ? void 0 : _g.code,
337
+ enableDeleteSourceCode: enableDeleteSourceCode,
338
+ enableServerSideChangeDetection: enableServerSideChangeDetection,
339
+ changeSetPolicy: changeSetPolicy,
340
+ enableAif: enableAif,
341
+ pushMode: pushMode
342
+ }
343
+ };
344
+ }
345
+ getFormResourceJson(value, ui) {
346
+ if (value.inputOptions.useI18nResource == false) {
347
+ return { "zh-CHS": [] };
348
+ }
349
+ let resourceJson = form_resource_json_reader_1.FormResourceJsonReader.read(value.metaFileName, value.metaFilePath);
350
+ if (!resourceJson) {
351
+ if (ui.module.ctrlLangs) {
352
+ const ctrlLangs = ui.module.ctrlLangs;
353
+ ctrlLangs["zh-CHS"] = ctrlLangs["ch"];
354
+ resourceJson = ctrlLangs;
355
+ }
356
+ else {
357
+ resourceJson = { "zh-CHS": [] };
358
+ }
359
+ }
360
+ return resourceJson;
361
+ }
362
+ modifyDeclarationEvents(ui, value) {
363
+ if (ui.module.declarations) {
364
+ const externalParentModule = value.externalComponent ? value.externalComponent.parentModule : null;
365
+ const parentDeclarations = externalParentModule ? externalParentModule.declarations : null;
366
+ if (!externalParentModule) {
367
+ declarationevents_modifier_1.DeclarationEventsModifier.modifyDeclarationEvents(ui.module.declarations, null, ui.module, parentDeclarations);
368
+ }
369
+ else {
370
+ declarationevents_modifier_1.DeclarationEventsModifier.modifyDeclarationEvents(ui.module.declarations, externalParentModule, value.externalComponent, parentDeclarations);
371
+ }
372
+ }
373
+ }
374
+ getExternalComponentModulePath(externalComponent) {
375
+ if (!externalComponent || (externalComponent.type == external_component_1.ExternalComponentConstant.ExternalModalContainerType && externalComponent.contentType == external_component_1.ExternalComponentConstant.ExternalModalContainerContentTypeUrl)) {
376
+ return;
377
+ }
378
+ if (!externalComponent.metaDataDevkit) {
379
+ __1.LoggerHelper.log(`external component has none value,the external form is :${externalComponent.code}, external component id is ${externalComponent.id}`);
380
+ return;
381
+ }
382
+ else {
383
+ const externalComponentUniqueCode = __1.ToolHelper.addPrefixWhenFirstNumber(externalComponent.containerId ? externalComponent.containerId : externalComponent.code);
384
+ const externalComponentModulePath = "./" + external_component_1.ExternalComponentConstant.DefaultExternalComponentFirstPath + "/" + externalComponentUniqueCode.toLowerCase() + "/" + externalComponent.metaDataDevkit.devkit.module.code.toLowerCase() + "/" + externalComponent.metaDataDevkit.devkit.module.code.toLowerCase() + ".module";
385
+ const externalComponentPrefix = __1.ToolHelper.tf(`${externalComponentUniqueCode.toLowerCase()}${externalComponent.metaDataDevkit.devkit.module.code.toLowerCase()}`);
386
+ const usePrefix = externalComponent.parentIsExternal ? false : true;
387
+ return {
388
+ "dependency": {
389
+ name: `${externalComponentPrefix}${externalComponent.metaDataDevkit.devkit.module.code}Module`,
390
+ path: externalComponentModulePath,
391
+ usePrefix: usePrefix
392
+ },
393
+ "import": { "name": `${externalComponentPrefix + externalComponent.metaDataDevkit.devkit.module.code}Module` }
394
+ };
395
+ }
396
+ }
397
+ readEapiJSONFileAndReturnFirst(ui, value, mainEntityCode) {
398
+ const eapiFileName = ui.module.schemas[0].eapiFileName ? ui.module.schemas[0].eapiFileName : value.metaFileName;
399
+ const arrEapi = file_operation_1.FileOperationManager.read(value.metaFilePath, value.metaFileName, file_operation_1.FileOperationType.Eapi);
400
+ if (arrEapi && __1.ToolHelper.isArray(arrEapi, false)) {
401
+ const eapi = arrEapi[0];
402
+ eapi.name = mainEntityCode;
403
+ eapi.proxyName = devkit_object_name_creator_1.DevkitObjectNameCreator.getDevkitObjectNameWithType("befProxy", __1.ToolHelper.tf(mainEntityCode));
404
+ eapi.restUri = ui.module.schemas[0].sourceUri;
405
+ if (eapi.Service && !eapi.Content) {
406
+ eapi.Content = {};
407
+ eapi.Content.Service = eapi.Service;
408
+ }
409
+ return eapi;
410
+ }
411
+ else {
412
+ __1.LoggerHelper.log(`the form:${value.metaFileName} has none eapi file: ${eapiFileName} or has no data!`, __1.LoggerLevel.Warning);
413
+ }
414
+ }
415
+ dealRouteForm(ui, isRouteForm) {
416
+ if (ui.module.viewmodels && ui.module.viewmodels.length > 0) {
417
+ ui.module.viewmodels.forEach((viewModel) => {
418
+ viewModel['jit_isRouteForm'] = isRouteForm;
419
+ });
420
+ }
421
+ ui['jit_isRouteForm'] = isRouteForm;
422
+ }
423
+ }
424
+ exports.FormFileExecutor = FormFileExecutor;
425
+ FormFileExecutor.instance = new FormFileExecutor();
417
426
  //# sourceMappingURL=form-file-executor.js.map