@farris/jit-engine 1.4.103 → 1.4.104

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