directual-web-components-v2 3.11.334 → 3.11.335

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
@@ -22637,6 +22637,98 @@ function NewMainMenuItem(_ref2) {
22637
22637
 
22638
22638
  var styles$C = {"showhide":"_2kNHQ"};
22639
22639
 
22640
+ function template$1(input, rowData, auth) {
22641
+ if (!input) return "";
22642
+ if (!input.includes('{{')) return input;
22643
+ const webUser = auth ? _extends({}, auth, {
22644
+ id: auth.user
22645
+ }) : {};
22646
+ const regex = /\{\{([^}]+)\}\}/g;
22647
+ return input.replace(regex, (match, fieldPath) => {
22648
+ const trimmedPath = fieldPath.trim();
22649
+ if (trimmedPath.startsWith('WebUser.')) {
22650
+ const authField = trimmedPath.substring('WebUser.'.length);
22651
+ const value = _$1__default.get(webUser, authField);
22652
+ if (value === null || value === undefined) return "";
22653
+ if (typeof value === 'boolean') return JSON.stringify(value);
22654
+ if (typeof value === 'object') return JSON.stringify(value);
22655
+ return String(value);
22656
+ }
22657
+ let value = _$1__default.get(rowData, trimmedPath);
22658
+ if (value && typeof value === 'object' && value.id !== undefined) {
22659
+ value = value.id;
22660
+ }
22661
+ if (value === null || value === undefined) return "";
22662
+ if (typeof value === 'boolean') return JSON.stringify(value);
22663
+ if (typeof value === 'object') return JSON.stringify(value);
22664
+ return String(value);
22665
+ });
22666
+ }
22667
+ function checkCondition(condition, rowData, auth) {
22668
+ let field = template$1("{{" + condition._conditionalView_field + "}}", rowData, auth);
22669
+ let value = template$1(condition._conditionalView_value, rowData, auth);
22670
+ if (condition._conditionalView_operator === "==") {
22671
+ if (typeof field === 'boolean') field = JSON.stringify(field);
22672
+ return !_$1__default.isEqual(field, value);
22673
+ }
22674
+ if (condition._conditionalView_operator === "!==") {
22675
+ if (typeof field === 'boolean') field = JSON.stringify(field);
22676
+ return _$1__default.isEqual(field, value);
22677
+ }
22678
+ if (condition._conditionalView_operator === "contains") {
22679
+ const valueArr = value ? value.split(",") : [];
22680
+ const fieldArr = field ? field.split(",") : [];
22681
+ const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
22682
+ return !hasIntersection;
22683
+ }
22684
+ if (condition._conditionalView_operator === "notContains") {
22685
+ const valueArr = value ? value.split(",") : [];
22686
+ const fieldArr = field ? field.split(",") : [];
22687
+ const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
22688
+ return hasIntersection;
22689
+ }
22690
+ if (condition._conditionalView_operator === "in") {
22691
+ const valueArr = value ? value.split(",") : [];
22692
+ const fieldArr = field ? field.split(",") : [];
22693
+ const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
22694
+ return !hasIntersection;
22695
+ }
22696
+ if (condition._conditionalView_operator === "notIn") {
22697
+ const valueArr = value ? value.split(",") : [];
22698
+ const fieldArr = field ? field.split(",") : [];
22699
+ const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
22700
+ return hasIntersection;
22701
+ }
22702
+ if (condition._conditionalView_operator === "isNull") {
22703
+ return !_$1__default.isEmpty(field);
22704
+ }
22705
+ if (condition._conditionalView_operator === "isNotNull") {
22706
+ return _$1__default.isEmpty(field);
22707
+ }
22708
+ return false;
22709
+ }
22710
+ function evaluateRowConditions(conditionLibrary, rowData, auth) {
22711
+ if (!conditionLibrary || !Array.isArray(conditionLibrary)) return "";
22712
+ const appliedClasses = [];
22713
+ conditionLibrary.forEach(condItem => {
22714
+ if (!condItem._conditionalView || !condItem.title) return;
22715
+ const conditions = _$1__default.get(condItem, "_conditions") || [];
22716
+ const andOr = _$1__default.get(condItem, "_action_conditionals_and_or") || "AND";
22717
+ if (conditions.length === 0) return;
22718
+ let shouldApplyClass = false;
22719
+ if (andOr === "OR") {
22720
+ shouldApplyClass = !conditions.every(cond => checkCondition(cond, rowData, auth));
22721
+ } else {
22722
+ shouldApplyClass = !conditions.some(cond => checkCondition(cond, rowData, auth));
22723
+ }
22724
+ if (shouldApplyClass) {
22725
+ const className = condItem.title.startsWith('.') ? condItem.title.substring(1) : condItem.title;
22726
+ appliedClasses.push(className);
22727
+ }
22728
+ });
22729
+ return appliedClasses.join(' ');
22730
+ }
22731
+
22640
22732
  function sanitizedHTML(inputHTML) {
22641
22733
  return DOMPurify.sanitize(inputHTML, {
22642
22734
  USE_PROFILES: {
@@ -22926,6 +23018,7 @@ const defaultColumn = {
22926
23018
  };
22927
23019
  function ReactTable(_ref2) {
22928
23020
  let {
23021
+ auth,
22929
23022
  columns,
22930
23023
  params,
22931
23024
  hideExpandTD,
@@ -22937,7 +23030,8 @@ function ReactTable(_ref2) {
22937
23030
  skipPageReset,
22938
23031
  getLinkName,
22939
23032
  onExpand,
22940
- getExpandHref
23033
+ getExpandHref,
23034
+ conditionLibrary
22941
23035
  } = _ref2;
22942
23036
  const {
22943
23037
  getTableProps,
@@ -22982,9 +23076,11 @@ function ReactTable(_ref2) {
22982
23076
  const isColorRow = row.cells.filter(cell => _$1__default.get(tableParams, "[" + cell.column.id + "].include") && _$1__default.get(tableParams, "[" + cell.column.id + "].colorRow")) ? row.cells.filter(cell => _$1__default.get(tableParams, "[" + cell.column.id + "].include") && _$1__default.get(tableParams, "[" + cell.column.id + "].colorRow"))[0] : null;
22983
23077
  let colorRow = isColorRow ? isColorRow.row.values[isColorRow.column.id] ? isColorRow.row.values[isColorRow.column.id] : 'default' : 'default';
22984
23078
  colorRow = colorRow == 'default' ? colorRow : colorRow[0] == '#' || colorRow[0] == 'r' ? colorRow : '#' + colorRow;
23079
+ const conditionalClasses = evaluateRowConditions(conditionLibrary, row.original, auth);
22985
23080
  const key = _$1__default.get(row, 'original.id') || row.id;
22986
23081
  return /*#__PURE__*/React__default.createElement("tr", _extends({
22987
23082
  key: key,
23083
+ className: conditionalClasses,
22988
23084
  onDoubleClick: () => onExpand(row.original),
22989
23085
  style: colorRow == 'default' ? {} : {
22990
23086
  backgroundColor: colorRow,
@@ -23167,6 +23263,7 @@ function Table(_ref3) {
23167
23263
  }, /*#__PURE__*/React__default.createElement(Loader, null, " ", _$1__default.get(dict[lang], 'loading') || "Loading..."))), /*#__PURE__*/React__default.createElement("div", {
23168
23264
  className: loading ? styles$n.backGroundBlur : ''
23169
23265
  }, /*#__PURE__*/React__default.createElement(ReactTable, {
23266
+ auth: auth,
23170
23267
  columns: columns,
23171
23268
  data: tableData,
23172
23269
  params: params,
@@ -23178,7 +23275,8 @@ function Table(_ref3) {
23178
23275
  skipPageReset: skipPageReset,
23179
23276
  onExpand: onExpand,
23180
23277
  getExpandHref: getExpandHref,
23181
- tableParams: tableParams.fieldParams
23278
+ tableParams: tableParams.fieldParams,
23279
+ conditionLibrary: _$1__default.get(data, "params._condition_library", [])
23182
23280
  })));
23183
23281
  }
23184
23282
 
@@ -23769,6 +23867,7 @@ function FpsTable(_ref) {
23769
23867
  urlKey: comp_ID,
23770
23868
  headers: currentData.headers
23771
23869
  }), /*#__PURE__*/React__default.createElement(Table, {
23870
+ auth: auth,
23772
23871
  currentBP: currentBP,
23773
23872
  data: currentData,
23774
23873
  cardsData: cardsData,
@@ -23801,7 +23900,6 @@ function FpsTable(_ref) {
23801
23900
  }
23802
23901
  return undefined;
23803
23902
  },
23804
- auth: auth,
23805
23903
  submitAction: submitAction,
23806
23904
  id: id,
23807
23905
  loading: loading,