@teselagen/ui 0.3.6 → 0.3.7
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.umd.js +98 -87
- package/package.json +3 -3
- package/src/DataTable/index.js +142 -141
package/index.umd.js
CHANGED
|
@@ -54930,17 +54930,17 @@
|
|
|
54930
54930
|
throw TypeError("Can't convert object to primitive value");
|
|
54931
54931
|
};
|
|
54932
54932
|
|
|
54933
|
-
var anObject$
|
|
54933
|
+
var anObject$3 = _anObject;
|
|
54934
54934
|
var IE8_DOM_DEFINE$1 = _ie8DomDefine;
|
|
54935
54935
|
var toPrimitive$2 = _toPrimitive;
|
|
54936
|
-
var dP$
|
|
54936
|
+
var dP$2 = Object.defineProperty;
|
|
54937
54937
|
|
|
54938
54938
|
_objectDp.f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
|
|
54939
|
-
anObject$
|
|
54939
|
+
anObject$3(O);
|
|
54940
54940
|
P = toPrimitive$2(P, true);
|
|
54941
|
-
anObject$
|
|
54941
|
+
anObject$3(Attributes);
|
|
54942
54942
|
if (IE8_DOM_DEFINE$1) try {
|
|
54943
|
-
return dP$
|
|
54943
|
+
return dP$2(O, P, Attributes);
|
|
54944
54944
|
} catch (e) { /* empty */ }
|
|
54945
54945
|
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
|
|
54946
54946
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
@@ -54956,10 +54956,10 @@
|
|
|
54956
54956
|
};
|
|
54957
54957
|
};
|
|
54958
54958
|
|
|
54959
|
-
var dP$
|
|
54959
|
+
var dP$1 = _objectDp;
|
|
54960
54960
|
var createDesc$3 = _propertyDesc;
|
|
54961
54961
|
var _hide = _descriptors ? function (object, key, value) {
|
|
54962
|
-
return dP$
|
|
54962
|
+
return dP$1.f(object, key, createDesc$3(1, value));
|
|
54963
54963
|
} : function (object, key, value) {
|
|
54964
54964
|
object[key] = value;
|
|
54965
54965
|
return object;
|
|
@@ -54975,7 +54975,7 @@
|
|
|
54975
54975
|
var ctx$1 = _ctx;
|
|
54976
54976
|
var hide$2 = _hide;
|
|
54977
54977
|
var has$b = _has;
|
|
54978
|
-
var PROTOTYPE$
|
|
54978
|
+
var PROTOTYPE$1 = 'prototype';
|
|
54979
54979
|
|
|
54980
54980
|
var $export$8 = function (type, name, source) {
|
|
54981
54981
|
var IS_FORCED = type & $export$8.F;
|
|
@@ -54985,8 +54985,8 @@
|
|
|
54985
54985
|
var IS_BIND = type & $export$8.B;
|
|
54986
54986
|
var IS_WRAP = type & $export$8.W;
|
|
54987
54987
|
var exports = IS_GLOBAL ? core$3 : core$3[name] || (core$3[name] = {});
|
|
54988
|
-
var expProto = exports[PROTOTYPE$
|
|
54989
|
-
var target = IS_GLOBAL ? global$4 : IS_STATIC ? global$4[name] : (global$4[name] || {})[PROTOTYPE$
|
|
54988
|
+
var expProto = exports[PROTOTYPE$1];
|
|
54989
|
+
var target = IS_GLOBAL ? global$4 : IS_STATIC ? global$4[name] : (global$4[name] || {})[PROTOTYPE$1];
|
|
54990
54990
|
var key, own, out;
|
|
54991
54991
|
if (IS_GLOBAL) source = name;
|
|
54992
54992
|
for (key in source) {
|
|
@@ -55010,7 +55010,7 @@
|
|
|
55010
55010
|
} return new C(a, b, c);
|
|
55011
55011
|
} return C.apply(this, arguments);
|
|
55012
55012
|
};
|
|
55013
|
-
F[PROTOTYPE$
|
|
55013
|
+
F[PROTOTYPE$1] = C[PROTOTYPE$1];
|
|
55014
55014
|
return F;
|
|
55015
55015
|
// make static versions for prototype methods
|
|
55016
55016
|
})(out) : IS_PROTO && typeof out == 'function' ? ctx$1(Function.call, out) : out;
|
|
@@ -55147,14 +55147,14 @@
|
|
|
55147
55147
|
var has$a = _has;
|
|
55148
55148
|
var toIObject$4 = _toIobject;
|
|
55149
55149
|
var arrayIndexOf = _arrayIncludes(false);
|
|
55150
|
-
var IE_PROTO$
|
|
55150
|
+
var IE_PROTO$1 = _sharedKey('IE_PROTO');
|
|
55151
55151
|
|
|
55152
55152
|
var _objectKeysInternal = function (object, names) {
|
|
55153
55153
|
var O = toIObject$4(object);
|
|
55154
55154
|
var i = 0;
|
|
55155
55155
|
var result = [];
|
|
55156
55156
|
var key;
|
|
55157
|
-
for (key in O) if (key != IE_PROTO$
|
|
55157
|
+
for (key in O) if (key != IE_PROTO$1) has$a(O, key) && result.push(key);
|
|
55158
55158
|
// Don't enum bug & hidden keys
|
|
55159
55159
|
while (names.length > i) if (has$a(O, key = names[i++])) {
|
|
55160
55160
|
~arrayIndexOf(result, key) || result.push(key);
|
|
@@ -55169,10 +55169,10 @@
|
|
|
55169
55169
|
|
|
55170
55170
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
55171
55171
|
var $keys$3 = _objectKeysInternal;
|
|
55172
|
-
var enumBugKeys
|
|
55172
|
+
var enumBugKeys = _enumBugKeys;
|
|
55173
55173
|
|
|
55174
55174
|
var _objectKeys = Object.keys || function keys(O) {
|
|
55175
|
-
return $keys$3(O, enumBugKeys
|
|
55175
|
+
return $keys$3(O, enumBugKeys);
|
|
55176
55176
|
};
|
|
55177
55177
|
|
|
55178
55178
|
var _objectGops = {};
|
|
@@ -55279,19 +55279,27 @@
|
|
|
55279
55279
|
|
|
55280
55280
|
var _redefine = _hide;
|
|
55281
55281
|
|
|
55282
|
-
var
|
|
55283
|
-
var
|
|
55284
|
-
var getKeys$1 = _objectKeys;
|
|
55282
|
+
var _objectDps;
|
|
55283
|
+
var hasRequired_objectDps;
|
|
55285
55284
|
|
|
55286
|
-
|
|
55287
|
-
|
|
55288
|
-
|
|
55289
|
-
|
|
55290
|
-
|
|
55291
|
-
|
|
55292
|
-
|
|
55293
|
-
|
|
55294
|
-
|
|
55285
|
+
function require_objectDps () {
|
|
55286
|
+
if (hasRequired_objectDps) return _objectDps;
|
|
55287
|
+
hasRequired_objectDps = 1;
|
|
55288
|
+
var dP = _objectDp;
|
|
55289
|
+
var anObject = _anObject;
|
|
55290
|
+
var getKeys = _objectKeys;
|
|
55291
|
+
|
|
55292
|
+
_objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
55293
|
+
anObject(O);
|
|
55294
|
+
var keys = getKeys(Properties);
|
|
55295
|
+
var length = keys.length;
|
|
55296
|
+
var i = 0;
|
|
55297
|
+
var P;
|
|
55298
|
+
while (length > i) dP.f(O, P = keys[i++], Properties[P]);
|
|
55299
|
+
return O;
|
|
55300
|
+
};
|
|
55301
|
+
return _objectDps;
|
|
55302
|
+
}
|
|
55295
55303
|
|
|
55296
55304
|
var _html;
|
|
55297
55305
|
var hasRequired_html;
|
|
@@ -55304,47 +55312,55 @@
|
|
|
55304
55312
|
return _html;
|
|
55305
55313
|
}
|
|
55306
55314
|
|
|
55307
|
-
|
|
55308
|
-
var
|
|
55309
|
-
var dPs = _objectDps;
|
|
55310
|
-
var enumBugKeys = _enumBugKeys;
|
|
55311
|
-
var IE_PROTO$1 = _sharedKey('IE_PROTO');
|
|
55312
|
-
var Empty = function () { /* empty */ };
|
|
55313
|
-
var PROTOTYPE$1 = 'prototype';
|
|
55315
|
+
var _objectCreate;
|
|
55316
|
+
var hasRequired_objectCreate;
|
|
55314
55317
|
|
|
55315
|
-
|
|
55316
|
-
|
|
55317
|
-
|
|
55318
|
-
|
|
55319
|
-
|
|
55320
|
-
|
|
55321
|
-
|
|
55322
|
-
|
|
55323
|
-
|
|
55324
|
-
|
|
55325
|
-
|
|
55326
|
-
|
|
55327
|
-
|
|
55328
|
-
|
|
55329
|
-
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55333
|
-
|
|
55334
|
-
|
|
55335
|
-
|
|
55336
|
-
|
|
55337
|
-
|
|
55338
|
-
|
|
55339
|
-
|
|
55340
|
-
|
|
55341
|
-
|
|
55342
|
-
|
|
55343
|
-
|
|
55344
|
-
|
|
55345
|
-
|
|
55346
|
-
|
|
55347
|
-
|
|
55318
|
+
function require_objectCreate () {
|
|
55319
|
+
if (hasRequired_objectCreate) return _objectCreate;
|
|
55320
|
+
hasRequired_objectCreate = 1;
|
|
55321
|
+
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
55322
|
+
var anObject = _anObject;
|
|
55323
|
+
var dPs = require_objectDps();
|
|
55324
|
+
var enumBugKeys = _enumBugKeys;
|
|
55325
|
+
var IE_PROTO = _sharedKey('IE_PROTO');
|
|
55326
|
+
var Empty = function () { /* empty */ };
|
|
55327
|
+
var PROTOTYPE = 'prototype';
|
|
55328
|
+
|
|
55329
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
55330
|
+
var createDict = function () {
|
|
55331
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
55332
|
+
var iframe = require_domCreate()('iframe');
|
|
55333
|
+
var i = enumBugKeys.length;
|
|
55334
|
+
var lt = '<';
|
|
55335
|
+
var gt = '>';
|
|
55336
|
+
var iframeDocument;
|
|
55337
|
+
iframe.style.display = 'none';
|
|
55338
|
+
require_html().appendChild(iframe);
|
|
55339
|
+
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
|
|
55340
|
+
// createDict = iframe.contentWindow.Object;
|
|
55341
|
+
// html.removeChild(iframe);
|
|
55342
|
+
iframeDocument = iframe.contentWindow.document;
|
|
55343
|
+
iframeDocument.open();
|
|
55344
|
+
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
|
|
55345
|
+
iframeDocument.close();
|
|
55346
|
+
createDict = iframeDocument.F;
|
|
55347
|
+
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
|
|
55348
|
+
return createDict();
|
|
55349
|
+
};
|
|
55350
|
+
|
|
55351
|
+
_objectCreate = Object.create || function create(O, Properties) {
|
|
55352
|
+
var result;
|
|
55353
|
+
if (O !== null) {
|
|
55354
|
+
Empty[PROTOTYPE] = anObject(O);
|
|
55355
|
+
result = new Empty();
|
|
55356
|
+
Empty[PROTOTYPE] = null;
|
|
55357
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
55358
|
+
result[IE_PROTO] = O;
|
|
55359
|
+
} else result = createDict();
|
|
55360
|
+
return Properties === undefined ? result : dPs(result, Properties);
|
|
55361
|
+
};
|
|
55362
|
+
return _objectCreate;
|
|
55363
|
+
}
|
|
55348
55364
|
|
|
55349
55365
|
var _wks = {exports: {}};
|
|
55350
55366
|
|
|
@@ -55370,7 +55386,7 @@
|
|
|
55370
55386
|
if (it && !has$9(it = stat ? it : it.prototype, TAG$1)) def(it, TAG$1, { configurable: true, value: tag });
|
|
55371
55387
|
};
|
|
55372
55388
|
|
|
55373
|
-
var create$3 =
|
|
55389
|
+
var create$3 = require_objectCreate();
|
|
55374
55390
|
var descriptor = _propertyDesc;
|
|
55375
55391
|
var setToStringTag$2 = _setToStringTag;
|
|
55376
55392
|
var IteratorPrototype = {};
|
|
@@ -56013,7 +56029,7 @@
|
|
|
56013
56029
|
var toIObject = _toIobject;
|
|
56014
56030
|
var toPrimitive = _toPrimitive;
|
|
56015
56031
|
var createDesc = _propertyDesc;
|
|
56016
|
-
var _create$1 =
|
|
56032
|
+
var _create$1 = require_objectCreate();
|
|
56017
56033
|
var gOPNExt = _objectGopnExt;
|
|
56018
56034
|
var $GOPD = _objectGopd;
|
|
56019
56035
|
var $GOPS = _objectGops;
|
|
@@ -56323,7 +56339,7 @@
|
|
|
56323
56339
|
|
|
56324
56340
|
var $export = _export;
|
|
56325
56341
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
56326
|
-
$export($export.S, 'Object', { create:
|
|
56342
|
+
$export($export.S, 'Object', { create: require_objectCreate() });
|
|
56327
56343
|
|
|
56328
56344
|
var $Object = _coreExports.Object;
|
|
56329
56345
|
var create$2 = function create(P, D) {
|
|
@@ -112700,9 +112716,7 @@
|
|
|
112700
112716
|
entities,
|
|
112701
112717
|
reduxFormEntitiesUndoRedoStack[reduxFormEntitiesUndoRedoStack.currentVersion].inversePatches
|
|
112702
112718
|
);
|
|
112703
|
-
const { newEnts, validationErrors } = this.formatAndValidateEntities(
|
|
112704
|
-
nextState
|
|
112705
|
-
);
|
|
112719
|
+
const { newEnts, validationErrors } = this.formatAndValidateEntities(nextState);
|
|
112706
112720
|
change("reduxFormEntities", newEnts);
|
|
112707
112721
|
this.updateValidation(newEnts, validationErrors);
|
|
112708
112722
|
change("reduxFormEntitiesUndoRedoStack", {
|
|
@@ -112724,9 +112738,7 @@
|
|
|
112724
112738
|
entities,
|
|
112725
112739
|
reduxFormEntitiesUndoRedoStack[nextV].patches
|
|
112726
112740
|
);
|
|
112727
|
-
const { newEnts, validationErrors } = this.formatAndValidateEntities(
|
|
112728
|
-
nextState
|
|
112729
|
-
);
|
|
112741
|
+
const { newEnts, validationErrors } = this.formatAndValidateEntities(nextState);
|
|
112730
112742
|
change("reduxFormEntities", newEnts);
|
|
112731
112743
|
this.updateValidation(newEnts, validationErrors);
|
|
112732
112744
|
change("reduxFormEntitiesUndoRedoStack", {
|
|
@@ -113228,10 +113240,7 @@
|
|
|
113228
113240
|
this.handleCopyHelper(textToCopy, "Column copied");
|
|
113229
113241
|
};
|
|
113230
113242
|
updateEntitiesHelper = (ents, fn) => {
|
|
113231
|
-
const {
|
|
113232
|
-
change,
|
|
113233
|
-
reduxFormEntitiesUndoRedoStack = { currentVersion: 0 }
|
|
113234
|
-
} = this.props;
|
|
113243
|
+
const { change, reduxFormEntitiesUndoRedoStack = { currentVersion: 0 } } = this.props;
|
|
113235
113244
|
const [nextState, patches, inversePatches] = cn(ents, fn);
|
|
113236
113245
|
if (!inversePatches.length)
|
|
113237
113246
|
return;
|
|
@@ -113293,9 +113302,11 @@
|
|
|
113293
113302
|
}
|
|
113294
113303
|
};
|
|
113295
113304
|
handleCopySelectedCells = (e) => {
|
|
113296
|
-
const {
|
|
113297
|
-
|
|
113298
|
-
|
|
113305
|
+
const {
|
|
113306
|
+
entities = [],
|
|
113307
|
+
reduxFormSelectedCells,
|
|
113308
|
+
schema
|
|
113309
|
+
} = computePresets(this.props);
|
|
113299
113310
|
if (lodashExports.isEmpty(reduxFormSelectedCells))
|
|
113300
113311
|
return;
|
|
113301
113312
|
const pathToIndex = getFieldPathToIndex(schema);
|
|
@@ -113581,7 +113592,9 @@
|
|
|
113581
113592
|
}
|
|
113582
113593
|
const numRows = isInfinite ? entities.length : pageSize;
|
|
113583
113594
|
const idMap = reduxFormSelectedEntityIdMap || {};
|
|
113584
|
-
const selectedRowCount = Object.keys(idMap).filter(
|
|
113595
|
+
const selectedRowCount = Object.keys(idMap).filter(
|
|
113596
|
+
(key) => idMap[key]
|
|
113597
|
+
).length;
|
|
113585
113598
|
let rowsToShow = doNotShowEmptyRows ? Math.min(numRows, entities.length) : numRows;
|
|
113586
113599
|
if (entities.length === 0 && rowsToShow < 3)
|
|
113587
113600
|
rowsToShow = 3;
|
|
@@ -115077,9 +115090,7 @@
|
|
|
115077
115090
|
return getIdOrCodeOrIndex(e, i) === rowId;
|
|
115078
115091
|
});
|
|
115079
115092
|
const insertIndex = above ? indexToInsert : indexToInsert + 1;
|
|
115080
|
-
let { newEnts, validationErrors } = this.formatAndValidateEntities(
|
|
115081
|
-
newEntities
|
|
115082
|
-
);
|
|
115093
|
+
let { newEnts, validationErrors } = this.formatAndValidateEntities(newEntities);
|
|
115083
115094
|
newEnts = newEnts.map((e) => ({
|
|
115084
115095
|
...e,
|
|
115085
115096
|
_isClean: true
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@teselagen/file-utils": "0.3.
|
|
7
|
-
"@teselagen/bounce-loader": "0.3.
|
|
6
|
+
"@teselagen/file-utils": "0.3.7",
|
|
7
|
+
"@teselagen/bounce-loader": "0.3.7",
|
|
8
8
|
"@blueprintjs/core": "3.52.0",
|
|
9
9
|
"@blueprintjs/datetime": "3.23.19",
|
|
10
10
|
"@blueprintjs/icons": "3.33.0",
|
package/src/DataTable/index.js
CHANGED
|
@@ -178,7 +178,7 @@ class DataTable extends React.Component {
|
|
|
178
178
|
fullscreen: !this.state.fullscreen
|
|
179
179
|
});
|
|
180
180
|
};
|
|
181
|
-
handleEnterStartCellEdit = e => {
|
|
181
|
+
handleEnterStartCellEdit = (e) => {
|
|
182
182
|
e.stopPropagation();
|
|
183
183
|
this.startCellEdit(this.getPrimarySelectedCellId());
|
|
184
184
|
};
|
|
@@ -208,9 +208,8 @@ class DataTable extends React.Component {
|
|
|
208
208
|
reduxFormEntitiesUndoRedoStack.currentVersion
|
|
209
209
|
].inversePatches
|
|
210
210
|
);
|
|
211
|
-
const { newEnts, validationErrors } =
|
|
212
|
-
nextState
|
|
213
|
-
);
|
|
211
|
+
const { newEnts, validationErrors } =
|
|
212
|
+
this.formatAndValidateEntities(nextState);
|
|
214
213
|
change("reduxFormEntities", newEnts);
|
|
215
214
|
this.updateValidation(newEnts, validationErrors);
|
|
216
215
|
change("reduxFormEntitiesUndoRedoStack", {
|
|
@@ -233,9 +232,8 @@ class DataTable extends React.Component {
|
|
|
233
232
|
entities,
|
|
234
233
|
reduxFormEntitiesUndoRedoStack[nextV].patches
|
|
235
234
|
);
|
|
236
|
-
const { newEnts, validationErrors } =
|
|
237
|
-
nextState
|
|
238
|
-
);
|
|
235
|
+
const { newEnts, validationErrors } =
|
|
236
|
+
this.formatAndValidateEntities(nextState);
|
|
239
237
|
change("reduxFormEntities", newEnts);
|
|
240
238
|
this.updateValidation(newEnts, validationErrors);
|
|
241
239
|
change("reduxFormEntitiesUndoRedoStack", {
|
|
@@ -266,7 +264,7 @@ class DataTable extends React.Component {
|
|
|
266
264
|
if (!isEqual(newProps.schema, oldProps.schema)) {
|
|
267
265
|
const { schema = {} } = newProps;
|
|
268
266
|
const columns = schema.fields
|
|
269
|
-
? schema.fields.reduce(function(columns, field, i) {
|
|
267
|
+
? schema.fields.reduce(function (columns, field, i) {
|
|
270
268
|
if (field.isHidden) {
|
|
271
269
|
return columns;
|
|
272
270
|
}
|
|
@@ -355,7 +353,8 @@ class DataTable extends React.Component {
|
|
|
355
353
|
? selectedIdsToUse
|
|
356
354
|
: [selectedIdsToUse];
|
|
357
355
|
const selectedEntities = entities.filter(
|
|
358
|
-
|
|
356
|
+
(e) =>
|
|
357
|
+
idArray.indexOf(getIdOrCodeOrIndex(e)) > -1 && !isEntityDisabled(e)
|
|
359
358
|
);
|
|
360
359
|
newIdMap =
|
|
361
360
|
newIdMap ||
|
|
@@ -368,14 +367,13 @@ class DataTable extends React.Component {
|
|
|
368
367
|
const idToScrollTo = idArray[0];
|
|
369
368
|
if (!idToScrollTo && idToScrollTo !== 0) return;
|
|
370
369
|
const entityIndexToScrollTo = entities.findIndex(
|
|
371
|
-
e => e.id === idToScrollTo || e.code === idToScrollTo
|
|
370
|
+
(e) => e.id === idToScrollTo || e.code === idToScrollTo
|
|
372
371
|
);
|
|
373
372
|
if (entityIndexToScrollTo === -1 || !table) return;
|
|
374
373
|
const tableBody = table.querySelector(".rt-tbody");
|
|
375
374
|
if (!tableBody) return;
|
|
376
|
-
const rowEl =
|
|
377
|
-
entityIndexToScrollTo
|
|
378
|
-
];
|
|
375
|
+
const rowEl =
|
|
376
|
+
tableBody.getElementsByClassName("rt-tr-group")[entityIndexToScrollTo];
|
|
379
377
|
if (!rowEl) return;
|
|
380
378
|
setTimeout(() => {
|
|
381
379
|
//we need to delay for a teeny bit to make sure the table has drawn
|
|
@@ -387,14 +385,14 @@ class DataTable extends React.Component {
|
|
|
387
385
|
}, 0);
|
|
388
386
|
}
|
|
389
387
|
};
|
|
390
|
-
formatAndValidateEntities = entities => {
|
|
388
|
+
formatAndValidateEntities = (entities) => {
|
|
391
389
|
const { schema } = this.props;
|
|
392
|
-
const editableFields = schema.fields.filter(f => !f.isNotEditable);
|
|
390
|
+
const editableFields = schema.fields.filter((f) => !f.isNotEditable);
|
|
393
391
|
const validationErrors = {};
|
|
394
392
|
|
|
395
|
-
const newEnts = immer(entities, entities => {
|
|
393
|
+
const newEnts = immer(entities, (entities) => {
|
|
396
394
|
entities.forEach((e, index) => {
|
|
397
|
-
editableFields.forEach(columnSchema => {
|
|
395
|
+
editableFields.forEach((columnSchema) => {
|
|
398
396
|
//mutative
|
|
399
397
|
const { error } = editCellHelper({
|
|
400
398
|
entity: e,
|
|
@@ -487,7 +485,7 @@ class DataTable extends React.Component {
|
|
|
487
485
|
document.removeEventListener("paste", this.handlePaste);
|
|
488
486
|
}
|
|
489
487
|
|
|
490
|
-
handleRowMove = (type, shiftHeld) => e => {
|
|
488
|
+
handleRowMove = (type, shiftHeld) => (e) => {
|
|
491
489
|
e.preventDefault();
|
|
492
490
|
e.stopPropagation();
|
|
493
491
|
const props = computePresets(this.props);
|
|
@@ -504,16 +502,16 @@ class DataTable extends React.Component {
|
|
|
504
502
|
if (noSelect) return;
|
|
505
503
|
if (lastSelectedEnt) {
|
|
506
504
|
let lastSelectedIndex = entities.findIndex(
|
|
507
|
-
ent => ent === lastSelectedEnt
|
|
505
|
+
(ent) => ent === lastSelectedEnt
|
|
508
506
|
);
|
|
509
507
|
if (lastSelectedIndex === -1) {
|
|
510
508
|
if (lastSelectedEnt.id !== undefined) {
|
|
511
509
|
lastSelectedIndex = entities.findIndex(
|
|
512
|
-
ent => ent.id === lastSelectedEnt.id
|
|
510
|
+
(ent) => ent.id === lastSelectedEnt.id
|
|
513
511
|
);
|
|
514
512
|
} else if (lastSelectedEnt.code !== undefined) {
|
|
515
513
|
lastSelectedIndex = entities.findIndex(
|
|
516
|
-
ent => ent.code === lastSelectedEnt.code
|
|
514
|
+
(ent) => ent.code === lastSelectedEnt.code
|
|
517
515
|
);
|
|
518
516
|
}
|
|
519
517
|
}
|
|
@@ -559,7 +557,7 @@ class DataTable extends React.Component {
|
|
|
559
557
|
props
|
|
560
558
|
});
|
|
561
559
|
};
|
|
562
|
-
handleCopyHotkey = e => {
|
|
560
|
+
handleCopyHotkey = (e) => {
|
|
563
561
|
const { isCellEditable, reduxFormSelectedEntityIdMap } = computePresets(
|
|
564
562
|
this.props
|
|
565
563
|
);
|
|
@@ -583,7 +581,7 @@ class DataTable extends React.Component {
|
|
|
583
581
|
}
|
|
584
582
|
};
|
|
585
583
|
|
|
586
|
-
handlePaste = e => {
|
|
584
|
+
handlePaste = (e) => {
|
|
587
585
|
const {
|
|
588
586
|
isCellEditable,
|
|
589
587
|
reduxFormSelectedCells,
|
|
@@ -627,9 +625,9 @@ class DataTable extends React.Component {
|
|
|
627
625
|
};
|
|
628
626
|
// single paste value, fill all cells with value
|
|
629
627
|
const newVal = pasteData[0][0];
|
|
630
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
628
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
631
629
|
const entityIdToEntity = getEntityIdToEntity(entities);
|
|
632
|
-
Object.keys(reduxFormSelectedCells).forEach(cellId => {
|
|
630
|
+
Object.keys(reduxFormSelectedCells).forEach((cellId) => {
|
|
633
631
|
const [rowId, path] = cellId.split(":");
|
|
634
632
|
const entity = entityIdToEntity[rowId].e;
|
|
635
633
|
delete entity._isClean;
|
|
@@ -656,7 +654,7 @@ class DataTable extends React.Component {
|
|
|
656
654
|
};
|
|
657
655
|
|
|
658
656
|
const newSelectedCells = { ...reduxFormSelectedCells };
|
|
659
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
657
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
660
658
|
const entityIdToEntity = getEntityIdToEntity(entities);
|
|
661
659
|
const [rowId, primaryCellPath] = primarySelectedCell.split(":");
|
|
662
660
|
const primaryEntityInfo = entityIdToEntity[rowId];
|
|
@@ -710,7 +708,7 @@ class DataTable extends React.Component {
|
|
|
710
708
|
}
|
|
711
709
|
}
|
|
712
710
|
};
|
|
713
|
-
handleSelectAllRows = e => {
|
|
711
|
+
handleSelectAllRows = (e) => {
|
|
714
712
|
const {
|
|
715
713
|
change,
|
|
716
714
|
isEntityDisabled,
|
|
@@ -723,12 +721,12 @@ class DataTable extends React.Component {
|
|
|
723
721
|
e.preventDefault();
|
|
724
722
|
|
|
725
723
|
if (isCellEditable) {
|
|
726
|
-
const schemaPaths = schema.fields.map(f => f.path);
|
|
724
|
+
const schemaPaths = schema.fields.map((f) => f.path);
|
|
727
725
|
const newSelectedCells = {};
|
|
728
726
|
entities.forEach((entity, i) => {
|
|
729
727
|
if (isEntityDisabled(entity)) return;
|
|
730
728
|
const entityId = getIdOrCodeOrIndex(entity, i);
|
|
731
|
-
schemaPaths.forEach(p => {
|
|
729
|
+
schemaPaths.forEach((p) => {
|
|
732
730
|
newSelectedCells[`${entityId}:${p}`] = true;
|
|
733
731
|
});
|
|
734
732
|
});
|
|
@@ -768,9 +766,9 @@ class DataTable extends React.Component {
|
|
|
768
766
|
};
|
|
769
767
|
if (isEmpty(reduxFormSelectedCells)) return;
|
|
770
768
|
const rowIds = [];
|
|
771
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
769
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
772
770
|
const entityIdToEntity = getEntityIdToEntity(entities);
|
|
773
|
-
Object.keys(reduxFormSelectedCells).forEach(cellId => {
|
|
771
|
+
Object.keys(reduxFormSelectedCells).forEach((cellId) => {
|
|
774
772
|
const [rowId, path] = cellId.split(":");
|
|
775
773
|
rowIds.push(rowId);
|
|
776
774
|
const entity = entityIdToEntity[rowId].e;
|
|
@@ -791,19 +789,19 @@ class DataTable extends React.Component {
|
|
|
791
789
|
});
|
|
792
790
|
};
|
|
793
791
|
|
|
794
|
-
handleCut = e => {
|
|
792
|
+
handleCut = (e) => {
|
|
795
793
|
this.handleDeleteCell();
|
|
796
794
|
this.handleCopyHotkey(e);
|
|
797
795
|
};
|
|
798
796
|
|
|
799
|
-
getCellCopyText = cellWrapper => {
|
|
797
|
+
getCellCopyText = (cellWrapper) => {
|
|
800
798
|
const text = cellWrapper && cellWrapper.getAttribute("data-copy-text");
|
|
801
799
|
|
|
802
800
|
const toRet = text || cellWrapper.textContent || "";
|
|
803
801
|
return toRet;
|
|
804
802
|
};
|
|
805
803
|
|
|
806
|
-
handleCopyRow = rowEl => {
|
|
804
|
+
handleCopyRow = (rowEl) => {
|
|
807
805
|
//takes in a row element
|
|
808
806
|
const text = this.getRowCopyText(rowEl);
|
|
809
807
|
if (!text) return window.toastr.warning("No text to copy");
|
|
@@ -813,20 +811,18 @@ class DataTable extends React.Component {
|
|
|
813
811
|
const cellType = cellWrapper.getAttribute("data-test");
|
|
814
812
|
const allRowEls = getAllRows(e);
|
|
815
813
|
if (!allRowEls) return;
|
|
816
|
-
const textToCopy = map(allRowEls, rowEl =>
|
|
814
|
+
const textToCopy = map(allRowEls, (rowEl) =>
|
|
817
815
|
this.getRowCopyText(rowEl, { cellType })
|
|
818
816
|
)
|
|
819
|
-
.filter(text => text)
|
|
817
|
+
.filter((text) => text)
|
|
820
818
|
.join("\n");
|
|
821
819
|
if (!textToCopy) return window.toastr.warning("No text to copy");
|
|
822
820
|
|
|
823
821
|
this.handleCopyHelper(textToCopy, "Column copied");
|
|
824
822
|
};
|
|
825
823
|
updateEntitiesHelper = (ents, fn) => {
|
|
826
|
-
const {
|
|
827
|
-
|
|
828
|
-
reduxFormEntitiesUndoRedoStack = { currentVersion: 0 }
|
|
829
|
-
} = this.props;
|
|
824
|
+
const { change, reduxFormEntitiesUndoRedoStack = { currentVersion: 0 } } =
|
|
825
|
+
this.props;
|
|
830
826
|
const [nextState, patches, inversePatches] = produceWithPatches(ents, fn);
|
|
831
827
|
if (!inversePatches.length) return;
|
|
832
828
|
const thatNewNew = [...nextState];
|
|
@@ -847,7 +843,7 @@ class DataTable extends React.Component {
|
|
|
847
843
|
getRowCopyText = (rowEl, { cellType } = {}) => {
|
|
848
844
|
//takes in a row element
|
|
849
845
|
if (!rowEl) return;
|
|
850
|
-
return flatMap(rowEl.children, cellEl => {
|
|
846
|
+
return flatMap(rowEl.children, (cellEl) => {
|
|
851
847
|
const cellChild = cellEl.querySelector(`[data-copy-text]`);
|
|
852
848
|
if (!cellChild) {
|
|
853
849
|
if (cellType) return []; //strip it
|
|
@@ -861,7 +857,7 @@ class DataTable extends React.Component {
|
|
|
861
857
|
};
|
|
862
858
|
|
|
863
859
|
handleCopyHelper = (stringToCopy, message) => {
|
|
864
|
-
const copyHandler = e => {
|
|
860
|
+
const copyHandler = (e) => {
|
|
865
861
|
e.preventDefault();
|
|
866
862
|
e.clipboardData.setData("text/plain", stringToCopy);
|
|
867
863
|
};
|
|
@@ -875,13 +871,13 @@ class DataTable extends React.Component {
|
|
|
875
871
|
window.toastr.success(message);
|
|
876
872
|
};
|
|
877
873
|
|
|
878
|
-
handleCopyTable = e => {
|
|
874
|
+
handleCopyTable = (e) => {
|
|
879
875
|
try {
|
|
880
876
|
const allRowEls = getAllRows(e);
|
|
881
877
|
if (!allRowEls) return;
|
|
882
878
|
//get row elements and call this.handleCopyRow for each
|
|
883
|
-
const textToCopy = map(allRowEls, rowEl => this.getRowCopyText(rowEl))
|
|
884
|
-
.filter(text => text)
|
|
879
|
+
const textToCopy = map(allRowEls, (rowEl) => this.getRowCopyText(rowEl))
|
|
880
|
+
.filter((text) => text)
|
|
885
881
|
.join("\n");
|
|
886
882
|
if (!textToCopy) return window.toastr.warning("No text to copy");
|
|
887
883
|
|
|
@@ -891,10 +887,12 @@ class DataTable extends React.Component {
|
|
|
891
887
|
window.toastr.error("Error copying rows.");
|
|
892
888
|
}
|
|
893
889
|
};
|
|
894
|
-
handleCopySelectedCells = e => {
|
|
895
|
-
const {
|
|
896
|
-
|
|
897
|
-
|
|
890
|
+
handleCopySelectedCells = (e) => {
|
|
891
|
+
const {
|
|
892
|
+
entities = [],
|
|
893
|
+
reduxFormSelectedCells,
|
|
894
|
+
schema
|
|
895
|
+
} = computePresets(this.props);
|
|
898
896
|
// if the current selection is consecutive cells then copy with
|
|
899
897
|
// tabs between. if not then just select primary selected cell
|
|
900
898
|
if (isEmpty(reduxFormSelectedCells)) return;
|
|
@@ -903,7 +901,7 @@ class DataTable extends React.Component {
|
|
|
903
901
|
const selectionGrid = [];
|
|
904
902
|
let firstRowIndex;
|
|
905
903
|
let firstCellIndex;
|
|
906
|
-
Object.keys(reduxFormSelectedCells).forEach(key => {
|
|
904
|
+
Object.keys(reduxFormSelectedCells).forEach((key) => {
|
|
907
905
|
const [rowId, path] = key.split(":");
|
|
908
906
|
const eInfo = entityIdToEntity[rowId];
|
|
909
907
|
if (eInfo) {
|
|
@@ -923,7 +921,7 @@ class DataTable extends React.Component {
|
|
|
923
921
|
if (firstRowIndex === undefined) return;
|
|
924
922
|
const allRows = getAllRows(e);
|
|
925
923
|
let fullCellText = "";
|
|
926
|
-
times(selectionGrid.length, i => {
|
|
924
|
+
times(selectionGrid.length, (i) => {
|
|
927
925
|
const row = selectionGrid[i];
|
|
928
926
|
if (fullCellText) {
|
|
929
927
|
fullCellText += "\n";
|
|
@@ -933,7 +931,7 @@ class DataTable extends React.Component {
|
|
|
933
931
|
} else {
|
|
934
932
|
// ignore header
|
|
935
933
|
const rowCopyText = this.getRowCopyText(allRows[i + 1]).split("\t");
|
|
936
|
-
times(row.length, i => {
|
|
934
|
+
times(row.length, (i) => {
|
|
937
935
|
const cell = row[i];
|
|
938
936
|
if (cell) {
|
|
939
937
|
fullCellText += rowCopyText[i];
|
|
@@ -957,7 +955,7 @@ class DataTable extends React.Component {
|
|
|
957
955
|
//index 0 of the table is the column titles
|
|
958
956
|
//must add 1 to rowNum
|
|
959
957
|
const rowNumbersToCopy = selectedRecords
|
|
960
|
-
.map(rec => idToIndex[rec.id || rec.code] + 1)
|
|
958
|
+
.map((rec) => idToIndex[rec.id || rec.code] + 1)
|
|
961
959
|
.sort();
|
|
962
960
|
|
|
963
961
|
if (!rowNumbersToCopy.length) return;
|
|
@@ -965,11 +963,11 @@ class DataTable extends React.Component {
|
|
|
965
963
|
try {
|
|
966
964
|
const allRowEls = getAllRows(e);
|
|
967
965
|
if (!allRowEls) return;
|
|
968
|
-
const rowEls = rowNumbersToCopy.map(i => allRowEls[i]);
|
|
966
|
+
const rowEls = rowNumbersToCopy.map((i) => allRowEls[i]);
|
|
969
967
|
|
|
970
968
|
//get row elements and call this.handleCopyRow for each const rowEls = this.getRowEls(rowNumbersToCopy)
|
|
971
|
-
const textToCopy = map(rowEls, rowEl => this.getRowCopyText(rowEl))
|
|
972
|
-
.filter(text => text)
|
|
969
|
+
const textToCopy = map(rowEls, (rowEl) => this.getRowCopyText(rowEl))
|
|
970
|
+
.filter((text) => text)
|
|
973
971
|
.join("\n");
|
|
974
972
|
if (!textToCopy) return window.toastr.warning("No text to copy");
|
|
975
973
|
|
|
@@ -1005,7 +1003,7 @@ class DataTable extends React.Component {
|
|
|
1005
1003
|
});
|
|
1006
1004
|
};
|
|
1007
1005
|
|
|
1008
|
-
getTheadComponent = props => {
|
|
1006
|
+
getTheadComponent = (props) => {
|
|
1009
1007
|
const {
|
|
1010
1008
|
withDisplayOptions,
|
|
1011
1009
|
moveColumnPersist,
|
|
@@ -1029,7 +1027,7 @@ class DataTable extends React.Component {
|
|
|
1029
1027
|
);
|
|
1030
1028
|
};
|
|
1031
1029
|
getThComponent = compose(
|
|
1032
|
-
withProps(props => {
|
|
1030
|
+
withProps((props) => {
|
|
1033
1031
|
const { columnindex } = props;
|
|
1034
1032
|
return {
|
|
1035
1033
|
index: columnindex || 0
|
|
@@ -1039,7 +1037,7 @@ class DataTable extends React.Component {
|
|
|
1039
1037
|
)(({ toggleSort, className, children, ...rest }) => (
|
|
1040
1038
|
<div
|
|
1041
1039
|
className={classNames("rt-th", className)}
|
|
1042
|
-
onClick={e => toggleSort && toggleSort(e)}
|
|
1040
|
+
onClick={(e) => toggleSort && toggleSort(e)}
|
|
1043
1041
|
role="columnheader"
|
|
1044
1042
|
tabIndex="-1" // Resolves eslint issues without implementing keyboard navigation incorrectly
|
|
1045
1043
|
{...rest}
|
|
@@ -1048,7 +1046,7 @@ class DataTable extends React.Component {
|
|
|
1048
1046
|
</div>
|
|
1049
1047
|
));
|
|
1050
1048
|
|
|
1051
|
-
addEntitiesToSelection = entities => {
|
|
1049
|
+
addEntitiesToSelection = (entities) => {
|
|
1052
1050
|
const propPresets = computePresets(this.props);
|
|
1053
1051
|
const { isEntityDisabled, reduxFormSelectedEntityIdMap } = propPresets;
|
|
1054
1052
|
const idMap = reduxFormSelectedEntityIdMap || {};
|
|
@@ -1156,10 +1154,12 @@ class DataTable extends React.Component {
|
|
|
1156
1154
|
if (withDisplayOptions && !syncDisplayOptionsToDb) {
|
|
1157
1155
|
//little hack to make localstorage changes get reflected in UI (we force an update to get the enhancers to run again :)
|
|
1158
1156
|
|
|
1159
|
-
const wrapUpdate =
|
|
1160
|
-
fn
|
|
1161
|
-
|
|
1162
|
-
|
|
1157
|
+
const wrapUpdate =
|
|
1158
|
+
(fn) =>
|
|
1159
|
+
(...args) => {
|
|
1160
|
+
fn(...args);
|
|
1161
|
+
change("localStorageForceUpdate", Math.random());
|
|
1162
|
+
};
|
|
1163
1163
|
updateColumnVisibilityToUse = wrapUpdate(updateColumnVisibility);
|
|
1164
1164
|
updateTableDisplayDensityToUse = wrapUpdate(updateTableDisplayDensity);
|
|
1165
1165
|
resetDefaultVisibilityToUse = wrapUpdate(resetDefaultVisibility);
|
|
@@ -1179,7 +1179,7 @@ class DataTable extends React.Component {
|
|
|
1179
1179
|
filters.length ||
|
|
1180
1180
|
searchTerm ||
|
|
1181
1181
|
schema.fields.some(
|
|
1182
|
-
field => field.filterIsActive && field.filterIsActive(currentParams)
|
|
1182
|
+
(field) => field.filterIsActive && field.filterIsActive(currentParams)
|
|
1183
1183
|
);
|
|
1184
1184
|
const additionalFilterKeys = schema.fields.reduce((acc, field) => {
|
|
1185
1185
|
if (field.filterKey) acc.push(field.filterKey);
|
|
@@ -1190,7 +1190,7 @@ class DataTable extends React.Component {
|
|
|
1190
1190
|
schema.fields.forEach(({ isHidden, displayName, path }) => {
|
|
1191
1191
|
const ccDisplayName = camelCase(displayName || path);
|
|
1192
1192
|
if (isHidden) {
|
|
1193
|
-
filters.forEach(filter => {
|
|
1193
|
+
filters.forEach((filter) => {
|
|
1194
1194
|
if (filter.filterOn === ccDisplayName) {
|
|
1195
1195
|
filtersOnNonDisplayedFields.push({
|
|
1196
1196
|
...filter,
|
|
@@ -1203,8 +1203,9 @@ class DataTable extends React.Component {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
const numRows = isInfinite ? entities.length : pageSize;
|
|
1205
1205
|
const idMap = reduxFormSelectedEntityIdMap || {};
|
|
1206
|
-
const selectedRowCount = Object.keys(idMap).filter(
|
|
1207
|
-
|
|
1206
|
+
const selectedRowCount = Object.keys(idMap).filter(
|
|
1207
|
+
(key) => idMap[key]
|
|
1208
|
+
).length;
|
|
1208
1209
|
|
|
1209
1210
|
let rowsToShow = doNotShowEmptyRows
|
|
1210
1211
|
? Math.min(numRows, entities.length)
|
|
@@ -1242,7 +1243,7 @@ class DataTable extends React.Component {
|
|
|
1242
1243
|
if (canShowSelectAll) {
|
|
1243
1244
|
// could all be disabled
|
|
1244
1245
|
let atLeastOneRowOnCurrentPageSelected = false;
|
|
1245
|
-
const allRowsOnCurrentPageSelected = entities.every(e => {
|
|
1246
|
+
const allRowsOnCurrentPageSelected = entities.every((e) => {
|
|
1246
1247
|
const rowId = getIdOrCodeOrIndex(e);
|
|
1247
1248
|
const selected = idMap[rowId] || isEntityDisabled(e);
|
|
1248
1249
|
if (selected) atLeastOneRowOnCurrentPageSelected = true;
|
|
@@ -1254,7 +1255,7 @@ class DataTable extends React.Component {
|
|
|
1254
1255
|
) {
|
|
1255
1256
|
let everyEntitySelected;
|
|
1256
1257
|
if (isLocalCall) {
|
|
1257
|
-
everyEntitySelected = entitiesAcrossPages.every(e => {
|
|
1258
|
+
everyEntitySelected = entitiesAcrossPages.every((e) => {
|
|
1258
1259
|
const rowId = getIdOrCodeOrIndex(e);
|
|
1259
1260
|
return idMap[rowId] || isEntityDisabled(e);
|
|
1260
1261
|
});
|
|
@@ -1292,7 +1293,7 @@ class DataTable extends React.Component {
|
|
|
1292
1293
|
|
|
1293
1294
|
let SubComponentToUse;
|
|
1294
1295
|
if (SubComponent) {
|
|
1295
|
-
SubComponentToUse = row => {
|
|
1296
|
+
SubComponentToUse = (row) => {
|
|
1296
1297
|
let shouldShow = true;
|
|
1297
1298
|
if (shouldShowSubComponent) {
|
|
1298
1299
|
shouldShow = shouldShowSubComponent(row.original);
|
|
@@ -1353,7 +1354,7 @@ class DataTable extends React.Component {
|
|
|
1353
1354
|
rowToErrorMap[rowId] = true;
|
|
1354
1355
|
}
|
|
1355
1356
|
});
|
|
1356
|
-
filteredEnts = entities.filter(e => {
|
|
1357
|
+
filteredEnts = entities.filter((e) => {
|
|
1357
1358
|
return rowToErrorMap[e.id];
|
|
1358
1359
|
});
|
|
1359
1360
|
}
|
|
@@ -1381,7 +1382,7 @@ class DataTable extends React.Component {
|
|
|
1381
1382
|
className="data-table-container-inner"
|
|
1382
1383
|
{...(isCellEditable && {
|
|
1383
1384
|
tabIndex: -1,
|
|
1384
|
-
onKeyDown: e => {
|
|
1385
|
+
onKeyDown: (e) => {
|
|
1385
1386
|
const isArrowKey =
|
|
1386
1387
|
(e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode === 9;
|
|
1387
1388
|
if (isArrowKey) {
|
|
@@ -1567,8 +1568,9 @@ class DataTable extends React.Component {
|
|
|
1567
1568
|
small
|
|
1568
1569
|
minimal
|
|
1569
1570
|
intent="primary"
|
|
1570
|
-
text={`Select all ${
|
|
1571
|
-
entitiesAcrossPages.length
|
|
1571
|
+
text={`Select all ${
|
|
1572
|
+
entityCount || entitiesAcrossPages.length
|
|
1573
|
+
} items`}
|
|
1572
1574
|
loading={this.state.selectingAll}
|
|
1573
1575
|
onClick={async () => {
|
|
1574
1576
|
if (withSelectAll) {
|
|
@@ -1626,7 +1628,7 @@ class DataTable extends React.Component {
|
|
|
1626
1628
|
)}
|
|
1627
1629
|
<ReactTable
|
|
1628
1630
|
data={filteredEnts}
|
|
1629
|
-
ref={n => {
|
|
1631
|
+
ref={(n) => {
|
|
1630
1632
|
if (n) this.table = n;
|
|
1631
1633
|
}}
|
|
1632
1634
|
additionalBodyEl={
|
|
@@ -1667,7 +1669,7 @@ class DataTable extends React.Component {
|
|
|
1667
1669
|
loading={isLoading || disabled}
|
|
1668
1670
|
defaultResized={resized}
|
|
1669
1671
|
onResizedChange={(newResized = []) => {
|
|
1670
|
-
const resizedToUse = newResized.map(column => {
|
|
1672
|
+
const resizedToUse = newResized.map((column) => {
|
|
1671
1673
|
// have a min width of 50 so that columns don't disappear
|
|
1672
1674
|
if (column.value < 50) {
|
|
1673
1675
|
return {
|
|
@@ -1691,7 +1693,7 @@ class DataTable extends React.Component {
|
|
|
1691
1693
|
</div>
|
|
1692
1694
|
)
|
|
1693
1695
|
}
|
|
1694
|
-
LoadingComponent={props => (
|
|
1696
|
+
LoadingComponent={(props) => (
|
|
1695
1697
|
<DisabledLoadingComponent {...{ ...props, disabled }} />
|
|
1696
1698
|
)}
|
|
1697
1699
|
style={{
|
|
@@ -1774,7 +1776,7 @@ class DataTable extends React.Component {
|
|
|
1774
1776
|
const rowDisabled = isEntityDisabled(entity);
|
|
1775
1777
|
const dataId = entity.id || entity.code;
|
|
1776
1778
|
return {
|
|
1777
|
-
onClick: e => {
|
|
1779
|
+
onClick: (e) => {
|
|
1778
1780
|
if (isCellEditable) return;
|
|
1779
1781
|
// if checkboxes are activated or row expander is clicked don't select row
|
|
1780
1782
|
if (e.target.matches(".tg-expander, .tg-expander *")) {
|
|
@@ -1796,7 +1798,7 @@ class DataTable extends React.Component {
|
|
|
1796
1798
|
rowClick(e, rowInfo, entities, computePresets(this.props));
|
|
1797
1799
|
},
|
|
1798
1800
|
//row right click
|
|
1799
|
-
onContextMenu: e => {
|
|
1801
|
+
onContextMenu: (e) => {
|
|
1800
1802
|
e.preventDefault();
|
|
1801
1803
|
if (rowId === undefined || rowDisabled || isCellEditable) return;
|
|
1802
1804
|
const oldIdMap = cloneDeep(reduxFormSelectedEntityIdMap) || {};
|
|
@@ -1835,7 +1837,7 @@ class DataTable extends React.Component {
|
|
|
1835
1837
|
),
|
|
1836
1838
|
"data-test-id": dataId === undefined ? rowInfo.index : dataId,
|
|
1837
1839
|
"data-index": rowInfo.index,
|
|
1838
|
-
onDoubleClick: e => {
|
|
1840
|
+
onDoubleClick: (e) => {
|
|
1839
1841
|
if (rowDisabled) return;
|
|
1840
1842
|
this.dblClickTriggered = true;
|
|
1841
1843
|
onDoubleClick &&
|
|
@@ -1935,7 +1937,7 @@ class DataTable extends React.Component {
|
|
|
1935
1937
|
...(err && {
|
|
1936
1938
|
"data-tip": err?.message || err
|
|
1937
1939
|
}),
|
|
1938
|
-
onContextMenu: e => {
|
|
1940
|
+
onContextMenu: (e) => {
|
|
1939
1941
|
if (!isPrimarySelected) {
|
|
1940
1942
|
const primaryCellId = this.getPrimarySelectedCellId();
|
|
1941
1943
|
const newSelectedCells = { ...reduxFormSelectedCells };
|
|
@@ -1950,7 +1952,7 @@ class DataTable extends React.Component {
|
|
|
1950
1952
|
this.showContextMenu(e);
|
|
1951
1953
|
}, 0);
|
|
1952
1954
|
},
|
|
1953
|
-
onClick: event => {
|
|
1955
|
+
onClick: (event) => {
|
|
1954
1956
|
this.handleCellClick({
|
|
1955
1957
|
event,
|
|
1956
1958
|
cellId,
|
|
@@ -2032,9 +2034,9 @@ class DataTable extends React.Component {
|
|
|
2032
2034
|
newSelectedCells = {
|
|
2033
2035
|
[primarySelectedCellId]: PRIMARY_SELECTED_VAL
|
|
2034
2036
|
};
|
|
2035
|
-
entitiesBetweenRows.forEach(e => {
|
|
2037
|
+
entitiesBetweenRows.forEach((e) => {
|
|
2036
2038
|
const rowId = getIdOrCodeOrIndex(e, entities.indexOf(e));
|
|
2037
|
-
fieldsBetweenCols.forEach(f => {
|
|
2039
|
+
fieldsBetweenCols.forEach((f) => {
|
|
2038
2040
|
const cellId = `${rowId}:${f.path}`;
|
|
2039
2041
|
if (!newSelectedCells[cellId]) newSelectedCells[cellId] = true;
|
|
2040
2042
|
});
|
|
@@ -2111,7 +2113,7 @@ class DataTable extends React.Component {
|
|
|
2111
2113
|
) : null;
|
|
2112
2114
|
};
|
|
2113
2115
|
|
|
2114
|
-
renderCheckboxCell = row => {
|
|
2116
|
+
renderCheckboxCell = (row) => {
|
|
2115
2117
|
const rowIndex = row.index;
|
|
2116
2118
|
const {
|
|
2117
2119
|
reduxFormSelectedEntityIdMap,
|
|
@@ -2125,7 +2127,7 @@ class DataTable extends React.Component {
|
|
|
2125
2127
|
reduxFormSelectedEntityIdMap
|
|
2126
2128
|
);
|
|
2127
2129
|
|
|
2128
|
-
const isSelected = checkedRows.some(rowNum => {
|
|
2130
|
+
const isSelected = checkedRows.some((rowNum) => {
|
|
2129
2131
|
return rowNum === rowIndex;
|
|
2130
2132
|
});
|
|
2131
2133
|
if (rowIndex >= entities.length) {
|
|
@@ -2135,7 +2137,7 @@ class DataTable extends React.Component {
|
|
|
2135
2137
|
return (
|
|
2136
2138
|
<Checkbox
|
|
2137
2139
|
disabled={noSelect || noUserSelect || isEntityDisabled(entity)}
|
|
2138
|
-
onClick={e => {
|
|
2140
|
+
onClick={(e) => {
|
|
2139
2141
|
rowClick(e, row, entities, computePresets(this.props));
|
|
2140
2142
|
}}
|
|
2141
2143
|
checked={isSelected}
|
|
@@ -2152,7 +2154,7 @@ class DataTable extends React.Component {
|
|
|
2152
2154
|
} = computePresets(this.props);
|
|
2153
2155
|
const [rowId, path] = cellId.split(":");
|
|
2154
2156
|
!doNotStopEditing && change("reduxFormEditingCell", null);
|
|
2155
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
2157
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
2156
2158
|
const entity = entities.find((e, i) => {
|
|
2157
2159
|
return getIdOrCodeOrIndex(e, i) === rowId;
|
|
2158
2160
|
});
|
|
@@ -2202,7 +2204,7 @@ class DataTable extends React.Component {
|
|
|
2202
2204
|
let lastRowIndex;
|
|
2203
2205
|
let firstRowIndex;
|
|
2204
2206
|
const selectedPaths = [];
|
|
2205
|
-
Object.keys(reduxFormSelectedCells).forEach(key => {
|
|
2207
|
+
Object.keys(reduxFormSelectedCells).forEach((key) => {
|
|
2206
2208
|
// if (reduxFormSelectedCells[key] === PRIMARY_SELECTED_VAL) {
|
|
2207
2209
|
// primaryCellId = key;
|
|
2208
2210
|
// }
|
|
@@ -2290,7 +2292,7 @@ class DataTable extends React.Component {
|
|
|
2290
2292
|
...(withExpandAndCollapseAllButton && {
|
|
2291
2293
|
Header: () => {
|
|
2292
2294
|
const showCollapseAll =
|
|
2293
|
-
Object.values(reduxFormExpandedEntityIdMap).filter(i => i)
|
|
2295
|
+
Object.values(reduxFormExpandedEntityIdMap).filter((i) => i)
|
|
2294
2296
|
.length === entities.length;
|
|
2295
2297
|
return (
|
|
2296
2298
|
<InfoHelper
|
|
@@ -2363,7 +2365,7 @@ class DataTable extends React.Component {
|
|
|
2363
2365
|
});
|
|
2364
2366
|
}
|
|
2365
2367
|
|
|
2366
|
-
columns.forEach(column => {
|
|
2368
|
+
columns.forEach((column) => {
|
|
2367
2369
|
const tableColumn = {
|
|
2368
2370
|
...column,
|
|
2369
2371
|
Header: this.renderColumnHeader(column),
|
|
@@ -2380,7 +2382,7 @@ class DataTable extends React.Component {
|
|
|
2380
2382
|
tableColumn.width = column.width;
|
|
2381
2383
|
}
|
|
2382
2384
|
if (cellRenderer && cellRenderer[column.path]) {
|
|
2383
|
-
tableColumn.Cell = row => {
|
|
2385
|
+
tableColumn.Cell = (row) => {
|
|
2384
2386
|
const val = cellRenderer[column.path](
|
|
2385
2387
|
row.value,
|
|
2386
2388
|
row.original,
|
|
@@ -2390,16 +2392,16 @@ class DataTable extends React.Component {
|
|
|
2390
2392
|
return val;
|
|
2391
2393
|
};
|
|
2392
2394
|
} else if (column.render) {
|
|
2393
|
-
tableColumn.Cell = row => {
|
|
2395
|
+
tableColumn.Cell = (row) => {
|
|
2394
2396
|
const val = column.render(row.value, row.original, row, this.props);
|
|
2395
2397
|
return val;
|
|
2396
2398
|
};
|
|
2397
2399
|
} else if (column.type === "timestamp") {
|
|
2398
|
-
tableColumn.Cell = props => {
|
|
2400
|
+
tableColumn.Cell = (props) => {
|
|
2399
2401
|
return props.value ? dayjs(props.value).format("lll") : "";
|
|
2400
2402
|
};
|
|
2401
2403
|
} else if (column.type === "color") {
|
|
2402
|
-
tableColumn.Cell = props => {
|
|
2404
|
+
tableColumn.Cell = (props) => {
|
|
2403
2405
|
return props.value ? (
|
|
2404
2406
|
<div
|
|
2405
2407
|
style={{
|
|
@@ -2416,9 +2418,9 @@ class DataTable extends React.Component {
|
|
|
2416
2418
|
};
|
|
2417
2419
|
} else if (column.type === "boolean") {
|
|
2418
2420
|
if (isCellEditable) {
|
|
2419
|
-
tableColumn.Cell = props => (props.value ? "True" : "False");
|
|
2421
|
+
tableColumn.Cell = (props) => (props.value ? "True" : "False");
|
|
2420
2422
|
} else {
|
|
2421
|
-
tableColumn.Cell = props => (
|
|
2423
|
+
tableColumn.Cell = (props) => (
|
|
2422
2424
|
<Icon
|
|
2423
2425
|
className={classNames({
|
|
2424
2426
|
[Classes.TEXT_MUTED]: !props.value
|
|
@@ -2428,13 +2430,13 @@ class DataTable extends React.Component {
|
|
|
2428
2430
|
);
|
|
2429
2431
|
}
|
|
2430
2432
|
} else if (column.type === "markdown") {
|
|
2431
|
-
tableColumn.Cell = props => (
|
|
2433
|
+
tableColumn.Cell = (props) => (
|
|
2432
2434
|
<ReactMarkdown remarkPlugins={[remarkGfm]}>
|
|
2433
2435
|
{props.value}
|
|
2434
2436
|
</ReactMarkdown>
|
|
2435
2437
|
);
|
|
2436
2438
|
} else {
|
|
2437
|
-
tableColumn.Cell = props => props.value;
|
|
2439
|
+
tableColumn.Cell = (props) => props.value;
|
|
2438
2440
|
}
|
|
2439
2441
|
const oldFunc = tableColumn.Cell;
|
|
2440
2442
|
|
|
@@ -2452,7 +2454,7 @@ class DataTable extends React.Component {
|
|
|
2452
2454
|
disabled={isEntityDisabled(row.original)}
|
|
2453
2455
|
className="tg-cell-edit-boolean-checkbox"
|
|
2454
2456
|
checked={oldVal === "True"}
|
|
2455
|
-
onChange={e => {
|
|
2457
|
+
onChange={(e) => {
|
|
2456
2458
|
const checked = e.target.checked;
|
|
2457
2459
|
this.finishCellEdit(cellId, checked);
|
|
2458
2460
|
}}
|
|
@@ -2483,7 +2485,7 @@ class DataTable extends React.Component {
|
|
|
2483
2485
|
cancelEdit={this.cancelCellEdit}
|
|
2484
2486
|
isNumeric={column.type === "number"}
|
|
2485
2487
|
initialValue={text}
|
|
2486
|
-
finishEdit={newVal => {
|
|
2488
|
+
finishEdit={(newVal) => {
|
|
2487
2489
|
this.finishCellEdit(cellId, newVal);
|
|
2488
2490
|
}}
|
|
2489
2491
|
></EditableCell>
|
|
@@ -2580,7 +2582,7 @@ class DataTable extends React.Component {
|
|
|
2580
2582
|
entityMap,
|
|
2581
2583
|
pathToIndex
|
|
2582
2584
|
}) => {
|
|
2583
|
-
selectionGrid.forEach(row => {
|
|
2585
|
+
selectionGrid.forEach((row) => {
|
|
2584
2586
|
// remove undefineds from start of row
|
|
2585
2587
|
while (row[0] === undefined && row.length) row.shift();
|
|
2586
2588
|
});
|
|
@@ -2593,7 +2595,7 @@ class DataTable extends React.Component {
|
|
|
2593
2595
|
return isBottomRight;
|
|
2594
2596
|
};
|
|
2595
2597
|
|
|
2596
|
-
onDragEnd = cellsToSelect => {
|
|
2598
|
+
onDragEnd = (cellsToSelect) => {
|
|
2597
2599
|
const {
|
|
2598
2600
|
entities,
|
|
2599
2601
|
schema,
|
|
@@ -2610,7 +2612,7 @@ class DataTable extends React.Component {
|
|
|
2610
2612
|
allSelectedPaths = [primaryCellPath];
|
|
2611
2613
|
}
|
|
2612
2614
|
|
|
2613
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
2615
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
2614
2616
|
let newReduxFormSelectedCells;
|
|
2615
2617
|
if (selectedPaths) {
|
|
2616
2618
|
newReduxFormSelectedCells = {
|
|
@@ -2631,7 +2633,7 @@ class DataTable extends React.Component {
|
|
|
2631
2633
|
entityMap[cellsToSelect[0]?.split(":")[0]]?.i;
|
|
2632
2634
|
const pathToIndex = getFieldPathToIndex(schema);
|
|
2633
2635
|
|
|
2634
|
-
allSelectedPaths.forEach(selectedPath => {
|
|
2636
|
+
allSelectedPaths.forEach((selectedPath) => {
|
|
2635
2637
|
const column = pathToField[selectedPath];
|
|
2636
2638
|
|
|
2637
2639
|
const selectedCellVal = getCellVal(selectedEnt, selectedPath, column);
|
|
@@ -2680,7 +2682,7 @@ class DataTable extends React.Component {
|
|
|
2680
2682
|
let prefix;
|
|
2681
2683
|
let maybePad;
|
|
2682
2684
|
// determine if all the cells in this column of the selectionGrid are incrementing
|
|
2683
|
-
const allAreIncrementing = selectionGrid.every(row => {
|
|
2685
|
+
const allAreIncrementing = selectionGrid.every((row) => {
|
|
2684
2686
|
// see if cell is selected
|
|
2685
2687
|
const cellInfo = row[cellIndexOfSelectedPath];
|
|
2686
2688
|
if (!cellInfo) return false;
|
|
@@ -2727,7 +2729,7 @@ class DataTable extends React.Component {
|
|
|
2727
2729
|
|
|
2728
2730
|
let firstSelectedCellRowIndex;
|
|
2729
2731
|
if (selectionGrid) {
|
|
2730
|
-
selectionGrid[0].some(cell => {
|
|
2732
|
+
selectionGrid[0].some((cell) => {
|
|
2731
2733
|
if (cell) {
|
|
2732
2734
|
firstSelectedCellRowIndex = cell.rowIndex;
|
|
2733
2735
|
return true;
|
|
@@ -2736,7 +2738,7 @@ class DataTable extends React.Component {
|
|
|
2736
2738
|
});
|
|
2737
2739
|
}
|
|
2738
2740
|
|
|
2739
|
-
cellsToSelect.forEach(cellId => {
|
|
2741
|
+
cellsToSelect.forEach((cellId) => {
|
|
2740
2742
|
const [rowId, cellPath] = cellId.split(":");
|
|
2741
2743
|
if (cellPath !== selectedPath) return;
|
|
2742
2744
|
newReduxFormSelectedCells[cellId] = true;
|
|
@@ -2759,14 +2761,14 @@ class DataTable extends React.Component {
|
|
|
2759
2761
|
const { cellId } = selectionGrid[
|
|
2760
2762
|
(rowIndex - firstSelectedCellRowIndex) %
|
|
2761
2763
|
selectionGrid.length
|
|
2762
|
-
].find(g => g && g.cellIndex === cellIndex);
|
|
2764
|
+
].find((g) => g && g.cellIndex === cellIndex);
|
|
2763
2765
|
cellIdToCopy = cellId;
|
|
2764
2766
|
} else {
|
|
2765
2767
|
const lastIndexInGrid =
|
|
2766
2768
|
selectionGrid[selectionGrid.length - 1][0].rowIndex;
|
|
2767
2769
|
const { cellId } = selectionGrid[
|
|
2768
2770
|
(rowIndex + lastIndexInGrid + 1) % selectionGrid.length
|
|
2769
|
-
].find(g => g.cellIndex === cellIndex);
|
|
2771
|
+
].find((g) => g.cellIndex === cellIndex);
|
|
2770
2772
|
cellIdToCopy = cellId;
|
|
2771
2773
|
}
|
|
2772
2774
|
|
|
@@ -2818,7 +2820,7 @@ class DataTable extends React.Component {
|
|
|
2818
2820
|
} else if (text) {
|
|
2819
2821
|
text = React.isValidElement(text) ? text : String(text);
|
|
2820
2822
|
}
|
|
2821
|
-
const getTextFromElementOrLink = text => {
|
|
2823
|
+
const getTextFromElementOrLink = (text) => {
|
|
2822
2824
|
if (React.isValidElement(text)) {
|
|
2823
2825
|
if (text.props?.to) {
|
|
2824
2826
|
// this will convert Link elements to url strings
|
|
@@ -2855,17 +2857,16 @@ class DataTable extends React.Component {
|
|
|
2855
2857
|
|
|
2856
2858
|
const primaryCellId = this.getPrimarySelectedCellId();
|
|
2857
2859
|
const [rowId] = primaryCellId?.split(":") || [];
|
|
2858
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
2860
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
2859
2861
|
const newEntities = times(numRows).map(() => ({ id: nanoid() }));
|
|
2860
2862
|
|
|
2861
2863
|
const indexToInsert = entities.findIndex((e, i) => {
|
|
2862
2864
|
return getIdOrCodeOrIndex(e, i) === rowId;
|
|
2863
2865
|
});
|
|
2864
2866
|
const insertIndex = above ? indexToInsert : indexToInsert + 1;
|
|
2865
|
-
let { newEnts, validationErrors } =
|
|
2866
|
-
newEntities
|
|
2867
|
-
)
|
|
2868
|
-
newEnts = newEnts.map(e => ({
|
|
2867
|
+
let { newEnts, validationErrors } =
|
|
2868
|
+
this.formatAndValidateEntities(newEntities);
|
|
2869
|
+
newEnts = newEnts.map((e) => ({
|
|
2869
2870
|
...e,
|
|
2870
2871
|
_isClean: true
|
|
2871
2872
|
}));
|
|
@@ -2895,11 +2896,11 @@ class DataTable extends React.Component {
|
|
|
2895
2896
|
let selectedRecords;
|
|
2896
2897
|
if (isCellEditable) {
|
|
2897
2898
|
const rowIds = {};
|
|
2898
|
-
Object.keys(reduxFormSelectedCells).forEach(cellKey => {
|
|
2899
|
+
Object.keys(reduxFormSelectedCells).forEach((cellKey) => {
|
|
2899
2900
|
const [rowId] = cellKey.split(":");
|
|
2900
2901
|
rowIds[rowId] = true;
|
|
2901
2902
|
});
|
|
2902
|
-
selectedRecords = entities.filter(e => rowIds[getIdOrCodeOrIndex(e)]);
|
|
2903
|
+
selectedRecords = entities.filter((e) => rowIds[getIdOrCodeOrIndex(e)]);
|
|
2903
2904
|
} else {
|
|
2904
2905
|
selectedRecords = getRecordsFromIdMap(idMap);
|
|
2905
2906
|
}
|
|
@@ -2980,7 +2981,7 @@ class DataTable extends React.Component {
|
|
|
2980
2981
|
/>
|
|
2981
2982
|
);
|
|
2982
2983
|
}
|
|
2983
|
-
const selectedRowIds = Object.keys(reduxFormSelectedCells).map(cellId => {
|
|
2984
|
+
const selectedRowIds = Object.keys(reduxFormSelectedCells).map((cellId) => {
|
|
2984
2985
|
const [rowId] = cellId.split(":");
|
|
2985
2986
|
return rowId;
|
|
2986
2987
|
});
|
|
@@ -3022,12 +3023,12 @@ class DataTable extends React.Component {
|
|
|
3022
3023
|
reduxFormSelectedCells = {}
|
|
3023
3024
|
} = computePresets(this.props);
|
|
3024
3025
|
const selectedRowIds = Object.keys(reduxFormSelectedCells).map(
|
|
3025
|
-
cellId => {
|
|
3026
|
+
(cellId) => {
|
|
3026
3027
|
const [rowId] = cellId.split(":");
|
|
3027
3028
|
return rowId;
|
|
3028
3029
|
}
|
|
3029
3030
|
);
|
|
3030
|
-
this.updateEntitiesHelper(entities, entities => {
|
|
3031
|
+
this.updateEntitiesHelper(entities, (entities) => {
|
|
3031
3032
|
const ents = entities.filter(
|
|
3032
3033
|
(e, i) => !selectedRowIds.includes(getIdOrCodeOrIndex(e, i))
|
|
3033
3034
|
);
|
|
@@ -3049,7 +3050,7 @@ class DataTable extends React.Component {
|
|
|
3049
3050
|
ContextMenu.show(menu, { left: e.clientX, top: e.clientY });
|
|
3050
3051
|
};
|
|
3051
3052
|
|
|
3052
|
-
renderColumnHeader = column => {
|
|
3053
|
+
renderColumnHeader = (column) => {
|
|
3053
3054
|
const {
|
|
3054
3055
|
addFilters,
|
|
3055
3056
|
setOrder,
|
|
@@ -3106,7 +3107,7 @@ class DataTable extends React.Component {
|
|
|
3106
3107
|
!!currentFilter || filterIsActive(currentParams);
|
|
3107
3108
|
let ordering;
|
|
3108
3109
|
if (order && order.length) {
|
|
3109
|
-
order.forEach(order => {
|
|
3110
|
+
order.forEach((order) => {
|
|
3110
3111
|
const orderField = order.replace("-", "");
|
|
3111
3112
|
if (orderField === ccDisplayName) {
|
|
3112
3113
|
if (orderField === order) {
|
|
@@ -3131,7 +3132,7 @@ class DataTable extends React.Component {
|
|
|
3131
3132
|
})}
|
|
3132
3133
|
color={sortUp ? "#106ba3" : undefined}
|
|
3133
3134
|
iconSize={extraCompact ? 10 : 12}
|
|
3134
|
-
onClick={e => {
|
|
3135
|
+
onClick={(e) => {
|
|
3135
3136
|
setOrder("-" + ccDisplayName, sortUp, e.shiftKey);
|
|
3136
3137
|
}}
|
|
3137
3138
|
/>
|
|
@@ -3143,7 +3144,7 @@ class DataTable extends React.Component {
|
|
|
3143
3144
|
})}
|
|
3144
3145
|
color={sortDown ? "#106ba3" : undefined}
|
|
3145
3146
|
iconSize={extraCompact ? 10 : 12}
|
|
3146
|
-
onClick={e => {
|
|
3147
|
+
onClick={(e) => {
|
|
3147
3148
|
setOrder(ccDisplayName, sortDown, e.shiftKey);
|
|
3148
3149
|
}}
|
|
3149
3150
|
/>
|
|
@@ -3174,7 +3175,7 @@ class DataTable extends React.Component {
|
|
|
3174
3175
|
let isChecked = !!entities.length;
|
|
3175
3176
|
let hasFalse;
|
|
3176
3177
|
let hasTrue;
|
|
3177
|
-
entities.some(e => {
|
|
3178
|
+
entities.some((e) => {
|
|
3178
3179
|
if (!get(e, path)) {
|
|
3179
3180
|
isChecked = false;
|
|
3180
3181
|
hasFalse = true;
|
|
@@ -3191,8 +3192,8 @@ class DataTable extends React.Component {
|
|
|
3191
3192
|
<Checkbox
|
|
3192
3193
|
style={{ marginBottom: 0, marginLeft: 3 }}
|
|
3193
3194
|
onChange={() => {
|
|
3194
|
-
this.updateEntitiesHelper(entities, ents => {
|
|
3195
|
-
ents.forEach(e => {
|
|
3195
|
+
this.updateEntitiesHelper(entities, (ents) => {
|
|
3196
|
+
ents.forEach((e) => {
|
|
3196
3197
|
delete e._isClean;
|
|
3197
3198
|
set(e, path, isIndeterminate ? true : !isChecked);
|
|
3198
3199
|
});
|
|
@@ -3408,7 +3409,7 @@ function EditableCell({
|
|
|
3408
3409
|
fontSize: 12,
|
|
3409
3410
|
background: "none"
|
|
3410
3411
|
}}
|
|
3411
|
-
ref={r => {
|
|
3412
|
+
ref={(r) => {
|
|
3412
3413
|
if (shouldSelectAll && r) {
|
|
3413
3414
|
r?.select();
|
|
3414
3415
|
stopSelectAll();
|
|
@@ -3417,7 +3418,7 @@ function EditableCell({
|
|
|
3417
3418
|
type={isNumeric ? "number" : undefined}
|
|
3418
3419
|
value={v}
|
|
3419
3420
|
autoFocus
|
|
3420
|
-
onKeyDown={e => {
|
|
3421
|
+
onKeyDown={(e) => {
|
|
3421
3422
|
if (e.key === "Enter") {
|
|
3422
3423
|
finishEdit(v);
|
|
3423
3424
|
e.stopPropagation();
|
|
@@ -3429,7 +3430,7 @@ function EditableCell({
|
|
|
3429
3430
|
onBlur={() => {
|
|
3430
3431
|
finishEdit(v);
|
|
3431
3432
|
}}
|
|
3432
|
-
onChange={e => {
|
|
3433
|
+
onChange={(e) => {
|
|
3433
3434
|
setV(e.target.value);
|
|
3434
3435
|
}}
|
|
3435
3436
|
></input>
|
|
@@ -3445,7 +3446,7 @@ function DropdownCell({
|
|
|
3445
3446
|
}) {
|
|
3446
3447
|
const [v, setV] = useState(
|
|
3447
3448
|
isMulti
|
|
3448
|
-
? initialValue.split(",").map(v => ({ value: v, label: v }))
|
|
3449
|
+
? initialValue.split(",").map((v) => ({ value: v, label: v }))
|
|
3449
3450
|
: initialValue
|
|
3450
3451
|
);
|
|
3451
3452
|
return (
|
|
@@ -3459,7 +3460,7 @@ function DropdownCell({
|
|
|
3459
3460
|
multi={isMulti}
|
|
3460
3461
|
autoOpen
|
|
3461
3462
|
value={v}
|
|
3462
|
-
onChange={val => {
|
|
3463
|
+
onChange={(val) => {
|
|
3463
3464
|
if (isMulti) {
|
|
3464
3465
|
setV(val);
|
|
3465
3466
|
return;
|
|
@@ -3467,7 +3468,7 @@ function DropdownCell({
|
|
|
3467
3468
|
finishEdit(val ? val.value : null);
|
|
3468
3469
|
}}
|
|
3469
3470
|
popoverProps={{
|
|
3470
|
-
onClose: e => {
|
|
3471
|
+
onClose: (e) => {
|
|
3471
3472
|
if (isMulti) {
|
|
3472
3473
|
if (e && e.key === "Escape") {
|
|
3473
3474
|
cancelEdit();
|
|
@@ -3475,8 +3476,8 @@ function DropdownCell({
|
|
|
3475
3476
|
finishEdit(
|
|
3476
3477
|
v && v.map
|
|
3477
3478
|
? v
|
|
3478
|
-
.map(v => v.value)
|
|
3479
|
-
.filter(v => v)
|
|
3479
|
+
.map((v) => v.value)
|
|
3480
|
+
.filter((v) => v)
|
|
3480
3481
|
.join(",")
|
|
3481
3482
|
: v
|
|
3482
3483
|
);
|
|
@@ -3486,7 +3487,7 @@ function DropdownCell({
|
|
|
3486
3487
|
}
|
|
3487
3488
|
}
|
|
3488
3489
|
}}
|
|
3489
|
-
options={options.map(value => ({ label: value, value }))}
|
|
3490
|
+
options={options.map((value) => ({ label: value, value }))}
|
|
3490
3491
|
></TgSelect>
|
|
3491
3492
|
</div>
|
|
3492
3493
|
);
|
|
@@ -3502,14 +3503,14 @@ function getFieldPathToIndex(schema) {
|
|
|
3502
3503
|
|
|
3503
3504
|
function getFieldPathToField(schema) {
|
|
3504
3505
|
const fieldPathToField = {};
|
|
3505
|
-
schema.fields.forEach(f => {
|
|
3506
|
+
schema.fields.forEach((f) => {
|
|
3506
3507
|
fieldPathToField[f.path] = f;
|
|
3507
3508
|
});
|
|
3508
3509
|
return fieldPathToField;
|
|
3509
3510
|
}
|
|
3510
3511
|
|
|
3511
|
-
const defaultParsePaste = str => {
|
|
3512
|
-
return str.split(/\r\n|\n|\r/).map(row => row.split("\t"));
|
|
3512
|
+
const defaultParsePaste = (str) => {
|
|
3513
|
+
return str.split(/\r\n|\n|\r/).map((row) => row.split("\t"));
|
|
3513
3514
|
};
|
|
3514
3515
|
|
|
3515
3516
|
function getEntityIdToEntity(entities) {
|