@economic/taco 2.43.1 → 2.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +9 -6
- 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 +224 -231
- 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);
|
|
@@ -15817,8 +15797,12 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
15817
15797
|
setValue(nextValue);
|
|
15818
15798
|
}
|
|
15819
15799
|
};
|
|
15820
|
-
const
|
|
15821
|
-
const
|
|
15800
|
+
const hasInlineCreation = onCreate && !createDialog;
|
|
15801
|
+
const hasSearch = flattenedChildren.length > 5 || hasInlineCreation;
|
|
15802
|
+
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md ', {
|
|
15803
|
+
'focus-within:yt-focus': !hasSearch,
|
|
15804
|
+
'outline-none': hasSearch
|
|
15805
|
+
}, createCollectionClassName());
|
|
15822
15806
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
|
15823
15807
|
value: context
|
|
15824
15808
|
}, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Root, {
|
|
@@ -15849,8 +15833,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
15849
15833
|
style: {
|
|
15850
15834
|
minWidth: dimensions !== null && dimensions !== void 0 && dimensions.width ? `${dimensions.width}px` : undefined
|
|
15851
15835
|
}
|
|
15852
|
-
},
|
|
15853
|
-
placeholder:
|
|
15836
|
+
}, hasSearch ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
|
|
15837
|
+
placeholder: hasInlineCreation ? texts.select2.searchOrCreate : texts.select2.search,
|
|
15854
15838
|
ref: searchRef,
|
|
15855
15839
|
onTabKeyPress: () => setTabTriggeredClose(true)
|
|
15856
15840
|
}), multiple && selectOptions.length > 1 && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
@@ -15872,7 +15856,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
15872
15856
|
className: "text-grey-700 -mt-0.5 flex h-8 items-center px-2",
|
|
15873
15857
|
role: "presentation"
|
|
15874
15858
|
}, texts.listbox.empty)) : (/*#__PURE__*/React__default.createElement(Root$1, {
|
|
15875
|
-
className: "flex flex-col gap-0.5",
|
|
15859
|
+
className: "flex flex-col gap-0.5 focus-visible:outline-none",
|
|
15876
15860
|
customSelector: ":scope > button",
|
|
15877
15861
|
disabled: disabled,
|
|
15878
15862
|
multiple: multiple,
|
|
@@ -15880,7 +15864,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
15880
15864
|
readOnly: readOnly,
|
|
15881
15865
|
ref: listboxRef,
|
|
15882
15866
|
setValue: setValue,
|
|
15883
|
-
tabIndex: -1,
|
|
15884
15867
|
value: value
|
|
15885
15868
|
}, searchQuery === '' ? (/*#__PURE__*/React__default.createElement(Collection$1, null, initialChildren)) : (/*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren)), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
|
15886
15869
|
onCreate: onCreate,
|
|
@@ -16756,6 +16739,8 @@ function TableGrid(props) {
|
|
|
16756
16739
|
table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
|
|
16757
16740
|
} : undefined;
|
|
16758
16741
|
const filterReason = getFilterReason(table);
|
|
16742
|
+
const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
|
|
16743
|
+
const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
|
|
16759
16744
|
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
16745
|
id: table.id,
|
|
16761
16746
|
"data-table-font-size": table.meta.fontSize.size,
|
|
@@ -16788,7 +16773,7 @@ function TableGrid(props) {
|
|
|
16788
16773
|
...table.renderer.style,
|
|
16789
16774
|
height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
|
|
16790
16775
|
} : table.renderer.style
|
|
16791
|
-
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
|
16776
|
+
}, table.renderer.rows, searchNotApplied && filtersNotApplied && props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
|
16792
16777
|
table: table.instance
|
|
16793
16778
|
}) : null)))));
|
|
16794
16779
|
}
|
|
@@ -18293,6 +18278,8 @@ const useTableRowCreation = (data, tableRef) => {
|
|
|
18293
18278
|
|
|
18294
18279
|
function useTableEditingListener(table, tableRef) {
|
|
18295
18280
|
const tableMeta = table.options.meta;
|
|
18281
|
+
const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
|
|
18282
|
+
const localization = useLocalization();
|
|
18296
18283
|
const saveChanges = () => {
|
|
18297
18284
|
requestAnimationFrame(() => {
|
|
18298
18285
|
tableMeta.editing.saveChanges();
|
|
@@ -18333,6 +18320,11 @@ function useTableEditingListener(table, tableRef) {
|
|
|
18333
18320
|
window.removeEventListener('beforeunload', showUnsavedChangesWarning);
|
|
18334
18321
|
};
|
|
18335
18322
|
}, [tableMeta.editing.isEditing, hasChanges]);
|
|
18323
|
+
React__default.useEffect(() => {
|
|
18324
|
+
if (completedRowsCount > 0) {
|
|
18325
|
+
resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
|
|
18326
|
+
}
|
|
18327
|
+
}, [completedRowsCount]);
|
|
18336
18328
|
React__default.useEffect(() => {
|
|
18337
18329
|
const onClickOutside = event => {
|
|
18338
18330
|
if (tableMeta.editing.isEditing) {
|
|
@@ -18545,14 +18537,13 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18545
18537
|
}
|
|
18546
18538
|
if (rowError || cellErrors) {
|
|
18547
18539
|
setPendingChanges(currentChanges => {
|
|
18548
|
-
var _nextChanges$rowId$_m, _nextChanges$rowId$_m2;
|
|
18549
18540
|
const nextChanges = {
|
|
18550
18541
|
...currentChanges
|
|
18551
18542
|
};
|
|
18552
18543
|
nextChanges[rowId]._meta.errors = {
|
|
18553
18544
|
row: rowError,
|
|
18554
18545
|
cells: cellErrors,
|
|
18555
|
-
|
|
18546
|
+
shouldShowErrorAlert: true
|
|
18556
18547
|
};
|
|
18557
18548
|
return nextChanges;
|
|
18558
18549
|
});
|
|
@@ -18587,7 +18578,7 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18587
18578
|
errors: {
|
|
18588
18579
|
...nextChanges[cell.row.id]._meta.errors,
|
|
18589
18580
|
cells: errors,
|
|
18590
|
-
|
|
18581
|
+
shouldShowErrorAlert: !Object.keys(errors).length ? false : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert
|
|
18591
18582
|
}
|
|
18592
18583
|
};
|
|
18593
18584
|
return nextChanges;
|
|
@@ -18675,22 +18666,18 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18675
18666
|
if (!isEnabled) {
|
|
18676
18667
|
return false;
|
|
18677
18668
|
}
|
|
18678
|
-
return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.
|
|
18669
|
+
return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.shouldShowErrorAlert);
|
|
18679
18670
|
}
|
|
18680
|
-
function
|
|
18681
|
-
|
|
18682
|
-
if (
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
...nextChanges[rowId]._meta.errors,
|
|
18689
|
-
hasShownErrorAlert: true
|
|
18690
|
-
};
|
|
18691
|
-
return nextChanges;
|
|
18692
|
-
});
|
|
18671
|
+
function getRowPendingChange(rowId) {
|
|
18672
|
+
const rowPendingChanges = pendingChanges[rowId];
|
|
18673
|
+
if (rowPendingChanges) {
|
|
18674
|
+
const {
|
|
18675
|
+
_meta,
|
|
18676
|
+
...pendingChange
|
|
18677
|
+
} = rowPendingChanges;
|
|
18678
|
+
return pendingChange;
|
|
18693
18679
|
}
|
|
18680
|
+
return undefined;
|
|
18694
18681
|
}
|
|
18695
18682
|
function getRowSaveStatus(rowId) {
|
|
18696
18683
|
if (!isEnabled) {
|
|
@@ -18712,8 +18699,8 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18712
18699
|
});
|
|
18713
18700
|
}
|
|
18714
18701
|
function getRowMoveReason(rowId) {
|
|
18715
|
-
var _pendingChanges$
|
|
18716
|
-
return (_pendingChanges$
|
|
18702
|
+
var _pendingChanges$rowId7;
|
|
18703
|
+
return (_pendingChanges$rowId7 = pendingChanges[rowId]) !== null && _pendingChanges$rowId7 !== void 0 && _pendingChanges$rowId7._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
|
|
18717
18704
|
}
|
|
18718
18705
|
function hasChanges(rowId) {
|
|
18719
18706
|
if (!isEnabled) {
|
|
@@ -18721,28 +18708,14 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18721
18708
|
}
|
|
18722
18709
|
return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;
|
|
18723
18710
|
}
|
|
18724
|
-
function
|
|
18725
|
-
var _tableRef$current;
|
|
18711
|
+
function hasAlertErrors() {
|
|
18726
18712
|
if (!isEnabled) {
|
|
18727
18713
|
return false;
|
|
18728
18714
|
}
|
|
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;
|
|
18715
|
+
return !!getAlertErrors().length;
|
|
18743
18716
|
}
|
|
18744
|
-
function
|
|
18745
|
-
return Object.keys(pendingChanges).filter(
|
|
18717
|
+
function getAlertErrors() {
|
|
18718
|
+
return Object.keys(pendingChanges).filter(hasRowErrorsSeen).map(rowId => ({
|
|
18746
18719
|
rowId,
|
|
18747
18720
|
pendingChange: pendingChanges[rowId]
|
|
18748
18721
|
}));
|
|
@@ -18756,6 +18729,9 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18756
18729
|
return nextChanges;
|
|
18757
18730
|
});
|
|
18758
18731
|
}
|
|
18732
|
+
function getCompletedRowsCount() {
|
|
18733
|
+
return Object.values(saveStates).filter(value => value === 'complete').length;
|
|
18734
|
+
}
|
|
18759
18735
|
return {
|
|
18760
18736
|
getCellValue,
|
|
18761
18737
|
getCellError,
|
|
@@ -18763,16 +18739,17 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
|
|
|
18763
18739
|
validateCell,
|
|
18764
18740
|
addCreatedRowChangeset,
|
|
18765
18741
|
hasChanges,
|
|
18766
|
-
|
|
18767
|
-
|
|
18742
|
+
hasAlertErrors,
|
|
18743
|
+
getAlertErrors,
|
|
18768
18744
|
saveChanges,
|
|
18769
18745
|
resetChanges,
|
|
18770
18746
|
hasRowErrors,
|
|
18771
18747
|
hasRowErrorsSeen,
|
|
18772
|
-
|
|
18748
|
+
getRowPendingChange,
|
|
18773
18749
|
getRowSaveStatus,
|
|
18774
18750
|
setRowSaveStatus,
|
|
18775
|
-
getRowMoveReason
|
|
18751
|
+
getRowMoveReason,
|
|
18752
|
+
getCompletedRowsCount
|
|
18776
18753
|
};
|
|
18777
18754
|
}
|
|
18778
18755
|
function useLastFocusedCellIndex() {
|
|
@@ -18844,12 +18821,16 @@ function createPendingChangesSetter(currentChanges, row, rowIndex, changes, loca
|
|
|
18844
18821
|
// otherwise remove any change - no point saving the same value
|
|
18845
18822
|
if (change !== row.original[accessor]) {
|
|
18846
18823
|
rowChanges[accessor] = change;
|
|
18847
|
-
//
|
|
18848
|
-
|
|
18849
|
-
if (
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18824
|
+
// consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
|
|
18825
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
18826
|
+
if (cells.hasOwnProperty(accessor)) {
|
|
18827
|
+
// determine if the row will move position based on this change, and save why it will move
|
|
18828
|
+
const reason = willRowMove(cells[accessor], change, rowIndex, localization);
|
|
18829
|
+
if (reason) {
|
|
18830
|
+
rowChanges._meta.moveReason[accessor] = reason;
|
|
18831
|
+
} else {
|
|
18832
|
+
delete rowChanges._meta.moveReason[accessor];
|
|
18833
|
+
}
|
|
18853
18834
|
}
|
|
18854
18835
|
} else {
|
|
18855
18836
|
delete rowChanges[accessor];
|
|
@@ -19078,7 +19059,7 @@ function useEditingCellAutofocus(props) {
|
|
|
19078
19059
|
(_props$cellRef$curren2 = props.cellRef.current) === null || _props$cellRef$curren2 === void 0 ? void 0 : _props$cellRef$curren2.focus();
|
|
19079
19060
|
}
|
|
19080
19061
|
}
|
|
19081
|
-
}, [
|
|
19062
|
+
}, [tableMeta.rowActive.rowActiveIndex]);
|
|
19082
19063
|
// when the cell receives focus we actually want to focus the control inside it...
|
|
19083
19064
|
const handleFocus = event => {
|
|
19084
19065
|
var _props$cellRef$curren3;
|
|
@@ -19089,11 +19070,12 @@ function useEditingCellAutofocus(props) {
|
|
|
19089
19070
|
const tableRect = tableElement.getBoundingClientRect();
|
|
19090
19071
|
const leftOffsetFromScrollContainer = targetRect.left - tableRect.left;
|
|
19091
19072
|
const scrollbarWidth = tableElement.offsetWidth - tableElement.clientWidth; // the width of table vertical scrollbar
|
|
19073
|
+
const isFocusedElementMenu = event.currentTarget.getAttribute('data-cell-id') === '__actions';
|
|
19092
19074
|
if (
|
|
19093
19075
|
// When pinned column overlaps the focused cell
|
|
19094
|
-
leftOffsetFromScrollContainer < columnFreezingOffset ||
|
|
19076
|
+
(leftOffsetFromScrollContainer < columnFreezingOffset ||
|
|
19095
19077
|
// When focused cell goes behidn the edge of the table
|
|
19096
|
-
leftOffsetFromScrollContainer + targetRect.width > tableRect.width - scrollbarWidth) {
|
|
19078
|
+
leftOffsetFromScrollContainer + targetRect.width > tableRect.width - scrollbarWidth) && !isFocusedElementMenu) {
|
|
19097
19079
|
tableElement.scrollTo(props.cell.column.getStart() - columnFreezingOffset, tableElement.scrollTop);
|
|
19098
19080
|
}
|
|
19099
19081
|
}
|
|
@@ -19143,6 +19125,7 @@ function EditingControlCell(props) {
|
|
|
19143
19125
|
onBlur: handleBlur,
|
|
19144
19126
|
onChange: value => tableMeta.editing.setCellValue(cell, value, rowIndex),
|
|
19145
19127
|
row: cell.row.original,
|
|
19128
|
+
rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),
|
|
19146
19129
|
tabIndex: isActiveRow ? 0 : -1,
|
|
19147
19130
|
toggleEditing: tableMeta.editing.toggleEditing,
|
|
19148
19131
|
toggleDetailedMode: tableMeta.editing.toggleDetailedMode,
|
|
@@ -19177,6 +19160,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
|
19177
19160
|
onBlur,
|
|
19178
19161
|
onChange,
|
|
19179
19162
|
row,
|
|
19163
|
+
rowPendingChanges,
|
|
19180
19164
|
tabIndex = -1,
|
|
19181
19165
|
toggleEditing,
|
|
19182
19166
|
toggleDetailedMode,
|
|
@@ -19197,7 +19181,10 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
|
19197
19181
|
setValue: onChange,
|
|
19198
19182
|
value
|
|
19199
19183
|
};
|
|
19200
|
-
return type(controlFnProps,
|
|
19184
|
+
return type(controlFnProps, {
|
|
19185
|
+
...row,
|
|
19186
|
+
...rowPendingChanges
|
|
19187
|
+
});
|
|
19201
19188
|
}
|
|
19202
19189
|
if (type === 'switch') {
|
|
19203
19190
|
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, commonProps, {
|
|
@@ -19363,13 +19350,21 @@ function EditingActionMenu(props) {
|
|
|
19363
19350
|
handleSave();
|
|
19364
19351
|
}
|
|
19365
19352
|
};
|
|
19353
|
+
const handleMenuContentKeyDown = event => {
|
|
19354
|
+
// Stops the keyboard event from propagating to the Table when EditActionsMenu is open
|
|
19355
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
19356
|
+
event.stopPropagation();
|
|
19357
|
+
}
|
|
19358
|
+
};
|
|
19366
19359
|
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
19367
19360
|
appearance: "transparent",
|
|
19368
19361
|
"aria-label": texts.table3.editing.actions.tooltip,
|
|
19369
19362
|
className: "group-[[data-row-editing-status]]/row:hidden",
|
|
19370
19363
|
icon: "more",
|
|
19371
19364
|
onKeyDown: handleKeyDown,
|
|
19372
|
-
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content,
|
|
19365
|
+
menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
|
19366
|
+
onKeyDown: handleMenuContentKeyDown
|
|
19367
|
+
}, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
|
19373
19368
|
icon: "tick",
|
|
19374
19369
|
disabled: !hasChanges || hasErrors,
|
|
19375
19370
|
onClick: handleSave
|
|
@@ -19393,14 +19388,20 @@ function ConfirmClearChangesDialog(props) {
|
|
|
19393
19388
|
const {
|
|
19394
19389
|
texts
|
|
19395
19390
|
} = useLocalization();
|
|
19391
|
+
const handleClickInsideDialogContent = event => {
|
|
19392
|
+
// Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
|
|
19393
|
+
// inside the dialog
|
|
19394
|
+
event.stopPropagation();
|
|
19395
|
+
};
|
|
19396
19396
|
return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
|
|
19397
|
-
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title
|
|
19397
|
+
"aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
|
|
19398
|
+
onClick: handleClickInsideDialogContent
|
|
19398
19399
|
}, /*#__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
19400
|
tabIndex: 0
|
|
19400
19401
|
}, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
19402
|
+
autoFocus: true,
|
|
19401
19403
|
tabIndex: 0,
|
|
19402
19404
|
appearance: "primary",
|
|
19403
|
-
autoFocus: true,
|
|
19404
19405
|
onClick: handleClear
|
|
19405
19406
|
}, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
|
|
19406
19407
|
}
|
|
@@ -19441,12 +19442,14 @@ function SaveStatus(props) {
|
|
|
19441
19442
|
title: texts.table3.editing.saving.progress
|
|
19442
19443
|
}, /*#__PURE__*/React__default.createElement(Spinner, {
|
|
19443
19444
|
delay: 0,
|
|
19444
|
-
className: "
|
|
19445
|
+
className: "mr-1 !h-5 !w-5"
|
|
19445
19446
|
}))) : (/*#__PURE__*/React__default.createElement(Tooltip, {
|
|
19446
19447
|
title: texts.table3.editing.saving.complete
|
|
19447
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
19448
|
-
|
|
19449
|
-
|
|
19448
|
+
}, /*#__PURE__*/React__default.createElement(BadgeIcon, {
|
|
19449
|
+
icon: "tick",
|
|
19450
|
+
color: "green",
|
|
19451
|
+
subtle: true,
|
|
19452
|
+
className: "mr-1"
|
|
19450
19453
|
})))));
|
|
19451
19454
|
}
|
|
19452
19455
|
|
|
@@ -19530,17 +19533,7 @@ function Alert$1(props) {
|
|
|
19530
19533
|
const validationTexts = texts.table3.editing.validation;
|
|
19531
19534
|
const tableMeta = table.options.meta;
|
|
19532
19535
|
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]);
|
|
19536
|
+
const pendingChangesWithErrors = tableMeta.editing.getAlertErrors();
|
|
19544
19537
|
function scrollToRow(rowIndex) {
|
|
19545
19538
|
tableMeta.rowActive.setRowActiveIndex(rowIndex);
|
|
19546
19539
|
scrollToIndex(rowIndex, {
|
|
@@ -19662,7 +19655,7 @@ function CreateNewRowButton(props) {
|
|
|
19662
19655
|
});
|
|
19663
19656
|
const handleKeyDown = event => {
|
|
19664
19657
|
if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
|
|
19665
|
-
|
|
19658
|
+
tableMeta.editing.saveChanges();
|
|
19666
19659
|
}
|
|
19667
19660
|
};
|
|
19668
19661
|
const handleCreate = function () {
|
|
@@ -19784,14 +19777,14 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
|
19784
19777
|
'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
19778
|
enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
|
|
19786
19779
|
};
|
|
19787
|
-
const
|
|
19780
|
+
const hasAlertErrors = table3.meta.editing.hasAlertErrors();
|
|
19788
19781
|
const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;
|
|
19789
19782
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
|
19790
19783
|
table: table3
|
|
19791
19784
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
|
19792
19785
|
scrollToIndex: table3.renderer.scrollToIndex,
|
|
19793
19786
|
table: table3.instance
|
|
19794
|
-
})) : null),
|
|
19787
|
+
})) : null), hasAlertErrors ? (/*#__PURE__*/React__default.createElement(Alert$1, {
|
|
19795
19788
|
className: "mb-4",
|
|
19796
19789
|
scrollToIndex: table3.renderer.scrollToIndex,
|
|
19797
19790
|
table: table3.instance,
|