@teselagen/ui 0.3.41 → 0.3.42

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/index.cjs.js CHANGED
@@ -6814,10 +6814,10 @@ var ownKeys$3 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownK
6814
6814
  /* istanbul ignore next */
6815
6815
  Object.getOwnPropertyNames
6816
6816
  );
6817
- function toPrimitive$2(value) {
6817
+ function toPrimitive$3(value) {
6818
6818
  return value === null ? null : typeof value === "object" ? "" + value : value;
6819
6819
  }
6820
- __name(toPrimitive$2, "toPrimitive$2");
6820
+ __name(toPrimitive$3, "toPrimitive$3");
6821
6821
  function hasProp(target, prop) {
6822
6822
  return objectPrototype$1.hasOwnProperty.call(target, prop);
6823
6823
  }
@@ -7714,7 +7714,7 @@ var ObservableValue = /* @__PURE__ */ function(_Atom) {
7714
7714
  return this.name_ + "[" + this.value_ + "]";
7715
7715
  }, "toString");
7716
7716
  _proto.valueOf = /* @__PURE__ */ __name(function valueOf() {
7717
- return toPrimitive$2(this.get());
7717
+ return toPrimitive$3(this.get());
7718
7718
  }, "valueOf");
7719
7719
  _proto[_Symbol$toPrimitive] = function() {
7720
7720
  return this.valueOf();
@@ -7899,7 +7899,7 @@ var ComputedValue = /* @__PURE__ */ function() {
7899
7899
  return this.name_ + "[" + this.derivation.toString() + "]";
7900
7900
  }, "toString");
7901
7901
  _proto.valueOf = /* @__PURE__ */ __name(function valueOf() {
7902
- return toPrimitive$2(this.get());
7902
+ return toPrimitive$3(this.get());
7903
7903
  }, "valueOf");
7904
7904
  _proto[_Symbol$toPrimitive$1] = function() {
7905
7905
  return this.valueOf();
@@ -12533,7 +12533,7 @@ lodash.exports;
12533
12533
  "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
12534
12534
  );
12535
12535
  var Buffer2 = moduleExports2 ? context.Buffer : undefined$12, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe2 = Buffer2 ? Buffer2.allocUnsafe : undefined$12, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable3 = objectProto2.propertyIsEnumerable, splice3 = arrayProto2.splice, spreadableSymbol2 = Symbol2 ? Symbol2.isConcatSpreadable : undefined$12, symIterator = Symbol2 ? Symbol2.iterator : undefined$12, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : undefined$12;
