procode-lowcode-core 1.0.14 → 1.0.15

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.
package/dist/index.js CHANGED
@@ -457,22 +457,13 @@ class CentralService {
457
457
  configurable: true,
458
458
  writable: true,
459
459
  value: (response, responseConfig) => {
460
- var _a, _b;
460
+ var _a;
461
461
  const statusRelatedConfig = (responseConfig !== null && responseConfig !== void 0 ? responseConfig : {})[response === null || response === void 0 ? void 0 : response.status];
462
462
  let errorMessage = "";
463
- if ((statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.alertType) === AlertType.FIELDVALIDATION) {
464
- errorMessage = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.message;
465
- if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
466
- errorMessage =
467
- (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.message) ||
468
- errorMessage ||
469
- ErrorMessageProvider.get(response.config.method, response === null || response === void 0 ? void 0 : response.status);
470
- }
471
- }
472
- else if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
463
+ if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
473
464
  errorMessage =
474
465
  (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.message) ||
475
- ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.message) ||
466
+ ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.message) ||
476
467
  ErrorMessageProvider.get(response.config.method, response === null || response === void 0 ? void 0 : response.status);
477
468
  }
478
469
  return errorMessage;
@@ -570,7 +561,7 @@ var ActionType;
570
561
  ActionType["CUSTOM"] = "CUSTOM";
571
562
  ActionType["TEMPLATE"] = "TEMPLATE";
572
563
  })(ActionType || (ActionType = {}));
573
- var ValueReplacePolicy$1;
564
+ exports.ValueReplacePolicy = void 0;
574
565
  (function (ValueReplacePolicy) {
575
566
  ValueReplacePolicy["STATE"] = "STATE";
576
567
  ValueReplacePolicy["STATE_SELECTED_DATA"] = "STATE_SELECTED_DATA";
@@ -579,7 +570,7 @@ var ValueReplacePolicy$1;
579
570
  ValueReplacePolicy["SELF"] = "SELF";
580
571
  ValueReplacePolicy["QUERYPARAMS"] = "QUERYPARAMS";
581
572
  ValueReplacePolicy["ROUTEPARAMS"] = "ROUTEPARAMS";
582
- })(ValueReplacePolicy$1 || (ValueReplacePolicy$1 = {}));
573
+ })(exports.ValueReplacePolicy || (exports.ValueReplacePolicy = {}));
583
574
 
