@economic/taco 2.3.0 → 2.4.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/Header/components/Agreement/types.d.ts +1 -1
- package/dist/components/Menu/Context.d.ts +2 -0
- package/dist/components/Menu/components/Item.d.ts +3 -2
- package/dist/components/Provider/Localization.d.ts +12 -0
- package/dist/components/Provider/Provider.d.ts +6 -1
- package/dist/components/SearchInput2/SearchInput2.d.ts +2 -1
- package/dist/components/Spinner/Spinner.d.ts +2 -2
- package/dist/components/Table2/types.d.ts +1 -1
- package/dist/components/Table3/Table3.d.ts +1 -1
- package/dist/components/Table3/components/columns/internal/Selection.d.ts +1 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +1 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.d.ts +4 -4
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterValue.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useColumnFreezing.d.ts +2 -1
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useEditing.d.ts +1 -2
- package/dist/components/Table3/hooks/features/usePauseHoverState.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useRowClick.d.ts +1 -2
- package/dist/components/Table3/hooks/features/useRowSelection.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useSettings.d.ts +2 -0
- package/dist/components/Table3/hooks/listeners/useSettingsStateListener.d.ts +2 -2
- package/dist/components/Table3/hooks/useTable.d.ts +2 -1
- package/dist/components/Table3/types.d.ts +24 -12
- package/dist/components/Table3/util/columns.d.ts +5 -4
- package/dist/esm/packages/taco/src/components/Menu/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +1 -0
- package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +32 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +13 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Provider.js +11 -4
- package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +30 -44
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +12 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +17 -16
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +5 -5
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +0 -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/footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Goto.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Goto.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +3 -4
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +5 -20
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +20 -6
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +4 -2
- 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/Filter/filters/components/Filter.js +2 -24
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +68 -17
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +31 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +1 -5
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +18 -25
- 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/hooks/useParentStylesheets.js +5 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +40 -29
- 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/Toolbar.js +6 -2
- 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 +20 -16
- 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/useEditing.js +9 -13
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +3 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.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 +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +18 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +4 -6
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +18 -12
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js +7 -5
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/columns.js +26 -7
- package/dist/esm/packages/taco/src/components/Table3/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/filtering.js +24 -6
- package/dist/esm/packages/taco/src/components/Table3/util/filtering.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useDebouncedEffect.js +15 -0
- package/dist/esm/packages/taco/src/hooks/useDebouncedEffect.js.map +1 -0
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +34 -0
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -0
- package/dist/esm/packages/taco/src/hooks/useTacoSettings.js +9 -0
- package/dist/esm/packages/taco/src/hooks/useTacoSettings.js.map +1 -0
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/hooks/useDebouncedEffect.d.ts +2 -0
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useTacoSettings.d.ts +1 -0
- package/dist/taco.cjs.development.js +550 -340
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +11529 -10643
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Comparator.d.ts +0 -11
|
@@ -3707,9 +3707,9 @@ const useMergedRef = ref => {
|
|
|
3707
3707
|
return internalRef;
|
|
3708
3708
|
};
|
|
3709
3709
|
|
|
3710
|
-
const
|
|
3710
|
+
const INTERACTIVE_ELEMENTS = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'];
|
|
3711
3711
|
function isEventTriggeredOnInteractiveElement(eventTarget) {
|
|
3712
|
-
return
|
|
3712
|
+
return INTERACTIVE_ELEMENTS.includes(eventTarget.tagName);
|
|
3713
3713
|
}
|
|
3714
3714
|
function createShortcutKeyDownHandler(key, handler) {
|
|
3715
3715
|
return function (event) {
|
|
@@ -4182,7 +4182,16 @@ const defaultLocalisationTexts = {
|
|
|
4182
4182
|
isNoneOf: 'Is none of',
|
|
4183
4183
|
isAllOf: 'Is all of',
|
|
4184
4184
|
isEmpty: 'Is empty',
|
|
4185
|
-
isNotEmpty: 'Is not empty'
|
|
4185
|
+
isNotEmpty: 'Is not empty',
|
|
4186
|
+
isBefore: 'Is before',
|
|
4187
|
+
isAfter: 'Is after',
|
|
4188
|
+
isOnOrBefore: 'Is on or before',
|
|
4189
|
+
isOnOrAfter: 'Is on or after',
|
|
4190
|
+
isLessThanOrEqualTo: 'Is less than or equal to',
|
|
4191
|
+
isGreaterThanOrEqualTo: 'Is greater than or equal to',
|
|
4192
|
+
hasAnyOf: 'Has any of',
|
|
4193
|
+
hasAllOf: 'Has all of',
|
|
4194
|
+
hasNoneOf: 'Has none of'
|
|
4186
4195
|
},
|
|
4187
4196
|
conditions: {
|
|
4188
4197
|
and: 'And',
|
|
@@ -4249,6 +4258,9 @@ const defaultLocalisationTexts = {
|
|
|
4249
4258
|
selectAllRows: 'Select all rows',
|
|
4250
4259
|
expandRow: 'Expand current row',
|
|
4251
4260
|
collapseRow: 'Collapse current row'
|
|
4261
|
+
},
|
|
4262
|
+
otherOptions: {
|
|
4263
|
+
tooltip: 'Other options'
|
|
4252
4264
|
}
|
|
4253
4265
|
},
|
|
4254
4266
|
searchInput: {
|
|
@@ -4854,7 +4866,7 @@ const useListScrollTo = (internalRef, itemRefs) => {
|
|
|
4854
4866
|
|
|
4855
4867
|
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
|
4856
4868
|
const {
|
|
4857
|
-
delay =
|
|
4869
|
+
delay = 350,
|
|
4858
4870
|
label,
|
|
4859
4871
|
...otherProps
|
|
4860
4872
|
} = props;
|
|
@@ -7228,6 +7240,35 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
|
|
|
7228
7240
|
...otherProps
|
|
7229
7241
|
} = props;
|
|
7230
7242
|
const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);
|
|
7243
|
+
// attach refs to each child
|
|
7244
|
+
const childrenRefs = React.useRef([]);
|
|
7245
|
+
const childrenWithRefs = React.Children.toArray(props.children).filter(child => !!child) // remove falsey children
|
|
7246
|
+
.map((child, index) => {
|
|
7247
|
+
childrenRefs.current[index] = /*#__PURE__*/React.createRef();
|
|
7248
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
7249
|
+
ref: childrenRefs.current[index]
|
|
7250
|
+
});
|
|
7251
|
+
});
|
|
7252
|
+
// register any shortcuts attached to children
|
|
7253
|
+
React.useEffect(() => {
|
|
7254
|
+
const shortcuts = [];
|
|
7255
|
+
childrenWithRefs.forEach((child, index) => {
|
|
7256
|
+
if (child.props.shortcut) {
|
|
7257
|
+
shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
|
|
7258
|
+
event.preventDefault();
|
|
7259
|
+
menu === null || menu === void 0 ? void 0 : menu.open();
|
|
7260
|
+
setTimeout(() => {
|
|
7261
|
+
var _childrenRefs$current, _childrenRefs$current2;
|
|
7262
|
+
return (_childrenRefs$current = childrenRefs.current[index]) === null || _childrenRefs$current === void 0 ? void 0 : (_childrenRefs$current2 = _childrenRefs$current.current) === null || _childrenRefs$current2 === void 0 ? void 0 : _childrenRefs$current2.click();
|
|
7263
|
+
}, 1);
|
|
7264
|
+
}));
|
|
7265
|
+
}
|
|
7266
|
+
});
|
|
7267
|
+
shortcuts.forEach(handler => document.addEventListener('keydown', handler));
|
|
7268
|
+
return () => {
|
|
7269
|
+
shortcuts.forEach(handler => document.removeEventListener('keydown', handler));
|
|
7270
|
+
};
|
|
7271
|
+
}, []);
|
|
7231
7272
|
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Portal, null, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
|
|
7232
7273
|
align: align,
|
|
7233
7274
|
className: className,
|
|
@@ -7238,7 +7279,7 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
|
|
|
7238
7279
|
minWidth: menu === null || menu === void 0 ? void 0 : menu.minWidth
|
|
7239
7280
|
},
|
|
7240
7281
|
ref: internalRef
|
|
7241
|
-
}),
|
|
7282
|
+
}), childrenWithRefs));
|
|
7242
7283
|
});
|
|
7243
7284
|
|
|
7244
7285
|
const replaceWithShortform = key => {
|
|
@@ -7249,7 +7290,7 @@ const replaceWithShortform = key => {
|
|
|
7249
7290
|
return 'Del';
|
|
7250
7291
|
case 'Space':
|
|
7251
7292
|
case ' ':
|
|
7252
|
-
return '
|
|
7293
|
+
return 'Space';
|
|
7253
7294
|
case 'ArrowLeft':
|
|
7254
7295
|
return '◄';
|
|
7255
7296
|
case 'ArrowRight':
|
|
@@ -7663,6 +7704,7 @@ const Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(externalProps, ref) {
|
|
|
7663
7704
|
registerIndentation: () => setIndented(true),
|
|
7664
7705
|
minWidth,
|
|
7665
7706
|
setMinWidth: width => setMinWidth(width),
|
|
7707
|
+
open: () => setOpen(true),
|
|
7666
7708
|
close: () => setOpen(false)
|
|
7667
7709
|
}), [indented, minWidth]);
|
|
7668
7710
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
@@ -8724,14 +8766,21 @@ const ToastProvider = ({
|
|
|
8724
8766
|
};
|
|
8725
8767
|
const useToast = () => React.useContext(ToastContext);
|
|
8726
8768
|
|
|
8769
|
+
const TacoContext = /*#__PURE__*/React.createContext({
|
|
8770
|
+
uniqueUserIdentifier: ''
|
|
8771
|
+
});
|
|
8727
8772
|
const Provider = props => {
|
|
8728
8773
|
const {
|
|
8729
8774
|
children,
|
|
8730
|
-
localization
|
|
8775
|
+
localization,
|
|
8776
|
+
settings
|
|
8731
8777
|
} = props;
|
|
8778
|
+
const context = React.useMemo(() => settings, [JSON.stringify(settings)]);
|
|
8732
8779
|
return /*#__PURE__*/React.createElement(LocalizationProvider, {
|
|
8733
8780
|
localization: localization
|
|
8734
|
-
}, /*#__PURE__*/React.createElement(
|
|
8781
|
+
}, /*#__PURE__*/React.createElement(TacoContext.Provider, {
|
|
8782
|
+
value: context
|
|
8783
|
+
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Provider, null, /*#__PURE__*/React.createElement(ToastProvider, null, children))));
|
|
8735
8784
|
};
|
|
8736
8785
|
|
|
8737
8786
|
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
@@ -8798,9 +8847,10 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8798
8847
|
const {
|
|
8799
8848
|
findCurrent,
|
|
8800
8849
|
findTotal,
|
|
8850
|
+
loading = false,
|
|
8851
|
+
onChange: handleChange,
|
|
8801
8852
|
onClickFindNext: handleClickFindNext,
|
|
8802
8853
|
onClickFindPrevious: handleClickFindPrevious,
|
|
8803
|
-
onSearch: handleSearch,
|
|
8804
8854
|
settingsContent,
|
|
8805
8855
|
shortcut,
|
|
8806
8856
|
value,
|
|
@@ -8808,13 +8858,11 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8808
8858
|
} = props;
|
|
8809
8859
|
const internalRef = useMergedRef(ref);
|
|
8810
8860
|
const settingsRef = React__default.useRef(null);
|
|
8811
|
-
const [internalValue, setInternalValue] = React__default.useState(value !== null && value !== void 0 ? value : '');
|
|
8812
8861
|
const [focused, setFocused] = React__default.useState(false);
|
|
8813
8862
|
const {
|
|
8814
8863
|
texts
|
|
8815
8864
|
} = useLocalization();
|
|
8816
8865
|
const isActive = value === null || value === void 0 ? void 0 : value.length;
|
|
8817
|
-
const isSynced = internalValue === value;
|
|
8818
8866
|
const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;
|
|
8819
8867
|
useGlobalKeyDown(shortcut, event => {
|
|
8820
8868
|
if (document.activeElement !== internalRef.current) {
|
|
@@ -8823,39 +8871,25 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8823
8871
|
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
|
8824
8872
|
}
|
|
8825
8873
|
});
|
|
8826
|
-
const handleSubmit = () => {
|
|
8827
|
-
handleSearch(internalValue);
|
|
8828
|
-
};
|
|
8829
8874
|
const handleBlur = event => {
|
|
8830
8875
|
var _settingsRef$current, _attributes$onBlur;
|
|
8831
|
-
// trigger searches when leaving the field
|
|
8832
|
-
if (!isSynced) {
|
|
8833
|
-
handleSubmit();
|
|
8834
|
-
}
|
|
8835
8876
|
if (settingsRef.current && (settingsRef.current === event.relatedTarget || (_settingsRef$current = settingsRef.current) !== null && _settingsRef$current !== void 0 && _settingsRef$current.contains(event.relatedTarget))) {
|
|
8836
8877
|
return;
|
|
8837
8878
|
}
|
|
8838
8879
|
setFocused(false);
|
|
8839
8880
|
(_attributes$onBlur = attributes.onBlur) === null || _attributes$onBlur === void 0 ? void 0 : _attributes$onBlur.call(attributes, event);
|
|
8840
8881
|
};
|
|
8841
|
-
const handleChange = event => {
|
|
8842
|
-
setInternalValue(event.target.value);
|
|
8843
|
-
if (!event.target.value) {
|
|
8844
|
-
handleClear();
|
|
8845
|
-
}
|
|
8846
|
-
};
|
|
8847
8882
|
const handleClear = () => {
|
|
8848
8883
|
requestAnimationFrame(() => {
|
|
8849
8884
|
var _internalRef$current2;
|
|
8850
8885
|
return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.focus();
|
|
8851
8886
|
});
|
|
8852
|
-
|
|
8853
|
-
handleSearch('');
|
|
8887
|
+
handleChange('');
|
|
8854
8888
|
};
|
|
8855
8889
|
const handleFocus = event => {
|
|
8856
8890
|
var _attributes$onFocus;
|
|
8857
|
-
(_attributes$onFocus = attributes.onFocus) === null || _attributes$onFocus === void 0 ? void 0 : _attributes$onFocus.call(attributes, event);
|
|
8858
8891
|
setFocused(true);
|
|
8892
|
+
(_attributes$onFocus = attributes.onFocus) === null || _attributes$onFocus === void 0 ? void 0 : _attributes$onFocus.call(attributes, event);
|
|
8859
8893
|
};
|
|
8860
8894
|
const handleKeyDown = event => {
|
|
8861
8895
|
var _props$onKeyDown;
|
|
@@ -8865,14 +8899,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8865
8899
|
}
|
|
8866
8900
|
if (event.key === 'Enter') {
|
|
8867
8901
|
event.preventDefault();
|
|
8868
|
-
if (hasFind && isActive
|
|
8902
|
+
if (hasFind && isActive) {
|
|
8869
8903
|
if (event.shiftKey) {
|
|
8870
8904
|
handleClickFindPrevious === null || handleClickFindPrevious === void 0 ? void 0 : handleClickFindPrevious();
|
|
8871
8905
|
} else {
|
|
8872
8906
|
handleClickFindNext === null || handleClickFindNext === void 0 ? void 0 : handleClickFindNext();
|
|
8873
8907
|
}
|
|
8874
|
-
} else {
|
|
8875
|
-
handleSearch(internalValue);
|
|
8876
8908
|
}
|
|
8877
8909
|
return;
|
|
8878
8910
|
}
|
|
@@ -8882,8 +8914,8 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8882
8914
|
}
|
|
8883
8915
|
};
|
|
8884
8916
|
let postfix;
|
|
8885
|
-
if (!attributes.disabled && !attributes.readOnly && (
|
|
8886
|
-
if (
|
|
8917
|
+
if (!attributes.disabled && !attributes.readOnly && (value || focused)) {
|
|
8918
|
+
if (value) {
|
|
8887
8919
|
postfix = /*#__PURE__*/React__default.createElement(IconButton, {
|
|
8888
8920
|
"aria-label": texts.searchInput.clear,
|
|
8889
8921
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
|
@@ -8898,7 +8930,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8898
8930
|
if (hasFind && isActive) {
|
|
8899
8931
|
postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
|
|
8900
8932
|
className: "text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2"
|
|
8901
|
-
},
|
|
8933
|
+
}, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
|
8934
|
+
className: "h-4 w-4"
|
|
8935
|
+
}) : `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`), findCurrent ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
8902
8936
|
"aria-label": texts.searchInput.findPrevious,
|
|
8903
8937
|
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
|
8904
8938
|
icon: "chevron-up",
|
|
@@ -8921,7 +8955,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8921
8955
|
})) : texts.searchInput.findNext
|
|
8922
8956
|
})) : null, postfix);
|
|
8923
8957
|
}
|
|
8924
|
-
} else if (shortcut && !focused && !
|
|
8958
|
+
} else if (shortcut && !focused && !value) {
|
|
8925
8959
|
postfix = /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
8926
8960
|
keys: shortcut,
|
|
8927
8961
|
onClickCapture: () => {
|
|
@@ -8931,38 +8965,37 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8931
8965
|
});
|
|
8932
8966
|
}
|
|
8933
8967
|
const className = cn('peer !pl-7', hasFind ? {
|
|
8934
|
-
'!w-48': !
|
|
8935
|
-
'!w-72':
|
|
8968
|
+
'!w-48': !value && !focused,
|
|
8969
|
+
'!w-72': value || focused
|
|
8936
8970
|
} : '!w-48', {
|
|
8937
8971
|
'!wcag-blue-100': isActive
|
|
8938
8972
|
}, props.className);
|
|
8973
|
+
const icon = /*#__PURE__*/React__default.createElement(Icon, {
|
|
8974
|
+
"aria-label": texts.searchInput.button,
|
|
8975
|
+
className: "-ml-0.5 scale-95",
|
|
8976
|
+
name: "search",
|
|
8977
|
+
onClickCapture: () => {
|
|
8978
|
+
var _internalRef$current4;
|
|
8979
|
+
return (_internalRef$current4 = internalRef.current) === null || _internalRef$current4 === void 0 ? void 0 : _internalRef$current4.focus();
|
|
8980
|
+
}
|
|
8981
|
+
});
|
|
8939
8982
|
const input = /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
|
|
8940
8983
|
"aria-label": (_attributes$ariaLabe = attributes['aria-label']) !== null && _attributes$ariaLabe !== void 0 ? _attributes$ariaLabe : texts.searchInput.placeholder,
|
|
8941
8984
|
className: className,
|
|
8942
8985
|
"data-taco": "search-input2",
|
|
8943
8986
|
onBlur: handleBlur,
|
|
8944
|
-
onChange: handleChange,
|
|
8987
|
+
onChange: event => handleChange(event.target.value),
|
|
8945
8988
|
onFocus: handleFocus,
|
|
8946
8989
|
onKeyDown: handleKeyDown,
|
|
8947
8990
|
placeholder: (_attributes$placehold = attributes.placeholder) !== null && _attributes$placehold !== void 0 ? _attributes$placehold : texts.searchInput.placeholder,
|
|
8948
|
-
prefix:
|
|
8949
|
-
"aria-label": texts.searchInput.button,
|
|
8950
|
-
className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
|
|
8951
|
-
disabled: attributes.disabled || attributes.readOnly,
|
|
8952
|
-
icon: "search",
|
|
8953
|
-
onMouseDown: handleSubmit,
|
|
8954
|
-
tabIndex: -1,
|
|
8955
|
-
tooltip: focused && !isSynced ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.searchInput.button, " ", /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
8956
|
-
keys: "Enter"
|
|
8957
|
-
})) : texts.searchInput.button
|
|
8958
|
-
}),
|
|
8991
|
+
prefix: icon,
|
|
8959
8992
|
postfix: postfix,
|
|
8960
8993
|
ref: internalRef,
|
|
8961
|
-
value:
|
|
8994
|
+
value: value !== null && value !== void 0 ? value : ''
|
|
8962
8995
|
}));
|
|
8963
8996
|
if (settingsContent) {
|
|
8964
8997
|
const handleSettingsBlur = event => {
|
|
8965
|
-
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
8998
|
+
if (event.currentTarget.contains(event.relatedTarget) || event.currentTarget.contains(event.target)) {
|
|
8966
8999
|
return;
|
|
8967
9000
|
}
|
|
8968
9001
|
setFocused(false);
|
|
@@ -8976,8 +9009,8 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
|
8976
9009
|
}, input, focused ? /*#__PURE__*/React__default.createElement("div", {
|
|
8977
9010
|
className: "border-grey-300 absolute left-0 right-0 top-full z-10 flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow",
|
|
8978
9011
|
onClickCapture: () => {
|
|
8979
|
-
var _internalRef$
|
|
8980
|
-
return (_internalRef$
|
|
9012
|
+
var _internalRef$current5;
|
|
9013
|
+
return (_internalRef$current5 = internalRef.current) === null || _internalRef$current5 === void 0 ? void 0 : _internalRef$current5.focus();
|
|
8981
9014
|
},
|
|
8982
9015
|
tabIndex: -1
|
|
8983
9016
|
}, settingsContent) : null);
|
|
@@ -9468,7 +9501,17 @@ const EditPopover = props => {
|
|
|
9468
9501
|
setColor(initialColor);
|
|
9469
9502
|
};
|
|
9470
9503
|
const preventKeyDownPropagation = event => {
|
|
9471
|
-
|
|
9504
|
+
// Need to allow 'Escape', 'Tab', 'Shift + Tab' to support default focus and close behaviour of Radix Popover.
|
|
9505
|
+
if (event.key === 'Escape' || event.key === 'Tab' || event.key === 'Tab' && event.shiftKey) {
|
|
9506
|
+
return;
|
|
9507
|
+
} else {
|
|
9508
|
+
event.stopPropagation();
|
|
9509
|
+
}
|
|
9510
|
+
};
|
|
9511
|
+
const popoverContentKeyDown = event => {
|
|
9512
|
+
// Need to stop propagation of 'Tab', 'Shift + Tab' keys out of Popover content,
|
|
9513
|
+
// to avoid 'Tab' key execution on Option component and closing the dropdown.
|
|
9514
|
+
if (event.key === 'Tab' || event.key === 'Tab' && event.shiftKey) {
|
|
9472
9515
|
event.stopPropagation();
|
|
9473
9516
|
}
|
|
9474
9517
|
};
|
|
@@ -9476,6 +9519,7 @@ const EditPopover = props => {
|
|
|
9476
9519
|
onCloseAutoFocus: handleCloseAutoFocus,
|
|
9477
9520
|
onInteractOutside: handleInteractOutside,
|
|
9478
9521
|
onClick: event => event.stopPropagation(),
|
|
9522
|
+
onKeyDown: popoverContentKeyDown,
|
|
9479
9523
|
placement: "right",
|
|
9480
9524
|
tabIndex: -1,
|
|
9481
9525
|
className: "focus:!shadow-none"
|
|
@@ -15616,54 +15660,6 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
|
15616
15660
|
});
|
|
15617
15661
|
Table2.Column = Column$3;
|
|
15618
15662
|
|
|
15619
|
-
const isInternalColumn$1 = id => id.startsWith('__');
|
|
15620
|
-
const isFrozenColumn = (index, table) => {
|
|
15621
|
-
const tableMeta = table.options.meta;
|
|
15622
|
-
if (!tableMeta.columnFreezing.isEnabled || tableMeta.columnFreezing.frozenColumnIndex === undefined) {
|
|
15623
|
-
return false;
|
|
15624
|
-
}
|
|
15625
|
-
return tableMeta.columnFreezing.frozenColumnIndex >= index;
|
|
15626
|
-
};
|
|
15627
|
-
const getCurrentRowCellElement = (index, table) => {
|
|
15628
|
-
const cellSelector = `[data-current="true"] [data-column-index="${index}"`;
|
|
15629
|
-
return table.querySelector(cellSelector);
|
|
15630
|
-
};
|
|
15631
|
-
function scrollColumnIntoView(columnIndex, frozenColumnIndex, column, table) {
|
|
15632
|
-
if (frozenColumnIndex !== undefined && columnIndex > frozenColumnIndex) {
|
|
15633
|
-
const lastFrozenColumnElement = getCurrentRowCellElement(frozenColumnIndex, table);
|
|
15634
|
-
const highlightRef = column === null || column === void 0 ? void 0 : column.getBoundingClientRect();
|
|
15635
|
-
const lastFrozenRect = lastFrozenColumnElement === null || lastFrozenColumnElement === void 0 ? void 0 : lastFrozenColumnElement.getBoundingClientRect();
|
|
15636
|
-
// offset the width of frozen columns so that the column being scrolled to is not hidden behind them
|
|
15637
|
-
if (highlightRef && lastFrozenRect && highlightRef.left < lastFrozenRect.left + lastFrozenRect.width) {
|
|
15638
|
-
const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;
|
|
15639
|
-
table === null || table === void 0 ? void 0 : table.scrollTo(highlightRef.left - pinnedColumnsWidth, table.scrollTop);
|
|
15640
|
-
}
|
|
15641
|
-
} else {
|
|
15642
|
-
column.scrollIntoView({
|
|
15643
|
-
block: 'nearest',
|
|
15644
|
-
inline: 'nearest'
|
|
15645
|
-
});
|
|
15646
|
-
}
|
|
15647
|
-
}
|
|
15648
|
-
function isCellHighlighted(query, value, children) {
|
|
15649
|
-
// if we just stringify date, we get the full object with "Greenwich Meantime" etc in
|
|
15650
|
-
const highlightValue = dateFns.isDate(value) ? children : value;
|
|
15651
|
-
return String(highlightValue).toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
|
15652
|
-
}
|
|
15653
|
-
|
|
15654
|
-
const MIN_COLUMN_SIZE$1 = 80; // accounts for padding and sort controls
|
|
15655
|
-
const getCellAlignmentClasses$1 = (alignment = 'left') => {
|
|
15656
|
-
return cn({
|
|
15657
|
-
'justify-start text-left': alignment === 'left',
|
|
15658
|
-
'justify-end text-right': alignment === 'right',
|
|
15659
|
-
'justify-center text-center': alignment === 'center'
|
|
15660
|
-
});
|
|
15661
|
-
};
|
|
15662
|
-
// Hiding input number spin buttons
|
|
15663
|
-
const getInputAppearanceClassnames = () => {
|
|
15664
|
-
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
|
15665
|
-
};
|
|
15666
|
-
|
|
15667
15663
|
function GotoPopover(props) {
|
|
15668
15664
|
const {
|
|
15669
15665
|
onGoto: handleGoto,
|
|
@@ -15680,6 +15676,7 @@ function GotoPopover(props) {
|
|
|
15680
15676
|
"aria-label": texts.table3.columns.menu.gotoRow,
|
|
15681
15677
|
name: "query",
|
|
15682
15678
|
onSearch: handleSearch,
|
|
15679
|
+
onKeyDown: event => event.stopPropagation(),
|
|
15683
15680
|
placeholder: `${texts.table3.columns.menu.gotoRow}...`
|
|
15684
15681
|
})));
|
|
15685
15682
|
}
|
|
@@ -15699,20 +15696,6 @@ function isMenuAvailable(table, header) {
|
|
|
15699
15696
|
const tableMeta = table.options.meta;
|
|
15700
15697
|
return !!((_header$column$column = header.column.columnDef.meta) !== null && _header$column$column !== void 0 && _header$column$column.menu) || !!tableMeta.columnFreezing.isEnabled || !!table.options.enableHiding && !!header.column.getCanHide() || isGotoAvailable(table, header);
|
|
15701
15698
|
}
|
|
15702
|
-
function getInitialFrozenIndex(table) {
|
|
15703
|
-
const tableMeta = table.options.meta;
|
|
15704
|
-
let index = 0;
|
|
15705
|
-
if (tableMeta.rowDrag.isEnabled) {
|
|
15706
|
-
index++;
|
|
15707
|
-
}
|
|
15708
|
-
if (table.options.enableRowSelection) {
|
|
15709
|
-
index++;
|
|
15710
|
-
}
|
|
15711
|
-
if (table.options.enableExpanding) {
|
|
15712
|
-
index++;
|
|
15713
|
-
}
|
|
15714
|
-
return index;
|
|
15715
|
-
}
|
|
15716
15699
|
function Menu$3(props) {
|
|
15717
15700
|
const {
|
|
15718
15701
|
canFreeze,
|
|
@@ -15774,7 +15757,8 @@ function Menu$3(props) {
|
|
|
15774
15757
|
if (handleGoto) {
|
|
15775
15758
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
|
15776
15759
|
icon: "move",
|
|
15777
|
-
onClick: () => setPopover('goto')
|
|
15760
|
+
onClick: () => setPopover('goto'),
|
|
15761
|
+
shortcut: "g"
|
|
15778
15762
|
}, texts.table3.columns.menu.gotoRow, "..."));
|
|
15779
15763
|
}
|
|
15780
15764
|
if (canHide) {
|
|
@@ -15786,10 +15770,8 @@ function Menu$3(props) {
|
|
|
15786
15770
|
}, texts.table3.columns.menu.hideColumn));
|
|
15787
15771
|
}
|
|
15788
15772
|
if (canFreeze) {
|
|
15789
|
-
const
|
|
15790
|
-
|
|
15791
|
-
};
|
|
15792
|
-
const frozenIndex = index - getInitialFrozenIndex(table);
|
|
15773
|
+
const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;
|
|
15774
|
+
const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);
|
|
15793
15775
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
|
15794
15776
|
icon: "column-freeze",
|
|
15795
15777
|
onClick: handleClick
|
|
@@ -15932,7 +15914,7 @@ function Header$2(props) {
|
|
|
15932
15914
|
hasMenu: isMenuAvailable(table, header),
|
|
15933
15915
|
id: header.id,
|
|
15934
15916
|
index: header.index,
|
|
15935
|
-
isFrozen: isFrozenColumn(header
|
|
15917
|
+
isFrozen: isFrozenColumn(header, table),
|
|
15936
15918
|
isResizing: column.getIsResizing(),
|
|
15937
15919
|
length: table.getRowModel().rows.length,
|
|
15938
15920
|
meta: columnMeta,
|
|
@@ -15984,7 +15966,7 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
|
|
|
15984
15966
|
React__default.useLayoutEffect(() => {
|
|
15985
15967
|
if (internalRef && length) {
|
|
15986
15968
|
// the actions column size gets set by the column itself
|
|
15987
|
-
if (id
|
|
15969
|
+
if (isInternalColumn$1(id)) {
|
|
15988
15970
|
return;
|
|
15989
15971
|
}
|
|
15990
15972
|
table.setColumnSizing(sizes => ({
|
|
@@ -16073,14 +16055,14 @@ function DisplayCell(props) {
|
|
|
16073
16055
|
}, [row.original, props.children, value]);
|
|
16074
16056
|
const memoedHighlight = React__default.useMemo(() => {
|
|
16075
16057
|
var _tableMeta$search$que;
|
|
16076
|
-
if (!tableMeta.search.isHighlightingEnabled) {
|
|
16058
|
+
if (!tableMeta.search.isHighlightingEnabled || !columnMeta.enableSearch) {
|
|
16077
16059
|
return false;
|
|
16078
16060
|
}
|
|
16079
|
-
if ((_tableMeta$search$que = tableMeta.search.query) !== null && _tableMeta$search$que !== void 0 && _tableMeta$search$que.length
|
|
16080
|
-
return isCellHighlighted(tableMeta.search.query, value,
|
|
16061
|
+
if ((_tableMeta$search$que = tableMeta.search.query) !== null && _tableMeta$search$que !== void 0 && _tableMeta$search$que.length) {
|
|
16062
|
+
return isCellHighlighted(tableMeta.search.query, value, columnMeta.dataType);
|
|
16081
16063
|
}
|
|
16082
16064
|
return false;
|
|
16083
|
-
}, [
|
|
16065
|
+
}, [value, tableMeta.search.isHighlightingEnabled, tableMeta.search.excludeUnmatchedResults, tableMeta.search.query]);
|
|
16084
16066
|
const memoedHighlightCurrent = React__default.useMemo(() => {
|
|
16085
16067
|
if (!tableMeta.search.isHighlightingEnabled || !memoedHighlight || tableMeta.search.currentHighlightColumnIndex === undefined) {
|
|
16086
16068
|
return false;
|
|
@@ -16171,7 +16153,7 @@ function Footer$4(props) {
|
|
|
16171
16153
|
align: meta.align,
|
|
16172
16154
|
id: header.id,
|
|
16173
16155
|
index: header.index,
|
|
16174
|
-
isFrozen: isFrozenColumn(header
|
|
16156
|
+
isFrozen: isFrozenColumn(header, table),
|
|
16175
16157
|
meta,
|
|
16176
16158
|
table
|
|
16177
16159
|
};
|
|
@@ -16292,7 +16274,7 @@ function createRowActionsColumn$1() {
|
|
|
16292
16274
|
footer: Footer$4,
|
|
16293
16275
|
meta: {
|
|
16294
16276
|
align: 'right',
|
|
16295
|
-
className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', '[[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:shadow-[-
|
|
16277
|
+
className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', '[[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:shadow-[-6px_0px_6px_theme(colors.grey.200)] [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:shadow-[-6px_0px_6px_theme(colors.grey.100)]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
|
|
16296
16278
|
enableOrdering: false,
|
|
16297
16279
|
enableSearch: false,
|
|
16298
16280
|
enableTruncate: false,
|
|
@@ -16304,6 +16286,71 @@ function createRowActionsColumn$1() {
|
|
|
16304
16286
|
};
|
|
16305
16287
|
}
|
|
16306
16288
|
|
|
16289
|
+
const isInternalColumn$1 = id => id.startsWith('__');
|
|
16290
|
+
const isFrozenColumn = (header, table) => {
|
|
16291
|
+
var _tableMeta$columnFree;
|
|
16292
|
+
const tableMeta = table.options.meta;
|
|
16293
|
+
if (header.column.id !== COLUMN_ID && isInternalColumn$1(header.column.id)) {
|
|
16294
|
+
return true;
|
|
16295
|
+
}
|
|
16296
|
+
if (!tableMeta.columnFreezing.isEnabled || tableMeta.columnFreezing.frozenColumnIndex === undefined) {
|
|
16297
|
+
return false;
|
|
16298
|
+
}
|
|
16299
|
+
return tableMeta.columnFreezing.frozenColumnIndex + ((_tableMeta$columnFree = tableMeta.columnFreezing.frozenInternalColumnCount) !== null && _tableMeta$columnFree !== void 0 ? _tableMeta$columnFree : 0) >= header.index;
|
|
16300
|
+
};
|
|
16301
|
+
const getCurrentRowCellElement = (index, table) => {
|
|
16302
|
+
const cellSelector = `[data-current="true"] [data-column-index="${index}"`;
|
|
16303
|
+
return table.querySelector(cellSelector);
|
|
16304
|
+
};
|
|
16305
|
+
function scrollColumnIntoView(columnIndex, frozenColumnIndex, column, table) {
|
|
16306
|
+
if (frozenColumnIndex !== undefined && columnIndex > frozenColumnIndex) {
|
|
16307
|
+
const lastFrozenColumnElement = getCurrentRowCellElement(frozenColumnIndex, table);
|
|
16308
|
+
const highlightRef = column === null || column === void 0 ? void 0 : column.getBoundingClientRect();
|
|
16309
|
+
const lastFrozenRect = lastFrozenColumnElement === null || lastFrozenColumnElement === void 0 ? void 0 : lastFrozenColumnElement.getBoundingClientRect();
|
|
16310
|
+
// offset the width of frozen columns so that the column being scrolled to is not hidden behind them
|
|
16311
|
+
if (highlightRef && lastFrozenRect && highlightRef.left < lastFrozenRect.left + lastFrozenRect.width) {
|
|
16312
|
+
const pinnedColumnsWidth = lastFrozenRect.left + lastFrozenRect.width;
|
|
16313
|
+
table === null || table === void 0 ? void 0 : table.scrollTo(highlightRef.left - pinnedColumnsWidth, table.scrollTop);
|
|
16314
|
+
}
|
|
16315
|
+
} else {
|
|
16316
|
+
column.scrollIntoView({
|
|
16317
|
+
block: 'nearest',
|
|
16318
|
+
inline: 'nearest'
|
|
16319
|
+
});
|
|
16320
|
+
}
|
|
16321
|
+
}
|
|
16322
|
+
function isCellHighlighted(query, value, dataType) {
|
|
16323
|
+
if (value === undefined || value === null) {
|
|
16324
|
+
return false;
|
|
16325
|
+
}
|
|
16326
|
+
return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
|
16327
|
+
}
|
|
16328
|
+
function getCellValueAsString(value, dataType) {
|
|
16329
|
+
if (value === undefined || value === null) {
|
|
16330
|
+
return '';
|
|
16331
|
+
} else if (dateFns.isDate(value)) {
|
|
16332
|
+
var _format;
|
|
16333
|
+
return (_format = format(value)) !== null && _format !== void 0 ? _format : '';
|
|
16334
|
+
} else if (dataType === 'datetime' && typeof value === 'string') {
|
|
16335
|
+
var _format2;
|
|
16336
|
+
return (_format2 = format(parseFromISOString(value))) !== null && _format2 !== void 0 ? _format2 : '';
|
|
16337
|
+
}
|
|
16338
|
+
return String(value);
|
|
16339
|
+
}
|
|
16340
|
+
|
|
16341
|
+
const MIN_COLUMN_SIZE$1 = 80; // accounts for padding and sort controls
|
|
16342
|
+
const getCellAlignmentClasses$1 = (alignment = 'left') => {
|
|
16343
|
+
return cn({
|
|
16344
|
+
'justify-start text-left': alignment === 'left',
|
|
16345
|
+
'justify-end text-right': alignment === 'right',
|
|
16346
|
+
'justify-center text-center': alignment === 'center'
|
|
16347
|
+
});
|
|
16348
|
+
};
|
|
16349
|
+
// Hiding input number spin buttons
|
|
16350
|
+
const getInputAppearanceClassnames = () => {
|
|
16351
|
+
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
|
16352
|
+
};
|
|
16353
|
+
|
|
16307
16354
|
const useCssGrid = table => {
|
|
16308
16355
|
const allVisibleColumns = table.getVisibleLeafColumns();
|
|
16309
16356
|
const columnSizing = table.getState().columnSizing;
|
|
@@ -16361,7 +16408,7 @@ function useCurrentRow(defaultCurrentRowIndex = 0) {
|
|
|
16361
16408
|
const moveUp = (length, callback) => move(-1, length, callback);
|
|
16362
16409
|
const moveDown = (length, callback) => move(1, length, callback);
|
|
16363
16410
|
const onKeyDown = React__default.useCallback((event, length, scrollToIndex) => {
|
|
16364
|
-
if (event.
|
|
16411
|
+
if (event.defaultPrevented) {
|
|
16365
16412
|
return;
|
|
16366
16413
|
}
|
|
16367
16414
|
if (event.key === 'ArrowUp') {
|
|
@@ -16402,6 +16449,9 @@ const getNextIndex$2 = (direction, currentIndex, length) => {
|
|
|
16402
16449
|
function usePauseHoverState() {
|
|
16403
16450
|
const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
|
|
16404
16451
|
const onKeyDown = React__default.useCallback(event => {
|
|
16452
|
+
if (event.defaultPrevented) {
|
|
16453
|
+
return;
|
|
16454
|
+
}
|
|
16405
16455
|
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
|
16406
16456
|
setHoverStatePaused(true);
|
|
16407
16457
|
}
|
|
@@ -16607,11 +16657,13 @@ var Table3FilterComparator;
|
|
|
16607
16657
|
Table3FilterComparator[Table3FilterComparator["IsGreaterThan"] = 4] = "IsGreaterThan";
|
|
16608
16658
|
Table3FilterComparator[Table3FilterComparator["IsLessThan"] = 5] = "IsLessThan";
|
|
16609
16659
|
Table3FilterComparator[Table3FilterComparator["IsBetween"] = 6] = "IsBetween";
|
|
16610
|
-
Table3FilterComparator[Table3FilterComparator["
|
|
16611
|
-
Table3FilterComparator[Table3FilterComparator["
|
|
16612
|
-
Table3FilterComparator[Table3FilterComparator["
|
|
16613
|
-
Table3FilterComparator[Table3FilterComparator["
|
|
16614
|
-
Table3FilterComparator[Table3FilterComparator["
|
|
16660
|
+
Table3FilterComparator[Table3FilterComparator["IsEmpty"] = 7] = "IsEmpty";
|
|
16661
|
+
Table3FilterComparator[Table3FilterComparator["IsNotEmpty"] = 8] = "IsNotEmpty";
|
|
16662
|
+
Table3FilterComparator[Table3FilterComparator["IsLessThanOrEqualTo"] = 9] = "IsLessThanOrEqualTo";
|
|
16663
|
+
Table3FilterComparator[Table3FilterComparator["IsGreaterThanOrEqualTo"] = 10] = "IsGreaterThanOrEqualTo";
|
|
16664
|
+
Table3FilterComparator[Table3FilterComparator["HasAnyOf"] = 11] = "HasAnyOf";
|
|
16665
|
+
Table3FilterComparator[Table3FilterComparator["HasAllOf"] = 12] = "HasAllOf";
|
|
16666
|
+
Table3FilterComparator[Table3FilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
|
|
16615
16667
|
})(Table3FilterComparator || (Table3FilterComparator = {}));
|
|
16616
16668
|
|
|
16617
16669
|
const toLowerCase$1 = value => String(value !== null && value !== void 0 ? value : '').toLocaleLowerCase();
|
|
@@ -16673,6 +16725,24 @@ function columnFilterFn$1(value, filter) {
|
|
|
16673
16725
|
return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber < filter.value;
|
|
16674
16726
|
}
|
|
16675
16727
|
}
|
|
16728
|
+
case Table3FilterComparator.IsLessThanOrEqualTo:
|
|
16729
|
+
{
|
|
16730
|
+
if (dateFns.isDate(value)) {
|
|
16731
|
+
return dateFns.isDate(filter.value) && (dateFns.isBefore(value, filter.value) || dateFns.isEqual(value, filter.value));
|
|
16732
|
+
} else {
|
|
16733
|
+
const valueAsNumber = parseInt(value);
|
|
16734
|
+
return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber <= filter.value;
|
|
16735
|
+
}
|
|
16736
|
+
}
|
|
16737
|
+
case Table3FilterComparator.IsGreaterThanOrEqualTo:
|
|
16738
|
+
{
|
|
16739
|
+
if (dateFns.isDate(value)) {
|
|
16740
|
+
return dateFns.isDate(filter.value) && (dateFns.isAfter(value, filter.value) || dateFns.isEqual(value, filter.value));
|
|
16741
|
+
} else {
|
|
16742
|
+
const valueAsNumber = parseInt(value);
|
|
16743
|
+
return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber >= filter.value;
|
|
16744
|
+
}
|
|
16745
|
+
}
|
|
16676
16746
|
case Table3FilterComparator.IsBetween:
|
|
16677
16747
|
{
|
|
16678
16748
|
const [fromValue, toValue] = filter.value;
|
|
@@ -16696,11 +16766,11 @@ function columnFilterFn$1(value, filter) {
|
|
|
16696
16766
|
return true;
|
|
16697
16767
|
}
|
|
16698
16768
|
}
|
|
16699
|
-
case Table3FilterComparator.
|
|
16700
|
-
return Array.isArray(filter.value) ? filter.value.includes(
|
|
16701
|
-
case Table3FilterComparator.
|
|
16702
|
-
return Array.isArray(filter.value) ? filter.value.includes(
|
|
16703
|
-
case Table3FilterComparator.
|
|
16769
|
+
case Table3FilterComparator.HasAnyOf:
|
|
16770
|
+
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.some(item => value.includes(item)) : false;
|
|
16771
|
+
case Table3FilterComparator.HasNoneOf:
|
|
16772
|
+
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.every(item => value.includes(item) === false) : false;
|
|
16773
|
+
case Table3FilterComparator.HasAllOf:
|
|
16704
16774
|
return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.filter(v => value.includes(v)).length === filter.value.length : false;
|
|
16705
16775
|
}
|
|
16706
16776
|
return false;
|
|
@@ -16748,8 +16818,8 @@ function useCurrentRowListener(table) {
|
|
|
16748
16818
|
}, [rows.length]);
|
|
16749
16819
|
}
|
|
16750
16820
|
|
|
16751
|
-
function
|
|
16752
|
-
let index =
|
|
16821
|
+
function getFrozenInternalColumnCount(options) {
|
|
16822
|
+
let index = 0;
|
|
16753
16823
|
if (options.enableRowDrag) {
|
|
16754
16824
|
index++;
|
|
16755
16825
|
}
|
|
@@ -16759,7 +16829,7 @@ function getDefaultFrozenIndex(options, defaultFrozenIndex = -1) {
|
|
|
16759
16829
|
if (options.enableRowExpansion) {
|
|
16760
16830
|
index++;
|
|
16761
16831
|
}
|
|
16762
|
-
return index
|
|
16832
|
+
return index;
|
|
16763
16833
|
}
|
|
16764
16834
|
/*
|
|
16765
16835
|
Because of the desired behaviour of column freezing we use custom state and just an index.
|
|
@@ -16767,7 +16837,7 @@ If a frozen column is, for example, hidden, then the desired behaviour is that t
|
|
|
16767
16837
|
If this behaviour were different we would just use the native column pinning functionality
|
|
16768
16838
|
*/
|
|
16769
16839
|
function useColumnFreezing(defaultFrozenIndex, options) {
|
|
16770
|
-
const [frozenColumnIndex, _setFrozenColumnIndex] = React__default.useState(
|
|
16840
|
+
const [frozenColumnIndex, _setFrozenColumnIndex] = React__default.useState(() => defaultFrozenIndex);
|
|
16771
16841
|
const [horizontallyScrolled, setHorizontallyScrolled] = React__default.useState(false);
|
|
16772
16842
|
const onScroll = event => {
|
|
16773
16843
|
if (event.currentTarget.scrollLeft > 0 && !horizontallyScrolled) {
|
|
@@ -16776,11 +16846,13 @@ function useColumnFreezing(defaultFrozenIndex, options) {
|
|
|
16776
16846
|
setHorizontallyScrolled(false);
|
|
16777
16847
|
}
|
|
16778
16848
|
};
|
|
16779
|
-
const
|
|
16780
|
-
|
|
16781
|
-
|
|
16849
|
+
const frozenInternalColumnCount = React__default.useMemo(() => getFrozenInternalColumnCount(options), []);
|
|
16850
|
+
// we must set a value when undefined is explicitly set, otherwise nothing is saved to settings
|
|
16851
|
+
// and the next time the table loads it will fall back to the initial value even though the user changed it
|
|
16852
|
+
const setFrozenColumnIndex = index => _setFrozenColumnIndex(index !== null && index !== void 0 ? index : -1);
|
|
16782
16853
|
return {
|
|
16783
16854
|
isEnabled: options.enableColumnFreezing,
|
|
16855
|
+
frozenInternalColumnCount,
|
|
16784
16856
|
frozenColumnIndex,
|
|
16785
16857
|
setFrozenColumnIndex,
|
|
16786
16858
|
horizontallyScrolled,
|
|
@@ -16788,6 +16860,7 @@ function useColumnFreezing(defaultFrozenIndex, options) {
|
|
|
16788
16860
|
};
|
|
16789
16861
|
}
|
|
16790
16862
|
function useColumnFreezingStyle(tableId, table) {
|
|
16863
|
+
var _tableMeta$columnFree;
|
|
16791
16864
|
const {
|
|
16792
16865
|
columnOrder,
|
|
16793
16866
|
columnSizing,
|
|
@@ -16795,9 +16868,10 @@ function useColumnFreezingStyle(tableId, table) {
|
|
|
16795
16868
|
columnVisibility
|
|
16796
16869
|
} = table.getState();
|
|
16797
16870
|
const tableMeta = table.options.meta;
|
|
16871
|
+
const frozenColumnIndex = ((_tableMeta$columnFree = tableMeta.columnFreezing.frozenColumnIndex) !== null && _tableMeta$columnFree !== void 0 ? _tableMeta$columnFree : -1) + tableMeta.columnFreezing.frozenInternalColumnCount;
|
|
16798
16872
|
const style = React__default.useMemo(() => {
|
|
16799
|
-
if (tableMeta.columnFreezing.
|
|
16800
|
-
const visibleFrozenColumns = table.getVisibleLeafColumns().slice(0,
|
|
16873
|
+
if (tableMeta.columnFreezing.frozenInternalColumnCount > 0 || tableMeta.columnFreezing.isEnabled && frozenColumnIndex !== undefined) {
|
|
16874
|
+
const visibleFrozenColumns = table.getVisibleLeafColumns().slice(0, frozenColumnIndex + 1).map(column => column.id);
|
|
16801
16875
|
// if all frozen columns haven't had their size set yet, then abort
|
|
16802
16876
|
if (visibleFrozenColumns.every(id => columnSizing[id] === undefined)) {
|
|
16803
16877
|
return undefined;
|
|
@@ -16807,33 +16881,33 @@ function useColumnFreezingStyle(tableId, table) {
|
|
|
16807
16881
|
offsets[columnId] = offset;
|
|
16808
16882
|
return offset + columnSizing[columnId];
|
|
16809
16883
|
}, 0);
|
|
16810
|
-
const styles = [Object.values(offsets).map((offset, index) => `#${tableId} [role="row"] > :nth-child(${index + 1}) { left: ${offset}px }`).join('\n'), `#${tableId} [role="row"] > :not(:nth-child(n+${
|
|
16884
|
+
const styles = [Object.values(offsets).map((offset, index) => `#${tableId} [role="row"] > :nth-child(${index + 1}) { left: ${offset}px }`).join('\n'), `#${tableId} [role="row"] > :not(:nth-child(n+${frozenColumnIndex + 2})) {
|
|
16811
16885
|
position: sticky;
|
|
16812
|
-
z-index: 20;
|
|
16813
|
-
}`, `#${tableId}[data-horizontally-scrolled="true"] [role="row"] > :nth-child(${
|
|
16886
|
+
z-index: 20;
|
|
16887
|
+
}`, `#${tableId}[data-horizontally-scrolled="true"] [role="row"] > :nth-child(${frozenColumnIndex + 1}) {
|
|
16814
16888
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), 6px 0px 6px rgb(0 0 0/8%), 1px 0px 0px #DDDDDD;
|
|
16815
16889
|
}`];
|
|
16816
|
-
const columnId = visibleFrozenColumns[
|
|
16890
|
+
const columnId = visibleFrozenColumns[frozenColumnIndex];
|
|
16817
16891
|
// frozenColumnIndex could not be in the visible frozen column so it is important to check if columnId
|
|
16818
16892
|
// exists before checking if it is internal.
|
|
16819
16893
|
//
|
|
16820
16894
|
// only add a border to the edge column if it isn't an internal column
|
|
16821
16895
|
if (columnId && !isInternalColumn$1(columnId)) {
|
|
16822
|
-
styles.push(`#${tableId}[data-horizontally-scrolled="false"] [role="row"] > :nth-child(${
|
|
16896
|
+
styles.push(`#${tableId}[data-horizontally-scrolled="false"] [role="row"] > :nth-child(${frozenColumnIndex + 1}) {
|
|
16823
16897
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), 1px 0px 0px #DDDDDD;
|
|
16824
16898
|
}`);
|
|
16825
16899
|
}
|
|
16826
16900
|
return styles.join('\n');
|
|
16827
16901
|
}
|
|
16828
16902
|
return undefined;
|
|
16829
|
-
}, [columnOrder, columnSizing, columnSizingInfo, columnVisibility, tableMeta.columnFreezing.isEnabled,
|
|
16903
|
+
}, [columnOrder, columnSizing, columnSizingInfo, columnVisibility, tableMeta.columnFreezing.isEnabled, frozenColumnIndex]);
|
|
16830
16904
|
return style;
|
|
16831
16905
|
}
|
|
16832
16906
|
|
|
16833
16907
|
function useRowSelection() {
|
|
16834
16908
|
const lastSelectedRowIndex = React__default.useRef();
|
|
16835
16909
|
const onKeyDown = React__default.useCallback((event, table) => {
|
|
16836
|
-
if (!table.options.enableRowSelection || event.
|
|
16910
|
+
if (!table.options.enableRowSelection || event.defaultPrevented) {
|
|
16837
16911
|
return;
|
|
16838
16912
|
}
|
|
16839
16913
|
const rows = table.getRowModel().rows;
|
|
@@ -16857,7 +16931,7 @@ function useRowSelection() {
|
|
|
16857
16931
|
|
|
16858
16932
|
function useRowClick(onRowClick) {
|
|
16859
16933
|
const onKeyDown = React__default.useCallback((event, table) => {
|
|
16860
|
-
if (typeof onRowClick !== 'function' || event.
|
|
16934
|
+
if (typeof onRowClick !== 'function' || event.defaultPrevented) {
|
|
16861
16935
|
return;
|
|
16862
16936
|
}
|
|
16863
16937
|
const rows = table.getRowModel().rows;
|
|
@@ -16927,29 +17001,25 @@ function useEditing(isEnabled, onSave) {
|
|
|
16927
17001
|
}
|
|
16928
17002
|
setChanges(currentChanges);
|
|
16929
17003
|
}
|
|
16930
|
-
const handleKeyDown = (event
|
|
17004
|
+
const handleKeyDown = React__default.useCallback(event => {
|
|
17005
|
+
if (event.defaultPrevented) {
|
|
17006
|
+
return;
|
|
17007
|
+
}
|
|
16931
17008
|
if (event.ctrlKey || event.metaKey) {
|
|
16932
17009
|
if (event.key === 'e') {
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
setIsEditing(false);
|
|
16936
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
|
|
16937
|
-
} else {
|
|
16938
|
-
setIsEditing(true);
|
|
16939
|
-
}
|
|
16940
|
-
}
|
|
16941
|
-
if (event.key === 's') {
|
|
17010
|
+
setIsEditing(editing => !editing);
|
|
17011
|
+
} else if (event.key === 's') {
|
|
16942
17012
|
// Prevent default browser save
|
|
16943
17013
|
event.preventDefault();
|
|
16944
17014
|
saveChangesIfNeeded();
|
|
16945
17015
|
}
|
|
16946
17016
|
}
|
|
16947
|
-
};
|
|
16948
|
-
const handleBlur = event => {
|
|
17017
|
+
}, [isEditing]);
|
|
17018
|
+
const handleBlur = React__default.useCallback(event => {
|
|
16949
17019
|
if (event.target === event.currentTarget) {
|
|
16950
17020
|
saveChangesIfNeeded();
|
|
16951
17021
|
}
|
|
16952
|
-
};
|
|
17022
|
+
}, []);
|
|
16953
17023
|
// Creates initial saving states from changes object
|
|
16954
17024
|
const addSavingStates = () => {
|
|
16955
17025
|
const changeset = Object.keys(changes || {});
|
|
@@ -17484,9 +17554,7 @@ const Control = /*#__PURE__*/React__default.forwardRef(function Control(props, r
|
|
|
17484
17554
|
}
|
|
17485
17555
|
}
|
|
17486
17556
|
} else {
|
|
17487
|
-
var _tableRef$current;
|
|
17488
17557
|
tableMeta.editing.toggleEditing(false);
|
|
17489
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
|
|
17490
17558
|
}
|
|
17491
17559
|
return;
|
|
17492
17560
|
}
|
|
@@ -17666,7 +17734,12 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
|
17666
17734
|
}
|
|
17667
17735
|
tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;
|
|
17668
17736
|
};
|
|
17669
|
-
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, context), /*#__PURE__*/React__default.createElement(
|
|
17737
|
+
return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
17738
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
17739
|
+
className: "ml-2",
|
|
17740
|
+
keys: "Space"
|
|
17741
|
+
}))
|
|
17742
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
17670
17743
|
"aria-label": title,
|
|
17671
17744
|
className: "!mt-0",
|
|
17672
17745
|
checked: isSelected,
|
|
@@ -17674,7 +17747,7 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
|
17674
17747
|
// this is necessary to remove console spam from eslint
|
|
17675
17748
|
onChange: () => false,
|
|
17676
17749
|
tabIndex: isCurrentRow ? 0 : -1
|
|
17677
|
-
}));
|
|
17750
|
+
})));
|
|
17678
17751
|
} else {
|
|
17679
17752
|
const className = cn('!mt-0', getRadioClassnames());
|
|
17680
17753
|
const handleClick = event => {
|
|
@@ -17701,7 +17774,8 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
|
17701
17774
|
// and we don't really care about re-rendering in any other scenario
|
|
17702
17775
|
return newTableMeta.currentRow.currentRowIndex === oldTableMeta.currentRow.currentRowIndex && newProps.row.getIsSelected() !== oldProps.row.getIsSelected();
|
|
17703
17776
|
});
|
|
17704
|
-
function createRowSelectionColumn$1(
|
|
17777
|
+
function createRowSelectionColumn$1(hasDrag, hasExpansion) {
|
|
17778
|
+
const size = hasDrag ? 22 : 40;
|
|
17705
17779
|
return {
|
|
17706
17780
|
id: COLUMN_ID$2,
|
|
17707
17781
|
header: Header$3,
|
|
@@ -17709,16 +17783,23 @@ function createRowSelectionColumn$1(onRowDrag) {
|
|
|
17709
17783
|
footer: Footer$4,
|
|
17710
17784
|
meta: {
|
|
17711
17785
|
align: 'center',
|
|
17712
|
-
className: '!pt-[var(--table3-row-padding)] !justify-end !p-0
|
|
17786
|
+
className: cn('!pt-[var(--table3-row-padding)] !justify-end !p-0', {
|
|
17787
|
+
'!pr-0.5': hasExpansion,
|
|
17788
|
+
'!pr-2.5': !hasExpansion
|
|
17789
|
+
}),
|
|
17713
17790
|
enableOrdering: false,
|
|
17714
17791
|
enableSearch: false,
|
|
17715
17792
|
enableTruncate: false,
|
|
17716
17793
|
header: '',
|
|
17717
|
-
headerClassName: 'items-center !justify-end !p-0
|
|
17794
|
+
headerClassName: cn('items-center !justify-end !p-0', {
|
|
17795
|
+
'!pr-0.5': hasExpansion,
|
|
17796
|
+
'!pr-2.5': !hasExpansion
|
|
17797
|
+
})
|
|
17718
17798
|
},
|
|
17719
17799
|
// options
|
|
17720
17800
|
enableResizing: false,
|
|
17721
|
-
size
|
|
17801
|
+
size,
|
|
17802
|
+
minSize: size
|
|
17722
17803
|
};
|
|
17723
17804
|
}
|
|
17724
17805
|
|
|
@@ -17901,7 +17982,7 @@ function getSortingFn$1(dataType, customFnOrBuiltIn) {
|
|
|
17901
17982
|
return customFnOrBuiltIn;
|
|
17902
17983
|
}
|
|
17903
17984
|
// some times we alias based on the type
|
|
17904
|
-
if (dataType && dataType !== 'boolean') {
|
|
17985
|
+
if (dataType && dataType !== 'boolean' && dataType !== 'number') {
|
|
17905
17986
|
return dataType;
|
|
17906
17987
|
}
|
|
17907
17988
|
// otherwise fall back to auto
|
|
@@ -17956,11 +18037,9 @@ function useConvertChildrenToColumns(props, options, editing) {
|
|
|
17956
18037
|
control: child.props.control,
|
|
17957
18038
|
dataType: child.props.dataType,
|
|
17958
18039
|
enableOrdering: (_child$props$enableOr = child.props.enableOrdering) !== null && _child$props$enableOr !== void 0 ? _child$props$enableOr : true,
|
|
17959
|
-
// react-table global filtering only samples from row 0 in a dataset for filtering and this
|
|
17960
|
-
// leads to some columns being disabled if, e.g., a column in row 0 has an undefined value
|
|
17961
|
-
// so we do not use the native enableGlobalFilter property and instead use our own enableSearch
|
|
17962
18040
|
enableSearch: (_child$props$enableSe = child.props.enableSearch) !== null && _child$props$enableSe !== void 0 ? _child$props$enableSe : true,
|
|
17963
18041
|
enableTruncate: (_child$props$enableTr = child.props.enableTruncate) !== null && _child$props$enableTr !== void 0 ? _child$props$enableTr : false,
|
|
18042
|
+
filters: child.props.filters,
|
|
17964
18043
|
footer: child.props.footer,
|
|
17965
18044
|
header: child.props.header,
|
|
17966
18045
|
headerClassName: child.props.headerClassName,
|
|
@@ -17975,7 +18054,7 @@ function useConvertChildrenToColumns(props, options, editing) {
|
|
|
17975
18054
|
columns.unshift(columnHelper.display(createRowExpansionColumn$1(props.expandedRowRenderer)));
|
|
17976
18055
|
}
|
|
17977
18056
|
if (options.enableRowSelection) {
|
|
17978
|
-
columns.unshift(columnHelper.display(createRowSelectionColumn$1(options.enableRowDrag
|
|
18057
|
+
columns.unshift(columnHelper.display(createRowSelectionColumn$1(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)));
|
|
17979
18058
|
}
|
|
17980
18059
|
if (options.enableRowDrag && props.onRowDrag) {
|
|
17981
18060
|
columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));
|
|
@@ -18118,8 +18197,54 @@ function useRowActions$1(actionsForRow, actionsForRowLength = ACTIONS_ON_ROW_LEN
|
|
|
18118
18197
|
};
|
|
18119
18198
|
}
|
|
18120
18199
|
|
|
18200
|
+
const useLocalStorage = (key, initialValue) => {
|
|
18201
|
+
const [state, setState] = React__default.useState(() => {
|
|
18202
|
+
try {
|
|
18203
|
+
const localStorageValue = localStorage.getItem(key);
|
|
18204
|
+
if (typeof localStorageValue !== 'string') {
|
|
18205
|
+
localStorage.setItem(key, JSON.stringify(initialValue));
|
|
18206
|
+
return initialValue;
|
|
18207
|
+
} else {
|
|
18208
|
+
return JSON.parse(localStorageValue || 'null');
|
|
18209
|
+
}
|
|
18210
|
+
} catch {
|
|
18211
|
+
// If user is in private mode or has storage restriction
|
|
18212
|
+
// localStorage can throw. JSON.parse and JSON.stringify
|
|
18213
|
+
// can throw, too.
|
|
18214
|
+
return initialValue;
|
|
18215
|
+
}
|
|
18216
|
+
});
|
|
18217
|
+
React__default.useEffect(() => {
|
|
18218
|
+
try {
|
|
18219
|
+
const serializedState = JSON.stringify(state);
|
|
18220
|
+
localStorage.setItem(key, serializedState);
|
|
18221
|
+
} catch {
|
|
18222
|
+
// If user is in private mode or has storage restriction
|
|
18223
|
+
// localStorage can throw. Also JSON.stringify can throw.
|
|
18224
|
+
}
|
|
18225
|
+
}, [key, state]);
|
|
18226
|
+
const clear = () => localStorage.removeItem(key);
|
|
18227
|
+
return [state, setState, clear];
|
|
18228
|
+
};
|
|
18229
|
+
|
|
18230
|
+
function useTacoSettings() {
|
|
18231
|
+
return React__default.useContext(TacoContext);
|
|
18232
|
+
}
|
|
18233
|
+
|
|
18234
|
+
function useSettings(id, defaultSettings = {}, onChangeSettings) {
|
|
18235
|
+
const tacoSettings = useTacoSettings();
|
|
18236
|
+
const uniqueId = `taco.${tacoSettings.uniqueUserIdentifier}.table3.${id}.settings`;
|
|
18237
|
+
const [persistedSettings, setPersistedSettings] = useLocalStorage(uniqueId, defaultSettings);
|
|
18238
|
+
return React__default.useMemo(() => {
|
|
18239
|
+
if (onChangeSettings) {
|
|
18240
|
+
return [defaultSettings, onChangeSettings];
|
|
18241
|
+
}
|
|
18242
|
+
return [persistedSettings, setPersistedSettings];
|
|
18243
|
+
}, []);
|
|
18244
|
+
}
|
|
18245
|
+
|
|
18121
18246
|
function useTable$2(props) {
|
|
18122
|
-
var _ref,
|
|
18247
|
+
var _ref, _defaultSettings$colu, _defaultSettings$rowH, _props$length;
|
|
18123
18248
|
// options
|
|
18124
18249
|
const options = useTablePreset(props);
|
|
18125
18250
|
const tableOptions = {
|
|
@@ -18157,6 +18282,10 @@ function useTable$2(props) {
|
|
|
18157
18282
|
return false;
|
|
18158
18283
|
};
|
|
18159
18284
|
tableOptions.getFilteredRowModel = reactTable$1.getFilteredRowModel();
|
|
18285
|
+
tableOptions.getColumnCanGlobalFilter = column => {
|
|
18286
|
+
var _column$columnDef$met;
|
|
18287
|
+
return (_column$columnDef$met = column.columnDef.meta.enableSearch) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : true;
|
|
18288
|
+
};
|
|
18160
18289
|
}
|
|
18161
18290
|
// sorting
|
|
18162
18291
|
if (options.enableSorting) {
|
|
@@ -18167,24 +18296,25 @@ function useTable$2(props) {
|
|
|
18167
18296
|
tableOptions.getSortedRowModel = reactTable$1.getSortedRowModel();
|
|
18168
18297
|
}
|
|
18169
18298
|
}
|
|
18299
|
+
const [defaultSettings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);
|
|
18170
18300
|
// custom features
|
|
18171
18301
|
const columnFreezing = useColumnFreezing( // temporarily see if deprecated frozenColumnCount is there
|
|
18172
|
-
(_ref = (
|
|
18302
|
+
(_ref = (_defaultSettings$colu = defaultSettings.columnFreezingIndex) !== null && _defaultSettings$colu !== void 0 ? _defaultSettings$colu : defaultSettings === null || defaultSettings === void 0 ? void 0 : defaultSettings.frozenColumnCount) !== null && _ref !== void 0 ? _ref : props.defaultColumnFreezingIndex, options);
|
|
18173
18303
|
const columnOrdering = useColumnOrdering(options);
|
|
18174
18304
|
const currentRow = useCurrentRow(props.defaultCurrentRowIndex);
|
|
18175
18305
|
const editing = useEditing(options.enableEditing, props.onSave);
|
|
18176
|
-
const fontSize = useFontSize(options.enableFontSize,
|
|
18306
|
+
const fontSize = useFontSize(options.enableFontSize, defaultSettings.fontSize);
|
|
18177
18307
|
const hoverState = usePauseHoverState();
|
|
18178
|
-
const printing = usePrinting(options.enablePrinting, props.loadAll,
|
|
18308
|
+
const printing = usePrinting(options.enablePrinting, props.loadAll, defaultSettings.showWarningWhenPrintingLargeDataset);
|
|
18179
18309
|
const rowActions = useRowActions$1(props.actionsForRow, props.actionsForRowLength);
|
|
18180
18310
|
const rowClick = useRowClick(props.onRowClick);
|
|
18181
18311
|
const rowDrag = useRowDrag(options.enableRowDrag);
|
|
18182
18312
|
const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);
|
|
18183
18313
|
const rowGoto = useRowGoto(options.enableRowGoto, props.onRowGoto);
|
|
18184
18314
|
const rowHeight = useRowHeight(options.enableRowHeight, // temporarily see if deprecated rowDensity is there
|
|
18185
|
-
(
|
|
18315
|
+
(_defaultSettings$rowH = defaultSettings.rowHeight) !== null && _defaultSettings$rowH !== void 0 ? _defaultSettings$rowH : defaultSettings === null || defaultSettings === void 0 ? void 0 : defaultSettings.rowDensity);
|
|
18186
18316
|
const rowSelection = useRowSelection();
|
|
18187
|
-
const search = useSearch(options.enableSearch,
|
|
18317
|
+
const search = useSearch(options.enableSearch, defaultSettings.excludeUnmatchedRecordsInSearch, props.loadAll);
|
|
18188
18318
|
// columns
|
|
18189
18319
|
const {
|
|
18190
18320
|
columns,
|
|
@@ -18194,13 +18324,13 @@ function useTable$2(props) {
|
|
|
18194
18324
|
} = useConvertChildrenToColumns(props, options, editing);
|
|
18195
18325
|
// built-in features
|
|
18196
18326
|
const initialState = React__default.useMemo(() => {
|
|
18197
|
-
var
|
|
18327
|
+
var _defaultSettings$colu2, _defaultSettings$colu3;
|
|
18198
18328
|
const sanitizeSortedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);
|
|
18199
18329
|
return {
|
|
18200
|
-
columnOrder: ensureOrdering$1(columns,
|
|
18201
|
-
columnSizing: (
|
|
18202
|
-
columnVisibility: (
|
|
18203
|
-
sorting:
|
|
18330
|
+
columnOrder: ensureOrdering$1(columns, defaultSettings.columnOrder),
|
|
18331
|
+
columnSizing: (_defaultSettings$colu2 = defaultSettings.columnSizing) !== null && _defaultSettings$colu2 !== void 0 ? _defaultSettings$colu2 : defaultColumnSizing,
|
|
18332
|
+
columnVisibility: (_defaultSettings$colu3 = defaultSettings.columnVisibility) !== null && _defaultSettings$colu3 !== void 0 ? _defaultSettings$colu3 : defaultColumnVisibility,
|
|
18333
|
+
sorting: defaultSettings.sorting ? defaultSettings.sorting.filter(sanitizeSortedColumns) : defaultSorting
|
|
18204
18334
|
};
|
|
18205
18335
|
}, []);
|
|
18206
18336
|
const table = reactTable$1.useReactTable({
|
|
@@ -18234,7 +18364,7 @@ function useTable$2(props) {
|
|
|
18234
18364
|
useEditingStateListener(table);
|
|
18235
18365
|
useFilteringStateListener(table, props.onFilter);
|
|
18236
18366
|
useRowSelectionListener$1(table, props.onRowSelect);
|
|
18237
|
-
useSettingsStateListener$1(table,
|
|
18367
|
+
useSettingsStateListener$1(table, setSettings);
|
|
18238
18368
|
useShortcutsListener(table, props.shortcuts);
|
|
18239
18369
|
useServerLoadingListener(table, props.loadPage);
|
|
18240
18370
|
useSortingStateListener(table, props.onSort);
|
|
@@ -18699,6 +18829,23 @@ function RowHeight(props) {
|
|
|
18699
18829
|
}, texts.table3.rowHeight.sizes.extraTall)));
|
|
18700
18830
|
}
|
|
18701
18831
|
|
|
18832
|
+
// augments useEffect to not run debounced
|
|
18833
|
+
function useDebouncedEffect(effect, deps, ms = 200) {
|
|
18834
|
+
const timeoutRef = React__default.useRef();
|
|
18835
|
+
React__default.useEffect(() => {
|
|
18836
|
+
timeoutRef.current = setTimeout(effect, ms);
|
|
18837
|
+
return () => {
|
|
18838
|
+
clearTimeout(timeoutRef.current);
|
|
18839
|
+
};
|
|
18840
|
+
}, deps);
|
|
18841
|
+
}
|
|
18842
|
+
|
|
18843
|
+
var LoadingState;
|
|
18844
|
+
(function (LoadingState) {
|
|
18845
|
+
LoadingState[LoadingState["Incomplete"] = 0] = "Incomplete";
|
|
18846
|
+
LoadingState[LoadingState["Loading"] = 1] = "Loading";
|
|
18847
|
+
LoadingState[LoadingState["Completed"] = 2] = "Completed";
|
|
18848
|
+
})(LoadingState || (LoadingState = {}));
|
|
18702
18849
|
function Search$3(props) {
|
|
18703
18850
|
const {
|
|
18704
18851
|
scrollToIndex,
|
|
@@ -18709,6 +18856,8 @@ function Search$3(props) {
|
|
|
18709
18856
|
} = useLocalization();
|
|
18710
18857
|
const ref = React__default.useRef(null);
|
|
18711
18858
|
const tableMeta = table.options.meta;
|
|
18859
|
+
const [query, setQuery] = React__default.useState(tableMeta.search.query);
|
|
18860
|
+
const [loading, setLoading] = React__default.useState(LoadingState.Incomplete);
|
|
18712
18861
|
const scrollTo = rowIndex => scrollToIndex(rowIndex, {
|
|
18713
18862
|
align: 'center'
|
|
18714
18863
|
});
|
|
@@ -18719,32 +18868,38 @@ function Search$3(props) {
|
|
|
18719
18868
|
if (firstRowIndex) {
|
|
18720
18869
|
scrollTo(firstRowIndex);
|
|
18721
18870
|
}
|
|
18722
|
-
}, [tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, table.getRowModel().rows.length, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
}
|
|
18732
|
-
}
|
|
18733
|
-
tableMeta.search.setQuery(value);
|
|
18871
|
+
}, [tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, table.getRowModel().rows.length, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility), loading]);
|
|
18872
|
+
// update the table search and filtering on a debounce
|
|
18873
|
+
useDebouncedEffect(() => {
|
|
18874
|
+
tableMeta.search.setQuery(query);
|
|
18875
|
+
if (tableMeta.search.excludeUnmatchedResults) {
|
|
18876
|
+
if (query !== null && query !== void 0 && query.length) {
|
|
18877
|
+
table.setGlobalFilter(query);
|
|
18878
|
+
} else {
|
|
18879
|
+
table.resetGlobalFilter();
|
|
18734
18880
|
}
|
|
18735
|
-
|
|
18736
|
-
|
|
18881
|
+
}
|
|
18882
|
+
}, [query]);
|
|
18883
|
+
const handleFocus = function () {
|
|
18884
|
+
try {
|
|
18737
18885
|
const _temp = function () {
|
|
18738
|
-
if (tableMeta.search.loadAll) {
|
|
18886
|
+
if (tableMeta.search.loadAll && loading === LoadingState.Incomplete) {
|
|
18887
|
+
setLoading(LoadingState.Loading);
|
|
18739
18888
|
// don't pass the search query because we need all data - not filtered data
|
|
18740
|
-
return Promise.resolve(tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {
|
|
18889
|
+
return Promise.resolve(tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {
|
|
18890
|
+
setLoading(LoadingState.Completed);
|
|
18891
|
+
});
|
|
18741
18892
|
}
|
|
18742
18893
|
}();
|
|
18743
|
-
|
|
18894
|
+
// load all data if that is possible
|
|
18895
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
18744
18896
|
} catch (e) {
|
|
18745
18897
|
return Promise.reject(e);
|
|
18746
18898
|
}
|
|
18747
18899
|
};
|
|
18900
|
+
const handleChange = query => {
|
|
18901
|
+
setQuery(String(query !== null && query !== void 0 ? query : ''));
|
|
18902
|
+
};
|
|
18748
18903
|
const handleToggleExcludeUnmatchedResults = enabled => {
|
|
18749
18904
|
tableMeta.search.toggleExcludeUnmatchedResults(enabled);
|
|
18750
18905
|
if (enabled) {
|
|
@@ -18789,9 +18944,11 @@ function Search$3(props) {
|
|
|
18789
18944
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
|
|
18790
18945
|
findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
|
|
18791
18946
|
findTotal: tableMeta.search.highlightedColumnIndexes ? tableMeta.search.highlightedColumnIndexes.length : null,
|
|
18947
|
+
loading: loading === LoadingState.Loading,
|
|
18792
18948
|
onClickFindPrevious: handlePreviousResult,
|
|
18793
18949
|
onClickFindNext: handleNextResult,
|
|
18794
|
-
|
|
18950
|
+
onChange: handleChange,
|
|
18951
|
+
onFocus: handleFocus,
|
|
18795
18952
|
placeholder: texts.table3.search.placeholder,
|
|
18796
18953
|
settingsContent: settings,
|
|
18797
18954
|
ref: ref,
|
|
@@ -18800,7 +18957,7 @@ function Search$3(props) {
|
|
|
18800
18957
|
meta: true,
|
|
18801
18958
|
shift: false
|
|
18802
18959
|
},
|
|
18803
|
-
value:
|
|
18960
|
+
value: query
|
|
18804
18961
|
}));
|
|
18805
18962
|
}
|
|
18806
18963
|
function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
@@ -18812,14 +18969,9 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
|
|
|
18812
18969
|
table.getRowModel().rows.forEach((row, rowIndex) => {
|
|
18813
18970
|
columns.forEach((column, columnIndex) => {
|
|
18814
18971
|
try {
|
|
18815
|
-
var _column$columnDef$met
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
dateFns.isDate(row.original[column.id]) ? (_format = format(row.original[column.id])) !== null && _format !== void 0 ? _format : '' :
|
|
18819
|
-
// if its marked as a date but isn't a date, try to format it
|
|
18820
|
-
column.columnDef.meta.dataType === 'datetime' ? (_format2 = format(parseFromISOString(row.original[column.id]))) !== null && _format2 !== void 0 ? _format2 : '' :
|
|
18821
|
-
// otherwise just string compare
|
|
18822
|
-
String(row.original[column.id]), value)) {
|
|
18972
|
+
var _row$original, _column$columnDef$met;
|
|
18973
|
+
const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
|
|
18974
|
+
if (cellValue && globalFilterFn$1(cellValue, value)) {
|
|
18823
18975
|
indexes.push([rowIndex, columnIndex]);
|
|
18824
18976
|
}
|
|
18825
18977
|
} catch (e) {
|
|
@@ -18869,29 +19021,74 @@ function FilterColumn(props) {
|
|
|
18869
19021
|
|
|
18870
19022
|
function FilterComparator(props) {
|
|
18871
19023
|
const {
|
|
19024
|
+
column,
|
|
18872
19025
|
onChange: handleChange,
|
|
18873
19026
|
value,
|
|
18874
|
-
validComparators,
|
|
18875
19027
|
...attributes
|
|
18876
19028
|
} = props;
|
|
18877
19029
|
const {
|
|
18878
19030
|
texts
|
|
18879
19031
|
} = useLocalization();
|
|
19032
|
+
const validComparators = guessComparatorsBasedOnControl$1(column);
|
|
18880
19033
|
React__default.useEffect(() => {
|
|
18881
|
-
if (value === undefined) {
|
|
19034
|
+
if (value === undefined || !validComparators.includes(value)) {
|
|
18882
19035
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange(validComparators[0]);
|
|
18883
19036
|
}
|
|
18884
|
-
}, []);
|
|
19037
|
+
}, [validComparators]);
|
|
18885
19038
|
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
|
18886
19039
|
className: "!w-32 flex-shrink-0",
|
|
19040
|
+
disabled: !column,
|
|
18887
19041
|
onChange: handleChange,
|
|
18888
19042
|
value: value
|
|
18889
|
-
}), validComparators.map(
|
|
18890
|
-
key:
|
|
18891
|
-
value:
|
|
18892
|
-
}, getComparatorText$1(
|
|
19043
|
+
}), validComparators.map(comparator => /*#__PURE__*/React__default.createElement(Select2.Option, {
|
|
19044
|
+
key: comparator,
|
|
19045
|
+
value: comparator
|
|
19046
|
+
}, getComparatorText$1(comparator, texts, column))));
|
|
18893
19047
|
}
|
|
18894
|
-
|
|
19048
|
+
function guessComparatorsBasedOnControl$1(column) {
|
|
19049
|
+
var _column$columnDef$met;
|
|
19050
|
+
const columnMeta = (_column$columnDef$met = column === null || column === void 0 ? void 0 : column.columnDef.meta) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : {};
|
|
19051
|
+
if (Array.isArray(columnMeta.filters)) {
|
|
19052
|
+
return columnMeta.filters;
|
|
19053
|
+
}
|
|
19054
|
+
if (typeof columnMeta.control === 'function') {
|
|
19055
|
+
const renderedControl = columnMeta.control({
|
|
19056
|
+
onBlur: () => undefined,
|
|
19057
|
+
onFocus: () => undefined,
|
|
19058
|
+
setValue: () => undefined,
|
|
19059
|
+
value: undefined,
|
|
19060
|
+
disabled: false,
|
|
19061
|
+
readOnly: false,
|
|
19062
|
+
ref: undefined
|
|
19063
|
+
});
|
|
19064
|
+
if ( /*#__PURE__*/React__default.isValidElement(renderedControl)) {
|
|
19065
|
+
const {
|
|
19066
|
+
props,
|
|
19067
|
+
type
|
|
19068
|
+
} = renderedControl;
|
|
19069
|
+
if (type.displayName === 'Select2') {
|
|
19070
|
+
if (props.multiple) {
|
|
19071
|
+
return [Table3FilterComparator.HasAnyOf, Table3FilterComparator.HasAllOf, Table3FilterComparator.IsEqualTo, Table3FilterComparator.HasNoneOf, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty];
|
|
19072
|
+
}
|
|
19073
|
+
return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty];
|
|
19074
|
+
}
|
|
19075
|
+
}
|
|
19076
|
+
}
|
|
19077
|
+
// @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta
|
|
19078
|
+
if (columnMeta.dataType === 'number') {
|
|
19079
|
+
return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsGreaterThan, Table3FilterComparator.IsLessThan, Table3FilterComparator.IsBetween, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty];
|
|
19080
|
+
}
|
|
19081
|
+
if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {
|
|
19082
|
+
return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsBetween, Table3FilterComparator.IsLessThan, Table3FilterComparator.IsGreaterThan, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty, Table3FilterComparator.IsLessThanOrEqualTo, Table3FilterComparator.IsGreaterThanOrEqualTo];
|
|
19083
|
+
}
|
|
19084
|
+
if (columnMeta.control === 'switch') {
|
|
19085
|
+
return [Table3FilterComparator.IsEqualTo];
|
|
19086
|
+
}
|
|
19087
|
+
return [Table3FilterComparator.Contains, Table3FilterComparator.DoesNotContain, Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty];
|
|
19088
|
+
}
|
|
19089
|
+
function getComparatorText$1(comparator, texts, column) {
|
|
19090
|
+
var _column$columnDef, _column$columnDef$met2;
|
|
19091
|
+
const isDate = (column === null || column === void 0 ? void 0 : (_column$columnDef = column.columnDef) === null || _column$columnDef === void 0 ? void 0 : (_column$columnDef$met2 = _column$columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control) === 'datepicker';
|
|
18895
19092
|
switch (comparator) {
|
|
18896
19093
|
case Table3FilterComparator.Contains:
|
|
18897
19094
|
return texts.table3.filters.comparators.contains;
|
|
@@ -18902,23 +19099,61 @@ const getComparatorText$1 = (comparator, texts) => {
|
|
|
18902
19099
|
case Table3FilterComparator.IsNotEqualTo:
|
|
18903
19100
|
return texts.table3.filters.comparators.isNotEqualTo;
|
|
18904
19101
|
case Table3FilterComparator.IsGreaterThan:
|
|
18905
|
-
return texts.table3.filters.comparators.isGreaterThan;
|
|
19102
|
+
return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;
|
|
18906
19103
|
case Table3FilterComparator.IsLessThan:
|
|
18907
|
-
return texts.table3.filters.comparators.isLessThan;
|
|
19104
|
+
return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;
|
|
18908
19105
|
case Table3FilterComparator.IsBetween:
|
|
18909
19106
|
return texts.table3.filters.comparators.isBetween;
|
|
18910
|
-
case Table3FilterComparator.IsOneOf:
|
|
18911
|
-
return texts.table3.filters.comparators.isOneOf;
|
|
18912
|
-
case Table3FilterComparator.IsNoneOf:
|
|
18913
|
-
return texts.table3.filters.comparators.isNoneOf;
|
|
18914
|
-
case Table3FilterComparator.IsAllOf:
|
|
18915
|
-
return texts.table3.filters.comparators.isAllOf;
|
|
18916
19107
|
case Table3FilterComparator.IsEmpty:
|
|
18917
19108
|
return texts.table3.filters.comparators.isEmpty;
|
|
18918
19109
|
case Table3FilterComparator.IsNotEmpty:
|
|
18919
19110
|
return texts.table3.filters.comparators.isNotEmpty;
|
|
19111
|
+
case Table3FilterComparator.IsLessThanOrEqualTo:
|
|
19112
|
+
return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;
|
|
19113
|
+
case Table3FilterComparator.IsGreaterThanOrEqualTo:
|
|
19114
|
+
return isDate ? texts.table3.filters.comparators.isOnOrAfter : texts.table3.filters.comparators.isGreaterThanOrEqualTo;
|
|
19115
|
+
case Table3FilterComparator.HasAnyOf:
|
|
19116
|
+
return texts.table3.filters.comparators.hasAnyOf;
|
|
19117
|
+
case Table3FilterComparator.HasAllOf:
|
|
19118
|
+
return texts.table3.filters.comparators.hasAllOf;
|
|
19119
|
+
case Table3FilterComparator.HasNoneOf:
|
|
19120
|
+
return texts.table3.filters.comparators.hasNoneOf;
|
|
19121
|
+
default:
|
|
19122
|
+
return '';
|
|
18920
19123
|
}
|
|
18921
|
-
}
|
|
19124
|
+
}
|
|
19125
|
+
|
|
19126
|
+
function Placeholder(props) {
|
|
19127
|
+
const {
|
|
19128
|
+
allColumns,
|
|
19129
|
+
filters,
|
|
19130
|
+
onCreate: handleCreate,
|
|
19131
|
+
onRemove: handleRemove,
|
|
19132
|
+
position
|
|
19133
|
+
} = props;
|
|
19134
|
+
const {
|
|
19135
|
+
texts
|
|
19136
|
+
} = useLocalization();
|
|
19137
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
19138
|
+
className: "flex gap-2"
|
|
19139
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
19140
|
+
className: "flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
|
19141
|
+
}, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
|
19142
|
+
allColumns: allColumns,
|
|
19143
|
+
filters: filters,
|
|
19144
|
+
onChange: handleCreate,
|
|
19145
|
+
value: null
|
|
19146
|
+
}), /*#__PURE__*/React__default.createElement(FilterComparator, null), /*#__PURE__*/React__default.createElement(Input, {
|
|
19147
|
+
"aria-label": texts.table3.filters.emptyFilter.value,
|
|
19148
|
+
className: "flex-grow",
|
|
19149
|
+
disabled: true,
|
|
19150
|
+
value: texts.table3.filters.emptyFilter.value
|
|
19151
|
+
}), handleRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
19152
|
+
appearance: "discrete",
|
|
19153
|
+
icon: "close",
|
|
19154
|
+
onClick: handleRemove
|
|
19155
|
+
}) : null);
|
|
19156
|
+
}
|
|
18922
19157
|
|
|
18923
19158
|
function FilterValue(props) {
|
|
18924
19159
|
const {
|
|
@@ -18927,6 +19162,9 @@ function FilterValue(props) {
|
|
|
18927
19162
|
onChange: handleChange,
|
|
18928
19163
|
value
|
|
18929
19164
|
} = props;
|
|
19165
|
+
const {
|
|
19166
|
+
texts
|
|
19167
|
+
} = useLocalization();
|
|
18930
19168
|
if (comparator === Table3FilterComparator.IsEmpty || comparator === Table3FilterComparator.IsNotEmpty) {
|
|
18931
19169
|
return null;
|
|
18932
19170
|
}
|
|
@@ -18934,6 +19172,14 @@ function FilterValue(props) {
|
|
|
18934
19172
|
var _column$columnDef$met;
|
|
18935
19173
|
const fromValue = Array.isArray(value) ? value[0] : undefined;
|
|
18936
19174
|
const toValue = Array.isArray(value) ? value[1] : undefined;
|
|
19175
|
+
if (column === undefined) {
|
|
19176
|
+
return /*#__PURE__*/React__default.createElement(Input, {
|
|
19177
|
+
"aria-label": texts.table3.filters.emptyFilter.value,
|
|
19178
|
+
className: "flex-grow",
|
|
19179
|
+
disabled: true,
|
|
19180
|
+
value: texts.table3.filters.emptyFilter.value
|
|
19181
|
+
});
|
|
19182
|
+
}
|
|
18937
19183
|
if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType) === 'datetime') {
|
|
18938
19184
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
18939
19185
|
className: "flex flex-grow items-center gap-2"
|
|
@@ -18962,6 +19208,7 @@ function FilterValue(props) {
|
|
|
18962
19208
|
}));
|
|
18963
19209
|
}
|
|
18964
19210
|
return /*#__PURE__*/React__default.createElement(Control$1, {
|
|
19211
|
+
comparator: comparator,
|
|
18965
19212
|
column: column,
|
|
18966
19213
|
onChange: handleChange,
|
|
18967
19214
|
value: value
|
|
@@ -18971,12 +19218,18 @@ function Control$1(props) {
|
|
|
18971
19218
|
var _column$columnDef$met2, _column$columnDef$met3;
|
|
18972
19219
|
const {
|
|
18973
19220
|
column,
|
|
19221
|
+
comparator,
|
|
18974
19222
|
onChange,
|
|
18975
19223
|
value,
|
|
18976
19224
|
...attributes
|
|
18977
19225
|
} = props;
|
|
18978
19226
|
const controlRenderer = (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
|
|
18979
19227
|
const dataType = (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
|
|
19228
|
+
React.useEffect(() => {
|
|
19229
|
+
if (controlRenderer === 'switch') {
|
|
19230
|
+
onChange(false);
|
|
19231
|
+
}
|
|
19232
|
+
}, []);
|
|
18980
19233
|
if (typeof controlRenderer === 'function') {
|
|
18981
19234
|
return controlRenderer({
|
|
18982
19235
|
...attributes,
|
|
@@ -18988,11 +19241,19 @@ function Control$1(props) {
|
|
|
18988
19241
|
onChange: event => onChange(event.detail),
|
|
18989
19242
|
value: value
|
|
18990
19243
|
}));
|
|
18991
|
-
} else if (controlRenderer === 'switch'
|
|
19244
|
+
} else if (controlRenderer === 'switch') {
|
|
18992
19245
|
return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, attributes, {
|
|
19246
|
+
className: "m-1.5",
|
|
18993
19247
|
checked: Boolean(value),
|
|
18994
19248
|
onChange: onChange
|
|
18995
19249
|
}));
|
|
19250
|
+
} else if ((controlRenderer === 'input' || controlRenderer === undefined) && dataType === 'number') {
|
|
19251
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
|
|
19252
|
+
className: cn(getInputAppearanceClassnames(), 'flex-grow'),
|
|
19253
|
+
type: "number",
|
|
19254
|
+
onChange: event => onChange(event.target.valueAsNumber),
|
|
19255
|
+
value: String(value !== null && value !== void 0 ? value : '')
|
|
19256
|
+
}));
|
|
18996
19257
|
}
|
|
18997
19258
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
|
|
18998
19259
|
className: "flex-grow",
|
|
@@ -19060,8 +19321,8 @@ function Filter$1(props) {
|
|
|
19060
19321
|
onChange: handleChangeColumn,
|
|
19061
19322
|
value: id
|
|
19062
19323
|
}), /*#__PURE__*/React__default.createElement(FilterComparator, {
|
|
19324
|
+
column: column,
|
|
19063
19325
|
onChange: handleChangeComparator,
|
|
19064
|
-
validComparators: guessComparatorsBasedOnControl$1(),
|
|
19065
19326
|
value: comparator
|
|
19066
19327
|
}), /*#__PURE__*/React__default.createElement(FilterValue, {
|
|
19067
19328
|
column: column,
|
|
@@ -19075,63 +19336,6 @@ function Filter$1(props) {
|
|
|
19075
19336
|
onClick: handleRemove
|
|
19076
19337
|
}));
|
|
19077
19338
|
}
|
|
19078
|
-
function guessComparatorsBasedOnControl$1(instance, control) {
|
|
19079
|
-
if ( /*#__PURE__*/React__default.isValidElement(instance)) {
|
|
19080
|
-
const {
|
|
19081
|
-
props,
|
|
19082
|
-
type
|
|
19083
|
-
} = instance;
|
|
19084
|
-
if (type.displayName === 'Select2') {
|
|
19085
|
-
if (props.multiple) {
|
|
19086
|
-
return [Table3FilterComparator.IsOneOf, Table3FilterComparator.IsNoneOf, Table3FilterComparator.IsAllOf];
|
|
19087
|
-
}
|
|
19088
|
-
return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo];
|
|
19089
|
-
}
|
|
19090
|
-
}
|
|
19091
|
-
switch (control) {
|
|
19092
|
-
case 'datepicker':
|
|
19093
|
-
return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsGreaterThan, Table3FilterComparator.IsLessThan, Table3FilterComparator.IsBetween];
|
|
19094
|
-
case 'switch':
|
|
19095
|
-
return [Table3FilterComparator.IsEqualTo];
|
|
19096
|
-
default:
|
|
19097
|
-
return [Table3FilterComparator.Contains, Table3FilterComparator.DoesNotContain, Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty, Table3FilterComparator.IsGreaterThan, Table3FilterComparator.IsLessThan, Table3FilterComparator.IsBetween];
|
|
19098
|
-
}
|
|
19099
|
-
}
|
|
19100
|
-
|
|
19101
|
-
function Placeholder(props) {
|
|
19102
|
-
const {
|
|
19103
|
-
allColumns,
|
|
19104
|
-
filters,
|
|
19105
|
-
onCreate: handleCreate,
|
|
19106
|
-
onRemove: handleRemove,
|
|
19107
|
-
position
|
|
19108
|
-
} = props;
|
|
19109
|
-
const {
|
|
19110
|
-
texts
|
|
19111
|
-
} = useLocalization();
|
|
19112
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
19113
|
-
className: "flex gap-2"
|
|
19114
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
19115
|
-
className: "flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
|
19116
|
-
}, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
|
19117
|
-
allColumns: allColumns,
|
|
19118
|
-
filters: filters,
|
|
19119
|
-
onChange: handleCreate,
|
|
19120
|
-
value: null
|
|
19121
|
-
}), /*#__PURE__*/React__default.createElement(FilterComparator, {
|
|
19122
|
-
disabled: true,
|
|
19123
|
-
validComparators: guessComparatorsBasedOnControl$1()
|
|
19124
|
-
}), /*#__PURE__*/React__default.createElement(Input, {
|
|
19125
|
-
"aria-label": texts.table3.filters.emptyFilter.value,
|
|
19126
|
-
className: "flex-grow",
|
|
19127
|
-
disabled: true,
|
|
19128
|
-
value: texts.table3.filters.emptyFilter.value
|
|
19129
|
-
}), handleRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
19130
|
-
appearance: "discrete",
|
|
19131
|
-
icon: "close",
|
|
19132
|
-
onClick: handleRemove
|
|
19133
|
-
}) : null);
|
|
19134
|
-
}
|
|
19135
19339
|
|
|
19136
19340
|
function sortByHeader(a, b) {
|
|
19137
19341
|
var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
|
|
@@ -19195,7 +19399,9 @@ function Filters(props) {
|
|
|
19195
19399
|
//
|
|
19196
19400
|
const handleApply = () => {
|
|
19197
19401
|
table.setColumnFilters(filters.filter(f => {
|
|
19198
|
-
|
|
19402
|
+
var _allColumns$find$colu;
|
|
19403
|
+
const controlRenderer = (_allColumns$find$colu = allColumns.find(c => c.id === f.id).columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
|
|
19404
|
+
if (f.value.comparator === Table3FilterComparator.IsEmpty || f.value.comparator === Table3FilterComparator.IsNotEmpty || controlRenderer === 'switch') {
|
|
19199
19405
|
return true;
|
|
19200
19406
|
}
|
|
19201
19407
|
return !!f.value.value;
|
|
@@ -19400,6 +19606,11 @@ const PRINT_STYLES = `
|
|
|
19400
19606
|
width: auto !important;
|
|
19401
19607
|
}
|
|
19402
19608
|
|
|
19609
|
+
#root {
|
|
19610
|
+
/* chrome sometimes crops the bottom content of page and this padding will make sure that we see the whole content*/
|
|
19611
|
+
padding-bottom: 20px;
|
|
19612
|
+
}
|
|
19613
|
+
|
|
19403
19614
|
[role="table"] {
|
|
19404
19615
|
border-width: 0 !important;
|
|
19405
19616
|
overflow-y: hidden !important;
|
|
@@ -19480,30 +19691,9 @@ function PrintIFrame({
|
|
|
19480
19691
|
}) {
|
|
19481
19692
|
const [contentRef, setContentRef] = React__default.useState(null);
|
|
19482
19693
|
const [mountNode, setMountNode] = React__default.useState(null);
|
|
19694
|
+
const isFirefoxBrowser = React__default.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);
|
|
19483
19695
|
const iframeWindow = contentRef === null || contentRef === void 0 ? void 0 : contentRef.contentWindow;
|
|
19484
19696
|
const stylesReady = useParentStylesheets(iframeWindow);
|
|
19485
|
-
// Adds print events to the iframe window.
|
|
19486
|
-
React__default.useEffect(() => {
|
|
19487
|
-
if (iframeWindow === null || iframeWindow === undefined) {
|
|
19488
|
-
return;
|
|
19489
|
-
}
|
|
19490
|
-
// Add print events to the window
|
|
19491
|
-
if (onAfterPrint) {
|
|
19492
|
-
iframeWindow.addEventListener('afterprint', onAfterPrint);
|
|
19493
|
-
}
|
|
19494
|
-
if (onBeforePrint) {
|
|
19495
|
-
iframeWindow.addEventListener('beforeprint', onBeforePrint);
|
|
19496
|
-
}
|
|
19497
|
-
return () => {
|
|
19498
|
-
// Remove print events from the window
|
|
19499
|
-
if (onAfterPrint) {
|
|
19500
|
-
iframeWindow.removeEventListener('afterprint', onAfterPrint);
|
|
19501
|
-
}
|
|
19502
|
-
if (onBeforePrint) {
|
|
19503
|
-
iframeWindow.removeEventListener('beforeprint', onBeforePrint);
|
|
19504
|
-
}
|
|
19505
|
-
};
|
|
19506
|
-
}, [iframeWindow]);
|
|
19507
19697
|
// Calls print method when table has loaded in the iframe.
|
|
19508
19698
|
React__default.useEffect(() => {
|
|
19509
19699
|
let intervalId;
|
|
@@ -19514,7 +19704,8 @@ function PrintIFrame({
|
|
|
19514
19704
|
intervalId = setInterval(function () {
|
|
19515
19705
|
try {
|
|
19516
19706
|
const tableWrapper = mountNode;
|
|
19517
|
-
const
|
|
19707
|
+
const table = tableWrapper.querySelector('[role="table"]');
|
|
19708
|
+
const hasTableRendered = !!table;
|
|
19518
19709
|
if (hasTableRendered && intervalId) {
|
|
19519
19710
|
var _contentRef$contentWi;
|
|
19520
19711
|
clearInterval(intervalId);
|
|
@@ -19523,6 +19714,12 @@ function PrintIFrame({
|
|
|
19523
19714
|
// Bug - Even though onBeforePrint is called before printing, the execution doesn't finish before
|
|
19524
19715
|
// the print dialog shows up, which results into having a visible loading toast.
|
|
19525
19716
|
onBeforePrint === null || onBeforePrint === void 0 ? void 0 : onBeforePrint();
|
|
19717
|
+
// By adding height to the tableWrapper, we make sure the content below absolutely positioned table
|
|
19718
|
+
// doesn't hide
|
|
19719
|
+
if (isFirefoxBrowser) {
|
|
19720
|
+
const tableHeight = `${table.offsetHeight}px`;
|
|
19721
|
+
tableWrapper.style.height = tableHeight;
|
|
19722
|
+
}
|
|
19526
19723
|
contentRef === null || contentRef === void 0 ? void 0 : (_contentRef$contentWi = contentRef.contentWindow) === null || _contentRef$contentWi === void 0 ? void 0 : _contentRef$contentWi.print();
|
|
19527
19724
|
// Calling the onAfterPrint method here as a fallback to do the cleanup, as certain browsers,
|
|
19528
19725
|
// like Safari, do not trigger the beforeprint or afterprint events when a confirmation dialog
|
|
@@ -19561,6 +19758,11 @@ function PrintIFrame({
|
|
|
19561
19758
|
tableWrapper.setAttribute('data-role', 'table-wrapper');
|
|
19562
19759
|
// Adding h-fit class makes sure that table is rendered with the whole content.
|
|
19563
19760
|
tableWrapper.classList.add('h-fit');
|
|
19761
|
+
tableWrapper.classList.add('[&>[role="table"]]:!h-fit');
|
|
19762
|
+
if (isFirefoxBrowser) {
|
|
19763
|
+
// Fix for firefox bug which adds page-long whitespace between page's top content and table
|
|
19764
|
+
tableWrapper.classList.add('[&>[role="table"]]:!absolute');
|
|
19765
|
+
}
|
|
19564
19766
|
// Safari print preview assigns no width to the table when w-screen class is used.
|
|
19565
19767
|
// By assigning table a big static width and hiding the horizontal scrollbar, the table on chrome
|
|
19566
19768
|
// and safari will always take full page width.
|
|
@@ -19607,10 +19809,12 @@ function PrintIFrame({
|
|
|
19607
19809
|
};
|
|
19608
19810
|
// -top-60 -left-60 styles make sure that iframe is added outside of the viewport
|
|
19609
19811
|
return /*#__PURE__*/React__default.createElement("iframe", {
|
|
19610
|
-
ref: setContentRef,
|
|
19611
19812
|
className: "fixed -left-60 -top-60 !h-0 !w-0",
|
|
19612
19813
|
frameBorder: "0",
|
|
19613
|
-
|
|
19814
|
+
ref: setContentRef,
|
|
19815
|
+
scrolling: "no",
|
|
19816
|
+
// Temporary fix to support printing in firefox: Find another solution while upgrading React
|
|
19817
|
+
src: "javascript:void(0);"
|
|
19614
19818
|
}, mountNode && stylesReady ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(Table3, Object.assign({}, printTableProps)), mountNode) : null);
|
|
19615
19819
|
}
|
|
19616
19820
|
|
|
@@ -19840,7 +20044,10 @@ function Toolbar(props) {
|
|
|
19840
20044
|
}) : null, tableMeta.printing.isEnabled ? /*#__PURE__*/React__default.createElement(PrintButton, {
|
|
19841
20045
|
table: table,
|
|
19842
20046
|
tableProps: tableProps
|
|
19843
|
-
}) : null, right, isMoreVisible(props) ? /*#__PURE__*/React__default.createElement(
|
|
20047
|
+
}) : null, right, isMoreVisible(props) ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
20048
|
+
title: texts.table3.otherOptions.tooltip
|
|
20049
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
20050
|
+
"aria-label": texts.table3.otherOptions.tooltip,
|
|
19844
20051
|
icon: "more",
|
|
19845
20052
|
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
|
19846
20053
|
align: "end"
|
|
@@ -19855,7 +20062,7 @@ function Toolbar(props) {
|
|
|
19855
20062
|
table: table
|
|
19856
20063
|
})
|
|
19857
20064
|
}, texts.table3.fontSize.tooltip) : null))
|
|
19858
|
-
}) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
|
|
20065
|
+
})) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
|
|
19859
20066
|
scrollToIndex: scrollToIndex,
|
|
19860
20067
|
table: table
|
|
19861
20068
|
}) : null));
|
|
@@ -20123,16 +20330,19 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
20123
20330
|
} = useTableRenderStrategy$1(props, table, internalRef);
|
|
20124
20331
|
const tableMeta = table.options.meta;
|
|
20125
20332
|
const state = table.getState();
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
|
|
20130
|
-
|
|
20131
|
-
|
|
20132
|
-
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
|
|
20333
|
+
React__default.useEffect(() => {
|
|
20334
|
+
const handleKeyDown = event => {
|
|
20335
|
+
tableMeta.hoverState.handleKeyDown(event);
|
|
20336
|
+
tableMeta.currentRow.handleKeyDown(event, table.getRowModel().rows.length, scrollToIndex);
|
|
20337
|
+
tableMeta.rowClick.handleKeyDown(event, table);
|
|
20338
|
+
tableMeta.rowSelection.handleKeyDown(event, table);
|
|
20339
|
+
tableMeta.editing.handleKeyDown(event);
|
|
20340
|
+
};
|
|
20341
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
20342
|
+
return () => {
|
|
20343
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
20344
|
+
};
|
|
20345
|
+
}, []);
|
|
20136
20346
|
const handleBlur = event => {
|
|
20137
20347
|
tableMeta.editing.handleBlur(event);
|
|
20138
20348
|
};
|
|
@@ -20144,7 +20354,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
20144
20354
|
return Promise.reject(e);
|
|
20145
20355
|
}
|
|
20146
20356
|
};
|
|
20147
|
-
const className = cn('border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px]', '
|
|
20357
|
+
const className = cn('border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px]', '[&[data-resizing="true"]]:select-none', {
|
|
20148
20358
|
'text-xs': tableMeta.fontSize.size === 'small',
|
|
20149
20359
|
'text-sm': tableMeta.fontSize.size === 'medium',
|
|
20150
20360
|
'text-base': tableMeta.fontSize.size === 'large'
|
|
@@ -20183,12 +20393,10 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
20183
20393
|
"data-resizing": !!state.columnSizingInfo.isResizingColumn,
|
|
20184
20394
|
"data-taco": "table2",
|
|
20185
20395
|
onBlur: handleBlur,
|
|
20186
|
-
onKeyDown: handleKeyDown,
|
|
20187
20396
|
onScroll: handleScroll,
|
|
20188
20397
|
ref: internalRef,
|
|
20189
20398
|
role: "table",
|
|
20190
|
-
style: style
|
|
20191
|
-
tabIndex: 0
|
|
20399
|
+
style: style
|
|
20192
20400
|
}, isServerLoadingAndNotReady ? null : /*#__PURE__*/React__default.createElement("div", {
|
|
20193
20401
|
className: "group/header contents",
|
|
20194
20402
|
"data-taco": "table2-header",
|
|
@@ -20226,9 +20434,10 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
20226
20434
|
}, EmptyState ? /*#__PURE__*/React__default.createElement(EmptyState, null) : null)));
|
|
20227
20435
|
});
|
|
20228
20436
|
const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
20437
|
+
const stringifiedChildren = String(props.children);
|
|
20229
20438
|
// we force a remount (using key) when the child columns change because there are too many places to add children as an effect
|
|
20230
20439
|
// this is cheaper from a complexity perspective, and probably performance wise as well
|
|
20231
|
-
const key = React__default.useMemo(() => String('tableKey_' +
|
|
20440
|
+
const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
|
|
20232
20441
|
return /*#__PURE__*/React__default.createElement(Table$1, Object.assign({}, props, {
|
|
20233
20442
|
key: key,
|
|
20234
20443
|
ref: ref
|
|
@@ -21273,6 +21482,7 @@ exports.Table = Table;
|
|
|
21273
21482
|
exports.Table2 = Table2;
|
|
21274
21483
|
exports.Table3 = Table3;
|
|
21275
21484
|
exports.Tabs = Tabs;
|
|
21485
|
+
exports.TacoContext = TacoContext;
|
|
21276
21486
|
exports.Tag = Tag$1;
|
|
21277
21487
|
exports.Textarea = Textarea;
|
|
21278
21488
|
exports.Title = Title$3;
|