12536
- var defineProperty5 = function() {
12536
+ var defineProperty6 = function() {
12537
12537
  try {
12538
12538
  var func = getNative2(Object2, "defineProperty");
12539
12539
  func({}, "", {});
@@ -12973,8 +12973,8 @@ lodash.exports;
12973
12973
  }
12974
12974
  __name(baseAssignIn2, "baseAssignIn");
12975
12975
  function baseAssignValue2(object2, key, value) {
12976
- if (key == "__proto__" && defineProperty5) {
12977
- defineProperty5(object2, key, {
12976
+ if (key == "__proto__" && defineProperty6) {
12977
+ defineProperty6(object2, key, {
12978
12978
  "configurable": true,
12979
12979
  "enumerable": true,
12980
12980
  "value": value,
@@ -13707,8 +13707,8 @@ lodash.exports;
13707
13707
  metaMap.set(func, data);
13708
13708
  return func;
13709
13709
  };
13710
- var baseSetToString2 = !defineProperty5 ? identity3 : function(func, string2) {
13711
- return defineProperty5(func, "toString", {
13710
+ var baseSetToString2 = !defineProperty6 ? identity3 : function(func, string2) {
13711
+ return defineProperty6(func, "toString", {
13712
13712
  "configurable": true,
13713
13713
  "enumerable": false,
13714
13714
  "value": constant2(string2),
@@ -18304,33 +18304,25 @@ var _toPrimitive = /* @__PURE__ */ __name(function(it, S2) {
18304
18304
  return val;
18305
18305
  throw TypeError("Can't convert object to primitive value");
18306
18306
  }, "_toPrimitive");
18307
- var hasRequired_objectDp;
18308
- function require_objectDp() {
18309
- if (hasRequired_objectDp)
18310
- return _objectDp;
18311
- hasRequired_objectDp = 1;
18312
- var anObject2 = _anObject;
18313
- var IE8_DOM_DEFINE2 = _ie8DomDefine;
18314
- var toPrimitive2 = _toPrimitive;
18315
- var dP2 = Object.defineProperty;
18316
- _objectDp.f = require_descriptors() ? Object.defineProperty : /* @__PURE__ */ __name(function defineProperty5(O2, P2, Attributes) {
18317
- anObject2(O2);
18318
- P2 = toPrimitive2(P2, true);
18319
- anObject2(Attributes);
18320
- if (IE8_DOM_DEFINE2)
18321
- try {
18322
- return dP2(O2, P2, Attributes);
18323
- } catch (e2) {
18324
- }
18325
- if ("get" in Attributes || "set" in Attributes)
18326
- throw TypeError("Accessors not supported!");
18327
- if ("value" in Attributes)
18328
- O2[P2] = Attributes.value;
18329
- return O2;
18330
- }, "defineProperty");
18331
- return _objectDp;
18332
- }
18333
- __name(require_objectDp, "require_objectDp");
18307
+ var anObject$3 = _anObject;
18308
+ var IE8_DOM_DEFINE$1 = _ie8DomDefine;
18309
+ var toPrimitive$2 = _toPrimitive;
18310
+ var dP$2 = Object.defineProperty;
18311
+ _objectDp.f = require_descriptors() ? Object.defineProperty : /* @__PURE__ */ __name(function defineProperty2(O2, P2, Attributes) {
18312
+ anObject$3(O2);
18313
+ P2 = toPrimitive$2(P2, true);
18314
+ anObject$3(Attributes);
18315
+ if (IE8_DOM_DEFINE$1)
18316
+ try {
18317
+ return dP$2(O2, P2, Attributes);
18318
+ } catch (e2) {
18319
+ }
18320
+ if ("get" in Attributes || "set" in Attributes)
18321
+ throw TypeError("Accessors not supported!");
18322
+ if ("value" in Attributes)
18323
+ O2[P2] = Attributes.value;
18324
+ return O2;
18325
+ }, "defineProperty");
18334
18326
  var _propertyDesc = /* @__PURE__ */ __name(function(bitmap, value) {
18335
18327
  return {
18336
18328
  enumerable: !(bitmap & 1),
@@ -18339,7 +18331,7 @@ var _propertyDesc = /* @__PURE__ */ __name(function(bitmap, value) {
18339
18331
  value
18340
18332
  };
18341
18333
  }, "_propertyDesc");
18342
- var dP$1 = require_objectDp();
18334
+ var dP$1 = _objectDp;
18343
18335
  var createDesc$3 = _propertyDesc;
18344
18336
  var _hide = require_descriptors() ? function(object2, key, value) {
18345
18337
  return dP$1.f(object2, key, createDesc$3(1, value));
@@ -18528,7 +18520,15 @@ var _objectKeys = Object.keys || /* @__PURE__ */ __name(function keys(O2) {
18528
18520
  var _objectGops = {};
18529
18521
  _objectGops.f = Object.getOwnPropertySymbols;
18530
18522
  var _objectPie = {};
18531
- _objectPie.f = {}.propertyIsEnumerable;
18523
+ var hasRequired_objectPie;
18524
+ function require_objectPie() {
18525
+ if (hasRequired_objectPie)
18526
+ return _objectPie;
18527
+ hasRequired_objectPie = 1;
18528
+ _objectPie.f = {}.propertyIsEnumerable;
18529
+ return _objectPie;
18530
+ }
18531
+ __name(require_objectPie, "require_objectPie");
18532
18532
  var defined$1 = _defined;
18533
18533
  var _toObject = /* @__PURE__ */ __name(function(it) {
18534
18534
  return Object(defined$1(it));
@@ -18542,7 +18542,7 @@ function require_objectAssign() {
18542
18542
  var DESCRIPTORS2 = require_descriptors();
18543
18543
  var getKeys2 = _objectKeys;
18544
18544
  var gOPS2 = _objectGops;
18545
- var pIE2 = _objectPie;
18545
+ var pIE2 = require_objectPie();
18546
18546
  var toObject2 = _toObject;
18547
18547
  var IObject2 = require_iobject();
18548
18548
  var $assign = Object.assign;
@@ -18611,7 +18611,7 @@ function require_objectDps() {
18611
18611
  if (hasRequired_objectDps)
18612
18612
  return _objectDps;
18613
18613
  hasRequired_objectDps = 1;
18614
- var dP2 = require_objectDp();
18614
+ var dP2 = _objectDp;
18615
18615
  var anObject2 = _anObject;
18616
18616
  var getKeys2 = _objectKeys;
18617
18617
  _objectDps = require_descriptors() ? Object.defineProperties : /* @__PURE__ */ __name(function defineProperties2(O2, Properties) {
@@ -18693,7 +18693,7 @@ var $exports = _wks.exports = function(name) {
18693
18693
  };
18694
18694
  $exports.store = store;
18695
18695
  var _wksExports = _wks.exports;
18696
- var def = require_objectDp().f;
18696
+ var def = _objectDp.f;
18697
18697
  var has$9 = _has;
18698
18698
  var TAG$1 = _wksExports("toStringTag");
18699
18699
  var _setToStringTag = /* @__PURE__ */ __name(function(it, tag, stat) {
@@ -18966,7 +18966,7 @@ var ArrayProto = Array.prototype;
18966
18966
  var _isArrayIter = /* @__PURE__ */ __name(function(it) {
18967
18967
  return it !== void 0 && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
18968
18968
  }, "_isArrayIter");
18969
- var $defineProperty$1 = require_objectDp();
18969
+ var $defineProperty$1 = _objectDp;
18970
18970
  var createDesc$2 = _propertyDesc;
18971
18971
  var _createProperty = /* @__PURE__ */ __name(function(object2, index2, value) {
18972
18972
  if (index2 in object2)
@@ -19095,9 +19095,9 @@ var _default$8 = /* @__PURE__ */ __name(function(instance, Constructor) {
19095
19095
  }
19096
19096
  }, "_default$8");
19097
19097
  var $export$3 = _export;
19098
- $export$3($export$3.S + $export$3.F * !require_descriptors(), "Object", { defineProperty: require_objectDp().f });
19098
+ $export$3($export$3.S + $export$3.F * !require_descriptors(), "Object", { defineProperty: _objectDp.f });
19099
19099
  var $Object$2 = _coreExports.Object;
19100
- var defineProperty$9 = /* @__PURE__ */ __name(function defineProperty2(it, key, desc) {
19100
+ var defineProperty$9 = /* @__PURE__ */ __name(function defineProperty3(it, key, desc) {
19101
19101
  return $Object$2.defineProperty(it, key, desc);
19102
19102
  }, "defineProperty");
19103
19103
  var defineProperty$8 = { "default": defineProperty$9, __esModule: true };
@@ -19136,7 +19136,7 @@ var _meta = { exports: {} };
19136
19136
  var META$1 = _uid("meta");
19137
19137
  var isObject$c = _isObject;
19138
19138
  var has$7 = _has;
19139
- var setDesc = require_objectDp().f;
19139
+ var setDesc = _objectDp.f;
19140
19140
  var id = 0;
19141
19141
  var isExtensible = Object.isExtensible || function() {
19142
19142
  return true;
@@ -19189,7 +19189,7 @@ var meta = _meta.exports = {
19189
19189
  var _metaExports = _meta.exports;
19190
19190
  var core = _coreExports;
19191
19191
  var wksExt$1 = _wksExt;
19192
- var defineProperty$7 = require_objectDp().f;
19192
+ var defineProperty$7 = _objectDp.f;
19193
19193
  var _wksDefine = /* @__PURE__ */ __name(function(name) {
19194
19194
  var $Symbol2 = core.Symbol || (core.Symbol = {});
19195
19195
  if (name.charAt(0) != "_" && !(name in $Symbol2))
@@ -19197,7 +19197,7 @@ var _wksDefine = /* @__PURE__ */ __name(function(name) {
19197
19197
  }, "_wksDefine");
19198
19198
  var getKeys = _objectKeys;
19199
19199
  var gOPS$1 = _objectGops;
19200
- var pIE$1 = _objectPie;
19200
+ var pIE$1 = require_objectPie();
19201
19201
  var _enumKeys = /* @__PURE__ */ __name(function(it) {
19202
19202
  var result = getKeys(it);
19203
19203
  var getSymbols2 = gOPS$1.f;
@@ -19238,7 +19238,7 @@ _objectGopnExt.f = /* @__PURE__ */ __name(function getOwnPropertyNames2(it) {
19238
19238
  return windowNames && toString$5.call(it) == "[object Window]" ? getWindowNames(it) : gOPN$1(toIObject$2(it));
19239
19239
  }, "getOwnPropertyNames");
19240
19240
  var _objectGopd = {};
19241
- var pIE = _objectPie;
19241
+ var pIE = require_objectPie();
19242
19242
  var createDesc$1 = _propertyDesc;
19243
19243
  var toIObject$1 = _toIobject;
19244
19244
  var toPrimitive$1 = _toPrimitive;
@@ -19281,7 +19281,7 @@ var _create$1 = require_objectCreate();
19281
19281
  var gOPNExt = _objectGopnExt;
19282
19282
  var $GOPD = _objectGopd;
19283
19283
  var $GOPS = _objectGops;
19284
- var $DP = require_objectDp();
19284
+ var $DP = _objectDp;
19285
19285
  var $keys$1 = _objectKeys;
19286
19286
  var gOPD$1 = $GOPD.f;
19287
19287
  var dP = $DP.f;
@@ -19324,7 +19324,7 @@ var isSymbol$8 = USE_NATIVE && typeof $Symbol.iterator == "symbol" ? function(it
19324
19324
  } : function(it) {
19325
19325
  return it instanceof $Symbol;
19326
19326
  };
19327
- var $defineProperty = /* @__PURE__ */ __name(function defineProperty3(it, key, D2) {
19327
+ var $defineProperty = /* @__PURE__ */ __name(function defineProperty4(it, key, D2) {
19328
19328
  if (it === ObjectProto)
19329
19329
  $defineProperty(OPSymbols, key, D2);
19330
19330
  anObject(it);
@@ -19418,7 +19418,7 @@ if (!USE_NATIVE) {
19418
19418
  $GOPD.f = $getOwnPropertyDescriptor;
19419
19419
  $DP.f = $defineProperty;
19420
19420
  _objectGopn.f = gOPNExt.f = $getOwnPropertyNames;
19421
- _objectPie.f = $propertyIsEnumerable;
19421
+ require_objectPie().f = $propertyIsEnumerable;
19422
19422
  $GOPS.f = $getOwnPropertySymbols;
19423
19423
  if (DESCRIPTORS && !_library) {
19424
19424
  redefine(ObjectProto, "propertyIsEnumerable", $propertyIsEnumerable);
@@ -55372,7 +55372,7 @@ var KNOWN_STATICS = {
55372
55372
  arguments: true,
55373
55373
  arity: true
55374
55374
  };
55375
- var defineProperty4 = Object.defineProperty;
55375
+ var defineProperty5 = Object.defineProperty;
55376
55376
  var getOwnPropertyNames4 = Object.getOwnPropertyNames;
55377
55377
  var getOwnPropertySymbols3 = Object.getOwnPropertySymbols;
55378
55378
  var getOwnPropertyDescriptor3 = Object.getOwnPropertyDescriptor;
@@ -55395,7 +55395,7 @@ function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
55395
55395
  if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
55396
55396
  var descriptor2 = getOwnPropertyDescriptor3(sourceComponent, key);
55397
55397
  try {
55398
- defineProperty4(targetComponent, key, descriptor2);
55398
+ defineProperty5(targetComponent, key, descriptor2);
55399
55399
  } catch (e2) {
55400
55400
  }
55401
55401
  }
@@ -55810,6 +55810,15 @@ const openColumn = __spreadProps(__spreadValues({}, viewColumn), {
55810
55810
  }
55811
55811
  });
55812
55812
  const dataTableEnhancer = compose(
55813
+ // maybe we need this in some cases?
55814
+ // tgFormValues("reduxFormEntities"),
55815
+ // withProps(props => {
55816
+ // const entities = props.reduxFormEntities || props.entities;
55817
+ // return {
55818
+ // _origEntities: props.entities,
55819
+ // entities
55820
+ // };
55821
+ // }),
55813
55822
  //connect to withTableParams here in the dataTable component so that, in the case that the table is not manually connected,
55814
55823
  withTableParams({
55815
55824
  isLocalCall: true
@@ -56668,13 +56677,14 @@ const _DataTable = class _DataTable extends React$1.Component {
56668
56677
  }, "formatAndValidateEntities"));
56669
56678
  __publicField(this, "formatAndValidateTableInitial", /* @__PURE__ */ __name(() => {
56670
56679
  const {
56671
- _origEntities: entities,
56680
+ _origEntities,
56681
+ entities,
56672
56682
  initialEntities,
56673
56683
  change,
56674
56684
  reduxFormCellValidation
56675
56685
  } = this.props;
56676
56686
  const { newEnts, validationErrors } = this.formatAndValidateEntities(
56677
- initialEntities || entities
56687
+ initialEntities || entities || _origEntities
56678
56688
  );
56679
56689
  change("reduxFormEntities", newEnts);
56680
56690
  const toKeep = {};
@@ -56792,16 +56802,33 @@ const _DataTable = class _DataTable extends React$1.Component {
56792
56802
  } else if (e2.clipboardData && e2.clipboardData.getData) {
56793
56803
  toPaste = e2.clipboardData.getData("text/plain");
56794
56804
  }
56795
- if (toPaste.includes(",")) {
56796
- try {
56797
- const { data, errors } = papaparse.parse(toPaste, {
56798
- header: false
56805
+ const jsonToPaste = e2.clipboardData.getData("application/json");
56806
+ try {
56807
+ const pastedJson = [];
56808
+ JSON.parse(jsonToPaste).forEach((row) => {
56809
+ const newRow = [];
56810
+ Object.values(row).forEach((cell) => {
56811
+ const cellVal = JSON.parse(cell);
56812
+ newRow.push(cellVal);
56799
56813
  });
56800
- if ((data == null ? void 0 : data.length) && !(errors == null ? void 0 : errors.length)) {
56801
- pasteData = data;
56814
+ pastedJson.push(newRow);
56815
+ });
56816
+ pasteData = pastedJson;
56817
+ if (pasteData[0] && pasteData[0][0] && pasteData[0][0].__isHeaderCell) {
56818
+ pasteData = pasteData.slice(1);
56819
+ }
56820
+ } catch (e22) {
56821
+ if (toPaste.includes(",")) {
56822
+ try {
56823
+ const { data, errors } = papaparse.parse(toPaste, {
56824
+ header: false
56825
+ });
56826
+ if ((data == null ? void 0 : data.length) && !(errors == null ? void 0 : errors.length)) {
56827
+ pasteData = data;
56828
+ }
56829
+ } catch (error) {
56830
+ console.error(`error p982qhgpf9qh`, error);
56802
56831
  }
56803
- } catch (error) {
56804
- console.error(`error p982qhgpf9qh`, error);
56805
56832
  }
56806
56833
  }
56807
56834
  pasteData = pasteData.length ? pasteData : defaultParsePaste(toPaste);
@@ -56820,7 +56847,7 @@ const _DataTable = class _DataTable extends React$1.Component {
56820
56847
  entity,
56821
56848
  path: path2,
56822
56849
  schema,
56823
- newVal
56850
+ newVal: formatPasteData({ newVal, path: path2, schema })
56824
56851
  });
56825
56852
  if (error) {
56826
56853
  newCellValidate[cellId] = error;
@@ -56851,8 +56878,8 @@ const _DataTable = class _DataTable extends React$1.Component {
56851
56878
  const indexToPath = lodashExports.invert(pathToIndex);
56852
56879
  const startCellIndex = pathToIndex[primaryCellPath];
56853
56880
  pasteData.forEach((row, i) => {
56854
- row.forEach((cell, j) => {
56855
- if (cell) {
56881
+ row.forEach((newVal, j) => {
56882
+ if (newVal) {
56856
56883
  const cellIndexToChange = startCellIndex + j;
56857
56884
  const entity = entitiesToManipulate[i];
56858
56885
  if (entity) {
@@ -56863,7 +56890,11 @@ const _DataTable = class _DataTable extends React$1.Component {
56863
56890
  entity,
56864
56891
  path: path2,
56865
56892
  schema,
56866
- newVal: cell
56893
+ newVal: formatPasteData({
56894
+ newVal,
56895
+ path: path2,
56896
+ schema
56897
+ })
56867
56898
  });
56868
56899
  const cellId = `${getIdOrCodeOrIndex(entity)}:${path2}`;
56869
56900
  if (!newSelectedCells[cellId]) {
@@ -56973,17 +57004,11 @@ const _DataTable = class _DataTable extends React$1.Component {
56973
57004
  __publicField(this, "getCellCopyText", /* @__PURE__ */ __name((cellWrapper) => {
56974
57005
  const text2 = cellWrapper && cellWrapper.getAttribute("data-copy-text");
56975
57006
  const jsonText = cellWrapper && cellWrapper.getAttribute("data-copy-json");
56976
- const toRet = text2 || cellWrapper.textContent || "";
56977
- return [toRet, jsonText];
57007
+ const textContent = text2 || cellWrapper.textContent || "";
57008
+ return [textContent, jsonText];
56978
57009
  }, "getCellCopyText"));
56979
- __publicField(this, "handleCopyRow", /* @__PURE__ */ __name((rowEl) => {
56980
- const text2 = this.getRowCopyText(rowEl);
56981
- if (!text2)
56982
- return window.toastr.warning("No text to copy");
56983
- this.handleCopyHelper(text2, void 0, "Row Copied");
56984
- }, "handleCopyRow"));
56985
57010
  __publicField(this, "handleCopyColumn", /* @__PURE__ */ __name((e2, cellWrapper, selectedRecords) => {
56986
- const cellType = cellWrapper.getAttribute("data-test");
57011
+ const specificColumn = cellWrapper.getAttribute("data-test");
56987
57012
  let rowElsToCopy = getAllRows(e2);
56988
57013
  if (!rowElsToCopy)
56989
57014
  return;
@@ -57000,14 +57025,24 @@ const _DataTable = class _DataTable extends React$1.Component {
57000
57025
  }
57001
57026
  if (!rowElsToCopy)
57002
57027
  return;
57003
- const textToCopy = lodashExports.map(
57004
- rowElsToCopy,
57005
- (rowEl) => this.getRowCopyText(rowEl, { cellType })
57006
- ).filter((text2) => text2).join("\n");
57028
+ this.handleCopyRows(rowElsToCopy, {
57029
+ specificColumn,
57030
+ onFinishMsg: "Column Copied"
57031
+ });
57032
+ }, "handleCopyColumn"));
57033
+ __publicField(this, "handleCopyRows", /* @__PURE__ */ __name((rowElsToCopy, { specificColumn, onFinishMsg } = {}) => {
57034
+ let textToCopy = [];
57035
+ const jsonToCopy = [];
57036
+ lodashExports.forEach(rowElsToCopy, (rowEl) => {
57037
+ const [t2, j] = this.getRowCopyText(rowEl, { specificColumn });
57038
+ textToCopy.push(t2);
57039
+ jsonToCopy.push(j);
57040
+ });
57041
+ textToCopy = textToCopy.filter((text2) => text2).join("\n");
57007
57042
  if (!textToCopy)
57008
57043
  return window.toastr.warning("No text to copy");
57009
- this.handleCopyHelper(textToCopy, void 0, "Column copied");
57010
- }, "handleCopyColumn"));
57044
+ this.handleCopyHelper(textToCopy, jsonToCopy, onFinishMsg || "Row Copied");
57045
+ }, "handleCopyRows"));
57011
57046
  __publicField(this, "updateEntitiesHelper", /* @__PURE__ */ __name((ents, fn4) => {
57012
57047
  const { change, reduxFormEntitiesUndoRedoStack = { currentVersion: 0 } } = this.props;
57013
57048
  const [nextState, patches, inversePatches] = cn(ents, fn4);
@@ -57026,34 +57061,35 @@ const _DataTable = class _DataTable extends React$1.Component {
57026
57061
  }
57027
57062
  }));
57028
57063
  }, "updateEntitiesHelper"));
57029
- __publicField(this, "getRowCopyText", /* @__PURE__ */ __name((rowEl, { cellType } = {}) => {
57064
+ __publicField(this, "getRowCopyText", /* @__PURE__ */ __name((rowEl, { specificColumn } = {}) => {
57030
57065
  if (!rowEl)
57031
57066
  return;
57032
- return lodashExports.flatMap(rowEl.children, (cellEl) => {
57067
+ const textContent = [];
57068
+ const jsonText = [];
57069
+ lodashExports.forEach(rowEl.children, (cellEl) => {
57033
57070
  const cellChild = cellEl.querySelector(`[data-copy-text]`);
57034
57071
  if (!cellChild) {
57035
- if (cellType)
57072
+ if (specificColumn)
57036
57073
  return [];
57037
57074
  return;
57038
57075
  }
57039
- if (cellType && cellChild.getAttribute("data-test") !== cellType) {
57076
+ if (specificColumn && cellChild.getAttribute("data-test") !== specificColumn) {
57040
57077
  return [];
57041
57078
  }
57042
- return this.getCellCopyText(cellChild);
57043
- }).join(" ");
57079
+ const [t2, j] = this.getCellCopyText(cellChild);
57080
+ textContent.push(t2);
57081
+ jsonText.push(j);
57082
+ });
57083
+ return [lodashExports.flatMap(textContent).join(" "), jsonText];
57044
57084
  }, "getRowCopyText"));
57045
- __publicField(this, "handleCopyHelper", /* @__PURE__ */ __name((stringToCopy, objToCopy, message) => {
57046
- const copyHandler = /* @__PURE__ */ __name((e2) => {
57047
- e2.preventDefault();
57048
- e2.clipboardData.setData("application/json", JSON.stringify(objToCopy));
57049
- e2.clipboardData.setData("text/plain", stringToCopy);
57050
- }, "copyHandler");
57051
- document.addEventListener("copy", copyHandler);
57085
+ __publicField(this, "handleCopyHelper", /* @__PURE__ */ __name((stringToCopy, jsonToCopy, message) => {
57052
57086
  !window.Cypress && copy$1(stringToCopy, {
57087
+ onCopy: (clipboardData) => {
57088
+ clipboardData.setData("application/json", JSON.stringify(jsonToCopy));
57089
+ },
57053
57090
  // keep this so that pasting into spreadsheets works.
57054
57091
  format: "text/plain"
57055
57092
  });
57056
- document.removeEventListener("copy", copyHandler);
57057
57093
  window.toastr.success(message);
57058
57094
  }, "handleCopyHelper"));
57059
57095
  __publicField(this, "handleCopyTable", /* @__PURE__ */ __name((e2) => {
@@ -57061,10 +57097,9 @@ const _DataTable = class _DataTable extends React$1.Component {
57061
57097
  const allRowEls = getAllRows(e2);
57062
57098
  if (!allRowEls)
57063
57099
  return;
57064
- const textToCopy = lodashExports.map(allRowEls, (rowEl) => this.getRowCopyText(rowEl)).filter((text2) => text2).join("\n");
57065
- if (!textToCopy)
57066
- return window.toastr.warning("No text to copy");
57067
- this.handleCopyHelper(textToCopy, void 0, "Table copied");
57100
+ this.handleCopyRows(allRowEls, {
57101
+ onFinishMsg: "Table Copied"
57102
+ });
57068
57103
  } catch (error) {
57069
57104
  console.error(`error:`, error);
57070
57105
  window.toastr.error("Error copying rows.");
@@ -57104,6 +57139,7 @@ const _DataTable = class _DataTable extends React$1.Component {
57104
57139
  return;
57105
57140
  const allRows = getAllRows(e2);
57106
57141
  let fullCellText = "";
57142
+ const fullJson = [];
57107
57143
  lodashExports.times(selectionGrid.length, (i) => {
57108
57144
  const row = selectionGrid[i];
57109
57145
  if (fullCellText) {
@@ -57112,20 +57148,24 @@ const _DataTable = class _DataTable extends React$1.Component {
57112
57148
  if (!row) {
57113
57149
  return;
57114
57150
  } else {
57115
- const rowCopyText = this.getRowCopyText(allRows[i + 1]).split(" ");
57151
+ const jsonRow = [];
57152
+ let [rowCopyText, json] = this.getRowCopyText(allRows[i + 1]);
57153
+ rowCopyText = rowCopyText.split(" ");
57116
57154
  lodashExports.times(row.length, (i2) => {
57117
57155
  const cell = row[i2];
57118
57156
  if (cell) {
57119
57157
  fullCellText += rowCopyText[i2];
57158
+ jsonRow.push(json[i2]);
57120
57159
  }
57121
57160
  if (i2 !== row.length - 1 && i2 >= firstCellIndex)
57122
57161
  fullCellText += " ";
57123
57162
  });
57163
+ fullJson.push(jsonRow);
57124
57164
  }
57125
57165
  });
57126
57166
  if (!fullCellText)
57127
57167
  return window.toastr.warning("No text to copy");
57128
- this.handleCopyHelper(fullCellText, void 0, "Selected cells copied");
57168
+ this.handleCopyHelper(fullCellText, fullJson, "Selected cells copied");
57129
57169
  }, "handleCopySelectedCells"));
57130
57170
  __publicField(this, "handleCopySelectedRows", /* @__PURE__ */ __name((selectedRecords, e2) => {
57131
57171
  const { entities = [] } = computePresets(this.props);
@@ -57142,10 +57182,9 @@ const _DataTable = class _DataTable extends React$1.Component {
57142
57182
  if (!allRowEls)
57143
57183
  return;
57144
57184
  const rowEls = rowNumbersToCopy.map((i) => allRowEls[i]);
57145
- const textToCopy = lodashExports.map(rowEls, (rowEl) => this.getRowCopyText(rowEl)).filter((text2) => text2).join("\n");
57146
- if (!textToCopy)
57147
- return window.toastr.warning("No text to copy");
57148
- this.handleCopyHelper(textToCopy, void 0, "Selected rows copied");
57185
+ this.handleCopyRows(rowEls, {
57186
+ onFinishMsg: "Selected rows copied"
57187
+ });
57149
57188
  } catch (error) {
57150
57189
  console.error(`error:`, error);
57151
57190
  window.toastr.error("Error copying rows.");
@@ -57880,6 +57919,7 @@ const _DataTable = class _DataTable extends React$1.Component {
57880
57919
  }
57881
57920
  const oldFunc = tableColumn.Cell;
57882
57921
  tableColumn.Cell = (...args) => {
57922
+ var _a2;
57883
57923
  const [row] = args;
57884
57924
  const rowId = getIdOrCodeOrIndex(row.original, row.index);
57885
57925
  const cellId = `${rowId}:${row.column.path}`;
@@ -57890,6 +57930,7 @@ const _DataTable = class _DataTable extends React$1.Component {
57890
57930
  const dataTest = {
57891
57931
  "data-test": "tgCell_" + column.path
57892
57932
  };
57933
+ const fullValue = (_a2 = row.original) == null ? void 0 : _a2[row.column.path];
57893
57934
  if (isCellEditable && isBool) {
57894
57935
  val = /* @__PURE__ */ React$1.createElement(
57895
57936
  core$5.Checkbox,
@@ -57912,6 +57953,7 @@ const _DataTable = class _DataTable extends React$1.Component {
57912
57953
  GenericSelectComp,
57913
57954
  __spreadProps(__spreadValues({
57914
57955
  rowId,
57956
+ fullValue,
57915
57957
  initialValue: text2
57916
57958
  }, dataTest), {
57917
57959
  finishEdit: (newVal, doNotStopEditing) => {
@@ -57979,6 +58021,13 @@ const _DataTable = class _DataTable extends React$1.Component {
57979
58021
  }, dataTest), {
57980
58022
  className: "tg-cell-wrapper",
57981
58023
  "data-copy-text": text2,
58024
+ "data-copy-json": JSON.stringify(
58025
+ //tnw: eventually we'll parse these back out and use either the fullValue (for the generic selects) or the regular text vals for everything else
58026
+ column.type === "genericSelect" ? {
58027
+ __strVal: fullValue,
58028
+ __genSelCol: column.path
58029
+ } : { __strVal: text2 }
58030
+ ),
57982
58031
  title: title || void 0
57983
58032
  }),
57984
58033
  val
@@ -58325,8 +58374,13 @@ const _DataTable = class _DataTable extends React$1.Component {
58325
58374
  {
58326
58375
  key: "copyCell",
58327
58376
  onClick: () => {
58377
+ const specificColumn = cellWrapper.getAttribute("data-test");
58378
+ this.handleCopyRows([cellWrapper.closest(".rt-tr")], {
58379
+ specificColumn,
58380
+ onFinishMsg: "Cell copied"
58381
+ });
58328
58382
  const [text2, jsonText] = this.getCellCopyText(cellWrapper);
58329
- this.handleCopyHelper(text2, jsonText, "Cell copied");
58383
+ this.handleCopyHelper(text2, jsonText);
58330
58384
  },
58331
58385
  text: "Cell"
58332
58386
  }
@@ -58368,7 +58422,7 @@ const _DataTable = class _DataTable extends React$1.Component {
58368
58422
  {
58369
58423
  key: "copySelectedRows",
58370
58424
  onClick: () => {
58371
- this.handleCopyRow(row);
58425
+ this.handleCopyRows([row]);
58372
58426
  },
58373
58427
  text: "Row"
58374
58428
  }
@@ -58614,6 +58668,10 @@ const _DataTable = class _DataTable extends React$1.Component {
58614
58668
  "data-test": columnTitleTextified,
58615
58669
  "data-path": path2,
58616
58670
  "data-copy-text": columnTitleTextified,
58671
+ "data-copy-json": JSON.stringify({
58672
+ __strVal: columnTitleTextified,
58673
+ __isHeaderCell: true
58674
+ }),
58617
58675
  className: classNames("tg-react-table-column-header", {
58618
58676
  "sort-active": sortUp || sortDown
58619
58677
  })
@@ -59630,6 +59688,20 @@ function isEntityClean(e2) {
59630
59688
  return isClean;
59631
59689
  }
59632
59690
  __name(isEntityClean, "isEntityClean");
59691
+ const formatPasteData = /* @__PURE__ */ __name(({ schema, newVal, path: path2 }) => {
59692
+ const pathToField = getFieldPathToField(schema);
59693
+ const column = pathToField[path2];
59694
+ if (column.type === "genericSelect") {
59695
+ if ((newVal == null ? void 0 : newVal.__genSelCol) === path2) {
59696
+ newVal = newVal.__strVal;
59697
+ } else {
59698
+ newVal = void 0;
59699
+ }
59700
+ } else {
59701
+ newVal = Object.hasOwn(newVal, "__strVal") ? newVal.__strVal : newVal;
59702
+ }
59703
+ return newVal;
59704
+ }, "formatPasteData");
59633
59705
  const wrapDialog = /* @__PURE__ */ __name((topLevelDialogProps = {}) => (Component) => (props) => {
59634
59706
  const r2 = React$1.useRef();
59635
59707
  const memoedHotkeys = React$1.useMemo(