@economic/taco 2.46.9-alpha.1 → 2.47.0-server-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/AlertDialog/AlertDialog.d.ts +1 -2
- package/dist/components/AlertDialog/components/Content.d.ts +0 -2
- package/dist/components/Dialog/components/Content.d.ts +3 -3
- package/dist/components/Menu/components/Content.d.ts +1 -1
- package/dist/components/Menu/components/SubMenu.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- 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/AlertDialog/AlertDialog.js +1 -2
- package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +2 -7
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -2
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +0 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.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/Select/Select.js +1 -2
- package/dist/esm/packages/taco/src/components/Select/Select.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 +365 -240
- 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 +16 -17
@@ -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'));
|
@@ -3946,11 +3946,6 @@ const Title = /*#__PURE__*/React.forwardRef(function AlertDialogTitle(props, ref
|
|
3946
3946
|
className: "mr-2"
|
3947
3947
|
})) : undefined, props.children);
|
3948
3948
|
});
|
3949
|
-
const Description = /*#__PURE__*/React.forwardRef(function AlertDialogDescription(props, ref) {
|
3950
|
-
return /*#__PURE__*/React.createElement(AlertDialogPrimitive.Description, Object.assign({
|
3951
|
-
ref: ref
|
3952
|
-
}, props));
|
3953
|
-
});
|
3954
3949
|
const Content = /*#__PURE__*/React.forwardRef(function AlertDialogContent(props, ref) {
|
3955
3950
|
const className = cn('p-6', getDialogPositionClassnames(), getDialogStylingClassnames(), getDialogSizeClassnames('dialog'));
|
3956
3951
|
return /*#__PURE__*/React.createElement(AlertDialogPrimitive.Portal, null, /*#__PURE__*/React.createElement(AlertDialogPrimitive.Overlay, {
|
@@ -3985,7 +3980,6 @@ const AlertDialog = /*#__PURE__*/React.forwardRef(function AlertDialog(props, re
|
|
3985
3980
|
});
|
3986
3981
|
AlertDialog.Trigger = Trigger;
|
3987
3982
|
AlertDialog.Content = Content;
|
3988
|
-
AlertDialog.Description = Description;
|
3989
3983
|
AlertDialog.Title = Title;
|
3990
3984
|
AlertDialog.Cancel = Cancel;
|
3991
3985
|
AlertDialog.Action = Action;
|
@@ -6625,7 +6619,7 @@ const useDraggable = ref => {
|
|
6625
6619
|
};
|
6626
6620
|
|
6627
6621
|
const Title$1 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
6628
|
-
const className = cn(
|
6622
|
+
const className = cn('text-center', props.className);
|
6629
6623
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Title, Object.assign({}, props, {
|
6630
6624
|
className: className,
|
6631
6625
|
ref: ref
|
@@ -6698,7 +6692,6 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
|
|
6698
6692
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Portal, null, /*#__PURE__*/React.createElement(DialogPrimitive.Overlay, {
|
6699
6693
|
asChild: true
|
6700
6694
|
}, /*#__PURE__*/React.createElement(Backdrop, null, /*#__PURE__*/React.createElement(DialogPrimitive.Content, Object.assign({}, props, {
|
6701
|
-
"aria-describedby": undefined,
|
6702
6695
|
className: className,
|
6703
6696
|
onEscapeKeyDown: handleEscapeKeyDown,
|
6704
6697
|
onInteractOutside: handleInteractOutside,
|
@@ -7226,7 +7219,6 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
7226
7219
|
return focusTrap ? (/*#__PURE__*/React__default.createElement(DialogPrimitive.Content, Object.assign({
|
7227
7220
|
forceMount: true
|
7228
7221
|
}, otherProps, {
|
7229
|
-
"aria-describedby": undefined,
|
7230
7222
|
className: contentClassName,
|
7231
7223
|
onEscapeKeyDown: handleEscapeKeyDown,
|
7232
7224
|
onInteractOutside: variant === 'overlay' ? undefined : event => event.preventDefault(),
|
@@ -9350,8 +9342,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
9350
9342
|
name: popover.open ? 'chevron-up' : 'chevron-down'
|
9351
9343
|
}))), /*#__PURE__*/React.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React.createElement(PopoverPrimitive.Content, {
|
9352
9344
|
align: "start",
|
9353
|
-
sideOffset: 4
|
9354
|
-
onEscapeKeyDown: event => event.preventDefault()
|
9345
|
+
sideOffset: 4
|
9355
9346
|
}, props.multiselect ? /*#__PURE__*/React.createElement(MultiListbox, Object.assign({}, commonListboxProps)) : /*#__PURE__*/React.createElement(Listbox, Object.assign({}, commonListboxProps)))), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
9356
9347
|
className: "hidden",
|
9357
9348
|
type: "text"
|
@@ -10196,6 +10187,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
|
|
10196
10187
|
function freezeUptoExternalColumn(index, columns) {
|
10197
10188
|
return columns.slice(0, index + 1);
|
10198
10189
|
}
|
10190
|
+
function getHiddenColumns(columnVisibility = {}) {
|
10191
|
+
return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
|
10192
|
+
}
|
10199
10193
|
|
10200
10194
|
function getSettings(table) {
|
10201
10195
|
const meta = table.options.meta;
|
@@ -10477,6 +10471,12 @@ function configureReactTableOptions(options, props, localization) {
|
|
10477
10471
|
var _column$columnDef$met;
|
10478
10472
|
return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
|
10479
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
|
+
}
|
10480
10480
|
}
|
10481
10481
|
if (tableOptions.enableSorting) {
|
10482
10482
|
// enter controlled sort mode (controlled could be local state, but usually the server)
|
@@ -10534,6 +10534,7 @@ const DEFAULT_PRESET = {
|
|
10534
10534
|
enableColumnHiding: false,
|
10535
10535
|
enableColumnResizing: false,
|
10536
10536
|
enableRowExpansion: false,
|
10537
|
+
enableRowExpansionAll: true,
|
10537
10538
|
enableRowSelection: false,
|
10538
10539
|
// custom -- common between all table types
|
10539
10540
|
enableColumnOrdering: false,
|
@@ -10560,6 +10561,7 @@ const presets = {
|
|
10560
10561
|
enableColumnHiding: true,
|
10561
10562
|
enableColumnResizing: true,
|
10562
10563
|
enableRowExpansion: true,
|
10564
|
+
enableRowExpansionAll: true,
|
10563
10565
|
enableRowSelection: true,
|
10564
10566
|
// custom -- common between all table types
|
10565
10567
|
enableColumnOrdering: true,
|
@@ -10585,6 +10587,7 @@ const presets = {
|
|
10585
10587
|
enableColumnHiding: false,
|
10586
10588
|
enableColumnResizing: false,
|
10587
10589
|
enableRowExpansion: true,
|
10590
|
+
enableRowExpansionAll: true,
|
10588
10591
|
enableRowSelection: true,
|
10589
10592
|
// custom -- common between all table types
|
10590
10593
|
enableColumnOrdering: false,
|
@@ -10610,6 +10613,7 @@ const presets = {
|
|
10610
10613
|
enableColumnHiding: false,
|
10611
10614
|
enableColumnResizing: false,
|
10612
10615
|
enableRowExpansion: true,
|
10616
|
+
enableRowExpansionAll: true,
|
10613
10617
|
enableRowSelection: false,
|
10614
10618
|
// custom -- common between all table types
|
10615
10619
|
enableColumnOrdering: false,
|
@@ -10627,7 +10631,7 @@ const presets = {
|
|
10627
10631
|
}
|
10628
10632
|
};
|
10629
10633
|
function getTableFeaturePreset(props) {
|
10630
|
-
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;
|
10631
10635
|
const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
|
10632
10636
|
const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
|
10633
10637
|
const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
|
@@ -10635,6 +10639,7 @@ function getTableFeaturePreset(props) {
|
|
10635
10639
|
const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
|
10636
10640
|
const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
|
10637
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;
|
10638
10643
|
const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
|
10639
10644
|
return {
|
10640
10645
|
// react-table built-in
|
@@ -10659,6 +10664,7 @@ function getTableFeaturePreset(props) {
|
|
10659
10664
|
enableRowDrag: enableRowDrag && !!props.onRowDrag,
|
10660
10665
|
enableRowDrop: enableRowDrop && !!props.onRowDrop,
|
10661
10666
|
enableRowGoto: enableRowGoto && !!props.onRowGoto,
|
10667
|
+
enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
|
10662
10668
|
enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
|
10663
10669
|
enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
|
10664
10670
|
};
|
@@ -10854,7 +10860,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
|
|
10854
10860
|
return index;
|
10855
10861
|
});
|
10856
10862
|
}
|
10857
|
-
}, [rowActiveIndex,
|
10863
|
+
}, [rowActiveIndex, isEnabled]);
|
10858
10864
|
return {
|
10859
10865
|
isEnabled,
|
10860
10866
|
rowActiveIndex,
|
@@ -10903,9 +10909,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
|
|
10903
10909
|
};
|
10904
10910
|
}
|
10905
10911
|
|
10906
|
-
function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
|
10912
|
+
function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
|
10907
10913
|
return {
|
10908
10914
|
isEnabled,
|
10915
|
+
canExpandAll,
|
10909
10916
|
rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
|
10910
10917
|
};
|
10911
10918
|
}
|
@@ -10969,7 +10976,7 @@ function useTableRowSelection(isEnabled = false) {
|
|
10969
10976
|
- Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
|
10970
10977
|
- Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
|
10971
10978
|
*/
|
10972
|
-
function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
10979
|
+
function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
|
10973
10980
|
const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
|
10974
10981
|
function setEnableGlobalFilter(enabled, instance) {
|
10975
10982
|
_setEnableGlobalFilter(enabled);
|
@@ -10994,18 +11001,19 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
|
|
10994
11001
|
highlightedColumnIndexes,
|
10995
11002
|
setHighlightedColumnIndexes,
|
10996
11003
|
currentHighlightColumnIndex,
|
10997
|
-
setCurrentHighlightColumnIndex
|
11004
|
+
setCurrentHighlightColumnIndex,
|
11005
|
+
handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
|
10998
11006
|
};
|
10999
11007
|
}
|
11000
11008
|
|
11001
11009
|
// A type of promise-like that resolves synchronously and supports only one observer
|
11002
|
-
|
11010
|
+
var _Pact = /*#__PURE__*/function () {
|
11003
11011
|
function _Pact() {}
|
11004
11012
|
_Pact.prototype.then = function (onFulfilled, onRejected) {
|
11005
|
-
|
11006
|
-
|
11013
|
+
var result = new _Pact();
|
11014
|
+
var state = this.s;
|
11007
11015
|
if (state) {
|
11008
|
-
|
11016
|
+
var callback = state & 1 ? onFulfilled : onRejected;
|
11009
11017
|
if (callback) {
|
11010
11018
|
try {
|
11011
11019
|
_settle(result, 1, callback(this.v));
|
@@ -11019,7 +11027,7 @@ const _Pact = /*#__PURE__*/function () {
|
|
11019
11027
|
}
|
11020
11028
|
this.o = function (_this) {
|
11021
11029
|
try {
|
11022
|
-
|
11030
|
+
var value = _this.v;
|
11023
11031
|
if (_this.s & 1) {
|
11024
11032
|
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
|
11025
11033
|
} else if (onRejected) {
|
@@ -11056,7 +11064,7 @@ function _settle(pact, state, value) {
|
|
11056
11064
|
}
|
11057
11065
|
pact.s = state;
|
11058
11066
|
pact.v = value;
|
11059
|
-
|
11067
|
+
var observer = pact.o;
|
11060
11068
|
if (observer) {
|
11061
11069
|
observer(pact);
|
11062
11070
|
}
|
@@ -11096,17 +11104,13 @@ function _forTo(array, body, check) {
|
|
11096
11104
|
_cycle();
|
11097
11105
|
return pact;
|
11098
11106
|
}
|
11099
|
-
|
11107
|
+
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
|
11100
11108
|
|
11101
11109
|
// Asynchronously iterate through an object's values
|
11102
11110
|
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
|
11103
11111
|
function _forOf(target, body, check) {
|
11104
11112
|
if (typeof target[_iteratorSymbol] === "function") {
|
11105
|
-
var
|
11106
|
-
step,
|
11107
|
-
pact,
|
11108
|
-
reject;
|
11109
|
-
function _cycle(result) {
|
11113
|
+
var _cycle = function _cycle(result) {
|
11110
11114
|
try {
|
11111
11115
|
while (!(step = iterator.next()).done && (!check || !check())) {
|
11112
11116
|
result = body(step.value);
|
@@ -11127,13 +11131,17 @@ function _forOf(target, body, check) {
|
|
11127
11131
|
} catch (e) {
|
11128
11132
|
_settle(pact || (pact = new _Pact()), 2, e);
|
11129
11133
|
}
|
11130
|
-
}
|
11134
|
+
};
|
11135
|
+
var iterator = target[_iteratorSymbol](),
|
11136
|
+
step,
|
11137
|
+
pact,
|
11138
|
+
reject;
|
11131
11139
|
_cycle();
|
11132
|
-
if (iterator
|
11133
|
-
var _fixup = function (value) {
|
11140
|
+
if (iterator["return"]) {
|
11141
|
+
var _fixup = function _fixup(value) {
|
11134
11142
|
try {
|
11135
11143
|
if (!step.done) {
|
11136
|
-
iterator
|
11144
|
+
iterator["return"]();
|
11137
11145
|
}
|
11138
11146
|
} catch (e) {}
|
11139
11147
|
return value;
|
@@ -11160,7 +11168,7 @@ function _forOf(target, body, check) {
|
|
11160
11168
|
return body(values[i]);
|
11161
11169
|
}, check);
|
11162
11170
|
}
|
11163
|
-
|
11171
|
+
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
11164
11172
|
|
11165
11173
|
// Asynchronously call a function and send errors to recovery continuation
|
11166
11174
|
function _catch(body, recover) {
|
@@ -11241,7 +11249,7 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11241
11249
|
length.current = response.length;
|
11242
11250
|
nextData = Array(length.current).fill(undefined);
|
11243
11251
|
} else {
|
11244
|
-
nextData = [
|
11252
|
+
nextData = [].concat(currentData);
|
11245
11253
|
}
|
11246
11254
|
const startIndex = pageIndex * pageSize;
|
11247
11255
|
nextData.splice(startIndex, pageSize, ...response.data);
|
@@ -11307,13 +11315,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11307
11315
|
try {
|
11308
11316
|
if (_lastUsedSearch.current) {
|
11309
11317
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11310
|
-
loadAll(sorting, _lastUsedFilters.current);
|
11318
|
+
return loadAll(sorting, _lastUsedFilters.current);
|
11311
11319
|
} else {
|
11312
11320
|
var _lastUsedPageIndex$cu2;
|
11313
11321
|
// load the last page that we scrolled to
|
11314
|
-
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);
|
11315
11323
|
}
|
11316
|
-
return Promise.resolve();
|
11317
11324
|
} catch (e) {
|
11318
11325
|
return Promise.reject(e);
|
11319
11326
|
}
|
@@ -11322,13 +11329,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11322
11329
|
try {
|
11323
11330
|
if (_lastUsedSearch.current) {
|
11324
11331
|
// we're searching, which means we need to refetch all with the correct sorting applied
|
11325
|
-
loadAll(_lastUsedSorting.current, filters);
|
11332
|
+
return loadAll(_lastUsedSorting.current, filters);
|
11326
11333
|
} else {
|
11327
11334
|
var _lastUsedPageIndex$cu3;
|
11328
11335
|
// load the last page that we scrolled to
|
11329
|
-
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);
|
11330
11337
|
}
|
11331
|
-
return Promise.resolve();
|
11332
11338
|
} catch (e) {
|
11333
11339
|
return Promise.reject(e);
|
11334
11340
|
}
|
@@ -11356,7 +11362,7 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
|
|
11356
11362
|
}, invalidate];
|
11357
11363
|
}
|
11358
11364
|
|
11359
|
-
function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
|
11365
|
+
function useTableServerLoading(loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
|
11360
11366
|
const isEnabled = !!loadPage && !!loadAll;
|
11361
11367
|
const [isReady, setReady] = React__default.useState(false);
|
11362
11368
|
const [loadAllStatus, setLoadedStatus] = React__default.useState(exports.TableServerLoadAllState.Incomplete);
|
@@ -11411,13 +11417,15 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
11411
11417
|
};
|
11412
11418
|
}
|
11413
11419
|
return {
|
11420
|
+
pages,
|
11414
11421
|
isEnabled,
|
11415
11422
|
isReady,
|
11416
11423
|
loadPage: _loadPage,
|
11417
11424
|
loadAll: _loadAll,
|
11418
11425
|
loadAllIfNeeded: _loadAllIfNeeded,
|
11419
11426
|
loadAllStatus,
|
11420
|
-
pageSize
|
11427
|
+
pageSize,
|
11428
|
+
_experimentalDataLoader2
|
11421
11429
|
};
|
11422
11430
|
}
|
11423
11431
|
|
@@ -11514,7 +11522,8 @@ function useTableFilterListener(table, onFilter) {
|
|
11514
11522
|
const columnFilters = table.getState().columnFilters;
|
11515
11523
|
useLazyEffect(() => {
|
11516
11524
|
if (table.options.enableColumnFilters && typeof onFilter === 'function') {
|
11517
|
-
|
11525
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11526
|
+
onFilter(columnFilters, hiddenColumns);
|
11518
11527
|
if (table.options.enableRowSelection) {
|
11519
11528
|
table.resetRowSelection();
|
11520
11529
|
}
|
@@ -11572,11 +11581,12 @@ function useTableRowHeightListener(table) {
|
|
11572
11581
|
}
|
11573
11582
|
|
11574
11583
|
function useTableRowSelectionListener(table, onRowSelect) {
|
11584
|
+
// note that the selected row model may not contain all rows in state when using server loading
|
11575
11585
|
const rows = table.getSelectedRowModel().flatRows;
|
11576
|
-
const
|
11586
|
+
const state = table.getState().rowSelection;
|
11577
11587
|
useLazyEffect(() => {
|
11578
11588
|
if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
|
11579
|
-
onRowSelect(
|
11589
|
+
onRowSelect(rows.map(row => row.original), Object.keys(state));
|
11580
11590
|
}
|
11581
11591
|
/**
|
11582
11592
|
* Casting to a boolean, since enableRowSelection can be a function,
|
@@ -11584,33 +11594,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
|
|
11584
11594
|
* we only need to know if selection was enabled or disabled, because enableRowSelection function
|
11585
11595
|
* will be applied directly to particular rows.
|
11586
11596
|
*/
|
11587
|
-
}, [!!table.options.enableRowSelection,
|
11597
|
+
}, [!!table.options.enableRowSelection, state]);
|
11588
11598
|
}
|
11589
11599
|
|
11590
|
-
function useTableSearchListener(table
|
11600
|
+
function useTableSearchListener(table) {
|
11591
11601
|
const meta = table.options.meta;
|
11592
11602
|
const localization = useLocalization();
|
11593
|
-
const
|
11603
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
11604
|
+
const query = table.getState().globalFilter;
|
11594
11605
|
// Need to re-run search when columns are getting shown/hidden.
|
11595
|
-
|
11596
|
-
if (meta.search.isEnabled
|
11597
|
-
const currentFilter =
|
11606
|
+
useLazyEffect(() => {
|
11607
|
+
if (meta.search.isEnabled) {
|
11608
|
+
const currentFilter = query;
|
11598
11609
|
requestAnimationFrame(() => {
|
11599
11610
|
table.resetGlobalFilter();
|
11600
11611
|
table.setGlobalFilter(currentFilter);
|
11601
11612
|
});
|
11613
|
+
if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
|
11614
|
+
meta.search.handleSearch(query, hiddenColumns);
|
11615
|
+
}
|
11602
11616
|
}
|
11603
|
-
}, [
|
11617
|
+
}, [hiddenColumns.length]);
|
11604
11618
|
// recalculates highlighted indexes whenever something important changes
|
11605
|
-
|
11619
|
+
useLazyEffect(() => {
|
11606
11620
|
if (meta.search.isEnabled) {
|
11607
|
-
const query = table.getState().globalFilter;
|
11608
11621
|
resetHighlightedColumnIndexes(query, table, localization);
|
11609
|
-
if (typeof onChangeSearch === 'function') {
|
11610
|
-
onChangeSearch(query);
|
11611
|
-
}
|
11612
11622
|
}
|
11613
|
-
}, [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)]);
|
11614
11624
|
}
|
11615
11625
|
|
11616
11626
|
function useTableSettingsListener(table, onChangeSettings) {
|
@@ -11694,12 +11704,15 @@ function useTableSortingListener(table, onSort) {
|
|
11694
11704
|
}
|
11695
11705
|
|
11696
11706
|
function useTableServerLoadingListener(table, loadPage) {
|
11697
|
-
const
|
11698
|
-
const columnFilters = table.getState().columnFilters;
|
11707
|
+
const meta = table.options.meta;
|
11699
11708
|
// trigger load of the first page on mount
|
11700
11709
|
React__default.useEffect(() => {
|
11701
11710
|
if (loadPage) {
|
11702
|
-
|
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);
|
11703
11716
|
}
|
11704
11717
|
}, []);
|
11705
11718
|
}
|
@@ -11746,13 +11759,13 @@ function useTableManager(props, meta, internalColumns) {
|
|
11746
11759
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
11747
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);
|
11748
11761
|
const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
|
11749
|
-
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
|
11762
|
+
const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
|
11750
11763
|
const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
|
11751
11764
|
const rowGroups = useTableRowGroups(props.rowActionsForGroup);
|
11752
11765
|
const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
|
11753
11766
|
const rowSelection = useTableRowSelection(!!options.enableRowSelection);
|
11754
|
-
const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
11755
|
-
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);
|
11756
11769
|
// TODO: memoise
|
11757
11770
|
// convert jsx column components into valid table columns
|
11758
11771
|
const {
|
@@ -11803,7 +11816,7 @@ function useTableManager(props, meta, internalColumns) {
|
|
11803
11816
|
useTableFontSizeListener(instance);
|
11804
11817
|
useTableRowHeightListener(instance);
|
11805
11818
|
useTableRowSelectionListener(instance, props.onRowSelect);
|
11806
|
-
useTableSearchListener(instance
|
11819
|
+
useTableSearchListener(instance);
|
11807
11820
|
useTableServerLoadingListener(instance, server.loadPage);
|
11808
11821
|
useTableSettingsListener(instance, setSettings);
|
11809
11822
|
useTableShortcutsListener(instance, props.shortcuts);
|
@@ -12029,7 +12042,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
12029
12042
|
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
12030
12043
|
return;
|
12031
12044
|
}
|
12032
|
-
tableMeta.rowActive.handleKeyDown(event,
|
12045
|
+
tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
|
12033
12046
|
tableMeta.rowSelection.handleKeyDown(event, table);
|
12034
12047
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
12035
12048
|
var _rows$tableMeta$rowAc;
|
@@ -12065,57 +12078,131 @@ const ROW_HEIGHT_ESTIMATES = {
|
|
12065
12078
|
'extra-tall': 57
|
12066
12079
|
};
|
12067
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;
|
12068
12154
|
function SkeletonRow(props) {
|
12069
12155
|
const {
|
12070
12156
|
index,
|
12071
|
-
row,
|
12072
12157
|
table
|
12073
12158
|
} = props;
|
12074
12159
|
const tableMeta = table.options.meta;
|
12075
12160
|
if (tableMeta.server.isEnabled) {
|
12076
|
-
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props
|
12077
|
-
index: index
|
12078
|
-
}));
|
12161
|
+
return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
|
12079
12162
|
}
|
12080
12163
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12081
|
-
cellsCount:
|
12164
|
+
cellsCount: table.getVisibleFlatColumns().length,
|
12165
|
+
index: index
|
12082
12166
|
});
|
12083
12167
|
}
|
12084
12168
|
function RowWithServerLoading(props) {
|
12085
12169
|
var _table$getState$group, _table$getState;
|
12086
12170
|
const {
|
12087
12171
|
index,
|
12088
|
-
row,
|
12089
12172
|
table
|
12090
12173
|
} = props;
|
12091
12174
|
const tableMeta = table.options.meta;
|
12092
12175
|
const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
|
12093
|
-
const {
|
12094
|
-
ref,
|
12095
|
-
inView
|
12096
|
-
} = reactIntersectionObserver.useInView({
|
12097
|
-
threshold: 0,
|
12098
|
-
triggerOnce: true,
|
12099
|
-
initialInView: pageIndex === 0
|
12100
|
-
});
|
12101
12176
|
React__default.useEffect(() => {
|
12102
|
-
|
12103
|
-
|
12104
|
-
|
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);
|
12105
12187
|
}
|
12106
|
-
|
12188
|
+
return () => {
|
12189
|
+
clearTimeout(timeout);
|
12190
|
+
};
|
12191
|
+
}, []);
|
12107
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;
|
12108
|
-
const ungroupedCellCount =
|
12193
|
+
const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
|
12109
12194
|
return /*#__PURE__*/React__default.createElement(Skeleton, {
|
12110
12195
|
cellsCount: ungroupedCellCount,
|
12111
|
-
|
12196
|
+
index: index
|
12112
12197
|
});
|
12113
12198
|
}
|
12114
12199
|
const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
|
12115
12200
|
const {
|
12116
|
-
cellsCount
|
12201
|
+
cellsCount,
|
12202
|
+
index
|
12117
12203
|
} = props;
|
12118
12204
|
return /*#__PURE__*/React__default.createElement("tr", {
|
12205
|
+
"data-row-index": index,
|
12119
12206
|
ref: ref
|
12120
12207
|
}, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
|
12121
12208
|
key: index
|
@@ -12124,41 +12211,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
|
|
12124
12211
|
})))));
|
12125
12212
|
});
|
12126
12213
|
|
12127
|
-
const RowContext = /*#__PURE__*/React__default.createContext({
|
12128
|
-
hideInternalColumns: false,
|
12129
|
-
hideRowActions: false,
|
12130
|
-
isHovered: false,
|
12131
|
-
rowIndex: -1
|
12132
|
-
});
|
12133
|
-
|
12134
|
-
/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
|
12135
|
-
function Row(props) {
|
12136
|
-
const {
|
12137
|
-
renderer: RowRenderer,
|
12138
|
-
cellRenderer: CellRenderer,
|
12139
|
-
hideInternalColumns = false,
|
12140
|
-
hideRowActions = false,
|
12141
|
-
...displayRowProps
|
12142
|
-
} = props;
|
12143
|
-
const tableMeta = props.table.options.meta;
|
12144
|
-
const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
|
12145
|
-
// context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
|
12146
|
-
const contextValue = React__default.useMemo(() => ({
|
12147
|
-
isHovered,
|
12148
|
-
rowIndex: props.index,
|
12149
|
-
hideInternalColumns,
|
12150
|
-
hideRowActions
|
12151
|
-
}), [isHovered, props.index, hideInternalColumns, hideRowActions]);
|
12152
|
-
if (props.row.original === undefined) {
|
12153
|
-
return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
|
12154
|
-
}
|
12155
|
-
return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
|
12156
|
-
value: contextValue
|
12157
|
-
}, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
|
12158
|
-
cellRenderer: CellRenderer
|
12159
|
-
})));
|
12160
|
-
}
|
12161
|
-
|
12162
12214
|
// scroll padding end is designed to always show half of the next row
|
12163
12215
|
function getScrollPaddingEndOffset(table) {
|
12164
12216
|
const tableMeta = table.options.meta;
|
@@ -12183,7 +12235,7 @@ function getPaddingEndOffset(table, options) {
|
|
12183
12235
|
const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
|
12184
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;
|
12185
12237
|
}
|
12186
|
-
function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
|
12238
|
+
function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
|
12187
12239
|
var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
|
12188
12240
|
const tableMeta = table.options.meta;
|
12189
12241
|
const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
|
@@ -12197,11 +12249,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12197
12249
|
const rangeExtractor = useRowGroupVirtualisation(table);
|
12198
12250
|
// account for thead and tfoot in the scroll area - both are always medium row height
|
12199
12251
|
const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
|
12252
|
+
const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
|
12200
12253
|
const virtualiser = reactVirtual.useVirtualizer({
|
12201
|
-
count
|
12254
|
+
count,
|
12202
12255
|
estimateSize,
|
12203
12256
|
getScrollElement: () => tableRef.current,
|
12204
|
-
overscan: tableMeta.printing.isPrinting ?
|
12257
|
+
overscan: tableMeta.printing.isPrinting ? count : undefined,
|
12205
12258
|
rangeExtractor,
|
12206
12259
|
// correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
|
12207
12260
|
scrollPaddingStart,
|
@@ -12221,16 +12274,16 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12221
12274
|
if (tableRef.current) {
|
12222
12275
|
if (index === 0) {
|
12223
12276
|
virtualiser.scrollToOffset(0, notSmooth);
|
12224
|
-
} else if (index ===
|
12277
|
+
} else if (index === count - 1) {
|
12225
12278
|
// sometimes the last row doesn't fully show, so we just force scroll to the bottom
|
12226
12279
|
tableRef.current.scrollTop = tableRef.current.scrollHeight;
|
12227
12280
|
} else {
|
12228
12281
|
virtualiser.scrollToIndex(index, options);
|
12229
12282
|
}
|
12230
12283
|
}
|
12231
|
-
}, [virtualItems.length, tableRef.current, totalSize,
|
12284
|
+
}, [virtualItems.length, tableRef.current, totalSize, count]);
|
12232
12285
|
// use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
|
12233
|
-
const paddingStartIndex = isTableRowGrouped &&
|
12286
|
+
const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
|
12234
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;
|
12235
12288
|
// styling for offsetting rows - this "is" the virtualisation
|
12236
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];
|
@@ -12247,7 +12300,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12247
12300
|
let style = {};
|
12248
12301
|
let content = null;
|
12249
12302
|
// bottom rows aren't virtualised (they're sticky) but we need to set the height
|
12250
|
-
if (
|
12303
|
+
if (count || table.getBottomRows().length) {
|
12251
12304
|
style = {
|
12252
12305
|
height: totalSize,
|
12253
12306
|
paddingBottom,
|
@@ -12255,18 +12308,43 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
|
|
12255
12308
|
};
|
12256
12309
|
}
|
12257
12310
|
// only render non sticky rows
|
12258
|
-
if (
|
12311
|
+
if (count) {
|
12259
12312
|
content = virtualItems.map(virtualRow => {
|
12313
|
+
var _row, _virtualiser$scrollDi2;
|
12260
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
|
12261
12315
|
if (!virtualRow) {
|
12262
12316
|
return null;
|
12263
12317
|
}
|
12264
|
-
|
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
|
+
}
|
12265
12342
|
const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
|
12266
12343
|
return /*#__PURE__*/React__default.createElement(Row, {
|
12267
12344
|
key: row.id,
|
12268
12345
|
row: row,
|
12269
12346
|
index: virtualRow.index,
|
12347
|
+
scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
|
12270
12348
|
table: table,
|
12271
12349
|
measureRow: measureRow,
|
12272
12350
|
renderer: renderers.row,
|
@@ -12488,6 +12566,10 @@ function Header$3(context) {
|
|
12488
12566
|
const {
|
12489
12567
|
table
|
12490
12568
|
} = context;
|
12569
|
+
const tableMeta = table.options.meta;
|
12570
|
+
if (!tableMeta.rowExpansion.canExpandAll) {
|
12571
|
+
return null;
|
12572
|
+
}
|
12491
12573
|
const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
|
12492
12574
|
const handleClick = event => {
|
12493
12575
|
event.stopPropagation();
|
@@ -12569,8 +12651,9 @@ function Header$4(context) {
|
|
12569
12651
|
}
|
12570
12652
|
const _temp = function () {
|
12571
12653
|
if (tableMeta.server.loadAllIfNeeded) {
|
12654
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12572
12655
|
// don't pass the search query because we need all data - not filtered data
|
12573
|
-
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 () {});
|
12574
12657
|
}
|
12575
12658
|
}();
|
12576
12659
|
// load all data if that is possible
|
@@ -12629,6 +12712,7 @@ function Cell$3(context) {
|
|
12629
12712
|
if (event.shiftKey) {
|
12630
12713
|
var _tableMeta$rowSelecti;
|
12631
12714
|
function _temp4() {
|
12715
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12632
12716
|
table.setRowSelection(currentRowSelection => ({
|
12633
12717
|
...currentRowSelection,
|
12634
12718
|
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
@@ -12638,11 +12722,11 @@ function Cell$3(context) {
|
|
12638
12722
|
}));
|
12639
12723
|
}
|
12640
12724
|
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
12641
|
-
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
12642
12725
|
const _temp3 = function () {
|
12643
|
-
if (tableMeta.server.loadAllIfNeeded
|
12726
|
+
if (tableMeta.server.loadAllIfNeeded) {
|
12727
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
12644
12728
|
// don't pass the search query because we need all data - not filtered data
|
12645
|
-
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 () {});
|
12646
12730
|
}
|
12647
12731
|
}();
|
12648
12732
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
@@ -12700,7 +12784,7 @@ function useTable(props, externalRef, renderers, meta, options) {
|
|
12700
12784
|
// configure the table
|
12701
12785
|
const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
|
12702
12786
|
// configure the virtualised renderer
|
12703
|
-
const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
|
12787
|
+
const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
|
12704
12788
|
// configure dynamic styling
|
12705
12789
|
const {
|
12706
12790
|
style,
|
@@ -13768,21 +13852,23 @@ function Summary(props) {
|
|
13768
13852
|
locale,
|
13769
13853
|
texts
|
13770
13854
|
} = useLocalization();
|
13771
|
-
const
|
13855
|
+
const tableMeta = table.options.meta;
|
13856
|
+
const length = tableMeta.length;
|
13772
13857
|
const currentLength = table.getRowModel().rows.length;
|
13773
13858
|
let label;
|
13774
13859
|
let count;
|
13775
13860
|
// row selection
|
13776
|
-
|
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;
|
13777
13863
|
if (rowsSelectedLength > 0) {
|
13778
13864
|
label = texts.table.footer.summary.selected;
|
13779
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)));
|
13780
|
-
} 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 ||
|
13781
13867
|
// filtered data
|
13782
|
-
!!table.getState().globalFilter && table.options.enableGlobalFilter // search with hide enabled
|
13868
|
+
!!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled
|
13783
13869
|
) {
|
13784
13870
|
label = texts.table.footer.summary.records;
|
13785
|
-
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)));
|
13786
13872
|
} else {
|
13787
13873
|
label = texts.table.footer.summary.records;
|
13788
13874
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
@@ -13794,8 +13880,13 @@ function Summary(props) {
|
|
13794
13880
|
}
|
13795
13881
|
|
13796
13882
|
function Foot(props) {
|
13797
|
-
const
|
13798
|
-
|
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, {
|
13799
13890
|
key: header.id,
|
13800
13891
|
header: header,
|
13801
13892
|
index: index
|
@@ -13877,6 +13968,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13877
13968
|
onClickFindPrevious: handleClickFindPrevious,
|
13878
13969
|
settingsContent,
|
13879
13970
|
shortcut,
|
13971
|
+
showTotal = true,
|
13880
13972
|
value,
|
13881
13973
|
...attributes
|
13882
13974
|
} = props;
|
@@ -13955,10 +14047,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
13955
14047
|
}
|
13956
14048
|
if (hasFind && isActive) {
|
13957
14049
|
postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
13958
|
-
className: "text-grey-700 flex h-4 items-center
|
13959
|
-
}, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
14050
|
+
className: "text-grey-700 flex h-4 items-center"
|
14051
|
+
}, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
|
13960
14052
|
className: "h-4 w-4"
|
13961
|
-
}) :
|
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, {
|
13962
14056
|
"aria-label": texts.searchInput.findPrevious,
|
13963
14057
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
13964
14058
|
icon: "chevron-up",
|
@@ -14062,6 +14156,7 @@ function Search$1(props) {
|
|
14062
14156
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
14063
14157
|
align: 'center'
|
14064
14158
|
});
|
14159
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
14065
14160
|
React__default.useEffect(() => {
|
14066
14161
|
if (tableMeta.search.highlightedColumnIndexes.length) {
|
14067
14162
|
scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
|
@@ -14070,9 +14165,11 @@ function Search$1(props) {
|
|
14070
14165
|
const handleFocus = function () {
|
14071
14166
|
try {
|
14072
14167
|
const _temp = function () {
|
14073
|
-
if (tableMeta.server.loadAllIfNeeded) {
|
14168
|
+
if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
|
14074
14169
|
// don't pass the search query because we need all data - not filtered data
|
14075
|
-
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 () {});
|
14076
14173
|
}
|
14077
14174
|
}();
|
14078
14175
|
// load all data if that is possible
|
@@ -14081,8 +14178,20 @@ function Search$1(props) {
|
|
14081
14178
|
return Promise.reject(e);
|
14082
14179
|
}
|
14083
14180
|
};
|
14181
|
+
const [loading, setLoading] = React__default.useState(false);
|
14182
|
+
const searchTimeoutRef = React__default.useRef();
|
14084
14183
|
const handleChange = query => {
|
14085
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
|
+
}
|
14086
14195
|
};
|
14087
14196
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
14088
14197
|
tableMeta.search.setEnableGlobalFilter(enabled, table);
|
@@ -14090,6 +14199,12 @@ function Search$1(props) {
|
|
14090
14199
|
var _ref$current;
|
14091
14200
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
14092
14201
|
});
|
14202
|
+
if (tableMeta.search.handleSearch) {
|
14203
|
+
setLoading(true);
|
14204
|
+
tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
|
14205
|
+
setLoading(false);
|
14206
|
+
});
|
14207
|
+
}
|
14093
14208
|
};
|
14094
14209
|
const handleNextResult = () => {
|
14095
14210
|
if (!tableMeta.search.highlightedColumnIndexes.length) {
|
@@ -14133,7 +14248,7 @@ function Search$1(props) {
|
|
14133
14248
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
14134
14249
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
14135
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,
|
14136
|
-
loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
|
14251
|
+
loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
|
14137
14252
|
name: "table-search",
|
14138
14253
|
onClickFindPrevious: handlePreviousResult,
|
14139
14254
|
onClickFindNext: handleNextResult,
|
@@ -14148,6 +14263,7 @@ function Search$1(props) {
|
|
14148
14263
|
meta: true,
|
14149
14264
|
shift: false
|
14150
14265
|
},
|
14266
|
+
showTotal: !tableMeta.server._experimentalDataLoader2,
|
14151
14267
|
value: query
|
14152
14268
|
}));
|
14153
14269
|
}
|
@@ -16193,8 +16309,9 @@ function Print$1(props) {
|
|
16193
16309
|
const toastRef = toast.loading(texts.table.print.loading);
|
16194
16310
|
const _temp2 = function () {
|
16195
16311
|
if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
|
16312
|
+
const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
|
16196
16313
|
const _temp = _catch(function () {
|
16197
|
-
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 () {});
|
16198
16315
|
}, function (error) {
|
16199
16316
|
const errorMessage = `${texts.table.print.error}: ${error}`;
|
16200
16317
|
console.error(errorMessage);
|
@@ -16868,6 +16985,7 @@ function TableGrid(props) {
|
|
16868
16985
|
var _table$state$grouping;
|
16869
16986
|
const {
|
16870
16987
|
enableHorizontalArrowKeyNavigation,
|
16988
|
+
footerRows,
|
16871
16989
|
table,
|
16872
16990
|
...attributes
|
16873
16991
|
} = props;
|
@@ -16910,7 +17028,7 @@ function TableGrid(props) {
|
|
16910
17028
|
} : table.renderer.style
|
16911
17029
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
16912
17030
|
table: table.instance
|
16913
|
-
}) : null)))));
|
17031
|
+
}, footerRows) : null)))));
|
16914
17032
|
}
|
16915
17033
|
|
16916
17034
|
function Column$1(_) {
|
@@ -18502,6 +18620,14 @@ const shortcut = {
|
|
18502
18620
|
meta: true,
|
18503
18621
|
shift: false
|
18504
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
|
+
}
|
18505
18631
|
|
18506
18632
|
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
18507
18633
|
const tableMeta = table.options.meta;
|
@@ -18552,18 +18678,21 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
18552
18678
|
document.addEventListener('click', onClickOutside);
|
18553
18679
|
return () => document.removeEventListener('click', onClickOutside);
|
18554
18680
|
}, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
|
18555
|
-
|
18556
|
-
|
18557
|
-
|
18558
|
-
|
18559
|
-
|
18560
|
-
|
18561
|
-
|
18562
|
-
|
18563
|
-
|
18564
|
-
|
18565
|
-
|
18566
|
-
|
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
|
+
*/
|
18567
18696
|
// shortcuts
|
18568
18697
|
useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
|
18569
18698
|
event.preventDefault();
|
@@ -18591,6 +18720,7 @@ function reducer$2(state, action) {
|
|
18591
18720
|
{
|
18592
18721
|
const {
|
18593
18722
|
columnId,
|
18723
|
+
index,
|
18594
18724
|
row,
|
18595
18725
|
value
|
18596
18726
|
} = payload;
|
@@ -18600,7 +18730,8 @@ function reducer$2(state, action) {
|
|
18600
18730
|
...state.changes,
|
18601
18731
|
rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
|
18602
18732
|
originals: setWith(state.changes.originals, rowId, row, Object)
|
18603
|
-
}
|
18733
|
+
},
|
18734
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18604
18735
|
};
|
18605
18736
|
}
|
18606
18737
|
case 'removeCellValue':
|
@@ -18634,6 +18765,7 @@ function reducer$2(state, action) {
|
|
18634
18765
|
{
|
18635
18766
|
const {
|
18636
18767
|
cellErrors,
|
18768
|
+
index,
|
18637
18769
|
moveReasons,
|
18638
18770
|
original,
|
18639
18771
|
value
|
@@ -18648,7 +18780,8 @@ function reducer$2(state, action) {
|
|
18648
18780
|
moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
|
18649
18781
|
// status can be undefined, so don't use ??
|
18650
18782
|
status: setWith(state.changes.status, rowId, undefined, Object)
|
18651
|
-
}
|
18783
|
+
},
|
18784
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18652
18785
|
};
|
18653
18786
|
}
|
18654
18787
|
case 'removeRow':
|
@@ -18666,6 +18799,7 @@ function reducer$2(state, action) {
|
|
18666
18799
|
originals: omit(state.changes.originals, rowId),
|
18667
18800
|
status: omit(state.changes.status, rowId)
|
18668
18801
|
},
|
18802
|
+
indexes: omit(state.indexes, rowId),
|
18669
18803
|
temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
|
18670
18804
|
};
|
18671
18805
|
}
|
@@ -18698,6 +18832,7 @@ function reducer$2(state, action) {
|
|
18698
18832
|
case 'insertTemporaryRow':
|
18699
18833
|
{
|
18700
18834
|
const {
|
18835
|
+
index,
|
18701
18836
|
value
|
18702
18837
|
} = payload;
|
18703
18838
|
return {
|
@@ -18707,7 +18842,8 @@ function reducer$2(state, action) {
|
|
18707
18842
|
...state.changes,
|
18708
18843
|
rows: setWith(state.changes.rows, rowId, value, Object),
|
18709
18844
|
originals: setWith(state.changes.originals, rowId, value, Object)
|
18710
|
-
}
|
18845
|
+
},
|
18846
|
+
indexes: setWith(state.indexes, rowId, index, Object)
|
18711
18847
|
};
|
18712
18848
|
}
|
18713
18849
|
default:
|
@@ -18727,10 +18863,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18727
18863
|
[rowId]: state.changes.rows[rowId]
|
18728
18864
|
} : state.changes.rows;
|
18729
18865
|
let completed = true;
|
18730
|
-
const
|
18866
|
+
const _temp7 = _forOf(Object.keys(changes), function (rowId) {
|
18731
18867
|
const status = getRowStatus(rowId);
|
18732
18868
|
return _catch(function () {
|
18733
|
-
function
|
18869
|
+
function _temp6(_result) {
|
18734
18870
|
return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
|
18735
18871
|
// cleanup changes, we don't need them after saving
|
18736
18872
|
discardChanges(rowId, table);
|
@@ -18755,7 +18891,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18755
18891
|
delete changeSet[rowIdentityAccessor];
|
18756
18892
|
}
|
18757
18893
|
// re-run validation, maybe a cell is already invalid but has never been blurred
|
18758
|
-
const
|
18894
|
+
const _temp5 = function () {
|
18759
18895
|
if (validator) {
|
18760
18896
|
return Promise.resolve(validator(changeSet)).then(function (errors) {
|
18761
18897
|
if (errors && Object.keys(errors).length) {
|
@@ -18764,7 +18900,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18764
18900
|
});
|
18765
18901
|
}
|
18766
18902
|
}();
|
18767
|
-
return
|
18903
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
|
18768
18904
|
}, function (error) {
|
18769
18905
|
var _error$response;
|
18770
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) {
|
@@ -18804,18 +18940,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18804
18940
|
}, function () {
|
18805
18941
|
return _exit;
|
18806
18942
|
});
|
18807
|
-
return Promise.resolve(
|
18943
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
|
18808
18944
|
return _exit ? _result3 : completed;
|
18809
|
-
}) : _exit ?
|
18945
|
+
}) : _exit ? _temp7 : completed);
|
18810
18946
|
} catch (e) {
|
18811
18947
|
return Promise.reject(e);
|
18812
18948
|
}
|
18813
18949
|
};
|
18814
18950
|
const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
|
18815
18951
|
try {
|
18816
|
-
function
|
18952
|
+
function _temp4() {
|
18817
18953
|
var _state$changes$errors11;
|
18818
|
-
function
|
18954
|
+
function _temp2() {
|
18819
18955
|
// only set errors and move reasons for the cells we're currently acting on
|
18820
18956
|
// why? because the UX is not good if we set them for cells the user hasn't touched yet
|
18821
18957
|
const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
|
@@ -18846,6 +18982,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18846
18982
|
rowId: cell.row.id,
|
18847
18983
|
payload: {
|
18848
18984
|
cellErrors: nextCellErrors,
|
18985
|
+
index: rowIndex,
|
18849
18986
|
moveReasons: nextMoveReasons,
|
18850
18987
|
value: nextChanges
|
18851
18988
|
}
|
@@ -18864,19 +19001,19 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18864
19001
|
};
|
18865
19002
|
// run validation
|
18866
19003
|
let validationErrors = {};
|
18867
|
-
const
|
19004
|
+
const _temp = function () {
|
18868
19005
|
if (validator) {
|
18869
19006
|
const nextRowValue = {
|
18870
19007
|
...state.changes.originals[cell.row.id],
|
18871
19008
|
...changes,
|
18872
19009
|
...updatesForOtherCells
|
18873
19010
|
};
|
18874
|
-
return Promise.resolve(validator(nextRowValue)).then(function (
|
18875
|
-
validationErrors =
|
19011
|
+
return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
|
19012
|
+
validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18876
19013
|
});
|
18877
19014
|
}
|
18878
19015
|
}();
|
18879
|
-
return
|
19016
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
18880
19017
|
}
|
18881
19018
|
const changes = state.changes.rows[cell.row.id];
|
18882
19019
|
if (!changes) {
|
@@ -18884,7 +19021,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18884
19021
|
}
|
18885
19022
|
let updatesForOtherCells = {};
|
18886
19023
|
// run the updater handler if there is one, to see if there are any other cells to update
|
18887
|
-
const
|
19024
|
+
const _temp3 = function () {
|
18888
19025
|
if (typeof handleChange === 'function' && shouldRunUpdaters) {
|
18889
19026
|
const previousRowValue = {
|
18890
19027
|
...state.changes.originals[cell.row.id]
|
@@ -18898,42 +19035,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18898
19035
|
});
|
18899
19036
|
}
|
18900
19037
|
}();
|
18901
|
-
return Promise.resolve(
|
19038
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
18902
19039
|
} catch (e) {
|
18903
19040
|
return Promise.reject(e);
|
18904
19041
|
}
|
18905
19042
|
}; // general
|
18906
|
-
// rows
|
18907
|
-
const setRowValue = function (rowId, original, value) {
|
18908
|
-
try {
|
18909
|
-
function _temp2() {
|
18910
|
-
dispatch({
|
18911
|
-
type: 'updateRow',
|
18912
|
-
rowId,
|
18913
|
-
payload: {
|
18914
|
-
cellErrors,
|
18915
|
-
original,
|
18916
|
-
value
|
18917
|
-
}
|
18918
|
-
});
|
18919
|
-
}
|
18920
|
-
let cellErrors;
|
18921
|
-
const _temp = function () {
|
18922
|
-
if (validator) {
|
18923
|
-
const row = {
|
18924
|
-
...original,
|
18925
|
-
...value
|
18926
|
-
};
|
18927
|
-
return Promise.resolve(validator(row)).then(function (_validator) {
|
18928
|
-
cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
|
18929
|
-
});
|
18930
|
-
}
|
18931
|
-
}();
|
18932
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
18933
|
-
} catch (e) {
|
18934
|
-
return Promise.reject(e);
|
18935
|
-
}
|
18936
|
-
};
|
18937
19043
|
const localization = useLocalization();
|
18938
19044
|
const [state, dispatch] = React__default.useReducer(reducer$2, {
|
18939
19045
|
changes: {
|
@@ -18943,8 +19049,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18943
19049
|
originals: {},
|
18944
19050
|
status: {}
|
18945
19051
|
},
|
19052
|
+
indexes: {},
|
18946
19053
|
temporaryRows: []
|
18947
19054
|
});
|
19055
|
+
// rows
|
18948
19056
|
function getRowValue(rowId) {
|
18949
19057
|
var _state$changes$rows$r, _state$changes$rows;
|
18950
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;
|
@@ -18982,7 +19090,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18982
19090
|
}
|
18983
19091
|
});
|
18984
19092
|
}
|
18985
|
-
function insertTemporaryRow(data) {
|
19093
|
+
function insertTemporaryRow(data, rowIndex) {
|
18986
19094
|
const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
|
18987
19095
|
const value = {
|
18988
19096
|
...data,
|
@@ -18992,13 +19100,14 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
18992
19100
|
type: 'insertTemporaryRow',
|
18993
19101
|
rowId: newRowId,
|
18994
19102
|
payload: {
|
19103
|
+
index: rowIndex,
|
18995
19104
|
value
|
18996
19105
|
}
|
18997
19106
|
});
|
18998
19107
|
return newRowId;
|
18999
19108
|
}
|
19000
19109
|
// cells
|
19001
|
-
function setCellValue(cell, value) {
|
19110
|
+
function setCellValue(cell, rowIndex, value) {
|
19002
19111
|
const rowId = cell.row.id;
|
19003
19112
|
const columnId = cell.column.id;
|
19004
19113
|
// update if the change is different to the original value
|
@@ -19008,6 +19117,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19008
19117
|
rowId,
|
19009
19118
|
payload: {
|
19010
19119
|
columnId,
|
19120
|
+
index: rowIndex,
|
19011
19121
|
row: cell.row.original,
|
19012
19122
|
value
|
19013
19123
|
}
|
@@ -19040,6 +19150,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19040
19150
|
}
|
19041
19151
|
return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
|
19042
19152
|
rowId,
|
19153
|
+
index: state.indexes[rowId],
|
19043
19154
|
changes: state.changes.rows[rowId],
|
19044
19155
|
errors: state.changes.errors[rowId]
|
19045
19156
|
}));
|
@@ -19063,7 +19174,6 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
|
|
19063
19174
|
}
|
19064
19175
|
return {
|
19065
19176
|
// row
|
19066
|
-
setRowValue,
|
19067
19177
|
getRowValue,
|
19068
19178
|
getRowMoveReason,
|
19069
19179
|
hasRowErrors,
|
@@ -19102,11 +19212,11 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19102
19212
|
const changeset = row !== null && row !== void 0 ? row : handleCreate();
|
19103
19213
|
try {
|
19104
19214
|
if (changeset) {
|
19105
|
-
const rowId = pendingChangesFns.insertTemporaryRow(changeset);
|
19106
|
-
table.getRow(rowId).pin('bottom');
|
19107
19215
|
// set the active row to the new row before toggling editing on
|
19108
19216
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
19109
19217
|
const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
|
19218
|
+
const rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
|
19219
|
+
table.getRow(rowId).pin('bottom');
|
19110
19220
|
tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
|
19111
19221
|
toggleEditing(true, table, scrollToIndex);
|
19112
19222
|
setLastFocusedCellIndex(undefined);
|
@@ -19144,7 +19254,9 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
|
|
19144
19254
|
tableMeta.rowActive.setRowActiveIndex(index);
|
19145
19255
|
}
|
19146
19256
|
setEditing(enabled);
|
19147
|
-
|
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');
|
19148
19260
|
scrollToIndex(index);
|
19149
19261
|
}
|
19150
19262
|
}
|
@@ -19415,7 +19527,7 @@ function EditingControlCell(props) {
|
|
19415
19527
|
}, [cellRef.current]);
|
19416
19528
|
const handleChange = nextValue => {
|
19417
19529
|
if (nextValue !== value) {
|
19418
|
-
tableMeta.editing.setCellValue(cell, nextValue);
|
19530
|
+
tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
|
19419
19531
|
if (hasNonTextControl) {
|
19420
19532
|
tableMeta.editing.onCellChanged(cell, rowIndex);
|
19421
19533
|
}
|
@@ -19926,20 +20038,21 @@ function Alert$1(props) {
|
|
19926
20038
|
const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
|
19927
20039
|
const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ? table.getColumn(String(tableMeta.rowIdentityAccessor)) : undefined;
|
19928
20040
|
pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
|
20041
|
+
var _row;
|
19929
20042
|
// if appropriate, concatenate the item with the text "and"
|
19930
20043
|
if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
|
19931
20044
|
// Add space before and after `messageAnd` text
|
19932
20045
|
links.push(` ${validationTexts.alert.messageAnd} `);
|
19933
20046
|
}
|
19934
|
-
const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
|
19935
20047
|
const handleClick = () => {
|
19936
20048
|
// if row is visible
|
19937
|
-
if (
|
19938
|
-
scrollToRow(
|
20049
|
+
if (pendingChangeWithError.index > -1) {
|
20050
|
+
scrollToRow(pendingChangeWithError.index);
|
20051
|
+
tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
|
19939
20052
|
}
|
19940
20053
|
// if row is filtered out
|
19941
20054
|
else {
|
19942
|
-
setShowFilterResetDialog(pendingChangeWithError.
|
20055
|
+
setShowFilterResetDialog(pendingChangeWithError.index);
|
19943
20056
|
}
|
19944
20057
|
};
|
19945
20058
|
let tooltip;
|
@@ -19951,7 +20064,12 @@ function Alert$1(props) {
|
|
19951
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;
|
19952
20065
|
tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
|
19953
20066
|
}
|
19954
|
-
|
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
|
+
}
|
19955
20073
|
links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
|
19956
20074
|
key: pendingChangeWithError.rowId,
|
19957
20075
|
title: tooltip
|
@@ -19959,7 +20077,7 @@ function Alert$1(props) {
|
|
19959
20077
|
className: "text-blue",
|
19960
20078
|
onClick: handleClick,
|
19961
20079
|
role: "button"
|
19962
|
-
}, rowIdentityColumn ? row[rowIdentityColumn.id] :
|
20080
|
+
}, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
|
19963
20081
|
// if appropriate, concatenate the item with the text ","
|
19964
20082
|
if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
|
19965
20083
|
links.push(', ');
|
@@ -19980,9 +20098,8 @@ function Alert$1(props) {
|
|
19980
20098
|
table.resetGlobalFilter();
|
19981
20099
|
table.resetColumnFilters();
|
19982
20100
|
requestAnimationFrame(() => {
|
19983
|
-
|
19984
|
-
|
19985
|
-
scrollToRow(rowIndex);
|
20101
|
+
if (showFilterResetDialog && showFilterResetDialog > -1) {
|
20102
|
+
scrollToRow(showFilterResetDialog);
|
19986
20103
|
}
|
19987
20104
|
setShowFilterResetDialog(false);
|
19988
20105
|
});
|
@@ -20046,10 +20163,10 @@ function CreateNewRow(props) {
|
|
20046
20163
|
var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
|
20047
20164
|
const {
|
20048
20165
|
buttonRef,
|
20166
|
+
isScrolled,
|
20049
20167
|
scrollToIndex,
|
20050
20168
|
table,
|
20051
|
-
tableMeta
|
20052
|
-
tableRef
|
20169
|
+
tableMeta
|
20053
20170
|
} = props;
|
20054
20171
|
const {
|
20055
20172
|
texts
|
@@ -20082,11 +20199,9 @@ function CreateNewRow(props) {
|
|
20082
20199
|
keys: shortcut
|
20083
20200
|
});
|
20084
20201
|
}
|
20085
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20086
20202
|
const className = cn('group/row border-grey-300 !sticky z-[21]', {
|
20087
20203
|
'bottom-10': tableMeta.footer.isEnabled,
|
20088
20204
|
'bottom-0': !tableMeta.footer.isEnabled,
|
20089
|
-
'border-t-2': isScrolled,
|
20090
20205
|
'border-b': !isScrolled
|
20091
20206
|
});
|
20092
20207
|
return /*#__PURE__*/React__default.createElement("tr", {
|
@@ -20111,6 +20226,7 @@ function CreateNewRow(props) {
|
|
20111
20226
|
function TemporaryRow(props) {
|
20112
20227
|
const {
|
20113
20228
|
createRowButtonRef,
|
20229
|
+
isScrolled,
|
20114
20230
|
table,
|
20115
20231
|
tableMeta,
|
20116
20232
|
tableRef
|
@@ -20173,10 +20289,9 @@ function TemporaryRow(props) {
|
|
20173
20289
|
}
|
20174
20290
|
}
|
20175
20291
|
};
|
20176
|
-
const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
|
20177
20292
|
const className = cn('group/row border-grey-300 !sticky z-[22]', {
|
20178
|
-
'bottom-[calc(5rem_+
|
20179
|
-
'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,
|
20180
20295
|
'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
|
20181
20296
|
});
|
20182
20297
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
|
@@ -20191,7 +20306,8 @@ function TemporaryRow(props) {
|
|
20191
20306
|
onKeyDown: handleKeyDown,
|
20192
20307
|
onKeyDownCapture: handleKeyDownCapture,
|
20193
20308
|
hideInternalColumns: true,
|
20194
|
-
hideRowActions: !tableMeta.editing.isEditing
|
20309
|
+
hideRowActions: !tableMeta.editing.isEditing,
|
20310
|
+
skipPageLoading: true
|
20195
20311
|
}))));
|
20196
20312
|
}
|
20197
20313
|
|
@@ -20212,6 +20328,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20212
20328
|
};
|
20213
20329
|
const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
|
20214
20330
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
20331
|
+
const isScrolled = isTableScrolled(table3.ref);
|
20215
20332
|
return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
|
20216
20333
|
table: table3
|
20217
20334
|
}, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
|
@@ -20224,19 +20341,27 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
|
|
20224
20341
|
tableRef: table3.ref
|
20225
20342
|
})) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
|
20226
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,
|
20227
20351
|
table: table3
|
20228
20352
|
}), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
|
20229
20353
|
createRowButtonRef: table3.meta.editing.createRowButtonRef,
|
20354
|
+
isScrolled: isScrolled,
|
20230
20355
|
table: table3.instance,
|
20231
20356
|
tableMeta: table3.meta,
|
20232
20357
|
tableRef: table3.ref
|
20233
|
-
}), /*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20358
|
+
}), !isScrolled ? (/*#__PURE__*/React__default.createElement(CreateNewRow, {
|
20234
20359
|
buttonRef: table3.meta.editing.createRowButtonRef,
|
20360
|
+
isScrolled: isScrolled,
|
20235
20361
|
scrollToIndex: table3.renderer.scrollToIndex,
|
20236
20362
|
table: table3.instance,
|
20237
|
-
tableMeta: table3.meta
|
20238
|
-
|
20239
|
-
}))) : null));
|
20363
|
+
tableMeta: table3.meta
|
20364
|
+
})) : null)) : null));
|
20240
20365
|
});
|
20241
20366
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
20242
20367
|
const stringifiedChildren = String(props.children);
|