@economic/taco 2.8.1 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Icon/components/Lock.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/Menu/components/Content.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Menu/components/Separator.d.ts +4 -2
- package/dist/components/Menu/components/SubMenu.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Table3/components/columns/styles.d.ts +1 -0
- package/dist/components/Table3/components/toolbar/ColumnSettings.d.ts +3 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/Filters.d.ts +1 -1
- package/dist/components/Table3/components/toolbar/PrintButton/WarningDialog.d.ts +2 -1
- package/dist/components/Table3/components/toolbar/Settings.d.ts +6 -0
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +3 -3
- package/dist/components/Table3/hooks/useCssGrid.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Lock.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Lock.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +7 -6
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -3
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +34 -35
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +19 -7
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +66 -18
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +12 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js +5 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +61 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +8 -35
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +5 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +8 -4
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +7 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +9 -4
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +10 -12
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +2 -2
- package/dist/taco.cjs.development.js +368 -234
- 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 +14 -14
- package/types.json +14106 -11815
@@ -2107,6 +2107,21 @@ function IconLockOpen(props, svgRef) {
|
|
2107
2107
|
}
|
2108
2108
|
var LockOpen = /*#__PURE__*/React.forwardRef(IconLockOpen);
|
2109
2109
|
|
2110
|
+
function IconLock(props, svgRef) {
|
2111
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2112
|
+
fill: "none",
|
2113
|
+
xmlns: "http://www.w3.org/2000/svg",
|
2114
|
+
viewBox: "0 0 24 24",
|
2115
|
+
ref: svgRef
|
2116
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
2117
|
+
fillRule: "evenodd",
|
2118
|
+
clipRule: "evenodd",
|
2119
|
+
d: "M12 1a5 5 0 015 5v2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V9.75C4 8.784 4.784 8 5.75 8H7V6a5 5 0 015-5zm6.25 8.5H5.75a.25.25 0 00-.243.193L5.5 9.75v10.5a.25.25 0 00.193.243l.057.007h12.5a.25.25 0 00.243-.193l.007-.057V9.75a.25.25 0 00-.193-.243L18.25 9.5zM12 13a1.5 1.5 0 01.751 2.799l-.001.951a.75.75 0 01-1.5 0v-.95A1.5 1.5 0 0112 13zm0-10.5a3.5 3.5 0 00-3.495 3.308L8.5 6v2h7V6a3.5 3.5 0 00-3.308-3.495L12 2.5z",
|
2120
|
+
fill: "currentColor"
|
2121
|
+
}));
|
2122
|
+
}
|
2123
|
+
var Lock = /*#__PURE__*/React.forwardRef(IconLock);
|
2124
|
+
|
2110
2125
|
function IconLogOut(props, svgRef) {
|
2111
2126
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
2112
2127
|
fill: "none",
|
@@ -3395,6 +3410,7 @@ const icons = {
|
|
3395
3410
|
'list-search': ListSearch,
|
3396
3411
|
list: List,
|
3397
3412
|
'lock-open': LockOpen,
|
3413
|
+
lock: Lock,
|
3398
3414
|
'log-out': LogOut,
|
3399
3415
|
log: Log,
|
3400
3416
|
market: Market,
|
@@ -3967,31 +3983,29 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
3967
3983
|
|
3968
3984
|
const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
3969
3985
|
const {
|
3970
|
-
title,
|
3971
3986
|
children,
|
3972
3987
|
placement,
|
3988
|
+
title,
|
3973
3989
|
...otherProps
|
3974
3990
|
} = props;
|
3975
|
-
const className = cn(otherProps.className);
|
3991
|
+
const className = cn('xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white', otherProps.className);
|
3992
|
+
const style = {
|
3993
|
+
transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
|
3994
|
+
};
|
3976
3995
|
return /*#__PURE__*/React.createElement(TooltipPrimitive.Root, {
|
3977
3996
|
delayDuration: 250
|
3978
3997
|
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Trigger, {
|
3979
3998
|
asChild: true,
|
3980
3999
|
ref: ref
|
3981
4000
|
}, children), /*#__PURE__*/React.createElement(TooltipPrimitive.Portal, null, /*#__PURE__*/React.createElement(TooltipPrimitive.Content, Object.assign({}, otherProps, {
|
3982
|
-
asChild: true,
|
3983
4001
|
className: className,
|
3984
|
-
side: placement,
|
3985
|
-
sideOffset: 3
|
3986
|
-
}), /*#__PURE__*/React.createElement("div", {
|
3987
|
-
className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white",
|
3988
4002
|
"data-taco": "tooltip",
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
|
4003
|
+
side: placement,
|
4004
|
+
sideOffset: 3,
|
4005
|
+
style: style
|
4006
|
+
}), /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
|
3993
4007
|
className: "-mt-px fill-blue-900/90 stroke-blue-900/90"
|
3994
|
-
}), title)))
|
4008
|
+
}), title)));
|
3995
4009
|
});
|
3996
4010
|
|
3997
4011
|
const getButtonClasses = () => {
|
@@ -4319,8 +4333,8 @@ const defaultLocalisationTexts = {
|
|
4319
4333
|
},
|
4320
4334
|
columnSettings: {
|
4321
4335
|
search: 'Search column...',
|
4322
|
-
tooltip: '
|
4323
|
-
button: '
|
4336
|
+
tooltip: 'Column settings',
|
4337
|
+
button: 'Column settings',
|
4324
4338
|
noResults: 'No results'
|
4325
4339
|
},
|
4326
4340
|
editing: {
|
@@ -4444,7 +4458,7 @@ const defaultLocalisationTexts = {
|
|
4444
4458
|
collapseRow: 'Collapse current row'
|
4445
4459
|
},
|
4446
4460
|
otherOptions: {
|
4447
|
-
tooltip: '
|
4461
|
+
tooltip: 'Table settings'
|
4448
4462
|
}
|
4449
4463
|
},
|
4450
4464
|
searchInput: {
|
@@ -7838,11 +7852,12 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props,
|
|
7838
7852
|
});
|
7839
7853
|
RadioGroup$1.Item = RadioItem;
|
7840
7854
|
|
7841
|
-
const Separator = () => {
|
7842
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
|
7843
|
-
className: "bg-grey-300 my-1 h-px"
|
7844
|
-
|
7845
|
-
};
|
7855
|
+
const Separator = /*#__PURE__*/React.forwardRef((props, ref) => {
|
7856
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, Object.assign({}, props, {
|
7857
|
+
className: "bg-grey-300 my-1 h-px",
|
7858
|
+
ref: ref
|
7859
|
+
}));
|
7860
|
+
});
|
7846
7861
|
|
7847
7862
|
const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
|
7848
7863
|
const menu = useCurrentMenu();
|
@@ -9072,7 +9087,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
9072
9087
|
const handleClear = () => {
|
9073
9088
|
requestAnimationFrame(() => {
|
9074
9089
|
var _internalRef$current2;
|
9075
|
-
return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.
|
9090
|
+
return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.blur();
|
9076
9091
|
});
|
9077
9092
|
handleChange('');
|
9078
9093
|
};
|
@@ -16566,6 +16581,7 @@ function getCellValueAsString(value, dataType) {
|
|
16566
16581
|
}
|
16567
16582
|
|
16568
16583
|
const MIN_COLUMN_SIZE$1 = 80; // accounts for padding and sort controls
|
16584
|
+
const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take
|
16569
16585
|
const getCellAlignmentClasses$1 = (alignment = 'left') => {
|
16570
16586
|
return cn({
|
16571
16587
|
'justify-start text-left': alignment === 'left',
|
@@ -16578,7 +16594,7 @@ const getInputAppearanceClassnames = () => {
|
|
16578
16594
|
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
16579
16595
|
};
|
16580
16596
|
|
16581
|
-
const useCssGrid = table => {
|
16597
|
+
const useCssGrid = (table, isPrintTable = false) => {
|
16582
16598
|
const allVisibleColumns = table.getVisibleLeafColumns();
|
16583
16599
|
const columnSizing = table.getState().columnSizing;
|
16584
16600
|
const rowsLength = table.getRowModel().rows.length;
|
@@ -16591,7 +16607,11 @@ const useCssGrid = table => {
|
|
16591
16607
|
// column has a getSize function, but it always returns a default value (150), and we want the
|
16592
16608
|
// first render to use auto layout - so we get the size directly from table state where it is undefined
|
16593
16609
|
const width = columnSizing[column.id];
|
16594
|
-
|
16610
|
+
const isColumnInternal = isInternalColumn$1(column.id);
|
16611
|
+
if (isPrintTable) {
|
16612
|
+
const maxWidth = isColumnInternal ? `${column.getSize()}px` : '1fr';
|
16613
|
+
size = `minmax(${PRINT_MIN_COLUMN_SIZE}px, ${maxWidth})`;
|
16614
|
+
} else if (isColumnInternal) {
|
16595
16615
|
if (column.id === COLUMN_ID) {
|
16596
16616
|
size = 'minmax(max-content, auto)';
|
16597
16617
|
} else {
|
@@ -16631,7 +16651,7 @@ const useCssGrid = table => {
|
|
16631
16651
|
};
|
16632
16652
|
};
|
16633
16653
|
|
16634
|
-
function useCurrentRow(defaultCurrentRowIndex
|
16654
|
+
function useCurrentRow(defaultCurrentRowIndex) {
|
16635
16655
|
const [currentRowIndex, setCurrentRowIndex] = React__default.useState(defaultCurrentRowIndex);
|
16636
16656
|
const move = (direction, length, scrollToIndex) => setCurrentRowIndex(currentIndex => {
|
16637
16657
|
const nextIndex = currentIndex !== undefined ? getNextIndex$2(direction, currentIndex, length) : 0;
|
@@ -17051,7 +17071,8 @@ function useCurrentRowListener(table) {
|
|
17051
17071
|
const meta = table.options.meta;
|
17052
17072
|
const rows = table.getRowModel().rows;
|
17053
17073
|
React__default.useEffect(() => {
|
17054
|
-
|
17074
|
+
const currentRowIndex = meta.currentRow.currentRowIndex;
|
17075
|
+
if (currentRowIndex !== undefined && currentRowIndex > rows.length) {
|
17055
17076
|
meta.currentRow.setCurrentRowIndex(0);
|
17056
17077
|
}
|
17057
17078
|
}, [rows.length]);
|
@@ -17114,8 +17135,9 @@ function useColumnFreezingStyle(tableId, table) {
|
|
17114
17135
|
if (tableMeta.columnFreezing.frozenInternalColumnCount > 0 || tableMeta.columnFreezing.isEnabled && frozenColumnIndex !== undefined) {
|
17115
17136
|
var _visibleFrozenColumns;
|
17116
17137
|
const visibleFrozenColumns = table.getVisibleLeafColumns().slice(0, frozenColumnIndex + 1);
|
17117
|
-
|
17118
|
-
if
|
17138
|
+
const visibleExternalFrozenColumns = visibleFrozenColumns.filter(column => !isInternalColumn$1(column.id));
|
17139
|
+
// if all external frozen columns haven't had their size set yet, then abort
|
17140
|
+
if (visibleExternalFrozenColumns.length && visibleExternalFrozenColumns.every(column => columnSizing[column.id] === undefined)) {
|
17119
17141
|
return undefined;
|
17120
17142
|
}
|
17121
17143
|
const offsets = {};
|
@@ -17161,9 +17183,12 @@ function useRowSelection() {
|
|
17161
17183
|
const rows = table.getRowModel().rows;
|
17162
17184
|
const tableMeta = table.options.meta;
|
17163
17185
|
if (event.key === ' ') {
|
17164
|
-
var _rows$tableMeta$curre;
|
17165
17186
|
event.preventDefault();
|
17166
|
-
|
17187
|
+
const currentRowIndex = tableMeta.currentRow.currentRowIndex;
|
17188
|
+
if (currentRowIndex !== undefined) {
|
17189
|
+
var _rows$currentRowIndex;
|
17190
|
+
(_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.toggleSelected();
|
17191
|
+
}
|
17167
17192
|
return;
|
17168
17193
|
} else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
|
17169
17194
|
event.preventDefault();
|
@@ -17186,7 +17211,7 @@ function useRowClick(onRowClick) {
|
|
17186
17211
|
const tableMeta = table.options.meta;
|
17187
17212
|
if (event.key === 'Enter') {
|
17188
17213
|
event.preventDefault();
|
17189
|
-
if (onRowClick) {
|
17214
|
+
if (onRowClick && tableMeta.currentRow.currentRowIndex !== undefined) {
|
17190
17215
|
onRowClick(rows[tableMeta.currentRow.currentRowIndex].original);
|
17191
17216
|
}
|
17192
17217
|
return;
|
@@ -17965,7 +17990,7 @@ function EditingCell$1(props) {
|
|
17965
17990
|
}));
|
17966
17991
|
}
|
17967
17992
|
const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditingCell(props) {
|
17968
|
-
var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$
|
17993
|
+
var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$currentRowIndex, _column$columnDef$met;
|
17969
17994
|
const {
|
17970
17995
|
cell,
|
17971
17996
|
column,
|
@@ -18017,7 +18042,8 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
|
|
18017
18042
|
// row move indicator
|
18018
18043
|
const moveReason = (_tableMeta$editing$ro = tableMeta.editing.rowMoveReason[cell.column.id]) !== null && _tableMeta$editing$ro !== void 0 ? _tableMeta$editing$ro : null;
|
18019
18044
|
const rows = table.getRowModel().rows;
|
18020
|
-
const
|
18045
|
+
const currentRowIndex = tableMeta.currentRow.currentRowIndex;
|
18046
|
+
const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
|
18021
18047
|
const mountNode = React__default.useMemo(() => {
|
18022
18048
|
if (moveReason) {
|
18023
18049
|
var _cellRef$current2, _cellRef$current2$par;
|
@@ -18107,7 +18133,7 @@ function getRowMoveReason(table, rowIndex, rowValues, cell, newValue) {
|
|
18107
18133
|
}
|
18108
18134
|
|
18109
18135
|
function Cell$3(props) {
|
18110
|
-
var _rows$
|
18136
|
+
var _rows$currentRowIndex;
|
18111
18137
|
const {
|
18112
18138
|
column,
|
18113
18139
|
row,
|
@@ -18119,7 +18145,8 @@ function Cell$3(props) {
|
|
18119
18145
|
const rows = table.getRowModel().rows;
|
18120
18146
|
const tableMeta = table.options.meta;
|
18121
18147
|
const columnMeta = column.columnDef.meta;
|
18122
|
-
const
|
18148
|
+
const currentRowIndex = tableMeta.currentRow.currentRowIndex;
|
18149
|
+
const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
|
18123
18150
|
if (tableMeta.editing.isEditing && columnMeta.control && (isCurrentRow || isHoveredRow && !tableMeta.hoverState.isPaused)) {
|
18124
18151
|
return /*#__PURE__*/React__default.createElement(EditingCell$1, Object.assign({}, props));
|
18125
18152
|
}
|
@@ -18538,7 +18565,7 @@ function useShortcutsListener(table, shortcuts) {
|
|
18538
18565
|
const shortcutKeys = Object.keys(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {});
|
18539
18566
|
const globalHandlers = [];
|
18540
18567
|
// convert the shortcut into the correct format to register it
|
18541
|
-
if (shortcuts && shortcutKeys.length) {
|
18568
|
+
if (shortcuts && shortcutKeys.length && meta.currentRow.currentRowIndex !== undefined) {
|
18542
18569
|
const currentRow = rows[meta.currentRow.currentRowIndex];
|
18543
18570
|
shortcutKeys.forEach(key => {
|
18544
18571
|
const handler = shortcuts[key];
|
@@ -18606,10 +18633,14 @@ function useEditingStateListener(table) {
|
|
18606
18633
|
}, [meta.currentRow.currentRowIndex]);
|
18607
18634
|
// save if editing gets toggled off
|
18608
18635
|
React__default.useEffect(() => {
|
18609
|
-
if (meta.editing.isEnabled
|
18610
|
-
|
18611
|
-
|
18612
|
-
|
18636
|
+
if (meta.editing.isEnabled) {
|
18637
|
+
if (!meta.editing.isEditing) {
|
18638
|
+
requestAnimationFrame(() => {
|
18639
|
+
meta.editing.saveChangesIfNeeded();
|
18640
|
+
});
|
18641
|
+
} else if (meta.currentRow.currentRowIndex === undefined) {
|
18642
|
+
meta.currentRow.setCurrentRowIndex(0);
|
18643
|
+
}
|
18613
18644
|
}
|
18614
18645
|
}, [meta.editing.isEditing]);
|
18615
18646
|
}
|
@@ -18741,10 +18772,15 @@ function useTable$2(props) {
|
|
18741
18772
|
tableOptions.globalFilterFn = (row, columnId, searchQuery) => {
|
18742
18773
|
try {
|
18743
18774
|
if (row.original) {
|
18744
|
-
|
18745
|
-
const
|
18746
|
-
|
18747
|
-
|
18775
|
+
const cell = row.getAllCells().find(cell => cell.column.id === columnId);
|
18776
|
+
const columnMeta = cell === null || cell === void 0 ? void 0 : cell.column.columnDef.meta;
|
18777
|
+
if (cell && cell.column.getIsVisible() && columnMeta !== null && columnMeta !== void 0 && columnMeta.enableSearch) {
|
18778
|
+
const cellValue = getCellValueAsString(row.original[columnId], columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.dataType);
|
18779
|
+
if (cellValue !== undefined) {
|
18780
|
+
return globalFilterFn$1(cellValue, searchQuery);
|
18781
|
+
}
|
18782
|
+
}
|
18783
|
+
return false;
|
18748
18784
|
}
|
18749
18785
|
} catch {
|
18750
18786
|
//
|
@@ -19291,32 +19327,6 @@ function useTableRenderStrategy$1(props, table, ref) {
|
|
19291
19327
|
return useTableRenderStrategy(props, table, ref);
|
19292
19328
|
}
|
19293
19329
|
|
19294
|
-
function RowHeight(props) {
|
19295
|
-
const {
|
19296
|
-
texts
|
19297
|
-
} = useLocalization();
|
19298
|
-
const meta = props.table.options.meta;
|
19299
|
-
const handleChange = value => {
|
19300
|
-
const height = value;
|
19301
|
-
meta.rowHeight.setHeight(height);
|
19302
|
-
if (height === 'short' && meta.fontSize.size === 'large') {
|
19303
|
-
meta.fontSize.setSize('medium');
|
19304
|
-
}
|
19305
|
-
};
|
19306
|
-
return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
|
19307
|
-
onChange: handleChange,
|
19308
|
-
value: meta.rowHeight.height
|
19309
|
-
}, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
19310
|
-
value: "short"
|
19311
|
-
}, texts.table3.rowHeight.sizes.short), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
19312
|
-
value: "medium"
|
19313
|
-
}, texts.table3.rowHeight.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
19314
|
-
value: "tall"
|
19315
|
-
}, texts.table3.rowHeight.sizes.tall), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
19316
|
-
value: "extra-tall"
|
19317
|
-
}, texts.table3.rowHeight.sizes.extraTall)));
|
19318
|
-
}
|
19319
|
-
|
19320
19330
|
// augments useEffect to not run debounced
|
19321
19331
|
function useDebouncedEffect(effect, deps, ms = 200) {
|
19322
19332
|
const timeoutRef = React__default.useRef();
|
@@ -19458,10 +19468,10 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
19458
19468
|
columns.forEach((column, columnIndex) => {
|
19459
19469
|
try {
|
19460
19470
|
var _column$columnDef$met;
|
19461
|
-
if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
19471
|
+
if (column.getIsVisible() && (_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
|
19462
19472
|
var _row$original, _column$columnDef$met2;
|
19463
19473
|
const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.dataType);
|
19464
|
-
if (cellValue && globalFilterFn$1(cellValue, value)) {
|
19474
|
+
if (cellValue !== undefined && globalFilterFn$1(cellValue, value)) {
|
19465
19475
|
indexes.push([rowIndex, columnIndex]);
|
19466
19476
|
}
|
19467
19477
|
}
|
@@ -19828,11 +19838,27 @@ function Filter$1(props) {
|
|
19828
19838
|
}));
|
19829
19839
|
}
|
19830
19840
|
|
19841
|
+
const useMatchMedia = (query, defaultMatches = false) => {
|
19842
|
+
const [matches, setMatches] = React__default.useState(defaultMatches);
|
19843
|
+
const handleChange = React__default.useCallback(event => setMatches(event.matches), []);
|
19844
|
+
React__default.useEffect(() => {
|
19845
|
+
const mediaQuery = window.matchMedia(query);
|
19846
|
+
setMatches(mediaQuery.matches);
|
19847
|
+
mediaQuery.addEventListener('change', handleChange);
|
19848
|
+
return () => {
|
19849
|
+
mediaQuery.removeEventListener('change', handleChange);
|
19850
|
+
};
|
19851
|
+
}, []);
|
19852
|
+
return matches;
|
19853
|
+
};
|
19854
|
+
|
19855
|
+
const useIsLargeScreen = () => useMatchMedia('(min-width: 1024px)', window.innerWidth > 1024);
|
19856
|
+
|
19831
19857
|
function sortByHeader(a, b) {
|
19832
19858
|
var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
|
19833
19859
|
return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
|
19834
19860
|
}
|
19835
|
-
function
|
19861
|
+
function FiltersButton$1(props) {
|
19836
19862
|
const {
|
19837
19863
|
total,
|
19838
19864
|
table
|
@@ -19842,6 +19868,7 @@ function Filters(props) {
|
|
19842
19868
|
texts
|
19843
19869
|
} = useLocalization();
|
19844
19870
|
const ref = React__default.useRef(null);
|
19871
|
+
const isLargeScreen = useIsLargeScreen();
|
19845
19872
|
const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn$1(column.id)).sort(sortByHeader);
|
19846
19873
|
const appliedFilters = table.getState().columnFilters;
|
19847
19874
|
useGlobalKeyDown({
|
@@ -19904,8 +19931,8 @@ function Filters(props) {
|
|
19904
19931
|
setFilters([]);
|
19905
19932
|
setPlaceholderCount(1);
|
19906
19933
|
};
|
19907
|
-
|
19908
|
-
|
19934
|
+
const buttonProps = {
|
19935
|
+
'aria-label': texts.table3.filters.tooltip,
|
19909
19936
|
className: cn({
|
19910
19937
|
'!wcag-blue-100': appliedFilters.length
|
19911
19938
|
}),
|
@@ -19949,7 +19976,7 @@ function Filters(props) {
|
|
19949
19976
|
appearance: "primary",
|
19950
19977
|
onClick: handleApply
|
19951
19978
|
}, "Apply"))))),
|
19952
|
-
ref
|
19979
|
+
ref,
|
19953
19980
|
tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
19954
19981
|
className: "ml-2",
|
19955
19982
|
keys: {
|
@@ -19958,97 +19985,18 @@ function Filters(props) {
|
|
19958
19985
|
shift: true
|
19959
19986
|
}
|
19960
19987
|
}))
|
19961
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
19962
|
-
name: appliedFilters.length ? 'filter-solid' : 'filter'
|
19963
|
-
}), texts.table3.filters.button, " ", appliedFilters.length ? `(${appliedFilters.length})` : '');
|
19964
|
-
}
|
19965
|
-
|
19966
|
-
const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
|
19967
|
-
var _column$columnDef$met;
|
19968
|
-
const {
|
19969
|
-
column,
|
19970
|
-
draggable = false,
|
19971
|
-
...dragAttributes
|
19972
|
-
} = props;
|
19973
|
-
const canHide = column.getCanHide();
|
19974
|
-
const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {
|
19975
|
-
'hover:bg-grey-200': canHide || draggable,
|
19976
|
-
'hover:cursor-pointer': canHide,
|
19977
|
-
'active:cursor-move active:bg-grey-300': draggable
|
19978
|
-
});
|
19979
|
-
const attributes = draggable ? dragAttributes : undefined;
|
19980
|
-
const isVisible = column.getIsVisible();
|
19981
|
-
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
19982
|
-
key: column.id,
|
19983
|
-
className: className,
|
19984
|
-
onClick: () => column.toggleVisibility(!isVisible),
|
19985
|
-
ref: ref
|
19986
|
-
}), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
|
19987
|
-
name: "drag",
|
19988
|
-
className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
|
19989
|
-
}) : null, /*#__PURE__*/React__default.createElement("span", {
|
19990
|
-
className: "flex-grow truncate"
|
19991
|
-
}, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
|
19992
|
-
checked: isVisible,
|
19993
|
-
onChange: () => column.toggleVisibility(!isVisible)
|
19994
|
-
}) : null);
|
19995
|
-
});
|
19996
|
-
function ColumnSettings(props) {
|
19997
|
-
const {
|
19998
|
-
table
|
19999
|
-
} = props;
|
20000
|
-
const {
|
20001
|
-
texts
|
20002
|
-
} = useLocalization();
|
20003
|
-
const [query, setQuery] = React__default.useState('');
|
20004
|
-
const allColumns = table.getAllLeafColumns();
|
20005
|
-
const tableMeta = table.options.meta;
|
20006
|
-
const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn$1(column.id)).filter(column => {
|
20007
|
-
var _column$columnDef$met2;
|
20008
|
-
return query !== null && query !== void 0 && query.length ? (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase()) : true;
|
20009
|
-
}), [allColumns, query]);
|
20010
|
-
const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
|
20011
|
-
const handleReorder = (activeId, overId) => {
|
20012
|
-
if (columns.find(column => {
|
20013
|
-
var _column$columnDef$met3;
|
20014
|
-
return column.id === overId && ((_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.enableOrdering) === false;
|
20015
|
-
})) {
|
20016
|
-
return;
|
20017
|
-
}
|
20018
|
-
table.setColumnOrder(currentOrder => ensureOrdering$1(allColumns, SortablePrimitive.arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
|
20019
19988
|
};
|
20020
|
-
|
20021
|
-
|
20022
|
-
|
20023
|
-
}
|
20024
|
-
|
20025
|
-
|
20026
|
-
|
20027
|
-
|
20028
|
-
|
20029
|
-
|
20030
|
-
|
20031
|
-
className: listClassName
|
20032
|
-
}, columns.map(column => {
|
20033
|
-
var _column$columnDef$met4, _column$columnDef$met5;
|
20034
|
-
return /*#__PURE__*/React__default.createElement(Item$3, {
|
20035
|
-
key: column.id,
|
20036
|
-
id: column.id,
|
20037
|
-
disabled: !((_column$columnDef$met4 = column.columnDef.meta) !== null && _column$columnDef$met4 !== void 0 && _column$columnDef$met4.enableOrdering),
|
20038
|
-
asChild: true
|
20039
|
-
}, /*#__PURE__*/React__default.createElement(Column$4, {
|
20040
|
-
column: column,
|
20041
|
-
draggable: (_column$columnDef$met5 = column.columnDef.meta) === null || _column$columnDef$met5 === void 0 ? void 0 : _column$columnDef$met5.enableOrdering
|
20042
|
-
}));
|
20043
|
-
}))) : /*#__PURE__*/React__default.createElement("div", {
|
20044
|
-
className: listClassName
|
20045
|
-
}, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column$4, {
|
20046
|
-
column: column,
|
20047
|
-
key: column.id
|
20048
|
-
})) : texts.table3.columnSettings.noResults))))
|
20049
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
20050
|
-
name: "columns"
|
20051
|
-
}), texts.table3.columnSettings.button);
|
19989
|
+
if (!isLargeScreen && !appliedFilters.length) {
|
19990
|
+
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, buttonProps, {
|
19991
|
+
icon: "filter"
|
19992
|
+
}));
|
19993
|
+
}
|
19994
|
+
return /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, buttonProps), /*#__PURE__*/React__default.createElement(Icon, {
|
19995
|
+
className: cn({
|
19996
|
+
'-mr-1.5': !isLargeScreen
|
19997
|
+
}),
|
19998
|
+
name: appliedFilters.length ? 'filter-solid' : 'filter'
|
19999
|
+
}), isLargeScreen ? texts.table3.filters.button : '', appliedFilters.length ? `(${appliedFilters.length})` : '');
|
20052
20000
|
}
|
20053
20001
|
|
20054
20002
|
function EditButton(props) {
|
@@ -20178,6 +20126,7 @@ function PrintIFrame({
|
|
20178
20126
|
const [contentRef, setContentRef] = React__default.useState(null);
|
20179
20127
|
const [mountNode, setMountNode] = React__default.useState(null);
|
20180
20128
|
const isFirefoxBrowser = React__default.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);
|
20129
|
+
const isSafariBrowser = React__default.useMemo(() => navigator.userAgent.toLowerCase().includes('safari') && !navigator.userAgent.toLowerCase().includes('chrome'), []);
|
20181
20130
|
const iframeWindow = contentRef === null || contentRef === void 0 ? void 0 : contentRef.contentWindow;
|
20182
20131
|
const stylesReady = useParentStylesheets(iframeWindow);
|
20183
20132
|
// Calls print method when table has loaded in the iframe.
|
@@ -20246,13 +20195,16 @@ function PrintIFrame({
|
|
20246
20195
|
tableWrapper.classList.add('h-fit');
|
20247
20196
|
tableWrapper.classList.add('[&>[role="table"]]:!h-fit');
|
20248
20197
|
if (isFirefoxBrowser) {
|
20249
|
-
// Fix for firefox bug which adds page-long whitespace between page's top content and table
|
20198
|
+
// Fix for firefox bug which adds page-long whitespace between page's top content and table.
|
20250
20199
|
tableWrapper.classList.add('[&>[role="table"]]:!absolute');
|
20251
20200
|
}
|
20252
|
-
//
|
20253
|
-
|
20254
|
-
|
20255
|
-
|
20201
|
+
// Makes sure table takes the full screen width.
|
20202
|
+
if (isSafariBrowser) {
|
20203
|
+
// Safari browser doesn't apply correct width to the columns when w-screen is used.
|
20204
|
+
tableWrapper.classList.add('w-full');
|
20205
|
+
} else {
|
20206
|
+
tableWrapper.classList.add('w-screen');
|
20207
|
+
}
|
20256
20208
|
if (tableElement) {
|
20257
20209
|
var _tableElement$parentN;
|
20258
20210
|
(_tableElement$parentN = tableElement.parentNode) === null || _tableElement$parentN === void 0 ? void 0 : _tableElement$parentN.insertBefore(tableWrapper, tableElement);
|
@@ -20297,7 +20249,7 @@ function PrintIFrame({
|
|
20297
20249
|
};
|
20298
20250
|
// -top-60 -left-60 styles make sure that iframe is added outside of the viewport
|
20299
20251
|
return /*#__PURE__*/React__default.createElement("iframe", {
|
20300
|
-
className: "fixed -left-
|
20252
|
+
className: "fixed -left-[6000px] -top-[6000px] -z-50 !h-0 !w-0",
|
20301
20253
|
ref: setContentRef,
|
20302
20254
|
// Temporary fix to support printing in firefox: Find another solution while upgrading React
|
20303
20255
|
src: "javascript:void(0);"
|
@@ -20306,6 +20258,7 @@ function PrintIFrame({
|
|
20306
20258
|
|
20307
20259
|
const WarningDialog = ({
|
20308
20260
|
onAccept,
|
20261
|
+
onCancel,
|
20309
20262
|
onClose,
|
20310
20263
|
onVisibilityChange,
|
20311
20264
|
...props
|
@@ -20339,7 +20292,10 @@ const WarningDialog = ({
|
|
20339
20292
|
checked: hideWarningDialog,
|
20340
20293
|
onChange: setHideWarningDialog
|
20341
20294
|
}), /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
20342
|
-
onClick:
|
20295
|
+
onClick: () => {
|
20296
|
+
handleClose();
|
20297
|
+
onCancel();
|
20298
|
+
}
|
20343
20299
|
}, texts.table3.print.warningDialog.cancelButtonText), /*#__PURE__*/React__default.createElement(Button$1, {
|
20344
20300
|
appearance: "primary",
|
20345
20301
|
autoFocus: true,
|
@@ -20369,20 +20325,23 @@ function PrintButton(props) {
|
|
20369
20325
|
const {
|
20370
20326
|
printWarningDialogVisibility
|
20371
20327
|
} = tableMeta.printing;
|
20328
|
+
// When changing printTableId, update packages/taco/src/components/Table3/Table3.tsx file and other usages where
|
20329
|
+
// printTableId is used to figure out whether the table is a print table or not.
|
20372
20330
|
const printTableId = `${tableProps.id}_print`;
|
20331
|
+
const excludeUnmatchedResults = tableMeta.search.excludeUnmatchedResults;
|
20373
20332
|
const defaultSettings = React__default.useMemo(() => ({
|
20374
20333
|
columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,
|
20375
20334
|
columnOrder: state.columnOrder,
|
20376
20335
|
columnSizing: state.columnSizing,
|
20377
20336
|
columnVisibility: state.columnVisibility,
|
20378
|
-
excludeUnmatchedRecordsInSearch:
|
20337
|
+
excludeUnmatchedRecordsInSearch: excludeUnmatchedResults,
|
20379
20338
|
fontSize: tableMeta.fontSize.size,
|
20380
20339
|
rowHeight: tableMeta.rowHeight.height,
|
20381
20340
|
sorting: state.sorting,
|
20382
20341
|
// we don't save these, but we must pass them to print
|
20383
20342
|
columnFilters: state.columnFilters,
|
20384
20343
|
globalFilter: state.globalFilter
|
20385
|
-
}), [tableMeta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility,
|
20344
|
+
}), [tableMeta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, excludeUnmatchedResults, tableMeta.fontSize.size, tableMeta.rowHeight.height, state.sorting, state.columnFilters, state.globalFilter]);
|
20386
20345
|
const iframeTableProps = {
|
20387
20346
|
...tableProps,
|
20388
20347
|
defaultSettings,
|
@@ -20398,20 +20357,51 @@ function PrintButton(props) {
|
|
20398
20357
|
// Starts custom printing
|
20399
20358
|
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.click();
|
20400
20359
|
});
|
20401
|
-
const
|
20360
|
+
const handleLoadingError = error => {
|
20402
20361
|
var _loadingToastRef$curr;
|
20403
|
-
|
20404
|
-
|
20362
|
+
const errorMessage = `${texts.table3.print.error}: ${error}`;
|
20363
|
+
console.error(errorMessage);
|
20364
|
+
(_loadingToastRef$curr = loadingToastRef.current) === null || _loadingToastRef$curr === void 0 ? void 0 : _loadingToastRef$curr.error(errorMessage);
|
20365
|
+
};
|
20366
|
+
const restoreTableDataWithoutSearch = function () {
|
20367
|
+
try {
|
20368
|
+
const _temp = _catch(function () {
|
20369
|
+
var _tableMeta$printing$l, _tableMeta$printing;
|
20370
|
+
return Promise.resolve((_tableMeta$printing$l = (_tableMeta$printing = tableMeta.printing).loadAll) === null || _tableMeta$printing$l === void 0 ? void 0 : _tableMeta$printing$l.call(_tableMeta$printing, table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
|
20371
|
+
}, function (error) {
|
20372
|
+
handleLoadingError(error);
|
20373
|
+
});
|
20374
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
20375
|
+
} catch (e) {
|
20376
|
+
return Promise.reject(e);
|
20377
|
+
}
|
20378
|
+
};
|
20379
|
+
const handleAfterPrint = function () {
|
20380
|
+
try {
|
20381
|
+
function _temp3() {
|
20382
|
+
var _loadingToastRef$curr2;
|
20383
|
+
setIsPrinting(false);
|
20384
|
+
(_loadingToastRef$curr2 = loadingToastRef.current) === null || _loadingToastRef$curr2 === void 0 ? void 0 : _loadingToastRef$curr2.close();
|
20385
|
+
}
|
20386
|
+
const _temp2 = function () {
|
20387
|
+
if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
|
20388
|
+
return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
|
20389
|
+
}
|
20390
|
+
}();
|
20391
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
20392
|
+
} catch (e) {
|
20393
|
+
return Promise.reject(e);
|
20394
|
+
}
|
20405
20395
|
};
|
20406
20396
|
const handleBeforePrint = () => {
|
20407
|
-
var _loadingToastRef$
|
20408
|
-
(_loadingToastRef$
|
20397
|
+
var _loadingToastRef$curr3;
|
20398
|
+
(_loadingToastRef$curr3 = loadingToastRef.current) === null || _loadingToastRef$curr3 === void 0 ? void 0 : _loadingToastRef$curr3.close();
|
20409
20399
|
};
|
20410
20400
|
const handlePrint = function () {
|
20411
20401
|
try {
|
20412
20402
|
let _exit = false;
|
20413
|
-
function
|
20414
|
-
if (_exit) return
|
20403
|
+
function _temp6(_result3) {
|
20404
|
+
if (_exit) return _result3;
|
20415
20405
|
if (hasNonSafeCellCount && printWarningDialogVisibility) {
|
20416
20406
|
setShowWarningDialog(true);
|
20417
20407
|
} else {
|
@@ -20424,7 +20414,7 @@ function PrintButton(props) {
|
|
20424
20414
|
let hasNonSafeCellCount = false;
|
20425
20415
|
// if loadAll is not defined, just print with what we've got
|
20426
20416
|
// don't compare length to data.length because the api might be choosing not to return all for performance
|
20427
|
-
const
|
20417
|
+
const _temp5 = function () {
|
20428
20418
|
if (!tableMeta.printing.loadAll) {
|
20429
20419
|
const {
|
20430
20420
|
data
|
@@ -20432,8 +20422,12 @@ function PrintButton(props) {
|
|
20432
20422
|
const cellCount = getCellCount(data);
|
20433
20423
|
hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
|
20434
20424
|
} else {
|
20435
|
-
const
|
20436
|
-
return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters,
|
20425
|
+
const _temp4 = _catch(function () {
|
20426
|
+
return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters,
|
20427
|
+
// We need to pass search query to the server when printing, to be able to render correct data set in iFrame,
|
20428
|
+
// But in "display" table, search is performed only on client side, so we'll need to request data again without search query,
|
20429
|
+
// when printing will be finished.
|
20430
|
+
excludeUnmatchedResults ? tableMeta.search.query : undefined)).then(function () {
|
20437
20431
|
// After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after
|
20438
20432
|
// this call rather than before it.
|
20439
20433
|
const {
|
@@ -20443,17 +20437,14 @@ function PrintButton(props) {
|
|
20443
20437
|
hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
|
20444
20438
|
});
|
20445
20439
|
}, function (error) {
|
20446
|
-
|
20447
|
-
const errorMessage = `${texts.table3.print.error}: ${error}`;
|
20448
|
-
console.error(errorMessage);
|
20449
|
-
(_loadingToastRef$curr3 = loadingToastRef.current) === null || _loadingToastRef$curr3 === void 0 ? void 0 : _loadingToastRef$curr3.error(errorMessage);
|
20440
|
+
handleLoadingError(error);
|
20450
20441
|
// in case of error, we return early
|
20451
20442
|
_exit = true;
|
20452
20443
|
});
|
20453
|
-
if (
|
20444
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
20454
20445
|
}
|
20455
20446
|
}();
|
20456
|
-
return Promise.resolve(
|
20447
|
+
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
20457
20448
|
} catch (e) {
|
20458
20449
|
return Promise.reject(e);
|
20459
20450
|
}
|
@@ -20461,6 +20452,18 @@ function PrintButton(props) {
|
|
20461
20452
|
const handleWarningDialogAccept = () => {
|
20462
20453
|
setIsPrinting(true);
|
20463
20454
|
};
|
20455
|
+
const handleWarningDialogCancel = function () {
|
20456
|
+
try {
|
20457
|
+
const _temp7 = function () {
|
20458
|
+
if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
|
20459
|
+
return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
|
20460
|
+
}
|
20461
|
+
}();
|
20462
|
+
return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
|
20463
|
+
} catch (e) {
|
20464
|
+
return Promise.reject(e);
|
20465
|
+
}
|
20466
|
+
};
|
20464
20467
|
const handleWarningDialogClose = () => {
|
20465
20468
|
var _loadingToastRef$curr4;
|
20466
20469
|
(_loadingToastRef$curr4 = loadingToastRef.current) === null || _loadingToastRef$curr4 === void 0 ? void 0 : _loadingToastRef$curr4.close();
|
@@ -20481,10 +20484,125 @@ function PrintButton(props) {
|
|
20481
20484
|
open: showWarningDialog,
|
20482
20485
|
onAccept: handleWarningDialogAccept,
|
20483
20486
|
onClose: handleWarningDialogClose,
|
20487
|
+
onCancel: handleWarningDialogCancel,
|
20484
20488
|
onVisibilityChange: tableMeta.printing.setPrintWarningDialogVisibility
|
20485
20489
|
}));
|
20486
20490
|
}
|
20487
20491
|
|
20492
|
+
function RowHeight(props) {
|
20493
|
+
const {
|
20494
|
+
texts
|
20495
|
+
} = useLocalization();
|
20496
|
+
const meta = props.table.options.meta;
|
20497
|
+
const handleChange = value => {
|
20498
|
+
const height = value;
|
20499
|
+
meta.rowHeight.setHeight(height);
|
20500
|
+
if (height === 'short' && meta.fontSize.size === 'large') {
|
20501
|
+
meta.fontSize.setSize('medium');
|
20502
|
+
}
|
20503
|
+
};
|
20504
|
+
return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
|
20505
|
+
onChange: handleChange,
|
20506
|
+
value: meta.rowHeight.height
|
20507
|
+
}, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
20508
|
+
value: "short"
|
20509
|
+
}, texts.table3.rowHeight.sizes.short), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
20510
|
+
value: "medium"
|
20511
|
+
}, texts.table3.rowHeight.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
20512
|
+
value: "tall"
|
20513
|
+
}, texts.table3.rowHeight.sizes.tall), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
|
20514
|
+
value: "extra-tall"
|
20515
|
+
}, texts.table3.rowHeight.sizes.extraTall)));
|
20516
|
+
}
|
20517
|
+
|
20518
|
+
const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
|
20519
|
+
var _column$columnDef$met;
|
20520
|
+
const {
|
20521
|
+
column,
|
20522
|
+
draggable = false,
|
20523
|
+
...dragAttributes
|
20524
|
+
} = props;
|
20525
|
+
const canHide = column.getCanHide();
|
20526
|
+
const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {
|
20527
|
+
'hover:bg-grey-200': canHide || draggable,
|
20528
|
+
'hover:cursor-pointer': canHide,
|
20529
|
+
'active:cursor-move active:bg-grey-300': draggable
|
20530
|
+
});
|
20531
|
+
const attributes = draggable ? dragAttributes : undefined;
|
20532
|
+
const isVisible = column.getIsVisible();
|
20533
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
20534
|
+
key: column.id,
|
20535
|
+
className: className,
|
20536
|
+
onClick: () => column.toggleVisibility(!isVisible),
|
20537
|
+
ref: ref
|
20538
|
+
}), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
|
20539
|
+
name: "drag",
|
20540
|
+
className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
|
20541
|
+
}) : null, /*#__PURE__*/React__default.createElement("span", {
|
20542
|
+
className: "flex-grow truncate"
|
20543
|
+
}, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
|
20544
|
+
checked: isVisible,
|
20545
|
+
onChange: () => column.toggleVisibility(!isVisible)
|
20546
|
+
}) : null);
|
20547
|
+
});
|
20548
|
+
function ColumnSettingsPopover(props) {
|
20549
|
+
const {
|
20550
|
+
table,
|
20551
|
+
trigger,
|
20552
|
+
...popoverProps
|
20553
|
+
} = props;
|
20554
|
+
const {
|
20555
|
+
texts
|
20556
|
+
} = useLocalization();
|
20557
|
+
const [query, setQuery] = React__default.useState('');
|
20558
|
+
const allColumns = table.getAllLeafColumns();
|
20559
|
+
const tableMeta = table.options.meta;
|
20560
|
+
const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn$1(column.id)).filter(column => {
|
20561
|
+
var _column$columnDef$met2;
|
20562
|
+
return query !== null && query !== void 0 && query.length ? (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase()) : true;
|
20563
|
+
}), [allColumns, query]);
|
20564
|
+
const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
|
20565
|
+
const handleReorder = (activeId, overId) => {
|
20566
|
+
if (columns.find(column => {
|
20567
|
+
var _column$columnDef$met3;
|
20568
|
+
return column.id === overId && ((_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.enableOrdering) === false;
|
20569
|
+
})) {
|
20570
|
+
return;
|
20571
|
+
}
|
20572
|
+
table.setColumnOrder(currentOrder => ensureOrdering$1(allColumns, SortablePrimitive.arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
|
20573
|
+
};
|
20574
|
+
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
20575
|
+
anchor: trigger
|
20576
|
+
}), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
|
20577
|
+
className: "flex w-60 flex-col gap-2"
|
20578
|
+
}, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
|
20579
|
+
onChange: event => setQuery(event.target.value),
|
20580
|
+
placeholder: texts.table3.columnSettings.search,
|
20581
|
+
value: query
|
20582
|
+
}) : null, tableMeta.columnOrdering.isEnabled && columns.length && !(query !== null && query !== void 0 && query.length) ? /*#__PURE__*/React__default.createElement(Container, {
|
20583
|
+
reorder: handleReorder
|
20584
|
+
}, /*#__PURE__*/React__default.createElement(List$1, {
|
20585
|
+
id: "columns",
|
20586
|
+
className: listClassName
|
20587
|
+
}, columns.map(column => {
|
20588
|
+
var _column$columnDef$met4, _column$columnDef$met5;
|
20589
|
+
return /*#__PURE__*/React__default.createElement(Item$3, {
|
20590
|
+
key: column.id,
|
20591
|
+
id: column.id,
|
20592
|
+
disabled: !((_column$columnDef$met4 = column.columnDef.meta) !== null && _column$columnDef$met4 !== void 0 && _column$columnDef$met4.enableOrdering),
|
20593
|
+
asChild: true
|
20594
|
+
}, /*#__PURE__*/React__default.createElement(Column$4, {
|
20595
|
+
column: column,
|
20596
|
+
draggable: (_column$columnDef$met5 = column.columnDef.meta) === null || _column$columnDef$met5 === void 0 ? void 0 : _column$columnDef$met5.enableOrdering
|
20597
|
+
}));
|
20598
|
+
}))) : /*#__PURE__*/React__default.createElement("div", {
|
20599
|
+
className: listClassName
|
20600
|
+
}, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column$4, {
|
20601
|
+
column: column,
|
20602
|
+
key: column.id
|
20603
|
+
})) : texts.table3.columnSettings.noResults))));
|
20604
|
+
}
|
20605
|
+
|
20488
20606
|
function FontSize$1(props) {
|
20489
20607
|
const {
|
20490
20608
|
texts
|
@@ -20504,6 +20622,57 @@ function FontSize$1(props) {
|
|
20504
20622
|
}, texts.table3.fontSize.sizes.large)));
|
20505
20623
|
}
|
20506
20624
|
|
20625
|
+
function SettingsButton(props) {
|
20626
|
+
const {
|
20627
|
+
table
|
20628
|
+
} = props;
|
20629
|
+
const {
|
20630
|
+
texts
|
20631
|
+
} = useLocalization();
|
20632
|
+
const [popover, setPopover] = React__default.useState(undefined);
|
20633
|
+
const tableMeta = table.options.meta;
|
20634
|
+
const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;
|
20635
|
+
let popoverElement;
|
20636
|
+
if (popover) {
|
20637
|
+
const handleClosePopover = () => setPopover(undefined);
|
20638
|
+
switch (popover) {
|
20639
|
+
case 'columnSettings':
|
20640
|
+
{
|
20641
|
+
if (hasColumnSettings) {
|
20642
|
+
popoverElement = props => /*#__PURE__*/React__default.createElement(ColumnSettingsPopover, Object.assign({}, props, {
|
20643
|
+
open: true,
|
20644
|
+
onChange: handleClosePopover,
|
20645
|
+
table: table
|
20646
|
+
}));
|
20647
|
+
}
|
20648
|
+
}
|
20649
|
+
}
|
20650
|
+
}
|
20651
|
+
return /*#__PURE__*/React__default.createElement(IconButton, {
|
20652
|
+
"aria-label": texts.table3.otherOptions.tooltip,
|
20653
|
+
icon: "sliders",
|
20654
|
+
menu: popoverElement ? undefined : menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
20655
|
+
align: "end"
|
20656
|
+
}, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
20657
|
+
icon: "columns",
|
20658
|
+
onClick: () => setPopover('columnSettings')
|
20659
|
+
}, texts.table3.columnSettings.button), /*#__PURE__*/React__default.createElement(Menu$1.Separator, null)) : null, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
20660
|
+
icon: `height-${tableMeta.rowHeight.height}`,
|
20661
|
+
subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
|
20662
|
+
table: table
|
20663
|
+
})
|
20664
|
+
}, texts.table3.rowHeight.tooltip) : null, tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
20665
|
+
icon: "font-size",
|
20666
|
+
subMenu: () => /*#__PURE__*/React__default.createElement(FontSize$1, {
|
20667
|
+
table: table
|
20668
|
+
})
|
20669
|
+
}, texts.table3.fontSize.tooltip) : null)),
|
20670
|
+
popover: popoverElement,
|
20671
|
+
onClickCapture: event => event.preventDefault(),
|
20672
|
+
tooltip: texts.table3.otherOptions.tooltip
|
20673
|
+
});
|
20674
|
+
}
|
20675
|
+
|
20507
20676
|
function Toolbar(props) {
|
20508
20677
|
const {
|
20509
20678
|
left,
|
@@ -20513,9 +20682,6 @@ function Toolbar(props) {
|
|
20513
20682
|
tableProps,
|
20514
20683
|
total
|
20515
20684
|
} = props;
|
20516
|
-
const {
|
20517
|
-
texts
|
20518
|
-
} = useLocalization();
|
20519
20685
|
if (!isToolbarVisible(props)) {
|
20520
20686
|
return null;
|
20521
20687
|
}
|
@@ -20527,38 +20693,20 @@ function Toolbar(props) {
|
|
20527
20693
|
className: "ml-auto flex-shrink-0 print:hidden"
|
20528
20694
|
}, tableMeta.editing.isEnabled ? /*#__PURE__*/React__default.createElement(EditButton, {
|
20529
20695
|
table: table
|
20530
|
-
}) : null, table.options.enableColumnFilters ? /*#__PURE__*/React__default.createElement(
|
20696
|
+
}) : null, table.options.enableColumnFilters ? /*#__PURE__*/React__default.createElement(FiltersButton$1, {
|
20531
20697
|
table: table,
|
20532
20698
|
total: total
|
20533
|
-
}) : null,
|
20534
|
-
table: table
|
20535
|
-
}) : null, tableMeta.printing.isEnabled ? /*#__PURE__*/React__default.createElement(PrintButton, {
|
20699
|
+
}) : null, right, tableMeta.printing.isEnabled ? /*#__PURE__*/React__default.createElement(PrintButton, {
|
20536
20700
|
table: table,
|
20537
20701
|
tableProps: tableProps
|
20538
|
-
}) : null,
|
20539
|
-
|
20540
|
-
}, /*#__PURE__*/React__default.createElement(
|
20541
|
-
"aria-label": texts.table3.otherOptions.tooltip,
|
20542
|
-
icon: "more",
|
20543
|
-
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
20544
|
-
align: "end"
|
20545
|
-
}, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
20546
|
-
icon: `height-${tableMeta.rowHeight.height}`,
|
20547
|
-
subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
|
20548
|
-
table: table
|
20549
|
-
})
|
20550
|
-
}, texts.table3.rowHeight.tooltip) : null, tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
20551
|
-
icon: "font-size",
|
20552
|
-
subMenu: () => /*#__PURE__*/React__default.createElement(FontSize$1, {
|
20553
|
-
table: table
|
20554
|
-
})
|
20555
|
-
}, texts.table3.fontSize.tooltip) : null))
|
20556
|
-
})) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
|
20702
|
+
}) : null, isSettingsVisible(props) ? /*#__PURE__*/React__default.createElement(SettingsButton, {
|
20703
|
+
table: table
|
20704
|
+
}) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
|
20557
20705
|
scrollToIndex: scrollToIndex,
|
20558
20706
|
table: table
|
20559
20707
|
}) : null));
|
20560
20708
|
}
|
20561
|
-
function
|
20709
|
+
function isSettingsVisible(props) {
|
20562
20710
|
const {
|
20563
20711
|
table
|
20564
20712
|
} = props;
|
@@ -20882,9 +21030,11 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20882
21030
|
'text-sm': tableMeta.fontSize.size === 'medium',
|
20883
21031
|
'text-base': tableMeta.fontSize.size === 'large'
|
20884
21032
|
});
|
21033
|
+
// Print tables have "_print" as the postfix for the table id, so we can use the it to determine
|
21034
|
+
// if the table is a print table or not.
|
20885
21035
|
const {
|
20886
21036
|
style: cssGridStyle
|
20887
|
-
} = useCssGrid(table);
|
21037
|
+
} = useCssGrid(table, props.id.endsWith('_print'));
|
20888
21038
|
const {
|
20889
21039
|
style: cssVars
|
20890
21040
|
} = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);
|
@@ -21424,20 +21574,6 @@ const AgreementItem = props => {
|
|
21424
21574
|
}))), children);
|
21425
21575
|
};
|
21426
21576
|
|
21427
|
-
const useMatchMedia = (query, defaultMatches = false) => {
|
21428
|
-
const [matches, setMatches] = React__default.useState(defaultMatches);
|
21429
|
-
const handleChange = React__default.useCallback(event => setMatches(event.matches), []);
|
21430
|
-
React__default.useEffect(() => {
|
21431
|
-
const mediaQuery = window.matchMedia(query);
|
21432
|
-
setMatches(mediaQuery.matches);
|
21433
|
-
mediaQuery.addEventListener('change', handleChange);
|
21434
|
-
return () => {
|
21435
|
-
mediaQuery.removeEventListener('change', handleChange);
|
21436
|
-
};
|
21437
|
-
}, []);
|
21438
|
-
return matches;
|
21439
|
-
};
|
21440
|
-
|
21441
21577
|
const AgreementDisplay = props => {
|
21442
21578
|
const {
|
21443
21579
|
children,
|
@@ -21626,8 +21762,6 @@ const Content$9 = /*#__PURE__*/React__default.forwardRef(function LayoutContent(
|
|
21626
21762
|
}));
|
21627
21763
|
});
|
21628
21764
|
|
21629
|
-
const useIsLargeScreen = () => useMatchMedia('(min-width: 1024px)', window.innerWidth > 1024);
|
21630
|
-
|
21631
21765
|
const SidebarBackdrop = /*#__PURE__*/framerMotion.motion(Backdrop);
|
21632
21766
|
const Sidebar = /*#__PURE__*/React__default.forwardRef(function LayoutSidebar(props, ref) {
|
21633
21767
|
const {
|