@kontur.candy/generator 5.29.0 → 5.30.0-calc2-args-changed.2

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 (2) hide show
  1. package/dist/index.js +1941 -1864
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75350,85 +75350,6 @@ function validateAutoCalculationsAst(ast) {
75350
75350
 
75351
75351
  /***/ }),
75352
75352
 
75353
- /***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts":
75354
- /*!*********************************************************************************************************************************************!*\
75355
- !*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts ***!
75356
- \*********************************************************************************************************************************************/
75357
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
75358
-
75359
- "use strict";
75360
- __webpack_require__.r(__webpack_exports__);
75361
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
75362
- /* harmony export */ AutoCalculationsCalculator2Generator: () => (/* binding */ AutoCalculationsCalculator2Generator)
75363
- /* harmony export */ });
75364
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
75365
- /* harmony import */ var _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../KCXmlGenerator/KCXmlGeneratorBase */ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts");
75366
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
75367
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../../Common/Errors */ "./Common/Errors.ts");
75368
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
75369
-
75370
-
75371
-
75372
-
75373
-
75374
- class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.KCXmlGeneratorBase {
75375
- constructor(schema, dataDeclarationHelper) {
75376
- super(schema);
75377
- this.dataDeclarationHelper = void 0;
75378
- this.dataDeclarationHelper = dataDeclarationHelper;
75379
- }
75380
- generate(formulas, options) {
75381
- var _ref;
75382
- const compiledFormulas = (_ref = formulas !== null && formulas !== void 0 ? formulas : []) === null || _ref === void 0 ? void 0 : _ref.map(x => this.compileFormula(x, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined);
75383
- const compiledAggregationFunctions = this.compileAggregationDependencies(compiledFormulas.map(x => x.dependencies).flat());
75384
- const indent = " ";
75385
- const allItemsText = compiledFormulas.map(x => x.compiledFunction).concat(compiledAggregationFunctions).map(x => `${indent}form.calculator2.addCalculationFunction(${x});`).join("\n");
75386
- const finalText = allItemsText.length > 0 ? `\n${allItemsText}\n` : "";
75387
- const result = `export default function kcXmlAutoCalculationConfigurator (
75388
- { form, ap, CalculationFunction , KCCalculation, KCSumCalculation, KCCountCalculation, PathTokens }) {${finalText}}`;
75389
- return result;
75390
- }
75391
- compileAllItemsIsEmptyCheckBlock(innerExpression, deps) {
75392
- if (deps.length === 0) {
75393
- return innerExpression;
75394
- }
75395
- const compiledArgumentsCondition = deps.map(x => x.toLegacyPath()).map(x => `(expression.argument("${x}") === "" || expression.argument("${x}") == undefined)`).join(" && ");
75396
- const compiledBlock = `(${compiledArgumentsCondition} ? undefined : ${innerExpression})`;
75397
- return compiledBlock;
75398
- }
75399
- compileFormula(formula, options) {
75400
- const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(formula.match), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
75401
- const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(formula.target), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
75402
- const dependencies = [];
75403
- const compiledExpression = this.compileExpressionWithUnsupportedHandled(prefix, target, formula.expression, dependencies);
75404
- if (compiledExpression instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_3__.NotSupportedError) {
75405
- if (options.skipNotSupportedFunction) {
75406
- return undefined;
75407
- } else {
75408
- throw compiledExpression;
75409
- }
75410
- }
75411
- const defaultValue = this.dataDeclarationHelper.getDefaultValue(target.toLegacyPath());
75412
- const autoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(target.toLegacyPath());
75413
- const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
75414
- const compiledTarget = this.modelPathInstance(target);
75415
- const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(dependencies.map(x => ({
75416
- path: x.asDependencyModelPath(),
75417
- isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x),
75418
- pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
75419
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
75420
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
75421
- const compiledExpressionWithCheck = this.compileAllItemsIsEmptyCheckBlock(compiledExpression, dependencyModelPaths.filter(x => !x.isIgnoreForChecks).map(x => x.path));
75422
- const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpressionWithCheck}, "${defaultValue}")`;
75423
- return {
75424
- compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled})`,
75425
- dependencies: dependencies
75426
- };
75427
- }
75428
- }
75429
-
75430
- /***/ }),
75431
-
75432
75353
  /***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/FormulaProcessing/DataPath.ts":
75433
75354
  /*!***********************************************************************************************************************!*\
75434
75355
  !*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/FormulaProcessing/DataPath.ts ***!
@@ -77682,419 +77603,747 @@ function getObjectPropertyName(property) {
77682
77603
 
77683
77604
  /***/ }),
77684
77605
 
77685
- /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts":
77606
+ /***/ "./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts":
77686
77607
  /*!***********************************************************************************************!*\
77687
- !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts ***!
77608
+ !*** ./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts ***!
77688
77609
  \***********************************************************************************************/
77689
77610
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77690
77611
 
77691
77612
  "use strict";
77692
77613
  __webpack_require__.r(__webpack_exports__);
77693
77614
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77694
- /* harmony export */ DataDeclarationGenerationContext: () => (/* binding */ DataDeclarationGenerationContext),
77695
- /* harmony export */ emptyDataDeclarationCollection: () => (/* binding */ emptyDataDeclarationCollection)
77615
+ /* harmony export */ AutoCalculationsCalculator2Generator: () => (/* binding */ AutoCalculationsCalculator2Generator)
77696
77616
  /* harmony export */ });
77697
- /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash.mergewith */ "./node_modules/lodash.mergewith/index.js");
77698
- /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__);
77699
- /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.uniqwith */ "./node_modules/lodash.uniqwith/index.js");
77700
- /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__);
77701
- /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
77702
- /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
77703
- /* harmony import */ var _Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/CommonConstants/SectionNames */ "./Common/CommonConstants/SectionNames.ts");
77704
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77705
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77706
- /* harmony import */ var _markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
77707
- /* harmony import */ var _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/ElementProcessors/FormParts/Page/PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
77708
- /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
77617
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77618
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
77619
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
77620
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77621
+ /* harmony import */ var _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FormulaToCalculator2FunctionConverter */ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts");
77709
77622
 
77710
77623
 
77711
77624
 
77712
77625
 
77713
77626
 
77627
+ class AutoCalculationsCalculator2Generator {
77628
+ constructor(schema, dataDeclarationHelper) {
77629
+ this.dataDeclarationHelper = void 0;
77630
+ this.schema = void 0;
77631
+ this.converter = void 0;
77632
+ this.schema = schema;
77633
+ this.dataDeclarationHelper = dataDeclarationHelper;
77634
+ this.converter = new _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.FormulaToCalculator2FunctionConverter(schema);
77635
+ }
77636
+ generate(formulas, options) {
77637
+ var _ref;
77638
+ const compiledFormulas = (_ref = formulas !== null && formulas !== void 0 ? formulas : []) === null || _ref === void 0 ? void 0 : _ref.map(x => this.compileFormula(x, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrUndefined);
77639
+ const compiledAggregationFunctions = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.compileAggregationDependencies)(compiledFormulas.map(x => x.dependencies).flat());
77640
+ const indent = " ";
77641
+ const allItemsText = compiledFormulas.map(x => x.compiledFunction).concat(compiledAggregationFunctions).map(x => `${indent}form.calculator2.addCalculationFunction(${x});`).join("\n");
77642
+ const finalText = allItemsText.length > 0 ? `\n${allItemsText}\n` : "";
77643
+ const result = `export default function kcXmlAutoCalculationConfigurator (
77644
+ { form, ap, CalculationFunction , KCCalculation, KCSumCalculation, KCCountCalculation, PathTokens }) {${finalText}}`;
77645
+ return result;
77646
+ }
77647
+ compileFormula(formula, options) {
77648
+ const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.removeAttributePrefix)(formula.match), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
77649
+ const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.removeAttributePrefix)(formula.target), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77650
+ const compileResult = this.converter.compileExpressionWithUnsupportedHandled(prefix, target, formula.expression);
77651
+ if (compileResult instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.NotSupportedError) {
77652
+ if (options.skipNotSupportedFunction) {
77653
+ return undefined;
77654
+ } else {
77655
+ throw compileResult;
77656
+ }
77657
+ }
77658
+ const {
77659
+ body: compiledExpression,
77660
+ deps: dependencies
77661
+ } = compileResult;
77662
+ const defaultValue = this.dataDeclarationHelper.getDefaultValue(target.toLegacyPath());
77663
+ const autoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(target.toLegacyPath());
77664
+ const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
77665
+ const compiledTarget = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.modelPathInstance)(target);
77666
+ const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(dependencies.map(x => ({
77667
+ path: x.asDependencyModelPath(),
77668
+ isIgnoreForChecks: (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.isDependencyWithoutChecks)(x),
77669
+ pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
77670
+ })).filter(x => !x.path.isEquals(target)), x => x.pathString));
77671
+ const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.modelPathInstance)(x)).join(", ");
77672
+ const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpression}, "${defaultValue}")`;
77673
+ return {
77674
+ compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled})`,
77675
+ dependencies: dependencies
77676
+ };
77677
+ }
77678
+ }
77714
77679
 
77680
+ /***/ }),
77715
77681
 
77682
+ /***/ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts":
77683
+ /*!************************************************************************************************!*\
77684
+ !*** ./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts ***!
77685
+ \************************************************************************************************/
77686
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77716
77687
 
77688
+ "use strict";
77689
+ __webpack_require__.r(__webpack_exports__);
77690
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77691
+ /* harmony export */ AggregationDependencyModelPath: () => (/* binding */ AggregationDependencyModelPath),
77692
+ /* harmony export */ DependencyWithoutChecks: () => (/* binding */ DependencyWithoutChecks),
77693
+ /* harmony export */ FormulaToCalculator2FunctionConverter: () => (/* binding */ FormulaToCalculator2FunctionConverter),
77694
+ /* harmony export */ RegularDependency: () => (/* binding */ RegularDependency),
77695
+ /* harmony export */ compileAggregationDependencies: () => (/* binding */ compileAggregationDependencies),
77696
+ /* harmony export */ createDependency: () => (/* binding */ createDependency),
77697
+ /* harmony export */ getAggregationPaths: () => (/* binding */ getAggregationPaths),
77698
+ /* harmony export */ getAggregationPathsRecursively: () => (/* binding */ getAggregationPathsRecursively),
77699
+ /* harmony export */ getArgumentDeps: () => (/* binding */ getArgumentDeps),
77700
+ /* harmony export */ getCompiledFuncWithArgs: () => (/* binding */ getCompiledFuncWithArgs),
77701
+ /* harmony export */ getRuntimeFunctionName: () => (/* binding */ getRuntimeFunctionName),
77702
+ /* harmony export */ isAggregationDependencyModelPath: () => (/* binding */ isAggregationDependencyModelPath),
77703
+ /* harmony export */ isDependencyWithoutChecks: () => (/* binding */ isDependencyWithoutChecks),
77704
+ /* harmony export */ modelPathInstance: () => (/* binding */ modelPathInstance),
77705
+ /* harmony export */ removeAttributePrefix: () => (/* binding */ removeAttributePrefix),
77706
+ /* harmony export */ removeMultiplicity: () => (/* binding */ removeMultiplicity)
77707
+ /* harmony export */ });
77708
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77709
+ /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
77710
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77711
+ /* harmony import */ var _markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/ComponentMarkupBuilder/PathHelper */ "./Generator/src/generators/markupGenerator/ComponentMarkupBuilder/PathHelper.ts");
77712
+ /* harmony import */ var _Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/PathSplitHelper */ "./Common/ModelPath/PathSplitHelper.ts");
77713
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
77714
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
77717
77715
 
77718
77716
 
