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