@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/DataTable/Columns.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function useColumns({ addFilters, cellRenderer, columns, currentParams, compact, editingCell, editingCellSelectAll, entities, expandedEntityIdMap, extraCompact, filters, formName, getCellHoverText, isCellEditable, isEntityDisabled, isLocalCall, isSimple, isSingleSelect, isSelectionARectangle, noDeselectAll, noSelect, noUserSelect, onDeselect, onMultiRowSelect, onRowClick, onRowSelect, onSingleRowSelect, order, primarySelectedCellId, reduxFormCellValidation, reduxFormSelectedEntityIdMap, refocusTable, removeSingleFilter, schema, selectedCells,
|
|
1
|
+
export function useColumns({ addFilters, cellRenderer, columns, currentParams, compact, editingCell, editingCellSelectAll, entities, expandedEntityIdMap, extraCompact, filters, formName, getCellHoverText, isCellEditable, isEntityDisabled, isLocalCall, isSimple, isSingleSelect, isSelectionARectangle, noDeselectAll, noSelect, noUserSelect, onDeselect, onMultiRowSelect, onRowClick, onRowSelect, onSingleRowSelect, order, primarySelectedCellId, reduxFormCellValidation, reduxFormSelectedEntityIdMap, refocusTable, removeSingleFilter, schema, selectedCells, setExpandedEntityIdMap, setNewParams, setOrder, setSelectedCells, shouldShowSubComponent, startCellEdit, SubComponent, tableRef, updateEntitiesHelper, updateValidation, withCheckboxes, withExpandAndCollapseAllButton, withFilter: _withFilter, withSort }: {
|
|
2
2
|
addFilters: any;
|
|
3
3
|
cellRenderer: any;
|
|
4
4
|
columns: any;
|
|
@@ -34,7 +34,6 @@ export function useColumns({ addFilters, cellRenderer, columns, currentParams, c
|
|
|
34
34
|
removeSingleFilter?: ((...args: any[]) => void) | undefined;
|
|
35
35
|
schema: any;
|
|
36
36
|
selectedCells: any;
|
|
37
|
-
setEditingCell: any;
|
|
38
37
|
setExpandedEntityIdMap: any;
|
|
39
38
|
setNewParams: any;
|
|
40
39
|
setOrder?: ((...args: any[]) => void) | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function RenderCell({ oldFunc, getCopyTextForCell, column, isCellEditable, isEntityDisabled, finishCellEdit, formName, noEllipsis, cancelCellEdit, getCellHoverText, selectedCells, isSelectionARectangle, startCellEdit, tableRef, onDragEnd, args }: {
|
|
2
|
+
oldFunc: any;
|
|
3
|
+
getCopyTextForCell: any;
|
|
4
|
+
column: any;
|
|
5
|
+
isCellEditable: any;
|
|
6
|
+
isEntityDisabled: any;
|
|
7
|
+
finishCellEdit: any;
|
|
8
|
+
formName: any;
|
|
9
|
+
noEllipsis: any;
|
|
10
|
+
cancelCellEdit: any;
|
|
11
|
+
getCellHoverText: any;
|
|
12
|
+
selectedCells: any;
|
|
13
|
+
isSelectionARectangle: any;
|
|
14
|
+
startCellEdit: any;
|
|
15
|
+
tableRef: any;
|
|
16
|
+
onDragEnd: any;
|
|
17
|
+
args: any;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/index.cjs.js
CHANGED
|
@@ -47274,6 +47274,177 @@ const CellDragHandle = /* @__PURE__ */ __name(({
|
|
|
47274
47274
|
}
|
|
47275
47275
|
);
|
|
47276
47276
|
}, "CellDragHandle");
|
|
47277
|
+
const RenderCell = /* @__PURE__ */ __name(({
|
|
47278
|
+
oldFunc,
|
|
47279
|
+
getCopyTextForCell,
|
|
47280
|
+
column,
|
|
47281
|
+
isCellEditable,
|
|
47282
|
+
isEntityDisabled,
|
|
47283
|
+
finishCellEdit,
|
|
47284
|
+
formName,
|
|
47285
|
+
noEllipsis,
|
|
47286
|
+
cancelCellEdit,
|
|
47287
|
+
getCellHoverText,
|
|
47288
|
+
selectedCells,
|
|
47289
|
+
isSelectionARectangle,
|
|
47290
|
+
startCellEdit,
|
|
47291
|
+
tableRef,
|
|
47292
|
+
onDragEnd,
|
|
47293
|
+
args
|
|
47294
|
+
}) => {
|
|
47295
|
+
var _a;
|
|
47296
|
+
const editingCell = reactRedux.useSelector(
|
|
47297
|
+
(state) => {
|
|
47298
|
+
var _a2, _b, _c;
|
|
47299
|
+
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormEditingCell;
|
|
47300
|
+
}
|
|
47301
|
+
);
|
|
47302
|
+
const initialValue = reactRedux.useSelector(
|
|
47303
|
+
(state) => {
|
|
47304
|
+
var _a2, _b, _c;
|
|
47305
|
+
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.reduxFormInitialValue;
|
|
47306
|
+
}
|
|
47307
|
+
);
|
|
47308
|
+
const [row] = args;
|
|
47309
|
+
const rowId = getIdOrCodeOrIndex(row.original, row.index);
|
|
47310
|
+
const cellId = `${rowId}:${row.column.path}`;
|
|
47311
|
+
const isEditingCell = editingCell === cellId;
|
|
47312
|
+
let val = oldFunc(...args);
|
|
47313
|
+
const oldVal = val;
|
|
47314
|
+
const text2 = getCopyTextForCell(val, row, column);
|
|
47315
|
+
const dataTest = {
|
|
47316
|
+
"data-test": "tgCell_" + column.path
|
|
47317
|
+
};
|
|
47318
|
+
const fullValue = (_a = row.original) == null ? void 0 : _a[row.column.path];
|
|
47319
|
+
if (isEditingCell) {
|
|
47320
|
+
if (column.type === "genericSelect") {
|
|
47321
|
+
const GenericSelectComp = column.GenericSelectComp;
|
|
47322
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
47323
|
+
GenericSelectComp,
|
|
47324
|
+
__spreadProps(__spreadValues({
|
|
47325
|
+
rowId,
|
|
47326
|
+
fullValue,
|
|
47327
|
+
initialValue: text2
|
|
47328
|
+
}, dataTest), {
|
|
47329
|
+
finishEdit: (newVal, doNotStopEditing) => {
|
|
47330
|
+
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47331
|
+
},
|
|
47332
|
+
dataTest,
|
|
47333
|
+
cancelEdit: cancelCellEdit
|
|
47334
|
+
})
|
|
47335
|
+
);
|
|
47336
|
+
}
|
|
47337
|
+
if (column.type === "dropdown" || column.type === "dropdownMulti") {
|
|
47338
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
47339
|
+
DropdownCell,
|
|
47340
|
+
{
|
|
47341
|
+
isMulti: dataTest.isMulti || column.type === "dropdownMulti",
|
|
47342
|
+
initialValue: dataTest.initialValue || text2,
|
|
47343
|
+
options: getVals(column.values),
|
|
47344
|
+
finishEdit: (newVal, doNotStopEditing) => {
|
|
47345
|
+
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47346
|
+
},
|
|
47347
|
+
dataTest,
|
|
47348
|
+
cancelEdit: cancelCellEdit
|
|
47349
|
+
}
|
|
47350
|
+
);
|
|
47351
|
+
} else {
|
|
47352
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
47353
|
+
EditableCell,
|
|
47354
|
+
{
|
|
47355
|
+
dataTest,
|
|
47356
|
+
cancelEdit: cancelCellEdit,
|
|
47357
|
+
isNumeric: column.type === "number",
|
|
47358
|
+
initialValue: initialValue || text2,
|
|
47359
|
+
finishEdit: (newVal) => {
|
|
47360
|
+
finishCellEdit(cellId, newVal);
|
|
47361
|
+
}
|
|
47362
|
+
}
|
|
47363
|
+
);
|
|
47364
|
+
}
|
|
47365
|
+
}
|
|
47366
|
+
const isBool = column.type === "boolean";
|
|
47367
|
+
if (isCellEditable && isBool) {
|
|
47368
|
+
val = /* @__PURE__ */ React$1.createElement(
|
|
47369
|
+
core.Checkbox,
|
|
47370
|
+
{
|
|
47371
|
+
disabled: isEntityDisabled(row.original),
|
|
47372
|
+
className: "tg-cell-edit-boolean-checkbox",
|
|
47373
|
+
checked: oldVal === "True",
|
|
47374
|
+
onChange: (e2) => {
|
|
47375
|
+
const checked = e2.target.checked;
|
|
47376
|
+
finishCellEdit(cellId, checked);
|
|
47377
|
+
}
|
|
47378
|
+
}
|
|
47379
|
+
);
|
|
47380
|
+
noEllipsis = true;
|
|
47381
|
+
}
|
|
47382
|
+
let title = text2;
|
|
47383
|
+
if (getCellHoverText)
|
|
47384
|
+
title = getCellHoverText(...args);
|
|
47385
|
+
else if (column.getTitleAttr)
|
|
47386
|
+
title = column.getTitleAttr(...args);
|
|
47387
|
+
const isSelectedCell = selectedCells == null ? void 0 : selectedCells[cellId];
|
|
47388
|
+
const {
|
|
47389
|
+
isRect,
|
|
47390
|
+
selectionGrid,
|
|
47391
|
+
lastRowIndex,
|
|
47392
|
+
lastCellIndex,
|
|
47393
|
+
entityMap,
|
|
47394
|
+
pathToIndex
|
|
47395
|
+
} = isSelectionARectangle();
|
|
47396
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(
|
|
47397
|
+
"div",
|
|
47398
|
+
__spreadProps(__spreadValues({
|
|
47399
|
+
style: __spreadValues({}, !noEllipsis && {
|
|
47400
|
+
textOverflow: "ellipsis",
|
|
47401
|
+
overflow: "hidden"
|
|
47402
|
+
})
|
|
47403
|
+
}, dataTest), {
|
|
47404
|
+
className: "tg-cell-wrapper",
|
|
47405
|
+
"data-copy-text": text2,
|
|
47406
|
+
"data-copy-json": JSON.stringify(
|
|
47407
|
+
//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
|
|
47408
|
+
column.type === "genericSelect" ? {
|
|
47409
|
+
__strVal: fullValue,
|
|
47410
|
+
__genSelCol: column.path
|
|
47411
|
+
} : { __strVal: text2 }
|
|
47412
|
+
),
|
|
47413
|
+
title: title || void 0
|
|
47414
|
+
}),
|
|
47415
|
+
val
|
|
47416
|
+
), isCellEditable && (column.type === "dropdown" || column.type === "dropdownMulti" || column.type === "genericSelect") && /* @__PURE__ */ React$1.createElement(
|
|
47417
|
+
core.Icon,
|
|
47418
|
+
{
|
|
47419
|
+
icon: "caret-down",
|
|
47420
|
+
style: {
|
|
47421
|
+
position: "absolute",
|
|
47422
|
+
right: 5,
|
|
47423
|
+
opacity: 0.3
|
|
47424
|
+
},
|
|
47425
|
+
className: "cell-edit-dropdown",
|
|
47426
|
+
onClick: () => {
|
|
47427
|
+
startCellEdit(cellId);
|
|
47428
|
+
}
|
|
47429
|
+
}
|
|
47430
|
+
), isSelectedCell && (isRect ? isBottomRightCornerOfRectangle({
|
|
47431
|
+
cellId,
|
|
47432
|
+
selectionGrid,
|
|
47433
|
+
lastRowIndex,
|
|
47434
|
+
lastCellIndex,
|
|
47435
|
+
entityMap,
|
|
47436
|
+
pathToIndex
|
|
47437
|
+
}) : isSelectedCell === PRIMARY_SELECTED_VAL) && /* @__PURE__ */ React$1.createElement(
|
|
47438
|
+
CellDragHandle,
|
|
47439
|
+
{
|
|
47440
|
+
key: cellId,
|
|
47441
|
+
thisTable: tableRef.current.tableRef,
|
|
47442
|
+
cellId,
|
|
47443
|
+
isSelectionARectangle,
|
|
47444
|
+
onDragEnd
|
|
47445
|
+
}
|
|
47446
|
+
));
|
|
47447
|
+
}, "RenderCell");
|
|
47277
47448
|
dayjs.extend(localizedFormat);
|
|
47278
47449
|
const RenderColumnHeader = /* @__PURE__ */ __name(({
|
|
47279
47450
|
addFilters,
|
|
@@ -47525,171 +47696,6 @@ const renderCheckboxHeader = /* @__PURE__ */ __name(({
|
|
|
47525
47696
|
}, checkboxProps)
|
|
47526
47697
|
) : null;
|
|
47527
47698
|
}, "renderCheckboxHeader");
|
|
47528
|
-
const RenderCell = /* @__PURE__ */ __name(({
|
|
47529
|
-
oldFunc,
|
|
47530
|
-
getCopyTextForCell,
|
|
47531
|
-
column,
|
|
47532
|
-
isCellEditable,
|
|
47533
|
-
isEntityDisabled,
|
|
47534
|
-
finishCellEdit,
|
|
47535
|
-
formName,
|
|
47536
|
-
noEllipsis,
|
|
47537
|
-
cancelCellEdit,
|
|
47538
|
-
getCellHoverText,
|
|
47539
|
-
selectedCells,
|
|
47540
|
-
isSelectionARectangle,
|
|
47541
|
-
startCellEdit,
|
|
47542
|
-
tableRef,
|
|
47543
|
-
onDragEnd,
|
|
47544
|
-
args
|
|
47545
|
-
}) => {
|
|
47546
|
-
var _a;
|
|
47547
|
-
const editingCell = reactRedux.useSelector(
|
|
47548
|
-
(state) => {
|
|
47549
|
-
var _a2, _b, _c;
|
|
47550
|
-
return (_c = (_b = (_a2 = state.form) == null ? void 0 : _a2[formName]) == null ? void 0 : _b.values) == null ? void 0 : _c.editingCell;
|
|
47551
|
-
}
|
|
47552
|
-
);
|
|
47553
|
-
const [row] = args;
|
|
47554
|
-
const rowId = getIdOrCodeOrIndex(row.original, row.index);
|
|
47555
|
-
const cellId = `${rowId}:${row.column.path}`;
|
|
47556
|
-
const isEditingCell = editingCell === cellId;
|
|
47557
|
-
let val = oldFunc(...args);
|
|
47558
|
-
const oldVal = val;
|
|
47559
|
-
const text2 = getCopyTextForCell(val, row, column);
|
|
47560
|
-
const dataTest = {
|
|
47561
|
-
"data-test": "tgCell_" + column.path
|
|
47562
|
-
};
|
|
47563
|
-
const fullValue = (_a = row.original) == null ? void 0 : _a[row.column.path];
|
|
47564
|
-
if (isEditingCell) {
|
|
47565
|
-
if (column.type === "genericSelect") {
|
|
47566
|
-
const GenericSelectComp = column.GenericSelectComp;
|
|
47567
|
-
return /* @__PURE__ */ React$1.createElement(
|
|
47568
|
-
GenericSelectComp,
|
|
47569
|
-
__spreadProps(__spreadValues({
|
|
47570
|
-
rowId,
|
|
47571
|
-
fullValue,
|
|
47572
|
-
initialValue: text2
|
|
47573
|
-
}, dataTest), {
|
|
47574
|
-
finishEdit: (newVal, doNotStopEditing) => {
|
|
47575
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47576
|
-
},
|
|
47577
|
-
dataTest,
|
|
47578
|
-
cancelEdit: cancelCellEdit
|
|
47579
|
-
})
|
|
47580
|
-
);
|
|
47581
|
-
}
|
|
47582
|
-
if (column.type === "dropdown" || column.type === "dropdownMulti") {
|
|
47583
|
-
return /* @__PURE__ */ React$1.createElement(
|
|
47584
|
-
DropdownCell,
|
|
47585
|
-
{
|
|
47586
|
-
isMulti: dataTest.isMulti || column.type === "dropdownMulti",
|
|
47587
|
-
initialValue: dataTest.initialValue || text2,
|
|
47588
|
-
options: getVals(column.values),
|
|
47589
|
-
finishEdit: (newVal, doNotStopEditing) => {
|
|
47590
|
-
finishCellEdit(cellId, newVal, doNotStopEditing);
|
|
47591
|
-
},
|
|
47592
|
-
dataTest,
|
|
47593
|
-
cancelEdit: cancelCellEdit
|
|
47594
|
-
}
|
|
47595
|
-
);
|
|
47596
|
-
} else {
|
|
47597
|
-
return /* @__PURE__ */ React$1.createElement(
|
|
47598
|
-
EditableCell,
|
|
47599
|
-
{
|
|
47600
|
-
dataTest,
|
|
47601
|
-
cancelEdit: cancelCellEdit,
|
|
47602
|
-
isNumeric: column.type === "number",
|
|
47603
|
-
initialValue: text2,
|
|
47604
|
-
finishEdit: (newVal) => {
|
|
47605
|
-
finishCellEdit(cellId, newVal);
|
|
47606
|
-
}
|
|
47607
|
-
}
|
|
47608
|
-
);
|
|
47609
|
-
}
|
|
47610
|
-
}
|
|
47611
|
-
const isBool = column.type === "boolean";
|
|
47612
|
-
if (isCellEditable && isBool) {
|
|
47613
|
-
val = /* @__PURE__ */ React$1.createElement(
|
|
47614
|
-
core.Checkbox,
|
|
47615
|
-
{
|
|
47616
|
-
disabled: isEntityDisabled(row.original),
|
|
47617
|
-
className: "tg-cell-edit-boolean-checkbox",
|
|
47618
|
-
checked: oldVal === "True",
|
|
47619
|
-
onChange: (e2) => {
|
|
47620
|
-
const checked = e2.target.checked;
|
|
47621
|
-
finishCellEdit(cellId, checked);
|
|
47622
|
-
}
|
|
47623
|
-
}
|
|
47624
|
-
);
|
|
47625
|
-
noEllipsis = true;
|
|
47626
|
-
}
|
|
47627
|
-
let title = text2;
|
|
47628
|
-
if (getCellHoverText)
|
|
47629
|
-
title = getCellHoverText(...args);
|
|
47630
|
-
else if (column.getTitleAttr)
|
|
47631
|
-
title = column.getTitleAttr(...args);
|
|
47632
|
-
const isSelectedCell = selectedCells == null ? void 0 : selectedCells[cellId];
|
|
47633
|
-
const {
|
|
47634
|
-
isRect,
|
|
47635
|
-
selectionGrid,
|
|
47636
|
-
lastRowIndex,
|
|
47637
|
-
lastCellIndex,
|
|
47638
|
-
entityMap,
|
|
47639
|
-
pathToIndex
|
|
47640
|
-
} = isSelectionARectangle();
|
|
47641
|
-
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(
|
|
47642
|
-
"div",
|
|
47643
|
-
__spreadProps(__spreadValues({
|
|
47644
|
-
style: __spreadValues({}, !noEllipsis && {
|
|
47645
|
-
textOverflow: "ellipsis",
|
|
47646
|
-
overflow: "hidden"
|
|
47647
|
-
})
|
|
47648
|
-
}, dataTest), {
|
|
47649
|
-
className: "tg-cell-wrapper",
|
|
47650
|
-
"data-copy-text": text2,
|
|
47651
|
-
"data-copy-json": JSON.stringify(
|
|
47652
|
-
//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
|
|
47653
|
-
column.type === "genericSelect" ? {
|
|
47654
|
-
__strVal: fullValue,
|
|
47655
|
-
__genSelCol: column.path
|
|
47656
|
-
} : { __strVal: text2 }
|
|
47657
|
-
),
|
|
47658
|
-
title: title || void 0
|
|
47659
|
-
}),
|
|
47660
|
-
val
|
|
47661
|
-
), isCellEditable && (column.type === "dropdown" || column.type === "dropdownMulti" || column.type === "genericSelect") && /* @__PURE__ */ React$1.createElement(
|
|
47662
|
-
core.Icon,
|
|
47663
|
-
{
|
|
47664
|
-
icon: "caret-down",
|
|
47665
|
-
style: {
|
|
47666
|
-
position: "absolute",
|
|
47667
|
-
right: 5,
|
|
47668
|
-
opacity: 0.3
|
|
47669
|
-
},
|
|
47670
|
-
className: "cell-edit-dropdown",
|
|
47671
|
-
onClick: () => {
|
|
47672
|
-
startCellEdit(cellId);
|
|
47673
|
-
}
|
|
47674
|
-
}
|
|
47675
|
-
), isSelectedCell && (isRect ? isBottomRightCornerOfRectangle({
|
|
47676
|
-
cellId,
|
|
47677
|
-
selectionGrid,
|
|
47678
|
-
lastRowIndex,
|
|
47679
|
-
lastCellIndex,
|
|
47680
|
-
entityMap,
|
|
47681
|
-
pathToIndex
|
|
47682
|
-
}) : isSelectedCell === PRIMARY_SELECTED_VAL) && /* @__PURE__ */ React$1.createElement(
|
|
47683
|
-
CellDragHandle,
|
|
47684
|
-
{
|
|
47685
|
-
key: cellId,
|
|
47686
|
-
thisTable: tableRef.current.tableRef,
|
|
47687
|
-
cellId,
|
|
47688
|
-
isSelectionARectangle,
|
|
47689
|
-
onDragEnd
|
|
47690
|
-
}
|
|
47691
|
-
));
|
|
47692
|
-
}, "RenderCell");
|
|
47693
47699
|
const useColumns = /* @__PURE__ */ __name(({
|
|
47694
47700
|
addFilters,
|
|
47695
47701
|
cellRenderer,
|
|
@@ -47726,7 +47732,6 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
47726
47732
|
removeSingleFilter = noop$3,
|
|
47727
47733
|
schema,
|
|
47728
47734
|
selectedCells,
|
|
47729
|
-
setEditingCell,
|
|
47730
47735
|
setExpandedEntityIdMap,
|
|
47731
47736
|
setNewParams,
|
|
47732
47737
|
setOrder = noop$3,
|
|
@@ -48036,7 +48041,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48036
48041
|
const finishCellEdit = React$1.useCallback(
|
|
48037
48042
|
(cellId, newVal, doNotStopEditing) => {
|
|
48038
48043
|
const [rowId, path2] = cellId.split(":");
|
|
48039
|
-
!doNotStopEditing &&
|
|
48044
|
+
!doNotStopEditing && change("reduxFormEditingCell", null);
|
|
48040
48045
|
updateEntitiesHelper(entities, (entities2) => {
|
|
48041
48046
|
const entity = entities2.find((e2, i) => {
|
|
48042
48047
|
return getIdOrCodeOrIndex(e2, i) === rowId;
|
|
@@ -48055,19 +48060,19 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48055
48060
|
!doNotStopEditing && refocusTable();
|
|
48056
48061
|
},
|
|
48057
48062
|
[
|
|
48063
|
+
change,
|
|
48058
48064
|
entities,
|
|
48059
48065
|
reduxFormCellValidation,
|
|
48060
48066
|
refocusTable,
|
|
48061
48067
|
schema,
|
|
48062
|
-
setEditingCell,
|
|
48063
48068
|
updateEntitiesHelper,
|
|
48064
48069
|
updateValidation
|
|
48065
48070
|
]
|
|
48066
48071
|
);
|
|
48067
48072
|
const cancelCellEdit = React$1.useCallback(() => {
|
|
48068
|
-
|
|
48073
|
+
change("reduxFormEditingCell", null);
|
|
48069
48074
|
refocusTable();
|
|
48070
|
-
}, [
|
|
48075
|
+
}, [change, refocusTable]);
|
|
48071
48076
|
if (!columns.length) {
|
|
48072
48077
|
return columns;
|
|
48073
48078
|
}
|
|
@@ -48250,6 +48255,7 @@ const useColumns = /* @__PURE__ */ __name(({
|
|
|
48250
48255
|
RenderCell,
|
|
48251
48256
|
{
|
|
48252
48257
|
oldFunc,
|
|
48258
|
+
formName,
|
|
48253
48259
|
getCopyTextForCell,
|
|
48254
48260
|
column,
|
|
48255
48261
|
isCellEditable,
|
|
@@ -48282,21 +48288,6 @@ const throwFormError = /* @__PURE__ */ __name((error) => {
|
|
|
48282
48288
|
}
|
|
48283
48289
|
throw new reduxForm.SubmissionError(errorToUse);
|
|
48284
48290
|
}, "throwFormError");
|
|
48285
|
-
const useTraceUpdate = /* @__PURE__ */ __name((props) => {
|
|
48286
|
-
const prev = React$1.useRef(props);
|
|
48287
|
-
React$1.useEffect(() => {
|
|
48288
|
-
const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
|
|
48289
|
-
if (prev.current[k2] !== v2) {
|
|
48290
|
-
ps[k2] = [prev.current[k2], v2];
|
|
48291
|
-
}
|
|
48292
|
-
return ps;
|
|
48293
|
-
}, {});
|
|
48294
|
-
if (Object.keys(changedProps).length > 0) {
|
|
48295
|
-
console.log("Changed props:", changedProps);
|
|
48296
|
-
}
|
|
48297
|
-
prev.current = props;
|
|
48298
|
-
});
|
|
48299
|
-
}, "useTraceUpdate");
|
|
48300
48291
|
T();
|
|
48301
48292
|
const IS_LINUX = window.navigator.platform.toLowerCase().search("linux") > -1;
|
|
48302
48293
|
const itemSizeEstimators = {
|
|
@@ -48369,7 +48360,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48369
48360
|
const {
|
|
48370
48361
|
reduxFormCellValidation: _reduxFormCellValidation,
|
|
48371
48362
|
reduxFormEditingCell,
|
|
48372
|
-
reduxFormEntities
|
|
48363
|
+
reduxFormEntities,
|
|
48373
48364
|
reduxFormQueryParams: _reduxFormQueryParams = {},
|
|
48374
48365
|
reduxFormSearchInput: _reduxFormSearchInput = "",
|
|
48375
48366
|
reduxFormSelectedEntityIdMap: _reduxFormSelectedEntityIdMap = {}
|
|
@@ -48384,7 +48375,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48384
48375
|
)
|
|
48385
48376
|
);
|
|
48386
48377
|
const reduxFormCellValidation = useDeepEqualMemo(_reduxFormCellValidation);
|
|
48387
|
-
const reduxFormEntities = useDeepEqualMemo(_reduxFormEntities);
|
|
48388
48378
|
const reduxFormQueryParams = useDeepEqualMemo(_reduxFormQueryParams);
|
|
48389
48379
|
const reduxFormSearchInput = useDeepEqualMemo(_reduxFormSearchInput);
|
|
48390
48380
|
const reduxFormSelectedEntityIdMap = useDeepEqualMemo(
|
|
@@ -48457,7 +48447,6 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48457
48447
|
return tmp;
|
|
48458
48448
|
}, [history, reduxFormQueryParams, reduxFormSearchInput, urlConnected]);
|
|
48459
48449
|
const currentParams = useDeepEqualMemo(_currentParams);
|
|
48460
|
-
useTraceUpdate({ currentParams });
|
|
48461
48450
|
const tableParams = React$1.useMemo(() => {
|
|
48462
48451
|
if (!isTableParamsConnected) {
|
|
48463
48452
|
const updateSearch = /* @__PURE__ */ __name((val) => {
|
|
@@ -48663,20 +48652,28 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48663
48652
|
}, [entitiesAcrossPages, reduxFormSelectedEntityIdMap, change]);
|
|
48664
48653
|
const [tableConfig, setTableConfig] = React$1.useState({ fieldOptions: [] });
|
|
48665
48654
|
React$1.useEffect(() => {
|
|
48666
|
-
let newTableConfig = {};
|
|
48667
48655
|
if (withDisplayOptions) {
|
|
48656
|
+
let newTableConfig = {};
|
|
48668
48657
|
if (syncDisplayOptionsToDb) {
|
|
48669
48658
|
newTableConfig = tableConfigurations && tableConfigurations[0];
|
|
48670
48659
|
} else {
|
|
48671
48660
|
newTableConfig = getTableConfigFromStorage(formName);
|
|
48672
48661
|
}
|
|
48673
|
-
|
|
48674
|
-
newTableConfig
|
|
48675
|
-
|
|
48676
|
-
|
|
48677
|
-
|
|
48662
|
+
setTableConfig((prev) => {
|
|
48663
|
+
if (!newTableConfig) {
|
|
48664
|
+
newTableConfig = {
|
|
48665
|
+
fieldOptions: []
|
|
48666
|
+
};
|
|
48667
|
+
if (isEqual(prev, newTableConfig)) {
|
|
48668
|
+
return prev;
|
|
48669
|
+
} else {
|
|
48670
|
+
return newTableConfig;
|
|
48671
|
+
}
|
|
48672
|
+
} else {
|
|
48673
|
+
return newTableConfig;
|
|
48674
|
+
}
|
|
48675
|
+
});
|
|
48678
48676
|
}
|
|
48679
|
-
setTableConfig(newTableConfig);
|
|
48680
48677
|
}, [
|
|
48681
48678
|
formName,
|
|
48682
48679
|
syncDisplayOptionsToDb,
|
|
@@ -48924,8 +48921,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
48924
48921
|
}
|
|
48925
48922
|
}));
|
|
48926
48923
|
},
|
|
48927
|
-
|
|
48928
|
-
[]
|
|
48924
|
+
[change]
|
|
48929
48925
|
);
|
|
48930
48926
|
const formatAndValidateEntities = React$1.useCallback(
|
|
48931
48927
|
(entities2, { useDefaultValues, indexToStartAt } = {}) => {
|
|
@@ -49125,7 +49121,8 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
49125
49121
|
}
|
|
49126
49122
|
}, [selectedCells]);
|
|
49127
49123
|
const startCellEdit = React$1.useCallback(
|
|
49128
|
-
(cellId) => {
|
|
49124
|
+
(cellId, initialValue) => {
|
|
49125
|
+
change("reduxFormInitialValue", initialValue);
|
|
49129
49126
|
change("reduxFormEditingCell", (prev) => {
|
|
49130
49127
|
if (prev === cellId)
|
|
49131
49128
|
return cellId;
|
|
@@ -49487,22 +49484,27 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
49487
49484
|
const [selectingAll, setSelectingAll] = React$1.useState(false);
|
|
49488
49485
|
React$1.useEffect(() => {
|
|
49489
49486
|
const formatAndValidateTableInitial = /* @__PURE__ */ __name(() => {
|
|
49490
|
-
const { newEnts, validationErrors } = formatAndValidateEntities(
|
|
49487
|
+
const { newEnts, validationErrors } = formatAndValidateEntities(entities);
|
|
49491
49488
|
const toKeep = {};
|
|
49492
49489
|
forEach(reduxFormCellValidation, (v2, k2) => {
|
|
49493
49490
|
if (v2 && v2._isTableAsyncWideError) {
|
|
49494
49491
|
toKeep[k2] = v2;
|
|
49495
49492
|
}
|
|
49496
49493
|
});
|
|
49497
|
-
change("reduxFormEntities",
|
|
49494
|
+
change("reduxFormEntities", (prev) => {
|
|
49495
|
+
if (!isEqual(prev, newEnts)) {
|
|
49496
|
+
return newEnts;
|
|
49497
|
+
}
|
|
49498
|
+
return prev;
|
|
49499
|
+
});
|
|
49498
49500
|
updateValidation(newEnts, __spreadValues(__spreadValues({}, toKeep), validationErrors));
|
|
49499
49501
|
}, "formatAndValidateTableInitial");
|
|
49500
49502
|
isCellEditable && formatAndValidateTableInitial();
|
|
49501
49503
|
}, [
|
|
49502
|
-
_origEntities,
|
|
49503
|
-
isCellEditable,
|
|
49504
49504
|
change,
|
|
49505
|
+
entities,
|
|
49505
49506
|
formatAndValidateEntities,
|
|
49507
|
+
isCellEditable,
|
|
49506
49508
|
reduxFormCellValidation,
|
|
49507
49509
|
updateValidation
|
|
49508
49510
|
]);
|
|
@@ -50831,7 +50833,7 @@ const DataTable = /* @__PURE__ */ __name((_G) => {
|
|
|
50831
50833
|
if (rowDisabled)
|
|
50832
50834
|
return;
|
|
50833
50835
|
e2.stopPropagation();
|
|
50834
|
-
startCellEdit(primarySelectedCellId);
|
|
50836
|
+
startCellEdit(primarySelectedCellId, e2.key);
|
|
50835
50837
|
}
|
|
50836
50838
|
}),
|
|
50837
50839
|
isCellEditable && entities.length > 50 && // test for this!!
|
|
@@ -64425,6 +64427,7 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64425
64427
|
syncDisplayOptionsToDb,
|
|
64426
64428
|
tableParams: _tableParams,
|
|
64427
64429
|
urlConnected,
|
|
64430
|
+
withDisplayOptions,
|
|
64428
64431
|
withPaging,
|
|
64429
64432
|
withSelectedEntities: withSelectedEntities2
|
|
64430
64433
|
} = props;
|
|
@@ -64585,7 +64588,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64585
64588
|
formName,
|
|
64586
64589
|
isLocalCall,
|
|
64587
64590
|
schema,
|
|
64588
|
-
currentParams
|
|
64591
|
+
currentParams,
|
|
64592
|
+
withDisplayOptions
|
|
64589
64593
|
}), queryParams), boundDispatchProps), {
|
|
64590
64594
|
form: formName,
|
|
64591
64595
|
//this will override the default redux form name
|
|
@@ -64604,7 +64608,8 @@ const useTableParams = /* @__PURE__ */ __name((props) => {
|
|
|
64604
64608
|
queryParams,
|
|
64605
64609
|
schema,
|
|
64606
64610
|
selectedEntities,
|
|
64607
|
-
urlConnected
|
|
64611
|
+
urlConnected,
|
|
64612
|
+
withDisplayOptions
|
|
64608
64613
|
]);
|
|
64609
64614
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
64610
64615
|
isLocalCall,
|
|
@@ -69575,6 +69580,21 @@ const CmdButton = withCommand({
|
|
|
69575
69580
|
icon: "icon",
|
|
69576
69581
|
disabled: "isDisabled"
|
|
69577
69582
|
})(core.Button);
|
|
69583
|
+
const useTraceUpdate = /* @__PURE__ */ __name((props) => {
|
|
69584
|
+
const prev = React$1.useRef(props);
|
|
69585
|
+
React$1.useEffect(() => {
|
|
69586
|
+
const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
|
|
69587
|
+
if (prev.current[k2] !== v2) {
|
|
69588
|
+
ps[k2] = [prev.current[k2], v2];
|
|
69589
|
+
}
|
|
69590
|
+
return ps;
|
|
69591
|
+
}, {});
|
|
69592
|
+
if (Object.keys(changedProps).length > 0) {
|
|
69593
|
+
console.log("Changed props:", changedProps);
|
|
69594
|
+
}
|
|
69595
|
+
prev.current = props;
|
|
69596
|
+
});
|
|
69597
|
+
}, "useTraceUpdate");
|
|
69578
69598
|
const showProgressToast = /* @__PURE__ */ __name((message, value, key, opts) => {
|
|
69579
69599
|
return window.toastr.default(
|
|
69580
69600
|
/* @__PURE__ */ React$1.createElement("div", null, /* @__PURE__ */ React$1.createElement("div", { style: { marginBottom: 10 } }, message), /* @__PURE__ */ React$1.createElement(
|