584
575
  const getValueFromNestedObject = (fieldName, object) => {
585
576
  if (!fieldName || typeof fieldName !== "string")
@@ -705,13 +696,13 @@ const routeParamHandler = (url, param, eventService, routeParams) => {
705
696
  };
706
697
 
707
698
  const replaceHandlers = {
708
- [ValueReplacePolicy$1.SELF]: selfHandler,
709
- [ValueReplacePolicy$1.STATE]: stateHandler,
710
- [ValueReplacePolicy$1.STATE_SELECTED_DATA]: stateSelectedHandler,
711
- [ValueReplacePolicy$1.STORAGE]: storageHandler,
712
- [ValueReplacePolicy$1.ENVIROMENT]: enviromentHandler,
713
- [ValueReplacePolicy$1.QUERYPARAMS]: queryParamHandler,
714
- [ValueReplacePolicy$1.ROUTEPARAMS]: routeParamHandler,
699
+ [exports.ValueReplacePolicy.SELF]: selfHandler,
700
+ [exports.ValueReplacePolicy.STATE]: stateHandler,
701
+ [exports.ValueReplacePolicy.STATE_SELECTED_DATA]: stateSelectedHandler,
702
+ [exports.ValueReplacePolicy.STORAGE]: storageHandler,
703
+ [exports.ValueReplacePolicy.ENVIROMENT]: enviromentHandler,
704
+ [exports.ValueReplacePolicy.QUERYPARAMS]: queryParamHandler,
705
+ [exports.ValueReplacePolicy.ROUTEPARAMS]: routeParamHandler,
715
706
  };
716
707
  const replaceRequestParams = (url, params, eventService, routeParams) => {
717
708
  params.forEach((param) => {
@@ -18556,11 +18547,11 @@ const getParams = (config, actionInvokerProps, selectedValue) => {
18556
18547
  (_a = config.params) === null || _a === void 0 ? void 0 : _a.forEach((p) => {
18557
18548
  var _a, _b;
18558
18549
  let value = "";
18559
- if (((_a = p === null || p === void 0 ? void 0 : p.rightOperand) === null || _a === void 0 ? void 0 : _a.valueReplacePolicy) === ValueReplacePolicy$1.STATE) {
18550
+ if (((_a = p === null || p === void 0 ? void 0 : p.rightOperand) === null || _a === void 0 ? void 0 : _a.valueReplacePolicy) === exports.ValueReplacePolicy.STATE) {
18560
18551
  value = getValueFromNestedObject(p.rightOperand.value, actionInvokerProps.viewModel);
18561
18552
  }
18562
18553
  else if (((_b = p === null || p === void 0 ? void 0 : p.rightOperand) === null || _b === void 0 ? void 0 : _b.valueReplacePolicy) ===
18563
- ValueReplacePolicy$1.STATE_SELECTED_DATA) {
18554
+ exports.ValueReplacePolicy.STATE_SELECTED_DATA) {
18564
18555
  const fields = p.rightOperand.value.split("::");
18565
18556
  let model = getValueFromNestedObject(fields[0], actionInvokerProps.viewModel);
18566
18557
  model = model === null || model === void 0 ? void 0 : model.find((m) => { var _a; return m[(_a = selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.dataItemKey) !== null && _a !== void 0 ? _a : "id"] === (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.value); });
@@ -18873,6 +18864,37 @@ class ActionInvoker {
18873
18864
  }
18874
18865
  }
18875
18866
 
18867
+ const isBoundOperand = (input) => typeof input === "object" &&
18868
+ input !== null &&
18869
+ "valueReplacePolicy" in input;
18870
+ const resolveBoundValue = (bound, viewModel) => {
18871
+ if (!isBoundOperand(bound))
18872
+ return bound;
18873
+ switch (bound.valueReplacePolicy) {
18874
+ case exports.ValueReplacePolicy.SELF:
18875
+ return bound.value;
18876
+ case exports.ValueReplacePolicy.STATE:
18877
+ return getValueFromNestedObject(bound.value, viewModel);
18878
+ default:
18879
+ return bound.value;
18880
+ }
18881
+ };
18882
+ const BOUND_PROP_NAMES = [
18883
+ "min",
18884
+ "max",
18885
+ "minDate",
18886
+ "maxDate",
18887
+ "minLength",
18888
+ "maxLength",
18889
+ "minResizeHeight",
18890
+ "maxResizeHeight",
18891
+ "minResizeWidth",
18892
+ "maxResizeWidth",
18893
+ "step",
18894
+ "placeHolder",
18895
+ "disabled",
18896
+ ];
18897
+
18876
18898
  var StandardValidationType;
18877
18899
  (function (StandardValidationType) {
18878
18900
  StandardValidationType["REQUIRED"] = "REQUIRED";
@@ -19352,7 +19374,16 @@ const useWidgetProps = (schemaElementProps, viewModel, validation, eventService,
19352
19374
  return;
19353
19375
  }
19354
19376
  const events = getEvents();
19355
- setWidgetProps(Object.assign(Object.assign(Object.assign(Object.assign({}, schemaElementProps), { id: schemaElementProps === null || schemaElementProps === void 0 ? void 0 : schemaElementProps.id, value: getScreenDataFieldValue(), listData: getSupportiveDataFieldValue(), uiElementGroupData: getUiElementGroupData(), validations: getValidationProperty(), eventService: eventService, viewModel: viewModel }), events), { dynamicEvents: events }));
19377
+ setWidgetProps(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, schemaElementProps), getResolvedBoundProps()), { id: schemaElementProps === null || schemaElementProps === void 0 ? void 0 : schemaElementProps.id, value: getScreenDataFieldValue(), listData: getSupportiveDataFieldValue(), uiElementGroupData: getUiElementGroupData(), validations: getValidationProperty(), eventService: eventService, viewModel: viewModel }), events), { dynamicEvents: events }));
19378
+ };
19379
+ const getResolvedBoundProps = () => {
19380
+ const resolved = {};
19381
+ BOUND_PROP_NAMES.forEach((name) => {
19382
+ if (name in schemaElementProps) {
19383
+ resolved[name] = resolveBoundValue(schemaElementProps[name], viewModel);
19384
+ }
19385
+ });
19386
+ return resolved;
19356
19387
  };
19357
19388
  const getEvents = () => {
19358
19389
  if (!(schemaElementProps === null || schemaElementProps === void 0 ? void 0 : schemaElementProps.events))
@@ -20641,10 +20672,12 @@ const coreStyles = './Assets/styles/index.scss';
20641
20672
  // Utility function to get styles path
20642
20673
  const getCoreStylesPath = () => coreStyles;
20643
20674
 
20675
+ exports.BOUND_PROP_NAMES = BOUND_PROP_NAMES;
20644
20676
  exports.Core = Core$1;
20645
20677
  exports.EventService = EventService;
20646
20678
  exports.coreStyles = coreStyles;
20647
20679
  exports.default = Core$1;
20648
20680
  exports.getCoreStylesPath = getCoreStylesPath;
20649
20681
  exports.resolveAppPath = resolveAppPath;
20682
+ exports.resolveBoundValue = resolveBoundValue;
20650
20683
  //# sourceMappingURL=index.js.map