77719
- var RequisiteSectionMode = /*#__PURE__*/function (RequisiteSectionMode) {
77720
- RequisiteSectionMode[RequisiteSectionMode["AsRequisiteAttribute"] = 0] = "AsRequisiteAttribute";
77721
- RequisiteSectionMode[RequisiteSectionMode["ForceAdd"] = 1] = "ForceAdd";
77722
- RequisiteSectionMode[RequisiteSectionMode["ForceSkip"] = 2] = "ForceSkip";
77723
- return RequisiteSectionMode;
77724
- }(RequisiteSectionMode || {});
77725
- const emptyDataDeclarationCollection = {};
77726
- class DataDeclarationGenerationContext {
77727
- constructor(initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
77728
- this.initSequenceFactory = void 0;
77729
- this.formSchemaRng = void 0;
77730
- this.schemeValidations = void 0;
77731
- this.controlCustomizationContext = void 0;
77732
- this.typesRegistry = void 0;
77733
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
77734
- this.declarationCustomizer = (objValue, srcValue, key) => {
77735
- // Вся эта функция не типизируется
77736
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
77737
- if (key === "section") {
77738
- const result = lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default()([].concat(...(objValue !== null && objValue !== void 0 ? objValue : []), ...srcValue), (a, b) => {
77739
- if (typeof a === "object" && typeof b === "object") {
77740
- // @ts-ignore см. выше.
77741
- return a.fn === b.fn;
77742
- }
77743
- return a === b;
77744
- });
77745
77717
 
77746
- // @ts-ignore см. выше.
77747
- if (result[0].fn) {
77748
- return result;
77749
- }
77750
- return [result];
77751
- }
77752
- /* eslint-enable @typescript-eslint/no-unsafe-argument */
77753
- return undefined;
77754
- };
77755
- this.formSchemaRng = formSchemaRng;
77756
- this.schemeValidations = schemeValidations;
77757
- this.initSequenceFactory = initSequenceFactory;
77758
- this.controlCustomizationContext = controlCustomizationContext;
77759
- this.typesRegistry = typesRegistry;
77718
+
77719
+
77720
+
77721
+
77722
+ class RegularDependency {
77723
+ constructor(currentDependencyPath, eachDependencyPath) {
77724
+ this.currentDependencyPath = void 0;
77725
+ this.eachDependencyPath = void 0;
77726
+ this.eachDependencyPath = eachDependencyPath;
77727
+ this.currentDependencyPath = currentDependencyPath;
77760
77728
  }
77761
- isMultipleNodeOptionalFromScheme(path) {
77762
- if (!this.schemeValidations) {
77763
- return undefined;
77764
- }
77765
- const schemaNode = this.formSchemaRng.getElementByPath(path);
77766
- if (schemaNode instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__.FormSchemaRngElement) {
77767
- var _schemaNode$isOptiona;
77768
- return (_schemaNode$isOptiona = schemaNode.isOptionalOrNillable()) !== null && _schemaNode$isOptiona !== void 0 ? _schemaNode$isOptiona : false;
77769
- }
77770
- return undefined;
77729
+ asDependencyModelPath() {
77730
+ const currentPart = this.currentDependencyPath.toCurrentIteration();
77731
+ return this.eachDependencyPath != undefined ? currentPart.joinWith(this.eachDependencyPath) : currentPart;
77771
77732
  }
77772
- getTypeNode(node) {
77773
- if (node.anonymousType != undefined) {
77774
- return node.anonymousType;
77775
- }
77776
- if (node.type != undefined) {
77777
- return this.typesRegistry.getByName(node.type);
77778
- }
77779
- return undefined;
77733
+ }
77734
+ class AggregationDependencyModelPath {
77735
+ constructor(type, modelPath, prefixModelPath, restModelPath) {
77736
+ this.type = void 0;
77737
+ this.modelPath = void 0;
77738
+ this.prefixModelPath = void 0;
77739
+ this.restModelPath = void 0;
77740
+ this.type = type;
77741
+ this.modelPath = modelPath;
77742
+ this.prefixModelPath = prefixModelPath;
77743
+ this.restModelPath = restModelPath;
77780
77744
  }
77781
- addTypeNode(node) {
77782
- var _this$formSchemaRng$g;
77783
- const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
77784
- return baseType ? {
77785
- type: baseType
77786
- } : {};
77745
+ asDependencyModelPath() {
77746
+ return this.modelPath.toCurrentIteration();
77787
77747
  }
77788
- processChildrenDataDeclaration(children, nodeProcessor) {
77789
- const childrenDataDeclaration = [];
77790
- for (const child of children) {
77791
- childrenDataDeclaration.push(this.buildNodeDataDeclaration(child, this.initSequenceFactory, nodeProcessor));
77792
- }
77793
- return this.mergeDataDeclaration(...childrenDataDeclaration);
77748
+ }
77749
+ class DependencyWithoutChecks extends RegularDependency {}
77750
+ function isAggregationDependencyModelPath(path) {
77751
+ return path instanceof AggregationDependencyModelPath;
77752
+ }
77753
+ function isDependencyWithoutChecks(path) {
77754
+ return path instanceof DependencyWithoutChecks;
77755
+ }
77756
+ function getArgumentDeps(targetFullPath, selectFullPath, aggregationType) {
77757
+ const pathDiffInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetFullPath, selectFullPath);
77758
+ const restPath = pathDiffInfo.differentPath;
77759
+ return !restPath.isContainIteration() ? new RegularDependency(selectFullPath) : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
77760
+ }
77761
+ function getRuntimeFunctionName(functionSelector) {
77762
+ return (0,_markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__.extractPath)(functionSelector.toString());
77763
+ }
77764
+ function getCompiledFuncWithArgs(functionSelector, args) {
77765
+ const funcName = getRuntimeFunctionName(functionSelector);
77766
+ const funcParams = args.join(", ");
77767
+ return `expression.${funcName}(${funcParams})`;
77768
+ }
77769
+ function getAggregationPathsRecursively(currentParts, restParts) {
77770
+ if (restParts.length === 0) {
77771
+ return [];
77794
77772
  }
77795
- addVisibilityPathDeclEntryNew(node, requisite) {
77796
- var _node$parent;
77797
- if (node.visibilityPath == undefined || node.visibilityPath === "") {
77798
- return {};
77773
+ const firstRestItem = restParts[1];
77774
+ const nextRestParts = restParts.slice(2);
77775
+ const nextCurrentParts = [...currentParts, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each, firstRestItem];
77776
+ const restWithoutMultiple = nextRestParts.filter(x => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x));
77777
+ const result = {
77778
+ aggregationPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...currentParts, firstRestItem, ...restWithoutMultiple),
77779
+ targetPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...nextCurrentParts, ...restWithoutMultiple),
77780
+ isTargetFinal: restWithoutMultiple.length === 0
77781
+ };
77782
+ const nextResults = getAggregationPathsRecursively(nextCurrentParts, nextRestParts);
77783
+ return [result, ...nextResults];
77784
+ }
77785
+
77786
+ // Example: Root/B/*/C/D/*/E = Root/B/C/D/E/Sum -> Root/B/*/C/D/E/Sum -> Root/B/*/C/D/*/E
77787
+ function getAggregationPaths(relativePath) {
77788
+ const splittedPath = [...relativePath.splitByMultiplicity()];
77789
+ return getAggregationPathsRecursively([splittedPath[0]], splittedPath.slice(1));
77790
+ }
77791
+ function createDependency(prefixModelPath, x, aggregationType) {
77792
+ return {
77793
+ aggPath: prefixModelPath.joinWith(x.aggregationPath).joinWith(aggregationType),
77794
+ type: aggregationType,
77795
+ dependencyPath: x.isTargetFinal ? prefixModelPath.joinWith(x.targetPath) : prefixModelPath.joinWith(x.targetPath).joinWith(aggregationType),
77796
+ isDependencyAggregation: !x.isTargetFinal
77797
+ };
77798
+ }
77799
+ function compileAggregationDependencies(dependencies) {
77800
+ const resultItems = dependencies.filter(isAggregationDependencyModelPath).map(dep => getAggregationPaths(dep.restModelPath).map(x => {
77801
+ switch (dep.type) {
77802
+ case "Sum":
77803
+ return [createDependency(dep.prefixModelPath, x, "Sum"), createDependency(dep.prefixModelPath, x, "Count")];
77804
+ case "Count":
77805
+ return [createDependency(dep.prefixModelPath, x, "Count")];
77806
+ default:
77807
+ {
77808
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureNever)(dep.type);
77809
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Not supported aggregation dependency: ${dep.type}`);
77810
+ }
77811
+ }
77812
+ })).flat(2);
77813
+ const distinctiveItems = Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__.IterUtils.distinctBy(resultItems, x => x.aggPath.toLegacyPath()));
77814
+ const sumCompiledFunctions = distinctiveItems.map(x => {
77815
+ const compiledDep = modelPathInstance(x.dependencyPath.toCurrentIteration());
77816
+ const compiledAggPath = modelPathInstance(x.aggPath);
77817
+ const compiledCountPath = modelPathInstance(x.aggPath.getParentPath().joinWith("Count").toCurrentIteration());
77818
+ const compiledDelegate = x.type === "Sum" ? `context => KCSumCalculation.execute(context, ${compiledAggPath},${compiledDep}, ${compiledCountPath}, "")` : x.type === "Count" ? `context => KCCountCalculation.execute(context, ${compiledAggPath}, ${compiledDep}, ${x.isDependencyAggregation}, "")` : "";
77819
+ const compiledDeps = [compiledDep, ...(x.type === "Sum" ? [compiledCountPath] : [])].join(", ");
77820
+ return `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
77821
+ });
77822
+ return [...sumCompiledFunctions];
77823
+ }
77824
+ function removeAttributePrefix(pathPart) {
77825
+ return pathPart.replace(/\@/g, "");
77826
+ }
77827
+ function removeMultiplicity(path) {
77828
+ return path.replace(/\/\*/g, "");
77829
+ }
77830
+ function modelPathInstance(target) {
77831
+ return `ap([${[...target.getPathParts()].map(x => {
77832
+ if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each) {
77833
+ return "PathTokens.each";
77799
77834
  }
77800
- const declEntry = {};
77801
- const nodePath = ((_node$parent = node.parent) !== null && _node$parent !== void 0 ? _node$parent : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)()).getFullPathForChildren().joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.createFromMask)(node.visibilityPath, "auto", _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.PathTokens.each));
77802
- declEntry.section = this.getSections(node, requisite);
77803
- return {
77804
- [nodePath.normalize().toLegacyPath()]: declEntry
77805
- };
77806
- }
77807
- maxOccurs(path, value) {
77808
- if (value == undefined) {
77809
- return {};
77810
- }
77811
- if (!isFinite(Number(value))) {
77812
- return {};
77835
+ if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current) {
77836
+ return "PathTokens.current";
77813
77837
  }
77838
+ return JSON.stringify(x);
77839
+ }).join(", ")}])`;
77840
+ }
77841
+
77842
+ /*
77843
+ Метод вычисляет зависимости для оператора.
77844
+ Для того, чтобы калькулятор корректно реагировал на измнения необходимо сделать корректные зависимости:
77845
+ 1) Если исходная множественность и множественность по которой строится группа совпадают, то необходио
77846
+ для последней звёздочки построить зависимость не через PathTokens.current, а через PathTokens.each,
77847
+ т.к. в таком случае пересчёт groupSum/groupCount должен тригетрися при изменении любого элемента в множественности, а не только текущего.
77848
+ 2) Если множественности не совпадают, то количество звёздочек (getIterationRank()) в общей части будет разным и ничего дополнительно делать не нужно,
77849
+ в зависимостях в CalculationFunction в данном случае все звёздочки превратятся в PathTokens.current.
77850
+ */
77851
+ function calculatedGroupSumDependencyForSourcePath(targetKeyPath, sourcePath) {
77852
+ const diffPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetKeyPath, sourcePath);
77853
+ if (targetKeyPath.getIterationRank() > diffPaths.matchedPath.getIterationRank()) {
77814
77854
  return {
77815
- [path.toLegacyPath()]: {
77816
- maxOccurs: Number(value)
77817
- }
77855
+ currentDepsPath: diffPaths.matchedPath,
77856
+ eachDepsPath: diffPaths.differentPath
77818
77857
  };
77819
77858
  }
77820
- addPathDeclEntry(sugarNode, fieldNames) {
77821
- const declEntry = {};
77822
- for (const [fieldName, option] of fieldNames.filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined)) {
77823
- declEntry[fieldName] = option;
77824
- }
77825
- return {
77826
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()(declEntry, this.addTypeNode(sugarNode))
77827
- };
77859
+ const targetPathParts = diffPaths.matchedPath.getPathPartsAsArray();
77860
+ const lastStarIndex = targetPathParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
77861
+ const currentDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(targetPathParts.slice(0, lastStarIndex));
77862
+ let eachDepsPath;
77863
+ if (lastStarIndex === -1) {
77864
+ eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...diffPaths.matchedPath.getPathParts(), ...diffPaths.differentPath.getPathParts()]);
77865
+ } else {
77866
+ var _targetPathParts$last;
77867
+ eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([(_targetPathParts$last = targetPathParts[lastStarIndex]) !== null && _targetPathParts$last !== void 0 ? _targetPathParts$last : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)("path in groupSum is incorrect. Cannot create DepsPath for " + targetPathParts.join("/")), ...targetPathParts.slice(lastStarIndex + 1), ...diffPaths.differentPath.getPathParts()]);
77828
77868
  }
77829
- addSpecialFieldsEntry(node, {
77830
- multiple,
77831
- optional,
77832
- disabled
77833
- }) {
77834
- const declEntry = {};
77835
- if (optional) {
77836
- declEntry.optional = [true];
77837
- }
77838
- if (disabled) {
77839
- declEntry.disabled = [true];
77840
- }
77841
- if (Object.keys(declEntry).length === 0) {
77842
- return {};
77869
+ return {
77870
+ currentDepsPath: currentDepsPath,
77871
+ eachDepsPath: eachDepsPath
77872
+ };
77873
+ }
77874
+ function makeResult(body, newDeps) {
77875
+ return {
77876
+ body: body,
77877
+ deps: newDeps
77878
+ };
77879
+ }
77880
+ function makeUnhandledResult() {
77881
+ return {
77882
+ body: "null",
77883
+ deps: []
77884
+ };
77885
+ }
77886
+ class FormulaToCalculator2FunctionConverter {
77887
+ constructor(schema) {
77888
+ this.schema = void 0;
77889
+ this.schema = schema;
77890
+ }
77891
+ compileExpressionWithUnsupportedHandled(prefix, targetFullPath, expression) {
77892
+ try {
77893
+ return this.compile(prefix, targetFullPath, expression);
77894
+ } catch (e) {
77895
+ if (e instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
77896
+ return e;
77897
+ }
77898
+ throw e;
77843
77899
  }
77844
- return {
77845
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node)]: declEntry
77846
- };
77847
77900
  }
77848
- addPathSectionDeclarationEntry(sugarNode, requisite, skipRequisitesSection = false) {
77849
- const declEntry = {};
77850
- const requisitesMode = skipRequisitesSection ? RequisiteSectionMode.ForceSkip : RequisiteSectionMode.AsRequisiteAttribute;
77851
- declEntry.section = this.getSections(sugarNode, requisite, requisitesMode);
77852
- return {
77853
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
77854
- };
77901
+ getAdjustedNormalizedPath(prefix, path) {
77902
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(removeMultiplicity(removeAttributePrefix(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77903
+ return modelPath;
77855
77904
  }
77856
- addChildPathSectionDeclarationEntry(sugarNode, childPath, requisite) {
77857
- const declEntry = {};
77858
- declEntry.section = this.getSections(sugarNode, requisite);
77859
- if ((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.isModelPath)(childPath)) {
77860
- return {
77861
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getNewBindingPathExpression)(sugarNode).joinWith(childPath).toLegacyPath()]: declEntry
77862
- };
77863
- } else {
77864
- return {
77865
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode) + "/" + childPath]: declEntry
77866
- };
77867
- }
77905
+ getModelPath(prefix, path) {
77906
+ return this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(removeAttributePrefix(removeMultiplicity(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77868
77907
  }
77869
- mergeDataDeclaration(...items) {
77870
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
77871
- return lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()({}, ...items.filter(x => Boolean(x)), this.declarationCustomizer);
77908
+ compile(prefix, targetFullPath, expression) {
77909
+ const result = this.compileExpression(prefix, targetFullPath, expression);
77910
+ return result;
77872
77911
  }
77873
- addChildrenPathDeclEntry(node, pathAttr, optional, requisite) {
77874
- if (pathAttr && pathAttr.includes("*")) {
77875
- const declEntry = {};
77876
- const childrenIndex = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node).lastIndexOf("*");
77877
- const childrenPath = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node).slice(0, childrenIndex - 1);
77878
- declEntry.children = this.initSequenceFactory.children(optional);
77879
- declEntry.section = this.getSections(node, requisite);
77912
+
77913
+ /* eslint-disable @typescript-eslint/unbound-method */
77914
+ compileExpression(prefix, targetFullPath, expression) {
77915
+ const gcf = (selector, ...args) => getCompiledFuncWithArgs(selector, args);
77916
+ const getCompiledArgs = expressions => {
77917
+ const compiledExpressions = expressions.map(arg => this.compileExpression(prefix, targetFullPath, arg));
77918
+ const compiledArgs = compiledExpressions.map(x => x.body);
77919
+ const compiledJoinedArgs = compiledArgs.join(",");
77920
+ const allDeps = compiledExpressions.map(x => x.deps).flat();
77880
77921
  return {
77881
- [childrenPath]: declEntry
77922
+ compiledArgs: compiledArgs,
77923
+ compiledJoinedArgs: compiledJoinedArgs,
77924
+ allDeps: allDeps
77882
77925
  };
77926
+ };
77927
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArgumentExpression || expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultySumExpression) {
77928
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77929
+ const argumentDependency = getArgumentDeps(targetFullPath, modelPath, "Sum");
77930
+ const finalPath = argumentDependency.asDependencyModelPath();
77931
+ return makeResult(gcf(x => x.argument, `"${finalPath.toLegacyPath()}"`), [argumentDependency]);
77883
77932
  }
77884
- return {};
77885
- }
77886
- addChildrenPathDeclEntryForChild(node, optional, pathAttrValue, childPath, requisite) {
77887
- const pathAttr = (pathAttrValue !== null && pathAttrValue !== void 0 ? pathAttrValue : "") + "/" + childPath;
77888
- if (pathAttr && pathAttr.includes("*")) {
77889
- const declEntry = {};
77890
- const resolvedBindingPath = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node) + "/" + childPath;
77891
- const childrenIndex = resolvedBindingPath.lastIndexOf("*");
77892
- const childrenPath = resolvedBindingPath.slice(0, childrenIndex - 1);
77893
- declEntry.children = this.initSequenceFactory.children(optional);
77894
- declEntry.section = this.getSections(node, requisite);
77895
- return {
77896
- [childrenPath]: declEntry
77897
- };
77933
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
77934
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77935
+ return makeResult(gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77898
77936
  }
77899
- return {};
77900
- }
77901
- *getAllParentPages(node) {
77902
- let currentNode = node;
77903
- while (currentNode != undefined) {
77904
- const parent = currentNode.findParentOfType(_markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode);
77905
- if (parent != undefined) {
77906
- yield parent;
77907
- }
77908
- currentNode = parent;
77937
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsSnilsExpression) {
77938
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77939
+ return makeResult(gcf(x => x.isSnils, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77909
77940
  }
77910
- }
77911
- getSections(node, requisite, requisiteMode = RequisiteSectionMode.AsRequisiteAttribute) {
77912
- const page = node instanceof _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode ? node : node.findParentOfType(_markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode);
77913
- const pageName = page === null || page === void 0 ? void 0 : page.id;
77914
- const pageRequiresResolution = page != undefined && (page.multiple || Iterator.from(this.getAllParentPages(page)).some(x => {
77915
- var _x$multiple;
77916
- return (_x$multiple = x.multiple) !== null && _x$multiple !== void 0 ? _x$multiple : false;
77917
- }));
77918
- if (!(node instanceof _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode)) {
77919
- if (pageRequiresResolution) {
77920
- return [{
77921
- fn: `#getSectionFunction('${pageName}')#`
77922
- }];
77923
- }
77941
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsInnExpression) {
77942
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77943
+ return makeResult(gcf(x => x.isInn, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77924
77944
  }
77925
- const sections = pageName != undefined ? [pageName] : [];
77926
- if (requisiteMode === RequisiteSectionMode.AsRequisiteAttribute) {
77927
- if (requisite) {
77928
- sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.requisitesSection);
77929
- }
77945
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidMirCardNumberExpression) {
77946
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77947
+ return makeResult(gcf(x => x.isValidMirCardNumber, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77930
77948
  }
77931
- if (requisiteMode === RequisiteSectionMode.ForceAdd) {
77932
- sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.requisitesSection);
77949
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidAccountNumberExpression) {
77950
+ const bikPath = this.getAdjustedNormalizedPath(prefix, expression.bik);
77951
+ const accountPath = this.getAdjustedNormalizedPath(prefix, expression.account);
77952
+ return makeResult(gcf(x => x.isValidAccountNumber, `"${bikPath.toLegacyPath()}"`, `"${accountPath.toLegacyPath()}"`), [new RegularDependency(bikPath), new RegularDependency(accountPath)]);
77933
77953
  }
77934
- sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.defaultSection);
77935
- return sections;
77936
- }
77937
- buildNodeDataDeclaration(child, fieldNameToDeclInfo, nodeProcessor) {
77938
- const controlConverterClass = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(child));
77939
- if (controlConverterClass == undefined) {
77940
- if (child instanceof _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.UnknownSugarNode && child.name === "type") {
77941
- return emptyDataDeclarationCollection;
77942
- }
77943
- if (child instanceof _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.UnknownSugarNode) {
77944
- const customControl = this.controlCustomizationContext.tryGetCustomRegularControl(child.name);
77945
- if (customControl != undefined) {
77946
- const hasBindingPath = customControl.properties.find(x => x.name === "path" && x.type === "bindingPath");
77947
- return hasBindingPath ? this.addCustomControlPathDeclEntry(child, customControl) : emptyDataDeclarationCollection;
77948
- }
77949
- }
77950
- const result = nodeProcessor === null || nodeProcessor === void 0 ? void 0 : nodeProcessor(child);
77951
- if (result == undefined) {
77952
- // eslint-disable-next-line no-console
77953
- console.error(`Cannot process node of type ${(0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(child).name}`);
77954
- return emptyDataDeclarationCollection;
77954
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaCountExpression) {
77955
+ var _expression$withNullO;
77956
+ const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77957
+ let finalPath = modelPath;
77958
+ const deps = [];
77959
+ if (targetFullPath.isContainIteration()) {
77960
+ const argumentDependency = getArgumentDeps(targetFullPath, modelPath, "Count");
77961
+ deps.push(argumentDependency);
77962
+ finalPath = argumentDependency.asDependencyModelPath();
77963
+ } else {
77964
+ deps.push(new RegularDependency(modelPath));
77955
77965
  }
77956
- return result;
77966
+ return makeResult(gcf(x => x.count, `"${finalPath.toLegacyPath()}"`, `"${(_expression$withNullO = expression.withNullOrEmptyValues) !== null && _expression$withNullO !== void 0 ? _expression$withNullO : false}"`), deps);
77957
77967
  }
77958
- const converter = new controlConverterClass(child);
77959
- return converter.buildDataDeclaration(this);
77960
- }
77961
- addCustomControlPathDeclEntry(sugarNode, customControl) {
77962
- const declEntry = {};
77963
- declEntry["value"] = this.initSequenceFactory.dataValue(sugarNode, sugarNode.disabled);
77964
- if (sugarNode.optional) {
77965
- declEntry.optional = [true];
77968
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaWhenExpression) {
77969
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.expressions, 2);
77970
+ const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.expressions[0]);
77971
+ const compiledBody = this.compileExpression(prefix, targetFullPath, expression.expressions[1]);
77972
+ return makeResult(gcf(x => x.when, compiledCondition.body, `() => ${compiledBody.body}`), [...compiledCondition.deps, ...compiledBody.deps]);
77966
77973
  }
77967
- if (sugarNode.disabled) {
77968
- declEntry.disabled = [true];
77974
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOrExpression) {
77975
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
77976
+ const {
77977
+ compiledJoinedArgs,
77978
+ allDeps
77979
+ } = getCompiledArgs(expression.arguments);
77980
+ return makeResult(gcf(x => x.or, `[${compiledJoinedArgs}]`), allDeps);
77969
77981
  }
77970
- declEntry.section = this.getSections(sugarNode, sugarNode.requisite);
77971
- return {
77972
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
77973
- };
77974
- }
77975
- }
77976
-
77977
- /***/ }),
77978
-
77979
- /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts":
77980
- /*!**************************************************************************************************!*\
77981
- !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts ***!
77982
- \**************************************************************************************************/
77983
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77984
-
77985
- "use strict";
77986
- __webpack_require__.r(__webpack_exports__);
77987
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77988
- /* harmony export */ DataDeclarationGenerationTimeHelper: () => (/* binding */ DataDeclarationGenerationTimeHelper)
77989
- /* harmony export */ });
77990
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77991
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
77992
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77993
- /* harmony import */ var _Common_ModelPath_Set_Set2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/ModelPath/Set/Set2 */ "./Common/ModelPath/Set/Set2.ts");
77994
-
77995
-
77996
-
77997
-
77998
- class DataDeclarationGenerationTimeHelper {
77999
- constructor(dataDeclaration) {
78000
- this.dataDeclaration = void 0;
78001
- this.dataDeclaration = dataDeclaration;
78002
- }
78003
- isErrorsAndWarningsCountRequired(targetPath) {
78004
- var _this$getDataDeclarat, _this$getDataDeclarat2, _this$getDataDeclarat3;
78005
- return (_this$getDataDeclarat = (_this$getDataDeclarat2 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat2 === void 0 ? void 0 : (_this$getDataDeclarat3 = _this$getDataDeclarat2.errorAndWarningCountRequired) === null || _this$getDataDeclarat3 === void 0 ? void 0 : _this$getDataDeclarat3[0]) !== null && _this$getDataDeclarat !== void 0 ? _this$getDataDeclarat : false;
78006
- }
78007
- hasMask(targetPath) {
78008
- return this.getDataDeclarationEntry(targetPath) != undefined;
78009
- }
78010
- getMaxOccurs(nodePath) {
78011
- var _this$getDataDeclarat4;
78012
- return (_this$getDataDeclarat4 = this.getDataDeclarationEntry(nodePath)) === null || _this$getDataDeclarat4 === void 0 ? void 0 : _this$getDataDeclarat4.maxOccurs;
78013
- }
78014
- isNodeHasChildrenEntry(targetPath) {
78015
- var _this$getDataDeclarat5;
78016
- return ((_this$getDataDeclarat5 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat5 === void 0 ? void 0 : _this$getDataDeclarat5.children) != undefined;
78017
- }
78018
- isNodeHasAutoFlagEntry(targetPath) {
78019
- const declEntry = this.getDataDeclarationEntry(targetPath);
78020
- return declEntry !== undefined && "autoValue" in declEntry;
78021
- }
78022
- isNodeHasDisabledEntry(targetPath) {
78023
- const declEntry = this.getDataDeclarationEntry(targetPath);
78024
- return Boolean(declEntry === null || declEntry === void 0 ? void 0 : declEntry.disabled);
78025
- }
78026
- getDefaultValue(targetPath) {
78027
- const declEntry = this.getDataDeclarationEntry(targetPath);
78028
- const lastValue = declEntry !== undefined && "value" in declEntry && declEntry.value != undefined ? declEntry.value[declEntry.value.length - 1] : "";
78029
- const returnDefaultValue = typeof lastValue === "string" ? lastValue : "";
78030
- return returnDefaultValue;
78031
- }
78032
- isNodeOptional(targetPath) {
78033
- var _this$getDataDeclarat6, _optionalValue$;
78034
- const optionalValue = (_this$getDataDeclarat6 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat6 === void 0 ? void 0 : _this$getDataDeclarat6.optional;
78035
- return (_optionalValue$ = optionalValue === null || optionalValue === void 0 ? void 0 : optionalValue[0]) !== null && _optionalValue$ !== void 0 ? _optionalValue$ : false;
77982
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAndExpression) {
77983
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
77984
+ const {
77985
+ compiledJoinedArgs,
77986
+ allDeps
77987
+ } = getCompiledArgs(expression.arguments);
77988
+ return makeResult(gcf(x => x.and, `[${compiledJoinedArgs}]`), allDeps);
77989
+ }
77990
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNotExpression) {
77991
+ const innerExpression = this.compileExpression(prefix, targetFullPath, expression.argument);
77992
+ return makeResult(gcf(x => x.not, innerExpression.body), innerExpression.deps);
77993
+ }
77994
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaEqExpression) {
77995
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
77996
+ const {
77997
+ compiledArgs,
77998
+ allDeps
77999
+ } = getCompiledArgs(expression.arguments);
78000
+ return makeResult(gcf(x => x.eq, ...compiledArgs), allDeps);
78001
+ }
78002
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConstExpression) {
78003
+ return makeResult(gcf(x => x.const, `"${expression.value}"`), []);
78004
+ }
78005
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGtExpression) {
78006
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78007
+ const {
78008
+ compiledArgs,
78009
+ allDeps
78010
+ } = getCompiledArgs(expression.arguments);
78011
+ return makeResult(gcf(x => x.gt, ...compiledArgs), allDeps);
78012
+ }
78013
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGeExpression) {
78014
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78015
+ const {
78016
+ compiledArgs,
78017
+ allDeps
78018
+ } = getCompiledArgs(expression.arguments);
78019
+ return makeResult(gcf(x => x.ge, ...compiledArgs), allDeps);
78020
+ }
78021
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLtExpression) {
78022
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78023
+ const {
78024
+ compiledArgs,
78025
+ allDeps
78026
+ } = getCompiledArgs(expression.arguments);
78027
+ return makeResult(gcf(x => x.lt, ...compiledArgs), allDeps);
78028
+ }
78029
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLeExpression) {
78030
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78031
+ const {
78032
+ compiledArgs,
78033
+ allDeps
78034
+ } = getCompiledArgs(expression.arguments);
78035
+ return makeResult(gcf(x => x.le, ...compiledArgs), allDeps);
78036
+ }
78037
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLengthExpression) {
78038
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78039
+ return makeResult(gcf(x => x.length, compiledArgument.body), compiledArgument.deps);
78040
+ }
78041
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRegexMatchExpression) {
78042
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78043
+ const preparedPattern = expression.pattern.replace(/"/g, '\\"').replace(/\\/g, "\\\\");
78044
+ return makeResult(gcf(x => x.regexMatch, compiledArgument.body, `"${preparedPattern}"`), compiledArgument.deps);
78045
+ }
78046
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultiplyExpression) {
78047
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78048
+ const {
78049
+ compiledJoinedArgs,
78050
+ allDeps
78051
+ } = getCompiledArgs(expression.arguments);
78052
+ return makeResult(gcf(x => x.multiply, `[${compiledJoinedArgs}]`), allDeps);
78053
+ }
78054
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDivisionExpression) {
78055
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78056
+ const {
78057
+ compiledJoinedArgs,
78058
+ allDeps
78059
+ } = getCompiledArgs(expression.arguments);
78060
+ return makeResult(gcf(x => x.division, `[${compiledJoinedArgs}]`), allDeps);
78061
+ }
78062
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
78063
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
78064
+ const {
78065
+ compiledJoinedArgs,
78066
+ allDeps
78067
+ } = getCompiledArgs(expression.arguments);
78068
+ return makeResult(gcf(x => x.sum, `[${compiledJoinedArgs}]`), allDeps);
78069
+ }
78070
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMinusExpression) {
78071
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78072
+ return makeResult(gcf(x => x.minus, compiledArgument.body), compiledArgument.deps);
78073
+ }
78074
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRoundExpression) {
78075
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78076
+ return makeResult(gcf(x => x.round, compiledArgument.body, `${expression.fractionalDigits}`), compiledArgument.deps);
78077
+ }
78078
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFloorExpression) {
78079
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78080
+ return makeResult(gcf(x => x.floor, compiledArgument.body), compiledArgument.deps);
78081
+ }
78082
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAbsExpression) {
78083
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78084
+ return makeResult(gcf(x => x.abs, compiledArgument.body), compiledArgument.deps);
78085
+ }
78086
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaXAbsExpression) {
78087
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78088
+ return makeResult(gcf(x => x.xabs, compiledArgument.body), compiledArgument.deps);
78089
+ }
78090
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaChooseExpression) {
78091
+ const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.ifNode.condition);
78092
+ const compiledThen = this.compileExpression(prefix, targetFullPath, expression.thenNode.expression);
78093
+ const compiledElse = this.compileExpression(prefix, targetFullPath, expression.elseNode.expression);
78094
+ return makeResult(gcf(x => x.choose, compiledCondition.body, `() => ${compiledThen.body}`, `() => ${compiledElse.body}`), [compiledCondition.deps, compiledThen.deps, compiledElse.deps].flat());
78095
+ }
78096
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateNowExpression) {
78097
+ return makeResult(gcf(x => x.dateNow), []);
78098
+ }
78099
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDaysInMonthExpression) {
78100
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78101
+ return makeResult(gcf(x => x.getDaysInMonth, compiledArgument.body), compiledArgument.deps);
78102
+ }
78103
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDayExpression) {
78104
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78105
+ return makeResult(gcf(x => x.getDay, compiledArgument.body), compiledArgument.deps);
78106
+ }
78107
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetMonthExpression) {
78108
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78109
+ return makeResult(gcf(x => x.getMonth, compiledArgument.body), compiledArgument.deps);
78110
+ }
78111
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetYearExpression) {
78112
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78113
+ return makeResult(gcf(x => x.getYear, compiledArgument.body), compiledArgument.deps);
78114
+ }
78115
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsDateExpression) {
78116
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78117
+ return makeResult(gcf(x => x.isDate, compiledArgument.body), compiledArgument.deps);
78118
+ }
78119
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInMonthsExpression) {
78120
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78121
+ const {
78122
+ compiledJoinedArgs,
78123
+ allDeps
78124
+ } = getCompiledArgs(expression.arguments);
78125
+ return makeResult(gcf(x => x.differenceInMonths, `[${compiledJoinedArgs}]`), allDeps);
78126
+ }
78127
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInDaysExpression) {
78128
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78129
+ const {
78130
+ compiledJoinedArgs,
78131
+ allDeps
78132
+ } = getCompiledArgs(expression.arguments);
78133
+ return makeResult(gcf(x => x.differenceInDays, `[${compiledJoinedArgs}]`), allDeps);
78134
+ }
78135
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddDaysExpression) {
78136
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78137
+ return makeResult(gcf(x => x.addDays, `${path.body}, ${expression.amount}`), path.deps);
78138
+ }
78139
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddMonthsExpression) {
78140
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78141
+ return makeResult(gcf(x => x.addMonths, `${path.body}, ${expression.amount}`), path.deps);
78142
+ }
78143
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddYearsExpression) {
78144
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78145
+ return makeResult(gcf(x => x.addYears, `${path.body}, ${expression.amount}`), path.deps);
78146
+ }
78147
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateToStringExpression) {
78148
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78149
+ return makeResult(gcf(x => x.dateToString, `${path.body}, "${!!expression.format ? expression.format : "dd.MM.yyyy"}"`), path.deps);
78150
+ }
78151
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateTimeExpression) {
78152
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78153
+ return makeResult(gcf(x => x.dateTime, compiledArgument.body), compiledArgument.deps);
78154
+ }
78155
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSubstringExpression) {
78156
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined)(expression.expression);
78157
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78158
+ return makeResult(gcf(x => x.substring, `${compiledArgument.body}`, `${expression.start}`, `${expression.length}`), compiledArgument.deps);
78159
+ }
78160
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
78161
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78162
+ const {
78163
+ compiledJoinedArgs,
78164
+ allDeps
78165
+ } = getCompiledArgs(expression.arguments);
78166
+ return makeResult(gcf(x => x.sum, `[${compiledJoinedArgs}]`), allDeps);
78167
+ }
78168
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupSumExpression) {
78169
+ const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys);
78170
+ const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
78171
+ const sourceKeyDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
78172
+ const sourceValuePath = this.getModelPath(prefix, expression.sourceValuePath);
78173
+ const sourceValueDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceValuePath);
78174
+ return makeResult(gcf(x => x.groupSum, `${targetKeys.body}, "${sourceKeyPath}", "${sourceValuePath}"`), [new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath), new DependencyWithoutChecks(sourceValueDeps.currentDepsPath, sourceValueDeps.eachDepsPath), ...targetKeys.deps]);
78175
+ }
78176
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupCountExpression) {
78177
+ const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys);
78178
+ const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
78179
+ const sourceKeyDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
78180
+ return makeResult(gcf(x => x.groupCount, `${targetKeys.body}, "${sourceKeyPath}"`), [new DependencyWithoutChecks(targetFullPath), new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath), ...targetKeys.deps]);
78181
+ }
78182
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression) {
78183
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78184
+ const {
78185
+ compiledJoinedArgs,
78186
+ allDeps
78187
+ } = getCompiledArgs(expression.arguments);
78188
+ return makeResult(gcf(x => x.concat, `[${compiledJoinedArgs}]`), allDeps);
78189
+ }
78190
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNewLineExpression) {
78191
+ return makeResult(gcf(x => x.const, `"\\r\\n"`), []);
78192
+ }
78193
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOneOfExpression) {
78194
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78195
+ const {
78196
+ compiledJoinedArgs,
78197
+ allDeps
78198
+ } = getCompiledArgs(expression.items.expressions);
78199
+ return makeResult(gcf(x => x.oneOf, compiledArgument.body, `[${compiledJoinedArgs}]`), [...compiledArgument.deps, ...allDeps]);
78200
+ }
78201
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
78202
+ const {
78203
+ compiledJoinedArgs,
78204
+ allDeps
78205
+ } = getCompiledArgs(expression.items);
78206
+ return makeResult(`JSON.stringify([${compiledJoinedArgs}])`, allDeps);
78207
+ }
78208
+ // -- не работает в рантайм калькуляторе
78209
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
78210
+ return makeUnhandledResult();
78211
+ }
78212
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFirstOrDefaultExpression) {
78213
+ return makeUnhandledResult();
78214
+ }
78215
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
78216
+ return makeUnhandledResult();
78217
+ }
78218
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
78219
+ return makeUnhandledResult();
78220
+ }
78221
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHasAutoFlagExpression) {
78222
+ return makeUnhandledResult();
78223
+ }
78224
+ // -----
78225
+
78226
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Unsupported node type: ${expression.constructor.name}`);
78036
78227
  }
78037
- getDataDeclarationEntry(targetPath) {
78038
- return this.dataDeclaration[(0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.convertToLegacyPath)(targetPath)];
78228
+ /* eslint-enable @typescript-eslint/unbound-method */
78229
+ }
78230
+
78231
+ /***/ }),
78232
+
78233
+ /***/ "./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts":
78234
+ /*!******************************************************************************************!*\
78235
+ !*** ./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts ***!
78236
+ \******************************************************************************************/
78237
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78238
+
78239
+ "use strict";
78240
+ __webpack_require__.r(__webpack_exports__);
78241
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78242
+ /* harmony export */ ValidationsCalculator2Generator: () => (/* binding */ ValidationsCalculator2Generator)
78243
+ /* harmony export */ });
78244
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78245
+ /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
78246
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78247
+ /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts");
78248
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
78249
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78250
+ /* harmony import */ var _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FormulaToCalculator2FunctionConverter */ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts");
78251
+
78252
+
78253
+
78254
+
78255
+
78256
+
78257
+
78258
+ const emptyResult = `
78259
+ export default function kcXmlValidationConfigurator ({ form, ModelPath, ValidationFunction, KCCondition }) {}
78260
+ `;
78261
+ class ValidationsCalculator2Generator {
78262
+ constructor(schema) {
78263
+ this.converter = void 0;
78264
+ this.schema = void 0;
78265
+ this.schema = schema;
78266
+ this.converter = new _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.FormulaToCalculator2FunctionConverter(schema);
78039
78267
  }
78040
- getOptionalSections() {
78041
- var _this$dataDeclaration, _this$dataDeclaration2;
78042
- const anyPath = Object.keys(this.dataDeclaration)[0];
78043
- if (anyPath == undefined) {
78044
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)();
78268
+ generate(kcXmlConditions, options) {
78269
+ const compiledConditions = Iterator.from(kcXmlConditions).map(condition => this.compileCondition(condition, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined).toArray();
78270
+ if (compiledConditions.length === 0) {
78271
+ // NOTE Просто, чтоб не падали аппрувал тесты
78272
+ return emptyResult;
78045
78273
  }
78046
- const absolutePath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsolute)(anyPath);
78047
- const root = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.first(absolutePath.getPathParts());
78048
- return (_this$dataDeclaration = (_this$dataDeclaration2 = this.dataDeclaration[root !== null && root !== void 0 ? root : ""]) === null || _this$dataDeclaration2 === void 0 ? void 0 : _this$dataDeclaration2.optionalSections) !== null && _this$dataDeclaration !== void 0 ? _this$dataDeclaration : [];
78274
+ const result = `export default function kcXmlValidationConfigurator ({ form, ap, ValidationFunction, KCCondition, PathTokens }) {
78275
+ ${compiledConditions.map(x => `form.calculator2.addCalculationFunction(${x});`).join("\n")}
78276
+ }
78277
+ `;
78278
+ return result;
78049
78279
  }
78050
- getAllPathsBySection() {
78051
- const unpackSectionNameFromFn = fnCode => {
78052
- var _fnCode$match, _fnCode$match$groups;
78053
- return (_fnCode$match = fnCode.match(/getSectionFunction\('(?<name>[\w\d_]+?)'\)/)) === null || _fnCode$match === void 0 ? void 0 : (_fnCode$match$groups = _fnCode$match.groups) === null || _fnCode$match$groups === void 0 ? void 0 : _fnCode$match$groups["name"];
78054
- };
78055
- const section2Path = Object.entries(this.dataDeclaration).map(current => {
78056
- var _pathData$section;
78057
- const path = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(current[0], _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
78058
- const pathData = current[1];
78059
- const allSections = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(((_pathData$section = pathData.section) !== null && _pathData$section !== void 0 ? _pathData$section : []).map(section => typeof section === "string" || Array.isArray(section) ? section : typeof section === "object" && "fn" in section && typeof section.fn === "string" ? unpackSectionNameFromFn(section.fn) : undefined).flat(1).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined).map(x => ({
78060
- section: x,
78061
- path: path
78062
- })), x => x.section);
78063
- return [...allSections];
78064
- }).flat(1).reduce((acc, current) => {
78065
- var _acc$get;
78066
- const currentPaths = (_acc$get = acc.get(current.section)) !== null && _acc$get !== void 0 ? _acc$get : new _Common_ModelPath_Set_Set2__WEBPACK_IMPORTED_MODULE_3__.Set2();
78067
- currentPaths.add(current.path);
78068
- acc.set(current.section, currentPaths);
78069
- return acc;
78070
- }, new Map());
78071
- return section2Path;
78280
+ compileCondition(condition, options) {
78281
+ var _condition$descriptio, _condition$errorLevel;
78282
+ const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeMultiplicity)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeAttributePrefix)(condition.match)), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
78283
+ const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeMultiplicity)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeAttributePrefix)(condition.target)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
78284
+ const compileResult = this.converter.compileExpressionWithUnsupportedHandled(prefix, target, condition.expression);
78285
+ if (compileResult instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_4__.NotSupportedError) {
78286
+ if (options.skipNotSupportedFunction) {
78287
+ return undefined;
78288
+ } else {
78289
+ throw compileResult;
78290
+ }
78291
+ }
78292
+ const {
78293
+ body: compiledExpression,
78294
+ deps
78295
+ } = compileResult;
78296
+ const compiledDescriptionParts = (0,_AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_3__.splitConditionDescriptionToParts)((_condition$descriptio = condition.description) !== null && _condition$descriptio !== void 0 ? _condition$descriptio : "Error Message");
78297
+ let concatDescription;
78298
+ if (compiledDescriptionParts.length > 1) {
78299
+ concatDescription = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression();
78300
+ concatDescription.arguments = compiledDescriptionParts;
78301
+ } else {
78302
+ concatDescription = compiledDescriptionParts[0];
78303
+ }
78304
+ const {
78305
+ body: compiledDescription,
78306
+ deps: descriptionDeps
78307
+ } = this.converter.compile(prefix, target, concatDescription);
78308
+ const allDeps = deps.concat(...descriptionDeps);
78309
+ const compiledTarget = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.modelPathInstance)(target);
78310
+ const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(allDeps.map(x => ({
78311
+ path: x.asDependencyModelPath(),
78312
+ isIgnoreForChecks: (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.isDependencyWithoutChecks)(x),
78313
+ pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
78314
+ })).filter(x => !x.path.isEquals(target)), x => x.pathString));
78315
+ const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.modelPathInstance)(x)).join(", ");
78316
+ const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `(expression) => ${compiledDescription}, "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
78317
+ return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
78072
78318
  }
