@true-engineering/true-react-common-ui-kit 3.0.0-alpha.15 → 3.0.0-alpha.16

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.
@@ -21731,6 +21731,20 @@
21731
21731
  });
21732
21732
  };
21733
21733
  var DEFAULT_DATE_FORMAT = "dd.MM.yyyy";
21734
+ function _instanceof(left2, right2) {
21735
+ if (right2 != null && typeof Symbol !== "undefined" && right2[Symbol.hasInstance]) {
21736
+ return !!right2[Symbol.hasInstance](left2);
21737
+ } else {
21738
+ return left2 instanceof right2;
21739
+ }
21740
+ }
21741
+ var hasHorizontalScrollBar = function(el) {
21742
+ return trueReactPlatformHelpers.isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
21743
+ };
21744
+ var _config_dateFormat;
21745
+ var formatCellContent = function(value, config) {
21746
+ return _instanceof(value, Date) ? dateFns.format(value, (_config_dateFormat = config === null || config === void 0 ? void 0 : config.dateFormat) !== null && _config_dateFormat !== void 0 ? _config_dateFormat : DEFAULT_DATE_FORMAT) : String(value);
21747
+ };
21734
21748
  var STICKY_SHADOW_PADDING = 12;
21735
21749
  var useStyles$h = createThemedStyles("FlexibleTable", {
21736
21750
  root: {
@@ -21909,47 +21923,34 @@
21909
21923
  }
21910
21924
  return obj;
21911
21925
  }
21912
- function _instanceof(left2, right2) {
21913
- if (right2 != null && typeof Symbol !== "undefined" && right2[Symbol.hasInstance]) {
21914
- return !!right2[Symbol.hasInstance](left2);
21915
- } else {
21916
- return left2 instanceof right2;
21917
- }
21918
- }
21919
21926
  function FlexibleTableCell(param) {
21920
21927
  var item = param.item, columnName = param.columnName, config = param.config, isFocusedRow = param.isFocusedRow, isSecond = param.isSecond, isSticky = param.isSticky, isNestedComponentExpanded = param.isNestedComponentExpanded, isRowNestedComponentExpanded = param.isRowNestedComponentExpanded, tweakStyles = param.tweakStyles, onSetNestedComponent = param.onSetNestedComponent;
21921
21928
  var classes = useStyles$g({
21922
21929
  theme: tweakStyles
21923
21930
  });
21924
- var itemConfig = config === null || config === void 0 ? void 0 : config[columnName];
21931
+ var _config_columnName;
21932
+ var _ref = (_config_columnName = config[columnName]) !== null && _config_columnName !== void 0 ? _config_columnName : {}, component = _ref.component, cellAlign = _ref.cellAlign, position = _ref.position, right2 = _ref.right, left2 = _ref.left, cellVerticalAlign = _ref.cellVerticalAlign;
21925
21933
  var value = item[columnName];
21926
- var content = null;
21927
- if (itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.component) {
21928
- var ValueComponent = itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.component;
21929
- content = ValueComponent({
21930
- value,
21931
- row: item,
21932
- isFocusedRow,
21933
- isNestedComponentExpanded,
21934
- isRowNestedComponentExpanded,
21935
- onSetNestedComponent
21936
- });
21937
- } else if (typeof value === "string" || typeof value === "number") {
21938
- content = value;
21939
- } else if (_instanceof(value, Date)) {
21940
- content = dateFns.format(value, (itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.dateFormat) || DEFAULT_DATE_FORMAT);
21941
- }
21942
21934
  var _obj;
21943
21935
  return /* @__PURE__ */ jsx("td", {
21944
21936
  className: clsx(classes.root, (_obj = {}, _define_property$i(_obj, classes.sticky, isSticky), _define_property$i(_obj, classes.second, isSecond), _obj)),
21945
21937
  style: {
21946
- textAlign: itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.cellAlign,
21947
- position: isSticky ? "sticky" : itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.position,
21948
- right: itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.right,
21949
- left: isSticky ? 0 : itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.left,
21950
- verticalAlign: itemConfig === null || itemConfig === void 0 ? void 0 : itemConfig.cellVerticalAlign
21938
+ textAlign: cellAlign,
21939
+ position: isSticky ? "sticky" : position,
21940
+ right: right2,
21941
+ left: isSticky ? 0 : left2,
21942
+ verticalAlign: cellVerticalAlign
21951
21943
  },
21952
- children: content
21944
+ children: trueReactPlatformHelpers.isNotEmpty(value) && /* @__PURE__ */ jsx(Fragment, {
21945
+ children: trueReactPlatformHelpers.isNotEmpty(component) ? component({
21946
+ value,
21947
+ row: item,
21948
+ isFocusedRow,
21949
+ isNestedComponentExpanded,
21950
+ isRowNestedComponentExpanded,
21951
+ onSetNestedComponent
21952
+ }) : formatCellContent(value, config[columnName])
21953
+ })
21953
21954
  }, columnName);
21954
21955
  }
21955
21956
  var useStyles$f = createThemedStyles("FlexibleTableRow", {
@@ -22177,9 +22178,6 @@
22177
22178
  });
22178
22179
  }
22179
22180
  var FlexibleTableRow = /* @__PURE__ */ React.memo(FlexibleTableRowInner);
22180
- var hasHorizontalScrollBar = function(el) {
22181
- return trueReactPlatformHelpers.isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
22182
- };
22183
22181
  function _array_like_to_array$8(arr, len) {
22184
22182
  if (len == null || len > arr.length)
22185
22183
  len = arr.length;