UNPKG

@netgrif/components

Version:

Netgrif Application Engine frontend Angular components

54 lines 3.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createCaseView = void 0; const schematics_1 = require("@angular-devkit/schematics"); const core_1 = require("@angular-devkit/core"); const utility_functions_1 = require("../../../../_utility/utility-functions"); const view_utility_functions_1 = require("../../../_utility/view-utility-functions"); const view_service_functions_1 = require("../../../_utility/view-service-functions"); const view_class_info_1 = require("../../../../_commons/view-class-info"); const import_to_add_1 = require("../../../../_commons/import-to-add"); function createCaseView(tree, args, addViewToService) { var _a, _b; const projectInfo = (0, utility_functions_1.getProjectInfo)(tree); const view = new view_class_info_1.ViewClassInfo(args.path, args.viewType, args.componentName); const rules = []; const destinationPath = `${projectInfo.path}/views/${args.path}`; const templateParams = { prefix: projectInfo.projectPrefixDasherized, className: view.nameWithoutComponent, viewPath: !!args.isTabbed ? args.path.split('/')[0] : args.path, dasherize: core_1.strings.dasherize, classify: core_1.strings.classify, configName: projectInfo.projectNameClassified, configImportPath: (0, utility_functions_1.createRelativePath)(view.fileImportPath, `./${projectInfo.projectNameDasherized}-configuration.service`), caseCreationConfig: { enableCaseTitle: (_a = args.enableCaseTitle) !== null && _a !== void 0 ? _a : true, isCaseTitleRequired: (_b = args.isCaseTitleRequired) !== null && _b !== void 0 ? _b : false } }; const commonPathPrefix = './views/case-view/files/'; rules.push((0, utility_functions_1.createFilesFromTemplates)(`${commonPathPrefix}common`, destinationPath, templateParams)); if (!!args.isTabbed) { rules.push((0, utility_functions_1.createFilesFromTemplates)(`${commonPathPrefix}tabbed`, destinationPath, templateParams)); } else { Object.assign(templateParams, { viewIdSegment: (0, view_utility_functions_1.getViewIdSegmentFromPath)(args.path) }); rules.push((0, utility_functions_1.createFilesFromTemplates)(`${commonPathPrefix}simple`, destinationPath, templateParams)); } (0, view_utility_functions_1.updateAppModule)(tree, view.className, view.fileImportPath, [ new import_to_add_1.ImportToAdd('FlexModule', '@ngbracket/ngx-layout'), new import_to_add_1.ImportToAdd('FlexLayoutModule', '@ngbracket/ngx-layout'), new import_to_add_1.ImportToAdd('MaterialModule', '@netgrif/components-core'), new import_to_add_1.ImportToAdd('HeaderComponentModule', '@netgrif/components'), new import_to_add_1.ImportToAdd('PanelComponentModule', '@netgrif/components'), new import_to_add_1.ImportToAdd('CaseViewComponentModule', '@netgrif/components'), new import_to_add_1.ImportToAdd('SearchComponentModule', '@netgrif/components') ]); if (addViewToService) { (0, view_service_functions_1.addViewToViewService)(tree, view); } return (0, schematics_1.chain)(rules); } exports.createCaseView = createCaseView; //# sourceMappingURL=create-case-view.js.map