@economic/taco 2.43.1 → 2.44.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Report/Report.d.ts +1 -1
- package/dist/components/Table3/features/useTableEditing.d.ts +8 -8
- package/dist/esm/index.css +44 -22
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +7 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +6 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +4 -3
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +17 -3
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +1 -11
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +7 -5
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +36 -47
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +9 -0
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +0 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +1 -8
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +85 -109
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -9
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +12 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +1 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +17 -10
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +4 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +44 -22
- package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +1 -2
- package/dist/primitives/Table/types.d.ts +0 -1
- package/dist/primitives/Table/useTableManager/util/columns.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/util/search.d.ts +2 -2
- package/dist/taco.cjs.development.js +216 -226
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -4339,7 +4339,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
4339
4339
|
hide = false,
|
4340
4340
|
...otherProps
|
4341
4341
|
} = props;
|
4342
|
-
const className = cn(otherProps.className);
|
4342
|
+
const className = cn('break-words', otherProps.className);
|
4343
4343
|
if (hide) {
|
4344
4344
|
return children;
|
4345
4345
|
}
|
@@ -6464,6 +6464,11 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
6464
6464
|
const currentDay = (_popoverContentRef$cu = popoverContentRef === null || popoverContentRef === void 0 ? void 0 : (_popoverContentRef$cu2 = popoverContentRef.current) === null || _popoverContentRef$cu2 === void 0 ? void 0 : _popoverContentRef$cu2.querySelector('table button[name="day"][aria-selected="true"]')) !== null && _popoverContentRef$cu !== void 0 ? _popoverContentRef$cu : null;
|
6465
6465
|
currentDay === null || currentDay === void 0 ? void 0 : currentDay.focus();
|
6466
6466
|
}, [popoverContentRef]);
|
6467
|
+
const handleCloseAutoFocus = React.useCallback(e => {
|
6468
|
+
var _input$ref$current;
|
6469
|
+
e.preventDefault();
|
6470
|
+
(_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
|
6471
|
+
}, [input.ref]);
|
6467
6472
|
return /*#__PURE__*/React.createElement("span", {
|
6468
6473
|
className: className,
|
6469
6474
|
"data-taco": "datepicker",
|
@@ -6475,7 +6480,8 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
6475
6480
|
icon: "calendar",
|
6476
6481
|
tabIndex: -1,
|
6477
6482
|
popover: props => (/*#__PURE__*/React.createElement(Popover, Object.assign({}, props), /*#__PURE__*/React.createElement(Popover.Content, {
|
6478
|
-
onOpenAutoFocus: handleOpenAutofocus
|
6483
|
+
onOpenAutoFocus: handleOpenAutofocus,
|
6484
|
+
onCloseAutoFocus: handleCloseAutoFocus
|
6479
6485
|
}, ({
|
6480
6486
|
close
|
6481
6487
|
}) => (/*#__PURE__*/React.createElement("div", {
|
@@ -9978,18 +9984,25 @@ function columnFilterFn(value, filter) {
|
|
9978
9984
|
}
|
9979
9985
|
}
|
9980
9986
|
|
9987
|
+
const flattenCellValue = cellValue => {
|
9988
|
+
return typeof cellValue === 'object' ? Object.values(cellValue).map(flattenCellValue) : cellValue;
|
9989
|
+
};
|
9981
9990
|
function isMatched(searchQuery, cellValue, dataType, localization) {
|
9982
|
-
|
9983
|
-
|
9984
|
-
return true;
|
9991
|
+
if (typeof cellValue === 'object') {
|
9992
|
+
return flattenCellValue(cellValue).flat(Infinity).find(y => isWeakContains(y, searchQuery));
|
9985
9993
|
} else {
|
9986
|
-
const
|
9987
|
-
if (
|
9988
|
-
|
9989
|
-
|
9990
|
-
|
9991
|
-
if (
|
9992
|
-
|
9994
|
+
const cellValueAsString = String(cellValue !== null && cellValue !== void 0 ? cellValue : '');
|
9995
|
+
if (cellValueAsString !== undefined && isWeakContains(cellValueAsString, searchQuery)) {
|
9996
|
+
return true;
|
9997
|
+
} else {
|
9998
|
+
const dataTypeProperties = getDataTypeProperties(dataType);
|
9999
|
+
if (dataTypeProperties.getDisplayValue) {
|
10000
|
+
const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
|
10001
|
+
localization
|
10002
|
+
});
|
10003
|
+
if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
|
10004
|
+
return true;
|
10005
|
+
}
|
9993
10006
|
}
|
9994
10007
|
}
|
9995
10008
|
}
|
@@ -10360,7 +10373,7 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns, lo
|
|
10360
10373
|
const column = createInternalColumn('__expansion', internalColumns.rowExpansion, defaultSizing);
|
10361
10374
|
columns.unshift(column);
|
10362
10375
|
}
|
10363
|
-
if (
|
10376
|
+
if (options.enableRowSelection && internalColumns.rowSelection) {
|
10364
10377
|
const column = createInternalColumn('__select', internalColumns.rowSelection, defaultSizing);
|
10365
10378
|
columns.unshift(column);
|
10366
10379
|
}
|
@@ -10382,10 +10395,9 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns, lo
|
|
10382
10395
|
}
|
10383
10396
|
function configureReactTableOptions(options, props, localization) {
|
10384
10397
|
var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
|
10385
|
-
const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
|
10386
10398
|
// We don't want to expose internal Tanstack Table row, so we need to wrap enableRowSelection callback into additional function,
|
10387
10399
|
// which receives the React Table Row object and passes row.original to a callback.
|
10388
|
-
const reactTableEnableRowSelection = typeof enableRowSelection === 'function' ? row => enableRowSelection(row.original) : enableRowSelection;
|
10400
|
+
const reactTableEnableRowSelection = typeof options.enableRowSelection === 'function' ? row => options.enableRowSelection(row.original) : options.enableRowSelection;
|
10389
10401
|
const tableOptions = {
|
10390
10402
|
defaultColumn: {
|
10391
10403
|
enableColumnFilter: options.enableFiltering || true,
|
@@ -10405,7 +10417,6 @@ function configureReactTableOptions(options, props, localization) {
|
|
10405
10417
|
enableHiding: (_options$enableColumn2 = options.enableColumnHiding) !== null && _options$enableColumn2 !== void 0 ? _options$enableColumn2 : false,
|
10406
10418
|
enablePinning: (_options$enableColumn3 = options.enableColumnFreezing) !== null && _options$enableColumn3 !== void 0 ? _options$enableColumn3 : false,
|
10407
10419
|
enableRowSelection: reactTableEnableRowSelection !== null && reactTableEnableRowSelection !== void 0 ? reactTableEnableRowSelection : false,
|
10408
|
-
enableMultiRowSelection: !options.enableRowSelectionSingle && reactTableEnableRowSelection,
|
10409
10420
|
enableSorting: (_options$enableSortin = options.enableSorting) !== null && _options$enableSortin !== void 0 ? _options$enableSortin : false,
|
10410
10421
|
// models for default features
|
10411
10422
|
getExpandedRowModel: reactTable.getExpandedRowModel(),
|
@@ -10429,8 +10440,8 @@ function configureReactTableOptions(options, props, localization) {
|
|
10429
10440
|
tableOptions.getFilteredRowModel = reactTable.getFilteredRowModel();
|
10430
10441
|
tableOptions.globalFilterFn = (row, columnId, searchQuery) => globalFilterFn(row, columnId, searchQuery, localization);
|
10431
10442
|
tableOptions.getColumnCanGlobalFilter = column => {
|
10432
|
-
var _column$columnDef$met
|
10433
|
-
return (_column$columnDef$met =
|
10443
|
+
var _column$columnDef$met;
|
10444
|
+
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10434
10445
|
};
|
10435
10446
|
}
|
10436
10447
|
if (tableOptions.enableSorting) {
|
@@ -10490,7 +10501,6 @@ const DEFAULT_PRESET = {
|
|
10490
10501
|
enableColumnResizing: false,
|
10491
10502
|
enableRowExpansion: false,
|
10492
10503
|
enableRowSelection: false,
|
10493
|
-
enableRowSelectionSingle: false,
|
10494
10504
|
// custom -- common between all table types
|
10495
10505
|
enableColumnOrdering: false,
|
10496
10506
|
enableFontSize: false,
|
@@ -10517,7 +10527,6 @@ const presets = {
|
|
10517
10527
|
enableColumnResizing: true,
|
10518
10528
|
enableRowExpansion: true,
|
10519
10529
|
enableRowSelection: true,
|
10520
|
-
enableRowSelectionSingle: false,
|
10521
10530
|
// custom -- common between all table types
|
10522
10531
|
enableColumnOrdering: true,
|
10523
10532
|
enableFontSize: true,
|
@@ -10543,7 +10552,6 @@ const presets = {
|
|
10543
10552
|
enableColumnResizing: false,
|
10544
10553
|
enableRowExpansion: true,
|
10545
10554
|
enableRowSelection: true,
|
10546
|
-
enableRowSelectionSingle: false,
|
10547
10555
|
// custom -- common between all table types
|
10548
10556
|
enableColumnOrdering: false,
|
10549
10557
|
enableFontSize: false,
|
@@ -10569,7 +10577,6 @@ const presets = {
|
|
10569
10577
|
enableColumnResizing: false,
|
10570
10578
|
enableRowExpansion: true,
|
10571
10579
|
enableRowSelection: false,
|
10572
|
-
enableRowSelectionSingle: false,
|
10573
10580
|
// custom -- common between all table types
|
10574
10581
|
enableColumnOrdering: false,
|
10575
10582
|
enableFontSize: false,
|
@@ -10586,7 +10593,7 @@ const presets = {
|
|
10586
10593
|
}
|
10587
10594
|
};
|
10588
10595
|
function getTableFeaturePreset(props) {
|
10589
|
-
var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$
|
10596
|
+
var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
|
10590
10597
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10591
10598
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10592
10599
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10595,7 +10602,6 @@ function getTableFeaturePreset(props) {
|
|
10595
10602
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10596
10603
|
const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
|
10597
10604
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10598
|
-
const enableRowSelectionSingle = (_props$enableRowSelec2 = props.enableRowSelectionSingle) !== null && _props$enableRowSelec2 !== void 0 ? _props$enableRowSelec2 : presetOptions.enableRowSelectionSingle;
|
10599
10605
|
return {
|
10600
10606
|
// react-table built-in
|
10601
10607
|
enableFiltering: (_props$enableFilterin = props.enableFiltering) !== null && _props$enableFilterin !== void 0 ? _props$enableFilterin : presetOptions.enableFiltering,
|
@@ -10606,7 +10612,6 @@ function getTableFeaturePreset(props) {
|
|
10606
10612
|
enableColumnResizing: (_props$enableColumnRe = props.enableColumnResizing) !== null && _props$enableColumnRe !== void 0 ? _props$enableColumnRe : presetOptions.enableColumnResizing,
|
10607
10613
|
enableRowExpansion: enableRowExpansion && !!props.rowExpansionRenderer,
|
10608
10614
|
enableRowSelection: !!props.onRowSelect && enableRowSelection,
|
10609
|
-
enableRowSelectionSingle: !!props.onRowSelect && enableRowSelectionSingle,
|
10610
10615
|
// custom -- common between all table types
|
10611
10616
|
enableColumnOrdering: (_props$enableColumnOr = props.enableColumnOrdering) !== null && _props$enableColumnOr !== void 0 ? _props$enableColumnOr : presetOptions.enableColumnOrdering,
|
10612
10617
|
enableFontSize: (_props$enableFontSize = props.enableFontSize) !== null && _props$enableFontSize !== void 0 ? _props$enableFontSize : presetOptions.enableFontSize,
|
@@ -11536,25 +11541,31 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11536
11541
|
const rowSelection = React__default.useMemo(() => rows.map(row => row.original), [rows]);
|
11537
11542
|
useLazyEffect(() => {
|
11538
11543
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11539
|
-
|
11540
|
-
onRowSelect(rowSelection);
|
11541
|
-
} else {
|
11542
|
-
var _ref;
|
11543
|
-
onRowSelect((_ref = [rowSelection[0]]) !== null && _ref !== void 0 ? _ref : []);
|
11544
|
-
}
|
11544
|
+
onRowSelect(rowSelection);
|
11545
11545
|
}
|
11546
11546
|
/**
|
11547
|
-
* Casting to a boolean, since enableRowSelection
|
11547
|
+
* Casting to a boolean, since enableRowSelection can be a function,
|
11548
11548
|
* and setting a function as depoendency will lead to infinity loop. And in case of row selection useEffect,
|
11549
|
-
* we only need to know if selection was enabled or disabled, because enableRowSelection
|
11549
|
+
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11550
11550
|
* will be applied directly to particular rows.
|
11551
11551
|
*/
|
11552
|
-
}, [!!table.options.enableRowSelection,
|
11552
|
+
}, [!!table.options.enableRowSelection, JSON.stringify(rowSelection)]);
|
11553
11553
|
}
|
11554
11554
|
|
11555
11555
|
function useTableSearchListener(table, onChangeSearch) {
|
11556
11556
|
const meta = table.options.meta;
|
11557
11557
|
const localization = useLocalization();
|
11558
|
+
const visibleColumns = table.getVisibleFlatColumns();
|
11559
|
+
// Need to re-run search when columns are getting shown/hidden.
|
11560
|
+
React__default.useEffect(() => {
|
11561
|
+
if (meta.search.isEnabled && visibleColumns.length > 0) {
|
11562
|
+
const currentFilter = table.getState().globalFilter;
|
11563
|
+
requestAnimationFrame(() => {
|
11564
|
+
table.resetGlobalFilter();
|
11565
|
+
table.setGlobalFilter(currentFilter);
|
11566
|
+
});
|
11567
|
+
}
|
11568
|
+
}, [visibleColumns.length]);
|
11558
11569
|
// recalculates highlighted indexes whenever something important changes
|
11559
11570
|
React__default.useEffect(() => {
|
11560
11571
|
if (meta.search.isEnabled) {
|
@@ -11564,7 +11575,7 @@ function useTableSearchListener(table, onChangeSearch) {
|
|
11564
11575
|
onChangeSearch(query);
|
11565
11576
|
}
|
11566
11577
|
}
|
11567
|
-
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting),
|
11578
|
+
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), onChangeSearch]);
|
11568
11579
|
}
|
11569
11580
|
|
11570
11581
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -12288,7 +12299,6 @@ function Actions$1(props) {
|
|
12288
12299
|
actions,
|
12289
12300
|
actionsLength,
|
12290
12301
|
data,
|
12291
|
-
fontSize,
|
12292
12302
|
isActiveRow,
|
12293
12303
|
rowId
|
12294
12304
|
} = props;
|
@@ -12298,11 +12308,7 @@ function Actions$1(props) {
|
|
12298
12308
|
const visibleActions = actions.map(action => action(data, rowId)).filter(action => !!action);
|
12299
12309
|
const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
|
12300
12310
|
const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
|
12301
|
-
const className = cn('
|
12302
|
-
// Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
|
12303
|
-
'-mt-2': fontSize === exports.FontSizes.small,
|
12304
|
-
'-mt-1.5': fontSize !== exports.FontSizes.small
|
12305
|
-
});
|
12311
|
+
const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
|
12306
12312
|
return /*#__PURE__*/React__default.createElement("span", {
|
12307
12313
|
className: className
|
12308
12314
|
}, actionsOnRow.map((button, index) => {
|
@@ -12354,7 +12360,6 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
12354
12360
|
actions: actions,
|
12355
12361
|
actionsLength: actionsLength,
|
12356
12362
|
data: row.original,
|
12357
|
-
fontSize: tableMeta.fontSize.size,
|
12358
12363
|
isActiveRow: isActiveRow,
|
12359
12364
|
rowId: row.id
|
12360
12365
|
});
|
@@ -12472,39 +12477,36 @@ function Header$4(context) {
|
|
12472
12477
|
table
|
12473
12478
|
} = context;
|
12474
12479
|
const tableMeta = table.options.meta;
|
12475
|
-
|
12476
|
-
|
12477
|
-
|
12478
|
-
|
12479
|
-
|
12480
|
-
|
12481
|
-
|
12482
|
-
table.toggleAllRowsSelected(checked);
|
12483
|
-
}
|
12484
|
-
const _temp = function () {
|
12485
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
12486
|
-
// don't pass the search query because we need all data - not filtered data
|
12487
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12488
|
-
}
|
12489
|
-
}();
|
12490
|
-
// load all data if that is possible
|
12491
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
12492
|
-
} catch (e) {
|
12493
|
-
return Promise.reject(e);
|
12480
|
+
const isAllRowsSelected = table.getIsAllRowsSelected();
|
12481
|
+
const isSomeRowsSelected = table.getIsSomeRowsSelected();
|
12482
|
+
const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;
|
12483
|
+
const handleChange = function (checked) {
|
12484
|
+
try {
|
12485
|
+
function _temp2() {
|
12486
|
+
table.toggleAllRowsSelected(checked);
|
12494
12487
|
}
|
12495
|
-
|
12496
|
-
|
12497
|
-
|
12498
|
-
|
12499
|
-
|
12500
|
-
|
12501
|
-
|
12502
|
-
|
12503
|
-
|
12504
|
-
|
12505
|
-
}
|
12506
|
-
}
|
12507
|
-
return
|
12488
|
+
const _temp = function () {
|
12489
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12490
|
+
// don't pass the search query because we need all data - not filtered data
|
12491
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12492
|
+
}
|
12493
|
+
}();
|
12494
|
+
// load all data if that is possible
|
12495
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
12496
|
+
} catch (e) {
|
12497
|
+
return Promise.reject(e);
|
12498
|
+
}
|
12499
|
+
};
|
12500
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
12501
|
+
title: title
|
12502
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
12503
|
+
"aria-label": title,
|
12504
|
+
className: "hover:border-blue !-mt-px",
|
12505
|
+
checked: isAllRowsSelected,
|
12506
|
+
indeterminate: isSomeRowsSelected && !isAllRowsSelected,
|
12507
|
+
loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
|
12508
|
+
onChange: handleChange
|
12509
|
+
}));
|
12508
12510
|
}
|
12509
12511
|
const toggleBetween = (fromRowIndex, toRowIndex) => {
|
12510
12512
|
const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;
|
@@ -12530,83 +12532,64 @@ function Cell$3(context) {
|
|
12530
12532
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
12531
12533
|
const canSelect = row.getCanSelect();
|
12532
12534
|
const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;
|
12533
|
-
|
12534
|
-
|
12535
|
-
|
12536
|
-
|
12537
|
-
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
12538
|
-
}
|
12539
|
-
event.stopPropagation();
|
12540
|
-
const _temp6 = function () {
|
12541
|
-
if (row.getIsGrouped()) {
|
12542
|
-
row.subRows.forEach(row => row.toggleSelected());
|
12543
|
-
} else {
|
12544
|
-
const _temp5 = function () {
|
12545
|
-
if (event.shiftKey) {
|
12546
|
-
var _tableMeta$rowSelecti;
|
12547
|
-
function _temp4() {
|
12548
|
-
table.setRowSelection(currentRowSelection => ({
|
12549
|
-
...currentRowSelection,
|
12550
|
-
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
12551
|
-
...state,
|
12552
|
-
[row.id]: true
|
12553
|
-
}), {})
|
12554
|
-
}));
|
12555
|
-
}
|
12556
|
-
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12557
|
-
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12558
|
-
const _temp3 = function () {
|
12559
|
-
if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
|
12560
|
-
// don't pass the search query because we need all data - not filtered data
|
12561
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12562
|
-
}
|
12563
|
-
}();
|
12564
|
-
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
12565
|
-
} else {
|
12566
|
-
row.toggleSelected();
|
12567
|
-
}
|
12568
|
-
}();
|
12569
|
-
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
12570
|
-
}
|
12571
|
-
}();
|
12572
|
-
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
12573
|
-
} catch (e) {
|
12574
|
-
return Promise.reject(e);
|
12535
|
+
const handleClick = function (event) {
|
12536
|
+
try {
|
12537
|
+
function _temp7() {
|
12538
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
12575
12539
|
}
|
12576
|
-
};
|
12577
|
-
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
12578
|
-
hidden: !canSelect,
|
12579
|
-
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
12580
|
-
className: "ml-2",
|
12581
|
-
keys: "Space"
|
12582
|
-
}))
|
12583
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
12584
|
-
"aria-label": title,
|
12585
|
-
className: "!mt-0",
|
12586
|
-
checked: isSelected,
|
12587
|
-
onClick: handleClick,
|
12588
|
-
disabled: !canSelect,
|
12589
|
-
// this is necessary to remove console spam from eslint
|
12590
|
-
onChange: () => false
|
12591
|
-
}));
|
12592
|
-
} else {
|
12593
|
-
const className = cn('!mt-0', getRadioClassnames(!canSelect));
|
12594
|
-
const handleClick = event => {
|
12595
12540
|
event.stopPropagation();
|
12596
|
-
|
12597
|
-
|
12598
|
-
|
12599
|
-
|
12600
|
-
|
12601
|
-
|
12602
|
-
|
12603
|
-
|
12604
|
-
|
12605
|
-
|
12606
|
-
|
12607
|
-
|
12608
|
-
|
12609
|
-
|
12541
|
+
const _temp6 = function () {
|
12542
|
+
if (row.getIsGrouped()) {
|
12543
|
+
row.subRows.forEach(row => row.toggleSelected());
|
12544
|
+
} else {
|
12545
|
+
const _temp5 = function () {
|
12546
|
+
if (event.shiftKey) {
|
12547
|
+
var _tableMeta$rowSelecti;
|
12548
|
+
function _temp4() {
|
12549
|
+
table.setRowSelection(currentRowSelection => ({
|
12550
|
+
...currentRowSelection,
|
12551
|
+
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
12552
|
+
...state,
|
12553
|
+
[row.id]: true
|
12554
|
+
}), {})
|
12555
|
+
}));
|
12556
|
+
}
|
12557
|
+
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12558
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12559
|
+
const _temp3 = function () {
|
12560
|
+
if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
|
12561
|
+
// don't pass the search query because we need all data - not filtered data
|
12562
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12563
|
+
}
|
12564
|
+
}();
|
12565
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
12566
|
+
} else {
|
12567
|
+
row.toggleSelected();
|
12568
|
+
}
|
12569
|
+
}();
|
12570
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
12571
|
+
}
|
12572
|
+
}();
|
12573
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
12574
|
+
} catch (e) {
|
12575
|
+
return Promise.reject(e);
|
12576
|
+
}
|
12577
|
+
};
|
12578
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
12579
|
+
hidden: !canSelect,
|
12580
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
12581
|
+
className: "ml-2",
|
12582
|
+
keys: "Space"
|
12583
|
+
}))
|
12584
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
12585
|
+
"aria-label": title,
|
12586
|
+
className: "!mt-0",
|
12587
|
+
checked: isSelected,
|
12588
|
+
onClick: handleClick,
|
12589
|
+
disabled: !canSelect,
|
12590
|
+
// this is necessary to remove console spam from eslint
|
12591
|
+
onChange: () => false
|
12592
|
+
}));
|
12610
12593
|
}
|
12611
12594
|
const renderer$3 = {
|
12612
12595
|
header: Header$4,
|
@@ -12751,7 +12734,6 @@ function GroupedCell(props) {
|
|
12751
12734
|
canShowActions: canShowActions,
|
12752
12735
|
cellRef: cellRef,
|
12753
12736
|
colSpan: colSpan,
|
12754
|
-
fontSize: tableMeta.fontSize.size,
|
12755
12737
|
rowActions: tableMeta.rowGroups.rowActionsForGroup,
|
12756
12738
|
rowId: cell.row.id,
|
12757
12739
|
subRows: subRows
|
@@ -12763,7 +12745,6 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12763
12745
|
cellRef,
|
12764
12746
|
children,
|
12765
12747
|
colSpan,
|
12766
|
-
fontSize,
|
12767
12748
|
rowActions,
|
12768
12749
|
rowId,
|
12769
12750
|
subRows,
|
@@ -12780,7 +12761,6 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
12780
12761
|
actions: rowActions,
|
12781
12762
|
actionsLength: 4,
|
12782
12763
|
data: subRows,
|
12783
|
-
fontSize: fontSize,
|
12784
12764
|
isActiveRow: true,
|
12785
12765
|
rowId: rowId
|
12786
12766
|
})) : null);
|
@@ -15849,7 +15829,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15849
15829
|
style: {
|
15850
15830
|
minWidth: dimensions !== null && dimensions !== void 0 && dimensions.width ? `${dimensions.width}px` : undefined
|
15851
15831
|
}
|
15852
|
-
}, flattenedChildren.length >
|
15832
|
+
}, flattenedChildren.length > 5 || isInlineCreation ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
|
15853
15833
|
placeholder: isInlineCreation ? texts.select2.searchOrCreate : texts.select2.search,
|
15854
15834
|
ref: searchRef,
|
15855
15835
|
onTabKeyPress: () => setTabTriggeredClose(true)
|
@@ -16756,6 +16736,8 @@ function TableGrid(props) {
|
|
16756
16736
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
16757
16737
|
} : undefined;
|
16758
16738
|
const filterReason = getFilterReason(table);
|
16739
|
+
const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
|
16740
|
+
const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
|
16759
16741
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
|
16760
16742
|
id: table.id,
|
16761
16743
|
"data-table-font-size": table.meta.fontSize.size,
|
@@ -16788,7 +16770,7 @@ function TableGrid(props) {
|
|
16788
16770
|
...table.renderer.style,
|
16789
16771
|
height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
|
16790
16772
|
} : table.renderer.style
|
16791
|
-
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16773
|
+
}, table.renderer.rows, searchNotApplied && filtersNotApplied && props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16792
16774
|
table: table.instance
|
16793
16775
|
}) : null)))));
|
16794
16776
|
}
|
@@ -18293,6 +18275,8 @@ const useTableRowCreation = (data, tableRef) => {
|
|
18293
18275
|
|
18294
18276
|
function useTableEditingListener(table, tableRef) {
|
18295
18277
|
const tableMeta = table.options.meta;
|
18278
|
+
const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
|
18279
|
+
const localization = useLocalization();
|
18296
18280
|
const saveChanges = () => {
|
18297
18281
|
requestAnimationFrame(() => {
|
18298
18282
|
tableMeta.editing.saveChanges();
|
@@ -18333,6 +18317,11 @@ function useTableEditingListener(table, tableRef) {
|
|
18333
18317
|
window.removeEventListener('beforeunload', showUnsavedChangesWarning);
|
18334
18318
|
};
|
18335
18319
|
}, [tableMeta.editing.isEditing, hasChanges]);
|
18320
|
+
React__default.useEffect(() => {
|
18321
|
+
if (completedRowsCount > 0) {
|
18322
|
+
resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
|
18323
|
+
}
|
18324
|
+
}, [completedRowsCount]);
|
18336
18325
|
React__default.useEffect(() => {
|
18337
18326
|
const onClickOutside = event => {
|
18338
18327
|
if (tableMeta.editing.isEditing) {
|
@@ -18545,14 +18534,13 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18545
18534
|
}
|
18546
18535
|
if (rowError || cellErrors) {
|
18547
18536
|
setPendingChanges(currentChanges => {
|
18548
|
-
var _nextChanges$rowId$_m, _nextChanges$rowId$_m2;
|
18549
18537
|
const nextChanges = {
|
18550
18538
|
...currentChanges
|
18551
18539
|
};
|
18552
18540
|
nextChanges[rowId]._meta.errors = {
|
18553
18541
|
row: rowError,
|
18554
18542
|
cells: cellErrors,
|
18555
|
-
|
18543
|
+
shouldShowErrorAlert: true
|
18556
18544
|
};
|
18557
18545
|
return nextChanges;
|
18558
18546
|
});
|
@@ -18587,7 +18575,7 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18587
18575
|
errors: {
|
18588
18576
|
...nextChanges[cell.row.id]._meta.errors,
|
18589
18577
|
cells: errors,
|
18590
|
-
|
18578
|
+
shouldShowErrorAlert: !Object.keys(errors).length ? false : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert
|
18591
18579
|
}
|
18592
18580
|
};
|
18593
18581
|
return nextChanges;
|
@@ -18675,22 +18663,18 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18675
18663
|
if (!isEnabled) {
|
18676
18664
|
return false;
|
18677
18665
|
}
|
18678
|
-
return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.
|
18666
|
+
return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.shouldShowErrorAlert);
|
18679
18667
|
}
|
18680
|
-
function
|
18681
|
-
|
18682
|
-
if (
|
18683
|
-
|
18684
|
-
|
18685
|
-
|
18686
|
-
|
18687
|
-
|
18688
|
-
...nextChanges[rowId]._meta.errors,
|
18689
|
-
hasShownErrorAlert: true
|
18690
|
-
};
|
18691
|
-
return nextChanges;
|
18692
|
-
});
|
18668
|
+
function getRowPendingChange(rowId) {
|
18669
|
+
const rowPendingChanges = pendingChanges[rowId];
|
18670
|
+
if (rowPendingChanges) {
|
18671
|
+
const {
|
18672
|
+
_meta,
|
18673
|
+
...pendingChange
|
18674
|
+
} = rowPendingChanges;
|
18675
|
+
return pendingChange;
|
18693
18676
|
}
|
18677
|
+
return undefined;
|
18694
18678
|
}
|
18695
18679
|
function getRowSaveStatus(rowId) {
|
18696
18680
|
if (!isEnabled) {
|
@@ -18712,8 +18696,8 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18712
18696
|
});
|
18713
18697
|
}
|
18714
18698
|
function getRowMoveReason(rowId) {
|
18715
|
-
var _pendingChanges$
|
18716
|
-
return (_pendingChanges$
|
18699
|
+
var _pendingChanges$rowId7;
|
18700
|
+
return (_pendingChanges$rowId7 = pendingChanges[rowId]) !== null && _pendingChanges$rowId7 !== void 0 && _pendingChanges$rowId7._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
|
18717
18701
|
}
|
18718
18702
|
function hasChanges(rowId) {
|
18719
18703
|
if (!isEnabled) {
|
@@ -18721,28 +18705,14 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18721
18705
|
}
|
18722
18706
|
return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;
|
18723
18707
|
}
|
18724
|
-
function
|
18725
|
-
var _tableRef$current;
|
18708
|
+
function hasAlertErrors() {
|
18726
18709
|
if (!isEnabled) {
|
18727
18710
|
return false;
|
18728
18711
|
}
|
18729
|
-
|
18730
|
-
const focusIsInsideTable = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.contains(document.activeElement);
|
18731
|
-
let activeRow;
|
18732
|
-
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
18733
|
-
activeRow = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex];
|
18734
|
-
}
|
18735
|
-
return Object.keys(getErrors().filter(error => {
|
18736
|
-
var _activeRow;
|
18737
|
-
if ((_activeRow = activeRow) !== null && _activeRow !== void 0 && _activeRow.id && focusIsInsideTable) {
|
18738
|
-
var _activeRow2, _error$pendingChange$;
|
18739
|
-
return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? (_error$pendingChange$ = error.pendingChange._meta.errors) === null || _error$pendingChange$ === void 0 ? void 0 : _error$pendingChange$.hasShownErrorAlert : true;
|
18740
|
-
}
|
18741
|
-
return true;
|
18742
|
-
})).length;
|
18712
|
+
return !!getAlertErrors().length;
|
18743
18713
|
}
|
18744
|
-
function
|
18745
|
-
return Object.keys(pendingChanges).filter(
|
18714
|
+
function getAlertErrors() {
|
18715
|
+
return Object.keys(pendingChanges).filter(hasRowErrorsSeen).map(rowId => ({
|
18746
18716
|
rowId,
|
18747
18717
|
pendingChange: pendingChanges[rowId]
|
18748
18718
|
}));
|
@@ -18756,6 +18726,9 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18756
18726
|
return nextChanges;
|
18757
18727
|
});
|
18758
18728
|
}
|
18729
|
+
function getCompletedRowsCount() {
|
18730
|
+
return Object.values(saveStates).filter(value => value === 'complete').length;
|
18731
|
+
}
|
18759
18732
|
return {
|
18760
18733
|
getCellValue,
|
18761
18734
|
getCellError,
|
@@ -18763,16 +18736,17 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
18763
18736
|
validateCell,
|
18764
18737
|
addCreatedRowChangeset,
|
18765
18738
|
hasChanges,
|
18766
|
-
|
18767
|
-
|
18739
|
+
hasAlertErrors,
|
18740
|
+
getAlertErrors,
|
18768
18741
|
saveChanges,
|
18769
18742
|
resetChanges,
|
18770
18743
|
hasRowErrors,
|
18771
18744
|
hasRowErrorsSeen,
|
18772
|
-
|
18745
|
+
getRowPendingChange,
|
18773
18746
|
getRowSaveStatus,
|
18774
18747
|
setRowSaveStatus,
|
18775
|
-
getRowMoveReason
|
18748
|
+
getRowMoveReason,
|
18749
|
+
getCompletedRowsCount
|
18776
18750
|
};
|
18777
18751
|
}
|
18778
18752
|
function useLastFocusedCellIndex() {
|
@@ -18844,12 +18818,16 @@ function createPendingChangesSetter(currentChanges, row, rowIndex, changes, loca
|
|
18844
18818
|
// otherwise remove any change - no point saving the same value
|
18845
18819
|
if (change !== row.original[accessor]) {
|
18846
18820
|
rowChanges[accessor] = change;
|
18847
|
-
//
|
18848
|
-
|
18849
|
-
if (
|
18850
|
-
|
18851
|
-
|
18852
|
-
|
18821
|
+
// consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
|
18822
|
+
// eslint-disable-next-line no-prototype-builtins
|
18823
|
+
if (cells.hasOwnProperty(accessor)) {
|
18824
|
+
// determine if the row will move position based on this change, and save why it will move
|
18825
|
+
const reason = willRowMove(cells[accessor], change, rowIndex, localization);
|
18826
|
+
if (reason) {
|
18827
|
+
rowChanges._meta.moveReason[accessor] = reason;
|
18828
|
+
} else {
|
18829
|
+
delete rowChanges._meta.moveReason[accessor];
|
18830
|
+
}
|
18853
18831
|
}
|
18854
18832
|
} else {
|
18855
18833
|
delete rowChanges[accessor];
|
@@ -19078,7 +19056,7 @@ function useEditingCellAutofocus(props) {
|
|
19078
19056
|
(_props$cellRef$curren2 = props.cellRef.current) === null || _props$cellRef$curren2 === void 0 ? void 0 : _props$cellRef$curren2.focus();
|
19079
19057
|
}
|
19080
19058
|
}
|
19081
|
-
}, [
|
19059
|
+
}, [tableMeta.rowActive.rowActiveIndex]);
|
19082
19060
|
// when the cell receives focus we actually want to focus the control inside it...
|
19083
19061
|
const handleFocus = event => {
|
19084
19062
|
var _props$cellRef$curren3;
|
@@ -19089,11 +19067,12 @@ function useEditingCellAutofocus(props) {
|
|
19089
19067
|
const tableRect = tableElement.getBoundingClientRect();
|
19090
19068
|
const leftOffsetFromScrollContainer = targetRect.left - tableRect.left;
|
19091
19069
|
const scrollbarWidth = tableElement.offsetWidth - tableElement.clientWidth; // the width of table vertical scrollbar
|
19070
|
+
const isFocusedElementMenu = event.currentTarget.getAttribute('data-cell-id') === '__actions';
|
19092
19071
|
if (
|
19093
19072
|
// When pinned column overlaps the focused cell
|
19094
|
-
leftOffsetFromScrollContainer < columnFreezingOffset ||
|
19073
|
+
(leftOffsetFromScrollContainer < columnFreezingOffset ||
|
19095
19074
|
// When focused cell goes behidn the edge of the table
|
19096
|
-
leftOffsetFromScrollContainer + targetRect.width > tableRect.width - scrollbarWidth) {
|
19075
|
+
leftOffsetFromScrollContainer + targetRect.width > tableRect.width - scrollbarWidth) && !isFocusedElementMenu) {
|
19097
19076
|
tableElement.scrollTo(props.cell.column.getStart() - columnFreezingOffset, tableElement.scrollTop);
|
19098
19077
|
}
|
19099
19078
|
}
|
@@ -19143,6 +19122,7 @@ function EditingControlCell(props) {
|
|
19143
19122
|
onBlur: handleBlur,
|
19144
19123
|
onChange: value => tableMeta.editing.setCellValue(cell, value, rowIndex),
|
19145
19124
|
row: cell.row.original,
|
19125
|
+
rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),
|
19146
19126
|
tabIndex: isActiveRow ? 0 : -1,
|
19147
19127
|
toggleEditing: tableMeta.editing.toggleEditing,
|
19148
19128
|
toggleDetailedMode: tableMeta.editing.toggleDetailedMode,
|
@@ -19177,6 +19157,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19177
19157
|
onBlur,
|
19178
19158
|
onChange,
|
19179
19159
|
row,
|
19160
|
+
rowPendingChanges,
|
19180
19161
|
tabIndex = -1,
|
19181
19162
|
toggleEditing,
|
19182
19163
|
toggleDetailedMode,
|
@@ -19197,7 +19178,10 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
19197
19178
|
setValue: onChange,
|
19198
19179
|
value
|
19199
19180
|
};
|
19200
|
-
return type(controlFnProps,
|
19181
|
+
return type(controlFnProps, {
|
19182
|
+
...row,
|
19183
|
+
...rowPendingChanges
|
19184
|
+
});
|
19201
19185
|
}
|
19202
19186
|
if (type === 'switch') {
|
19203
19187
|
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
@@ -19363,13 +19347,21 @@ function EditingActionMenu(props) {
|
|
19363
19347
|
handleSave();
|
19364
19348
|
}
|
19365
19349
|
};
|
19350
|
+
const handleMenuContentKeyDown = event => {
|
19351
|
+
// Stops the keyboard event from propagating to the Table when EditActionsMenu is open
|
19352
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
19353
|
+
event.stopPropagation();
|
19354
|
+
}
|
19355
|
+
};
|
19366
19356
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
19367
19357
|
appearance: "transparent",
|
19368
19358
|
"aria-label": texts.table3.editing.actions.tooltip,
|
19369
19359
|
className: "group-[[data-row-editing-status]]/row:hidden",
|
19370
19360
|
icon: "more",
|
19371
19361
|
onKeyDown: handleKeyDown,
|
19372
|
-
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content,
|
19362
|
+
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
19363
|
+
onKeyDown: handleMenuContentKeyDown
|
19364
|
+
}, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
19373
19365
|
icon: "tick",
|
19374
19366
|
disabled: !hasChanges || hasErrors,
|
19375
19367
|
onClick: handleSave
|
@@ -19393,14 +19385,20 @@ function ConfirmClearChangesDialog(props) {
|
|
19393
19385
|
const {
|
19394
19386
|
texts
|
19395
19387
|
} = useLocalization();
|
19388
|
+
const handleClickInsideDialogContent = event => {
|
19389
|
+
// Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
|
19390
|
+
// inside the dialog
|
19391
|
+
event.stopPropagation();
|
19392
|
+
};
|
19396
19393
|
return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
|
19397
|
-
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title
|
19394
|
+
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
19395
|
+
onClick: handleClickInsideDialogContent
|
19398
19396
|
}, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19399
19397
|
tabIndex: 0
|
19400
19398
|
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
19399
|
+
autoFocus: true,
|
19401
19400
|
tabIndex: 0,
|
19402
19401
|
appearance: "primary",
|
19403
|
-
autoFocus: true,
|
19404
19402
|
onClick: handleClear
|
19405
19403
|
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
19406
19404
|
}
|
@@ -19441,12 +19439,14 @@ function SaveStatus(props) {
|
|
19441
19439
|
title: texts.table3.editing.saving.progress
|
19442
19440
|
}, /*#__PURE__*/React__default.createElement(Spinner, {
|
19443
19441
|
delay: 0,
|
19444
|
-
className: "
|
19442
|
+
className: "mr-1 !h-5 !w-5"
|
19445
19443
|
}))) : (/*#__PURE__*/React__default.createElement(Tooltip, {
|
19446
19444
|
title: texts.table3.editing.saving.complete
|
19447
|
-
}, /*#__PURE__*/React__default.createElement(
|
19448
|
-
|
19449
|
-
|
19445
|
+
}, /*#__PURE__*/React__default.createElement(BadgeIcon, {
|
19446
|
+
icon: "tick",
|
19447
|
+
color: "green",
|
19448
|
+
subtle: true,
|
19449
|
+
className: "mr-1"
|
19450
19450
|
})))));
|
19451
19451
|
}
|
19452
19452
|
|
@@ -19530,17 +19530,7 @@ function Alert$1(props) {
|
|
19530
19530
|
const validationTexts = texts.table3.editing.validation;
|
19531
19531
|
const tableMeta = table.options.meta;
|
19532
19532
|
const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
|
19533
|
-
const pendingChangesWithErrors = tableMeta.editing.
|
19534
|
-
const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
|
19535
|
-
// mark errors being rendered as seen
|
19536
|
-
React__default.useEffect(() => {
|
19537
|
-
pendingChangesWithErrors.forEach(error => {
|
19538
|
-
if (activeRow && error.rowId === activeRow.id) {
|
19539
|
-
return;
|
19540
|
-
}
|
19541
|
-
tableMeta.editing.setRowErrorsSeen(error.rowId);
|
19542
|
-
});
|
19543
|
-
}, [pendingChangesWithErrors]);
|
19533
|
+
const pendingChangesWithErrors = tableMeta.editing.getAlertErrors();
|
19544
19534
|
function scrollToRow(rowIndex) {
|
19545
19535
|
tableMeta.rowActive.setRowActiveIndex(rowIndex);
|
19546
19536
|
scrollToIndex(rowIndex, {
|
@@ -19662,7 +19652,7 @@ function CreateNewRowButton(props) {
|
|
19662
19652
|
});
|
19663
19653
|
const handleKeyDown = event => {
|
19664
19654
|
if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
|
19665
|
-
|
19655
|
+
tableMeta.editing.saveChanges();
|
19666
19656
|
}
|
19667
19657
|
};
|
19668
19658
|
const handleCreate = function () {
|
@@ -19784,14 +19774,14 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
19784
19774
|
'data-table-editing-mode': (_table3$meta$editing = table3.meta.editing) !== null && _table3$meta$editing !== void 0 && _table3$meta$editing.isEditing ? (_table3$meta$editing2 = table3.meta.editing) !== null && _table3$meta$editing2 !== void 0 && _table3$meta$editing2.isDetailedMode ? 'detailed' : 'normal' : undefined,
|
19785
19775
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
19786
19776
|
};
|
19787
|
-
const
|
19777
|
+
const hasAlertErrors = table3.meta.editing.hasAlertErrors();
|
19788
19778
|
const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;
|
19789
19779
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
19790
19780
|
table: table3
|
19791
19781
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
19792
19782
|
scrollToIndex: table3.renderer.scrollToIndex,
|
19793
19783
|
table: table3.instance
|
19794
|
-
})) : null),
|
19784
|
+
})) : null), hasAlertErrors ? (/*#__PURE__*/React__default.createElement(Alert$1, {
|
19795
19785
|
className: "mb-4",
|
19796
19786
|
scrollToIndex: table3.renderer.scrollToIndex,
|
19797
19787
|
table: table3.instance,
|