@procore/data-table 14.17.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 +9 -0
- package/dist/legacy/index.cjs +1229 -1123
- package/dist/legacy/index.d.cts +1 -0
- package/dist/legacy/index.d.ts +1 -0
- package/dist/legacy/index.js +1228 -1122
- package/dist/modern/index.cjs +1566 -1463
- package/dist/modern/index.d.cts +1 -0
- package/dist/modern/index.d.ts +1 -0
- package/dist/modern/index.js +1566 -1463
- 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
|
|
@@ -82721,7 +82786,7 @@ var FILTERS_GROUP_EXPANDABLE_AREA_VERTICAL_MARGIN = spacing.md;
|
|
|
82721
82786
|
var FILTERS_GROUP_ITEM_HEIGHT = 60;
|
|
82722
82787
|
var ITEMS_IN_FILTERS_GROUP = 5;
|
|
82723
82788
|
var FILTERS_GROUP_EXPANDABLE_AREA_HEIGHT = (FILTERS_GROUP_ITEM_HEIGHT + spacing.xl) * ITEMS_IN_FILTERS_GROUP + BORDER_WIDTH;
|
|
82724
|
-
var StyledPanelSection =
|
|
82789
|
+
var StyledPanelSection = styled3(Panel.Section)`
|
|
82725
82790
|
// Filters Group container styles
|
|
82726
82791
|
&.filters-list-group-section {
|
|
82727
82792
|
padding-bottom: ${FILTERS_GROUP_VERTICAL_MARGIN}px;
|
|
@@ -83011,899 +83076,807 @@ var ConfigPanelButton = () => {
|
|
|
83011
83076
|
)
|
|
83012
83077
|
);
|
|
83013
83078
|
};
|
|
83014
|
-
|
|
83015
|
-
|
|
83016
|
-
|
|
83017
|
-
|
|
83018
|
-
|
|
83019
|
-
|
|
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
|
+
`}
|
|
83020
83109
|
}
|
|
83021
|
-
|
|
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
|
+
);
|
|
83022
83174
|
return /* @__PURE__ */ React76.createElement(
|
|
83023
|
-
|
|
83175
|
+
OverlayTrigger,
|
|
83024
83176
|
{
|
|
83025
|
-
|
|
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"
|
|
83026
83191
|
},
|
|
83027
83192
|
/* @__PURE__ */ React76.createElement(
|
|
83028
|
-
|
|
83193
|
+
DateQuickFilterLabel,
|
|
83029
83194
|
{
|
|
83030
|
-
headerName
|
|
83031
|
-
|
|
83195
|
+
headerName,
|
|
83196
|
+
onClear,
|
|
83197
|
+
value: selectedDate,
|
|
83198
|
+
disabled
|
|
83032
83199
|
}
|
|
83033
83200
|
)
|
|
83034
83201
|
);
|
|
83035
83202
|
}
|
|
83036
|
-
|
|
83037
|
-
|
|
83038
|
-
|
|
83039
|
-
|
|
83040
|
-
|
|
83041
|
-
|
|
83042
|
-
|
|
83043
|
-
|
|
83044
|
-
|
|
83045
|
-
|
|
83046
|
-
|
|
83047
|
-
|
|
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
|
+
);
|
|
83048
83239
|
}
|
|
83049
|
-
return `${columnDefinition?.headerName}: (${filterValue.length})`;
|
|
83050
|
-
}
|
|
83051
|
-
return columnDefinition?.headerName;
|
|
83052
|
-
}
|
|
83053
|
-
var ensureArray = (input) => {
|
|
83054
|
-
if (input === null) {
|
|
83055
|
-
return [];
|
|
83056
|
-
}
|
|
83057
|
-
return Array.isArray(input) ? input : [input];
|
|
83058
|
-
};
|
|
83059
|
-
var FiltersPanelToggleButton = ({ hasSelectedFilters, hasDefinedFilters }) => {
|
|
83060
|
-
const I18n = useI18nContext();
|
|
83061
|
-
const { contextPanel } = useInternalTableContext();
|
|
83062
|
-
const hasNoContent = useTableHasNoContent();
|
|
83063
|
-
if (!hasDefinedFilters) {
|
|
83064
|
-
return null;
|
|
83065
83240
|
}
|
|
83066
|
-
|
|
83067
|
-
|
|
83068
|
-
|
|
83069
|
-
featureI18nKey: "featureFilter",
|
|
83070
|
-
enabled: hasNoContent
|
|
83241
|
+
const onSelectionTypeChange = React76.useCallback(
|
|
83242
|
+
(newSelectionType) => {
|
|
83243
|
+
setSelectedValue({ type: newSelectionType });
|
|
83071
83244
|
},
|
|
83072
|
-
|
|
83073
|
-
ToggleButton,
|
|
83074
|
-
{
|
|
83075
|
-
"data-qa": "data-table-show-filters-button",
|
|
83076
|
-
disabled: hasNoContent,
|
|
83077
|
-
icon: /* @__PURE__ */ React76.createElement(FilterIcon, null),
|
|
83078
|
-
onClick: () => {
|
|
83079
|
-
if (contextPanel.content === "filters") {
|
|
83080
|
-
contextPanel.hide();
|
|
83081
|
-
} else {
|
|
83082
|
-
contextPanel.show("filters");
|
|
83083
|
-
}
|
|
83084
|
-
},
|
|
83085
|
-
selected: contextPanel.content === "filters"
|
|
83086
|
-
},
|
|
83087
|
-
hasSelectedFilters ? I18n.t("dataTable.filters.moreFilters") : I18n.t("dataTable.filters.filters")
|
|
83088
|
-
)
|
|
83245
|
+
[setSelectedValue]
|
|
83089
83246
|
);
|
|
83090
|
-
|
|
83091
|
-
|
|
83092
|
-
|
|
83093
|
-
|
|
83094
|
-
|
|
83095
|
-
|
|
83096
|
-
|
|
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,
|
|
83097
83255
|
{
|
|
83098
|
-
|
|
83099
|
-
|
|
83256
|
+
afterHide: dateRangeAfterHide,
|
|
83257
|
+
headerName,
|
|
83258
|
+
onChange: dateFilterOnChange,
|
|
83259
|
+
position: "start",
|
|
83260
|
+
selectedValue,
|
|
83261
|
+
selectionType,
|
|
83262
|
+
setSelectionType: onSelectionTypeChange,
|
|
83263
|
+
disabled
|
|
83100
83264
|
}
|
|
83101
|
-
)
|
|
83102
|
-
|
|
83103
|
-
var ClientSideFiltersPanelToggleButton = () => {
|
|
83104
|
-
const { filterState } = useInternalTableContext();
|
|
83105
|
-
const activeFilters = React76.useMemo(() => {
|
|
83106
|
-
return filterState.allAvailableFilters.filter(({ instance }) => {
|
|
83107
|
-
return instance.isFilterActive();
|
|
83108
|
-
});
|
|
83109
|
-
}, [filterState.allAvailableFilters]);
|
|
83110
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83111
|
-
FiltersPanelToggleButton,
|
|
83265
|
+
), selectedValue.type === "range" && /* @__PURE__ */ React76.createElement(
|
|
83266
|
+
DateFilterSelect2,
|
|
83112
83267
|
{
|
|
83113
|
-
|
|
83114
|
-
|
|
83268
|
+
headerName,
|
|
83269
|
+
onChange: dateFilterOnChange,
|
|
83270
|
+
position: "end",
|
|
83271
|
+
ref: dateRangeEndDateRef,
|
|
83272
|
+
selectedValue,
|
|
83273
|
+
selectionType,
|
|
83274
|
+
setSelectionType: onSelectionTypeChange,
|
|
83275
|
+
disabled
|
|
83115
83276
|
}
|
|
83116
|
-
);
|
|
83117
|
-
}
|
|
83118
|
-
|
|
83119
|
-
|
|
83120
|
-
|
|
83121
|
-
|
|
83122
|
-
|
|
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,
|
|
83123
83289
|
{
|
|
83124
|
-
|
|
83125
|
-
|
|
83126
|
-
|
|
83127
|
-
|
|
83128
|
-
|
|
83129
|
-
|
|
83130
|
-
|
|
83131
|
-
|
|
83132
|
-
|
|
83133
|
-
|
|
83134
|
-
|
|
83135
|
-
|
|
83136
|
-
|
|
83137
|
-
|
|
83138
|
-
|
|
83139
|
-
|
|
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"
|
|
83140
83317
|
);
|
|
83318
|
+
return null;
|
|
83141
83319
|
};
|
|
83142
|
-
var
|
|
83143
|
-
|
|
83144
|
-
|
|
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" }
|
|
83145
83341
|
}
|
|
83146
|
-
`;
|
|
83147
|
-
var ClientSideQuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
83148
|
-
const { tableRef, filterState, getColumnDefinition } = useInternalTableContext();
|
|
83149
|
-
const hasNoContent = useTableHasNoContent();
|
|
83150
|
-
const { quickFilters, tokens } = React76.useMemo(() => {
|
|
83151
|
-
return filterState.allAvailableFilters.reduce(
|
|
83152
|
-
(acc, filter) => {
|
|
83153
|
-
const colDef = getColumnDefinition(filter.field);
|
|
83154
|
-
if (!colDef) {
|
|
83155
|
-
return acc;
|
|
83156
|
-
}
|
|
83157
|
-
if (colDef?.quickFilterRenderer) {
|
|
83158
|
-
return { ...acc, quickFilters: [...acc.quickFilters, filter] };
|
|
83159
|
-
} else if (filter.instance.isFilterActive()) {
|
|
83160
|
-
return { ...acc, tokens: [...acc.tokens, filter] };
|
|
83161
|
-
}
|
|
83162
|
-
return acc;
|
|
83163
|
-
},
|
|
83164
|
-
{
|
|
83165
|
-
quickFilters: [],
|
|
83166
|
-
tokens: []
|
|
83167
|
-
}
|
|
83168
|
-
);
|
|
83169
|
-
}, [filterState.allAvailableFilters, getColumnDefinition]);
|
|
83170
|
-
const isEmpty2 = quickFilters.length === 0 && tokens.length === 0;
|
|
83171
|
-
return isEmpty2 ? null : /* @__PURE__ */ React76.createElement(
|
|
83172
|
-
FlexList,
|
|
83173
|
-
{
|
|
83174
|
-
padding: "xs none",
|
|
83175
|
-
size: "none",
|
|
83176
|
-
alignItems: "center",
|
|
83177
|
-
wrap: "wrap",
|
|
83178
|
-
gap: "sm"
|
|
83179
|
-
},
|
|
83180
|
-
quickFilters.map((filter) => {
|
|
83181
|
-
const colDef = getColumnDefinition(filter.field);
|
|
83182
|
-
const QuickFilter = colDef?.quickFilterRenderer;
|
|
83183
|
-
if (!colDef || !QuickFilter) {
|
|
83184
|
-
return null;
|
|
83185
|
-
}
|
|
83186
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83187
|
-
EmptyResultsControlTooltip,
|
|
83188
|
-
{
|
|
83189
|
-
featureI18nKey: "featureQuickFilter",
|
|
83190
|
-
enabled: hasNoContent
|
|
83191
|
-
},
|
|
83192
|
-
/* @__PURE__ */ React76.createElement(
|
|
83193
|
-
QuickFilter,
|
|
83194
|
-
{
|
|
83195
|
-
key: filter.field,
|
|
83196
|
-
filter,
|
|
83197
|
-
columnDefinition: colDef,
|
|
83198
|
-
disabled: hasNoContent,
|
|
83199
|
-
onChange: (value) => tableRef?.current?.applyListFilter(filter.field, value),
|
|
83200
|
-
onRemove: () => tableRef?.current?.removeFilter(filter.field),
|
|
83201
|
-
overlayMatchesTriggerWidth
|
|
83202
|
-
}
|
|
83203
|
-
)
|
|
83204
|
-
);
|
|
83205
|
-
}),
|
|
83206
|
-
tokens.map((filter) => {
|
|
83207
|
-
const colDef = getColumnDefinition(filter.field);
|
|
83208
|
-
if (!colDef) {
|
|
83209
|
-
return null;
|
|
83210
|
-
}
|
|
83211
|
-
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(
|
|
83212
|
-
UNSAFE_FilterToken.Remove,
|
|
83213
|
-
{
|
|
83214
|
-
onClick: () => tableRef?.current?.removeFilter(filter.field)
|
|
83215
|
-
}
|
|
83216
|
-
)));
|
|
83217
|
-
})
|
|
83218
|
-
);
|
|
83219
83342
|
};
|
|
83220
|
-
var
|
|
83221
|
-
const
|
|
83222
|
-
|
|
83223
|
-
|
|
83224
|
-
|
|
83225
|
-
|
|
83226
|
-
|
|
83227
|
-
|
|
83228
|
-
|
|
83229
|
-
|
|
83230
|
-
|
|
83231
|
-
const hasNoContent = useTableHasNoContent();
|
|
83232
|
-
const { quickFilterNames, tokenNames } = React76.useMemo(() => {
|
|
83233
|
-
const appliedFilterNames = Object.keys(selectedFilters);
|
|
83234
|
-
const isActiveFilter = (filterName) => appliedFilterNames.includes(filterName);
|
|
83235
|
-
return possibleFilters.reduce(
|
|
83236
|
-
(acc, filterName) => {
|
|
83237
|
-
const colDef = getColumnDefinition(filterName);
|
|
83238
|
-
if (!colDef) {
|
|
83239
|
-
return acc;
|
|
83240
|
-
}
|
|
83241
|
-
if (colDef?.quickFilterRenderer) {
|
|
83242
|
-
return {
|
|
83243
|
-
...acc,
|
|
83244
|
-
quickFilterNames: [...acc.quickFilterNames, filterName]
|
|
83245
|
-
};
|
|
83246
|
-
} else if (isActiveFilter(filterName)) {
|
|
83247
|
-
return { ...acc, tokenNames: [...acc.tokenNames, filterName] };
|
|
83248
|
-
}
|
|
83249
|
-
return acc;
|
|
83250
|
-
},
|
|
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,
|
|
83251
83354
|
{
|
|
83252
|
-
|
|
83253
|
-
|
|
83355
|
+
enabled: true,
|
|
83356
|
+
disabled,
|
|
83357
|
+
label: `${headerName}: ${dateTime.format(value, "numeric-date")}`,
|
|
83358
|
+
onClear,
|
|
83359
|
+
ref
|
|
83254
83360
|
}
|
|
83255
83361
|
);
|
|
83256
|
-
}, [possibleFilters, selectedFilters, getColumnDefinition]);
|
|
83257
|
-
if (!hasDefinedFilters) {
|
|
83258
|
-
return null;
|
|
83259
83362
|
}
|
|
83260
|
-
|
|
83261
|
-
|
|
83262
|
-
FlexList,
|
|
83363
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83364
|
+
QuickFilterLabel,
|
|
83263
83365
|
{
|
|
83264
|
-
|
|
83265
|
-
|
|
83266
|
-
|
|
83267
|
-
|
|
83268
|
-
gap: "sm",
|
|
83269
|
-
"data-qa": "data-table-quick-filters"
|
|
83270
|
-
},
|
|
83271
|
-
quickFilterNames.map((fieldName) => {
|
|
83272
|
-
const colDef = getColumnDefinition(fieldName);
|
|
83273
|
-
const QuickFilter = colDef?.quickFilterRenderer;
|
|
83274
|
-
if (!colDef || !QuickFilter) {
|
|
83275
|
-
return null;
|
|
83276
|
-
}
|
|
83277
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83278
|
-
EmptyResultsControlTooltip,
|
|
83279
|
-
{
|
|
83280
|
-
featureI18nKey: "featureQuickFilter",
|
|
83281
|
-
enabled: hasNoContent
|
|
83282
|
-
},
|
|
83283
|
-
/* @__PURE__ */ React76.createElement(
|
|
83284
|
-
QuickFilter,
|
|
83285
|
-
{
|
|
83286
|
-
key: fieldName,
|
|
83287
|
-
columnDefinition: colDef,
|
|
83288
|
-
disabled: hasNoContent,
|
|
83289
|
-
overlayMatchesTriggerWidth
|
|
83290
|
-
}
|
|
83291
|
-
)
|
|
83292
|
-
);
|
|
83293
|
-
}),
|
|
83294
|
-
tokenNames.map((fieldName) => {
|
|
83295
|
-
const colDef = getColumnDefinition(fieldName);
|
|
83296
|
-
if (!colDef) {
|
|
83297
|
-
return null;
|
|
83298
|
-
}
|
|
83299
|
-
const filter = getListFilter(fieldName);
|
|
83300
|
-
return /* @__PURE__ */ React76.createElement(StyledFilterTokenWrapper, { key: fieldName }, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken, null, /* @__PURE__ */ React76.createElement(UNSAFE_FilterToken.Label, null, getFilterTokenText(
|
|
83301
|
-
colDef,
|
|
83302
|
-
colDef.filterRenderer === DateFilterRenderer_default ? filter.value : filter.selected
|
|
83303
|
-
)), /* @__PURE__ */ React76.createElement(
|
|
83304
|
-
UNSAFE_FilterToken.Remove,
|
|
83305
|
-
{
|
|
83306
|
-
"data-qa": "data-table-quick-filter-remove-token",
|
|
83307
|
-
onClick: () => onClearFilter(fieldName)
|
|
83308
|
-
}
|
|
83309
|
-
)));
|
|
83310
|
-
})
|
|
83311
|
-
);
|
|
83312
|
-
};
|
|
83313
|
-
var QuickFilters = ({ overlayMatchesTriggerWidth }) => {
|
|
83314
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83315
|
-
if (onServerSideDataRequest) {
|
|
83316
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83317
|
-
ServerSideQuickFilters,
|
|
83318
|
-
{
|
|
83319
|
-
overlayMatchesTriggerWidth
|
|
83320
|
-
}
|
|
83321
|
-
);
|
|
83322
|
-
}
|
|
83323
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83324
|
-
ClientSideQuickFilters,
|
|
83325
|
-
{
|
|
83326
|
-
overlayMatchesTriggerWidth
|
|
83366
|
+
enabled: false,
|
|
83367
|
+
disabled,
|
|
83368
|
+
label: `${headerName}: ${getDatePlaceholder(i18n.locale, placeholders)}`,
|
|
83369
|
+
ref
|
|
83327
83370
|
}
|
|
83328
83371
|
);
|
|
83372
|
+
});
|
|
83373
|
+
var DateQuickFilterRenderer_default = QuickDateFilterRenderer;
|
|
83374
|
+
var defaultGetId2 = (option) => option?.id;
|
|
83375
|
+
var defaultGetLabel2 = (option) => {
|
|
83376
|
+
return option?.label ?? option?.name ?? option;
|
|
83329
83377
|
};
|
|
83330
|
-
var
|
|
83331
|
-
|
|
83332
|
-
|
|
83333
|
-
|
|
83334
|
-
|
|
83335
|
-
|
|
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
|
+
};
|
|
83336
83399
|
};
|
|
83337
|
-
var
|
|
83338
|
-
|
|
83339
|
-
|
|
83340
|
-
|
|
83341
|
-
|
|
83342
|
-
|
|
83343
|
-
|
|
83344
|
-
|
|
83345
|
-
|
|
83346
|
-
|
|
83347
|
-
|
|
83348
|
-
|
|
83349
|
-
|
|
83350
|
-
|
|
83351
|
-
)
|
|
83352
|
-
|
|
83353
|
-
|
|
83354
|
-
|
|
83355
|
-
const colDef = column2.getColDef();
|
|
83356
|
-
return transformToColumnDefinition(colDef);
|
|
83357
|
-
});
|
|
83358
|
-
}, [columnDefinitions]);
|
|
83359
|
-
const selectedColumns = React76.useMemo(
|
|
83360
|
-
() => mapColumnsToOptions(groupedColumns),
|
|
83361
|
-
[groupedColumns]
|
|
83362
|
-
);
|
|
83363
|
-
const onGroupedClear = React76.useCallback(() => {
|
|
83364
|
-
tableRef?.current?.setRowGrouping([]);
|
|
83365
|
-
}, [tableRef]);
|
|
83366
|
-
const onGroupedRowChange = React76.useCallback(
|
|
83367
|
-
(newValue) => {
|
|
83368
|
-
const fields = newValue.map((val) => {
|
|
83369
|
-
return val.id;
|
|
83370
|
-
});
|
|
83371
|
-
if (!equals(selectedColumns, newValue)) {
|
|
83372
|
-
tableRef?.current?.setRowGrouping(fields);
|
|
83373
|
-
}
|
|
83374
|
-
},
|
|
83375
|
-
[selectedColumns]
|
|
83376
|
-
);
|
|
83377
|
-
React76.useEffect(() => {
|
|
83378
|
-
function onDisplayedColumnsChanged(event) {
|
|
83379
|
-
const agColumnDefs = event.api.getColumnDefs();
|
|
83380
|
-
if (agColumnDefs?.length) {
|
|
83381
|
-
const flattenedAgColDefs = flattenColDefs(event.api.getColumnDefs());
|
|
83382
|
-
const dataTableColumnDefinitions = flattenedAgColDefs.map(
|
|
83383
|
-
transformToColumnDefinition
|
|
83384
|
-
);
|
|
83385
|
-
setColumnDefinitions(dataTableColumnDefinitions);
|
|
83386
|
-
}
|
|
83387
|
-
}
|
|
83388
|
-
gridApi?.addEventListener(
|
|
83389
|
-
"displayedColumnsChanged",
|
|
83390
|
-
onDisplayedColumnsChanged
|
|
83391
|
-
);
|
|
83392
|
-
return () => {
|
|
83393
|
-
removeEventListenerFromGrid(
|
|
83394
|
-
"displayedColumnsChanged",
|
|
83395
|
-
onDisplayedColumnsChanged,
|
|
83396
|
-
gridApi
|
|
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"
|
|
83397
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"
|
|
83398
83429
|
};
|
|
83399
|
-
|
|
83400
|
-
|
|
83401
|
-
|
|
83402
|
-
|
|
83403
|
-
|
|
83404
|
-
|
|
83405
|
-
|
|
83406
|
-
featureI18nKey: "featureGroupBy",
|
|
83407
|
-
enabled: hasNoContent
|
|
83408
|
-
},
|
|
83409
|
-
/* @__PURE__ */ React76.createElement(
|
|
83410
|
-
GroupBySelect,
|
|
83411
|
-
{
|
|
83412
|
-
isDisabled: hasNoContent,
|
|
83413
|
-
localeText,
|
|
83414
|
-
onBlur: onGroupedRowChange,
|
|
83415
|
-
onClear: onGroupedClear,
|
|
83416
|
-
options: groupableColumns,
|
|
83417
|
-
selected: selectedColumns
|
|
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();
|
|
83418
83437
|
}
|
|
83419
|
-
|
|
83420
|
-
|
|
83421
|
-
|
|
83422
|
-
|
|
83423
|
-
|
|
83424
|
-
return {
|
|
83425
|
-
label: col.headerName,
|
|
83426
|
-
id: col.field,
|
|
83427
|
-
key: col.field,
|
|
83428
|
-
group: col.columnGroupName
|
|
83438
|
+
if (selection.item.id === includeSublocationOption.id) {
|
|
83439
|
+
_onSelect(selection);
|
|
83440
|
+
return onSelectSublocations();
|
|
83441
|
+
}
|
|
83442
|
+
return _onSelect(selection);
|
|
83429
83443
|
};
|
|
83430
|
-
|
|
83431
|
-
|
|
83432
|
-
|
|
83433
|
-
|
|
83434
|
-
onSearch,
|
|
83435
|
-
placeholder
|
|
83436
|
-
}) => {
|
|
83437
|
-
const [internalValue, setInternalValue] = React76.useState("");
|
|
83438
|
-
const { tableRef } = useInternalTableContext();
|
|
83439
|
-
const hasNoContent = useTableHasNoContent();
|
|
83440
|
-
const I18n = useI18nContext();
|
|
83441
|
-
const debouncedSetSearchValue = React76.useCallback(
|
|
83442
|
-
debounce5((value) => {
|
|
83443
|
-
tableRef?.current?.setSearchValue(value);
|
|
83444
|
-
}, 250),
|
|
83445
|
-
[tableRef?.current?.setSearchValue]
|
|
83446
|
-
);
|
|
83447
|
-
const onChange = React76.useCallback(
|
|
83448
|
-
(value, event) => {
|
|
83449
|
-
setInternalValue(value);
|
|
83450
|
-
if (onSearch) {
|
|
83451
|
-
onSearch(event);
|
|
83444
|
+
function defaultOnSearch(e) {
|
|
83445
|
+
if (e.target.value === "") {
|
|
83446
|
+
setSearching(false);
|
|
83447
|
+
setItems(options);
|
|
83452
83448
|
} else {
|
|
83453
|
-
|
|
83449
|
+
setSearching(true);
|
|
83450
|
+
setItems(
|
|
83451
|
+
options.filter(
|
|
83452
|
+
(item) => getLabel3(item).toLowerCase().includes(e.target.value.toLowerCase())
|
|
83453
|
+
)
|
|
83454
|
+
);
|
|
83454
83455
|
}
|
|
83455
|
-
},
|
|
83456
|
-
[debouncedSetSearchValue, onSearch]
|
|
83457
|
-
);
|
|
83458
|
-
return /* @__PURE__ */ React76.createElement(EmptyResultsControlTooltip, { hasSearch: true, enabled: hasNoContent }, /* @__PURE__ */ React76.createElement(
|
|
83459
|
-
Typeahead,
|
|
83460
|
-
{
|
|
83461
|
-
disabled: hasNoContent,
|
|
83462
|
-
"data-qa": "data-table-search",
|
|
83463
|
-
value: internalValue,
|
|
83464
|
-
className: cx21("search", {
|
|
83465
|
-
"search--empty": !internalValue.length
|
|
83466
|
-
}),
|
|
83467
|
-
onChange,
|
|
83468
|
-
placeholder: placeholder || I18n.t("dataTable.search")
|
|
83469
83456
|
}
|
|
83470
|
-
|
|
83471
|
-
|
|
83472
|
-
|
|
83473
|
-
|
|
83474
|
-
|
|
83475
|
-
|
|
83476
|
-
}
|
|
83477
|
-
return /* @__PURE__ */ React76.createElement(ClientSideSearch, { ...props });
|
|
83478
|
-
};
|
|
83479
|
-
|
|
83480
|
-
// src/QuickControls/QuickControls.tsx
|
|
83481
|
-
var QuickControls = (props) => {
|
|
83482
|
-
const I18n = useI18nContext();
|
|
83483
|
-
if (props.children) {
|
|
83484
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83485
|
-
Box,
|
|
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,
|
|
83486
83463
|
{
|
|
83487
|
-
|
|
83488
|
-
|
|
83489
|
-
|
|
83464
|
+
...menuProps,
|
|
83465
|
+
multiple: true,
|
|
83466
|
+
role: "listbox",
|
|
83467
|
+
ref: menuRef,
|
|
83468
|
+
onSelect,
|
|
83469
|
+
className: locationFilterStyles_default.locationFilterMenu
|
|
83490
83470
|
},
|
|
83491
|
-
|
|
83492
|
-
|
|
83471
|
+
/* @__PURE__ */ React76.createElement(
|
|
83472
|
+
UNSAFE_Menu.Search,
|
|
83473
|
+
{
|
|
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
|
|
83483
|
+
},
|
|
83484
|
+
/* @__PURE__ */ React76.createElement(
|
|
83485
|
+
UNSAFE_Menu.CheckboxItem,
|
|
83486
|
+
{
|
|
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)
|
|
83502
|
+
)
|
|
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
|
+
));
|
|
83493
83518
|
}
|
|
83494
|
-
|
|
83495
|
-
|
|
83496
|
-
|
|
83497
|
-
|
|
83498
|
-
|
|
83499
|
-
|
|
83519
|
+
);
|
|
83520
|
+
var LocationQuickFilterRenderer = ({
|
|
83521
|
+
columnDefinition,
|
|
83522
|
+
disabled
|
|
83523
|
+
}) => {
|
|
83524
|
+
const {
|
|
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";
|
|
83500
83543
|
}
|
|
83501
|
-
|
|
83502
|
-
|
|
83503
|
-
{
|
|
83504
|
-
localeText: {
|
|
83505
|
-
reset: I18n.t("dataTable.tableSettings.reset"),
|
|
83506
|
-
placeholder: I18n.t("dataTable.tableSettings.selectColumnGroup"),
|
|
83507
|
-
selectedItemsPrefix: I18n.t("dataTable.tableSettings.groupBy")
|
|
83508
|
-
}
|
|
83544
|
+
if (selection.length && (options.length > selection.length || options.length < selection.length)) {
|
|
83545
|
+
return "partial";
|
|
83509
83546
|
}
|
|
83510
|
-
|
|
83511
|
-
|
|
83512
|
-
{
|
|
83513
|
-
overlayMatchesTriggerWidth: props.filterOverlayMatchesTriggerWidth
|
|
83547
|
+
if (selection.length === 0) {
|
|
83548
|
+
return "none";
|
|
83514
83549
|
}
|
|
83515
|
-
|
|
83516
|
-
};
|
|
83517
|
-
|
|
83518
|
-
|
|
83519
|
-
|
|
83520
|
-
|
|
83521
|
-
Object.keys(subs).forEach((key) => {
|
|
83522
|
-
assigned[key] = subs[key];
|
|
83523
|
-
});
|
|
83524
|
-
return assigned;
|
|
83525
|
-
};
|
|
83526
|
-
|
|
83527
|
-
// src/ClientSideDataTable.tsx
|
|
83528
|
-
var ClientSideDataTable = ({
|
|
83529
|
-
analytics,
|
|
83530
|
-
children,
|
|
83531
|
-
columnDefinitions: _columnDefinitions,
|
|
83532
|
-
customBulkEditorFields,
|
|
83533
|
-
enableDynamicRowHeight,
|
|
83534
|
-
enableGroupEditAndValidation,
|
|
83535
|
-
filterGroups,
|
|
83536
|
-
getRowId,
|
|
83537
|
-
initialTableConfig: _initialTableConfig,
|
|
83538
|
-
onBulkEditUpdate,
|
|
83539
|
-
onTableConfigChange,
|
|
83540
|
-
translations: translations2 = {},
|
|
83541
|
-
enableCellTextSelection,
|
|
83542
|
-
localStoragePersistenceKey
|
|
83543
|
-
}) => {
|
|
83544
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83545
|
-
DataTable,
|
|
83546
|
-
{
|
|
83547
|
-
analytics,
|
|
83548
|
-
columnDefinitions: _columnDefinitions,
|
|
83549
|
-
enableGroupEditAndValidation,
|
|
83550
|
-
enableDynamicRowHeight,
|
|
83551
|
-
filterGroups,
|
|
83552
|
-
getRowId,
|
|
83553
|
-
initialTableConfig: _initialTableConfig,
|
|
83554
|
-
onTableConfigChange,
|
|
83555
|
-
onBulkEditUpdate,
|
|
83556
|
-
showExpandCollapseAllToggle: true,
|
|
83557
|
-
translations: translations2,
|
|
83558
|
-
localStoragePersistenceKey,
|
|
83559
|
-
customBulkEditorFields,
|
|
83560
|
-
enableCellTextSelection
|
|
83561
|
-
},
|
|
83562
|
-
children
|
|
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)
|
|
83563
83556
|
);
|
|
83564
|
-
|
|
83565
|
-
|
|
83566
|
-
const
|
|
83567
|
-
|
|
83568
|
-
|
|
83569
|
-
|
|
83570
|
-
|
|
83571
|
-
|
|
83572
|
-
|
|
83573
|
-
|
|
83574
|
-
|
|
83575
|
-
|
|
83576
|
-
|
|
83577
|
-
|
|
83578
|
-
Search.displayName = "ClientSideDataTable.Search";
|
|
83579
|
-
Table2.displayName = "ClientSideDataTable.Table";
|
|
83580
|
-
FiltersPanel.displayName = "ClientSideDataTable.FiltersPanel";
|
|
83581
|
-
var ClientSideDataTable_default = addSubcomponents(
|
|
83582
|
-
{
|
|
83583
|
-
BulkActions,
|
|
83584
|
-
BulkEditActionButton,
|
|
83585
|
-
ConfigPanelButton,
|
|
83586
|
-
ContextPanel,
|
|
83587
|
-
QuickControls,
|
|
83588
|
-
QuickFilters,
|
|
83589
|
-
RowGroupSelector,
|
|
83590
|
-
Search,
|
|
83591
|
-
Table: Table2,
|
|
83592
|
-
FiltersPanel,
|
|
83593
|
-
FiltersPanelButton
|
|
83594
|
-
},
|
|
83595
|
-
ClientSideDataTable
|
|
83596
|
-
);
|
|
83597
|
-
var QuickFilterLabel = React76.forwardRef(({ enabled, ...props }, ref) => {
|
|
83598
|
-
return /* @__PURE__ */ React76.createElement(StyledQuickFilterLabel, { $enabled: enabled }, /* @__PURE__ */ React76.createElement(SelectButton, { ref, ...props }));
|
|
83599
|
-
});
|
|
83600
|
-
var StyledQuickFilterLabel = styled4.div`
|
|
83601
|
-
${StyledSelectButton} {
|
|
83602
|
-
width: auto;
|
|
83603
|
-
max-width: 380px;
|
|
83604
|
-
${({ $enabled }) => $enabled && css$1`
|
|
83605
|
-
background: ${colors.blue96};
|
|
83606
|
-
border-color: ${colors.blue96};
|
|
83607
|
-
font-weight: ${typographyWeights.semibold};
|
|
83608
|
-
&:hover {
|
|
83609
|
-
background: ${colors.blue90};
|
|
83610
|
-
border-color: ${colors.blue90};
|
|
83611
|
-
}
|
|
83612
|
-
${StyledSelectButtonLabel} {
|
|
83613
|
-
color: ${colors.blue45};
|
|
83614
|
-
}
|
|
83615
|
-
${StyledButton} {
|
|
83616
|
-
color: ${colors.blue45};
|
|
83617
|
-
&:hover {
|
|
83618
|
-
background: white;
|
|
83619
|
-
}
|
|
83620
|
-
}
|
|
83621
|
-
${StyledSelectArrow} {
|
|
83622
|
-
svg {
|
|
83623
|
-
fill: ${colors.blue45};
|
|
83624
|
-
}
|
|
83625
|
-
}
|
|
83626
|
-
`}
|
|
83627
|
-
}
|
|
83628
|
-
`;
|
|
83629
|
-
|
|
83630
|
-
// src/QuickFilterRenderers/DateQuickFilterRenderer.tsx
|
|
83631
|
-
function getPlacement2(currentSelectionType, position) {
|
|
83632
|
-
if (currentSelectionType === "single") {
|
|
83633
|
-
return "bottom-left";
|
|
83634
|
-
}
|
|
83635
|
-
if (position === "start") {
|
|
83636
|
-
return "bottom-left";
|
|
83637
|
-
}
|
|
83638
|
-
return "bottom-right";
|
|
83639
|
-
}
|
|
83640
|
-
var OptionalDateTimeProvider2 = ({ timeZone, children }) => {
|
|
83641
|
-
return timeZone ? /* @__PURE__ */ React76.createElement(DateTimeProvider, { timeZone }, children) : /* @__PURE__ */ React76.createElement(React76.Fragment, null, children);
|
|
83642
|
-
};
|
|
83643
|
-
var DateFilterSelect2 = React76.forwardRef(
|
|
83644
|
-
({
|
|
83645
|
-
afterHide,
|
|
83646
|
-
selectionType = "either",
|
|
83647
|
-
headerName,
|
|
83648
|
-
disabled,
|
|
83649
|
-
onChange,
|
|
83650
|
-
position,
|
|
83651
|
-
selectedValue,
|
|
83652
|
-
setSelectionType = () => {
|
|
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));
|
|
83566
|
+
});
|
|
83567
|
+
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
83568
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
83569
|
+
);
|
|
83570
|
+
setDisabledValues(uniqDisabledValues);
|
|
83653
83571
|
}
|
|
83654
|
-
|
|
83655
|
-
|
|
83656
|
-
|
|
83657
|
-
|
|
83658
|
-
|
|
83659
|
-
|
|
83660
|
-
|
|
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
|
+
}))
|
|
83661
83619
|
);
|
|
83662
|
-
|
|
83663
|
-
|
|
83664
|
-
|
|
83665
|
-
|
|
83666
|
-
|
|
83667
|
-
|
|
83668
|
-
|
|
83669
|
-
}
|
|
83670
|
-
|
|
83671
|
-
|
|
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 [];
|
|
83672
83635
|
}
|
|
83673
|
-
|
|
83674
|
-
|
|
83675
|
-
|
|
83676
|
-
|
|
83677
|
-
|
|
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));
|
|
83648
|
+
},
|
|
83649
|
+
[enableSublocations, disabledValues]
|
|
83650
|
+
);
|
|
83651
|
+
React76.useEffect(() => {
|
|
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
|
|
83670
|
+
}
|
|
83671
|
+
);
|
|
83672
|
+
const triggerLabel = value.length ? value.length === 1 ? `: ${value[0].label}` : `: (${value.length})` : "";
|
|
83673
|
+
return /* @__PURE__ */ React76.createElement(
|
|
83674
|
+
OverlayTrigger,
|
|
83675
|
+
{
|
|
83676
|
+
overlay,
|
|
83677
|
+
beforeShow: getOptions,
|
|
83678
|
+
placement: "bottom-left"
|
|
83679
|
+
},
|
|
83680
|
+
value.length ? /* @__PURE__ */ React76.createElement(
|
|
83681
|
+
QuickFilterLabel,
|
|
83678
83682
|
{
|
|
83679
|
-
|
|
83680
|
-
|
|
83681
|
-
|
|
83682
|
-
|
|
83683
|
-
|
|
83683
|
+
enabled: true,
|
|
83684
|
+
disabled,
|
|
83685
|
+
label: `${I18n.t(
|
|
83686
|
+
"dataTable.filters.locationFilter.locations"
|
|
83687
|
+
)}${triggerLabel}`,
|
|
83688
|
+
onClear: () => {
|
|
83689
|
+
onChange([]);
|
|
83684
83690
|
},
|
|
83685
|
-
|
|
83686
|
-
selectedValue,
|
|
83687
|
-
setDisplayDate: setDisplayed2,
|
|
83688
|
-
setSelectionType,
|
|
83689
|
-
yearRef
|
|
83691
|
+
block: true
|
|
83690
83692
|
}
|
|
83691
|
-
)
|
|
83692
|
-
|
|
83693
|
-
OverlayTrigger,
|
|
83693
|
+
) : /* @__PURE__ */ React76.createElement(
|
|
83694
|
+
QuickFilterLabel,
|
|
83694
83695
|
{
|
|
83695
|
-
|
|
83696
|
-
|
|
83697
|
-
|
|
83698
|
-
|
|
83699
|
-
|
|
83700
|
-
|
|
83701
|
-
|
|
83702
|
-
|
|
83703
|
-
|
|
83704
|
-
|
|
83705
|
-
|
|
83706
|
-
|
|
83707
|
-
|
|
83708
|
-
|
|
83709
|
-
|
|
83710
|
-
|
|
83711
|
-
|
|
83712
|
-
|
|
83713
|
-
|
|
83714
|
-
|
|
83715
|
-
|
|
83716
|
-
|
|
83696
|
+
enabled: false,
|
|
83697
|
+
disabled,
|
|
83698
|
+
label: `${I18n.t(
|
|
83699
|
+
"dataTable.filters.locationFilter.locations"
|
|
83700
|
+
)}${triggerLabel}`,
|
|
83701
|
+
block: true
|
|
83702
|
+
}
|
|
83703
|
+
)
|
|
83704
|
+
);
|
|
83705
|
+
};
|
|
83706
|
+
var LocationQuickFilterRenderer_default = LocationQuickFilterRenderer;
|
|
83707
|
+
var StyledFilterPresetPopoverContent = styled3(Popover.Content)`
|
|
83708
|
+
padding: ${spacing.sm}px ${spacing.lg}px;
|
|
83709
|
+
`;
|
|
83710
|
+
var getValueLabel = (isValueEmpty, value, placeholder, filterName) => {
|
|
83711
|
+
const prefixLabel = isValueEmpty ? placeholder || filterName : filterName;
|
|
83712
|
+
const valueLabel = value ? `${prefixLabel ? ": " : ""}${value}` : "";
|
|
83713
|
+
return `${prefixLabel}${valueLabel}`;
|
|
83714
|
+
};
|
|
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
|
+
));
|
|
83717
83782
|
}
|
|
83718
|
-
|
|
83719
|
-
);
|
|
83720
|
-
}
|
|
83721
|
-
);
|
|
83722
|
-
function DateFilter3({
|
|
83723
|
-
// TODO: talk to design about potential loading UX for this.
|
|
83724
|
-
// core DateSelect doesn't have it
|
|
83725
|
-
// loading,
|
|
83726
|
-
headerName,
|
|
83727
|
-
onChange,
|
|
83728
|
-
selectionType = "either",
|
|
83729
|
-
value,
|
|
83730
|
-
disabled,
|
|
83731
|
-
...props
|
|
83732
|
-
}) {
|
|
83733
|
-
const [selectedValue, setSelectedValue] = React76.useState({
|
|
83734
|
-
type: selectionType === "either" ? "range" : selectionType
|
|
83735
|
-
});
|
|
83736
|
-
React76.useEffect(() => {
|
|
83737
|
-
const parsedValue = value.map((date) => {
|
|
83738
|
-
if (isDate(date)) {
|
|
83739
|
-
return date;
|
|
83783
|
+
return /* @__PURE__ */ React76.createElement("div", null, "Value is not an array");
|
|
83740
83784
|
}
|
|
83741
|
-
return parseISO(String(date));
|
|
83742
|
-
});
|
|
83743
|
-
const type = isSameDay(parsedValue[0], parsedValue[1]) ? "single" : "range";
|
|
83744
|
-
setSelectedValue({ type, start: parsedValue[0], end: parsedValue[1] });
|
|
83745
|
-
}, [value]);
|
|
83746
|
-
const dateRangeEndDateRef = React76.useRef(null);
|
|
83747
|
-
function dateFilterOnChange(date, position) {
|
|
83748
|
-
const newValue = getValueFromSelection(selectedValue, date, position);
|
|
83749
|
-
setSelectedValue(newValue);
|
|
83750
|
-
if (isValidDateSelection(newValue)) {
|
|
83751
|
-
onChange(
|
|
83752
|
-
newValue.start || newValue.end ? [
|
|
83753
|
-
newValue.start,
|
|
83754
|
-
newValue.type === "single" ? newValue.start : newValue.end
|
|
83755
|
-
] : []
|
|
83756
|
-
);
|
|
83757
|
-
}
|
|
83758
|
-
}
|
|
83759
|
-
const onSelectionTypeChange = React76.useCallback(
|
|
83760
|
-
(newSelectionType) => {
|
|
83761
|
-
setSelectedValue({ type: newSelectionType });
|
|
83762
83785
|
},
|
|
83763
|
-
|
|
83764
|
-
|
|
83765
|
-
|
|
83766
|
-
|
|
83767
|
-
|
|
83768
|
-
|
|
83769
|
-
return true;
|
|
83786
|
+
selectionStyle: "highlight"
|
|
83787
|
+
};
|
|
83788
|
+
};
|
|
83789
|
+
var StyledSuperSelectWrapper = styled3.div`
|
|
83790
|
+
${UNSAFE_StyledSuperSelectTrigger} {
|
|
83791
|
+
width: auto;
|
|
83770
83792
|
}
|
|
83771
|
-
|
|
83772
|
-
|
|
83773
|
-
|
|
83774
|
-
|
|
83775
|
-
|
|
83776
|
-
|
|
83777
|
-
|
|
83778
|
-
|
|
83779
|
-
|
|
83780
|
-
|
|
83781
|
-
|
|
83782
|
-
|
|
83783
|
-
|
|
83784
|
-
|
|
83785
|
-
|
|
83786
|
-
|
|
83787
|
-
|
|
83788
|
-
|
|
83789
|
-
|
|
83790
|
-
|
|
83791
|
-
|
|
83792
|
-
|
|
83793
|
-
|
|
83794
|
-
|
|
83795
|
-
|
|
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;
|
|
83796
83830
|
}
|
|
83797
|
-
|
|
83831
|
+
|
|
83832
|
+
// src/QuickFilterRenderers/MultiSelectQuickFilterRenderer.tsx
|
|
83833
|
+
var ClientSideMultiSelectQuickFilter = ({
|
|
83834
|
+
filter,
|
|
83798
83835
|
columnDefinition,
|
|
83836
|
+
onChange,
|
|
83837
|
+
onRemove,
|
|
83838
|
+
overlayMatchesTriggerWidth,
|
|
83799
83839
|
disabled
|
|
83800
|
-
}) {
|
|
83801
|
-
|
|
83802
|
-
|
|
83803
|
-
});
|
|
83804
|
-
const colDef = columnDefinition;
|
|
83805
|
-
return /* @__PURE__ */ React76.createElement(OptionalDateTimeProvider2, { timeZone: colDef.timeZone }, /* @__PURE__ */ React76.createElement(
|
|
83806
|
-
DateFilter3,
|
|
83840
|
+
}) => {
|
|
83841
|
+
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(filter.filterValues?.length) }, /* @__PURE__ */ React76.createElement(
|
|
83842
|
+
UNSAFE_SuperSelect,
|
|
83807
83843
|
{
|
|
83808
|
-
|
|
83809
|
-
|
|
83844
|
+
overlayMatchesTriggerWidth,
|
|
83845
|
+
value: filter.filterValues === null ? [] : filter.filterValues,
|
|
83846
|
+
search: false,
|
|
83847
|
+
multiple: true,
|
|
83848
|
+
options: filter.options,
|
|
83810
83849
|
disabled,
|
|
83811
|
-
|
|
83812
|
-
|
|
83813
|
-
selected.map((date) => {
|
|
83814
|
-
return date ? {
|
|
83815
|
-
// future extensions can go here (month, day, year keys etc)
|
|
83816
|
-
date
|
|
83817
|
-
} : (
|
|
83818
|
-
// TODO: refactor out date-specific getId stuff from useServerSideFilterStorage
|
|
83819
|
-
date
|
|
83820
|
-
);
|
|
83821
|
-
})
|
|
83822
|
-
);
|
|
83850
|
+
getOptionValue: (option) => {
|
|
83851
|
+
return getId(columnDefinition.filterProps?.getId, option);
|
|
83823
83852
|
},
|
|
83824
|
-
|
|
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)
|
|
83825
83864
|
}
|
|
83826
83865
|
));
|
|
83827
|
-
}
|
|
83828
|
-
var QuickDateFilterRenderer = (props) => {
|
|
83829
|
-
const { onServerSideDataRequest } = useInternalTableContext();
|
|
83830
|
-
if (onServerSideDataRequest) {
|
|
83831
|
-
return /* @__PURE__ */ React76.createElement(ServerSideQuickDateFilterRenderer, { ...props });
|
|
83832
|
-
}
|
|
83833
|
-
logger.error(
|
|
83834
|
-
"Warning: Date Filters are currently only implemented for the serverside row model"
|
|
83835
|
-
);
|
|
83836
|
-
return null;
|
|
83837
|
-
};
|
|
83838
|
-
var dateInputLocales = {
|
|
83839
|
-
"fr-CA": {
|
|
83840
|
-
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83841
|
-
},
|
|
83842
|
-
"fr-FR": {
|
|
83843
|
-
placeholders: { day: "jj", month: "mm", year: "aaaa" }
|
|
83844
|
-
},
|
|
83845
|
-
es: {
|
|
83846
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83847
|
-
},
|
|
83848
|
-
"es-ES": {
|
|
83849
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83850
|
-
},
|
|
83851
|
-
pt: {
|
|
83852
|
-
placeholders: { day: "dd", month: "mm", year: "aaaa" }
|
|
83853
|
-
},
|
|
83854
|
-
"is-IS": {
|
|
83855
|
-
placeholders: { day: "dd", month: "mm", year: "\xE1\xE1\xE1\xE1" }
|
|
83856
|
-
},
|
|
83857
|
-
"de-DE": {
|
|
83858
|
-
placeholders: { day: "tt", month: "MM", year: "jjjj" }
|
|
83859
|
-
}
|
|
83860
|
-
};
|
|
83861
|
-
var DateQuickFilterLabel = React76.forwardRef(({ headerName, onClear, value, disabled }, ref) => {
|
|
83862
|
-
const dateTime = useDateTime();
|
|
83863
|
-
const i18n = useI18nContext();
|
|
83864
|
-
const placeholders = dateInputLocales[i18n.locale]?.placeholders || {
|
|
83865
|
-
day: "dd",
|
|
83866
|
-
month: "mm",
|
|
83867
|
-
year: "yyyy"
|
|
83868
|
-
};
|
|
83869
|
-
if (value !== void 0 && isDate(value)) {
|
|
83870
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83871
|
-
QuickFilterLabel,
|
|
83872
|
-
{
|
|
83873
|
-
enabled: true,
|
|
83874
|
-
disabled,
|
|
83875
|
-
label: `${headerName}: ${dateTime.format(value, "numeric-date")}`,
|
|
83876
|
-
onClear,
|
|
83877
|
-
ref
|
|
83878
|
-
}
|
|
83879
|
-
);
|
|
83880
|
-
}
|
|
83881
|
-
return /* @__PURE__ */ React76.createElement(
|
|
83882
|
-
QuickFilterLabel,
|
|
83883
|
-
{
|
|
83884
|
-
enabled: false,
|
|
83885
|
-
disabled,
|
|
83886
|
-
label: `${headerName}: ${getDatePlaceholder(i18n.locale, placeholders)}`,
|
|
83887
|
-
ref
|
|
83888
|
-
}
|
|
83889
|
-
);
|
|
83890
|
-
});
|
|
83891
|
-
var DateQuickFilterRenderer_default = QuickDateFilterRenderer;
|
|
83892
|
-
var defaultGetId2 = (option) => option?.id;
|
|
83893
|
-
var defaultGetLabel2 = (option) => {
|
|
83894
|
-
return option?.label ?? option?.name ?? option;
|
|
83895
83866
|
};
|
|
83896
|
-
var
|
|
83867
|
+
var useSuperSelectOptionAsValueWorkaround2 = ({
|
|
83897
83868
|
originValue,
|
|
83898
83869
|
originOptions,
|
|
83899
|
-
getId: getId3
|
|
83870
|
+
getId: getId3,
|
|
83900
83871
|
loading
|
|
83901
83872
|
}) => {
|
|
83902
83873
|
const isValueFromOptions = React76.useRef(false);
|
|
83903
83874
|
const getValueFromOptions = () => {
|
|
83904
|
-
const valueIds = originValue.map(getId3);
|
|
83875
|
+
const valueIds = originValue.map((option) => getId(getId3, option));
|
|
83905
83876
|
isValueFromOptions.current = true;
|
|
83906
|
-
return originOptions.filter(
|
|
83877
|
+
return originOptions.filter(
|
|
83878
|
+
(option) => valueIds.includes(getId(getId3, option))
|
|
83879
|
+
);
|
|
83907
83880
|
};
|
|
83908
83881
|
const hasOptions = originOptions.length > 0 && !loading;
|
|
83909
83882
|
const hasValue = originValue?.length > 0;
|
|
@@ -83915,684 +83888,814 @@ var useSuperSelectOptionAsValueWorkaround = ({
|
|
|
83915
83888
|
getOptionValue: (option) => option
|
|
83916
83889
|
};
|
|
83917
83890
|
};
|
|
83918
|
-
var
|
|
83919
|
-
|
|
83920
|
-
|
|
83921
|
-
|
|
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,
|
|
83922
83904
|
loading,
|
|
83923
|
-
|
|
83924
|
-
|
|
83925
|
-
|
|
83926
|
-
|
|
83927
|
-
|
|
83928
|
-
|
|
83929
|
-
|
|
83930
|
-
|
|
83931
|
-
|
|
83932
|
-
|
|
83933
|
-
|
|
83934
|
-
|
|
83935
|
-
|
|
83936
|
-
|
|
83937
|
-
|
|
83938
|
-
|
|
83939
|
-
|
|
83940
|
-
|
|
83941
|
-
|
|
83942
|
-
|
|
83943
|
-
|
|
83944
|
-
|
|
83945
|
-
|
|
83946
|
-
|
|
83947
|
-
|
|
83948
|
-
|
|
83949
|
-
|
|
83950
|
-
|
|
83951
|
-
|
|
83952
|
-
|
|
83953
|
-
if (selection.item.id === selectAllOption.id) {
|
|
83954
|
-
return onSelectAll();
|
|
83955
|
-
}
|
|
83956
|
-
if (selection.item.id === includeSublocationOption.id) {
|
|
83957
|
-
_onSelect(selection);
|
|
83958
|
-
return onSelectSublocations();
|
|
83959
|
-
}
|
|
83960
|
-
return _onSelect(selection);
|
|
83961
|
-
};
|
|
83962
|
-
function defaultOnSearch(e) {
|
|
83963
|
-
if (e.target.value === "") {
|
|
83964
|
-
setSearching(false);
|
|
83965
|
-
setItems(options);
|
|
83966
|
-
} else {
|
|
83967
|
-
setSearching(true);
|
|
83968
|
-
setItems(
|
|
83969
|
-
options.filter(
|
|
83970
|
-
(item) => getLabel3(item).toLowerCase().includes(e.target.value.toLowerCase())
|
|
83971
|
-
)
|
|
83972
|
-
);
|
|
83973
|
-
}
|
|
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)
|
|
83974
83935
|
}
|
|
83975
|
-
|
|
83976
|
-
|
|
83977
|
-
|
|
83978
|
-
|
|
83979
|
-
|
|
83980
|
-
|
|
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,
|
|
83981
83956
|
{
|
|
83982
|
-
|
|
83983
|
-
multiple: true,
|
|
83984
|
-
role: "listbox",
|
|
83985
|
-
ref: menuRef,
|
|
83986
|
-
onSelect,
|
|
83987
|
-
className: locationFilterStyles_default.locationFilterMenu
|
|
83957
|
+
timeZone: columnDefinition.timeZone
|
|
83988
83958
|
},
|
|
83989
83959
|
/* @__PURE__ */ React76.createElement(
|
|
83990
|
-
|
|
83960
|
+
DateFilterTokenText,
|
|
83991
83961
|
{
|
|
83992
|
-
|
|
83993
|
-
|
|
83962
|
+
headerName: columnDefinition.headerName,
|
|
83963
|
+
value: filterValue
|
|
83994
83964
|
}
|
|
83995
|
-
)
|
|
83996
|
-
|
|
83997
|
-
Box,
|
|
83998
|
-
{
|
|
83999
|
-
className: locationFilterStyles_default.controlsContainer,
|
|
84000
|
-
...UNSAFE_menuItemsWrapperAttribute
|
|
84001
|
-
},
|
|
84002
|
-
/* @__PURE__ */ React76.createElement(
|
|
84003
|
-
UNSAFE_Menu.CheckboxItem,
|
|
84004
|
-
{
|
|
84005
|
-
key: getId3(includeSublocationOption),
|
|
84006
|
-
item: includeSublocationOption,
|
|
84007
|
-
selected: enableSublocations
|
|
84008
|
-
},
|
|
84009
|
-
getLabel3(includeSublocationOption)
|
|
84010
|
-
),
|
|
84011
|
-
/* @__PURE__ */ React76.createElement(
|
|
84012
|
-
UNSAFE_Menu.CheckboxItem,
|
|
84013
|
-
{
|
|
84014
|
-
key: getId3(selectAllOption),
|
|
84015
|
-
item: selectAllOption,
|
|
84016
|
-
selected: selectState === "all",
|
|
84017
|
-
indeterminate: selectState === "partial"
|
|
84018
|
-
},
|
|
84019
|
-
getLabel3(selectAllOption)
|
|
84020
|
-
)
|
|
84021
|
-
), !loading && items.map((item, i) => {
|
|
84022
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84023
|
-
UNSAFE_Menu.CheckboxItem,
|
|
84024
|
-
{
|
|
84025
|
-
key: getId3(item),
|
|
84026
|
-
item,
|
|
84027
|
-
selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
|
|
84028
|
-
suggested: i === 0,
|
|
84029
|
-
disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
|
|
84030
|
-
},
|
|
84031
|
-
getLabel3(item)
|
|
84032
|
-
);
|
|
84033
|
-
})),
|
|
84034
|
-
loading && /* @__PURE__ */ React76.createElement(UNSAFE_Menu.Footer, null, /* @__PURE__ */ React76.createElement(Flex, { justifyContent: "center" }, /* @__PURE__ */ React76.createElement(Spinner$1, { size: "sm" })))
|
|
84035
|
-
));
|
|
83965
|
+
)
|
|
83966
|
+
);
|
|
84036
83967
|
}
|
|
84037
|
-
)
|
|
84038
|
-
|
|
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,
|
|
84039
83995
|
columnDefinition,
|
|
83996
|
+
onChange,
|
|
83997
|
+
onRemove,
|
|
83998
|
+
overlayMatchesTriggerWidth,
|
|
84040
83999
|
disabled
|
|
84041
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 }) => {
|
|
84042
84056
|
const {
|
|
84043
84057
|
options: originOptions,
|
|
84058
|
+
onClearFilter,
|
|
84059
|
+
fieldName,
|
|
84044
84060
|
value: originValue = [],
|
|
84045
84061
|
onChange,
|
|
84046
84062
|
getOptions,
|
|
84047
84063
|
loading
|
|
84048
84064
|
} = useServerSideFilter({ columnDefinition });
|
|
84049
|
-
const { options, value } =
|
|
84065
|
+
const { options, value, getOptionValue } = useSuperSelectOptionAsValueWorkaround3({
|
|
84050
84066
|
originOptions,
|
|
84051
84067
|
originValue,
|
|
84052
84068
|
loading,
|
|
84053
84069
|
getId: columnDefinition.filterProps?.getId
|
|
84054
84070
|
});
|
|
84055
|
-
const
|
|
84056
|
-
|
|
84057
|
-
|
|
84058
|
-
|
|
84059
|
-
|
|
84060
|
-
return "all";
|
|
84061
|
-
}
|
|
84062
|
-
if (selection.length && (options.length > selection.length || options.length < selection.length)) {
|
|
84063
|
-
return "partial";
|
|
84064
|
-
}
|
|
84065
|
-
if (selection.length === 0) {
|
|
84066
|
-
return "none";
|
|
84067
|
-
}
|
|
84068
|
-
return "none";
|
|
84069
|
-
};
|
|
84070
|
-
const ids = React76.useMemo(() => value.map(({ id }) => id), [value]);
|
|
84071
|
-
const [selectedValueIds, setSelectedValueIds] = React76.useState(ids);
|
|
84072
|
-
const [selectState, setSelectState] = React76.useState(
|
|
84073
|
-
determineSelectedState(value)
|
|
84074
|
-
);
|
|
84075
|
-
const [disabledValues, setDisabledValues] = React76.useState([]);
|
|
84076
|
-
const [enableSublocations, setEnableSublocations] = React76.useState(false);
|
|
84077
|
-
const onSelectSublocations = React76.useCallback(() => {
|
|
84078
|
-
if (enableSublocations) {
|
|
84079
|
-
setDisabledValues([]);
|
|
84080
|
-
} else {
|
|
84081
|
-
const newDisabledValues = [];
|
|
84082
|
-
value.forEach((location) => {
|
|
84083
|
-
newDisabledValues.push(...findSublocations(location));
|
|
84084
|
-
});
|
|
84085
|
-
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
84086
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
84087
|
-
);
|
|
84088
|
-
setDisabledValues(uniqDisabledValues);
|
|
84089
|
-
}
|
|
84090
|
-
setEnableSublocations(!enableSublocations);
|
|
84091
|
-
}, [enableSublocations, value, selectedValueIds, options]);
|
|
84092
|
-
const onSelectAll = React76.useCallback(() => {
|
|
84093
|
-
if (selectState === "none" || selectState === "partial") {
|
|
84094
|
-
setSelectState("all");
|
|
84095
|
-
setSelectedValueIds(options.map(({ id }) => id));
|
|
84096
|
-
onChange(options);
|
|
84097
|
-
}
|
|
84098
|
-
if (selectState === "all") {
|
|
84099
|
-
setSelectState("none");
|
|
84100
|
-
setSelectedValueIds([]);
|
|
84101
|
-
onChange([]);
|
|
84071
|
+
const hasFetchedOptions = React76.useRef(false);
|
|
84072
|
+
React76.useEffect(() => {
|
|
84073
|
+
if (!hasFetchedOptions.current && !originOptions.length) {
|
|
84074
|
+
getOptions();
|
|
84075
|
+
hasFetchedOptions.current = true;
|
|
84102
84076
|
}
|
|
84103
|
-
}, [
|
|
84104
|
-
const
|
|
84105
|
-
|
|
84077
|
+
}, [getOptions, originOptions.length]);
|
|
84078
|
+
const handleOnChange = (values2) => {
|
|
84079
|
+
const selectedValues = ensureArray(values2);
|
|
84080
|
+
if (!selectedValues.length) {
|
|
84081
|
+
onClearFilter?.(fieldName);
|
|
84082
|
+
getOptions();
|
|
84106
84083
|
return;
|
|
84107
84084
|
}
|
|
84108
|
-
|
|
84109
|
-
return onChange(
|
|
84110
|
-
value.map((item) => ({
|
|
84111
|
-
...item,
|
|
84112
|
-
sublocations: enableSublocations ? [] : findSublocations(item)
|
|
84113
|
-
}))
|
|
84114
|
-
);
|
|
84115
|
-
}
|
|
84116
|
-
let newSelections = [];
|
|
84117
|
-
if (selectedValueIds.includes(getId3(selection.item))) {
|
|
84118
|
-
newSelections = removeSelections(selection.item, value);
|
|
84119
|
-
} else {
|
|
84120
|
-
newSelections = [...value, selection.item];
|
|
84121
|
-
const sublocationsToDisable = handleSelectSublocations(selection.item);
|
|
84122
|
-
const newDisabledValues = [
|
|
84123
|
-
...disabledValues,
|
|
84124
|
-
...sublocationsToDisable.filter(
|
|
84125
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
84126
|
-
)
|
|
84127
|
-
];
|
|
84128
|
-
setDisabledValues(newDisabledValues);
|
|
84129
|
-
}
|
|
84130
|
-
setSelectState(determineSelectedState(newSelections));
|
|
84131
|
-
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
84132
|
-
onChange(
|
|
84133
|
-
newSelections.map((item) => ({
|
|
84134
|
-
...item,
|
|
84135
|
-
sublocations: handleSelectSublocations(item)
|
|
84136
|
-
}))
|
|
84137
|
-
);
|
|
84138
|
-
};
|
|
84139
|
-
const findSublocations = (selected) => {
|
|
84140
|
-
return options.filter((option) => {
|
|
84141
|
-
return startsWith(
|
|
84142
|
-
`${getLabel3(selected).toLowerCase()} > `,
|
|
84143
|
-
getLabel3(option).toLowerCase()
|
|
84144
|
-
);
|
|
84145
|
-
});
|
|
84085
|
+
onChange(selectedValues);
|
|
84146
84086
|
};
|
|
84147
|
-
const
|
|
84148
|
-
if (
|
|
84149
|
-
|
|
84150
|
-
return filteredOptions;
|
|
84151
|
-
} else {
|
|
84152
|
-
return [];
|
|
84087
|
+
const handleOnOpenChange = (open) => {
|
|
84088
|
+
if (open && !originOptions.length) {
|
|
84089
|
+
getOptions();
|
|
84153
84090
|
}
|
|
84154
84091
|
};
|
|
84155
|
-
|
|
84156
|
-
|
|
84157
|
-
|
|
84158
|
-
|
|
84159
|
-
|
|
84160
|
-
setDisabledValues(
|
|
84161
|
-
disabledValues.filter(
|
|
84162
|
-
({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
|
|
84163
|
-
)
|
|
84164
|
-
);
|
|
84165
|
-
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"
|
|
84166
84097
|
},
|
|
84167
|
-
|
|
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
|
+
)
|
|
84168
84115
|
);
|
|
84169
|
-
|
|
84170
|
-
|
|
84171
|
-
}
|
|
84172
|
-
|
|
84173
|
-
|
|
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,
|
|
84174
84134
|
{
|
|
84175
|
-
|
|
84176
|
-
|
|
84177
|
-
|
|
84178
|
-
|
|
84179
|
-
|
|
84180
|
-
|
|
84181
|
-
|
|
84182
|
-
|
|
84183
|
-
|
|
84184
|
-
|
|
84185
|
-
|
|
84186
|
-
|
|
84187
|
-
|
|
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
|
|
84188
84166
|
}
|
|
84189
84167
|
);
|
|
84190
|
-
|
|
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]);
|
|
84191
84176
|
return /* @__PURE__ */ React76.createElement(
|
|
84192
|
-
|
|
84177
|
+
FiltersPanelToggleButton,
|
|
84193
84178
|
{
|
|
84194
|
-
|
|
84195
|
-
|
|
84196
|
-
|
|
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"
|
|
84197
84214
|
},
|
|
84198
|
-
|
|
84199
|
-
|
|
84200
|
-
{
|
|
84201
|
-
enabled: true,
|
|
84202
|
-
disabled,
|
|
84203
|
-
label: `${I18n.t(
|
|
84204
|
-
"dataTable.filters.locationFilter.locations"
|
|
84205
|
-
)}${triggerLabel}`,
|
|
84206
|
-
onClear: () => {
|
|
84207
|
-
onChange([]);
|
|
84208
|
-
},
|
|
84209
|
-
block: true
|
|
84210
|
-
}
|
|
84211
|
-
) : /* @__PURE__ */ React76.createElement(
|
|
84212
|
-
QuickFilterLabel,
|
|
84215
|
+
/* @__PURE__ */ React76.createElement(
|
|
84216
|
+
"path",
|
|
84213
84217
|
{
|
|
84214
|
-
|
|
84215
|
-
|
|
84216
|
-
|
|
84217
|
-
|
|
84218
|
-
)}${triggerLabel}`,
|
|
84219
|
-
block: true
|
|
84218
|
+
fillRule: "evenodd",
|
|
84219
|
+
clipRule: "evenodd",
|
|
84220
|
+
d: "M3 5V7H17V5H3ZM8 15H12V13H8V15ZM15 11H5V9H15V11Z",
|
|
84221
|
+
fill: "currentColor"
|
|
84220
84222
|
}
|
|
84221
84223
|
)
|
|
84222
84224
|
);
|
|
84223
84225
|
};
|
|
84224
|
-
var
|
|
84225
|
-
|
|
84226
|
-
|
|
84226
|
+
var StyledFilterTokenWrapper = styled3.div`
|
|
84227
|
+
${UNSAFE_StyledFilterTokenLabel} {
|
|
84228
|
+
font-weight: ${typographyWeights.semibold};
|
|
84229
|
+
}
|
|
84227
84230
|
`;
|
|
84228
|
-
var
|
|
84229
|
-
const
|
|
84230
|
-
const
|
|
84231
|
-
|
|
84232
|
-
|
|
84233
|
-
|
|
84234
|
-
|
|
84235
|
-
|
|
84236
|
-
|
|
84237
|
-
headerName: columnDefinition.headerName,
|
|
84238
|
-
value: Array.isArray(value) ? value : [value]
|
|
84239
|
-
});
|
|
84240
|
-
} : void 0;
|
|
84241
|
-
return {
|
|
84242
|
-
components: {
|
|
84243
|
-
Label: React76.forwardRef(() => {
|
|
84244
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84245
|
-
const isValueEmpty = ["", null, void 0].includes(
|
|
84246
|
-
ctx.state.value
|
|
84247
|
-
);
|
|
84248
|
-
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
84249
|
-
isValueEmpty,
|
|
84250
|
-
ctx.state.selectedLabel,
|
|
84251
|
-
ctx.config.placeholder,
|
|
84252
|
-
filterName
|
|
84253
|
-
));
|
|
84254
|
-
}),
|
|
84255
|
-
TriggerContainer: React76.forwardRef((props, ref) => {
|
|
84256
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84257
|
-
if (!Array.isArray(ctx.state.value)) {
|
|
84258
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84259
|
-
UNSAFE_StyledSuperSelectTrigger,
|
|
84260
|
-
{
|
|
84261
|
-
$block: ctx.config.block,
|
|
84262
|
-
...props,
|
|
84263
|
-
ref
|
|
84264
|
-
}
|
|
84265
|
-
);
|
|
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;
|
|
84266
84240
|
}
|
|
84267
|
-
|
|
84268
|
-
|
|
84269
|
-
|
|
84270
|
-
|
|
84271
|
-
|
|
84272
|
-
|
|
84273
|
-
|
|
84274
|
-
(option2) => ctx.option.value(option2) === v
|
|
84275
|
-
);
|
|
84276
|
-
return option ? ctx.option.label(option) : "";
|
|
84277
|
-
}).join(", ")))
|
|
84278
|
-
},
|
|
84279
|
-
/* @__PURE__ */ React76.createElement(
|
|
84280
|
-
UNSAFE_StyledSuperSelectTrigger,
|
|
84281
|
-
{
|
|
84282
|
-
$block: ctx.config.block,
|
|
84283
|
-
...props,
|
|
84284
|
-
ref
|
|
84285
|
-
}
|
|
84286
|
-
)
|
|
84287
|
-
);
|
|
84288
|
-
}),
|
|
84289
|
-
MultiValueContainer: () => {
|
|
84290
|
-
const ctx = UNSAFE_useSuperSelectContext();
|
|
84291
|
-
if (Array.isArray(ctx.state.value)) {
|
|
84292
|
-
const isValueEmpty = !ctx.state.value.length;
|
|
84293
|
-
const value = ctx.state.value.length > 1 ? `(${ctx.state.value.length})` : ctx.state.value.length === 1 ? `${ctx.state.selectedLabel}` : "";
|
|
84294
|
-
return /* @__PURE__ */ React76.createElement(UNSAFE_StyledSuperSelectLabel, { $hoverable: false }, typeof getValueLabel_ === "function" ? getValueLabel_(ctx.state.value) : getValueLabel(
|
|
84295
|
-
isValueEmpty,
|
|
84296
|
-
value,
|
|
84297
|
-
ctx.config.placeholder,
|
|
84298
|
-
filterName
|
|
84299
|
-
));
|
|
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] };
|
|
84300
84248
|
}
|
|
84301
|
-
return
|
|
84249
|
+
return acc;
|
|
84250
|
+
},
|
|
84251
|
+
{
|
|
84252
|
+
quickFilters: [],
|
|
84253
|
+
tokens: []
|
|
84302
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"
|
|
84303
84266
|
},
|
|
84304
|
-
|
|
84305
|
-
|
|
84306
|
-
|
|
84307
|
-
|
|
84308
|
-
|
|
84309
|
-
|
|
84310
|
-
|
|
84311
|
-
|
|
84312
|
-
|
|
84313
|
-
|
|
84314
|
-
|
|
84315
|
-
|
|
84316
|
-
|
|
84317
|
-
|
|
84318
|
-
|
|
84319
|
-
|
|
84320
|
-
|
|
84321
|
-
|
|
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)
|
|
84322
84302
|
}
|
|
84323
|
-
|
|
84324
|
-
|
|
84325
|
-
|
|
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;
|
|
84326
84327
|
}
|
|
84327
|
-
|
|
84328
|
-
|
|
84329
|
-
|
|
84330
|
-
|
|
84331
|
-
|
|
84332
|
-
|
|
84333
|
-
|
|
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
|
+
};
|
|
84334
84341
|
}
|
|
84335
|
-
|
|
84336
|
-
|
|
84337
|
-
|
|
84338
|
-
|
|
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
|
|
84339
84383
|
}
|
|
84340
|
-
|
|
84384
|
+
)
|
|
84385
|
+
);
|
|
84386
|
+
}),
|
|
84387
|
+
tokenNames.map((fieldName) => {
|
|
84388
|
+
const colDef = getColumnDefinition(fieldName);
|
|
84389
|
+
if (!colDef) {
|
|
84390
|
+
return null;
|
|
84341
84391
|
}
|
|
84342
|
-
|
|
84343
|
-
|
|
84344
|
-
|
|
84345
|
-
|
|
84346
|
-
|
|
84347
|
-
|
|
84348
|
-
|
|
84349
|
-
|
|
84350
|
-
|
|
84351
|
-
var ClientSideMultiSelectQuickFilter = ({
|
|
84352
|
-
filter,
|
|
84353
|
-
columnDefinition,
|
|
84354
|
-
onChange,
|
|
84355
|
-
onRemove,
|
|
84356
|
-
overlayMatchesTriggerWidth,
|
|
84357
|
-
disabled
|
|
84358
|
-
}) => {
|
|
84359
|
-
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(filter.filterValues?.length) }, /* @__PURE__ */ React76.createElement(
|
|
84360
|
-
UNSAFE_SuperSelect,
|
|
84361
|
-
{
|
|
84362
|
-
overlayMatchesTriggerWidth,
|
|
84363
|
-
value: filter.filterValues === null ? [] : filter.filterValues,
|
|
84364
|
-
search: false,
|
|
84365
|
-
multiple: true,
|
|
84366
|
-
options: filter.options,
|
|
84367
|
-
disabled,
|
|
84368
|
-
getOptionValue: (option) => {
|
|
84369
|
-
return getId(columnDefinition.filterProps?.getId, option);
|
|
84370
|
-
},
|
|
84371
|
-
getOptionLabel: (option) => {
|
|
84372
|
-
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
84373
|
-
},
|
|
84374
|
-
onChange: (values2) => {
|
|
84375
|
-
if (Array.isArray(values2) && !values2.length) {
|
|
84376
|
-
onRemove?.();
|
|
84377
|
-
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)
|
|
84378
84401
|
}
|
|
84379
|
-
|
|
84380
|
-
|
|
84381
|
-
|
|
84382
|
-
}
|
|
84383
|
-
));
|
|
84402
|
+
)));
|
|
84403
|
+
})
|
|
84404
|
+
);
|
|
84384
84405
|
};
|
|
84385
|
-
var
|
|
84386
|
-
|
|
84387
|
-
|
|
84388
|
-
|
|
84389
|
-
|
|
84390
|
-
|
|
84391
|
-
|
|
84392
|
-
|
|
84393
|
-
const valueIds = originValue.map((option) => getId(getId3, option));
|
|
84394
|
-
isValueFromOptions.current = true;
|
|
84395
|
-
return originOptions.filter(
|
|
84396
|
-
(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
|
+
}
|
|
84397
84414
|
);
|
|
84398
|
-
}
|
|
84399
|
-
|
|
84400
|
-
|
|
84401
|
-
const options = !hasOptions && hasValue ? originValue : originOptions;
|
|
84402
|
-
const value = !hasOptions ? originValue : isValueFromOptions.current ? originValue : getValueFromOptions();
|
|
84403
|
-
return {
|
|
84404
|
-
options,
|
|
84405
|
-
value,
|
|
84406
|
-
getOptionValue: (option) => option
|
|
84407
|
-
};
|
|
84408
|
-
};
|
|
84409
|
-
var ServerSideMultiSelectQuickFilter = ({ columnDefinition, overlayMatchesTriggerWidth, disabled }) => {
|
|
84410
|
-
const {
|
|
84411
|
-
options: originOptions,
|
|
84412
|
-
onClearFilter,
|
|
84413
|
-
fieldName,
|
|
84414
|
-
value: originValue = [],
|
|
84415
|
-
onChange,
|
|
84416
|
-
getOptions,
|
|
84417
|
-
loading
|
|
84418
|
-
} = useServerSideFilter({ columnDefinition });
|
|
84419
|
-
const { options, value, getOptionValue } = useSuperSelectOptionAsValueWorkaround2({
|
|
84420
|
-
originOptions,
|
|
84421
|
-
originValue,
|
|
84422
|
-
loading,
|
|
84423
|
-
getId: columnDefinition.filterProps?.getId
|
|
84424
|
-
});
|
|
84425
|
-
return /* @__PURE__ */ React76.createElement(StyledSuperSelectWrapper, { $enabled: Boolean(value?.length) }, /* @__PURE__ */ React76.createElement(
|
|
84426
|
-
UNSAFE_SuperSelect,
|
|
84415
|
+
}
|
|
84416
|
+
return /* @__PURE__ */ React76.createElement(
|
|
84417
|
+
ClientSideQuickFilters,
|
|
84427
84418
|
{
|
|
84428
|
-
overlayMatchesTriggerWidth
|
|
84429
|
-
loading,
|
|
84430
|
-
value: value === null ? [] : value,
|
|
84431
|
-
search: false,
|
|
84432
|
-
getOptionLabel: (option) => {
|
|
84433
|
-
return getLabel(columnDefinition.filterProps?.getLabel, option);
|
|
84434
|
-
},
|
|
84435
|
-
getOptionValue,
|
|
84436
|
-
multiple: true,
|
|
84437
|
-
options,
|
|
84438
|
-
disabled,
|
|
84439
|
-
onChange: (values2) => {
|
|
84440
|
-
if (Array.isArray(values2) && !values2.length) {
|
|
84441
|
-
onClearFilter?.(fieldName);
|
|
84442
|
-
getOptions();
|
|
84443
|
-
return;
|
|
84444
|
-
}
|
|
84445
|
-
onChange(values2);
|
|
84446
|
-
},
|
|
84447
|
-
onOpenChange: (open) => {
|
|
84448
|
-
if (open && !originOptions.length) {
|
|
84449
|
-
getOptions();
|
|
84450
|
-
}
|
|
84451
|
-
},
|
|
84452
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84419
|
+
overlayMatchesTriggerWidth
|
|
84453
84420
|
}
|
|
84454
|
-
)
|
|
84421
|
+
);
|
|
84455
84422
|
};
|
|
84456
|
-
var
|
|
84423
|
+
var FiltersPanelButton = () => {
|
|
84457
84424
|
const { onServerSideDataRequest } = useInternalTableContext();
|
|
84458
|
-
if (
|
|
84459
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84425
|
+
if (onServerSideDataRequest) {
|
|
84426
|
+
return /* @__PURE__ */ React76.createElement(ServerSideFiltersPanelToggleButton, null);
|
|
84460
84427
|
}
|
|
84461
|
-
return /* @__PURE__ */ React76.createElement(
|
|
84428
|
+
return /* @__PURE__ */ React76.createElement(ClientSideFiltersPanelToggleButton, null);
|
|
84462
84429
|
};
|
|
84463
|
-
var
|
|
84464
|
-
|
|
84465
|
-
|
|
84466
|
-
|
|
84467
|
-
|
|
84468
|
-
|
|
84469
|
-
|
|
84470
|
-
|
|
84471
|
-
|
|
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
|
+
}
|
|
84472
84496
|
return /* @__PURE__ */ React76.createElement(
|
|
84473
|
-
|
|
84497
|
+
EmptyResultsControlTooltip,
|
|
84474
84498
|
{
|
|
84475
|
-
|
|
84476
|
-
|
|
84499
|
+
featureI18nKey: "featureGroupBy",
|
|
84500
|
+
enabled: hasNoContent
|
|
84477
84501
|
},
|
|
84478
84502
|
/* @__PURE__ */ React76.createElement(
|
|
84479
|
-
|
|
84503
|
+
Tooltip,
|
|
84480
84504
|
{
|
|
84481
|
-
|
|
84482
|
-
|
|
84483
|
-
|
|
84484
|
-
|
|
84485
|
-
|
|
84486
|
-
|
|
84487
|
-
|
|
84488
|
-
|
|
84489
|
-
|
|
84490
|
-
|
|
84491
|
-
|
|
84492
|
-
|
|
84493
|
-
|
|
84494
|
-
|
|
84495
|
-
|
|
84496
|
-
|
|
84497
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84498
|
-
}
|
|
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
|
+
))
|
|
84499
84521
|
)
|
|
84500
84522
|
);
|
|
84501
84523
|
};
|
|
84502
|
-
|
|
84503
|
-
|
|
84504
|
-
|
|
84505
|
-
|
|
84506
|
-
|
|
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
|
|
84507
84538
|
}) => {
|
|
84508
|
-
const
|
|
84509
|
-
const
|
|
84510
|
-
|
|
84511
|
-
|
|
84512
|
-
|
|
84513
|
-
|
|
84514
|
-
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
|
|
84518
|
-
const
|
|
84519
|
-
|
|
84520
|
-
|
|
84521
|
-
|
|
84522
|
-
|
|
84523
|
-
|
|
84524
|
-
|
|
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
|
+
));
|
|
84525
84573
|
};
|
|
84526
|
-
var
|
|
84527
|
-
const {
|
|
84528
|
-
|
|
84529
|
-
|
|
84530
|
-
|
|
84531
|
-
|
|
84532
|
-
|
|
84533
|
-
|
|
84534
|
-
|
|
84535
|
-
|
|
84536
|
-
const
|
|
84537
|
-
|
|
84538
|
-
|
|
84539
|
-
|
|
84540
|
-
|
|
84541
|
-
|
|
84542
|
-
|
|
84543
|
-
|
|
84544
|
-
|
|
84545
|
-
|
|
84546
|
-
|
|
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
|
|
84547
84602
|
}
|
|
84548
|
-
|
|
84549
|
-
|
|
84550
|
-
|
|
84551
|
-
|
|
84552
|
-
|
|
84553
|
-
|
|
84554
|
-
|
|
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
|
+
}
|
|
84555
84611
|
}
|
|
84556
|
-
|
|
84557
|
-
|
|
84558
|
-
|
|
84559
|
-
|
|
84560
|
-
getOptions();
|
|
84612
|
+
), /* @__PURE__ */ React76.createElement(ConfigPanelButton, null))), /* @__PURE__ */ React76.createElement(
|
|
84613
|
+
QuickFilters,
|
|
84614
|
+
{
|
|
84615
|
+
overlayMatchesTriggerWidth: props.filterOverlayMatchesTriggerWidth
|
|
84561
84616
|
}
|
|
84562
|
-
|
|
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
|
+
}) => {
|
|
84563
84646
|
return /* @__PURE__ */ React76.createElement(
|
|
84564
|
-
|
|
84647
|
+
DataTable,
|
|
84565
84648
|
{
|
|
84566
|
-
|
|
84567
|
-
|
|
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
|
|
84568
84663
|
},
|
|
84569
|
-
|
|
84570
|
-
UNSAFE_SuperSelect,
|
|
84571
|
-
{
|
|
84572
|
-
overlayMatchesTriggerWidth,
|
|
84573
|
-
loading,
|
|
84574
|
-
value: value ?? [],
|
|
84575
|
-
search: false,
|
|
84576
|
-
disabled,
|
|
84577
|
-
getOptionLabel: (option) => getLabel(columnDefinition.filterProps?.getLabel, option),
|
|
84578
|
-
getOptionValue,
|
|
84579
|
-
multiple: false,
|
|
84580
|
-
options,
|
|
84581
|
-
onChange: handleOnChange,
|
|
84582
|
-
onOpenChange: handleOnOpenChange,
|
|
84583
|
-
...getSuperSelectFilterPreset(columnDefinition)
|
|
84584
|
-
}
|
|
84585
|
-
)
|
|
84664
|
+
children
|
|
84586
84665
|
);
|
|
84587
84666
|
};
|
|
84588
|
-
var
|
|
84589
|
-
const
|
|
84590
|
-
|
|
84591
|
-
|
|
84592
|
-
}
|
|
84593
|
-
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] });
|
|
84594
84673
|
};
|
|
84595
|
-
|
|
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
|
+
);
|
|
84596
84699
|
|
|
84597
84700
|
// ../../node_modules/@ag-grid-enterprise/server-side-row-model/dist/esm/es6/serverSideRowModel/stores/fullStore.mjs
|
|
84598
84701
|
var __decorate212 = function(decorators, target, key, desc) {
|