@pdg/react-table 1.0.55 → 1.0.57

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
@@ -62,39 +62,57 @@ function getDefaultExportFromCjs (x) {
62
62
 
63
63
  var hasOwn = {}.hasOwnProperty;
64
64
 
65
- function classNames() {
66
- var classes = [];
65
+ function classNames () {
66
+ var classes = '';
67
67
 
68
68
  for (var i = 0; i < arguments.length; i++) {
69
69
  var arg = arguments[i];
70
- if (!arg) continue;
71
-
72
- var argType = typeof arg;
73
-
74
- if (argType === 'string' || argType === 'number') {
75
- classes.push(arg);
76
- } else if (Array.isArray(arg)) {
77
- if (arg.length) {
78
- var inner = classNames.apply(null, arg);
79
- if (inner) {
80
- classes.push(inner);
81
- }
82
- }
83
- } else if (argType === 'object') {
84
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
85
- classes.push(arg.toString());
86
- continue;
87
- }
88
-
89
- for (var key in arg) {
90
- if (hasOwn.call(arg, key) && arg[key]) {
91
- classes.push(key);
92
- }
93
- }
70
+ if (arg) {
71
+ classes = appendClass(classes, parseValue(arg));
94
72
  }
95
73
  }
96
74
 
97
- return classes.join(' ');
75
+ return classes;
76
+ }
77
+
78
+ function parseValue (arg) {
79
+ if (typeof arg === 'string' || typeof arg === 'number') {
80
+ return arg;
81
+ }
82
+
83
+ if (typeof arg !== 'object') {
84
+ return '';
85
+ }
86
+
87
+ if (Array.isArray(arg)) {
88
+ return classNames.apply(null, arg);
89
+ }
90
+
91
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
92
+ return arg.toString();
93
+ }
94
+
95
+ var classes = '';
96
+
97
+ for (var key in arg) {
98
+ if (hasOwn.call(arg, key) && arg[key]) {
99
+ classes = appendClass(classes, key);
100
+ }
101
+ }
102
+
103
+ return classes;
104
+ }
105
+
106
+ function appendClass (value, newClass) {
107
+ if (!newClass) {
108
+ return value;
109
+ }
110
+
111
+ if (value) {
112
+ return value + ' ' + newClass;
113
+ }
114
+
115
+ return value + newClass;
98
116
  }
99
117
 
100
118
  if (module.exports) {
@@ -2246,16 +2264,18 @@ function throttle(func, wait, options) {
2246
2264
 
2247
2265
  var throttle_1 = throttle;
2248
2266
 
2249
- var throttle$1 = /*@__PURE__*/getDefaultExportFromCjs(throttle_1);/* global Reflect, Promise */
2267
+ var throttle$1 = /*@__PURE__*/getDefaultExportFromCjs(throttle_1);/* global Reflect, Promise, SuppressedError, Symbol */
2250
2268
 
2251
2269
  var extendStatics = function(d, b) {
2252
2270
  extendStatics = Object.setPrototypeOf ||
2253
2271
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2254
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2272
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
2255
2273
  return extendStatics(d, b);
2256
2274
  };
2257
2275
 
2258
2276
  function __extends(d, b) {
2277
+ if (typeof b !== "function" && b !== null)
2278
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2259
2279
  extendStatics(d, b);
2260
2280
  function __() { this.constructor = d; }
2261
2281
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -2282,7 +2302,12 @@ function __rest(s, e) {
2282
2302
  t[p[i]] = s[p[i]];
2283
2303
  }
2284
2304
  return t;
2285
- }var patchResizeCallback = function (resizeCallback, refreshMode, refreshRate, refreshOptions) {
2305
+ }
2306
+
2307
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2308
+ var e = new Error(message);
2309
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2310
+ };var patchResizeCallback = function (resizeCallback, refreshMode, refreshRate, refreshOptions) {
2286
2311
  switch (refreshMode) {
2287
2312
  case 'debounce':
2288
2313
  return debounce$2(resizeCallback, refreshRate, refreshOptions);
@@ -2498,14 +2523,6 @@ var isDOMElement = function (element) {
2498
2523
  }, [refElement]);
2499
2524
  // adding `current` to make it compatible with useRef shape
2500
2525
  onRefChange.current = refElement;
2501
- React.useEffect(function () {
2502
- return function () {
2503
- // component is unmounted
2504
- // clear ref to avoid memory leaks
2505
- setRefElement(null);
2506
- onRefChange.current = null;
2507
- };
2508
- }, []);
2509
2526
  var shouldSetSize = React.useCallback(function (prevSize, nextSize) {
2510
2527
  if (prevSize.width === nextSize.width && prevSize.height === nextSize.height) {
2511
2528
  // skip if dimensions haven't changed
@@ -2872,15 +2889,13 @@ var TableBodyCell = function (_a) {
2872
2889
  var item = _a.item, index = _a.index, column = _a.column, defaultAlign = _a.defaultAlign, defaultEllipsis = _a.defaultEllipsis, onClick = _a.onClick, onCheckChange = _a.onCheckChange;
2873
2890
  var _b = useTableState(), menuOpen = _b.menuOpen, setItemColumnChecked = _b.setItemColumnChecked, setItemColumnCheckDisabled = _b.setItemColumnCheckDisabled, setItemColumnCommands = _b.setItemColumnCommands;
2874
2891
  // State -------------------------------------------------------------------------------------------------------------
2875
- var _c = React.useState(false), initialized = _c[0], setInitialized = _c[1];
2876
- var _d = React.useState(false), checked = _d[0], setChecked = _d[1];
2877
- var _e = React.useState(false), checkDisabled = _e[0], setCheckDisabled = _e[1];
2892
+ var _c = React.useState(false), checked = _c[0], setChecked = _c[1];
2893
+ var _d = React.useState(false), checkDisabled = _d[0], setCheckDisabled = _d[1];
2878
2894
  // Effect ------------------------------------------------------------------------------------------------------------
2879
2895
  React.useEffect(function () {
2880
2896
  if (column.type === 'check') {
2881
2897
  setChecked(column.onInitChecked ? column.onInitChecked(item) : false);
2882
2898
  setCheckDisabled(column.onCheckDisabled ? column.onCheckDisabled(item) : false);
2883
- setInitialized(true);
2884
2899
  }
2885
2900
  setItemColumnCommands(item, column, {
2886
2901
  setChecked: function (checked) {
@@ -2898,9 +2913,6 @@ var TableBodyCell = function (_a) {
2898
2913
  React.useEffect(function () {
2899
2914
  if (column.type === 'check') {
2900
2915
  setItemColumnChecked(item, column, checked);
2901
- if (initialized) {
2902
- column.onCheckChange && column.onCheckChange(item, checked);
2903
- }
2904
2916
  }
2905
2917
  // eslint-disable-next-line react-hooks/exhaustive-deps
2906
2918
  }, [checked]);
@@ -2947,6 +2959,7 @@ var TableBodyCell = function (_a) {
2947
2959
  data = (React.createElement(material.Box, { className: 'TableBoxyCell-check-box', onClick: menuOpen ? undefined : function (e) { return e.stopPropagation(); } },
2948
2960
  React.createElement(material.Checkbox, { checked: checked, disabled: checkDisabled, onChange: function (e, newChecked) {
2949
2961
  setChecked(newChecked);
2962
+ column.onCheckChange && column.onCheckChange(item, newChecked);
2950
2963
  onCheckChange && onCheckChange(item, column, newChecked);
2951
2964
  } })));
2952
2965
  break;
@@ -3175,7 +3188,7 @@ for (let i = 0; i < 256; ++i) {
3175
3188
  function unsafeStringify(arr, offset = 0) {
3176
3189
  // Note: Be careful editing this code! It's been tuned for performance
3177
3190
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
3178
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
3191
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
3179
3192
  }const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
3180
3193
  var native = {
3181
3194
  randomUUID