@stenajs-webui/grid 17.13.0 → 17.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,2660 +1,2096 @@
1
- (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("._tableRow_1cphw_1:focus-within{background:var(--focus-within-background, var(--lhds-color-blue-50))}._standardTable_1iok0_1{--swui-standard-table-height: 40px;--swui-sticky-header-shadow: 2px 4px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-header-shadow-and-right: var(--swui-sticky-header-shadow), var(--swui-sticky-column-shadow-right);--swui-sticky-header-shadow-and-left: var(--swui-sticky-header-shadow), var(--swui-sticky-column-shadow-left);--swui-sticky-column-shadow-right: 4px 2px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-column-shadow-left: -4px 2px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-header-z-index: 10;--swui-sticky-column-z-index: 20;--swui-sticky-group-group-z-index: 25;--swui-sticky-group-header-z-index: 26;--swui-sticky-header-column-group-z-index: 30;--swui-sticky-column-group-label-z-index: 40;--swui-sticky-header-in-sticky-column-z-index: 50;--swui-sticky-popover-z-index: 60;--swui-expand-cell-width: 45px;--swui-checkbox-cell-width: 45px;--swui-expand-highlight-border-width: 2px;--current-row-height: var(--swui-standard-table-height);--current-left-offset: 0px;border-spacing:0}._standardTable_1iok0_1 td{border-top:1px solid var(--lhds-color-ui-300);padding:0}._standardTable_1iok0_1 th{padding:0}._standardTable_1iok0_1._relaxed_1iok0_37{--current-row-height: 48px}._standardTable_1iok0_1._condensed_1iok0_41{--current-row-height: 32px}._standardTable_1iok0_1._compact_1iok0_45{--current-row-height: 24px}._standardTableCell_1xzcm_1{outline:none}._textCell_1yv6v_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._summaryRow_12x8k_1 td{border-top:1px solid var(--lhds-color-ui-400)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import * as React from "react";
2
- import { useMemo, useRef, useState, useCallback, useEffect, useContext, createContext, useReducer, useId } from "react";
3
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
4
- import { faExclamationTriangle } from "@fortawesome/free-solid-svg-icons/faExclamationTriangle";
5
- import { InputSpinner, Icon, stenaArrowRight, stenaInfoCircle, FlatButton, ResultListBanner, Banner } from "@stenajs-webui/elements";
6
- import { cssColor } from "@stenajs-webui/theme";
7
- import { Tooltip, Popover } from "@stenajs-webui/tooltip";
8
- import { Text, Indent, Space, Row, Box, exhaustSwitchCaseElseThrow, Heading, useArraySet, useOnScreen, Spacing, booleanOrNumberToNumber } from "@stenajs-webui/core";
9
- import { faEllipsisV } from "@fortawesome/free-solid-svg-icons/faEllipsisV";
10
- import { faSortAlphaDown } from "@fortawesome/free-solid-svg-icons/faSortAlphaDown";
11
- import { faSortAlphaUp } from "@fortawesome/free-solid-svg-icons/faSortAlphaUp";
12
- import { faSortAmountDownAlt } from "@fortawesome/free-solid-svg-icons/faSortAmountDownAlt";
13
- import { faSortAmountUpAlt } from "@fortawesome/free-solid-svg-icons/faSortAmountUpAlt";
14
- import { faSortNumericDown } from "@fortawesome/free-solid-svg-icons/faSortNumericDown";
15
- import { faSortNumericUp } from "@fortawesome/free-solid-svg-icons/faSortNumericUp";
16
- import cx from "classnames";
17
- import { faArrowRight } from "@fortawesome/free-solid-svg-icons/faArrowRight";
18
- import { TextInput, Checkbox } from "@stenajs-webui/forms";
19
- import { useDispatch, useSelector } from "react-redux";
20
- import { createSortOrderActions, createSelectedIdsActions, createEntityActions, createSortOrderReducerInitialState, createSelectedIdsReducerInitialState, reducerIdGate, createSortOrderReducer, createSelectedIdsReducer, createEntityReducer, reducerIdGateAction } from "@stenajs-webui/redux";
21
- import { combineReducers } from "redux";
22
- import { LoadingScreen, ErrorScreen } from "@stenajs-webui/panels";
23
- import { compact as compact$1, upperFirst, lowerCase } from "lodash";
24
- import { faChevronDown } from "@fortawesome/free-solid-svg-icons/faChevronDown";
25
- import { faChevronRight } from "@fortawesome/free-solid-svg-icons/faChevronRight";
26
- import styled from "@emotion/styled";
27
- const GridHooksContext = React.createContext({});
28
- const GridHooksTable = ({
29
- children,
30
- numCols,
31
- numRows,
32
- tableId,
33
- wrap
1
+ (function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("._tableRow_1cphw_1:focus-within{background:var(--focus-within-background, var(--lhds-color-blue-50))}._standardTable_1iok0_1{--swui-standard-table-height: 40px;--swui-sticky-header-shadow: 2px 4px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-header-shadow-and-right: var(--swui-sticky-header-shadow), var(--swui-sticky-column-shadow-right);--swui-sticky-header-shadow-and-left: var(--swui-sticky-header-shadow), var(--swui-sticky-column-shadow-left);--swui-sticky-column-shadow-right: 4px 2px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-column-shadow-left: -4px 2px 4px 0 rgba(0, 0, 0, .05);--swui-sticky-header-z-index: 10;--swui-sticky-column-z-index: 20;--swui-sticky-group-group-z-index: 25;--swui-sticky-group-header-z-index: 26;--swui-sticky-header-column-group-z-index: 30;--swui-sticky-column-group-label-z-index: 40;--swui-sticky-header-in-sticky-column-z-index: 50;--swui-sticky-popover-z-index: 60;--swui-expand-cell-width: 45px;--swui-checkbox-cell-width: 45px;--swui-expand-highlight-border-width: 2px;--current-row-height: var(--swui-standard-table-height);--current-left-offset: 0px;border-spacing:0}._standardTable_1iok0_1 td{border-top:1px solid var(--lhds-color-ui-300);padding:0}._standardTable_1iok0_1 th{padding:0}._standardTable_1iok0_1._relaxed_1iok0_37{--current-row-height: 48px}._standardTable_1iok0_1._condensed_1iok0_41{--current-row-height: 32px}._standardTable_1iok0_1._compact_1iok0_45{--current-row-height: 24px}._standardTableCell_1xzcm_1{outline:none}._textCell_1yv6v_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._summaryRow_12x8k_1 td{border-top:1px solid var(--lhds-color-ui-400)}")),document.head.appendChild(e)}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
+ import * as T from "react";
3
+ import { useMemo as v, useRef as te, useState as ve, useCallback as I, useEffect as je, useContext as V, createContext as $, useReducer as It, useId as Et } from "react";
4
+ import { jsx as r, Fragment as G, jsxs as g } from "react/jsx-runtime";
5
+ import { faExclamationTriangle as ue } from "@fortawesome/free-solid-svg-icons/faExclamationTriangle";
6
+ import { InputSpinner as ye, Icon as F, stenaArrowRight as Rt, stenaInfoCircle as Gt, FlatButton as xe, ResultListBanner as Tt, Banner as Le } from "@stenajs-webui/elements";
7
+ import { cssColor as _ } from "@stenajs-webui/theme";
8
+ import { Tooltip as re, Popover as Ot } from "@stenajs-webui/tooltip";
9
+ import { Text as U, Indent as N, Space as B, Row as E, Box as ne, exhaustSwitchCaseElseThrow as Pt, Heading as We, useArraySet as qe, useOnScreen as At, Spacing as we, booleanOrNumberToNumber as Lt } from "@stenajs-webui/core";
10
+ import { faEllipsisV as Bt } from "@fortawesome/free-solid-svg-icons/faEllipsisV";
11
+ import { faSortAlphaDown as Dt } from "@fortawesome/free-solid-svg-icons/faSortAlphaDown";
12
+ import { faSortAlphaUp as Nt } from "@fortawesome/free-solid-svg-icons/faSortAlphaUp";
13
+ import { faSortAmountDownAlt as zt } from "@fortawesome/free-solid-svg-icons/faSortAmountDownAlt";
14
+ import { faSortAmountUpAlt as Kt } from "@fortawesome/free-solid-svg-icons/faSortAmountUpAlt";
15
+ import { faSortNumericDown as Ht } from "@fortawesome/free-solid-svg-icons/faSortNumericDown";
16
+ import { faSortNumericUp as $t } from "@fortawesome/free-solid-svg-icons/faSortNumericUp";
17
+ import Fe from "classnames";
18
+ import { faArrowRight as Mt } from "@fortawesome/free-solid-svg-icons/faArrowRight";
19
+ import { TextInput as ge, Checkbox as Ue } from "@stenajs-webui/forms";
20
+ import { useDispatch as Vt, useSelector as Be } from "react-redux";
21
+ import { createSortOrderActions as _t, createSelectedIdsActions as De, createEntityActions as jt, createSortOrderReducerInitialState as Wt, createSelectedIdsReducerInitialState as Ne, reducerIdGate as de, createSortOrderReducer as qt, createSelectedIdsReducer as ze, createEntityReducer as Ft, reducerIdGateAction as X } from "@stenajs-webui/redux";
22
+ import { combineReducers as Ut } from "redux";
23
+ import { LoadingScreen as Zt, ErrorScreen as Jt } from "@stenajs-webui/panels";
24
+ import { compact as Xt, upperFirst as Yt, lowerCase as Qt } from "lodash";
25
+ import { faChevronDown as Ze } from "@fortawesome/free-solid-svg-icons/faChevronDown";
26
+ import { faChevronRight as Je } from "@fortawesome/free-solid-svg-icons/faChevronRight";
27
+ import en from "@emotion/styled";
28
+ const Xe = T.createContext({}), xr = ({
29
+ children: e,
30
+ numCols: t,
31
+ numRows: n,
32
+ tableId: o,
33
+ wrap: s
34
34
  }) => {
35
- const contextProps = useMemo(() => ({
36
- numCols,
37
- numRows,
38
- tableId,
39
- wrap
40
- }), [numCols, numRows, tableId, wrap]);
41
- return /* @__PURE__ */ jsx(GridHooksContext.Provider, {
42
- value: contextProps,
43
- children
35
+ const c = v(() => ({
36
+ numCols: t,
37
+ numRows: n,
38
+ tableId: o,
39
+ wrap: s
40
+ }), [t, n, o, s]);
41
+ return /* @__PURE__ */ r(Xe.Provider, {
42
+ value: c,
43
+ children: e
44
44
  });
45
- };
46
- const hasIndicatorContent = (status) => {
45
+ }, be = (e) => {
47
46
  const {
48
- loading,
49
- creating,
50
- deleting,
51
- updating,
52
- hasError
53
- } = status;
54
- return Boolean(loading || creating || deleting || updating || hasError);
55
- };
56
- const CrudStatusIndicator = ({
57
- crudStatus
47
+ loading: t,
48
+ creating: n,
49
+ deleting: o,
50
+ updating: s,
51
+ hasError: c
52
+ } = e;
53
+ return Boolean(t || n || o || s || c);
54
+ }, Ye = ({
55
+ crudStatus: e
58
56
  }) => {
59
- if (!crudStatus || !hasIndicatorContent(crudStatus)) {
57
+ if (!e || !be(e))
60
58
  return null;
61
- }
62
59
  const {
63
- errorMessage,
64
- hasError,
65
- loading,
66
- creating,
67
- deleting,
68
- updating
69
- } = crudStatus;
70
- if (loading || creating || deleting || updating) {
71
- return /* @__PURE__ */ jsx(InputSpinner, {
72
- color: cssColor("--lhds-color-ui-500")
60
+ errorMessage: t,
61
+ hasError: n,
62
+ loading: o,
63
+ creating: s,
64
+ deleting: c,
65
+ updating: l
66
+ } = e;
67
+ if (o || s || c || l)
68
+ return /* @__PURE__ */ r(ye, {
69
+ color: _("--lhds-color-ui-500")
73
70
  });
74
- }
75
- if (hasError) {
76
- const icon = /* @__PURE__ */ jsx(Icon, {
77
- icon: faExclamationTriangle,
78
- color: cssColor("--lhds-color-orange-600"),
71
+ if (n) {
72
+ const i = /* @__PURE__ */ r(F, {
73
+ icon: ue,
74
+ color: _("--lhds-color-orange-600"),
79
75
  size: 14
80
76
  });
81
- return /* @__PURE__ */ jsx(Fragment, {
82
- children: errorMessage ? /* @__PURE__ */ jsx(Tooltip, {
83
- label: errorMessage,
77
+ return /* @__PURE__ */ r(G, {
78
+ children: t ? /* @__PURE__ */ r(re, {
79
+ label: t,
84
80
  zIndex: 100,
85
- children: icon
86
- }) : icon
81
+ children: i
82
+ }) : i
87
83
  });
88
84
  }
89
85
  return null;
90
- };
91
- const ModifiedField = ({
92
- isEditable,
93
- warningOnEmpty,
94
- value,
95
- modifiedField,
96
- crudStatus
86
+ }, tn = ({
87
+ isEditable: e,
88
+ warningOnEmpty: t,
89
+ value: n,
90
+ modifiedField: o,
91
+ crudStatus: s
97
92
  }) => {
98
- const showEmptyFieldWarning = warningOnEmpty && (modifiedField == null ? void 0 : modifiedField.modified) && (modifiedField == null ? void 0 : modifiedField.newValue) === "";
99
- const hasCrudIndicator = crudStatus && hasIndicatorContent(crudStatus);
100
- const hasRightIcon = showEmptyFieldWarning || hasCrudIndicator;
101
- return /* @__PURE__ */ jsxs(Fragment, {
102
- children: [/* @__PURE__ */ jsx(Text, {
103
- color: isEditable ? "var(--swui-primary-action-color)" : void 0,
104
- variant: (modifiedField == null ? void 0 : modifiedField.modified) ? "bold" : void 0,
105
- children: value
106
- }), (modifiedField == null ? void 0 : modifiedField.newValue) !== void 0 && /* @__PURE__ */ jsxs(Fragment, {
107
- children: [/* @__PURE__ */ jsx(Indent, {
108
- children: /* @__PURE__ */ jsx(Icon, {
109
- icon: stenaArrowRight,
93
+ const c = t && (o == null ? void 0 : o.modified) && (o == null ? void 0 : o.newValue) === "", l = s && be(s), i = c || l;
94
+ return /* @__PURE__ */ g(G, {
95
+ children: [/* @__PURE__ */ r(U, {
96
+ color: e ? "var(--swui-primary-action-color)" : void 0,
97
+ variant: o != null && o.modified ? "bold" : void 0,
98
+ children: n
99
+ }), (o == null ? void 0 : o.newValue) !== void 0 && /* @__PURE__ */ g(G, {
100
+ children: [/* @__PURE__ */ r(N, {
101
+ children: /* @__PURE__ */ r(F, {
102
+ icon: Rt,
110
103
  size: 12
111
104
  })
112
- }), /* @__PURE__ */ jsx(Text, {
105
+ }), /* @__PURE__ */ r(U, {
113
106
  color: "var(--swui-primary-action-color)",
114
107
  variant: "bold",
115
- children: modifiedField.newValue
108
+ children: o.newValue
116
109
  })]
117
- }), hasRightIcon && /* @__PURE__ */ jsx(Space, {}), showEmptyFieldWarning ? /* @__PURE__ */ jsx(Tooltip, {
118
- label: warningOnEmpty,
110
+ }), i && /* @__PURE__ */ r(B, {}), c ? /* @__PURE__ */ r(re, {
111
+ label: t,
119
112
  zIndex: 100,
120
- children: /* @__PURE__ */ jsx(Icon, {
121
- icon: faExclamationTriangle,
122
- color: cssColor("--lhds-color-orange-600"),
113
+ children: /* @__PURE__ */ r(F, {
114
+ icon: ue,
115
+ color: _("--lhds-color-orange-600"),
123
116
  size: 14
124
117
  })
125
- }) : /* @__PURE__ */ jsx(CrudStatusIndicator, {
126
- crudStatus
118
+ }) : /* @__PURE__ */ r(Ye, {
119
+ crudStatus: s
127
120
  })]
128
121
  });
129
- };
130
- const TableCell = ({
131
- alignItems = "center",
132
- justifyContent = "flex-start",
133
- overflow = "hidden",
134
- indent = 1,
135
- ...boxProps
136
- }) => {
137
- return /* @__PURE__ */ jsx(Row, {
138
- height: "100%",
139
- alignItems,
140
- justifyContent,
141
- overflow,
142
- indent,
143
- ...boxProps
144
- });
145
- };
146
- const tableBorderColor = "var(--lhds-color-ui-300)";
147
- const tableBorderColorExpanded = "var(--lhds-color-blue-500)";
148
- const tableBackgroundColorExpanded = "var(--lhds-color-blue-50)";
149
- const tableBackgroundHoverColorExpanded = "var(--lhds-color-blue-100)";
150
- const tableBorder = `1px solid ${tableBorderColor}`;
151
- const tableBorderHidden = `1px solid transparent`;
152
- const tableBorderLeft = `var(--swui-expand-highlight-border-width) solid transparent`;
153
- const tableBorderLeftExpanded = `var(--swui-expand-highlight-border-width) solid ${tableBorderColorExpanded}`;
154
- const defaultTableRowHeight = "40px";
155
- const defaultTableHeadRowHeight = "40px";
156
- const smallTableRowWidth = "40px";
157
- const SmallTableCell = (props) => {
158
- return /* @__PURE__ */ jsx(TableCell, {
159
- width: smallTableRowWidth,
160
- justifyContent: "center",
161
- ...props
162
- });
163
- };
164
- const SortOrderIcon = ({
165
- iconVariant = "amount",
166
- direction
167
- }) => {
168
- return /* @__PURE__ */ jsx(Box, {
169
- width: "14px",
170
- children: /* @__PURE__ */ jsx(Icon, {
171
- size: 14,
172
- color: cssColor("--lhds-color-ui-500"),
173
- icon: getIcon(direction, iconVariant)
174
- })
175
- });
176
- };
177
- const getIcon = (arrow, iconType) => {
178
- switch (iconType) {
122
+ }, nn = ({
123
+ alignItems: e = "center",
124
+ justifyContent: t = "flex-start",
125
+ overflow: n = "hidden",
126
+ indent: o = 1,
127
+ ...s
128
+ }) => /* @__PURE__ */ r(E, {
129
+ height: "100%",
130
+ alignItems: e,
131
+ justifyContent: t,
132
+ overflow: n,
133
+ indent: o,
134
+ ...s
135
+ }), on = "var(--lhds-color-ui-300)", rn = "var(--lhds-color-blue-500)", Qe = "var(--lhds-color-blue-50)", sn = "var(--lhds-color-blue-100)", oe = `1px solid ${on}`, cn = "1px solid transparent", ke = "var(--swui-expand-highlight-border-width) solid transparent", et = `var(--swui-expand-highlight-border-width) solid ${rn}`, Se = "40px", Ie = "40px", tt = "40px", gr = (e) => /* @__PURE__ */ r(nn, {
136
+ width: tt,
137
+ justifyContent: "center",
138
+ ...e
139
+ }), Ke = ({
140
+ iconVariant: e = "amount",
141
+ direction: t
142
+ }) => /* @__PURE__ */ r(ne, {
143
+ width: "14px",
144
+ children: /* @__PURE__ */ r(F, {
145
+ size: 14,
146
+ color: _("--lhds-color-ui-500"),
147
+ icon: ln(t, e)
148
+ })
149
+ }), ln = (e, t) => {
150
+ switch (t) {
179
151
  case "alpha":
180
- return arrow === "up" ? faSortAlphaUp : faSortAlphaDown;
152
+ return e === "up" ? Nt : Dt;
181
153
  case "numeric":
182
- return arrow === "up" ? faSortNumericUp : faSortNumericDown;
154
+ return e === "up" ? $t : Ht;
183
155
  case "amount":
184
- return arrow === "up" ? faSortAmountUpAlt : faSortAmountDownAlt;
156
+ return e === "up" ? Kt : zt;
185
157
  default:
186
- return exhaustSwitchCaseElseThrow(iconType);
187
- }
188
- };
189
- const TableHeadItem = React.memo(({
190
- label,
191
- arrow,
192
- onClick,
193
- children,
194
- selected,
195
- popoverContent,
196
- loading,
197
- infoIconTooltipText,
198
- overflow = "hidden",
199
- alignRight,
200
- sortOrderIconVariant,
201
- ...boxProps
158
+ return Pt(t);
159
+ }
160
+ }, Ee = T.memo(({
161
+ label: e,
162
+ arrow: t,
163
+ onClick: n,
164
+ children: o,
165
+ selected: s,
166
+ popoverContent: c,
167
+ loading: l,
168
+ infoIconTooltipText: i,
169
+ overflow: d = "hidden",
170
+ alignRight: u,
171
+ sortOrderIconVariant: a,
172
+ ...h
202
173
  }) => {
203
- const containerRef = useRef(null);
204
- const cursorStyle = onClick ? {
205
- cursor: "pointer",
206
- userSelect: "none"
207
- } : void 0;
208
- const hasOnlyChildren = !label && !arrow && !infoIconTooltipText;
209
- return /* @__PURE__ */ jsxs(Row, {
174
+ const m = te(null);
175
+ return /* @__PURE__ */ g(E, {
210
176
  height: "100%",
211
177
  alignItems: "center",
212
- ref: containerRef,
213
- overflow,
214
- justifyContent: alignRight ? "flex-end" : "flex-start",
215
- ...boxProps,
216
- children: [/* @__PURE__ */ jsxs(Row, {
178
+ ref: m,
179
+ overflow: d,
180
+ justifyContent: u ? "flex-end" : "flex-start",
181
+ ...h,
182
+ children: [/* @__PURE__ */ g(E, {
217
183
  alignItems: "center",
218
- indent: true,
219
- children: [!arrow && alignRight && /* @__PURE__ */ jsxs(Fragment, {
220
- children: [/* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(Box, {
184
+ indent: !0,
185
+ children: [!t && u && /* @__PURE__ */ g(G, {
186
+ children: [/* @__PURE__ */ r(B, {}), /* @__PURE__ */ r(ne, {
221
187
  width: "14px"
222
- }), /* @__PURE__ */ jsx(Space, {
188
+ }), /* @__PURE__ */ r(B, {
223
189
  num: 0.5
224
190
  })]
225
- }), (children || label) && /* @__PURE__ */ jsxs(Row, {
226
- onClick,
227
- style: cursorStyle,
191
+ }), (o || e) && /* @__PURE__ */ g(E, {
192
+ onClick: n,
193
+ style: n ? {
194
+ cursor: "pointer",
195
+ userSelect: "none"
196
+ } : void 0,
228
197
  alignItems: "center",
229
- children: [children && /* @__PURE__ */ jsxs(Fragment, {
230
- children: [children, !hasOnlyChildren && /* @__PURE__ */ jsx(Space, {
198
+ children: [o && /* @__PURE__ */ g(G, {
199
+ children: [o, !(!e && !t && !i) && /* @__PURE__ */ r(B, {
231
200
  num: 0.5
232
201
  })]
233
- }), arrow && alignRight && /* @__PURE__ */ jsxs(Fragment, {
234
- children: [/* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(SortOrderIcon, {
235
- direction: arrow,
236
- iconVariant: sortOrderIconVariant
237
- }), /* @__PURE__ */ jsx(Space, {
202
+ }), t && u && /* @__PURE__ */ g(G, {
203
+ children: [/* @__PURE__ */ r(B, {}), /* @__PURE__ */ r(Ke, {
204
+ direction: t,
205
+ iconVariant: a
206
+ }), /* @__PURE__ */ r(B, {
238
207
  num: 0.5
239
208
  })]
240
- }), label && /* @__PURE__ */ jsx(Heading, {
209
+ }), e && /* @__PURE__ */ r(We, {
241
210
  variant: "h6",
242
- children: label
243
- }), arrow && !alignRight && /* @__PURE__ */ jsxs(Fragment, {
244
- children: [/* @__PURE__ */ jsx(Space, {
211
+ style: {
212
+ textAlign: "left"
213
+ },
214
+ children: e
215
+ }), t && !u && /* @__PURE__ */ g(G, {
216
+ children: [/* @__PURE__ */ r(B, {
245
217
  num: 0.5
246
- }), /* @__PURE__ */ jsx(SortOrderIcon, {
247
- direction: arrow,
248
- iconVariant: sortOrderIconVariant
249
- }), /* @__PURE__ */ jsx(Space, {})]
218
+ }), /* @__PURE__ */ r(Ke, {
219
+ direction: t,
220
+ iconVariant: a
221
+ }), /* @__PURE__ */ r(B, {})]
250
222
  })]
251
- }), infoIconTooltipText && /* @__PURE__ */ jsxs(Fragment, {
252
- children: [/* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsxs(Row, {
253
- onClick: (ev) => ev.stopPropagation(),
254
- children: [/* @__PURE__ */ jsx(Tooltip, {
255
- label: infoIconTooltipText,
223
+ }), i && /* @__PURE__ */ g(G, {
224
+ children: [/* @__PURE__ */ r(B, {}), /* @__PURE__ */ g(E, {
225
+ onClick: (p) => p.stopPropagation(),
226
+ children: [/* @__PURE__ */ r(re, {
227
+ label: i,
256
228
  zIndex: "var(--swui-sticky-popover-z-index)",
257
- children: /* @__PURE__ */ jsx(Icon, {
258
- icon: stenaInfoCircle,
229
+ children: /* @__PURE__ */ r(F, {
230
+ icon: Gt,
259
231
  size: 14,
260
- color: cssColor("--lhds-color-blue-400")
232
+ color: _("--lhds-color-blue-400")
261
233
  })
262
- }), /* @__PURE__ */ jsx(Space, {})]
234
+ }), /* @__PURE__ */ r(B, {})]
263
235
  })]
264
236
  })]
265
- }), /* @__PURE__ */ jsx(Row, {
266
- children: loading ? /* @__PURE__ */ jsx(InputSpinner, {}) : popoverContent ? /* @__PURE__ */ jsx(Popover, {
267
- content: popoverContent,
237
+ }), /* @__PURE__ */ r(E, {
238
+ children: l ? /* @__PURE__ */ r(ye, {}) : c ? /* @__PURE__ */ r(Ot, {
239
+ content: c,
268
240
  trigger: "click",
269
241
  zIndex: 1e3,
270
- disablePadding: true,
242
+ disablePadding: !0,
271
243
  variant: "outlined",
272
- arrow: false,
273
- children: /* @__PURE__ */ jsx(FlatButton, {
274
- leftIcon: faEllipsisV,
244
+ arrow: !1,
245
+ children: /* @__PURE__ */ r(xe, {
246
+ leftIcon: Bt,
275
247
  size: "small"
276
248
  })
277
249
  }) : null
278
- }), !arrow && !alignRight && /* @__PURE__ */ jsxs(Fragment, {
279
- children: [/* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(Box, {
250
+ }), !t && !u && /* @__PURE__ */ g(G, {
251
+ children: [/* @__PURE__ */ r(B, {}), /* @__PURE__ */ r(ne, {
280
252
  width: "14px"
281
- }), /* @__PURE__ */ jsx(Space, {
253
+ }), /* @__PURE__ */ r(B, {
282
254
  num: 0.5
283
255
  })]
284
256
  })]
285
257
  });
286
- });
287
- const SmallTableHead = (props) => {
288
- return /* @__PURE__ */ jsx(TableHeadItem, {
289
- width: smallTableRowWidth,
290
- justifyContent: "center",
291
- ...props
292
- });
293
- };
294
- const TableColumnGroupHead = ({
295
- label,
296
- flex,
297
- width,
298
- indent = 1,
299
- height = defaultTableHeadRowHeight
300
- }) => {
301
- return /* @__PURE__ */ jsx(TableHeadItem, {
302
- width,
303
- flex,
304
- height,
305
- children: /* @__PURE__ */ jsx(Box, {
306
- indent,
307
- spacing: true,
308
- children: /* @__PURE__ */ jsx(Text, {
309
- variant: "bold",
310
- children: label
311
- })
258
+ }), br = (e) => /* @__PURE__ */ r(Ee, {
259
+ width: tt,
260
+ justifyContent: "center",
261
+ ...e
262
+ }), kr = ({
263
+ label: e,
264
+ flex: t,
265
+ width: n,
266
+ indent: o = 1,
267
+ height: s = Ie
268
+ }) => /* @__PURE__ */ r(Ee, {
269
+ width: n,
270
+ flex: t,
271
+ height: s,
272
+ children: /* @__PURE__ */ r(ne, {
273
+ indent: o,
274
+ spacing: !0,
275
+ children: /* @__PURE__ */ r(U, {
276
+ variant: "bold",
277
+ children: e
312
278
  })
313
- });
314
- };
315
- const TableHeadRow = React.memo(({
316
- style,
317
- height = defaultTableHeadRowHeight,
318
- ...boxProps
319
- }) => {
320
- return /* @__PURE__ */ jsx(Row, {
321
- style,
322
- height,
323
- ...boxProps
324
- });
325
- });
326
- const tableRow = "_tableRow_1cphw_1";
327
- var styles$4 = {
328
- tableRow
329
- };
330
- const TableRow = ({
331
- hideBorderTop,
332
- height = defaultTableHeadRowHeight,
333
- className,
334
- ...boxProps
335
- }) => {
336
- return /* @__PURE__ */ jsx(Row, {
337
- borderTop: hideBorderTop ? tableBorderHidden : tableBorder,
338
- height,
339
- className: cx(styles$4.tableRow, className),
340
- ...boxProps
341
- });
342
- };
343
- const useRevertableValue = (initialValue) => {
344
- const [value, setValueInternal] = useState(initialValue);
345
- const revertValue = useRef(initialValue);
346
- const valueRef = useRef(initialValue);
347
- const setValue = useCallback((value2) => {
348
- setValueInternal(value2);
349
- valueRef.current = value2;
350
- }, [setValueInternal, valueRef]);
351
- useEffect(() => {
352
- setValue(initialValue);
353
- }, [setValue, initialValue]);
354
- const revert = useCallback(() => {
355
- if (revertValue) {
356
- setValue(revertValue.current);
357
- }
358
- }, [setValue, revertValue]);
359
- const commit = useCallback((commitValue) => {
360
- revertValue.current = value;
361
- if (commitValue) {
362
- setValue(commitValue);
363
- }
364
- }, [value, setValue]);
365
- const setRevertValue = useCallback((value2) => revertValue.current = value2, [revertValue]);
366
- const getValue = useCallback(() => valueRef.current, [valueRef]);
279
+ })
280
+ }), Sr = T.memo(({
281
+ style: e,
282
+ height: t = Ie,
283
+ ...n
284
+ }) => /* @__PURE__ */ r(E, {
285
+ style: e,
286
+ height: t,
287
+ ...n
288
+ })), an = "_tableRow_1cphw_1", dn = {
289
+ tableRow: an
290
+ }, Ir = ({
291
+ hideBorderTop: e,
292
+ height: t = Ie,
293
+ className: n,
294
+ ...o
295
+ }) => /* @__PURE__ */ r(E, {
296
+ borderTop: e ? cn : oe,
297
+ height: t,
298
+ className: Fe(dn.tableRow, n),
299
+ ...o
300
+ }), un = (e) => {
301
+ const [t, n] = ve(e), o = te(e), s = te(e), c = I(
302
+ (a) => {
303
+ n(a), s.current = a;
304
+ },
305
+ [n, s]
306
+ );
307
+ je(() => {
308
+ c(e);
309
+ }, [c, e]);
310
+ const l = I(() => {
311
+ o && c(o.current);
312
+ }, [c, o]), i = I(
313
+ (a) => {
314
+ o.current = t, a && c(a);
315
+ },
316
+ [t, c]
317
+ ), d = I(
318
+ (a) => o.current = a,
319
+ [o]
320
+ ), u = I(() => s.current, [s]);
367
321
  return {
368
- value,
369
- setValue,
370
- setRevertValue,
371
- revert,
372
- commit,
373
- getValue
322
+ value: t,
323
+ setValue: c,
324
+ setRevertValue: d,
325
+ revert: l,
326
+ commit: i,
327
+ getValue: u
374
328
  };
375
- };
376
- const createKeyDownEvent = (event) => ({
377
- altKey: event.altKey,
378
- charCode: event.charCode,
379
- ctrlKey: event.ctrlKey,
380
- key: event.key,
381
- keyCode: event.keyCode,
382
- locale: event.locale,
383
- location: event.location,
384
- metaKey: event.metaKey,
385
- repeat: event.repeat,
386
- shiftKey: event.shiftKey,
387
- which: event.which
388
- });
389
- const defaultTransformEnteredValue = (value) => value;
390
- const useEditableCell = (value, {
391
- isEditable = false,
392
- allowedInputType = "all",
393
- onChange,
394
- onStartEditing,
395
- onStopEditing,
396
- transformEnteredValue = defaultTransformEnteredValue
329
+ }, hn = (e) => ({
330
+ altKey: e.altKey,
331
+ charCode: e.charCode,
332
+ ctrlKey: e.ctrlKey,
333
+ key: e.key,
334
+ keyCode: e.keyCode,
335
+ locale: e.locale,
336
+ location: e.location,
337
+ metaKey: e.metaKey,
338
+ repeat: e.repeat,
339
+ shiftKey: e.shiftKey,
340
+ which: e.which
341
+ }), pn = (e) => e, mn = (e, {
342
+ isEditable: t = !1,
343
+ allowedInputType: n = "all",
344
+ onChange: o,
345
+ onStartEditing: s,
346
+ onStopEditing: c,
347
+ transformEnteredValue: l = pn
397
348
  }) => {
398
- const [isEditing, setIsEditing] = useState(false);
399
- const [lastKeyEvent, setLastKeyEvent] = useState(void 0);
400
- const revertableValue = useRevertableValue(value);
401
- const { getValue, revert, setValue, setRevertValue } = revertableValue;
402
- const startEditing = useCallback((keyEvent) => {
403
- if (isEditable) {
404
- setValue(value);
405
- setRevertValue(value);
406
- setIsEditing(true);
407
- if (onStartEditing) {
408
- onStartEditing(keyEvent);
409
- }
410
- }
411
- }, [isEditable, onStartEditing, setRevertValue, setValue, value]);
412
- const stopEditing = useCallback(() => {
413
- if (isEditable) {
414
- setIsEditing(false);
415
- if (onStopEditing) {
416
- onStopEditing();
417
- }
418
- if (onChange) {
419
- onChange(getValue());
420
- }
421
- }
422
- }, [isEditable, onChange, onStopEditing, getValue, setIsEditing]);
423
- const stopEditingAndRevert = useCallback(() => {
424
- if (isEditable) {
425
- setIsEditing(false);
426
- if (onStopEditing) {
427
- onStopEditing();
428
- }
429
- revert();
430
- }
431
- }, [isEditable, onStopEditing, revert, setIsEditing]);
432
- const onKeyDown = useMemo(() => createKeyDownHandler$1(isEditing, isEditable, startEditing, setLastKeyEvent, allowedInputType, transformEnteredValue, revertableValue), [
433
- isEditing,
434
- isEditable,
435
- startEditing,
436
- setLastKeyEvent,
437
- allowedInputType,
438
- transformEnteredValue,
439
- revertableValue
440
- ]);
349
+ const [i, d] = ve(!1), [u, a] = ve(
350
+ void 0
351
+ ), h = un(e), { getValue: m, revert: f, setValue: w, setRevertValue: p } = h, C = I(
352
+ (y) => {
353
+ t && (w(e), p(e), d(!0), s && s(y));
354
+ },
355
+ [t, s, p, w, e]
356
+ ), x = I(() => {
357
+ t && (d(!1), c && c(), o && o(m()));
358
+ }, [t, o, c, m, d]), b = I(() => {
359
+ t && (d(!1), c && c(), f());
360
+ }, [t, c, f, d]);
441
361
  return {
442
- onKeyDown,
443
- isEditing,
444
- lastKeyEvent,
445
- revertableValue,
446
- startEditing,
447
- stopEditing,
448
- stopEditingAndRevert,
449
- onDoubleClick: startEditing
362
+ onKeyDown: v(
363
+ () => xn(
364
+ i,
365
+ t,
366
+ C,
367
+ a,
368
+ n,
369
+ l,
370
+ h
371
+ ),
372
+ [
373
+ i,
374
+ t,
375
+ C,
376
+ a,
377
+ n,
378
+ l,
379
+ h
380
+ ]
381
+ ),
382
+ isEditing: i,
383
+ lastKeyEvent: u,
384
+ revertableValue: h,
385
+ startEditing: C,
386
+ stopEditing: x,
387
+ stopEditingAndRevert: b,
388
+ onDoubleClick: C
450
389
  };
451
- };
452
- const allowsNumerics = (allowedInputType) => allowedInputType === "all" || allowedInputType === "numeric" || allowedInputType === "alphanumeric";
453
- const allowsLetters = (allowedInputType) => allowedInputType === "all" || allowedInputType === "alphanumeric" || allowedInputType === "letters";
454
- const isCharacter = (key) => !!key.match(/^[-+*<>]$/);
455
- const isLetter = (key) => !!key.match(/^[a-zA-Z0-9]$/);
456
- const isNumeric = (key) => !isNaN(parseInt(key, 10));
457
- const createKeyDownHandler$1 = (_, isEditable, startEditing, setLastKeyEvent, allowedInputType, transformEnteredValue, revertableValue) => (e) => {
458
- if (e.ctrlKey || e.metaKey || e.shiftKey) {
459
- return;
460
- }
461
- if (e.key === "Enter" && isEditable) {
462
- setLastKeyEvent(void 0);
463
- startEditing();
464
- revertableValue.commit();
465
- e.preventDefault();
466
- e.stopPropagation();
467
- } else if (isEditable) {
468
- const lastKeyEvent = createKeyDownEvent(e);
469
- if (isNumeric(e.key) && allowsNumerics(allowedInputType) || isLetter(e.key) && allowsLetters(allowedInputType) || isCharacter(e.key)) {
470
- startEditing(lastKeyEvent);
471
- setLastKeyEvent(lastKeyEvent);
472
- revertableValue.commit();
473
- revertableValue.setValue(transformEnteredValue(lastKeyEvent.key));
474
- e.preventDefault();
475
- e.stopPropagation();
390
+ }, fn = (e) => e === "all" || e === "numeric" || e === "alphanumeric", wn = (e) => e === "all" || e === "alphanumeric" || e === "letters", Cn = (e) => !!e.match(/^[-+*<>]$/), vn = (e) => !!e.match(/^[a-zA-Z0-9]$/), yn = (e) => !isNaN(parseInt(e, 10)), xn = (e, t, n, o, s, c, l) => (i) => {
391
+ if (!(i.ctrlKey || i.metaKey || i.shiftKey)) {
392
+ if (i.key === "Enter" && t)
393
+ o(void 0), n(), l.commit(), i.preventDefault(), i.stopPropagation();
394
+ else if (t) {
395
+ const d = hn(i);
396
+ (yn(i.key) && fn(s) || vn(i.key) && wn(s) || Cn(i.key)) && (n(d), o(d), l.commit(), l.setValue(c(d.key)), i.preventDefault(), i.stopPropagation());
476
397
  }
477
398
  }
478
- };
479
- const wrapBounds = (x, y, maxX, maxY) => {
480
- let realX = x;
481
- let realY = y;
482
- if (y > maxY) {
483
- realY = 0;
484
- }
485
- if (y < 0) {
486
- realY = maxY;
487
- }
488
- if (x > maxX) {
489
- realX = 0;
490
- }
491
- if (x < 0) {
492
- realX = maxX;
493
- }
494
- return {
495
- realX,
496
- realY
497
- };
498
- };
499
- const limitRange = (val, min, max) => {
500
- return Math.max(Math.min(val, max), min);
501
- };
502
- const clampPos = (pos, numRows, numCols) => {
503
- return {
504
- rowIndex: limitRange(pos.rowIndex, 0, numRows),
505
- colIndex: limitRange(pos.colIndex, 0, numCols)
506
- };
507
- };
508
- const wrapPos = (pos, numRows, numCols) => {
509
- const wrapped = wrapBounds(pos.colIndex, pos.rowIndex, numCols, numRows);
510
- return {
511
- rowIndex: wrapped.realY,
512
- colIndex: wrapped.realX
399
+ }, gn = (e, t, n, o) => {
400
+ let s = e, c = t;
401
+ return t > o && (c = 0), t < 0 && (c = o), e > n && (s = 0), e < 0 && (s = n), {
402
+ realX: s,
403
+ realY: c
513
404
  };
514
- };
515
- const getNextPositionWrappedOrClamped = (rowIndex, colIndex, numRows, numCols, direction, edgeMode = "clamped") => {
516
- const posNotWrapped = getNextPosition(rowIndex, colIndex, direction);
517
- if (edgeMode === "clamped") {
518
- return clampPos(posNotWrapped, numRows - 1, numCols - 1);
519
- }
520
- if (edgeMode === "wrapped") {
521
- return wrapPos(posNotWrapped, numRows - 1, numCols - 1);
522
- }
523
- return posNotWrapped;
524
- };
525
- const getNextPosition = (rowIndex, colIndex, direction) => {
526
- if (direction === "up") {
527
- return {
528
- rowIndex: rowIndex - 1,
529
- colIndex
530
- };
531
- }
532
- if (direction === "down") {
533
- return {
534
- rowIndex: rowIndex + 1,
535
- colIndex
536
- };
537
- }
538
- if (direction === "left") {
539
- return {
540
- rowIndex,
541
- colIndex: colIndex - 1
542
- };
543
- }
544
- if (direction === "right") {
545
- return {
546
- rowIndex,
547
- colIndex: colIndex + 1
548
- };
549
- }
405
+ }, He = (e, t, n) => Math.max(Math.min(e, n), t), bn = (e, t, n) => ({
406
+ rowIndex: He(e.rowIndex, 0, t),
407
+ colIndex: He(e.colIndex, 0, n)
408
+ }), kn = (e, t, n) => {
409
+ const o = gn(e.colIndex, e.rowIndex, n, t);
550
410
  return {
551
- rowIndex,
552
- colIndex
411
+ rowIndex: o.realY,
412
+ colIndex: o.realX
553
413
  };
554
- };
555
- const ensureDomIdIsCorrect = (id) => {
556
- return id.replace(/^[^a-z]+|[^\w:.-]+/gi, "");
557
- };
558
- const validateGridHookOptions = (options) => {
559
- if (!options.tableId) {
414
+ }, Sn = (e, t, n, o, s, c = "clamped") => {
415
+ const l = In(e, t, s);
416
+ return c === "clamped" ? bn(l, n - 1, o - 1) : c === "wrapped" ? kn(l, n - 1, o - 1) : l;
417
+ }, In = (e, t, n) => n === "up" ? {
418
+ rowIndex: e - 1,
419
+ colIndex: t
420
+ } : n === "down" ? {
421
+ rowIndex: e + 1,
422
+ colIndex: t
423
+ } : n === "left" ? {
424
+ rowIndex: e,
425
+ colIndex: t - 1
426
+ } : n === "right" ? {
427
+ rowIndex: e,
428
+ colIndex: t + 1
429
+ } : {
430
+ rowIndex: e,
431
+ colIndex: t
432
+ }, En = (e) => e.replace(/^[^a-z]+|[^\w:.-]+/gi, ""), Rn = (e) => {
433
+ if (!e.tableId)
560
434
  throw new Error("tableId is required.");
561
- }
562
- if (options.numRows == null) {
435
+ if (e.numRows == null)
563
436
  throw new Error("numRows is required.");
564
- }
565
- if (options.numCols == null) {
437
+ if (e.numCols == null)
566
438
  throw new Error("numCols is required.");
567
- }
568
- return options;
569
- };
570
- const useGridNavigationOptionsFromContext = (options) => {
571
- const context = useContext(GridHooksContext);
572
- return useMemo(() => validateGridHookOptions({
573
- ...context,
574
- ...options
575
- }), [context, options]);
576
- };
577
- const useGridNavigation = (options) => {
439
+ return e;
440
+ }, nt = (e) => {
441
+ const t = V(Xe);
442
+ return v(
443
+ () => Rn({
444
+ ...t,
445
+ ...e
446
+ }),
447
+ [t, e]
448
+ );
449
+ }, Gn = (e) => {
578
450
  const {
579
- rowIndex,
580
- colIndex,
581
- numRows,
582
- numCols,
583
- tableId,
584
- edgeMode,
585
- onCellMove,
586
- onCellNavigation
587
- } = useGridNavigationOptionsFromContext(options);
588
- const moveHandler = useMemo(() => createMoveHandler(tableId, rowIndex, colIndex, numRows, numCols, edgeMode, onCellMove, onCellNavigation), [
589
- tableId,
590
- rowIndex,
591
- colIndex,
592
- numRows,
593
- numCols,
594
- edgeMode,
595
- onCellMove,
596
- onCellNavigation
597
- ]);
598
- const onKeyDown = useMemo(() => createKeyDownHandler(moveHandler), [moveHandler]);
599
- const id = useMemo(() => createCellId(tableId, rowIndex, colIndex), [tableId, rowIndex, colIndex]);
600
- const requiredProps = useMemo(() => ({
601
- tabIndex: 0,
602
- onKeyDown,
603
- id
604
- }), [onKeyDown, id]);
451
+ rowIndex: t,
452
+ colIndex: n,
453
+ numRows: o,
454
+ numCols: s,
455
+ tableId: c,
456
+ edgeMode: l,
457
+ onCellMove: i,
458
+ onCellNavigation: d
459
+ } = nt(e), u = v(
460
+ () => Tn(
461
+ c,
462
+ t,
463
+ n,
464
+ o,
465
+ s,
466
+ l,
467
+ i,
468
+ d
469
+ ),
470
+ [
471
+ c,
472
+ t,
473
+ n,
474
+ o,
475
+ s,
476
+ l,
477
+ i,
478
+ d
479
+ ]
480
+ ), a = v(
481
+ () => On(u),
482
+ [u]
483
+ ), h = v(
484
+ () => ot(c, t, n),
485
+ [c, t, n]
486
+ ), m = v(
487
+ () => ({
488
+ tabIndex: 0,
489
+ onKeyDown: a,
490
+ id: h
491
+ }),
492
+ [a, h]
493
+ );
605
494
  return {
606
- focusOnCell,
607
- moveHandler,
608
- requiredProps
495
+ focusOnCell: rt,
496
+ moveHandler: u,
497
+ requiredProps: m
609
498
  };
610
- };
611
- const createMoveHandler = (tableId, rowIndex, colIndex, numRows, numCols, edgeMode, onCellMove, onCellNavigation) => (direction) => {
612
- const pos = getNextPositionWrappedOrClamped(rowIndex, colIndex, numRows, numCols, direction, edgeMode);
613
- const colDidChange = colIndex !== pos.colIndex;
614
- const rowDidChange = rowIndex !== pos.rowIndex;
615
- if (colDidChange || rowDidChange) {
616
- if (onCellMove) {
617
- onCellMove({
618
- direction,
619
- fromRowIndex: rowIndex,
620
- fromColIndex: colIndex,
621
- rowIndex: pos.rowIndex,
622
- colIndex: pos.colIndex,
623
- colDidChange,
624
- rowDidChange
625
- });
626
- }
627
- focusOnCell(tableId, pos);
628
- }
629
- if (onCellNavigation) {
630
- onCellNavigation({
631
- direction,
632
- fromRowIndex: rowIndex,
633
- fromColIndex: colIndex,
634
- rowIndex: pos.rowIndex,
635
- colIndex: pos.colIndex,
636
- colDidChange,
637
- rowDidChange,
638
- cellDidChange: colDidChange || rowDidChange
639
- });
640
- }
641
- };
642
- const createCellId = (tableId, rowIndex, colIndex) => ensureDomIdIsCorrect(`table-${tableId}-${rowIndex}-${colIndex}`);
643
- const createKeyDownHandler = (moveHandler) => (e) => {
644
- if (e.key === "ArrowLeft") {
645
- moveHandler("left");
646
- e.preventDefault();
647
- e.stopPropagation();
648
- return true;
649
- } else if (e.key === "ArrowUp") {
650
- moveHandler("up");
651
- e.preventDefault();
652
- e.stopPropagation();
653
- return true;
654
- } else if (e.key === "ArrowRight") {
655
- moveHandler("right");
656
- e.preventDefault();
657
- e.stopPropagation();
658
- return true;
659
- } else if (e.key === "ArrowDown") {
660
- moveHandler("down");
661
- e.preventDefault();
662
- e.stopPropagation();
663
- return true;
664
- } else {
665
- return false;
666
- }
667
- };
668
- const focusOnCell = (tableId, pos) => {
669
- const el = document.getElementById(createCellId(tableId, pos.rowIndex, pos.colIndex));
670
- if (el) {
671
- el.focus();
672
- }
673
- };
674
- const useGridCell = (value, options) => {
675
- const { tableId } = useGridNavigationOptionsFromContext(options);
676
- const nav = useGridNavigation(options);
677
- const edit = useEditableCell(value, options);
678
- const cellCoordinates = useMemo(() => ({
679
- rowIndex: options.rowIndex,
680
- colIndex: options.colIndex
681
- }), [options.rowIndex, options.colIndex]);
682
- const startEditing = useCallback(() => {
683
- edit.startEditing();
684
- nav.focusOnCell(tableId, cellCoordinates);
685
- }, [edit, nav, tableId, cellCoordinates]);
686
- const stopEditing = useCallback(() => {
687
- edit.stopEditing();
688
- nav.focusOnCell(tableId, cellCoordinates);
689
- }, [edit, nav, tableId, cellCoordinates]);
690
- const stopEditingAndRevert = useCallback(() => {
691
- edit.stopEditingAndRevert();
692
- nav.focusOnCell(tableId, cellCoordinates);
693
- }, [edit, nav, tableId, cellCoordinates]);
694
- const stopEditingAndMove = useCallback((direction) => {
695
- edit.stopEditing();
696
- nav.moveHandler(direction);
697
- }, [edit, nav]);
698
- const move = useCallback((direction) => {
699
- nav.moveHandler(direction);
700
- }, [nav]);
701
- const onKeyDown = useCallback((e) => {
702
- if (!edit.isEditing) {
703
- const consumed = nav.requiredProps.onKeyDown(e);
704
- if (!consumed) {
705
- edit.onKeyDown(e);
706
- }
707
- }
708
- }, [edit, nav.requiredProps]);
709
- const requiredProps = useMemo(() => ({
710
- ...nav.requiredProps,
711
- onKeyDown,
712
- onDoubleClick: edit.onDoubleClick
713
- }), [onKeyDown, edit.onDoubleClick, nav.requiredProps]);
499
+ }, Tn = (e, t, n, o, s, c, l, i) => (d) => {
500
+ const u = Sn(
501
+ t,
502
+ n,
503
+ o,
504
+ s,
505
+ d,
506
+ c
507
+ ), a = n !== u.colIndex, h = t !== u.rowIndex;
508
+ (a || h) && (l && l({
509
+ direction: d,
510
+ fromRowIndex: t,
511
+ fromColIndex: n,
512
+ rowIndex: u.rowIndex,
513
+ colIndex: u.colIndex,
514
+ colDidChange: a,
515
+ rowDidChange: h
516
+ }), rt(e, u)), i && i({
517
+ direction: d,
518
+ fromRowIndex: t,
519
+ fromColIndex: n,
520
+ rowIndex: u.rowIndex,
521
+ colIndex: u.colIndex,
522
+ colDidChange: a,
523
+ rowDidChange: h,
524
+ cellDidChange: a || h
525
+ });
526
+ }, ot = (e, t, n) => En(`table-${e}-${t}-${n}`), On = (e) => (t) => t.key === "ArrowLeft" ? (e("left"), t.preventDefault(), t.stopPropagation(), !0) : t.key === "ArrowUp" ? (e("up"), t.preventDefault(), t.stopPropagation(), !0) : t.key === "ArrowRight" ? (e("right"), t.preventDefault(), t.stopPropagation(), !0) : t.key === "ArrowDown" ? (e("down"), t.preventDefault(), t.stopPropagation(), !0) : !1, rt = (e, t) => {
527
+ const n = document.getElementById(
528
+ ot(e, t.rowIndex, t.colIndex)
529
+ );
530
+ n && n.focus();
531
+ }, he = (e, t) => {
532
+ const { tableId: n } = nt(t), o = Gn(t), s = mn(e, t), c = v(
533
+ () => ({
534
+ rowIndex: t.rowIndex,
535
+ colIndex: t.colIndex
536
+ }),
537
+ [t.rowIndex, t.colIndex]
538
+ ), l = I(() => {
539
+ s.startEditing(), o.focusOnCell(n, c);
540
+ }, [s, o, n, c]), i = I(() => {
541
+ s.stopEditing(), o.focusOnCell(n, c);
542
+ }, [s, o, n, c]), d = I(() => {
543
+ s.stopEditingAndRevert(), o.focusOnCell(n, c);
544
+ }, [s, o, n, c]), u = I(
545
+ (f) => {
546
+ s.stopEditing(), o.moveHandler(f);
547
+ },
548
+ [s, o]
549
+ ), a = I(
550
+ (f) => {
551
+ o.moveHandler(f);
552
+ },
553
+ [o]
554
+ ), h = I(
555
+ (f) => {
556
+ s.isEditing || o.requiredProps.onKeyDown(f) || s.onKeyDown(f);
557
+ },
558
+ [s, o.requiredProps]
559
+ ), m = v(
560
+ () => ({
561
+ ...o.requiredProps,
562
+ onKeyDown: h,
563
+ onDoubleClick: s.onDoubleClick
564
+ }),
565
+ [h, s.onDoubleClick, o.requiredProps]
566
+ );
714
567
  return {
715
- isEditing: edit.isEditing,
716
- lastKeyEvent: edit.lastKeyEvent,
717
- editorValue: edit.revertableValue.value,
718
- setEditorValue: edit.revertableValue.setValue,
719
- revertEditorValue: edit.revertableValue.revert,
720
- requiredProps,
721
- move,
722
- startEditing,
723
- stopEditing,
724
- stopEditingAndRevert,
725
- stopEditingAndMove
568
+ isEditing: s.isEditing,
569
+ lastKeyEvent: s.lastKeyEvent,
570
+ editorValue: s.revertableValue.value,
571
+ setEditorValue: s.revertableValue.setValue,
572
+ revertEditorValue: s.revertableValue.revert,
573
+ requiredProps: m,
574
+ move: a,
575
+ startEditing: l,
576
+ stopEditing: i,
577
+ stopEditingAndRevert: d,
578
+ stopEditingAndMove: u
726
579
  };
727
- };
728
- const EditableTextCellWithCrudAndModified = function EditableTextCellWithCrudAndModified2({
729
- allowedInputType,
730
- value = "",
731
- entityId,
732
- isEditable,
733
- rowIndent,
734
- crudStatusRedux,
735
- modifiedFieldsRedux,
736
- colIndex,
737
- rowIndex,
738
- numCols,
739
- numRows,
740
- warningOnEmpty
580
+ }, Er = function({
581
+ allowedInputType: t,
582
+ value: n = "",
583
+ entityId: o,
584
+ isEditable: s,
585
+ rowIndent: c,
586
+ crudStatusRedux: l,
587
+ modifiedFieldsRedux: i,
588
+ colIndex: d,
589
+ rowIndex: u,
590
+ numCols: a,
591
+ numRows: h,
592
+ warningOnEmpty: m
741
593
  }) {
742
- const dispatch = useDispatch();
743
- const modifiedFieldsState = useSelector(modifiedFieldsRedux.selectors.getState);
744
- const crudStatusState = useSelector(crudStatusRedux.selectors.getState);
745
- const modifiedField = modifiedFieldsState.entities[entityId];
746
- const crudStatus = crudStatusState.entities[entityId];
747
- const onChangeHandler = useCallback((newValue = "") => {
748
- if (newValue === value) {
749
- dispatch(modifiedFieldsRedux.actions.clearEntity(entityId));
750
- } else {
751
- dispatch(modifiedFieldsRedux.actions.setEntity({
752
- id: entityId,
753
- originalValue: value,
754
- newValue,
755
- modified: true
756
- }));
757
- }
758
- }, [dispatch, entityId, modifiedFieldsRedux.actions, value]);
759
- const {
760
- isEditing,
761
- stopEditing,
762
- editorValue,
763
- setEditorValue,
764
- stopEditingAndRevert,
765
- stopEditingAndMove,
766
- lastKeyEvent,
594
+ const f = Vt(), w = Be(i.selectors.getState), p = Be(l.selectors.getState), C = w.entities[o], x = p.entities[o], b = I((H = "") => {
595
+ f(H === n ? i.actions.clearEntity(o) : i.actions.setEntity({
596
+ id: o,
597
+ originalValue: n,
598
+ newValue: H,
599
+ modified: !0
600
+ }));
601
+ }, [f, o, i.actions, n]), {
602
+ isEditing: S,
603
+ stopEditing: y,
604
+ editorValue: A,
605
+ setEditorValue: k,
606
+ stopEditingAndRevert: L,
607
+ stopEditingAndMove: O,
608
+ lastKeyEvent: z,
767
609
  requiredProps: {
768
- onKeyDown,
769
- ...requiredProps
610
+ onKeyDown: D,
611
+ ...j
770
612
  }
771
- } = useGridCell(value, {
772
- rowIndex,
773
- colIndex,
774
- numCols,
775
- numRows,
613
+ } = he(n, {
614
+ rowIndex: u,
615
+ colIndex: d,
616
+ numCols: a,
617
+ numRows: h,
776
618
  tableId: "serviceManningMatrixTable",
777
- onChange: onChangeHandler,
778
- isEditable,
779
- allowedInputType
780
- });
781
- const onKeyDownHandler = useCallback((ev) => {
782
- if (ev.key === "Delete") {
783
- dispatch(modifiedFieldsRedux.actions.clearEntity(entityId));
784
- dispatch(crudStatusRedux.actions.setEntityFields(entityId, {
785
- hasError: false,
786
- errorMessage: void 0
787
- }));
788
- } else {
789
- onKeyDown(ev);
790
- }
791
- }, [onKeyDown, entityId, dispatch, modifiedFieldsRedux.actions, crudStatusRedux.actions]);
792
- return /* @__PURE__ */ jsxs(Row, {
793
- height: defaultTableRowHeight,
619
+ onChange: b,
620
+ isEditable: s,
621
+ allowedInputType: t
622
+ }), K = I((H) => {
623
+ H.key === "Delete" ? (f(i.actions.clearEntity(o)), f(l.actions.setEntityFields(o, {
624
+ hasError: !1,
625
+ errorMessage: void 0
626
+ }))) : D(H);
627
+ }, [D, o, f, i.actions, l.actions]);
628
+ return /* @__PURE__ */ g(E, {
629
+ height: Se,
794
630
  width: "100%",
795
- borderBottom: tableBorder,
631
+ borderBottom: oe,
796
632
  hoverBackground: "var(--ui7)",
797
633
  alignItems: "center",
798
- children: [rowIndent && /* @__PURE__ */ jsx(Indent, {
799
- num: rowIndent
800
- }), /* @__PURE__ */ jsx(Row, {
634
+ children: [c && /* @__PURE__ */ r(N, {
635
+ num: c
636
+ }), /* @__PURE__ */ r(E, {
801
637
  width: "100%",
802
638
  height: "100%",
803
639
  justifyContent: "flex-end",
804
640
  alignItems: "center",
805
641
  border: "1px solid transparent",
806
642
  borderRadius: "4px",
807
- focusBorder: !isEditing ? "1px solid var(--primary-action-color)" : void 0,
808
- hoverBorder: !isEditing ? "var(--ui5) solid 1px;" : void 0,
809
- onKeyDown: onKeyDownHandler,
810
- ...requiredProps,
811
- children: /* @__PURE__ */ jsx(Indent, {
812
- row: true,
643
+ focusBorder: S ? void 0 : "1px solid var(--primary-action-color)",
644
+ hoverBorder: S ? void 0 : "var(--ui5) solid 1px;",
645
+ onKeyDown: K,
646
+ ...j,
647
+ children: /* @__PURE__ */ r(N, {
648
+ row: !0,
813
649
  alignItems: "center",
814
- children: isEditing ? /* @__PURE__ */ jsx(TextInput, {
815
- onValueChange: setEditorValue,
816
- value: editorValue,
817
- onDone: stopEditing,
818
- onEsc: stopEditingAndRevert,
819
- autoFocus: true,
820
- selectAllOnMount: !lastKeyEvent,
821
- onMove: stopEditingAndMove
822
- }) : /* @__PURE__ */ jsxs(Fragment, {
823
- children: [/* @__PURE__ */ jsx(Text, {
824
- color: isEditable ? "var(--primary-action-color)" : void 0,
825
- variant: (modifiedField == null ? void 0 : modifiedField.modified) ? "bold" : void 0,
826
- children: value
827
- }), (modifiedField == null ? void 0 : modifiedField.newValue) !== void 0 && /* @__PURE__ */ jsxs(Fragment, {
828
- children: [/* @__PURE__ */ jsx(Indent, {
829
- children: /* @__PURE__ */ jsx(Icon, {
830
- icon: faArrowRight,
650
+ children: S ? /* @__PURE__ */ r(ge, {
651
+ onValueChange: k,
652
+ value: A,
653
+ onDone: y,
654
+ onEsc: L,
655
+ autoFocus: !0,
656
+ selectAllOnMount: !z,
657
+ onMove: O
658
+ }) : /* @__PURE__ */ g(G, {
659
+ children: [/* @__PURE__ */ r(U, {
660
+ color: s ? "var(--primary-action-color)" : void 0,
661
+ variant: C != null && C.modified ? "bold" : void 0,
662
+ children: n
663
+ }), (C == null ? void 0 : C.newValue) !== void 0 && /* @__PURE__ */ g(G, {
664
+ children: [/* @__PURE__ */ r(N, {
665
+ children: /* @__PURE__ */ r(F, {
666
+ icon: Mt,
831
667
  size: 12
832
668
  })
833
- }), /* @__PURE__ */ jsx(Text, {
669
+ }), /* @__PURE__ */ r(U, {
834
670
  color: "var(--primary-action-color)",
835
671
  variant: "bold",
836
- children: modifiedField.newValue
672
+ children: C.newValue
837
673
  })]
838
- }), crudStatus && hasIndicatorContent(crudStatus) && /* @__PURE__ */ jsx(Space, {
674
+ }), x && be(x) && /* @__PURE__ */ r(B, {
839
675
  num: 2
840
- }), warningOnEmpty && (modifiedField == null ? void 0 : modifiedField.modified) && (modifiedField == null ? void 0 : modifiedField.newValue) === "" ? /* @__PURE__ */ jsx(Tooltip, {
841
- label: warningOnEmpty,
676
+ }), m && (C == null ? void 0 : C.modified) && (C == null ? void 0 : C.newValue) === "" ? /* @__PURE__ */ r(re, {
677
+ label: m,
842
678
  zIndex: 100,
843
- children: /* @__PURE__ */ jsx(Icon, {
844
- icon: faExclamationTriangle,
679
+ children: /* @__PURE__ */ r(F, {
680
+ icon: ue,
845
681
  color: "var(--ui-alert1)",
846
682
  size: 14
847
683
  })
848
- }) : /* @__PURE__ */ jsx(CrudStatusIndicator, {
849
- crudStatus
684
+ }) : /* @__PURE__ */ r(Ye, {
685
+ crudStatus: x
850
686
  })]
851
687
  })
852
688
  })
853
- }), rowIndent && /* @__PURE__ */ jsx(Indent, {
854
- num: rowIndent
689
+ }), c && /* @__PURE__ */ r(N, {
690
+ num: c
855
691
  })]
856
692
  });
857
- };
858
- const StandardTableTableIdContext = createContext("");
859
- const StandardTableStateContext = createContext(void 0);
860
- const StandardTableActionsContext = createContext(void 0);
861
- const StandardTableConfigContext = createContext(void 0);
862
- const createInternalStandardTableActions = () => ({
863
- sortOrder: createSortOrderActions(),
864
- selectedIds: createSelectedIdsActions(),
865
- expandedRows: createSelectedIdsActions(),
866
- fields: createEntityActions()
867
- });
868
- const getReducerIdFor = (reducerId, reducerIdSuffix) => `${reducerId}.${reducerIdSuffix}`;
869
- const createStandardTableInitialState = (sortBy = void 0, desc = false, selectedIds = [], expandedRows = []) => ({
870
- sortOrder: createSortOrderReducerInitialState(sortBy, desc),
871
- selectedIds: createSelectedIdsReducerInitialState(selectedIds),
872
- expandedRows: createSelectedIdsReducerInitialState(expandedRows),
693
+ }, st = $(""), ct = $(
694
+ void 0
695
+ ), lt = $(void 0), it = $(void 0), Pn = () => ({
696
+ sortOrder: _t(),
697
+ selectedIds: De(),
698
+ expandedRows: De(),
699
+ fields: jt()
700
+ }), M = (e, t) => `${e}.${t}`, at = (e = void 0, t = !1, n = [], o = []) => ({
701
+ sortOrder: Wt(e, t),
702
+ selectedIds: Ne(n),
703
+ expandedRows: Ne(o),
873
704
  fields: { lastSelectedId: void 0 }
874
- });
875
- const createStandardTableReducer = (reducerId, initialState) => {
876
- var _a;
877
- const sortOrder = reducerIdGate(getReducerIdFor(reducerId, "sortOrder"), createSortOrderReducer(initialState == null ? void 0 : initialState.sortOrder));
878
- const selectedIds = reducerIdGate(getReducerIdFor(reducerId, "selectedIds"), createSelectedIdsReducer(initialState == null ? void 0 : initialState.selectedIds));
879
- const expandedRows = reducerIdGate(getReducerIdFor(reducerId, "expandedRows"), createSelectedIdsReducer(initialState == null ? void 0 : initialState.expandedRows));
880
- const fields = reducerIdGate(getReducerIdFor(reducerId, "fields"), createEntityReducer((_a = initialState == null ? void 0 : initialState.fields) != null ? _a : {}));
881
- return combineReducers({
882
- sortOrder,
883
- selectedIds,
884
- expandedRows,
885
- fields
705
+ }), An = (e, t) => {
706
+ var l;
707
+ const n = de(
708
+ M(e, "sortOrder"),
709
+ qt(t == null ? void 0 : t.sortOrder)
710
+ ), o = de(
711
+ M(e, "selectedIds"),
712
+ ze(t == null ? void 0 : t.selectedIds)
713
+ ), s = de(
714
+ M(e, "expandedRows"),
715
+ ze(t == null ? void 0 : t.expandedRows)
716
+ ), c = de(
717
+ M(e, "fields"),
718
+ Ft((l = t == null ? void 0 : t.fields) != null ? l : {})
719
+ );
720
+ return Ut({
721
+ sortOrder: n,
722
+ selectedIds: o,
723
+ expandedRows: s,
724
+ fields: c
886
725
  });
887
- };
888
- const useStandardTableId = () => useContext(StandardTableTableIdContext);
889
- const useStandardTableConfig = () => useContext(StandardTableConfigContext);
890
- const useStandardTableState = () => useContext(StandardTableStateContext);
891
- const useStandardTableActions = () => useContext(StandardTableActionsContext);
892
- const GroupConfigsAndIdsForRowsContext = createContext([]);
893
- const useGroupConfigsAndIdsForRows = () => useContext(GroupConfigsAndIdsForRowsContext);
894
- const useTotalNumColumnsForRows = () => {
895
- const config = useStandardTableConfig();
896
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
897
- let offset = 0;
898
- if (config.enableExpandCollapse) {
899
- offset++;
900
- }
901
- if (config.showRowCheckbox) {
902
- offset++;
903
- }
904
- return offset + useMemo(() => groupConfigsAndIds.map((c) => c.groupConfig.columnOrder.length).reduce((sum, item) => sum + item, 0), [groupConfigsAndIds]);
905
- };
906
- const OnKeyDownContext = createContext(void 0);
907
- const useOnKeyDownContext = () => useContext(OnKeyDownContext);
908
- const StandardTableColumnGroupOrderContext = createContext(void 0);
909
- const StandardTableUsingColumnGroupsContext = createContext(false);
910
- const useColumnGroupOrderContext = () => useContext(StandardTableColumnGroupOrderContext);
911
- const StandardTableVariantContext = createContext("standard");
912
- const StickyPropsPerColumnContext = createContext({});
913
- const useStickyPropsPerColumnContext = () => useContext(StickyPropsPerColumnContext);
914
- const TotalNumColumnsContext = createContext(0);
915
- const useTotalNumColumns = () => useContext(TotalNumColumnsContext);
916
- const createGroupConfigAndIdsForRows = (columnGroups, columnGroupOrder, columnOrder) => {
917
- var _a;
918
- if (columnGroups) {
919
- return compact$1((_a = columnGroupOrder == null ? void 0 : columnGroupOrder.map((groupId) => {
920
- const groupConfig = columnGroups == null ? void 0 : columnGroups[groupId];
726
+ }, Re = () => V(st), R = () => V(it), Y = () => V(ct), se = () => V(lt), dt = $([]), Z = () => V(
727
+ dt
728
+ ), ut = () => {
729
+ const e = R(), t = Z();
730
+ let n = 0;
731
+ return e.enableExpandCollapse && n++, e.showRowCheckbox && n++, n + v(
732
+ () => t.map((o) => o.groupConfig.columnOrder.length).reduce((o, s) => o + s, 0),
733
+ [t]
734
+ );
735
+ }, ht = $(void 0), Ln = () => V(ht), pt = $(void 0), Bn = $(!1), Dn = () => V(pt), Nn = $("standard"), mt = $({}), Ge = () => V(mt), ft = $(0), Te = () => V(ft), wt = (e, t, n) => {
736
+ var o;
737
+ return e ? Xt(
738
+ (o = t == null ? void 0 : t.map((s) => {
739
+ const c = e == null ? void 0 : e[s];
921
740
  return {
922
- groupId,
923
- groupConfig
741
+ groupId: s,
742
+ groupConfig: c
924
743
  };
925
- })) != null ? _a : []).filter((item) => {
926
- var _a2, _b;
927
- return ((_b = (_a2 = item.groupConfig) == null ? void 0 : _a2.columnOrder.length) != null ? _b : 0) > 0;
928
- }).map((p) => p);
929
- }
930
- return [
744
+ })) != null ? o : []
745
+ ).filter((s) => {
746
+ var c, l;
747
+ return ((l = (c = s.groupConfig) == null ? void 0 : c.columnOrder.length) != null ? l : 0) > 0;
748
+ }).map(
749
+ (s) => s
750
+ ) : [
931
751
  {
932
752
  groupId: "virtual",
933
753
  groupConfig: {
934
754
  label: "",
935
- columnOrder: columnOrder != null ? columnOrder : []
755
+ columnOrder: n != null ? n : []
936
756
  }
937
757
  }
938
758
  ];
939
- };
940
- const getCellBorder = (borderFromGroup, disableBorderLeft, borderLeft) => {
941
- if (borderFromGroup) {
942
- if (borderFromGroup === true) {
943
- return tableBorder;
944
- }
945
- return borderFromGroup;
946
- }
947
- if (disableBorderLeft) {
948
- return void 0;
949
- }
950
- if (!borderLeft) {
951
- return void 0;
952
- }
953
- if (borderLeft === true) {
954
- return tableBorder;
955
- }
956
- return borderLeft;
957
- };
958
- const getCellBorderFromGroup = (groupIndex, columnIndexInGroup, groupBorderLeft) => {
959
- if (groupIndex === 0 || columnIndexInGroup !== 0) {
960
- return void 0;
961
- }
962
- if (groupBorderLeft) {
963
- if (groupBorderLeft === true) {
964
- return tableBorder;
965
- }
966
- return groupBorderLeft;
967
- }
968
- return void 0;
969
- };
970
- const useColumnConfigById = (columnId) => {
971
- const { columns } = useStandardTableConfig();
972
- const column = columns[columnId];
973
- if (!column) {
974
- throw new Error("No config for column with id=" + columnId);
975
- }
976
- return column;
977
- };
978
- const useFirstColumnConfig = () => {
979
- var _a, _b, _c;
980
- const config = useStandardTableConfig();
981
- const columnId = (_c = (_b = (_a = useGroupConfigsAndIdsForRows()) == null ? void 0 : _a[0]) == null ? void 0 : _b.groupConfig.columnOrder) == null ? void 0 : _c[0];
982
- return columnId ? config.columns[columnId] : void 0;
983
- };
984
- const useLastColumnConfig = () => {
985
- var _a;
986
- const config = useStandardTableConfig();
987
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
988
- const groupConfigAndId = groupConfigsAndIds[groupConfigsAndIds.length - 1];
989
- const columnId = (_a = groupConfigAndId == null ? void 0 : groupConfigAndId.groupConfig.columnOrder[groupConfigAndId.groupConfig.columnOrder.length - 1]) != null ? _a : void 0;
990
- return columnId ? config.columns[columnId] : void 0;
991
- };
992
- const ColumnInGroup = function ColumnGroupColumnItem({
993
- columnId,
994
- groupConfig,
995
- borderFromGroup,
996
- colSpan,
997
- isFirstGroup,
998
- isLastGroup
759
+ }, Oe = (e, t, n) => {
760
+ if (e)
761
+ return e === !0 ? oe : e;
762
+ if (!t && !!n)
763
+ return n === !0 ? oe : n;
764
+ }, pe = (e, t, n) => {
765
+ if (!(e === 0 || t !== 0) && n)
766
+ return n === !0 ? oe : n;
767
+ }, ce = (e) => {
768
+ const { columns: t } = R(), n = t[e];
769
+ if (!n)
770
+ throw new Error("No config for column with id=" + e);
771
+ return n;
772
+ }, zn = () => {
773
+ var n, o, s;
774
+ const e = R(), t = (s = (o = (n = Z()) == null ? void 0 : n[0]) == null ? void 0 : o.groupConfig.columnOrder) == null ? void 0 : s[0];
775
+ return t ? e.columns[t] : void 0;
776
+ }, Kn = () => {
777
+ var s;
778
+ const e = R(), t = Z(), n = t[t.length - 1], o = (s = n == null ? void 0 : n.groupConfig.columnOrder[n.groupConfig.columnOrder.length - 1]) != null ? s : void 0;
779
+ return o ? e.columns[o] : void 0;
780
+ }, Hn = function({
781
+ columnId: t,
782
+ groupConfig: n,
783
+ borderFromGroup: o,
784
+ colSpan: s,
785
+ isFirstGroup: c,
786
+ isLastGroup: l
999
787
  }) {
1000
- var _a;
1001
- const {
1002
- label,
1003
- render,
1004
- contentLeft,
1005
- contentRight,
1006
- loading,
1007
- error
1008
- } = groupConfig;
1009
- const {
1010
- width,
1011
- minWidth,
1012
- zIndex,
1013
- borderLeft
1014
- } = useColumnConfigById(columnId);
1015
- const config = useStandardTableConfig();
788
+ var D;
1016
789
  const {
1017
- stickyHeader,
1018
- headerRowOffsetTop
1019
- } = config;
1020
- const stickyColumnGroups = "columnGroupOrder" in config ? config.stickyColumnGroups : void 0;
1021
- const activeBorder = getActiveBorder(borderFromGroup, borderLeft);
1022
- const isStickyFirstGroup = isFirstGroup && (stickyColumnGroups === "first" || stickyColumnGroups === "both");
1023
- const isStickyLastGroup = isLastGroup && (stickyColumnGroups === "last" || stickyColumnGroups === "both");
1024
- const isSticky = isStickyFirstGroup || isStickyLastGroup || stickyHeader;
1025
- const isStickyGroup = isStickyFirstGroup || isStickyLastGroup;
1026
- return /* @__PURE__ */ jsx("th", {
1027
- colSpan,
790
+ label: i,
791
+ render: d,
792
+ contentLeft: u,
793
+ contentRight: a,
794
+ loading: h,
795
+ error: m
796
+ } = n, {
797
+ width: f,
798
+ minWidth: w,
799
+ zIndex: p,
800
+ borderLeft: C
801
+ } = ce(t), x = R(), {
802
+ stickyHeader: b,
803
+ headerRowOffsetTop: S
804
+ } = x, y = "columnGroupOrder" in x ? x.stickyColumnGroups : void 0, A = $n(o, C), k = c && (y === "first" || y === "both"), L = l && (y === "last" || y === "both"), O = k || L || b, z = k || L;
805
+ return /* @__PURE__ */ r("th", {
806
+ colSpan: s,
1028
807
  style: {
1029
- position: isSticky ? "sticky" : void 0,
808
+ position: O ? "sticky" : void 0,
1030
809
  height: "var(--current-row-height)",
1031
- width,
1032
- minWidth: (_a = minWidth != null ? minWidth : width) != null ? _a : "20px",
1033
- background: isSticky ? "white" : "transparent",
1034
- left: isStickyFirstGroup ? `var(--current-left-offset)` : void 0,
1035
- right: isStickyLastGroup ? `0px` : void 0,
1036
- top: stickyHeader ? headerRowOffsetTop != null ? headerRowOffsetTop : "0px" : void 0,
1037
- borderLeft: activeBorder,
1038
- zIndex: stickyHeader && isStickyGroup ? "var(--swui-sticky-column-group-label-z-index)" : isStickyGroup ? "var(--swui-sticky-group-group-z-index)" : stickyHeader ? zIndex != null ? zIndex : "var(--swui-sticky-header-column-group-z-index)" : zIndex != null ? zIndex : 1,
1039
- boxShadow: isStickyFirstGroup ? "var(--swui-sticky-column-shadow-right)" : isStickyLastGroup ? "var(--swui-sticky-column-shadow-left)" : void 0
810
+ width: f,
811
+ minWidth: (D = w != null ? w : f) != null ? D : "20px",
812
+ background: O ? "white" : "transparent",
813
+ left: k ? "var(--current-left-offset)" : void 0,
814
+ right: L ? "0px" : void 0,
815
+ top: b ? S != null ? S : "0px" : void 0,
816
+ borderLeft: A,
817
+ zIndex: b && z ? "var(--swui-sticky-column-group-label-z-index)" : z ? "var(--swui-sticky-group-group-z-index)" : b ? p != null ? p : "var(--swui-sticky-header-column-group-z-index)" : p != null ? p : 1,
818
+ boxShadow: k ? "var(--swui-sticky-column-shadow-right)" : L ? "var(--swui-sticky-column-shadow-left)" : void 0
1040
819
  },
1041
- children: /* @__PURE__ */ jsx(Row, {
820
+ children: /* @__PURE__ */ r(E, {
1042
821
  alignItems: "center",
1043
- children: /* @__PURE__ */ jsxs(Fragment, {
1044
- children: [contentLeft && /* @__PURE__ */ jsxs(Fragment, {
1045
- children: [/* @__PURE__ */ jsx(Space, {}), contentLeft, /* @__PURE__ */ jsx(Space, {
822
+ children: /* @__PURE__ */ g(G, {
823
+ children: [u && /* @__PURE__ */ g(G, {
824
+ children: [/* @__PURE__ */ r(B, {}), u, /* @__PURE__ */ r(B, {
1046
825
  num: 0.5
1047
826
  })]
1048
- }), render ? render(groupConfig) : /* @__PURE__ */ jsx(Indent, {
1049
- children: /* @__PURE__ */ jsx(Heading, {
827
+ }), d ? d(n) : /* @__PURE__ */ r(N, {
828
+ children: /* @__PURE__ */ r(We, {
1050
829
  variant: "h5",
1051
830
  whiteSpace: "nowrap",
1052
- children: label
831
+ children: i
1053
832
  })
1054
- }), contentRight && /* @__PURE__ */ jsxs(Fragment, {
1055
- children: [/* @__PURE__ */ jsx(Space, {
833
+ }), a && /* @__PURE__ */ g(G, {
834
+ children: [/* @__PURE__ */ r(B, {
1056
835
  num: 0.5
1057
- }), contentRight]
1058
- }), (error || loading) && /* @__PURE__ */ jsx(Indent, {}), loading ? /* @__PURE__ */ jsx(InputSpinner, {}) : error ? /* @__PURE__ */ jsx(Tooltip, {
1059
- label: error,
836
+ }), a]
837
+ }), (m || h) && /* @__PURE__ */ r(N, {}), h ? /* @__PURE__ */ r(ye, {}) : m ? /* @__PURE__ */ r(re, {
838
+ label: m,
1060
839
  placement: "bottom",
1061
840
  appendTo: document.body,
1062
- children: /* @__PURE__ */ jsx(Icon, {
1063
- icon: faExclamationTriangle,
1064
- color: cssColor("--lhds-color-red-500"),
841
+ children: /* @__PURE__ */ r(F, {
842
+ icon: ue,
843
+ color: _("--lhds-color-red-500"),
1065
844
  size: 14
1066
845
  })
1067
846
  }) : void 0]
1068
847
  })
1069
848
  })
1070
849
  });
1071
- };
1072
- const getActiveBorder = (borderFromGroup, borderFromColumn) => {
1073
- if (borderFromGroup) {
1074
- return borderFromGroup;
1075
- }
1076
- if (borderFromColumn) {
850
+ }, $n = (e, t) => {
851
+ if (e)
852
+ return e;
853
+ if (t)
1077
854
  return "1px solid transparent";
1078
- }
1079
- return void 0;
1080
- };
1081
- const createStickyHeaderProps = (stickyHeader, stickyColumn, headerRowOffsetTop, zIndexFromConfig) => ({
1082
- top: stickyHeader ? getTopPosition$1(stickyHeader, headerRowOffsetTop) : void 0,
1083
- background: stickyHeader || stickyColumn ? "white" : void 0,
1084
- position: stickyHeader || stickyColumn ? "sticky" : void 0,
1085
- boxShadow: stickyColumn ? "var(--swui-sticky-column-shadow-right)" : void 0,
1086
- zIndex: stickyHeader || stickyColumn ? zIndexFromConfig != null ? zIndexFromConfig : "var(--swui-sticky-header-z-index)" : zIndexFromConfig
1087
- });
1088
- const getTopPosition$1 = (stickyHeader, headerRowOffsetTop) => {
1089
- if (stickyHeader && headerRowOffsetTop) {
1090
- return headerRowOffsetTop;
1091
- } else if (headerRowOffsetTop) {
1092
- return headerRowOffsetTop;
1093
- } else if (stickyHeader) {
855
+ }, Mn = (e, t, n, o) => ({
856
+ top: e ? Vn(e, n) : void 0,
857
+ background: e || t ? "white" : void 0,
858
+ position: e || t ? "sticky" : void 0,
859
+ boxShadow: t ? "var(--swui-sticky-column-shadow-right)" : void 0,
860
+ zIndex: e || t ? o != null ? o : "var(--swui-sticky-header-z-index)" : o
861
+ }), Vn = (e, t) => {
862
+ if (e && t)
863
+ return t;
864
+ if (t)
865
+ return t;
866
+ if (e)
1094
867
  return 0;
1095
- }
1096
- return void 0;
1097
- };
1098
- const ColumnGroupRow = React.memo(function ColumnGroupRow2({
1099
- height = defaultTableRowHeight
868
+ }, _n = T.memo(function({
869
+ height: t = Se
1100
870
  }) {
1101
- const groupConfigAndIds = useGroupConfigsAndIdsForRows();
1102
- const config = useStandardTableConfig();
1103
- const {
1104
- showHeaderCheckbox,
1105
- enableExpandCollapse,
1106
- rowIndent,
1107
- zIndex,
1108
- stickyHeader,
1109
- stickyCheckboxColumn,
1110
- headerRowOffsetTop
1111
- } = config;
1112
- const stickyHeaderProps = createStickyHeaderProps(stickyHeader, stickyCheckboxColumn, headerRowOffsetTop, zIndex);
1113
- const zIndexForCells = stickyHeader ? "var(--swui-sticky-column-group-label-z-index)" : "var(--swui-sticky-group-group-z-index)";
1114
- return /* @__PURE__ */ jsxs("tr", {
871
+ const n = Z(), o = R(), {
872
+ showHeaderCheckbox: s,
873
+ enableExpandCollapse: c,
874
+ rowIndent: l,
875
+ zIndex: i,
876
+ stickyHeader: d,
877
+ stickyCheckboxColumn: u,
878
+ headerRowOffsetTop: a
879
+ } = o, h = Mn(d, u, a, i), m = d ? "var(--swui-sticky-column-group-label-z-index)" : "var(--swui-sticky-group-group-z-index)";
880
+ return /* @__PURE__ */ g("tr", {
1115
881
  style: {
1116
- height,
1117
- borderLeft: tableBorderLeft
882
+ height: t,
883
+ borderLeft: ke
1118
884
  },
1119
- children: [rowIndent && /* @__PURE__ */ jsx("th", {
1120
- style: stickyHeaderProps
1121
- }), enableExpandCollapse && /* @__PURE__ */ jsx("th", {
885
+ children: [l && /* @__PURE__ */ r("th", {
886
+ style: h
887
+ }), c && /* @__PURE__ */ r("th", {
1122
888
  style: {
1123
- ...stickyHeaderProps,
889
+ ...h,
1124
890
  width: "var(--swui-expand-cell-width)",
1125
- left: stickyCheckboxColumn ? "0px" : void 0,
1126
- zIndex: zIndexForCells
891
+ left: u ? "0px" : void 0,
892
+ zIndex: m
1127
893
  }
1128
- }), showHeaderCheckbox && /* @__PURE__ */ jsx("th", {
894
+ }), s && /* @__PURE__ */ r("th", {
1129
895
  style: {
1130
- ...stickyHeaderProps,
1131
- left: stickyCheckboxColumn && enableExpandCollapse ? "var(--swui-expand-cell-width)" : stickyCheckboxColumn ? "0px" : void 0,
1132
- zIndex: zIndexForCells
896
+ ...h,
897
+ left: u && c ? "var(--swui-expand-cell-width)" : u ? "0px" : void 0,
898
+ zIndex: m
1133
899
  }
1134
- }), groupConfigAndIds.map(({
1135
- groupConfig,
1136
- groupId
1137
- }, groupIndex) => /* @__PURE__ */ jsx(ColumnInGroup, {
1138
- isFirstGroup: groupIndex === 0,
1139
- isLastGroup: groupIndex === groupConfigAndIds.length - 1,
1140
- groupConfig,
1141
- columnId: groupConfig.columnOrder[0],
1142
- colSpan: groupConfig.columnOrder.length,
1143
- borderFromGroup: getCellBorderFromGroup(groupIndex, 0, groupConfig.borderLeft)
1144
- }, groupId)), rowIndent && /* @__PURE__ */ jsx("th", {
1145
- style: stickyHeaderProps
900
+ }), n.map(({
901
+ groupConfig: f,
902
+ groupId: w
903
+ }, p) => /* @__PURE__ */ r(Hn, {
904
+ isFirstGroup: p === 0,
905
+ isLastGroup: p === n.length - 1,
906
+ groupConfig: f,
907
+ columnId: f.columnOrder[0],
908
+ colSpan: f.columnOrder.length,
909
+ borderFromGroup: pe(p, 0, f.borderLeft)
910
+ }, w)), l && /* @__PURE__ */ r("th", {
911
+ style: h
1146
912
  })]
1147
913
  });
1148
- });
1149
- const calculateColumnIndexPerColumnId = (config) => {
1150
- const groupConfigs = createGroupConfigAndIdsForRows("columnGroups" in config ? config.columnGroups : void 0, "columnGroupOrder" in config ? config.columnGroupOrder : void 0, "columnOrder" in config ? config.columnOrder : void 0);
1151
- let columnIndexPerColumnId = {};
1152
- let currentIndex = 0;
1153
- if (config.showRowCheckbox) {
1154
- currentIndex++;
1155
- }
1156
- if (config.enableExpandCollapse) {
1157
- currentIndex++;
1158
- }
1159
- groupConfigs.forEach((conf) => {
1160
- conf.groupConfig.columnOrder.forEach((columnId) => {
1161
- if (isColumnNavigable(config.columns[columnId])) {
1162
- columnIndexPerColumnId[columnId] = currentIndex++;
1163
- }
914
+ }), jn = (e) => {
915
+ const t = wt(
916
+ "columnGroups" in e ? e.columnGroups : void 0,
917
+ "columnGroupOrder" in e ? e.columnGroupOrder : void 0,
918
+ "columnOrder" in e ? e.columnOrder : void 0
919
+ );
920
+ let n = {}, o = 0;
921
+ return e.showRowCheckbox && o++, e.enableExpandCollapse && o++, t.forEach((s) => {
922
+ s.groupConfig.columnOrder.forEach((c) => {
923
+ Wn(e.columns[c]) && (n[c] = o++);
1164
924
  });
1165
- });
1166
- return {
1167
- columnIndexPerColumnId,
1168
- numNavigableColumns: currentIndex
925
+ }), {
926
+ columnIndexPerColumnId: n,
927
+ numNavigableColumns: o
1169
928
  };
1170
- };
1171
- const isColumnNavigable = (columnConfig) => !columnConfig.disableGridCell;
1172
- const ColumnIndexPerColumnIdContext = createContext({
929
+ }, Wn = (e) => !e.disableGridCell, Ct = $({
1173
930
  columnIndexPerColumnId: {},
1174
931
  numNavigableColumns: 0
1175
- });
1176
- const useColumnIndexPerColumnIdContext = () => useContext(ColumnIndexPerColumnIdContext);
1177
- const ensureConfigHasValidSticky = (config) => {
1178
- if ("columnGroupOrder" in config) {
1179
- ensureNoColumnsAreSticky(config);
1180
- if (config.stickyColumnGroups === "first" || config.stickyColumnGroups === "both") {
1181
- ensureAllColumnsInGroupHasFixedWidth(config, 0);
1182
- }
1183
- if (config.stickyColumnGroups === "last" || config.stickyColumnGroups === "both") {
1184
- ensureAllColumnsInGroupHasFixedWidth(config, config.columnGroupOrder.length - 1);
1185
- }
1186
- }
1187
- };
1188
- const ensureNoColumnsAreSticky = (config) => {
1189
- const columnIds = Object.keys(config.columns);
1190
- columnIds.forEach((columnId) => {
1191
- const columnConfig = config.columns[columnId];
1192
- if (columnConfig.sticky) {
1193
- throw new Error("Columns can not be sticky when column groups are used. columnId: " + columnId);
1194
- }
932
+ }), vt = () => V(
933
+ Ct
934
+ ), qn = (e) => {
935
+ "columnGroupOrder" in e && (Fn(e), (e.stickyColumnGroups === "first" || e.stickyColumnGroups === "both") && $e(e, 0), (e.stickyColumnGroups === "last" || e.stickyColumnGroups === "both") && $e(
936
+ e,
937
+ e.columnGroupOrder.length - 1
938
+ ));
939
+ }, Fn = (e) => {
940
+ Object.keys(e.columns).forEach((n) => {
941
+ if (e.columns[n].sticky)
942
+ throw new Error(
943
+ "Columns can not be sticky when column groups are used. columnId: " + n
944
+ );
1195
945
  });
1196
- };
1197
- const ensureAllColumnsInGroupHasFixedWidth = (config, columnGroupIndex) => {
1198
- var _a;
1199
- if (!config.columnGroupOrder || config.columnGroupOrder.length === 0) {
1200
- throw new Error("columnGroupOrder required when validating column group fixed width.");
1201
- }
1202
- const columnGroupId = config.columnGroupOrder[columnGroupIndex];
1203
- const columnGroupConfig = (_a = config.columnGroups) == null ? void 0 : _a[columnGroupId];
1204
- if (!columnGroupConfig) {
1205
- throw new Error("Column group does not exist. Column group id = " + columnGroupId);
1206
- }
1207
- columnGroupConfig.columnOrder.forEach((columnId) => {
1208
- const columnConfig = config.columns[columnId];
1209
- if (columnConfig.width == null) {
1210
- throw new Error("All columns in sticky column group must have width set.");
1211
- }
946
+ }, $e = (e, t) => {
947
+ var s;
948
+ if (!e.columnGroupOrder || e.columnGroupOrder.length === 0)
949
+ throw new Error(
950
+ "columnGroupOrder required when validating column group fixed width."
951
+ );
952
+ const n = e.columnGroupOrder[t], o = (s = e.columnGroups) == null ? void 0 : s[n];
953
+ if (!o)
954
+ throw new Error(
955
+ "Column group does not exist. Column group id = " + n
956
+ );
957
+ o.columnOrder.forEach((c) => {
958
+ if (e.columns[c].width == null)
959
+ throw new Error(
960
+ "All columns in sticky column group must have width set."
961
+ );
1212
962
  });
1213
- };
1214
- const calculateOffsetForColumnInStickyColumnGroups = (config) => {
1215
- const left = config.stickyColumnGroups === "first" || config.stickyColumnGroups === "both" ? calculateOffsetForColumns(getColumnIdsForLeftSideStickyGroup(config), config.columns, true) : void 0;
1216
- const right = config.stickyColumnGroups === "last" || config.stickyColumnGroups === "both" ? calculateOffsetForColumns(getColumnIdsForRightSideStickyGroup(config), config.columns, false) : void 0;
963
+ }, Un = (e) => {
964
+ const t = e.stickyColumnGroups === "first" || e.stickyColumnGroups === "both" ? Me(
965
+ Jn(e),
966
+ e.columns,
967
+ !0
968
+ ) : void 0, n = e.stickyColumnGroups === "last" || e.stickyColumnGroups === "both" ? Me(
969
+ Xn(e),
970
+ e.columns,
971
+ !1
972
+ ) : void 0;
1217
973
  return {
1218
- ...left,
1219
- ...right
974
+ ...t,
975
+ ...n
1220
976
  };
1221
- };
1222
- const calculateOffsetForColumns = (columnIds, columns, includeOffsetForCheckboxAndExpand) => {
1223
- var _a;
1224
- const r = {};
1225
- const widths = [
1226
- includeOffsetForCheckboxAndExpand ? "var(--current-left-offset)" : "0px"
977
+ }, Me = (e, t, n) => {
978
+ var c;
979
+ const o = {}, s = [
980
+ n ? "var(--current-left-offset)" : "0px"
1227
981
  ];
1228
- for (let i = 0; i < columnIds.length; i++) {
1229
- const columnId = columnIds[i];
1230
- const columnConfig = columns == null ? void 0 : columns[columnId];
1231
- r[columnId] = getCalcForWidths(widths);
1232
- widths.push((_a = columnConfig == null ? void 0 : columnConfig.width) != null ? _a : "0px");
1233
- }
1234
- return r;
1235
- };
1236
- const getCalcForWidths = (widths) => {
1237
- if (widths.length === 0) {
1238
- return "0px";
1239
- }
1240
- if (widths.length === 1) {
1241
- return widths[0];
1242
- }
1243
- return "calc(" + widths.join(" + ") + ")";
1244
- };
1245
- const getColumnIdsForLeftSideStickyGroup = (config) => {
1246
- var _a, _b, _c;
1247
- const columnGroupId = (_a = config.columnGroupOrder) == null ? void 0 : _a[0];
1248
- if (!columnGroupId) {
982
+ for (let l = 0; l < e.length; l++) {
983
+ const i = e[l], d = t == null ? void 0 : t[i];
984
+ o[i] = Zn(s), s.push((c = d == null ? void 0 : d.width) != null ? c : "0px");
985
+ }
986
+ return o;
987
+ }, Zn = (e) => e.length === 0 ? "0px" : e.length === 1 ? e[0] : "calc(" + e.join(" + ") + ")", Jn = (e) => {
988
+ var o, s, c;
989
+ const t = (o = e.columnGroupOrder) == null ? void 0 : o[0];
990
+ if (!t)
1249
991
  return [];
1250
- }
1251
- const columnGroupConfig = (_b = config.columnGroups) == null ? void 0 : _b[columnGroupId];
1252
- return (_c = columnGroupConfig == null ? void 0 : columnGroupConfig.columnOrder) != null ? _c : [];
1253
- };
1254
- const getColumnIdsForRightSideStickyGroup = (config) => {
1255
- var _a, _b, _c;
1256
- const columnGroupId = (_b = config.columnGroupOrder) == null ? void 0 : _b[((_a = config.columnGroupOrder) == null ? void 0 : _a.length) - 1];
1257
- if (!columnGroupId) {
992
+ const n = (s = e.columnGroups) == null ? void 0 : s[t];
993
+ return (c = n == null ? void 0 : n.columnOrder) != null ? c : [];
994
+ }, Xn = (e) => {
995
+ var s, c, l;
996
+ const t = (c = e.columnGroupOrder) == null ? void 0 : c[((s = e.columnGroupOrder) == null ? void 0 : s.length) - 1];
997
+ if (!t)
1258
998
  return [];
1259
- }
1260
- const columnGroupConfig = (_c = config.columnGroups) == null ? void 0 : _c[columnGroupId];
1261
- if (!columnGroupConfig) {
999
+ const n = (l = e.columnGroups) == null ? void 0 : l[t];
1000
+ if (!n)
1262
1001
  return [];
1263
- }
1264
- const r = [...columnGroupConfig.columnOrder];
1265
- r.reverse();
1266
- return r;
1267
- };
1268
- const getStickyPropsPerColumn = (config) => {
1269
- if ("columnGroups" in config) {
1270
- return getStickyPropsPerColumnWithGroups(config);
1271
- } else {
1272
- return getStickyPropsPerColumnWithNoGroups(config);
1273
- }
1274
- };
1275
- const getStickyPropsPerColumnWithNoGroups = (config) => {
1276
- const columnIds = Object.keys(config.columns);
1277
- return columnIds.reduce((sum, columnId) => {
1278
- var _a;
1279
- const columnConfig = config.columns[columnId];
1280
- const sticky = Boolean(columnConfig.sticky);
1281
- sum[columnId] = {
1282
- sticky,
1283
- left: sticky ? `calc(var(--current-left-offset) + ${(_a = columnConfig.left) != null ? _a : "0px"})` : void 0,
1284
- right: sticky ? columnConfig.right : void 0,
1285
- type: "column",
1286
- isFirstColumnInLastGroup: false,
1287
- isLastColumnInFirstGroup: false
1288
- };
1289
- return sum;
1290
- }, {});
1291
- };
1292
- const getStickyPropsPerColumnWithGroups = (config) => {
1293
- const r = {};
1294
- const columnGroupIds = config.columnGroupOrder;
1295
- const stickyGroupOffsets = calculateOffsetForColumnInStickyColumnGroups(config);
1296
- const firstGroupIsSticky = config.stickyColumnGroups === "first" || config.stickyColumnGroups === "both";
1297
- const lastGroupIsSticky = config.stickyColumnGroups === "last" || config.stickyColumnGroups === "both";
1298
- columnGroupIds.forEach((columnGroupId, columnGroupIndex) => {
1299
- const columnGroup = config.columnGroups[columnGroupId];
1300
- const columnIds = columnGroup.columnOrder;
1301
- columnIds.forEach((columnId, columnIndex) => {
1302
- const isFirstGroup = columnGroupIndex === 0;
1303
- const isLastGroup = columnGroupIndex === columnGroupIds.length - 1;
1304
- const isStickyFirst = isFirstGroup && firstGroupIsSticky;
1305
- const isStickyLast = isLastGroup && lastGroupIsSticky;
1306
- const isFirstColumnInLastGroup = columnIndex === 0 && isLastGroup;
1307
- const isLastColumnInFirstGroup = columnIndex === columnIds.length - 1 && isFirstGroup;
1308
- r[columnId] = {
1309
- sticky: isStickyFirst || isStickyLast,
1310
- left: isStickyFirst ? stickyGroupOffsets[columnId] : void 0,
1311
- right: isStickyLast ? stickyGroupOffsets[columnId] : void 0,
1312
- type: isStickyFirst ? "first-group" : isStickyLast ? "last-group" : void 0,
1313
- isFirstColumnInLastGroup,
1314
- isLastColumnInFirstGroup
1002
+ const o = [...n.columnOrder];
1003
+ return o.reverse(), o;
1004
+ }, Yn = (e) => "columnGroups" in e ? eo(e) : Qn(e), Qn = (e) => Object.keys(e.columns).reduce((n, o) => {
1005
+ var l;
1006
+ const s = e.columns[o], c = Boolean(s.sticky);
1007
+ return n[o] = {
1008
+ sticky: c,
1009
+ left: c ? `calc(var(--current-left-offset) + ${(l = s.left) != null ? l : "0px"})` : void 0,
1010
+ right: c ? s.right : void 0,
1011
+ type: "column",
1012
+ isFirstColumnInLastGroup: !1,
1013
+ isLastColumnInFirstGroup: !1
1014
+ }, n;
1015
+ }, {}), eo = (e) => {
1016
+ const t = {}, n = e.columnGroupOrder, o = Un(e), s = e.stickyColumnGroups === "first" || e.stickyColumnGroups === "both", c = e.stickyColumnGroups === "last" || e.stickyColumnGroups === "both";
1017
+ return n.forEach((l, i) => {
1018
+ const u = e.columnGroups[l].columnOrder;
1019
+ u.forEach((a, h) => {
1020
+ const m = i === 0, f = i === n.length - 1, w = m && s, p = f && c, C = h === 0 && f, x = h === u.length - 1 && m;
1021
+ t[a] = {
1022
+ sticky: w || p,
1023
+ left: w ? o[a] : void 0,
1024
+ right: p ? o[a] : void 0,
1025
+ type: w ? "first-group" : p ? "last-group" : void 0,
1026
+ isFirstColumnInLastGroup: C,
1027
+ isLastColumnInFirstGroup: x
1315
1028
  };
1316
1029
  });
1317
- });
1318
- return r;
1319
- };
1320
- const createStandardTableActions = (tableId, actions) => {
1321
- return {
1322
- setSelectedIds: (ids) => reducerIdGateAction(getReducerIdFor(tableId, "selectedIds"), actions.selectedIds.setSelectedIds(ids)),
1323
- clearSelection: () => reducerIdGateAction(getReducerIdFor(tableId, "selectedIds"), actions.selectedIds.clearSelectedIds()),
1324
- expandByIds: (ids) => reducerIdGateAction(getReducerIdFor(tableId, "expandedRows"), actions.expandedRows.setSelectedIds(ids)),
1325
- collapseAll: () => reducerIdGateAction(getReducerIdFor(tableId, "expandedRows"), actions.expandedRows.clearSelectedIds()),
1326
- sortBy: (columnId, desc) => reducerIdGateAction(getReducerIdFor(tableId, "sortOrder"), actions.sortOrder.sortBy(columnId, desc != null ? desc : false)),
1327
- clearSortOrder: () => reducerIdGateAction(getReducerIdFor(tableId, "sortOrder"), actions.sortOrder.clearSortOrder()),
1328
- setLastSelectedId: (lastSelectedId) => reducerIdGateAction(getReducerIdFor(tableId, "fields"), actions.fields.setEntityFields({ lastSelectedId }))
1329
- };
1330
- };
1331
- const useLocalStateTableContext = (tableId, initialState = createStandardTableInitialState()) => {
1332
- const [state, dispatch] = useReducer(createStandardTableReducer(tableId), initialState);
1333
- const actions = useMemo(() => createStandardTableActions(tableId, createInternalStandardTableActions()), [tableId]);
1334
- const tableContext = useMemo(() => ({
1335
- dispatch,
1336
- actions,
1337
- state
1338
- }), [state, actions, dispatch]);
1030
+ }), t;
1031
+ }, to = (e, t) => ({
1032
+ setSelectedIds: (n) => X(
1033
+ M(e, "selectedIds"),
1034
+ t.selectedIds.setSelectedIds(n)
1035
+ ),
1036
+ clearSelection: () => X(
1037
+ M(e, "selectedIds"),
1038
+ t.selectedIds.clearSelectedIds()
1039
+ ),
1040
+ expandByIds: (n) => X(
1041
+ M(e, "expandedRows"),
1042
+ t.expandedRows.setSelectedIds(n)
1043
+ ),
1044
+ collapseAll: () => X(
1045
+ M(e, "expandedRows"),
1046
+ t.expandedRows.clearSelectedIds()
1047
+ ),
1048
+ sortBy: (n, o) => X(
1049
+ M(e, "sortOrder"),
1050
+ t.sortOrder.sortBy(n, o != null ? o : !1)
1051
+ ),
1052
+ clearSortOrder: () => X(
1053
+ M(e, "sortOrder"),
1054
+ t.sortOrder.clearSortOrder()
1055
+ ),
1056
+ setLastSelectedId: (n) => X(
1057
+ M(e, "fields"),
1058
+ t.fields.setEntityFields({ lastSelectedId: n })
1059
+ )
1060
+ }), no = (e, t = at()) => {
1061
+ const [n, o] = It(
1062
+ An(e),
1063
+ t
1064
+ ), s = v(
1065
+ () => to(
1066
+ e,
1067
+ Pn()
1068
+ ),
1069
+ [e]
1070
+ );
1339
1071
  return {
1340
- tableContext
1072
+ tableContext: v(
1073
+ () => ({
1074
+ dispatch: o,
1075
+ actions: s,
1076
+ state: n
1077
+ }),
1078
+ [n, s, o]
1079
+ )
1341
1080
  };
1342
- };
1343
- const getTotalNumColumns = (config) => (config.rowIndent ? 2 : 0) + (config.enableExpandCollapse ? 1 : 0) + (config.showRowCheckbox ? 1 : 0) + getNumUserColumns(config);
1344
- const getNumUserColumns = (config) => {
1345
- var _a, _b;
1346
- if ("columnGroupOrder" in config) {
1347
- return config.columnGroupOrder.reduce((sum, groupId) => {
1348
- var _a2, _b2, _c;
1349
- const group = (_a2 = config.columnGroups) == null ? void 0 : _a2[groupId];
1350
- return sum + ((_c = (_b2 = group == null ? void 0 : group.columnOrder) == null ? void 0 : _b2.length) != null ? _c : 0);
1351
- }, 0);
1352
- }
1353
- return (_b = (_a = config.columnOrder) == null ? void 0 : _a.length) != null ? _b : 0;
1354
- };
1355
- const standardTable = "_standardTable_1iok0_1";
1356
- const relaxed = "_relaxed_1iok0_37";
1357
- const condensed = "_condensed_1iok0_41";
1358
- const compact = "_compact_1iok0_45";
1359
- var styles$3 = {
1360
- standardTable,
1361
- relaxed,
1362
- condensed,
1363
- compact
1364
- };
1365
- const multitypeComparator = (a, b) => {
1366
- if (a != null && b == null) {
1367
- return -1;
1368
- }
1369
- if (a == null && b != null) {
1370
- return 1;
1371
- }
1372
- if (isBothOfType(a, b, "number")) {
1373
- return Number(a) - Number(b);
1374
- }
1375
- if (isBothOfType(a, b, "boolean")) {
1376
- return Number(b) - Number(a);
1377
- }
1378
- if (isBothOfType(a, b, "string")) {
1379
- return String(a).localeCompare(String(b));
1380
- }
1381
- if (a instanceof Date && b instanceof Date) {
1382
- return a.getTime() - b.getTime();
1383
- }
1384
- return 0;
1385
- };
1386
- const isBothOfType = (a, b, type) => typeof a === type && typeof b === type;
1387
- const useColumnValueResolver = (columnId) => {
1388
- const { columns } = useStandardTableConfig();
1389
- if (!columnId) {
1390
- return void 0;
1391
- }
1392
- const column = columns[columnId];
1393
- if (!column) {
1394
- return void 0;
1395
- }
1396
- return column.itemValueResolver;
1397
- };
1398
- const StandardTableRowCheckbox = React.memo(function StandardTableRowCheckbox2({
1399
- value,
1400
- onValueChange,
1401
- colIndex,
1402
- rowIndex,
1403
- numRows,
1404
- disabled,
1405
- onValueChangeAndShift,
1406
- shiftPressedRef
1081
+ }, oo = (e) => (e.rowIndent ? 2 : 0) + (e.enableExpandCollapse ? 1 : 0) + (e.showRowCheckbox ? 1 : 0) + ro(e), ro = (e) => {
1082
+ var t, n;
1083
+ return "columnGroupOrder" in e ? e.columnGroupOrder.reduce((o, s) => {
1084
+ var l, i, d;
1085
+ const c = (l = e.columnGroups) == null ? void 0 : l[s];
1086
+ return o + ((d = (i = c == null ? void 0 : c.columnOrder) == null ? void 0 : i.length) != null ? d : 0);
1087
+ }, 0) : (n = (t = e.columnOrder) == null ? void 0 : t.length) != null ? n : 0;
1088
+ }, so = "_standardTable_1iok0_1", co = "_relaxed_1iok0_37", lo = "_condensed_1iok0_41", io = "_compact_1iok0_45", Ve = {
1089
+ standardTable: so,
1090
+ relaxed: co,
1091
+ condensed: lo,
1092
+ compact: io
1093
+ }, ao = (e, t) => e != null && t == null ? -1 : e == null && t != null ? 1 : Ce(e, t, "number") ? Number(e) - Number(t) : Ce(e, t, "boolean") ? Number(t) - Number(e) : Ce(e, t, "string") ? String(e).localeCompare(String(t)) : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : 0, Ce = (e, t, n) => typeof e === n && typeof t === n, uo = (e) => {
1094
+ const { columns: t } = R();
1095
+ if (!e)
1096
+ return;
1097
+ const n = t[e];
1098
+ if (!!n)
1099
+ return n.itemValueResolver;
1100
+ }, ho = T.memo(function({
1101
+ value: t,
1102
+ onValueChange: n,
1103
+ colIndex: o,
1104
+ rowIndex: s,
1105
+ numRows: c,
1106
+ disabled: l,
1107
+ onValueChangeAndShift: i,
1108
+ shiftPressedRef: d
1407
1109
  }) {
1408
- const totalNumColumns = useTotalNumColumnsForRows();
1409
- const tableId = useStandardTableId();
1410
- const gridCell = useGridCell(Boolean(value), {
1411
- colIndex,
1412
- numCols: totalNumColumns,
1413
- numRows,
1414
- rowIndex,
1415
- tableId
1416
- });
1417
- const {
1418
- requiredProps
1419
- } = gridCell;
1420
- const internalOnValueChange = useCallback((value2) => {
1421
- if (shiftPressedRef.current) {
1422
- onValueChangeAndShift == null ? void 0 : onValueChangeAndShift(value2);
1423
- } else {
1424
- onValueChange == null ? void 0 : onValueChange(value2);
1425
- }
1426
- }, [onValueChange, onValueChangeAndShift, shiftPressedRef]);
1427
- return /* @__PURE__ */ jsx(Checkbox, {
1110
+ const u = ut(), a = Re(), h = he(Boolean(t), {
1111
+ colIndex: o,
1112
+ numCols: u,
1113
+ numRows: c,
1114
+ rowIndex: s,
1115
+ tableId: a
1116
+ }), {
1117
+ requiredProps: m
1118
+ } = h, f = I((w) => {
1119
+ d.current ? i == null || i(w) : n == null || n(w);
1120
+ }, [n, i, d]);
1121
+ return /* @__PURE__ */ r(Ue, {
1428
1122
  size: "small",
1429
- disabled,
1430
- value,
1431
- onValueChange: internalOnValueChange,
1432
- ...requiredProps
1123
+ disabled: l,
1124
+ value: t,
1125
+ onValueChange: f,
1126
+ ...m
1433
1127
  });
1434
- });
1435
- const getIdsBetweenSelected = (idList, selected1, selected2) => {
1436
- if (selected1 == null || selected2 == null || idList == null) {
1437
- return void 0;
1438
- }
1439
- if (selected1 === selected2) {
1440
- return void 0;
1441
- }
1442
- const i1 = idList.indexOf(selected1);
1443
- const i2 = idList.indexOf(selected2);
1444
- if (i1 < 0 || i2 < 0) {
1445
- return void 0;
1446
- }
1447
- const start = Math.min(i1, i2);
1448
- const end = Math.max(i1, i2);
1449
- return idList.slice(start, end + 1);
1450
- };
1451
- const useRowCheckbox = (item, idListForEnabledItems) => {
1452
- const { keyResolver } = useStandardTableConfig();
1453
- const {
1454
- selectedIds: { selectedIds },
1455
- fields: { lastSelectedId }
1456
- } = useStandardTableState();
1457
- const {
1458
- actions: { setSelectedIds, setLastSelectedId },
1459
- dispatch
1460
- } = useStandardTableActions();
1461
- const itemKey = useMemo(() => keyResolver(item), [keyResolver, item]);
1462
- const isSelected = useMemo(() => selectedIds.includes(itemKey), [selectedIds, itemKey]);
1463
- const { toggle, addMultiple, removeMultiple } = useArraySet(selectedIds, (ids) => dispatch(setSelectedIds(ids)));
1464
- const shiftAndToggleSelected = useCallback(() => {
1465
- if (idListForEnabledItems && lastSelectedId) {
1466
- const idList = getIdsBetweenSelected(idListForEnabledItems, lastSelectedId, itemKey);
1467
- if (idList == null ? void 0 : idList.length) {
1468
- if (isSelected) {
1469
- removeMultiple(idList);
1470
- } else {
1471
- addMultiple(idList);
1472
- }
1473
- } else {
1474
- toggle(itemKey);
1475
- }
1476
- } else {
1477
- toggle(itemKey);
1478
- }
1479
- dispatch(setLastSelectedId(itemKey));
1128
+ }), po = (e, t, n) => {
1129
+ if (t == null || n == null || e == null || t === n)
1130
+ return;
1131
+ const o = e.indexOf(t), s = e.indexOf(n);
1132
+ if (o < 0 || s < 0)
1133
+ return;
1134
+ const c = Math.min(o, s), l = Math.max(o, s);
1135
+ return e.slice(c, l + 1);
1136
+ }, mo = (e, t) => {
1137
+ const { keyResolver: n } = R(), {
1138
+ selectedIds: { selectedIds: o },
1139
+ fields: { lastSelectedId: s }
1140
+ } = Y(), {
1141
+ actions: { setSelectedIds: c, setLastSelectedId: l },
1142
+ dispatch: i
1143
+ } = se(), d = v(() => n(e), [n, e]), u = v(
1144
+ () => o.includes(d),
1145
+ [o, d]
1146
+ ), { toggle: a, addMultiple: h, removeMultiple: m } = qe(
1147
+ o,
1148
+ (p) => i(c(p))
1149
+ ), f = I(() => {
1150
+ if (t && s) {
1151
+ const p = po(
1152
+ t,
1153
+ s,
1154
+ d
1155
+ );
1156
+ p != null && p.length ? u ? m(p) : h(p) : a(d);
1157
+ } else
1158
+ a(d);
1159
+ i(l(d));
1480
1160
  }, [
1481
- idListForEnabledItems,
1482
- lastSelectedId,
1483
- dispatch,
1484
- setLastSelectedId,
1485
- itemKey,
1486
- isSelected,
1487
- removeMultiple,
1488
- addMultiple,
1489
- toggle
1490
- ]);
1491
- const toggleSelected = useCallback(() => {
1492
- toggle(itemKey);
1493
- dispatch(setLastSelectedId(itemKey));
1494
- }, [toggle, itemKey, dispatch, setLastSelectedId]);
1161
+ t,
1162
+ s,
1163
+ i,
1164
+ l,
1165
+ d,
1166
+ u,
1167
+ m,
1168
+ h,
1169
+ a
1170
+ ]), w = I(() => {
1171
+ a(d), i(l(d));
1172
+ }, [a, d, i, l]);
1495
1173
  return {
1496
- isSelected,
1497
- toggleSelected,
1498
- shiftAndToggleSelected
1174
+ isSelected: u,
1175
+ toggleSelected: w,
1176
+ shiftAndToggleSelected: f
1499
1177
  };
1500
- };
1501
- const useExpandCollapseActions = (item) => {
1502
- const { keyResolver } = useStandardTableConfig();
1503
- const {
1504
- expandedRows: { selectedIds }
1505
- } = useStandardTableState();
1506
- const {
1507
- actions: { expandByIds },
1508
- dispatch
1509
- } = useStandardTableActions();
1510
- const itemKey = useMemo(() => keyResolver(item), [keyResolver, item]);
1511
- const isExpanded = useMemo(() => selectedIds.includes(itemKey), [selectedIds, itemKey]);
1512
- const { toggle } = useArraySet(selectedIds, (ids) => dispatch(expandByIds(ids)));
1513
- const toggleRowExpanded = useCallback(() => {
1514
- toggle(itemKey);
1515
- }, [toggle, itemKey]);
1178
+ }, Pe = (e) => {
1179
+ const { keyResolver: t } = R(), {
1180
+ expandedRows: { selectedIds: n }
1181
+ } = Y(), {
1182
+ actions: { expandByIds: o },
1183
+ dispatch: s
1184
+ } = se(), c = v(() => t(e), [t, e]), l = v(
1185
+ () => n.includes(c),
1186
+ [n, c]
1187
+ ), { toggle: i } = qe(
1188
+ n,
1189
+ (u) => s(o(u))
1190
+ );
1516
1191
  return {
1517
- toggleRowExpanded,
1518
- isExpanded
1192
+ toggleRowExpanded: I(() => {
1193
+ i(c);
1194
+ }, [i, c]),
1195
+ isExpanded: l
1519
1196
  };
1520
- };
1521
- const StandardTableRowExpandButton = function({
1522
- item,
1523
- colIndex,
1524
- numRows,
1525
- rowIndex
1197
+ }, fo = function({
1198
+ item: e,
1199
+ colIndex: t,
1200
+ numRows: n,
1201
+ rowIndex: o
1526
1202
  }) {
1527
- const totalNumColumns = useTotalNumColumnsForRows();
1528
- const tableId = useStandardTableId();
1529
- const gridCell = useGridCell(true, {
1530
- colIndex,
1531
- numCols: totalNumColumns,
1532
- numRows,
1533
- rowIndex,
1534
- tableId
1535
- });
1536
- const {
1537
- requiredProps
1538
- } = gridCell;
1539
- const {
1540
- expandCollapseDisableResolver
1541
- } = useStandardTableConfig();
1542
- const {
1543
- toggleRowExpanded,
1544
- isExpanded
1545
- } = useExpandCollapseActions(item);
1546
- const buttonDisabled = useMemo(() => {
1547
- if (!expandCollapseDisableResolver) {
1548
- return false;
1549
- }
1550
- return expandCollapseDisableResolver(item);
1551
- }, [expandCollapseDisableResolver, item]);
1552
- return /* @__PURE__ */ jsx(Row, {
1203
+ const s = ut(), c = Re(), l = he(!0, {
1204
+ colIndex: t,
1205
+ numCols: s,
1206
+ numRows: n,
1207
+ rowIndex: o,
1208
+ tableId: c
1209
+ }), {
1210
+ requiredProps: i
1211
+ } = l, {
1212
+ expandCollapseDisableResolver: d
1213
+ } = R(), {
1214
+ toggleRowExpanded: u,
1215
+ isExpanded: a
1216
+ } = Pe(e), h = v(() => d ? d(e) : !1, [d, e]);
1217
+ return /* @__PURE__ */ r(E, {
1553
1218
  alignItems: "center",
1554
1219
  justifyContent: "center",
1555
- indent: true,
1556
- children: !buttonDisabled && /* @__PURE__ */ jsx(FlatButton, {
1220
+ indent: !0,
1221
+ children: !h && /* @__PURE__ */ r(xe, {
1557
1222
  size: "small",
1558
- leftIcon: isExpanded ? faChevronDown : faChevronRight,
1559
- onClick: toggleRowExpanded,
1560
- ...requiredProps
1223
+ leftIcon: a ? Ze : Je,
1224
+ onClick: u,
1225
+ ...i
1561
1226
  })
1562
1227
  });
1563
- };
1564
- const getBackgroundColor$1 = (backgroundResolver, item, background) => backgroundResolver ? backgroundResolver(item) : background;
1565
- const useBackground = (backgroundResolver, item, background) => useMemo(() => getBackgroundColor$1(backgroundResolver, item, background), [backgroundResolver, item, background]);
1566
- const useCellBackgroundByColumnId = (columnId, item) => {
1567
- const { background, backgroundResolver } = useColumnConfigById(columnId);
1568
- return useBackground(backgroundResolver, item, background);
1569
- };
1570
- const useCellBackgroundByColumnConfig = (columnConfig, item) => {
1571
- const { background, backgroundResolver } = columnConfig != null ? columnConfig : {};
1572
- return useBackground(backgroundResolver, item, background);
1573
- };
1574
- const formatValueLabel = (itemValue) => {
1575
- if (itemValue == null) {
1576
- return "";
1577
- } else if (itemValue instanceof Date) {
1578
- return itemValue.toISOString();
1579
- } else if (typeof itemValue === "object") {
1580
- return JSON.stringify(itemValue);
1581
- } else {
1582
- return String(itemValue);
1583
- }
1584
- };
1585
- const formatColumnIdToHeaderCellLabel = (columnId) => upperFirst(lowerCase(columnId));
1586
- const standardTableCell = "_standardTableCell_1xzcm_1";
1587
- var styles$2 = {
1588
- standardTableCell
1589
- };
1590
- const StandardTableCellUi = React.memo(function StandardTableCellUi2({
1591
- enableGridCell,
1592
- children,
1593
- background,
1594
- gridCellRequiredProps,
1595
- isEditing,
1596
- justifyContent,
1597
- onKeyDown,
1598
- width,
1599
- minWidth
1228
+ }, wo = (e, t, n) => e ? e(t) : n, yt = (e, t, n) => v(
1229
+ () => wo(e, t, n),
1230
+ [e, t, n]
1231
+ ), Co = (e, t) => {
1232
+ const { background: n, backgroundResolver: o } = ce(e);
1233
+ return yt(o, t, n);
1234
+ }, _e = (e, t) => {
1235
+ const { background: n, backgroundResolver: o } = e != null ? e : {};
1236
+ return yt(o, t, n);
1237
+ }, vo = (e) => e == null ? "" : e instanceof Date ? e.toISOString() : typeof e == "object" ? JSON.stringify(e) : String(e), yo = (e) => Yt(Qt(e)), xo = "_standardTableCell_1xzcm_1", go = {
1238
+ standardTableCell: xo
1239
+ }, bo = T.memo(function({
1240
+ enableGridCell: t,
1241
+ children: n,
1242
+ background: o,
1243
+ gridCellRequiredProps: s,
1244
+ isEditing: c,
1245
+ justifyContent: l,
1246
+ onKeyDown: i,
1247
+ width: d,
1248
+ minWidth: u
1600
1249
  }) {
1601
- return /* @__PURE__ */ jsx(Row, {
1602
- width,
1603
- minWidth,
1250
+ return /* @__PURE__ */ r(E, {
1251
+ width: d,
1252
+ minWidth: u,
1604
1253
  height: "inherit",
1605
- background,
1254
+ background: o,
1606
1255
  overflow: "hidden",
1607
- onKeyDown,
1608
- children: /* @__PURE__ */ jsx(Row, {
1256
+ onKeyDown: i,
1257
+ children: /* @__PURE__ */ r(E, {
1609
1258
  border: "1px solid transparent",
1610
- className: styles$2.standardTableCell,
1259
+ className: go.standardTableCell,
1611
1260
  width: "100%",
1612
1261
  height: "100%",
1613
- justifyContent,
1262
+ justifyContent: l,
1614
1263
  alignItems: "center",
1615
- borderRadius: enableGridCell ? "4px" : void 0,
1616
- focusBorder: enableGridCell && !isEditing ? "1px solid var(--swui-primary-action-color)" : void 0,
1617
- hoverBorder: enableGridCell && !isEditing ? "1px solid var(--lhds-color-ui-300)" : void 0,
1618
- ...enableGridCell ? gridCellRequiredProps : void 0,
1619
- children
1264
+ borderRadius: t ? "4px" : void 0,
1265
+ focusBorder: t && !c ? "1px solid var(--swui-primary-action-color)" : void 0,
1266
+ hoverBorder: t && !c ? "1px solid var(--lhds-color-ui-300)" : void 0,
1267
+ ...t ? s : void 0,
1268
+ children: n
1620
1269
  })
1621
1270
  });
1622
- });
1623
- const textCell = "_textCell_1yv6v_1";
1624
- var styles$1 = {
1625
- textCell
1626
- };
1627
- const TextCell = React.memo(function TextCell2({
1628
- label
1271
+ }), ko = "_textCell_1yv6v_1", So = {
1272
+ textCell: ko
1273
+ }, Io = T.memo(function({
1274
+ label: t
1629
1275
  }) {
1630
- return /* @__PURE__ */ jsx(Indent, {
1276
+ return /* @__PURE__ */ r(N, {
1631
1277
  overflow: "hidden",
1632
- children: /* @__PURE__ */ jsx(Text, {
1633
- className: styles$1.textCell,
1634
- title: label,
1635
- children: label
1278
+ children: /* @__PURE__ */ r(U, {
1279
+ className: So.textCell,
1280
+ title: t,
1281
+ children: t
1636
1282
  })
1637
1283
  });
1638
- });
1639
- const StandardTableCell = React.memo(function StandardTableCell2({
1640
- columnId,
1641
- item,
1642
- colIndex,
1643
- rowIndex,
1644
- numRows,
1645
- borderFromGroup,
1646
- disableBorderLeft
1284
+ }), Eo = T.memo(function({
1285
+ columnId: t,
1286
+ item: n,
1287
+ colIndex: o,
1288
+ rowIndex: s,
1289
+ numRows: c,
1290
+ borderFromGroup: l,
1291
+ disableBorderLeft: i
1647
1292
  }) {
1648
- var _a;
1649
- const {
1650
- keyResolver,
1651
- enableGridCell,
1652
- gridCellOptions: gridCellOptionsForTable
1653
- } = useStandardTableConfig();
1654
- const selectedIds = useStandardTableState().selectedIds.selectedIds;
1655
- const tableId = useStandardTableId();
1656
- const onKeyDownTable = useOnKeyDownContext();
1293
+ var Ae;
1657
1294
  const {
1658
- numNavigableColumns
1659
- } = useColumnIndexPerColumnIdContext();
1660
- const stickyPropsPerColumnContext = useStickyPropsPerColumnContext();
1661
- const itemKey = useMemo(() => keyResolver(item), [item, keyResolver]);
1662
- const isSelected = useMemo(() => {
1663
- return selectedIds.indexOf(itemKey) >= 0;
1664
- }, [itemKey, selectedIds]);
1665
- const {
1666
- itemValueResolver,
1667
- itemLabelFormatter,
1668
- width,
1669
- minWidth,
1670
- justifyContentCell = "flex-start",
1671
- borderLeft,
1672
- renderCell,
1673
- gridCellOptions: gridCellOptionsForColumn,
1674
- isEditable,
1675
- onChange,
1676
- onKeyDown: onKeyDownCell,
1677
- disableGridCell,
1678
- disableGridCellFocus,
1679
- zIndex
1680
- } = useColumnConfigById(columnId);
1681
- const itemValue = useMemo(() => {
1682
- if (itemValueResolver) {
1683
- return itemValueResolver(item);
1684
- }
1685
- if (columnId in item) {
1686
- return item[columnId];
1687
- }
1688
- return "";
1689
- }, [itemValueResolver, item, columnId]);
1690
- const label = useMemo(() => itemLabelFormatter ? itemLabelFormatter(itemValue, item) : formatValueLabel(itemValue), [itemValue, itemLabelFormatter, item]);
1691
- const editable = typeof isEditable === "boolean" ? isEditable : isEditable ? isEditable(item) : void 0;
1692
- const onKeyDownHandler = useCallback((ev) => {
1693
- onKeyDownCell == null ? void 0 : onKeyDownCell(ev, {
1694
- columnId,
1695
- item
1696
- });
1697
- onKeyDownTable == null ? void 0 : onKeyDownTable(ev, {
1698
- columnId,
1699
- item
1295
+ keyResolver: d,
1296
+ enableGridCell: u,
1297
+ gridCellOptions: a
1298
+ } = R(), h = Y().selectedIds.selectedIds, m = Re(), f = Ln(), {
1299
+ numNavigableColumns: w
1300
+ } = vt(), p = Ge(), C = v(() => d(n), [n, d]), x = v(() => h.indexOf(C) >= 0, [C, h]), {
1301
+ itemValueResolver: b,
1302
+ itemLabelFormatter: S,
1303
+ width: y,
1304
+ minWidth: A,
1305
+ justifyContentCell: k = "flex-start",
1306
+ borderLeft: L,
1307
+ renderCell: O,
1308
+ gridCellOptions: z,
1309
+ isEditable: D,
1310
+ onChange: j,
1311
+ onKeyDown: K,
1312
+ disableGridCell: H,
1313
+ disableGridCellFocus: le,
1314
+ zIndex: W
1315
+ } = ce(t), q = v(() => b ? b(n) : t in n ? n[t] : "", [b, n, t]), Q = v(() => S ? S(q, n) : vo(q), [q, S, n]), ee = typeof D == "boolean" ? D : D ? D(n) : void 0, me = I((ae) => {
1316
+ K == null || K(ae, {
1317
+ columnId: t,
1318
+ item: n
1319
+ }), f == null || f(ae, {
1320
+ columnId: t,
1321
+ item: n
1700
1322
  });
1701
- }, [onKeyDownTable, columnId, item, onKeyDownCell]);
1702
- const gridCell = useGridCell(label, {
1703
- colIndex,
1704
- rowIndex,
1705
- numRows,
1706
- numCols: numNavigableColumns,
1707
- tableId,
1708
- isEditable: editable,
1709
- onChange: onChange ? (value) => onChange(item, value) : void 0,
1710
- ...gridCellOptionsForTable,
1711
- ...gridCellOptionsForColumn
1712
- });
1713
- const stickyProps = stickyPropsPerColumnContext[columnId];
1714
- const background = (_a = useCellBackgroundByColumnId(columnId, item)) != null ? _a : "inherit";
1715
- const currentZIndex = stickyProps.sticky ? zIndex != null ? zIndex : "var(--swui-sticky-column-z-index)" : zIndex != null ? zIndex : 1;
1716
- const content = useMemo(() => renderCell ? renderCell({
1717
- label,
1718
- value: itemValue,
1719
- item,
1720
- gridCell,
1721
- isEditable: editable,
1722
- isSelected,
1723
- zIndex: currentZIndex,
1724
- itemKey
1725
- }) : /* @__PURE__ */ jsx(TextCell, {
1726
- label
1727
- }), [renderCell, label, itemValue, item, gridCell, editable, isSelected, currentZIndex, itemKey]);
1728
- const activeBorderLeft = getCellBorder(borderFromGroup, disableBorderLeft, borderLeft);
1729
- const shadow = stickyProps.sticky && stickyProps.type === "last-group" && stickyProps.isFirstColumnInLastGroup ? "var(--swui-sticky-column-shadow-left)" : stickyProps.sticky && stickyProps.type === "column" && stickyProps.right ? "var(--swui-sticky-column-shadow-left)" : stickyProps.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0;
1730
- return /* @__PURE__ */ jsx("td", {
1323
+ }, [f, t, n, K]), J = he(Q, {
1324
+ colIndex: o,
1325
+ rowIndex: s,
1326
+ numRows: c,
1327
+ numCols: w,
1328
+ tableId: m,
1329
+ isEditable: ee,
1330
+ onChange: j ? (ae) => j(n, ae) : void 0,
1331
+ ...a,
1332
+ ...z
1333
+ }), P = p[t], ie = (Ae = Co(t, n)) != null ? Ae : "inherit", fe = P.sticky ? W != null ? W : "var(--swui-sticky-column-z-index)" : W != null ? W : 1, bt = v(() => O ? O({
1334
+ label: Q,
1335
+ value: q,
1336
+ item: n,
1337
+ gridCell: J,
1338
+ isEditable: ee,
1339
+ isSelected: x,
1340
+ zIndex: fe,
1341
+ itemKey: C
1342
+ }) : /* @__PURE__ */ r(Io, {
1343
+ label: Q
1344
+ }), [O, Q, q, n, J, ee, x, fe, C]), kt = Oe(l, i, L), St = P.sticky && P.type === "last-group" && P.isFirstColumnInLastGroup || P.sticky && P.type === "column" && P.right ? "var(--swui-sticky-column-shadow-left)" : P.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0;
1345
+ return /* @__PURE__ */ r("td", {
1731
1346
  style: {
1732
- borderLeft: activeBorderLeft,
1733
- position: stickyProps.sticky ? "sticky" : void 0,
1734
- left: stickyProps.sticky ? stickyProps.left : void 0,
1735
- right: stickyProps.sticky ? stickyProps.right : void 0,
1736
- boxShadow: shadow,
1737
- zIndex: currentZIndex,
1347
+ borderLeft: kt,
1348
+ position: P.sticky ? "sticky" : void 0,
1349
+ left: P.sticky ? P.left : void 0,
1350
+ right: P.sticky ? P.right : void 0,
1351
+ boxShadow: St,
1352
+ zIndex: fe,
1738
1353
  height: "var(--current-row-height)",
1739
- background
1354
+ background: ie
1740
1355
  },
1741
- children: /* @__PURE__ */ jsx(StandardTableCellUi, {
1742
- enableGridCell: enableGridCell && !disableGridCell && !disableGridCellFocus,
1743
- gridCellRequiredProps: gridCell.requiredProps,
1744
- isEditing: gridCell.isEditing,
1745
- width,
1746
- minWidth,
1747
- justifyContent: justifyContentCell,
1748
- onKeyDown: onKeyDownHandler,
1749
- children: content
1356
+ children: /* @__PURE__ */ r(bo, {
1357
+ enableGridCell: u && !H && !le,
1358
+ gridCellRequiredProps: J.requiredProps,
1359
+ isEditing: J.isEditing,
1360
+ width: y,
1361
+ minWidth: A,
1362
+ justifyContent: k,
1363
+ onKeyDown: me,
1364
+ children: bt
1750
1365
  })
1751
1366
  });
1752
- });
1753
- const StandardTableRowExpansion = function StandardTableRowExpansion2({
1754
- item
1367
+ }), Ro = function({
1368
+ item: t
1755
1369
  }) {
1756
1370
  const {
1757
- renderRowExpansion,
1758
- enableExpandCollapse
1759
- } = useStandardTableConfig();
1760
- const {
1761
- isExpanded,
1762
- toggleRowExpanded
1763
- } = useExpandCollapseActions(item);
1764
- const totalNumColumns = useTotalNumColumns();
1765
- return /* @__PURE__ */ jsx(Fragment, {
1766
- children: enableExpandCollapse && renderRowExpansion && isExpanded && /* @__PURE__ */ jsx("tr", {
1371
+ renderRowExpansion: n,
1372
+ enableExpandCollapse: o
1373
+ } = R(), {
1374
+ isExpanded: s,
1375
+ toggleRowExpanded: c
1376
+ } = Pe(t), l = Te();
1377
+ return /* @__PURE__ */ r(G, {
1378
+ children: o && n && s && /* @__PURE__ */ r("tr", {
1767
1379
  style: {
1768
- borderLeft: tableBorderLeftExpanded,
1769
- background: tableBackgroundColorExpanded
1380
+ borderLeft: et,
1381
+ background: Qe
1770
1382
  },
1771
- children: /* @__PURE__ */ jsx("td", {
1772
- colSpan: totalNumColumns,
1773
- children: renderRowExpansion(item, {
1774
- onRequestCollapse: toggleRowExpanded
1383
+ children: /* @__PURE__ */ r("td", {
1384
+ colSpan: l,
1385
+ children: n(t, {
1386
+ onRequestCollapse: c
1775
1387
  })
1776
1388
  })
1777
1389
  })
1778
1390
  });
1779
- };
1780
- const TrWithHoverBackground = styled.tr`
1391
+ }, xt = en.tr`
1781
1392
  ${({
1782
- focusBackground
1783
- }) => focusBackground ? `--focus-within-background: ${focusBackground};` : ""}
1393
+ focusBackground: e
1394
+ }) => e ? `--focus-within-background: ${e};` : ""}
1784
1395
  ${({
1785
- borderLeft
1786
- }) => borderLeft ? `border-left: ${borderLeft};` : ""};
1396
+ borderLeft: e
1397
+ }) => e ? `border-left: ${e};` : ""};
1787
1398
  ${({
1788
- background
1789
- }) => background ? `background: ${background};` : ""};
1399
+ background: e
1400
+ }) => e ? `background: ${e};` : ""};
1790
1401
  ${({
1791
- height
1792
- }) => height ? `height: ${height};` : ""};
1402
+ height: e
1403
+ }) => e ? `height: ${e};` : ""};
1793
1404
  ${({
1794
- hoverBackground
1795
- }) => hoverBackground ? ` &:hover {
1796
- background: ${hoverBackground};
1405
+ hoverBackground: e
1406
+ }) => e ? ` &:hover {
1407
+ background: ${e};
1797
1408
  }
1798
1409
  ` : ""}
1799
- `;
1800
- const StandardTableRow = React.memo(function StandardTableRow2({
1801
- item,
1802
- idListForEnabledItems,
1803
- rowIndex,
1804
- numRows,
1805
- colIndexOffset,
1806
- alwaysVisible,
1807
- shiftPressedRef
1410
+ `, Go = T.memo(function({
1411
+ item: t,
1412
+ idListForEnabledItems: n,
1413
+ rowIndex: o,
1414
+ numRows: s,
1415
+ colIndexOffset: c,
1416
+ alwaysVisible: l,
1417
+ shiftPressedRef: i
1808
1418
  }) {
1809
- const trRef = useRef(null);
1810
- const totalNumColumns = useTotalNumColumns();
1811
- const {
1812
- stickyCheckboxColumn
1813
- } = useStandardTableConfig();
1814
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
1815
- const {
1816
- columnIndexPerColumnId
1817
- } = useColumnIndexPerColumnIdContext();
1818
- const {
1819
- showRowCheckbox,
1820
- rowBackgroundResolver,
1821
- checkboxDisabledResolver,
1822
- enableGridCell,
1823
- rowIndent,
1824
- enableExpandCollapse
1825
- } = useStandardTableConfig();
1826
- const {
1827
- isExpanded
1828
- } = useExpandCollapseActions(item);
1829
- const {
1830
- isSelected,
1831
- toggleSelected,
1832
- shiftAndToggleSelected
1833
- } = useRowCheckbox(item, idListForEnabledItems);
1834
- const visible = useOnScreen(trRef, {
1419
+ const d = te(null), u = Te(), {
1420
+ stickyCheckboxColumn: a
1421
+ } = R(), h = Z(), {
1422
+ columnIndexPerColumnId: m
1423
+ } = vt(), {
1424
+ showRowCheckbox: f,
1425
+ rowBackgroundResolver: w,
1426
+ checkboxDisabledResolver: p,
1427
+ enableGridCell: C,
1428
+ rowIndent: x,
1429
+ enableExpandCollapse: b
1430
+ } = R(), {
1431
+ isExpanded: S
1432
+ } = Pe(t), {
1433
+ isSelected: y,
1434
+ toggleSelected: A,
1435
+ shiftAndToggleSelected: k
1436
+ } = mo(t, n), L = At(d, {
1835
1437
  rootMargin: "400px 0px 400px 0px",
1836
1438
  threshold: 0
1837
- });
1838
- const resolvedBackgroundResult = useMemo(() => rowBackgroundResolver == null ? void 0 : rowBackgroundResolver(item, isSelected), [isSelected, item, rowBackgroundResolver]);
1839
- const background = getBackgroundColor(resolvedBackgroundResult, isSelected, isExpanded);
1840
- const hoverBackground = getHoverBackgroundColor(resolvedBackgroundResult, isSelected, isExpanded);
1841
- const focusBackground = getFocusBackgroundColor(resolvedBackgroundResult, isSelected, hoverBackground);
1842
- const disabled = useMemo(() => checkboxDisabledResolver == null ? void 0 : checkboxDisabledResolver(item), [item, checkboxDisabledResolver]);
1843
- const firstColumn = useFirstColumnConfig();
1844
- const firstColumnBackground = useCellBackgroundByColumnConfig(firstColumn, item);
1845
- const lastColumn = useLastColumnConfig();
1846
- const lastColumnBackground = useCellBackgroundByColumnConfig(lastColumn, item);
1847
- const content = useMemo(() => /* @__PURE__ */ jsx(Fragment, {
1848
- children: /* @__PURE__ */ jsxs(Fragment, {
1849
- children: [rowIndent && /* @__PURE__ */ jsx("td", {
1439
+ }), O = v(() => w == null ? void 0 : w(t, y), [y, t, w]), z = To(O, y, S), D = Oo(O, y, S), j = Po(O, y, D), K = v(() => p == null ? void 0 : p(t), [t, p]), H = zn(), le = _e(H, t), W = Kn(), q = _e(W, t), Q = v(() => /* @__PURE__ */ r(G, {
1440
+ children: /* @__PURE__ */ g(G, {
1441
+ children: [x && /* @__PURE__ */ r("td", {
1850
1442
  style: {
1851
- background: firstColumnBackground
1443
+ background: le
1852
1444
  },
1853
- children: /* @__PURE__ */ jsx(Indent, {
1854
- num: rowIndent
1445
+ children: /* @__PURE__ */ r(N, {
1446
+ num: x
1855
1447
  })
1856
- }), enableExpandCollapse && /* @__PURE__ */ jsx("td", {
1448
+ }), b && /* @__PURE__ */ r("td", {
1857
1449
  style: {
1858
- background: stickyCheckboxColumn ? "inherit" : void 0,
1859
- position: stickyCheckboxColumn ? "sticky" : void 0,
1860
- left: stickyCheckboxColumn ? "0px" : void 0,
1861
- boxShadow: stickyCheckboxColumn ? "var(--swui-sticky-column-shadow-right)" : void 0,
1862
- zIndex: stickyCheckboxColumn ? "var(--swui-sticky-column-z-index)" : void 0
1450
+ background: a ? "inherit" : void 0,
1451
+ position: a ? "sticky" : void 0,
1452
+ left: a ? "0px" : void 0,
1453
+ boxShadow: a ? "var(--swui-sticky-column-shadow-right)" : void 0,
1454
+ zIndex: a ? "var(--swui-sticky-column-z-index)" : void 0
1863
1455
  },
1864
- children: /* @__PURE__ */ jsx(Row, {
1456
+ children: /* @__PURE__ */ r(E, {
1865
1457
  width: "var(--swui-expand-cell-width)",
1866
1458
  minWidth: "var(--swui-expand-cell-width)",
1867
1459
  alignItems: "center",
1868
1460
  justifyContent: "center",
1869
- children: /* @__PURE__ */ jsx(StandardTableRowExpandButton, {
1870
- colIndex: colIndexOffset,
1871
- rowIndex: enableGridCell ? rowIndex : 0,
1872
- numRows: enableGridCell ? numRows : 0,
1873
- item
1461
+ children: /* @__PURE__ */ r(fo, {
1462
+ colIndex: c,
1463
+ rowIndex: C ? o : 0,
1464
+ numRows: C ? s : 0,
1465
+ item: t
1874
1466
  })
1875
1467
  })
1876
- }), showRowCheckbox && /* @__PURE__ */ jsx("td", {
1468
+ }), f && /* @__PURE__ */ r("td", {
1877
1469
  style: {
1878
- background: stickyCheckboxColumn ? "inherit" : void 0,
1879
- position: stickyCheckboxColumn ? "sticky" : void 0,
1880
- left: enableExpandCollapse && stickyCheckboxColumn ? "var(--swui-expand-cell-width)" : stickyCheckboxColumn ? "0px" : void 0,
1470
+ background: a ? "inherit" : void 0,
1471
+ position: a ? "sticky" : void 0,
1472
+ left: b && a ? "var(--swui-expand-cell-width)" : a ? "0px" : void 0,
1881
1473
  textAlign: "center",
1882
- boxShadow: stickyCheckboxColumn ? "var(--swui-sticky-column-shadow-right)" : void 0,
1883
- zIndex: stickyCheckboxColumn ? "var(--swui-sticky-column-z-index)" : void 0
1474
+ boxShadow: a ? "var(--swui-sticky-column-shadow-right)" : void 0,
1475
+ zIndex: a ? "var(--swui-sticky-column-z-index)" : void 0
1884
1476
  },
1885
- children: /* @__PURE__ */ jsx(Row, {
1477
+ children: /* @__PURE__ */ r(E, {
1886
1478
  width: "var(--swui-checkbox-cell-width)",
1887
1479
  minWidth: "var(--swui-checkbox-cell-width)",
1888
1480
  alignItems: "center",
1889
1481
  justifyContent: "center",
1890
- children: /* @__PURE__ */ jsx(StandardTableRowCheckbox, {
1891
- disabled,
1892
- value: isSelected,
1893
- onValueChange: toggleSelected,
1894
- onValueChangeAndShift: shiftAndToggleSelected,
1895
- colIndex: colIndexOffset + (enableExpandCollapse ? 1 : 0),
1896
- rowIndex,
1897
- numRows,
1898
- shiftPressedRef
1482
+ children: /* @__PURE__ */ r(ho, {
1483
+ disabled: K,
1484
+ value: y,
1485
+ onValueChange: A,
1486
+ onValueChangeAndShift: k,
1487
+ colIndex: c + (b ? 1 : 0),
1488
+ rowIndex: o,
1489
+ numRows: s,
1490
+ shiftPressedRef: i
1899
1491
  })
1900
1492
  })
1901
- }), groupConfigsAndIds.map(({
1902
- groupConfig,
1903
- groupId
1904
- }, groupIndex) => /* @__PURE__ */ jsx(React.Fragment, {
1905
- children: groupConfig.columnOrder.map((columnId, index) => /* @__PURE__ */ jsx(StandardTableCell, {
1906
- columnId,
1907
- item,
1908
- colIndex: colIndexOffset + columnIndexPerColumnId[columnId],
1909
- rowIndex,
1910
- numRows,
1911
- borderFromGroup: getCellBorderFromGroup(groupIndex, index, groupConfig.borderLeft),
1912
- disableBorderLeft: groupIndex === 0 && index === 0
1913
- }, columnId))
1914
- }, groupId)), rowIndent && /* @__PURE__ */ jsx("td", {
1493
+ }), h.map(({
1494
+ groupConfig: ee,
1495
+ groupId: me
1496
+ }, J) => /* @__PURE__ */ r(T.Fragment, {
1497
+ children: ee.columnOrder.map((P, ie) => /* @__PURE__ */ r(Eo, {
1498
+ columnId: P,
1499
+ item: t,
1500
+ colIndex: c + m[P],
1501
+ rowIndex: o,
1502
+ numRows: s,
1503
+ borderFromGroup: pe(J, ie, ee.borderLeft),
1504
+ disableBorderLeft: J === 0 && ie === 0
1505
+ }, P))
1506
+ }, me)), x && /* @__PURE__ */ r("td", {
1915
1507
  style: {
1916
- background: lastColumnBackground
1508
+ background: q
1917
1509
  },
1918
- children: /* @__PURE__ */ jsx(Indent, {
1919
- num: rowIndent
1510
+ children: /* @__PURE__ */ r(N, {
1511
+ num: x
1920
1512
  })
1921
- }), /* @__PURE__ */ jsx("td", {})]
1513
+ }), /* @__PURE__ */ r("td", {})]
1922
1514
  })
1923
- }), [colIndexOffset, columnIndexPerColumnId, disabled, enableExpandCollapse, enableGridCell, firstColumnBackground, groupConfigsAndIds, isSelected, item, lastColumnBackground, numRows, rowIndent, rowIndex, shiftAndToggleSelected, shiftPressedRef, showRowCheckbox, stickyCheckboxColumn, toggleSelected]);
1924
- return /* @__PURE__ */ jsxs(Fragment, {
1925
- children: [/* @__PURE__ */ jsx(TrWithHoverBackground, {
1926
- hoverBackground,
1927
- background,
1928
- focusBackground,
1929
- borderLeft: isExpanded ? tableBorderLeftExpanded : tableBorderLeft,
1930
- ref: trRef,
1931
- children: visible || alwaysVisible || isExpanded ? content : /* @__PURE__ */ jsx("td", {
1932
- colSpan: totalNumColumns,
1515
+ }), [c, m, K, b, C, le, h, y, t, q, s, x, o, k, i, f, a, A]);
1516
+ return /* @__PURE__ */ g(G, {
1517
+ children: [/* @__PURE__ */ r(xt, {
1518
+ hoverBackground: D,
1519
+ background: z,
1520
+ focusBackground: j,
1521
+ borderLeft: S ? et : ke,
1522
+ ref: d,
1523
+ children: L || l || S ? Q : /* @__PURE__ */ r("td", {
1524
+ colSpan: u,
1933
1525
  style: {
1934
1526
  height: "var(--current-row-height)"
1935
1527
  }
1936
1528
  })
1937
- }), /* @__PURE__ */ jsx(StandardTableRowExpansion, {
1938
- item
1529
+ }), /* @__PURE__ */ r(Ro, {
1530
+ item: t
1939
1531
  })]
1940
1532
  });
1941
- });
1942
- const getBackgroundColor = (resolvedBackground, isSelected, isExpanded) => {
1943
- if (resolvedBackground) {
1944
- return typeof resolvedBackground === "string" ? resolvedBackground : resolvedBackground == null ? void 0 : resolvedBackground.background;
1945
- }
1946
- if (isSelected) {
1947
- return cssColor("--lhds-color-blue-100");
1948
- }
1949
- if (isExpanded) {
1950
- return tableBackgroundColorExpanded;
1951
- }
1952
- return "white";
1953
- };
1954
- const getHoverBackgroundColor = (resolvedBackground, isSelected, isExpanded) => {
1955
- if (resolvedBackground) {
1956
- return typeof resolvedBackground === "string" ? resolvedBackground : resolvedBackground == null ? void 0 : resolvedBackground.hoverBackground;
1957
- }
1958
- if (isSelected) {
1959
- return cssColor("--lhds-color-blue-100");
1960
- }
1961
- if (isExpanded) {
1962
- return tableBackgroundHoverColorExpanded;
1963
- }
1964
- return cssColor("--lhds-color-ui-100");
1965
- };
1966
- const getFocusBackgroundColor = (resolvedBackground, isSelected, hoverBackground) => {
1967
- if (isSelected) {
1968
- return cssColor("--lhds-color-blue-100");
1969
- }
1970
- if (resolvedBackground) {
1971
- return hoverBackground;
1972
- }
1973
- return void 0;
1974
- };
1975
- const isSummaryRowVisible = (columns) => Object.values(columns).some((columnConfig) => columnHasSummaryCell(columnConfig));
1976
- const columnHasSummaryCell = (columnConfig) => Boolean(columnConfig.renderSummaryCell || columnConfig.summaryText);
1977
- const summaryRow = "_summaryRow_12x8k_1";
1978
- var styles = {
1979
- summaryRow
1980
- };
1981
- const SummaryCell = React.memo(function SummaryCell2({
1982
- columnId,
1983
- items,
1984
- disableBorderLeft,
1985
- borderFromGroup,
1986
- colSpan
1533
+ }), To = (e, t, n) => e ? typeof e == "string" ? e : e == null ? void 0 : e.background : t ? _("--lhds-color-blue-100") : n ? Qe : "white", Oo = (e, t, n) => e ? typeof e == "string" ? e : e == null ? void 0 : e.hoverBackground : t ? _("--lhds-color-blue-100") : n ? sn : _("--lhds-color-ui-100"), Po = (e, t, n) => {
1534
+ if (t)
1535
+ return _("--lhds-color-blue-100");
1536
+ if (e)
1537
+ return n;
1538
+ }, Ao = (e) => Object.values(e).some((t) => Lo(t)), Lo = (e) => Boolean(e.renderSummaryCell || e.summaryText), Bo = "_summaryRow_12x8k_1", Do = {
1539
+ summaryRow: Bo
1540
+ }, No = T.memo(function({
1541
+ columnId: t,
1542
+ items: n,
1543
+ disableBorderLeft: o,
1544
+ borderFromGroup: s,
1545
+ colSpan: c
1987
1546
  }) {
1988
- const stickyPropsPerColumnContext = useStickyPropsPerColumnContext();
1989
- const {
1990
- renderSummaryCell,
1991
- summaryText,
1992
- borderLeft,
1993
- zIndex,
1994
- width,
1995
- minWidth,
1996
- justifyContentCell
1997
- } = useColumnConfigById(columnId);
1998
- const activeBorderLeft = getCellBorder(borderFromGroup, disableBorderLeft, borderLeft);
1999
- const stickyProps = stickyPropsPerColumnContext[columnId];
2000
- const currentZIndex = stickyProps.sticky ? zIndex != null ? zIndex : "var(--swui-sticky-column-z-index)" : zIndex != null ? zIndex : 1;
2001
- const shadow = stickyProps.sticky && stickyProps.type === "last-group" && stickyProps.isFirstColumnInLastGroup ? "var(--swui-sticky-column-shadow-left)" : stickyProps.sticky && stickyProps.type === "column" && stickyProps.right ? "var(--swui-sticky-column-shadow-left)" : stickyProps.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0;
2002
- const text = useMemo(() => summaryText == null ? void 0 : summaryText({
2003
- items
2004
- }), [items, summaryText]);
2005
- const renderResult = useMemo(() => renderSummaryCell == null ? void 0 : renderSummaryCell({
2006
- items,
2007
- text
2008
- }), [items, renderSummaryCell, text]);
2009
- return /* @__PURE__ */ jsx("td", {
2010
- colSpan,
1547
+ const l = Ge(), {
1548
+ renderSummaryCell: i,
1549
+ summaryText: d,
1550
+ borderLeft: u,
1551
+ zIndex: a,
1552
+ width: h,
1553
+ minWidth: m,
1554
+ justifyContentCell: f
1555
+ } = ce(t), w = Oe(s, o, u), p = l[t], C = p.sticky ? a != null ? a : "var(--swui-sticky-column-z-index)" : a != null ? a : 1, x = p.sticky && p.type === "last-group" && p.isFirstColumnInLastGroup || p.sticky && p.type === "column" && p.right ? "var(--swui-sticky-column-shadow-left)" : p.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0, b = v(() => d == null ? void 0 : d({
1556
+ items: n
1557
+ }), [n, d]), S = v(() => i == null ? void 0 : i({
1558
+ items: n,
1559
+ text: b
1560
+ }), [n, i, b]);
1561
+ return /* @__PURE__ */ r("td", {
1562
+ colSpan: c,
2011
1563
  style: {
2012
- borderLeft: activeBorderLeft,
2013
- position: stickyProps.sticky ? "sticky" : void 0,
2014
- left: stickyProps.sticky ? stickyProps.left : void 0,
2015
- right: stickyProps.sticky ? stickyProps.right : void 0,
2016
- boxShadow: shadow,
2017
- zIndex: currentZIndex,
1564
+ borderLeft: w,
1565
+ position: p.sticky ? "sticky" : void 0,
1566
+ left: p.sticky ? p.left : void 0,
1567
+ right: p.sticky ? p.right : void 0,
1568
+ boxShadow: x,
1569
+ zIndex: C,
2018
1570
  height: "var(--current-row-height)"
2019
1571
  },
2020
- children: /* @__PURE__ */ jsx(Row, {
2021
- width,
2022
- minWidth,
1572
+ children: /* @__PURE__ */ r(E, {
1573
+ width: h,
1574
+ minWidth: m,
2023
1575
  height: "inherit",
2024
1576
  overflow: "hidden",
2025
- justifyContent: justifyContentCell,
1577
+ justifyContent: f,
2026
1578
  alignItems: "center",
2027
- children: renderSummaryCell ? renderResult : /* @__PURE__ */ jsx(Indent, {
2028
- children: /* @__PURE__ */ jsx(Text, {
1579
+ children: i ? S : /* @__PURE__ */ r(N, {
1580
+ children: /* @__PURE__ */ r(U, {
2029
1581
  variant: "bold",
2030
- children: text
1582
+ children: b
2031
1583
  })
2032
1584
  })
2033
1585
  })
2034
1586
  });
2035
- });
2036
- const getColumnsLimitedWithColSpan = (columnOrder, columns) => {
2037
- const list = [];
2038
- for (let i = 0; i < columnOrder.length; i++) {
2039
- const { summaryCellColSpan } = columns[columnOrder[i]];
2040
- const realColSpan = Math.min(summaryCellColSpan != null ? summaryCellColSpan : 1, columnOrder.length - i);
2041
- list.push({ columnId: columnOrder[i], colSpan: realColSpan });
2042
- const colSpan = summaryCellColSpan != null ? summaryCellColSpan : 1;
2043
- if (colSpan > 1) {
2044
- i += colSpan - 1;
2045
- }
2046
- }
2047
- return list;
2048
- };
2049
- const StandardTableSummaryRow = React.memo(function StandardTableSummaryRow2({
2050
- items
1587
+ }), zo = (e, t) => {
1588
+ const n = [];
1589
+ for (let o = 0; o < e.length; o++) {
1590
+ const { summaryCellColSpan: s } = t[e[o]], c = Math.min(
1591
+ s != null ? s : 1,
1592
+ e.length - o
1593
+ );
1594
+ n.push({ columnId: e[o], colSpan: c });
1595
+ const l = s != null ? s : 1;
1596
+ l > 1 && (o += l - 1);
1597
+ }
1598
+ return n;
1599
+ }, Ko = T.memo(function({
1600
+ items: t
2051
1601
  }) {
2052
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
2053
- const {
2054
- showRowCheckbox,
2055
- enableExpandCollapse,
2056
- columns,
2057
- rowIndent
2058
- } = useStandardTableConfig();
2059
- return /* @__PURE__ */ jsxs("tr", {
2060
- className: styles.summaryRow,
2061
- children: [rowIndent && /* @__PURE__ */ jsx("td", {
2062
- children: /* @__PURE__ */ jsx(Indent, {
2063
- num: rowIndent
1602
+ const n = Z(), {
1603
+ showRowCheckbox: o,
1604
+ enableExpandCollapse: s,
1605
+ columns: c,
1606
+ rowIndent: l
1607
+ } = R();
1608
+ return /* @__PURE__ */ g("tr", {
1609
+ className: Do.summaryRow,
1610
+ children: [l && /* @__PURE__ */ r("td", {
1611
+ children: /* @__PURE__ */ r(N, {
1612
+ num: l
2064
1613
  })
2065
- }), enableExpandCollapse && /* @__PURE__ */ jsx("td", {}), showRowCheckbox && /* @__PURE__ */ jsx("td", {}), groupConfigsAndIds.map(({
2066
- groupConfig,
2067
- groupId
2068
- }, groupIndex) => /* @__PURE__ */ jsx(React.Fragment, {
2069
- children: getColumnsLimitedWithColSpan(groupConfig.columnOrder, columns).map(({
2070
- columnId,
2071
- colSpan
2072
- }, index) => {
2073
- return /* @__PURE__ */ jsx(SummaryCell, {
2074
- colSpan,
2075
- columnId,
2076
- items,
2077
- borderFromGroup: getCellBorderFromGroup(groupIndex, index, groupConfig.borderLeft),
2078
- disableBorderLeft: groupIndex === 0 && index === 0
2079
- }, columnId);
1614
+ }), s && /* @__PURE__ */ r("td", {}), o && /* @__PURE__ */ r("td", {}), n.map(({
1615
+ groupConfig: i,
1616
+ groupId: d
1617
+ }, u) => /* @__PURE__ */ r(T.Fragment, {
1618
+ children: zo(i.columnOrder, c).map(({
1619
+ columnId: a,
1620
+ colSpan: h
1621
+ }, m) => /* @__PURE__ */ r(No, {
1622
+ colSpan: h,
1623
+ columnId: a,
1624
+ items: t,
1625
+ borderFromGroup: pe(u, m, i.borderLeft),
1626
+ disableBorderLeft: u === 0 && m === 0
1627
+ }, a))
1628
+ }, d)), l && /* @__PURE__ */ r("td", {
1629
+ children: /* @__PURE__ */ r(N, {
1630
+ num: l
2080
1631
  })
2081
- }, groupId)), rowIndent && /* @__PURE__ */ jsx("td", {
2082
- children: /* @__PURE__ */ jsx(Indent, {
2083
- num: rowIndent
2084
- })
2085
- }), /* @__PURE__ */ jsx("td", {})]
1632
+ }), /* @__PURE__ */ r("td", {})]
2086
1633
  });
2087
- });
2088
- const SummaryRowSwitcher = function SummaryRowSwitcher2({
2089
- items
1634
+ }), Ho = function({
1635
+ items: t
2090
1636
  }) {
2091
1637
  const {
2092
- columns
2093
- } = useStandardTableConfig();
2094
- const visible = useMemo(() => isSummaryRowVisible(columns), [columns]);
2095
- if (!visible) {
2096
- return null;
2097
- }
2098
- return /* @__PURE__ */ jsx(StandardTableSummaryRow, {
2099
- items
2100
- });
2101
- };
2102
- const filterItemsOnEnabledCheckboxes = (checkboxDisabledResolver) => (item) => (checkboxDisabledResolver == null ? void 0 : checkboxDisabledResolver(item)) ? false : true;
2103
- const StandardTableRowList = React.memo(function StandardTableRowList2({
2104
- items,
2105
- colIndexOffset = 0,
2106
- rowIndexOffset = 0
1638
+ columns: n
1639
+ } = R();
1640
+ return v(() => Ao(n), [n]) ? /* @__PURE__ */ r(Ko, {
1641
+ items: t
1642
+ }) : null;
1643
+ }, gt = (e) => (t) => !(e != null && e(t)), $o = T.memo(function({
1644
+ items: t,
1645
+ colIndexOffset: n = 0,
1646
+ rowIndexOffset: o = 0
2107
1647
  }) {
2108
- const sortCounterRef = useRef(0);
2109
- const shiftPressedRef = useRef(false);
2110
- const {
2111
- keyResolver,
2112
- disableInfiniteList,
2113
- checkboxDisabledResolver
2114
- } = useStandardTableConfig();
2115
- const {
1648
+ const s = te(0), c = te(!1), {
1649
+ keyResolver: l,
1650
+ disableInfiniteList: i,
1651
+ checkboxDisabledResolver: d
1652
+ } = R(), {
2116
1653
  sortOrder: {
2117
- sortBy,
2118
- desc
1654
+ sortBy: u,
1655
+ desc: a
2119
1656
  }
2120
- } = useStandardTableState();
2121
- const valueResolver = useColumnValueResolver(sortBy);
2122
- const sortedItems = useMemo(() => {
2123
- if (!items || !items.length) {
1657
+ } = Y(), h = uo(u), m = v(() => {
1658
+ if (!t || !t.length)
2124
1659
  return [];
2125
- }
2126
- if (!valueResolver) {
2127
- return items;
2128
- }
2129
- const sortedList = [...items];
2130
- sortedList.sort((a, b) => multitypeComparator(valueResolver(a), valueResolver(b)));
2131
- if (desc) {
2132
- sortedList.reverse();
2133
- }
2134
- if (!disableInfiniteList) {
2135
- sortCounterRef.current++;
2136
- }
2137
- return sortedList;
2138
- }, [items, valueResolver, desc, disableInfiniteList]);
2139
- const idListForEnabledItems = useMemo(() => sortedItems.filter(filterItemsOnEnabledCheckboxes(checkboxDisabledResolver)).map((l) => keyResolver(l)), [sortedItems, checkboxDisabledResolver, keyResolver]);
2140
- useEffect(() => {
2141
- const keyUp = (ev) => {
2142
- if (ev.key === "Shift") {
2143
- shiftPressedRef.current = false;
2144
- }
1660
+ if (!h)
1661
+ return t;
1662
+ const w = [...t];
1663
+ return w.sort((p, C) => ao(h(p), h(C))), a && w.reverse(), i || s.current++, w;
1664
+ }, [t, h, a, i]), f = v(() => m.filter(gt(d)).map((w) => l(w)), [m, d, l]);
1665
+ return je(() => {
1666
+ const w = (C) => {
1667
+ C.key === "Shift" && (c.current = !1);
1668
+ }, p = (C) => {
1669
+ C.key === "Shift" && (c.current = !0);
2145
1670
  };
2146
- const keyDown = (ev) => {
2147
- if (ev.key === "Shift") {
2148
- shiftPressedRef.current = true;
2149
- }
2150
- };
2151
- document.addEventListener("keyup", keyUp);
2152
- document.addEventListener("keydown", keyDown);
2153
- return () => {
2154
- document.removeEventListener("keyup", keyUp);
2155
- document.removeEventListener("keydown", keyDown);
1671
+ return document.addEventListener("keyup", w), document.addEventListener("keydown", p), () => {
1672
+ document.removeEventListener("keyup", w), document.removeEventListener("keydown", p);
2156
1673
  };
2157
- }, []);
2158
- return /* @__PURE__ */ jsxs(React.Fragment, {
2159
- children: [sortedItems.map((item, index) => /* @__PURE__ */ jsx(StandardTableRow, {
2160
- alwaysVisible: disableInfiniteList || sortedItems.length < 30,
2161
- item,
2162
- idListForEnabledItems,
2163
- colIndexOffset,
2164
- rowIndex: index + rowIndexOffset,
2165
- numRows: sortedItems.length,
2166
- shiftPressedRef
2167
- }, keyResolver(item))), /* @__PURE__ */ jsx(SummaryRowSwitcher, {
2168
- items: sortedItems
1674
+ }, []), /* @__PURE__ */ g(T.Fragment, {
1675
+ children: [m.map((w, p) => /* @__PURE__ */ r(Go, {
1676
+ alwaysVisible: i || m.length < 30,
1677
+ item: w,
1678
+ idListForEnabledItems: f,
1679
+ colIndexOffset: n,
1680
+ rowIndex: p + o,
1681
+ numRows: m.length,
1682
+ shiftPressedRef: c
1683
+ }, l(w))), /* @__PURE__ */ r(Ho, {
1684
+ items: m
2169
1685
  })]
2170
- }, sortCounterRef.current);
2171
- });
2172
- const StandardTableContent = React.memo(function StandardTableContent2({
2173
- error,
2174
- bannerError,
2175
- loading,
2176
- items,
2177
- noItemsLabel = "There is no data available.",
2178
- noItemsContentRight,
2179
- noItemsContentBottom,
2180
- noItemsHeader,
2181
- colIndexOffset,
2182
- rowIndexOffset,
2183
- variant,
2184
- errorLabel
1686
+ }, s.current);
1687
+ }), Mo = T.memo(function({
1688
+ error: t,
1689
+ bannerError: n,
1690
+ loading: o,
1691
+ items: s,
1692
+ noItemsLabel: c = "There is no data available.",
1693
+ noItemsContentRight: l,
1694
+ noItemsContentBottom: i,
1695
+ noItemsHeader: d,
1696
+ colIndexOffset: u,
1697
+ rowIndexOffset: a,
1698
+ variant: h,
1699
+ errorLabel: m
2185
1700
  }) {
2186
- var _a;
2187
- const totalNumColumns = useTotalNumColumns();
2188
- if (bannerError) {
2189
- return /* @__PURE__ */ jsx("tbody", {
2190
- children: /* @__PURE__ */ jsx("tr", {
2191
- children: /* @__PURE__ */ jsx("td", {
2192
- colSpan: totalNumColumns,
2193
- children: /* @__PURE__ */ jsx(Spacing, {
2194
- num: 4,
2195
- justifyContent: "center",
2196
- children: /* @__PURE__ */ jsx(Box, {
2197
- alignItems: "center",
2198
- children: /* @__PURE__ */ jsx(ResultListBanner, {
2199
- bannerState: bannerError,
2200
- variant: "error"
2201
- })
1701
+ var w;
1702
+ const f = Te();
1703
+ return n ? /* @__PURE__ */ r("tbody", {
1704
+ children: /* @__PURE__ */ r("tr", {
1705
+ children: /* @__PURE__ */ r("td", {
1706
+ colSpan: f,
1707
+ children: /* @__PURE__ */ r(we, {
1708
+ num: 4,
1709
+ justifyContent: "center",
1710
+ children: /* @__PURE__ */ r(ne, {
1711
+ alignItems: "center",
1712
+ children: /* @__PURE__ */ r(Tt, {
1713
+ bannerState: n,
1714
+ variant: "error"
2202
1715
  })
2203
1716
  })
2204
1717
  })
2205
1718
  })
2206
- });
2207
- }
2208
- if (error || errorLabel) {
2209
- return /* @__PURE__ */ jsx("tbody", {
2210
- children: /* @__PURE__ */ jsx("tr", {
2211
- children: /* @__PURE__ */ jsx("td", {
2212
- colSpan: totalNumColumns,
2213
- children: /* @__PURE__ */ jsx(Spacing, {
2214
- num: 4,
2215
- justifyContent: "center",
2216
- children: /* @__PURE__ */ jsx(Box, {
2217
- alignItems: "center",
2218
- children: /* @__PURE__ */ jsx(Banner, {
2219
- headerText: (_a = error ? error.message : errorLabel) != null ? _a : "Unknown error",
2220
- variant: "error"
2221
- })
1719
+ })
1720
+ }) : t || m ? /* @__PURE__ */ r("tbody", {
1721
+ children: /* @__PURE__ */ r("tr", {
1722
+ children: /* @__PURE__ */ r("td", {
1723
+ colSpan: f,
1724
+ children: /* @__PURE__ */ r(we, {
1725
+ num: 4,
1726
+ justifyContent: "center",
1727
+ children: /* @__PURE__ */ r(ne, {
1728
+ alignItems: "center",
1729
+ children: /* @__PURE__ */ r(Le, {
1730
+ headerText: (w = t ? t.message : m) != null ? w : "Unknown error",
1731
+ variant: "error"
2222
1732
  })
2223
1733
  })
2224
1734
  })
2225
1735
  })
2226
- });
2227
- }
2228
- if (loading) {
2229
- return /* @__PURE__ */ jsx("tbody", {
2230
- children: /* @__PURE__ */ jsx("tr", {
2231
- children: /* @__PURE__ */ jsx("td", {
2232
- colSpan: totalNumColumns,
2233
- children: /* @__PURE__ */ jsx(Spacing, {
2234
- num: 4,
2235
- children: /* @__PURE__ */ jsx(LoadingScreen, {})
2236
- })
1736
+ })
1737
+ }) : o ? /* @__PURE__ */ r("tbody", {
1738
+ children: /* @__PURE__ */ r("tr", {
1739
+ children: /* @__PURE__ */ r("td", {
1740
+ colSpan: f,
1741
+ children: /* @__PURE__ */ r(we, {
1742
+ num: 4,
1743
+ children: /* @__PURE__ */ r(Zt, {})
2237
1744
  })
2238
1745
  })
2239
- });
2240
- }
2241
- if (!items || !items.length) {
2242
- return /* @__PURE__ */ jsx("tbody", {
2243
- children: /* @__PURE__ */ jsx("tr", {
2244
- children: /* @__PURE__ */ jsx("td", {
2245
- colSpan: totalNumColumns,
2246
- children: /* @__PURE__ */ jsx(Row, {
2247
- spacing: 4,
2248
- justifyContent: "center",
2249
- children: /* @__PURE__ */ jsx(Banner, {
2250
- text: noItemsLabel,
2251
- headerText: noItemsHeader,
2252
- contentRight: noItemsContentRight,
2253
- variant: "info",
2254
- children: noItemsContentBottom
2255
- })
1746
+ })
1747
+ }) : !s || !s.length ? /* @__PURE__ */ r("tbody", {
1748
+ children: /* @__PURE__ */ r("tr", {
1749
+ children: /* @__PURE__ */ r("td", {
1750
+ colSpan: f,
1751
+ children: /* @__PURE__ */ r(E, {
1752
+ spacing: 4,
1753
+ justifyContent: "center",
1754
+ children: /* @__PURE__ */ r(Le, {
1755
+ text: c,
1756
+ headerText: d,
1757
+ contentRight: l,
1758
+ variant: "info",
1759
+ children: i
2256
1760
  })
2257
1761
  })
2258
1762
  })
2259
- });
2260
- }
2261
- return /* @__PURE__ */ jsx("tbody", {
2262
- children: /* @__PURE__ */ jsx(StandardTableRowList, {
2263
- variant,
2264
- items,
2265
- colIndexOffset,
2266
- rowIndexOffset
1763
+ })
1764
+ }) : /* @__PURE__ */ r("tbody", {
1765
+ children: /* @__PURE__ */ r($o, {
1766
+ variant: h,
1767
+ items: s,
1768
+ colIndexOffset: u,
1769
+ rowIndexOffset: a
2267
1770
  })
2268
1771
  });
2269
- });
2270
- const useTableHeadCheckbox = (items) => {
2271
- const { keyResolver, checkboxDisabledResolver } = useStandardTableConfig();
2272
- const {
2273
- selectedIds: { selectedIds }
2274
- } = useStandardTableState();
2275
- const {
2276
- actions: { setSelectedIds, clearSelection },
2277
- dispatch
2278
- } = useStandardTableActions();
2279
- const selectionIsEmpty = selectedIds.length === 0;
2280
- const allItemsAreSelected = !items ? false : items.length > 0 && selectedIds.length === items.length;
2281
- const onClickCheckbox = useCallback(() => {
2282
- if (items) {
2283
- if (selectionIsEmpty) {
2284
- dispatch(setSelectedIds(items.filter(filterItemsOnEnabledCheckboxes(checkboxDisabledResolver)).map((item) => keyResolver(item))));
2285
- } else {
2286
- dispatch(clearSelection());
2287
- }
2288
- }
1772
+ }), Vo = (e) => {
1773
+ const { keyResolver: t, checkboxDisabledResolver: n } = R(), {
1774
+ selectedIds: { selectedIds: o }
1775
+ } = Y(), {
1776
+ actions: { setSelectedIds: s, clearSelection: c },
1777
+ dispatch: l
1778
+ } = se(), i = o.length === 0, d = e ? e.length > 0 && o.length === e.length : !1, u = I(() => {
1779
+ e && l(
1780
+ i ? s(
1781
+ e.filter(gt(n)).map((a) => t(a))
1782
+ ) : c()
1783
+ );
2289
1784
  }, [
2290
- items,
2291
- selectionIsEmpty,
2292
- dispatch,
2293
- setSelectedIds,
2294
- checkboxDisabledResolver,
2295
- keyResolver,
2296
- clearSelection
1785
+ e,
1786
+ i,
1787
+ l,
1788
+ s,
1789
+ n,
1790
+ t,
1791
+ c
2297
1792
  ]);
2298
1793
  return {
2299
- selectionIsEmpty,
2300
- allItemsAreSelected,
2301
- onClickCheckbox
1794
+ selectionIsEmpty: i,
1795
+ allItemsAreSelected: d,
1796
+ onClickCheckbox: u
2302
1797
  };
2303
- };
2304
- const useTableHeadExpandCollapse = (items) => {
2305
- const { keyResolver } = useStandardTableConfig();
2306
- const {
2307
- expandedRows: { selectedIds }
2308
- } = useStandardTableState();
2309
- const {
2310
- actions: { collapseAll, expandByIds },
2311
- dispatch
2312
- } = useStandardTableActions();
2313
- const allItemsAreExpanded = !items ? false : items.length > 0 && selectedIds.length === items.length;
2314
- const toggleExpanded = useCallback(() => {
2315
- if (items) {
2316
- if (allItemsAreExpanded) {
2317
- dispatch(collapseAll());
2318
- } else {
2319
- dispatch(expandByIds(items.map((item) => keyResolver(item))));
2320
- }
2321
- }
1798
+ }, _o = (e) => {
1799
+ const { keyResolver: t } = R(), {
1800
+ expandedRows: { selectedIds: n }
1801
+ } = Y(), {
1802
+ actions: { collapseAll: o, expandByIds: s },
1803
+ dispatch: c
1804
+ } = se(), l = e ? e.length > 0 && n.length === e.length : !1, i = I(() => {
1805
+ e && c(l ? o() : s(e.map((d) => t(d))));
2322
1806
  }, [
2323
- allItemsAreExpanded,
2324
- collapseAll,
2325
- dispatch,
2326
- items,
2327
- keyResolver,
2328
- expandByIds
1807
+ l,
1808
+ o,
1809
+ c,
1810
+ e,
1811
+ t,
1812
+ s
2329
1813
  ]);
2330
1814
  return {
2331
- allItemsAreExpanded,
2332
- toggleExpanded
1815
+ allItemsAreExpanded: l,
1816
+ toggleExpanded: i
2333
1817
  };
2334
- };
2335
- const useTableSortHeader = (columnId) => {
2336
- const { dispatch, actions } = useStandardTableActions();
2337
- const {
2338
- sortOrder: { desc, sortBy }
2339
- } = useStandardTableState();
2340
- return useMemo(() => {
2341
- const selected = columnId === sortBy;
1818
+ }, jo = (e) => {
1819
+ const { dispatch: t, actions: n } = se(), {
1820
+ sortOrder: { desc: o, sortBy: s }
1821
+ } = Y();
1822
+ return v(() => {
1823
+ const c = e === s;
2342
1824
  return {
2343
- arrow: selected ? desc ? "up" : "down" : void 0,
2344
- selected,
2345
- desc,
1825
+ arrow: c ? o ? "up" : "down" : void 0,
1826
+ selected: c,
1827
+ desc: o,
2346
1828
  onClickColumnHead: () => {
2347
- dispatch(actions.sortBy(columnId, selected ? !desc : false));
1829
+ t(n.sortBy(e, c ? !o : !1));
2348
1830
  }
2349
1831
  };
2350
- }, [sortBy, desc, actions, columnId, dispatch]);
2351
- };
2352
- const StandardTableHeadItem = React.memo(function StandardTableHeaderItem({
2353
- columnId,
2354
- borderFromGroup,
2355
- disableBorderLeft,
2356
- stickyHeader,
2357
- top
1832
+ }, [s, o, n, e, t]);
1833
+ }, Wo = T.memo(function({
1834
+ columnId: t,
1835
+ borderFromGroup: n,
1836
+ disableBorderLeft: o,
1837
+ stickyHeader: s,
1838
+ top: c
2358
1839
  }) {
2359
1840
  const {
2360
- justifyContentHeader,
2361
- columnLabel,
2362
- borderLeft,
2363
- infoIconTooltipText,
2364
- background,
2365
- zIndex,
2366
- sortOrderIconVariant,
2367
- width,
2368
- minWidth
2369
- } = useColumnConfigById(columnId);
2370
- const {
2371
- disableSorting,
2372
- sortOrderIconVariant: defaultSortOrderIconVariant
2373
- } = useStandardTableConfig();
2374
- const stickyPropsPerColumnContext = useStickyPropsPerColumnContext();
2375
- const {
2376
- arrow,
2377
- onClickColumnHead
2378
- } = useTableSortHeader(columnId);
2379
- const label = typeof columnLabel === "string" ? columnLabel : formatColumnIdToHeaderCellLabel(columnId);
2380
- const activeBorderLeft = getCellBorder(borderFromGroup, disableBorderLeft, borderLeft);
2381
- const stickyProps = stickyPropsPerColumnContext[columnId];
2382
- return /* @__PURE__ */ jsx("th", {
1841
+ justifyContentHeader: l,
1842
+ columnLabel: i,
1843
+ borderLeft: d,
1844
+ infoIconTooltipText: u,
1845
+ background: a,
1846
+ zIndex: h,
1847
+ sortOrderIconVariant: m,
1848
+ width: f,
1849
+ minWidth: w
1850
+ } = ce(t), {
1851
+ disableSorting: p,
1852
+ sortOrderIconVariant: C
1853
+ } = R(), x = Ge(), {
1854
+ arrow: b,
1855
+ onClickColumnHead: S
1856
+ } = jo(t), y = typeof i == "string" ? i : yo(t), A = Oe(n, o, d), k = x[t];
1857
+ return /* @__PURE__ */ r("th", {
2383
1858
  style: {
2384
- background: background != null ? background : "white",
2385
- borderLeft: activeBorderLeft,
2386
- position: stickyHeader || stickyProps.sticky ? "sticky" : void 0,
2387
- left: stickyProps.left,
2388
- right: stickyProps.right,
2389
- top,
2390
- boxShadow: stickyProps.sticky && stickyProps.isFirstColumnInLastGroup && stickyHeader ? "var(--swui-sticky-header-shadow-and-left)" : stickyProps.sticky && stickyProps.isFirstColumnInLastGroup ? "var(--swui-sticky-column-shadow-left)" : stickyHeader && stickyProps.sticky ? "var(--swui-sticky-header-shadow-and-right)" : stickyHeader ? "var(--swui-sticky-header-shadow)" : stickyProps.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0,
2391
- zIndex: stickyHeader && stickyProps.sticky ? "var(--swui-sticky-header-in-sticky-column-z-index)" : stickyHeader ? "var(--swui-sticky-header-z-index)" : stickyProps.sticky ? "var(--swui-sticky-group-header-z-index)" : zIndex,
2392
- width,
2393
- minWidth
1859
+ background: a != null ? a : "white",
1860
+ borderLeft: A,
1861
+ position: s || k.sticky ? "sticky" : void 0,
1862
+ left: k.left,
1863
+ right: k.right,
1864
+ top: c,
1865
+ boxShadow: k.sticky && k.isFirstColumnInLastGroup && s ? "var(--swui-sticky-header-shadow-and-left)" : k.sticky && k.isFirstColumnInLastGroup ? "var(--swui-sticky-column-shadow-left)" : s && k.sticky ? "var(--swui-sticky-header-shadow-and-right)" : s ? "var(--swui-sticky-header-shadow)" : k.sticky ? "var(--swui-sticky-column-shadow-right)" : void 0,
1866
+ zIndex: s && k.sticky ? "var(--swui-sticky-header-in-sticky-column-z-index)" : s ? "var(--swui-sticky-header-z-index)" : k.sticky ? "var(--swui-sticky-group-header-z-index)" : h,
1867
+ width: f,
1868
+ minWidth: w
2394
1869
  },
2395
- children: /* @__PURE__ */ jsx(TableHeadItem, {
1870
+ children: /* @__PURE__ */ r(Ee, {
2396
1871
  width: "inherit",
2397
1872
  minWidth: "inherit",
2398
- arrow: !disableSorting && label ? arrow : void 0,
2399
- onClick: !disableSorting ? onClickColumnHead : void 0,
2400
- label,
2401
- infoIconTooltipText,
2402
- alignRight: justifyContentHeader === "flex-end",
2403
- sortOrderIconVariant: sortOrderIconVariant != null ? sortOrderIconVariant : defaultSortOrderIconVariant
1873
+ arrow: !p && y ? b : void 0,
1874
+ onClick: p ? void 0 : S,
1875
+ label: y,
1876
+ infoIconTooltipText: u,
1877
+ alignRight: l === "flex-end",
1878
+ sortOrderIconVariant: m != null ? m : C
2404
1879
  })
2405
1880
  });
2406
- });
2407
- const getTopPosition = (headerRowOffsetTop, columnGroupOrder, height, stickyHeader) => {
2408
- if (headerRowOffsetTop && columnGroupOrder !== void 0) {
2409
- return `calc(${headerRowOffsetTop} + ${height})`;
2410
- } else if (stickyHeader && columnGroupOrder) {
2411
- return `calc(0px + ${height})`;
2412
- } else if (headerRowOffsetTop) {
2413
- return headerRowOffsetTop;
2414
- } else if (stickyHeader) {
1881
+ }), qo = (e, t, n, o) => {
1882
+ if (e && t !== void 0)
1883
+ return `calc(${e} + ${n})`;
1884
+ if (o && t)
1885
+ return `calc(0px + ${n})`;
1886
+ if (e)
1887
+ return e;
1888
+ if (o)
2415
1889
  return 0;
2416
- }
2417
- return void 0;
2418
- };
2419
- const StandardTableHeadRow = React.memo(function StandardTableHeadRow2({
2420
- items,
2421
- height = defaultTableRowHeight
1890
+ }, Fo = T.memo(function({
1891
+ items: t,
1892
+ height: n = Se
2422
1893
  }) {
2423
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
2424
- const {
2425
- showHeaderCheckbox,
2426
- showHeaderExpandCollapse,
2427
- enableExpandCollapse,
2428
- rowIndent,
2429
- headerRowOffsetTop,
2430
- zIndex,
2431
- stickyHeader,
2432
- stickyCheckboxColumn,
2433
- showRowCheckbox
2434
- } = useStandardTableConfig();
2435
- const columnGroupOrder = useColumnGroupOrderContext();
2436
- const {
2437
- allItemsAreExpanded,
2438
- toggleExpanded
2439
- } = useTableHeadExpandCollapse(items);
2440
- const {
2441
- allItemsAreSelected,
2442
- onClickCheckbox,
2443
- selectionIsEmpty
2444
- } = useTableHeadCheckbox(items);
2445
- const checkboxDisabled = !items || items.length === 0;
2446
- const stickyHeaderStyle = {
2447
- zIndex: stickyHeader && stickyCheckboxColumn ? "var(--swui-sticky-header-in-sticky-column-z-index)" : stickyCheckboxColumn ? "var(--swui-sticky-group-header-z-index)" : stickyHeader ? "var(--swui-sticky-header-z-index)" : zIndex,
2448
- top: getTopPosition(headerRowOffsetTop, columnGroupOrder, height, stickyHeader),
2449
- background: stickyHeader || stickyCheckboxColumn ? "white" : void 0,
2450
- position: stickyHeader || stickyCheckboxColumn ? "sticky" : void 0,
2451
- boxShadow: stickyHeader && stickyCheckboxColumn ? "var(--swui-sticky-header-shadow-and-right)" : stickyCheckboxColumn ? "var(--swui-sticky-column-shadow-right)" : stickyHeader ? "var(--swui-sticky-header-shadow)" : void 0
1894
+ const o = Z(), {
1895
+ showHeaderCheckbox: s,
1896
+ showHeaderExpandCollapse: c,
1897
+ enableExpandCollapse: l,
1898
+ rowIndent: i,
1899
+ headerRowOffsetTop: d,
1900
+ zIndex: u,
1901
+ stickyHeader: a,
1902
+ stickyCheckboxColumn: h,
1903
+ showRowCheckbox: m
1904
+ } = R(), f = Dn(), {
1905
+ allItemsAreExpanded: w,
1906
+ toggleExpanded: p
1907
+ } = _o(t), {
1908
+ allItemsAreSelected: C,
1909
+ onClickCheckbox: x,
1910
+ selectionIsEmpty: b
1911
+ } = Vo(t), S = !t || t.length === 0, y = {
1912
+ zIndex: a && h ? "var(--swui-sticky-header-in-sticky-column-z-index)" : h ? "var(--swui-sticky-group-header-z-index)" : a ? "var(--swui-sticky-header-z-index)" : u,
1913
+ top: qo(d, f, n, a),
1914
+ background: a || h ? "white" : void 0,
1915
+ position: a || h ? "sticky" : void 0,
1916
+ boxShadow: a && h ? "var(--swui-sticky-header-shadow-and-right)" : h ? "var(--swui-sticky-column-shadow-right)" : a ? "var(--swui-sticky-header-shadow)" : void 0
2452
1917
  };
2453
- return /* @__PURE__ */ jsxs(TrWithHoverBackground, {
2454
- height,
2455
- borderLeft: tableBorderLeft,
2456
- children: [rowIndent && /* @__PURE__ */ jsx("th", {
2457
- style: stickyHeaderStyle,
2458
- children: /* @__PURE__ */ jsx(Row, {
2459
- indent: rowIndent
1918
+ return /* @__PURE__ */ g(xt, {
1919
+ height: n,
1920
+ borderLeft: ke,
1921
+ children: [i && /* @__PURE__ */ r("th", {
1922
+ style: y,
1923
+ children: /* @__PURE__ */ r(E, {
1924
+ indent: i
2460
1925
  })
2461
- }), enableExpandCollapse && /* @__PURE__ */ jsx("th", {
1926
+ }), l && /* @__PURE__ */ r("th", {
2462
1927
  style: {
2463
- ...stickyHeaderStyle,
1928
+ ...y,
2464
1929
  left: "0px",
2465
1930
  textAlign: "left"
2466
1931
  },
2467
- children: /* @__PURE__ */ jsx(Row, {
1932
+ children: /* @__PURE__ */ r(E, {
2468
1933
  width: "var(--swui-expand-cell-width)",
2469
1934
  minWidth: "var(--swui-expand-cell-width)",
2470
1935
  alignItems: "center",
2471
1936
  justifyContent: "center",
2472
- children: showHeaderExpandCollapse && /* @__PURE__ */ jsx(FlatButton, {
1937
+ children: c && /* @__PURE__ */ r(xe, {
2473
1938
  size: "small",
2474
- leftIcon: allItemsAreExpanded ? faChevronDown : faChevronRight,
2475
- onClick: toggleExpanded
1939
+ leftIcon: w ? Ze : Je,
1940
+ onClick: p
2476
1941
  })
2477
1942
  })
2478
- }), (showRowCheckbox || showHeaderCheckbox) && /* @__PURE__ */ jsx("th", {
1943
+ }), (m || s) && /* @__PURE__ */ r("th", {
2479
1944
  style: {
2480
- ...stickyHeaderStyle,
1945
+ ...y,
2481
1946
  overflow: "hidden",
2482
- left: stickyCheckboxColumn && enableExpandCollapse ? "var(--swui-expand-cell-width)" : stickyCheckboxColumn ? "0px" : void 0
1947
+ left: h && l ? "var(--swui-expand-cell-width)" : h ? "0px" : void 0
2483
1948
  },
2484
- children: /* @__PURE__ */ jsx(Row, {
1949
+ children: /* @__PURE__ */ r(E, {
2485
1950
  width: "var(--swui-checkbox-cell-width)",
2486
1951
  minWidth: "var(--swui-checkbox-cell-width)",
2487
1952
  alignItems: "center",
2488
1953
  justifyContent: "center",
2489
- children: showHeaderCheckbox && /* @__PURE__ */ jsx(Checkbox, {
1954
+ children: s && /* @__PURE__ */ r(Ue, {
2490
1955
  size: "small",
2491
- disabled: checkboxDisabled,
2492
- value: allItemsAreSelected,
2493
- indeterminate: !selectionIsEmpty && !allItemsAreSelected,
2494
- onValueChange: onClickCheckbox
1956
+ disabled: S,
1957
+ value: C,
1958
+ indeterminate: !b && !C,
1959
+ onValueChange: x
2495
1960
  })
2496
1961
  })
2497
- }), groupConfigsAndIds.map(({
2498
- groupConfig,
2499
- groupId
2500
- }, groupIndex) => {
2501
- return /* @__PURE__ */ jsx(React.Fragment, {
2502
- children: groupConfig.columnOrder.map((columnId, index) => {
2503
- return /* @__PURE__ */ jsx(StandardTableHeadItem, {
2504
- columnId,
2505
- borderFromGroup: getCellBorderFromGroup(groupIndex, index, groupConfig.borderLeft),
2506
- disableBorderLeft: groupIndex === 0 && index === 0,
2507
- stickyHeader,
2508
- top: stickyHeaderStyle.top
2509
- }, columnId);
2510
- })
2511
- }, groupId);
2512
- }), rowIndent && /* @__PURE__ */ jsx("th", {
2513
- style: stickyHeaderStyle,
2514
- children: /* @__PURE__ */ jsx(Row, {
2515
- indent: rowIndent
1962
+ }), o.map(({
1963
+ groupConfig: A,
1964
+ groupId: k
1965
+ }, L) => /* @__PURE__ */ r(T.Fragment, {
1966
+ children: A.columnOrder.map((O, z) => /* @__PURE__ */ r(Wo, {
1967
+ columnId: O,
1968
+ borderFromGroup: pe(L, z, A.borderLeft),
1969
+ disableBorderLeft: L === 0 && z === 0,
1970
+ stickyHeader: a,
1971
+ top: y.top
1972
+ }, O))
1973
+ }, k)), i && /* @__PURE__ */ r("th", {
1974
+ style: y,
1975
+ children: /* @__PURE__ */ r(E, {
1976
+ indent: i
2516
1977
  })
2517
- }), /* @__PURE__ */ jsx("th", {
2518
- style: stickyHeaderStyle
1978
+ }), /* @__PURE__ */ r("th", {
1979
+ style: y
2519
1980
  })]
2520
1981
  });
2521
- });
2522
- const ColGroups = () => {
2523
- const config = useStandardTableConfig();
2524
- const groupConfigsAndIds = useGroupConfigsAndIdsForRows();
2525
- const hasExtraColGroup = config.enableExpandCollapse || config.showRowCheckbox;
2526
- const rowIndent = booleanOrNumberToNumber(config.rowIndent);
2527
- return /* @__PURE__ */ jsxs(Fragment, {
2528
- children: [rowIndent ? /* @__PURE__ */ jsx("colgroup", {
2529
- children: /* @__PURE__ */ jsx("col", {
1982
+ }), Uo = () => {
1983
+ const e = R(), t = Z(), n = e.enableExpandCollapse || e.showRowCheckbox, o = Lt(e.rowIndent);
1984
+ return /* @__PURE__ */ g(G, {
1985
+ children: [o ? /* @__PURE__ */ r("colgroup", {
1986
+ children: /* @__PURE__ */ r("col", {
2530
1987
  style: {
2531
- width: `calc(var(--swui-metrics-indent) * ${rowIndent})`
1988
+ width: `calc(var(--swui-metrics-indent) * ${o})`
2532
1989
  }
2533
1990
  })
2534
- }) : null, hasExtraColGroup && /* @__PURE__ */ jsxs("colgroup", {
2535
- children: [config.enableExpandCollapse && /* @__PURE__ */ jsx("col", {
1991
+ }) : null, n && /* @__PURE__ */ g("colgroup", {
1992
+ children: [e.enableExpandCollapse && /* @__PURE__ */ r("col", {
2536
1993
  style: {
2537
1994
  width: "var(--swui-expand-cell-width)"
2538
1995
  }
2539
- }), config.showRowCheckbox && /* @__PURE__ */ jsx("col", {
1996
+ }), e.showRowCheckbox && /* @__PURE__ */ r("col", {
2540
1997
  style: {
2541
1998
  width: "var(--swui-checkbox-cell-width)"
2542
1999
  }
2543
2000
  })]
2544
- }), groupConfigsAndIds.map(({
2545
- groupConfig,
2546
- groupId
2547
- }) => /* @__PURE__ */ jsx("colgroup", {
2548
- children: groupConfig.columnOrder.map((columnId) => /* @__PURE__ */ jsx("col", {
2001
+ }), t.map(({
2002
+ groupConfig: s,
2003
+ groupId: c
2004
+ }) => /* @__PURE__ */ r("colgroup", {
2005
+ children: s.columnOrder.map((l) => /* @__PURE__ */ r("col", {
2549
2006
  style: {
2550
- width: config.columns[columnId].width,
2551
- minWidth: config.columns[columnId].minWidth
2007
+ width: e.columns[l].width,
2008
+ minWidth: e.columns[l].minWidth
2552
2009
  }
2553
- }, columnId))
2554
- }, groupId)), rowIndent ? /* @__PURE__ */ jsx("colgroup", {
2555
- children: /* @__PURE__ */ jsx("col", {
2010
+ }, l))
2011
+ }, c)), o ? /* @__PURE__ */ r("colgroup", {
2012
+ children: /* @__PURE__ */ r("col", {
2556
2013
  style: {
2557
- width: `calc(var(--swui-metrics-indent) * ${rowIndent})`
2014
+ width: `calc(var(--swui-metrics-indent) * ${o})`
2558
2015
  }
2559
2016
  })
2560
2017
  }) : null]
2561
2018
  });
2562
- };
2563
- const StandardTable = function StandardTable2({
2564
- tableContext,
2565
- config,
2566
- columnOrder,
2567
- columnGroupOrder,
2568
- tableId,
2569
- variant = "standard",
2570
- onKeyDown,
2571
- ...props
2019
+ }, Rr = function({
2020
+ tableContext: t,
2021
+ config: n,
2022
+ columnOrder: o,
2023
+ columnGroupOrder: s,
2024
+ tableId: c,
2025
+ variant: l = "standard",
2026
+ onKeyDown: i,
2027
+ ...d
2572
2028
  }) {
2573
- const generatedTableId = useId();
2574
- const {
2575
- initialSortOrderDesc,
2576
- initialSortOrder,
2577
- enableExpandCollapse,
2578
- stickyCheckboxColumn
2579
- } = config;
2580
- const {
2581
- tableContext: localTableContext
2582
- } = useLocalStateTableContext(tableId != null ? tableId : generatedTableId, createStandardTableInitialState(initialSortOrder, initialSortOrderDesc));
2583
- const currentTableContext = tableContext || localTableContext;
2584
- const {
2585
- state,
2586
- actions,
2587
- dispatch
2588
- } = currentTableContext;
2589
- const actionsContext = useMemo(() => ({
2590
- actions,
2591
- dispatch
2592
- }), [actions, dispatch]);
2593
- const usingColumnGroups = Boolean(columnGroupOrder != null ? columnGroupOrder : "columnGroupOrder" in config);
2594
- const columnGroupsFromConfig = "columnGroups" in config ? config.columnGroups : void 0;
2595
- const columnGroupOrderFromConfig = "columnGroupOrder" in config ? config.columnGroupOrder : void 0;
2596
- const columnOrderFromConfig = "columnOrder" in config ? config.columnOrder : void 0;
2597
- const groupConfigsForRows = useMemo(() => createGroupConfigAndIdsForRows(columnGroupsFromConfig, columnGroupOrderFromConfig, columnOrderFromConfig), [columnGroupsFromConfig, columnGroupOrderFromConfig, columnOrderFromConfig]);
2598
- const columnIndexPerColumnId = useMemo(() => calculateColumnIndexPerColumnId(config), [config]);
2599
- const totalNumColumns = useMemo(() => getTotalNumColumns(config), [config]);
2600
- const stickyPropsPerColumnContext = useMemo(() => getStickyPropsPerColumn(config), [config]);
2601
- const validationError = useMemo(() => {
2029
+ const u = Et(), {
2030
+ initialSortOrderDesc: a,
2031
+ initialSortOrder: h,
2032
+ enableExpandCollapse: m,
2033
+ stickyCheckboxColumn: f
2034
+ } = n, {
2035
+ tableContext: w
2036
+ } = no(c != null ? c : u, at(h, a)), p = t || w, {
2037
+ state: C,
2038
+ actions: x,
2039
+ dispatch: b
2040
+ } = p, S = v(() => ({
2041
+ actions: x,
2042
+ dispatch: b
2043
+ }), [x, b]), y = Boolean(s != null ? s : "columnGroupOrder" in n), A = "columnGroups" in n ? n.columnGroups : void 0, k = "columnGroupOrder" in n ? n.columnGroupOrder : void 0, L = "columnOrder" in n ? n.columnOrder : void 0, O = v(() => wt(A, k, L), [A, k, L]), z = v(() => jn(n), [n]), D = v(() => oo(n), [n]), j = v(() => Yn(n), [n]), K = v(() => {
2602
2044
  try {
2603
- ensureConfigHasValidSticky(config);
2604
- return void 0;
2605
- } catch (e) {
2606
- if (e instanceof Error) {
2607
- return e;
2608
- }
2609
- return new Error("Unknown error");
2045
+ qn(n);
2046
+ return;
2047
+ } catch (H) {
2048
+ return H instanceof Error ? H : new Error("Unknown error");
2610
2049
  }
2611
- }, [config]);
2612
- if (validationError) {
2613
- return /* @__PURE__ */ jsx(ErrorScreen, {
2614
- text: validationError.message
2615
- });
2616
- }
2617
- return /* @__PURE__ */ jsx("table", {
2618
- className: cx(styles$3.standardTable, styles$3[variant]),
2050
+ }, [n]);
2051
+ return K ? /* @__PURE__ */ r(Jt, {
2052
+ text: K.message
2053
+ }) : /* @__PURE__ */ r("table", {
2054
+ className: Fe(Ve.standardTable, Ve[l]),
2619
2055
  style: {
2620
2056
  width: "100%",
2621
2057
  isolation: "isolate",
2622
- "--current-left-offset": enableExpandCollapse && stickyCheckboxColumn ? "calc(var(--swui-expand-cell-width) + var(--swui-checkbox-cell-width))" : stickyCheckboxColumn ? "var(--swui-checkbox-cell-width)" : enableExpandCollapse ? "var(--swui-expand-cell-width)" : "0px"
2058
+ "--current-left-offset": m && f ? "calc(var(--swui-expand-cell-width) + var(--swui-checkbox-cell-width))" : f ? "var(--swui-checkbox-cell-width)" : m ? "var(--swui-expand-cell-width)" : "0px"
2623
2059
  },
2624
- children: /* @__PURE__ */ jsx(StickyPropsPerColumnContext.Provider, {
2625
- value: stickyPropsPerColumnContext,
2626
- children: /* @__PURE__ */ jsx(TotalNumColumnsContext.Provider, {
2627
- value: totalNumColumns,
2628
- children: /* @__PURE__ */ jsx(StandardTableVariantContext.Provider, {
2629
- value: variant,
2630
- children: /* @__PURE__ */ jsx(StandardTableTableIdContext.Provider, {
2631
- value: tableId != null ? tableId : generatedTableId,
2632
- children: /* @__PURE__ */ jsx(StandardTableStateContext.Provider, {
2633
- value: state,
2634
- children: /* @__PURE__ */ jsx(StandardTableActionsContext.Provider, {
2635
- value: actionsContext,
2636
- children: /* @__PURE__ */ jsx(StandardTableConfigContext.Provider, {
2637
- value: config,
2638
- children: /* @__PURE__ */ jsx(GroupConfigsAndIdsForRowsContext.Provider, {
2639
- value: groupConfigsForRows,
2640
- children: /* @__PURE__ */ jsx(ColumnIndexPerColumnIdContext.Provider, {
2641
- value: columnIndexPerColumnId,
2642
- children: /* @__PURE__ */ jsx(StandardTableUsingColumnGroupsContext.Provider, {
2643
- value: usingColumnGroups,
2644
- children: /* @__PURE__ */ jsxs(StandardTableColumnGroupOrderContext.Provider, {
2645
- value: "columnGroupOrder" in config ? columnGroupOrder != null ? columnGroupOrder : config.columnGroupOrder : columnGroupOrder,
2646
- children: [/* @__PURE__ */ jsx(ColGroups, {}), /* @__PURE__ */ jsxs(OnKeyDownContext.Provider, {
2647
- value: onKeyDown,
2648
- children: [/* @__PURE__ */ jsxs("thead", {
2649
- children: [(columnGroupOrder || "columnGroupOrder" in config) && /* @__PURE__ */ jsx(ColumnGroupRow, {
2060
+ children: /* @__PURE__ */ r(mt.Provider, {
2061
+ value: j,
2062
+ children: /* @__PURE__ */ r(ft.Provider, {
2063
+ value: D,
2064
+ children: /* @__PURE__ */ r(Nn.Provider, {
2065
+ value: l,
2066
+ children: /* @__PURE__ */ r(st.Provider, {
2067
+ value: c != null ? c : u,
2068
+ children: /* @__PURE__ */ r(ct.Provider, {
2069
+ value: C,
2070
+ children: /* @__PURE__ */ r(lt.Provider, {
2071
+ value: S,
2072
+ children: /* @__PURE__ */ r(it.Provider, {
2073
+ value: n,
2074
+ children: /* @__PURE__ */ r(dt.Provider, {
2075
+ value: O,
2076
+ children: /* @__PURE__ */ r(Ct.Provider, {
2077
+ value: z,
2078
+ children: /* @__PURE__ */ r(Bn.Provider, {
2079
+ value: y,
2080
+ children: /* @__PURE__ */ g(pt.Provider, {
2081
+ value: "columnGroupOrder" in n ? s != null ? s : n.columnGroupOrder : s,
2082
+ children: [/* @__PURE__ */ r(Uo, {}), /* @__PURE__ */ g(ht.Provider, {
2083
+ value: i,
2084
+ children: [/* @__PURE__ */ g("thead", {
2085
+ children: [(s || "columnGroupOrder" in n) && /* @__PURE__ */ r(_n, {
2650
2086
  height: "var(--current-row-height)"
2651
- }), /* @__PURE__ */ jsx(StandardTableHeadRow, {
2652
- items: props.items,
2087
+ }), /* @__PURE__ */ r(Fo, {
2088
+ items: d.items,
2653
2089
  height: "var(--current-row-height)"
2654
2090
  })]
2655
- }), /* @__PURE__ */ jsx(StandardTableContent, {
2656
- variant,
2657
- ...props
2091
+ }), /* @__PURE__ */ r(Mo, {
2092
+ variant: l,
2093
+ ...d
2658
2094
  })]
2659
2095
  })]
2660
2096
  })
@@ -2669,74 +2105,136 @@ const StandardTable = function StandardTable2({
2669
2105
  })
2670
2106
  })
2671
2107
  });
2672
- };
2673
- const createColumnConfig = (itemValueResolver, options) => {
2674
- return {
2675
- ...options,
2676
- itemValueResolver
2677
- };
2678
- };
2679
- const createStandardEditableTextCell = () => ({
2680
- label,
2108
+ }, Gr = (e, t) => ({
2109
+ ...t,
2110
+ itemValueResolver: e
2111
+ }), Tr = () => ({
2112
+ label: e,
2681
2113
  gridCell: {
2682
- editorValue,
2683
- isEditing,
2684
- setEditorValue,
2685
- stopEditingAndRevert,
2686
- lastKeyEvent,
2687
- stopEditing,
2688
- stopEditingAndMove
2689
- }
2690
- }) => isEditing ? /* @__PURE__ */ jsx(TextInput, {
2691
- onValueChange: setEditorValue,
2692
- value: editorValue,
2693
- onDone: stopEditing,
2694
- onEsc: stopEditingAndRevert,
2695
- autoFocus: true,
2696
- selectAllOnMount: !lastKeyEvent,
2697
- onMove: stopEditingAndMove
2698
- }) : /* @__PURE__ */ jsx(Indent, {
2699
- children: /* @__PURE__ */ jsx(Text, {
2114
+ editorValue: t,
2115
+ isEditing: n,
2116
+ setEditorValue: o,
2117
+ stopEditingAndRevert: s,
2118
+ lastKeyEvent: c,
2119
+ stopEditing: l,
2120
+ stopEditingAndMove: i
2121
+ }
2122
+ }) => n ? /* @__PURE__ */ r(ge, {
2123
+ onValueChange: o,
2124
+ value: t,
2125
+ onDone: l,
2126
+ onEsc: s,
2127
+ autoFocus: !0,
2128
+ selectAllOnMount: !c,
2129
+ onMove: i
2130
+ }) : /* @__PURE__ */ r(N, {
2131
+ children: /* @__PURE__ */ r(U, {
2700
2132
  color: "var(--swui-primary-action-color)",
2701
- children: label
2133
+ children: e
2702
2134
  })
2703
- });
2704
- const createEditableTextCellWithStatus = (warningOnEmpty, crudStatusProvider, modifiedFieldProvider) => ({
2705
- label,
2706
- item,
2135
+ }), Or = (e, t, n) => ({
2136
+ label: o,
2137
+ item: s,
2707
2138
  gridCell: {
2708
- editorValue,
2709
- isEditing,
2710
- setEditorValue,
2711
- stopEditingAndRevert,
2712
- lastKeyEvent,
2713
- stopEditing,
2714
- stopEditingAndMove
2139
+ editorValue: c,
2140
+ isEditing: l,
2141
+ setEditorValue: i,
2142
+ stopEditingAndRevert: d,
2143
+ lastKeyEvent: u,
2144
+ stopEditing: a,
2145
+ stopEditingAndMove: h
2715
2146
  },
2716
- isEditable
2147
+ isEditable: m
2717
2148
  }) => {
2718
- const warnOnEmpty = typeof warningOnEmpty === "function" ? warningOnEmpty(item) : warningOnEmpty;
2719
- const crudStatus = crudStatusProvider ? crudStatusProvider(item) : void 0;
2720
- const modifiedField = modifiedFieldProvider ? modifiedFieldProvider(item) : void 0;
2721
- return isEditable && isEditing ? /* @__PURE__ */ jsx(TextInput, {
2722
- onValueChange: setEditorValue,
2723
- value: editorValue,
2724
- onDone: stopEditing,
2725
- onEsc: stopEditingAndRevert,
2726
- autoFocus: true,
2727
- selectAllOnMount: !lastKeyEvent,
2728
- onMove: stopEditingAndMove
2729
- }) : /* @__PURE__ */ jsx(Indent, {
2730
- row: true,
2149
+ const f = typeof e == "function" ? e(s) : e, w = t ? t(s) : void 0, p = n ? n(s) : void 0;
2150
+ return m && l ? /* @__PURE__ */ r(ge, {
2151
+ onValueChange: i,
2152
+ value: c,
2153
+ onDone: a,
2154
+ onEsc: d,
2155
+ autoFocus: !0,
2156
+ selectAllOnMount: !u,
2157
+ onMove: h
2158
+ }) : /* @__PURE__ */ r(N, {
2159
+ row: !0,
2731
2160
  alignItems: "center",
2732
- children: /* @__PURE__ */ jsx(ModifiedField, {
2733
- value: label,
2734
- modifiedField,
2735
- crudStatus,
2736
- isEditable,
2737
- warningOnEmpty: warnOnEmpty
2161
+ children: /* @__PURE__ */ r(tn, {
2162
+ value: o,
2163
+ modifiedField: p,
2164
+ crudStatus: w,
2165
+ isEditable: m,
2166
+ warningOnEmpty: f
2738
2167
  })
2739
2168
  });
2740
2169
  };
2741
- export { CrudStatusIndicator, EditableTextCellWithCrudAndModified, GridHooksContext, GridHooksTable, ModifiedField, SmallTableCell, SmallTableHead, StandardTable, StandardTableActionsContext, StandardTableCell, StandardTableCellUi, StandardTableConfigContext, StandardTableContent, StandardTableHeadRow, StandardTableRow, StandardTableRowCheckbox, StandardTableRowList, StandardTableStateContext, StandardTableTableIdContext, TableCell, TableColumnGroupHead, TableHeadItem, TableHeadRow, TableRow, TextCell, createColumnConfig, createEditableTextCellWithStatus, createGroupConfigAndIdsForRows, createInternalStandardTableActions, createStandardEditableTextCell, createStandardTableActions, createStandardTableInitialState, createStandardTableReducer, defaultTableHeadRowHeight, defaultTableRowHeight, focusOnCell, formatColumnIdToHeaderCellLabel, formatValueLabel, hasIndicatorContent, multitypeComparator, smallTableRowWidth, tableBackgroundColorExpanded, tableBackgroundHoverColorExpanded, tableBorder, tableBorderColor, tableBorderColorExpanded, tableBorderHidden, tableBorderLeft, tableBorderLeftExpanded, useCellBackgroundByColumnConfig, useCellBackgroundByColumnId, useColumnConfigById, useColumnValueResolver, useEditableCell, useFirstColumnConfig, useGridCell, useGridNavigation, useGridNavigationOptionsFromContext, useLastColumnConfig, useLocalStateTableContext, useRevertableValue, useRowCheckbox, useStandardTableActions, useStandardTableConfig, useStandardTableId, useStandardTableState, useTableHeadCheckbox, useTableSortHeader };
2170
+ export {
2171
+ Ye as CrudStatusIndicator,
2172
+ Er as EditableTextCellWithCrudAndModified,
2173
+ Xe as GridHooksContext,
2174
+ xr as GridHooksTable,
2175
+ tn as ModifiedField,
2176
+ gr as SmallTableCell,
2177
+ br as SmallTableHead,
2178
+ Rr as StandardTable,
2179
+ lt as StandardTableActionsContext,
2180
+ Eo as StandardTableCell,
2181
+ bo as StandardTableCellUi,
2182
+ it as StandardTableConfigContext,
2183
+ Mo as StandardTableContent,
2184
+ Fo as StandardTableHeadRow,
2185
+ Go as StandardTableRow,
2186
+ ho as StandardTableRowCheckbox,
2187
+ $o as StandardTableRowList,
2188
+ ct as StandardTableStateContext,
2189
+ st as StandardTableTableIdContext,
2190
+ nn as TableCell,
2191
+ kr as TableColumnGroupHead,
2192
+ Ee as TableHeadItem,
2193
+ Sr as TableHeadRow,
2194
+ Ir as TableRow,
2195
+ Io as TextCell,
2196
+ Gr as createColumnConfig,
2197
+ Or as createEditableTextCellWithStatus,
2198
+ wt as createGroupConfigAndIdsForRows,
2199
+ Pn as createInternalStandardTableActions,
2200
+ Tr as createStandardEditableTextCell,
2201
+ to as createStandardTableActions,
2202
+ at as createStandardTableInitialState,
2203
+ An as createStandardTableReducer,
2204
+ Ie as defaultTableHeadRowHeight,
2205
+ Se as defaultTableRowHeight,
2206
+ rt as focusOnCell,
2207
+ yo as formatColumnIdToHeaderCellLabel,
2208
+ vo as formatValueLabel,
2209
+ be as hasIndicatorContent,
2210
+ ao as multitypeComparator,
2211
+ tt as smallTableRowWidth,
2212
+ Qe as tableBackgroundColorExpanded,
2213
+ sn as tableBackgroundHoverColorExpanded,
2214
+ oe as tableBorder,
2215
+ on as tableBorderColor,
2216
+ rn as tableBorderColorExpanded,
2217
+ cn as tableBorderHidden,
2218
+ ke as tableBorderLeft,
2219
+ et as tableBorderLeftExpanded,
2220
+ _e as useCellBackgroundByColumnConfig,
2221
+ Co as useCellBackgroundByColumnId,
2222
+ ce as useColumnConfigById,
2223
+ uo as useColumnValueResolver,
2224
+ mn as useEditableCell,
2225
+ zn as useFirstColumnConfig,
2226
+ he as useGridCell,
2227
+ Gn as useGridNavigation,
2228
+ nt as useGridNavigationOptionsFromContext,
2229
+ Kn as useLastColumnConfig,
2230
+ no as useLocalStateTableContext,
2231
+ un as useRevertableValue,
2232
+ mo as useRowCheckbox,
2233
+ se as useStandardTableActions,
2234
+ R as useStandardTableConfig,
2235
+ Re as useStandardTableId,
2236
+ Y as useStandardTableState,
2237
+ Vo as useTableHeadCheckbox,
2238
+ jo as useTableSortHeader
2239
+ };
2742
2240
  //# sourceMappingURL=index.es.js.map