78073
78319
  }
78074
78320
 
78075
78321
  /***/ }),
78076
78322
 
78077
- /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerator.ts":
78078
- /*!***************************************************************************************!*\
78079
- !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerator.ts ***!
78080
- \***************************************************************************************/
78323
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts":
78324
+ /*!***********************************************************************************************!*\
78325
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts ***!
78326
+ \***********************************************************************************************/
78081
78327
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78082
78328
 
78083
78329
  "use strict";
78084
78330
  __webpack_require__.r(__webpack_exports__);
78085
78331
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78086
- /* harmony export */ DataDeclarationGenerator: () => (/* binding */ DataDeclarationGenerator)
78332
+ /* harmony export */ DataDeclarationGenerationContext: () => (/* binding */ DataDeclarationGenerationContext),
78333
+ /* harmony export */ emptyDataDeclarationCollection: () => (/* binding */ emptyDataDeclarationCollection)
78087
78334
  /* harmony export */ });
78088
- /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serialize-javascript */ "./node_modules/serialize-javascript/index.js");
78089
- /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(serialize_javascript__WEBPACK_IMPORTED_MODULE_0__);
78090
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78091
- /* harmony import */ var _common_SugarPathUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/SugarPathUtils */ "./Generator/src/common/SugarPathUtils.ts");
78335
+ /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash.mergewith */ "./node_modules/lodash.mergewith/index.js");
78336
+ /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__);
78337
+ /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.uniqwith */ "./node_modules/lodash.uniqwith/index.js");
78338
+ /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__);
78339
+ /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
78092
78340
  /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
78093
- /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
78341
+ /* harmony import */ var _Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/CommonConstants/SectionNames */ "./Common/CommonConstants/SectionNames.ts");
78094
78342
  /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78095
- /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
78096
- /* harmony import */ var _placeholders__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./placeholders */ "./Generator/src/generators/DataDeclarationGenerator/placeholders.js");
78097
- /* harmony import */ var _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DataDeclarationGenerationContext */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts");
78343
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78344
+ /* harmony import */ var _markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
78345
+ /* harmony import */ var _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/ElementProcessors/FormParts/Page/PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
78346
+ /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
78098
78347
 
78099
78348
 
78100
78349
 
@@ -78104,1630 +78353,1472 @@ __webpack_require__.r(__webpack_exports__);
78104
78353
 
78105
78354
 
78106
78355
 
78107
- class DataDeclarationGenerator {
78108
- constructor(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
78109
- this.sugarRoot = void 0;
78110
- this.initSequenceFactory = void 0;
78111
- this.formSchemaRng = void 0;
78112
- this.schemeValidations = void 0;
78113
- this.controlCustomizationContext = void 0;
78114
- this.typesRegistry = void 0;
78356
+
78357
+ var RequisiteSectionMode = /*#__PURE__*/function (RequisiteSectionMode) {
78358
+ RequisiteSectionMode[RequisiteSectionMode["AsRequisiteAttribute"] = 0] = "AsRequisiteAttribute";
78359
+ RequisiteSectionMode[RequisiteSectionMode["ForceAdd"] = 1] = "ForceAdd";
78360
+ RequisiteSectionMode[RequisiteSectionMode["ForceSkip"] = 2] = "ForceSkip";
78361
+ return RequisiteSectionMode;
78362
+ }(RequisiteSectionMode || {});
78363
+ const emptyDataDeclarationCollection = {};
78364
+ class DataDeclarationGenerationContext {
78365
+ constructor(initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
78366
+ this.initSequenceFactory = void 0;
78367
+ this.formSchemaRng = void 0;
78368
+ this.schemeValidations = void 0;
78369
+ this.controlCustomizationContext = void 0;
78370
+ this.typesRegistry = void 0;
78371
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78372
+ this.declarationCustomizer = (objValue, srcValue, key) => {
78373
+ // Вся эта функция не типизируется
78374
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
78375
+ if (key === "section") {
78376
+ const result = lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default()([].concat(...(objValue !== null && objValue !== void 0 ? objValue : []), ...srcValue), (a, b) => {
78377
+ if (typeof a === "object" && typeof b === "object") {
78378
+ // @ts-ignore см. выше.
78379
+ return a.fn === b.fn;
78380
+ }
78381
+ return a === b;
78382
+ });
78383
+
78384
+ // @ts-ignore см. выше.
78385
+ if (result[0].fn) {
78386
+ return result;
78387
+ }
78388
+ return [result];
78389
+ }
78390
+ /* eslint-enable @typescript-eslint/no-unsafe-argument */
78391
+ return undefined;
78392
+ };
78115
78393
  this.formSchemaRng = formSchemaRng;
78116
78394
  this.schemeValidations = schemeValidations;
78117
- this.sugarRoot = sugarRoot;
78118
78395
  this.initSequenceFactory = initSequenceFactory;
78119
78396
  this.controlCustomizationContext = controlCustomizationContext;
78120
78397
  this.typesRegistry = typesRegistry;
78121
78398
  }
78122
- generate() {
78123
- var _getConverterByNodeCl;
78124
- const converterClass = (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
78125
- const converter = new converterClass(this.sugarRoot);
78126
- const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry, this.formSchemaRng, this.schemeValidations);
78127
- const dataDeclaration = converter.buildDataDeclaration(context);
78128
- this.enrichWithSchemaRng(dataDeclaration);
78129
- const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
78130
- const result = this.replaceHolder(`
78131
- export default function dataDeclaration({
78132
- Helpers: {
78133
- autocalcCommonFunctions: {
78134
- getAsyncResultHandler,
78135
- getAsyncTextResultHandler,
78136
- wrapDecimalOperand,
78137
- getSum,
78138
- checkValuesArguments,
78139
- getAsyncBoolResultHandler,
78140
- getAsyncErrorResultHandler,
78141
- getOperands,
78142
- Deferred,
78143
- },
78144
- },
78145
- }) {
78146
- return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
78147
- space: " "
78148
- })};
78149
- };`);
78150
- return {
78151
- dataDeclarationContent: unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2")),
78152
- dataDeclaration: orderedDataDeclaration
78153
- };
78399
+ isMultipleNodeOptionalFromScheme(path) {
78400
+ if (!this.schemeValidations) {
78401
+ return undefined;
78402
+ }
78403
+ const schemaNode = this.formSchemaRng.getElementByPath(path);
78404
+ if (schemaNode instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__.FormSchemaRngElement) {
78405
+ var _schemaNode$isOptiona;
78406
+ return (_schemaNode$isOptiona = schemaNode.isOptionalOrNillable()) !== null && _schemaNode$isOptiona !== void 0 ? _schemaNode$isOptiona : false;
78407
+ }
78408
+ return undefined;
78154
78409
  }
78155
- enrichWithSchemaRng(dataDeclaration) {
78156
- const elementEntries = Iterator.from(this.formSchemaRng.getAllChildren(this.formSchemaRng.getRootElement())).map(x => ({
78157
- element: x,
78158
- legacyPath: this.formSchemaRng.getPath(x).trimLastStarIfLastToken().toLegacyPath()
78159
- }));
78160
- for (const item of elementEntries) {
78161
- var _dataDeclaration$item;
78162
- const entry = item.element;
78163
- const declarationEntry = (_dataDeclaration$item = dataDeclaration[item.legacyPath]) !== null && _dataDeclaration$item !== void 0 ? _dataDeclaration$item : {};
78164
- if (entry instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__.FormSchemaRngElement && entry.errorAndWarningCountRequired != undefined) {
78165
- declarationEntry.errorAndWarningCountRequired = [entry.errorAndWarningCountRequired];
78166
- }
78167
- if (entry.disableValueAutoInit != undefined) {
78168
- declarationEntry.disableValueAutoInit = entry.disableValueAutoInit;
78169
- }
78410
+ getTypeNode(node) {
78411
+ if (node.anonymousType != undefined) {
78412
+ return node.anonymousType;
78413
+ }
78414
+ if (node.type != undefined) {
78415
+ return this.typesRegistry.getByName(node.type);
78170
78416
  }
78417
+ return undefined;
78171
78418
  }
78172
- generateDataDeclarationFactory() {
78173
- var _getConverterByNodeCl2;
78174
- const converterClass = (_getConverterByNodeCl2 = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl2 !== void 0 ? _getConverterByNodeCl2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
78175
- const converter = new converterClass(this.sugarRoot);
78176
- const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry, this.formSchemaRng, this.schemeValidations);
78177
- const dataDeclaration = converter.buildDataDeclaration(context);
78178
- const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
78179
- return `
78180
- function dataDeclaration({
78181
- Helpers: {
78182
- autocalcCommonFunctions: {
78183
- getAsyncResultHandler,
78184
- getAsyncTextResultHandler,
78185
- wrapDecimalOperand,
78186
- getSum,
78187
- checkValuesArguments,
78188
- getAsyncBoolResultHandler,
78189
- getAsyncErrorResultHandler,
78190
- getOperands,
78191
- Deferred,
78192
- },
78193
- },
78194
- }) {
78195
- return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
78196
- space: " "
78197
- })};
78198
- }`;
78419
+ addTypeNode(node) {
78420
+ var _this$formSchemaRng$g;
78421
+ const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
78422
+ return baseType ? {
78423
+ type: baseType
78424
+ } : {};
78199
78425
  }
78200
- sortDataDeclarationKeys(dataDeclaration) {
78201
- const orderedDecl = {};
78202
- const orderedPaths = Object.keys(dataDeclaration).sort(_common_SugarPathUtils__WEBPACK_IMPORTED_MODULE_2__.SugarPathUtils.compare);
78203
- for (const filePath of orderedPaths) {
78204
- orderedDecl[filePath] = dataDeclaration[filePath];
78426
+ processChildrenDataDeclaration(children, nodeProcessor) {
78427
+ const childrenDataDeclaration = [];
78428
+ for (const child of children) {
78429
+ childrenDataDeclaration.push(this.buildNodeDataDeclaration(child, this.initSequenceFactory, nodeProcessor));
78205
78430
  }
78206
- return orderedDecl;
78431
+ return this.mergeDataDeclaration(...childrenDataDeclaration);
78207
78432
  }
78208
- replaceHolder(decl) {
78209
- let replacedDecl = decl;
78210
- for (const [placeholderName, placeHoldersFunction] of (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.iterateEntries)(_placeholders__WEBPACK_IMPORTED_MODULE_7__.placeHolders)) {
78211
- const checkName = `"#(${placeholderName})(\\('[\\w]*'\\))?#"`;
78212
- const include = new RegExp(checkName, "i");
78213
- if (include.test(replacedDecl)) {
78214
- const regex = new RegExp(checkName, "g");
78215
- replacedDecl = replacedDecl.replace(regex, "$1$2");
78216
- replacedDecl = replacedDecl + placeHoldersFunction.toString();
78217
- }
78433
+ addVisibilityPathDeclEntryNew(node, requisite) {
78434
+ var _node$parent;
78435
+ if (node.visibilityPath == undefined || node.visibilityPath === "") {
78436
+ return {};
78218
78437
  }
78219
- return replacedDecl;
78438
+ const declEntry = {};
78439
+ const nodePath = ((_node$parent = node.parent) !== null && _node$parent !== void 0 ? _node$parent : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)()).getFullPathForChildren().joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.createFromMask)(node.visibilityPath, "auto", _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.PathTokens.each));
78440
+ declEntry.section = this.getSections(node, requisite);
78441
+ return {
78442
+ [nodePath.normalize().toLegacyPath()]: declEntry
78443
+ };
78220
78444
  }
78221
- }
78222
-
78223
- /***/ }),
78224
-
78225
- /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts":
78226
- /*!*******************************************************************************************************!*\
78227
- !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts ***!
78228
- \*******************************************************************************************************/
78229
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78230
-
78231
- "use strict";
78232
- __webpack_require__.r(__webpack_exports__);
78233
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78234
- /* harmony export */ DataDeclarationInitSourceSequenceFactory: () => (/* binding */ DataDeclarationInitSourceSequenceFactory)
78235
- /* harmony export */ });
78236
- class DataDeclarationInitSourceSequenceFactory {
78237
- constructor(fetchFunctions) {
78238
- this.fetchFunctions = void 0;
78239
- this.fetchFunctions = fetchFunctions;
78445
+ maxOccurs(path, value) {
78446
+ if (value == undefined) {
78447
+ return {};
78448
+ }
78449
+ if (!isFinite(Number(value))) {
78450
+ return {};
78451
+ }
78452
+ return {
78453
+ [path.toLegacyPath()]: {
78454
+ maxOccurs: Number(value)
78455
+ }
78456
+ };
78240
78457
  }
78241
- dataValue(node, disabled, defaultValue) {
78242
- var _ref3;
78243
- if (node.settings) {
78244
- var _ref;
78245
- return [...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.takeFromModel(), ...this.setValueUnconditionally((_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref !== void 0 ? _ref : "")];
78458
+ addPathDeclEntry(sugarNode, fieldNames) {
78459
+ const declEntry = {};
78460
+ for (const [fieldName, option] of fieldNames.filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined)) {
78461
+ declEntry[fieldName] = option;
78462
+ }
78463
+ return {
78464
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()(declEntry, this.addTypeNode(sugarNode))
78465
+ };
78466
+ }
78467
+ addSpecialFieldsEntry(node, {
78468
+ multiple,
78469
+ optional,
78470
+ disabled
78471
+ }) {
78472
+ const declEntry = {};
78473
+ if (optional) {
78474
+ declEntry.optional = [true];
78246
78475
  }
78247
78476
  if (disabled) {
78248
- var _ref2;
78249
- return [...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.setValueUnconditionally((_ref2 = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref2 !== void 0 ? _ref2 : "")];
78477
+ declEntry.disabled = [true];
78250
78478
  }
78251
- return [...this.takeFromModel(), ...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.setValueUnconditionally((_ref3 = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref3 !== void 0 ? _ref3 : "")];
78252
- }
78253
- takeFromFetchFunctionOrDefault(fetchFnName, fieldName, defaultValue) {
78254
- return [...this.takeFromFetchFunction(fetchFnName, fieldName), ...this.setValueUnconditionally(defaultValue !== null && defaultValue !== void 0 ? defaultValue : "")];
78479
+ if (Object.keys(declEntry).length === 0) {
78480
+ return {};
78481
+ }
78482
+ return {
78483
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node)]: declEntry
78484
+ };
78255
78485
  }
78256
- takeFromModelOrDefaultValue(defaultValue) {
78257
- return [...this.takeFromModel(), ...this.setValueUnconditionally(defaultValue !== null && defaultValue !== void 0 ? defaultValue : "")];
78486
+ addPathSectionDeclarationEntry(sugarNode, requisite, skipRequisitesSection = false) {
78487
+ const declEntry = {};
78488
+ const requisitesMode = skipRequisitesSection ? RequisiteSectionMode.ForceSkip : RequisiteSectionMode.AsRequisiteAttribute;
78489
+ declEntry.section = this.getSections(sugarNode, requisite, requisitesMode);
78490
+ return {
78491
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
78492
+ };
78258
78493
  }
78259
- children(optional, defaultChildren) {
78260
- return [...this.takeFromModel(), ...this.setValueUnconditionally(defaultChildren !== null && defaultChildren !== void 0 ? defaultChildren : optional ? [] : ["0"])];
78494
+ addChildPathSectionDeclarationEntry(sugarNode, childPath, requisite) {
78495
+ const declEntry = {};
78496
+ declEntry.section = this.getSections(sugarNode, requisite);
78497
+ if ((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__.isModelPath)(childPath)) {
78498
+ return {
78499
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getNewBindingPathExpression)(sugarNode).joinWith(childPath).toLegacyPath()]: declEntry
78500
+ };
78501
+ } else {
78502
+ return {
78503
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode) + "/" + childPath]: declEntry
78504
+ };
78505
+ }
78261
78506
  }
78262
- takeFromModelOrFetchFn(fieldName, fetchFnName) {
78263
- return [...this.takeFromModel(), ...this.takeFromFetchFunctionIfExists(fetchFnName, fieldName)];
78507
+ mergeDataDeclaration(...items) {
78508
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
78509
+ return lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()({}, ...items.filter(x => Boolean(x)), this.declarationCustomizer);
78264
78510
  }
78265
- disabled() {
78266
- return [...this.takeFromModel(), ...this.setValueUnconditionally(false)];
78511
+ addChildrenPathDeclEntry(node, pathAttr, optional, requisite) {
78512
+ if (pathAttr && pathAttr.includes("*")) {
78513
+ const declEntry = {};
78514
+ const childrenIndex = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node).lastIndexOf("*");
78515
+ const childrenPath = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node).slice(0, childrenIndex - 1);
78516
+ declEntry.children = this.initSequenceFactory.children(optional);
78517
+ declEntry.section = this.getSections(node, requisite);
78518
+ return {
78519
+ [childrenPath]: declEntry
78520
+ };
78521
+ }
78522
+ return {};
78267
78523
  }
78268
- visible() {
78269
- return [...this.takeFromModel(), ...this.setValueUnconditionally(true)];
78524
+ addChildrenPathDeclEntryForChild(node, optional, pathAttrValue, childPath, requisite) {
78525
+ const pathAttr = (pathAttrValue !== null && pathAttrValue !== void 0 ? pathAttrValue : "") + "/" + childPath;
78526
+ if (pathAttr && pathAttr.includes("*")) {
78527
+ const declEntry = {};
78528
+ const resolvedBindingPath = (0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(node) + "/" + childPath;
78529
+ const childrenIndex = resolvedBindingPath.lastIndexOf("*");
78530
+ const childrenPath = resolvedBindingPath.slice(0, childrenIndex - 1);
78531
+ declEntry.children = this.initSequenceFactory.children(optional);
78532
+ declEntry.section = this.getSections(node, requisite);
78533
+ return {
78534
+ [childrenPath]: declEntry
78535
+ };
78536
+ }
78537
+ return {};
78270
78538
  }
78271
- setValueUnconditionally(value) {
78272
- return [value];
78539
+ *getAllParentPages(node) {
78540
+ let currentNode = node;
78541
+ while (currentNode != undefined) {
78542
+ const parent = currentNode.findParentOfType(_markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode);
78543
+ if (parent != undefined) {
78544
+ yield parent;
78545
+ }
78546
+ currentNode = parent;
78547
+ }
78273
78548
  }
78274
- takeFromModel() {
78275
- return [{
78276
- model: true
78277
- }];
78549
+ getSections(node, requisite, requisiteMode = RequisiteSectionMode.AsRequisiteAttribute) {
78550
+ const page = node instanceof _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode ? node : node.findParentOfType(_markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode);
78551
+ const pageName = page === null || page === void 0 ? void 0 : page.id;
78552
+ const pageRequiresResolution = page != undefined && (page.multiple || Iterator.from(this.getAllParentPages(page)).some(x => {
78553
+ var _x$multiple;
78554
+ return (_x$multiple = x.multiple) !== null && _x$multiple !== void 0 ? _x$multiple : false;
78555
+ }));
78556
+ if (!(node instanceof _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__.PageNode)) {
78557
+ if (pageRequiresResolution) {
78558
+ return [{
78559
+ fn: `#getSectionFunction('${pageName}')#`
78560
+ }];
78561
+ }
78562
+ }
78563
+ const sections = pageName != undefined ? [pageName] : [];
78564
+ if (requisiteMode === RequisiteSectionMode.AsRequisiteAttribute) {
78565
+ if (requisite) {
78566
+ sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.requisitesSection);
78567
+ }
78568
+ }
78569
+ if (requisiteMode === RequisiteSectionMode.ForceAdd) {
78570
+ sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.requisitesSection);
78571
+ }
78572
+ sections.push(_Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__.SectionNames.defaultSection);
78573
+ return sections;
78278
78574
  }
78279
- takeFromFetchFunction(fetchFnName, fieldName) {
78280
- const fetchFn = this.fetchFunctions.getFetchFunction(fetchFnName, fieldName);
78281
- return [{
78282
- fn: fetchFn
78283
- }];
78575
+ buildNodeDataDeclaration(child, fieldNameToDeclInfo, nodeProcessor) {
78576
+ const controlConverterClass = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(child));
78577
+ if (controlConverterClass == undefined) {
78578
+ if (child instanceof _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.UnknownSugarNode && child.name === "type") {
78579
+ return emptyDataDeclarationCollection;
78580
+ }
78581
+ if (child instanceof _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.UnknownSugarNode) {
78582
+ const customControl = this.controlCustomizationContext.tryGetCustomRegularControl(child.name);
78583
+ if (customControl != undefined) {
78584
+ const hasBindingPath = customControl.properties.find(x => x.name === "path" && x.type === "bindingPath");
78585
+ return hasBindingPath ? this.addCustomControlPathDeclEntry(child, customControl) : emptyDataDeclarationCollection;
78586
+ }
78587
+ }
78588
+ const result = nodeProcessor === null || nodeProcessor === void 0 ? void 0 : nodeProcessor(child);
78589
+ if (result == undefined) {
78590
+ // eslint-disable-next-line no-console
78591
+ console.error(`Cannot process node of type ${(0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(child).name}`);
78592
+ return emptyDataDeclarationCollection;
78593
+ }
78594
+ return result;
78595
+ }
78596
+ const converter = new controlConverterClass(child);
78597
+ return converter.buildDataDeclaration(this);
78284
78598
  }
78285
- takeFromFetchFunctionIfExists(fetchFnName, fieldName) {
78286
- const fetchFn = this.fetchFunctions.getFetchFunction(fetchFnName, fieldName);
78287
- if (fetchFn) {
78288
- return [{
78289
- fn: fetchFn
78290
- }];
78599
+ addCustomControlPathDeclEntry(sugarNode, customControl) {
78600
+ const declEntry = {};
78601
+ declEntry["value"] = this.initSequenceFactory.dataValue(sugarNode, sugarNode.disabled);
78602
+ if (sugarNode.optional) {
78603
+ declEntry.optional = [true];
78291
78604
  }
78292
- return [];
78605
+ if (sugarNode.disabled) {
78606
+ declEntry.disabled = [true];
78607
+ }
78608
+ declEntry.section = this.getSections(sugarNode, sugarNode.requisite);
78609
+ return {
78610
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
78611
+ };
78293
78612
  }
78294
78613
  }
78295
78614
 
78296
78615
  /***/ }),
78297
78616
 
78298
- /***/ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts":
78299
- /*!****************************************************************!*\
78300
- !*** ./Generator/src/generators/DataSchema/DataSchemaUtils.ts ***!
78301
- \****************************************************************/
78617
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts":
78618
+ /*!**************************************************************************************************!*\
78619
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts ***!
78620
+ \**************************************************************************************************/
78302
78621
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78303
78622
 
78304
78623
  "use strict";
78305
78624
  __webpack_require__.r(__webpack_exports__);
78306
78625
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78307
- /* harmony export */ adjustPathMultiplicityComplex: () => (/* binding */ adjustPathMultiplicityComplex)
78626
+ /* harmony export */ DataDeclarationGenerationTimeHelper: () => (/* binding */ DataDeclarationGenerationTimeHelper)
78308
78627
  /* harmony export */ });
78309
78628
  /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78310
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
78311
- /* harmony import */ var _Common_ModelPath_ModelPathBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPathBuilder */ "./Common/ModelPath/ModelPathBuilder.ts");
78629
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78630
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78631
+ /* harmony import */ var _Common_ModelPath_Set_Set2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/ModelPath/Set/Set2 */ "./Common/ModelPath/Set/Set2.ts");
78312
78632
 
78313
78633
 
78314
78634
 
78315
- function adjustPathMultiplicityComplex(path, formSchemaRng, dataDeclarationHelper) {
78316
- const result = new _Common_ModelPath_ModelPathBuilder__WEBPACK_IMPORTED_MODULE_2__.ModelPathBuilder(true);
78317
- for (const pathToken of path.getPathParts()) {
78318
- if (_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isMultiToken(pathToken)) {
78319
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_1__.InvalidArgumentError("path");
78320
- }
78321
- result.append(pathToken);
78322
- if (dataDeclarationHelper.isNodeHasChildrenEntry(result.toPath().toLegacyPath())) {
78323
- result.append(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
78635
+
78636
+ class DataDeclarationGenerationTimeHelper {
78637
+ constructor(dataDeclaration) {
78638
+ this.dataDeclaration = void 0;
78639
+ this.dataDeclaration = dataDeclaration;
78640
+ }
78641
+ isErrorsAndWarningsCountRequired(targetPath) {
78642
+ var _this$getDataDeclarat, _this$getDataDeclarat2, _this$getDataDeclarat3;
78643
+ return (_this$getDataDeclarat = (_this$getDataDeclarat2 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat2 === void 0 ? void 0 : (_this$getDataDeclarat3 = _this$getDataDeclarat2.errorAndWarningCountRequired) === null || _this$getDataDeclarat3 === void 0 ? void 0 : _this$getDataDeclarat3[0]) !== null && _this$getDataDeclarat !== void 0 ? _this$getDataDeclarat : false;
78644
+ }
78645
+ hasMask(targetPath) {
78646
+ return this.getDataDeclarationEntry(targetPath) != undefined;
78647
+ }
78648
+ getMaxOccurs(nodePath) {
78649
+ var _this$getDataDeclarat4;
78650
+ return (_this$getDataDeclarat4 = this.getDataDeclarationEntry(nodePath)) === null || _this$getDataDeclarat4 === void 0 ? void 0 : _this$getDataDeclarat4.maxOccurs;
78651
+ }
78652
+ isNodeHasChildrenEntry(targetPath) {
78653
+ var _this$getDataDeclarat5;
78654
+ return ((_this$getDataDeclarat5 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat5 === void 0 ? void 0 : _this$getDataDeclarat5.children) != undefined;
78655
+ }
78656
+ isNodeHasAutoFlagEntry(targetPath) {
78657
+ const declEntry = this.getDataDeclarationEntry(targetPath);
78658
+ return declEntry !== undefined && "autoValue" in declEntry;
78659
+ }
78660
+ isNodeHasDisabledEntry(targetPath) {
78661
+ const declEntry = this.getDataDeclarationEntry(targetPath);
78662
+ return Boolean(declEntry === null || declEntry === void 0 ? void 0 : declEntry.disabled);
78663
+ }
78664
+ getDefaultValue(targetPath) {
78665
+ const declEntry = this.getDataDeclarationEntry(targetPath);
78666
+ const lastValue = declEntry !== undefined && "value" in declEntry && declEntry.value != undefined ? declEntry.value[declEntry.value.length - 1] : "";
78667
+ const returnDefaultValue = typeof lastValue === "string" ? lastValue : "";
78668
+ return returnDefaultValue;
78669
+ }
78670
+ isNodeOptional(targetPath) {
78671
+ var _this$getDataDeclarat6, _optionalValue$;
78672
+ const optionalValue = (_this$getDataDeclarat6 = this.getDataDeclarationEntry(targetPath)) === null || _this$getDataDeclarat6 === void 0 ? void 0 : _this$getDataDeclarat6.optional;
78673
+ return (_optionalValue$ = optionalValue === null || optionalValue === void 0 ? void 0 : optionalValue[0]) !== null && _optionalValue$ !== void 0 ? _optionalValue$ : false;
78674
+ }
78675
+ getDataDeclarationEntry(targetPath) {
78676
+ return this.dataDeclaration[(0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.convertToLegacyPath)(targetPath)];
78677
+ }
78678
+ getOptionalSections() {
78679
+ var _this$dataDeclaration, _this$dataDeclaration2;
78680
+ const anyPath = Object.keys(this.dataDeclaration)[0];
78681
+ if (anyPath == undefined) {
78682
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)();
78324
78683
  }
78684
+ const absolutePath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsolute)(anyPath);
78685
+ const root = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.first(absolutePath.getPathParts());
78686
+ return (_this$dataDeclaration = (_this$dataDeclaration2 = this.dataDeclaration[root !== null && root !== void 0 ? root : ""]) === null || _this$dataDeclaration2 === void 0 ? void 0 : _this$dataDeclaration2.optionalSections) !== null && _this$dataDeclaration !== void 0 ? _this$dataDeclaration : [];
78687
+ }
78688
+ getAllPathsBySection() {
78689
+ const unpackSectionNameFromFn = fnCode => {
78690
+ var _fnCode$match, _fnCode$match$groups;
78691
+ return (_fnCode$match = fnCode.match(/getSectionFunction\('(?<name>[\w\d_]+?)'\)/)) === null || _fnCode$match === void 0 ? void 0 : (_fnCode$match$groups = _fnCode$match.groups) === null || _fnCode$match$groups === void 0 ? void 0 : _fnCode$match$groups["name"];
78692
+ };
78693
+ const section2Path = Object.entries(this.dataDeclaration).map(current => {
78694
+ var _pathData$section;
78695
+ const path = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromMask)(current[0], _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
78696
+ const pathData = current[1];
78697
+ const allSections = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(((_pathData$section = pathData.section) !== null && _pathData$section !== void 0 ? _pathData$section : []).map(section => typeof section === "string" || Array.isArray(section) ? section : typeof section === "object" && "fn" in section && typeof section.fn === "string" ? unpackSectionNameFromFn(section.fn) : undefined).flat(1).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined).map(x => ({
78698
+ section: x,
78699
+ path: path
78700
+ })), x => x.section);
78701
+ return [...allSections];
78702
+ }).flat(1).reduce((acc, current) => {
78703
+ var _acc$get;
78704
+ const currentPaths = (_acc$get = acc.get(current.section)) !== null && _acc$get !== void 0 ? _acc$get : new _Common_ModelPath_Set_Set2__WEBPACK_IMPORTED_MODULE_3__.Set2();
78705
+ currentPaths.add(current.path);
78706
+ acc.set(current.section, currentPaths);
78707
+ return acc;
78708
+ }, new Map());
78709
+ return section2Path;
78325
78710
  }
78326
- return result.toPath().toAbsolute();
78327
78711
  }
78328
78712
 
78329
78713
  /***/ }),
78330
78714
 
78331
- /***/ "./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts":
78332
- /*!******************************************************************************!*\
78333
- !*** ./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts ***!
78334
- \******************************************************************************/
78715
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerator.ts":
78716
+ /*!***************************************************************************************!*\
78717
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerator.ts ***!
78718
+ \***************************************************************************************/
78335
78719
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78336
78720
 
78337
78721
  "use strict";
78338
78722
  __webpack_require__.r(__webpack_exports__);
78339
78723
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78340
- /* harmony export */ AttributeTypeKind: () => (/* binding */ AttributeTypeKind)
78724
+ /* harmony export */ DataDeclarationGenerator: () => (/* binding */ DataDeclarationGenerator)
78341
78725
  /* harmony export */ });
78342
- let AttributeTypeKind = /*#__PURE__*/function (AttributeTypeKind) {
78343
- AttributeTypeKind["Path"] = "Path";
78344
- AttributeTypeKind["VisibilityPath"] = "VisibilityPath";
78345
- AttributeTypeKind["Type"] = "Type";
78346
- AttributeTypeKind["String"] = "String";
78347
- AttributeTypeKind["Number"] = "Number";
78348
- AttributeTypeKind["Boolean"] = "Boolean";
78349
- AttributeTypeKind["FunctionName"] = "FunctionName";
78350
- AttributeTypeKind["CssClassName"] = "CssClassName";
78351
- AttributeTypeKind["PicklistId"] = "PicklistId";
78352
- AttributeTypeKind["JavaScriptLiteral"] = "JavaScriptLiteral";
78353
- AttributeTypeKind["Enum"] = "Enum";
78354
- AttributeTypeKind["Color"] = "Color";
78355
- AttributeTypeKind["PathList"] = "PathList";
78356
- AttributeTypeKind["TemplateParameterType"] = "TemplateParameterType";
78357
- return AttributeTypeKind;
78358
- }({});
78359
-
78360
- /***/ }),
78361
-
78362
- /***/ "./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts":
78363
- /*!***************************************************************************!*\
78364
- !*** ./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts ***!
78365
- \***************************************************************************/
78366
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78367
-
78368
- "use strict";
78369
- __webpack_require__.r(__webpack_exports__);
78370
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78371
- /* harmony export */ isFileExists: () => (/* binding */ isFileExists),
78372
- /* harmony export */ normalizeDocument: () => (/* binding */ normalizeDocument)
78373
- /* harmony export */ });
78374
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs");
78375
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
78376
- /* harmony import */ var _DocumentationTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DocumentationTypes */ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts");
78377
-
78726
+ /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serialize-javascript */ "./node_modules/serialize-javascript/index.js");
78727
+ /* harmony import */ var serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(serialize_javascript__WEBPACK_IMPORTED_MODULE_0__);
78728
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78729
+ /* harmony import */ var _common_SugarPathUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/SugarPathUtils */ "./Generator/src/common/SugarPathUtils.ts");
78730
+ /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
78731
+ /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
78732
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78733
+ /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
78734
+ /* harmony import */ var _placeholders__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./placeholders */ "./Generator/src/generators/DataDeclarationGenerator/placeholders.js");
78735
+ /* harmony import */ var _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DataDeclarationGenerationContext */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts");
78378
78736
 
