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