procode-lowcode-core 1.0.13 → 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.esm.js CHANGED
@@ -154,15 +154,15 @@ const CellRenderer = ({ colIndex, rowIndex, colSpan, rowSpan, placeSelf, widgetS
154
154
  if (rowIndex && rowSpan) {
155
155
  styles = Object.assign(Object.assign({}, styles), { gridRow: `${rowIndex} / span ${rowSpan} ` });
156
156
  }
157
- return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || "", style: styles }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
157
+ return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || "", "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, style: styles }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
158
158
  };
159
159
 
160
160
  const GenericLayoutRenderer = ({ numOfColumns, noOfRows, columnGap, rowGap, placeItems, placeContent, cells, widgetStyle, isCompletedSetup, eventService, }) => {
161
- return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: `${(widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || ""}`, style: Object.assign(Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})), { display: "grid", gridColumnGap: `${columnGap}px`, gridRowGap: `${rowGap}px`, gridTemplateColumns: `repeat(${numOfColumns}, 1fr)`, gridTemplateRows: `repeat(${noOfRows}, 1fr)`, placeItems: placeItems, placeContent: placeContent }) }, { children: cells === null || cells === void 0 ? void 0 : cells.map((cell) => (jsx(CellRenderer, Object.assign({}, cell, { isCompletedSetup: isCompletedSetup, eventService: eventService }), cell.id))) })));
161
+ return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: `${(widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || ""}`, "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, style: Object.assign(Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})), { display: "grid", gridColumnGap: `${columnGap}px`, gridRowGap: `${rowGap}px`, gridTemplateColumns: `repeat(${numOfColumns}, 1fr)`, gridTemplateRows: `repeat(${noOfRows}, 1fr)`, placeItems: placeItems, placeContent: placeContent }) }, { children: cells === null || cells === void 0 ? void 0 : cells.map((cell) => (jsx(CellRenderer, Object.assign({}, cell, { isCompletedSetup: isCompletedSetup, eventService: eventService }), cell.id))) })));
162
162
  };
163
163
 
164
164
  const LayoutRenderer$1 = ({ columnGap, rowGap, placeItems, placeContent, cells, gridTemplateColumns, gridTemplateRows, widgetStyle, isCompletedSetup, eventService, }) => {
165
- return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: `${(widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || ""}`, style: Object.assign(Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})), { display: "grid", gridColumnGap: `${columnGap}`, gridRowGap: `${rowGap}`, gridTemplateColumns: gridTemplateColumns, gridTemplateRows: gridTemplateRows, placeItems: placeItems, placeContent: placeContent }) }, { children: cells === null || cells === void 0 ? void 0 : cells.map((cell) => (jsx(CellRenderer, Object.assign({}, cell, { isCompletedSetup: isCompletedSetup, eventService: eventService }), cell.id))) })));
165
+ return (jsx("div", Object.assign({ id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", className: `${(widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || ""}`, "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, style: Object.assign(Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})), { display: "grid", gridColumnGap: `${columnGap}`, gridRowGap: `${rowGap}`, gridTemplateColumns: gridTemplateColumns, gridTemplateRows: gridTemplateRows, placeItems: placeItems, placeContent: placeContent }) }, { children: cells === null || cells === void 0 ? void 0 : cells.map((cell) => (jsx(CellRenderer, Object.assign({}, cell, { isCompletedSetup: isCompletedSetup, eventService: eventService }), cell.id))) })));
166
166
  };
167
167
 