78379
- function isFileExists(directoryPath) {
78380
- try {
78381
- const dirStat = (0,fs__WEBPACK_IMPORTED_MODULE_0__.statSync)(directoryPath);
78382
- return dirStat.isFile();
78383
- } catch (ignoreError) {
78384
- return false;
78385
- }
78386
- }
78387
- function normalizeDocument(documentJson) {
78388
- const availableChildren = documentJson.availableChildren != undefined ? documentJson.availableChildren : {
78389
- children: [],
78390
- singleChild: []
78391
- };
78392
- const document = {
78393
- ...documentJson,
78394
- availableChildren: availableChildren
78395
- };
78396
- if (documentJson.attributes != undefined) {
78397
- const attributes = documentJson.attributes.map(normalizeAttribute);
78398
- document.attributes = attributes;
78399
- }
78400
- return document;
78401
- }
78402
- function normalizeAttribute(attributeJson) {
78403
- var _attributeJson$valueT;
78404
- return {
78405
- shortMarkdownDescription: "--",
78406
- ...attributeJson,
78407
- valueTypes: (_attributeJson$valueT = attributeJson.valueTypes) !== null && _attributeJson$valueT !== void 0 ? _attributeJson$valueT : [_DocumentationTypes__WEBPACK_IMPORTED_MODULE_1__.AttributeTypes.String]
78408
- };
78409
- }
78410
78737
 
78411
- /***/ }),
78412
78738
 
78413
- /***/ "./Generator/src/generators/DocumentationGenerator/Documentation.ts":
78414
- /*!**************************************************************************!*\
78415
- !*** ./Generator/src/generators/DocumentationGenerator/Documentation.ts ***!
78416
- \**************************************************************************/
78417
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78418
78739
 
78419
- "use strict";
78420
- __webpack_require__.r(__webpack_exports__);
78421
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78422
- /* harmony export */ getDocuments: () => (/* binding */ getDocuments),
78423
- /* harmony export */ getMarkupDocuments: () => (/* binding */ getMarkupDocuments)
78424
- /* harmony export */ });
78425
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs");
78426
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
78427
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path");
78428
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
78429
- /* harmony import */ var _markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/SugarNodes/DefaultSugarSerializer */ "./Generator/src/generators/markupGenerator/SugarNodes/DefaultSugarSerializer.ts");
78430
- /* harmony import */ var _DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DocFileHelpers */ "./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts");
78431
- /* harmony import */ var _SugarNodeDocumentationGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SugarNodeDocumentationGenerator */ "./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts");
78432
78740
 
78433
78741
 
78434
78742
 
78435
78743
 
78436
78744
 
78437
- function getMarkupDocuments() {
78438
- const nodes = (0,_markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_2__.getAllSugarNodeClasses)();
78439
- return nodes.map(_SugarNodeDocumentationGenerator__WEBPACK_IMPORTED_MODULE_4__.buildSugarNodeDocumentation);
78440
- }
78441
- function getDocuments(documentsDirPath) {
78442
- const docsNames = (0,fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync)(documentsDirPath);
78443
- const documents = docsNames.filter(docName => (0,path__WEBPACK_IMPORTED_MODULE_1__.extname)(docName) === ".json").map(docsName => {
78444
- const docFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)(documentsDirPath, docsName);
78445
- const doc = (0,_DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__.isFileExists)(docFilePath) ? JSON.parse((0,fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(docFilePath, "utf8")) : undefined;
78446
- const markdownDescriptionFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)(documentsDirPath, `${(0,path__WEBPACK_IMPORTED_MODULE_1__.parse)(docsName).name}.md`);
78447
- const markdownDescription = (0,_DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__.isFileExists)(markdownDescriptionFilePath) ? {
78448
- markdownDescription: (0,fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(markdownDescriptionFilePath, "utf8")
78449
- } : {};
78745
+ class DataDeclarationGenerator {
78746
+ constructor(sugarRoot, initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
78747
+ this.sugarRoot = void 0;
78748
+ this.initSequenceFactory = void 0;
78749
+ this.formSchemaRng = void 0;
78750
+ this.schemeValidations = void 0;
78751
+ this.controlCustomizationContext = void 0;
78752
+ this.typesRegistry = void 0;
78753
+ this.formSchemaRng = formSchemaRng;
78754
+ this.schemeValidations = schemeValidations;
78755
+ this.sugarRoot = sugarRoot;
78756
+ this.initSequenceFactory = initSequenceFactory;
78757
+ this.controlCustomizationContext = controlCustomizationContext;
78758
+ this.typesRegistry = typesRegistry;
78759
+ }
78760
+ generate() {
78761
+ var _getConverterByNodeCl;
78762
+ const converterClass = (_getConverterByNodeCl = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl !== void 0 ? _getConverterByNodeCl : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
78763
+ const converter = new converterClass(this.sugarRoot);
78764
+ const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry, this.formSchemaRng, this.schemeValidations);
78765
+ const dataDeclaration = converter.buildDataDeclaration(context);
78766
+ this.enrichWithSchemaRng(dataDeclaration);
78767
+ const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
78768
+ const result = this.replaceHolder(`
78769
+ export default function dataDeclaration({
78770
+ Helpers: {
78771
+ autocalcCommonFunctions: {
78772
+ getAsyncResultHandler,
78773
+ getAsyncTextResultHandler,
78774
+ wrapDecimalOperand,
78775
+ getSum,
78776
+ checkValuesArguments,
78777
+ getAsyncBoolResultHandler,
78778
+ getAsyncErrorResultHandler,
78779
+ getOperands,
78780
+ Deferred,
78781
+ },
78782
+ },
78783
+ }) {
78784
+ return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
78785
+ space: " "
78786
+ })};
78787
+ };`);
78450
78788
  return {
78451
- ...doc,
78452
- ...markdownDescription
78789
+ dataDeclarationContent: unescape(result.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2")),
78790
+ dataDeclaration: orderedDataDeclaration
78453
78791
  };
78454
- });
78455
- return documents;
78792
+ }
78793
+ enrichWithSchemaRng(dataDeclaration) {
78794
+ const elementEntries = Iterator.from(this.formSchemaRng.getAllChildren(this.formSchemaRng.getRootElement())).map(x => ({
78795
+ element: x,
78796
+ legacyPath: this.formSchemaRng.getPath(x).trimLastStarIfLastToken().toLegacyPath()
78797
+ }));
78798
+ for (const item of elementEntries) {
78799
+ var _dataDeclaration$item;
78800
+ const entry = item.element;
78801
+ const declarationEntry = (_dataDeclaration$item = dataDeclaration[item.legacyPath]) !== null && _dataDeclaration$item !== void 0 ? _dataDeclaration$item : {};
78802
+ if (entry instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_6__.FormSchemaRngElement && entry.errorAndWarningCountRequired != undefined) {
78803
+ declarationEntry.errorAndWarningCountRequired = [entry.errorAndWarningCountRequired];
78804
+ }
78805
+ if (entry.disableValueAutoInit != undefined) {
78806
+ declarationEntry.disableValueAutoInit = entry.disableValueAutoInit;
78807
+ }
78808
+ }
78809
+ }
78810
+ generateDataDeclarationFactory() {
78811
+ var _getConverterByNodeCl2;
78812
+ const converterClass = (_getConverterByNodeCl2 = (0,_markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_4__.getConverterByNodeClass)((0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__.getNodeClass)(this.sugarRoot))) !== null && _getConverterByNodeCl2 !== void 0 ? _getConverterByNodeCl2 : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.reject)();
78813
+ const converter = new converterClass(this.sugarRoot);
78814
+ const context = new _DataDeclarationGenerationContext__WEBPACK_IMPORTED_MODULE_8__.DataDeclarationGenerationContext(this.initSequenceFactory, this.controlCustomizationContext, this.typesRegistry, this.formSchemaRng, this.schemeValidations);
78815
+ const dataDeclaration = converter.buildDataDeclaration(context);
78816
+ const orderedDataDeclaration = this.sortDataDeclarationKeys(dataDeclaration);
78817
+ return `
78818
+ function dataDeclaration({
78819
+ Helpers: {
78820
+ autocalcCommonFunctions: {
78821
+ getAsyncResultHandler,
78822
+ getAsyncTextResultHandler,
78823
+ wrapDecimalOperand,
78824
+ getSum,
78825
+ checkValuesArguments,
78826
+ getAsyncBoolResultHandler,
78827
+ getAsyncErrorResultHandler,
78828
+ getOperands,
78829
+ Deferred,
78830
+ },
78831
+ },
78832
+ }) {
78833
+ return ${serialize_javascript__WEBPACK_IMPORTED_MODULE_0___default()(orderedDataDeclaration, {
78834
+ space: " "
78835
+ })};
78836
+ }`;
78837
+ }
78838
+ sortDataDeclarationKeys(dataDeclaration) {
78839
+ const orderedDecl = {};
78840
+ const orderedPaths = Object.keys(dataDeclaration).sort(_common_SugarPathUtils__WEBPACK_IMPORTED_MODULE_2__.SugarPathUtils.compare);
78841
+ for (const filePath of orderedPaths) {
78842
+ orderedDecl[filePath] = dataDeclaration[filePath];
78843
+ }
78844
+ return orderedDecl;
78845
+ }
78846
+ replaceHolder(decl) {
78847
+ let replacedDecl = decl;
78848
+ for (const [placeholderName, placeHoldersFunction] of (0,_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.iterateEntries)(_placeholders__WEBPACK_IMPORTED_MODULE_7__.placeHolders)) {
78849
+ const checkName = `"#(${placeholderName})(\\('[\\w]*'\\))?#"`;
78850
+ const include = new RegExp(checkName, "i");
78851
+ if (include.test(replacedDecl)) {
78852
+ const regex = new RegExp(checkName, "g");
78853
+ replacedDecl = replacedDecl.replace(regex, "$1$2");
78854
+ replacedDecl = replacedDecl + placeHoldersFunction.toString();
78855
+ }
78856
+ }
78857
+ return replacedDecl;
78858
+ }
78456
78859
  }
78457
78860
 
78458
78861
  /***/ }),
78459
78862
 
78460
- /***/ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts":
78461
- /*!*******************************************************************************!*\
78462
- !*** ./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts ***!
78463
- \*******************************************************************************/
78863
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts":
78864
+ /*!*******************************************************************************************************!*\
78865
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts ***!
78866
+ \*******************************************************************************************************/
78464
78867
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78465
78868
 
78466
78869
  "use strict";
78467
78870
  __webpack_require__.r(__webpack_exports__);
78468
78871
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78469
- /* harmony export */ AttributeTypes: () => (/* binding */ AttributeTypes),
78470
- /* harmony export */ AvailableChildrenType: () => (/* binding */ AvailableChildrenType),
78471
- /* harmony export */ isRequiredValueParser: () => (/* binding */ isRequiredValueParser),
78472
- /* harmony export */ valueParserToAttributeType: () => (/* binding */ valueParserToAttributeType)
78872
+ /* harmony export */ DataDeclarationInitSourceSequenceFactory: () => (/* binding */ DataDeclarationInitSourceSequenceFactory)
78473
78873
  /* harmony export */ });
78474
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_ArrayValueParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/ArrayValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/ArrayValueParser.ts");
78475
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_BooleanValueParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/BooleanValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/BooleanValueParser.ts");
78476
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_DefaultWrapperValueParser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/DefaultWrapperValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/DefaultWrapperValueParser.ts");
78477
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_DelimitedStringArrayValueParser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/DelimitedStringArrayValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/DelimitedStringArrayValueParser.ts");
78478
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_EnumValueParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/EnumValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/EnumValueParser.ts");
78479
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_InlineStyleValueParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/InlineStyleValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/InlineStyleValueParser.ts");
78480
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_LengthUnitValueParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/LengthUnitValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/LengthUnitValueParser.ts");
78481
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_LocalizedStringValueParser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/LocalizedStringValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/LocalizedStringValueParser.ts");
78482
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_NumberValueParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/NumberValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/NumberValueParser.ts");
78483
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_ObjectValueParser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/ObjectValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/ObjectValueParser.ts");
78484
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/RequiredWrapperValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/RequiredWrapperValueParser.ts");
78485
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_StringValueParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/StringValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/StringValueParser.ts");
78486
- /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
78487
- /* harmony import */ var _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./AttributeTypeKind */ "./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts");
78488
-
78489
-
78490
-
78491
-
78492
-
78493
-
78494
-
78495
-
78496
-
78497
-
78498
-
78499
-
78500
-
78501
-
78502
- let AvailableChildrenType = /*#__PURE__*/function (AvailableChildrenType) {
78503
- AvailableChildrenType["NoChildren"] = "NoChildren";
78504
- AvailableChildrenType["Any"] = "Any";
78505
- AvailableChildrenType["TextOnly"] = "TextOnly";
78506
- AvailableChildrenType["List"] = "List";
78507
- return AvailableChildrenType;
78508
- }({});
78509
- class AttributeTypes {}
78510
- AttributeTypes.Path = {
78511
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Path
78512
- };
78513
- AttributeTypes.VisibilityPath = {
78514
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.VisibilityPath
78515
- };
78516
- AttributeTypes.Type = {
78517
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Type
78518
- };
78519
- AttributeTypes.String = {
78520
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.String
78521
- };
78522
- AttributeTypes.Number = {
78523
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Number
78524
- };
78525
- AttributeTypes.Boolean = {
78526
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Boolean
78527
- };
78528
- AttributeTypes.FunctionName = {
78529
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.FunctionName
78530
- };
78531
- AttributeTypes.CssClassName = {
78532
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.CssClassName
78533
- };
78534
- AttributeTypes.PicklistId = {
78535
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.PicklistId
78536
- };
78537
- AttributeTypes.JavaScriptLiteral = {
78538
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.JavaScriptLiteral
78539
- };
78540
- AttributeTypes.Color = {
78541
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Color
78542
- };
78543
- AttributeTypes.PathList = {
78544
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.PathList
78545
- };
78546
- AttributeTypes.TemplateParameterType = {
78547
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.TemplateParameterType
78548
- };
78549
- function isRequiredValueParser(valueParser) {
78550
- return valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__.RequiredWrapperValueParser;
78551
- }
78552
- function valueParserToAttributeType(valueParser) {
78553
- if (valueParser === _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__.attrType.bindingPath) {
78554
- return [AttributeTypes.Path];
78555
- }
78556
- if (valueParser === _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__.attrType.typeName) {
78557
- return [AttributeTypes.Type];
78558
- }
78559
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_ArrayValueParser__WEBPACK_IMPORTED_MODULE_0__.ArrayValueParser) {
78560
- return [AttributeTypes.String, AttributeTypes.JavaScriptLiteral];
78874
+ class DataDeclarationInitSourceSequenceFactory {
78875
+ constructor(fetchFunctions) {
78876
+ this.fetchFunctions = void 0;
78877
+ this.fetchFunctions = fetchFunctions;
78561
78878
  }
78562
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_BooleanValueParser__WEBPACK_IMPORTED_MODULE_1__.BooleanValueParser) {
78563
- return [AttributeTypes.Boolean];
78879
+ dataValue(node, disabled, defaultValue) {
78880
+ var _ref3;
78881
+ if (node.settings) {
78882
+ var _ref;
78883
+ return [...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.takeFromModel(), ...this.setValueUnconditionally((_ref = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref !== void 0 ? _ref : "")];
78884
+ }
78885
+ if (disabled) {
78886
+ var _ref2;
78887
+ return [...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.setValueUnconditionally((_ref2 = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref2 !== void 0 ? _ref2 : "")];
78888
+ }
78889
+ return [...this.takeFromModel(), ...this.takeFromFetchFunctionIfExists(node.fetchfn, "value"), ...this.setValueUnconditionally((_ref3 = defaultValue !== null && defaultValue !== void 0 ? defaultValue : node.defaultValue) !== null && _ref3 !== void 0 ? _ref3 : "")];
78564
78890
  }
78565
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_DefaultWrapperValueParser__WEBPACK_IMPORTED_MODULE_2__.DefaultWrapperValueParser) {
78566
- return valueParserToAttributeType(valueParser.innerValueParser);
78891
+ takeFromFetchFunctionOrDefault(fetchFnName, fieldName, defaultValue) {
78892
+ return [...this.takeFromFetchFunction(fetchFnName, fieldName), ...this.setValueUnconditionally(defaultValue !== null && defaultValue !== void 0 ? defaultValue : "")];
78567
78893
  }
78568
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_DelimitedStringArrayValueParser__WEBPACK_IMPORTED_MODULE_3__.DelimitedStringArrayValueParser) {
78569
- return [AttributeTypes.String];
78894
+ takeFromModelOrDefaultValue(defaultValue) {
78895
+ return [...this.takeFromModel(), ...this.setValueUnconditionally(defaultValue !== null && defaultValue !== void 0 ? defaultValue : "")];
78570
78896
  }
78571
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_EnumValueParser__WEBPACK_IMPORTED_MODULE_4__.EnumValueParser) {
78572
- return [{
78573
- type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Enum,
78574
- values: valueParser.values
78575
- }];
78897
+ children(optional, defaultChildren) {
78898
+ return [...this.takeFromModel(), ...this.setValueUnconditionally(defaultChildren !== null && defaultChildren !== void 0 ? defaultChildren : optional ? [] : ["0"])];
78576
78899
  }
78577
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_InlineStyleValueParser__WEBPACK_IMPORTED_MODULE_5__.InlineStyleValueParser) {
78578
- return [AttributeTypes.JavaScriptLiteral];
78900
+ takeFromModelOrFetchFn(fieldName, fetchFnName) {
78901
+ return [...this.takeFromModel(), ...this.takeFromFetchFunctionIfExists(fetchFnName, fieldName)];
78579
78902
  }
78580
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_LengthUnitValueParser__WEBPACK_IMPORTED_MODULE_6__.LengthUnitValueParser) {
78581
- return [AttributeTypes.Number, AttributeTypes.String];
78903
+ disabled() {
78904
+ return [...this.takeFromModel(), ...this.setValueUnconditionally(false)];
78582
78905
  }
78583
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_LocalizedStringValueParser__WEBPACK_IMPORTED_MODULE_7__.LocalizedStringValueParser) {
78584
- return [AttributeTypes.String];
78906
+ visible() {
78907
+ return [...this.takeFromModel(), ...this.setValueUnconditionally(true)];
78585
78908
  }
78586
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_NumberValueParser__WEBPACK_IMPORTED_MODULE_8__.NumberValueParser) {
78587
- return [AttributeTypes.Number];
78909
+ setValueUnconditionally(value) {
78910
+ return [value];
78588
78911
  }
78589
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_ObjectValueParser__WEBPACK_IMPORTED_MODULE_9__.ObjectValueParser) {
78590
- return [AttributeTypes.JavaScriptLiteral];
78912
+ takeFromModel() {
78913
+ return [{
78914
+ model: true
78915
+ }];
78591
78916
  }
78592
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__.RequiredWrapperValueParser) {
78593
- return valueParserToAttributeType(valueParser.innerValueParser);
78917
+ takeFromFetchFunction(fetchFnName, fieldName) {
78918
+ const fetchFn = this.fetchFunctions.getFetchFunction(fetchFnName, fieldName);
78919
+ return [{
78920
+ fn: fetchFn
78921
+ }];
78594
78922
  }
78595
- if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_StringValueParser__WEBPACK_IMPORTED_MODULE_11__.StringValueParser) {
78596
- return [AttributeTypes.String];
78923
+ takeFromFetchFunctionIfExists(fetchFnName, fieldName) {
78924
+ const fetchFn = this.fetchFunctions.getFetchFunction(fetchFnName, fieldName);
78925
+ if (fetchFn) {
78926
+ return [{
78927
+ fn: fetchFn
78928
+ }];
78929
+ }
78930
+ return [];
78597
78931
  }
78598
- return [AttributeTypes.String];
78599
78932
  }
78600
78933
 
78601
78934
  /***/ }),
78602
78935
 
78603
- /***/ "./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts":
78604
- /*!********************************************************************************************!*\
78605
- !*** ./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts ***!
78606
- \********************************************************************************************/
78936
+ /***/ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts":
78937
+ /*!****************************************************************!*\
78938
+ !*** ./Generator/src/generators/DataSchema/DataSchemaUtils.ts ***!
78939
+ \****************************************************************/
78607
78940
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78608
78941
 
78609
78942
  "use strict";
78610
78943
  __webpack_require__.r(__webpack_exports__);
78611
78944
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78612
- /* harmony export */ buildSugarNodeDocumentation: () => (/* binding */ buildSugarNodeDocumentation)
78945
+ /* harmony export */ adjustPathMultiplicityComplex: () => (/* binding */ adjustPathMultiplicityComplex)
78613
78946
  /* harmony export */ });
