@procore/data-table 14.16.0 → 14.18.0
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/CHANGELOG.md +20 -0
- package/dist/legacy/index.cjs +1273 -1127
- package/dist/legacy/index.d.cts +4 -1
- package/dist/legacy/index.d.ts +4 -1
- package/dist/legacy/index.js +1272 -1127
- package/dist/modern/index.cjs +1607 -1466
- package/dist/modern/index.d.cts +4 -1
- package/dist/modern/index.d.ts +4 -1
- package/dist/modern/index.js +1607 -1467
- package/package.json +2 -2
package/dist/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React76, { useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo, useEffect, Component as Component$1, createElement } from 'react';
|
|
2
2
|
import { uniqBy, prop, startsWith, mergeDeepRight, equals, omit, intersection, isNil, mergeDeepLeft, isEmpty, groupBy } from 'ramda';
|
|
3
|
-
import { useI18nContext, Select, Input, UNSAFE_useOverlayTriggerContext, Card, Flex, Box, SegmentedController, Calendar, useDateTime, OverlayTrigger, isEventSource, DateInput, UNSAFE_isValidYearRange, DateSelect, PillSelect, TextArea, UNSAFE_useMenuImperativeControlNavigation, UNSAFE_Menu, UNSAFE_menuItemsWrapperAttribute, Spinner as Spinner$1, FlexList, Typography, Tooltip, Button, Required, MultiSelect, colors, Form, spacing, Switch, Panel,
|
|
3
|
+
import { useI18nContext, Select, Input, UNSAFE_useOverlayTriggerContext, Card, Flex, Box, SegmentedController, Calendar, useDateTime, OverlayTrigger, isEventSource, DateInput, UNSAFE_isValidYearRange, DateSelect, PillSelect, TextArea, UNSAFE_useMenuImperativeControlNavigation, UNSAFE_Menu, UNSAFE_menuItemsWrapperAttribute, Spinner as Spinner$1, FlexList, Typography, Tooltip, Button, Required, MultiSelect, colors, Form, spacing, Switch, Panel, SelectButton, StyledSelectButton, typographyWeights, StyledSelectButtonLabel, StyledButton, StyledSelectArrow, Popover, UNSAFE_StyledSuperSelectTrigger, UNSAFE_StyledSuperSelectLabel, UNSAFE_StyledSuperSelectArrow, UNSAFE_StyledFilterTokenLabel, DateTimeProvider, useField, Label, UNSAFE_mergeRefs, ContactItem as ContactItem$1, ToggleButton, Link, AvatarStack, Pill, Typeahead, Pagination, UNSAFE_SuperSelect, UNSAFE_FilterToken, Avatar, H3, Checkbox, useI18n, I18nContext, UNSAFE_useSuperSelectContext, DropdownFlyout, useVisibility, StyledDropdownFlyoutLabel, StyledDropdownFlyoutExpandIcon, EmptyState as EmptyState$1 } from '@procore/core-react';
|
|
4
4
|
import classnames from 'classnames/bind';
|
|
5
5
|
import debounce5 from 'lodash.debounce';
|
|
6
6
|
import { Error as Error$1, Grip, ExternalLink, Pencil, Building, Clear, Calendar as Calendar$1, ArrowDown, ArrowUp, CaretDown, CaretRight, CaretsInVertical, CaretsOutVerticalWithLine, CaretsOutVertical, CaretsIn, CaretsOut } from '@procore/core-icons';
|
|
@@ -17,9 +17,9 @@ import _isEqual from 'lodash.isequal';
|
|
|
17
17
|
import ReactResizeDetector from 'react-resize-detector';
|
|
18
18
|
import { DateTimeSelectField } from '@procore/labs-datetime-select';
|
|
19
19
|
import Decimal from 'decimal.js';
|
|
20
|
-
import
|
|
21
|
-
import { GroupBySelect } from '@procore/labs-group-by-select';
|
|
20
|
+
import styled3, { css as css$1 } from 'styled-components';
|
|
22
21
|
import { getDatePlaceholder } from '@procore/globalization-toolkit';
|
|
22
|
+
import { GroupBySelect } from '@procore/labs-group-by-select';
|
|
23
23
|
|
|
24
24
|
var __create = Object.create;
|
|
25
25
|
var __defProp = Object.defineProperty;
|
|
@@ -1408,7 +1408,7 @@ ag-grid, ag-grid-angular, ag-grid-ng2, ag-grid-polymer, ag-grid-aurelia {
|
|
|
1408
1408
|
animation-iteration-count: infinite;
|
|
1409
1409
|
animation-name: ag-shake-left-to-right;
|
|
1410
1410
|
}
|
|
1411
|
-
@keyframes _ag-shake-left-to-
|
|
1411
|
+
@keyframes _ag-shake-left-to-right_18odb_369 {
|
|
1412
1412
|
from {
|
|
1413
1413
|
padding-left: 6px;
|
|
1414
1414
|
padding-right: 2px;
|
|
@@ -5409,7 +5409,7 @@ input[class^=ag-][type=button]:focus, button[class^=ag-]:focus {
|
|
|
5409
5409
|
animation-iteration-count: infinite;
|
|
5410
5410
|
animation-timing-function: linear;
|
|
5411
5411
|
}
|
|
5412
|
-
@keyframes
|
|
5412
|
+
@keyframes _spin_18odb_1 {
|
|
5413
5413
|
from {
|
|
5414
5414
|
transform: rotate(0deg);
|
|
5415
5415
|
}
|
|
@@ -7715,7 +7715,7 @@ input[class^=ag-][type=range]:disabled {
|
|
|
7715
7715
|
.ag-theme-alpine.ag-theme-alpine .ag-details-row-auto-height .ag-center-cols-viewport, .ag-theme-alpine.ag-theme-alpine .ag-layout-auto-height .ag-center-cols-viewport {
|
|
7716
7716
|
min-height: 0px;
|
|
7717
7717
|
}
|
|
7718
|
-
.ag-theme-alpine.ag-theme-alpine .ag-overlay
|
|
7718
|
+
.ag-theme-alpine.ag-theme-alpine .ag-overlay .ag-react-container {
|
|
7719
7719
|
pointer-events: initial;
|
|
7720
7720
|
}
|
|
7721
7721
|
.ag-theme-alpine.ag-theme-alpine .ag-menu, .ag-theme-alpine.ag-theme-alpine .ag-menu-header {
|
|
@@ -7914,7 +7914,7 @@ input[class^=ag-][type=range]:disabled {
|
|
|
7914
7914
|
padding-left: 16px;
|
|
7915
7915
|
}
|
|
7916
7916
|
|
|
7917
|
-
div.
|
|
7917
|
+
div._contextPanel_18odb_7153 {
|
|
7918
7918
|
width: 400px;
|
|
7919
7919
|
transition: all ease 500ms;
|
|
7920
7920
|
flex: 0 0 auto;
|
|
@@ -7923,7 +7923,7 @@ div._contextPanel_1t4e8_7153 {
|
|
|
7923
7923
|
border: 1px solid #d6dadc;
|
|
7924
7924
|
display: flex;
|
|
7925
7925
|
}
|
|
7926
|
-
div._contextPanel--
|
|
7926
|
+
div._contextPanel--hidden_18odb_7162 {
|
|
7927
7927
|
border: none;
|
|
7928
7928
|
overflow: hidden;
|
|
7929
7929
|
padding: 0px;
|
|
@@ -7931,50 +7931,50 @@ div._contextPanel--hidden_1t4e8_7162 {
|
|
|
7931
7931
|
width: 0px;
|
|
7932
7932
|
}
|
|
7933
7933
|
|
|
7934
|
-
.
|
|
7934
|
+
._contextPanelWrapper_18odb_7170 {
|
|
7935
7935
|
position: relative;
|
|
7936
7936
|
flex-grow: 1;
|
|
7937
7937
|
}
|
|
7938
7938
|
|
|
7939
|
-
.
|
|
7939
|
+
._contextPanelBody_18odb_7175 {
|
|
7940
7940
|
width: clamp(380px, 400px, 100%);
|
|
7941
7941
|
}
|
|
7942
7942
|
|
|
7943
|
-
._contextPanel-
|
|
7943
|
+
._contextPanel-stickyHeader_18odb_7179 {
|
|
7944
7944
|
background-color: #ffffff;
|
|
7945
7945
|
position: sticky;
|
|
7946
7946
|
top: 0;
|
|
7947
7947
|
z-index: 5;
|
|
7948
7948
|
}
|
|
7949
7949
|
|
|
7950
|
-
._filters-
|
|
7950
|
+
._filters-list_18odb_7186 {
|
|
7951
7951
|
padding: 0;
|
|
7952
7952
|
margin: 0;
|
|
7953
7953
|
}
|
|
7954
|
-
._filters-
|
|
7954
|
+
._filters-list_18odb_7186 ol {
|
|
7955
7955
|
padding: 0;
|
|
7956
7956
|
margin: 0;
|
|
7957
7957
|
}
|
|
7958
7958
|
|
|
7959
|
-
._col-drag-column-
|
|
7959
|
+
._col-drag-column-icon_18odb_7195 {
|
|
7960
7960
|
color: #6a767c;
|
|
7961
7961
|
}
|
|
7962
7962
|
|
|
7963
|
-
._tabular-
|
|
7963
|
+
._tabular-nums_18odb_7199 {
|
|
7964
7964
|
font-variant-numeric: tabular-nums;
|
|
7965
7965
|
}`;
|
|
7966
7966
|
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
|
|
7967
7967
|
var styles_default = {
|
|
7968
|
-
"contextPanel": "
|
|
7969
|
-
"contextPanel--hidden": "_contextPanel--
|
|
7970
|
-
"contextPanelWrapper": "
|
|
7971
|
-
"contextPanelBody": "
|
|
7972
|
-
"contextPanel-stickyHeader": "_contextPanel-
|
|
7973
|
-
"filters-list": "_filters-
|
|
7974
|
-
"col-drag-column-icon": "_col-drag-column-
|
|
7975
|
-
"tabular-nums": "_tabular-
|
|
7976
|
-
"ag-shake-left-to-right": "_ag-shake-left-to-
|
|
7977
|
-
"spin": "
|
|
7968
|
+
"contextPanel": "_contextPanel_18odb_7153",
|
|
7969
|
+
"contextPanel--hidden": "_contextPanel--hidden_18odb_7162",
|
|
7970
|
+
"contextPanelWrapper": "_contextPanelWrapper_18odb_7170",
|
|
7971
|
+
"contextPanelBody": "_contextPanelBody_18odb_7175",
|
|
7972
|
+
"contextPanel-stickyHeader": "_contextPanel-stickyHeader_18odb_7179",
|
|
7973
|
+
"filters-list": "_filters-list_18odb_7186",
|
|
7974
|
+
"col-drag-column-icon": "_col-drag-column-icon_18odb_7195",
|
|
7975
|
+
"tabular-nums": "_tabular-nums_18odb_7199",
|
|
7976
|
+
"ag-shake-left-to-right": "_ag-shake-left-to-right_18odb_369",
|
|
7977
|
+
"spin": "_spin_18odb_1"
|
|
7978
7978
|
};
|
|
7979
7979
|
|
|
7980
7980
|
// src/utils/getCellValueTypographyProps.ts
|
|
@@ -8061,7 +8061,7 @@ var Renderer = ({
|
|
|
8061
8061
|
var ButtonsCellRenderer = withDataTableRenderer(Renderer, "select");
|
|
8062
8062
|
|
|
8063
8063
|
// src/utils/truncation.scss
|
|
8064
|
-
var css2 = `.
|
|
8064
|
+
var css2 = `._truncatingText_c077g_1 {
|
|
8065
8065
|
white-space: normal;
|
|
8066
8066
|
overflow: hidden;
|
|
8067
8067
|
word-wrap: break-word;
|
|
@@ -8070,17 +8070,43 @@ var css2 = `._truncatingText_114ye_1 {
|
|
|
8070
8070
|
-webkit-box-orient: vertical;
|
|
8071
8071
|
-webkit-line-clamp: 1;
|
|
8072
8072
|
}
|
|
8073
|
-
._truncatingText--
|
|
8073
|
+
._truncatingText--md_c077g_10 {
|
|
8074
8074
|
-webkit-line-clamp: 2;
|
|
8075
8075
|
}
|
|
8076
|
-
._truncatingText--
|
|
8076
|
+
._truncatingText--lg_c077g_13 {
|
|
8077
8077
|
-webkit-line-clamp: 3;
|
|
8078
|
+
}
|
|
8079
|
+
._truncatingText--overflowVisible_c077g_16 {
|
|
8080
|
+
overflow: visible;
|
|
8081
|
+
}
|
|
8082
|
+
|
|
8083
|
+
._extendClickableArea_c077g_20 {
|
|
8084
|
+
display: inline-block;
|
|
8085
|
+
position: relative;
|
|
8086
|
+
width: 100%;
|
|
8087
|
+
}
|
|
8088
|
+
._extendClickableArea_c077g_20::before {
|
|
8089
|
+
content: "";
|
|
8090
|
+
position: absolute;
|
|
8091
|
+
top: 50%;
|
|
8092
|
+
left: 50%;
|
|
8093
|
+
width: 48px;
|
|
8094
|
+
height: 48px;
|
|
8095
|
+
transform: translate(-50%, -50%);
|
|
8096
|
+
pointer-events: auto;
|
|
8097
|
+
background: transparent;
|
|
8098
|
+
}
|
|
8099
|
+
._extendClickableArea--rowHeightSm_c077g_36::before {
|
|
8100
|
+
height: 32px;
|
|
8078
8101
|
}`;
|
|
8079
8102
|
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css2));
|
|
8080
8103
|
var truncation_default = {
|
|
8081
|
-
"truncatingText": "
|
|
8082
|
-
"truncatingText--md": "_truncatingText--
|
|
8083
|
-
"truncatingText--lg": "_truncatingText--
|
|
8104
|
+
"truncatingText": "_truncatingText_c077g_1",
|
|
8105
|
+
"truncatingText--md": "_truncatingText--md_c077g_10",
|
|
8106
|
+
"truncatingText--lg": "_truncatingText--lg_c077g_13",
|
|
8107
|
+
"truncatingText--overflowVisible": "_truncatingText--overflowVisible_c077g_16",
|
|
8108
|
+
"extendClickableArea": "_extendClickableArea_c077g_20",
|
|
8109
|
+
"extendClickableArea--rowHeightSm": "_extendClickableArea--rowHeightSm_c077g_36"
|
|
8084
8110
|
};
|
|
8085
8111
|
|
|
8086
8112
|
// src/utils/ContactItem.tsx
|
|
@@ -52944,7 +52970,10 @@ globalObj.MouseEvent = typeof MouseEvent === "undefined" ? {} : MouseEvent;
|
|
|
52944
52970
|
// src/CellRenderers/GroupCell.tsx
|
|
52945
52971
|
var GroupCellRenderer2 = GroupCellRenderer;
|
|
52946
52972
|
var cx6 = classnames.bind(truncation_default);
|
|
52973
|
+
var MIN_LINK_WIDTH = 48;
|
|
52947
52974
|
var InternalLinkCellRenderer = ({ columnDefinition, isGroup, data, rowHeight, value }) => {
|
|
52975
|
+
const [isLinkWidthBelowMin, setIsLinkWidthBelowMin] = useState(false);
|
|
52976
|
+
const linkRef = useRef(null);
|
|
52948
52977
|
const internalValue = value ? columnDefinition.getStringFormattedValue?.(value) : "";
|
|
52949
52978
|
const typographyProps = getCellValueTypographyProps(
|
|
52950
52979
|
columnDefinition.cellRendererParams?.typographyProps
|
|
@@ -52955,14 +52984,24 @@ var InternalLinkCellRenderer = ({ columnDefinition, isGroup, data, rowHeight, va
|
|
|
52955
52984
|
"truncatingText",
|
|
52956
52985
|
{
|
|
52957
52986
|
"truncatingText--md": rowHeight === rowSize.md,
|
|
52958
|
-
"truncatingText--lg": rowHeight === rowSize.lg
|
|
52987
|
+
"truncatingText--lg": rowHeight === rowSize.lg,
|
|
52988
|
+
"truncatingText--overflowVisible": isLinkWidthBelowMin
|
|
52959
52989
|
}
|
|
52960
52990
|
);
|
|
52961
52991
|
if (isGroup) {
|
|
52962
52992
|
return /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps, className, weight: "semibold" }, value);
|
|
52963
52993
|
}
|
|
52994
|
+
useEffect(() => {
|
|
52995
|
+
if (linkRef.current) {
|
|
52996
|
+
const { width } = linkRef.current.getBoundingClientRect();
|
|
52997
|
+
setIsLinkWidthBelowMin(width < MIN_LINK_WIDTH);
|
|
52998
|
+
}
|
|
52999
|
+
}, [internalValue]);
|
|
52964
53000
|
const isExternalLink = columnDefinition.cellRendererParams.isExternalLink ?? false;
|
|
52965
53001
|
const URL = columnDefinition.cellRendererParams.getURL(value, data);
|
|
53002
|
+
const extendClickableAreaClassNames = isLinkWidthBelowMin ? cx6("extendClickableArea", {
|
|
53003
|
+
"extendClickableArea--rowHeightSm": rowHeight === rowSize.sm
|
|
53004
|
+
}) : "";
|
|
52966
53005
|
if (isExternalLink && value && URL) {
|
|
52967
53006
|
return /* @__PURE__ */ React76.createElement(
|
|
52968
53007
|
Typography,
|
|
@@ -52982,7 +53021,7 @@ var InternalLinkCellRenderer = ({ columnDefinition, isGroup, data, rowHeight, va
|
|
|
52982
53021
|
)
|
|
52983
53022
|
);
|
|
52984
53023
|
}
|
|
52985
|
-
return URL ? /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps, className }, /* @__PURE__ */ React76.createElement(Link, { href: URL }, internalValue)) : /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps }, internalValue);
|
|
53024
|
+
return URL ? /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps, className }, /* @__PURE__ */ React76.createElement(Link, { href: URL, className: extendClickableAreaClassNames, ref: linkRef }, internalValue)) : /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps }, internalValue);
|
|
52986
53025
|
};
|
|
52987
53026
|
var LinkCellRenderer = withDataTableRenderer(
|
|
52988
53027
|
InternalLinkCellRenderer,
|
|
@@ -53061,7 +53100,7 @@ var NumberCellEditor2 = withDataTableEditor(
|
|
|
53061
53100
|
);
|
|
53062
53101
|
|
|
53063
53102
|
// src/CellRenderers/peopleCellStyles.scss
|
|
53064
|
-
var css3 = `.
|
|
53103
|
+
var css3 = `._truncatingText_14qzu_1 {
|
|
53065
53104
|
white-space: normal;
|
|
53066
53105
|
overflow: hidden;
|
|
53067
53106
|
word-wrap: break-word;
|
|
@@ -53070,33 +53109,59 @@ var css3 = `._truncatingText_3wkw2_1 {
|
|
|
53070
53109
|
-webkit-box-orient: vertical;
|
|
53071
53110
|
-webkit-line-clamp: 1;
|
|
53072
53111
|
}
|
|
53073
|
-
._truncatingText--
|
|
53112
|
+
._truncatingText--md_14qzu_10 {
|
|
53074
53113
|
-webkit-line-clamp: 2;
|
|
53075
53114
|
}
|
|
53076
|
-
._truncatingText--
|
|
53115
|
+
._truncatingText--lg_14qzu_13 {
|
|
53077
53116
|
-webkit-line-clamp: 3;
|
|
53078
53117
|
}
|
|
53118
|
+
._truncatingText--overflowVisible_14qzu_16 {
|
|
53119
|
+
overflow: visible;
|
|
53120
|
+
}
|
|
53121
|
+
|
|
53122
|
+
._extendClickableArea_14qzu_20 {
|
|
53123
|
+
display: inline-block;
|
|
53124
|
+
position: relative;
|
|
53125
|
+
width: 100%;
|
|
53126
|
+
}
|
|
53127
|
+
._extendClickableArea_14qzu_20::before {
|
|
53128
|
+
content: "";
|
|
53129
|
+
position: absolute;
|
|
53130
|
+
top: 50%;
|
|
53131
|
+
left: 50%;
|
|
53132
|
+
width: 48px;
|
|
53133
|
+
height: 48px;
|
|
53134
|
+
transform: translate(-50%, -50%);
|
|
53135
|
+
pointer-events: auto;
|
|
53136
|
+
background: transparent;
|
|
53137
|
+
}
|
|
53138
|
+
._extendClickableArea--rowHeightSm_14qzu_36::before {
|
|
53139
|
+
height: 32px;
|
|
53140
|
+
}
|
|
53079
53141
|
|
|
53080
|
-
.
|
|
53142
|
+
._inlineListItems_14qzu_40 {
|
|
53081
53143
|
list-style: none;
|
|
53082
53144
|
margin: 0;
|
|
53083
53145
|
padding: 0;
|
|
53084
53146
|
}
|
|
53085
|
-
.
|
|
53147
|
+
._inlineListItems_14qzu_40 > li {
|
|
53086
53148
|
display: inline;
|
|
53087
53149
|
}
|
|
53088
53150
|
|
|
53089
|
-
.
|
|
53151
|
+
._dynamicRowHeightSpacing_14qzu_49 {
|
|
53090
53152
|
margin-top: 8px;
|
|
53091
53153
|
margin-bottom: 8px;
|
|
53092
53154
|
}`;
|
|
53093
53155
|
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css3));
|
|
53094
53156
|
var peopleCellStyles_default = {
|
|
53095
|
-
"truncatingText": "
|
|
53096
|
-
"truncatingText--md": "_truncatingText--
|
|
53097
|
-
"truncatingText--lg": "_truncatingText--
|
|
53098
|
-
"
|
|
53099
|
-
"
|
|
53157
|
+
"truncatingText": "_truncatingText_14qzu_1",
|
|
53158
|
+
"truncatingText--md": "_truncatingText--md_14qzu_10",
|
|
53159
|
+
"truncatingText--lg": "_truncatingText--lg_14qzu_13",
|
|
53160
|
+
"truncatingText--overflowVisible": "_truncatingText--overflowVisible_14qzu_16",
|
|
53161
|
+
"extendClickableArea": "_extendClickableArea_14qzu_20",
|
|
53162
|
+
"extendClickableArea--rowHeightSm": "_extendClickableArea--rowHeightSm_14qzu_36",
|
|
53163
|
+
"inlineListItems": "_inlineListItems_14qzu_40",
|
|
53164
|
+
"dynamicRowHeightSpacing": "_dynamicRowHeightSpacing_14qzu_49"
|
|
53100
53165
|
};
|
|
53101
53166
|
|
|
53102
53167
|
// src/CellRenderers/PeopleCell.tsx
|
|
@@ -54142,6 +54207,37 @@ function sortColumnDefinitionsByFilterIndex(colDef1, colDef2) {
|
|
|
54142
54207
|
}
|
|
54143
54208
|
return filterIndex1 > filterIndex2 ? 1 : -1;
|
|
54144
54209
|
}
|
|
54210
|
+
function assignAlphabeticalFilterIndices(columnDefinitions) {
|
|
54211
|
+
const newColumns = columnDefinitions.map((col) => ({
|
|
54212
|
+
...col,
|
|
54213
|
+
filterProps: col.filterProps ? { ...col.filterProps } : void 0
|
|
54214
|
+
}));
|
|
54215
|
+
const filterColumns = newColumns.filter(
|
|
54216
|
+
(col) => col.filterRenderer || col.filterProps
|
|
54217
|
+
);
|
|
54218
|
+
const groups = {};
|
|
54219
|
+
filterColumns.forEach((col) => {
|
|
54220
|
+
const groupName = col.filterProps?.groupName || "default";
|
|
54221
|
+
if (!groups[groupName]) {
|
|
54222
|
+
groups[groupName] = [];
|
|
54223
|
+
}
|
|
54224
|
+
groups[groupName].push(col);
|
|
54225
|
+
});
|
|
54226
|
+
Object.values(groups).forEach((groupCols) => {
|
|
54227
|
+
groupCols.sort((a, b) => {
|
|
54228
|
+
const headerA = a.headerName || "";
|
|
54229
|
+
const headerB = b.headerName || "";
|
|
54230
|
+
return headerA.localeCompare(headerB);
|
|
54231
|
+
});
|
|
54232
|
+
groupCols.forEach((col, idx) => {
|
|
54233
|
+
if (!col.filterProps) {
|
|
54234
|
+
col.filterProps = {};
|
|
54235
|
+
}
|
|
54236
|
+
col.filterProps.index = idx;
|
|
54237
|
+
});
|
|
54238
|
+
});
|
|
54239
|
+
return newColumns;
|
|
54240
|
+
}
|
|
54145
54241
|
|
|
54146
54242
|
// src/state/useFilterState.ts
|
|
54147
54243
|
function isNumberFilterModel(value) {
|
|
@@ -55880,7 +55976,10 @@ var DataTableCellRenderer = ({
|
|
|
55880
55976
|
value
|
|
55881
55977
|
};
|
|
55882
55978
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
|
55883
|
-
const isSelectCellComponent = columnDefinition.
|
|
55979
|
+
const isSelectCellComponent = columnDefinition.cellRendererSelector?.({
|
|
55980
|
+
...columnDefinition.cellRendererParams,
|
|
55981
|
+
node
|
|
55982
|
+
}).component?.displayName === "SelectCellRenderer";
|
|
55884
55983
|
const URL = isSelectCellComponent && columnDefinition?.cellRendererParams?.getURL ? columnDefinition.cellRendererParams.getURL(value) : null;
|
|
55885
55984
|
const startEditing = useCallback(
|
|
55886
55985
|
() => api.startEditingCell({
|
|
@@ -78074,12 +78173,15 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
|
|
|
78074
78173
|
};
|
|
78075
78174
|
|
|
78076
78175
|
// src/utils/expandRows.ts
|
|
78176
|
+
function getStringifiedRoute(node) {
|
|
78177
|
+
return node.getRoute()?.map((r) => typeof r === "object" ? JSON.stringify(r) : r);
|
|
78178
|
+
}
|
|
78077
78179
|
var getGroupRowState = (gridApi, groupDefaultExpanded = 0) => {
|
|
78078
78180
|
const expandedRoutes = [];
|
|
78079
78181
|
const collapsedRoutes = [];
|
|
78080
78182
|
if (gridApi) {
|
|
78081
78183
|
gridApi.forEachNode((node) => {
|
|
78082
|
-
const route = node
|
|
78184
|
+
const route = getStringifiedRoute(node);
|
|
78083
78185
|
if (route) {
|
|
78084
78186
|
const routePath = route.join(",");
|
|
78085
78187
|
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
@@ -78099,7 +78201,7 @@ var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
|
|
|
78099
78201
|
const expandedRoutes = tableConfig.groupRowState?.expandedRoutes ?? [];
|
|
78100
78202
|
const collapsedRoutes = tableConfig.groupRowState?.collapsedRoutes ?? [];
|
|
78101
78203
|
gridApi.forEachNode((node) => {
|
|
78102
|
-
const route = node
|
|
78204
|
+
const route = getStringifiedRoute(node);
|
|
78103
78205
|
if (route) {
|
|
78104
78206
|
const routePath = route.join(",");
|
|
78105
78207
|
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
@@ -78116,7 +78218,7 @@ var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
|
|
|
78116
78218
|
var isRowOpenedByDefault = (node, tableConfig, groupDefaultExpanded = 0) => {
|
|
78117
78219
|
const expandedRoutes = tableConfig?.groupRowState?.expandedRoutes ?? [];
|
|
78118
78220
|
const collapsedRoutes = tableConfig?.groupRowState?.collapsedRoutes ?? [];
|
|
78119
|
-
const route = node
|
|
78221
|
+
const route = getStringifiedRoute(node);
|
|
78120
78222
|
if (!route) {
|
|
78121
78223
|
return false;
|
|
78122
78224
|
}
|
|
@@ -82684,7 +82786,7 @@ var FILTERS_GROUP_EXPANDABLE_AREA_VERTICAL_MARGIN = spacing.md;
|
|
|
82684
82786
|
var FILTERS_GROUP_ITEM_HEIGHT = 60;
|
|
82685
82787
|
var ITEMS_IN_FILTERS_GROUP = 5;
|
|
82686
82788
|
var FILTERS_GROUP_EXPANDABLE_AREA_HEIGHT = (FILTERS_GROUP_ITEM_HEIGHT + spacing.xl) * ITEMS_IN_FILTERS_GROUP + BORDER_WIDTH;
|
|
82687
|
-
var StyledPanelSection =
|
|
82789
|
+
var StyledPanelSection = styled3(Panel.Section)`
|
|
82688
82790
|
// Filters Group container styles
|
|
82689
82791
|
&.filters-list-group-section {
|
|
82690
82792
|
padding-bottom: ${FILTERS_GROUP_VERTICAL_MARGIN}px;
|
|
@@ -82974,899 +83076,807 @@ var ConfigPanelButton = () => {
|
|
|
82974
83076
|
)
|
|
82975
83077
|
);
|
|
82976
83078
|
};
|
|
82977
|
-
|
|
82978
|
-
|
|
82979
|
-
|
|
82980
|
-
|
|
82981
|
-
|
|
82982
|
-
|
|
83079
|
+
var QuickFilterLabel = React76.forwardRef(({ enabled, ...props }, ref) => {
|
|
83080
|
+
return /* @__PURE__ */ React76.createElement(StyledQuickFilterLabel, { $enabled: enabled }, /* @__PURE__ */ React76.createElement(SelectButton, { ref, ...props }));
|
|
83081
|
+
});
|
|
83082
|
+
var StyledQuickFilterLabel = styled3.div`
|
|
83083
|
+
${StyledSelectButton} {
|
|
83084
|
+
width: auto;
|
|
83085
|
+
max-width: 380px;
|
|
83086
|
+
${({ $enabled }) => $enabled && css$1`
|
|
83087
|
+
background: ${colors.blue96};
|
|
83088
|
+
border-color: ${colors.blue96};
|
|
83089
|
+
font-weight: ${typographyWeights.semibold};
|
|
83090
|
+
&:hover {
|
|
83091
|
+
background: ${colors.blue90};
|
|
83092
|
+
border-color: ${colors.blue90};
|
|
83093
|
+
}
|
|
83094
|
+
${StyledSelectButtonLabel} {
|
|
83095
|
+
color: ${colors.blue45};
|
|
83096
|
+
}
|
|
83097
|
+
${StyledButton} {
|
|
83098
|
+
color: ${colors.blue45};
|
|
83099
|
+
&:hover {
|
|
83100
|
+
background: white;
|
|
83101
|
+
}
|
|
83102
|
+
}
|
|
83103
|
+
${StyledSelectArrow} {
|
|
83104
|
+
svg {
|
|
83105
|
+
fill: ${colors.blue45};
|
|
83106
|
+
}
|
|
83107
|
+
}
|
|
83108
|
+
`}
|
|
82983
83109
|
}
|
|
82984
|
-
|
|
83110
|
+
`;
|
|
83111
|
+
|
|
83112
|
+
// src/QuickFilterRenderers/DateQuickFilterRenderer.tsx
|
|
83113
|
+
function getPlacement2(currentSelectionType, position) {
|
|
83114
|
+
if (currentSelectionType === "single") {
|
|
83115
|
+
return "bottom-left";
|
|
83116
|
+
}
|
|
83117
|
+
if (position === "start") {
|
|
83118
|
+
return "bottom-left";
|
|
83119
|
+
}
|
|
83120
|
+
return "bottom-right";
|
|
83121
|
+
}
|
|
83122
|
+
var OptionalDateTimeProvider2 = ({ timeZone, children }) => {
|
|
83123
|
+
return timeZone ? /* @__PURE__ */ React76.createElement(DateTimeProvider, { timeZone }, children) : /* @__PURE__ */ React76.createElement(React76.Fragment, null, children);
|
|
83124
|
+
};
|
|
83125
|
+
var DateFilterSelect2 = React76.forwardRef(
|
|
83126
|
+
({
|
|
83127
|
+
afterHide,
|
|
83128
|
+
selectionType = "either",
|
|
83129
|
+
headerName,
|
|
83130
|
+
disabled,
|
|
83131
|
+
onChange,
|
|
83132
|
+
position,
|
|
83133
|
+
selectedValue,
|
|
83134
|
+
setSelectionType = () => {
|
|
83135
|
+
}
|
|
83136
|
+
}, ref) => {
|
|
83137
|
+
const dateTime = useDateTime();
|
|
83138
|
+
const { start, end } = selectedValue;
|
|
83139
|
+
const selectedDate = (position === "start" ? start : end) ?? void 0;
|
|
83140
|
+
const [displayed, setDisplayed2] = React76.useState(
|
|
83141
|
+
// @ts-ignore
|
|
83142
|
+
selectedDate || dateTime.newDate()
|
|
83143
|
+
);
|
|
83144
|
+
React76.useEffect(() => {
|
|
83145
|
+
if (isDate(start) && !isDate(end) && position === "end") {
|
|
83146
|
+
setDisplayed2(start);
|
|
83147
|
+
}
|
|
83148
|
+
if (!isDate(start) && isDate(end) && position === "start") {
|
|
83149
|
+
setDisplayed2(end);
|
|
83150
|
+
}
|
|
83151
|
+
}, [position, selectedValue]);
|
|
83152
|
+
function onClear() {
|
|
83153
|
+
onChange(null, position);
|
|
83154
|
+
}
|
|
83155
|
+
const clearRef = React76.useRef(null);
|
|
83156
|
+
const monthRef = React76.useRef(null);
|
|
83157
|
+
const yearRef = React76.useRef(null);
|
|
83158
|
+
const overlay = /* @__PURE__ */ React76.createElement(
|
|
83159
|
+
DateFilterOverlay,
|
|
83160
|
+
{
|
|
83161
|
+
displayDate: displayed,
|
|
83162
|
+
selectionType,
|
|
83163
|
+
monthRef,
|
|
83164
|
+
onSelect: (date) => {
|
|
83165
|
+
onChange(date, position);
|
|
83166
|
+
},
|
|
83167
|
+
position,
|
|
83168
|
+
selectedValue,
|
|
83169
|
+
setDisplayDate: setDisplayed2,
|
|
83170
|
+
setSelectionType,
|
|
83171
|
+
yearRef
|
|
83172
|
+
}
|
|
83173
|
+
);
|
|
82985
83174
|
return /* @__PURE__ */ React76.createElement(
|
|
82986
|
-
|
|
83175
|
+
OverlayTrigger,
|
|
82987
83176
|
{
|
|
82988
|
-
|
|
83177
|
+
afterHide,
|
|
83178
|
+
autoFocus: true,
|
|
83179
|
+
beforeShow: (e) => {
|
|
83180
|
+
if (isEventSource(clearRef, e)) {
|
|
83181
|
+
return false;
|
|
83182
|
+
}
|
|
83183
|
+
return true;
|
|
83184
|
+
},
|
|
83185
|
+
clickOutsideIgnoreRefs: [monthRef, yearRef],
|
|
83186
|
+
overlay,
|
|
83187
|
+
placement: getPlacement2(selectionType, position),
|
|
83188
|
+
ref,
|
|
83189
|
+
restoreFocusOnHide: true,
|
|
83190
|
+
role: "dialog"
|
|
82989
83191
|
},
|
|
82990
83192
|
/* @__PURE__ */ React76.createElement(
|
|
82991
|
-
|
|
83193
|
+
DateQuickFilterLabel,
|
|
82992
83194
|
{
|
|
82993
|
-
headerName
|
|
82994
|
-
|
|
83195
|
+
headerName,
|
|
83196
|
+
onClear,
|
|
83197
|
+
value: selectedDate,
|
|
83198
|
+
disabled
|
|
82995
83199
|
}
|
|
82996
83200
|
)
|
|
82997
83201
|
);
|
|
82998
83202
|
}
|
|
82999
|
-
|
|
83000
|
-
|
|
83001
|
-
|
|
83002
|
-
|
|
83003
|
-
|
|
83004
|
-
|
|
83005
|
-
|
|
83006
|
-
|
|
83007
|
-
|
|
83008
|
-
|
|
83009
|
-
|
|
83010
|
-
|
|
83203
|
+
);
|
|
83204
|
+
function DateFilter3({
|
|
83205
|
+
// TODO: talk to design about potential loading UX for this.
|
|
83206
|
+
// core DateSelect doesn't have it
|
|
83207
|
+
// loading,
|
|
83208
|
+
headerName,
|
|
83209
|
+
onChange,
|
|
83210
|
+
selectionType = "either",
|
|
83211
|
+
value,
|
|
83212
|
+
disabled,
|
|
83213
|
+
...props
|
|
83214
|
+
}) {
|
|
83215
|
+
const [selectedValue, setSelectedValue] = React76.useState({
|
|
83216
|
+
type: selectionType === "either" ? "range" : selectionType
|
|
83217
|
+
});
|
|
83218
|
+
React76.useEffect(() => {
|
|
83219
|
+
const parsedValue = value.map((date) => {
|
|
83220
|
+
if (isDate(date)) {
|
|
83221
|
+
return date;
|
|
83222
|
+
}
|
|
83223
|
+
return parseISO(String(date));
|
|
83224
|
+
});
|
|
83225
|
+
const type = isSameDay(parsedValue[0], parsedValue[1]) ? "single" : "range";
|
|
83226
|
+
setSelectedValue({ type, start: parsedValue[0], end: parsedValue[1] });
|
|
83227
|
+
}, [value]);
|
|
83228
|
+
const dateRangeEndDateRef = React76.useRef(null);
|
|
83229
|
+
function dateFilterOnChange(date, position) {
|
|
83230
|
+
const newValue = getValueFromSelection(selectedValue, date, position);
|
|
83231
|
+
setSelectedValue(newValue);
|
|
83232
|
+
if (isValidDateSelection(newValue)) {
|
|
83233
|
+
onChange(
|
|
83234
|
+
newValue.start || newValue.end ? [
|
|
83235
|
+
newValue.start,
|
|
83236
|
+
newValue.type === "single" ? newValue.start : newValue.end
|
|
83237
|
+
] : []
|
|
83238
|
+
);
|
|
83011
83239
|
}
|
|
83012
|
-
return `${columnDefinition?.headerName}: (${filterValue.length})`;
|
|
83013
|
-
}
|
|
83014
|
-
return columnDefinition?.headerName;
|
|
83015
|
-
}
|
|
83016
|
-
var ensureArray = (input) => {
|
|
83017
|
-
if (input === null) {
|
|
83018
|
-
return [];
|
|
83019
|
-
}
|
|
83020
|
-
return Array.isArray(input) ? input : [input];
|
|
83021
|
-
};
|
|
83022
|
-
var FiltersPanelToggleButton = ({ hasSelectedFilters, hasDefinedFilters }) => {
|
|
83023
|
-
const I18n = useI18nContext();
|
|
83024
|
-
const { contextPanel } = useInternalTableContext();
|
|
83025
|
-
const hasNoContent = useTableHasNoContent();
|
|
83026
|
-
if (!hasDefinedFilters) {
|
|
83027
|
-
return null;
|
|
83028
83240
|
}
|
|
83029
|
-
|
|
83030
|
-
|
|
83031
|
-
|
|
83032
|
-
featureI18nKey: "featureFilter",
|
|
83033
|
-
enabled: hasNoContent
|
|
83241
|
+
const onSelectionTypeChange = React76.useCallback(
|
|
83242
|
+
(newSelectionType) => {
|
|
83243
|
+
setSelectedValue({ type: newSelectionType });
|
|
83034
83244
|
},
|
|
83035
|
-
|
|
83036
|
-
ToggleButton,
|
|
83037
|
-
{
|
|
83038
|
-
"data-qa": "data-table-show-filters-button",
|
|
83039
|
-
disabled: hasNoContent,
|
|
83040
|
-
icon: /* @__PURE__ */ React76.createElement(FilterIcon, null),
|
|
83041
|
-
onClick: () => {
|
|
83042
|
-
if (contextPanel.content === "filters") {
|
|
83043
|
-
contextPanel.hide();
|
|
83044
|
-
} else {
|
|
83045
|
-
contextPanel.show("filters");
|
|
83046
|
-
}
|
|
83047
|
-
},
|
|
83048
|
-
selected: contextPanel.content === "filters"
|
|
83049
|
-
},
|
|
83050
|
-
hasSelectedFilters ? I18n.t("dataTable.filters.moreFilters") : I18n.t("dataTable.filters.filters")
|
|
83051
|
-
)
|
|
83245
|
+
[setSelectedValue]
|
|
83052
83246
|
);
|
|
83053
|
-
|
|
83054
|
-
|
|
83055
|
-
|
|
83056
|
-
|
|
83057
|
-
|
|
83058
|
-
|
|
83059
|
-
|
|
83247
|
+
function dateRangeAfterHide() {
|
|
83248
|
+
if (selectedValue.type === "range" && isDate(selectedValue.start) && !isDate(selectedValue.end)) {
|
|
83249
|
+
dateRangeEndDateRef.current?.click();
|
|
83250
|
+
}
|
|
83251
|
+
return true;
|
|
83252
|
+
}
|
|
83253
|
+
return /* @__PURE__ */ React76.createElement(FlexList, { space: "xs", "data-qa": props["data-qa"] }, /* @__PURE__ */ React76.createElement(
|
|
83254
|
+
DateFilterSelect2,
|
|
83060
83255
|
{
|
|
83061
|
-
|
|
83062
|
-
|
|
83256
|
+
afterHide: dateRangeAfterHide,
|
|
83257
|
+
headerName,
|
|
83258
|
+
onChange: dateFilterOnChange,
|
|
83259
|
+
position: "start",
|
|
83260
|
+
selectedValue,
|
|
83261
|
+
selectionType,
|
|
83262
|
+
setSelectionType: onSelectionTypeChange,
|
|
83263
|
+
disabled
|
|
83063
83264
|
}
|
|
83064
|
-
)
|
|
83065
|
-
|
|
83066
|
-
var ClientSideFiltersPanelToggleButton = () => {
|
|
83067
|
-
const { filterState } = useInternalTableContext();
|
|
83068
|
-
const activeFilters = React76.useMemo(() => {
|
|
83069
|
-
return filterState.allAvailableFilters.filter(({ instance }) => {
|
|
83070
|
-
return instance.isFilterActive();
|
|
83071
|
-
});
|
|
83072
|
-
}, [filterState.allAvailableFilters]);
|
|
83073
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83074
|
-
FiltersPanelToggleButton,
|
|
83265
|
+
), selectedValue.type === "range" && /* @__PURE__ */ React76.createElement(
|
|
83266
|
+
DateFilterSelect2,
|
|
83075
83267
|
{
|
|
83076
|
-
|
|
83077
|
-
|
|
83268
|
+
headerName,
|
|
83269
|
+
onChange: dateFilterOnChange,
|
|
83270
|
+
position: "end",
|
|
83271
|
+
ref: dateRangeEndDateRef,
|
|
83272
|
+
selectedValue,
|
|
83273
|
+
selectionType,
|
|
83274
|
+
setSelectionType: onSelectionTypeChange,
|
|
83275
|
+
disabled
|
|
83078
83276
|
}
|
|
83079
|
-
);
|
|
83080
|
-
}
|
|
83081
|
-
|
|
83082
|
-
|
|
83083
|
-
|
|
83084
|
-
|
|
83085
|
-
|
|
83277
|
+
));
|
|
83278
|
+
}
|
|
83279
|
+
function ServerSideQuickDateFilterRenderer({
|
|
83280
|
+
columnDefinition,
|
|
83281
|
+
disabled
|
|
83282
|
+
}) {
|
|
83283
|
+
const { onChange, value = [] } = useServerSideFilter({
|
|
83284
|
+
columnDefinition
|
|
83285
|
+
});
|
|
83286
|
+
const colDef = columnDefinition;
|
|
83287
|
+
return /* @__PURE__ */ React76.createElement(OptionalDateTimeProvider2, { timeZone: colDef.timeZone }, /* @__PURE__ */ React76.createElement(
|
|
83288
|
+
DateFilter3,
|
|
83086
83289
|
{
|
|
83087
|
-
|
|
83088
|
-
|
|
83089
|
-
|
|
83090
|
-
|
|
83091
|
-
|
|
83092
|
-
|
|
83093
|
-
|
|
83094
|
-
|
|
83095
|
-
|
|
83096
|
-
|
|
83097
|
-
|
|
83098
|
-
|
|
83099
|
-
|
|
83100
|
-
|
|
83101
|
-
|
|
83102
|
-
|
|
83290
|
+
selectionType: colDef.filterProps?.selectionType ?? "either",
|
|
83291
|
+
headerName: colDef.headerName,
|
|
83292
|
+
disabled,
|
|
83293
|
+
onChange: (selected) => {
|
|
83294
|
+
onChange(
|
|
83295
|
+
selected.map((date) => {
|
|
83296
|
+
return date ? {
|
|
83297
|
+
// future extensions can go here (month, day, year keys etc)
|
|
83298
|
+
date
|
|
83299
|
+
} : (
|
|
83300
|
+
// TODO: refactor out date-specific getId stuff from useServerSideFilterStorage
|
|
83301
|
+
date
|
|
83302
|
+
);
|
|
83303
|
+
})
|
|
83304
|
+
);
|
|
83305
|
+
},
|
|
83306
|
+
value: value.map((option) => option ? option.date : option)
|
|
83307
|
+
}
|
|
83308
|
+
));
|
|
83309
|
+
}
|
|
83310
|
+
var QuickDateFilterRenderer = (props) => {
|
|
83311
|
+
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83312
|
+
if (onServerSideDataRequest) {
|
|
83313
|
+
return /* @__PURE__ */ React76.createElement(ServerSideQuickDateFilterRenderer, { ...props });
|
|
83314
|
+
}
|
|
83315
|
+
logger.error(
|
|
83316
|
+
"Warning: Date Filters are currently only implemented for the serverside row model"
|
|
83103
83317
|
);
|
|
83318
|
+
return null;
|
|
83104
83319
|
};
|
|
83105
|
-
var
|
|
83106
|
-
|
|
83107
|
-
|
|
83320
|
+
var dateInputLocales = {
|
|
83321
|
+
"fr-CA": {
|
|
83322
|
+
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83323
|
+
},
|
|
83324
|
+
"fr-FR": {
|
|
83325
|
+
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83326
|
+
},
|
|
83327
|
+
es: {
|
|
83328
|
+
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83329
|
+
},
|
|
83330
|
+
"es-ES": {
|
|
83331
|
+
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83332
|
+
},
|
|
83333
|
+
pt: {
|
|
83334
|
+
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83335
|
+
},
|
|
83336
|
+
"is-IS": {
|
|
83337
|
+
placeholders: { day: "dd", month: "mm", year: "\xE1\xE1\xE1\xE1" }
|
|
83338
|
+
},
|
|
83339
|
+
"de-DE": {
|
|
83340
|
+
placeholders: { day: "tt", month: "MM", year: "jjjj" }
|
|
83108
83341
|
}
|
|
83109
|
-
|
|
83110
|
-
var
|
|
83111
|
-
const
|
|
83112
|
-
const
|
|
83113
|
-
const
|
|
83114
|
-
|
|
83115
|
-
|
|
83116
|
-
|
|
83117
|
-
|
|
83118
|
-
|
|
83119
|
-
|
|
83120
|
-
|
|
83121
|
-
return { ...acc, quickFilters: [...acc.quickFilters, filter] };
|
|
83122
|
-
} else if (filter.instance.isFilterActive()) {
|
|
83123
|
-
return { ...acc, tokens: [...acc.tokens, filter] };
|
|
83124
|
-
}
|
|
83125
|
-
return acc;
|
|
83126
|
-
},
|
|
83342
|
+
};
|
|
83343
|
+
var DateQuickFilterLabel = React76.forwardRef(({ headerName, onClear, value, disabled }, ref) => {
|
|
83344
|
+
const dateTime = useDateTime();
|
|
83345
|
+
const i18n = useI18nContext();
|
|
83346
|
+
const placeholders = dateInputLocales[i18n.locale]?.placeholders || {
|
|
83347
|
+
day: "dd",
|
|
83348
|
+
month: "mm",
|
|
83349
|
+
year: "yyyy"
|
|
83350
|
+
};
|
|
83351
|
+
if (value !== void 0 && isDate(value)) {
|
|
83352
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83353
|
+
QuickFilterLabel,
|
|
83127
83354
|
{
|
|
83128
|
-
|
|
83129
|
-
|
|
83355
|
+
enabled: true,
|
|
83356
|
+
disabled,
|
|
83357
|
+
label: `${headerName}: ${dateTime.format(value, "numeric-date")}`,
|
|
83358
|
+
onClear,
|
|
83359
|
+
ref
|
|
83130
83360
|
}
|
|
83131
83361
|
);
|
|
83132
|
-
}
|
|
83133
|
-
|
|
83134
|
-
|
|
83135
|
-
FlexList,
|
|
83362
|
+
}
|
|
83363
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83364
|
+
QuickFilterLabel,
|
|
83136
83365
|
{
|
|
83137
|
-
|
|
83138
|
-
|
|
83139
|
-
|
|
83140
|
-
|
|
83141
|
-
|
|
83142
|
-
},
|
|
83143
|
-
quickFilters.map((filter) => {
|
|
83144
|
-
const colDef = getColumnDefinition(filter.field);
|
|
83145
|
-
const QuickFilter = colDef?.quickFilterRenderer;
|
|
83146
|
-
if (!colDef || !QuickFilter) {
|
|
83147
|
-
return null;
|
|
83148
|
-
}
|
|
83149
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83150
|
-
EmptyResultsControlTooltip,
|
|
83151
|
-
{
|
|
83152
|
-
featureI18nKey: "featureQuickFilter",
|
|
83153
|
-
enabled: hasNoContent
|
|
83154
|
-
},
|
|
83155
|
-
/* @__PURE__ */ React76.createElement(
|
|
83156
|
-
QuickFilter,
|
|
83157
|
-
{
|
|
83158
|
-
key: filter.field,
|
|
83159
|
-
filter,
|
|
83160
|
-
columnDefinition: colDef,
|
|
83161
|
-
disabled: hasNoContent,
|
|
83162
|
-
onChange: (value) => tableRef?.current?.applyListFilter(filter.field, value),
|
|
83163
|
-
onRemove: () => tableRef?.current?.removeFilter(filter.field),
|
|
83164
|
-
overlayMatchesTriggerWidth
|
|
83165
|
-
}
|
|
83166
|
-
)
|
|
83167
|
-
);
|
|
83168
|
-
}),
|
|
83169
|
-
tokens.map((filter) => {
|
|
83170
|
-
const colDef = getColumnDefinition(filter.field);
|
|
83171
|
-
if (!colDef) {
|
|
83172
|
-
return null;
|
|
83173
|
-
}
|
|
83174
|
-
return /* @__PURE__ */ React76.createElement(StyledFilterTokenWrapper, { key: filter.field }, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken, null, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken.Label, null, getFilterTokenText(colDef, filter.filterValues)), /* @__PURE__ */ React76.createElement(
|
|
83175
|
-
UNSAFE_FilterToken.Remove,
|
|
83176
|
-
{
|
|
83177
|
-
onClick: () => tableRef?.current?.removeFilter(filter.field)
|
|
83178
|
-
}
|
|
83179
|
-
)));
|
|
83180
|
-
})
|
|
83366
|
+
enabled: false,
|
|
83367
|
+
disabled,
|
|
83368
|
+
label: `${headerName}: ${getDatePlaceholder(i18n.locale, placeholders)}`,
|
|
83369
|
+
ref
|
|
83370
|
+
}
|
|
83181
83371
|
);
|
|
83372
|
+
});
|
|
83373
|
+
var DateQuickFilterRenderer_default = QuickDateFilterRenderer;
|
|
83374
|
+
var defaultGetId2 = (option) => option?.id;
|
|
83375
|
+
var defaultGetLabel2 = (option) => {
|
|
83376
|
+
return option?.label ?? option?.name ?? option;
|
|
83182
83377
|
};
|
|
83183
|
-
var
|
|
83184
|
-
|
|
83185
|
-
|
|
83186
|
-
|
|
83187
|
-
|
|
83188
|
-
|
|
83189
|
-
|
|
83190
|
-
|
|
83191
|
-
|
|
83192
|
-
|
|
83193
|
-
|
|
83194
|
-
|
|
83195
|
-
const
|
|
83196
|
-
|
|
83197
|
-
|
|
83198
|
-
|
|
83199
|
-
|
|
83200
|
-
|
|
83201
|
-
|
|
83202
|
-
|
|
83203
|
-
|
|
83204
|
-
|
|
83205
|
-
|
|
83206
|
-
|
|
83207
|
-
|
|
83208
|
-
|
|
83209
|
-
|
|
83210
|
-
|
|
83211
|
-
|
|
83212
|
-
|
|
83213
|
-
|
|
83214
|
-
|
|
83215
|
-
|
|
83216
|
-
|
|
83378
|
+
var useSuperSelectOptionAsValueWorkaround = ({
|
|
83379
|
+
originValue,
|
|
83380
|
+
originOptions,
|
|
83381
|
+
getId: getId3 = defaultGetId2,
|
|
83382
|
+
loading
|
|
83383
|
+
}) => {
|
|
83384
|
+
const isValueFromOptions = React76.useRef(false);
|
|
83385
|
+
const getValueFromOptions = () => {
|
|
83386
|
+
const valueIds = originValue.map(getId3);
|
|
83387
|
+
isValueFromOptions.current = true;
|
|
83388
|
+
return originOptions.filter((option) => valueIds.includes(getId3(option)));
|
|
83389
|
+
};
|
|
83390
|
+
const hasOptions = originOptions.length > 0 && !loading;
|
|
83391
|
+
const hasValue = originValue?.length > 0;
|
|
83392
|
+
const options = !hasOptions && hasValue ? originValue : originOptions;
|
|
83393
|
+
const value = !hasOptions ? originValue : isValueFromOptions.current ? originValue : getValueFromOptions();
|
|
83394
|
+
return {
|
|
83395
|
+
options,
|
|
83396
|
+
value,
|
|
83397
|
+
getOptionValue: (option) => option
|
|
83398
|
+
};
|
|
83399
|
+
};
|
|
83400
|
+
var LocationQuickFilterOverlay = React76.forwardRef(
|
|
83401
|
+
({
|
|
83402
|
+
getId: getId3,
|
|
83403
|
+
getLabel: getLabel3,
|
|
83404
|
+
loading,
|
|
83405
|
+
onSelect: _onSelect,
|
|
83406
|
+
onSelectAll,
|
|
83407
|
+
onSelectSublocations,
|
|
83408
|
+
enableSublocations,
|
|
83409
|
+
selectState,
|
|
83410
|
+
options,
|
|
83411
|
+
disabledOptions,
|
|
83412
|
+
columnDefinition,
|
|
83413
|
+
value
|
|
83414
|
+
}, ref) => {
|
|
83415
|
+
if (value && !Array.isArray(value)) {
|
|
83416
|
+
logger.warn(
|
|
83417
|
+
"a value was set that is not compatible with this LocationQuickFilterRenderer"
|
|
83418
|
+
);
|
|
83419
|
+
return null;
|
|
83420
|
+
}
|
|
83421
|
+
const [items, setItems] = React76.useState(options);
|
|
83422
|
+
const [searching, setSearching] = React76.useState(false);
|
|
83423
|
+
const menuRef = React76.useRef(null);
|
|
83424
|
+
const { menuProps, menuNavigationTriggerProps } = UNSAFE_useMenuImperativeControlNavigation(menuRef);
|
|
83425
|
+
const I18n = useI18nContext();
|
|
83426
|
+
const selectAllOption = {
|
|
83427
|
+
label: I18n.t("dataTable.filters.locationFilter.selectAll"),
|
|
83428
|
+
id: "select_all"
|
|
83429
|
+
};
|
|
83430
|
+
const includeSublocationOption = {
|
|
83431
|
+
label: I18n.t("dataTable.filters.locationFilter.includeSublocations"),
|
|
83432
|
+
id: "include_sublocations"
|
|
83433
|
+
};
|
|
83434
|
+
const onSelect = (selection) => {
|
|
83435
|
+
if (selection.item.id === selectAllOption.id) {
|
|
83436
|
+
return onSelectAll();
|
|
83217
83437
|
}
|
|
83218
|
-
|
|
83219
|
-
|
|
83220
|
-
|
|
83221
|
-
return null;
|
|
83222
|
-
}
|
|
83223
|
-
const isEmpty2 = quickFilterNames.length === 0 && tokenNames.length === 0;
|
|
83224
|
-
return isEmpty2 ? null : /* @__PURE__ */ React76.createElement(
|
|
83225
|
-
FlexList,
|
|
83226
|
-
{
|
|
83227
|
-
padding: "xs none",
|
|
83228
|
-
size: "none",
|
|
83229
|
-
alignItems: "center",
|
|
83230
|
-
wrap: "wrap",
|
|
83231
|
-
gap: "sm",
|
|
83232
|
-
"data-qa": "data-table-quick-filters"
|
|
83233
|
-
},
|
|
83234
|
-
quickFilterNames.map((fieldName) => {
|
|
83235
|
-
const colDef = getColumnDefinition(fieldName);
|
|
83236
|
-
const QuickFilter = colDef?.quickFilterRenderer;
|
|
83237
|
-
if (!colDef || !QuickFilter) {
|
|
83238
|
-
return null;
|
|
83438
|
+
if (selection.item.id === includeSublocationOption.id) {
|
|
83439
|
+
_onSelect(selection);
|
|
83440
|
+
return onSelectSublocations();
|
|
83239
83441
|
}
|
|
83240
|
-
return
|
|
83241
|
-
|
|
83442
|
+
return _onSelect(selection);
|
|
83443
|
+
};
|
|
83444
|
+
function defaultOnSearch(e) {
|
|
83445
|
+
if (e.target.value === "") {
|
|
83446
|
+
setSearching(false);
|
|
83447
|
+
setItems(options);
|
|
83448
|
+
} else {
|
|
83449
|
+
setSearching(true);
|
|
83450
|
+
setItems(
|
|
83451
|
+
options.filter(
|
|
83452
|
+
(item) => getLabel3(item).toLowerCase().includes(e.target.value.toLowerCase())
|
|
83453
|
+
)
|
|
83454
|
+
);
|
|
83455
|
+
}
|
|
83456
|
+
}
|
|
83457
|
+
const _onSearch = columnDefinition.filterProps.onSearch || defaultOnSearch;
|
|
83458
|
+
React76.useEffect(() => {
|
|
83459
|
+
menuRef.current?.highlightSuggested();
|
|
83460
|
+
}, []);
|
|
83461
|
+
return /* @__PURE__ */ React76.createElement(Card, { ref }, /* @__PURE__ */ React76.createElement(
|
|
83462
|
+
UNSAFE_Menu,
|
|
83463
|
+
{
|
|
83464
|
+
...menuProps,
|
|
83465
|
+
multiple: true,
|
|
83466
|
+
role: "listbox",
|
|
83467
|
+
ref: menuRef,
|
|
83468
|
+
onSelect,
|
|
83469
|
+
className: locationFilterStyles_default.locationFilterMenu
|
|
83470
|
+
},
|
|
83471
|
+
/* @__PURE__ */ React76.createElement(
|
|
83472
|
+
UNSAFE_Menu.Search,
|
|
83242
83473
|
{
|
|
83243
|
-
|
|
83244
|
-
|
|
83474
|
+
...menuNavigationTriggerProps,
|
|
83475
|
+
onChange: _onSearch
|
|
83476
|
+
}
|
|
83477
|
+
),
|
|
83478
|
+
/* @__PURE__ */ React76.createElement(UNSAFE_Menu.Options, null, !searching && /* @__PURE__ */ React76.createElement(
|
|
83479
|
+
Box,
|
|
83480
|
+
{
|
|
83481
|
+
className: locationFilterStyles_default.controlsContainer,
|
|
83482
|
+
...UNSAFE_menuItemsWrapperAttribute
|
|
83245
83483
|
},
|
|
83246
83484
|
/* @__PURE__ */ React76.createElement(
|
|
83247
|
-
|
|
83485
|
+
UNSAFE_Menu.CheckboxItem,
|
|
83248
83486
|
{
|
|
83249
|
-
key:
|
|
83250
|
-
|
|
83251
|
-
|
|
83252
|
-
|
|
83253
|
-
|
|
83487
|
+
key: getId3(includeSublocationOption),
|
|
83488
|
+
item: includeSublocationOption,
|
|
83489
|
+
selected: enableSublocations
|
|
83490
|
+
},
|
|
83491
|
+
getLabel3(includeSublocationOption)
|
|
83492
|
+
),
|
|
83493
|
+
/* @__PURE__ */ React76.createElement(
|
|
83494
|
+
UNSAFE_Menu.CheckboxItem,
|
|
83495
|
+
{
|
|
83496
|
+
key: getId3(selectAllOption),
|
|
83497
|
+
item: selectAllOption,
|
|
83498
|
+
selected: selectState === "all",
|
|
83499
|
+
indeterminate: selectState === "partial"
|
|
83500
|
+
},
|
|
83501
|
+
getLabel3(selectAllOption)
|
|
83254
83502
|
)
|
|
83255
|
-
)
|
|
83256
|
-
|
|
83257
|
-
|
|
83258
|
-
|
|
83259
|
-
|
|
83260
|
-
|
|
83261
|
-
|
|
83262
|
-
|
|
83263
|
-
|
|
83264
|
-
|
|
83265
|
-
|
|
83266
|
-
|
|
83267
|
-
|
|
83268
|
-
|
|
83269
|
-
|
|
83270
|
-
onClick: () => onClearFilter(fieldName)
|
|
83271
|
-
}
|
|
83272
|
-
)));
|
|
83273
|
-
})
|
|
83274
|
-
);
|
|
83275
|
-
};
|
|
83276
|
-
var QuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
83277
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83278
|
-
if (onServerSideDataRequest) {
|
|
83279
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83280
|
-
ServerSideQuickFilters,
|
|
83281
|
-
{
|
|
83282
|
-
overlayMatchesTriggerWidth
|
|
83283
|
-
}
|
|
83284
|
-
);
|
|
83285
|
-
}
|
|
83286
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83287
|
-
ClientSideQuickFilters,
|
|
83288
|
-
{
|
|
83289
|
-
overlayMatchesTriggerWidth
|
|
83290
|
-
}
|
|
83291
|
-
);
|
|
83292
|
-
};
|
|
83293
|
-
var FiltersPanelButton = () => {
|
|
83294
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83295
|
-
if (onServerSideDataRequest) {
|
|
83296
|
-
return /* @__PURE__ */ React76.createElement(ServerSideFiltersPanelToggleButton, null);
|
|
83503
|
+
), !loading && items.map((item, i) => {
|
|
83504
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83505
|
+
UNSAFE_Menu.CheckboxItem,
|
|
83506
|
+
{
|
|
83507
|
+
key: getId3(item),
|
|
83508
|
+
item,
|
|
83509
|
+
selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
|
|
83510
|
+
suggested: i === 0,
|
|
83511
|
+
disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
|
|
83512
|
+
},
|
|
83513
|
+
getLabel3(item)
|
|
83514
|
+
);
|
|
83515
|
+
})),
|
|
83516
|
+
loading && /* @__PURE__ */ React76.createElement(UNSAFE_Menu.Footer, null, /* @__PURE__ */ React76.createElement(Flex, { justifyContent: "center" }, /* @__PURE__ */ React76.createElement(Spinner$1, { size: "sm" })))
|
|
83517
|
+
));
|
|
83297
83518
|
}
|
|
83298
|
-
|
|
83299
|
-
|
|
83300
|
-
|
|
83519
|
+
);
|
|
83520
|
+
var LocationQuickFilterRenderer = ({
|
|
83521
|
+
columnDefinition,
|
|
83522
|
+
disabled
|
|
83523
|
+
}) => {
|
|
83301
83524
|
const {
|
|
83302
|
-
|
|
83303
|
-
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
|
|
83307
|
-
|
|
83308
|
-
const
|
|
83309
|
-
|
|
83310
|
-
|
|
83311
|
-
|
|
83312
|
-
|
|
83313
|
-
|
|
83314
|
-
);
|
|
83315
|
-
const
|
|
83316
|
-
|
|
83317
|
-
|
|
83318
|
-
|
|
83319
|
-
return
|
|
83320
|
-
}
|
|
83321
|
-
|
|
83322
|
-
|
|
83323
|
-
|
|
83324
|
-
|
|
83525
|
+
options: originOptions,
|
|
83526
|
+
value: originValue = [],
|
|
83527
|
+
onChange,
|
|
83528
|
+
getOptions,
|
|
83529
|
+
loading
|
|
83530
|
+
} = useServerSideFilter({ columnDefinition });
|
|
83531
|
+
const { options, value } = useSuperSelectOptionAsValueWorkaround({
|
|
83532
|
+
originOptions,
|
|
83533
|
+
originValue,
|
|
83534
|
+
loading,
|
|
83535
|
+
getId: columnDefinition.filterProps?.getId
|
|
83536
|
+
});
|
|
83537
|
+
const I18n = useI18nContext();
|
|
83538
|
+
const getId3 = columnDefinition.filterProps?.getId || defaultGetId2;
|
|
83539
|
+
const getLabel3 = columnDefinition.filterProps?.getLabel || defaultGetLabel2;
|
|
83540
|
+
const determineSelectedState = (selection) => {
|
|
83541
|
+
if (options.length === selection.length) {
|
|
83542
|
+
return "all";
|
|
83543
|
+
}
|
|
83544
|
+
if (selection.length && (options.length > selection.length || options.length < selection.length)) {
|
|
83545
|
+
return "partial";
|
|
83546
|
+
}
|
|
83547
|
+
if (selection.length === 0) {
|
|
83548
|
+
return "none";
|
|
83549
|
+
}
|
|
83550
|
+
return "none";
|
|
83551
|
+
};
|
|
83552
|
+
const ids = React76.useMemo(() => value.map(({ id }) => id), [value]);
|
|
83553
|
+
const [selectedValueIds, setSelectedValueIds] = React76.useState(ids);
|
|
83554
|
+
const [selectState, setSelectState] = React76.useState(
|
|
83555
|
+
determineSelectedState(value)
|
|
83325
83556
|
);
|
|
83326
|
-
const
|
|
83327
|
-
|
|
83328
|
-
|
|
83329
|
-
|
|
83330
|
-
|
|
83331
|
-
|
|
83332
|
-
|
|
83557
|
+
const [disabledValues, setDisabledValues] = React76.useState([]);
|
|
83558
|
+
const [enableSublocations, setEnableSublocations] = React76.useState(false);
|
|
83559
|
+
const onSelectSublocations = React76.useCallback(() => {
|
|
83560
|
+
if (enableSublocations) {
|
|
83561
|
+
setDisabledValues([]);
|
|
83562
|
+
} else {
|
|
83563
|
+
const newDisabledValues = [];
|
|
83564
|
+
value.forEach((location) => {
|
|
83565
|
+
newDisabledValues.push(...findSublocations(location));
|
|
83333
83566
|
});
|
|
83334
|
-
|
|
83335
|
-
|
|
83336
|
-
|
|
83567
|
+
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
83568
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
83569
|
+
);
|
|
83570
|
+
setDisabledValues(uniqDisabledValues);
|
|
83571
|
+
}
|
|
83572
|
+
setEnableSublocations(!enableSublocations);
|
|
83573
|
+
}, [enableSublocations, value, selectedValueIds, options]);
|
|
83574
|
+
const onSelectAll = React76.useCallback(() => {
|
|
83575
|
+
if (selectState === "none" || selectState === "partial") {
|
|
83576
|
+
setSelectState("all");
|
|
83577
|
+
setSelectedValueIds(options.map(({ id }) => id));
|
|
83578
|
+
onChange(options);
|
|
83579
|
+
}
|
|
83580
|
+
if (selectState === "all") {
|
|
83581
|
+
setSelectState("none");
|
|
83582
|
+
setSelectedValueIds([]);
|
|
83583
|
+
onChange([]);
|
|
83584
|
+
}
|
|
83585
|
+
}, [options, selectState, selectedValueIds]);
|
|
83586
|
+
const onSelect = (selection) => {
|
|
83587
|
+
if (selection.item.id === "select_all") {
|
|
83588
|
+
return;
|
|
83589
|
+
}
|
|
83590
|
+
if (selection.item.id === "include_sublocations") {
|
|
83591
|
+
return onChange(
|
|
83592
|
+
value.map((item) => ({
|
|
83593
|
+
...item,
|
|
83594
|
+
sublocations: enableSublocations ? [] : findSublocations(item)
|
|
83595
|
+
}))
|
|
83596
|
+
);
|
|
83597
|
+
}
|
|
83598
|
+
let newSelections = [];
|
|
83599
|
+
if (selectedValueIds.includes(getId3(selection.item))) {
|
|
83600
|
+
newSelections = removeSelections(selection.item, value);
|
|
83601
|
+
} else {
|
|
83602
|
+
newSelections = [...value, selection.item];
|
|
83603
|
+
const sublocationsToDisable = handleSelectSublocations(selection.item);
|
|
83604
|
+
const newDisabledValues = [
|
|
83605
|
+
...disabledValues,
|
|
83606
|
+
...sublocationsToDisable.filter(
|
|
83607
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
83608
|
+
)
|
|
83609
|
+
];
|
|
83610
|
+
setDisabledValues(newDisabledValues);
|
|
83611
|
+
}
|
|
83612
|
+
setSelectState(determineSelectedState(newSelections));
|
|
83613
|
+
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
83614
|
+
onChange(
|
|
83615
|
+
newSelections.map((item) => ({
|
|
83616
|
+
...item,
|
|
83617
|
+
sublocations: handleSelectSublocations(item)
|
|
83618
|
+
}))
|
|
83619
|
+
);
|
|
83620
|
+
};
|
|
83621
|
+
const findSublocations = (selected) => {
|
|
83622
|
+
return options.filter((option) => {
|
|
83623
|
+
return startsWith(
|
|
83624
|
+
`${getLabel3(selected).toLowerCase()} > `,
|
|
83625
|
+
getLabel3(option).toLowerCase()
|
|
83626
|
+
);
|
|
83627
|
+
});
|
|
83628
|
+
};
|
|
83629
|
+
const handleSelectSublocations = (selected) => {
|
|
83630
|
+
if (enableSublocations) {
|
|
83631
|
+
const filteredOptions = findSublocations(selected);
|
|
83632
|
+
return filteredOptions;
|
|
83633
|
+
} else {
|
|
83634
|
+
return [];
|
|
83635
|
+
}
|
|
83636
|
+
};
|
|
83637
|
+
const removeSelections = React76.useCallback(
|
|
83638
|
+
function(selection, selected) {
|
|
83639
|
+
const sublocations = handleSelectSublocations(selection);
|
|
83640
|
+
const disabledValueIds = disabledValues.map(({ id }) => id);
|
|
83641
|
+
const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
|
|
83642
|
+
setDisabledValues(
|
|
83643
|
+
disabledValues.filter(
|
|
83644
|
+
({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
|
|
83645
|
+
)
|
|
83646
|
+
);
|
|
83647
|
+
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
83337
83648
|
},
|
|
83338
|
-
[
|
|
83649
|
+
[enableSublocations, disabledValues]
|
|
83339
83650
|
);
|
|
83340
83651
|
React76.useEffect(() => {
|
|
83341
|
-
|
|
83342
|
-
|
|
83343
|
-
|
|
83344
|
-
|
|
83345
|
-
|
|
83346
|
-
|
|
83347
|
-
|
|
83348
|
-
|
|
83349
|
-
|
|
83652
|
+
setSelectState(determineSelectedState(value));
|
|
83653
|
+
}, [value]);
|
|
83654
|
+
const overlay = /* @__PURE__ */ React76.createElement(
|
|
83655
|
+
LocationQuickFilterOverlay,
|
|
83656
|
+
{
|
|
83657
|
+
columnDefinition,
|
|
83658
|
+
enableSublocations,
|
|
83659
|
+
onSelectAll,
|
|
83660
|
+
onSelectSublocations,
|
|
83661
|
+
selectState,
|
|
83662
|
+
value,
|
|
83663
|
+
options,
|
|
83664
|
+
disabledOptions: disabledValues,
|
|
83665
|
+
getId: getId3,
|
|
83666
|
+
getLabel: getLabel3,
|
|
83667
|
+
loading,
|
|
83668
|
+
onSelect,
|
|
83669
|
+
selectedValueIds
|
|
83350
83670
|
}
|
|
83351
|
-
|
|
83352
|
-
|
|
83353
|
-
onDisplayedColumnsChanged
|
|
83354
|
-
);
|
|
83355
|
-
return () => {
|
|
83356
|
-
removeEventListenerFromGrid(
|
|
83357
|
-
"displayedColumnsChanged",
|
|
83358
|
-
onDisplayedColumnsChanged,
|
|
83359
|
-
gridApi
|
|
83360
|
-
);
|
|
83361
|
-
};
|
|
83362
|
-
}, [gridApi]);
|
|
83363
|
-
if (groupableColumns.length === 0) {
|
|
83364
|
-
return null;
|
|
83365
|
-
}
|
|
83671
|
+
);
|
|
83672
|
+
const triggerLabel = value.length ? value.length === 1 ? `: ${value[0].label}` : `: (${value.length})` : "";
|
|
83366
83673
|
return /* @__PURE__ */ React76.createElement(
|
|
83367
|
-
|
|
83674
|
+
OverlayTrigger,
|
|
83368
83675
|
{
|
|
83369
|
-
|
|
83370
|
-
|
|
83676
|
+
overlay,
|
|
83677
|
+
beforeShow: getOptions,
|
|
83678
|
+
placement: "bottom-left"
|
|
83371
83679
|
},
|
|
83372
|
-
/* @__PURE__ */ React76.createElement(
|
|
83373
|
-
|
|
83680
|
+
value.length ? /* @__PURE__ */ React76.createElement(
|
|
83681
|
+
QuickFilterLabel,
|
|
83374
83682
|
{
|
|
83375
|
-
|
|
83376
|
-
|
|
83377
|
-
|
|
83378
|
-
|
|
83379
|
-
|
|
83380
|
-
|
|
83381
|
-
|
|
83382
|
-
|
|
83383
|
-
|
|
83384
|
-
};
|
|
83385
|
-
function mapColumnsToOptions(columnDefinitions) {
|
|
83386
|
-
return columnDefinitions.map((col) => {
|
|
83387
|
-
return {
|
|
83388
|
-
label: col.headerName,
|
|
83389
|
-
id: col.field,
|
|
83390
|
-
key: col.field,
|
|
83391
|
-
group: col.columnGroupName
|
|
83392
|
-
};
|
|
83393
|
-
});
|
|
83394
|
-
}
|
|
83395
|
-
var cx21 = classnames.bind(quickControlsStyles_default);
|
|
83396
|
-
var ClientSideSearch = ({
|
|
83397
|
-
onSearch,
|
|
83398
|
-
placeholder
|
|
83399
|
-
}) => {
|
|
83400
|
-
const [internalValue, setInternalValue] = React76.useState("");
|
|
83401
|
-
const { tableRef } = useInternalTableContext();
|
|
83402
|
-
const hasNoContent = useTableHasNoContent();
|
|
83403
|
-
const I18n = useI18nContext();
|
|
83404
|
-
const debouncedSetSearchValue = React76.useCallback(
|
|
83405
|
-
debounce5((value) => {
|
|
83406
|
-
tableRef?.current?.setSearchValue(value);
|
|
83407
|
-
}, 250),
|
|
83408
|
-
[tableRef?.current?.setSearchValue]
|
|
83409
|
-
);
|
|
83410
|
-
const onChange = React76.useCallback(
|
|
83411
|
-
(value, event) => {
|
|
83412
|
-
setInternalValue(value);
|
|
83413
|
-
if (onSearch) {
|
|
83414
|
-
onSearch(event);
|
|
83415
|
-
} else {
|
|
83416
|
-
debouncedSetSearchValue(value);
|
|
83683
|
+
enabled: true,
|
|
83684
|
+
disabled,
|
|
83685
|
+
label: `${I18n.t(
|
|
83686
|
+
"dataTable.filters.locationFilter.locations"
|
|
83687
|
+
)}${triggerLabel}`,
|
|
83688
|
+
onClear: () => {
|
|
83689
|
+
onChange([]);
|
|
83690
|
+
},
|
|
83691
|
+
block: true
|
|
83417
83692
|
}
|
|
83418
|
-
|
|
83419
|
-
|
|
83420
|
-
);
|
|
83421
|
-
return /* @__PURE__ */ React76.createElement(EmptyResultsControlTooltip, { hasSearch: true, enabled: hasNoContent }, /* @__PURE__ */ React76.createElement(
|
|
83422
|
-
Typeahead,
|
|
83423
|
-
{
|
|
83424
|
-
disabled: hasNoContent,
|
|
83425
|
-
"data-qa": "data-table-search",
|
|
83426
|
-
value: internalValue,
|
|
83427
|
-
className: cx21("search", {
|
|
83428
|
-
"search--empty": !internalValue.length
|
|
83429
|
-
}),
|
|
83430
|
-
onChange,
|
|
83431
|
-
placeholder: placeholder || I18n.t("dataTable.search")
|
|
83432
|
-
}
|
|
83433
|
-
));
|
|
83434
|
-
};
|
|
83435
|
-
var Search = (props) => {
|
|
83436
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83437
|
-
if (onServerSideDataRequest) {
|
|
83438
|
-
return /* @__PURE__ */ React76.createElement(ServerSideSearch, { ...props });
|
|
83439
|
-
}
|
|
83440
|
-
return /* @__PURE__ */ React76.createElement(ClientSideSearch, { ...props });
|
|
83441
|
-
};
|
|
83442
|
-
|
|
83443
|
-
// src/QuickControls/QuickControls.tsx
|
|
83444
|
-
var QuickControls = (props) => {
|
|
83445
|
-
const I18n = useI18nContext();
|
|
83446
|
-
if (props.children) {
|
|
83447
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83448
|
-
Box,
|
|
83693
|
+
) : /* @__PURE__ */ React76.createElement(
|
|
83694
|
+
QuickFilterLabel,
|
|
83449
83695
|
{
|
|
83450
|
-
|
|
83451
|
-
|
|
83452
|
-
|
|
83453
|
-
|
|
83454
|
-
|
|
83455
|
-
|
|
83456
|
-
}
|
|
83457
|
-
return /* @__PURE__ */ React76.createElement(Box, { padding: "xs none", style: props.style }, /* @__PURE__ */ React76.createElement(Box, { padding: "xs none", display: "flex-row", justifyContent: "space-between" }, /* @__PURE__ */ React76.createElement(FlexList, { size: "xs", alignItems: "center", marginRight: "sm" }, /* @__PURE__ */ React76.createElement(
|
|
83458
|
-
Search,
|
|
83459
|
-
{
|
|
83460
|
-
onSearch: props.onSearch,
|
|
83461
|
-
placeholder: props.placeholder,
|
|
83462
|
-
disabled: props.disabledSearch
|
|
83463
|
-
}
|
|
83464
|
-
), /* @__PURE__ */ React76.createElement(FiltersPanelButton, null)), /* @__PURE__ */ React76.createElement(FlexList, { size: "xs", alignItems: "center" }, /* @__PURE__ */ React76.createElement(
|
|
83465
|
-
RowGroupSelector,
|
|
83466
|
-
{
|
|
83467
|
-
localeText: {
|
|
83468
|
-
reset: I18n.t("dataTable.tableSettings.reset"),
|
|
83469
|
-
placeholder: I18n.t("dataTable.tableSettings.selectColumnGroup"),
|
|
83470
|
-
selectedItemsPrefix: I18n.t("dataTable.tableSettings.groupBy")
|
|
83696
|
+
enabled: false,
|
|
83697
|
+
disabled,
|
|
83698
|
+
label: `${I18n.t(
|
|
83699
|
+
"dataTable.filters.locationFilter.locations"
|
|
83700
|
+
)}${triggerLabel}`,
|
|
83701
|
+
block: true
|
|
83471
83702
|
}
|
|
83472
|
-
|
|
83473
|
-
), /* @__PURE__ */ React76.createElement(ConfigPanelButton, null))), /* @__PURE__ */ React76.createElement(
|
|
83474
|
-
QuickFilters,
|
|
83475
|
-
{
|
|
83476
|
-
overlayMatchesTriggerWidth: props.filterOverlayMatchesTriggerWidth
|
|
83477
|
-
}
|
|
83478
|
-
));
|
|
83479
|
-
};
|
|
83480
|
-
|
|
83481
|
-
// src/utils/addSubcomponents.ts
|
|
83482
|
-
var addSubcomponents = (subs, parent) => {
|
|
83483
|
-
const assigned = parent;
|
|
83484
|
-
Object.keys(subs).forEach((key) => {
|
|
83485
|
-
assigned[key] = subs[key];
|
|
83486
|
-
});
|
|
83487
|
-
return assigned;
|
|
83488
|
-
};
|
|
83489
|
-
|
|
83490
|
-
// src/ClientSideDataTable.tsx
|
|
83491
|
-
var ClientSideDataTable = ({
|
|
83492
|
-
analytics,
|
|
83493
|
-
children,
|
|
83494
|
-
columnDefinitions: _columnDefinitions,
|
|
83495
|
-
customBulkEditorFields,
|
|
83496
|
-
enableDynamicRowHeight,
|
|
83497
|
-
enableGroupEditAndValidation,
|
|
83498
|
-
filterGroups,
|
|
83499
|
-
getRowId,
|
|
83500
|
-
initialTableConfig: _initialTableConfig,
|
|
83501
|
-
onBulkEditUpdate,
|
|
83502
|
-
onTableConfigChange,
|
|
83503
|
-
translations: translations2 = {},
|
|
83504
|
-
enableCellTextSelection,
|
|
83505
|
-
localStoragePersistenceKey
|
|
83506
|
-
}) => {
|
|
83507
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83508
|
-
DataTable,
|
|
83509
|
-
{
|
|
83510
|
-
analytics,
|
|
83511
|
-
columnDefinitions: _columnDefinitions,
|
|
83512
|
-
enableGroupEditAndValidation,
|
|
83513
|
-
enableDynamicRowHeight,
|
|
83514
|
-
filterGroups,
|
|
83515
|
-
getRowId,
|
|
83516
|
-
initialTableConfig: _initialTableConfig,
|
|
83517
|
-
onTableConfigChange,
|
|
83518
|
-
onBulkEditUpdate,
|
|
83519
|
-
showExpandCollapseAllToggle: true,
|
|
83520
|
-
translations: translations2,
|
|
83521
|
-
localStoragePersistenceKey,
|
|
83522
|
-
customBulkEditorFields,
|
|
83523
|
-
enableCellTextSelection
|
|
83524
|
-
},
|
|
83525
|
-
children
|
|
83703
|
+
)
|
|
83526
83704
|
);
|
|
83527
83705
|
};
|
|
83528
|
-
var
|
|
83529
|
-
|
|
83530
|
-
|
|
83531
|
-
internalTableContext.setTotalRowCount(props.rows?.length ?? 0);
|
|
83532
|
-
}, [props.rows]);
|
|
83533
|
-
return /* @__PURE__ */ React76.createElement(Table, { ...props, modules: [ClientSideRowModelModule] });
|
|
83534
|
-
};
|
|
83535
|
-
BulkActions.displayName = "ClientSideDataTable.BulkActions";
|
|
83536
|
-
ConfigPanelButton.displayName = "ClientSideDataTable.ConfigPanelButton";
|
|
83537
|
-
ContextPanel.displayName = "ClientSideDataTable.ContextPanel";
|
|
83538
|
-
QuickControls.displayName = "ClientSideDataTable.QuickControls";
|
|
83539
|
-
QuickFilters.displayName = "ClientSideDataTable.QuickFilters";
|
|
83540
|
-
RowGroupSelector.displayName = "ClientSideDataTable.RowGroupSelector";
|
|
83541
|
-
Search.displayName = "ClientSideDataTable.Search";
|
|
83542
|
-
Table2.displayName = "ClientSideDataTable.Table";
|
|
83543
|
-
FiltersPanel.displayName = "ClientSideDataTable.FiltersPanel";
|
|
83544
|
-
var ClientSideDataTable_default = addSubcomponents(
|
|
83545
|
-
{
|
|
83546
|
-
BulkActions,
|
|
83547
|
-
BulkEditActionButton,
|
|
83548
|
-
ConfigPanelButton,
|
|
83549
|
-
ContextPanel,
|
|
83550
|
-
QuickControls,
|
|
83551
|
-
QuickFilters,
|
|
83552
|
-
RowGroupSelector,
|
|
83553
|
-
Search,
|
|
83554
|
-
Table: Table2,
|
|
83555
|
-
FiltersPanel,
|
|
83556
|
-
FiltersPanelButton
|
|
83557
|
-
},
|
|
83558
|
-
ClientSideDataTable
|
|
83559
|
-
);
|
|
83560
|
-
var QuickFilterLabel = React76.forwardRef(({ enabled, ...props }, ref) => {
|
|
83561
|
-
return /* @__PURE__ */ React76.createElement(StyledQuickFilterLabel, { $enabled: enabled }, /* @__PURE__ */ React76.createElement(SelectButton, { ref, ...props }));
|
|
83562
|
-
});
|
|
83563
|
-
var StyledQuickFilterLabel = styled4.div`
|
|
83564
|
-
${StyledSelectButton} {
|
|
83565
|
-
width: auto;
|
|
83566
|
-
max-width: 380px;
|
|
83567
|
-
${({ $enabled }) => $enabled && css$1`
|
|
83568
|
-
background: ${colors.blue96};
|
|
83569
|
-
border-color: ${colors.blue96};
|
|
83570
|
-
font-weight: ${typographyWeights.semibold};
|
|
83571
|
-
&:hover {
|
|
83572
|
-
background: ${colors.blue90};
|
|
83573
|
-
border-color: ${colors.blue90};
|
|
83574
|
-
}
|
|
83575
|
-
${StyledSelectButtonLabel} {
|
|
83576
|
-
color: ${colors.blue45};
|
|
83577
|
-
}
|
|
83578
|
-
${StyledButton} {
|
|
83579
|
-
color: ${colors.blue45};
|
|
83580
|
-
&:hover {
|
|
83581
|
-
background: white;
|
|
83582
|
-
}
|
|
83583
|
-
}
|
|
83584
|
-
${StyledSelectArrow} {
|
|
83585
|
-
svg {
|
|
83586
|
-
fill: ${colors.blue45};
|
|
83587
|
-
}
|
|
83588
|
-
}
|
|
83589
|
-
`}
|
|
83590
|
-
}
|
|
83706
|
+
var LocationQuickFilterRenderer_default = LocationQuickFilterRenderer;
|
|
83707
|
+
var StyledFilterPresetPopoverContent = styled3(Popover.Content)`
|
|
83708
|
+
padding: ${spacing.sm}px ${spacing.lg}px;
|
|
83591
83709
|
`;
|
|
83592
|
-
|
|
83593
|
-
|
|
83594
|
-
|
|
83595
|
-
|
|
83596
|
-
return "bottom-left";
|
|
83597
|
-
}
|
|
83598
|
-
if (position === "start") {
|
|
83599
|
-
return "bottom-left";
|
|
83600
|
-
}
|
|
83601
|
-
return "bottom-right";
|
|
83602
|
-
}
|
|
83603
|
-
var OptionalDateTimeProvider2 = ({ timeZone, children }) => {
|
|
83604
|
-
return timeZone ? /* @__PURE__ */ React76.createElement(DateTimeProvider, { timeZone }, children) : /* @__PURE__ */ React76.createElement(React76.Fragment, null, children);
|
|
83710
|
+
var getValueLabel = (isValueEmpty, value, placeholder, filterName) => {
|
|
83711
|
+
const prefixLabel = isValueEmpty ? placeholder || filterName : filterName;
|
|
83712
|
+
const valueLabel = value ? `${prefixLabel ? ": " : ""}${value}` : "";
|
|
83713
|
+
return `${prefixLabel}${valueLabel}`;
|
|
83605
83714
|
};
|
|
83606
|
-
var
|
|
83607
|
-
|
|
83608
|
-
|
|
83609
|
-
|
|
83610
|
-
|
|
83611
|
-
|
|
83612
|
-
|
|
83613
|
-
|
|
83614
|
-
|
|
83615
|
-
|
|
83616
|
-
|
|
83617
|
-
|
|
83618
|
-
|
|
83619
|
-
|
|
83620
|
-
|
|
83621
|
-
|
|
83622
|
-
|
|
83623
|
-
|
|
83624
|
-
|
|
83625
|
-
|
|
83626
|
-
|
|
83627
|
-
|
|
83628
|
-
|
|
83629
|
-
|
|
83630
|
-
|
|
83631
|
-
|
|
83632
|
-
|
|
83633
|
-
|
|
83634
|
-
|
|
83635
|
-
|
|
83636
|
-
|
|
83637
|
-
|
|
83638
|
-
|
|
83639
|
-
|
|
83640
|
-
|
|
83641
|
-
|
|
83642
|
-
|
|
83643
|
-
|
|
83644
|
-
|
|
83645
|
-
|
|
83646
|
-
|
|
83647
|
-
|
|
83648
|
-
|
|
83649
|
-
|
|
83650
|
-
|
|
83651
|
-
|
|
83652
|
-
|
|
83653
|
-
|
|
83654
|
-
|
|
83655
|
-
|
|
83656
|
-
|
|
83657
|
-
|
|
83658
|
-
|
|
83659
|
-
|
|
83660
|
-
|
|
83661
|
-
|
|
83662
|
-
|
|
83663
|
-
|
|
83664
|
-
|
|
83665
|
-
|
|
83666
|
-
|
|
83667
|
-
|
|
83668
|
-
|
|
83669
|
-
|
|
83670
|
-
|
|
83671
|
-
|
|
83672
|
-
|
|
83673
|
-
/* @__PURE__ */ React76.createElement(
|
|
83674
|
-
DateQuickFilterLabel,
|
|
83675
|
-
{
|
|
83676
|
-
headerName,
|
|
83677
|
-
onClear,
|
|
83678
|
-
value: selectedDate,
|
|
83679
|
-
disabled
|
|
83715
|
+
var getSuperSelectFilterPreset = (columnDefinition) => {
|
|
83716
|
+
const filterName = columnDefinition.headerName;
|
|
83717
|
+
const getValueLabel_ = typeof columnDefinition.filterProps?.getFilterTokenText === "function" ? (value) => {
|
|
83718
|
+
return columnDefinition.filterProps?.getFilterTokenText?.({
|
|
83719
|
+
headerName: columnDefinition.headerName,
|
|
83720
|
+
value: Array.isArray(value) ? value : [value]
|
|
83721
|
+
});
|
|
83722
|
+
} : void 0;
|
|
83723
|
+
return {
|
|
83724
|
+
components: {
|
|
83725
|
+
Label: React76.forwardRef(() => {
|
|
83726
|
+
const ctx = UNSAFE_useSuperSelectContext();
|
|
83727
|
+
const isValueEmpty = ["", null, void 0].includes(
|
|
83728
|
+
ctx.state.value
|
|
83729
|
+
);
|
|
83730
|
+
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
83731
|
+
isValueEmpty,
|
|
83732
|
+
ctx.state.selectedLabel,
|
|
83733
|
+
ctx.config.placeholder,
|
|
83734
|
+
filterName
|
|
83735
|
+
));
|
|
83736
|
+
}),
|
|
83737
|
+
TriggerContainer: React76.forwardRef((props, ref) => {
|
|
83738
|
+
const ctx = UNSAFE_useSuperSelectContext();
|
|
83739
|
+
if (!Array.isArray(ctx.state.value)) {
|
|
83740
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83741
|
+
UNSAFE_StyledSuperSelectTrigger,
|
|
83742
|
+
{
|
|
83743
|
+
$block: ctx.config.block,
|
|
83744
|
+
...props,
|
|
83745
|
+
ref
|
|
83746
|
+
}
|
|
83747
|
+
);
|
|
83748
|
+
}
|
|
83749
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83750
|
+
Popover,
|
|
83751
|
+
{
|
|
83752
|
+
placement: "top",
|
|
83753
|
+
trigger: ctx.state.value.length > 1 ? "hover" : "none",
|
|
83754
|
+
overlay: /* @__PURE__ */ React76.createElement(StyledFilterPresetPopoverContent, null, /* @__PURE__ */ React76.createElement(Typography, null, ctx.state.value.map((v) => {
|
|
83755
|
+
const option = ctx.state.options.find(
|
|
83756
|
+
(option2) => ctx.option.value(option2) === v
|
|
83757
|
+
);
|
|
83758
|
+
return option ? ctx.option.label(option) : "";
|
|
83759
|
+
}).join(", ")))
|
|
83760
|
+
},
|
|
83761
|
+
/* @__PURE__ */ React76.createElement(
|
|
83762
|
+
UNSAFE_StyledSuperSelectTrigger,
|
|
83763
|
+
{
|
|
83764
|
+
$block: ctx.config.block,
|
|
83765
|
+
...props,
|
|
83766
|
+
ref
|
|
83767
|
+
}
|
|
83768
|
+
)
|
|
83769
|
+
);
|
|
83770
|
+
}),
|
|
83771
|
+
MultiValueContainer: () => {
|
|
83772
|
+
const ctx = UNSAFE_useSuperSelectContext();
|
|
83773
|
+
if (Array.isArray(ctx.state.value)) {
|
|
83774
|
+
const isValueEmpty = !ctx.state.value.length;
|
|
83775
|
+
const value = ctx.state.value.length > 1 ? `(${ctx.state.value.length})` : ctx.state.value.length === 1 ? `${ctx.state.selectedLabel}` : "";
|
|
83776
|
+
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
83777
|
+
isValueEmpty,
|
|
83778
|
+
value,
|
|
83779
|
+
ctx.config.placeholder,
|
|
83780
|
+
filterName
|
|
83781
|
+
));
|
|
83680
83782
|
}
|
|
83681
|
-
|
|
83682
|
-
);
|
|
83683
|
-
}
|
|
83684
|
-
);
|
|
83685
|
-
function DateFilter3({
|
|
83686
|
-
// TODO: talk to design about potential loading UX for this.
|
|
83687
|
-
// core DateSelect doesn't have it
|
|
83688
|
-
// loading,
|
|
83689
|
-
headerName,
|
|
83690
|
-
onChange,
|
|
83691
|
-
selectionType = "either",
|
|
83692
|
-
value,
|
|
83693
|
-
disabled,
|
|
83694
|
-
...props
|
|
83695
|
-
}) {
|
|
83696
|
-
const [selectedValue, setSelectedValue] = React76.useState({
|
|
83697
|
-
type: selectionType === "either" ? "range" : selectionType
|
|
83698
|
-
});
|
|
83699
|
-
React76.useEffect(() => {
|
|
83700
|
-
const parsedValue = value.map((date) => {
|
|
83701
|
-
if (isDate(date)) {
|
|
83702
|
-
return date;
|
|
83783
|
+
return /* @__PURE__ */ React76.createElement("div", null, "Value is not an array");
|
|
83703
83784
|
}
|
|
83704
|
-
return parseISO(String(date));
|
|
83705
|
-
});
|
|
83706
|
-
const type = isSameDay(parsedValue[0], parsedValue[1]) ? "single" : "range";
|
|
83707
|
-
setSelectedValue({ type, start: parsedValue[0], end: parsedValue[1] });
|
|
83708
|
-
}, [value]);
|
|
83709
|
-
const dateRangeEndDateRef = React76.useRef(null);
|
|
83710
|
-
function dateFilterOnChange(date, position) {
|
|
83711
|
-
const newValue = getValueFromSelection(selectedValue, date, position);
|
|
83712
|
-
setSelectedValue(newValue);
|
|
83713
|
-
if (isValidDateSelection(newValue)) {
|
|
83714
|
-
onChange(
|
|
83715
|
-
newValue.start || newValue.end ? [
|
|
83716
|
-
newValue.start,
|
|
83717
|
-
newValue.type === "single" ? newValue.start : newValue.end
|
|
83718
|
-
] : []
|
|
83719
|
-
);
|
|
83720
|
-
}
|
|
83721
|
-
}
|
|
83722
|
-
const onSelectionTypeChange = React76.useCallback(
|
|
83723
|
-
(newSelectionType) => {
|
|
83724
|
-
setSelectedValue({ type: newSelectionType });
|
|
83725
83785
|
},
|
|
83726
|
-
|
|
83727
|
-
|
|
83728
|
-
|
|
83729
|
-
|
|
83730
|
-
|
|
83731
|
-
|
|
83732
|
-
return true;
|
|
83786
|
+
selectionStyle: "highlight"
|
|
83787
|
+
};
|
|
83788
|
+
};
|
|
83789
|
+
var StyledSuperSelectWrapper = styled3.div`
|
|
83790
|
+
${UNSAFE_StyledSuperSelectTrigger} {
|
|
83791
|
+
width: auto;
|
|
83733
83792
|
}
|
|
83734
|
-
|
|
83735
|
-
|
|
83736
|
-
|
|
83737
|
-
|
|
83738
|
-
|
|
83739
|
-
|
|
83740
|
-
|
|
83741
|
-
|
|
83742
|
-
|
|
83743
|
-
|
|
83744
|
-
|
|
83745
|
-
|
|
83746
|
-
|
|
83747
|
-
|
|
83748
|
-
|
|
83749
|
-
|
|
83750
|
-
|
|
83751
|
-
|
|
83752
|
-
|
|
83753
|
-
|
|
83754
|
-
|
|
83755
|
-
|
|
83756
|
-
|
|
83757
|
-
|
|
83758
|
-
|
|
83793
|
+
|
|
83794
|
+
${({ $enabled }) => $enabled && css$1`
|
|
83795
|
+
${UNSAFE_StyledSuperSelectTrigger} {
|
|
83796
|
+
max-width: 360px;
|
|
83797
|
+
background: ${colors.blue96};
|
|
83798
|
+
border-color: ${colors.blue96};
|
|
83799
|
+
font-weight: ${typographyWeights.semibold};
|
|
83800
|
+
|
|
83801
|
+
&:hover {
|
|
83802
|
+
background: ${colors.blue90};
|
|
83803
|
+
border-color: ${colors.blue90};
|
|
83804
|
+
}
|
|
83805
|
+
|
|
83806
|
+
${UNSAFE_StyledSuperSelectLabel} {
|
|
83807
|
+
color: ${colors.blue45};
|
|
83808
|
+
}
|
|
83809
|
+
|
|
83810
|
+
${StyledButton} {
|
|
83811
|
+
color: ${colors.blue45};
|
|
83812
|
+
|
|
83813
|
+
&:hover {
|
|
83814
|
+
background: white;
|
|
83815
|
+
}
|
|
83816
|
+
}
|
|
83817
|
+
|
|
83818
|
+
${UNSAFE_StyledSuperSelectArrow} {
|
|
83819
|
+
svg {
|
|
83820
|
+
fill: ${colors.blue45};
|
|
83821
|
+
}
|
|
83822
|
+
}
|
|
83823
|
+
}
|
|
83824
|
+
`}
|
|
83825
|
+
`;
|
|
83826
|
+
|
|
83827
|
+
// src/QuickFilterRenderers/types.ts
|
|
83828
|
+
function isClientSideFilterProps(_value, isServerSideDataRequest) {
|
|
83829
|
+
return !isServerSideDataRequest;
|
|
83759
83830
|
}
|
|
83760
|
-
|
|
83831
|
+
|
|
83832
|
+
// src/QuickFilterRenderers/MultiSelectQuickFilterRenderer.tsx
|
|
83833
|
+
var ClientSideMultiSelectQuickFilter = ({
|
|
83834
|
+
filter,
|
|
83761
83835
|
columnDefinition,
|
|
83836
|
+
onChange,
|
|
83837
|
+
onRemove,
|
|
83838
|
+
overlayMatchesTriggerWidth,
|
|
83762
83839
|
disabled
|
|
83763
|
-
}) {
|
|
83764
|
-
|
|
83765
|
-
|
|
83766
|
-
});
|
|
83767
|
-
const colDef = columnDefinition;
|
|
83768
|
-
return /* @__PURE__ */ React76.createElement(OptionalDateTimeProvider2, { timeZone: colDef.timeZone }, /* @__PURE__ */ React76.createElement(
|
|
83769
|
-
DateFilter3,
|
|
83840
|
+
}) => {
|
|
83841
|
+
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(filter.filterValues?.length) }, /* @__PURE__ */ React76.createElement(
|
|
83842
|
+
UNSAFE_SuperSelect,
|
|
83770
83843
|
{
|
|
83771
|
-
|
|
83772
|
-
|
|
83844
|
+
overlayMatchesTriggerWidth,
|
|
83845
|
+
value: filter.filterValues === null ? [] : filter.filterValues,
|
|
83846
|
+
search: false,
|
|
83847
|
+
multiple: true,
|
|
83848
|
+
options: filter.options,
|
|
83773
83849
|
disabled,
|
|
83774
|
-
|
|
83775
|
-
|
|
83776
|
-
selected.map((date) => {
|
|
83777
|
-
return date ? {
|
|
83778
|
-
// future extensions can go here (month, day, year keys etc)
|
|
83779
|
-
date
|
|
83780
|
-
} : (
|
|
83781
|
-
// TODO: refactor out date-specific getId stuff from useServerSideFilterStorage
|
|
83782
|
-
date
|
|
83783
|
-
);
|
|
83784
|
-
})
|
|
83785
|
-
);
|
|
83850
|
+
getOptionValue: (option) => {
|
|
83851
|
+
return getId(columnDefinition.filterProps?.getId, option);
|
|
83786
83852
|
},
|
|
83787
|
-
|
|
83853
|
+
getOptionLabel: (option) => {
|
|
83854
|
+
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
83855
|
+
},
|
|
83856
|
+
onChange: (values2) => {
|
|
83857
|
+
if (Array.isArray(values2) && !values2.length) {
|
|
83858
|
+
onRemove?.();
|
|
83859
|
+
return;
|
|
83860
|
+
}
|
|
83861
|
+
onChange?.(values2);
|
|
83862
|
+
},
|
|
83863
|
+
...getSuperSelectFilterPreset(columnDefinition)
|
|
83788
83864
|
}
|
|
83789
83865
|
));
|
|
83790
|
-
}
|
|
83791
|
-
var QuickDateFilterRenderer = (props) => {
|
|
83792
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83793
|
-
if (onServerSideDataRequest) {
|
|
83794
|
-
return /* @__PURE__ */ React76.createElement(ServerSideQuickDateFilterRenderer, { ...props });
|
|
83795
|
-
}
|
|
83796
|
-
logger.error(
|
|
83797
|
-
"Warning: Date Filters are currently only implemented for the serverside row model"
|
|
83798
|
-
);
|
|
83799
|
-
return null;
|
|
83800
|
-
};
|
|
83801
|
-
var dateInputLocales = {
|
|
83802
|
-
"fr-CA": {
|
|
83803
|
-
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83804
|
-
},
|
|
83805
|
-
"fr-FR": {
|
|
83806
|
-
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83807
|
-
},
|
|
83808
|
-
es: {
|
|
83809
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83810
|
-
},
|
|
83811
|
-
"es-ES": {
|
|
83812
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83813
|
-
},
|
|
83814
|
-
pt: {
|
|
83815
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83816
|
-
},
|
|
83817
|
-
"is-IS": {
|
|
83818
|
-
placeholders: { day: "dd", month: "mm", year: "\xE1\xE1\xE1\xE1" }
|
|
83819
|
-
},
|
|
83820
|
-
"de-DE": {
|
|
83821
|
-
placeholders: { day: "tt", month: "MM", year: "jjjj" }
|
|
83822
|
-
}
|
|
83823
|
-
};
|
|
83824
|
-
var DateQuickFilterLabel = React76.forwardRef(({ headerName, onClear, value, disabled }, ref) => {
|
|
83825
|
-
const dateTime = useDateTime();
|
|
83826
|
-
const i18n = useI18nContext();
|
|
83827
|
-
const placeholders = dateInputLocales[i18n.locale]?.placeholders || {
|
|
83828
|
-
day: "dd",
|
|
83829
|
-
month: "mm",
|
|
83830
|
-
year: "yyyy"
|
|
83831
|
-
};
|
|
83832
|
-
if (value !== void 0 && isDate(value)) {
|
|
83833
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83834
|
-
QuickFilterLabel,
|
|
83835
|
-
{
|
|
83836
|
-
enabled: true,
|
|
83837
|
-
disabled,
|
|
83838
|
-
label: `${headerName}: ${dateTime.format(value, "numeric-date")}`,
|
|
83839
|
-
onClear,
|
|
83840
|
-
ref
|
|
83841
|
-
}
|
|
83842
|
-
);
|
|
83843
|
-
}
|
|
83844
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83845
|
-
QuickFilterLabel,
|
|
83846
|
-
{
|
|
83847
|
-
enabled: false,
|
|
83848
|
-
disabled,
|
|
83849
|
-
label: `${headerName}: ${getDatePlaceholder(i18n.locale, placeholders)}`,
|
|
83850
|
-
ref
|
|
83851
|
-
}
|
|
83852
|
-
);
|
|
83853
|
-
});
|
|
83854
|
-
var DateQuickFilterRenderer_default = QuickDateFilterRenderer;
|
|
83855
|
-
var defaultGetId2 = (option) => option?.id;
|
|
83856
|
-
var defaultGetLabel2 = (option) => {
|
|
83857
|
-
return option?.label ?? option?.name ?? option;
|
|
83858
83866
|
};
|
|
83859
|
-
var
|
|
83867
|
+
var useSuperSelectOptionAsValueWorkaround2 = ({
|
|
83860
83868
|
originValue,
|
|
83861
83869
|
originOptions,
|
|
83862
|
-
getId: getId3
|
|
83870
|
+
getId: getId3,
|
|
83863
83871
|
loading
|
|
83864
83872
|
}) => {
|
|
83865
83873
|
const isValueFromOptions = React76.useRef(false);
|
|
83866
83874
|
const getValueFromOptions = () => {
|
|
83867
|
-
const valueIds = originValue.map(getId3);
|
|
83875
|
+
const valueIds = originValue.map((option) => getId(getId3, option));
|
|
83868
83876
|
isValueFromOptions.current = true;
|
|
83869
|
-
return originOptions.filter(
|
|
83877
|
+
return originOptions.filter(
|
|
83878
|
+
(option) => valueIds.includes(getId(getId3, option))
|
|
83879
|
+
);
|
|
83870
83880
|
};
|
|
83871
83881
|
const hasOptions = originOptions.length > 0 && !loading;
|
|
83872
83882
|
const hasValue = originValue?.length > 0;
|
|
@@ -83878,684 +83888,814 @@ var useSuperSelectOptionAsValueWorkaround = ({
|
|
|
83878
83888
|
getOptionValue: (option) => option
|
|
83879
83889
|
};
|
|
83880
83890
|
};
|
|
83881
|
-
var
|
|
83882
|
-
|
|
83883
|
-
|
|
83884
|
-
|
|
83891
|
+
var ServerSideMultiSelectQuickFilter = ({ columnDefinition, overlayMatchesTriggerWidth, disabled }) => {
|
|
83892
|
+
const {
|
|
83893
|
+
options: originOptions,
|
|
83894
|
+
onClearFilter,
|
|
83895
|
+
fieldName,
|
|
83896
|
+
value: originValue = [],
|
|
83897
|
+
onChange,
|
|
83898
|
+
getOptions,
|
|
83899
|
+
loading
|
|
83900
|
+
} = useServerSideFilter({ columnDefinition });
|
|
83901
|
+
const { options, value, getOptionValue } = useSuperSelectOptionAsValueWorkaround2({
|
|
83902
|
+
originOptions,
|
|
83903
|
+
originValue,
|
|
83885
83904
|
loading,
|
|
83886
|
-
|
|
83887
|
-
|
|
83888
|
-
|
|
83889
|
-
|
|
83890
|
-
|
|
83891
|
-
|
|
83892
|
-
|
|
83893
|
-
|
|
83894
|
-
|
|
83895
|
-
|
|
83896
|
-
|
|
83897
|
-
|
|
83898
|
-
|
|
83899
|
-
|
|
83900
|
-
|
|
83901
|
-
|
|
83902
|
-
|
|
83903
|
-
|
|
83904
|
-
|
|
83905
|
-
|
|
83906
|
-
|
|
83907
|
-
|
|
83908
|
-
|
|
83909
|
-
|
|
83910
|
-
|
|
83911
|
-
|
|
83912
|
-
|
|
83913
|
-
|
|
83914
|
-
|
|
83915
|
-
|
|
83916
|
-
if (selection.item.id === selectAllOption.id) {
|
|
83917
|
-
return onSelectAll();
|
|
83918
|
-
}
|
|
83919
|
-
if (selection.item.id === includeSublocationOption.id) {
|
|
83920
|
-
_onSelect(selection);
|
|
83921
|
-
return onSelectSublocations();
|
|
83922
|
-
}
|
|
83923
|
-
return _onSelect(selection);
|
|
83924
|
-
};
|
|
83925
|
-
function defaultOnSearch(e) {
|
|
83926
|
-
if (e.target.value === "") {
|
|
83927
|
-
setSearching(false);
|
|
83928
|
-
setItems(options);
|
|
83929
|
-
} else {
|
|
83930
|
-
setSearching(true);
|
|
83931
|
-
setItems(
|
|
83932
|
-
options.filter(
|
|
83933
|
-
(item) => getLabel3(item).toLowerCase().includes(e.target.value.toLowerCase())
|
|
83934
|
-
)
|
|
83935
|
-
);
|
|
83936
|
-
}
|
|
83905
|
+
getId: columnDefinition.filterProps?.getId
|
|
83906
|
+
});
|
|
83907
|
+
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(value?.length) }, /* @__PURE__ */ React76.createElement(
|
|
83908
|
+
UNSAFE_SuperSelect,
|
|
83909
|
+
{
|
|
83910
|
+
overlayMatchesTriggerWidth,
|
|
83911
|
+
loading,
|
|
83912
|
+
value: value === null ? [] : value,
|
|
83913
|
+
search: false,
|
|
83914
|
+
getOptionLabel: (option) => {
|
|
83915
|
+
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
83916
|
+
},
|
|
83917
|
+
getOptionValue,
|
|
83918
|
+
multiple: true,
|
|
83919
|
+
options,
|
|
83920
|
+
disabled,
|
|
83921
|
+
onChange: (values2) => {
|
|
83922
|
+
if (Array.isArray(values2) && !values2.length) {
|
|
83923
|
+
onClearFilter?.(fieldName);
|
|
83924
|
+
getOptions();
|
|
83925
|
+
return;
|
|
83926
|
+
}
|
|
83927
|
+
onChange(values2);
|
|
83928
|
+
},
|
|
83929
|
+
onOpenChange: (open) => {
|
|
83930
|
+
if (open && !originOptions.length) {
|
|
83931
|
+
getOptions();
|
|
83932
|
+
}
|
|
83933
|
+
},
|
|
83934
|
+
...getSuperSelectFilterPreset(columnDefinition)
|
|
83937
83935
|
}
|
|
83938
|
-
|
|
83939
|
-
|
|
83940
|
-
|
|
83941
|
-
|
|
83942
|
-
|
|
83943
|
-
|
|
83936
|
+
));
|
|
83937
|
+
};
|
|
83938
|
+
var MultiSelectQuickFilterRenderer = (props) => {
|
|
83939
|
+
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83940
|
+
if (!isClientSideFilterProps(props, !!onServerSideDataRequest)) {
|
|
83941
|
+
return /* @__PURE__ */ React76.createElement(ServerSideMultiSelectQuickFilter, { ...props });
|
|
83942
|
+
}
|
|
83943
|
+
return /* @__PURE__ */ React76.createElement(ClientSideMultiSelectQuickFilter, { ...props });
|
|
83944
|
+
};
|
|
83945
|
+
var MultiSelectQuickFilterRenderer_default = MultiSelectQuickFilterRenderer;
|
|
83946
|
+
function getFilterTokenText(columnDefinition, filterValue) {
|
|
83947
|
+
if (columnDefinition?.filterProps?.getFilterTokenText) {
|
|
83948
|
+
return columnDefinition?.filterProps?.getFilterTokenText?.({
|
|
83949
|
+
headerName: columnDefinition?.headerName || "",
|
|
83950
|
+
value: filterValue
|
|
83951
|
+
});
|
|
83952
|
+
}
|
|
83953
|
+
if (columnDefinition.filterRenderer === DateFilterRenderer_default) {
|
|
83954
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83955
|
+
OptionalDateTimeProvider,
|
|
83944
83956
|
{
|
|
83945
|
-
|
|
83946
|
-
multiple: true,
|
|
83947
|
-
role: "listbox",
|
|
83948
|
-
ref: menuRef,
|
|
83949
|
-
onSelect,
|
|
83950
|
-
className: locationFilterStyles_default.locationFilterMenu
|
|
83957
|
+
timeZone: columnDefinition.timeZone
|
|
83951
83958
|
},
|
|
83952
83959
|
/* @__PURE__ */ React76.createElement(
|
|
83953
|
-
|
|
83960
|
+
DateFilterTokenText,
|
|
83954
83961
|
{
|
|
83955
|
-
|
|
83956
|
-
|
|
83962
|
+
headerName: columnDefinition.headerName,
|
|
83963
|
+
value: filterValue
|
|
83957
83964
|
}
|
|
83958
|
-
)
|
|
83959
|
-
|
|
83960
|
-
Box,
|
|
83961
|
-
{
|
|
83962
|
-
className: locationFilterStyles_default.controlsContainer,
|
|
83963
|
-
...UNSAFE_menuItemsWrapperAttribute
|
|
83964
|
-
},
|
|
83965
|
-
/* @__PURE__ */ React76.createElement(
|
|
83966
|
-
UNSAFE_Menu.CheckboxItem,
|
|
83967
|
-
{
|
|
83968
|
-
key: getId3(includeSublocationOption),
|
|
83969
|
-
item: includeSublocationOption,
|
|
83970
|
-
selected: enableSublocations
|
|
83971
|
-
},
|
|
83972
|
-
getLabel3(includeSublocationOption)
|
|
83973
|
-
),
|
|
83974
|
-
/* @__PURE__ */ React76.createElement(
|
|
83975
|
-
UNSAFE_Menu.CheckboxItem,
|
|
83976
|
-
{
|
|
83977
|
-
key: getId3(selectAllOption),
|
|
83978
|
-
item: selectAllOption,
|
|
83979
|
-
selected: selectState === "all",
|
|
83980
|
-
indeterminate: selectState === "partial"
|
|
83981
|
-
},
|
|
83982
|
-
getLabel3(selectAllOption)
|
|
83983
|
-
)
|
|
83984
|
-
), !loading && items.map((item, i) => {
|
|
83985
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83986
|
-
UNSAFE_Menu.CheckboxItem,
|
|
83987
|
-
{
|
|
83988
|
-
key: getId3(item),
|
|
83989
|
-
item,
|
|
83990
|
-
selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
|
|
83991
|
-
suggested: i === 0,
|
|
83992
|
-
disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
|
|
83993
|
-
},
|
|
83994
|
-
getLabel3(item)
|
|
83995
|
-
);
|
|
83996
|
-
})),
|
|
83997
|
-
loading && /* @__PURE__ */ React76.createElement(UNSAFE_Menu.Footer, null, /* @__PURE__ */ React76.createElement(Flex, { justifyContent: "center" }, /* @__PURE__ */ React76.createElement(Spinner$1, { size: "sm" })))
|
|
83998
|
-
));
|
|
83965
|
+
)
|
|
83966
|
+
);
|
|
83999
83967
|
}
|
|
84000
|
-
)
|
|
84001
|
-
|
|
83968
|
+
if (columnDefinition.filterRenderer === NumberFilterRenderer) {
|
|
83969
|
+
return columnDefinition?.headerName;
|
|
83970
|
+
}
|
|
83971
|
+
if (Array.isArray(filterValue)) {
|
|
83972
|
+
if (filterValue.length === 0) {
|
|
83973
|
+
return columnDefinition?.headerName;
|
|
83974
|
+
}
|
|
83975
|
+
if (filterValue.length === 1) {
|
|
83976
|
+
return `${columnDefinition?.headerName}: ${getLabel(
|
|
83977
|
+
columnDefinition.filterProps?.getLabel,
|
|
83978
|
+
filterValue[0]
|
|
83979
|
+
)}`;
|
|
83980
|
+
}
|
|
83981
|
+
return `${columnDefinition?.headerName}: (${filterValue.length})`;
|
|
83982
|
+
}
|
|
83983
|
+
return columnDefinition?.headerName;
|
|
83984
|
+
}
|
|
83985
|
+
var ensureArray = (input) => {
|
|
83986
|
+
if (input === null) {
|
|
83987
|
+
return [];
|
|
83988
|
+
}
|
|
83989
|
+
return Array.isArray(input) ? input : [input];
|
|
83990
|
+
};
|
|
83991
|
+
|
|
83992
|
+
// src/QuickFilterRenderers/SingleSelectQuickFilterRenderer.tsx
|
|
83993
|
+
var ClientSideSingleSelectQuickFilter = ({
|
|
83994
|
+
filter,
|
|
84002
83995
|
columnDefinition,
|
|
83996
|
+
onChange,
|
|
83997
|
+
onRemove,
|
|
83998
|
+
overlayMatchesTriggerWidth,
|
|
84003
83999
|
disabled
|
|
84004
84000
|
}) => {
|
|
84001
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84002
|
+
StyledSuperSelectWrapper,
|
|
84003
|
+
{
|
|
84004
|
+
$enabled: Boolean(filter.filterValues?.length),
|
|
84005
|
+
"data-test-id": "client-side-single-select-quick-filter"
|
|
84006
|
+
},
|
|
84007
|
+
/* @__PURE__ */ React76.createElement(
|
|
84008
|
+
UNSAFE_SuperSelect,
|
|
84009
|
+
{
|
|
84010
|
+
overlayMatchesTriggerWidth,
|
|
84011
|
+
value: filter.filterValues ?? [],
|
|
84012
|
+
search: false,
|
|
84013
|
+
multiple: false,
|
|
84014
|
+
options: filter.options,
|
|
84015
|
+
disabled,
|
|
84016
|
+
getOptionValue: (option) => getId(columnDefinition.filterProps?.getId, option),
|
|
84017
|
+
getOptionLabel: (option) => getLabel(columnDefinition.filterProps?.getLabel, option),
|
|
84018
|
+
onChange: (values2) => {
|
|
84019
|
+
const valuesArray = ensureArray(values2);
|
|
84020
|
+
if (!valuesArray.length) {
|
|
84021
|
+
onRemove?.();
|
|
84022
|
+
return;
|
|
84023
|
+
}
|
|
84024
|
+
onChange?.(valuesArray);
|
|
84025
|
+
},
|
|
84026
|
+
...getSuperSelectFilterPreset(columnDefinition)
|
|
84027
|
+
}
|
|
84028
|
+
)
|
|
84029
|
+
);
|
|
84030
|
+
};
|
|
84031
|
+
var useSuperSelectOptionAsValueWorkaround3 = ({
|
|
84032
|
+
originValue,
|
|
84033
|
+
originOptions,
|
|
84034
|
+
getId: getId3,
|
|
84035
|
+
loading
|
|
84036
|
+
}) => {
|
|
84037
|
+
const isValueFromOptions = React76.useRef(false);
|
|
84038
|
+
const getValueFromOptions = () => {
|
|
84039
|
+
const valueIds = originValue.map((option) => getId(getId3, option));
|
|
84040
|
+
isValueFromOptions.current = true;
|
|
84041
|
+
return originOptions.filter(
|
|
84042
|
+
(option) => valueIds.includes(getId(getId3, option))
|
|
84043
|
+
);
|
|
84044
|
+
};
|
|
84045
|
+
const hasOptions = originOptions.length > 0 && !loading;
|
|
84046
|
+
const hasValue = originValue?.length > 0;
|
|
84047
|
+
const options = !hasOptions && hasValue ? originValue : originOptions;
|
|
84048
|
+
const value = !hasOptions ? originValue : isValueFromOptions.current ? originValue : getValueFromOptions();
|
|
84049
|
+
return {
|
|
84050
|
+
options,
|
|
84051
|
+
value,
|
|
84052
|
+
getOptionValue: (option) => option
|
|
84053
|
+
};
|
|
84054
|
+
};
|
|
84055
|
+
var ServerSideSingleSelectQuickFilter = ({ columnDefinition, overlayMatchesTriggerWidth, disabled }) => {
|
|
84005
84056
|
const {
|
|
84006
84057
|
options: originOptions,
|
|
84058
|
+
onClearFilter,
|
|
84059
|
+
fieldName,
|
|
84007
84060
|
value: originValue = [],
|
|
84008
84061
|
onChange,
|
|
84009
84062
|
getOptions,
|
|
84010
84063
|
loading
|
|
84011
84064
|
} = useServerSideFilter({ columnDefinition });
|
|
84012
|
-
const { options, value } =
|
|
84065
|
+
const { options, value, getOptionValue } = useSuperSelectOptionAsValueWorkaround3({
|
|
84013
84066
|
originOptions,
|
|
84014
84067
|
originValue,
|
|
84015
84068
|
loading,
|
|
84016
84069
|
getId: columnDefinition.filterProps?.getId
|
|
84017
84070
|
});
|
|
84018
|
-
const
|
|
84019
|
-
|
|
84020
|
-
|
|
84021
|
-
|
|
84022
|
-
|
|
84023
|
-
return "all";
|
|
84024
|
-
}
|
|
84025
|
-
if (selection.length && (options.length > selection.length || options.length < selection.length)) {
|
|
84026
|
-
return "partial";
|
|
84027
|
-
}
|
|
84028
|
-
if (selection.length === 0) {
|
|
84029
|
-
return "none";
|
|
84030
|
-
}
|
|
84031
|
-
return "none";
|
|
84032
|
-
};
|
|
84033
|
-
const ids = React76.useMemo(() => value.map(({ id }) => id), [value]);
|
|
84034
|
-
const [selectedValueIds, setSelectedValueIds] = React76.useState(ids);
|
|
84035
|
-
const [selectState, setSelectState] = React76.useState(
|
|
84036
|
-
determineSelectedState(value)
|
|
84037
|
-
);
|
|
84038
|
-
const [disabledValues, setDisabledValues] = React76.useState([]);
|
|
84039
|
-
const [enableSublocations, setEnableSublocations] = React76.useState(false);
|
|
84040
|
-
const onSelectSublocations = React76.useCallback(() => {
|
|
84041
|
-
if (enableSublocations) {
|
|
84042
|
-
setDisabledValues([]);
|
|
84043
|
-
} else {
|
|
84044
|
-
const newDisabledValues = [];
|
|
84045
|
-
value.forEach((location) => {
|
|
84046
|
-
newDisabledValues.push(...findSublocations(location));
|
|
84047
|
-
});
|
|
84048
|
-
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
84049
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
84050
|
-
);
|
|
84051
|
-
setDisabledValues(uniqDisabledValues);
|
|
84052
|
-
}
|
|
84053
|
-
setEnableSublocations(!enableSublocations);
|
|
84054
|
-
}, [enableSublocations, value, selectedValueIds, options]);
|
|
84055
|
-
const onSelectAll = React76.useCallback(() => {
|
|
84056
|
-
if (selectState === "none" || selectState === "partial") {
|
|
84057
|
-
setSelectState("all");
|
|
84058
|
-
setSelectedValueIds(options.map(({ id }) => id));
|
|
84059
|
-
onChange(options);
|
|
84060
|
-
}
|
|
84061
|
-
if (selectState === "all") {
|
|
84062
|
-
setSelectState("none");
|
|
84063
|
-
setSelectedValueIds([]);
|
|
84064
|
-
onChange([]);
|
|
84071
|
+
const hasFetchedOptions = React76.useRef(false);
|
|
84072
|
+
React76.useEffect(() => {
|
|
84073
|
+
if (!hasFetchedOptions.current && !originOptions.length) {
|
|
84074
|
+
getOptions();
|
|
84075
|
+
hasFetchedOptions.current = true;
|
|
84065
84076
|
}
|
|
84066
|
-
}, [
|
|
84067
|
-
const
|
|
84068
|
-
|
|
84077
|
+
}, [getOptions, originOptions.length]);
|
|
84078
|
+
const handleOnChange = (values2) => {
|
|
84079
|
+
const selectedValues = ensureArray(values2);
|
|
84080
|
+
if (!selectedValues.length) {
|
|
84081
|
+
onClearFilter?.(fieldName);
|
|
84082
|
+
getOptions();
|
|
84069
84083
|
return;
|
|
84070
84084
|
}
|
|
84071
|
-
|
|
84072
|
-
return onChange(
|
|
84073
|
-
value.map((item) => ({
|
|
84074
|
-
...item,
|
|
84075
|
-
sublocations: enableSublocations ? [] : findSublocations(item)
|
|
84076
|
-
}))
|
|
84077
|
-
);
|
|
84078
|
-
}
|
|
84079
|
-
let newSelections = [];
|
|
84080
|
-
if (selectedValueIds.includes(getId3(selection.item))) {
|
|
84081
|
-
newSelections = removeSelections(selection.item, value);
|
|
84082
|
-
} else {
|
|
84083
|
-
newSelections = [...value, selection.item];
|
|
84084
|
-
const sublocationsToDisable = handleSelectSublocations(selection.item);
|
|
84085
|
-
const newDisabledValues = [
|
|
84086
|
-
...disabledValues,
|
|
84087
|
-
...sublocationsToDisable.filter(
|
|
84088
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
84089
|
-
)
|
|
84090
|
-
];
|
|
84091
|
-
setDisabledValues(newDisabledValues);
|
|
84092
|
-
}
|
|
84093
|
-
setSelectState(determineSelectedState(newSelections));
|
|
84094
|
-
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
84095
|
-
onChange(
|
|
84096
|
-
newSelections.map((item) => ({
|
|
84097
|
-
...item,
|
|
84098
|
-
sublocations: handleSelectSublocations(item)
|
|
84099
|
-
}))
|
|
84100
|
-
);
|
|
84101
|
-
};
|
|
84102
|
-
const findSublocations = (selected) => {
|
|
84103
|
-
return options.filter((option) => {
|
|
84104
|
-
return startsWith(
|
|
84105
|
-
`${getLabel3(selected).toLowerCase()} > `,
|
|
84106
|
-
getLabel3(option).toLowerCase()
|
|
84107
|
-
);
|
|
84108
|
-
});
|
|
84085
|
+
onChange(selectedValues);
|
|
84109
84086
|
};
|
|
84110
|
-
const
|
|
84111
|
-
if (
|
|
84112
|
-
|
|
84113
|
-
return filteredOptions;
|
|
84114
|
-
} else {
|
|
84115
|
-
return [];
|
|
84087
|
+
const handleOnOpenChange = (open) => {
|
|
84088
|
+
if (open && !originOptions.length) {
|
|
84089
|
+
getOptions();
|
|
84116
84090
|
}
|
|
84117
84091
|
};
|
|
84118
|
-
|
|
84119
|
-
|
|
84120
|
-
|
|
84121
|
-
|
|
84122
|
-
|
|
84123
|
-
setDisabledValues(
|
|
84124
|
-
disabledValues.filter(
|
|
84125
|
-
({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
|
|
84126
|
-
)
|
|
84127
|
-
);
|
|
84128
|
-
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
84092
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84093
|
+
StyledSuperSelectWrapper,
|
|
84094
|
+
{
|
|
84095
|
+
$enabled: Boolean(value?.length),
|
|
84096
|
+
"data-test-id": "server-side-single-select-quick-filter"
|
|
84129
84097
|
},
|
|
84130
|
-
|
|
84098
|
+
/* @__PURE__ */ React76.createElement(
|
|
84099
|
+
UNSAFE_SuperSelect,
|
|
84100
|
+
{
|
|
84101
|
+
overlayMatchesTriggerWidth,
|
|
84102
|
+
loading,
|
|
84103
|
+
value: value ?? [],
|
|
84104
|
+
search: false,
|
|
84105
|
+
disabled,
|
|
84106
|
+
getOptionLabel: (option) => getLabel(columnDefinition.filterProps?.getLabel, option),
|
|
84107
|
+
getOptionValue,
|
|
84108
|
+
multiple: false,
|
|
84109
|
+
options,
|
|
84110
|
+
onChange: handleOnChange,
|
|
84111
|
+
onOpenChange: handleOnOpenChange,
|
|
84112
|
+
...getSuperSelectFilterPreset(columnDefinition)
|
|
84113
|
+
}
|
|
84114
|
+
)
|
|
84131
84115
|
);
|
|
84132
|
-
|
|
84133
|
-
|
|
84134
|
-
}
|
|
84135
|
-
|
|
84136
|
-
|
|
84116
|
+
};
|
|
84117
|
+
var SingleSelectQuickFilterRenderer = (props) => {
|
|
84118
|
+
const { onServerSideDataRequest } = useInternalTableContext();
|
|
84119
|
+
if (!isClientSideFilterProps(props, !!onServerSideDataRequest)) {
|
|
84120
|
+
return /* @__PURE__ */ React76.createElement(ServerSideSingleSelectQuickFilter, { ...props });
|
|
84121
|
+
}
|
|
84122
|
+
return /* @__PURE__ */ React76.createElement(ClientSideSingleSelectQuickFilter, { ...props });
|
|
84123
|
+
};
|
|
84124
|
+
var SingleSelectQuickFilterRenderer_default = SingleSelectQuickFilterRenderer;
|
|
84125
|
+
var FiltersPanelToggleButton = ({ hasSelectedFilters, hasDefinedFilters }) => {
|
|
84126
|
+
const I18n = useI18nContext();
|
|
84127
|
+
const { contextPanel } = useInternalTableContext();
|
|
84128
|
+
const hasNoContent = useTableHasNoContent();
|
|
84129
|
+
if (!hasDefinedFilters) {
|
|
84130
|
+
return null;
|
|
84131
|
+
}
|
|
84132
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84133
|
+
EmptyResultsControlTooltip,
|
|
84137
84134
|
{
|
|
84138
|
-
|
|
84139
|
-
|
|
84140
|
-
|
|
84141
|
-
|
|
84142
|
-
|
|
84143
|
-
|
|
84144
|
-
|
|
84145
|
-
|
|
84146
|
-
|
|
84147
|
-
|
|
84148
|
-
|
|
84149
|
-
|
|
84150
|
-
|
|
84135
|
+
featureI18nKey: "featureFilter",
|
|
84136
|
+
enabled: hasNoContent
|
|
84137
|
+
},
|
|
84138
|
+
/* @__PURE__ */ React76.createElement(
|
|
84139
|
+
ToggleButton,
|
|
84140
|
+
{
|
|
84141
|
+
"data-qa": "data-table-show-filters-button",
|
|
84142
|
+
disabled: hasNoContent,
|
|
84143
|
+
icon: /* @__PURE__ */ React76.createElement(FilterIcon, null),
|
|
84144
|
+
onClick: () => {
|
|
84145
|
+
if (contextPanel.content === "filters") {
|
|
84146
|
+
contextPanel.hide();
|
|
84147
|
+
} else {
|
|
84148
|
+
contextPanel.show("filters");
|
|
84149
|
+
}
|
|
84150
|
+
},
|
|
84151
|
+
selected: contextPanel.content === "filters"
|
|
84152
|
+
},
|
|
84153
|
+
hasSelectedFilters ? I18n.t("dataTable.filters.moreFilters") : I18n.t("dataTable.filters.filters")
|
|
84154
|
+
)
|
|
84155
|
+
);
|
|
84156
|
+
};
|
|
84157
|
+
var ServerSideFiltersPanelToggleButton = () => {
|
|
84158
|
+
const {
|
|
84159
|
+
filterStorage: { hasDefinedFilters, hasSelectedFilters }
|
|
84160
|
+
} = useInternalTableContext();
|
|
84161
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84162
|
+
FiltersPanelToggleButton,
|
|
84163
|
+
{
|
|
84164
|
+
hasDefinedFilters,
|
|
84165
|
+
hasSelectedFilters
|
|
84151
84166
|
}
|
|
84152
84167
|
);
|
|
84153
|
-
|
|
84168
|
+
};
|
|
84169
|
+
var ClientSideFiltersPanelToggleButton = () => {
|
|
84170
|
+
const { filterState } = useInternalTableContext();
|
|
84171
|
+
const activeFilters = React76.useMemo(() => {
|
|
84172
|
+
return filterState.allAvailableFilters.filter(({ instance }) => {
|
|
84173
|
+
return instance.isFilterActive();
|
|
84174
|
+
});
|
|
84175
|
+
}, [filterState.allAvailableFilters]);
|
|
84154
84176
|
return /* @__PURE__ */ React76.createElement(
|
|
84155
|
-
|
|
84177
|
+
FiltersPanelToggleButton,
|
|
84156
84178
|
{
|
|
84157
|
-
|
|
84158
|
-
|
|
84159
|
-
|
|
84179
|
+
hasDefinedFilters: filterState.allAvailableFilters.length > 0,
|
|
84180
|
+
hasSelectedFilters: activeFilters.length > 0
|
|
84181
|
+
}
|
|
84182
|
+
);
|
|
84183
|
+
};
|
|
84184
|
+
|
|
84185
|
+
// src/QuickControls/QuickFilters.tsx
|
|
84186
|
+
var defaultQuickFilterRenderers = {
|
|
84187
|
+
MultiSelectFilterRenderer: MultiSelectQuickFilterRenderer_default,
|
|
84188
|
+
DateFilterRenderer: DateQuickFilterRenderer_default,
|
|
84189
|
+
LocationFilterRenderer: LocationQuickFilterRenderer_default,
|
|
84190
|
+
SingleSelectFilterRenderer: SingleSelectQuickFilterRenderer_default
|
|
84191
|
+
};
|
|
84192
|
+
function getQuickFilterRenderer(colDef) {
|
|
84193
|
+
if (!colDef)
|
|
84194
|
+
return null;
|
|
84195
|
+
if (colDef.quickFilterRenderer) {
|
|
84196
|
+
return colDef.quickFilterRenderer;
|
|
84197
|
+
}
|
|
84198
|
+
const filterRendererName = colDef.filterRenderer?.displayName;
|
|
84199
|
+
if (filterRendererName) {
|
|
84200
|
+
return defaultQuickFilterRenderers[filterRendererName] || null;
|
|
84201
|
+
}
|
|
84202
|
+
return null;
|
|
84203
|
+
}
|
|
84204
|
+
var FilterIcon = () => {
|
|
84205
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84206
|
+
"svg",
|
|
84207
|
+
{
|
|
84208
|
+
focusable: false,
|
|
84209
|
+
width: "16",
|
|
84210
|
+
height: "16",
|
|
84211
|
+
viewBox: "0 0 20 20",
|
|
84212
|
+
fill: "none",
|
|
84213
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
84160
84214
|
},
|
|
84161
|
-
|
|
84162
|
-
|
|
84163
|
-
{
|
|
84164
|
-
enabled: true,
|
|
84165
|
-
disabled,
|
|
84166
|
-
label: `${I18n.t(
|
|
84167
|
-
"dataTable.filters.locationFilter.locations"
|
|
84168
|
-
)}${triggerLabel}`,
|
|
84169
|
-
onClear: () => {
|
|
84170
|
-
onChange([]);
|
|
84171
|
-
},
|
|
84172
|
-
block: true
|
|
84173
|
-
}
|
|
84174
|
-
) : /* @__PURE__ */ React76.createElement(
|
|
84175
|
-
QuickFilterLabel,
|
|
84215
|
+
/* @__PURE__ */ React76.createElement(
|
|
84216
|
+
"path",
|
|
84176
84217
|
{
|
|
84177
|
-
|
|
84178
|
-
|
|
84179
|
-
|
|
84180
|
-
|
|
84181
|
-
)}${triggerLabel}`,
|
|
84182
|
-
block: true
|
|
84218
|
+
fillRule: "evenodd",
|
|
84219
|
+
clipRule: "evenodd",
|
|
84220
|
+
d: "M3 5V7H17V5H3ZM8 15H12V13H8V15ZM15 11H5V9H15V11Z",
|
|
84221
|
+
fill: "currentColor"
|
|
84183
84222
|
}
|
|
84184
84223
|
)
|
|
84185
84224
|
);
|
|
84186
84225
|
};
|
|
84187
|
-
var
|
|
84188
|
-
|
|
84189
|
-
|
|
84226
|
+
var StyledFilterTokenWrapper = styled3.div`
|
|
84227
|
+
${UNSAFE_StyledFilterTokenLabel} {
|
|
84228
|
+
font-weight: ${typographyWeights.semibold};
|
|
84229
|
+
}
|
|
84190
84230
|
`;
|
|
84191
|
-
var
|
|
84192
|
-
const
|
|
84193
|
-
const
|
|
84194
|
-
|
|
84195
|
-
|
|
84196
|
-
|
|
84197
|
-
|
|
84198
|
-
|
|
84199
|
-
|
|
84200
|
-
headerName: columnDefinition.headerName,
|
|
84201
|
-
value: Array.isArray(value) ? value : [value]
|
|
84202
|
-
});
|
|
84203
|
-
} : void 0;
|
|
84204
|
-
return {
|
|
84205
|
-
components: {
|
|
84206
|
-
Label: React76.forwardRef(() => {
|
|
84207
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84208
|
-
const isValueEmpty = ["", null, void 0].includes(
|
|
84209
|
-
ctx.state.value
|
|
84210
|
-
);
|
|
84211
|
-
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
84212
|
-
isValueEmpty,
|
|
84213
|
-
ctx.state.selectedLabel,
|
|
84214
|
-
ctx.config.placeholder,
|
|
84215
|
-
filterName
|
|
84216
|
-
));
|
|
84217
|
-
}),
|
|
84218
|
-
TriggerContainer: React76.forwardRef((props, ref) => {
|
|
84219
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84220
|
-
if (!Array.isArray(ctx.state.value)) {
|
|
84221
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84222
|
-
UNSAFE_StyledSuperSelectTrigger,
|
|
84223
|
-
{
|
|
84224
|
-
$block: ctx.config.block,
|
|
84225
|
-
...props,
|
|
84226
|
-
ref
|
|
84227
|
-
}
|
|
84228
|
-
);
|
|
84231
|
+
var ClientSideQuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
84232
|
+
const { tableRef, filterState, getColumnDefinition } = useInternalTableContext();
|
|
84233
|
+
const hasNoContent = useTableHasNoContent();
|
|
84234
|
+
const { quickFilters, tokens } = React76.useMemo(() => {
|
|
84235
|
+
return filterState.allAvailableFilters.reduce(
|
|
84236
|
+
(acc, filter) => {
|
|
84237
|
+
const colDef = getColumnDefinition(filter.field);
|
|
84238
|
+
if (!colDef) {
|
|
84239
|
+
return acc;
|
|
84229
84240
|
}
|
|
84230
|
-
|
|
84231
|
-
|
|
84232
|
-
|
|
84233
|
-
|
|
84234
|
-
|
|
84235
|
-
|
|
84236
|
-
|
|
84237
|
-
(option2) => ctx.option.value(option2) === v
|
|
84238
|
-
);
|
|
84239
|
-
return option ? ctx.option.label(option) : "";
|
|
84240
|
-
}).join(", ")))
|
|
84241
|
-
},
|
|
84242
|
-
/* @__PURE__ */ React76.createElement(
|
|
84243
|
-
UNSAFE_StyledSuperSelectTrigger,
|
|
84244
|
-
{
|
|
84245
|
-
$block: ctx.config.block,
|
|
84246
|
-
...props,
|
|
84247
|
-
ref
|
|
84248
|
-
}
|
|
84249
|
-
)
|
|
84250
|
-
);
|
|
84251
|
-
}),
|
|
84252
|
-
MultiValueContainer: () => {
|
|
84253
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84254
|
-
if (Array.isArray(ctx.state.value)) {
|
|
84255
|
-
const isValueEmpty = !ctx.state.value.length;
|
|
84256
|
-
const value = ctx.state.value.length > 1 ? `(${ctx.state.value.length})` : ctx.state.value.length === 1 ? `${ctx.state.selectedLabel}` : "";
|
|
84257
|
-
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
84258
|
-
isValueEmpty,
|
|
84259
|
-
value,
|
|
84260
|
-
ctx.config.placeholder,
|
|
84261
|
-
filterName
|
|
84262
|
-
));
|
|
84241
|
+
const isInteractive = colDef?.filterProps?.isInteractiveFilterToken === true;
|
|
84242
|
+
const hasQuickFilterRenderer = !!colDef?.quickFilterRenderer;
|
|
84243
|
+
const filterIsActive = filter.instance.isFilterActive();
|
|
84244
|
+
if (hasQuickFilterRenderer || filterIsActive && isInteractive && getQuickFilterRenderer(colDef) !== null) {
|
|
84245
|
+
return { ...acc, quickFilters: [...acc.quickFilters, filter] };
|
|
84246
|
+
} else if (filterIsActive) {
|
|
84247
|
+
return { ...acc, tokens: [...acc.tokens, filter] };
|
|
84263
84248
|
}
|
|
84264
|
-
return
|
|
84249
|
+
return acc;
|
|
84250
|
+
},
|
|
84251
|
+
{
|
|
84252
|
+
quickFilters: [],
|
|
84253
|
+
tokens: []
|
|
84265
84254
|
}
|
|
84255
|
+
);
|
|
84256
|
+
}, [filterState.allAvailableFilters, getColumnDefinition]);
|
|
84257
|
+
const isEmpty2 = quickFilters.length === 0 && tokens.length === 0;
|
|
84258
|
+
return isEmpty2 ? null : /* @__PURE__ */ React76.createElement(
|
|
84259
|
+
FlexList,
|
|
84260
|
+
{
|
|
84261
|
+
padding: "xs none",
|
|
84262
|
+
size: "none",
|
|
84263
|
+
alignItems: "center",
|
|
84264
|
+
wrap: "wrap",
|
|
84265
|
+
gap: "sm"
|
|
84266
84266
|
},
|
|
84267
|
-
|
|
84268
|
-
|
|
84269
|
-
|
|
84270
|
-
|
|
84271
|
-
|
|
84272
|
-
|
|
84273
|
-
|
|
84274
|
-
|
|
84275
|
-
|
|
84276
|
-
|
|
84277
|
-
|
|
84278
|
-
|
|
84279
|
-
|
|
84280
|
-
|
|
84281
|
-
|
|
84282
|
-
|
|
84283
|
-
|
|
84284
|
-
|
|
84267
|
+
quickFilters.map((filter) => {
|
|
84268
|
+
const colDef = getColumnDefinition(filter.field);
|
|
84269
|
+
const QuickFilter = getQuickFilterRenderer(colDef);
|
|
84270
|
+
if (!colDef || !QuickFilter) {
|
|
84271
|
+
return null;
|
|
84272
|
+
}
|
|
84273
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84274
|
+
EmptyResultsControlTooltip,
|
|
84275
|
+
{
|
|
84276
|
+
featureI18nKey: "featureQuickFilter",
|
|
84277
|
+
enabled: hasNoContent
|
|
84278
|
+
},
|
|
84279
|
+
/* @__PURE__ */ React76.createElement(
|
|
84280
|
+
QuickFilter,
|
|
84281
|
+
{
|
|
84282
|
+
key: filter.field,
|
|
84283
|
+
filter,
|
|
84284
|
+
columnDefinition: colDef,
|
|
84285
|
+
disabled: hasNoContent,
|
|
84286
|
+
onChange: (value) => tableRef?.current?.applyListFilter(filter.field, value),
|
|
84287
|
+
onRemove: () => tableRef?.current?.removeFilter(filter.field),
|
|
84288
|
+
overlayMatchesTriggerWidth
|
|
84289
|
+
}
|
|
84290
|
+
)
|
|
84291
|
+
);
|
|
84292
|
+
}),
|
|
84293
|
+
tokens.map((filter) => {
|
|
84294
|
+
const colDef = getColumnDefinition(filter.field);
|
|
84295
|
+
if (!colDef) {
|
|
84296
|
+
return null;
|
|
84297
|
+
}
|
|
84298
|
+
return /* @__PURE__ */ React76.createElement(StyledFilterTokenWrapper, { key: filter.field }, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken, null, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken.Label, null, getFilterTokenText(colDef, filter.filterValues)), /* @__PURE__ */ React76.createElement(
|
|
84299
|
+
UNSAFE_FilterToken.Remove,
|
|
84300
|
+
{
|
|
84301
|
+
onClick: () => tableRef?.current?.removeFilter(filter.field)
|
|
84285
84302
|
}
|
|
84286
|
-
|
|
84287
|
-
|
|
84288
|
-
|
|
84303
|
+
)));
|
|
84304
|
+
})
|
|
84305
|
+
);
|
|
84306
|
+
};
|
|
84307
|
+
var ServerSideQuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
84308
|
+
const {
|
|
84309
|
+
filterStorage: {
|
|
84310
|
+
hasDefinedFilters,
|
|
84311
|
+
onClearFilter,
|
|
84312
|
+
possibleFilters,
|
|
84313
|
+
selectedFilters,
|
|
84314
|
+
getListFilter
|
|
84315
|
+
},
|
|
84316
|
+
getColumnDefinition
|
|
84317
|
+
} = useInternalTableContext();
|
|
84318
|
+
const hasNoContent = useTableHasNoContent();
|
|
84319
|
+
const { quickFilterNames, tokenNames } = React76.useMemo(() => {
|
|
84320
|
+
const appliedFilterNames = Object.keys(selectedFilters);
|
|
84321
|
+
const isActiveFilter = (filterName) => appliedFilterNames.includes(filterName);
|
|
84322
|
+
return possibleFilters.reduce(
|
|
84323
|
+
(acc, filterName) => {
|
|
84324
|
+
const colDef = getColumnDefinition(filterName);
|
|
84325
|
+
if (!colDef) {
|
|
84326
|
+
return acc;
|
|
84289
84327
|
}
|
|
84290
|
-
|
|
84291
|
-
|
|
84292
|
-
|
|
84293
|
-
|
|
84294
|
-
|
|
84295
|
-
|
|
84296
|
-
|
|
84328
|
+
const isInteractive = colDef?.filterProps?.isInteractiveFilterToken === true;
|
|
84329
|
+
const hasQuickFilterRenderer = !!colDef?.quickFilterRenderer;
|
|
84330
|
+
const filterIsActive = isActiveFilter(filterName);
|
|
84331
|
+
if (hasQuickFilterRenderer || filterIsActive && isInteractive && getQuickFilterRenderer(colDef) !== null) {
|
|
84332
|
+
return {
|
|
84333
|
+
...acc,
|
|
84334
|
+
quickFilterNames: [...acc.quickFilterNames, filterName]
|
|
84335
|
+
};
|
|
84336
|
+
} else if (filterIsActive) {
|
|
84337
|
+
return {
|
|
84338
|
+
...acc,
|
|
84339
|
+
tokenNames: [...acc.tokenNames, filterName]
|
|
84340
|
+
};
|
|
84297
84341
|
}
|
|
84298
|
-
|
|
84299
|
-
|
|
84300
|
-
|
|
84301
|
-
|
|
84342
|
+
return acc;
|
|
84343
|
+
},
|
|
84344
|
+
{
|
|
84345
|
+
quickFilterNames: [],
|
|
84346
|
+
tokenNames: []
|
|
84347
|
+
}
|
|
84348
|
+
);
|
|
84349
|
+
}, [possibleFilters, selectedFilters, getColumnDefinition]);
|
|
84350
|
+
if (!hasDefinedFilters) {
|
|
84351
|
+
return null;
|
|
84352
|
+
}
|
|
84353
|
+
const isEmpty2 = quickFilterNames.length === 0 && tokenNames.length === 0;
|
|
84354
|
+
return isEmpty2 ? null : /* @__PURE__ */ React76.createElement(
|
|
84355
|
+
FlexList,
|
|
84356
|
+
{
|
|
84357
|
+
padding: "xs none",
|
|
84358
|
+
size: "none",
|
|
84359
|
+
alignItems: "center",
|
|
84360
|
+
wrap: "wrap",
|
|
84361
|
+
gap: "sm",
|
|
84362
|
+
"data-qa": "data-table-quick-filters"
|
|
84363
|
+
},
|
|
84364
|
+
quickFilterNames.map((fieldName) => {
|
|
84365
|
+
const colDef = getColumnDefinition(fieldName);
|
|
84366
|
+
const QuickFilter = getQuickFilterRenderer(colDef);
|
|
84367
|
+
if (!colDef || !QuickFilter) {
|
|
84368
|
+
return null;
|
|
84369
|
+
}
|
|
84370
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84371
|
+
EmptyResultsControlTooltip,
|
|
84372
|
+
{
|
|
84373
|
+
featureI18nKey: "featureQuickFilter",
|
|
84374
|
+
enabled: hasNoContent
|
|
84375
|
+
},
|
|
84376
|
+
/* @__PURE__ */ React76.createElement(
|
|
84377
|
+
QuickFilter,
|
|
84378
|
+
{
|
|
84379
|
+
key: fieldName,
|
|
84380
|
+
columnDefinition: colDef,
|
|
84381
|
+
disabled: hasNoContent,
|
|
84382
|
+
overlayMatchesTriggerWidth
|
|
84302
84383
|
}
|
|
84303
|
-
|
|
84384
|
+
)
|
|
84385
|
+
);
|
|
84386
|
+
}),
|
|
84387
|
+
tokenNames.map((fieldName) => {
|
|
84388
|
+
const colDef = getColumnDefinition(fieldName);
|
|
84389
|
+
if (!colDef) {
|
|
84390
|
+
return null;
|
|
84304
84391
|
}
|
|
84305
|
-
|
|
84306
|
-
|
|
84307
|
-
|
|
84308
|
-
|
|
84309
|
-
|
|
84310
|
-
|
|
84311
|
-
|
|
84312
|
-
|
|
84313
|
-
|
|
84314
|
-
var ClientSideMultiSelectQuickFilter = ({
|
|
84315
|
-
filter,
|
|
84316
|
-
columnDefinition,
|
|
84317
|
-
onChange,
|
|
84318
|
-
onRemove,
|
|
84319
|
-
overlayMatchesTriggerWidth,
|
|
84320
|
-
disabled
|
|
84321
|
-
}) => {
|
|
84322
|
-
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(filter.filterValues?.length) }, /* @__PURE__ */ React76.createElement(
|
|
84323
|
-
UNSAFE_SuperSelect,
|
|
84324
|
-
{
|
|
84325
|
-
overlayMatchesTriggerWidth,
|
|
84326
|
-
value: filter.filterValues === null ? [] : filter.filterValues,
|
|
84327
|
-
search: false,
|
|
84328
|
-
multiple: true,
|
|
84329
|
-
options: filter.options,
|
|
84330
|
-
disabled,
|
|
84331
|
-
getOptionValue: (option) => {
|
|
84332
|
-
return getId(columnDefinition.filterProps?.getId, option);
|
|
84333
|
-
},
|
|
84334
|
-
getOptionLabel: (option) => {
|
|
84335
|
-
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
84336
|
-
},
|
|
84337
|
-
onChange: (values2) => {
|
|
84338
|
-
if (Array.isArray(values2) && !values2.length) {
|
|
84339
|
-
onRemove?.();
|
|
84340
|
-
return;
|
|
84392
|
+
const filter = getListFilter(fieldName);
|
|
84393
|
+
return /* @__PURE__ */ React76.createElement(StyledFilterTokenWrapper, { key: fieldName }, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken, null, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken.Label, null, getFilterTokenText(
|
|
84394
|
+
colDef,
|
|
84395
|
+
colDef.filterRenderer === DateFilterRenderer_default ? filter.value : filter.selected
|
|
84396
|
+
)), /* @__PURE__ */ React76.createElement(
|
|
84397
|
+
UNSAFE_FilterToken.Remove,
|
|
84398
|
+
{
|
|
84399
|
+
"data-qa": "data-table-quick-filter-remove-token",
|
|
84400
|
+
onClick: () => onClearFilter(fieldName)
|
|
84341
84401
|
}
|
|
84342
|
-
|
|
84343
|
-
|
|
84344
|
-
|
|
84345
|
-
}
|
|
84346
|
-
));
|
|
84402
|
+
)));
|
|
84403
|
+
})
|
|
84404
|
+
);
|
|
84347
84405
|
};
|
|
84348
|
-
var
|
|
84349
|
-
|
|
84350
|
-
|
|
84351
|
-
|
|
84352
|
-
|
|
84353
|
-
|
|
84354
|
-
|
|
84355
|
-
|
|
84356
|
-
const valueIds = originValue.map((option) => getId(getId3, option));
|
|
84357
|
-
isValueFromOptions.current = true;
|
|
84358
|
-
return originOptions.filter(
|
|
84359
|
-
(option) => valueIds.includes(getId(getId3, option))
|
|
84406
|
+
var QuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
84407
|
+
const { onServerSideDataRequest } = useInternalTableContext();
|
|
84408
|
+
if (onServerSideDataRequest) {
|
|
84409
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84410
|
+
ServerSideQuickFilters,
|
|
84411
|
+
{
|
|
84412
|
+
overlayMatchesTriggerWidth
|
|
84413
|
+
}
|
|
84360
84414
|
);
|
|
84361
|
-
}
|
|
84362
|
-
|
|
84363
|
-
|
|
84364
|
-
const options = !hasOptions && hasValue ? originValue : originOptions;
|
|
84365
|
-
const value = !hasOptions ? originValue : isValueFromOptions.current ? originValue : getValueFromOptions();
|
|
84366
|
-
return {
|
|
84367
|
-
options,
|
|
84368
|
-
value,
|
|
84369
|
-
getOptionValue: (option) => option
|
|
84370
|
-
};
|
|
84371
|
-
};
|
|
84372
|
-
var ServerSideMultiSelectQuickFilter = ({ columnDefinition, overlayMatchesTriggerWidth, disabled }) => {
|
|
84373
|
-
const {
|
|
84374
|
-
options: originOptions,
|
|
84375
|
-
onClearFilter,
|
|
84376
|
-
fieldName,
|
|
84377
|
-
value: originValue = [],
|
|
84378
|
-
onChange,
|
|
84379
|
-
getOptions,
|
|
84380
|
-
loading
|
|
84381
|
-
} = useServerSideFilter({ columnDefinition });
|
|
84382
|
-
const { options, value, getOptionValue } = useSuperSelectOptionAsValueWorkaround2({
|
|
84383
|
-
originOptions,
|
|
84384
|
-
originValue,
|
|
84385
|
-
loading,
|
|
84386
|
-
getId: columnDefinition.filterProps?.getId
|
|
84387
|
-
});
|
|
84388
|
-
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(value?.length) }, /* @__PURE__ */ React76.createElement(
|
|
84389
|
-
UNSAFE_SuperSelect,
|
|
84415
|
+
}
|
|
84416
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84417
|
+
ClientSideQuickFilters,
|
|
84390
84418
|
{
|
|
84391
|
-
overlayMatchesTriggerWidth
|
|
84392
|
-
loading,
|
|
84393
|
-
value: value === null ? [] : value,
|
|
84394
|
-
search: false,
|
|
84395
|
-
getOptionLabel: (option) => {
|
|
84396
|
-
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
84397
|
-
},
|
|
84398
|
-
getOptionValue,
|
|
84399
|
-
multiple: true,
|
|
84400
|
-
options,
|
|
84401
|
-
disabled,
|
|
84402
|
-
onChange: (values2) => {
|
|
84403
|
-
if (Array.isArray(values2) && !values2.length) {
|
|
84404
|
-
onClearFilter?.(fieldName);
|
|
84405
|
-
getOptions();
|
|
84406
|
-
return;
|
|
84407
|
-
}
|
|
84408
|
-
onChange(values2);
|
|
84409
|
-
},
|
|
84410
|
-
onOpenChange: (open) => {
|
|
84411
|
-
if (open && !originOptions.length) {
|
|
84412
|
-
getOptions();
|
|
84413
|
-
}
|
|
84414
|
-
},
|
|
84415
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84419
|
+
overlayMatchesTriggerWidth
|
|
84416
84420
|
}
|
|
84417
|
-
)
|
|
84421
|
+
);
|
|
84418
84422
|
};
|
|
84419
|
-
var
|
|
84423
|
+
var FiltersPanelButton = () => {
|
|
84420
84424
|
const { onServerSideDataRequest } = useInternalTableContext();
|
|
84421
|
-
if (
|
|
84422
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84425
|
+
if (onServerSideDataRequest) {
|
|
84426
|
+
return /* @__PURE__ */ React76.createElement(ServerSideFiltersPanelToggleButton, null);
|
|
84423
84427
|
}
|
|
84424
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84428
|
+
return /* @__PURE__ */ React76.createElement(ClientSideFiltersPanelToggleButton, null);
|
|
84425
84429
|
};
|
|
84426
|
-
var
|
|
84427
|
-
|
|
84428
|
-
|
|
84429
|
-
|
|
84430
|
-
|
|
84431
|
-
|
|
84432
|
-
|
|
84433
|
-
|
|
84434
|
-
|
|
84430
|
+
var RowGroupSelector = ({ localeText }) => {
|
|
84431
|
+
const {
|
|
84432
|
+
columnDefinitions: _columnDefinitions,
|
|
84433
|
+
columnApi,
|
|
84434
|
+
gridApi,
|
|
84435
|
+
tableRef
|
|
84436
|
+
} = useInternalTableContext();
|
|
84437
|
+
const hasNoContent = useTableHasNoContent();
|
|
84438
|
+
const [columnDefinitions, setColumnDefinitions] = React76.useState(_columnDefinitions);
|
|
84439
|
+
const groupableColumns = React76.useMemo(
|
|
84440
|
+
() => mapColumnsToOptions(
|
|
84441
|
+
columnDefinitions.filter((column2) => column2.enableRowGroup)
|
|
84442
|
+
),
|
|
84443
|
+
[columnDefinitions]
|
|
84444
|
+
);
|
|
84445
|
+
const groupedColumns = React76.useMemo(() => {
|
|
84446
|
+
const rowGrouping = columnApi?.getRowGroupColumns() ?? [];
|
|
84447
|
+
return rowGrouping.map((column2) => {
|
|
84448
|
+
const colDef = column2.getColDef();
|
|
84449
|
+
return transformToColumnDefinition(colDef);
|
|
84450
|
+
});
|
|
84451
|
+
}, [columnDefinitions]);
|
|
84452
|
+
const selectedColumns = React76.useMemo(
|
|
84453
|
+
() => mapColumnsToOptions(groupedColumns),
|
|
84454
|
+
[groupedColumns]
|
|
84455
|
+
);
|
|
84456
|
+
const onGroupedClear = React76.useCallback(() => {
|
|
84457
|
+
tableRef?.current?.setRowGrouping([]);
|
|
84458
|
+
}, [tableRef]);
|
|
84459
|
+
const onGroupedRowChange = React76.useCallback(
|
|
84460
|
+
(newValue) => {
|
|
84461
|
+
const fields = newValue.map((val) => {
|
|
84462
|
+
return val.id;
|
|
84463
|
+
});
|
|
84464
|
+
if (!equals(selectedColumns, newValue)) {
|
|
84465
|
+
tableRef?.current?.setRowGrouping(fields);
|
|
84466
|
+
}
|
|
84467
|
+
},
|
|
84468
|
+
[selectedColumns]
|
|
84469
|
+
);
|
|
84470
|
+
React76.useEffect(() => {
|
|
84471
|
+
function onDisplayedColumnsChanged(event) {
|
|
84472
|
+
const agColumnDefs = event.api.getColumnDefs();
|
|
84473
|
+
if (agColumnDefs?.length) {
|
|
84474
|
+
const flattenedAgColDefs = flattenColDefs(event.api.getColumnDefs());
|
|
84475
|
+
const dataTableColumnDefinitions = flattenedAgColDefs.map(
|
|
84476
|
+
transformToColumnDefinition
|
|
84477
|
+
);
|
|
84478
|
+
setColumnDefinitions(dataTableColumnDefinitions);
|
|
84479
|
+
}
|
|
84480
|
+
}
|
|
84481
|
+
gridApi?.addEventListener(
|
|
84482
|
+
"displayedColumnsChanged",
|
|
84483
|
+
onDisplayedColumnsChanged
|
|
84484
|
+
);
|
|
84485
|
+
return () => {
|
|
84486
|
+
removeEventListenerFromGrid(
|
|
84487
|
+
"displayedColumnsChanged",
|
|
84488
|
+
onDisplayedColumnsChanged,
|
|
84489
|
+
gridApi
|
|
84490
|
+
);
|
|
84491
|
+
};
|
|
84492
|
+
}, [gridApi]);
|
|
84493
|
+
if (groupableColumns.length === 0) {
|
|
84494
|
+
return null;
|
|
84495
|
+
}
|
|
84435
84496
|
return /* @__PURE__ */ React76.createElement(
|
|
84436
|
-
|
|
84497
|
+
EmptyResultsControlTooltip,
|
|
84437
84498
|
{
|
|
84438
|
-
|
|
84439
|
-
|
|
84499
|
+
featureI18nKey: "featureGroupBy",
|
|
84500
|
+
enabled: hasNoContent
|
|
84440
84501
|
},
|
|
84441
84502
|
/* @__PURE__ */ React76.createElement(
|
|
84442
|
-
|
|
84503
|
+
Tooltip,
|
|
84443
84504
|
{
|
|
84444
|
-
|
|
84445
|
-
|
|
84446
|
-
|
|
84447
|
-
|
|
84448
|
-
|
|
84449
|
-
|
|
84450
|
-
|
|
84451
|
-
|
|
84452
|
-
|
|
84453
|
-
|
|
84454
|
-
|
|
84455
|
-
|
|
84456
|
-
|
|
84457
|
-
|
|
84458
|
-
|
|
84459
|
-
|
|
84460
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84461
|
-
}
|
|
84505
|
+
overlay: localeText.placeholder,
|
|
84506
|
+
trigger: "hover",
|
|
84507
|
+
placement: "top",
|
|
84508
|
+
showDelay: 400
|
|
84509
|
+
},
|
|
84510
|
+
/* @__PURE__ */ React76.createElement(Box, { style: { width: "100%" } }, /* @__PURE__ */ React76.createElement(
|
|
84511
|
+
GroupBySelect,
|
|
84512
|
+
{
|
|
84513
|
+
isDisabled: hasNoContent,
|
|
84514
|
+
localeText,
|
|
84515
|
+
onBlur: onGroupedRowChange,
|
|
84516
|
+
onClear: onGroupedClear,
|
|
84517
|
+
options: groupableColumns,
|
|
84518
|
+
selected: selectedColumns
|
|
84519
|
+
}
|
|
84520
|
+
))
|
|
84462
84521
|
)
|
|
84463
84522
|
);
|
|
84464
84523
|
};
|
|
84465
|
-
|
|
84466
|
-
|
|
84467
|
-
|
|
84468
|
-
|
|
84469
|
-
|
|
84524
|
+
function mapColumnsToOptions(columnDefinitions) {
|
|
84525
|
+
return columnDefinitions.map((col) => {
|
|
84526
|
+
return {
|
|
84527
|
+
label: col.headerName,
|
|
84528
|
+
id: col.field,
|
|
84529
|
+
key: col.field,
|
|
84530
|
+
group: col.columnGroupName
|
|
84531
|
+
};
|
|
84532
|
+
});
|
|
84533
|
+
}
|
|
84534
|
+
var cx21 = classnames.bind(quickControlsStyles_default);
|
|
84535
|
+
var ClientSideSearch = ({
|
|
84536
|
+
onSearch,
|
|
84537
|
+
placeholder
|
|
84470
84538
|
}) => {
|
|
84471
|
-
const
|
|
84472
|
-
const
|
|
84473
|
-
|
|
84474
|
-
|
|
84475
|
-
|
|
84476
|
-
|
|
84477
|
-
|
|
84478
|
-
|
|
84479
|
-
|
|
84480
|
-
|
|
84481
|
-
const
|
|
84482
|
-
|
|
84483
|
-
|
|
84484
|
-
|
|
84485
|
-
|
|
84486
|
-
|
|
84487
|
-
|
|
84539
|
+
const [internalValue, setInternalValue] = React76.useState("");
|
|
84540
|
+
const { tableRef } = useInternalTableContext();
|
|
84541
|
+
const hasNoContent = useTableHasNoContent();
|
|
84542
|
+
const I18n = useI18nContext();
|
|
84543
|
+
const debouncedSetSearchValue = React76.useCallback(
|
|
84544
|
+
debounce5((value) => {
|
|
84545
|
+
tableRef?.current?.setSearchValue(value);
|
|
84546
|
+
}, 250),
|
|
84547
|
+
[tableRef?.current?.setSearchValue]
|
|
84548
|
+
);
|
|
84549
|
+
const onChange = React76.useCallback(
|
|
84550
|
+
(value, event) => {
|
|
84551
|
+
setInternalValue(value);
|
|
84552
|
+
if (onSearch) {
|
|
84553
|
+
onSearch(event);
|
|
84554
|
+
} else {
|
|
84555
|
+
debouncedSetSearchValue(value);
|
|
84556
|
+
}
|
|
84557
|
+
},
|
|
84558
|
+
[debouncedSetSearchValue, onSearch]
|
|
84559
|
+
);
|
|
84560
|
+
return /* @__PURE__ */ React76.createElement(EmptyResultsControlTooltip, { hasSearch: true, enabled: hasNoContent }, /* @__PURE__ */ React76.createElement(
|
|
84561
|
+
Typeahead,
|
|
84562
|
+
{
|
|
84563
|
+
disabled: hasNoContent,
|
|
84564
|
+
"data-qa": "data-table-search",
|
|
84565
|
+
value: internalValue,
|
|
84566
|
+
className: cx21("search", {
|
|
84567
|
+
"search--empty": !internalValue.length
|
|
84568
|
+
}),
|
|
84569
|
+
onChange,
|
|
84570
|
+
placeholder: placeholder || I18n.t("dataTable.search")
|
|
84571
|
+
}
|
|
84572
|
+
));
|
|
84488
84573
|
};
|
|
84489
|
-
var
|
|
84490
|
-
const {
|
|
84491
|
-
|
|
84492
|
-
|
|
84493
|
-
|
|
84494
|
-
|
|
84495
|
-
|
|
84496
|
-
|
|
84497
|
-
|
|
84498
|
-
|
|
84499
|
-
const
|
|
84500
|
-
|
|
84501
|
-
|
|
84502
|
-
|
|
84503
|
-
|
|
84504
|
-
|
|
84505
|
-
|
|
84506
|
-
|
|
84507
|
-
|
|
84508
|
-
|
|
84509
|
-
|
|
84574
|
+
var Search = (props) => {
|
|
84575
|
+
const { onServerSideDataRequest } = useInternalTableContext();
|
|
84576
|
+
if (onServerSideDataRequest) {
|
|
84577
|
+
return /* @__PURE__ */ React76.createElement(ServerSideSearch, { ...props });
|
|
84578
|
+
}
|
|
84579
|
+
return /* @__PURE__ */ React76.createElement(ClientSideSearch, { ...props });
|
|
84580
|
+
};
|
|
84581
|
+
|
|
84582
|
+
// src/QuickControls/QuickControls.tsx
|
|
84583
|
+
var QuickControls = (props) => {
|
|
84584
|
+
const I18n = useI18nContext();
|
|
84585
|
+
if (props.children) {
|
|
84586
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84587
|
+
Box,
|
|
84588
|
+
{
|
|
84589
|
+
"data-qa": "data-table-quick-controls",
|
|
84590
|
+
padding: "xs none",
|
|
84591
|
+
style: props.style
|
|
84592
|
+
},
|
|
84593
|
+
props.children
|
|
84594
|
+
);
|
|
84595
|
+
}
|
|
84596
|
+
return /* @__PURE__ */ React76.createElement(Box, { padding: "xs none", style: props.style }, /* @__PURE__ */ React76.createElement(Box, { padding: "xs none", display: "flex-row", justifyContent: "space-between" }, /* @__PURE__ */ React76.createElement(FlexList, { size: "xs", alignItems: "center", marginRight: "sm" }, /* @__PURE__ */ React76.createElement(
|
|
84597
|
+
Search,
|
|
84598
|
+
{
|
|
84599
|
+
onSearch: props.onSearch,
|
|
84600
|
+
placeholder: props.placeholder,
|
|
84601
|
+
disabled: props.disabledSearch
|
|
84510
84602
|
}
|
|
84511
|
-
|
|
84512
|
-
|
|
84513
|
-
|
|
84514
|
-
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
|
|
84603
|
+
), /* @__PURE__ */ React76.createElement(FiltersPanelButton, null)), /* @__PURE__ */ React76.createElement(FlexList, { size: "xs", alignItems: "center" }, /* @__PURE__ */ React76.createElement(
|
|
84604
|
+
RowGroupSelector,
|
|
84605
|
+
{
|
|
84606
|
+
localeText: {
|
|
84607
|
+
reset: I18n.t("dataTable.tableSettings.reset"),
|
|
84608
|
+
placeholder: I18n.t("dataTable.tableSettings.selectColumnGroup"),
|
|
84609
|
+
selectedItemsPrefix: I18n.t("dataTable.tableSettings.groupBy")
|
|
84610
|
+
}
|
|
84518
84611
|
}
|
|
84519
|
-
|
|
84520
|
-
|
|
84521
|
-
|
|
84522
|
-
|
|
84523
|
-
getOptions();
|
|
84612
|
+
), /* @__PURE__ */ React76.createElement(ConfigPanelButton, null))), /* @__PURE__ */ React76.createElement(
|
|
84613
|
+
QuickFilters,
|
|
84614
|
+
{
|
|
84615
|
+
overlayMatchesTriggerWidth: props.filterOverlayMatchesTriggerWidth
|
|
84524
84616
|
}
|
|
84525
|
-
|
|
84617
|
+
));
|
|
84618
|
+
};
|
|
84619
|
+
|
|
84620
|
+
// src/utils/addSubcomponents.ts
|
|
84621
|
+
var addSubcomponents = (subs, parent) => {
|
|
84622
|
+
const assigned = parent;
|
|
84623
|
+
Object.keys(subs).forEach((key) => {
|
|
84624
|
+
assigned[key] = subs[key];
|
|
84625
|
+
});
|
|
84626
|
+
return assigned;
|
|
84627
|
+
};
|
|
84628
|
+
|
|
84629
|
+
// src/ClientSideDataTable.tsx
|
|
84630
|
+
var ClientSideDataTable = ({
|
|
84631
|
+
analytics,
|
|
84632
|
+
children,
|
|
84633
|
+
columnDefinitions: _columnDefinitions,
|
|
84634
|
+
customBulkEditorFields,
|
|
84635
|
+
enableDynamicRowHeight,
|
|
84636
|
+
enableGroupEditAndValidation,
|
|
84637
|
+
filterGroups,
|
|
84638
|
+
getRowId,
|
|
84639
|
+
initialTableConfig: _initialTableConfig,
|
|
84640
|
+
onBulkEditUpdate,
|
|
84641
|
+
onTableConfigChange,
|
|
84642
|
+
translations: translations2 = {},
|
|
84643
|
+
enableCellTextSelection,
|
|
84644
|
+
localStoragePersistenceKey
|
|
84645
|
+
}) => {
|
|
84526
84646
|
return /* @__PURE__ */ React76.createElement(
|
|
84527
|
-
|
|
84647
|
+
DataTable,
|
|
84528
84648
|
{
|
|
84529
|
-
|
|
84530
|
-
|
|
84649
|
+
analytics,
|
|
84650
|
+
columnDefinitions: _columnDefinitions,
|
|
84651
|
+
enableGroupEditAndValidation,
|
|
84652
|
+
enableDynamicRowHeight,
|
|
84653
|
+
filterGroups,
|
|
84654
|
+
getRowId,
|
|
84655
|
+
initialTableConfig: _initialTableConfig,
|
|
84656
|
+
onTableConfigChange,
|
|
84657
|
+
onBulkEditUpdate,
|
|
84658
|
+
showExpandCollapseAllToggle: true,
|
|
84659
|
+
translations: translations2,
|
|
84660
|
+
localStoragePersistenceKey,
|
|
84661
|
+
customBulkEditorFields,
|
|
84662
|
+
enableCellTextSelection
|
|
84531
84663
|
},
|
|
84532
|
-
|
|
84533
|
-
UNSAFE_SuperSelect,
|
|
84534
|
-
{
|
|
84535
|
-
overlayMatchesTriggerWidth,
|
|
84536
|
-
loading,
|
|
84537
|
-
value: value ?? [],
|
|
84538
|
-
search: false,
|
|
84539
|
-
disabled,
|
|
84540
|
-
getOptionLabel: (option) => getLabel(columnDefinition.filterProps?.getLabel, option),
|
|
84541
|
-
getOptionValue,
|
|
84542
|
-
multiple: false,
|
|
84543
|
-
options,
|
|
84544
|
-
onChange: handleOnChange,
|
|
84545
|
-
onOpenChange: handleOnOpenChange,
|
|
84546
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84547
|
-
}
|
|
84548
|
-
)
|
|
84664
|
+
children
|
|
84549
84665
|
);
|
|
84550
84666
|
};
|
|
84551
|
-
var
|
|
84552
|
-
const
|
|
84553
|
-
|
|
84554
|
-
|
|
84555
|
-
}
|
|
84556
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84667
|
+
var Table2 = (props) => {
|
|
84668
|
+
const internalTableContext = useInternalTableContext();
|
|
84669
|
+
React76.useEffect(() => {
|
|
84670
|
+
internalTableContext.setTotalRowCount(props.rows?.length ?? 0);
|
|
84671
|
+
}, [props.rows]);
|
|
84672
|
+
return /* @__PURE__ */ React76.createElement(Table, { ...props, modules: [ClientSideRowModelModule] });
|
|
84557
84673
|
};
|
|
84558
|
-
|
|
84674
|
+
BulkActions.displayName = "ClientSideDataTable.BulkActions";
|
|
84675
|
+
ConfigPanelButton.displayName = "ClientSideDataTable.ConfigPanelButton";
|
|
84676
|
+
ContextPanel.displayName = "ClientSideDataTable.ContextPanel";
|
|
84677
|
+
QuickControls.displayName = "ClientSideDataTable.QuickControls";
|
|
84678
|
+
QuickFilters.displayName = "ClientSideDataTable.QuickFilters";
|
|
84679
|
+
RowGroupSelector.displayName = "ClientSideDataTable.RowGroupSelector";
|
|
84680
|
+
Search.displayName = "ClientSideDataTable.Search";
|
|
84681
|
+
Table2.displayName = "ClientSideDataTable.Table";
|
|
84682
|
+
FiltersPanel.displayName = "ClientSideDataTable.FiltersPanel";
|
|
84683
|
+
var ClientSideDataTable_default = addSubcomponents(
|
|
84684
|
+
{
|
|
84685
|
+
BulkActions,
|
|
84686
|
+
BulkEditActionButton,
|
|
84687
|
+
ConfigPanelButton,
|
|
84688
|
+
ContextPanel,
|
|
84689
|
+
QuickControls,
|
|
84690
|
+
QuickFilters,
|
|
84691
|
+
RowGroupSelector,
|
|
84692
|
+
Search,
|
|
84693
|
+
Table: Table2,
|
|
84694
|
+
FiltersPanel,
|
|
84695
|
+
FiltersPanelButton
|
|
84696
|
+
},
|
|
84697
|
+
ClientSideDataTable
|
|
84698
|
+
);
|
|
84559
84699
|
|
|
84560
84700
|
// ../../node_modules/@ag-grid-enterprise/server-side-row-model/dist/esm/es6/serverSideRowModel/stores/fullStore.mjs
|
|
84561
84701
|
var __decorate212 = function(decorators, target, key, desc) {
|
|
@@ -89096,4 +89236,4 @@ object-assign/index.js:
|
|
|
89096
89236
|
*)
|
|
89097
89237
|
*/
|
|
89098
89238
|
|
|
89099
|
-
export { Analytics_default as Analytics, AnalyticsBulkClient, BooleanCellEditor, BooleanCellRenderer, ButtonsCellRenderer, ClientSideDataTable_default as ClientSideDataTable, CompanyCellRenderer, CurrencyCellEditor, CurrencyCellRenderer, DateCellEditor, DateCellRenderer, DateFilterRenderer_default as DateFilterRenderer, DateQuickFilterRenderer_default as DateQuickFilterRenderer, DateTimeCellEditor, DateTimeCellRenderer, GrandTotalsLabelRenderer, GroupCellRenderer2 as GroupCellRenderer, LinkCellRenderer, LocationFilterRenderer, LocationQuickFilterRenderer_default as LocationQuickFilterRenderer, MultiSelectCellEditor, MultiSelectCellRenderer, MultiSelectFilterRenderer_default as MultiSelectFilterRenderer, MultiSelectQuickFilterRenderer_default as MultiSelectQuickFilterRenderer, NumberCellEditor2 as NumberCellEditor, NumberCellRenderer, NumberFilterRenderer, PeopleCellRenderer, PercentCellEditor, PercentCellRenderer, PersonCellRenderer, PillCellRenderer, PillSelectCellEditor, SelectAllState, SelectCellEditor2 as SelectCellEditor, SelectCellRenderer, ServerSideDataTable_default as ServerSideDataTable, SingleSelectQuickFilterRenderer_default as SingleSelectQuickFilterRenderer, TextCellEditor2 as TextCellEditor, TextCellRenderer, UNSAFE_useTableContext, rowSize, useAnalyticsContext, useRowSelectionState, waitForAsyncCondition, withDataTableEditor, withDataTableRenderer };
|
|
89239
|
+
export { Analytics_default as Analytics, AnalyticsBulkClient, BooleanCellEditor, BooleanCellRenderer, ButtonsCellRenderer, ClientSideDataTable_default as ClientSideDataTable, CompanyCellRenderer, CurrencyCellEditor, CurrencyCellRenderer, DateCellEditor, DateCellRenderer, DateFilterRenderer_default as DateFilterRenderer, DateQuickFilterRenderer_default as DateQuickFilterRenderer, DateTimeCellEditor, DateTimeCellRenderer, GrandTotalsLabelRenderer, GroupCellRenderer2 as GroupCellRenderer, LinkCellRenderer, LocationFilterRenderer, LocationQuickFilterRenderer_default as LocationQuickFilterRenderer, MultiSelectCellEditor, MultiSelectCellRenderer, MultiSelectFilterRenderer_default as MultiSelectFilterRenderer, MultiSelectQuickFilterRenderer_default as MultiSelectQuickFilterRenderer, NumberCellEditor2 as NumberCellEditor, NumberCellRenderer, NumberFilterRenderer, PeopleCellRenderer, PercentCellEditor, PercentCellRenderer, PersonCellRenderer, PillCellRenderer, PillSelectCellEditor, SelectAllState, SelectCellEditor2 as SelectCellEditor, SelectCellRenderer, ServerSideDataTable_default as ServerSideDataTable, SingleSelectQuickFilterRenderer_default as SingleSelectQuickFilterRenderer, TextCellEditor2 as TextCellEditor, TextCellRenderer, UNSAFE_useTableContext, assignAlphabeticalFilterIndices, rowSize, useAnalyticsContext, useRowSelectionState, waitForAsyncCondition, withDataTableEditor, withDataTableRenderer };
|