168
168
  const LayoutRenderer = ({ columnGap, rowGap, placeItems, placeContent, cells, gridTemplateColumns, gridTemplateRows, widgetStyle, isCompletedSetup, eventService, }) => {
@@ -189,7 +189,7 @@ const LayOutRenderer = ({ layout, isCompletedSetup, eventService, }) => {
189
189
 
190
190
  function Container({ id, children = [], widgetStyle, toolTip, label, helperText, disabled, isCompletedSetup, eventService, }) {
191
191
  var _a, _b, _c;
192
- return (jsx("div", Object.assign({ id: (_a = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) !== null && _a !== void 0 ? _a : "", className: `${(_b = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) !== null && _b !== void 0 ? _b : ""}`, style: Object.assign({}, ((_c = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) !== null && _c !== void 0 ? _c : {})) }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
192
+ return (jsx("div", Object.assign({ id: (_a = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) !== null && _a !== void 0 ? _a : "", className: `${(_b = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) !== null && _b !== void 0 ? _b : ""}`, "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, style: Object.assign({}, ((_c = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) !== null && _c !== void 0 ? _c : {})) }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
193
193
  }
194
194
 
195
195
  const ContainerRenderer = (props) => {
@@ -453,22 +453,13 @@ class CentralService {
453
453
  configurable: true,
454
454
  writable: true,
455
455
  value: (response, responseConfig) => {
456
- var _a, _b;
456
+ var _a;
457
457
  const statusRelatedConfig = (responseConfig !== null && responseConfig !== void 0 ? responseConfig : {})[response === null || response === void 0 ? void 0 : response.status];
458
458
  let errorMessage = "";
459
- if ((statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.alertType) === AlertType.FIELDVALIDATION) {
460
- errorMessage = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.message;
461
- if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
462
- errorMessage =
463
- (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.message) ||
464
- errorMessage ||
465
- ErrorMessageProvider.get(response.config.method, response === null || response === void 0 ? void 0 : response.status);
466
- }
467
- }
468
- else if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
459
+ if (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.enableMessage) {
469
460
  errorMessage =
470
461
  (statusRelatedConfig === null || statusRelatedConfig === void 0 ? void 0 : statusRelatedConfig.message) ||
471
- ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.message) ||
462
+ ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.message) ||
472
463
  ErrorMessageProvider.get(response.config.method, response === null || response === void 0 ? void 0 : response.status);
473
464
  }
474
465
  return errorMessage;
@@ -18869,6 +18860,37 @@ class ActionInvoker {
18869
18860
  }
18870
18861
  }
18871
18862
 
18863
+ const isBoundOperand = (input) => typeof input === "object" &&
18864
+ input !== null &&
18865
+ "valueReplacePolicy" in input;
18866
+ const resolveBoundValue = (bound, viewModel) => {
18867
+ if (!isBoundOperand(bound))
18868
+ return bound;
18869
+ switch (bound.valueReplacePolicy) {
18870
+ case ValueReplacePolicy$1.SELF:
18871
+ return bound.value;
18872
+ case ValueReplacePolicy$1.STATE:
18873
+ return getValueFromNestedObject(bound.value, viewModel);
18874
+ default:
18875
+ return bound.value;
18876
+ }
18877
+ };
18878
+ const BOUND_PROP_NAMES = [
18879
+ "min",
18880
+ "max",
18881
+ "minDate",
18882
+ "maxDate",
18883
+ "minLength",
18884
+ "maxLength",
18885
+ "minResizeHeight",
18886
+ "maxResizeHeight",
18887
+ "minResizeWidth",
18888
+ "maxResizeWidth",
18889
+ "step",
18890
+ "placeHolder",
18891
+ "disabled",
18892
+ ];
18893
+
18872
18894
  var StandardValidationType;
18873
18895
  (function (StandardValidationType) {
18874
18896
  StandardValidationType["REQUIRED"] = "REQUIRED";
@@ -19348,7 +19370,16 @@ const useWidgetProps = (schemaElementProps, viewModel, validation, eventService,
19348
19370
  return;
19349
19371
  }
19350
19372
  const events = getEvents();
19351
- 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, "sssss": "ss" }), events), { dynamicEvents: events }));
19373
+ 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 }));
19374
+ };
19375
+ const getResolvedBoundProps = () => {
19376
+ const resolved = {};
19377
+ BOUND_PROP_NAMES.forEach((name) => {
19378
+ if (name in schemaElementProps) {
19379
+ resolved[name] = resolveBoundValue(schemaElementProps[name], viewModel);
19380
+ }
19381
+ });
19382
+ return resolved;
19352
19383
  };
19353
19384
  const getEvents = () => {
19354
19385
  if (!(schemaElementProps === null || schemaElementProps === void 0 ? void 0 : schemaElementProps.events))
@@ -19432,7 +19463,7 @@ const useWidgetProps = (schemaElementProps, viewModel, validation, eventService,
19432
19463
  };
19433
19464
 
19434
19465
  const Widget = ({ schemaElementProps, viewModel, validation, navigate, eventService, }) => {
19435
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19466
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
19436
19467
  const widgetProps = useWidgetProps(schemaElementProps, viewModel, validation, eventService, navigate);
19437
19468
  const standardWidgets = (_a = AppDependenceyProvider.getInstance()
19438
19469
  .getWidgetProvider()) === null || _a === void 0 ? void 0 : _a.getWidgets();
@@ -19440,9 +19471,23 @@ const Widget = ({ schemaElementProps, viewModel, validation, navigate, eventServ
19440
19471
  .getTempleteWidgetProvider()) === null || _b === void 0 ? void 0 : _b.getWidgets();
19441
19472
  const customWidgets = (_c = AppDependenceyProvider.getInstance()
19442
19473
  .getCustomWidgetProvider()) === null || _c === void 0 ? void 0 : _c.getWidgets();
19443
- const WidgetComponent = (_g = (_e = (_d = customWidgets === null || customWidgets === void 0 ? void 0 : customWidgets.get) === null || _d === void 0 ? void 0 : _d.call(customWidgets, widgetProps.widgetType)) !== null && _e !== void 0 ? _e : (_f = templateWidgets === null || templateWidgets === void 0 ? void 0 : templateWidgets.get) === null || _f === void 0 ? void 0 : _f.call(templateWidgets, widgetProps.widgetType)) !== null && _g !== void 0 ? _g : (_h = standardWidgets === null || standardWidgets === void 0 ? void 0 : standardWidgets.get) === null || _h === void 0 ? void 0 : _h.call(standardWidgets, widgetProps.widgetType);
19474
+ let WidgetComponent;
19475
+ const targetFactory = widgetProps.targetWidgetFactory;
19476
+ if (targetFactory === "CUSTOM") {
19477
+ WidgetComponent = (_d = customWidgets === null || customWidgets === void 0 ? void 0 : customWidgets.get) === null || _d === void 0 ? void 0 : _d.call(customWidgets, widgetProps.widgetType);
19478
+ }
19479
+ else if (targetFactory === "TEMPLATE") {
19480
+ WidgetComponent = (_e = templateWidgets === null || templateWidgets === void 0 ? void 0 : templateWidgets.get) === null || _e === void 0 ? void 0 : _e.call(templateWidgets, widgetProps.widgetType);
19481
+ }
19482
+ else if (targetFactory === "DEFAULT") {
19483
+ WidgetComponent = (_f = standardWidgets === null || standardWidgets === void 0 ? void 0 : standardWidgets.get) === null || _f === void 0 ? void 0 : _f.call(standardWidgets, widgetProps.widgetType);
19484
+ }
19485
+ if (!WidgetComponent) {
19486
+ WidgetComponent =
19487
+ (_k = (_h = (_g = customWidgets === null || customWidgets === void 0 ? void 0 : customWidgets.get) === null || _g === void 0 ? void 0 : _g.call(customWidgets, widgetProps.widgetType)) !== null && _h !== void 0 ? _h : (_j = templateWidgets === null || templateWidgets === void 0 ? void 0 : templateWidgets.get) === null || _j === void 0 ? void 0 : _j.call(templateWidgets, widgetProps.widgetType)) !== null && _k !== void 0 ? _k : (_l = standardWidgets === null || standardWidgets === void 0 ? void 0 : standardWidgets.get) === null || _l === void 0 ? void 0 : _l.call(standardWidgets, widgetProps.widgetType);
19488
+ }
19444
19489
  if (!WidgetComponent) {
19445
- return (jsx(Skeleton, { className: "", skeletonType: (_j = schemaElementProps.skeletonType) !== null && _j !== void 0 ? _j : "", value: "LOADING..." }));
19490
+ return (jsx(Skeleton, { className: "", skeletonType: (_m = schemaElementProps.skeletonType) !== null && _m !== void 0 ? _m : "", value: "LOADING..." }));
19446
19491
  }
19447
19492
  return (jsx(WidgetComponent, Object.assign({}, widgetProps, { availableValidations: schemaElementProps.validations })));
19448
19493
  };
@@ -19487,17 +19532,17 @@ const IteratorRenderer = ({ childProps, screenDataField, isCompletedSetup, event
19487
19532
  const FormRenderer = ({ children = [], events = {}, widgetStyle, toolTip, label, helperText, disabled, method = "post", isCompletedSetup, eventService, }) => {
19488
19533
  return (jsx("form", Object.assign({ encType: "multipart/form-data", method: method, autoComplete: "off", autoFocus: true, onSubmit: (e) => {
19489
19534
  e.preventDefault();
19490
- }, className: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || "", id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", style: Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})) }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: Object.assign({}, element), isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
19535
+ }, className: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || "", "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, id: (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) || "", style: Object.assign({}, ((widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) || {})) }, { children: children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: Object.assign({}, element), isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
19491
19536
  };
19492
19537
 
19493
19538
  const Drawer = ({ children, applicableOn, id, overlay, widgetStyle, toolTip, label, helperText, disabled, isCompletedSetup, eventService, }) => {
19494
19539
  var _a, _b, _c;
19495
- return (jsx("div", Object.assign({ id: (_a = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) !== null && _a !== void 0 ? _a : "", className: `prc-drawer ${(_b = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) !== null && _b !== void 0 ? _b : ""}`, style: Object.assign({}, ((_c = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) !== null && _c !== void 0 ? _c : {})) }, { children: children === null || children === void 0 ? void 0 : children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
19540
+ return (jsx("div", Object.assign({ id: (_a = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.id) !== null && _a !== void 0 ? _a : "", className: `prc-drawer ${(_b = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) !== null && _b !== void 0 ? _b : ""}`, "data-prc-col-important": (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.important) ? (widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.className) || undefined : undefined, style: Object.assign({}, ((_c = widgetStyle === null || widgetStyle === void 0 ? void 0 : widgetStyle.inline) !== null && _c !== void 0 ? _c : {})) }, { children: children === null || children === void 0 ? void 0 : children.map((element) => (jsx(ScreenElementRenderer, { screenUIElement: element, isCompletedSetup: isCompletedSetup, eventService: eventService }, element.id))) })));
19496
19541
  };
19497
19542
 
19498
19543
  const DrawerRenderer = (props) => {
19499
- var _a, _b, _c, _d, _e, _f, _g;
19500
- return ((_a = props.overlay) === null || _a === void 0 ? void 0 : _a.enabled) ? (jsx("div", Object.assign({ id: (_c = (_b = props.overlay.widgetStyle) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "", style: Object.assign({}, ((_e = (_d = props.overlay.widgetStyle) === null || _d === void 0 ? void 0 : _d.inline) !== null && _e !== void 0 ? _e : {})), className: `prc-drawer-shield ${(_g = (_f = props.overlay.widgetStyle) === null || _f === void 0 ? void 0 : _f.className) !== null && _g !== void 0 ? _g : ""}` }, { children: jsx(Drawer, Object.assign({}, props)) }))) : (jsx(Drawer, Object.assign({}, props)));
19544
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19545
+ return ((_a = props.overlay) === null || _a === void 0 ? void 0 : _a.enabled) ? (jsx("div", Object.assign({ id: (_c = (_b = props.overlay.widgetStyle) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "", style: Object.assign({}, ((_e = (_d = props.overlay.widgetStyle) === null || _d === void 0 ? void 0 : _d.inline) !== null && _e !== void 0 ? _e : {})), className: `prc-drawer-shield ${(_g = (_f = props.overlay.widgetStyle) === null || _f === void 0 ? void 0 : _f.className) !== null && _g !== void 0 ? _g : ""}`, "data-prc-col-important": ((_h = props.overlay.widgetStyle) === null || _h === void 0 ? void 0 : _h.important) ? ((_j = props.overlay.widgetStyle) === null || _j === void 0 ? void 0 : _j.className) || undefined : undefined }, { children: jsx(Drawer, Object.assign({}, props)) }))) : (jsx(Drawer, Object.assign({}, props)));
19501
19546
  };
19502
19547
 
19503
19548
  const renderLayout = (screenUIElement, isCompletedSetup, eventService) => (jsx(LayOutRenderer, { layout: screenUIElement, isCompletedSetup: isCompletedSetup, eventService: eventService }, screenUIElement.id));
@@ -20623,5 +20668,5 @@ const coreStyles = './Assets/styles/index.scss';
20623
20668
  // Utility function to get styles path
20624
20669
  const getCoreStylesPath = () => coreStyles;
20625
20670
 
20626
- export { Core$1 as Core, EventService, coreStyles, Core$1 as default, getCoreStylesPath, resolveAppPath };
20671
+ export { BOUND_PROP_NAMES, Core$1 as Core, EventService, ValueReplacePolicy$1 as ValueReplacePolicy, coreStyles, Core$1 as default, getCoreStylesPath, resolveAppPath, resolveBoundValue };
20627
20672
  //# sourceMappingURL=index.esm.js.map