78614
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78615
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78616
- /* harmony import */ var _common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/RequireContext/LoadDocumentationFileFormContext */ "./Generator/src/common/RequireContext/LoadDocumentationFileFormContext.ts");
78617
- /* harmony import */ var _markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/ClassMetadataAccess */ "./Generator/src/generators/markupGenerator/Serializer/ClassMetadataAccess.ts");
78618
- /* harmony import */ var _markupGenerator_Serializer_Properties_MixinPropertyDeserializer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/MixinPropertyDeserializer */ "./Generator/src/generators/markupGenerator/Serializer/Properties/MixinPropertyDeserializer.ts");
78619
- /* harmony import */ var _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/SinglePropertyDeserializer */ "./Generator/src/generators/markupGenerator/Serializer/Properties/SinglePropertyDeserializer.ts");
78620
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_AttributeValueSource__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/AttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/AttributeValueSource.ts");
78621
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_SkipAttributeValueSource__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/SkipAttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/SkipAttributeValueSource.ts");
78622
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_MarkupOrAttributeValueSource__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/MarkupOrAttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/MarkupOrAttributeValueSource.ts");
78623
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_ChildrenNodesValueSource__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/ChildrenNodesValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/ChildrenNodesValueSource.ts");
78624
- /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_SingleChildValueSource__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/SingleChildValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/SingleChildValueSource.ts");
78625
- /* harmony import */ var _DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./DocumentationTypes */ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts");
78626
-
78947
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78948
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
78949
+ /* harmony import */ var _Common_ModelPath_ModelPathBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPathBuilder */ "./Common/ModelPath/ModelPathBuilder.ts");
78627
78950
 
78628
78951
 
78629
78952
 
78953
+ function adjustPathMultiplicityComplex(path, formSchemaRng, dataDeclarationHelper) {
78954
+ const result = new _Common_ModelPath_ModelPathBuilder__WEBPACK_IMPORTED_MODULE_2__.ModelPathBuilder(true);
78955
+ for (const pathToken of path.getPathParts()) {
78956
+ if (_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isMultiToken(pathToken)) {
78957
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_1__.InvalidArgumentError("path");
78958
+ }
78959
+ result.append(pathToken);
78960
+ if (dataDeclarationHelper.isNodeHasChildrenEntry(result.toPath().toLegacyPath())) {
78961
+ result.append(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
78962
+ }
78963
+ }
78964
+ return result.toPath().toAbsolute();
78965
+ }
78630
78966
 
78967
+ /***/ }),
78631
78968
 
78969
+ /***/ "./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts":
78970
+ /*!******************************************************************************!*\
78971
+ !*** ./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts ***!
78972
+ \******************************************************************************/
78973
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78632
78974
 
78975
+ "use strict";
78976
+ __webpack_require__.r(__webpack_exports__);
78977
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78978
+ /* harmony export */ AttributeTypeKind: () => (/* binding */ AttributeTypeKind)
78979
+ /* harmony export */ });
78980
+ let AttributeTypeKind = /*#__PURE__*/function (AttributeTypeKind) {
78981
+ AttributeTypeKind["Path"] = "Path";
78982
+ AttributeTypeKind["VisibilityPath"] = "VisibilityPath";
78983
+ AttributeTypeKind["Type"] = "Type";
78984
+ AttributeTypeKind["String"] = "String";
78985
+ AttributeTypeKind["Number"] = "Number";
78986
+ AttributeTypeKind["Boolean"] = "Boolean";
78987
+ AttributeTypeKind["FunctionName"] = "FunctionName";
78988
+ AttributeTypeKind["CssClassName"] = "CssClassName";
78989
+ AttributeTypeKind["PicklistId"] = "PicklistId";
78990
+ AttributeTypeKind["JavaScriptLiteral"] = "JavaScriptLiteral";
78991
+ AttributeTypeKind["Enum"] = "Enum";
78992
+ AttributeTypeKind["Color"] = "Color";
78993
+ AttributeTypeKind["PathList"] = "PathList";
78994
+ AttributeTypeKind["TemplateParameterType"] = "TemplateParameterType";
78995
+ return AttributeTypeKind;
78996
+ }({});
78633
78997
 
78998
+ /***/ }),
78634
78999
 
79000
+ /***/ "./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts":
79001
+ /*!***************************************************************************!*\
79002
+ !*** ./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts ***!
79003
+ \***************************************************************************/
79004
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78635
79005
 
79006
+ "use strict";
79007
+ __webpack_require__.r(__webpack_exports__);
79008
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79009
+ /* harmony export */ isFileExists: () => (/* binding */ isFileExists),
79010
+ /* harmony export */ normalizeDocument: () => (/* binding */ normalizeDocument)
79011
+ /* harmony export */ });
79012
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs");
79013
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
79014
+ /* harmony import */ var _DocumentationTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DocumentationTypes */ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts");
78636
79015
 
78637
79016
 
78638
- function getMarkdownDescription(documentationFilesContext, metadata, sugarNodeClass) {
78639
- if (documentationFilesContext == undefined) {
78640
- return undefined;
79017
+ function isFileExists(directoryPath) {
79018
+ try {
79019
+ const dirStat = (0,fs__WEBPACK_IMPORTED_MODULE_0__.statSync)(directoryPath);
79020
+ return dirStat.isFile();
79021
+ } catch (ignoreError) {
79022
+ return false;
78641
79023
  }
78642
- const descriptions = [(0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, "description.md"), (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, metadata.sugarNodeName + ".md"), (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, sugarNodeClass.name + ".md")];
78643
- return _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.first(descriptions.filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined));
78644
79024
  }
78645
- function buildSugarNodeDocumentation(sugarNodeClass) {
78646
- const metadata = (0,_markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__.getSugarNodeMetadata)(sugarNodeClass);
78647
- const propertySerializers = (0,_markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__.getPropertyDeserializers)(sugarNodeClass);
78648
- const documentationFilesContext = metadata.documentationFilesContext;
78649
- const example = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, "example.md");
78650
- const markdownDescription = getMarkdownDescription(documentationFilesContext, metadata, sugarNodeClass);
78651
- const {
78652
- markupAttributes,
78653
- attributes
78654
- } = buildMarkupAndAttributesInfo(propertySerializers, documentationFilesContext);
78655
- const {
78656
- children,
78657
- singleChild,
78658
- availableAnyChildren
78659
- } = buildAvailableChildrenInfo(propertySerializers, documentationFilesContext);
79025
+ function normalizeDocument(documentJson) {
79026
+ const availableChildren = documentJson.availableChildren != undefined ? documentJson.availableChildren : {
79027
+ children: [],
79028
+ singleChild: []
79029
+ };
79030
+ const document = {
79031
+ ...documentJson,
79032
+ availableChildren: availableChildren
79033
+ };
79034
+ if (documentJson.attributes != undefined) {
79035
+ const attributes = documentJson.attributes.map(normalizeAttribute);
79036
+ document.attributes = attributes;
79037
+ }
79038
+ return document;
79039
+ }
79040
+ function normalizeAttribute(attributeJson) {
79041
+ var _attributeJson$valueT;
78660
79042
  return {
78661
- name: metadata.sugarNodeName.toLowerCase(),
78662
- availableChildren: {
78663
- children: children,
78664
- singleChild: singleChild,
78665
- availableAnyChildren: availableAnyChildren
78666
- },
78667
- example: example,
78668
- shortMarkdownDescription: metadata.description,
78669
- markdownDescription: markdownDescription,
78670
- attributes: attributes,
78671
- markupAttributes: markupAttributes
79043
+ shortMarkdownDescription: "--",
79044
+ ...attributeJson,
79045
+ valueTypes: (_attributeJson$valueT = attributeJson.valueTypes) !== null && _attributeJson$valueT !== void 0 ? _attributeJson$valueT : [_DocumentationTypes__WEBPACK_IMPORTED_MODULE_1__.AttributeTypes.String]
78672
79046
  };
78673
79047
  }
78674
- function buildAvailableChildrenInfo(propertySerializers, documentationFilesContext) {
78675
- if (propertySerializers.length === 0) {
78676
- return {
78677
- children: [],
78678
- singleChild: []
78679
- };
78680
- }
78681
- const children = propertySerializers.map(x => buildAvailableChildrenDocs(x, documentationFilesContext)).flat();
78682
- const singleChild = propertySerializers.map(x => buildAvailableSingleChildDocs(x, documentationFilesContext)).flat();
78683
- const availableAnyChildren = propertySerializers.map(x => buildAvailableSugarChildrenDocs(x, documentationFilesContext)).some(x => x === true);
78684
- return {
78685
- children: children,
78686
- singleChild: singleChild,
78687
- availableAnyChildren: availableAnyChildren
78688
- };
78689
- }
78690
- function buildAvailableChildrenDocs(propertyDeserializer, documentationFilesContext) {
78691
- if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
78692
- return [];
78693
- }
78694
- if (propertyDeserializer.propertyName === "children") {
78695
- return [];
78696
- }
78697
- if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_ChildrenNodesValueSource__WEBPACK_IMPORTED_MODULE_9__.ChildrenNodesValueSource) {
78698
- const childrenNodes = propertyDeserializer.valueSource.nodeClasses.map(buildSugarNodeDocumentation);
78699
- return childrenNodes;
78700
- }
78701
- return [];
78702
- }
78703
- function buildAvailableSugarChildrenDocs(propertyDeserializer, documentationFilesContext) {
78704
- if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
78705
- return false;
78706
- }
78707
- if (propertyDeserializer.propertyName === "children") {
78708
- return true;
78709
- }
78710
- return false;
78711
- }
78712
- function buildAvailableSingleChildDocs(propertyDeserializer, documentationFilesContext) {
78713
- if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
78714
- return [];
78715
- }
78716
- if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_SingleChildValueSource__WEBPACK_IMPORTED_MODULE_10__.SingleChildValueSource) {
78717
- const childrenNodes = propertyDeserializer.valueSource.nodeClasses.map(buildSugarNodeDocumentation);
78718
- return childrenNodes;
78719
- }
78720
- return [];
78721
- }
78722
- function buildMarkupAndAttributesInfo(propertySerializers, documentationFilesContext) {
78723
- if (propertySerializers.length === 0) {
78724
- return {
78725
- attributes: [],
78726
- markupAttributes: []
78727
- };
78728
- }
78729
- const attributes = propertySerializers.map(x => buildAttributeDocs(x, documentationFilesContext)).flat();
78730
- const markupAttributes = propertySerializers.map(x => buildMarkupAttributeDocs(x, documentationFilesContext)).flat();
78731
- return {
78732
- attributes: attributes,
78733
- markupAttributes: markupAttributes
78734
- };
78735
- }
78736
- function buildMarkupAttributeDocs(propertyDeserializer, documentationFilesContext) {
78737
- if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
78738
- return [];
78739
- }
78740
- if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_MarkupOrAttributeValueSource__WEBPACK_IMPORTED_MODULE_8__.MarkupOrAttributeValueSource) {
78741
- var _propertyDeserializer;
78742
- let markdownDescription = "";
78743
- if (documentationFilesContext != undefined) {
78744
- markdownDescription = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, `${propertyDeserializer.valueSource.attrName}.attr.md`);
78745
- }
78746
- return [{
78747
- name: propertyDeserializer.valueSource.attrName,
78748
- valueTypes: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.valueParserToAttributeType)(propertyDeserializer.valueSource.valueParser),
78749
- shortMarkdownDescription: (_propertyDeserializer = propertyDeserializer.propertyDescription) !== null && _propertyDeserializer !== void 0 ? _propertyDeserializer : "--",
78750
- markdownDescription: markdownDescription,
78751
- defaultValue: undefined,
78752
- required: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.isRequiredValueParser)(propertyDeserializer.valueSource.valueParser),
78753
- deprecated: false
78754
- }];
78755
- }
78756
- return [];
78757
- }
78758
- function buildAttributeDocs(propertyDeserializer, documentationFilesContext) {
78759
- if (propertyDeserializer instanceof _markupGenerator_Serializer_Properties_MixinPropertyDeserializer__WEBPACK_IMPORTED_MODULE_4__.MixinPropertyDeserializer) {
78760
- return propertyDeserializer.getPropertyDeserializers().map(x => buildAttributeDocs(x, documentationFilesContext)).flat();
78761
- }
78762
- if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
78763
- return [];
78764
- }
78765
- if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_AttributeValueSource__WEBPACK_IMPORTED_MODULE_6__.AttributeValueSource) {
78766
- var _propertyDeserializer2;
78767
- let markdownDescription = "";
78768
- if (documentationFilesContext != undefined) {
78769
- markdownDescription = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, `${propertyDeserializer.valueSource.attrName}.attr.md`);
78770
- }
78771
- return [{
78772
- name: propertyDeserializer.valueSource.attrName,
78773
- valueTypes: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.valueParserToAttributeType)(propertyDeserializer.valueSource.valueParser),
78774
- shortMarkdownDescription: (_propertyDeserializer2 = propertyDeserializer.propertyDescription) !== null && _propertyDeserializer2 !== void 0 ? _propertyDeserializer2 : "--",
78775
- markdownDescription: markdownDescription,
78776
- defaultValue: undefined,
78777
- required: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.isRequiredValueParser)(propertyDeserializer.valueSource.valueParser),
78778
- deprecated: false
78779
- }];
78780
- }
78781
- if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_SkipAttributeValueSource__WEBPACK_IMPORTED_MODULE_7__.SkipAttributeValueSource) {
78782
- return [{
78783
- name: propertyDeserializer.propertyName,
78784
- valueTypes: [],
78785
- shortMarkdownDescription: "DEPRECATED",
78786
- markdownDescription: "DEPRECATED",
78787
- defaultValue: undefined,
78788
- required: undefined,
78789
- deprecated: true
78790
- }];
78791
- }
78792
- return [];
78793
- }
78794
79048
 
78795
79049
  /***/ }),
78796
79050
 
78797
- /***/ "./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts":
78798
- /*!***************************************************************************!*\
78799
- !*** ./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts ***!
78800
- \***************************************************************************/
79051
+ /***/ "./Generator/src/generators/DocumentationGenerator/Documentation.ts":
79052
+ /*!**************************************************************************!*\
79053
+ !*** ./Generator/src/generators/DocumentationGenerator/Documentation.ts ***!
79054
+ \**************************************************************************/
78801
79055
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78802
79056
 
78803
79057
  "use strict";
78804
79058
  __webpack_require__.r(__webpack_exports__);
78805
79059
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78806
- /* harmony export */ FormSourcesBuilder: () => (/* binding */ FormSourcesBuilder)
79060
+ /* harmony export */ getDocuments: () => (/* binding */ getDocuments),
79061
+ /* harmony export */ getMarkupDocuments: () => (/* binding */ getMarkupDocuments)
78807
79062
  /* harmony export */ });
78808
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ "path");
78809
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
78810
- /* harmony import */ var _GetWebEntry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GetWebEntry */ "./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts");
78811
- /* harmony import */ var _GetWebJsContent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GetWebJsContent */ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts");
79063
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs");
79064
+ /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
79065
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path");
79066
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
79067
+ /* harmony import */ var _markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/SugarNodes/DefaultSugarSerializer */ "./Generator/src/generators/markupGenerator/SugarNodes/DefaultSugarSerializer.ts");
79068
+ /* harmony import */ var _DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DocFileHelpers */ "./Generator/src/generators/DocumentationGenerator/DocFileHelpers.ts");
79069
+ /* harmony import */ var _SugarNodeDocumentationGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SugarNodeDocumentationGenerator */ "./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts");
78812
79070
 
78813
79071
 
78814
79072
 
78815
- class FormSourcesBuilder {
78816
- constructor(formSourcesPath) {
78817
- this.resources = new Map();
78818
- this.serverSideResources = new Map();
78819
- this.components = new Map();
78820
- this.formSourcesPath = void 0;
78821
- this.formSourcesPath = formSourcesPath;
78822
- }
78823
- resolveAbsolutePath(fromPath, toPath) {
78824
- return path__WEBPACK_IMPORTED_MODULE_0__.relative(path__WEBPACK_IMPORTED_MODULE_0__.join(this.formSourcesPath, fromPath), toPath);
78825
- }
78826
- addComponent(pathToComponent, content) {
78827
- this.components.set(pathToComponent, content);
78828
- }
78829
- addResource(pathToResource, content) {
78830
- this.resources.set(pathToResource, content);
78831
- }
78832
- addServerSideResource(pathToResource, content) {
78833
- this.serverSideResources.set(pathToResource, content);
78834
- }
78835
- buildSources(gfv, resourcesHash) {
78836
- const formContent = {};
78837
- formContent["web.js"] = (0,_GetWebJsContent__WEBPACK_IMPORTED_MODULE_2__.getWebJsContent)();
78838
- formContent["webEntry.js"] = (0,_GetWebEntry__WEBPACK_IMPORTED_MODULE_1__.getWebEntry)(gfv, resourcesHash);
78839
- for (const [filename, content] of this.serverSideResources.entries()) {
78840
- formContent[filename] = content;
78841
- }
78842
- for (const [filename, content] of this.resources.entries()) {
78843
- formContent["resources/" + filename] = content;
78844
- }
78845
- for (const [filePath, content] of this.components.entries()) {
78846
- formContent["components/" + filePath] = content;
78847
- }
78848
- const resourcesExports = this.buildResourcesExports();
78849
- formContent["resources/index.js"] = resourcesExports;
78850
- const componentsExports = this.buildComponentsExports();
78851
- formContent["components/index.js"] = componentsExports;
78852
- return formContent;
78853
- }
78854
- buildComponentsExports() {
78855
- const componentsReExports = [];
78856
- for (const [filePath] of this.components.entries()) {
78857
- if (filePath.endsWith(".jsx")) {
78858
- const [componentName, filename = ""] = filePath.split("/");
78859
- if (componentName === filename.replace(".jsx", "")) {
78860
- componentsReExports.push(`export ${componentName} from './${componentName}'`);
78861
- }
78862
- }
78863
- }
78864
- return componentsReExports.join("\n") + "\n";
78865
- }
78866
- buildResourcesExports() {
78867
- const resourcesImports = [];
78868
- const resourcesExports = [];
78869
- for (const [filename] of this.resources.entries()) {
78870
- if (filename.endsWith(".js")) {
78871
- const fileNameWithoutExtension = filename.replace(".js", "");
78872
- resourcesExports.push(`export ${fileNameWithoutExtension} from './${fileNameWithoutExtension}'`);
78873
- } else if (filename.endsWith(".less")) {
78874
- resourcesImports.push(`import './${filename}'`);
78875
- }
78876
- }
78877
- if (!this.resources.has("hooks.js")) {
78878
- resourcesExports.push(`export const hooks = undefined`);
78879
- }
78880
- if (!this.resources.has("localizationDictionary.js")) {
78881
- resourcesExports.push(`export const localizationDictionary = undefined`);
78882
- }
78883
- return [...resourcesImports, ...resourcesExports].join("\n");
78884
- }
79073
+
79074
+
79075
+ function getMarkupDocuments() {
79076
+ const nodes = (0,_markupGenerator_SugarNodes_DefaultSugarSerializer__WEBPACK_IMPORTED_MODULE_2__.getAllSugarNodeClasses)();
79077
+ return nodes.map(_SugarNodeDocumentationGenerator__WEBPACK_IMPORTED_MODULE_4__.buildSugarNodeDocumentation);
79078
+ }
79079
+ function getDocuments(documentsDirPath) {
79080
+ const docsNames = (0,fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync)(documentsDirPath);
79081
+ const documents = docsNames.filter(docName => (0,path__WEBPACK_IMPORTED_MODULE_1__.extname)(docName) === ".json").map(docsName => {
79082
+ const docFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)(documentsDirPath, docsName);
79083
+ const doc = (0,_DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__.isFileExists)(docFilePath) ? JSON.parse((0,fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(docFilePath, "utf8")) : undefined;
79084
+ const markdownDescriptionFilePath = (0,path__WEBPACK_IMPORTED_MODULE_1__.resolve)(documentsDirPath, `${(0,path__WEBPACK_IMPORTED_MODULE_1__.parse)(docsName).name}.md`);
79085
+ const markdownDescription = (0,_DocFileHelpers__WEBPACK_IMPORTED_MODULE_3__.isFileExists)(markdownDescriptionFilePath) ? {
79086
+ markdownDescription: (0,fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(markdownDescriptionFilePath, "utf8")
79087
+ } : {};
79088
+ return {
79089
+ ...doc,
79090
+ ...markdownDescription
79091
+ };
79092
+ });
79093
+ return documents;
78885
79094
  }
78886
79095
 
78887
79096
  /***/ }),
78888
79097
 
78889
- /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts":
78890
- /*!********************************************************************!*\
78891
- !*** ./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts ***!
78892
- \********************************************************************/
79098
+ /***/ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts":
79099
+ /*!*******************************************************************************!*\
79100
+ !*** ./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts ***!
79101
+ \*******************************************************************************/
78893
79102
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78894
79103
 
78895
79104
  "use strict";
78896
79105
  __webpack_require__.r(__webpack_exports__);
78897
79106
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78898
- /* harmony export */ getWebEntry: () => (/* binding */ getWebEntry)
79107
+ /* harmony export */ AttributeTypes: () => (/* binding */ AttributeTypes),
79108
+ /* harmony export */ AvailableChildrenType: () => (/* binding */ AvailableChildrenType),
79109
+ /* harmony export */ isRequiredValueParser: () => (/* binding */ isRequiredValueParser),
79110
+ /* harmony export */ valueParserToAttributeType: () => (/* binding */ valueParserToAttributeType)
78899
79111
  /* harmony export */ });
