@teselagen/ui 0.5.23-beta.17 → 0.5.23-beta.19
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/DataTable/Columns.d.ts +1 -2
- package/DataTable/RenderCell.d.ts +18 -0
- package/index.cjs.js +225 -205
- package/index.es.js +225 -205
- package/package.json +1 -1
- package/src/DataTable/Columns.js +7 -186
- package/src/DataTable/Columns.jsx +945 -0
- package/src/DataTable/EditabelCell.jsx +44 -0
- package/src/DataTable/RenderCell.jsx +191 -0
- package/src/DataTable/index.js +34 -27
- package/src/DataTable/utils/withTableParams.js +4 -1
package/index.es.js
CHANGED
|
@@ -47256,6 +47256,177 @@ const CellDragHandle = /* @__PURE__ */ __name(({
|
|
|
47256
47256
|
}
|
|
47257
47257
|
);
|
|
47258
47258
|
}, "CellDragHandle");
|
|
47259
|
+
const RenderCell = /* @__PURE__ */ __name(({
|
|
47260
|
+
oldFunc,
|
|
47261
|
+
getCopyTextForCell,
|
|
47262
|
+
column,
|
|
47263
|
+
isCellEditable,
|
|
47264
|
+
isEntityDisabled,
|
|
47265
|
+
finishCellEdit,
|
|
47266
|
+
formName,
|
|
47267
|
+
noEllipsis,
|
|
47268
|
+
cancelCellEdit,
|
|
47269
|
+
getCellHoverText,
|
|
47270
|
+
selectedCells,
|
|
47271
|
+
isSelectionARectangle,
|
|
47272
|
+
startCellEdit,
|
|
47273
|
+
tableRef,
|
|
47274
|
+
onDragEnd,
|
|
47275
|
+
args
|
|
47276
|
+
}) => {
|
|
47277
|
+
var _a;
|
|
47278
|
+
const editingCell = useSelector(
|
|
47279
|
+
(state) => {
|
|
47280
|
+
var _a2, _b, _c;
|
|
47281
|
+
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormEditingCell;
|
|
47282
|
+
}
|
|
47283
|
+
);
|
|
47284
|
+
const initialValue = useSelector(
|
|
47285
|
+
(state) => {
|
|
47286
|
+
var _a2, _b, _c;
|
|
47287
|
+
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormInitialValue;
|
|
47288
|
+
}
|
|
47289
|
+
);
|
|
47290
|
+
const [row] = args;
|
|
47291
|
+
const rowId = getIdOrCodeOrIndex(row.original, row.index);
|
|
47292
|
+
const cellId = `${rowId}:${row.column.path}`;
|
|
47293
|
+
const isEditingCell = editingCell === cellId;
|
|
47294
|
+
let val = oldFunc(...args);
|
|
47295
|
+
const oldVal = val;
|
|
47296
|
+
const text2 = getCopyTextForCell(val, row, column);
|
|
47297
|
+
const dataTest = {
|
|
47298
|
+
"data-test": "tgCell_" + column.path
|
|
47299
|
+
};
|
|
47300
|
+
const fullValue = (_a = row.original) == null ? void 0 : _a[row.column.path];
|
|
47301
|
+
if (isEditingCell) {
|
|
47302
|
+
if (column.type === "genericSelect") {
|
|
47303
|
+
const GenericSelectComp = column.GenericSelectComp;
|
|
47304
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
47305
|
+
GenericSelectComp,
|
|
47306
|
+
__spreadProps(__spreadValues({
|
|
47307
|
+
rowId,
|
|
47308
|
+
fullValue,
|
|
47309
|
+
initialValue: text2
|
|
47310
|
+
}, dataTest), {
|
|
47311
|
+
finishEdit: (newVal, doNotStopEditing) => {
|
|
47312
|
+
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47313
|
+
},
|
|
47314
|
+
dataTest,
|
|
47315
|
+
cancelEdit: cancelCellEdit
|
|
47316
|
+
})
|
|
47317
|
+
);
|
|
47318
|
+
}
|
|
47319
|
+
if (column.type === "dropdown" || column.type === "dropdownMulti") {
|
|
47320
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
47321
|
+
DropdownCell,
|
|
47322
|
+
{
|
|
47323
|
+
isMulti: dataTest.isMulti || column.type === "dropdownMulti",
|
|
47324
|
+
initialValue: dataTest.initialValue || text2,
|
|
47325
|
+
options: getVals(column.values),
|
|
47326
|
+
finishEdit: (newVal, doNotStopEditing) => {
|
|
47327
|
+
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47328
|
+
},
|
|
47329
|
+
dataTest,
|
|
47330
|
+
cancelEdit: cancelCellEdit
|
|
47331
|
+
}
|
|
47332
|
+
);
|
|
47333
|
+
} else {
|
|
47334
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
47335
|
+
EditableCell,
|
|
47336
|
+
{
|
|
47337
|
+
dataTest,
|
|
47338
|
+
cancelEdit: cancelCellEdit,
|
|
47339
|
+
isNumeric: column.type === "number",
|
|
47340
|
+
initialValue: initialValue || text2,
|
|
47341
|
+
finishEdit: (newVal) => {
|
|
47342
|
+
finishCellEdit(cellId, newVal);
|
|
47343
|
+
}
|
|
47344
|
+
}
|
|
47345
|
+
);
|
|
47346
|
+
}
|
|
47347
|
+
}
|
|
47348
|
+
const isBool = column.type === "boolean";
|
|
47349
|
+
if (isCellEditable && isBool) {
|
|
47350
|
+
val = /* @__PURE__ */ React__default.createElement(
|
|
47351
|
+
Checkbox,
|
|
47352
|
+
{
|
|
47353
|
+
disabled: isEntityDisabled(row.original),
|
|
47354
|
+
className: "tg-cell-edit-boolean-checkbox",
|
|
47355
|
+
checked: oldVal === "True",
|
|
47356
|
+
onChange: (e2) => {
|
|
47357
|
+
const checked = e2.target.checked;
|
|
47358
|
+
finishCellEdit(cellId, checked);
|
|
47359
|
+
}
|
|
47360
|
+
}
|
|
47361
|
+
);
|
|
47362
|
+
noEllipsis = true;
|
|
47363
|
+
}
|
|
47364
|
+
let title = text2;
|
|
47365
|
+
if (getCellHoverText)
|
|
47366
|
+
title = getCellHoverText(...args);
|
|
47367
|
+
else if (column.getTitleAttr)
|
|
47368
|
+
title = column.getTitleAttr(...args);
|
|
47369
|
+
const isSelectedCell = selectedCells == null ? void 0 : selectedCells[cellId];
|
|
47370
|
+
const {
|
|
47371
|
+
isRect,
|
|
47372
|
+
selectionGrid,
|
|
47373
|
+
lastRowIndex,
|
|
47374
|
+
lastCellIndex,
|
|
47375
|
+
entityMap,
|
|
47376
|
+
pathToIndex
|
|
47377
|
+
} = isSelectionARectangle();
|
|
47378
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
47379
|
+
"div",
|
|
47380
|
+
__spreadProps(__spreadValues({
|
|
47381
|
+
style: __spreadValues({}, !noEllipsis && {
|
|
47382
|
+
textOverflow: "ellipsis",
|
|
47383
|
+
overflow: "hidden"
|
|
47384
|
+
})
|
|
47385
|
+
}, dataTest), {
|
|
47386
|
+
className: "tg-cell-wrapper",
|
|
47387
|
+
"data-copy-text": text2,
|
|
47388
|
+
"data-copy-json": JSON.stringify(
|
|
47389
|
+
//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
|
|
47390
|
+
column.type === "genericSelect" ? {
|
|
47391
|
+
__strVal: fullValue,
|
|
47392
|
+
__genSelCol: column.path
|
|
47393
|
+
} : { __strVal: text2 }
|
|
47394
|
+
),
|
|
47395
|
+
title: title || void 0
|
|
47396
|
+
}),
|
|
47397
|
+
val
|
|
47398
|
+
), isCellEditable && (column.type === "dropdown" || column.type === "dropdownMulti" || column.type === "genericSelect") && /* @__PURE__ */ React__default.createElement(
|
|
47399
|
+
Icon,
|
|
47400
|
+
{
|
|
47401
|
+
icon: "caret-down",
|
|
47402
|
+
style: {
|
|
47403
|
+
position: "absolute",
|
|
47404
|
+
right: 5,
|
|
47405
|
+
opacity: 0.3
|
|
47406
|
+
},
|
|
47407
|
+
className: "cell-edit-dropdown",
|
|
47408
|
+
onClick: () => {
|
|
47409
|
+
startCellEdit(cellId);
|
|
47410
|
+
}
|
|
47411
|
+
}
|
|
47412
|
+
), isSelectedCell && (isRect ? isBottomRightCornerOfRectangle({
|
|
47413
|
+
cellId,
|
|
47414
|
+
selectionGrid,
|
|
47415
|
+
lastRowIndex,
|
|
47416
|
+
lastCellIndex,
|
|
47417
|
+
entityMap,
|
|
47418
|
+
pathToIndex
|
|
47419
|
+
}) : isSelectedCell === PRIMARY_SELECTED_VAL) && /* @__PURE__ */ React__default.createElement(
|
|
47420
|
+
CellDragHandle,
|
|
47421
|
+
{
|
|
47422
|
+
key: cellId,
|
|
47423
|
+
thisTable: tableRef.current.tableRef,
|
|
47424
|
+
cellId,
|
|
47425
|
+
isSelectionARectangle,
|
|
47426
|
+
onDragEnd
|
|
47427
|
+
}
|
|
47428
|
+
));
|
|
47429
|
+
}, "RenderCell");
|
|
47259
47430
|
dayjs.extend(localizedFormat);
|
|
47260
47431
|
const RenderColumnHeader = /* @__PURE__ */ __name(({
|
|
47261
47432
|
addFilters,
|
|
@@ -47507,171 +47678,6 @@ const renderCheckboxHeader = /* @__PURE__ */ __name(({
|
|
|
47507
47678
|
}, checkboxProps)
|
|
47508
47679
|
) : null;
|
|
47509
47680
|
}, "renderCheckboxHeader");
|
|
47510
|
-
const RenderCell = /* @__PURE__ */ __name(({
|
|
47511
|
-
oldFunc,
|
|
47512
|
-
getCopyTextForCell,
|
|
47513
|
-
column,
|
|
47514
|
-
isCellEditable,
|
|
47515
|
-
isEntityDisabled,
|
|
47516
|
-
finishCellEdit,
|
|
47517
|
-
formName,
|
|
47518
|
-
noEllipsis,
|
|
47519
|
-
cancelCellEdit,
|
|
47520
|
-
getCellHoverText,
|
|
47521
|
-
selectedCells,
|
|
47522
|
-
isSelectionARectangle,
|
|
47523
|
-
startCellEdit,
|
|
47524
|
-
tableRef,
|
|
47525
|
-
onDragEnd,
|
|
47526
|
-
args
|
|
47527
|
-
}) => {
|
|
47528
|
-
var _a;
|
|
47529
|
-
const editingCell = useSelector(
|
|
47530
|
-
(state) => {
|
|
47531
|
-
var _a2, _b, _c;
|
|
47532
|
-
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.editingCell;
|
|
47533
|
-
}
|
|
47534
|
-
);
|
|
47535
|
-
const [row] = args;
|
|
47536
|
-
const rowId = getIdOrCodeOrIndex(row.original, row.index);
|
|
47537
|
-
const cellId = `${rowId}:${row.column.path}`;
|
|
47538
|
-
const isEditingCell = editingCell === cellId;
|
|
47539
|
-
let val = oldFunc(...args);
|
|
47540
|
-
const oldVal = val;
|
|
47541
|
-
const text2 = getCopyTextForCell(val, row, column);
|
|
47542
|
-
const dataTest = {
|
|
47543
|
-
"data-test": "tgCell_" + column.path
|
|
47544
|
-
};
|
|
47545
|
-
const fullValue = (_a = row.original) == null ? void 0 : _a[row.column.path];
|
|
47546
|
-
if (isEditingCell) {
|
|
47547
|
-
if (column.type === "genericSelect") {
|
|
47548
|
-
const GenericSelectComp = column.GenericSelectComp;
|
|
47549
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
47550
|
-
GenericSelectComp,
|
|
47551
|
-
__spreadProps(__spreadValues({
|
|
47552
|
-
rowId,
|
|
47553
|
-
fullValue,
|
|
47554
|
-
initialValue: text2
|
|
47555
|
-
}, dataTest), {
|
|
47556
|
-
finishEdit: (newVal, doNotStopEditing) => {
|
|
47557
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47558
|
-
},
|
|
47559
|
-
dataTest,
|
|
47560
|
-
cancelEdit: cancelCellEdit
|
|
47561
|
-
})
|
|
47562
|
-
);
|
|
47563
|
-
}
|
|
47564
|
-
if (column.type === "dropdown" || column.type === "dropdownMulti") {
|
|
47565
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
47566
|
-
DropdownCell,
|
|
47567
|
-
{
|
|
47568
|
-
isMulti: dataTest.isMulti || column.type === "dropdownMulti",
|
|
47569
|
-
initialValue: dataTest.initialValue || text2,
|
|
47570
|
-
options: getVals(column.values),
|
|
47571
|
-
finishEdit: (newVal, doNotStopEditing) => {
|
|
47572
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47573
|
-
},
|
|
47574
|
-
dataTest,
|
|
47575
|
-
cancelEdit: cancelCellEdit
|
|
47576
|
-
}
|
|
47577
|
-
);
|
|
47578
|
-
} else {
|
|
47579
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
47580
|
-
EditableCell,
|
|
47581
|
-
{
|
|
47582
|
-
dataTest,
|
|
47583
|
-
cancelEdit: cancelCellEdit,
|
|
47584
|
-
isNumeric: column.type === "number",
|
|
47585
|
-
initialValue: text2,
|
|
47586
|
-
finishEdit: (newVal) => {
|
|
47587
|
-
finishCellEdit(cellId, newVal);
|
|
47588
|
-
}
|
|
47589
|
-
}
|
|
47590
|
-
);
|
|
47591
|
-
}
|
|
47592
|
-
}
|
|
47593
|
-
const isBool = column.type === "boolean";
|
|
47594
|
-
if (isCellEditable && isBool) {
|
|
47595
|
-
val = /* @__PURE__ */ React__default.createElement(
|
|
47596
|
-
Checkbox,
|
|
47597
|
-
{
|
|
47598
|
-
disabled: isEntityDisabled(row.original),
|
|
47599
|
-
className: "tg-cell-edit-boolean-checkbox",
|
|
47600
|
-
checked: oldVal === "True",
|
|
47601
|
-
onChange: (e2) => {
|
|
47602
|
-
const checked = e2.target.checked;
|
|
47603
|
-
finishCellEdit(cellId, checked);
|
|
47604
|
-
}
|
|
47605
|
-
}
|
|
47606
|
-
);
|
|
47607
|
-
noEllipsis = true;
|
|
47608
|
-
}
|
|
47609
|
-
let title = text2;
|
|
47610
|
-
if (getCellHoverText)
|
|
47611
|
-
title = getCellHoverText(...args);
|
|
47612
|
-
else if (column.getTitleAttr)
|
|
47613
|
-
title = column.getTitleAttr(...args);
|
|
47614
|
-
const isSelectedCell = selectedCells == null ? void 0 : selectedCells[cellId];
|
|
47615
|
-
const {
|
|
47616
|
-
isRect,
|
|
47617
|
-
selectionGrid,
|
|
47618
|
-
lastRowIndex,
|
|
47619
|
-
lastCellIndex,
|
|
47620
|
-
entityMap,
|
|
47621
|
-
pathToIndex
|
|
47622
|
-
} = isSelectionARectangle();
|
|
47623
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
47624
|
-
"div",
|
|
47625
|
-
__spreadProps(__spreadValues({
|
|
47626
|
-
style: __spreadValues({}, !noEllipsis && {
|
|
47627
|
-
textOverflow: "ellipsis",
|
|
47628
|
-
overflow: "hidden"
|
|
47629
|
-
})
|
|
47630
|
-
}, dataTest), {
|
|
47631
|
-
className: "tg-cell-wrapper",
|
|
47632
|
-
"data-copy-text": text2,
|
|
47633
|
-
"data-copy-json": JSON.stringify(
|
|
47634
|
-
//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
|
|
47635
|
-
column.type === "genericSelect" ? {
|
|
47636
|
-
__strVal: fullValue,
|
|
47637
|
-
__genSelCol: column.path
|
|
47638
|
-
} : { __strVal: text2 }
|
|
47639
|
-
),
|
|
47640
|
-
title: title || void 0
|
|
47641
|
-
}),
|
|
47642
|
-
val
|
|
47643
|
-
), isCellEditable && (column.type === "dropdown" || column.type === "dropdownMulti" || column.type === "genericSelect") && /* @__PURE__ */ React__default.createElement(
|
|
47644
|
-
Icon,
|
|
47645
|
-
{
|
|
47646
|
-
icon: "caret-down",
|
|
47647
|
-
style: {
|
|
47648
|
-
position: "absolute",
|
|
47649
|
-
right: 5,
|
|
47650
|
-
opacity: 0.3
|
|
47651
|
-
},
|
|
47652
|
-
className: "cell-edit-dropdown",
|
|
47653
|
-
onClick: () => {
|
|
47654
|
-
startCellEdit(cellId);
|
|
47655
|
-
}
|
|
47656
|
-
}
|
|
47657
|
-
), isSelectedCell && (isRect ? isBottomRightCornerOfRectangle({
|
|
47658
|
-
cellId,
|
|
47659
|
-
selectionGrid,
|
|
47660
|
-
lastRowIndex,
|
|
47661
|
-
lastCellIndex,
|
|
47662
|
-
entityMap,
|
|
47663
|
-
pathToIndex
|
|
47664
|
-
}) : isSelectedCell === PRIMARY_SELECTED_VAL) && /* @__PURE__ */ React__default.createElement(
|
|
47665
|
-
CellDragHandle,
|
|
47666
|
-
{
|
|
47667
|
-
key: cellId,
|
|
47668
|
-
thisTable: tableRef.current.tableRef,
|
|
47669
|
-
cellId,
|
|
47670
|
-
isSelectionARectangle,
|
|
47671
|
-
onDragEnd
|
|
47672
|
-
}
|
|
47673
|
-
));
|
|
47674
|
-
}, "RenderCell");
|
|
47675
47681
|
const useColumns = /* @__PURE__ */ __name(({
|
|
47676
47682
|
addFilters,
|
|
47677
47683
|
cellRenderer,
|
|
@@ -47708,7 +47714,6 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
47708
47714
|
removeSingleFilter = noop$3,
|
|
47709
47715
|
schema,
|
|
47710
47716
|
selectedCells,
|
|
47711
|
-
setEditingCell,
|
|
47712
47717
|
setExpandedEntityIdMap,
|
|
47713
47718
|
setNewParams,
|
|
47714
47719
|
setOrder = noop$3,
|
|
@@ -48018,7 +48023,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48018
48023
|
const finishCellEdit = useCallback(
|
|
48019
48024
|
(cellId, newVal, doNotStopEditing) => {
|
|
48020
48025
|
const [rowId, path2] = cellId.split(":");
|
|
48021
|
-
!doNotStopEditing &&
|
|
48026
|
+
!doNotStopEditing && change$1("reduxFormEditingCell", null);
|
|
48022
48027
|
updateEntitiesHelper(entities, (entities2) => {
|
|
48023
48028
|
const entity = entities2.find((e2, i) => {
|
|
48024
48029
|
return getIdOrCodeOrIndex(e2, i) === rowId;
|
|
@@ -48037,19 +48042,19 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48037
48042
|
!doNotStopEditing && refocusTable();
|
|
48038
48043
|
},
|
|
48039
48044
|
[
|
|
48045
|
+
change$1,
|
|
48040
48046
|
entities,
|
|
48041
48047
|
reduxFormCellValidation,
|
|
48042
48048
|
refocusTable,
|
|
48043
48049
|
schema,
|
|
48044
|
-
setEditingCell,
|
|
48045
48050
|
updateEntitiesHelper,
|
|
48046
48051
|
updateValidation
|
|
48047
48052
|
]
|
|
48048
48053
|
);
|
|
48049
48054
|
const cancelCellEdit = useCallback(() => {
|
|
48050
|
-
|
|
48055
|
+
change$1("reduxFormEditingCell", null);
|
|
48051
48056
|
refocusTable();
|
|
48052
|
-
}, [
|
|
48057
|
+
}, [change$1, refocusTable]);
|
|
48053
48058
|
if (!columns.length) {
|
|
48054
48059
|
return columns;
|
|
48055
48060
|
}
|
|
@@ -48232,6 +48237,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48232
48237
|
RenderCell,
|
|
48233
48238
|
{
|
|
48234
48239
|
oldFunc,
|
|
48240
|
+
formName,
|
|
48235
48241
|
getCopyTextForCell,
|
|
48236
48242
|
column,
|
|
48237
48243
|
isCellEditable,
|
|
@@ -48264,21 +48270,6 @@ const throwFormError = /* @__PURE__ */ __name((error) => {
|
|
|
48264
48270
|
}
|
|
48265
48271
|
throw new SubmissionError(errorToUse);
|
|
48266
48272
|
}, "throwFormError");
|
|
48267
|
-
const useTraceUpdate = /* @__PURE__ */ __name((props) => {
|
|
48268
|
-
const prev = useRef(props);
|
|
48269
|
-
useEffect(() => {
|
|
48270
|
-
const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
|
|
48271
|
-
if (prev.current[k2] !== v2) {
|
|
48272
|
-
ps[k2] = [prev.current[k2], v2];
|
|
48273
|
-
}
|
|
48274
|
-
return ps;
|
|
48275
|
-
}, {});
|
|
48276
|
-
if (Object.keys(changedProps).length > 0) {
|
|
48277
|
-
console.log("Changed props:", changedProps);
|
|
48278
|
-
}
|
|
48279
|
-
prev.current = props;
|
|
48280
|
-
});
|
|
48281
|
-
}, "useTraceUpdate");
|
|
48282
48273
|
T();
|
|
48283
48274
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
48284
48275
|
const itemSizeEstimators = {
|
|
@@ -48351,7 +48342,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48351
48342
|
const {
|
|
48352
48343
|
reduxFormCellValidation: _reduxFormCellValidation,
|
|
48353
48344
|
reduxFormEditingCell,
|
|
48354
|
-
reduxFormEntities
|
|
48345
|
+
reduxFormEntities,
|
|
48355
48346
|
reduxFormQueryParams: _reduxFormQueryParams = {},
|
|
48356
48347
|
reduxFormSearchInput: _reduxFormSearchInput = "",
|
|
48357
48348
|
reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
|
|
@@ -48366,7 +48357,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48366
48357
|
)
|
|
48367
48358
|
);
|
|
48368
48359
|
const reduxFormCellValidation = useDeepEqualMemo(_reduxFormCellValidation);
|
|
48369
|
-
const reduxFormEntities = useDeepEqualMemo(_reduxFormEntities);
|
|
48370
48360
|
const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
|
|
48371
48361
|
const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
|
|
48372
48362
|
const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
|
|
@@ -48439,7 +48429,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48439
48429
|
return tmp;
|
|
48440
48430
|
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
48441
48431
|
const currentParams = useDeepEqualMemo(_currentParams);
|
|
48442
|
-
useTraceUpdate({ currentParams });
|
|
48443
48432
|
const tableParams = useMemo(() => {
|
|
48444
48433
|
if (!isTableParamsConnected) {
|
|
48445
48434
|
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
@@ -48645,20 +48634,28 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48645
48634
|
}, [entitiesAcrossPages, reduxFormSelectedEntityIdMap, change$1]);
|
|
48646
48635
|
const [tableConfig, setTableConfig] = useState({ fieldOptions: [] });
|
|
48647
48636
|
useEffect(() => {
|
|
48648
|
-
let newTableConfig = {};
|
|
48649
48637
|
if (withDisplayOptions) {
|
|
48638
|
+
let newTableConfig = {};
|
|
48650
48639
|
if (syncDisplayOptionsToDb) {
|
|
48651
48640
|
newTableConfig = tableConfigurations && tableConfigurations[0];
|
|
48652
48641
|
} else {
|
|
48653
48642
|
newTableConfig = getTableConfigFromStorage(formName);
|
|
48654
48643
|
}
|
|
48655
|
-
|
|
48656
|
-
newTableConfig
|
|
48657
|
-
|
|
48658
|
-
|
|
48659
|
-
|
|
48644
|
+
setTableConfig((prev) => {
|
|
48645
|
+
if (!newTableConfig) {
|
|
48646
|
+
newTableConfig = {
|
|
48647
|
+
fieldOptions: []
|
|
48648
|
+
};
|
|
48649
|
+
if (isEqual(prev, newTableConfig)) {
|
|
48650
|
+
return prev;
|
|
48651
|
+
} else {
|
|
48652
|
+
return newTableConfig;
|
|
48653
|
+
}
|
|
48654
|
+
} else {
|
|
48655
|
+
return newTableConfig;
|
|
48656
|
+
}
|
|
48657
|
+
});
|
|
48660
48658
|
}
|
|
48661
|
-
setTableConfig(newTableConfig);
|
|
48662
48659
|
}, [
|
|
48663
48660
|
formName,
|
|
48664
48661
|
syncDisplayOptionsToDb,
|
|
@@ -48906,8 +48903,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48906
48903
|
}
|
|
48907
48904
|
}));
|
|
48908
48905
|
},
|
|
48909
|
-
|
|
48910
|
-
[]
|
|
48906
|
+
[change$1]
|
|
48911
48907
|
);
|
|
48912
48908
|
const formatAndValidateEntities = useCallback(
|
|
48913
48909
|
(entities2, { useDefaultValues, indexToStartAt } = {}) => {
|
|
@@ -49107,7 +49103,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
49107
49103
|
}
|
|
49108
49104
|
}, [selectedCells]);
|
|
49109
49105
|
const startCellEdit = useCallback(
|
|
49110
|
-
(cellId) => {
|
|
49106
|
+
(cellId, initialValue) => {
|
|
49107
|
+
change$1("reduxFormInitialValue", initialValue);
|
|
49111
49108
|
change$1("reduxFormEditingCell", (prev) => {
|
|
49112
49109
|
if (prev === cellId)
|
|
49113
49110
|
return cellId;
|
|
@@ -49469,22 +49466,27 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
49469
49466
|
const [selectingAll, setSelectingAll] = useState(false);
|
|
49470
49467
|
useEffect(() => {
|
|
49471
49468
|
const formatAndValidateTableInitial = /* @__PURE__ */ __name(() => {
|
|
49472
|
-
const { newEnts, validationErrors } = formatAndValidateEntities(
|
|
49469
|
+
const { newEnts, validationErrors } = formatAndValidateEntities(entities);
|
|
49473
49470
|
const toKeep = {};
|
|
49474
49471
|
forEach(reduxFormCellValidation, (v2, k2) => {
|
|
49475
49472
|
if (v2 && v2._isTableAsyncWideError) {
|
|
49476
49473
|
toKeep[k2] = v2;
|
|
49477
49474
|
}
|
|
49478
49475
|
});
|
|
49479
|
-
change$1("reduxFormEntities",
|
|
49476
|
+
change$1("reduxFormEntities", (prev) => {
|
|
49477
|
+
if (!isEqual(prev, newEnts)) {
|
|
49478
|
+
return newEnts;
|
|
49479
|
+
}
|
|
49480
|
+
return prev;
|
|
49481
|
+
});
|
|
49480
49482
|
updateValidation(newEnts, __spreadValues(__spreadValues({}, toKeep), validationErrors));
|
|
49481
49483
|
}, "formatAndValidateTableInitial");
|
|
49482
49484
|
isCellEditable && formatAndValidateTableInitial();
|
|
49483
49485
|
}, [
|
|
49484
|
-
_origEntities,
|
|
49485
|
-
isCellEditable,
|
|
49486
49486
|
change$1,
|
|
49487
|
+
entities,
|
|
49487
49488
|
formatAndValidateEntities,
|
|
49489
|
+
isCellEditable,
|
|
49488
49490
|
reduxFormCellValidation,
|
|
49489
49491
|
updateValidation
|
|
49490
49492
|
]);
|
|
@@ -50813,7 +50815,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50813
50815
|
if (rowDisabled)
|
|
50814
50816
|
return;
|
|
50815
50817
|
e2.stopPropagation();
|
|
50816
|
-
startCellEdit(primarySelectedCellId);
|
|
50818
|
+
startCellEdit(primarySelectedCellId, e2.key);
|
|
50817
50819
|
}
|
|
50818
50820
|
}),
|
|
50819
50821
|
isCellEditable && entities.length > 50 && // test for this!!
|
|
@@ -64407,6 +64409,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64407
64409
|
syncDisplayOptionsToDb,
|
|
64408
64410
|
tableParams: _tableParams,
|
|
64409
64411
|
urlConnected,
|
|
64412
|
+
withDisplayOptions,
|
|
64410
64413
|
withPaging,
|
|
64411
64414
|
withSelectedEntities: withSelectedEntities2
|
|
64412
64415
|
} = props;
|
|
@@ -64567,7 +64570,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64567
64570
|
formName,
|
|
64568
64571
|
isLocalCall,
|
|
64569
64572
|
schema,
|
|
64570
|
-
currentParams
|
|
64573
|
+
currentParams,
|
|
64574
|
+
withDisplayOptions
|
|
64571
64575
|
}), queryParams), boundDispatchProps), {
|
|
64572
64576
|
form: formName,
|
|
64573
64577
|
//this will override the default redux form name
|
|
@@ -64586,7 +64590,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64586
64590
|
queryParams,
|
|
64587
64591
|
schema,
|
|
64588
64592
|
selectedEntities,
|
|
64589
|
-
urlConnected
|
|
64593
|
+
urlConnected,
|
|
64594
|
+
withDisplayOptions
|
|
64590
64595
|
]);
|
|
64591
64596
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
64592
64597
|
isLocalCall,
|
|
@@ -69557,6 +69562,21 @@ const CmdButton = withCommand({
|
|
|
69557
69562
|
icon: "icon",
|
|
69558
69563
|
disabled: "isDisabled"
|
|
69559
69564
|
})(Button);
|
|
69565
|
+
const useTraceUpdate = /* @__PURE__ */ __name((props) => {
|
|
69566
|
+
const prev = useRef(props);
|
|
69567
|
+
useEffect(() => {
|
|
69568
|
+
const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
|
|
69569
|
+
if (prev.current[k2] !== v2) {
|
|
69570
|
+
ps[k2] = [prev.current[k2], v2];
|
|
69571
|
+
}
|
|
69572
|
+
return ps;
|
|
69573
|
+
}, {});
|
|
69574
|
+
if (Object.keys(changedProps).length > 0) {
|
|
69575
|
+
console.log("Changed props:", changedProps);
|
|
69576
|
+
}
|
|
69577
|
+
prev.current = props;
|
|
69578
|
+
});
|
|
69579
|
+
}, "useTraceUpdate");
|
|
69560
69580
|
const showProgressToast = /* @__PURE__ */ __name((message, value, key, opts) => {
|
|
69561
69581
|
return window.toastr.default(
|
|
69562
69582
|
/* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", { style: { marginBottom: 10 } }, message), /* @__PURE__ */ React__default.createElement(
|