@economic/taco 2.46.9 → 2.47.0-server-1
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/SearchInput2/SearchInput2.d.ts +2 -0
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -2
- package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
- package/dist/components/Table3/features/useEditingState.d.ts +11 -11
- package/dist/components/Table3/features/useTableEditing.d.ts +13 -13
- package/dist/components/Table3/util/editing.d.ts +3 -0
- package/dist/esm/index.css +2 -2
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
- package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +14 -4
- 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 +1 -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/Editing/Alert.js +14 -9
- 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/CreateNewRow.js +2 -4
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +5 -4
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +32 -51
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +5 -3
- 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 +15 -12
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -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/Internal/Expansion.js +4 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +7 -4
- 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/Core/components/Footer/Footer.js +7 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -5
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +41 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +36 -9
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.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/useTableDataLoader.js +5 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +4 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
- 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 +14 -13
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
- 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/setup.js +6 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
- package/dist/index.css +2 -2
- package/dist/primitives/Table/Core/Table.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
- package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
- package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
- package/dist/primitives/Table/types.d.ts +11 -6
- package/dist/primitives/Table/useTableDataLoader2.d.ts +24 -0
- package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
- package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
- package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +3 -1
- package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
- package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
- package/dist/taco.cjs.development.js +363 -229
- 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 -3
@@ -31,12 +31,12 @@ var reactPortal = require('@radix-ui/react-portal');
|
|
31
31
|
var reactTable = require('@tanstack/react-table');
|
32
32
|
var get = _interopDefault(require('lodash/get'));
|
33
33
|
var reactVirtual = require('@tanstack/react-virtual');
|
34
|
-
var reactIntersectionObserver = require('react-intersection-observer');
|
35
34
|
var core = require('@dnd-kit/core');
|
36
35
|
var modifiers = require('@dnd-kit/modifiers');
|
37
36
|
var SortablePrimitive = require('@dnd-kit/sortable');
|
38
37
|
var utilities = require('@dnd-kit/utilities');
|
39
38
|
var reactTable$1 = require('react-table');
|
39
|
+
var reactIntersectionObserver = require('react-intersection-observer');
|
40
40
|
var reactWindow = require('react-window');
|
41
41
|
var InfiniteLoader = _interopDefault(require('react-window-infinite-loader'));
|
42
42
|
var set = _interopDefault(require('lodash/set'));
|
@@ -10187,6 +10187,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
|
|
10187
10187
|
function freezeUptoExternalColumn(index, columns) {
|
10188
10188
|
return columns.slice(0, index + 1);
|
10189
10189
|
}
|
10190
|
+
function getHiddenColumns(columnVisibility = {}) {
|
10191
|
+
return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
|
10192
|
+
}
|
10190
10193
|
|
10191
10194
|
function getSettings(table) {
|
10192
10195
|
const meta = table.options.meta;
|
@@ -10468,6 +10471,12 @@ function configureReactTableOptions(options, props, localization) {
|
|
10468
10471
|
var _column$columnDef$met;
|
10469
10472
|
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10470
10473
|
};
|
10474
|
+
// enter controlled search mode (controlled could be local state, but usually the server)
|
10475
|
+
if (props.onChangeSearch) {
|
10476
|
+
if (props._experimentalDataLoader2) {
|
10477
|
+
tableOptions.manualFiltering = true;
|
10478
|
+
}
|
10479
|
+
}
|
10471
10480
|
}
|
10472
10481
|
if (tableOptions.enableSorting) {
|
10473
10482
|
// enter controlled sort mode (controlled could be local state, but usually the server)
|
@@ -10525,6 +10534,7 @@ const DEFAULT_PRESET = {
|
|
10525
10534
|
enableColumnHiding: false,
|
10526
10535
|
enableColumnResizing: false,
|
10527
10536
|
enableRowExpansion: false,
|
10537
|
+
enableRowExpansionAll: true,
|
10528
10538
|
enableRowSelection: false,
|
10529
10539
|
// custom -- common between all table types
|
10530
10540
|
enableColumnOrdering: false,
|
@@ -10551,6 +10561,7 @@ const presets = {
|
|
10551
10561
|
enableColumnHiding: true,
|
10552
10562
|
enableColumnResizing: true,
|
10553
10563
|
enableRowExpansion: true,
|
10564
|
+
enableRowExpansionAll: true,
|
10554
10565
|
enableRowSelection: true,
|
10555
10566
|
// custom -- common between all table types
|
10556
10567
|
enableColumnOrdering: true,
|
@@ -10576,6 +10587,7 @@ const presets = {
|
|
10576
10587
|
enableColumnHiding: false,
|
10577
10588
|
enableColumnResizing: false,
|
10578
10589
|
enableRowExpansion: true,
|
10590
|
+
enableRowExpansionAll: true,
|
10579
10591
|
enableRowSelection: true,
|
10580
10592
|
// custom -- common between all table types
|
10581
10593
|
enableColumnOrdering: false,
|
@@ -10601,6 +10613,7 @@ const presets = {
|
|
10601
10613
|
enableColumnHiding: false,
|
10602
10614
|
enableColumnResizing: false,
|
10603
10615
|
enableRowExpansion: true,
|
10616
|
+
enableRowExpansionAll: true,
|
10604
10617
|
enableRowSelection: false,
|
10605
10618
|
// custom -- common between all table types
|
10606
10619
|
enableColumnOrdering: false,
|
@@ -10618,7 +10631,7 @@ const presets = {
|
|
10618
10631
|
}
|
10619
10632
|
};
|
10620
10633
|
function getTableFeaturePreset(props) {
|
10621
|
-
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;
|
10634
|
+
var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowExpan2, _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;
|
10622
10635
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10623
10636
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10624
10637
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10626,6 +10639,7 @@ function getTableFeaturePreset(props) {
|
|
10626
10639
|
const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
|
10627
10640
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10628
10641
|
const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
|
10642
|
+
const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
|
10629
10643
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10630
10644
|
return {
|
10631
10645
|
// react-table built-in
|
@@ -10650,6 +10664,7 @@ function getTableFeaturePreset(props) {
|
|
10650
10664
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10651
10665
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10652
10666
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
10667
|
+
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
10653
10668
|
enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
|
10654
10669
|
enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
|
10655
10670
|
};
|
@@ -10845,7 +10860,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
|
10845
10860
|
return index;
|
10846
10861
|
});
|
10847
10862
|
}
|
10848
|
-
}, [rowActiveIndex,
|
10863
|
+
}, [rowActiveIndex, isEnabled]);
|
10849
10864
|
return {
|
10850
10865
|
isEnabled,
|
10851
10866
|
rowActiveIndex,
|
@@ -10894,9 +10909,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
|
|
10894
10909
|
};
|
10895
10910
|
}
|
10896
10911
|
|
10897
|
-
function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
|
10912
|
+
function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
|
10898
10913
|
return {
|
10899
10914
|
isEnabled,
|
10915
|
+
canExpandAll,
|
10900
10916
|
rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
|
10901
10917
|
};
|
10902
10918
|
}
|
@@ -10960,7 +10976,7 @@ function useTableRowSelection(isEnabled = false) {
|
|
10960
10976
|
- Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
|
10961
10977
|
- Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
|
10962
10978
|
*/
|
10963
|
-
function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
10979
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
10964
10980
|
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
|
10965
10981
|
function setEnableGlobalFilter(enabled, instance) {
|
10966
10982
|
_setEnableGlobalFilter(enabled);
|
@@ -10985,18 +11001,19 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10985
11001
|
highlightedColumnIndexes,
|
10986
11002
|
setHighlightedColumnIndexes,
|
10987
11003
|
currentHighlightColumnIndex,
|
10988
|
-
setCurrentHighlightColumnIndex
|
11004
|
+
setCurrentHighlightColumnIndex,
|
11005
|
+
handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
|
10989
11006
|
};
|
10990
11007
|
}
|
10991
11008
|
|
10992
11009
|
// A type of promise-like that resolves synchronously and supports only one observer
|
10993
|
-
|
11010
|
+
var _Pact = /*#__PURE__*/function () {
|
10994
11011
|
function _Pact() {}
|
10995
11012
|
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
10996
|
-
|
10997
|
-
|
11013
|
+
var result = new _Pact();
|
11014
|
+
var state = this.s;
|
10998
11015
|
if (state) {
|
10999
|
-
|
11016
|
+
var callback = state & 1 ? onFulfilled : onRejected;
|
11000
11017
|
if (callback) {
|
11001
11018
|
try {
|
11002
11019
|
_settle(result, 1, callback(this.v));
|
@@ -11010,7 +11027,7 @@ const _Pact = /*#__PURE__*/function () {
|
|
11010
11027
|
}
|
11011
11028
|
this.o = function (_this) {
|
11012
11029
|
try {
|
11013
|
-
|
11030
|
+
var value = _this.v;
|
11014
11031
|
if (_this.s & 1) {
|
11015
11032
|
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
11016
11033
|
} else if (onRejected) {
|
@@ -11047,7 +11064,7 @@ function _settle(pact, state, value) {
|
|
11047
11064
|
}
|
11048
11065
|
pact.s = state;
|
11049
11066
|
pact.v = value;
|
11050
|
-
|
11067
|
+
var observer = pact.o;
|
11051
11068
|
if (observer) {
|
11052
11069
|
observer(pact);
|
11053
11070
|
}
|
@@ -11087,17 +11104,13 @@ function _forTo(array, body, check) {
|
|
11087
11104
|
_cycle();
|
11088
11105
|
return pact;
|
11089
11106
|
}
|
11090
|
-
|
11107
|
+
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
|
11091
11108
|
|
11092
11109
|
// Asynchronously iterate through an object's values
|
11093
11110
|
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
|
11094
11111
|
function _forOf(target, body, check) {
|
11095
11112
|
if (typeof target[_iteratorSymbol] === "function") {
|
11096
|
-
var
|
11097
|
-
step,
|
11098
|
-
pact,
|
11099
|
-
reject;
|
11100
|
-
function _cycle(result) {
|
11113
|
+
var _cycle = function _cycle(result) {
|
11101
11114
|
try {
|
11102
11115
|
while (!(step = iterator.next()).done && (!check || !check())) {
|
11103
11116
|
result = body(step.value);
|
@@ -11118,13 +11131,17 @@ function _forOf(target, body, check) {
|
|
11118
11131
|
} catch (e) {
|
11119
11132
|
_settle(pact || (pact = new _Pact()), 2, e);
|
11120
11133
|
}
|
11121
|
-
}
|
11134
|
+
};
|
11135
|
+
var iterator = target[_iteratorSymbol](),
|
11136
|
+
step,
|
11137
|
+
pact,
|
11138
|
+
reject;
|
11122
11139
|
_cycle();
|
11123
|
-
if (iterator
|
11124
|
-
var _fixup = function (value) {
|
11140
|
+
if (iterator["return"]) {
|
11141
|
+
var _fixup = function _fixup(value) {
|
11125
11142
|
try {
|
11126
11143
|
if (!step.done) {
|
11127
|
-
iterator
|
11144
|
+
iterator["return"]();
|
11128
11145
|
}
|
11129
11146
|
} catch (e) {}
|
11130
11147
|
return value;
|
@@ -11151,7 +11168,7 @@ function _forOf(target, body, check) {
|
|
11151
11168
|
return body(values[i]);
|
11152
11169
|
}, check);
|
11153
11170
|
}
|
11154
|
-
|
11171
|
+
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
11155
11172
|
|
11156
11173
|
// Asynchronously call a function and send errors to recovery continuation
|
11157
11174
|
function _catch(body, recover) {
|
@@ -11232,7 +11249,7 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11232
11249
|
length.current = response.length;
|
11233
11250
|
nextData = Array(length.current).fill(undefined);
|
11234
11251
|
} else {
|
11235
|
-
nextData = [
|
11252
|
+
nextData = [].concat(currentData);
|
11236
11253
|
}
|
11237
11254
|
const startIndex = pageIndex * pageSize;
|
11238
11255
|
nextData.splice(startIndex, pageSize, ...response.data);
|
@@ -11298,13 +11315,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11298
11315
|
try {
|
11299
11316
|
if (_lastUsedSearch.current) {
|
11300
11317
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11301
|
-
loadAll(sorting, _lastUsedFilters.current);
|
11318
|
+
return loadAll(sorting, _lastUsedFilters.current);
|
11302
11319
|
} else {
|
11303
11320
|
var _lastUsedPageIndex$cu2;
|
11304
11321
|
// load the last page that we scrolled to
|
11305
|
-
loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current);
|
11322
|
+
return loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current);
|
11306
11323
|
}
|
11307
|
-
return Promise.resolve();
|
11308
11324
|
} catch (e) {
|
11309
11325
|
return Promise.reject(e);
|
11310
11326
|
}
|
@@ -11313,13 +11329,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11313
11329
|
try {
|
11314
11330
|
if (_lastUsedSearch.current) {
|
11315
11331
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11316
|
-
loadAll(_lastUsedSorting.current, filters);
|
11332
|
+
return loadAll(_lastUsedSorting.current, filters);
|
11317
11333
|
} else {
|
11318
11334
|
var _lastUsedPageIndex$cu3;
|
11319
11335
|
// load the last page that we scrolled to
|
11320
|
-
loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters);
|
11336
|
+
return loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters);
|
11321
11337
|
}
|
11322
|
-
return Promise.resolve();
|
11323
11338
|
} catch (e) {
|
11324
11339
|
return Promise.reject(e);
|
11325
11340
|
}
|
@@ -11347,7 +11362,7 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11347
11362
|
}, invalidate];
|
11348
11363
|
}
|
11349
11364
|
|
11350
|
-
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
11365
|
+
function useTableServerLoading(loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
|
11351
11366
|
const isEnabled = !!loadPage && !!loadAll;
|
11352
11367
|
const [isReady, setReady] = React__default.useState(false);
|
11353
11368
|
const [loadAllStatus, setLoadedStatus] = React__default.useState(exports.TableServerLoadAllState.Incomplete);
|
@@ -11402,13 +11417,15 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11402
11417
|
};
|
11403
11418
|
}
|
11404
11419
|
return {
|
11420
|
+
pages,
|
11405
11421
|
isEnabled,
|
11406
11422
|
isReady,
|
11407
11423
|
loadPage: _loadPage,
|
11408
11424
|
loadAll: _loadAll,
|
11409
11425
|
loadAllIfNeeded: _loadAllIfNeeded,
|
11410
11426
|
loadAllStatus,
|
11411
|
-
pageSize
|
11427
|
+
pageSize,
|
11428
|
+
_experimentalDataLoader2
|
11412
11429
|
};
|
11413
11430
|
}
|
11414
11431
|
|
@@ -11505,7 +11522,8 @@ function useTableFilterListener(table, onFilter) {
|
|
11505
11522
|
const columnFilters = table.getState().columnFilters;
|
11506
11523
|
useLazyEffect(() => {
|
11507
11524
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
11508
|
-
|
11525
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11526
|
+
onFilter(columnFilters, hiddenColumns);
|
11509
11527
|
if (table.options.enableRowSelection) {
|
11510
11528
|
table.resetRowSelection();
|
11511
11529
|
}
|
@@ -11563,11 +11581,12 @@ function useTableRowHeightListener(table) {
|
|
11563
11581
|
}
|
11564
11582
|
|
11565
11583
|
function useTableRowSelectionListener(table, onRowSelect) {
|
11584
|
+
// note that the selected row model may not contain all rows in state when using server loading
|
11566
11585
|
const rows = table.getSelectedRowModel().flatRows;
|
11567
|
-
const
|
11586
|
+
const state = table.getState().rowSelection;
|
11568
11587
|
useLazyEffect(() => {
|
11569
11588
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11570
|
-
onRowSelect(
|
11589
|
+
onRowSelect(rows.map(row => row.original), Object.keys(state));
|
11571
11590
|
}
|
11572
11591
|
/**
|
11573
11592
|
* Casting to a boolean, since enableRowSelection can be a function,
|
@@ -11575,33 +11594,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11575
11594
|
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11576
11595
|
* will be applied directly to particular rows.
|
11577
11596
|
*/
|
11578
|
-
}, [!!table.options.enableRowSelection,
|
11597
|
+
}, [!!table.options.enableRowSelection, state]);
|
11579
11598
|
}
|
11580
11599
|
|
11581
|
-
function useTableSearchListener(table
|
11600
|
+
function useTableSearchListener(table) {
|
11582
11601
|
const meta = table.options.meta;
|
11583
11602
|
const localization = useLocalization();
|
11584
|
-
const
|
11603
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11604
|
+
const query = table.getState().globalFilter;
|
11585
11605
|
// Need to re-run search when columns are getting shown/hidden.
|
11586
|
-
|
11587
|
-
if (meta.search.isEnabled
|
11588
|
-
const currentFilter =
|
11606
|
+
useLazyEffect(() => {
|
11607
|
+
if (meta.search.isEnabled) {
|
11608
|
+
const currentFilter = query;
|
11589
11609
|
requestAnimationFrame(() => {
|
11590
11610
|
table.resetGlobalFilter();
|
11591
11611
|
table.setGlobalFilter(currentFilter);
|
11592
11612
|
});
|
11613
|
+
if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
|
11614
|
+
meta.search.handleSearch(query, hiddenColumns);
|
11615
|
+
}
|
11593
11616
|
}
|
11594
|
-
}, [
|
11617
|
+
}, [hiddenColumns.length]);
|
11595
11618
|
// recalculates highlighted indexes whenever something important changes
|
11596
|
-
|
11619
|
+
useLazyEffect(() => {
|
11597
11620
|
if (meta.search.isEnabled) {
|
11598
|
-
const query = table.getState().globalFilter;
|
11599
11621
|
resetHighlightedColumnIndexes(query, table, localization);
|
11600
|
-
if (typeof onChangeSearch === 'function') {
|
11601
|
-
onChangeSearch(query);
|
11602
|
-
}
|
11603
11622
|
}
|
11604
|
-
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length,
|
11623
|
+
}, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
|
11605
11624
|
}
|
11606
11625
|
|
11607
11626
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -11685,12 +11704,15 @@ function useTableSortingListener(table, onSort) {
|
|
11685
11704
|
}
|
11686
11705
|
|
11687
11706
|
function useTableServerLoadingListener(table, loadPage) {
|
11688
|
-
const
|
11689
|
-
const columnFilters = table.getState().columnFilters;
|
11707
|
+
const meta = table.options.meta;
|
11690
11708
|
// trigger load of the first page on mount
|
11691
11709
|
React__default.useEffect(() => {
|
11692
11710
|
if (loadPage) {
|
11693
|
-
|
11711
|
+
const sorting = table.getState().sorting;
|
11712
|
+
const columnFilters = table.getState().columnFilters;
|
11713
|
+
const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
|
11714
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11715
|
+
loadPage(0, sorting, columnFilters, search, hiddenColumns);
|
11694
11716
|
}
|
11695
11717
|
}, []);
|
11696
11718
|
}
|
@@ -11737,13 +11759,13 @@ function useTableManager(props, meta, internalColumns) {
|
|
11737
11759
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
11738
11760
|
const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
|
11739
11761
|
const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
|
11740
|
-
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
|
11762
|
+
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
|
11741
11763
|
const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
|
11742
11764
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
11743
11765
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
11744
11766
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
11745
|
-
const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
11746
|
-
const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
|
11767
|
+
const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
|
11768
|
+
const server = useTableServerLoading(props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
|
11747
11769
|
// TODO: memoise
|
11748
11770
|
// convert jsx column components into valid table columns
|
11749
11771
|
const {
|
@@ -11794,7 +11816,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11794
11816
|
useTableFontSizeListener(instance);
|
11795
11817
|
useTableRowHeightListener(instance);
|
11796
11818
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
11797
|
-
useTableSearchListener(instance
|
11819
|
+
useTableSearchListener(instance);
|
11798
11820
|
useTableServerLoadingListener(instance, server.loadPage);
|
11799
11821
|
useTableSettingsListener(instance, setSettings);
|
11800
11822
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -12020,7 +12042,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12020
12042
|
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
12021
12043
|
return;
|
12022
12044
|
}
|
12023
|
-
tableMeta.rowActive.handleKeyDown(event,
|
12045
|
+
tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
|
12024
12046
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
12025
12047
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
12026
12048
|
var _rows$tableMeta$rowAc;
|
@@ -12056,57 +12078,131 @@ const ROW_HEIGHT_ESTIMATES = {
|
|
12056
12078
|
'extra-tall': 57
|
12057
12079
|
};
|
12058
12080
|
|
12081
|
+
const RowContext = /*#__PURE__*/React__default.createContext({
|
12082
|
+
hideInternalColumns: false,
|
12083
|
+
hideRowActions: false,
|
12084
|
+
isHovered: false,
|
12085
|
+
rowIndex: -1
|
12086
|
+
});
|
12087
|
+
|
12088
|
+
const DELAY_BEFORE_LOAD_MS = 250;
|
12089
|
+
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12090
|
+
function Row(props) {
|
12091
|
+
const {
|
12092
|
+
renderer: RowRenderer,
|
12093
|
+
cellRenderer: CellRenderer,
|
12094
|
+
hideInternalColumns = false,
|
12095
|
+
hideRowActions = false,
|
12096
|
+
scrollDirection,
|
12097
|
+
skipPageLoading = false,
|
12098
|
+
...displayRowProps
|
12099
|
+
} = props;
|
12100
|
+
const tableMeta = props.table.options.meta;
|
12101
|
+
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12102
|
+
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12103
|
+
const contextValue = React__default.useMemo(() => ({
|
12104
|
+
isHovered,
|
12105
|
+
rowIndex: props.index,
|
12106
|
+
hideInternalColumns,
|
12107
|
+
hideRowActions
|
12108
|
+
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12109
|
+
React__default.useEffect(() => {
|
12110
|
+
let timeout;
|
12111
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
|
12112
|
+
const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12113
|
+
const sorting = props.table.getState().sorting;
|
12114
|
+
const filters = props.table.getState().columnFilters;
|
12115
|
+
const search = props.table.getState().globalFilter;
|
12116
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12117
|
+
const pageIndexesToFetch = [];
|
12118
|
+
/*
|
12119
|
+
// if there's no direction, it means the scroll bar got dropped un unloaded pages,
|
12120
|
+
// in that case, load forward and backward pages to prevent skeletons
|
12121
|
+
if (scrollDirection === 'backward' || !scrollDirection) {
|
12122
|
+
const backIndex = pageIndex - 1;
|
12123
|
+
if (backIndex > -1) {
|
12124
|
+
pageIndexesToFetch.push(backIndex);
|
12125
|
+
}
|
12126
|
+
}
|
12127
|
+
*/
|
12128
|
+
// always load the next page
|
12129
|
+
if (scrollDirection === 'forward' || !scrollDirection) {
|
12130
|
+
pageIndexesToFetch.push(pageIndex + 1);
|
12131
|
+
}
|
12132
|
+
// the virtualiser fetches a page ahead, so this won't get called in most cases
|
12133
|
+
// but it provides a fallback for some edge cases
|
12134
|
+
timeout = setTimeout(() => {
|
12135
|
+
pageIndexesToFetch.forEach(index => {
|
12136
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12137
|
+
// this can be called by every row within the current page, but loadPage returns early if a pending request exists
|
12138
|
+
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, index, sorting, filters, tableMeta.search.enableGlobalFilter ? search : undefined, hiddenColumns);
|
12139
|
+
});
|
12140
|
+
}, DELAY_BEFORE_LOAD_MS);
|
12141
|
+
}
|
12142
|
+
return () => {
|
12143
|
+
clearTimeout(timeout);
|
12144
|
+
};
|
12145
|
+
}, [tableMeta.server.pages]);
|
12146
|
+
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12147
|
+
value: contextValue
|
12148
|
+
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12149
|
+
cellRenderer: CellRenderer
|
12150
|
+
})));
|
12151
|
+
}
|
12152
|
+
|
12153
|
+
const DELAY_BEFORE_LOAD_MS$1 = 150;
|
12059
12154
|
function SkeletonRow(props) {
|
12060
12155
|
const {
|
12061
12156
|
index,
|
12062
|
-
row,
|
12063
12157
|
table
|
12064
12158
|
} = props;
|
12065
12159
|
const tableMeta = table.options.meta;
|
12066
12160
|
if (tableMeta.server.isEnabled) {
|
12067
|
-
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props
|
12068
|
-
index: index
|
12069
|
-
}));
|
12161
|
+
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
|
12070
12162
|
}
|
12071
12163
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12072
|
-
cellsCount:
|
12164
|
+
cellsCount: table.getVisibleFlatColumns().length,
|
12165
|
+
index: index
|
12073
12166
|
});
|
12074
12167
|
}
|
12075
12168
|
function RowWithServerLoading(props) {
|
12076
12169
|
var _table$getState$group, _table$getState;
|
12077
12170
|
const {
|
12078
12171
|
index,
|
12079
|
-
row,
|
12080
12172
|
table
|
12081
12173
|
} = props;
|
12082
12174
|
const tableMeta = table.options.meta;
|
12083
12175
|
const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12084
|
-
const {
|
12085
|
-
ref,
|
12086
|
-
inView
|
12087
|
-
} = reactIntersectionObserver.useInView({
|
12088
|
-
threshold: 0,
|
12089
|
-
triggerOnce: true,
|
12090
|
-
initialInView: pageIndex === 0
|
12091
|
-
});
|
12092
12176
|
React__default.useEffect(() => {
|
12093
|
-
|
12094
|
-
|
12095
|
-
|
12177
|
+
let timeout;
|
12178
|
+
if (tableMeta.server.isEnabled) {
|
12179
|
+
const sorting = props.table.getState().sorting;
|
12180
|
+
const filters = props.table.getState().columnFilters;
|
12181
|
+
const search = props.table.getState().globalFilter;
|
12182
|
+
const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
|
12183
|
+
timeout = setTimeout(() => {
|
12184
|
+
var _tableMeta$server$loa, _tableMeta$server;
|
12185
|
+
(_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, sorting, filters, tableMeta.search.enableGlobalFilter ? search : undefined, hiddenColumns);
|
12186
|
+
}, DELAY_BEFORE_LOAD_MS$1);
|
12096
12187
|
}
|
12097
|
-
|
12188
|
+
return () => {
|
12189
|
+
clearTimeout(timeout);
|
12190
|
+
};
|
12191
|
+
}, []);
|
12098
12192
|
const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
|
12099
|
-
const ungroupedCellCount =
|
12193
|
+
const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
|
12100
12194
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12101
12195
|
cellsCount: ungroupedCellCount,
|
12102
|
-
|
12196
|
+
index: index
|
12103
12197
|
});
|
12104
12198
|
}
|
12105
12199
|
const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
|
12106
12200
|
const {
|
12107
|
-
cellsCount
|
12201
|
+
cellsCount,
|
12202
|
+
index
|
12108
12203
|
} = props;
|
12109
12204
|
return /*#__PURE__*/React__default.createElement("tr", {
|
12205
|
+
"data-row-index": index,
|
12110
12206
|
ref: ref
|
12111
12207
|
}, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
|
12112
12208
|
key: index
|
@@ -12115,41 +12211,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
|
|
12115
12211
|
})))));
|
12116
12212
|
});
|
12117
12213
|
|
12118
|
-
const RowContext = /*#__PURE__*/React__default.createContext({
|
12119
|
-
hideInternalColumns: false,
|
12120
|
-
hideRowActions: false,
|
12121
|
-
isHovered: false,
|
12122
|
-
rowIndex: -1
|
12123
|
-
});
|
12124
|
-
|
12125
|
-
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12126
|
-
function Row(props) {
|
12127
|
-
const {
|
12128
|
-
renderer: RowRenderer,
|
12129
|
-
cellRenderer: CellRenderer,
|
12130
|
-
hideInternalColumns = false,
|
12131
|
-
hideRowActions = false,
|
12132
|
-
...displayRowProps
|
12133
|
-
} = props;
|
12134
|
-
const tableMeta = props.table.options.meta;
|
12135
|
-
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12136
|
-
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12137
|
-
const contextValue = React__default.useMemo(() => ({
|
12138
|
-
isHovered,
|
12139
|
-
rowIndex: props.index,
|
12140
|
-
hideInternalColumns,
|
12141
|
-
hideRowActions
|
12142
|
-
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12143
|
-
if (props.row.original === undefined) {
|
12144
|
-
return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
|
12145
|
-
}
|
12146
|
-
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12147
|
-
value: contextValue
|
12148
|
-
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12149
|
-
cellRenderer: CellRenderer
|
12150
|
-
})));
|
12151
|
-
}
|
12152
|
-
|
12153
12214
|
// scroll padding end is designed to always show half of the next row
|
12154
12215
|
function getScrollPaddingEndOffset(table) {
|
12155
12216
|
const tableMeta = table.options.meta;
|
@@ -12174,7 +12235,7 @@ function getPaddingEndOffset(table, options) {
|
|
12174
12235
|
const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
|
12175
12236
|
return ROW_HEIGHT_ESTIMATES.medium * ((_options$virtualiserP = options === null || options === void 0 ? void 0 : options.virtualiserPaddingEndOffset) !== null && _options$virtualiserP !== void 0 ? _options$virtualiserP : 1) * bottomRows.length;
|
12176
12237
|
}
|
12177
|
-
function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
|
12238
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
|
12178
12239
|
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
|
12179
12240
|
const tableMeta = table.options.meta;
|
12180
12241
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
@@ -12188,11 +12249,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12188
12249
|
const rangeExtractor = useRowGroupVirtualisation(table);
|
12189
12250
|
// account for thead and tfoot in the scroll area - both are always medium row height
|
12190
12251
|
const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
|
12252
|
+
const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
|
12191
12253
|
const virtualiser = reactVirtual.useVirtualizer({
|
12192
|
-
count
|
12254
|
+
count,
|
12193
12255
|
estimateSize,
|
12194
12256
|
getScrollElement: () => tableRef.current,
|
12195
|
-
overscan: tableMeta.printing.isPrinting ?
|
12257
|
+
overscan: tableMeta.printing.isPrinting ? count : undefined,
|
12196
12258
|
rangeExtractor,
|
12197
12259
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
12198
12260
|
scrollPaddingStart,
|
@@ -12212,16 +12274,16 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12212
12274
|
if (tableRef.current) {
|
12213
12275
|
if (index === 0) {
|
12214
12276
|
virtualiser.scrollToOffset(0, notSmooth);
|
12215
|
-
} else if (index ===
|
12277
|
+
} else if (index === count - 1) {
|
12216
12278
|
// sometimes the last row doesn't fully show, so we just force scroll to the bottom
|
12217
12279
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
12218
12280
|
} else {
|
12219
12281
|
virtualiser.scrollToIndex(index, options);
|
12220
12282
|
}
|
12221
12283
|
}
|
12222
|
-
}, [virtualItems.length, tableRef.current, totalSize,
|
12284
|
+
}, [virtualItems.length, tableRef.current, totalSize, count]);
|
12223
12285
|
// use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
|
12224
|
-
const paddingStartIndex = isTableRowGrouped &&
|
12286
|
+
const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
|
12225
12287
|
const startValue = isTableRowGrouped ? ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size) : (_virtualItems$padding3 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding3 === void 0 ? void 0 : _virtualItems$padding3.start;
|
12226
12288
|
// styling for offsetting rows - this "is" the virtualisation
|
12227
12289
|
const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0, (_ref = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref !== void 0 ? _ref : 0)] : [0, 0];
|
@@ -12238,7 +12300,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12238
12300
|
let style = {};
|
12239
12301
|
let content = null;
|
12240
12302
|
// bottom rows aren't virtualised (they're sticky) but we need to set the height
|
12241
|
-
if (
|
12303
|
+
if (count || table.getBottomRows().length) {
|
12242
12304
|
style = {
|
12243
12305
|
height: totalSize,
|
12244
12306
|
paddingBottom,
|
@@ -12246,18 +12308,43 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12246
12308
|
};
|
12247
12309
|
}
|
12248
12310
|
// only render non sticky rows
|
12249
|
-
if (
|
12311
|
+
if (count) {
|
12250
12312
|
content = virtualItems.map(virtualRow => {
|
12313
|
+
var _row, _virtualiser$scrollDi2;
|
12251
12314
|
// there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
|
12252
12315
|
if (!virtualRow) {
|
12253
12316
|
return null;
|
12254
12317
|
}
|
12255
|
-
|
12318
|
+
let row;
|
12319
|
+
if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {
|
12320
|
+
var _tableMeta$server$pag, _tableMeta$server$pag2;
|
12321
|
+
const currentPageIndex = Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12322
|
+
const pagePosition = (_tableMeta$server$pag = (_tableMeta$server$pag2 = tableMeta.server.pages) === null || _tableMeta$server$pag2 === void 0 ? void 0 : _tableMeta$server$pag2.indexOf(currentPageIndex)) !== null && _tableMeta$server$pag !== void 0 ? _tableMeta$server$pag : -1;
|
12323
|
+
if (pagePosition > -1) {
|
12324
|
+
// "flatten" row indexes down into the dataloader2 dataset size
|
12325
|
+
// for example, with a page size of 100...
|
12326
|
+
// row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)
|
12327
|
+
const fakeIndex = pagePosition * tableMeta.server.pageSize + virtualRow.index % tableMeta.server.pageSize;
|
12328
|
+
row = rows[fakeIndex];
|
12329
|
+
}
|
12330
|
+
} else {
|
12331
|
+
row = rows[virtualRow.index];
|
12332
|
+
}
|
12333
|
+
if (!((_row = row) !== null && _row !== void 0 && _row.original)) {
|
12334
|
+
var _virtualiser$scrollDi;
|
12335
|
+
return /*#__PURE__*/React__default.createElement(SkeletonRow, {
|
12336
|
+
key: virtualRow.index,
|
12337
|
+
index: virtualRow.index,
|
12338
|
+
scrollDirection: (_virtualiser$scrollDi = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi !== void 0 ? _virtualiser$scrollDi : undefined,
|
12339
|
+
table: table
|
12340
|
+
});
|
12341
|
+
}
|
12256
12342
|
const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
|
12257
12343
|
return /*#__PURE__*/React__default.createElement(Row, {
|
12258
12344
|
key: row.id,
|
12259
12345
|
row: row,
|
12260
12346
|
index: virtualRow.index,
|
12347
|
+
scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
|
12261
12348
|
table: table,
|
12262
12349
|
measureRow: measureRow,
|
12263
12350
|
renderer: renderers.row,
|
@@ -12479,6 +12566,10 @@ function Header$3(context) {
|
|
12479
12566
|
const {
|
12480
12567
|
table
|
12481
12568
|
} = context;
|
12569
|
+
const tableMeta = table.options.meta;
|
12570
|
+
if (!tableMeta.rowExpansion.canExpandAll) {
|
12571
|
+
return null;
|
12572
|
+
}
|
12482
12573
|
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
12483
12574
|
const handleClick = event => {
|
12484
12575
|
event.stopPropagation();
|
@@ -12560,8 +12651,9 @@ function Header$4(context) {
|
|
12560
12651
|
}
|
12561
12652
|
const _temp = function () {
|
12562
12653
|
if (tableMeta.server.loadAllIfNeeded) {
|
12654
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12563
12655
|
// don't pass the search query because we need all data - not filtered data
|
12564
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12656
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined, hiddenColumns)).then(function () {});
|
12565
12657
|
}
|
12566
12658
|
}();
|
12567
12659
|
// load all data if that is possible
|
@@ -12620,6 +12712,7 @@ function Cell$3(context) {
|
|
12620
12712
|
if (event.shiftKey) {
|
12621
12713
|
var _tableMeta$rowSelecti;
|
12622
12714
|
function _temp4() {
|
12715
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12623
12716
|
table.setRowSelection(currentRowSelection => ({
|
12624
12717
|
...currentRowSelection,
|
12625
12718
|
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
@@ -12629,11 +12722,11 @@ function Cell$3(context) {
|
|
12629
12722
|
}));
|
12630
12723
|
}
|
12631
12724
|
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12632
|
-
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12633
12725
|
const _temp3 = function () {
|
12634
|
-
if (tableMeta.server.loadAllIfNeeded
|
12726
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12727
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12635
12728
|
// don't pass the search query because we need all data - not filtered data
|
12636
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
12729
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined, hiddenColumns)).then(function () {});
|
12637
12730
|
}
|
12638
12731
|
}();
|
12639
12732
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -12691,7 +12784,7 @@ function useTable(props, externalRef, renderers, meta, options) {
|
|
12691
12784
|
// configure the table
|
12692
12785
|
const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
|
12693
12786
|
// configure the virtualised renderer
|
12694
|
-
const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
|
12787
|
+
const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
|
12695
12788
|
// configure dynamic styling
|
12696
12789
|
const {
|
12697
12790
|
style,
|
@@ -13759,21 +13852,23 @@ function Summary(props) {
|
|
13759
13852
|
locale,
|
13760
13853
|
texts
|
13761
13854
|
} = useLocalization();
|
13762
|
-
const
|
13855
|
+
const tableMeta = table.options.meta;
|
13856
|
+
const length = tableMeta.length;
|
13763
13857
|
const currentLength = table.getRowModel().rows.length;
|
13764
13858
|
let label;
|
13765
13859
|
let count;
|
13766
13860
|
// row selection
|
13767
|
-
|
13861
|
+
// use table state and not the selected row model because of the way server loading works
|
13862
|
+
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
13768
13863
|
if (rowsSelectedLength > 0) {
|
13769
13864
|
label = texts.table.footer.summary.selected;
|
13770
13865
|
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13771
|
-
} else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
13866
|
+
} else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
|
13772
13867
|
// filtered data
|
13773
|
-
!!table.getState().globalFilter && table.options.enableGlobalFilter // search with hide enabled
|
13868
|
+
!!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled
|
13774
13869
|
) {
|
13775
13870
|
label = texts.table.footer.summary.records;
|
13776
|
-
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13871
|
+
count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(currentLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
13777
13872
|
} else {
|
13778
13873
|
label = texts.table.footer.summary.records;
|
13779
13874
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
@@ -13785,8 +13880,13 @@ function Summary(props) {
|
|
13785
13880
|
}
|
13786
13881
|
|
13787
13882
|
function Foot(props) {
|
13788
|
-
const
|
13789
|
-
|
13883
|
+
const {
|
13884
|
+
children,
|
13885
|
+
table,
|
13886
|
+
...attributes
|
13887
|
+
} = props;
|
13888
|
+
const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
|
13889
|
+
return /*#__PURE__*/React__default.createElement("tfoot", Object.assign({}, attributes), children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
|
13790
13890
|
key: header.id,
|
13791
13891
|
header: header,
|
13792
13892
|
index: index
|
@@ -13868,6 +13968,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13868
13968
|
onClickFindPrevious: handleClickFindPrevious,
|
13869
13969
|
settingsContent,
|
13870
13970
|
shortcut,
|
13971
|
+
showTotal = true,
|
13871
13972
|
value,
|
13872
13973
|
...attributes
|
13873
13974
|
} = props;
|
@@ -13946,10 +14047,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13946
14047
|
}
|
13947
14048
|
if (hasFind && isActive) {
|
13948
14049
|
postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
13949
|
-
className: "text-grey-700 flex h-4 items-center
|
13950
|
-
}, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
14050
|
+
className: "text-grey-700 flex h-4 items-center"
|
14051
|
+
}, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
|
13951
14052
|
className: "h-4 w-4"
|
13952
|
-
}) :
|
14053
|
+
})) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
|
14054
|
+
className: "border-r border-black/[0.25] pr-2"
|
14055
|
+
}, `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`)) : null), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
13953
14056
|
"aria-label": texts.searchInput.findPrevious,
|
13954
14057
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
13955
14058
|
icon: "chevron-up",
|
@@ -14053,6 +14156,7 @@ function Search$1(props) {
|
|
14053
14156
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
14054
14157
|
align: 'center'
|
14055
14158
|
});
|
14159
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
14056
14160
|
React__default.useEffect(() => {
|
14057
14161
|
if (tableMeta.search.highlightedColumnIndexes.length) {
|
14058
14162
|
scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
|
@@ -14061,9 +14165,11 @@ function Search$1(props) {
|
|
14061
14165
|
const handleFocus = function () {
|
14062
14166
|
try {
|
14063
14167
|
const _temp = function () {
|
14064
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
14168
|
+
if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
|
14065
14169
|
// don't pass the search query because we need all data - not filtered data
|
14066
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters
|
14170
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters,
|
14171
|
+
// the old data loader doesn't have server side search
|
14172
|
+
undefined, hiddenColumns)).then(function () {});
|
14067
14173
|
}
|
14068
14174
|
}();
|
14069
14175
|
// load all data if that is possible
|
@@ -14072,8 +14178,20 @@ function Search$1(props) {
|
|
14072
14178
|
return Promise.reject(e);
|
14073
14179
|
}
|
14074
14180
|
};
|
14181
|
+
const [loading, setLoading] = React__default.useState(false);
|
14182
|
+
const searchTimeoutRef = React__default.useRef();
|
14075
14183
|
const handleChange = query => {
|
14076
14184
|
table.setGlobalFilter(String(query !== null && query !== void 0 ? query : ''));
|
14185
|
+
if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
|
14186
|
+
clearTimeout(searchTimeoutRef.current);
|
14187
|
+
searchTimeoutRef.current = setTimeout(() => {
|
14188
|
+
var _tableMeta$search$han, _tableMeta$search;
|
14189
|
+
setLoading(true);
|
14190
|
+
(_tableMeta$search$han = (_tableMeta$search = tableMeta.search).handleSearch) === null || _tableMeta$search$han === void 0 ? void 0 : _tableMeta$search$han.call(_tableMeta$search, query, hiddenColumns).then(() => {
|
14191
|
+
setLoading(false);
|
14192
|
+
});
|
14193
|
+
}, 150);
|
14194
|
+
}
|
14077
14195
|
};
|
14078
14196
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
14079
14197
|
tableMeta.search.setEnableGlobalFilter(enabled, table);
|
@@ -14081,6 +14199,12 @@ function Search$1(props) {
|
|
14081
14199
|
var _ref$current;
|
14082
14200
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
14083
14201
|
});
|
14202
|
+
if (tableMeta.search.handleSearch) {
|
14203
|
+
setLoading(true);
|
14204
|
+
tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
|
14205
|
+
setLoading(false);
|
14206
|
+
});
|
14207
|
+
}
|
14084
14208
|
};
|
14085
14209
|
const handleNextResult = () => {
|
14086
14210
|
if (!tableMeta.search.highlightedColumnIndexes.length) {
|
@@ -14124,7 +14248,7 @@ function Search$1(props) {
|
|
14124
14248
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
14125
14249
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
14126
14250
|
findTotal: (_tableMeta$search$hig = (_tableMeta$search$hig2 = tableMeta.search.highlightedColumnIndexes) === null || _tableMeta$search$hig2 === void 0 ? void 0 : _tableMeta$search$hig2.length) !== null && _tableMeta$search$hig !== void 0 ? _tableMeta$search$hig : null,
|
14127
|
-
loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
|
14251
|
+
loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
|
14128
14252
|
name: "table-search",
|
14129
14253
|
onClickFindPrevious: handlePreviousResult,
|
14130
14254
|
onClickFindNext: handleNextResult,
|
@@ -14139,6 +14263,7 @@ function Search$1(props) {
|
|
14139
14263
|
meta: true,
|
14140
14264
|
shift: false
|
14141
14265
|
},
|
14266
|
+
showTotal: !tableMeta.server._experimentalDataLoader2,
|
14142
14267
|
value: query
|
14143
14268
|
}));
|
14144
14269
|
}
|
@@ -16184,8 +16309,9 @@ function Print$1(props) {
|
|
16184
16309
|
const toastRef = toast.loading(texts.table.print.loading);
|
16185
16310
|
const _temp2 = function () {
|
16186
16311
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
16312
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
16187
16313
|
const _temp = _catch(function () {
|
16188
|
-
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
|
16314
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined, hiddenColumns)).then(function () {});
|
16189
16315
|
}, function (error) {
|
16190
16316
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
16191
16317
|
console.error(errorMessage);
|
@@ -16859,6 +16985,7 @@ function TableGrid(props) {
|
|
16859
16985
|
var _table$state$grouping;
|
16860
16986
|
const {
|
16861
16987
|
enableHorizontalArrowKeyNavigation,
|
16988
|
+
footerRows,
|
16862
16989
|
table,
|
16863
16990
|
...attributes
|
16864
16991
|
} = props;
|
@@ -16901,7 +17028,7 @@ function TableGrid(props) {
|
|
16901
17028
|
} : table.renderer.style
|
16902
17029
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16903
17030
|
table: table.instance
|
16904
|
-
}) : null)))));
|
17031
|
+
}, footerRows) : null)))));
|
16905
17032
|
}
|
16906
17033
|
|
16907
17034
|
function Column$1(_) {
|
@@ -18493,6 +18620,14 @@ const shortcut = {
|
|
18493
18620
|
meta: true,
|
18494
18621
|
shift: false
|
18495
18622
|
};
|
18623
|
+
function isTableScrolled(ref) {
|
18624
|
+
if (ref.current) {
|
18625
|
+
var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
|
18626
|
+
const height = parseFloat(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$querySel = _ref$current.querySelector('tbody')) === null || _ref$current$querySel === void 0 ? void 0 : _ref$current$querySel.style.height) || '0') + parseFloat(((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$querySe = _ref$current2.querySelector('tbody')) === null || _ref$current2$querySe === void 0 ? void 0 : _ref$current2$querySe.style.paddingBottom) || '0');
|
18627
|
+
return height > ref.current.scrollHeight;
|
18628
|
+
}
|
18629
|
+
return false;
|
18630
|
+
}
|
18496
18631
|
|
18497
18632
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
18498
18633
|
const tableMeta = table.options.meta;
|
@@ -18543,18 +18678,21 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18543
18678
|
document.addEventListener('click', onClickOutside);
|
18544
18679
|
return () => document.removeEventListener('click', onClickOutside);
|
18545
18680
|
}, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
|
18546
|
-
|
18547
|
-
|
18548
|
-
|
18549
|
-
|
18550
|
-
|
18551
|
-
|
18552
|
-
|
18553
|
-
|
18554
|
-
|
18555
|
-
|
18556
|
-
|
18557
|
-
|
18681
|
+
/*
|
18682
|
+
const rows = table.getRowModel().rows;
|
18683
|
+
// make sure pending changes are removed for rows that no longer exist
|
18684
|
+
useLazyEffect(() => {
|
18685
|
+
const pendingChanges = tableMeta.editing.getErrorsShownInAlert();
|
18686
|
+
pendingChanges.forEach(pendingChange => {
|
18687
|
+
try {
|
18688
|
+
table.getRow(pendingChange.rowId);
|
18689
|
+
} catch {
|
18690
|
+
// TODO: this has the potential to remove changes for "unloaded" rows in server loading
|
18691
|
+
//tableMeta.editing.discardChanges(pendingChange.rowId, table);
|
18692
|
+
}
|
18693
|
+
});
|
18694
|
+
}, [rows.length]);
|
18695
|
+
*/
|
18558
18696
|
// shortcuts
|
18559
18697
|
useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
|
18560
18698
|
event.preventDefault();
|
@@ -18582,6 +18720,7 @@ function reducer$2(state, action) {
|
|
18582
18720
|
{
|
18583
18721
|
const {
|
18584
18722
|
columnId,
|
18723
|
+
index,
|
18585
18724
|
row,
|
18586
18725
|
value
|
18587
18726
|
} = payload;
|
@@ -18591,7 +18730,8 @@ function reducer$2(state, action) {
|
|
18591
18730
|
...state.changes,
|
18592
18731
|
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18593
18732
|
originals: setWith(state.changes.originals, rowId, row, Object)
|
18594
|
-
}
|
18733
|
+
},
|
18734
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18595
18735
|
};
|
18596
18736
|
}
|
18597
18737
|
case 'removeCellValue':
|
@@ -18625,6 +18765,7 @@ function reducer$2(state, action) {
|
|
18625
18765
|
{
|
18626
18766
|
const {
|
18627
18767
|
cellErrors,
|
18768
|
+
index,
|
18628
18769
|
moveReasons,
|
18629
18770
|
original,
|
18630
18771
|
value
|
@@ -18639,7 +18780,8 @@ function reducer$2(state, action) {
|
|
18639
18780
|
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18640
18781
|
// status can be undefined, so don't use ??
|
18641
18782
|
status: setWith(state.changes.status, rowId, undefined, Object)
|
18642
|
-
}
|
18783
|
+
},
|
18784
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18643
18785
|
};
|
18644
18786
|
}
|
18645
18787
|
case 'removeRow':
|
@@ -18657,6 +18799,7 @@ function reducer$2(state, action) {
|
|
18657
18799
|
originals: omit(state.changes.originals, rowId),
|
18658
18800
|
status: omit(state.changes.status, rowId)
|
18659
18801
|
},
|
18802
|
+
indexes: omit(state.indexes, rowId),
|
18660
18803
|
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18661
18804
|
};
|
18662
18805
|
}
|
@@ -18689,6 +18832,7 @@ function reducer$2(state, action) {
|
|
18689
18832
|
case 'insertTemporaryRow':
|
18690
18833
|
{
|
18691
18834
|
const {
|
18835
|
+
index,
|
18692
18836
|
value
|
18693
18837
|
} = payload;
|
18694
18838
|
return {
|
@@ -18698,7 +18842,8 @@ function reducer$2(state, action) {
|
|
18698
18842
|
...state.changes,
|
18699
18843
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18700
18844
|
originals: setWith(state.changes.originals, rowId, value, Object)
|
18701
|
-
}
|
18845
|
+
},
|
18846
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18702
18847
|
};
|
18703
18848
|
}
|
18704
18849
|
default:
|
@@ -18718,10 +18863,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18718
18863
|
[rowId]: state.changes.rows[rowId]
|
18719
18864
|
} : state.changes.rows;
|
18720
18865
|
let completed = true;
|
18721
|
-
const
|
18866
|
+
const _temp7 = _forOf(Object.keys(changes), function (rowId) {
|
18722
18867
|
const status = getRowStatus(rowId);
|
18723
18868
|
return _catch(function () {
|
18724
|
-
function
|
18869
|
+
function _temp6(_result) {
|
18725
18870
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18726
18871
|
// cleanup changes, we don't need them after saving
|
18727
18872
|
discardChanges(rowId, table);
|
@@ -18746,7 +18891,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18746
18891
|
delete changeSet[rowIdentityAccessor];
|
18747
18892
|
}
|
18748
18893
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18749
|
-
const
|
18894
|
+
const _temp5 = function () {
|
18750
18895
|
if (validator) {
|
18751
18896
|
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18752
18897
|
if (errors && Object.keys(errors).length) {
|
@@ -18755,7 +18900,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18755
18900
|
});
|
18756
18901
|
}
|
18757
18902
|
}();
|
18758
|
-
return
|
18903
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
|
18759
18904
|
}, function (error) {
|
18760
18905
|
var _error$response;
|
18761
18906
|
if (error instanceof ReferenceError || error instanceof TypeError || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) >= 500) {
|
@@ -18795,18 +18940,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18795
18940
|
}, function () {
|
18796
18941
|
return _exit;
|
18797
18942
|
});
|
18798
|
-
return Promise.resolve(
|
18943
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
|
18799
18944
|
return _exit ? _result3 : completed;
|
18800
|
-
}) : _exit ?
|
18945
|
+
}) : _exit ? _temp7 : completed);
|
18801
18946
|
} catch (e) {
|
18802
18947
|
return Promise.reject(e);
|
18803
18948
|
}
|
18804
18949
|
};
|
18805
18950
|
const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
|
18806
18951
|
try {
|
18807
|
-
function
|
18952
|
+
function _temp4() {
|
18808
18953
|
var _state$changes$errors11;
|
18809
|
-
function
|
18954
|
+
function _temp2() {
|
18810
18955
|
// only set errors and move reasons for the cells we're currently acting on
|
18811
18956
|
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18812
18957
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -18837,6 +18982,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18837
18982
|
rowId: cell.row.id,
|
18838
18983
|
payload: {
|
18839
18984
|
cellErrors: nextCellErrors,
|
18985
|
+
index: rowIndex,
|
18840
18986
|
moveReasons: nextMoveReasons,
|
18841
18987
|
value: nextChanges
|
18842
18988
|
}
|
@@ -18855,19 +19001,19 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18855
19001
|
};
|
18856
19002
|
// run validation
|
18857
19003
|
let validationErrors = {};
|
18858
|
-
const
|
19004
|
+
const _temp = function () {
|
18859
19005
|
if (validator) {
|
18860
19006
|
const nextRowValue = {
|
18861
19007
|
...state.changes.originals[cell.row.id],
|
18862
19008
|
...changes,
|
18863
19009
|
...updatesForOtherCells
|
18864
19010
|
};
|
18865
|
-
return Promise.resolve(validator(nextRowValue)).then(function (
|
18866
|
-
validationErrors =
|
19011
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
|
19012
|
+
validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18867
19013
|
});
|
18868
19014
|
}
|
18869
19015
|
}();
|
18870
|
-
return
|
19016
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
18871
19017
|
}
|
18872
19018
|
const changes = state.changes.rows[cell.row.id];
|
18873
19019
|
if (!changes) {
|
@@ -18875,7 +19021,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18875
19021
|
}
|
18876
19022
|
let updatesForOtherCells = {};
|
18877
19023
|
// run the updater handler if there is one, to see if there are any other cells to update
|
18878
|
-
const
|
19024
|
+
const _temp3 = function () {
|
18879
19025
|
if (typeof handleChange === 'function' && shouldRunUpdaters) {
|
18880
19026
|
const previousRowValue = {
|
18881
19027
|
...state.changes.originals[cell.row.id]
|
@@ -18889,42 +19035,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18889
19035
|
});
|
18890
19036
|
}
|
18891
19037
|
}();
|
18892
|
-
return Promise.resolve(
|
19038
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
18893
19039
|
} catch (e) {
|
18894
19040
|
return Promise.reject(e);
|
18895
19041
|
}
|
18896
19042
|
}; // general
|
18897
|
-
// rows
|
18898
|
-
const setRowValue = function (rowId, original, value) {
|
18899
|
-
try {
|
18900
|
-
function _temp2() {
|
18901
|
-
dispatch({
|
18902
|
-
type: 'updateRow',
|
18903
|
-
rowId,
|
18904
|
-
payload: {
|
18905
|
-
cellErrors,
|
18906
|
-
original,
|
18907
|
-
value
|
18908
|
-
}
|
18909
|
-
});
|
18910
|
-
}
|
18911
|
-
let cellErrors;
|
18912
|
-
const _temp = function () {
|
18913
|
-
if (validator) {
|
18914
|
-
const row = {
|
18915
|
-
...original,
|
18916
|
-
...value
|
18917
|
-
};
|
18918
|
-
return Promise.resolve(validator(row)).then(function (_validator) {
|
18919
|
-
cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18920
|
-
});
|
18921
|
-
}
|
18922
|
-
}();
|
18923
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
18924
|
-
} catch (e) {
|
18925
|
-
return Promise.reject(e);
|
18926
|
-
}
|
18927
|
-
};
|
18928
19043
|
const localization = useLocalization();
|
18929
19044
|
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18930
19045
|
changes: {
|
@@ -18934,8 +19049,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18934
19049
|
originals: {},
|
18935
19050
|
status: {}
|
18936
19051
|
},
|
19052
|
+
indexes: {},
|
18937
19053
|
temporaryRows: []
|
18938
19054
|
});
|
19055
|
+
// rows
|
18939
19056
|
function getRowValue(rowId) {
|
18940
19057
|
var _state$changes$rows$r, _state$changes$rows;
|
18941
19058
|
return (_state$changes$rows$r = (_state$changes$rows = state.changes.rows) === null || _state$changes$rows === void 0 ? void 0 : _state$changes$rows[rowId]) !== null && _state$changes$rows$r !== void 0 ? _state$changes$rows$r : undefined;
|
@@ -18973,7 +19090,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18973
19090
|
}
|
18974
19091
|
});
|
18975
19092
|
}
|
18976
|
-
function insertTemporaryRow(data) {
|
19093
|
+
function insertTemporaryRow(data, rowIndex) {
|
18977
19094
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18978
19095
|
const value = {
|
18979
19096
|
...data,
|
@@ -18983,13 +19100,14 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18983
19100
|
type: 'insertTemporaryRow',
|
18984
19101
|
rowId: newRowId,
|
18985
19102
|
payload: {
|
19103
|
+
index: rowIndex,
|
18986
19104
|
value
|
18987
19105
|
}
|
18988
19106
|
});
|
18989
19107
|
return newRowId;
|
18990
19108
|
}
|
18991
19109
|
// cells
|
18992
|
-
function setCellValue(cell, value) {
|
19110
|
+
function setCellValue(cell, rowIndex, value) {
|
18993
19111
|
const rowId = cell.row.id;
|
18994
19112
|
const columnId = cell.column.id;
|
18995
19113
|
// update if the change is different to the original value
|
@@ -18999,6 +19117,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18999
19117
|
rowId,
|
19000
19118
|
payload: {
|
19001
19119
|
columnId,
|
19120
|
+
index: rowIndex,
|
19002
19121
|
row: cell.row.original,
|
19003
19122
|
value
|
19004
19123
|
}
|
@@ -19031,6 +19150,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19031
19150
|
}
|
19032
19151
|
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
19033
19152
|
rowId,
|
19153
|
+
index: state.indexes[rowId],
|
19034
19154
|
changes: state.changes.rows[rowId],
|
19035
19155
|
errors: state.changes.errors[rowId]
|
19036
19156
|
}));
|
@@ -19054,7 +19174,6 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19054
19174
|
}
|
19055
19175
|
return {
|
19056
19176
|
// row
|
19057
|
-
setRowValue,
|
19058
19177
|
getRowValue,
|
19059
19178
|
getRowMoveReason,
|
19060
19179
|
hasRowErrors,
|
@@ -19093,11 +19212,11 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19093
19212
|
const changeset = row !== null && row !== void 0 ? row : handleCreate();
|
19094
19213
|
try {
|
19095
19214
|
if (changeset) {
|
19096
|
-
const rowId = pendingChangesFns.insertTemporaryRow(changeset);
|
19097
|
-
table.getRow(rowId).pin('bottom');
|
19098
19215
|
// set the active row to the new row before toggling editing on
|
19099
19216
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
19100
19217
|
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
19218
|
+
const rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
19219
|
+
table.getRow(rowId).pin('bottom');
|
19101
19220
|
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
19102
19221
|
toggleEditing(true, table, scrollToIndex);
|
19103
19222
|
setLastFocusedCellIndex(undefined);
|
@@ -19135,7 +19254,9 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19135
19254
|
tableMeta.rowActive.setRowActiveIndex(index);
|
19136
19255
|
}
|
19137
19256
|
setEditing(enabled);
|
19138
|
-
|
19257
|
+
const row = (_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id;
|
19258
|
+
if (row && !isTemporaryRow(row)) {
|
19259
|
+
console.log('hmm');
|
19139
19260
|
scrollToIndex(index);
|
19140
19261
|
}
|
19141
19262
|
}
|
@@ -19406,7 +19527,7 @@ function EditingControlCell(props) {
|
|
19406
19527
|
}, [cellRef.current]);
|
19407
19528
|
const handleChange = nextValue => {
|
19408
19529
|
if (nextValue !== value) {
|
19409
|
-
tableMeta.editing.setCellValue(cell, nextValue);
|
19530
|
+
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
19410
19531
|
if (hasNonTextControl) {
|
19411
19532
|
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19412
19533
|
}
|
@@ -19917,20 +20038,21 @@ function Alert$1(props) {
|
|
19917
20038
|
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19918
20039
|
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ? table.getColumn(String(tableMeta.rowIdentityAccessor)) : undefined;
|
19919
20040
|
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
20041
|
+
var _row;
|
19920
20042
|
// if appropriate, concatenate the item with the text "and"
|
19921
20043
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19922
20044
|
// Add space before and after `messageAnd` text
|
19923
20045
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19924
20046
|
}
|
19925
|
-
const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
|
19926
20047
|
const handleClick = () => {
|
19927
20048
|
// if row is visible
|
19928
|
-
if (
|
19929
|
-
scrollToRow(
|
20049
|
+
if (pendingChangeWithError.index > -1) {
|
20050
|
+
scrollToRow(pendingChangeWithError.index);
|
20051
|
+
tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
|
19930
20052
|
}
|
19931
20053
|
// if row is filtered out
|
19932
20054
|
else {
|
19933
|
-
setShowFilterResetDialog(pendingChangeWithError.
|
20055
|
+
setShowFilterResetDialog(pendingChangeWithError.index);
|
19934
20056
|
}
|
19935
20057
|
};
|
19936
20058
|
let tooltip;
|
@@ -19942,7 +20064,12 @@ function Alert$1(props) {
|
|
19942
20064
|
const columnName = (_table$getAllColumns$ = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)) === null || _table$getAllColumns$ === void 0 ? void 0 : (_table$getAllColumns$2 = _table$getAllColumns$.columnDef.meta) === null || _table$getAllColumns$2 === void 0 ? void 0 : _table$getAllColumns$2.header;
|
19943
20065
|
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19944
20066
|
}
|
19945
|
-
|
20067
|
+
let row;
|
20068
|
+
try {
|
20069
|
+
row = table.getRow(pendingChangeWithError.rowId).original;
|
20070
|
+
} catch {
|
20071
|
+
// because of server loading, some rows may not be accessible
|
20072
|
+
}
|
19946
20073
|
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
19947
20074
|
key: pendingChangeWithError.rowId,
|
19948
20075
|
title: tooltip
|
@@ -19950,7 +20077,7 @@ function Alert$1(props) {
|
|
19950
20077
|
className: "text-blue",
|
19951
20078
|
onClick: handleClick,
|
19952
20079
|
role: "button"
|
19953
|
-
}, rowIdentityColumn ? row[rowIdentityColumn.id] :
|
20080
|
+
}, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
|
19954
20081
|
// if appropriate, concatenate the item with the text ","
|
19955
20082
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19956
20083
|
links.push(', ');
|
@@ -19971,9 +20098,8 @@ function Alert$1(props) {
|
|
19971
20098
|
table.resetGlobalFilter();
|
19972
20099
|
table.resetColumnFilters();
|
19973
20100
|
requestAnimationFrame(() => {
|
19974
|
-
|
19975
|
-
|
19976
|
-
scrollToRow(rowIndex);
|
20101
|
+
if (showFilterResetDialog && showFilterResetDialog > -1) {
|
20102
|
+
scrollToRow(showFilterResetDialog);
|
19977
20103
|
}
|
19978
20104
|
setShowFilterResetDialog(false);
|
19979
20105
|
});
|
@@ -20037,10 +20163,10 @@ function CreateNewRow(props) {
|
|
20037
20163
|
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
20038
20164
|
const {
|
20039
20165
|
buttonRef,
|
20166
|
+
isScrolled,
|
20040
20167
|
scrollToIndex,
|
20041
20168
|
table,
|
20042
|
-
tableMeta
|
20043
|
-
tableRef
|
20169
|
+
tableMeta
|
20044
20170
|
} = props;
|
20045
20171
|
const {
|
20046
20172
|
texts
|
@@ -20073,11 +20199,9 @@ function CreateNewRow(props) {
|
|
20073
20199
|
keys: shortcut
|
20074
20200
|
});
|
20075
20201
|
}
|
20076
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20077
20202
|
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20078
20203
|
'bottom-10': tableMeta.footer.isEnabled,
|
20079
20204
|
'bottom-0': !tableMeta.footer.isEnabled,
|
20080
|
-
'border-t-2': isScrolled,
|
20081
20205
|
'border-b': !isScrolled
|
20082
20206
|
});
|
20083
20207
|
return /*#__PURE__*/React__default.createElement("tr", {
|
@@ -20102,6 +20226,7 @@ function CreateNewRow(props) {
|
|
20102
20226
|
function TemporaryRow(props) {
|
20103
20227
|
const {
|
20104
20228
|
createRowButtonRef,
|
20229
|
+
isScrolled,
|
20105
20230
|
table,
|
20106
20231
|
tableMeta,
|
20107
20232
|
tableRef
|
@@ -20164,10 +20289,9 @@ function TemporaryRow(props) {
|
|
20164
20289
|
}
|
20165
20290
|
}
|
20166
20291
|
};
|
20167
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20168
20292
|
const className = cn('group/row border-grey-300 !sticky z-[22]', {
|
20169
|
-
'bottom-[calc(5rem_+
|
20170
|
-
'bottom-[calc(2.5rem_+
|
20293
|
+
'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
|
20294
|
+
'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
|
20171
20295
|
'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
|
20172
20296
|
});
|
20173
20297
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
@@ -20182,7 +20306,8 @@ function TemporaryRow(props) {
|
|
20182
20306
|
onKeyDown: handleKeyDown,
|
20183
20307
|
onKeyDownCapture: handleKeyDownCapture,
|
20184
20308
|
hideInternalColumns: true,
|
20185
|
-
hideRowActions: !tableMeta.editing.isEditing
|
20309
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
20310
|
+
skipPageLoading: true
|
20186
20311
|
}))));
|
20187
20312
|
}
|
20188
20313
|
|
@@ -20203,6 +20328,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20203
20328
|
};
|
20204
20329
|
const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
|
20205
20330
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20331
|
+
const isScrolled = isTableScrolled(table3.ref);
|
20206
20332
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
20207
20333
|
table: table3
|
20208
20334
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -20215,19 +20341,27 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20215
20341
|
tableRef: table3.ref
|
20216
20342
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
20217
20343
|
"data-taco": "table3",
|
20344
|
+
footerRows: hasCreateWorkflow && isScrolled ? (/*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20345
|
+
buttonRef: table3.meta.editing.createRowButtonRef,
|
20346
|
+
isScrolled: isScrolled,
|
20347
|
+
scrollToIndex: table3.renderer.scrollToIndex,
|
20348
|
+
table: table3.instance,
|
20349
|
+
tableMeta: table3.meta
|
20350
|
+
})) : undefined,
|
20218
20351
|
table: table3
|
20219
20352
|
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20220
20353
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
20354
|
+
isScrolled: isScrolled,
|
20221
20355
|
table: table3.instance,
|
20222
20356
|
tableMeta: table3.meta,
|
20223
20357
|
tableRef: table3.ref
|
20224
|
-
}), /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20358
|
+
}), !isScrolled ? (/*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20225
20359
|
buttonRef: table3.meta.editing.createRowButtonRef,
|
20360
|
+
isScrolled: isScrolled,
|
20226
20361
|
scrollToIndex: table3.renderer.scrollToIndex,
|
20227
20362
|
table: table3.instance,
|
20228
|
-
tableMeta: table3.meta
|
20229
|
-
|
20230
|
-
}))) : null));
|
20363
|
+
tableMeta: table3.meta
|
20364
|
+
})) : null)) : null));
|
20231
20365
|
});
|
20232
20366
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
20233
20367
|
const stringifiedChildren = String(props.children);
|