78900
- function getWebEntry(gfv, resourcesHash) {
78901
- return `import {
78902
- dataDeclaration,
78903
- calculationFunctions,
78904
- validationFunctions,
78905
- rngSchemaValidationConfigurator,
78906
- settings as defaultSettings,
78907
- requisiteList,
78908
- hooks,
78909
- localizationDictionary,
78910
- autocalculationConfigurators,
78911
- kcXmlValidationConfigurator,
78912
- kcXmlAutoCalculationConfigurator,
78913
- lazyLoadDeclaration
78914
- } from './resources'
78915
- import { Form } from './components'
79112
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_ArrayValueParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/ArrayValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/ArrayValueParser.ts");
79113
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_BooleanValueParser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/BooleanValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/BooleanValueParser.ts");
79114
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_DefaultWrapperValueParser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/DefaultWrapperValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/DefaultWrapperValueParser.ts");
79115
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_DelimitedStringArrayValueParser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/DelimitedStringArrayValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/DelimitedStringArrayValueParser.ts");
79116
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_EnumValueParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/EnumValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/EnumValueParser.ts");
79117
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_InlineStyleValueParser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/InlineStyleValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/InlineStyleValueParser.ts");
79118
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_LengthUnitValueParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/LengthUnitValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/LengthUnitValueParser.ts");
79119
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_LocalizedStringValueParser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/LocalizedStringValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/LocalizedStringValueParser.ts");
79120
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_NumberValueParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/NumberValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/NumberValueParser.ts");
79121
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_ObjectValueParser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/ObjectValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/ObjectValueParser.ts");
79122
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/RequiredWrapperValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/RequiredWrapperValueParser.ts");
79123
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesParsers_StringValueParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesParsers/StringValueParser */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesParsers/StringValueParser.ts");
79124
+ /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
79125
+ /* harmony import */ var _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./AttributeTypeKind */ "./Generator/src/generators/DocumentationGenerator/AttributeTypeKind.ts");
78916
79126
 
78917
- const gfv = '${gfv}'
78918
- const resourcesHash = ${JSON.stringify(resourcesHash)}
78919
79127
 
78920
- window.CF.entryPoint = window.CF.entryPoint || {};
78921
- if (window.CF.entryPoint[gfv]) {
78922
- for (const instance of window.CF.entryPoint[gfv].instances) {
78923
- const resources = {
78924
- dataDeclaration: dataDeclaration,
78925
- calculationFunctions: calculationFunctions,
78926
- validationFunctions: validationFunctions,
78927
- requisiteList: requisiteList,
78928
- autocalculationConfigurators: [...autocalculationConfigurators, kcXmlValidationConfigurator, rngSchemaValidationConfigurator, kcXmlAutoCalculationConfigurator],
78929
- }
78930
- instance.updateFormResources(Form, resources);
78931
- }
78932
- } else {
78933
- window.CF.entryPoint[gfv] = async function(container, { renderForm, ...settings }) {
78934
- const resources = {
78935
- dataDeclaration: dataDeclaration,
78936
- lazyLoadDeclaration: lazyLoadDeclaration,
78937
- calculationFunctions: calculationFunctions,
78938
- validationFunctions: validationFunctions,
78939
- requisiteList: requisiteList,
78940
- resourcesHash: resourcesHash,
78941
- localizationDictionary: localizationDictionary,
78942
- hooks: hooks,
78943
- autocalculationConfigurators: [...autocalculationConfigurators, kcXmlValidationConfigurator, rngSchemaValidationConfigurator, kcXmlAutoCalculationConfigurator],
78944
- settings: {
78945
- ...defaultSettings,
78946
- ...settings,
78947
- isDisabledCleanForm: defaultSettings.isDisabledCleanForm || settings.isDisabledCleanForm,
78948
- isDisabledCloseButton: defaultSettings.isDisabledCloseButton || settings.isDisabledCloseButton,
78949
- isDisabledCloseAndSaveButton: defaultSettings.isDisabledCloseAndSaveButton || settings.isDisabledCloseAndSaveButton,
78950
- }
78951
- }
78952
- const formInstance = await renderForm(Form, resources, container)
78953
- window.CF.entryPoint[gfv].instances = window.CF.entryPoint[gfv].instances ?? [];
78954
- window.CF.entryPoint[gfv].instances.push(formInstance)
78955
- return formInstance;
78956
- }
78957
- }
78958
79128
 
78959
- if (module.hot) {
78960
- module.hot.accept();
78961
- }
78962
- `;
78963
- }
78964
79129
 
78965
- /***/ }),
78966
79130
 
78967
- /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts":
78968
- /*!************************************************************************!*\
78969
- !*** ./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts ***!
78970
- \************************************************************************/
78971
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78972
79131
 
78973
- "use strict";
78974
- __webpack_require__.r(__webpack_exports__);
78975
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78976
- /* harmony export */ getWebJsContent: () => (/* binding */ getWebJsContent)
78977
- /* harmony export */ });
78978
- function getWebJsContent() {
78979
- return `if (window.CF && window.CF.keformsUrl) {
78980
- let { keformsUrl } = window.CF
78981
- let publicPath = __webpack_public_path__
78982
79132
 
78983
- publicPath = publicPath.slice(0, 1) == '/' ? publicPath.slice(1) : publicPath
78984
- keformsUrl = keformsUrl.slice(-1) == '/' ? keformsUrl.slice(0, -1) : keformsUrl
78985
- __webpack_public_path__ = \`\${keformsUrl\}/\$\{publicPath\}\`
78986
- }
78987
79133
 
78988
- require('./webEntry')
78989
- `;
78990
- }
78991
79134
 
78992
- /***/ }),
78993
79135
 
78994
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts":
78995
- /*!***********************************************************************************!*\
78996
- !*** ./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts ***!
78997
- \***********************************************************************************/
78998
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78999
79136
 
79000
- "use strict";
79001
- __webpack_require__.r(__webpack_exports__);
79002
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79003
- /* harmony export */ astToExportStatement: () => (/* binding */ astToExportStatement)
79004
- /* harmony export */ });
79005
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79006
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79007
79137
 
79008
- const astToExportStatement = (filename, ast) => {
79009
- const defaultExport = ast.program.body.find(x => _babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(x) && _babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(x.declaration));
79010
- if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(defaultExport) || !_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(defaultExport.declaration)) {
79011
- throw new Error(`InvalidProgramState: default function export not found in ${filename}.js`);
79012
- }
79013
- return _babel_types__WEBPACK_IMPORTED_MODULE_0__.exportNamedDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.functionDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.identifier(filename), defaultExport.declaration.params, defaultExport.declaration.body, defaultExport.declaration.generator, defaultExport.declaration.async));
79138
+
79139
+
79140
+ let AvailableChildrenType = /*#__PURE__*/function (AvailableChildrenType) {
79141
+ AvailableChildrenType["NoChildren"] = "NoChildren";
79142
+ AvailableChildrenType["Any"] = "Any";
79143
+ AvailableChildrenType["TextOnly"] = "TextOnly";
79144
+ AvailableChildrenType["List"] = "List";
79145
+ return AvailableChildrenType;
79146
+ }({});
79147
+ class AttributeTypes {}
79148
+ AttributeTypes.Path = {
79149
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Path
79150
+ };
79151
+ AttributeTypes.VisibilityPath = {
79152
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.VisibilityPath
79153
+ };
79154
+ AttributeTypes.Type = {
79155
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Type
79156
+ };
79157
+ AttributeTypes.String = {
79158
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.String
79159
+ };
79160
+ AttributeTypes.Number = {
79161
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Number
79162
+ };
79163
+ AttributeTypes.Boolean = {
79164
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Boolean
79165
+ };
79166
+ AttributeTypes.FunctionName = {
79167
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.FunctionName
79168
+ };
79169
+ AttributeTypes.CssClassName = {
79170
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.CssClassName
79171
+ };
79172
+ AttributeTypes.PicklistId = {
79173
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.PicklistId
79174
+ };
79175
+ AttributeTypes.JavaScriptLiteral = {
79176
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.JavaScriptLiteral
79014
79177
  };
79178
+ AttributeTypes.Color = {
79179
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Color
79180
+ };
79181
+ AttributeTypes.PathList = {
79182
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.PathList
79183
+ };
79184
+ AttributeTypes.TemplateParameterType = {
79185
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.TemplateParameterType
79186
+ };
79187
+ function isRequiredValueParser(valueParser) {
79188
+ return valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__.RequiredWrapperValueParser;
79189
+ }
79190
+ function valueParserToAttributeType(valueParser) {
79191
+ if (valueParser === _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__.attrType.bindingPath) {
79192
+ return [AttributeTypes.Path];
79193
+ }
79194
+ if (valueParser === _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_12__.attrType.typeName) {
79195
+ return [AttributeTypes.Type];
79196
+ }
79197
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_ArrayValueParser__WEBPACK_IMPORTED_MODULE_0__.ArrayValueParser) {
79198
+ return [AttributeTypes.String, AttributeTypes.JavaScriptLiteral];
79199
+ }
79200
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_BooleanValueParser__WEBPACK_IMPORTED_MODULE_1__.BooleanValueParser) {
79201
+ return [AttributeTypes.Boolean];
79202
+ }
79203
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_DefaultWrapperValueParser__WEBPACK_IMPORTED_MODULE_2__.DefaultWrapperValueParser) {
79204
+ return valueParserToAttributeType(valueParser.innerValueParser);
79205
+ }
79206
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_DelimitedStringArrayValueParser__WEBPACK_IMPORTED_MODULE_3__.DelimitedStringArrayValueParser) {
79207
+ return [AttributeTypes.String];
79208
+ }
79209
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_EnumValueParser__WEBPACK_IMPORTED_MODULE_4__.EnumValueParser) {
79210
+ return [{
79211
+ type: _AttributeTypeKind__WEBPACK_IMPORTED_MODULE_13__.AttributeTypeKind.Enum,
79212
+ values: valueParser.values
79213
+ }];
79214
+ }
79215
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_InlineStyleValueParser__WEBPACK_IMPORTED_MODULE_5__.InlineStyleValueParser) {
79216
+ return [AttributeTypes.JavaScriptLiteral];
79217
+ }
79218
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_LengthUnitValueParser__WEBPACK_IMPORTED_MODULE_6__.LengthUnitValueParser) {
79219
+ return [AttributeTypes.Number, AttributeTypes.String];
79220
+ }
79221
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_LocalizedStringValueParser__WEBPACK_IMPORTED_MODULE_7__.LocalizedStringValueParser) {
79222
+ return [AttributeTypes.String];
79223
+ }
79224
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_NumberValueParser__WEBPACK_IMPORTED_MODULE_8__.NumberValueParser) {
79225
+ return [AttributeTypes.Number];
79226
+ }
79227
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_ObjectValueParser__WEBPACK_IMPORTED_MODULE_9__.ObjectValueParser) {
79228
+ return [AttributeTypes.JavaScriptLiteral];
79229
+ }
79230
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_RequiredWrapperValueParser__WEBPACK_IMPORTED_MODULE_10__.RequiredWrapperValueParser) {
79231
+ return valueParserToAttributeType(valueParser.innerValueParser);
79232
+ }
79233
+ if (valueParser instanceof _markupGenerator_Serializer_Properties_ValuesParsers_StringValueParser__WEBPACK_IMPORTED_MODULE_11__.StringValueParser) {
79234
+ return [AttributeTypes.String];
79235
+ }
79236
+ return [AttributeTypes.String];
79237
+ }
79015
79238
 
79016
79239
  /***/ }),
79017
79240
 
79018
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts":
79019
- /*!*********************************************************************************************!*\
79020
- !*** ./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts ***!
79021
- \*********************************************************************************************/
79241
+ /***/ "./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts":
79242
+ /*!********************************************************************************************!*\
79243
+ !*** ./Generator/src/generators/DocumentationGenerator/SugarNodeDocumentationGenerator.ts ***!
79244
+ \********************************************************************************************/
79022
79245
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79023
79246
 
79024
79247
  "use strict";
79025
79248
  __webpack_require__.r(__webpack_exports__);
79026
79249
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79027
- /* harmony export */ CommonHelperFunctionsGenerator: () => (/* binding */ CommonHelperFunctionsGenerator)
79250
+ /* harmony export */ buildSugarNodeDocumentation: () => (/* binding */ buildSugarNodeDocumentation)
79028
79251
  /* harmony export */ });
79029
- /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79030
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79031
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79032
- /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79033
- /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79034
- /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79252
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
79253
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
79254
+ /* harmony import */ var _common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../common/RequireContext/LoadDocumentationFileFormContext */ "./Generator/src/common/RequireContext/LoadDocumentationFileFormContext.ts");
79255
+ /* harmony import */ var _markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/ClassMetadataAccess */ "./Generator/src/generators/markupGenerator/Serializer/ClassMetadataAccess.ts");
79256
+ /* harmony import */ var _markupGenerator_Serializer_Properties_MixinPropertyDeserializer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/MixinPropertyDeserializer */ "./Generator/src/generators/markupGenerator/Serializer/Properties/MixinPropertyDeserializer.ts");
79257
+ /* harmony import */ var _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/SinglePropertyDeserializer */ "./Generator/src/generators/markupGenerator/Serializer/Properties/SinglePropertyDeserializer.ts");
79258
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_AttributeValueSource__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/AttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/AttributeValueSource.ts");
79259
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_SkipAttributeValueSource__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/SkipAttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/SkipAttributeValueSource.ts");
79260
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_MarkupOrAttributeValueSource__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/MarkupOrAttributeValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/MarkupOrAttributeValueSource.ts");
79261
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_ChildrenNodesValueSource__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/ChildrenNodesValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/ChildrenNodesValueSource.ts");
79262
+ /* harmony import */ var _markupGenerator_Serializer_Properties_ValuesSources_SingleChildValueSource__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../markupGenerator/Serializer/Properties/ValuesSources/SingleChildValueSource */ "./Generator/src/generators/markupGenerator/Serializer/Properties/ValuesSources/SingleChildValueSource.ts");
79263
+ /* harmony import */ var _DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./DocumentationTypes */ "./Generator/src/generators/DocumentationGenerator/DocumentationTypes.ts");
79035
79264
 
79036
79265
 
79037
79266
 
79038
79267
 
79039
79268
 
79040
- class CommonHelperFunctionsGenerator {
79041
- generate(commonHelpers) {
79042
- if (commonHelpers.length === 0) {
79043
- return "";
79044
- }
79045
- const helperFunctionsList = commonHelpers.map(helper => helper.filename).join(", ");
79046
- const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79047
- sourceType: "module"
79048
- });
79049
- const exportDefault = buildExportDefault();
79050
- if (Array.isArray(exportDefault)) {
79051
- throw new Error("InvalidProgramState: default export build failed");
79052
- }
79053
- const helpersStatements = [].concat(...commonHelpers.map(helper => {
79054
- const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79055
- return this.transform(helper.filename, ast);
79056
- }), exportDefault);
79057
- return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79058
- }
79059
- transform(filename, ast) {
79060
- const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79061
- const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./"));
79062
- return [...imports, result];
79063
- }
79064
- }
79065
-
79066
- /***/ }),
79067
-
79068
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts":
79069
- /*!*******************************************************************************!*\
79070
- !*** ./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts ***!
79071
- \*******************************************************************************/
79072
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79073
-
79074
- "use strict";
79075
- __webpack_require__.r(__webpack_exports__);
79076
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79077
- /* harmony export */ fileContentToAst: () => (/* binding */ fileContentToAst)
79078
- /* harmony export */ });
79079
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79080
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79081
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79082
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79083
-
79084
-
79085
- const fileContentToAst = helper => {
79086
- const ast = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.parse)(helper.content, {
79087
- sourceType: "module",
79088
- filename: "fake-file-name.js",
79089
- configFile: false,
79090
- babelrc: false,
79091
- plugins: [__webpack_require__(/*! @babel/plugin-syntax-jsx */ "./node_modules/@babel/plugin-syntax-jsx/lib/index.js")]
79092
- });
79093
- if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFile(ast)) {
79094
- throw new Error(`InvalidProgramState: incorrect helper ${helper.filename}.js`);
79095
- }
79096
- return ast;
79097
- };
79098
-
79099
- /***/ }),
79100
79269
 
79101
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts":
79102
- /*!***************************************************************************************!*\
79103
- !*** ./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts ***!
79104
- \***************************************************************************************/
79105
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79106
79270
 
79107
- "use strict";
79108
- __webpack_require__.r(__webpack_exports__);
79109
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79110
- /* harmony export */ HelperFunctionsGenerator: () => (/* binding */ HelperFunctionsGenerator)
79111
- /* harmony export */ });
79112
- /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79113
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79114
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79115
- /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79116
- /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79117
- /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79118
79271
 
79119
79272
 
79120
79273
 
79121
79274
 
79122
79275
 
79123
- class HelperFunctionsGenerator {
79124
- generate(helpers) {
79125
- if (helpers.length === 0) {
79126
- return "";
79276
+ function getMarkdownDescription(documentationFilesContext, metadata, sugarNodeClass) {
79277
+ if (documentationFilesContext == undefined) {
79278
+ return undefined;
79279
+ }
79280
+ const descriptions = [(0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, "description.md"), (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, metadata.sugarNodeName + ".md"), (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, sugarNodeClass.name + ".md")];
79281
+ return _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.first(descriptions.filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined));
79282
+ }
79283
+ function buildSugarNodeDocumentation(sugarNodeClass) {
79284
+ const metadata = (0,_markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__.getSugarNodeMetadata)(sugarNodeClass);
79285
+ const propertySerializers = (0,_markupGenerator_Serializer_ClassMetadataAccess__WEBPACK_IMPORTED_MODULE_3__.getPropertyDeserializers)(sugarNodeClass);
79286
+ const documentationFilesContext = metadata.documentationFilesContext;
79287
+ const example = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, "example.md");
79288
+ const markdownDescription = getMarkdownDescription(documentationFilesContext, metadata, sugarNodeClass);
79289
+ const {
79290
+ markupAttributes,
79291
+ attributes
79292
+ } = buildMarkupAndAttributesInfo(propertySerializers, documentationFilesContext);
79293
+ const {
79294
+ children,
79295
+ singleChild,
79296
+ availableAnyChildren
79297
+ } = buildAvailableChildrenInfo(propertySerializers, documentationFilesContext);
79298
+ return {
79299
+ name: metadata.sugarNodeName.toLowerCase(),
79300
+ availableChildren: {
79301
+ children: children,
79302
+ singleChild: singleChild,
79303
+ availableAnyChildren: availableAnyChildren
79304
+ },
79305
+ example: example,
79306
+ shortMarkdownDescription: metadata.description,
79307
+ markdownDescription: markdownDescription,
79308
+ attributes: attributes,
79309
+ markupAttributes: markupAttributes
79310
+ };
79311
+ }
79312
+ function buildAvailableChildrenInfo(propertySerializers, documentationFilesContext) {
79313
+ if (propertySerializers.length === 0) {
79314
+ return {
79315
+ children: [],
79316
+ singleChild: []
79317
+ };
79318
+ }
79319
+ const children = propertySerializers.map(x => buildAvailableChildrenDocs(x, documentationFilesContext)).flat();
79320
+ const singleChild = propertySerializers.map(x => buildAvailableSingleChildDocs(x, documentationFilesContext)).flat();
79321
+ const availableAnyChildren = propertySerializers.map(x => buildAvailableSugarChildrenDocs(x, documentationFilesContext)).some(x => x === true);
79322
+ return {
79323
+ children: children,
79324
+ singleChild: singleChild,
79325
+ availableAnyChildren: availableAnyChildren
79326
+ };
79327
+ }
79328
+ function buildAvailableChildrenDocs(propertyDeserializer, documentationFilesContext) {
79329
+ if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
79330
+ return [];
79331
+ }
79332
+ if (propertyDeserializer.propertyName === "children") {
79333
+ return [];
79334
+ }
79335
+ if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_ChildrenNodesValueSource__WEBPACK_IMPORTED_MODULE_9__.ChildrenNodesValueSource) {
79336
+ const childrenNodes = propertyDeserializer.valueSource.nodeClasses.map(buildSugarNodeDocumentation);
79337
+ return childrenNodes;
79338
+ }
79339
+ return [];
79340
+ }
79341
+ function buildAvailableSugarChildrenDocs(propertyDeserializer, documentationFilesContext) {
79342
+ if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
79343
+ return false;
79344
+ }
79345
+ if (propertyDeserializer.propertyName === "children") {
79346
+ return true;
79347
+ }
79348
+ return false;
79349
+ }
79350
+ function buildAvailableSingleChildDocs(propertyDeserializer, documentationFilesContext) {
79351
+ if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
79352
+ return [];
79353
+ }
79354
+ if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_SingleChildValueSource__WEBPACK_IMPORTED_MODULE_10__.SingleChildValueSource) {
79355
+ const childrenNodes = propertyDeserializer.valueSource.nodeClasses.map(buildSugarNodeDocumentation);
79356
+ return childrenNodes;
79357
+ }
79358
+ return [];
79359
+ }
79360
+ function buildMarkupAndAttributesInfo(propertySerializers, documentationFilesContext) {
79361
+ if (propertySerializers.length === 0) {
79362
+ return {
79363
+ attributes: [],
79364
+ markupAttributes: []
79365
+ };
79366
+ }
79367
+ const attributes = propertySerializers.map(x => buildAttributeDocs(x, documentationFilesContext)).flat();
79368
+ const markupAttributes = propertySerializers.map(x => buildMarkupAttributeDocs(x, documentationFilesContext)).flat();
79369
+ return {
79370
+ attributes: attributes,
79371
+ markupAttributes: markupAttributes
79372
+ };
79373
+ }
79374
+ function buildMarkupAttributeDocs(propertyDeserializer, documentationFilesContext) {
79375
+ if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
79376
+ return [];
79377
+ }
79378
+ if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_MarkupOrAttributeValueSource__WEBPACK_IMPORTED_MODULE_8__.MarkupOrAttributeValueSource) {
79379
+ var _propertyDeserializer;
79380
+ let markdownDescription = "";
79381
+ if (documentationFilesContext != undefined) {
79382
+ markdownDescription = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, `${propertyDeserializer.valueSource.attrName}.attr.md`);
79127
79383
  }
79128
- const helperFunctionsList = helpers.map(helper => helper.filename).join(", ");
79129
- const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79130
- sourceType: "module"
79131
- });
79132
- const exportDefault = buildExportDefault();
79133
- if (Array.isArray(exportDefault)) {
79134
- throw new Error("InvalidProgramState: default export build failed");
79384
+ return [{
79385
+ name: propertyDeserializer.valueSource.attrName,
79386
+ valueTypes: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.valueParserToAttributeType)(propertyDeserializer.valueSource.valueParser),
79387
+ shortMarkdownDescription: (_propertyDeserializer = propertyDeserializer.propertyDescription) !== null && _propertyDeserializer !== void 0 ? _propertyDeserializer : "--",
79388
+ markdownDescription: markdownDescription,
79389
+ defaultValue: undefined,
79390
+ required: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.isRequiredValueParser)(propertyDeserializer.valueSource.valueParser),
79391
+ deprecated: false
79392
+ }];
79393
+ }
79394
+ return [];
79395
+ }
79396
+ function buildAttributeDocs(propertyDeserializer, documentationFilesContext) {
79397
+ if (propertyDeserializer instanceof _markupGenerator_Serializer_Properties_MixinPropertyDeserializer__WEBPACK_IMPORTED_MODULE_4__.MixinPropertyDeserializer) {
79398
+ return propertyDeserializer.getPropertyDeserializers().map(x => buildAttributeDocs(x, documentationFilesContext)).flat();
79399
+ }
79400
+ if (!(propertyDeserializer instanceof _markupGenerator_Serializer_Properties_SinglePropertyDeserializer__WEBPACK_IMPORTED_MODULE_5__.SinglePropertyDeserializer)) {
79401
+ return [];
79402
+ }
79403
+ if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_AttributeValueSource__WEBPACK_IMPORTED_MODULE_6__.AttributeValueSource) {
79404
+ var _propertyDeserializer2;
79405
+ let markdownDescription = "";
79406
+ if (documentationFilesContext != undefined) {
79407
+ markdownDescription = (0,_common_RequireContext_LoadDocumentationFileFormContext__WEBPACK_IMPORTED_MODULE_2__.loadDocumentationFileFormContext)(documentationFilesContext, `${propertyDeserializer.valueSource.attrName}.attr.md`);
79135
79408
  }
79136
- const helpersStatements = [].concat(...helpers.map(helper => {
79137
- const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79138
- return this.transform(helper.filename, ast);
79139
- }), exportDefault);
79140
- return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79409
+ return [{
79410
+ name: propertyDeserializer.valueSource.attrName,
79411
+ valueTypes: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.valueParserToAttributeType)(propertyDeserializer.valueSource.valueParser),
79412
+ shortMarkdownDescription: (_propertyDeserializer2 = propertyDeserializer.propertyDescription) !== null && _propertyDeserializer2 !== void 0 ? _propertyDeserializer2 : "--",
79413
+ markdownDescription: markdownDescription,
79414
+ defaultValue: undefined,
79415
+ required: (0,_DocumentationTypes__WEBPACK_IMPORTED_MODULE_11__.isRequiredValueParser)(propertyDeserializer.valueSource.valueParser),
79416
+ deprecated: false
79417
+ }];
79141
79418
  }
79142
- transform(filename, ast) {
79143
- const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79144
- const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./")).map(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && x.source.value.includes("/jsHelpers/") ? _babel_types__WEBPACK_IMPORTED_MODULE_1__.importDeclaration(x.specifiers.map(s => _babel_types__WEBPACK_IMPORTED_MODULE_1__.importSpecifier(s.local, s.local)), _babel_types__WEBPACK_IMPORTED_MODULE_1__.stringLiteral("./commonHelperFunctions")) : x);
79145
- return [...imports, result];
79419
+ if (propertyDeserializer.valueSource instanceof _markupGenerator_Serializer_Properties_ValuesSources_SkipAttributeValueSource__WEBPACK_IMPORTED_MODULE_7__.SkipAttributeValueSource) {
79420
+ return [{
79421
+ name: propertyDeserializer.propertyName,
79422
+ valueTypes: [],
79423
+ shortMarkdownDescription: "DEPRECATED",
79424
+ markdownDescription: "DEPRECATED",
79425
+ defaultValue: undefined,
79426
+ required: undefined,
79427
+ deprecated: true
79428
+ }];
79146
79429
  }
79430
+ return [];
79147
79431
  }
79148
79432
 
79149
79433
  /***/ }),
79150
79434
 
79151
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts":
79152
- /*!*******************************************************************************!*\
79153
- !*** ./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts ***!
79154
- \*******************************************************************************/
79435
+ /***/ "./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts":
79436
+ /*!***************************************************************************!*\
79437
+ !*** ./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts ***!
79438
+ \***************************************************************************/
79155
79439
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79156
79440
 
79157
79441
  "use strict";
79158
79442
  __webpack_require__.r(__webpack_exports__);
79159
79443
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79160
- /* harmony export */ statementsToCode: () => (/* binding */ statementsToCode)
79444
+ /* harmony export */ FormSourcesBuilder: () => (/* binding */ FormSourcesBuilder)
79161
79445
  /* harmony export */ });
79162
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79163
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79164
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79165
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79166
-
79446
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ "path");
79447
+ /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
79448
+ /* harmony import */ var _GetWebEntry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GetWebEntry */ "./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts");
79449
+ /* harmony import */ var _GetWebJsContent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GetWebJsContent */ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts");
79167
79450
 
79168
- const statementsToCode = statements => {
79169
- const transformResult = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.transformFromAstSync)(_babel_types__WEBPACK_IMPORTED_MODULE_0__.program(statements), undefined, {
79170
- configFile: false,
79171
- sourceType: "module"
79172
- });
79173
- if (transformResult == undefined || transformResult.code == undefined) {
79174
- throw new Error("InvalidProgramState: statements transform failed");
79175
- }
79176
- const {
79177
- code
79178
- } = transformResult;
79179
- return unescape(code.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
79180
- };
79181
79451
 
