@economic/taco 2.23.0 → 2.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +2 -0
- package/dist/components/Provider/Localization.d.ts +4 -0
- package/dist/components/Report/components/Body/Body.d.ts +0 -1
- package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
- package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
- package/dist/components/Report/useReport.d.ts +0 -1
- package/dist/components/Select2/Select2.d.ts +4 -0
- package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
- package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
- package/dist/esm/index.css +55 -46
- package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +3 -8
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +1 -2
- package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +2 -2
- package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
- package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +28 -43
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
- package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +7 -4
- package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
- package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +43 -4
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
- 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 +27 -44
- 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 +14 -7
- 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/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -1
- 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/PrintButton/PrintButton.js +2 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +24 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +1 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +7 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +33 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +0 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +12 -3
- package/dist/esm/packages/taco/src/utils/dom.js.map +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/useLocalStorage.d.ts +2 -1
- package/dist/index.css +55 -46
- package/dist/primitives/Table/types.d.ts +0 -2
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +10 -3
- package/dist/primitives/Table/useTable/useTable.d.ts +1 -1
- package/dist/primitives/Table/useTable/util/settings.d.ts +0 -1
- package/dist/taco.cjs.development.js +511 -387
- 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/dist/utils/dom.d.ts +3 -1
- package/package.json +2 -2
- package/types.json +6781 -6993
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
- package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
@@ -4061,8 +4061,17 @@ function isElementInsideOrTriggeredFromContainer(element, container) {
|
|
4061
4061
|
}
|
4062
4062
|
return !!(container !== null && container !== void 0 && container.contains(element));
|
4063
4063
|
}
|
4064
|
-
function
|
4065
|
-
|
4064
|
+
function isElementInsideOverlay(element) {
|
4065
|
+
return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
|
4066
|
+
}
|
4067
|
+
function isSiblingElementInsideSameParentOverlay(element, sibling) {
|
4068
|
+
var _element$closest2;
|
4069
|
+
return !!(element !== null && element !== void 0 && (_element$closest2 = element.closest('[role=dialog],[role=menu]')) !== null && _element$closest2 !== void 0 && _element$closest2.contains(sibling));
|
4070
|
+
}
|
4071
|
+
function isElementInteractive(element) {
|
4072
|
+
if (!element) {
|
4073
|
+
return false;
|
4074
|
+
}
|
4066
4075
|
return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
|
4067
4076
|
}
|
4068
4077
|
|
@@ -4085,7 +4094,7 @@ function shouldTriggerShortcut(event, key) {
|
|
4085
4094
|
}
|
4086
4095
|
function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
|
4087
4096
|
return function (event) {
|
4088
|
-
if (event.target !== event.currentTarget &&
|
4097
|
+
if (event.target !== event.currentTarget && isElementInteractive(event.target) && !isPressingMetaKey(event)) {
|
4089
4098
|
return;
|
4090
4099
|
}
|
4091
4100
|
const condition = shouldTriggerShortcut(event, key);
|
@@ -4142,6 +4151,7 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
4142
4151
|
});
|
4143
4152
|
const Tag = props.href ? 'a' : 'button';
|
4144
4153
|
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
|
4154
|
+
href: disabled ? undefined : props.href,
|
4145
4155
|
"aria-disabled": disabled ? 'true' : undefined,
|
4146
4156
|
disabled: disabled,
|
4147
4157
|
target: Tag === 'a' ? target : undefined,
|
@@ -4184,29 +4194,29 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
4184
4194
|
});
|
4185
4195
|
|
4186
4196
|
const getButtonClasses = () => {
|
4187
|
-
return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus disabled:cursor-not-allowed';
|
4197
|
+
return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus aria-disabled:cursor-not-allowed';
|
4188
4198
|
};
|
4189
4199
|
const getAppearanceClasses = (value, icon = false) => {
|
4190
4200
|
switch (value) {
|
4191
4201
|
case 'primary':
|
4192
|
-
return `wcag-blue-500
|
4202
|
+
return `wcag-blue-500 visited:wcag-blue-500 hover:wcag-blue-700 hover:active:wcag-blue-500 aria-disabled:bg-blue-500/50 aria-disabled:active:bg-blue-500/50`;
|
4193
4203
|
case 'danger':
|
4194
|
-
return `wcag-red-500
|
4204
|
+
return `wcag-red-500 visited:wcag-red-500 hover:wcag-red-700 hover:active:wcag-red-500 aria-disabled:bg-red-500/50 aria-disabled:active:bg-red-500/50`;
|
4195
4205
|
case 'ghost':
|
4196
|
-
return `bg-white border border-blue-500 text-blue-500
|
4206
|
+
return `bg-white border border-blue-500 text-blue-500 visited:text-blue-500 hover:bg-blue-100 hover:text-blue-700 aria-disabled:border-blue-500/50 aria-disabled:text-blue-500/50 aria-disabled:bg-white`;
|
4197
4207
|
case 'discrete':
|
4198
4208
|
{
|
4199
4209
|
if (icon) {
|
4200
|
-
return `bg-transparent text-black
|
4210
|
+
return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30`;
|
4201
4211
|
}
|
4202
|
-
return `bg-transparent text-blue-500
|
4212
|
+
return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 aria-disabled:text-blue-500/50`;
|
4203
4213
|
}
|
4204
4214
|
case 'transparent':
|
4205
4215
|
{
|
4206
|
-
return `bg-transparent text-black
|
4216
|
+
return `bg-transparent text-black visited:text-black hover:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30 aria-disabled:bg-transparent`;
|
4207
4217
|
}
|
4208
4218
|
default:
|
4209
|
-
return `wcag-grey-200
|
4219
|
+
return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
|
4210
4220
|
}
|
4211
4221
|
};
|
4212
4222
|
const createButtonWithTooltip = (props, className, ref) => {
|
@@ -4592,7 +4602,11 @@ const defaultLocalisationTexts = {
|
|
4592
4602
|
delete: 'Delete',
|
4593
4603
|
save: 'Save',
|
4594
4604
|
search: 'Search...',
|
4595
|
-
searchOrCreate: 'Search or create...'
|
4605
|
+
searchOrCreate: 'Search or create...',
|
4606
|
+
selectAll: 'Select all',
|
4607
|
+
selectAllResults: 'Select all results',
|
4608
|
+
deselectAll: 'Deselect all',
|
4609
|
+
deselectAllResults: 'Deselect all results'
|
4596
4610
|
},
|
4597
4611
|
toasts: {
|
4598
4612
|
dismiss: 'Dismiss'
|
@@ -4872,6 +4886,7 @@ const Content$2 = /*#__PURE__*/React.forwardRef(function CardContent(externalPro
|
|
4872
4886
|
}, props.className);
|
4873
4887
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
4874
4888
|
className: className,
|
4889
|
+
"data-taco": "card-content",
|
4875
4890
|
ref: ref
|
4876
4891
|
}));
|
4877
4892
|
});
|
@@ -4881,7 +4896,7 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4881
4896
|
menu,
|
4882
4897
|
children
|
4883
4898
|
} = props;
|
4884
|
-
const className = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500
|
4899
|
+
const className = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500', props.className);
|
4885
4900
|
return /*#__PURE__*/React.createElement("div", {
|
4886
4901
|
className: className,
|
4887
4902
|
"data-taco": "card",
|
@@ -4906,12 +4921,52 @@ const useId = nativeId => {
|
|
4906
4921
|
return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
|
4907
4922
|
};
|
4908
4923
|
|
4924
|
+
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
4925
|
+
const {
|
4926
|
+
delay = 350,
|
4927
|
+
label,
|
4928
|
+
...otherProps
|
4929
|
+
} = props;
|
4930
|
+
const [visible, setVisibility] = React__default.useState(!delay);
|
4931
|
+
React__default.useEffect(() => {
|
4932
|
+
let timeout;
|
4933
|
+
if (delay) {
|
4934
|
+
timeout = window.setTimeout(() => setVisibility(true), delay);
|
4935
|
+
}
|
4936
|
+
return () => {
|
4937
|
+
if (timeout) {
|
4938
|
+
clearTimeout(timeout);
|
4939
|
+
}
|
4940
|
+
};
|
4941
|
+
}, [delay]);
|
4942
|
+
if (!visible) {
|
4943
|
+
return null;
|
4944
|
+
}
|
4945
|
+
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
4946
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
4947
|
+
className: className,
|
4948
|
+
"data-taco": "spinner",
|
4949
|
+
ref: ref
|
4950
|
+
}), /*#__PURE__*/React__default.createElement("svg", {
|
4951
|
+
className: "h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]",
|
4952
|
+
viewBox: "0 0 100 100",
|
4953
|
+
xmlns: "http://www.w3.org/2000/svg"
|
4954
|
+
}, /*#__PURE__*/React__default.createElement("circle", {
|
4955
|
+
cx: "50",
|
4956
|
+
cy: "50",
|
4957
|
+
r: "45"
|
4958
|
+
})), label && /*#__PURE__*/React__default.createElement("span", {
|
4959
|
+
className: "mt-4"
|
4960
|
+
}, label));
|
4961
|
+
});
|
4962
|
+
|
4909
4963
|
const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4910
4964
|
const {
|
4911
4965
|
checked,
|
4912
4966
|
indeterminate,
|
4913
4967
|
invalid,
|
4914
4968
|
label,
|
4969
|
+
loading,
|
4915
4970
|
onChange,
|
4916
4971
|
...otherProps
|
4917
4972
|
} = props;
|
@@ -4942,6 +4997,11 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4942
4997
|
event.currentTarget.click();
|
4943
4998
|
}
|
4944
4999
|
};
|
5000
|
+
const spinnerClassname = cn(
|
5001
|
+
//Spinner is slightly bigger then 'line' and 'tick' icons, so making it 2px smaller from each side
|
5002
|
+
"m-0.5 !h-[calc(100%-theme('spacing.1'))] !w-[calc(100%-theme('spacing.1'))]", {
|
5003
|
+
'text-blue-500': !checked && !indeterminate
|
5004
|
+
});
|
4945
5005
|
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
4946
5006
|
"aria-invalid": invalid ? 'true' : undefined,
|
4947
5007
|
"data-taco": "checkbox",
|
@@ -4950,12 +5010,14 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4950
5010
|
onCheckedChange: handleChange,
|
4951
5011
|
onKeyDown: handleKeyDown,
|
4952
5012
|
ref: ref
|
4953
|
-
}), /*#__PURE__*/React.createElement(
|
5013
|
+
}), loading ? ( /*#__PURE__*/React.createElement(Spinner, {
|
5014
|
+
className: spinnerClassname
|
5015
|
+
})) : ( /*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
|
4954
5016
|
className: "flex h-full w-full"
|
4955
5017
|
}, /*#__PURE__*/React.createElement(Icon, {
|
4956
5018
|
name: indeterminate ? 'line' : 'tick',
|
4957
5019
|
className: "!h-full !w-full"
|
4958
|
-
})));
|
5020
|
+
}))));
|
4959
5021
|
if (label) {
|
4960
5022
|
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
4961
5023
|
'cursor-not-allowed text-grey-300': props.disabled
|
@@ -5254,45 +5316,6 @@ const useListScrollTo = (internalRef, itemRefs) => {
|
|
5254
5316
|
};
|
5255
5317
|
};
|
5256
5318
|
|
5257
|
-
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
5258
|
-
const {
|
5259
|
-
delay = 350,
|
5260
|
-
label,
|
5261
|
-
...otherProps
|
5262
|
-
} = props;
|
5263
|
-
const [visible, setVisibility] = React__default.useState(!delay);
|
5264
|
-
React__default.useEffect(() => {
|
5265
|
-
let timeout;
|
5266
|
-
if (delay) {
|
5267
|
-
timeout = window.setTimeout(() => setVisibility(true), delay);
|
5268
|
-
}
|
5269
|
-
return () => {
|
5270
|
-
if (timeout) {
|
5271
|
-
clearTimeout(timeout);
|
5272
|
-
}
|
5273
|
-
};
|
5274
|
-
}, [delay]);
|
5275
|
-
if (!visible) {
|
5276
|
-
return null;
|
5277
|
-
}
|
5278
|
-
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
5279
|
-
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
5280
|
-
className: className,
|
5281
|
-
"data-taco": "spinner",
|
5282
|
-
ref: ref
|
5283
|
-
}), /*#__PURE__*/React__default.createElement("svg", {
|
5284
|
-
className: "h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]",
|
5285
|
-
viewBox: "0 0 100 100",
|
5286
|
-
xmlns: "http://www.w3.org/2000/svg"
|
5287
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
5288
|
-
cx: "50",
|
5289
|
-
cy: "50",
|
5290
|
-
r: "45"
|
5291
|
-
})), label && /*#__PURE__*/React__default.createElement("span", {
|
5292
|
-
className: "mt-4"
|
5293
|
-
}, label));
|
5294
|
-
});
|
5295
|
-
|
5296
5319
|
const getId = (id, value) => `${id}_${value}`;
|
5297
5320
|
const getNextEnabledItem = (event, data, index) => {
|
5298
5321
|
const nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
@@ -9277,13 +9300,32 @@ function getCellValueAsString(value, dataType) {
|
|
9277
9300
|
}
|
9278
9301
|
return String(value);
|
9279
9302
|
}
|
9303
|
+
function orderColumn(column, {
|
9304
|
+
orderingDisabled,
|
9305
|
+
orderingEnabled
|
9306
|
+
}) {
|
9307
|
+
const groupedColumn = column;
|
9308
|
+
if (Array.isArray(groupedColumn.columns) && groupedColumn.columns.length > 0) {
|
9309
|
+
groupedColumn.columns.forEach(subcolumn => orderColumn(subcolumn, {
|
9310
|
+
orderingDisabled,
|
9311
|
+
orderingEnabled
|
9312
|
+
}));
|
9313
|
+
} else {
|
9314
|
+
var _column$meta;
|
9315
|
+
if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.enableOrdering) {
|
9316
|
+
orderingEnabled.push(column.id);
|
9317
|
+
} else {
|
9318
|
+
orderingDisabled.push(column.id);
|
9319
|
+
}
|
9320
|
+
}
|
9321
|
+
}
|
9280
9322
|
// ordering
|
9281
9323
|
function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight = ['__actions']) {
|
9282
9324
|
// internal columns come with a defined order
|
9283
9325
|
const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
|
9284
9326
|
// columns with ordering disabled should be moved to the front
|
9285
9327
|
const orderingDisabled = [];
|
9286
|
-
|
9328
|
+
let orderingEnabled = [];
|
9287
9329
|
let orderedColumns = columns;
|
9288
9330
|
// if settings is defined, make sure the columns that are actual children are sorted by it
|
9289
9331
|
if (Array.isArray(settingsOrder)) {
|
@@ -9292,16 +9334,23 @@ function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight
|
|
9292
9334
|
(a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
|
9293
9335
|
}
|
9294
9336
|
orderedColumns.forEach(column => {
|
9295
|
-
var _column$meta;
|
9296
9337
|
if (isInternalColumn(column.id)) {
|
9297
9338
|
return;
|
9298
9339
|
}
|
9299
|
-
|
9300
|
-
|
9301
|
-
|
9302
|
-
|
9303
|
-
}
|
9340
|
+
orderColumn(column, {
|
9341
|
+
orderingDisabled,
|
9342
|
+
orderingEnabled
|
9343
|
+
});
|
9304
9344
|
});
|
9345
|
+
if (settingsOrder && settingsOrder.length > 0) {
|
9346
|
+
orderingEnabled = orderingEnabled.reduce((acc, column) => {
|
9347
|
+
const index = settingsOrder.indexOf(column);
|
9348
|
+
if (index > -1) {
|
9349
|
+
acc[index] = column;
|
9350
|
+
}
|
9351
|
+
return acc;
|
9352
|
+
}, []).filter(column => !!column);
|
9353
|
+
}
|
9305
9354
|
const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
|
9306
9355
|
// actions should always be last, enforce that
|
9307
9356
|
internalColumnsPinnedToTheRight.forEach(id => {
|
@@ -9896,17 +9945,79 @@ function useTableFontSize(isEnabled = false, defaultFontSize = 'medium') {
|
|
9896
9945
|
};
|
9897
9946
|
}
|
9898
9947
|
|
9899
|
-
function
|
9948
|
+
function useTacoSettings() {
|
9949
|
+
return React__default.useContext(TacoContext);
|
9950
|
+
}
|
9951
|
+
|
9952
|
+
const useLocalStorage = (key, initialValue) => {
|
9953
|
+
const [state, setState] = React__default.useState(() => {
|
9954
|
+
if (!key) {
|
9955
|
+
return initialValue;
|
9956
|
+
}
|
9957
|
+
try {
|
9958
|
+
const localStorageValue = localStorage.getItem(key);
|
9959
|
+
if (typeof localStorageValue !== 'string') {
|
9960
|
+
localStorage.setItem(key, JSON.stringify(initialValue));
|
9961
|
+
return initialValue;
|
9962
|
+
} else {
|
9963
|
+
return JSON.parse(localStorageValue || 'null');
|
9964
|
+
}
|
9965
|
+
} catch {
|
9966
|
+
// If user is in private mode or has storage restriction
|
9967
|
+
// localStorage can throw. JSON.parse and JSON.stringify
|
9968
|
+
// can throw, too.
|
9969
|
+
return initialValue;
|
9970
|
+
}
|
9971
|
+
});
|
9972
|
+
React__default.useEffect(() => {
|
9973
|
+
if (!key) {
|
9974
|
+
return;
|
9975
|
+
}
|
9976
|
+
try {
|
9977
|
+
const serializedState = JSON.stringify(state);
|
9978
|
+
localStorage.setItem(key, serializedState);
|
9979
|
+
} catch {
|
9980
|
+
// If user is in private mode or has storage restriction
|
9981
|
+
// localStorage can throw. Also JSON.stringify can throw.
|
9982
|
+
}
|
9983
|
+
}, [key, state]);
|
9984
|
+
const clear = () => {
|
9985
|
+
if (key) {
|
9986
|
+
localStorage.removeItem(key);
|
9987
|
+
}
|
9988
|
+
};
|
9989
|
+
return [state, setState, clear];
|
9990
|
+
};
|
9991
|
+
|
9992
|
+
function useTablePrinting(isEnabled = false, tableId) {
|
9900
9993
|
const [isPrinting, setIsPrinting] = React__default.useState(false);
|
9901
|
-
const [
|
9994
|
+
const [settings, setSetting] = useTablePrintingSettings(tableId);
|
9902
9995
|
return {
|
9903
9996
|
isEnabled,
|
9904
9997
|
isPrinting,
|
9905
9998
|
setIsPrinting,
|
9906
|
-
|
9907
|
-
|
9999
|
+
settings,
|
10000
|
+
setSetting
|
9908
10001
|
};
|
9909
10002
|
}
|
10003
|
+
const DEFAULT_PRINT_SETTINGS = {
|
10004
|
+
size: 'A4',
|
10005
|
+
orientation: 'portrait',
|
10006
|
+
allRows: true,
|
10007
|
+
splitGroups: true
|
10008
|
+
};
|
10009
|
+
function useTablePrintingSettings(tableId) {
|
10010
|
+
const tacoSettings = useTacoSettings();
|
10011
|
+
const uniqueId = `taco.${tacoSettings.uniqueUserIdentifier}.table.${tableId}.print.settings`;
|
10012
|
+
const [persistedSettings, setPersistedSettings] = useLocalStorage(uniqueId, DEFAULT_PRINT_SETTINGS);
|
10013
|
+
function setSetting(key, value) {
|
10014
|
+
setPersistedSettings(currentSettings => ({
|
10015
|
+
...currentSettings,
|
10016
|
+
[key]: value
|
10017
|
+
}));
|
10018
|
+
}
|
10019
|
+
return [persistedSettings, setSetting];
|
10020
|
+
}
|
9910
10021
|
|
9911
10022
|
const DEFAULT_ROW_ACTIONS_LENGTH = 4;
|
9912
10023
|
function useTableRowActions(isEnabled = false, rowActions, rowActionsLength = DEFAULT_ROW_ACTIONS_LENGTH) {
|
@@ -10336,50 +10447,6 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
|
|
10336
10447
|
};
|
10337
10448
|
}
|
10338
10449
|
|
10339
|
-
const useLocalStorage = (key, initialValue) => {
|
10340
|
-
const [state, setState] = React__default.useState(() => {
|
10341
|
-
if (!key) {
|
10342
|
-
return initialValue;
|
10343
|
-
}
|
10344
|
-
try {
|
10345
|
-
const localStorageValue = localStorage.getItem(key);
|
10346
|
-
if (typeof localStorageValue !== 'string') {
|
10347
|
-
localStorage.setItem(key, JSON.stringify(initialValue));
|
10348
|
-
return initialValue;
|
10349
|
-
} else {
|
10350
|
-
return JSON.parse(localStorageValue || 'null');
|
10351
|
-
}
|
10352
|
-
} catch {
|
10353
|
-
// If user is in private mode or has storage restriction
|
10354
|
-
// localStorage can throw. JSON.parse and JSON.stringify
|
10355
|
-
// can throw, too.
|
10356
|
-
return initialValue;
|
10357
|
-
}
|
10358
|
-
});
|
10359
|
-
React__default.useEffect(() => {
|
10360
|
-
if (!key) {
|
10361
|
-
return;
|
10362
|
-
}
|
10363
|
-
try {
|
10364
|
-
const serializedState = JSON.stringify(state);
|
10365
|
-
localStorage.setItem(key, serializedState);
|
10366
|
-
} catch {
|
10367
|
-
// If user is in private mode or has storage restriction
|
10368
|
-
// localStorage can throw. Also JSON.stringify can throw.
|
10369
|
-
}
|
10370
|
-
}, [key, state]);
|
10371
|
-
const clear = () => {
|
10372
|
-
if (key) {
|
10373
|
-
localStorage.removeItem(key);
|
10374
|
-
}
|
10375
|
-
};
|
10376
|
-
return [state, setState, clear];
|
10377
|
-
};
|
10378
|
-
|
10379
|
-
function useTacoSettings() {
|
10380
|
-
return React__default.useContext(TacoContext);
|
10381
|
-
}
|
10382
|
-
|
10383
10450
|
const DEFAULT_ENABLED_OPTIONS = {
|
10384
10451
|
columnOrder: true,
|
10385
10452
|
columnPinning: true,
|
@@ -10389,7 +10456,6 @@ const DEFAULT_ENABLED_OPTIONS = {
|
|
10389
10456
|
fontSize: true,
|
10390
10457
|
grouping: true,
|
10391
10458
|
rowHeight: true,
|
10392
|
-
showWarningWhenPrintingLargeDataset: true,
|
10393
10459
|
sorting: true
|
10394
10460
|
};
|
10395
10461
|
function useUniqueTableId(tableId) {
|
@@ -10618,7 +10684,6 @@ function getSettings(table) {
|
|
10618
10684
|
fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
|
10619
10685
|
grouping: table.options.enableGrouping ? state.grouping : undefined,
|
10620
10686
|
rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
|
10621
|
-
showWarningWhenPrintingLargeDataset: meta.printing.isWarningVisibleForLargeDatasets,
|
10622
10687
|
//searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
|
10623
10688
|
sorting: state.sorting
|
10624
10689
|
};
|
@@ -10640,7 +10705,7 @@ function useTableSettingsListener(table, onChangeSettings) {
|
|
10640
10705
|
//state.columnFilters,
|
10641
10706
|
state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility,
|
10642
10707
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
10643
|
-
meta.search.excludeUnmatchedResults, meta.fontSize.size, state.grouping, meta.rowHeight.height,
|
10708
|
+
meta.search.excludeUnmatchedResults, meta.fontSize.size, state.grouping, meta.rowHeight.height,
|
10644
10709
|
//state.globalFilter,
|
10645
10710
|
state.sorting]);
|
10646
10711
|
}
|
@@ -10730,7 +10795,7 @@ function useTableRef(table, ref) {
|
|
10730
10795
|
}
|
10731
10796
|
|
10732
10797
|
function useTable(props, ref, meta, internalColumns) {
|
10733
|
-
var _props$length, _instance$options$met;
|
10798
|
+
var _props$data, _props$length, _instance$options$met;
|
10734
10799
|
// CSS.escape would be best here, but it doesn't seem to work very well
|
10735
10800
|
const safeId = props.id.replace('.', '_');
|
10736
10801
|
// configure table options, merging props with presets
|
@@ -10742,7 +10807,7 @@ function useTable(props, ref, meta, internalColumns) {
|
|
10742
10807
|
const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
|
10743
10808
|
const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
|
10744
10809
|
const footer = useTableFooter(options.enableFooter);
|
10745
|
-
const printing = useTablePrinting(options.enablePrinting,
|
10810
|
+
const printing = useTablePrinting(options.enablePrinting, safeId);
|
10746
10811
|
const rowActive = useTableRowActive(options.enableRowActive, props.defaultRowActiveIndex);
|
10747
10812
|
const rowActions = useTableRowActions(options.enableRowActions, props.rowActions, props.rowActionsLength);
|
10748
10813
|
const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
|
@@ -10761,10 +10826,13 @@ function useTable(props, ref, meta, internalColumns) {
|
|
10761
10826
|
} = mapTableChildrenToColumns(props, settings, options, internalColumns);
|
10762
10827
|
// configure initial table state
|
10763
10828
|
const initialState = useReactTableInitialState(props, columns, settings, defaultState);
|
10829
|
+
// ensure data is always valid
|
10830
|
+
const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
|
10831
|
+
const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
|
10764
10832
|
// create a react-table instance
|
10765
10833
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
10766
10834
|
const instance = reactTable.useReactTable({
|
10767
|
-
data
|
10835
|
+
data,
|
10768
10836
|
columns,
|
10769
10837
|
// configure initial table state
|
10770
10838
|
initialState,
|
@@ -10780,7 +10848,7 @@ function useTable(props, ref, meta, internalColumns) {
|
|
10780
10848
|
columnOrdering,
|
10781
10849
|
fontSize,
|
10782
10850
|
footer,
|
10783
|
-
|
10851
|
+
length,
|
10784
10852
|
printing,
|
10785
10853
|
rowActions,
|
10786
10854
|
rowActive,
|
@@ -10810,7 +10878,6 @@ function useTable(props, ref, meta, internalColumns) {
|
|
10810
10878
|
return {
|
10811
10879
|
id: safeId,
|
10812
10880
|
instance,
|
10813
|
-
length: (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : props.data.length,
|
10814
10881
|
meta: (_instance$options$met = instance.options.meta) !== null && _instance$options$met !== void 0 ? _instance$options$met : {},
|
10815
10882
|
state: instance.getState()
|
10816
10883
|
};
|
@@ -10990,6 +11057,7 @@ function Header$3(context) {
|
|
10990
11057
|
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
10991
11058
|
checked: isAllRowsSelected,
|
10992
11059
|
indeterminate: isSomeRowsSelected,
|
11060
|
+
loading: tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading,
|
10993
11061
|
onChange: handleChange
|
10994
11062
|
}));
|
10995
11063
|
}
|
@@ -11009,6 +11077,9 @@ function Cell$2(context) {
|
|
11009
11077
|
row,
|
11010
11078
|
table
|
11011
11079
|
} = context;
|
11080
|
+
const {
|
11081
|
+
rowIndex
|
11082
|
+
} = React__default.useContext(RowContext);
|
11012
11083
|
const tableMeta = table.options.meta;
|
11013
11084
|
if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
|
11014
11085
|
return null;
|
@@ -11016,18 +11087,48 @@ function Cell$2(context) {
|
|
11016
11087
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
11017
11088
|
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
11018
11089
|
if (table.options.enableMultiRowSelection) {
|
11019
|
-
const handleClick = event
|
11020
|
-
|
11021
|
-
|
11022
|
-
|
11023
|
-
|
11024
|
-
|
11025
|
-
const
|
11026
|
-
|
11027
|
-
|
11028
|
-
|
11090
|
+
const handleClick = function (event) {
|
11091
|
+
try {
|
11092
|
+
function _temp7() {
|
11093
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
11094
|
+
}
|
11095
|
+
event.stopPropagation();
|
11096
|
+
const _temp6 = function () {
|
11097
|
+
if (row.getIsGrouped()) {
|
11098
|
+
row.subRows.forEach(row => row.toggleSelected());
|
11099
|
+
} else {
|
11100
|
+
const _temp5 = function () {
|
11101
|
+
if (event.shiftKey) {
|
11102
|
+
var _tableMeta$rowSelecti;
|
11103
|
+
function _temp4() {
|
11104
|
+
table.setRowSelection(currentRowSelection => ({
|
11105
|
+
...currentRowSelection,
|
11106
|
+
...selectedRows.reduce((state, row) => ({
|
11107
|
+
...state,
|
11108
|
+
[row.id]: true
|
11109
|
+
}), {})
|
11110
|
+
}));
|
11111
|
+
}
|
11112
|
+
const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
11113
|
+
const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
11114
|
+
const _temp3 = function () {
|
11115
|
+
if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
|
11116
|
+
// don't pass the search query because we need all data - not filtered data
|
11117
|
+
return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
|
11118
|
+
}
|
11119
|
+
}();
|
11120
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
11121
|
+
} else {
|
11122
|
+
row.toggleSelected();
|
11123
|
+
}
|
11124
|
+
}();
|
11125
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
11126
|
+
}
|
11127
|
+
}();
|
11128
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6));
|
11129
|
+
} catch (e) {
|
11130
|
+
return Promise.reject(e);
|
11029
11131
|
}
|
11030
|
-
tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;
|
11031
11132
|
};
|
11032
11133
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
11033
11134
|
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
@@ -11070,7 +11171,7 @@ function useTableRowActiveListener(table, tableRef) {
|
|
11070
11171
|
const activeRow = (_tableRef$current$que = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.querySelector('tbody tr[data-row-active="true"]')) !== null && _tableRef$current$que !== void 0 ? _tableRef$current$que : null;
|
11071
11172
|
// if the focused element, or it's parent if it's portalled, aren't in the row, then focus the row
|
11072
11173
|
// this ensures the next tab press starts at the row
|
11073
|
-
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !
|
11174
|
+
if (!isElementInsideOrTriggeredFromContainer(document.activeElement, activeRow) && !isElementInteractive(document.activeElement)) {
|
11074
11175
|
var _activeRow$focus;
|
11075
11176
|
activeRow === null || activeRow === void 0 ? void 0 : (_activeRow$focus = activeRow.focus) === null || _activeRow$focus === void 0 ? void 0 : _activeRow$focus.call(activeRow, {
|
11076
11177
|
preventScroll: true
|
@@ -11652,7 +11753,6 @@ function useAugmentedFocusManager() {
|
|
11652
11753
|
function Body(props) {
|
11653
11754
|
const {
|
11654
11755
|
enableArrowKeyFocusing = false,
|
11655
|
-
length,
|
11656
11756
|
table,
|
11657
11757
|
...attributes
|
11658
11758
|
} = props;
|
@@ -11667,7 +11767,7 @@ function Body(props) {
|
|
11667
11767
|
}
|
11668
11768
|
if (tableMeta.rowActive.rowActiveIndex !== undefined) {
|
11669
11769
|
const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
|
11670
|
-
const isLastRow = tableMeta.rowActive.rowActiveIndex === length - 1;
|
11770
|
+
const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
|
11671
11771
|
if (event.key === 'Tab' || enableArrowKeyFocusing && (event.key === 'ArrowLeft' || event.key === 'ArrowRight')) {
|
11672
11772
|
tableMeta.rowActive.setHoverStatePaused(true);
|
11673
11773
|
const focusedElement = event.shiftKey || event.key === 'ArrowLeft' ? focusManager.focusPrevious() : focusManager.focusNext();
|
@@ -11705,45 +11805,16 @@ function Body(props) {
|
|
11705
11805
|
}));
|
11706
11806
|
}
|
11707
11807
|
|
11708
|
-
function Footer$3(header) {
|
11709
|
-
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
11710
|
-
key: header.id,
|
11711
|
-
footer: header
|
11712
|
-
});
|
11713
|
-
}
|
11714
|
-
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
11715
|
-
var _footer$subHeaders, _footer$subHeaders$fi;
|
11716
|
-
const {
|
11717
|
-
footer
|
11718
|
-
} = props;
|
11719
|
-
const columnMeta = footer.column.columnDef.meta;
|
11720
|
-
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
11721
|
-
const isHeaderGroup = !!((_footer$subHeaders = footer.subHeaders) !== null && _footer$subHeaders !== void 0 && _footer$subHeaders.length);
|
11722
|
-
const isPinned = isHeaderGroup ? (_footer$subHeaders$fi = footer.subHeaders.find(x => x.column.getIsPinned())) === null || _footer$subHeaders$fi === void 0 ? void 0 : _footer$subHeaders$fi.column.getIsPinned() : footer.column.getIsPinned();
|
11723
|
-
const style = {};
|
11724
|
-
if (isPinned) {
|
11725
|
-
// pinned columns should be offset from either the left or right
|
11726
|
-
style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;
|
11727
|
-
}
|
11728
|
-
return /*#__PURE__*/React__default.createElement("td", {
|
11729
|
-
key: footer.id,
|
11730
|
-
"data-cell-align": columnMeta.align,
|
11731
|
-
"data-cell-id": footer.id,
|
11732
|
-
"data-cell-pinned": isPinned ? isPinned : undefined,
|
11733
|
-
style: style
|
11734
|
-
}, footer.isPlaceholder ? null : reactTable.flexRender(footer.column.columnDef.footer, footer.getContext()));
|
11735
|
-
});
|
11736
|
-
|
11737
11808
|
function Summary(props) {
|
11738
11809
|
var _table$getState$colum;
|
11739
11810
|
const {
|
11740
|
-
length,
|
11741
11811
|
table
|
11742
11812
|
} = props;
|
11743
11813
|
const {
|
11744
11814
|
locale,
|
11745
11815
|
texts
|
11746
11816
|
} = useLocalization();
|
11817
|
+
const length = table.options.meta.length;
|
11747
11818
|
const currentLength = table.getRowModel().rows.length;
|
11748
11819
|
let label;
|
11749
11820
|
let count;
|
@@ -11763,11 +11834,51 @@ function Summary(props) {
|
|
11763
11834
|
count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
|
11764
11835
|
}
|
11765
11836
|
return /*#__PURE__*/React__default.createElement("div", {
|
11766
|
-
className: "
|
11837
|
+
className: "sticky left-0 z-20 flex h-full w-fit items-center whitespace-nowrap bg-white pr-1 shadow-[12px_0px_6px_white]",
|
11767
11838
|
"data-taco": "table2-footer-summary"
|
11768
11839
|
}, label, "\u00A0", count);
|
11769
11840
|
}
|
11770
11841
|
|
11842
|
+
function Footer$3(header) {
|
11843
|
+
return /*#__PURE__*/React__default.createElement(MemoedFooter, {
|
11844
|
+
key: header.id,
|
11845
|
+
footer: header
|
11846
|
+
});
|
11847
|
+
}
|
11848
|
+
const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(props) {
|
11849
|
+
var _footer$subHeaders, _footer$subHeaders$fi;
|
11850
|
+
const {
|
11851
|
+
footer
|
11852
|
+
} = props;
|
11853
|
+
const columnMeta = footer.column.columnDef.meta;
|
11854
|
+
// getIsPinned returns true for split header groups, even if the split group has no pinned sub headers
|
11855
|
+
const isHeaderGroup = !!((_footer$subHeaders = footer.subHeaders) !== null && _footer$subHeaders !== void 0 && _footer$subHeaders.length);
|
11856
|
+
const isPinned = isHeaderGroup ? (_footer$subHeaders$fi = footer.subHeaders.find(x => x.column.getIsPinned())) === null || _footer$subHeaders$fi === void 0 ? void 0 : _footer$subHeaders$fi.column.getIsPinned() : footer.column.getIsPinned();
|
11857
|
+
const style = {};
|
11858
|
+
if (isPinned) {
|
11859
|
+
// pinned columns should be offset from either the left or right
|
11860
|
+
style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;
|
11861
|
+
}
|
11862
|
+
let content;
|
11863
|
+
let align;
|
11864
|
+
if (footer.index === 0) {
|
11865
|
+
align = 'left';
|
11866
|
+
content = /*#__PURE__*/React__default.createElement(Summary, {
|
11867
|
+
table: footer.getContext().table
|
11868
|
+
});
|
11869
|
+
} else {
|
11870
|
+
align = columnMeta.align;
|
11871
|
+
content = footer.isPlaceholder ? null : reactTable.flexRender(footer.column.columnDef.footer, footer.getContext());
|
11872
|
+
}
|
11873
|
+
return /*#__PURE__*/React__default.createElement("td", {
|
11874
|
+
key: footer.id,
|
11875
|
+
"data-cell-align": align,
|
11876
|
+
"data-cell-id": footer.id,
|
11877
|
+
"data-cell-pinned": isPinned ? isPinned : undefined,
|
11878
|
+
style: style
|
11879
|
+
}, content);
|
11880
|
+
});
|
11881
|
+
|
11771
11882
|
const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput2(props, ref) {
|
11772
11883
|
var _attributes$ariaLabe, _attributes$placehold;
|
11773
11884
|
const {
|
@@ -11838,6 +11949,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
|
|
11838
11949
|
}
|
11839
11950
|
if (event.key === 'Escape') {
|
11840
11951
|
handleClear();
|
11952
|
+
event.stopPropagation();
|
11841
11953
|
return;
|
11842
11954
|
}
|
11843
11955
|
};
|
@@ -13731,7 +13843,39 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
13731
13843
|
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
13732
13844
|
}
|
13733
13845
|
};
|
13734
|
-
const
|
13846
|
+
const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.key) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.key) : child.key).flatMap(c => c) || [];
|
13847
|
+
const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option));
|
13848
|
+
const selectAllText = React__default.useMemo(() => {
|
13849
|
+
if (searchQuery === '') {
|
13850
|
+
if (areAllSelected) {
|
13851
|
+
return texts.select2.deselectAll;
|
13852
|
+
} else {
|
13853
|
+
return texts.select2.selectAll;
|
13854
|
+
}
|
13855
|
+
} else if (areAllSelected) {
|
13856
|
+
return texts.select2.deselectAllResults;
|
13857
|
+
} else {
|
13858
|
+
return texts.select2.selectAllResults;
|
13859
|
+
}
|
13860
|
+
}, [areAllSelected, searchQuery]);
|
13861
|
+
const selectAll = () => {
|
13862
|
+
if (!Array.isArray(value) || value.length === 0) {
|
13863
|
+
setValue(selectOptions);
|
13864
|
+
} else {
|
13865
|
+
selectOptions.forEach(child => {
|
13866
|
+
!value.includes(child) && setValue(child);
|
13867
|
+
});
|
13868
|
+
}
|
13869
|
+
};
|
13870
|
+
const deselectAll = () => {
|
13871
|
+
if (searchQuery === '') {
|
13872
|
+
setValue([]);
|
13873
|
+
} else {
|
13874
|
+
const nextValue = Array.isArray(value) && value.filter(subValue => !selectOptions.includes(subValue));
|
13875
|
+
setValue(nextValue);
|
13876
|
+
}
|
13877
|
+
};
|
13878
|
+
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none"', createCollectionClassName());
|
13735
13879
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
13736
13880
|
value: context
|
13737
13881
|
}, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Root, {
|
@@ -13771,11 +13915,17 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
13771
13915
|
style: {
|
13772
13916
|
minWidth: dimensions !== null && dimensions !== void 0 && dimensions.width ? `${dimensions.width}px` : undefined
|
13773
13917
|
}
|
13774
|
-
}, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(Search$2, {
|
13918
|
+
}, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
|
13775
13919
|
placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
|
13776
13920
|
ref: searchRef,
|
13777
13921
|
onTabKeyPress: () => setTabTriggeredClose(true)
|
13778
|
-
})
|
13922
|
+
}), multiple && selectOptions.length > 1 && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
|
13923
|
+
className: "!justify-start",
|
13924
|
+
appearance: "discrete",
|
13925
|
+
onClick: areAllSelected ? deselectAll : selectAll
|
13926
|
+
}, selectAllText), /*#__PURE__*/React__default.createElement("div", {
|
13927
|
+
className: "border-grey-300 mx-3 rounded border-t"
|
13928
|
+
}))))) : null, flattenedChildren.length <= 0 ? ( /*#__PURE__*/React__default.createElement("div", {
|
13779
13929
|
className: "text-grey-700 -mt-0.5 flex h-8 items-center px-2",
|
13780
13930
|
role: "presentation"
|
13781
13931
|
}, "No results found...")) : ( /*#__PURE__*/React__default.createElement(Root$1, {
|
@@ -13922,6 +14072,12 @@ function Print$1(props) {
|
|
13922
14072
|
const lastScrollTopRef = React__default.useRef();
|
13923
14073
|
const toast = useToast();
|
13924
14074
|
const tableMeta = table.options.meta;
|
14075
|
+
const {
|
14076
|
+
allRows,
|
14077
|
+
orientation,
|
14078
|
+
size,
|
14079
|
+
splitGroups
|
14080
|
+
} = tableMeta.printing.settings;
|
13925
14081
|
const togglePrinting = React__default.useCallback(enabled => {
|
13926
14082
|
tableMeta.printing.setIsPrinting(enabled);
|
13927
14083
|
if (tableRef.current) {
|
@@ -13979,10 +14135,6 @@ function Print$1(props) {
|
|
13979
14135
|
return Promise.reject(e);
|
13980
14136
|
}
|
13981
14137
|
};
|
13982
|
-
const [orientation, setOrientation] = React__default.useState('portrait');
|
13983
|
-
const [size, setSize] = React__default.useState('A4');
|
13984
|
-
const [allRows, setAllRows] = React__default.useState(true);
|
13985
|
-
const [splitGroups, setSplitGroups] = React__default.useState(true);
|
13986
14138
|
const printStyle = [`@page { size: ${size} ${orientation}; }`];
|
13987
14139
|
if (!allRows) {
|
13988
14140
|
printStyle.push(`table[data-taco='report']#${tableId} tr:not([data-row-selected="true"]) { display: none; }`);
|
@@ -14008,13 +14160,13 @@ function Print$1(props) {
|
|
14008
14160
|
table: table,
|
14009
14161
|
onAccept: print,
|
14010
14162
|
orientation: orientation,
|
14011
|
-
setOrientation:
|
14163
|
+
setOrientation: value => tableMeta.printing.setSetting('orientation', value),
|
14012
14164
|
size: size,
|
14013
|
-
setSize:
|
14165
|
+
setSize: value => tableMeta.printing.setSetting('size', value),
|
14014
14166
|
allRows: allRows,
|
14015
|
-
setAllRows:
|
14167
|
+
setAllRows: value => tableMeta.printing.setSetting('allRows', value),
|
14016
14168
|
splitGroups: splitGroups,
|
14017
|
-
setSplitGroups:
|
14169
|
+
setSplitGroups: value => tableMeta.printing.setSetting('splitGroups', value)
|
14018
14170
|
}))),
|
14019
14171
|
ref: ref,
|
14020
14172
|
shortcut: shortcut,
|
@@ -14043,7 +14195,7 @@ function sortByHeader(a, b) {
|
|
14043
14195
|
return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
|
14044
14196
|
}
|
14045
14197
|
|
14046
|
-
|
14198
|
+
const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
14047
14199
|
const {
|
14048
14200
|
allColumns,
|
14049
14201
|
filters,
|
@@ -14063,7 +14215,8 @@ function FilterColumn(props) {
|
|
14063
14215
|
warning: warning,
|
14064
14216
|
className: "min-h-[theme(spacing.8)]"
|
14065
14217
|
}, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
14066
|
-
|
14218
|
+
ref: ref,
|
14219
|
+
className: "focus:yt-focus !w-32 flex-shrink-0 ",
|
14067
14220
|
emptyValue: null,
|
14068
14221
|
onChange: handleChange,
|
14069
14222
|
value: value
|
@@ -14081,7 +14234,7 @@ function FilterColumn(props) {
|
|
14081
14234
|
disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
|
14082
14235
|
}, ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header) + (column.parent ? ` (${(_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header})` : ''));
|
14083
14236
|
}))));
|
14084
|
-
}
|
14237
|
+
});
|
14085
14238
|
|
14086
14239
|
function FilterComparator(props) {
|
14087
14240
|
const {
|
@@ -14308,6 +14461,7 @@ function Filter$1(props) {
|
|
14308
14461
|
texts
|
14309
14462
|
} = useLocalization();
|
14310
14463
|
const column = allColumns.find(c => c.id === filter.id);
|
14464
|
+
const ref = React__default.useRef(null);
|
14311
14465
|
const {
|
14312
14466
|
id,
|
14313
14467
|
value: {
|
@@ -14326,7 +14480,7 @@ function Filter$1(props) {
|
|
14326
14480
|
comparator: TableFilterComparator.Contains,
|
14327
14481
|
value: undefined
|
14328
14482
|
};
|
14329
|
-
handleChange(
|
14483
|
+
handleChange(position, {
|
14330
14484
|
id: columnId,
|
14331
14485
|
value
|
14332
14486
|
});
|
@@ -14336,7 +14490,7 @@ function Filter$1(props) {
|
|
14336
14490
|
if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {
|
14337
14491
|
nextValue = undefined;
|
14338
14492
|
}
|
14339
|
-
handleChange(
|
14493
|
+
handleChange(position, {
|
14340
14494
|
id,
|
14341
14495
|
value: {
|
14342
14496
|
comparator,
|
@@ -14345,7 +14499,7 @@ function Filter$1(props) {
|
|
14345
14499
|
});
|
14346
14500
|
};
|
14347
14501
|
const handleChangeValue = value => {
|
14348
|
-
handleChange(
|
14502
|
+
handleChange(position, {
|
14349
14503
|
id,
|
14350
14504
|
value: {
|
14351
14505
|
...filter.value,
|
@@ -14353,7 +14507,12 @@ function Filter$1(props) {
|
|
14353
14507
|
}
|
14354
14508
|
});
|
14355
14509
|
};
|
14356
|
-
const handleRemove = () => onRemove(
|
14510
|
+
const handleRemove = () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(position);
|
14511
|
+
React__default.useEffect(() => {
|
14512
|
+
if (ref.current && !id) {
|
14513
|
+
ref.current.focus(); // after adding a new filter placeholder, we want to focus it right way.
|
14514
|
+
}
|
14515
|
+
}, [id]);
|
14357
14516
|
return /*#__PURE__*/React__default.createElement("div", {
|
14358
14517
|
className: "flex items-start gap-2"
|
14359
14518
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -14362,7 +14521,8 @@ function Filter$1(props) {
|
|
14362
14521
|
allColumns: allColumns,
|
14363
14522
|
filters: filters,
|
14364
14523
|
onChange: handleChangeColumn,
|
14365
|
-
value: id
|
14524
|
+
value: id,
|
14525
|
+
ref: ref
|
14366
14526
|
}), /*#__PURE__*/React__default.createElement(FilterComparator, {
|
14367
14527
|
column: column,
|
14368
14528
|
onChange: handleChangeComparator,
|
@@ -14372,46 +14532,21 @@ function Filter$1(props) {
|
|
14372
14532
|
comparator: comparator,
|
14373
14533
|
onChange: handleChangeValue,
|
14374
14534
|
value: value
|
14375
|
-
}), /*#__PURE__*/React__default.createElement(IconButton, {
|
14535
|
+
}), onRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
14376
14536
|
appearance: "discrete",
|
14377
14537
|
className: "ml-auto",
|
14378
14538
|
icon: "close",
|
14379
14539
|
onClick: handleRemove
|
14380
|
-
}));
|
14381
|
-
}
|
14382
|
-
|
14383
|
-
function Placeholder(props) {
|
14384
|
-
const {
|
14385
|
-
allColumns,
|
14386
|
-
filters,
|
14387
|
-
onCreate: handleCreate,
|
14388
|
-
onRemove: handleRemove,
|
14389
|
-
position
|
14390
|
-
} = props;
|
14391
|
-
const {
|
14392
|
-
texts
|
14393
|
-
} = useLocalization();
|
14394
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
14395
|
-
className: "flex items-start gap-2"
|
14396
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
14397
|
-
className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
14398
|
-
}, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
|
14399
|
-
allColumns: allColumns,
|
14400
|
-
filters: filters,
|
14401
|
-
onChange: handleCreate,
|
14402
|
-
value: null
|
14403
|
-
}), /*#__PURE__*/React__default.createElement(FilterComparator, null), /*#__PURE__*/React__default.createElement(Input, {
|
14404
|
-
"aria-label": texts.table3.filters.emptyFilter.value,
|
14405
|
-
className: "flex-grow",
|
14406
|
-
disabled: true,
|
14407
|
-
value: texts.table3.filters.emptyFilter.value
|
14408
|
-
}), handleRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
14409
|
-
appearance: "discrete",
|
14410
|
-
icon: "close",
|
14411
|
-
onClick: handleRemove
|
14412
14540
|
}) : null);
|
14413
14541
|
}
|
14414
14542
|
|
14543
|
+
const placeholderFilter = {
|
14544
|
+
id: '',
|
14545
|
+
value: {
|
14546
|
+
comparator: TableFilterComparator.Contains,
|
14547
|
+
value: undefined
|
14548
|
+
}
|
14549
|
+
};
|
14415
14550
|
function ManageFiltersPopover(props) {
|
14416
14551
|
const {
|
14417
14552
|
length,
|
@@ -14425,52 +14560,40 @@ function ManageFiltersPopover(props) {
|
|
14425
14560
|
const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort(sortByHeader);
|
14426
14561
|
const appliedFilters = table.getState().columnFilters;
|
14427
14562
|
// state, since we "apply" filters - our filter values have a special shape, so we force to our type
|
14428
|
-
const [filters, setFilters] = React__default.useState(
|
14429
|
-
const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
|
14563
|
+
const [filters, setFilters] = React__default.useState(appliedFilters.length ? appliedFilters : [placeholderFilter]);
|
14430
14564
|
// filters might reset from the outside
|
14431
14565
|
React__default.useEffect(() => {
|
14432
14566
|
if (appliedFilters.length === 0) {
|
14433
|
-
setFilters([]);
|
14434
|
-
setPlaceholderCount(1);
|
14567
|
+
setFilters([placeholderFilter]);
|
14435
14568
|
}
|
14436
14569
|
}, [appliedFilters]);
|
14437
14570
|
// filters
|
14438
|
-
const handleChangeFilter = (
|
14571
|
+
const handleChangeFilter = (position, filter) => {
|
14439
14572
|
setFilters(currentFilters => {
|
14440
|
-
|
14441
|
-
|
14442
|
-
|
14573
|
+
return currentFilters.map((current, index) => {
|
14574
|
+
if (index === position) {
|
14575
|
+
return filter;
|
14576
|
+
}
|
14577
|
+
return current;
|
14578
|
+
});
|
14443
14579
|
});
|
14444
14580
|
};
|
14445
|
-
const handleRemoveFilter =
|
14446
|
-
if (filters.length === 1
|
14447
|
-
|
14581
|
+
const handleRemoveFilter = position => {
|
14582
|
+
if (filters.length === 1) {
|
14583
|
+
setFilters([placeholderFilter]);
|
14584
|
+
return;
|
14448
14585
|
}
|
14449
|
-
setFilters(currentFilters => currentFilters.filter(
|
14586
|
+
setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));
|
14450
14587
|
};
|
14451
|
-
|
14452
|
-
|
14453
|
-
setFilters(currentFilters => [...currentFilters, {
|
14454
|
-
id: columnId,
|
14455
|
-
value: {
|
14456
|
-
comparator: TableFilterComparator.Contains,
|
14457
|
-
value: undefined
|
14458
|
-
}
|
14459
|
-
}]);
|
14460
|
-
handleRemovePlaceholder();
|
14461
|
-
};
|
14462
|
-
const handleCreatePlaceholder = () => {
|
14463
|
-
setPlaceholderCount(count => count + 1);
|
14464
|
-
};
|
14465
|
-
const handleRemovePlaceholder = () => {
|
14466
|
-
setPlaceholderCount(count => count - 1);
|
14588
|
+
const handleCreate = () => {
|
14589
|
+
setFilters(filters.concat(placeholderFilter));
|
14467
14590
|
};
|
14468
14591
|
//
|
14469
14592
|
const handleApply = () => {
|
14470
14593
|
table.setColumnFilters(() => {
|
14471
14594
|
const newFilters = filters.filter(f => {
|
14472
14595
|
var _allColumns$find, _allColumns$find$colu;
|
14473
|
-
if (f.id === null) {
|
14596
|
+
if (f.id === null || f.id === '') {
|
14474
14597
|
return false;
|
14475
14598
|
}
|
14476
14599
|
const controlRenderer = (_allColumns$find = allColumns.find(c => c.id === f.id)) === null || _allColumns$find === void 0 ? void 0 : (_allColumns$find$colu = _allColumns$find.columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
|
@@ -14484,12 +14607,10 @@ function ManageFiltersPopover(props) {
|
|
14484
14607
|
};
|
14485
14608
|
const handleClear = () => {
|
14486
14609
|
table.resetColumnFilters();
|
14487
|
-
setFilters([]);
|
14488
|
-
setPlaceholderCount(1);
|
14610
|
+
setFilters([placeholderFilter]);
|
14489
14611
|
};
|
14490
14612
|
const handleClose = () => {
|
14491
|
-
setFilters(appliedFilters);
|
14492
|
-
setPlaceholderCount(appliedFilters.length ? 0 : 1);
|
14613
|
+
setFilters(appliedFilters.length === 0 ? [placeholderFilter] : appliedFilters);
|
14493
14614
|
};
|
14494
14615
|
return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
|
14495
14616
|
onChange: handleClose
|
@@ -14512,19 +14633,12 @@ function ManageFiltersPopover(props) {
|
|
14512
14633
|
filters: filters,
|
14513
14634
|
position: index,
|
14514
14635
|
onChange: handleChangeFilter,
|
14515
|
-
onRemove: handleRemoveFilter
|
14516
|
-
}))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
|
14517
|
-
key: `placeholder_${index}`,
|
14518
|
-
allColumns: allColumns,
|
14519
|
-
filters: filters,
|
14520
|
-
position: filters.length + index,
|
14521
|
-
onCreate: handleCreateFilterFromPlaceholder,
|
14522
|
-
onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
|
14636
|
+
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
14523
14637
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
14524
14638
|
className: "justify-start"
|
14525
14639
|
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
14526
14640
|
appearance: "discrete",
|
14527
|
-
onClick:
|
14641
|
+
onClick: handleCreate
|
14528
14642
|
}, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
14529
14643
|
className: "ml-auto"
|
14530
14644
|
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button$1, {
|
@@ -14652,12 +14766,15 @@ function useCssGridStylesheet(tableId, table, fontSize) {
|
|
14652
14766
|
size = `minmax(${minWidth}px, auto)`;
|
14653
14767
|
} else if (width !== undefined) {
|
14654
14768
|
const isLastColumn = index === allVisibleColumns.length - 1;
|
14655
|
-
if (isLastColumn) {
|
14656
|
-
size = `minmax(${minSize}px, auto)`;
|
14657
|
-
} else if (width === 'grow' || Number.isNaN(width)) {
|
14769
|
+
if (width === 'grow' || Number.isNaN(width) && !isLastColumn) {
|
14658
14770
|
size = `minmax(${minSize}px, 1fr)`;
|
14659
14771
|
} else {
|
14660
|
-
|
14772
|
+
const minWidth = width < minSize ? minSize : width;
|
14773
|
+
if (isLastColumn) {
|
14774
|
+
size = `minmax(${minWidth}px, auto)`;
|
14775
|
+
} else {
|
14776
|
+
size = `${minWidth}px`;
|
14777
|
+
}
|
14661
14778
|
}
|
14662
14779
|
} else {
|
14663
14780
|
size = `minmax(${minSize}px, auto)`;
|
@@ -15284,16 +15401,8 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
|
|
15284
15401
|
const rows = table.getRowModel().rows;
|
15285
15402
|
React__default.useEffect(() => {
|
15286
15403
|
const handleKeyDown = event => {
|
15287
|
-
const
|
15288
|
-
|
15289
|
-
//const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]');
|
15290
|
-
// Don't trigger global shortcuts on the table if event originated from a combobox or if table is
|
15291
|
-
// outside the dialog
|
15292
|
-
if (
|
15293
|
-
//eventOriginatedFromCombobox ||
|
15294
|
-
dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(tableRef.current))
|
15295
|
-
// || tableMeta.shortcutsState.isPaused
|
15296
|
-
) {
|
15404
|
+
const trigger = event.target;
|
15405
|
+
if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
|
15297
15406
|
return;
|
15298
15407
|
}
|
15299
15408
|
tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);
|
@@ -15342,12 +15451,12 @@ const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
|
15342
15451
|
const stylesheet = useStylesheet(report.id, report.instance);
|
15343
15452
|
useTableGlobalShortcuts(report.instance, tableRef, renderer.scrollToIndex);
|
15344
15453
|
const handleFocus = report.meta.rowActive.rowActiveIndex === undefined ? event => {
|
15345
|
-
report.meta.rowActive.handleFocus(event, report.length, renderer.scrollToIndex);
|
15454
|
+
report.meta.rowActive.handleFocus(event, report.meta.length, renderer.scrollToIndex);
|
15346
15455
|
} : undefined;
|
15347
15456
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, stylesheet, /*#__PURE__*/React__default.createElement(Toolbar, {
|
15348
15457
|
customSettings: props.customSettings,
|
15349
15458
|
left: props.toolbarLeft,
|
15350
|
-
length: report.length,
|
15459
|
+
length: report.meta.length,
|
15351
15460
|
right: props.toolbarRight,
|
15352
15461
|
scrollToIndex: renderer.scrollToIndex,
|
15353
15462
|
table: report.instance,
|
@@ -15371,15 +15480,11 @@ const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
|
|
15371
15480
|
}, /*#__PURE__*/React__default.createElement("thead", null, report.instance.getHeaderGroups().map(headerGroup => ( /*#__PURE__*/React__default.createElement("tr", {
|
15372
15481
|
key: headerGroup.id
|
15373
15482
|
}, headerGroup.headers.map(Header$4))))), (_renderer$rows = renderer.rows) !== null && _renderer$rows !== void 0 && _renderer$rows.length ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
|
15374
|
-
length: report.length,
|
15375
15483
|
table: report.instance,
|
15376
15484
|
style: renderer.style
|
15377
15485
|
}, renderer.rows), report.meta.footer.isEnabled ? ( /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, report.instance.getFooterGroups()[0].headers.map(Footer$3)))) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
|
15378
15486
|
emptyState: props.emptyState
|
15379
|
-
})))
|
15380
|
-
length: report.length,
|
15381
|
-
table: report.instance
|
15382
|
-
}) : null));
|
15487
|
+
})))));
|
15383
15488
|
});
|
15384
15489
|
Report$1.Column = Column$1;
|
15385
15490
|
Report$1.Group = Group$3;
|
@@ -17990,7 +18095,9 @@ function useSettingsStateListener(table, onChangeSettings) {
|
|
17990
18095
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
17991
18096
|
meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility,
|
17992
18097
|
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
17993
|
-
meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height,
|
18098
|
+
meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height,
|
18099
|
+
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
18100
|
+
meta.printing.isWarningVisibleForLargeDatasets, state.sorting]);
|
17994
18101
|
}
|
17995
18102
|
|
17996
18103
|
var Table3FilterComparator;
|
@@ -19669,6 +19776,25 @@ function Header$6(context) {
|
|
19669
19776
|
const isAllRowsSelected = context.table.getIsAllRowsSelected();
|
19670
19777
|
const isSomeRowsSelected = context.table.getIsSomeRowsSelected();
|
19671
19778
|
const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;
|
19779
|
+
const tableMeta = context.table.options.meta;
|
19780
|
+
const isServerloading = tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading;
|
19781
|
+
const isLoadingAll = isAllRowsSelected && isServerloading;
|
19782
|
+
const isLoadingPreviousRows = tableMeta.rowSelection.lastSelectedRowIndex !== undefined && isServerloading;
|
19783
|
+
const toggleSelectAll = function () {
|
19784
|
+
try {
|
19785
|
+
const _temp = function () {
|
19786
|
+
if (!isServerloading) {
|
19787
|
+
var _tableMeta$server, _tableMeta$server$loa;
|
19788
|
+
return Promise.resolve((_tableMeta$server = tableMeta.server) === null || _tableMeta$server === void 0 ? void 0 : (_tableMeta$server$loa = _tableMeta$server.loadAllIfNeeded) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, context.table.getState().sorting, context.table.getState().columnFilters, undefined)).then(function () {
|
19789
|
+
context.table.toggleAllRowsSelected(!isAllRowsSelected);
|
19790
|
+
});
|
19791
|
+
}
|
19792
|
+
}();
|
19793
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
19794
|
+
} catch (e) {
|
19795
|
+
return Promise.reject(e);
|
19796
|
+
}
|
19797
|
+
};
|
19672
19798
|
return /*#__PURE__*/React__default.createElement(Header$5, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
|
19673
19799
|
title: title
|
19674
19800
|
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
@@ -19677,8 +19803,9 @@ function Header$6(context) {
|
|
19677
19803
|
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
19678
19804
|
checked: isAllRowsSelected,
|
19679
19805
|
indeterminate: isSomeRowsSelected,
|
19680
|
-
onChange:
|
19681
|
-
tabIndex: -1
|
19806
|
+
onChange: toggleSelectAll,
|
19807
|
+
tabIndex: -1,
|
19808
|
+
loading: isLoadingAll || isLoadingPreviousRows
|
19682
19809
|
})));
|
19683
19810
|
} else {
|
19684
19811
|
return /*#__PURE__*/React__default.createElement(Header$5, Object.assign({}, context));
|
@@ -19700,18 +19827,49 @@ const Cell$7 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
19700
19827
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
19701
19828
|
const isSelected = context.row.getIsSelected();
|
19702
19829
|
const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;
|
19703
|
-
|
19704
|
-
|
19705
|
-
|
19706
|
-
|
19707
|
-
var _tableMeta$rowSelecti;
|
19708
|
-
const [fromIndex, toIndex] = toggleBetween$2((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
19709
|
-
context.table.getRowModel().rows.slice(fromIndex, toIndex + 1).forEach(row => row.toggleSelected(true));
|
19710
|
-
} else {
|
19711
|
-
context.row.toggleSelected();
|
19830
|
+
const handleCheckboxClick = function (event) {
|
19831
|
+
try {
|
19832
|
+
function _temp5() {
|
19833
|
+
tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;
|
19712
19834
|
}
|
19713
|
-
|
19714
|
-
|
19835
|
+
event.stopPropagation();
|
19836
|
+
const _temp4 = function () {
|
19837
|
+
if (event.shiftKey) {
|
19838
|
+
var _tableMeta$rowSelecti;
|
19839
|
+
function _temp3() {
|
19840
|
+
const currentlySelected = context.table.getSelectedRowModel().rows;
|
19841
|
+
// concat currently selected with selection range and get rid of duplicates using "Set".
|
19842
|
+
// converting allSelected array into updater object: {[row.id]: true}
|
19843
|
+
const allSelected = [...new Set(currentlySelected.concat(selectionRangeRows))];
|
19844
|
+
const updater = allSelected.reduce((obj, row) => Object.assign(obj, {
|
19845
|
+
[row.id]: true
|
19846
|
+
}), {});
|
19847
|
+
context.table.setRowSelection(updater);
|
19848
|
+
}
|
19849
|
+
const [fromIndex, toIndex] = toggleBetween$2((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
|
19850
|
+
const selectionRangeRows = context.table.getRowModel().rows.slice(fromIndex, toIndex + 1);
|
19851
|
+
// Table data loader filling-in all the rest of unloaded items with the undefined values,
|
19852
|
+
// so we can easily check if at least one of the rows in the selection range is undefined,
|
19853
|
+
// then it means that we need to call load all.
|
19854
|
+
const hasUndefinedRows = selectionRangeRows.some(row => row.original === undefined);
|
19855
|
+
const _temp2 = function () {
|
19856
|
+
if (hasUndefinedRows) {
|
19857
|
+
var _tableMeta$server2, _tableMeta$server2$lo;
|
19858
|
+
// We don't need to await and freeze UI
|
19859
|
+
return Promise.resolve((_tableMeta$server2 = tableMeta.server) === null || _tableMeta$server2 === void 0 ? void 0 : (_tableMeta$server2$lo = _tableMeta$server2.loadAllIfNeeded) === null || _tableMeta$server2$lo === void 0 ? void 0 : _tableMeta$server2$lo.call(_tableMeta$server2, context.table.getState().sorting, context.table.getState().columnFilters, undefined)).then(function () {});
|
19860
|
+
}
|
19861
|
+
}();
|
19862
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
19863
|
+
} else {
|
19864
|
+
context.row.toggleSelected();
|
19865
|
+
}
|
19866
|
+
}();
|
19867
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
19868
|
+
} catch (e) {
|
19869
|
+
return Promise.reject(e);
|
19870
|
+
}
|
19871
|
+
};
|
19872
|
+
if (context.table.options.enableMultiRowSelection) {
|
19715
19873
|
return /*#__PURE__*/React__default.createElement(DisplayCell$1, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
|
19716
19874
|
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
19717
19875
|
className: "ml-2",
|
@@ -19721,7 +19879,7 @@ const Cell$7 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
|
|
19721
19879
|
"aria-label": title,
|
19722
19880
|
className: "!mt-0",
|
19723
19881
|
checked: isSelected,
|
19724
|
-
onClick:
|
19882
|
+
onClick: handleCheckboxClick,
|
19725
19883
|
// this is necessary to remove console spam from eslint
|
19726
19884
|
onChange: () => false,
|
19727
19885
|
tabIndex: isActiveRow ? 0 : -1
|
@@ -20413,7 +20571,7 @@ function usePauseShortcuts() {
|
|
20413
20571
|
}
|
20414
20572
|
|
20415
20573
|
function useTable$2(props, ref) {
|
20416
|
-
var _settings$columnFreez, _props$length;
|
20574
|
+
var _settings$columnFreez, _props$data, _ref, _props$length, _props$data2;
|
20417
20575
|
// load any persisted table settings and merge them with any defaults
|
20418
20576
|
const [settings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);
|
20419
20577
|
// configure table3 options
|
@@ -20437,6 +20595,12 @@ function useTable$2(props, ref) {
|
|
20437
20595
|
// haven't migrated load all/server loading yet
|
20438
20596
|
const search = useSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
|
20439
20597
|
const shortcutsState = usePauseShortcuts();
|
20598
|
+
React__default.useEffect(() => {
|
20599
|
+
// Needed for DataDog
|
20600
|
+
if (!Array.isArray(props.data)) {
|
20601
|
+
console.error('Table3 data value is not an array');
|
20602
|
+
}
|
20603
|
+
}, []);
|
20440
20604
|
// custom features - shared/migrated
|
20441
20605
|
const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
|
20442
20606
|
const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
|
@@ -20489,7 +20653,8 @@ function useTable$2(props, ref) {
|
|
20489
20653
|
};
|
20490
20654
|
};
|
20491
20655
|
const table = reactTable.useReactTable({
|
20492
|
-
|
20656
|
+
// We need to fallback to an empty array, to avoid table crash in the client
|
20657
|
+
data: (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [],
|
20493
20658
|
columns,
|
20494
20659
|
getCoreRowModel: reactTable.getCoreRowModel(),
|
20495
20660
|
initialState,
|
@@ -20533,7 +20698,7 @@ function useTable$2(props, ref) {
|
|
20533
20698
|
useTableSortingListener(table, props.onSort);
|
20534
20699
|
return {
|
20535
20700
|
table,
|
20536
|
-
length: (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : props.data.length
|
20701
|
+
length: (_ref = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.length) !== null && _ref !== void 0 ? _ref : 0
|
20537
20702
|
};
|
20538
20703
|
}
|
20539
20704
|
function configureReactTableOptions$1(props, options) {
|
@@ -21017,7 +21182,7 @@ function resetHighlightedColumnIndexes$1(enabled, value, table) {
|
|
21017
21182
|
return firstRowIndex;
|
21018
21183
|
}
|
21019
21184
|
|
21020
|
-
|
21185
|
+
const FilterColumn$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
21021
21186
|
const {
|
21022
21187
|
allColumns,
|
21023
21188
|
filters,
|
@@ -21037,7 +21202,8 @@ function FilterColumn$1(props) {
|
|
21037
21202
|
warning: warning,
|
21038
21203
|
className: "min-h-[theme(spacing.8)]"
|
21039
21204
|
}, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
21040
|
-
|
21205
|
+
ref: ref,
|
21206
|
+
className: "focus:yt-focus !w-32 flex-shrink-0",
|
21041
21207
|
emptyValue: null,
|
21042
21208
|
onChange: handleChange,
|
21043
21209
|
value: value
|
@@ -21055,7 +21221,7 @@ function FilterColumn$1(props) {
|
|
21055
21221
|
disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
|
21056
21222
|
}, ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header) + (column.parent ? ` (${(_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header})` : ''));
|
21057
21223
|
}))));
|
21058
|
-
}
|
21224
|
+
});
|
21059
21225
|
|
21060
21226
|
function FilterComparator$1(props) {
|
21061
21227
|
const {
|
@@ -21074,7 +21240,7 @@ function FilterComparator$1(props) {
|
|
21074
21240
|
}
|
21075
21241
|
}, [validComparators]);
|
21076
21242
|
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
21077
|
-
className: "!w-32 flex-shrink-0",
|
21243
|
+
className: "focus:yt-focus !w-32 flex-shrink-0",
|
21078
21244
|
disabled: !column,
|
21079
21245
|
onChange: handleChange,
|
21080
21246
|
value: value
|
@@ -21161,38 +21327,6 @@ function getComparatorText$1(comparator, texts, column) {
|
|
21161
21327
|
}
|
21162
21328
|
}
|
21163
21329
|
|
21164
|
-
function Placeholder$1(props) {
|
21165
|
-
const {
|
21166
|
-
allColumns,
|
21167
|
-
filters,
|
21168
|
-
onCreate: handleCreate,
|
21169
|
-
onRemove: handleRemove,
|
21170
|
-
position
|
21171
|
-
} = props;
|
21172
|
-
const {
|
21173
|
-
texts
|
21174
|
-
} = useLocalization();
|
21175
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
21176
|
-
className: "flex items-start gap-2"
|
21177
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
21178
|
-
className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
|
21179
|
-
}, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn$1, {
|
21180
|
-
allColumns: allColumns,
|
21181
|
-
filters: filters,
|
21182
|
-
onChange: handleCreate,
|
21183
|
-
value: null
|
21184
|
-
}), /*#__PURE__*/React__default.createElement(FilterComparator$1, null), /*#__PURE__*/React__default.createElement(Input, {
|
21185
|
-
"aria-label": texts.table3.filters.emptyFilter.value,
|
21186
|
-
className: "flex-grow",
|
21187
|
-
disabled: true,
|
21188
|
-
value: texts.table3.filters.emptyFilter.value
|
21189
|
-
}), handleRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
21190
|
-
appearance: "discrete",
|
21191
|
-
icon: "close",
|
21192
|
-
onClick: handleRemove
|
21193
|
-
}) : null);
|
21194
|
-
}
|
21195
|
-
|
21196
21330
|
function FilterValue$1(props) {
|
21197
21331
|
const {
|
21198
21332
|
column,
|
@@ -21313,6 +21447,7 @@ function Filter$2(props) {
|
|
21313
21447
|
texts
|
21314
21448
|
} = useLocalization();
|
21315
21449
|
const column = allColumns.find(c => c.id === filter.id);
|
21450
|
+
const ref = React__default.useRef(null);
|
21316
21451
|
const {
|
21317
21452
|
id,
|
21318
21453
|
value: {
|
@@ -21331,7 +21466,7 @@ function Filter$2(props) {
|
|
21331
21466
|
comparator: null,
|
21332
21467
|
value: null
|
21333
21468
|
};
|
21334
|
-
handleChange(
|
21469
|
+
handleChange(position, {
|
21335
21470
|
id: columnId,
|
21336
21471
|
value
|
21337
21472
|
});
|
@@ -21341,7 +21476,7 @@ function Filter$2(props) {
|
|
21341
21476
|
if (comparator === Table3FilterComparator.IsEmpty || comparator === Table3FilterComparator.IsNotEmpty) {
|
21342
21477
|
nextValue = undefined;
|
21343
21478
|
}
|
21344
|
-
handleChange(
|
21479
|
+
handleChange(position, {
|
21345
21480
|
id,
|
21346
21481
|
value: {
|
21347
21482
|
comparator,
|
@@ -21350,7 +21485,7 @@ function Filter$2(props) {
|
|
21350
21485
|
});
|
21351
21486
|
};
|
21352
21487
|
const handleChangeValue = value => {
|
21353
|
-
handleChange(
|
21488
|
+
handleChange(position, {
|
21354
21489
|
id,
|
21355
21490
|
value: {
|
21356
21491
|
...filter.value,
|
@@ -21358,7 +21493,12 @@ function Filter$2(props) {
|
|
21358
21493
|
}
|
21359
21494
|
});
|
21360
21495
|
};
|
21361
|
-
const handleRemove = () => onRemove(
|
21496
|
+
const handleRemove = () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(position);
|
21497
|
+
React__default.useEffect(() => {
|
21498
|
+
if (ref.current && !id) {
|
21499
|
+
ref.current.focus(); // after adding a new filter placeholder, we want to focus it right way.
|
21500
|
+
}
|
21501
|
+
}, [id]);
|
21362
21502
|
return /*#__PURE__*/React__default.createElement("div", {
|
21363
21503
|
className: "flex items-start gap-2"
|
21364
21504
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -21367,7 +21507,8 @@ function Filter$2(props) {
|
|
21367
21507
|
allColumns: allColumns,
|
21368
21508
|
filters: filters,
|
21369
21509
|
onChange: handleChangeColumn,
|
21370
|
-
value: id
|
21510
|
+
value: id,
|
21511
|
+
ref: ref
|
21371
21512
|
}), /*#__PURE__*/React__default.createElement(FilterComparator$1, {
|
21372
21513
|
column: column,
|
21373
21514
|
onChange: handleChangeComparator,
|
@@ -21377,18 +21518,25 @@ function Filter$2(props) {
|
|
21377
21518
|
comparator: comparator,
|
21378
21519
|
onChange: handleChangeValue,
|
21379
21520
|
value: value
|
21380
|
-
}), /*#__PURE__*/React__default.createElement(IconButton, {
|
21521
|
+
}), onRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
|
21381
21522
|
appearance: "discrete",
|
21382
21523
|
className: "ml-auto",
|
21383
21524
|
icon: "close",
|
21384
21525
|
onClick: handleRemove
|
21385
|
-
}));
|
21526
|
+
}) : null);
|
21386
21527
|
}
|
21387
21528
|
|
21388
21529
|
function sortByHeader$1(a, b) {
|
21389
21530
|
var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
|
21390
21531
|
return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
|
21391
21532
|
}
|
21533
|
+
const placeholderFilter$1 = {
|
21534
|
+
id: null,
|
21535
|
+
value: {
|
21536
|
+
comparator: Table3FilterComparator.Contains,
|
21537
|
+
value: undefined
|
21538
|
+
}
|
21539
|
+
};
|
21392
21540
|
function FiltersButton(props) {
|
21393
21541
|
const {
|
21394
21542
|
total,
|
@@ -21408,41 +21556,28 @@ function FiltersButton(props) {
|
|
21408
21556
|
shift: true
|
21409
21557
|
};
|
21410
21558
|
// state, since we "apply" filters
|
21411
|
-
const [filters, setFilters] = React__default.useState(appliedFilters);
|
21412
|
-
const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
|
21559
|
+
const [filters, setFilters] = React__default.useState(appliedFilters.length ? appliedFilters : [placeholderFilter$1]);
|
21413
21560
|
// filters
|
21414
|
-
const handleChangeFilter = (
|
21561
|
+
const handleChangeFilter = (position, filter) => {
|
21415
21562
|
setFilters(currentFilters => {
|
21416
|
-
|
21417
|
-
|
21418
|
-
|
21419
|
-
|
21563
|
+
return currentFilters.map((current, index) => {
|
21564
|
+
if (index === position) {
|
21565
|
+
return filter;
|
21566
|
+
}
|
21567
|
+
return current;
|
21568
|
+
});
|
21420
21569
|
});
|
21421
21570
|
};
|
21422
|
-
const handleRemoveFilter =
|
21423
|
-
if (filters.length === 1
|
21424
|
-
|
21571
|
+
const handleRemoveFilter = position => {
|
21572
|
+
if (filters.length === 1) {
|
21573
|
+
setFilters([placeholderFilter$1]);
|
21574
|
+
return;
|
21425
21575
|
}
|
21426
|
-
setFilters(currentFilters => currentFilters.filter(
|
21427
|
-
};
|
21428
|
-
// placeholders
|
21429
|
-
const handleCreateFilterFromPlaceholder = columnId => {
|
21430
|
-
setFilters(currentFilters => [...currentFilters, {
|
21431
|
-
id: columnId,
|
21432
|
-
value: {
|
21433
|
-
comparator: Table3FilterComparator.Contains,
|
21434
|
-
value: undefined
|
21435
|
-
}
|
21436
|
-
}]);
|
21437
|
-
handleRemovePlaceholder();
|
21438
|
-
};
|
21439
|
-
const handleCreatePlaceholder = () => {
|
21440
|
-
setPlaceholderCount(count => count + 1);
|
21576
|
+
setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));
|
21441
21577
|
};
|
21442
|
-
const
|
21443
|
-
|
21578
|
+
const handleCreateNew = () => {
|
21579
|
+
setFilters(filters.concat(placeholderFilter$1));
|
21444
21580
|
};
|
21445
|
-
//
|
21446
21581
|
const handleApply = () => {
|
21447
21582
|
table.setColumnFilters(() => {
|
21448
21583
|
const newFilters = filters.filter(f => {
|
@@ -21462,20 +21597,17 @@ function FiltersButton(props) {
|
|
21462
21597
|
};
|
21463
21598
|
const handleClear = () => {
|
21464
21599
|
table.resetColumnFilters();
|
21465
|
-
setFilters([]);
|
21466
|
-
setPlaceholderCount(1);
|
21600
|
+
setFilters([placeholderFilter$1]);
|
21467
21601
|
};
|
21468
21602
|
const handleClose = React__default.useCallback(open => {
|
21469
21603
|
if (!open) {
|
21470
|
-
setFilters(appliedFilters);
|
21471
|
-
setPlaceholderCount(appliedFilters.length === 0 ? 1 : 0);
|
21604
|
+
setFilters(appliedFilters.length === 0 ? [placeholderFilter$1] : appliedFilters);
|
21472
21605
|
}
|
21473
21606
|
}, [appliedFilters]);
|
21474
21607
|
// Because filters can be reset from outside
|
21475
21608
|
React__default.useEffect(() => {
|
21476
21609
|
if (appliedFilters.length === 0) {
|
21477
|
-
setFilters([]);
|
21478
|
-
setPlaceholderCount(1);
|
21610
|
+
setFilters([placeholderFilter$1]);
|
21479
21611
|
}
|
21480
21612
|
}, [appliedFilters]);
|
21481
21613
|
const buttonProps = {
|
@@ -21505,19 +21637,12 @@ function FiltersButton(props) {
|
|
21505
21637
|
filters: filters,
|
21506
21638
|
position: index,
|
21507
21639
|
onChange: handleChangeFilter,
|
21508
|
-
onRemove: handleRemoveFilter
|
21509
|
-
}))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder$1, {
|
21510
|
-
key: `placeholder_${index}`,
|
21511
|
-
allColumns: allColumns,
|
21512
|
-
filters: filters,
|
21513
|
-
position: filters.length + index,
|
21514
|
-
onCreate: handleCreateFilterFromPlaceholder,
|
21515
|
-
onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
|
21640
|
+
onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
|
21516
21641
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
21517
21642
|
className: "justify-start"
|
21518
21643
|
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
21519
21644
|
appearance: "discrete",
|
21520
|
-
onClick:
|
21645
|
+
onClick: handleCreateNew
|
21521
21646
|
}, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
|
21522
21647
|
className: "ml-auto"
|
21523
21648
|
}, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button$1, {
|
@@ -21867,6 +21992,7 @@ function PrintButton(props) {
|
|
21867
21992
|
const buttonRef = React__default.useRef(null);
|
21868
21993
|
const tableMeta = table.options.meta;
|
21869
21994
|
const state = table.getState();
|
21995
|
+
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
21870
21996
|
const {
|
21871
21997
|
isWarningVisibleForLargeDatasets
|
21872
21998
|
} = tableMeta.printing;
|
@@ -22045,6 +22171,7 @@ function PrintButton(props) {
|
|
22045
22171
|
onAccept: handleWarningDialogAccept,
|
22046
22172
|
onClose: handleWarningDialogClose,
|
22047
22173
|
onCancel: handleWarningDialogCancel,
|
22174
|
+
// @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
|
22048
22175
|
onVisibilityChange: tableMeta.printing.setIsWarningVisibleForLargeDatasets
|
22049
22176
|
}));
|
22050
22177
|
}
|
@@ -22754,13 +22881,10 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
22754
22881
|
}, []);
|
22755
22882
|
React__default.useEffect(() => {
|
22756
22883
|
const handleKeyDown = event => {
|
22757
|
-
const
|
22758
|
-
const dialog = target.closest('[role="dialog"]');
|
22884
|
+
const trigger = event.target;
|
22759
22885
|
// Select2 also have combobox role to align with W3C guidelines
|
22760
|
-
const eventOriginatedFromCombobox = !!
|
22761
|
-
|
22762
|
-
// outside the dialog
|
22763
|
-
if (eventOriginatedFromCombobox || dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current)) || tableMeta.shortcutsState.isPaused) {
|
22886
|
+
const eventOriginatedFromCombobox = !!trigger.closest('[role="combobox"]:not([data-taco="Select2"])');
|
22887
|
+
if (tableMeta.shortcutsState.isPaused || isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, internalRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, internalRef.current) || eventOriginatedFromCombobox) {
|
22764
22888
|
return;
|
22765
22889
|
}
|
22766
22890
|
const rows = table.getRowModel().rows;
|