79182
- /***/ }),
79183
79452
 
79184
- /***/ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts":
79185
- /*!***********************************************************************!*\
79186
- !*** ./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts ***!
79187
- \***********************************************************************/
79188
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79189
-
79190
- "use strict";
79191
- __webpack_require__.r(__webpack_exports__);
79192
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79193
- /* harmony export */ AggregationDependencyModelPath: () => (/* binding */ AggregationDependencyModelPath),
79194
- /* harmony export */ DependencyWithoutChecks: () => (/* binding */ DependencyWithoutChecks),
79195
- /* harmony export */ KCXmlGeneratorBase: () => (/* binding */ KCXmlGeneratorBase),
79196
- /* harmony export */ RegularDependency: () => (/* binding */ RegularDependency),
79197
- /* harmony export */ isAggregationDependencyModelPath: () => (/* binding */ isAggregationDependencyModelPath),
79198
- /* harmony export */ isDependencyWithoutChecks: () => (/* binding */ isDependencyWithoutChecks)
79199
- /* harmony export */ });
79200
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
79201
- /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
79202
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
79203
- /* harmony import */ var _markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/ComponentMarkupBuilder/PathHelper */ "./Generator/src/generators/markupGenerator/ComponentMarkupBuilder/PathHelper.ts");
79204
- /* harmony import */ var _Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/PathSplitHelper */ "./Common/ModelPath/PathSplitHelper.ts");
79205
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
79206
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
79207
-
79208
-
79209
-
79210
-
79211
-
79212
-
79213
-
79214
- class RegularDependency {
79215
- constructor(currentDependencyPath, eachDependencyPath) {
79216
- this.currentDependencyPath = void 0;
79217
- this.eachDependencyPath = void 0;
79218
- this.eachDependencyPath = eachDependencyPath;
79219
- this.currentDependencyPath = currentDependencyPath;
79220
- }
79221
- asDependencyModelPath() {
79222
- const currentPart = this.currentDependencyPath.toCurrentIteration();
79223
- return this.eachDependencyPath != undefined ? currentPart.joinWith(this.eachDependencyPath) : currentPart;
79453
+ class FormSourcesBuilder {
79454
+ constructor(formSourcesPath) {
79455
+ this.resources = new Map();
79456
+ this.serverSideResources = new Map();
79457
+ this.components = new Map();
79458
+ this.formSourcesPath = void 0;
79459
+ this.formSourcesPath = formSourcesPath;
79224
79460
  }
79225
- }
79226
- class AggregationDependencyModelPath {
79227
- constructor(type, modelPath, prefixModelPath, restModelPath) {
79228
- this.type = void 0;
79229
- this.modelPath = void 0;
79230
- this.prefixModelPath = void 0;
79231
- this.restModelPath = void 0;
79232
- this.type = type;
79233
- this.modelPath = modelPath;
79234
- this.prefixModelPath = prefixModelPath;
79235
- this.restModelPath = restModelPath;
79461
+ resolveAbsolutePath(fromPath, toPath) {
79462
+ return path__WEBPACK_IMPORTED_MODULE_0__.relative(path__WEBPACK_IMPORTED_MODULE_0__.join(this.formSourcesPath, fromPath), toPath);
79236
79463
  }
79237
- asDependencyModelPath() {
79238
- return this.modelPath.toCurrentIteration();
79464
+ addComponent(pathToComponent, content) {
79465
+ this.components.set(pathToComponent, content);
79239
79466
  }
79240
- }
79241
- class DependencyWithoutChecks extends RegularDependency {}
79242
- function isAggregationDependencyModelPath(path) {
79243
- return path instanceof AggregationDependencyModelPath;
79244
- }
79245
- function isDependencyWithoutChecks(path) {
79246
- return path instanceof DependencyWithoutChecks;
79247
- }
79248
- class KCXmlGeneratorBase {
79249
- constructor(schema) {
79250
- this.schema = void 0;
79251
- this.schema = schema;
79467
+ addResource(pathToResource, content) {
79468
+ this.resources.set(pathToResource, content);
79252
79469
  }
79253
- getRuntimeFunctionName(functionSelector) {
79254
- return (0,_markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__.extractPath)(functionSelector.toString());
79470
+ addServerSideResource(pathToResource, content) {
79471
+ this.serverSideResources.set(pathToResource, content);
79255
79472
  }
79256
- getCompiledFuncWithArgs(functionSelector, args) {
79257
- const funcName = this.getRuntimeFunctionName(functionSelector);
79258
- const funcParams = args.join(", ");
79259
- return `expression.${funcName}(${funcParams})`;
79473
+ buildSources(gfv, resourcesHash) {
79474
+ const formContent = {};
79475
+ formContent["web.js"] = (0,_GetWebJsContent__WEBPACK_IMPORTED_MODULE_2__.getWebJsContent)();
79476
+ formContent["webEntry.js"] = (0,_GetWebEntry__WEBPACK_IMPORTED_MODULE_1__.getWebEntry)(gfv, resourcesHash);
79477
+ for (const [filename, content] of this.serverSideResources.entries()) {
79478
+ formContent[filename] = content;
79479
+ }
79480
+ for (const [filename, content] of this.resources.entries()) {
79481
+ formContent["resources/" + filename] = content;
79482
+ }
79483
+ for (const [filePath, content] of this.components.entries()) {
79484
+ formContent["components/" + filePath] = content;
79485
+ }
79486
+ const resourcesExports = this.buildResourcesExports();
79487
+ formContent["resources/index.js"] = resourcesExports;
79488
+ const componentsExports = this.buildComponentsExports();
79489
+ formContent["components/index.js"] = componentsExports;
79490
+ return formContent;
79260
79491
  }
79261
- getArgumentDeps(targetFullPath, selectFullPath, aggregationType) {
79262
- const pathDiffInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetFullPath, selectFullPath);
79263
- const restPath = pathDiffInfo.differentPath;
79264
- return !restPath.isContainIteration() ? new RegularDependency(selectFullPath) : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
79492
+ buildComponentsExports() {
79493
+ const componentsReExports = [];
79494
+ for (const [filePath] of this.components.entries()) {
79495
+ if (filePath.endsWith(".jsx")) {
79496
+ const [componentName, filename = ""] = filePath.split("/");
79497
+ if (componentName === filename.replace(".jsx", "")) {
79498
+ componentsReExports.push(`export ${componentName} from './${componentName}'`);
79499
+ }
79500
+ }
79501
+ }
79502
+ return componentsReExports.join("\n") + "\n";
79265
79503
  }
79266
- getAggregationPathsRecursively(currentParts, restParts) {
79267
- if (restParts.length === 0) {
79268
- return [];
79504
+ buildResourcesExports() {
79505
+ const resourcesImports = [];
79506
+ const resourcesExports = [];
79507
+ for (const [filename] of this.resources.entries()) {
79508
+ if (filename.endsWith(".js")) {
79509
+ const fileNameWithoutExtension = filename.replace(".js", "");
79510
+ resourcesExports.push(`export ${fileNameWithoutExtension} from './${fileNameWithoutExtension}'`);
79511
+ } else if (filename.endsWith(".less")) {
79512
+ resourcesImports.push(`import './${filename}'`);
79513
+ }
79269
79514
  }
79270
- const firstRestItem = restParts[1];
79271
- const nextRestParts = restParts.slice(2);
79272
- const nextCurrentParts = [...currentParts, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each, firstRestItem];
79273
- const restWithoutMultiple = nextRestParts.filter(x => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x));
79274
- const result = {
79275
- aggregationPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...currentParts, firstRestItem, ...restWithoutMultiple),
79276
- targetPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...nextCurrentParts, ...restWithoutMultiple),
79277
- isTargetFinal: restWithoutMultiple.length === 0
79278
- };
79279
- const nextResults = this.getAggregationPathsRecursively(nextCurrentParts, nextRestParts);
79280
- return [result, ...nextResults];
79515
+ if (!this.resources.has("hooks.js")) {
79516
+ resourcesExports.push(`export const hooks = undefined`);
79517
+ }
79518
+ if (!this.resources.has("localizationDictionary.js")) {
79519
+ resourcesExports.push(`export const localizationDictionary = undefined`);
79520
+ }
79521
+ return [...resourcesImports, ...resourcesExports].join("\n");
79281
79522
  }
79523
+ }
79282
79524
 
79283
- // Example: Root/B/*/C/D/*/E = Root/B/C/D/E/Sum -> Root/B/*/C/D/E/Sum -> Root/B/*/C/D/*/E
79284
- getAggregationPaths(relativePath) {
79285
- const splittedPath = [...relativePath.splitByMultiplicity()];
79286
- return this.getAggregationPathsRecursively([splittedPath[0]], splittedPath.slice(1));
79287
- }
79288
- createDependency(prefixModelPath, x, aggregationType) {
79289
- return {
79290
- aggPath: prefixModelPath.joinWith(x.aggregationPath).joinWith(aggregationType),
79291
- type: aggregationType,
79292
- dependencyPath: x.isTargetFinal ? prefixModelPath.joinWith(x.targetPath) : prefixModelPath.joinWith(x.targetPath).joinWith(aggregationType),
79293
- isDependencyAggregation: !x.isTargetFinal
79294
- };
79295
- }
79296
- compileAggregationDependencies(dependencies) {
79297
- const resultItems = dependencies.filter(isAggregationDependencyModelPath).map(dep => this.getAggregationPaths(dep.restModelPath).map(x => {
79298
- switch (dep.type) {
79299
- case "Sum":
79300
- return [this.createDependency(dep.prefixModelPath, x, "Sum"), this.createDependency(dep.prefixModelPath, x, "Count")];
79301
- case "Count":
79302
- return [this.createDependency(dep.prefixModelPath, x, "Count")];
79303
- default:
79304
- {
79305
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureNever)(dep.type);
79306
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Not supported aggregation dependency: ${dep.type}`);
79307
- }
79525
+ /***/ }),
79526
+
79527
+ /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts":
79528
+ /*!********************************************************************!*\
79529
+ !*** ./Generator/src/generators/FormSourcesBuilder/GetWebEntry.ts ***!
79530
+ \********************************************************************/
79531
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79532
+
79533
+ "use strict";
79534
+ __webpack_require__.r(__webpack_exports__);
79535
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79536
+ /* harmony export */ getWebEntry: () => (/* binding */ getWebEntry)
79537
+ /* harmony export */ });
79538
+ function getWebEntry(gfv, resourcesHash) {
79539
+ return `import {
79540
+ dataDeclaration,
79541
+ calculationFunctions,
79542
+ validationFunctions,
79543
+ rngSchemaValidationConfigurator,
79544
+ settings as defaultSettings,
79545
+ requisiteList,
79546
+ hooks,
79547
+ localizationDictionary,
79548
+ autocalculationConfigurators,
79549
+ kcXmlValidationConfigurator,
79550
+ kcXmlAutoCalculationConfigurator,
79551
+ lazyLoadDeclaration
79552
+ } from './resources'
79553
+ import { Form } from './components'
79554
+
79555
+ const gfv = '${gfv}'
79556
+ const resourcesHash = ${JSON.stringify(resourcesHash)}
79557
+
79558
+ window.CF.entryPoint = window.CF.entryPoint || {};
79559
+ if (window.CF.entryPoint[gfv]) {
79560
+ for (const instance of window.CF.entryPoint[gfv].instances) {
79561
+ const resources = {
79562
+ dataDeclaration: dataDeclaration,
79563
+ calculationFunctions: calculationFunctions,
79564
+ validationFunctions: validationFunctions,
79565
+ requisiteList: requisiteList,
79566
+ autocalculationConfigurators: [...autocalculationConfigurators, kcXmlValidationConfigurator, rngSchemaValidationConfigurator, kcXmlAutoCalculationConfigurator],
79308
79567
  }
79309
- })).flat(2);
79310
- const distinctiveItems = Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__.IterUtils.distinctBy(resultItems, x => x.aggPath.toLegacyPath()));
79311
- const sumCompiledFunctions = distinctiveItems.map(x => {
79312
- const compiledDep = this.modelPathInstance(x.dependencyPath.toCurrentIteration());
79313
- const compiledAggPath = this.modelPathInstance(x.aggPath);
79314
- const compiledCountPath = this.modelPathInstance(x.aggPath.getParentPath().joinWith("Count").toCurrentIteration());
79315
- const compiledDelegate = x.type === "Sum" ? `context => KCSumCalculation.execute(context, ${compiledAggPath},${compiledDep}, ${compiledCountPath}, "")` : x.type === "Count" ? `context => KCCountCalculation.execute(context, ${compiledAggPath}, ${compiledDep}, ${x.isDependencyAggregation}, "")` : "";
79316
- const compiledDeps = [compiledDep, ...(x.type === "Sum" ? [compiledCountPath] : [])].join(", ");
79317
- return `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
79318
- });
79319
- return [...sumCompiledFunctions];
79568
+ instance.updateFormResources(Form, resources);
79320
79569
  }
79321
- compileExpressionWithUnsupportedHandled(prefix, targetFullPath, expression, deps) {
79322
- try {
79323
- return this.compileExpression(prefix, targetFullPath, expression, deps);
79324
- } catch (e) {
79325
- if (e instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
79326
- return e;
79570
+ } else {
79571
+ window.CF.entryPoint[gfv] = async function(container, { renderForm, ...settings }) {
79572
+ const resources = {
79573
+ dataDeclaration: dataDeclaration,
79574
+ lazyLoadDeclaration: lazyLoadDeclaration,
79575
+ calculationFunctions: calculationFunctions,
79576
+ validationFunctions: validationFunctions,
79577
+ requisiteList: requisiteList,
79578
+ resourcesHash: resourcesHash,
79579
+ localizationDictionary: localizationDictionary,
79580
+ hooks: hooks,
79581
+ autocalculationConfigurators: [...autocalculationConfigurators, kcXmlValidationConfigurator, rngSchemaValidationConfigurator, kcXmlAutoCalculationConfigurator],
79582
+ settings: {
79583
+ ...defaultSettings,
79584
+ ...settings,
79585
+ isDisabledCleanForm: defaultSettings.isDisabledCleanForm || settings.isDisabledCleanForm,
79586
+ isDisabledCloseButton: defaultSettings.isDisabledCloseButton || settings.isDisabledCloseButton,
79587
+ isDisabledCloseAndSaveButton: defaultSettings.isDisabledCloseAndSaveButton || settings.isDisabledCloseAndSaveButton,
79327
79588
  }
79328
- throw e;
79329
79589
  }
79590
+ const formInstance = await renderForm(Form, resources, container)
79591
+ window.CF.entryPoint[gfv].instances = window.CF.entryPoint[gfv].instances ?? [];
79592
+ window.CF.entryPoint[gfv].instances.push(formInstance)
79593
+ return formInstance;
79330
79594
  }
79595
+ }
79331
79596
 
79332
- /* eslint-disable @typescript-eslint/unbound-method */
79333
- compileExpression(prefix, targetFullPath, expression, deps) {
79334
- const gcf = (selector, ...args) => this.getCompiledFuncWithArgs(selector, args);
79335
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArgumentExpression || expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultySumExpression) {
79336
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79337
- const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Sum");
79338
- deps.push(argumentDependency);
79339
- const finalPath = argumentDependency.asDependencyModelPath();
79340
- return gcf(x => x.argument, `"${finalPath.toLegacyPath()}"`);
79341
- }
79342
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
79343
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79344
- deps.push(new RegularDependency(modelPath));
79345
- return gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`);
79346
- }
79347
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsSnilsExpression) {
79348
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79349
- deps.push(new RegularDependency(modelPath));
79350
- return gcf(x => x.isSnils, `"${modelPath.toLegacyPath()}"`);
79351
- }
79352
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsInnExpression) {
79353
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79354
- deps.push(new RegularDependency(modelPath));
79355
- return gcf(x => x.isInn, `"${modelPath.toLegacyPath()}"`);
79356
- }
79357
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidMirCardNumberExpression) {
79358
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79359
- deps.push(new RegularDependency(modelPath));
79360
- return gcf(x => x.isValidMirCardNumber, `"${modelPath.toLegacyPath()}"`);
79361
- }
79362
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidAccountNumberExpression) {
79363
- const bikPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.bik)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79364
- const accountPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.account)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79365
- deps.push(new RegularDependency(bikPath));
79366
- deps.push(new RegularDependency(accountPath));
79367
- return gcf(x => x.isValidAccountNumber, `"${bikPath.toLegacyPath()}"`, `"${accountPath.toLegacyPath()}"`);
79368
- }
79369
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaCountExpression) {
79370
- var _expression$withNullO;
79371
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79372
- let finalPath = modelPath;
79373
- if (targetFullPath.isContainIteration()) {
79374
- const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Count");
79375
- deps.push(argumentDependency);
79376
- finalPath = argumentDependency.asDependencyModelPath();
79377
- } else {
79378
- deps.push(new RegularDependency(modelPath));
79379
- }
79380
- return gcf(x => x.count, `"${finalPath.toLegacyPath()}"`, `"${(_expression$withNullO = expression.withNullOrEmptyValues) !== null && _expression$withNullO !== void 0 ? _expression$withNullO : false}"`);
79381
- }
79382
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaWhenExpression) {
79383
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.expressions, 2);
79384
- const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.expressions[0], deps);
79385
- const compiledBody = this.compileExpression(prefix, targetFullPath, expression.expressions[1], deps);
79386
- return gcf(x => x.when, compiledCondition, `() => ${compiledBody}`);
79387
- }
79388
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOrExpression) {
79389
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79390
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79391
- return gcf(x => x.or, `[${compiledExpressions}]`);
79392
- }
79393
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAndExpression) {
79394
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79395
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79396
- return gcf(x => x.and, `[${compiledExpressions}]`);
79397
- }
79398
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNotExpression) {
79399
- return gcf(x => x.not, this.compileExpression(prefix, targetFullPath, expression.argument, deps));
79400
- }
79401
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaEqExpression) {
79402
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79403
- const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79404
- return gcf(x => x.eq, ...compiledParts);
79405
- }
79406
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConstExpression) {
79407
- return gcf(x => x.const, `"${expression.value}"`);
79408
- }
79409
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGtExpression) {
79410
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79411
- const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79412
- return gcf(x => x.gt, ...compiledParts);
79413
- }
79414
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGeExpression) {
79415
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79416
- const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79417
- return gcf(x => x.ge, ...compiledParts);
79418
- }
79419
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLtExpression) {
79420
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79421
- const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79422
- return gcf(x => x.lt, ...compiledParts);
79423
- }
79424
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLeExpression) {
79425
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79426
- const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79427
- return gcf(x => x.le, ...compiledParts);
79428
- }
79429
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLengthExpression) {
79430
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79431
- return gcf(x => x.length, compiledArgument);
79432
- }
79433
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRegexMatchExpression) {
79434
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79435
- const preparedPattern = expression.pattern.replace(/"/g, '\\"').replace(/\\/g, "\\\\");
79436
- return gcf(x => x.regexMatch, compiledArgument, `"${preparedPattern}"`);
79437
- }
79438
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultiplyExpression) {
79439
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79440
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79441
- return gcf(x => x.multiply, `[${compiledExpressions}]`);
79442
- }
79443
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDivisionExpression) {
79444
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79445
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79446
- return gcf(x => x.division, `[${compiledExpressions}]`);
79447
- }
79448
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
79449
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79450
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79451
- return gcf(x => x.sum, `[${compiledExpressions}]`);
79452
- }
79453
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMinusExpression) {
79454
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79455
- return gcf(x => x.minus, compiledArgument);
79456
- }
79457
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRoundExpression) {
79458
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79459
- return gcf(x => x.round, compiledArgument, `${expression.fractionalDigits}`);
79460
- }
79461
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFloorExpression) {
79462
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79463
- return gcf(x => x.floor, compiledArgument);
79464
- }
79465
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAbsExpression) {
79466
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79467
- return gcf(x => x.abs, compiledArgument);
79468
- }
79469
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaXAbsExpression) {
79470
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79471
- return gcf(x => x.xabs, compiledArgument);
79472
- }
79473
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaChooseExpression) {
79474
- const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.ifNode.condition, deps);
79475
- const compiledThen = this.compileExpression(prefix, targetFullPath, expression.thenNode.expression, deps);
79476
- const compiledElse = this.compileExpression(prefix, targetFullPath, expression.elseNode.expression, deps);
79477
- return gcf(x => x.choose, compiledCondition, `() => ${compiledThen}`, `() => ${compiledElse}`);
79478
- }
79479
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateNowExpression) {
79480
- return gcf(x => x.dateNow);
79481
- }
79482
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDaysInMonthExpression) {
79483
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79484
- return gcf(x => x.getDaysInMonth, compiledArgument);
79485
- }
79486
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDayExpression) {
79487
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79488
- return gcf(x => x.getDay, compiledArgument);
79489
- }
79490
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetMonthExpression) {
79491
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79492
- return gcf(x => x.getMonth, compiledArgument);
79493
- }
79494
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetYearExpression) {
79495
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79496
- return gcf(x => x.getYear, compiledArgument);
79497
- }
79498
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsDateExpression) {
79499
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79500
- return gcf(x => x.isDate, compiledArgument);
79501
- }
79502
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInMonthsExpression) {
79503
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79504
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79505
- return gcf(x => x.differenceInMonths, `[${compiledExpressions}]`);
79506
- }
79507
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInDaysExpression) {
79508
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79509
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79510
- return gcf(x => x.differenceInDays, `[${compiledExpressions}]`);
79511
- }
79512
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddDaysExpression) {
79513
- const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79514
- return gcf(x => x.addDays, `${path}, ${expression.amount}`);
79515
- }
79516
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddMonthsExpression) {
79517
- const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79518
- return gcf(x => x.addMonths, `${path}, ${expression.amount}`);
79519
- }
79520
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddYearsExpression) {
79521
- const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79522
- return gcf(x => x.addYears, `${path}, ${expression.amount}`);
79523
- }
79524
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateToStringExpression) {
79525
- const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79526
- return gcf(x => x.dateToString, `${path}, "${!!expression.format ? expression.format : "dd.MM.yyyy"}"`);
79527
- }
79528
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateTimeExpression) {
79529
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79530
- return gcf(x => x.dateTime, compiledArgument);
79531
- }
79532
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSubstringExpression) {
79533
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined)(expression.expression);
79534
- return `expression.substring(${this.compileExpression(prefix, targetFullPath, expression.expression, deps)}, "${expression.start}", "${expression.length}")`;
79535
- }
79536
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
79537
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79538
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79539
- return `expression.sum([${compiledExpressions}])`;
79540
- }
79541
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupSumExpression) {
79542
- const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys, deps);
79543
- const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
79544
- const sourceKeyDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
79545
- deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
79546
- const sourceValuePath = this.getModelPath(prefix, expression.sourceValuePath);
79547
- const sourceValueDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceValuePath);
79548
- deps.push(new DependencyWithoutChecks(sourceValueDeps.currentDepsPath, sourceValueDeps.eachDepsPath));
79549
- return gcf(x => x.groupSum, `${targetKeys}, "${sourceKeyPath}", "${sourceValuePath}"`);
79550
- }
79551
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupCountExpression) {
79552
- const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys, deps);
79553
- deps.push(new DependencyWithoutChecks(targetFullPath));
79554
- const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
79555
- const sourceKeyDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
79556
- deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
79557
- return gcf(x => x.groupCount, `${targetKeys}, "${sourceKeyPath}"`);
79558
- }
79559
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression) {
79560
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79561
- const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79562
- return gcf(x => x.concat, `[${compiledExpressions}]`);
79563
- }
79564
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNewLineExpression) {
79565
- return gcf(x => x.const, `"\\r\\n"`);
79566
- }
79567
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOneOfExpression) {
79568
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79569
- const compiledItems = expression.items.expressions.map(item => this.compileExpression(prefix, targetFullPath, item, deps)).join(",");
79570
- return gcf(x => x.oneOf, compiledArgument, `[${compiledItems}]`);
79571
- }
79572
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
79573
- const itemsText = expression.items.map(x => this.compileExpression(prefix, targetFullPath, x, deps)).join(", ");
79574
- return `JSON.stringify([${itemsText}])`;
79575
- }
79576
- // -- не работает в рантайм калькуляторе
79577
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
79578
- return "null";
79579
- }
79580
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFirstOrDefaultExpression) {
79581
- return "null";
79582
- }
79583
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
79584
- return "null";
79585
- }
79586
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
79587
- return "null";
79588
- }
79589
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHasAutoFlagExpression) {
79590
- return "null";
79591
- }
79592
- // -----
79597
+ if (module.hot) {
79598
+ module.hot.accept();
79599
+ }
79600
+ `;
79601
+ }
79593
79602
 
79594
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Unsupported node type: ${expression.constructor.name}`);
79603
+ /***/ }),
79604
+
79605
+ /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts":
79606
+ /*!************************************************************************!*\
79607
+ !*** ./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts ***!
79608
+ \************************************************************************/
79609
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79610
+
79611
+ "use strict";
79612
+ __webpack_require__.r(__webpack_exports__);
79613
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79614
+ /* harmony export */ getWebJsContent: () => (/* binding */ getWebJsContent)
79615
+ /* harmony export */ });
79616
+ function getWebJsContent() {
79617
+ return `if (window.CF && window.CF.keformsUrl) {
79618
+ let { keformsUrl } = window.CF
79619
+ let publicPath = __webpack_public_path__
79620
+
79621
+ publicPath = publicPath.slice(0, 1) == '/' ? publicPath.slice(1) : publicPath
79622
+ keformsUrl = keformsUrl.slice(-1) == '/' ? keformsUrl.slice(0, -1) : keformsUrl
79623
+ __webpack_public_path__ = \`\${keformsUrl\}/\$\{publicPath\}\`
79624
+ }
79625
+
79626
+ require('./webEntry')
79627
+ `;
79628
+ }
79629
+
79630
+ /***/ }),
79631
+
79632
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts":
79633
+ /*!***********************************************************************************!*\
79634
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts ***!
79635
+ \***********************************************************************************/
79636
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79637
+
79638
+ "use strict";
79639
+ __webpack_require__.r(__webpack_exports__);
79640
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79641
+ /* harmony export */ astToExportStatement: () => (/* binding */ astToExportStatement)
79642
+ /* harmony export */ });
79643
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79644
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79645
+
79646
+ const astToExportStatement = (filename, ast) => {
79647
+ const defaultExport = ast.program.body.find(x => _babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(x) && _babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(x.declaration));
79648
+ if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(defaultExport) || !_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(defaultExport.declaration)) {
79649
+ throw new Error(`InvalidProgramState: default function export not found in ${filename}.js`);
79595
79650
  }
79596
- /* eslint-enable @typescript-eslint/unbound-method */
79651
+ return _babel_types__WEBPACK_IMPORTED_MODULE_0__.exportNamedDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.functionDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.identifier(filename), defaultExport.declaration.params, defaultExport.declaration.body, defaultExport.declaration.generator, defaultExport.declaration.async));
79652
+ };
79597
79653
 
79598
- /*
79599
- Метод вычисляет зависимости для оператора.
79600
- Для того, чтобы калькулятор корректно реагировал на измнения необходимо сделать корректные зависимости:
79601
- 1) Если исходная множественность и множественность по которой строится группа совпадают, то необходио
79602
- для последней звёздочки построить зависимость не через PathTokens.current, а через PathTokens.each,
79603
- т.к. в таком случае пересчёт groupSum/groupCount должен тригетрися при изменении любого элемента в множественности, а не только текущего.
79604
- 2) Если множественности не совпадают, то количество звёздочек (getIterationRank()) в общей части будет разным и ничего дополнительно делать не нужно,
79605
- в зависимостях в CalculationFunction в данном случае все звёздочки превратятся в PathTokens.current.
79606
- */
79607
- calculatedGroupSumDependencyForSourcePath(targetKeyPath, sourcePath) {
79608
- const diffPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetKeyPath, sourcePath);
79609
- if (targetKeyPath.getIterationRank() > diffPaths.matchedPath.getIterationRank()) {
79610
- return {
79611
- currentDepsPath: diffPaths.matchedPath,
79612
- eachDepsPath: diffPaths.differentPath
79613
- };
79654
+ /***/ }),
79655
+
79656
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts":
79657
+ /*!*********************************************************************************************!*\
79658
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts ***!
79659
+ \*********************************************************************************************/
79660
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79661
+
79662
+ "use strict";
79663
+ __webpack_require__.r(__webpack_exports__);
79664
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79665
+ /* harmony export */ CommonHelperFunctionsGenerator: () => (/* binding */ CommonHelperFunctionsGenerator)
79666
+ /* harmony export */ });
79667
+ /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79668
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79669
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79670
+ /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79671
+ /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79672
+ /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79673
+
79674
+
79675
+
79676
+
79677
+
79678
+ class CommonHelperFunctionsGenerator {
79679
+ generate(commonHelpers) {
79680
+ if (commonHelpers.length === 0) {
79681
+ return "";
79614
79682
  }
79615
- const targetPathParts = diffPaths.matchedPath.getPathPartsAsArray();
79616
- const lastStarIndex = targetPathParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
79617
- const currentDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(targetPathParts.slice(0, lastStarIndex));
79618
- let eachDepsPath;
79619
- if (lastStarIndex === -1) {
79620
- eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...diffPaths.matchedPath.getPathParts(), ...diffPaths.differentPath.getPathParts()]);
79621
- } else {
79622
- var _targetPathParts$last;
79623
- eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([(_targetPathParts$last = targetPathParts[lastStarIndex]) !== null && _targetPathParts$last !== void 0 ? _targetPathParts$last : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)("path in groupSum is incorrect. Cannot create DepsPath for " + targetPathParts.join("/")), ...targetPathParts.slice(lastStarIndex + 1), ...diffPaths.differentPath.getPathParts()]);
79683
+ const helperFunctionsList = commonHelpers.map(helper => helper.filename).join(", ");
79684
+ const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79685
+ sourceType: "module"
79686
+ });
79687
+ const exportDefault = buildExportDefault();
79688
+ if (Array.isArray(exportDefault)) {
79689
+ throw new Error("InvalidProgramState: default export build failed");
79624
79690
  }
79625
- return {
79626
- currentDepsPath: currentDepsPath,
79627
- eachDepsPath: eachDepsPath
79628
- };
79629
- }
79630
- removeAttributePrefix(pathPart) {
79631
- return pathPart.replace(/\@/g, "");
79632
- }
79633
- removeMultiplicity(path) {
79634
- return path.replace(/\/\*/g, "");
79635
- }
79636
- getModelPath(prefix, path) {
79637
- return this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79691
+ const helpersStatements = [].concat(...commonHelpers.map(helper => {
79692
+ const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79693
+ return this.transform(helper.filename, ast);
79694
+ }), exportDefault);
79695
+ return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79638
79696
  }
79639
- modelPathInstance(target) {
79640
- return `ap([${[...target.getPathParts()].map(x => {
79641
- if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each) {
79642
- return "PathTokens.each";
79643
- }
79644
- if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current) {
79645
- return "PathTokens.current";
79646
- }
79647
- return JSON.stringify(x);
79648
- }).join(", ")}])`;
79697
+ transform(filename, ast) {
79698
+ const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79699
+ const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./"));
79700
+ return [...imports, result];
79649
79701
  }
79650
79702
  }
79651
79703
 
79652
79704
  /***/ }),
79653
79705
 
79654
- /***/ "./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts":
79655
- /*!***************************************************************************************!*\
79656
- !*** ./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts ***!
79657
- \***************************************************************************************/
79706
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts":
79707
+ /*!*******************************************************************************!*\
79708
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts ***!
79709
+ \*******************************************************************************/
79658
79710
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79659
79711
 
79660
79712
  "use strict";
79661
79713
  __webpack_require__.r(__webpack_exports__);
79662
79714
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79663
- /* harmony export */ KCXmlValidationGenerator: () => (/* binding */ KCXmlValidationGenerator)
79715
+ /* harmony export */ fileContentToAst: () => (/* binding */ fileContentToAst)
79664
79716
  /* harmony export */ });
79665
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
79666
- /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
79667
- /* harmony import */ var _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../KCXmlGenerator/KCXmlGeneratorBase */ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts");
79668
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
79669
- /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts");
79670
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
79671
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
79717
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79718
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79719
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79720
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79721
+
79722
+
79723
+ const fileContentToAst = helper => {
79724
+ const ast = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.parse)(helper.content, {
79725
+ sourceType: "module",
79726
+ filename: "fake-file-name.js",
79727
+ configFile: false,
79728
+ babelrc: false,
79729
+ plugins: [__webpack_require__(/*! @babel/plugin-syntax-jsx */ "./node_modules/@babel/plugin-syntax-jsx/lib/index.js")]
79730
+ });
79731
+ if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFile(ast)) {
79732
+ throw new Error(`InvalidProgramState: incorrect helper ${helper.filename}.js`);
79733
+ }
79734
+ return ast;
79735
+ };
79736
+
79737
+ /***/ }),
79672
79738
 
79739
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts":
79740
+ /*!***************************************************************************************!*\
79741
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts ***!
79742
+ \***************************************************************************************/
79743
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79673
79744
 
79745
+ "use strict";
79746
+ __webpack_require__.r(__webpack_exports__);
79747
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79748
+ /* harmony export */ HelperFunctionsGenerator: () => (/* binding */ HelperFunctionsGenerator)
79749
+ /* harmony export */ });
79750
+ /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79751
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79752
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79753
+ /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79754
+ /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79755
+ /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79674
79756
 
79675
79757
 
79676
79758
 
79677
79759
 
79678
79760
 
79679
- const emptyResult = `
79680
- export default function kcXmlValidationConfigurator ({ form, ModelPath, ValidationFunction, KCCondition }) {}
79681
- `;
79682
- class KCXmlValidationGenerator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.KCXmlGeneratorBase {
79683
- generate(kcXmlConditions, options) {
79684
- const compiledConditions = Iterator.from(kcXmlConditions).map(condition => this.compileCondition(condition, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.isNotNullOrUndefined).toArray();
79685
- if (compiledConditions.length === 0) {
79686
- // NOTE Просто, чтоб не падали аппрувал тесты
79687
- return emptyResult;
79688
- }
79689
- const result = `export default function kcXmlValidationConfigurator ({ form, ap, ValidationFunction, KCCondition, PathTokens }) {
79690
- ${compiledConditions.map(x => `form.calculator2.addCalculationFunction(${x});`).join("\n")}
79691
- }
79692
- `;
79693
- return result;
79694
- }
79695
- compileCondition(condition, options) {
79696
- var _condition$descriptio, _condition$errorLevel;
79697
- const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(condition.match)), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
79698
- const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(condition.target)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79699
- const deps = [];
79700
- const compiledExpression = this.compileExpressionWithUnsupportedHandled(prefix, target, condition.expression, deps);
79701
- if (compiledExpression instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
79702
- if (options.skipNotSupportedFunction) {
79703
- return undefined;
79704
- } else {
79705
- throw compiledExpression;
79706
- }
79761
+ class HelperFunctionsGenerator {
79762
+ generate(helpers) {
79763
+ if (helpers.length === 0) {
79764
+ return "";
79707
79765
  }
79708
- const compiledDescriptionParts = (0,_AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_4__.splitConditionDescriptionToParts)((_condition$descriptio = condition.description) !== null && _condition$descriptio !== void 0 ? _condition$descriptio : "Error Message");
79709
- let concatDescription;
79710
- if (compiledDescriptionParts.length > 1) {
79711
- concatDescription = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression();
79712
- concatDescription.arguments = compiledDescriptionParts;
79713
- } else {
79714
- concatDescription = compiledDescriptionParts[0];
79766
+ const helperFunctionsList = helpers.map(helper => helper.filename).join(", ");
79767
+ const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79768
+ sourceType: "module"
79769
+ });
79770
+ const exportDefault = buildExportDefault();
79771
+ if (Array.isArray(exportDefault)) {
79772
+ throw new Error("InvalidProgramState: default export build failed");
79715
79773
  }
79716
- const compiledDescription = this.compileExpression(prefix, target, concatDescription, deps);
79717
- const compiledTarget = this.modelPathInstance(target);
79718
- const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.distinctBy(deps.map(x => ({
79719
- path: x.asDependencyModelPath(),
79720
- isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.isDependencyWithoutChecks)(x),
79721
- pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
79722
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
79723
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
79724
- const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `(expression) => ${compiledDescription}, "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
79725
- return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
79774
+ const helpersStatements = [].concat(...helpers.map(helper => {
79775
+ const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79776
+ return this.transform(helper.filename, ast);
79777
+ }), exportDefault);
79778
+ return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79779
+ }
79780
+ transform(filename, ast) {
79781
+ const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79782
+ const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./")).map(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && x.source.value.includes("/jsHelpers/") ? _babel_types__WEBPACK_IMPORTED_MODULE_1__.importDeclaration(x.specifiers.map(s => _babel_types__WEBPACK_IMPORTED_MODULE_1__.importSpecifier(s.local, s.local)), _babel_types__WEBPACK_IMPORTED_MODULE_1__.stringLiteral("./commonHelperFunctions")) : x);
79783
+ return [...imports, result];
79726
79784
  }
79727
79785
  }
79728
79786
 
79729
79787
  /***/ }),
79730
79788
 
79789
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts":
79790
+ /*!*******************************************************************************!*\
79791
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts ***!
79792
+ \*******************************************************************************/
79793
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79794
+
79795
+ "use strict";
79796
+ __webpack_require__.r(__webpack_exports__);
79797
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79798
+ /* harmony export */ statementsToCode: () => (/* binding */ statementsToCode)
79799
+ /* harmony export */ });
79800
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79801
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79802
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79803
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79804
+
79805
+
79806
+ const statementsToCode = statements => {
79807
+ const transformResult = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.transformFromAstSync)(_babel_types__WEBPACK_IMPORTED_MODULE_0__.program(statements), undefined, {
79808
+ configFile: false,
79809
+ sourceType: "module"
79810
+ });
79811
+ if (transformResult == undefined || transformResult.code == undefined) {
79812
+ throw new Error("InvalidProgramState: statements transform failed");
79813
+ }
79814
+ const {
79815
+ code
79816
+ } = transformResult;
79817
+ return unescape(code.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
79818
+ };
79819
+
79820
+ /***/ }),
79821
+
79731
79822
  /***/ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts":
79732
79823
  /*!***********************************************************************************************!*\
79733
79824
  !*** ./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts ***!
@@ -79913,12 +80004,12 @@ __webpack_require__.r(__webpack_exports__);
79913
80004
  /* harmony import */ var _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts");
79914
80005
  /* harmony import */ var _FormSourcesBuilder_FormSourcesBuilder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./FormSourcesBuilder/FormSourcesBuilder */ "./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts");
79915
80006
  /* harmony import */ var _HelperFunctionsGenerator_HelperFunctionsGenerator__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./HelperFunctionsGenerator/HelperFunctionsGenerator */ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts");
79916
- /* harmony import */ var _KCXmlValidationGenerator_KCXmlValidationGenerator__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./KCXmlValidationGenerator/KCXmlValidationGenerator */ "./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts");
80007
+ /* harmony import */ var _Calculator2Generator_ValidationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Calculator2Generator/ValidationsCalculator2Generator */ "./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts");
79917
80008
  /* harmony import */ var _RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./RequisiteLIst/requisiteList */ "./Generator/src/generators/RequisiteLIst/requisiteList.ts");
79918
80009
  /* harmony import */ var _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./ServerSideFLangNormalization/NormalizationRulesGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/NormalizationRulesGenerator.ts");
79919
80010
  /* harmony import */ var _DataDeclarationGenerator_DataDeclarationGenerationTimeHelper__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./DataDeclarationGenerator/DataDeclarationGenerationTimeHelper */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts");
79920
80011
  /* harmony import */ var _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./AttachmentPaths/AttachmentPathsGenerator */ "./Generator/src/generators/AttachmentPaths/AttachmentPathsGenerator.ts");
79921
- /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts");
80012
+ /* harmony import */ var _Calculator2Generator_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Calculator2Generator/AutoCalculationsCalculator2Generator */ "./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts");
79922
80013
  /* harmony import */ var _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator */ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts");
79923
80014
  /* harmony import */ var _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts");
79924
80015
  /* harmony import */ var _HelperFunctionsGenerator_CommonHelperFunctionsGenerator__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./HelperFunctionsGenerator/CommonHelperFunctionsGenerator */ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts");
@@ -80081,11 +80172,11 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
80081
80172
  const rngSchemaValidationConfigurator = validationGenerator.generateRngSchemaValidationConfigurator();
80082
80173
  builder.addResource("rngSchemaValidationConfigurator.js", rngSchemaValidationConfigurator);
80083
80174
  const formulasForCalculator2 = useCalculator2 ? formulas : [];
80084
- const kcXmlAutoCalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__.AutoCalculationsCalculator2Generator(formSchemaRng, dataDeclarationHelper);
80175
+ const kcXmlAutoCalcGenerator = new _Calculator2Generator_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__.AutoCalculationsCalculator2Generator(formSchemaRng, dataDeclarationHelper);
80085
80176
  builder.addResource("kcXmlAutoCalculationConfigurator.js", kcXmlAutoCalcGenerator.generate(formulasForCalculator2, {
80086
80177
  skipNotSupportedFunction: useServerCalculations
80087
80178
  }));
80088
- const kcXmlValidationGenerator = new _KCXmlValidationGenerator_KCXmlValidationGenerator__WEBPACK_IMPORTED_MODULE_23__.KCXmlValidationGenerator(formSchemaRng);
80179
+ const kcXmlValidationGenerator = new _Calculator2Generator_ValidationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_23__.ValidationsCalculator2Generator(formSchemaRng);
80089
80180
  const kcXmlConditionsForCalculator2 = kcXmlConditions;
80090
80181
  builder.addResource("kcXmlValidationConfigurator.js", kcXmlValidationGenerator.generate(kcXmlConditionsForCalculator2, {
80091
80182
  skipNotSupportedFunction: useServerCalculations
@@ -80597,7 +80688,7 @@ class CustomKCLangToFlangRuleGenerator {
80597
80688
  const defaultValue = this.dataDeclarationHelper.getDefaultValue(fullTarget.toLegacyPath());
80598
80689
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
80599
80690
  const result = [];
80600
- const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.StringLiteralExpression(defaultValue));
80691
+ const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.StringLiteralExpression(defaultValue));
80601
80692
  if (isTargetAutoField) {
80602
80693
  result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.BuildInTypeExpression.string)));
80603
80694
  } else {
@@ -81151,6 +81242,7 @@ __webpack_require__.r(__webpack_exports__);
81151
81242
  /* harmony export */ StringLiteralExpression: () => (/* binding */ StringLiteralExpression),
81152
81243
  /* harmony export */ SubstringExpression: () => (/* binding */ SubstringExpression),
81153
81244
  /* harmony export */ SumBinaryExpression: () => (/* binding */ SumBinaryExpression),
81245
+ /* harmony export */ TernaryConditionalExpression: () => (/* binding */ TernaryConditionalExpression),
81154
81246
  /* harmony export */ TrimExpression: () => (/* binding */ TrimExpression),
81155
81247
  /* harmony export */ TypeReferenceExpression: () => (/* binding */ TypeReferenceExpression),
81156
81248
  /* harmony export */ UnaryExpression: () => (/* binding */ UnaryExpression),
@@ -81363,7 +81455,7 @@ class MinusBinaryExpression extends BinaryExpression {
81363
81455
  }
81364
81456
  class MultiplicativeBinaryExpression extends BinaryExpression {
81365
81457
  needAddBraces(child) {
81366
- return !(child instanceof NegateUnaryExpression || child instanceof ValueReferenceExpression || child instanceof ArgumentReferenceExpression || child instanceof SumBinaryExpression || child instanceof MinusBinaryExpression || child instanceof CastExpression || child instanceof ConstExpression);
81458
+ return !(child instanceof NegateUnaryExpression || child instanceof ValueReferenceExpression || child instanceof ArgumentReferenceExpression || child instanceof CastExpression || child instanceof ConstExpression);
81367
81459
  }
81368
81460
  getType() {
81369
81461
  return BuildInTypeExpression.decimal;
@@ -82030,6 +82122,7 @@ class ConditionalExpression extends FLangExpression {
82030
82122
  return `${condition} ? ${this.trueResult.convertToString()} : ${this.falseResult.convertToString()}`;
82031
82123
  }
82032
82124
  }
82125
+ class TernaryConditionalExpression extends ConditionalExpression {}
82033
82126
  class DateNowExpression extends DateTimeExpression {
82034
82127
  getChildNodes() {
82035
82128
  return [];
@@ -82423,13 +82516,10 @@ __webpack_require__.r(__webpack_exports__);
82423
82516
  /* harmony export */ ensureOperandsOfTypeOrNull: () => (/* binding */ ensureOperandsOfTypeOrNull),
82424
82517
  /* harmony export */ getAllExpressionChildren: () => (/* binding */ getAllExpressionChildren),
82425
82518
  /* harmony export */ nullCoalesceWithTypeCheck: () => (/* binding */ nullCoalesceWithTypeCheck),
82426
- /* harmony export */ tryExtractValueReferenceAsStringFromDecimal: () => (/* binding */ tryExtractValueReferenceAsStringFromDecimal),
82427
- /* harmony export */ wrapWithArgumentsCondition: () => (/* binding */ wrapWithArgumentsCondition)
82519
+ /* harmony export */ tryExtractValueReferenceAsStringFromDecimal: () => (/* binding */ tryExtractValueReferenceAsStringFromDecimal)
82428
82520
  /* harmony export */ });
82429
82521
  /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
82430
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
82431
- /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
82432
-
82522
+ /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
82433
82523
 
82434
82524
 
82435
82525
  function* getAllExpressionChildren(node, descendantsFilter) {
@@ -82441,69 +82531,56 @@ function* getAllExpressionChildren(node, descendantsFilter) {
82441
82531
  }
82442
82532
  }
82443
82533
  }
82444
- function wrapWithArgumentsCondition(expression) {
82445
- const childFilter = node => !(node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ReduceCallExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.GetSumByKeysExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NoDepsExpression);
82446
- const allValueRefNodes = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat([expression], getAllExpressionChildren(expression, childFilter)).map(x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression ? x : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined);
82447
- const uniquePaths = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allValueRefNodes, x => x.convertToString());
82448
- const conditionExpression = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.reduce(uniquePaths, (acc, curr) => {
82449
- const currExpr = new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullLiteralExpression()), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("")));
82450
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, currExpr) : currExpr;
82451
- }, undefined);
82452
- if (conditionExpression == undefined) {
82453
- return expression;
82454
- }
82455
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ConditionalExpression(conditionExpression, expression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullLiteralExpression());
82456
- }
82457
82534
  function combineRulesWithOptionalSectionChecking(allRules, optionalSectionRulesBuilder) {
82458
- const allUniqueRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allRules, x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement ? x.left.convertToString() : x.convertToString());
82535
+ const allUniqueRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allRules, x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement ? x.left.convertToString() : x.convertToString());
82459
82536
  const allUniqueRulesWithOptionalChecks = Iterator.from(optionalSectionRulesBuilder.wrapRulesWithOptionalPageCheck(allUniqueRules)).map(x => x.convertToString()).reduce((x, y) => x + (x ? "\n" : "") + y, "");
82460
82537
  return allUniqueRulesWithOptionalChecks;
82461
82538
  }
82462
82539
  function tryExtractValueReferenceAsStringFromDecimal(expression) {
82463
- if (expression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal && expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
82540
+ if (expression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal && expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression) {
82464
82541
  return expression.targetExpression;
82465
82542
  }
82466
82543
  return expression;
82467
82544
  }
82468
82545
  function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82469
- if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82470
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82546
+ if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateNowExpression) {
82547
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression("dd.MM.yyyy"));
82471
82548
  }
82472
- if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.HashSetExpression) {
82473
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SerializeEnumerationExpression(operandExpression);
82549
+ if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.HashSetExpression) {
82550
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SerializeEnumerationExpression(operandExpression);
82474
82551
  }
82475
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.string ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.string, decimalFormat != undefined && operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression(decimalFormat) : undefined) : operandExpression;
82552
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.string ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.string, decimalFormat != undefined && operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(decimalFormat) : undefined) : operandExpression;
82476
82553
  }
82477
82554
  function castOperandToBoolIfNeed(operandExpression) {
82478
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.bool ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.bool) : operandExpression;
82555
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.bool ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.bool) : operandExpression;
82479
82556
  }
82480
82557
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82481
- return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
82558
+ return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
82482
82559
  }
82483
- const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82560
+ const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal) : ex;
82484
82561
  function castOperandToDateTimeIfNeed(operandExpression) {
82485
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime) : operandExpression;
82562
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.dateTime) : operandExpression;
82486
82563
  }
82487
82564
  function nullCoalesceWithTypeCheck(argument, replacement) {
82488
- const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null;
82565
+ const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null;
82489
82566
  if (!isValid) {
82490
82567
  throw new Error("Couldn't build null coalesce expression: types not match");
82491
82568
  }
82492
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullCoalesceExpression(argument, replacement);
82569
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullCoalesceExpression(argument, replacement);
82493
82570
  }
82494
82571
  function ensureOperandsOfTypeOrNull(type, ...operands) {
82495
82572
  for (const operand of operands) {
82496
82573
  const operandType = operand.getType();
82497
- if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null && operandType !== type) {
82574
+ if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null && operandType !== type) {
82498
82575
  throw new Error(`Invalid operand type: required [${type}] but got ${operandType}`);
82499
82576
  }
82500
82577
  }
82501
82578
  }
82502
82579
  function combineByOrFlangExpr(acc, current) {
82503
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, current) : current;
82580
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.OrBinaryExpression(acc, current) : current;
82504
82581
  }
82505
82582
  function combineByAndFlangExpr(acc, current) {
82506
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(acc, current) : current;
82583
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.AndBinaryExpression(acc, current) : current;
82507
82584
  }
82508
82585
 
82509
82586
  /***/ }),
@@ -82779,7 +82856,7 @@ class FormulaExpressionToFlangExpressionConverter {
82779
82856
  const thenExpr = this.compileExpressionToFlangExpressionInternal(expression.thenNode.expression, prefix, target, addPrecalculationRule);
82780
82857
  const elseExpr = this.compileExpressionToFlangExpressionInternal(expression.elseNode.expression, prefix, target, addPrecalculationRule);
82781
82858
  const castToStringRequired = thenExpr.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.string || elseExpr.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.string;
82782
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ConditionalExpression(condExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(thenExpr) : thenExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(elseExpr) : elseExpr);
82859
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.TernaryConditionalExpression(condExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(thenExpr) : thenExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(elseExpr) : elseExpr);
82783
82860
  }
82784
82861
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaMultiplyExpression) {
82785
82862
  return this.compileMultiplyExpression(expression, prefix, target, addPrecalculationRule);
@@ -83093,7 +83170,7 @@ class FormulaExpressionToFlangExpressionConverter {
83093
83170
  if (result == undefined) {
83094
83171
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83095
83172
  }
83096
- return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83173
+ return result;
83097
83174
  }
83098
83175
  compileConcatExpression(expression, prefix, target, addPrecalculationRule) {
83099
83176
  const result = expression.arguments.reduce((acc, curr) => {
@@ -83133,7 +83210,7 @@ class FormulaExpressionToFlangExpressionConverter {
83133
83210
  if (result == undefined) {
83134
83211
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83135
83212
  }
83136
- return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83213
+ return result;
83137
83214
  }
83138
83215
  compileDivisionExpression(expression, prefix, target, addPrecalculationRule) {
83139
83216
  const makeDivision = (numerator, denominator) => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.NotEqExpression(denominator, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DecimalLiteralExpression(0)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DivisionBinaryExpression(numerator, denominator), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.NullLiteralExpression());
@@ -83144,7 +83221,7 @@ class FormulaExpressionToFlangExpressionConverter {
83144
83221
  if (result == undefined) {
83145
83222
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83146
83223
  }
83147
- return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83224
+ return result;
83148
83225
  }
83149
83226
  preparePathAndAdjustMultiplicity(prefix, path) {
83150
83227
  const resultPath = this.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(path.replace(/\@/g, ""), false)).normalize());
@@ -83208,7 +83285,7 @@ class FormulaOnlyNormalizationRuleGenerator {
83208
83285
  const defaultValue = this.dataDeclarationHelper.getDefaultValue(fullTarget.toLegacyPath());
83209
83286
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83210
83287
  const result = [];
83211
- const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.StringLiteralExpression(defaultValue));
83288
+ const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.StringLiteralExpression(defaultValue));
83212
83289
  if (isTargetAutoField) {
83213
83290
  result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.BuildInTypeExpression.string)));
83214
83291
  } else {
@@ -83396,7 +83473,7 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83396
83473
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83397
83474
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83398
83475
  const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83399
- const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, targetField), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue));
83476
+ const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, targetField), x => precalculationRules.push(x)), "G29"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue));
83400
83477
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83401
83478
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83402
83479
  const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;