@osdk/react-components 0.2.0-beta.16 → 0.2.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +5 -3
- package/build/browser/base-components/tooltip/Tooltip.js +91 -0
- package/build/browser/base-components/tooltip/Tooltip.js.map +1 -0
- package/build/browser/base-components/tooltip/Tooltip.module.css +70 -0
- package/build/browser/base-components/tooltip/Tooltip.module.css.js +11 -0
- package/build/browser/base-components/tooltip/index.js +18 -0
- package/build/browser/base-components/tooltip/index.js.map +1 -0
- package/build/browser/filter-list/hooks/useFilterListState.js +5 -6
- package/build/browser/filter-list/hooks/useFilterListState.js.map +1 -1
- package/build/browser/filter-list/utils/filterStateToWhereClause.js +18 -3
- package/build/browser/filter-list/utils/filterStateToWhereClause.js.map +1 -1
- package/build/browser/object-table/DefaultCellRenderer.js +6 -1
- package/build/browser/object-table/DefaultCellRenderer.js.map +1 -1
- package/build/browser/object-table/EditableCell.js +76 -9
- package/build/browser/object-table/EditableCell.js.map +1 -1
- package/build/browser/object-table/EditableCell.module.css +47 -8
- package/build/browser/object-table/EditableCell.module.css.js +5 -1
- package/build/browser/object-table/MultiColumnSortDialog.js +4 -1
- package/build/browser/object-table/MultiColumnSortDialog.js.map +1 -1
- package/build/browser/object-table/ObjectTable.js +4 -1
- package/build/browser/object-table/ObjectTable.js.map +1 -1
- package/build/browser/object-table/ObjectTableApi.js.map +1 -1
- package/build/browser/object-table/SelectionCells.js +1 -0
- package/build/browser/object-table/SelectionCells.js.map +1 -1
- package/build/browser/object-table/Table.js +2 -2
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/TableBody.js +1 -1
- package/build/browser/object-table/TableBody.js.map +1 -1
- package/build/browser/object-table/TableEditContainer.js +27 -16
- package/build/browser/object-table/TableEditContainer.js.map +1 -1
- package/build/browser/object-table/TableEditContainer.module.css +27 -0
- package/build/browser/object-table/TableEditContainer.module.css.js +5 -1
- package/build/browser/object-table/TableRow.js +2 -2
- package/build/browser/object-table/TableRow.js.map +1 -1
- package/build/browser/object-table/hooks/useColumnDefs.js +2 -1
- package/build/browser/object-table/hooks/useColumnDefs.js.map +1 -1
- package/build/browser/object-table/hooks/useEditableTable.js +21 -2
- package/build/browser/object-table/hooks/useEditableTable.js.map +1 -1
- package/build/browser/object-table/utils/types.js.map +1 -1
- package/build/browser/styles.css +147 -8
- package/build/cjs/public/experimental.cjs +969 -772
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +103 -8
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +18 -4
- package/build/esm/base-components/tooltip/Tooltip.js +91 -0
- package/build/esm/base-components/tooltip/Tooltip.js.map +1 -0
- package/build/esm/base-components/tooltip/Tooltip.module.css +70 -0
- package/build/esm/base-components/tooltip/index.js +18 -0
- package/build/esm/base-components/tooltip/index.js.map +1 -0
- package/build/esm/filter-list/hooks/useFilterListState.js +5 -6
- package/build/esm/filter-list/hooks/useFilterListState.js.map +1 -1
- package/build/esm/filter-list/utils/filterStateToWhereClause.js +18 -3
- package/build/esm/filter-list/utils/filterStateToWhereClause.js.map +1 -1
- package/build/esm/object-table/DefaultCellRenderer.js +6 -1
- package/build/esm/object-table/DefaultCellRenderer.js.map +1 -1
- package/build/esm/object-table/EditableCell.js +76 -9
- package/build/esm/object-table/EditableCell.js.map +1 -1
- package/build/esm/object-table/EditableCell.module.css +47 -8
- package/build/esm/object-table/MultiColumnSortDialog.js +4 -1
- package/build/esm/object-table/MultiColumnSortDialog.js.map +1 -1
- package/build/esm/object-table/ObjectTable.js +4 -1
- package/build/esm/object-table/ObjectTable.js.map +1 -1
- package/build/esm/object-table/ObjectTableApi.js.map +1 -1
- package/build/esm/object-table/SelectionCells.js +1 -0
- package/build/esm/object-table/SelectionCells.js.map +1 -1
- package/build/esm/object-table/Table.js +2 -2
- package/build/esm/object-table/Table.js.map +1 -1
- package/build/esm/object-table/TableBody.js +1 -1
- package/build/esm/object-table/TableBody.js.map +1 -1
- package/build/esm/object-table/TableEditContainer.js +27 -16
- package/build/esm/object-table/TableEditContainer.js.map +1 -1
- package/build/esm/object-table/TableEditContainer.module.css +27 -0
- package/build/esm/object-table/TableRow.js +2 -2
- package/build/esm/object-table/TableRow.js.map +1 -1
- package/build/esm/object-table/hooks/useColumnDefs.js +2 -1
- package/build/esm/object-table/hooks/useColumnDefs.js.map +1 -1
- package/build/esm/object-table/hooks/useEditableTable.js +21 -2
- package/build/esm/object-table/hooks/useEditableTable.js.map +1 -1
- package/build/esm/object-table/utils/types.js.map +1 -1
- package/build/types/base-components/tooltip/Tooltip.d.ts +31 -0
- package/build/types/base-components/tooltip/Tooltip.d.ts.map +1 -0
- package/build/types/base-components/tooltip/index.d.ts +1 -0
- package/build/types/base-components/tooltip/index.d.ts.map +1 -0
- package/build/types/filter-list/utils/filterStateToWhereClause.d.ts.map +1 -1
- package/build/types/object-table/EditableCell.d.ts +8 -2
- package/build/types/object-table/EditableCell.d.ts.map +1 -1
- package/build/types/object-table/ObjectTableApi.d.ts +7 -0
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
- package/build/types/object-table/Table.d.ts +4 -0
- package/build/types/object-table/Table.d.ts.map +1 -1
- package/build/types/object-table/TableEditContainer.d.ts +1 -1
- package/build/types/object-table/TableEditContainer.d.ts.map +1 -1
- package/build/types/object-table/TableRow.d.ts +2 -2
- package/build/types/object-table/TableRow.d.ts.map +1 -1
- package/build/types/object-table/hooks/useEditableTable.d.ts.map +1 -1
- package/build/types/object-table/utils/types.d.ts +7 -4
- package/build/types/object-table/utils/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var button = require('@base-ui/react/button');
|
|
4
4
|
var classnames14 = require('classnames');
|
|
5
|
-
var
|
|
5
|
+
var React54 = require('react');
|
|
6
6
|
var core = require('@dnd-kit/core');
|
|
7
7
|
var sortable = require('@dnd-kit/sortable');
|
|
8
8
|
var utilities = require('@dnd-kit/utilities');
|
|
@@ -16,6 +16,7 @@ var combobox = require('@base-ui/react/combobox');
|
|
|
16
16
|
var select = require('@base-ui/react/select');
|
|
17
17
|
var reactTable = require('@tanstack/react-table');
|
|
18
18
|
var react = require('@osdk/react');
|
|
19
|
+
var tooltip = require('@base-ui/react/tooltip');
|
|
19
20
|
var collapsible = require('@base-ui/react/collapsible');
|
|
20
21
|
var dialog = require('@base-ui/react/dialog');
|
|
21
22
|
var menu = require('@base-ui/react/menu');
|
|
@@ -25,7 +26,7 @@ var reactDom = require('react-dom');
|
|
|
25
26
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
27
|
|
|
27
28
|
var classnames14__default = /*#__PURE__*/_interopDefault(classnames14);
|
|
28
|
-
var
|
|
29
|
+
var React54__default = /*#__PURE__*/_interopDefault(React54);
|
|
29
30
|
|
|
30
31
|
// src/filter-list/base/BaseFilterList.tsx
|
|
31
32
|
|
|
@@ -39,7 +40,7 @@ var FilterListContent_default = {};
|
|
|
39
40
|
var ErrorBoundary_default = {};
|
|
40
41
|
|
|
41
42
|
// src/shared/ErrorBoundary.tsx
|
|
42
|
-
var ErrorBoundary = class extends
|
|
43
|
+
var ErrorBoundary = class extends React54.Component {
|
|
43
44
|
state = {
|
|
44
45
|
hasError: false,
|
|
45
46
|
error: null
|
|
@@ -66,11 +67,11 @@ var ErrorBoundary = class extends React53.Component {
|
|
|
66
67
|
if (this.props.fallback) {
|
|
67
68
|
return this.props.fallback;
|
|
68
69
|
}
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
70
71
|
className: ErrorBoundary_default.errorContainer
|
|
71
|
-
}, /* @__PURE__ */
|
|
72
|
+
}, /* @__PURE__ */ React54__default.default.createElement("p", {
|
|
72
73
|
className: ErrorBoundary_default.errorMessage
|
|
73
|
-
}, this.props.errorMessage ?? "Something went wrong"), /* @__PURE__ */
|
|
74
|
+
}, this.props.errorMessage ?? "Something went wrong"), /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
74
75
|
className: ErrorBoundary_default.retryButton,
|
|
75
76
|
onClick: this.handleRetry,
|
|
76
77
|
"aria-label": "Retry"
|
|
@@ -134,40 +135,40 @@ function filterHasActiveState(state) {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
function DragHandleIcon() {
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ React54__default.default.createElement("svg", {
|
|
138
139
|
width: "16",
|
|
139
140
|
height: "16",
|
|
140
141
|
viewBox: "0 0 16 16",
|
|
141
142
|
fill: "currentColor",
|
|
142
143
|
"aria-hidden": "true"
|
|
143
|
-
}, /* @__PURE__ */
|
|
144
|
+
}, /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
144
145
|
cx: "5.5",
|
|
145
146
|
cy: "3.5",
|
|
146
147
|
r: "1.5"
|
|
147
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
148
149
|
cx: "10.5",
|
|
149
150
|
cy: "3.5",
|
|
150
151
|
r: "1.5"
|
|
151
|
-
}), /* @__PURE__ */
|
|
152
|
+
}), /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
152
153
|
cx: "5.5",
|
|
153
154
|
cy: "8",
|
|
154
155
|
r: "1.5"
|
|
155
|
-
}), /* @__PURE__ */
|
|
156
|
+
}), /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
156
157
|
cx: "10.5",
|
|
157
158
|
cy: "8",
|
|
158
159
|
r: "1.5"
|
|
159
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
160
161
|
cx: "5.5",
|
|
161
162
|
cy: "12.5",
|
|
162
163
|
r: "1.5"
|
|
163
|
-
}), /* @__PURE__ */
|
|
164
|
+
}), /* @__PURE__ */ React54__default.default.createElement("circle", {
|
|
164
165
|
cx: "10.5",
|
|
165
166
|
cy: "12.5",
|
|
166
167
|
r: "1.5"
|
|
167
168
|
}));
|
|
168
169
|
}
|
|
169
170
|
function IncludeIcon() {
|
|
170
|
-
return /* @__PURE__ */
|
|
171
|
+
return /* @__PURE__ */ React54__default.default.createElement("svg", {
|
|
171
172
|
width: "14",
|
|
172
173
|
height: "14",
|
|
173
174
|
viewBox: "0 0 16 16",
|
|
@@ -175,13 +176,13 @@ function IncludeIcon() {
|
|
|
175
176
|
stroke: "currentColor",
|
|
176
177
|
strokeWidth: "1.5",
|
|
177
178
|
"aria-hidden": "true"
|
|
178
|
-
}, /* @__PURE__ */
|
|
179
|
+
}, /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
179
180
|
d: "M2 3h12M5 8h6M7 13h2",
|
|
180
181
|
strokeLinecap: "round"
|
|
181
182
|
}));
|
|
182
183
|
}
|
|
183
184
|
function ExcludeIcon() {
|
|
184
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ React54__default.default.createElement("svg", {
|
|
185
186
|
width: "14",
|
|
186
187
|
height: "14",
|
|
187
188
|
viewBox: "0 0 16 16",
|
|
@@ -189,16 +190,16 @@ function ExcludeIcon() {
|
|
|
189
190
|
stroke: "currentColor",
|
|
190
191
|
strokeWidth: "1.5",
|
|
191
192
|
"aria-hidden": "true"
|
|
192
|
-
}, /* @__PURE__ */
|
|
193
|
+
}, /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
193
194
|
d: "M2 3h12M5 8h6M7 13h2",
|
|
194
195
|
strokeLinecap: "round"
|
|
195
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
196
197
|
d: "M3 14L13 2",
|
|
197
198
|
strokeLinecap: "round"
|
|
198
199
|
}));
|
|
199
200
|
}
|
|
200
201
|
function RemoveIcon() {
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ React54__default.default.createElement("svg", {
|
|
202
203
|
width: "14",
|
|
203
204
|
height: "14",
|
|
204
205
|
viewBox: "0 0 16 16",
|
|
@@ -206,7 +207,7 @@ function RemoveIcon() {
|
|
|
206
207
|
stroke: "currentColor",
|
|
207
208
|
strokeWidth: "1.5",
|
|
208
209
|
"aria-hidden": "true"
|
|
209
|
-
}, /* @__PURE__ */
|
|
210
|
+
}, /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
210
211
|
d: "M4 4l8 8M12 4l-8 8",
|
|
211
212
|
strokeLinecap: "round"
|
|
212
213
|
}));
|
|
@@ -238,10 +239,10 @@ function FilterListItemInner({
|
|
|
238
239
|
className,
|
|
239
240
|
style
|
|
240
241
|
}) {
|
|
241
|
-
const handleFilterStateChanged =
|
|
242
|
+
const handleFilterStateChanged = React54.useCallback((newState) => {
|
|
242
243
|
onFilterStateChanged(filterKey, newState);
|
|
243
244
|
}, [filterKey, onFilterStateChanged]);
|
|
244
|
-
const handleToggleExclude =
|
|
245
|
+
const handleToggleExclude = React54.useCallback(() => {
|
|
245
246
|
if (filterState) {
|
|
246
247
|
onFilterStateChanged(filterKey, {
|
|
247
248
|
...filterState,
|
|
@@ -249,34 +250,34 @@ function FilterListItemInner({
|
|
|
249
250
|
});
|
|
250
251
|
}
|
|
251
252
|
}, [filterKey, filterState, onFilterStateChanged]);
|
|
252
|
-
const handleRemove =
|
|
253
|
+
const handleRemove = React54.useCallback(() => {
|
|
253
254
|
onFilterRemoved?.(filterKey);
|
|
254
255
|
}, [filterKey, onFilterRemoved]);
|
|
255
256
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
256
257
|
const showExcludeToggle = supportsExcluding(filterState);
|
|
257
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
258
259
|
className: classnames14__default.default(FilterListItem_default.filterItem, className),
|
|
259
260
|
style,
|
|
260
261
|
"data-excluding": isExcluding || void 0
|
|
261
|
-
}, /* @__PURE__ */
|
|
262
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
262
263
|
className: FilterListItem_default.itemHeader
|
|
263
|
-
}, dragHandleAttributes && /* @__PURE__ */
|
|
264
|
+
}, dragHandleAttributes && /* @__PURE__ */ React54__default.default.createElement(button.Button, _extends({
|
|
264
265
|
className: FilterListItem_default.dragHandle,
|
|
265
266
|
"aria-label": `Reorder ${label}`
|
|
266
|
-
}, dragHandleAttributes, dragHandleListeners), /* @__PURE__ */
|
|
267
|
+
}, dragHandleAttributes, dragHandleListeners), /* @__PURE__ */ React54__default.default.createElement(DragHandleIcon, null)), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
267
268
|
className: FilterListItem_default.itemLabel
|
|
268
|
-
}, label), showExcludeToggle && /* @__PURE__ */
|
|
269
|
+
}, label), showExcludeToggle && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
269
270
|
className: FilterListItem_default.excludeToggle,
|
|
270
271
|
onClick: handleToggleExclude,
|
|
271
272
|
"aria-pressed": isExcluding,
|
|
272
273
|
"aria-label": isExcluding ? "Switch to include mode" : "Switch to exclude mode"
|
|
273
|
-
}, isExcluding ? /* @__PURE__ */
|
|
274
|
+
}, isExcluding ? /* @__PURE__ */ React54__default.default.createElement(ExcludeIcon, null) : /* @__PURE__ */ React54__default.default.createElement(IncludeIcon, null)), onFilterRemoved && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
274
275
|
className: FilterListItem_default.removeButton,
|
|
275
276
|
onClick: handleRemove,
|
|
276
277
|
"aria-label": `Remove ${label} filter`
|
|
277
|
-
}, /* @__PURE__ */
|
|
278
|
+
}, /* @__PURE__ */ React54__default.default.createElement(RemoveIcon, null))), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
278
279
|
className: FilterListItem_default.itemContent
|
|
279
|
-
}, /* @__PURE__ */
|
|
280
|
+
}, /* @__PURE__ */ React54__default.default.createElement(ErrorBoundary, {
|
|
280
281
|
errorMessage: "Error loading filter"
|
|
281
282
|
}, renderInput({
|
|
282
283
|
definition,
|
|
@@ -285,7 +286,7 @@ function FilterListItemInner({
|
|
|
285
286
|
onFilterStateChanged: handleFilterStateChanged
|
|
286
287
|
}))));
|
|
287
288
|
}
|
|
288
|
-
var FilterListItem = /* @__PURE__ */
|
|
289
|
+
var FilterListItem = /* @__PURE__ */ React54.memo(FilterListItemInner);
|
|
289
290
|
function SortableFilterListItem({
|
|
290
291
|
id,
|
|
291
292
|
definition,
|
|
@@ -306,15 +307,15 @@ function SortableFilterListItem({
|
|
|
306
307
|
} = sortable.useSortable({
|
|
307
308
|
id
|
|
308
309
|
});
|
|
309
|
-
const style =
|
|
310
|
+
const style = React54.useMemo(() => ({
|
|
310
311
|
transform: utilities.CSS.Transform.toString(transform),
|
|
311
312
|
transition: transition ?? void 0
|
|
312
313
|
}), [transform, transition]);
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
314
315
|
ref: setNodeRef,
|
|
315
316
|
style,
|
|
316
317
|
className: classnames14__default.default(isDragging && FilterListItem_default.dragging)
|
|
317
|
-
}, /* @__PURE__ */
|
|
318
|
+
}, /* @__PURE__ */ React54__default.default.createElement(FilterListItem, {
|
|
318
319
|
definition,
|
|
319
320
|
filterKey,
|
|
320
321
|
label,
|
|
@@ -350,15 +351,15 @@ function FilterListContent({
|
|
|
350
351
|
className,
|
|
351
352
|
style
|
|
352
353
|
}) {
|
|
353
|
-
const [internalOrder, setInternalOrder] =
|
|
354
|
-
const [activeId, setActiveId] =
|
|
355
|
-
|
|
354
|
+
const [internalOrder, setInternalOrder] = React54.useState(() => filterDefinitions ?? []);
|
|
355
|
+
const [activeId, setActiveId] = React54.useState(null);
|
|
356
|
+
React54.useEffect(() => {
|
|
356
357
|
if (filterDefinitions) {
|
|
357
358
|
setInternalOrder(filterDefinitions);
|
|
358
359
|
}
|
|
359
360
|
}, [filterDefinitions]);
|
|
360
361
|
const renderDefinitions = enableSorting ? internalOrder : filterDefinitions;
|
|
361
|
-
const sortableIds =
|
|
362
|
+
const sortableIds = React54.useMemo(() => enableSorting ? internalOrder.map((def) => getFilterKey2(def)) : [], [enableSorting, internalOrder, getFilterKey2]);
|
|
362
363
|
const pointerSensor = core.useSensor(core.PointerSensor, {
|
|
363
364
|
activationConstraint: POINTER_ACTIVATION_CONSTRAINT
|
|
364
365
|
});
|
|
@@ -368,11 +369,11 @@ function FilterListContent({
|
|
|
368
369
|
const sensors = core.useSensors(pointerSensor, keyboardSensor);
|
|
369
370
|
const activeIndex = activeId != null ? sortableIds.indexOf(String(activeId)) : -1;
|
|
370
371
|
const activeDefinition = activeIndex >= 0 ? internalOrder[activeIndex] : void 0;
|
|
371
|
-
const activeFilterKey =
|
|
372
|
-
const handleDragStart =
|
|
372
|
+
const activeFilterKey = React54.useMemo(() => activeDefinition ? getFilterKey2(activeDefinition) : void 0, [activeDefinition, getFilterKey2]);
|
|
373
|
+
const handleDragStart = React54.useCallback((event) => {
|
|
373
374
|
setActiveId(event.active.id);
|
|
374
375
|
}, []);
|
|
375
|
-
const handleDragEnd =
|
|
376
|
+
const handleDragEnd = React54.useCallback((event) => {
|
|
376
377
|
setActiveId(null);
|
|
377
378
|
const {
|
|
378
379
|
active,
|
|
@@ -387,10 +388,10 @@ function FilterListContent({
|
|
|
387
388
|
setInternalOrder(sortable.arrayMove(internalOrder, oldIndex, newIndex));
|
|
388
389
|
}
|
|
389
390
|
}, [internalOrder, sortableIds]);
|
|
390
|
-
const handleDragCancel =
|
|
391
|
+
const handleDragCancel = React54.useCallback(() => {
|
|
391
392
|
setActiveId(null);
|
|
392
393
|
}, []);
|
|
393
|
-
const announcements =
|
|
394
|
+
const announcements = React54.useMemo(() => ({
|
|
394
395
|
onDragStart({
|
|
395
396
|
active
|
|
396
397
|
}) {
|
|
@@ -430,21 +431,21 @@ function FilterListContent({
|
|
|
430
431
|
return `Cancelled dragging ${label} filter`;
|
|
431
432
|
}
|
|
432
433
|
}), [internalOrder, sortableIds, getFilterLabel2]);
|
|
433
|
-
const accessibility =
|
|
434
|
+
const accessibility = React54.useMemo(() => ({
|
|
434
435
|
announcements
|
|
435
436
|
}), [announcements]);
|
|
436
437
|
if (!renderDefinitions || renderDefinitions.length === 0) {
|
|
437
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
438
439
|
className: classnames14__default.default(FilterListContent_default.content, className),
|
|
439
440
|
style,
|
|
440
441
|
"data-empty": "true"
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
444
|
if (enableSorting) {
|
|
444
|
-
return /* @__PURE__ */
|
|
445
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
445
446
|
className: classnames14__default.default(FilterListContent_default.content, className),
|
|
446
447
|
style
|
|
447
|
-
}, /* @__PURE__ */
|
|
448
|
+
}, /* @__PURE__ */ React54__default.default.createElement(core.DndContext, {
|
|
448
449
|
sensors,
|
|
449
450
|
collisionDetection: core.closestCenter,
|
|
450
451
|
modifiers: MODIFIERS,
|
|
@@ -452,7 +453,7 @@ function FilterListContent({
|
|
|
452
453
|
onDragEnd: handleDragEnd,
|
|
453
454
|
onDragCancel: handleDragCancel,
|
|
454
455
|
accessibility
|
|
455
|
-
}, /* @__PURE__ */
|
|
456
|
+
}, /* @__PURE__ */ React54__default.default.createElement(sortable.SortableContext, {
|
|
456
457
|
items: sortableIds,
|
|
457
458
|
strategy: sortable.verticalListSortingStrategy
|
|
458
459
|
}, internalOrder.map((definition, index) => {
|
|
@@ -460,7 +461,7 @@ function FilterListContent({
|
|
|
460
461
|
const filterKey = getFilterKey2(definition);
|
|
461
462
|
const label = getFilterLabel2(definition);
|
|
462
463
|
const state = filterStates.get(filterKey);
|
|
463
|
-
return /* @__PURE__ */
|
|
464
|
+
return /* @__PURE__ */ React54__default.default.createElement(SortableFilterListItem, {
|
|
464
465
|
key: id,
|
|
465
466
|
id,
|
|
466
467
|
definition,
|
|
@@ -471,10 +472,10 @@ function FilterListContent({
|
|
|
471
472
|
onFilterRemoved,
|
|
472
473
|
renderInput
|
|
473
474
|
});
|
|
474
|
-
})), /* @__PURE__ */
|
|
475
|
+
})), /* @__PURE__ */ React54__default.default.createElement(core.DragOverlay, {
|
|
475
476
|
dropAnimation: null,
|
|
476
477
|
className: FilterListContent_default.dragOverlay
|
|
477
|
-
}, activeDefinition && activeFilterKey && /* @__PURE__ */
|
|
478
|
+
}, activeDefinition && activeFilterKey && /* @__PURE__ */ React54__default.default.createElement(FilterListItem, {
|
|
478
479
|
definition: activeDefinition,
|
|
479
480
|
filterKey: activeFilterKey,
|
|
480
481
|
label: getFilterLabel2(activeDefinition),
|
|
@@ -484,13 +485,13 @@ function FilterListContent({
|
|
|
484
485
|
renderInput
|
|
485
486
|
}))));
|
|
486
487
|
}
|
|
487
|
-
return /* @__PURE__ */
|
|
488
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
488
489
|
className: classnames14__default.default(FilterListContent_default.content, className),
|
|
489
490
|
style
|
|
490
491
|
}, renderDefinitions.map((definition) => {
|
|
491
492
|
const filterKey = getFilterKey2(definition);
|
|
492
493
|
const state = filterStates.get(filterKey);
|
|
493
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ React54__default.default.createElement(FilterListItem, {
|
|
494
495
|
key: filterKey,
|
|
495
496
|
definition,
|
|
496
497
|
filterKey,
|
|
@@ -518,38 +519,38 @@ function FilterListHeaderInner({
|
|
|
518
519
|
activeFilterCount = 0
|
|
519
520
|
}) {
|
|
520
521
|
const showCollapseButton = onCollapsedChange != null;
|
|
521
|
-
const handleCollapseClick =
|
|
522
|
+
const handleCollapseClick = React54.useCallback(() => {
|
|
522
523
|
onCollapsedChange?.(!collapsed);
|
|
523
524
|
}, [onCollapsedChange, collapsed]);
|
|
524
|
-
return /* @__PURE__ */
|
|
525
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
525
526
|
className: FilterListHeader_default.header
|
|
526
|
-
}, showCollapseButton && /* @__PURE__ */
|
|
527
|
+
}, showCollapseButton && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
527
528
|
className: FilterListHeader_default.collapseButton,
|
|
528
529
|
onClick: handleCollapseClick,
|
|
529
530
|
"aria-expanded": !collapsed,
|
|
530
531
|
"aria-label": collapsed ? "Expand filters" : "Collapse filters"
|
|
531
|
-
}, /* @__PURE__ */
|
|
532
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
532
533
|
className: classnames14__default.default(FilterListHeader_default.collapseIcon, collapsed && FilterListHeader_default.collapsed)
|
|
533
|
-
})), /* @__PURE__ */
|
|
534
|
+
})), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
534
535
|
className: FilterListHeader_default.headerContentWrapper,
|
|
535
536
|
"data-collapsed": collapsed
|
|
536
|
-
}, /* @__PURE__ */
|
|
537
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
537
538
|
className: FilterListHeader_default.headerContentInner
|
|
538
|
-
}, /* @__PURE__ */
|
|
539
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
539
540
|
className: FilterListHeader_default.titleContainer
|
|
540
|
-
}, titleIcon && /* @__PURE__ */
|
|
541
|
+
}, titleIcon && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
541
542
|
className: FilterListHeader_default.titleIcon
|
|
542
|
-
}, titleIcon), title && /* @__PURE__ */
|
|
543
|
+
}, titleIcon), title && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
543
544
|
className: FilterListHeader_default.title
|
|
544
|
-
}, title), showActiveFilterCount && activeFilterCount > 0 && /* @__PURE__ */
|
|
545
|
+
}, title), showActiveFilterCount && activeFilterCount > 0 && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
545
546
|
className: FilterListHeader_default.activeCount
|
|
546
|
-
}, "(", activeFilterCount, ")")), showResetButton && /* @__PURE__ */
|
|
547
|
+
}, "(", activeFilterCount, ")")), showResetButton && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
547
548
|
className: FilterListHeader_default.resetButton,
|
|
548
549
|
onClick: onReset,
|
|
549
550
|
disabled: activeFilterCount === 0
|
|
550
551
|
}, "Reset"))));
|
|
551
552
|
}
|
|
552
|
-
var FilterListHeader = /* @__PURE__ */
|
|
553
|
+
var FilterListHeader = /* @__PURE__ */ React54.memo(FilterListHeaderInner);
|
|
553
554
|
|
|
554
555
|
// src/filter-list/base/BaseFilterList.tsx
|
|
555
556
|
function BaseFilterList(props) {
|
|
@@ -576,10 +577,10 @@ function BaseFilterList(props) {
|
|
|
576
577
|
} = props;
|
|
577
578
|
const showHeader = title || titleIcon || showResetButton || showActiveFilterCount || onCollapsedChange;
|
|
578
579
|
const showAddButton = renderAddFilterButton != null || onFilterAdded != null;
|
|
579
|
-
return /* @__PURE__ */
|
|
580
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
580
581
|
className: classnames14__default.default(FilterList_default.filterList, className),
|
|
581
582
|
"data-active-count": activeFilterCount
|
|
582
|
-
}, showHeader && /* @__PURE__ */
|
|
583
|
+
}, showHeader && /* @__PURE__ */ React54__default.default.createElement(FilterListHeader, {
|
|
583
584
|
title,
|
|
584
585
|
titleIcon,
|
|
585
586
|
collapsed,
|
|
@@ -588,12 +589,12 @@ function BaseFilterList(props) {
|
|
|
588
589
|
onReset,
|
|
589
590
|
showActiveFilterCount,
|
|
590
591
|
activeFilterCount
|
|
591
|
-
}), /* @__PURE__ */
|
|
592
|
+
}), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
592
593
|
className: FilterList_default.contentWrapper,
|
|
593
594
|
"data-collapsed": collapsed
|
|
594
|
-
}, /* @__PURE__ */
|
|
595
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
595
596
|
className: FilterList_default.contentInner
|
|
596
|
-
}, /* @__PURE__ */
|
|
597
|
+
}, /* @__PURE__ */ React54__default.default.createElement(FilterListContent, {
|
|
597
598
|
filterDefinitions,
|
|
598
599
|
filterStates,
|
|
599
600
|
onFilterStateChanged,
|
|
@@ -602,9 +603,9 @@ function BaseFilterList(props) {
|
|
|
602
603
|
getFilterKey: getFilterKey2,
|
|
603
604
|
getFilterLabel: getFilterLabel2,
|
|
604
605
|
enableSorting
|
|
605
|
-
}))), !collapsed && showAddButton && /* @__PURE__ */
|
|
606
|
+
}))), !collapsed && showAddButton && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
606
607
|
className: FilterList_default.addButtonContainer
|
|
607
|
-
}, renderAddFilterButton ? renderAddFilterButton() : /* @__PURE__ */
|
|
608
|
+
}, renderAddFilterButton ? renderAddFilterButton() : /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
608
609
|
type: "button",
|
|
609
610
|
className: FilterList_default.addButton
|
|
610
611
|
}, "+ Add filter")));
|
|
@@ -624,57 +625,57 @@ function ContainsTextInputInner({
|
|
|
624
625
|
renderSearchIcon,
|
|
625
626
|
renderClearIcon
|
|
626
627
|
}) {
|
|
627
|
-
const [localValue, setLocalValue] =
|
|
628
|
-
const onChangeRef =
|
|
628
|
+
const [localValue, setLocalValue] = React54.useState(value ?? "");
|
|
629
|
+
const onChangeRef = React54.useRef(onChange);
|
|
629
630
|
onChangeRef.current = onChange;
|
|
630
|
-
const debouncedOnChange =
|
|
631
|
+
const debouncedOnChange = React54.useMemo(() => lodashEs.debounce((newValue) => {
|
|
631
632
|
onChangeRef.current(newValue.length > 0 ? newValue : void 0);
|
|
632
633
|
}, debounceMs), [debounceMs]);
|
|
633
|
-
|
|
634
|
+
React54.useEffect(() => {
|
|
634
635
|
return () => {
|
|
635
636
|
debouncedOnChange.cancel();
|
|
636
637
|
};
|
|
637
638
|
}, [debouncedOnChange]);
|
|
638
|
-
|
|
639
|
+
React54.useEffect(() => {
|
|
639
640
|
setLocalValue(value ?? "");
|
|
640
641
|
debouncedOnChange.cancel();
|
|
641
642
|
}, [value, debouncedOnChange]);
|
|
642
|
-
const handleInputChange =
|
|
643
|
+
const handleInputChange = React54.useCallback((e) => {
|
|
643
644
|
setLocalValue(e.target.value);
|
|
644
645
|
debouncedOnChange(e.target.value);
|
|
645
646
|
}, [debouncedOnChange]);
|
|
646
|
-
const handleClear =
|
|
647
|
+
const handleClear = React54.useCallback(() => {
|
|
647
648
|
setLocalValue("");
|
|
648
649
|
debouncedOnChange.cancel();
|
|
649
650
|
onChangeRef.current(void 0);
|
|
650
651
|
}, [debouncedOnChange]);
|
|
651
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
652
653
|
className: classnames14__default.default(ContainsTextInput_default.textInput, className),
|
|
653
654
|
style,
|
|
654
655
|
"data-has-value": !!localValue
|
|
655
|
-
}, /* @__PURE__ */
|
|
656
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
656
657
|
className: ContainsTextInput_default.inputGroup
|
|
657
|
-
}, renderSearchIcon ? renderSearchIcon() : /* @__PURE__ */
|
|
658
|
+
}, renderSearchIcon ? renderSearchIcon() : /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
658
659
|
className: ContainsTextInput_default.searchIcon
|
|
659
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Search, {
|
|
660
661
|
color: "currentColor"
|
|
661
|
-
})), /* @__PURE__ */
|
|
662
|
+
})), /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
662
663
|
type: "text",
|
|
663
664
|
className: ContainsTextInput_default.input,
|
|
664
665
|
value: localValue,
|
|
665
666
|
onChange: handleInputChange,
|
|
666
667
|
placeholder,
|
|
667
668
|
"aria-label": placeholder
|
|
668
|
-
}), localValue && /* @__PURE__ */
|
|
669
|
+
}), localValue && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
669
670
|
type: "button",
|
|
670
671
|
className: ContainsTextInput_default.clearButton,
|
|
671
672
|
onClick: handleClear,
|
|
672
673
|
"aria-label": "Clear search"
|
|
673
|
-
}, renderClearIcon ? renderClearIcon() : /* @__PURE__ */
|
|
674
|
+
}, renderClearIcon ? renderClearIcon() : /* @__PURE__ */ React54__default.default.createElement(icons.Cross, {
|
|
674
675
|
color: "currentColor"
|
|
675
676
|
}))));
|
|
676
677
|
}
|
|
677
|
-
var ContainsTextInput = /* @__PURE__ */
|
|
678
|
+
var ContainsTextInput = /* @__PURE__ */ React54.memo(ContainsTextInputInner);
|
|
678
679
|
|
|
679
680
|
// src/base-components/switch/Switch.module.css
|
|
680
681
|
var Switch_default = {};
|
|
@@ -694,9 +695,9 @@ function Switch({
|
|
|
694
695
|
thumbProps,
|
|
695
696
|
...rest
|
|
696
697
|
}) {
|
|
697
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ React54__default.default.createElement(_switch.Switch.Root, _extends2({
|
|
698
699
|
className: classnames14__default.default(Switch_default.osdkSwitchRoot, className)
|
|
699
|
-
}, rest), /* @__PURE__ */
|
|
700
|
+
}, rest), /* @__PURE__ */ React54__default.default.createElement(_switch.Switch.Thumb, _extends2({}, thumbProps, {
|
|
700
701
|
className: classnames14__default.default(Switch_default.osdkSwitchThumb, thumbProps?.className)
|
|
701
702
|
})));
|
|
702
703
|
}
|
|
@@ -713,20 +714,20 @@ function ToggleInputInner({
|
|
|
713
714
|
style
|
|
714
715
|
}) {
|
|
715
716
|
const rootClassName = classnames14__default.default(ToggleInput_default.toggleInput, className);
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
717
718
|
className: rootClassName,
|
|
718
719
|
style,
|
|
719
720
|
"data-enabled": enabled
|
|
720
|
-
}, /* @__PURE__ */
|
|
721
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
721
722
|
className: ToggleInput_default.toggleLabel
|
|
722
|
-
}, /* @__PURE__ */
|
|
723
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Switch, {
|
|
723
724
|
checked: enabled,
|
|
724
725
|
onCheckedChange: onChange
|
|
725
|
-
}), label && /* @__PURE__ */
|
|
726
|
+
}), label && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
726
727
|
className: ToggleInput_default.labelText
|
|
727
728
|
}, label)));
|
|
728
729
|
}
|
|
729
|
-
var ToggleInput = /* @__PURE__ */
|
|
730
|
+
var ToggleInput = /* @__PURE__ */ React54.memo(ToggleInputInner);
|
|
730
731
|
|
|
731
732
|
// src/base-components/checkbox/Checkbox.module.css
|
|
732
733
|
var Checkbox_default = {};
|
|
@@ -747,14 +748,14 @@ function Checkbox({
|
|
|
747
748
|
indicatorProps,
|
|
748
749
|
...rest
|
|
749
750
|
}) {
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ React54__default.default.createElement(checkbox.Checkbox.Root, _extends3({
|
|
751
752
|
className: classnames14__default.default(Checkbox_default.osdkCheckboxRoot, className),
|
|
752
753
|
indeterminate
|
|
753
|
-
}, rest), /* @__PURE__ */
|
|
754
|
+
}, rest), /* @__PURE__ */ React54__default.default.createElement(checkbox.Checkbox.Indicator, _extends3({}, indicatorProps, {
|
|
754
755
|
className: classnames14__default.default(Checkbox_default.osdkCheckboxIndicator, indicatorProps?.className)
|
|
755
|
-
}), indeterminate ? /* @__PURE__ */
|
|
756
|
+
}), indeterminate ? /* @__PURE__ */ React54__default.default.createElement(icons.Minus, {
|
|
756
757
|
color: "currentColor"
|
|
757
|
-
}) : /* @__PURE__ */
|
|
758
|
+
}) : /* @__PURE__ */ React54__default.default.createElement(icons.Tick, {
|
|
758
759
|
color: "currentColor"
|
|
759
760
|
})));
|
|
760
761
|
}
|
|
@@ -776,68 +777,68 @@ function CheckboxListInputInner({
|
|
|
776
777
|
className,
|
|
777
778
|
style
|
|
778
779
|
}) {
|
|
779
|
-
const displayValues =
|
|
780
|
-
const selectedSet =
|
|
781
|
-
const toggleValue =
|
|
780
|
+
const displayValues = React54.useMemo(() => values.map((item) => item.value), [values]);
|
|
781
|
+
const selectedSet = React54.useMemo(() => new Set(selectedValues), [selectedValues]);
|
|
782
|
+
const toggleValue = React54.useCallback((value) => {
|
|
782
783
|
if (selectedSet.has(value)) {
|
|
783
784
|
onChange(selectedValues.filter((v) => v !== value));
|
|
784
785
|
} else {
|
|
785
786
|
onChange([...selectedValues, value]);
|
|
786
787
|
}
|
|
787
788
|
}, [selectedValues, selectedSet, onChange]);
|
|
788
|
-
const allSelected =
|
|
789
|
-
const areSomeValuesSelected =
|
|
790
|
-
const handleSelectAll =
|
|
789
|
+
const allSelected = React54.useMemo(() => displayValues.length > 0 && displayValues.every((v) => selectedSet.has(v)), [displayValues, selectedSet]);
|
|
790
|
+
const areSomeValuesSelected = React54.useMemo(() => !allSelected && selectedValues.some((v) => selectedSet.has(v)), [allSelected, selectedValues, selectedSet]);
|
|
791
|
+
const handleSelectAll = React54.useCallback(() => {
|
|
791
792
|
if (allSelected) {
|
|
792
793
|
onChange([]);
|
|
793
794
|
} else {
|
|
794
795
|
onChange([...displayValues]);
|
|
795
796
|
}
|
|
796
797
|
}, [allSelected, displayValues, onChange]);
|
|
797
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
798
799
|
className: classnames14__default.default(CheckboxListInput_default.checkboxList, className),
|
|
799
800
|
style,
|
|
800
801
|
"data-loading": isLoading
|
|
801
|
-
}, error && /* @__PURE__ */
|
|
802
|
+
}, error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
802
803
|
className: shared_default.errorMessage
|
|
803
|
-
}, "Error loading values: ", error.message), !error && displayValues.length === 0 && /* @__PURE__ */
|
|
804
|
+
}, "Error loading values: ", error.message), !error && displayValues.length === 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
804
805
|
className: shared_default.emptyMessage
|
|
805
|
-
}, isLoading ? "Loading values..." : "No values available"), (displayValues.length > 0 || isLoading) && /* @__PURE__ */
|
|
806
|
+
}, isLoading ? "Loading values..." : "No values available"), (displayValues.length > 0 || isLoading) && /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, isLoading && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
806
807
|
className: shared_default.loadingMessage
|
|
807
|
-
}, "Updating..."), /* @__PURE__ */
|
|
808
|
+
}, "Updating..."), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
808
809
|
className: CheckboxListInput_default.checkboxRow,
|
|
809
810
|
"data-select-all": true
|
|
810
|
-
}, /* @__PURE__ */
|
|
811
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
811
812
|
className: CheckboxListInput_default.checkboxLabel
|
|
812
|
-
}, /* @__PURE__ */
|
|
813
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
813
814
|
checked: allSelected,
|
|
814
815
|
indeterminate: areSomeValuesSelected,
|
|
815
816
|
onCheckedChange: handleSelectAll
|
|
816
|
-
}), /* @__PURE__ */
|
|
817
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
817
818
|
className: CheckboxListInput_default.valueText
|
|
818
819
|
}, "Select all"))), displayValues.map((value) => {
|
|
819
820
|
const isSelected = selectedSet.has(value);
|
|
820
821
|
const color = colorMap?.[value];
|
|
821
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
822
823
|
key: value,
|
|
823
824
|
className: CheckboxListInput_default.checkboxRow,
|
|
824
825
|
"data-selected": isSelected
|
|
825
|
-
}, /* @__PURE__ */
|
|
826
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
826
827
|
className: CheckboxListInput_default.checkboxLabel
|
|
827
|
-
}, /* @__PURE__ */
|
|
828
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
828
829
|
checked: isSelected,
|
|
829
830
|
onCheckedChange: () => toggleValue(value)
|
|
830
|
-
}), color && /* @__PURE__ */
|
|
831
|
+
}), color && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
831
832
|
className: CheckboxListInput_default.colorDot,
|
|
832
833
|
style: {
|
|
833
834
|
backgroundColor: color
|
|
834
835
|
}
|
|
835
|
-
}), /* @__PURE__ */
|
|
836
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
836
837
|
className: CheckboxListInput_default.valueText
|
|
837
838
|
}, value)));
|
|
838
839
|
})));
|
|
839
840
|
}
|
|
840
|
-
var CheckboxListInput = /* @__PURE__ */
|
|
841
|
+
var CheckboxListInput = /* @__PURE__ */ React54.memo(CheckboxListInputInner);
|
|
841
842
|
|
|
842
843
|
// src/filter-list/base/inputs/dateUtils.ts
|
|
843
844
|
function formatDateForInput(date) {
|
|
@@ -920,39 +921,39 @@ function RangeInputInner({
|
|
|
920
921
|
style,
|
|
921
922
|
config
|
|
922
923
|
}) {
|
|
923
|
-
const minInputId =
|
|
924
|
-
const maxInputId =
|
|
925
|
-
const [localMin, setLocalMin] =
|
|
926
|
-
const [localMax, setLocalMax] =
|
|
927
|
-
const onChangeRef =
|
|
924
|
+
const minInputId = React54.useId();
|
|
925
|
+
const maxInputId = React54.useId();
|
|
926
|
+
const [localMin, setLocalMin] = React54.useState(config.formatValue(minValue));
|
|
927
|
+
const [localMax, setLocalMax] = React54.useState(config.formatValue(maxValue));
|
|
928
|
+
const onChangeRef = React54.useRef(onChange);
|
|
928
929
|
onChangeRef.current = onChange;
|
|
929
|
-
const minValueRef =
|
|
930
|
+
const minValueRef = React54.useRef(minValue);
|
|
930
931
|
minValueRef.current = minValue;
|
|
931
|
-
const maxValueRef =
|
|
932
|
+
const maxValueRef = React54.useRef(maxValue);
|
|
932
933
|
maxValueRef.current = maxValue;
|
|
933
|
-
const debouncedMinChange =
|
|
934
|
+
const debouncedMinChange = React54.useMemo(() => lodashEs.debounce((newValue) => {
|
|
934
935
|
const parsed = config.parseValue(newValue);
|
|
935
936
|
onChangeRef.current(parsed, maxValueRef.current);
|
|
936
937
|
}, DEBOUNCE_MS), [config]);
|
|
937
|
-
const debouncedMaxChange =
|
|
938
|
+
const debouncedMaxChange = React54.useMemo(() => lodashEs.debounce((newValue) => {
|
|
938
939
|
const parsed = config.parseValue(newValue);
|
|
939
940
|
onChangeRef.current(minValueRef.current, parsed);
|
|
940
941
|
}, DEBOUNCE_MS), [config]);
|
|
941
|
-
|
|
942
|
+
React54.useEffect(() => {
|
|
942
943
|
setLocalMin(config.formatValue(minValue));
|
|
943
944
|
debouncedMinChange.cancel();
|
|
944
945
|
}, [minValue, config, debouncedMinChange]);
|
|
945
|
-
|
|
946
|
+
React54.useEffect(() => {
|
|
946
947
|
setLocalMax(config.formatValue(maxValue));
|
|
947
948
|
debouncedMaxChange.cancel();
|
|
948
949
|
}, [maxValue, config, debouncedMaxChange]);
|
|
949
|
-
|
|
950
|
+
React54.useEffect(() => {
|
|
950
951
|
return () => {
|
|
951
952
|
debouncedMinChange.cancel();
|
|
952
953
|
debouncedMaxChange.cancel();
|
|
953
954
|
};
|
|
954
955
|
}, [debouncedMinChange, debouncedMaxChange]);
|
|
955
|
-
const computedRange =
|
|
956
|
+
const computedRange = React54.useMemo(() => {
|
|
956
957
|
if (valueCountPairs.length === 0) return {
|
|
957
958
|
min: void 0,
|
|
958
959
|
max: void 0
|
|
@@ -964,11 +965,11 @@ function RangeInputInner({
|
|
|
964
965
|
max: config.fromNumber(max)
|
|
965
966
|
};
|
|
966
967
|
}, [valueCountPairs, config]);
|
|
967
|
-
const dataRange =
|
|
968
|
+
const dataRange = React54.useMemo(() => ({
|
|
968
969
|
dataMin: computedRange.min,
|
|
969
970
|
dataMax: computedRange.max
|
|
970
971
|
}), [computedRange.min, computedRange.max]);
|
|
971
|
-
const buckets =
|
|
972
|
+
const buckets = React54.useMemo(() => {
|
|
972
973
|
if (!showHistogram || valueCountPairs.length === 0 || computedRange.min === void 0 || computedRange.max === void 0) {
|
|
973
974
|
return [];
|
|
974
975
|
}
|
|
@@ -977,27 +978,27 @@ function RangeInputInner({
|
|
|
977
978
|
max: computedRange.max
|
|
978
979
|
}, config.toNumber, config.fromNumber);
|
|
979
980
|
}, [showHistogram, valueCountPairs, computedRange, config]);
|
|
980
|
-
const maxBucketCount =
|
|
981
|
-
const handleMinChange =
|
|
981
|
+
const maxBucketCount = React54.useMemo(() => getMaxBucketCount(buckets), [buckets]);
|
|
982
|
+
const handleMinChange = React54.useCallback((e) => {
|
|
982
983
|
const newValue = e.target.value;
|
|
983
984
|
setLocalMin(newValue);
|
|
984
985
|
debouncedMinChange(newValue);
|
|
985
986
|
}, [debouncedMinChange]);
|
|
986
|
-
const handleMaxChange =
|
|
987
|
+
const handleMaxChange = React54.useCallback((e) => {
|
|
987
988
|
const newValue = e.target.value;
|
|
988
989
|
setLocalMax(newValue);
|
|
989
990
|
debouncedMaxChange(newValue);
|
|
990
991
|
}, [debouncedMaxChange]);
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
992
993
|
className: classnames14__default.default(RangeInput_default.rangeInput, className),
|
|
993
994
|
style,
|
|
994
995
|
"data-loading": isLoading
|
|
995
|
-
}, showHistogram && buckets.length > 0 && /* @__PURE__ */
|
|
996
|
+
}, showHistogram && buckets.length > 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
996
997
|
className: RangeInput_default.histogramContainer
|
|
997
998
|
}, buckets.map((bucket, index) => {
|
|
998
999
|
const height = bucket.count / maxBucketCount * 100;
|
|
999
1000
|
const isInRange = (minValue === void 0 || config.toNumber(bucket.max) >= config.toNumber(minValue)) && (maxValue === void 0 || config.toNumber(bucket.min) <= config.toNumber(maxValue));
|
|
1000
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1001
1002
|
key: index,
|
|
1002
1003
|
className: RangeInput_default.histogramBar,
|
|
1003
1004
|
"data-in-range": isInRange,
|
|
@@ -1006,40 +1007,40 @@ function RangeInputInner({
|
|
|
1006
1007
|
},
|
|
1007
1008
|
title: config.formatTooltip(bucket.min, bucket.max, bucket.count)
|
|
1008
1009
|
});
|
|
1009
|
-
})), /* @__PURE__ */
|
|
1010
|
+
})), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1010
1011
|
className: RangeInput_default.rangeInputs
|
|
1011
|
-
}, /* @__PURE__ */
|
|
1012
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1012
1013
|
className: RangeInput_default.inputWrapper
|
|
1013
|
-
}, /* @__PURE__ */
|
|
1014
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
1014
1015
|
htmlFor: minInputId,
|
|
1015
1016
|
className: RangeInput_default.inputLabel
|
|
1016
|
-
}, config.minLabel), /* @__PURE__ */
|
|
1017
|
+
}, config.minLabel), /* @__PURE__ */ React54__default.default.createElement(input.Input, _extends4({
|
|
1017
1018
|
id: minInputId,
|
|
1018
1019
|
type: config.inputType,
|
|
1019
1020
|
className: RangeInput_default.input,
|
|
1020
1021
|
value: localMin,
|
|
1021
1022
|
onChange: handleMinChange,
|
|
1022
1023
|
placeholder: dataRange.dataMin !== void 0 && config.formatPlaceholder ? config.formatPlaceholder(dataRange.dataMin) : void 0
|
|
1023
|
-
}, config.inputProps))), /* @__PURE__ */
|
|
1024
|
+
}, config.inputProps))), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1024
1025
|
className: RangeInput_default.separator,
|
|
1025
1026
|
"aria-hidden": "true"
|
|
1026
|
-
}, "\u2013"), /* @__PURE__ */
|
|
1027
|
+
}, "\u2013"), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1027
1028
|
className: RangeInput_default.inputWrapper
|
|
1028
|
-
}, /* @__PURE__ */
|
|
1029
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
1029
1030
|
htmlFor: maxInputId,
|
|
1030
1031
|
className: RangeInput_default.inputLabel
|
|
1031
|
-
}, config.maxLabel), /* @__PURE__ */
|
|
1032
|
+
}, config.maxLabel), /* @__PURE__ */ React54__default.default.createElement(input.Input, _extends4({
|
|
1032
1033
|
id: maxInputId,
|
|
1033
1034
|
type: config.inputType,
|
|
1034
1035
|
className: RangeInput_default.input,
|
|
1035
1036
|
value: localMax,
|
|
1036
1037
|
onChange: handleMaxChange,
|
|
1037
1038
|
placeholder: dataRange.dataMax !== void 0 && config.formatPlaceholder ? config.formatPlaceholder(dataRange.dataMax) : void 0
|
|
1038
|
-
}, config.inputProps)))), isLoading && /* @__PURE__ */
|
|
1039
|
+
}, config.inputProps)))), isLoading && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1039
1040
|
className: shared_default.loadingMessage
|
|
1040
1041
|
}, "Loading..."));
|
|
1041
1042
|
}
|
|
1042
|
-
var RangeInput = /* @__PURE__ */
|
|
1043
|
+
var RangeInput = /* @__PURE__ */ React54.memo(RangeInputInner);
|
|
1043
1044
|
|
|
1044
1045
|
// src/filter-list/base/inputs/DateRangeInput.tsx
|
|
1045
1046
|
function _extends5() {
|
|
@@ -1062,11 +1063,11 @@ var dateConfig = {
|
|
|
1062
1063
|
formatTooltip: (min, max, count) => `${formatDateForInput(min)} - ${formatDateForInput(max)}: ${count.toLocaleString()}`
|
|
1063
1064
|
};
|
|
1064
1065
|
function DateRangeInputInner(props) {
|
|
1065
|
-
return /* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ React54__default.default.createElement(RangeInput, _extends5({}, props, {
|
|
1066
1067
|
config: dateConfig
|
|
1067
1068
|
}));
|
|
1068
1069
|
}
|
|
1069
|
-
var DateRangeInput = /* @__PURE__ */
|
|
1070
|
+
var DateRangeInput = /* @__PURE__ */ React54.memo(DateRangeInputInner);
|
|
1070
1071
|
|
|
1071
1072
|
// src/filter-list/base/inputs/LinkedPropertyInput.module.css
|
|
1072
1073
|
var LinkedPropertyInput_default = {};
|
|
@@ -1088,31 +1089,31 @@ function ListogramInputInner({
|
|
|
1088
1089
|
style,
|
|
1089
1090
|
maxVisibleItems
|
|
1090
1091
|
}) {
|
|
1091
|
-
const [isExpanded, setIsExpanded] =
|
|
1092
|
-
const selectedSet =
|
|
1093
|
-
const toggleValue =
|
|
1092
|
+
const [isExpanded, setIsExpanded] = React54.useState(false);
|
|
1093
|
+
const selectedSet = React54.useMemo(() => new Set(selectedValues), [selectedValues]);
|
|
1094
|
+
const toggleValue = React54.useCallback((value) => {
|
|
1094
1095
|
if (selectedSet.has(value)) {
|
|
1095
1096
|
onChange(selectedValues.filter((v) => v !== value));
|
|
1096
1097
|
} else {
|
|
1097
1098
|
onChange([...selectedValues, value]);
|
|
1098
1099
|
}
|
|
1099
1100
|
}, [selectedValues, selectedSet, onChange]);
|
|
1100
|
-
const displayValues =
|
|
1101
|
+
const displayValues = React54.useMemo(() => {
|
|
1101
1102
|
if (isExpanded || !maxVisibleItems) return values;
|
|
1102
1103
|
return values.slice(0, maxVisibleItems);
|
|
1103
1104
|
}, [values, maxVisibleItems, isExpanded]);
|
|
1104
1105
|
const hasMore = maxVisibleItems != null && values.length > maxVisibleItems;
|
|
1105
|
-
return /* @__PURE__ */
|
|
1106
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1106
1107
|
className: classnames14__default.default(ListogramInput_default.listogram, className),
|
|
1107
1108
|
style,
|
|
1108
1109
|
"data-loading": isLoading
|
|
1109
|
-
}, isLoading && /* @__PURE__ */
|
|
1110
|
+
}, isLoading && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1110
1111
|
className: shared_default.loadingMessage
|
|
1111
|
-
}, "Loading values..."), error && /* @__PURE__ */
|
|
1112
|
+
}, "Loading values..."), error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1112
1113
|
className: shared_default.errorMessage
|
|
1113
|
-
}, "Error loading values: ", error.message), !isLoading && !error && values.length === 0 && /* @__PURE__ */
|
|
1114
|
+
}, "Error loading values: ", error.message), !isLoading && !error && values.length === 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1114
1115
|
className: shared_default.emptyMessage
|
|
1115
|
-
}, "No values available"), (values.length > 0 || isLoading) && /* @__PURE__ */
|
|
1116
|
+
}, "No values available"), (values.length > 0 || isLoading) && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1116
1117
|
className: ListogramInput_default.container
|
|
1117
1118
|
}, displayValues.map(({
|
|
1118
1119
|
value,
|
|
@@ -1120,7 +1121,7 @@ function ListogramInputInner({
|
|
|
1120
1121
|
}) => {
|
|
1121
1122
|
const percentage = maxCount > 0 ? count / maxCount * 100 : 0;
|
|
1122
1123
|
const perRowColor = colorMap?.[value];
|
|
1123
|
-
return /* @__PURE__ */
|
|
1124
|
+
return /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1124
1125
|
key: value,
|
|
1125
1126
|
className: ListogramInput_default.row,
|
|
1126
1127
|
onClick: () => toggleValue(value),
|
|
@@ -1131,22 +1132,22 @@ function ListogramInputInner({
|
|
|
1131
1132
|
"--osdk-filter-listogram-row-bar-color": perRowColor
|
|
1132
1133
|
} : void 0
|
|
1133
1134
|
} : void 0
|
|
1134
|
-
}, /* @__PURE__ */
|
|
1135
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1135
1136
|
className: ListogramInput_default.label
|
|
1136
|
-
}, value), displayMode === "full" && /* @__PURE__ */
|
|
1137
|
+
}, value), displayMode === "full" && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1137
1138
|
className: ListogramInput_default.bar
|
|
1138
|
-
}, /* @__PURE__ */
|
|
1139
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1139
1140
|
className: ListogramInput_default.barFill
|
|
1140
|
-
})), displayMode !== "minimal" && /* @__PURE__ */
|
|
1141
|
+
})), displayMode !== "minimal" && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1141
1142
|
className: ListogramInput_default.count
|
|
1142
1143
|
}, count.toLocaleString()));
|
|
1143
|
-
}), hasMore && !isExpanded && /* @__PURE__ */
|
|
1144
|
+
}), hasMore && !isExpanded && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1144
1145
|
type: "button",
|
|
1145
1146
|
className: ListogramInput_default.row,
|
|
1146
1147
|
onClick: () => setIsExpanded(true)
|
|
1147
1148
|
}, "View all (", values.length, ")")));
|
|
1148
1149
|
}
|
|
1149
|
-
var ListogramInput = /* @__PURE__ */
|
|
1150
|
+
var ListogramInput = /* @__PURE__ */ React54.memo(ListogramInputInner);
|
|
1150
1151
|
|
|
1151
1152
|
// src/filter-list/base/inputs/MultiDateInput.module.css
|
|
1152
1153
|
var MultiDateInput_default = {};
|
|
@@ -1161,46 +1162,46 @@ function MultiDateInputInner({
|
|
|
1161
1162
|
maxDate,
|
|
1162
1163
|
showClearAll = true
|
|
1163
1164
|
}) {
|
|
1164
|
-
const addDate =
|
|
1165
|
+
const addDate = React54.useCallback((date) => {
|
|
1165
1166
|
const dateStr = formatDateForInput(date);
|
|
1166
1167
|
const exists = selectedDates.some((d) => formatDateForInput(d) === dateStr);
|
|
1167
1168
|
if (!exists) {
|
|
1168
1169
|
onChange([...selectedDates, date].sort((a, b) => a.getTime() - b.getTime()));
|
|
1169
1170
|
}
|
|
1170
1171
|
}, [selectedDates, onChange]);
|
|
1171
|
-
const removeDate =
|
|
1172
|
+
const removeDate = React54.useCallback((date) => {
|
|
1172
1173
|
const dateStr = formatDateForInput(date);
|
|
1173
1174
|
onChange(selectedDates.filter((d) => formatDateForInput(d) !== dateStr));
|
|
1174
1175
|
}, [selectedDates, onChange]);
|
|
1175
|
-
const clearAll =
|
|
1176
|
+
const clearAll = React54.useCallback(() => {
|
|
1176
1177
|
onChange([]);
|
|
1177
1178
|
}, [onChange]);
|
|
1178
|
-
const handleDateChange =
|
|
1179
|
+
const handleDateChange = React54.useCallback((e) => {
|
|
1179
1180
|
const date = parseDateFromInput(e.target.value);
|
|
1180
1181
|
if (date) {
|
|
1181
1182
|
addDate(date);
|
|
1182
1183
|
e.target.value = "";
|
|
1183
1184
|
}
|
|
1184
1185
|
}, [addDate]);
|
|
1185
|
-
return /* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1186
1187
|
className: classnames14__default.default(MultiDateInput_default.multiDate, className),
|
|
1187
1188
|
style
|
|
1188
|
-
}, selectedDates.length > 0 && /* @__PURE__ */
|
|
1189
|
+
}, selectedDates.length > 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1189
1190
|
className: shared_default.tagContainer
|
|
1190
|
-
}, selectedDates.map((date) => /* @__PURE__ */
|
|
1191
|
+
}, selectedDates.map((date) => /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1191
1192
|
key: date.toISOString(),
|
|
1192
1193
|
className: shared_default.tag
|
|
1193
|
-
}, formatDateForDisplay(date), /* @__PURE__ */
|
|
1194
|
+
}, formatDateForDisplay(date), /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1194
1195
|
className: shared_default.tagRemove,
|
|
1195
1196
|
onClick: () => removeDate(date),
|
|
1196
1197
|
"aria-label": `Remove ${formatDateForDisplay(date)}`
|
|
1197
|
-
}, "\xD7"))), showClearAll && selectedDates.length > 1 && /* @__PURE__ */
|
|
1198
|
+
}, "\xD7"))), showClearAll && selectedDates.length > 1 && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1198
1199
|
className: MultiDateInput_default.clearAll,
|
|
1199
1200
|
onClick: clearAll,
|
|
1200
1201
|
"aria-label": "Clear all dates"
|
|
1201
|
-
}, "Clear all")), /* @__PURE__ */
|
|
1202
|
+
}, "Clear all")), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1202
1203
|
className: MultiDateInput_default.calendarContainer
|
|
1203
|
-
}, /* @__PURE__ */
|
|
1204
|
+
}, /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
1204
1205
|
type: "date",
|
|
1205
1206
|
className: MultiDateInput_default.input,
|
|
1206
1207
|
onChange: handleDateChange,
|
|
@@ -1209,7 +1210,7 @@ function MultiDateInputInner({
|
|
|
1209
1210
|
"aria-label": "Add date"
|
|
1210
1211
|
})));
|
|
1211
1212
|
}
|
|
1212
|
-
var MultiDateInput = /* @__PURE__ */
|
|
1213
|
+
var MultiDateInput = /* @__PURE__ */ React54.memo(MultiDateInputInner);
|
|
1213
1214
|
|
|
1214
1215
|
// src/base-components/combobox/Combobox.module.css
|
|
1215
1216
|
var Combobox_default = {};
|
|
@@ -1228,12 +1229,12 @@ function ComboboxInput({
|
|
|
1228
1229
|
className,
|
|
1229
1230
|
...rest
|
|
1230
1231
|
}) {
|
|
1231
|
-
return /* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1232
1233
|
className: classnames14__default.default(Combobox_default.osdkComboboxInputWrapper, className)
|
|
1233
|
-
}, /* @__PURE__ */
|
|
1234
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Search, {
|
|
1234
1235
|
className: Combobox_default.osdkComboboxSearchIcon,
|
|
1235
1236
|
color: "currentColor"
|
|
1236
|
-
}), /* @__PURE__ */
|
|
1237
|
+
}), /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Input, _extends6({
|
|
1237
1238
|
className: Combobox_default.osdkComboboxInput
|
|
1238
1239
|
}, rest)));
|
|
1239
1240
|
}
|
|
@@ -1242,7 +1243,7 @@ function ComboboxPositioner({
|
|
|
1242
1243
|
children,
|
|
1243
1244
|
...rest
|
|
1244
1245
|
}) {
|
|
1245
|
-
return /* @__PURE__ */
|
|
1246
|
+
return /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Positioner, _extends6({
|
|
1246
1247
|
className: classnames14__default.default(Combobox_default.osdkComboboxPositioner, className),
|
|
1247
1248
|
sideOffset: 4
|
|
1248
1249
|
}, rest), children);
|
|
@@ -1252,7 +1253,7 @@ function ComboboxPopup({
|
|
|
1252
1253
|
children,
|
|
1253
1254
|
...rest
|
|
1254
1255
|
}) {
|
|
1255
|
-
return /* @__PURE__ */
|
|
1256
|
+
return /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Popup, _extends6({
|
|
1256
1257
|
className: classnames14__default.default(Combobox_default.osdkComboboxPopup, className)
|
|
1257
1258
|
}, rest), children);
|
|
1258
1259
|
}
|
|
@@ -1261,7 +1262,7 @@ function ComboboxItem({
|
|
|
1261
1262
|
children,
|
|
1262
1263
|
...rest
|
|
1263
1264
|
}) {
|
|
1264
|
-
return /* @__PURE__ */
|
|
1265
|
+
return /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Item, _extends6({
|
|
1265
1266
|
className: classnames14__default.default(Combobox_default.osdkComboboxItem, className)
|
|
1266
1267
|
}, rest), children);
|
|
1267
1268
|
}
|
|
@@ -1269,10 +1270,10 @@ function ComboboxClear({
|
|
|
1269
1270
|
className,
|
|
1270
1271
|
...rest
|
|
1271
1272
|
}) {
|
|
1272
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Clear, _extends6({
|
|
1273
1274
|
className: classnames14__default.default(Combobox_default.osdkComboboxClear, className),
|
|
1274
1275
|
"aria-label": "Clear all"
|
|
1275
|
-
}, rest), /* @__PURE__ */
|
|
1276
|
+
}, rest), /* @__PURE__ */ React54__default.default.createElement(icons.Cross, {
|
|
1276
1277
|
color: "currentColor"
|
|
1277
1278
|
}));
|
|
1278
1279
|
}
|
|
@@ -1280,7 +1281,7 @@ function ComboboxEmpty({
|
|
|
1280
1281
|
children,
|
|
1281
1282
|
className
|
|
1282
1283
|
}) {
|
|
1283
|
-
return /* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ React54__default.default.createElement(combobox.Combobox.Empty, {
|
|
1284
1285
|
className: classnames14__default.default(Combobox_default.osdkComboboxEmpty, className)
|
|
1285
1286
|
}, children);
|
|
1286
1287
|
}
|
|
@@ -1312,63 +1313,63 @@ function MultiSelectInputInner({
|
|
|
1312
1313
|
showClearAll = true,
|
|
1313
1314
|
ariaLabel = "Search values"
|
|
1314
1315
|
}) {
|
|
1315
|
-
const handleValueChange =
|
|
1316
|
+
const handleValueChange = React54.useCallback((newValues) => {
|
|
1316
1317
|
onChange(newValues ?? []);
|
|
1317
1318
|
}, [onChange]);
|
|
1318
|
-
const removeValue =
|
|
1319
|
+
const removeValue = React54.useCallback((value) => {
|
|
1319
1320
|
onChange(selectedValues.filter((v) => v !== value));
|
|
1320
1321
|
}, [selectedValues, onChange]);
|
|
1321
|
-
const clearAll =
|
|
1322
|
+
const clearAll = React54.useCallback(() => {
|
|
1322
1323
|
onChange([]);
|
|
1323
1324
|
}, [onChange]);
|
|
1324
1325
|
const displayedTags = selectedValues.slice(0, maxDisplayedTags);
|
|
1325
1326
|
const remainingCount = selectedValues.length - maxDisplayedTags;
|
|
1326
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1327
1328
|
className: classnames14__default.default(MultiSelectInput_default.multiSelect, className),
|
|
1328
1329
|
style,
|
|
1329
1330
|
"data-loading": isLoading
|
|
1330
|
-
}, error && /* @__PURE__ */
|
|
1331
|
+
}, error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1331
1332
|
className: shared_default.errorMessage
|
|
1332
|
-
}, "Error loading options: ", error.message), !error && values.length === 0 && /* @__PURE__ */
|
|
1333
|
+
}, "Error loading options: ", error.message), !error && values.length === 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1333
1334
|
className: shared_default.emptyMessage
|
|
1334
|
-
}, isLoading ? "Loading options..." : "No options available"), (values.length > 0 || isLoading) && /* @__PURE__ */
|
|
1335
|
+
}, isLoading ? "Loading options..." : "No options available"), (values.length > 0 || isLoading) && /* @__PURE__ */ React54__default.default.createElement(Combobox.Root, {
|
|
1335
1336
|
multiple: true,
|
|
1336
1337
|
value: selectedValues,
|
|
1337
1338
|
onValueChange: handleValueChange
|
|
1338
|
-
}, isLoading && /* @__PURE__ */
|
|
1339
|
+
}, isLoading && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1339
1340
|
className: shared_default.loadingMessage
|
|
1340
|
-
}, "Updating..."), selectedValues.length > 0 && /* @__PURE__ */
|
|
1341
|
+
}, "Updating..."), selectedValues.length > 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1341
1342
|
className: shared_default.tagContainer
|
|
1342
|
-
}, displayedTags.map((value) => /* @__PURE__ */
|
|
1343
|
+
}, displayedTags.map((value) => /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1343
1344
|
key: value,
|
|
1344
1345
|
className: shared_default.tag
|
|
1345
|
-
}, value, /* @__PURE__ */
|
|
1346
|
+
}, value, /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1346
1347
|
type: "button",
|
|
1347
1348
|
className: shared_default.tagRemove,
|
|
1348
1349
|
onClick: () => removeValue(value),
|
|
1349
1350
|
"aria-label": `Remove ${value}`
|
|
1350
|
-
}, "\xD7"))), remainingCount > 0 && /* @__PURE__ */
|
|
1351
|
+
}, "\xD7"))), remainingCount > 0 && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1351
1352
|
className: shared_default.tag
|
|
1352
|
-
}, "+", remainingCount, " more")), /* @__PURE__ */
|
|
1353
|
+
}, "+", remainingCount, " more")), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1353
1354
|
className: MultiSelectInput_default.inputRow
|
|
1354
|
-
}, /* @__PURE__ */
|
|
1355
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Combobox.Input, {
|
|
1355
1356
|
placeholder: selectedValues.length > 0 ? `${selectedValues.length} selected` : placeholder,
|
|
1356
1357
|
"aria-label": ariaLabel
|
|
1357
|
-
}), showClearAll && selectedValues.length > 0 && /* @__PURE__ */
|
|
1358
|
+
}), showClearAll && selectedValues.length > 0 && /* @__PURE__ */ React54__default.default.createElement(Combobox.Clear, {
|
|
1358
1359
|
className: MultiSelectInput_default.clearButton,
|
|
1359
1360
|
onClick: clearAll,
|
|
1360
1361
|
"aria-label": "Clear all selections"
|
|
1361
|
-
})), /* @__PURE__ */
|
|
1362
|
+
})), /* @__PURE__ */ React54__default.default.createElement(Combobox.Portal, null, /* @__PURE__ */ React54__default.default.createElement(Combobox.Positioner, null, /* @__PURE__ */ React54__default.default.createElement(Combobox.Popup, null, values.length === 0 ? /* @__PURE__ */ React54__default.default.createElement(Combobox.Empty, null, "No options available") : values.map(({
|
|
1362
1363
|
value,
|
|
1363
1364
|
count
|
|
1364
|
-
}) => /* @__PURE__ */
|
|
1365
|
+
}) => /* @__PURE__ */ React54__default.default.createElement(Combobox.Item, {
|
|
1365
1366
|
key: value,
|
|
1366
1367
|
value
|
|
1367
|
-
}, /* @__PURE__ */
|
|
1368
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", null, value), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1368
1369
|
className: MultiSelectInput_default.itemCount
|
|
1369
1370
|
}, "(", count.toLocaleString(), ")"))))))));
|
|
1370
1371
|
}
|
|
1371
|
-
var MultiSelectInput = /* @__PURE__ */
|
|
1372
|
+
var MultiSelectInput = /* @__PURE__ */ React54.memo(MultiSelectInputInner);
|
|
1372
1373
|
|
|
1373
1374
|
// src/filter-list/base/inputs/NullValueWrapper.module.css
|
|
1374
1375
|
var NullValueWrapper_default = {};
|
|
@@ -1385,30 +1386,30 @@ function NullValueWrapperInner({
|
|
|
1385
1386
|
className,
|
|
1386
1387
|
style
|
|
1387
1388
|
}) {
|
|
1388
|
-
const handleToggle =
|
|
1389
|
+
const handleToggle = React54.useCallback(() => {
|
|
1389
1390
|
onIncludeNullChange(!includeNull);
|
|
1390
1391
|
}, [includeNull, onIncludeNullChange]);
|
|
1391
|
-
return /* @__PURE__ */
|
|
1392
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1392
1393
|
className: classnames14__default.default(NullValueWrapper_default.nullWrapper, className),
|
|
1393
1394
|
style
|
|
1394
|
-
}, children, /* @__PURE__ */
|
|
1395
|
+
}, children, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1395
1396
|
className: NullValueWrapper_default.nullValueRow,
|
|
1396
1397
|
"data-checked": includeNull,
|
|
1397
1398
|
"data-loading": isLoading
|
|
1398
|
-
}, /* @__PURE__ */
|
|
1399
|
+
}, /* @__PURE__ */ React54__default.default.createElement("label", {
|
|
1399
1400
|
className: NullValueWrapper_default.nullLabel
|
|
1400
|
-
}, /* @__PURE__ */
|
|
1401
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
1401
1402
|
checked: includeNull,
|
|
1402
1403
|
onCheckedChange: handleToggle
|
|
1403
|
-
}), /* @__PURE__ */
|
|
1404
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1404
1405
|
className: NullValueWrapper_default.nullLabelText
|
|
1405
|
-
}, "No value")), showNullCount && !error && nullCount > 0 && /* @__PURE__ */
|
|
1406
|
+
}, "No value")), showNullCount && !error && nullCount > 0 && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1406
1407
|
className: NullValueWrapper_default.count
|
|
1407
|
-
}, nullCount.toLocaleString())), error && /* @__PURE__ */
|
|
1408
|
+
}, nullCount.toLocaleString())), error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1408
1409
|
className: shared_default.errorMessage
|
|
1409
1410
|
}, "Failed to load null count"));
|
|
1410
1411
|
}
|
|
1411
|
-
var NullValueWrapper = /* @__PURE__ */
|
|
1412
|
+
var NullValueWrapper = /* @__PURE__ */ React54.memo(NullValueWrapperInner);
|
|
1412
1413
|
function _extends7() {
|
|
1413
1414
|
return _extends7 = Object.assign ? Object.assign.bind() : function(n) {
|
|
1414
1415
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -1441,11 +1442,11 @@ var numberConfig = {
|
|
|
1441
1442
|
}
|
|
1442
1443
|
};
|
|
1443
1444
|
function NumberRangeInputInner(props) {
|
|
1444
|
-
return /* @__PURE__ */
|
|
1445
|
+
return /* @__PURE__ */ React54__default.default.createElement(RangeInput, _extends7({}, props, {
|
|
1445
1446
|
config: numberConfig
|
|
1446
1447
|
}));
|
|
1447
1448
|
}
|
|
1448
|
-
var NumberRangeInput = /* @__PURE__ */
|
|
1449
|
+
var NumberRangeInput = /* @__PURE__ */ React54.memo(NumberRangeInputInner);
|
|
1449
1450
|
|
|
1450
1451
|
// src/filter-list/base/inputs/SingleDateInput.module.css
|
|
1451
1452
|
var SingleDateInput_default = {};
|
|
@@ -1461,19 +1462,19 @@ function SingleDateInputInner({
|
|
|
1461
1462
|
placeholder = "Select a date...",
|
|
1462
1463
|
showClearButton = true
|
|
1463
1464
|
}) {
|
|
1464
|
-
const handleChange =
|
|
1465
|
+
const handleChange = React54.useCallback((e) => {
|
|
1465
1466
|
const date = parseDateFromInput(e.target.value);
|
|
1466
1467
|
onChange(date);
|
|
1467
1468
|
}, [onChange]);
|
|
1468
|
-
const handleClear =
|
|
1469
|
+
const handleClear = React54.useCallback(() => {
|
|
1469
1470
|
onChange(void 0);
|
|
1470
1471
|
}, [onChange]);
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1472
1473
|
className: classnames14__default.default(SingleDateInput_default.singleDate, className),
|
|
1473
1474
|
style
|
|
1474
|
-
}, /* @__PURE__ */
|
|
1475
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1475
1476
|
className: SingleDateInput_default.dateContainer
|
|
1476
|
-
}, /* @__PURE__ */
|
|
1477
|
+
}, /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
1477
1478
|
type: "date",
|
|
1478
1479
|
className: SingleDateInput_default.input,
|
|
1479
1480
|
value: formatDateForInput(selectedDate),
|
|
@@ -1482,13 +1483,13 @@ function SingleDateInputInner({
|
|
|
1482
1483
|
max: maxDate ? formatDateForInput(maxDate) : void 0,
|
|
1483
1484
|
placeholder,
|
|
1484
1485
|
"aria-label": "Select date"
|
|
1485
|
-
}), showClearButton && selectedDate !== void 0 && /* @__PURE__ */
|
|
1486
|
+
}), showClearButton && selectedDate !== void 0 && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1486
1487
|
className: SingleDateInput_default.clearButton,
|
|
1487
1488
|
onClick: handleClear,
|
|
1488
1489
|
"aria-label": "Clear date"
|
|
1489
1490
|
}, "\xD7")));
|
|
1490
1491
|
}
|
|
1491
|
-
var SingleDateInput = /* @__PURE__ */
|
|
1492
|
+
var SingleDateInput = /* @__PURE__ */ React54.memo(SingleDateInputInner);
|
|
1492
1493
|
|
|
1493
1494
|
// src/base-components/select/Select.module.css
|
|
1494
1495
|
var Select_default = {};
|
|
@@ -1507,7 +1508,7 @@ function SelectRoot({
|
|
|
1507
1508
|
children,
|
|
1508
1509
|
...rest
|
|
1509
1510
|
}) {
|
|
1510
|
-
return /* @__PURE__ */
|
|
1511
|
+
return /* @__PURE__ */ React54__default.default.createElement(select.Select.Root, rest, children);
|
|
1511
1512
|
}
|
|
1512
1513
|
function SelectTrigger({
|
|
1513
1514
|
className,
|
|
@@ -1515,11 +1516,11 @@ function SelectTrigger({
|
|
|
1515
1516
|
children,
|
|
1516
1517
|
...rest
|
|
1517
1518
|
}) {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ React54__default.default.createElement(select.Select.Trigger, _extends8({
|
|
1519
1520
|
className: classnames14__default.default(Select_default.osdkSelectTrigger, className)
|
|
1520
|
-
}, rest), children ?? /* @__PURE__ */
|
|
1521
|
+
}, rest), children ?? /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(select.Select.Value, null, (value) => value != null ? String(value) : placeholder), /* @__PURE__ */ React54__default.default.createElement(select.Select.Icon, {
|
|
1521
1522
|
className: Select_default.osdkSelectIcon
|
|
1522
|
-
}, /* @__PURE__ */
|
|
1523
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.CaretDown, {
|
|
1523
1524
|
color: "currentColor"
|
|
1524
1525
|
}))));
|
|
1525
1526
|
}
|
|
@@ -1528,7 +1529,7 @@ function SelectPositioner({
|
|
|
1528
1529
|
children,
|
|
1529
1530
|
...rest
|
|
1530
1531
|
}) {
|
|
1531
|
-
return /* @__PURE__ */
|
|
1532
|
+
return /* @__PURE__ */ React54__default.default.createElement(select.Select.Positioner, _extends8({
|
|
1532
1533
|
className: classnames14__default.default(Select_default.osdkSelectPositioner, className),
|
|
1533
1534
|
sideOffset: 4
|
|
1534
1535
|
}, rest), children);
|
|
@@ -1538,7 +1539,7 @@ function SelectPopup({
|
|
|
1538
1539
|
children,
|
|
1539
1540
|
...rest
|
|
1540
1541
|
}) {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ React54__default.default.createElement(select.Select.Popup, _extends8({
|
|
1542
1543
|
className: classnames14__default.default(Select_default.osdkSelectPopup, className)
|
|
1543
1544
|
}, rest), children);
|
|
1544
1545
|
}
|
|
@@ -1547,9 +1548,9 @@ function SelectItem({
|
|
|
1547
1548
|
children,
|
|
1548
1549
|
...rest
|
|
1549
1550
|
}) {
|
|
1550
|
-
return /* @__PURE__ */
|
|
1551
|
+
return /* @__PURE__ */ React54__default.default.createElement(select.Select.Item, _extends8({
|
|
1551
1552
|
className: classnames14__default.default(Select_default.osdkSelectItem, className)
|
|
1552
|
-
}, rest), /* @__PURE__ */
|
|
1553
|
+
}, rest), /* @__PURE__ */ React54__default.default.createElement(select.Select.ItemText, null, children));
|
|
1553
1554
|
}
|
|
1554
1555
|
var Select = {
|
|
1555
1556
|
Root: SelectRoot,
|
|
@@ -1577,13 +1578,13 @@ function SingleSelectInputInner({
|
|
|
1577
1578
|
showCounts = false,
|
|
1578
1579
|
ariaLabel = "Select value"
|
|
1579
1580
|
}) {
|
|
1580
|
-
const handleValueChange =
|
|
1581
|
+
const handleValueChange = React54.useCallback((value) => {
|
|
1581
1582
|
onChange(value ?? void 0);
|
|
1582
1583
|
}, [onChange]);
|
|
1583
|
-
const handleClear =
|
|
1584
|
+
const handleClear = React54.useCallback(() => {
|
|
1584
1585
|
onChange(void 0);
|
|
1585
1586
|
}, [onChange]);
|
|
1586
|
-
const items =
|
|
1587
|
+
const items = React54.useMemo(() => {
|
|
1587
1588
|
const result = {};
|
|
1588
1589
|
for (const {
|
|
1589
1590
|
value,
|
|
@@ -1593,57 +1594,57 @@ function SingleSelectInputInner({
|
|
|
1593
1594
|
}
|
|
1594
1595
|
return result;
|
|
1595
1596
|
}, [values, showCounts]);
|
|
1596
|
-
return /* @__PURE__ */
|
|
1597
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1597
1598
|
className: classnames14__default.default(SingleSelectInput_default.singleSelect, className),
|
|
1598
1599
|
style,
|
|
1599
1600
|
"data-loading": isLoading
|
|
1600
|
-
}, isLoading && /* @__PURE__ */
|
|
1601
|
+
}, isLoading && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1601
1602
|
className: shared_default.loadingMessage
|
|
1602
|
-
}, "Loading options..."), error && /* @__PURE__ */
|
|
1603
|
+
}, "Loading options..."), error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1603
1604
|
className: shared_default.errorMessage
|
|
1604
|
-
}, "Error loading options: ", error.message), !isLoading && !error && values.length === 0 && /* @__PURE__ */
|
|
1605
|
+
}, "Error loading options: ", error.message), !isLoading && !error && values.length === 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1605
1606
|
className: shared_default.emptyMessage
|
|
1606
|
-
}, "No options available"), (values.length > 0 || isLoading) && /* @__PURE__ */
|
|
1607
|
+
}, "No options available"), (values.length > 0 || isLoading) && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1607
1608
|
className: SingleSelectInput_default.selectContainer
|
|
1608
|
-
}, /* @__PURE__ */
|
|
1609
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Select.Root, {
|
|
1609
1610
|
value: selectedValue ?? null,
|
|
1610
1611
|
onValueChange: handleValueChange,
|
|
1611
1612
|
items
|
|
1612
|
-
}, /* @__PURE__ */
|
|
1613
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Select.Trigger, {
|
|
1613
1614
|
placeholder,
|
|
1614
1615
|
"aria-label": ariaLabel
|
|
1615
|
-
}), /* @__PURE__ */
|
|
1616
|
+
}), /* @__PURE__ */ React54__default.default.createElement(Select.Portal, null, /* @__PURE__ */ React54__default.default.createElement(Select.Positioner, null, /* @__PURE__ */ React54__default.default.createElement(Select.Popup, null, values.map(({
|
|
1616
1617
|
value,
|
|
1617
1618
|
count
|
|
1618
|
-
}) => /* @__PURE__ */
|
|
1619
|
+
}) => /* @__PURE__ */ React54__default.default.createElement(Select.Item, {
|
|
1619
1620
|
key: value,
|
|
1620
1621
|
value
|
|
1621
|
-
}, showCounts ? `${value} (${count.toLocaleString()})` : value)))))), showClearButton && selectedValue !== void 0 && /* @__PURE__ */
|
|
1622
|
+
}, showCounts ? `${value} (${count.toLocaleString()})` : value)))))), showClearButton && selectedValue !== void 0 && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1622
1623
|
type: "button",
|
|
1623
1624
|
className: SingleSelectInput_default.clearButton,
|
|
1624
1625
|
onClick: handleClear,
|
|
1625
1626
|
"aria-label": "Clear selection"
|
|
1626
|
-
}, /* @__PURE__ */
|
|
1627
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Cross, {
|
|
1627
1628
|
color: "currentColor"
|
|
1628
1629
|
}))));
|
|
1629
1630
|
}
|
|
1630
|
-
var SingleSelectInput = /* @__PURE__ */
|
|
1631
|
+
var SingleSelectInput = /* @__PURE__ */ React54.memo(SingleSelectInputInner);
|
|
1631
1632
|
|
|
1632
1633
|
// src/filter-list/base/inputs/TextTagsInput.module.css
|
|
1633
1634
|
var TextTagsInput_default = {};
|
|
1634
1635
|
|
|
1635
1636
|
// src/filter-list/base/inputs/TextTagsInput.tsx
|
|
1636
1637
|
var TAG_SEPARATOR_PATTERN = /[,\n]/;
|
|
1637
|
-
var TagItem = /* @__PURE__ */
|
|
1638
|
+
var TagItem = /* @__PURE__ */ React54.memo(function TagItem2({
|
|
1638
1639
|
tag,
|
|
1639
1640
|
onRemove
|
|
1640
1641
|
}) {
|
|
1641
|
-
const handleRemove =
|
|
1642
|
+
const handleRemove = React54.useCallback(() => {
|
|
1642
1643
|
onRemove(tag);
|
|
1643
1644
|
}, [tag, onRemove]);
|
|
1644
|
-
return /* @__PURE__ */
|
|
1645
|
+
return /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
1645
1646
|
className: shared_default.tag
|
|
1646
|
-
}, tag, /* @__PURE__ */
|
|
1647
|
+
}, tag, /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1647
1648
|
type: "button",
|
|
1648
1649
|
className: shared_default.tagRemove,
|
|
1649
1650
|
onClick: handleRemove,
|
|
@@ -1663,29 +1664,29 @@ function TextTagsInputInner({
|
|
|
1663
1664
|
suggestionLimit = 10,
|
|
1664
1665
|
ariaLabel = "Add tag"
|
|
1665
1666
|
}) {
|
|
1666
|
-
const [inputValue, setInputValue] =
|
|
1667
|
-
const filteredSuggestions =
|
|
1667
|
+
const [inputValue, setInputValue] = React54.useState("");
|
|
1668
|
+
const filteredSuggestions = React54.useMemo(() => {
|
|
1668
1669
|
if (!suggestionLimit) return [];
|
|
1669
1670
|
const lowerInput = inputValue.toLowerCase();
|
|
1670
1671
|
return suggestions.filter((s) => (!inputValue.trim() || s.value.toLowerCase().includes(lowerInput)) && !tags.includes(s.value)).slice(0, suggestionLimit);
|
|
1671
1672
|
}, [suggestions, inputValue, tags, suggestionLimit]);
|
|
1672
|
-
const addTag =
|
|
1673
|
+
const addTag = React54.useCallback((tag) => {
|
|
1673
1674
|
const trimmedTag = tag.trim();
|
|
1674
1675
|
if (trimmedTag && !tags.includes(trimmedTag)) {
|
|
1675
1676
|
onChange([...tags, trimmedTag]);
|
|
1676
1677
|
}
|
|
1677
1678
|
setInputValue("");
|
|
1678
1679
|
}, [tags, onChange]);
|
|
1679
|
-
const removeTag =
|
|
1680
|
+
const removeTag = React54.useCallback((tag) => {
|
|
1680
1681
|
onChange(tags.filter((t) => t !== tag));
|
|
1681
1682
|
}, [tags, onChange]);
|
|
1682
|
-
const handleValueChange =
|
|
1683
|
+
const handleValueChange = React54.useCallback((newTags) => {
|
|
1683
1684
|
onChange(newTags ?? []);
|
|
1684
1685
|
}, [onChange]);
|
|
1685
|
-
const handleInputValueChange =
|
|
1686
|
+
const handleInputValueChange = React54.useCallback((value) => {
|
|
1686
1687
|
setInputValue(value);
|
|
1687
1688
|
}, []);
|
|
1688
|
-
const handleKeyDown =
|
|
1689
|
+
const handleKeyDown = React54.useCallback((e) => {
|
|
1689
1690
|
if (e.key === "Enter" && inputValue.trim()) {
|
|
1690
1691
|
if (filteredSuggestions.length > 0) {
|
|
1691
1692
|
return;
|
|
@@ -1698,7 +1699,7 @@ function TextTagsInputInner({
|
|
|
1698
1699
|
removeTag(tags[tags.length - 1]);
|
|
1699
1700
|
}
|
|
1700
1701
|
}, [inputValue, tags, addTag, removeTag, allowCustomTags, filteredSuggestions]);
|
|
1701
|
-
const handlePaste =
|
|
1702
|
+
const handlePaste = React54.useCallback((e) => {
|
|
1702
1703
|
const pastedText = e.clipboardData.getData("text");
|
|
1703
1704
|
if (TAG_SEPARATOR_PATTERN.test(pastedText)) {
|
|
1704
1705
|
e.preventDefault();
|
|
@@ -1708,41 +1709,41 @@ function TextTagsInputInner({
|
|
|
1708
1709
|
}
|
|
1709
1710
|
}
|
|
1710
1711
|
}, [tags, onChange]);
|
|
1711
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1712
1713
|
className: classnames14__default.default(TextTagsInput_default.textTags, className),
|
|
1713
1714
|
style,
|
|
1714
1715
|
"data-loading": isLoading
|
|
1715
|
-
}, error && /* @__PURE__ */
|
|
1716
|
+
}, error && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1716
1717
|
className: shared_default.errorMessage
|
|
1717
|
-
}, "Error loading suggestions: ", error.message), /* @__PURE__ */
|
|
1718
|
+
}, "Error loading suggestions: ", error.message), /* @__PURE__ */ React54__default.default.createElement(Combobox.Root, {
|
|
1718
1719
|
multiple: true,
|
|
1719
1720
|
value: tags,
|
|
1720
1721
|
onValueChange: handleValueChange,
|
|
1721
1722
|
inputValue,
|
|
1722
1723
|
onInputValueChange: handleInputValueChange
|
|
1723
|
-
}, tags.length > 0 && /* @__PURE__ */
|
|
1724
|
+
}, tags.length > 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1724
1725
|
className: shared_default.tagContainer
|
|
1725
|
-
}, tags.map((tag) => /* @__PURE__ */
|
|
1726
|
+
}, tags.map((tag) => /* @__PURE__ */ React54__default.default.createElement(TagItem, {
|
|
1726
1727
|
key: tag,
|
|
1727
1728
|
tag,
|
|
1728
1729
|
onRemove: removeTag
|
|
1729
|
-
}))), /* @__PURE__ */
|
|
1730
|
+
}))), /* @__PURE__ */ React54__default.default.createElement(Combobox.Input, {
|
|
1730
1731
|
className: TextTagsInput_default.input,
|
|
1731
1732
|
placeholder: tags.length > 0 ? "" : placeholder,
|
|
1732
1733
|
onKeyDown: handleKeyDown,
|
|
1733
1734
|
onPaste: handlePaste,
|
|
1734
1735
|
"aria-label": ariaLabel
|
|
1735
|
-
}), /* @__PURE__ */
|
|
1736
|
+
}), /* @__PURE__ */ React54__default.default.createElement(Combobox.Portal, null, /* @__PURE__ */ React54__default.default.createElement(Combobox.Positioner, null, /* @__PURE__ */ React54__default.default.createElement(Combobox.Popup, null, filteredSuggestions.length === 0 ? allowCustomTags && inputValue.trim() ? /* @__PURE__ */ React54__default.default.createElement(Combobox.Empty, null, 'Press Enter to add "', inputValue, '"') : /* @__PURE__ */ React54__default.default.createElement(Combobox.Empty, null, suggestionLimit ? "No suggestions" : "Type to add a tag") : filteredSuggestions.map(({
|
|
1736
1737
|
value,
|
|
1737
1738
|
count
|
|
1738
|
-
}) => /* @__PURE__ */
|
|
1739
|
+
}) => /* @__PURE__ */ React54__default.default.createElement(Combobox.Item, {
|
|
1739
1740
|
key: value,
|
|
1740
1741
|
value
|
|
1741
|
-
}, value, " (", count.toLocaleString(), ")")))))), isLoading && !!suggestionLimit && /* @__PURE__ */
|
|
1742
|
+
}, value, " (", count.toLocaleString(), ")")))))), isLoading && !!suggestionLimit && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1742
1743
|
className: shared_default.loadingMessage
|
|
1743
1744
|
}, "Loading suggestions..."));
|
|
1744
1745
|
}
|
|
1745
|
-
var TextTagsInput = /* @__PURE__ */
|
|
1746
|
+
var TextTagsInput = /* @__PURE__ */ React54.memo(TextTagsInputInner);
|
|
1746
1747
|
|
|
1747
1748
|
// src/filter-list/base/inputs/TimelineInput.module.css
|
|
1748
1749
|
var TimelineInput_default = {};
|
|
@@ -1756,31 +1757,31 @@ function TimelineInputInner({
|
|
|
1756
1757
|
minDate,
|
|
1757
1758
|
maxDate
|
|
1758
1759
|
}) {
|
|
1759
|
-
const handleStartChange =
|
|
1760
|
+
const handleStartChange = React54.useCallback((e) => {
|
|
1760
1761
|
const date = parseDateFromInput(e.target.value);
|
|
1761
1762
|
onChange(date, endDate);
|
|
1762
1763
|
}, [onChange, endDate]);
|
|
1763
|
-
const handleEndChange =
|
|
1764
|
+
const handleEndChange = React54.useCallback((e) => {
|
|
1764
1765
|
const date = parseDateFromInput(e.target.value);
|
|
1765
1766
|
onChange(startDate, date);
|
|
1766
1767
|
}, [onChange, startDate]);
|
|
1767
|
-
const handleClear =
|
|
1768
|
+
const handleClear = React54.useCallback(() => {
|
|
1768
1769
|
onChange(void 0, void 0);
|
|
1769
1770
|
}, [onChange]);
|
|
1770
|
-
const startInputMax =
|
|
1771
|
-
const endInputMin =
|
|
1772
|
-
return /* @__PURE__ */
|
|
1771
|
+
const startInputMax = React54.useMemo(() => endDate ?? maxDate, [endDate, maxDate]);
|
|
1772
|
+
const endInputMin = React54.useMemo(() => startDate ?? minDate, [startDate, minDate]);
|
|
1773
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1773
1774
|
className: classnames14__default.default(TimelineInput_default.timeline, className)
|
|
1774
|
-
}, /* @__PURE__ */
|
|
1775
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1775
1776
|
className: TimelineInput_default.labels
|
|
1776
|
-
}, /* @__PURE__ */
|
|
1777
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", null, formatDateForDisplay(startDate, "\u2014")), /* @__PURE__ */ React54__default.default.createElement("span", null, "to"), /* @__PURE__ */ React54__default.default.createElement("span", null, formatDateForDisplay(endDate, "\u2014")), (startDate || endDate) && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
1777
1778
|
type: "button",
|
|
1778
1779
|
onClick: handleClear,
|
|
1779
1780
|
"aria-label": "Clear range",
|
|
1780
1781
|
className: TimelineInput_default.clearButton
|
|
1781
|
-
}, "\xD7")), /* @__PURE__ */
|
|
1782
|
+
}, "\xD7")), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
1782
1783
|
className: TimelineInput_default.brush
|
|
1783
|
-
}, /* @__PURE__ */
|
|
1784
|
+
}, /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
1784
1785
|
type: "date",
|
|
1785
1786
|
className: TimelineInput_default.input,
|
|
1786
1787
|
value: formatDateForInput(startDate),
|
|
@@ -1788,7 +1789,7 @@ function TimelineInputInner({
|
|
|
1788
1789
|
min: minDate ? formatDateForInput(minDate) : void 0,
|
|
1789
1790
|
max: startInputMax ? formatDateForInput(startInputMax) : void 0,
|
|
1790
1791
|
"aria-label": "Start date"
|
|
1791
|
-
}), /* @__PURE__ */
|
|
1792
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", null, "\u2014"), /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
1792
1793
|
type: "date",
|
|
1793
1794
|
className: TimelineInput_default.input,
|
|
1794
1795
|
value: formatDateForInput(endDate),
|
|
@@ -1798,9 +1799,9 @@ function TimelineInputInner({
|
|
|
1798
1799
|
"aria-label": "End date"
|
|
1799
1800
|
})));
|
|
1800
1801
|
}
|
|
1801
|
-
var TimelineInput = /* @__PURE__ */
|
|
1802
|
+
var TimelineInput = /* @__PURE__ */ React54.memo(TimelineInputInner);
|
|
1802
1803
|
function usePropertyAggregation(objectType, propertyKey, options) {
|
|
1803
|
-
const aggregateOptions =
|
|
1804
|
+
const aggregateOptions = React54.useMemo(() => ({
|
|
1804
1805
|
$select: {
|
|
1805
1806
|
$count: "unordered"
|
|
1806
1807
|
},
|
|
@@ -1820,7 +1821,7 @@ function usePropertyAggregation(objectType, propertyKey, options) {
|
|
|
1820
1821
|
aggregate: aggregateOptions,
|
|
1821
1822
|
where: options?.where
|
|
1822
1823
|
});
|
|
1823
|
-
const result =
|
|
1824
|
+
const result = React54.useMemo(() => {
|
|
1824
1825
|
if (!countData) {
|
|
1825
1826
|
return {
|
|
1826
1827
|
data: [],
|
|
@@ -1917,45 +1918,45 @@ function LinkedPropertyInputInner({
|
|
|
1917
1918
|
className,
|
|
1918
1919
|
style
|
|
1919
1920
|
}) {
|
|
1920
|
-
const linkedObjectSet =
|
|
1921
|
+
const linkedObjectSet = React54.useMemo(() => objectSet.pivotTo(definition.linkName), [objectSet, definition.linkName]);
|
|
1921
1922
|
const linkedObjectType = linkedObjectSet.$objectSetInternals.def;
|
|
1922
1923
|
const linkedPropertyKey = definition.linkedPropertyKey;
|
|
1923
1924
|
const innerState = filterState?.type === "linkedProperty" ? filterState.linkedFilterState : void 0;
|
|
1924
1925
|
const isExcluding = innerState?.isExcluding ?? false;
|
|
1925
1926
|
const includeNull = innerState?.includeNull;
|
|
1926
|
-
const wrappedOnChange =
|
|
1927
|
+
const wrappedOnChange = React54.useCallback((innerFilterState) => {
|
|
1927
1928
|
onFilterStateChanged({
|
|
1928
1929
|
type: "linkedProperty",
|
|
1929
1930
|
linkedFilterState: innerFilterState
|
|
1930
1931
|
});
|
|
1931
1932
|
}, [onFilterStateChanged]);
|
|
1932
|
-
const onSelectChange =
|
|
1933
|
+
const onSelectChange = React54.useCallback((selectedValues) => {
|
|
1933
1934
|
wrappedOnChange({
|
|
1934
1935
|
type: "SELECT",
|
|
1935
1936
|
selectedValues,
|
|
1936
1937
|
isExcluding
|
|
1937
1938
|
});
|
|
1938
1939
|
}, [wrappedOnChange, isExcluding]);
|
|
1939
|
-
const onSingleSelectChange =
|
|
1940
|
+
const onSingleSelectChange = React54.useCallback((selectedValue) => {
|
|
1940
1941
|
wrappedOnChange({
|
|
1941
1942
|
type: "SELECT",
|
|
1942
1943
|
selectedValues: selectedValue !== void 0 ? [selectedValue] : [],
|
|
1943
1944
|
isExcluding
|
|
1944
1945
|
});
|
|
1945
1946
|
}, [wrappedOnChange, isExcluding]);
|
|
1946
|
-
const onContainsTextChange =
|
|
1947
|
+
const onContainsTextChange = React54.useCallback((value) => {
|
|
1947
1948
|
wrappedOnChange({
|
|
1948
1949
|
type: "CONTAINS_TEXT",
|
|
1949
1950
|
value
|
|
1950
1951
|
});
|
|
1951
1952
|
}, [wrappedOnChange]);
|
|
1952
|
-
const onToggleChange =
|
|
1953
|
+
const onToggleChange = React54.useCallback((enabled) => {
|
|
1953
1954
|
wrappedOnChange({
|
|
1954
1955
|
type: "TOGGLE",
|
|
1955
1956
|
enabled
|
|
1956
1957
|
});
|
|
1957
1958
|
}, [wrappedOnChange]);
|
|
1958
|
-
const onNumberRangeChange =
|
|
1959
|
+
const onNumberRangeChange = React54.useCallback((minValue, maxValue) => {
|
|
1959
1960
|
wrappedOnChange({
|
|
1960
1961
|
type: "NUMBER_RANGE",
|
|
1961
1962
|
minValue,
|
|
@@ -1963,7 +1964,7 @@ function LinkedPropertyInputInner({
|
|
|
1963
1964
|
includeNull
|
|
1964
1965
|
});
|
|
1965
1966
|
}, [wrappedOnChange, includeNull]);
|
|
1966
|
-
const onDateRangeChange =
|
|
1967
|
+
const onDateRangeChange = React54.useCallback((minValue, maxValue) => {
|
|
1967
1968
|
wrappedOnChange({
|
|
1968
1969
|
type: "DATE_RANGE",
|
|
1969
1970
|
minValue,
|
|
@@ -1971,27 +1972,27 @@ function LinkedPropertyInputInner({
|
|
|
1971
1972
|
includeNull
|
|
1972
1973
|
});
|
|
1973
1974
|
}, [wrappedOnChange, includeNull]);
|
|
1974
|
-
const onExactMatchChange =
|
|
1975
|
+
const onExactMatchChange = React54.useCallback((values) => {
|
|
1975
1976
|
wrappedOnChange({
|
|
1976
1977
|
type: "EXACT_MATCH",
|
|
1977
1978
|
values,
|
|
1978
1979
|
isExcluding
|
|
1979
1980
|
});
|
|
1980
1981
|
}, [wrappedOnChange, isExcluding]);
|
|
1981
|
-
const onDateSelectChange =
|
|
1982
|
+
const onDateSelectChange = React54.useCallback((date) => {
|
|
1982
1983
|
wrappedOnChange({
|
|
1983
1984
|
type: "SELECT",
|
|
1984
1985
|
selectedValues: date !== void 0 ? [date] : [],
|
|
1985
1986
|
isExcluding
|
|
1986
1987
|
});
|
|
1987
1988
|
}, [wrappedOnChange, isExcluding]);
|
|
1988
|
-
const onMultiDateChange =
|
|
1989
|
+
const onMultiDateChange = React54.useCallback((dates) => {
|
|
1989
1990
|
wrappedOnChange({
|
|
1990
1991
|
type: "SELECT",
|
|
1991
1992
|
selectedValues: dates
|
|
1992
1993
|
});
|
|
1993
1994
|
}, [wrappedOnChange]);
|
|
1994
|
-
const onTimelineChange =
|
|
1995
|
+
const onTimelineChange = React54.useCallback((start, end) => {
|
|
1995
1996
|
wrappedOnChange({
|
|
1996
1997
|
type: "TIMELINE",
|
|
1997
1998
|
startDate: start,
|
|
@@ -1999,7 +2000,7 @@ function LinkedPropertyInputInner({
|
|
|
1999
2000
|
isExcluding
|
|
2000
2001
|
});
|
|
2001
2002
|
}, [wrappedOnChange, isExcluding]);
|
|
2002
|
-
const onNullChange =
|
|
2003
|
+
const onNullChange = React54.useCallback((newIncludeNull) => {
|
|
2003
2004
|
if (innerState?.type === "NUMBER_RANGE") {
|
|
2004
2005
|
wrappedOnChange({
|
|
2005
2006
|
...innerState,
|
|
@@ -2023,7 +2024,7 @@ function LinkedPropertyInputInner({
|
|
|
2023
2024
|
switch (definition.linkedFilterComponent) {
|
|
2024
2025
|
case "CHECKBOX_LIST": {
|
|
2025
2026
|
const selectedValues = innerState?.type === "SELECT" ? coerceToStringArray(innerState.selectedValues) : [];
|
|
2026
|
-
return /* @__PURE__ */
|
|
2027
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedCheckboxListInput, {
|
|
2027
2028
|
objectType: linkedObjectType,
|
|
2028
2029
|
propertyKey: linkedPropertyKey,
|
|
2029
2030
|
selectedValues,
|
|
@@ -2032,7 +2033,7 @@ function LinkedPropertyInputInner({
|
|
|
2032
2033
|
}
|
|
2033
2034
|
case "MULTI_SELECT": {
|
|
2034
2035
|
const values = innerState?.type === "SELECT" ? coerceToStringArray(innerState.selectedValues) : [];
|
|
2035
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedMultiSelectInput, {
|
|
2036
2037
|
objectType: linkedObjectType,
|
|
2037
2038
|
propertyKey: linkedPropertyKey,
|
|
2038
2039
|
selectedValues: values,
|
|
@@ -2041,7 +2042,7 @@ function LinkedPropertyInputInner({
|
|
|
2041
2042
|
}
|
|
2042
2043
|
case "SINGLE_SELECT": {
|
|
2043
2044
|
const value = innerState?.type === "SELECT" ? coerceToString(innerState.selectedValues[0]) : void 0;
|
|
2044
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedSingleSelectInput, {
|
|
2045
2046
|
objectType: linkedObjectType,
|
|
2046
2047
|
propertyKey: linkedPropertyKey,
|
|
2047
2048
|
selectedValue: value,
|
|
@@ -2050,7 +2051,7 @@ function LinkedPropertyInputInner({
|
|
|
2050
2051
|
}
|
|
2051
2052
|
case "CONTAINS_TEXT": {
|
|
2052
2053
|
const value = innerState?.type === "CONTAINS_TEXT" ? innerState.value : void 0;
|
|
2053
|
-
return /* @__PURE__ */
|
|
2054
|
+
return /* @__PURE__ */ React54__default.default.createElement(ContainsTextInput, {
|
|
2054
2055
|
value,
|
|
2055
2056
|
onChange: onContainsTextChange,
|
|
2056
2057
|
placeholder: `Search ${String(definition.linkedPropertyKey)}...`
|
|
@@ -2058,14 +2059,14 @@ function LinkedPropertyInputInner({
|
|
|
2058
2059
|
}
|
|
2059
2060
|
case "TOGGLE": {
|
|
2060
2061
|
const enabled = innerState?.type === "TOGGLE" ? innerState.enabled : false;
|
|
2061
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ React54__default.default.createElement(ToggleInput, {
|
|
2062
2063
|
enabled,
|
|
2063
2064
|
onChange: onToggleChange
|
|
2064
2065
|
});
|
|
2065
2066
|
}
|
|
2066
2067
|
case "NUMBER_RANGE": {
|
|
2067
2068
|
const nr = innerState?.type === "NUMBER_RANGE" ? innerState : void 0;
|
|
2068
|
-
return /* @__PURE__ */
|
|
2069
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedNumberRangeInput, {
|
|
2069
2070
|
objectType: linkedObjectType,
|
|
2070
2071
|
propertyKey: linkedPropertyKey,
|
|
2071
2072
|
minValue: nr?.minValue,
|
|
@@ -2077,7 +2078,7 @@ function LinkedPropertyInputInner({
|
|
|
2077
2078
|
}
|
|
2078
2079
|
case "DATE_RANGE": {
|
|
2079
2080
|
const dr = innerState?.type === "DATE_RANGE" ? innerState : void 0;
|
|
2080
|
-
return /* @__PURE__ */
|
|
2081
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedDateRangeInput, {
|
|
2081
2082
|
objectType: linkedObjectType,
|
|
2082
2083
|
propertyKey: linkedPropertyKey,
|
|
2083
2084
|
minValue: dr?.minValue,
|
|
@@ -2090,7 +2091,7 @@ function LinkedPropertyInputInner({
|
|
|
2090
2091
|
case "LISTOGRAM": {
|
|
2091
2092
|
const exactState = innerState?.type === "EXACT_MATCH" ? innerState : void 0;
|
|
2092
2093
|
const selectedValues = exactState ? coerceToStringArray(exactState.values) : [];
|
|
2093
|
-
return /* @__PURE__ */
|
|
2094
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedListogramInput, {
|
|
2094
2095
|
objectType: linkedObjectType,
|
|
2095
2096
|
propertyKey: linkedPropertyKey,
|
|
2096
2097
|
selectedValues,
|
|
@@ -2100,7 +2101,7 @@ function LinkedPropertyInputInner({
|
|
|
2100
2101
|
case "TEXT_TAGS": {
|
|
2101
2102
|
const exactState = innerState?.type === "EXACT_MATCH" ? innerState : void 0;
|
|
2102
2103
|
const tags = exactState ? coerceToStringArray(exactState.values) : [];
|
|
2103
|
-
return /* @__PURE__ */
|
|
2104
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedTextTagsInput, {
|
|
2104
2105
|
objectType: linkedObjectType,
|
|
2105
2106
|
propertyKey: linkedPropertyKey,
|
|
2106
2107
|
tags,
|
|
@@ -2109,7 +2110,7 @@ function LinkedPropertyInputInner({
|
|
|
2109
2110
|
}
|
|
2110
2111
|
case "SINGLE_DATE": {
|
|
2111
2112
|
const selectedDate = innerState?.type === "SELECT" ? innerState.selectedValues[0] instanceof Date ? innerState.selectedValues[0] : void 0 : void 0;
|
|
2112
|
-
return /* @__PURE__ */
|
|
2113
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleDateInput, {
|
|
2113
2114
|
selectedDate,
|
|
2114
2115
|
onChange: onDateSelectChange,
|
|
2115
2116
|
showClearButton: true
|
|
@@ -2117,7 +2118,7 @@ function LinkedPropertyInputInner({
|
|
|
2117
2118
|
}
|
|
2118
2119
|
case "MULTI_DATE": {
|
|
2119
2120
|
const selectedDates = innerState?.type === "SELECT" ? innerState.selectedValues.filter((v) => v instanceof Date) : [];
|
|
2120
|
-
return /* @__PURE__ */
|
|
2121
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiDateInput, {
|
|
2121
2122
|
selectedDates,
|
|
2122
2123
|
onChange: onMultiDateChange,
|
|
2123
2124
|
showClearAll: true
|
|
@@ -2125,7 +2126,7 @@ function LinkedPropertyInputInner({
|
|
|
2125
2126
|
}
|
|
2126
2127
|
case "TIMELINE": {
|
|
2127
2128
|
const tl = innerState?.type === "TIMELINE" ? innerState : void 0;
|
|
2128
|
-
return /* @__PURE__ */
|
|
2129
|
+
return /* @__PURE__ */ React54__default.default.createElement(TimelineInput, {
|
|
2129
2130
|
startDate: tl?.startDate,
|
|
2130
2131
|
endDate: tl?.endDate,
|
|
2131
2132
|
onChange: onTimelineChange
|
|
@@ -2135,12 +2136,12 @@ function LinkedPropertyInputInner({
|
|
|
2135
2136
|
return assertUnreachable(definition.linkedFilterComponent);
|
|
2136
2137
|
}
|
|
2137
2138
|
})();
|
|
2138
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
2139
2140
|
className: classnames14__default.default(LinkedPropertyInput_default.linkedProperty, className),
|
|
2140
2141
|
style
|
|
2141
2142
|
}, content);
|
|
2142
2143
|
}
|
|
2143
|
-
var LinkedPropertyInput = /* @__PURE__ */
|
|
2144
|
+
var LinkedPropertyInput = /* @__PURE__ */ React54.memo(LinkedPropertyInputInner);
|
|
2144
2145
|
function LinkedCheckboxListInput({
|
|
2145
2146
|
objectType,
|
|
2146
2147
|
propertyKey,
|
|
@@ -2152,7 +2153,7 @@ function LinkedCheckboxListInput({
|
|
|
2152
2153
|
isLoading,
|
|
2153
2154
|
error
|
|
2154
2155
|
} = usePropertyAggregation(objectType, propertyKey);
|
|
2155
|
-
return /* @__PURE__ */
|
|
2156
|
+
return /* @__PURE__ */ React54__default.default.createElement(CheckboxListInput, {
|
|
2156
2157
|
values: data,
|
|
2157
2158
|
isLoading,
|
|
2158
2159
|
error,
|
|
@@ -2171,7 +2172,7 @@ function LinkedMultiSelectInput({
|
|
|
2171
2172
|
isLoading,
|
|
2172
2173
|
error
|
|
2173
2174
|
} = usePropertyAggregation(objectType, propertyKey);
|
|
2174
|
-
return /* @__PURE__ */
|
|
2175
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiSelectInput, {
|
|
2175
2176
|
values: data,
|
|
2176
2177
|
isLoading,
|
|
2177
2178
|
error,
|
|
@@ -2190,7 +2191,7 @@ function LinkedSingleSelectInput({
|
|
|
2190
2191
|
isLoading,
|
|
2191
2192
|
error
|
|
2192
2193
|
} = usePropertyAggregation(objectType, propertyKey);
|
|
2193
|
-
return /* @__PURE__ */
|
|
2194
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleSelectInput, {
|
|
2194
2195
|
values: data,
|
|
2195
2196
|
isLoading,
|
|
2196
2197
|
error,
|
|
@@ -2211,7 +2212,7 @@ function LinkedListogramInput({
|
|
|
2211
2212
|
isLoading,
|
|
2212
2213
|
error
|
|
2213
2214
|
} = usePropertyAggregation(objectType, propertyKey);
|
|
2214
|
-
return /* @__PURE__ */
|
|
2215
|
+
return /* @__PURE__ */ React54__default.default.createElement(ListogramInput, {
|
|
2215
2216
|
values: data,
|
|
2216
2217
|
maxCount,
|
|
2217
2218
|
isLoading,
|
|
@@ -2226,7 +2227,7 @@ function LinkedTextTagsInput({
|
|
|
2226
2227
|
tags,
|
|
2227
2228
|
onChange
|
|
2228
2229
|
}) {
|
|
2229
|
-
const aggregationOptions =
|
|
2230
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2230
2231
|
limit: 50
|
|
2231
2232
|
}), []);
|
|
2232
2233
|
const {
|
|
@@ -2234,7 +2235,7 @@ function LinkedTextTagsInput({
|
|
|
2234
2235
|
isLoading,
|
|
2235
2236
|
error
|
|
2236
2237
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2237
|
-
return /* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ React54__default.default.createElement(TextTagsInput, {
|
|
2238
2239
|
suggestions: data,
|
|
2239
2240
|
isLoading,
|
|
2240
2241
|
error,
|
|
@@ -2244,17 +2245,17 @@ function LinkedTextTagsInput({
|
|
|
2244
2245
|
});
|
|
2245
2246
|
}
|
|
2246
2247
|
function useLinkedRangeData(objectType, propertyKey) {
|
|
2247
|
-
const aggregateOptions =
|
|
2248
|
-
const histogramArgs =
|
|
2248
|
+
const aggregateOptions = React54.useMemo(() => createGroupByAggregateOptions(propertyKey), [propertyKey]);
|
|
2249
|
+
const histogramArgs = React54.useMemo(() => ({
|
|
2249
2250
|
aggregate: aggregateOptions
|
|
2250
2251
|
}), [aggregateOptions]);
|
|
2251
2252
|
const {
|
|
2252
2253
|
data: aggregateData,
|
|
2253
2254
|
isLoading: histLoading
|
|
2254
2255
|
} = experimental.useOsdkAggregation(objectType, histogramArgs);
|
|
2255
|
-
const nullCountAggregateOptions =
|
|
2256
|
-
const nullWhereClause =
|
|
2257
|
-
const nullCountArgs =
|
|
2256
|
+
const nullCountAggregateOptions = React54.useMemo(() => createNullCountAggregateOptions(), []);
|
|
2257
|
+
const nullWhereClause = React54.useMemo(() => createNullWhereClause(propertyKey), [propertyKey]);
|
|
2258
|
+
const nullCountArgs = React54.useMemo(() => ({
|
|
2258
2259
|
where: nullWhereClause,
|
|
2259
2260
|
aggregate: nullCountAggregateOptions
|
|
2260
2261
|
}), [nullWhereClause, nullCountAggregateOptions]);
|
|
@@ -2262,7 +2263,7 @@ function useLinkedRangeData(objectType, propertyKey) {
|
|
|
2262
2263
|
data: nullCountData,
|
|
2263
2264
|
isLoading: nullLoading
|
|
2264
2265
|
} = experimental.useOsdkAggregation(objectType, nullCountArgs);
|
|
2265
|
-
const nullCount =
|
|
2266
|
+
const nullCount = React54.useMemo(() => {
|
|
2266
2267
|
if (!nullCountData) return 0;
|
|
2267
2268
|
const result = nullCountData;
|
|
2268
2269
|
if ("$count" in result && typeof result.$count === "number") {
|
|
@@ -2292,7 +2293,7 @@ function LinkedNumberRangeInput({
|
|
|
2292
2293
|
nullCount,
|
|
2293
2294
|
nullLoading
|
|
2294
2295
|
} = useLinkedRangeData(objectType, propertyKey);
|
|
2295
|
-
const valueCountPairs =
|
|
2296
|
+
const valueCountPairs = React54.useMemo(() => {
|
|
2296
2297
|
if (!aggregateData) return [];
|
|
2297
2298
|
const dataArray = aggregateData;
|
|
2298
2299
|
const pairs = [];
|
|
@@ -2310,12 +2311,12 @@ function LinkedNumberRangeInput({
|
|
|
2310
2311
|
}
|
|
2311
2312
|
return pairs;
|
|
2312
2313
|
}, [aggregateData, propertyKey]);
|
|
2313
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ React54__default.default.createElement(NullValueWrapper, {
|
|
2314
2315
|
nullCount,
|
|
2315
2316
|
isLoading: nullLoading,
|
|
2316
2317
|
includeNull,
|
|
2317
2318
|
onIncludeNullChange: onNullChange
|
|
2318
|
-
}, /* @__PURE__ */
|
|
2319
|
+
}, /* @__PURE__ */ React54__default.default.createElement(NumberRangeInput, {
|
|
2319
2320
|
valueCountPairs,
|
|
2320
2321
|
isLoading: histLoading,
|
|
2321
2322
|
minValue,
|
|
@@ -2338,7 +2339,7 @@ function LinkedDateRangeInput({
|
|
|
2338
2339
|
nullCount,
|
|
2339
2340
|
nullLoading
|
|
2340
2341
|
} = useLinkedRangeData(objectType, propertyKey);
|
|
2341
|
-
const valueCountPairs =
|
|
2342
|
+
const valueCountPairs = React54.useMemo(() => {
|
|
2342
2343
|
if (!aggregateData) return [];
|
|
2343
2344
|
const dataArray = aggregateData;
|
|
2344
2345
|
const pairs = [];
|
|
@@ -2356,12 +2357,12 @@ function LinkedDateRangeInput({
|
|
|
2356
2357
|
}
|
|
2357
2358
|
return pairs;
|
|
2358
2359
|
}, [aggregateData, propertyKey]);
|
|
2359
|
-
return /* @__PURE__ */
|
|
2360
|
+
return /* @__PURE__ */ React54__default.default.createElement(NullValueWrapper, {
|
|
2360
2361
|
nullCount,
|
|
2361
2362
|
isLoading: nullLoading,
|
|
2362
2363
|
includeNull,
|
|
2363
2364
|
onIncludeNullChange: onNullChange
|
|
2364
|
-
}, /* @__PURE__ */
|
|
2365
|
+
}, /* @__PURE__ */ React54__default.default.createElement(DateRangeInput, {
|
|
2365
2366
|
valueCountPairs,
|
|
2366
2367
|
isLoading: histLoading,
|
|
2367
2368
|
minValue,
|
|
@@ -2377,16 +2378,16 @@ function CheckboxListFilterInputInner({
|
|
|
2377
2378
|
whereClause,
|
|
2378
2379
|
colorMap
|
|
2379
2380
|
}) {
|
|
2380
|
-
const selectedValues =
|
|
2381
|
+
const selectedValues = React54.useMemo(() => filterState?.type === "SELECT" ? coerceToStringArray(filterState.selectedValues) : [], [filterState]);
|
|
2381
2382
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2382
|
-
const handleChange =
|
|
2383
|
+
const handleChange = React54.useCallback((newSelectedValues) => {
|
|
2383
2384
|
onFilterStateChanged({
|
|
2384
2385
|
type: "SELECT",
|
|
2385
2386
|
selectedValues: newSelectedValues,
|
|
2386
2387
|
isExcluding
|
|
2387
2388
|
});
|
|
2388
2389
|
}, [onFilterStateChanged, isExcluding]);
|
|
2389
|
-
const aggregationOptions =
|
|
2390
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2390
2391
|
where: whereClause
|
|
2391
2392
|
}), [whereClause]);
|
|
2392
2393
|
const {
|
|
@@ -2394,7 +2395,7 @@ function CheckboxListFilterInputInner({
|
|
|
2394
2395
|
isLoading,
|
|
2395
2396
|
error
|
|
2396
2397
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2397
|
-
return /* @__PURE__ */
|
|
2398
|
+
return /* @__PURE__ */ React54__default.default.createElement(CheckboxListInput, {
|
|
2398
2399
|
values: data,
|
|
2399
2400
|
isLoading,
|
|
2400
2401
|
error,
|
|
@@ -2403,26 +2404,26 @@ function CheckboxListFilterInputInner({
|
|
|
2403
2404
|
colorMap
|
|
2404
2405
|
});
|
|
2405
2406
|
}
|
|
2406
|
-
var CheckboxListFilterInput = /* @__PURE__ */
|
|
2407
|
+
var CheckboxListFilterInput = /* @__PURE__ */ React54.memo(CheckboxListFilterInputInner);
|
|
2407
2408
|
function ContainsTextFilterInputInner({
|
|
2408
2409
|
propertyKey,
|
|
2409
2410
|
filterState,
|
|
2410
2411
|
onFilterStateChanged
|
|
2411
2412
|
}) {
|
|
2412
|
-
const value =
|
|
2413
|
-
const handleChange =
|
|
2413
|
+
const value = React54.useMemo(() => filterState?.type === "CONTAINS_TEXT" ? filterState.value : void 0, [filterState]);
|
|
2414
|
+
const handleChange = React54.useCallback((value2) => {
|
|
2414
2415
|
onFilterStateChanged({
|
|
2415
2416
|
type: "CONTAINS_TEXT",
|
|
2416
2417
|
value: value2
|
|
2417
2418
|
});
|
|
2418
2419
|
}, [onFilterStateChanged]);
|
|
2419
|
-
return /* @__PURE__ */
|
|
2420
|
+
return /* @__PURE__ */ React54__default.default.createElement(ContainsTextInput, {
|
|
2420
2421
|
value,
|
|
2421
2422
|
onChange: handleChange,
|
|
2422
2423
|
placeholder: `Search ${propertyKey}...`
|
|
2423
2424
|
});
|
|
2424
2425
|
}
|
|
2425
|
-
var ContainsTextFilterInput = /* @__PURE__ */
|
|
2426
|
+
var ContainsTextFilterInput = /* @__PURE__ */ React54.memo(ContainsTextFilterInputInner);
|
|
2426
2427
|
function DateRangeFilterInputInner({
|
|
2427
2428
|
objectType,
|
|
2428
2429
|
propertyKey,
|
|
@@ -2431,7 +2432,7 @@ function DateRangeFilterInputInner({
|
|
|
2431
2432
|
}) {
|
|
2432
2433
|
const dateRangeState = filterState?.type === "DATE_RANGE" ? filterState : void 0;
|
|
2433
2434
|
const includeNull = filterState?.includeNull;
|
|
2434
|
-
const handleNullChange =
|
|
2435
|
+
const handleNullChange = React54.useCallback((includeNull2) => {
|
|
2435
2436
|
onFilterStateChanged({
|
|
2436
2437
|
type: "DATE_RANGE",
|
|
2437
2438
|
minValue: dateRangeState?.minValue,
|
|
@@ -2439,7 +2440,7 @@ function DateRangeFilterInputInner({
|
|
|
2439
2440
|
includeNull: includeNull2
|
|
2440
2441
|
});
|
|
2441
2442
|
}, [onFilterStateChanged, dateRangeState?.minValue, dateRangeState?.maxValue]);
|
|
2442
|
-
const handleRangeChange =
|
|
2443
|
+
const handleRangeChange = React54.useCallback((minValue, maxValue) => {
|
|
2443
2444
|
onFilterStateChanged({
|
|
2444
2445
|
type: "DATE_RANGE",
|
|
2445
2446
|
minValue,
|
|
@@ -2447,15 +2448,15 @@ function DateRangeFilterInputInner({
|
|
|
2447
2448
|
includeNull
|
|
2448
2449
|
});
|
|
2449
2450
|
}, [onFilterStateChanged, includeNull]);
|
|
2450
|
-
const aggregateOptions =
|
|
2451
|
-
const histogramArgs =
|
|
2451
|
+
const aggregateOptions = React54.useMemo(() => createGroupByAggregateOptions(propertyKey), [propertyKey]);
|
|
2452
|
+
const histogramArgs = React54.useMemo(() => ({
|
|
2452
2453
|
aggregate: aggregateOptions
|
|
2453
2454
|
}), [aggregateOptions]);
|
|
2454
2455
|
const {
|
|
2455
2456
|
data: aggregateData,
|
|
2456
2457
|
isLoading: histLoading
|
|
2457
2458
|
} = experimental.useOsdkAggregation(objectType, histogramArgs);
|
|
2458
|
-
const valueCountPairs =
|
|
2459
|
+
const valueCountPairs = React54.useMemo(() => {
|
|
2459
2460
|
if (!aggregateData) return [];
|
|
2460
2461
|
const dataArray = aggregateData;
|
|
2461
2462
|
const pairs = [];
|
|
@@ -2473,9 +2474,9 @@ function DateRangeFilterInputInner({
|
|
|
2473
2474
|
}
|
|
2474
2475
|
return pairs;
|
|
2475
2476
|
}, [aggregateData, propertyKey]);
|
|
2476
|
-
const nullCountAggregateOptions =
|
|
2477
|
-
const nullWhereClause =
|
|
2478
|
-
const nullCountArgs =
|
|
2477
|
+
const nullCountAggregateOptions = React54.useMemo(() => createNullCountAggregateOptions(), []);
|
|
2478
|
+
const nullWhereClause = React54.useMemo(() => createNullWhereClause(propertyKey), [propertyKey]);
|
|
2479
|
+
const nullCountArgs = React54.useMemo(() => ({
|
|
2479
2480
|
where: nullWhereClause,
|
|
2480
2481
|
aggregate: nullCountAggregateOptions
|
|
2481
2482
|
}), [nullWhereClause, nullCountAggregateOptions]);
|
|
@@ -2484,7 +2485,7 @@ function DateRangeFilterInputInner({
|
|
|
2484
2485
|
isLoading: nullLoading,
|
|
2485
2486
|
error: nullError
|
|
2486
2487
|
} = experimental.useOsdkAggregation(objectType, nullCountArgs);
|
|
2487
|
-
const nullCount =
|
|
2488
|
+
const nullCount = React54.useMemo(() => {
|
|
2488
2489
|
if (!nullCountData) return 0;
|
|
2489
2490
|
const result = nullCountData;
|
|
2490
2491
|
if ("$count" in result && typeof result.$count === "number") {
|
|
@@ -2492,13 +2493,13 @@ function DateRangeFilterInputInner({
|
|
|
2492
2493
|
}
|
|
2493
2494
|
return 0;
|
|
2494
2495
|
}, [nullCountData]);
|
|
2495
|
-
return /* @__PURE__ */
|
|
2496
|
+
return /* @__PURE__ */ React54__default.default.createElement(NullValueWrapper, {
|
|
2496
2497
|
nullCount,
|
|
2497
2498
|
isLoading: nullLoading,
|
|
2498
2499
|
error: nullError,
|
|
2499
2500
|
includeNull,
|
|
2500
2501
|
onIncludeNullChange: handleNullChange
|
|
2501
|
-
}, /* @__PURE__ */
|
|
2502
|
+
}, /* @__PURE__ */ React54__default.default.createElement(DateRangeInput, {
|
|
2502
2503
|
valueCountPairs,
|
|
2503
2504
|
isLoading: histLoading,
|
|
2504
2505
|
minValue: dateRangeState?.minValue,
|
|
@@ -2506,7 +2507,7 @@ function DateRangeFilterInputInner({
|
|
|
2506
2507
|
onChange: handleRangeChange
|
|
2507
2508
|
}));
|
|
2508
2509
|
}
|
|
2509
|
-
var DateRangeFilterInput = /* @__PURE__ */
|
|
2510
|
+
var DateRangeFilterInput = /* @__PURE__ */ React54.memo(DateRangeFilterInputInner);
|
|
2510
2511
|
function ListogramFilterInputInner({
|
|
2511
2512
|
objectType,
|
|
2512
2513
|
propertyKey,
|
|
@@ -2517,16 +2518,16 @@ function ListogramFilterInputInner({
|
|
|
2517
2518
|
displayMode,
|
|
2518
2519
|
maxVisibleItems
|
|
2519
2520
|
}) {
|
|
2520
|
-
const selectedValues =
|
|
2521
|
+
const selectedValues = React54.useMemo(() => filterState?.type === "EXACT_MATCH" ? coerceToStringArray(filterState.values) : [], [filterState]);
|
|
2521
2522
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2522
|
-
const handleChange =
|
|
2523
|
+
const handleChange = React54.useCallback((values) => {
|
|
2523
2524
|
onFilterStateChanged({
|
|
2524
2525
|
type: "EXACT_MATCH",
|
|
2525
2526
|
values,
|
|
2526
2527
|
isExcluding
|
|
2527
2528
|
});
|
|
2528
2529
|
}, [onFilterStateChanged, isExcluding]);
|
|
2529
|
-
const aggregationOptions =
|
|
2530
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2530
2531
|
where: whereClause
|
|
2531
2532
|
}), [whereClause]);
|
|
2532
2533
|
const {
|
|
@@ -2535,7 +2536,7 @@ function ListogramFilterInputInner({
|
|
|
2535
2536
|
isLoading,
|
|
2536
2537
|
error
|
|
2537
2538
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2538
|
-
return /* @__PURE__ */
|
|
2539
|
+
return /* @__PURE__ */ React54__default.default.createElement(ListogramInput, {
|
|
2539
2540
|
values: data,
|
|
2540
2541
|
maxCount,
|
|
2541
2542
|
isLoading,
|
|
@@ -2547,26 +2548,26 @@ function ListogramFilterInputInner({
|
|
|
2547
2548
|
maxVisibleItems
|
|
2548
2549
|
});
|
|
2549
2550
|
}
|
|
2550
|
-
var ListogramFilterInput = /* @__PURE__ */
|
|
2551
|
+
var ListogramFilterInput = /* @__PURE__ */ React54.memo(ListogramFilterInputInner);
|
|
2551
2552
|
function MultiDateFilterInputInner({
|
|
2552
2553
|
filterState,
|
|
2553
2554
|
onFilterStateChanged
|
|
2554
2555
|
}) {
|
|
2555
|
-
const selectedDates =
|
|
2556
|
+
const selectedDates = React54.useMemo(() => filterState?.type === "SELECT" ? filterState.selectedValues.filter((v) => v instanceof Date) : [], [filterState]);
|
|
2556
2557
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2557
|
-
const handleChange =
|
|
2558
|
+
const handleChange = React54.useCallback((selectedDates2) => {
|
|
2558
2559
|
onFilterStateChanged({
|
|
2559
2560
|
type: "SELECT",
|
|
2560
2561
|
selectedValues: selectedDates2,
|
|
2561
2562
|
isExcluding
|
|
2562
2563
|
});
|
|
2563
2564
|
}, [onFilterStateChanged, isExcluding]);
|
|
2564
|
-
return /* @__PURE__ */
|
|
2565
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiDateInput, {
|
|
2565
2566
|
selectedDates,
|
|
2566
2567
|
onChange: handleChange
|
|
2567
2568
|
});
|
|
2568
2569
|
}
|
|
2569
|
-
var MultiDateFilterInput = /* @__PURE__ */
|
|
2570
|
+
var MultiDateFilterInput = /* @__PURE__ */ React54.memo(MultiDateFilterInputInner);
|
|
2570
2571
|
function MultiSelectFilterInputInner({
|
|
2571
2572
|
objectType,
|
|
2572
2573
|
propertyKey,
|
|
@@ -2574,16 +2575,16 @@ function MultiSelectFilterInputInner({
|
|
|
2574
2575
|
onFilterStateChanged,
|
|
2575
2576
|
whereClause
|
|
2576
2577
|
}) {
|
|
2577
|
-
const selectedValues =
|
|
2578
|
+
const selectedValues = React54.useMemo(() => filterState?.type === "SELECT" ? coerceToStringArray(filterState.selectedValues) : [], [filterState]);
|
|
2578
2579
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2579
|
-
const handleChange =
|
|
2580
|
+
const handleChange = React54.useCallback((selectedValues2) => {
|
|
2580
2581
|
onFilterStateChanged({
|
|
2581
2582
|
type: "SELECT",
|
|
2582
2583
|
selectedValues: selectedValues2,
|
|
2583
2584
|
isExcluding
|
|
2584
2585
|
});
|
|
2585
2586
|
}, [onFilterStateChanged, isExcluding]);
|
|
2586
|
-
const aggregationOptions =
|
|
2587
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2587
2588
|
where: whereClause
|
|
2588
2589
|
}), [whereClause]);
|
|
2589
2590
|
const {
|
|
@@ -2591,7 +2592,7 @@ function MultiSelectFilterInputInner({
|
|
|
2591
2592
|
isLoading,
|
|
2592
2593
|
error
|
|
2593
2594
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2594
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiSelectInput, {
|
|
2595
2596
|
values: data,
|
|
2596
2597
|
isLoading,
|
|
2597
2598
|
error,
|
|
@@ -2600,7 +2601,7 @@ function MultiSelectFilterInputInner({
|
|
|
2600
2601
|
ariaLabel: `Search ${propertyKey} values`
|
|
2601
2602
|
});
|
|
2602
2603
|
}
|
|
2603
|
-
var MultiSelectFilterInput = /* @__PURE__ */
|
|
2604
|
+
var MultiSelectFilterInput = /* @__PURE__ */ React54.memo(MultiSelectFilterInputInner);
|
|
2604
2605
|
function NumberRangeFilterInputInner({
|
|
2605
2606
|
objectType,
|
|
2606
2607
|
propertyKey,
|
|
@@ -2609,7 +2610,7 @@ function NumberRangeFilterInputInner({
|
|
|
2609
2610
|
}) {
|
|
2610
2611
|
const numberRangeState = filterState?.type === "NUMBER_RANGE" ? filterState : void 0;
|
|
2611
2612
|
const includeNull = filterState?.includeNull;
|
|
2612
|
-
const handleNullChange =
|
|
2613
|
+
const handleNullChange = React54.useCallback((includeNull2) => {
|
|
2613
2614
|
onFilterStateChanged({
|
|
2614
2615
|
type: "NUMBER_RANGE",
|
|
2615
2616
|
minValue: numberRangeState?.minValue,
|
|
@@ -2617,7 +2618,7 @@ function NumberRangeFilterInputInner({
|
|
|
2617
2618
|
includeNull: includeNull2
|
|
2618
2619
|
});
|
|
2619
2620
|
}, [onFilterStateChanged, numberRangeState?.minValue, numberRangeState?.maxValue]);
|
|
2620
|
-
const handleRangeChange =
|
|
2621
|
+
const handleRangeChange = React54.useCallback((minValue, maxValue) => {
|
|
2621
2622
|
onFilterStateChanged({
|
|
2622
2623
|
type: "NUMBER_RANGE",
|
|
2623
2624
|
minValue,
|
|
@@ -2625,15 +2626,15 @@ function NumberRangeFilterInputInner({
|
|
|
2625
2626
|
includeNull
|
|
2626
2627
|
});
|
|
2627
2628
|
}, [onFilterStateChanged, includeNull]);
|
|
2628
|
-
const aggregateOptions =
|
|
2629
|
-
const histogramArgs =
|
|
2629
|
+
const aggregateOptions = React54.useMemo(() => createGroupByAggregateOptions(propertyKey), [propertyKey]);
|
|
2630
|
+
const histogramArgs = React54.useMemo(() => ({
|
|
2630
2631
|
aggregate: aggregateOptions
|
|
2631
2632
|
}), [aggregateOptions]);
|
|
2632
2633
|
const {
|
|
2633
2634
|
data: aggregateData,
|
|
2634
2635
|
isLoading: histLoading
|
|
2635
2636
|
} = experimental.useOsdkAggregation(objectType, histogramArgs);
|
|
2636
|
-
const valueCountPairs =
|
|
2637
|
+
const valueCountPairs = React54.useMemo(() => {
|
|
2637
2638
|
if (!aggregateData) return [];
|
|
2638
2639
|
const dataArray = aggregateData;
|
|
2639
2640
|
const pairs = [];
|
|
@@ -2651,9 +2652,9 @@ function NumberRangeFilterInputInner({
|
|
|
2651
2652
|
}
|
|
2652
2653
|
return pairs;
|
|
2653
2654
|
}, [aggregateData, propertyKey]);
|
|
2654
|
-
const nullCountAggregateOptions =
|
|
2655
|
-
const nullWhereClause =
|
|
2656
|
-
const nullCountArgs =
|
|
2655
|
+
const nullCountAggregateOptions = React54.useMemo(() => createNullCountAggregateOptions(), []);
|
|
2656
|
+
const nullWhereClause = React54.useMemo(() => createNullWhereClause(propertyKey), [propertyKey]);
|
|
2657
|
+
const nullCountArgs = React54.useMemo(() => ({
|
|
2657
2658
|
where: nullWhereClause,
|
|
2658
2659
|
aggregate: nullCountAggregateOptions
|
|
2659
2660
|
}), [nullWhereClause, nullCountAggregateOptions]);
|
|
@@ -2662,7 +2663,7 @@ function NumberRangeFilterInputInner({
|
|
|
2662
2663
|
isLoading: nullLoading,
|
|
2663
2664
|
error: nullError
|
|
2664
2665
|
} = experimental.useOsdkAggregation(objectType, nullCountArgs);
|
|
2665
|
-
const nullCount =
|
|
2666
|
+
const nullCount = React54.useMemo(() => {
|
|
2666
2667
|
if (!nullCountData) return 0;
|
|
2667
2668
|
const result = nullCountData;
|
|
2668
2669
|
if ("$count" in result && typeof result.$count === "number") {
|
|
@@ -2670,13 +2671,13 @@ function NumberRangeFilterInputInner({
|
|
|
2670
2671
|
}
|
|
2671
2672
|
return 0;
|
|
2672
2673
|
}, [nullCountData]);
|
|
2673
|
-
return /* @__PURE__ */
|
|
2674
|
+
return /* @__PURE__ */ React54__default.default.createElement(NullValueWrapper, {
|
|
2674
2675
|
nullCount,
|
|
2675
2676
|
isLoading: nullLoading,
|
|
2676
2677
|
error: nullError,
|
|
2677
2678
|
includeNull,
|
|
2678
2679
|
onIncludeNullChange: handleNullChange
|
|
2679
|
-
}, /* @__PURE__ */
|
|
2680
|
+
}, /* @__PURE__ */ React54__default.default.createElement(NumberRangeInput, {
|
|
2680
2681
|
valueCountPairs,
|
|
2681
2682
|
isLoading: histLoading,
|
|
2682
2683
|
minValue: numberRangeState?.minValue,
|
|
@@ -2684,26 +2685,26 @@ function NumberRangeFilterInputInner({
|
|
|
2684
2685
|
onChange: handleRangeChange
|
|
2685
2686
|
}));
|
|
2686
2687
|
}
|
|
2687
|
-
var NumberRangeFilterInput = /* @__PURE__ */
|
|
2688
|
+
var NumberRangeFilterInput = /* @__PURE__ */ React54.memo(NumberRangeFilterInputInner);
|
|
2688
2689
|
function SingleDateFilterInputInner({
|
|
2689
2690
|
filterState,
|
|
2690
2691
|
onFilterStateChanged
|
|
2691
2692
|
}) {
|
|
2692
|
-
const selectedDate =
|
|
2693
|
+
const selectedDate = React54.useMemo(() => filterState?.type === "SELECT" ? filterState.selectedValues[0] instanceof Date ? filterState.selectedValues[0] : void 0 : void 0, [filterState]);
|
|
2693
2694
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2694
|
-
const handleChange =
|
|
2695
|
+
const handleChange = React54.useCallback((selectedDate2) => {
|
|
2695
2696
|
onFilterStateChanged({
|
|
2696
2697
|
type: "SELECT",
|
|
2697
2698
|
selectedValues: selectedDate2 !== void 0 ? [selectedDate2] : [],
|
|
2698
2699
|
isExcluding
|
|
2699
2700
|
});
|
|
2700
2701
|
}, [onFilterStateChanged, isExcluding]);
|
|
2701
|
-
return /* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleDateInput, {
|
|
2702
2703
|
selectedDate,
|
|
2703
2704
|
onChange: handleChange
|
|
2704
2705
|
});
|
|
2705
2706
|
}
|
|
2706
|
-
var SingleDateFilterInput = /* @__PURE__ */
|
|
2707
|
+
var SingleDateFilterInput = /* @__PURE__ */ React54.memo(SingleDateFilterInputInner);
|
|
2707
2708
|
function SingleSelectFilterInputInner({
|
|
2708
2709
|
objectType,
|
|
2709
2710
|
propertyKey,
|
|
@@ -2711,16 +2712,16 @@ function SingleSelectFilterInputInner({
|
|
|
2711
2712
|
onFilterStateChanged,
|
|
2712
2713
|
whereClause
|
|
2713
2714
|
}) {
|
|
2714
|
-
const selectedValue =
|
|
2715
|
+
const selectedValue = React54.useMemo(() => filterState?.type === "SELECT" ? coerceToString(filterState.selectedValues[0]) : void 0, [filterState]);
|
|
2715
2716
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2716
|
-
const handleChange =
|
|
2717
|
+
const handleChange = React54.useCallback((value) => {
|
|
2717
2718
|
onFilterStateChanged({
|
|
2718
2719
|
type: "SELECT",
|
|
2719
2720
|
selectedValues: value !== void 0 ? [value] : [],
|
|
2720
2721
|
isExcluding
|
|
2721
2722
|
});
|
|
2722
2723
|
}, [onFilterStateChanged, isExcluding]);
|
|
2723
|
-
const aggregationOptions =
|
|
2724
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2724
2725
|
where: whereClause
|
|
2725
2726
|
}), [whereClause]);
|
|
2726
2727
|
const {
|
|
@@ -2728,7 +2729,7 @@ function SingleSelectFilterInputInner({
|
|
|
2728
2729
|
isLoading,
|
|
2729
2730
|
error
|
|
2730
2731
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2731
|
-
return /* @__PURE__ */
|
|
2732
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleSelectInput, {
|
|
2732
2733
|
values: data,
|
|
2733
2734
|
isLoading,
|
|
2734
2735
|
error,
|
|
@@ -2737,7 +2738,7 @@ function SingleSelectFilterInputInner({
|
|
|
2737
2738
|
ariaLabel: `Select ${propertyKey}`
|
|
2738
2739
|
});
|
|
2739
2740
|
}
|
|
2740
|
-
var SingleSelectFilterInput = /* @__PURE__ */
|
|
2741
|
+
var SingleSelectFilterInput = /* @__PURE__ */ React54.memo(SingleSelectFilterInputInner);
|
|
2741
2742
|
function TextTagsFilterInputInner({
|
|
2742
2743
|
objectType,
|
|
2743
2744
|
propertyKey,
|
|
@@ -2745,16 +2746,16 @@ function TextTagsFilterInputInner({
|
|
|
2745
2746
|
onFilterStateChanged,
|
|
2746
2747
|
whereClause
|
|
2747
2748
|
}) {
|
|
2748
|
-
const tags =
|
|
2749
|
+
const tags = React54.useMemo(() => filterState?.type === "EXACT_MATCH" ? coerceToStringArray(filterState.values) : [], [filterState]);
|
|
2749
2750
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2750
|
-
const handleChange =
|
|
2751
|
+
const handleChange = React54.useCallback((values) => {
|
|
2751
2752
|
onFilterStateChanged({
|
|
2752
2753
|
type: "EXACT_MATCH",
|
|
2753
2754
|
values,
|
|
2754
2755
|
isExcluding
|
|
2755
2756
|
});
|
|
2756
2757
|
}, [onFilterStateChanged, isExcluding]);
|
|
2757
|
-
const aggregationOptions =
|
|
2758
|
+
const aggregationOptions = React54.useMemo(() => ({
|
|
2758
2759
|
where: whereClause
|
|
2759
2760
|
}), [whereClause]);
|
|
2760
2761
|
const {
|
|
@@ -2762,7 +2763,7 @@ function TextTagsFilterInputInner({
|
|
|
2762
2763
|
isLoading,
|
|
2763
2764
|
error
|
|
2764
2765
|
} = usePropertyAggregation(objectType, propertyKey, aggregationOptions);
|
|
2765
|
-
return /* @__PURE__ */
|
|
2766
|
+
return /* @__PURE__ */ React54__default.default.createElement(TextTagsInput, {
|
|
2766
2767
|
suggestions: data,
|
|
2767
2768
|
isLoading,
|
|
2768
2769
|
error,
|
|
@@ -2770,7 +2771,7 @@ function TextTagsFilterInputInner({
|
|
|
2770
2771
|
onChange: handleChange
|
|
2771
2772
|
});
|
|
2772
2773
|
}
|
|
2773
|
-
var TextTagsFilterInput = /* @__PURE__ */
|
|
2774
|
+
var TextTagsFilterInput = /* @__PURE__ */ React54.memo(TextTagsFilterInputInner);
|
|
2774
2775
|
function TimelineFilterInputInner({
|
|
2775
2776
|
filterState,
|
|
2776
2777
|
onFilterStateChanged
|
|
@@ -2778,7 +2779,7 @@ function TimelineFilterInputInner({
|
|
|
2778
2779
|
const {
|
|
2779
2780
|
startDate,
|
|
2780
2781
|
endDate
|
|
2781
|
-
} =
|
|
2782
|
+
} = React54.useMemo(() => filterState?.type === "TIMELINE" ? {
|
|
2782
2783
|
startDate: filterState.startDate,
|
|
2783
2784
|
endDate: filterState.endDate
|
|
2784
2785
|
} : {
|
|
@@ -2786,7 +2787,7 @@ function TimelineFilterInputInner({
|
|
|
2786
2787
|
endDate: void 0
|
|
2787
2788
|
}, [filterState]);
|
|
2788
2789
|
const isExcluding = filterState?.isExcluding ?? false;
|
|
2789
|
-
const handleChange =
|
|
2790
|
+
const handleChange = React54.useCallback((startDate2, endDate2) => {
|
|
2790
2791
|
onFilterStateChanged({
|
|
2791
2792
|
type: "TIMELINE",
|
|
2792
2793
|
startDate: startDate2,
|
|
@@ -2794,30 +2795,30 @@ function TimelineFilterInputInner({
|
|
|
2794
2795
|
isExcluding
|
|
2795
2796
|
});
|
|
2796
2797
|
}, [onFilterStateChanged, isExcluding]);
|
|
2797
|
-
return /* @__PURE__ */
|
|
2798
|
+
return /* @__PURE__ */ React54__default.default.createElement(TimelineInput, {
|
|
2798
2799
|
startDate,
|
|
2799
2800
|
endDate,
|
|
2800
2801
|
onChange: handleChange
|
|
2801
2802
|
});
|
|
2802
2803
|
}
|
|
2803
|
-
var TimelineFilterInput = /* @__PURE__ */
|
|
2804
|
+
var TimelineFilterInput = /* @__PURE__ */ React54.memo(TimelineFilterInputInner);
|
|
2804
2805
|
function ToggleFilterInputInner({
|
|
2805
2806
|
filterState,
|
|
2806
2807
|
onFilterStateChanged
|
|
2807
2808
|
}) {
|
|
2808
2809
|
const enabled = filterState?.type === "TOGGLE" ? filterState.enabled : false;
|
|
2809
|
-
const handleChange =
|
|
2810
|
+
const handleChange = React54.useCallback((enabled2) => {
|
|
2810
2811
|
onFilterStateChanged({
|
|
2811
2812
|
type: "TOGGLE",
|
|
2812
2813
|
enabled: enabled2
|
|
2813
2814
|
});
|
|
2814
2815
|
}, [onFilterStateChanged]);
|
|
2815
|
-
return /* @__PURE__ */
|
|
2816
|
+
return /* @__PURE__ */ React54__default.default.createElement(ToggleInput, {
|
|
2816
2817
|
enabled,
|
|
2817
2818
|
onChange: handleChange
|
|
2818
2819
|
});
|
|
2819
2820
|
}
|
|
2820
|
-
var ToggleFilterInput = /* @__PURE__ */
|
|
2821
|
+
var ToggleFilterInput = /* @__PURE__ */ React54.memo(ToggleFilterInputInner);
|
|
2821
2822
|
|
|
2822
2823
|
// src/filter-list/inputs/PropertyFilterInput.tsx
|
|
2823
2824
|
function PropertyFilterInputInner({
|
|
@@ -2829,7 +2830,7 @@ function PropertyFilterInputInner({
|
|
|
2829
2830
|
}) {
|
|
2830
2831
|
switch (definition.filterComponent) {
|
|
2831
2832
|
case "CHECKBOX_LIST":
|
|
2832
|
-
return /* @__PURE__ */
|
|
2833
|
+
return /* @__PURE__ */ React54__default.default.createElement(CheckboxListFilterInput, {
|
|
2833
2834
|
objectType,
|
|
2834
2835
|
propertyKey: definition.key,
|
|
2835
2836
|
filterState,
|
|
@@ -2838,32 +2839,32 @@ function PropertyFilterInputInner({
|
|
|
2838
2839
|
colorMap: definition.colorMap
|
|
2839
2840
|
});
|
|
2840
2841
|
case "CONTAINS_TEXT":
|
|
2841
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ React54__default.default.createElement(ContainsTextFilterInput, {
|
|
2842
2843
|
propertyKey: definition.key,
|
|
2843
2844
|
filterState,
|
|
2844
2845
|
onFilterStateChanged
|
|
2845
2846
|
});
|
|
2846
2847
|
case "TOGGLE":
|
|
2847
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ React54__default.default.createElement(ToggleFilterInput, {
|
|
2848
2849
|
filterState,
|
|
2849
2850
|
onFilterStateChanged
|
|
2850
2851
|
});
|
|
2851
2852
|
case "NUMBER_RANGE":
|
|
2852
|
-
return /* @__PURE__ */
|
|
2853
|
+
return /* @__PURE__ */ React54__default.default.createElement(NumberRangeFilterInput, {
|
|
2853
2854
|
objectType,
|
|
2854
2855
|
propertyKey: definition.key,
|
|
2855
2856
|
filterState,
|
|
2856
2857
|
onFilterStateChanged
|
|
2857
2858
|
});
|
|
2858
2859
|
case "DATE_RANGE":
|
|
2859
|
-
return /* @__PURE__ */
|
|
2860
|
+
return /* @__PURE__ */ React54__default.default.createElement(DateRangeFilterInput, {
|
|
2860
2861
|
objectType,
|
|
2861
2862
|
propertyKey: definition.key,
|
|
2862
2863
|
filterState,
|
|
2863
2864
|
onFilterStateChanged
|
|
2864
2865
|
});
|
|
2865
2866
|
case "SINGLE_SELECT":
|
|
2866
|
-
return /* @__PURE__ */
|
|
2867
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleSelectFilterInput, {
|
|
2867
2868
|
objectType,
|
|
2868
2869
|
propertyKey: definition.key,
|
|
2869
2870
|
filterState,
|
|
@@ -2871,7 +2872,7 @@ function PropertyFilterInputInner({
|
|
|
2871
2872
|
whereClause
|
|
2872
2873
|
});
|
|
2873
2874
|
case "MULTI_SELECT":
|
|
2874
|
-
return /* @__PURE__ */
|
|
2875
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiSelectFilterInput, {
|
|
2875
2876
|
objectType,
|
|
2876
2877
|
propertyKey: definition.key,
|
|
2877
2878
|
filterState,
|
|
@@ -2879,17 +2880,17 @@ function PropertyFilterInputInner({
|
|
|
2879
2880
|
whereClause
|
|
2880
2881
|
});
|
|
2881
2882
|
case "SINGLE_DATE":
|
|
2882
|
-
return /* @__PURE__ */
|
|
2883
|
+
return /* @__PURE__ */ React54__default.default.createElement(SingleDateFilterInput, {
|
|
2883
2884
|
filterState,
|
|
2884
2885
|
onFilterStateChanged
|
|
2885
2886
|
});
|
|
2886
2887
|
case "MULTI_DATE":
|
|
2887
|
-
return /* @__PURE__ */
|
|
2888
|
+
return /* @__PURE__ */ React54__default.default.createElement(MultiDateFilterInput, {
|
|
2888
2889
|
filterState,
|
|
2889
2890
|
onFilterStateChanged
|
|
2890
2891
|
});
|
|
2891
2892
|
case "LISTOGRAM":
|
|
2892
|
-
return /* @__PURE__ */
|
|
2893
|
+
return /* @__PURE__ */ React54__default.default.createElement(ListogramFilterInput, {
|
|
2893
2894
|
objectType,
|
|
2894
2895
|
propertyKey: definition.key,
|
|
2895
2896
|
filterState,
|
|
@@ -2900,7 +2901,7 @@ function PropertyFilterInputInner({
|
|
|
2900
2901
|
maxVisibleItems: definition.listogramConfig?.maxVisibleItems
|
|
2901
2902
|
});
|
|
2902
2903
|
case "TEXT_TAGS":
|
|
2903
|
-
return /* @__PURE__ */
|
|
2904
|
+
return /* @__PURE__ */ React54__default.default.createElement(TextTagsFilterInput, {
|
|
2904
2905
|
objectType,
|
|
2905
2906
|
propertyKey: definition.key,
|
|
2906
2907
|
filterState,
|
|
@@ -2908,17 +2909,17 @@ function PropertyFilterInputInner({
|
|
|
2908
2909
|
whereClause
|
|
2909
2910
|
});
|
|
2910
2911
|
case "TIMELINE":
|
|
2911
|
-
return /* @__PURE__ */
|
|
2912
|
+
return /* @__PURE__ */ React54__default.default.createElement(TimelineFilterInput, {
|
|
2912
2913
|
filterState,
|
|
2913
2914
|
onFilterStateChanged
|
|
2914
2915
|
});
|
|
2915
2916
|
default:
|
|
2916
|
-
return /* @__PURE__ */
|
|
2917
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
2917
2918
|
"data-unsupported": "true"
|
|
2918
2919
|
}, "Unsupported filter component: ", definition.filterComponent);
|
|
2919
2920
|
}
|
|
2920
2921
|
}
|
|
2921
|
-
var PropertyFilterInput = /* @__PURE__ */
|
|
2922
|
+
var PropertyFilterInput = /* @__PURE__ */ React54.memo(PropertyFilterInputInner);
|
|
2922
2923
|
|
|
2923
2924
|
// src/filter-list/FilterInput.tsx
|
|
2924
2925
|
function FilterInputInner({
|
|
@@ -2929,7 +2930,7 @@ function FilterInputInner({
|
|
|
2929
2930
|
onFilterStateChanged,
|
|
2930
2931
|
whereClause
|
|
2931
2932
|
}) {
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
+
return /* @__PURE__ */ React54__default.default.createElement(FilterInputContent, {
|
|
2933
2934
|
objectType,
|
|
2934
2935
|
objectSet,
|
|
2935
2936
|
definition,
|
|
@@ -2938,7 +2939,7 @@ function FilterInputInner({
|
|
|
2938
2939
|
whereClause
|
|
2939
2940
|
});
|
|
2940
2941
|
}
|
|
2941
|
-
var FilterInput = /* @__PURE__ */
|
|
2942
|
+
var FilterInput = /* @__PURE__ */ React54.memo(FilterInputInner);
|
|
2942
2943
|
function FilterInputContent({
|
|
2943
2944
|
objectType,
|
|
2944
2945
|
objectSet,
|
|
@@ -2949,38 +2950,38 @@ function FilterInputContent({
|
|
|
2949
2950
|
}) {
|
|
2950
2951
|
switch (definition.type) {
|
|
2951
2952
|
case "HAS_LINK":
|
|
2952
|
-
return /* @__PURE__ */
|
|
2953
|
+
return /* @__PURE__ */ React54__default.default.createElement(HasLinkInput, {
|
|
2953
2954
|
filterState,
|
|
2954
2955
|
onFilterStateChanged
|
|
2955
2956
|
});
|
|
2956
2957
|
case "LINKED_PROPERTY":
|
|
2957
|
-
return /* @__PURE__ */
|
|
2958
|
+
return /* @__PURE__ */ React54__default.default.createElement(LinkedPropertyInput, {
|
|
2958
2959
|
objectSet,
|
|
2959
2960
|
definition,
|
|
2960
2961
|
filterState,
|
|
2961
2962
|
onFilterStateChanged
|
|
2962
2963
|
});
|
|
2963
2964
|
case "KEYWORD_SEARCH":
|
|
2964
|
-
return /* @__PURE__ */
|
|
2965
|
+
return /* @__PURE__ */ React54__default.default.createElement(KeywordSearchInput, {
|
|
2965
2966
|
filterState,
|
|
2966
2967
|
onFilterStateChanged,
|
|
2967
2968
|
placeholder: definition.label ?? "Search..."
|
|
2968
2969
|
});
|
|
2969
2970
|
case "CUSTOM": {
|
|
2970
2971
|
if (!definition.renderInput) {
|
|
2971
|
-
return /* @__PURE__ */
|
|
2972
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
2972
2973
|
"data-unsupported": "true"
|
|
2973
2974
|
}, "Custom filter missing renderInput");
|
|
2974
2975
|
}
|
|
2975
2976
|
const customFilterState = filterState?.type === "custom" ? filterState : definition.filterState;
|
|
2976
|
-
return /* @__PURE__ */
|
|
2977
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, definition.renderInput({
|
|
2977
2978
|
objectSet,
|
|
2978
2979
|
filterState: customFilterState,
|
|
2979
2980
|
onFilterStateChanged: (state) => onFilterStateChanged(state)
|
|
2980
2981
|
}));
|
|
2981
2982
|
}
|
|
2982
2983
|
case "PROPERTY":
|
|
2983
|
-
return /* @__PURE__ */
|
|
2984
|
+
return /* @__PURE__ */ React54__default.default.createElement(PropertyFilterInput, {
|
|
2984
2985
|
objectType,
|
|
2985
2986
|
objectSet,
|
|
2986
2987
|
definition,
|
|
@@ -2989,42 +2990,42 @@ function FilterInputContent({
|
|
|
2989
2990
|
whereClause
|
|
2990
2991
|
});
|
|
2991
2992
|
default:
|
|
2992
|
-
return /* @__PURE__ */
|
|
2993
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
2993
2994
|
"data-unsupported": "true"
|
|
2994
2995
|
}, "Unsupported filter type");
|
|
2995
2996
|
}
|
|
2996
2997
|
}
|
|
2997
|
-
var HasLinkInput = /* @__PURE__ */
|
|
2998
|
+
var HasLinkInput = /* @__PURE__ */ React54.memo(function HasLinkInput2({
|
|
2998
2999
|
filterState,
|
|
2999
3000
|
onFilterStateChanged
|
|
3000
3001
|
}) {
|
|
3001
3002
|
const hasLink = filterState?.type === "hasLink" ? filterState.hasLink : false;
|
|
3002
|
-
const handleChange =
|
|
3003
|
+
const handleChange = React54.useCallback((hasLink2) => {
|
|
3003
3004
|
onFilterStateChanged({
|
|
3004
3005
|
type: "hasLink",
|
|
3005
3006
|
hasLink: hasLink2
|
|
3006
3007
|
});
|
|
3007
3008
|
}, [onFilterStateChanged]);
|
|
3008
|
-
return /* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ React54__default.default.createElement(ToggleInput, {
|
|
3009
3010
|
enabled: hasLink,
|
|
3010
3011
|
onChange: handleChange
|
|
3011
3012
|
});
|
|
3012
3013
|
});
|
|
3013
|
-
var KeywordSearchInput = /* @__PURE__ */
|
|
3014
|
+
var KeywordSearchInput = /* @__PURE__ */ React54.memo(function KeywordSearchInput2({
|
|
3014
3015
|
filterState,
|
|
3015
3016
|
onFilterStateChanged,
|
|
3016
3017
|
placeholder
|
|
3017
3018
|
}) {
|
|
3018
3019
|
const searchTerm = filterState?.type === "keywordSearch" ? filterState.searchTerm : void 0;
|
|
3019
3020
|
const operator = filterState?.type === "keywordSearch" ? filterState.operator : "AND";
|
|
3020
|
-
const handleChange =
|
|
3021
|
+
const handleChange = React54.useCallback((newSearchTerm) => {
|
|
3021
3022
|
onFilterStateChanged({
|
|
3022
3023
|
type: "keywordSearch",
|
|
3023
3024
|
searchTerm: newSearchTerm ?? "",
|
|
3024
3025
|
operator
|
|
3025
3026
|
});
|
|
3026
3027
|
}, [onFilterStateChanged, operator]);
|
|
3027
|
-
return /* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ React54__default.default.createElement(ContainsTextInput, {
|
|
3028
3029
|
value: searchTerm,
|
|
3029
3030
|
onChange: handleChange,
|
|
3030
3031
|
placeholder
|
|
@@ -3050,6 +3051,23 @@ function getFilterKey(definition) {
|
|
|
3050
3051
|
}
|
|
3051
3052
|
|
|
3052
3053
|
// src/filter-list/utils/filterStateToWhereClause.ts
|
|
3054
|
+
function liftCompoundPropertyFilter(propertyKey, filter) {
|
|
3055
|
+
if (typeof filter === "object" && !Array.isArray(filter)) {
|
|
3056
|
+
if ("$and" in filter && Array.isArray(filter.$and)) {
|
|
3057
|
+
return {
|
|
3058
|
+
$and: filter.$and.map((f) => liftCompoundPropertyFilter(propertyKey, f))
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
if ("$or" in filter && Array.isArray(filter.$or)) {
|
|
3062
|
+
return {
|
|
3063
|
+
$or: filter.$or.map((f) => liftCompoundPropertyFilter(propertyKey, f))
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
return {
|
|
3068
|
+
[propertyKey]: filter
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3053
3071
|
function filterStateToPropertyFilter(state) {
|
|
3054
3072
|
switch (state.type) {
|
|
3055
3073
|
case "CONTAINS_TEXT": {
|
|
@@ -3231,9 +3249,7 @@ function buildWhereClause(definitions, filterStates, operator, objectType, exclu
|
|
|
3231
3249
|
case "PROPERTY": {
|
|
3232
3250
|
const filter = filterStateToPropertyFilter(state);
|
|
3233
3251
|
if (filter !== void 0) {
|
|
3234
|
-
clauses.push(
|
|
3235
|
-
[definition.key]: filter
|
|
3236
|
-
});
|
|
3252
|
+
clauses.push(liftCompoundPropertyFilter(definition.key, filter));
|
|
3237
3253
|
}
|
|
3238
3254
|
break;
|
|
3239
3255
|
}
|
|
@@ -3392,7 +3408,7 @@ function useFilterListState(props) {
|
|
|
3392
3408
|
initialFilterStates
|
|
3393
3409
|
} = props;
|
|
3394
3410
|
const objectType = objectSet.$objectSetInternals.def;
|
|
3395
|
-
const [filterStates, setFilterStates] =
|
|
3411
|
+
const [filterStates, setFilterStates] = React54.useState(() => {
|
|
3396
3412
|
const states = buildInitialStates(filterDefinitions);
|
|
3397
3413
|
if (initialFilterStates) {
|
|
3398
3414
|
for (const [key, state] of initialFilterStates) {
|
|
@@ -3401,24 +3417,24 @@ function useFilterListState(props) {
|
|
|
3401
3417
|
}
|
|
3402
3418
|
return states;
|
|
3403
3419
|
});
|
|
3404
|
-
const setFilterState =
|
|
3405
|
-
let
|
|
3420
|
+
const setFilterState = React54.useCallback((filterKey, state) => {
|
|
3421
|
+
let computedClause;
|
|
3406
3422
|
setFilterStates((prev) => {
|
|
3407
3423
|
const next = new Map(prev);
|
|
3408
3424
|
next.set(filterKey, state);
|
|
3409
|
-
|
|
3425
|
+
computedClause = buildWhereClause(filterDefinitions, next, filterOperator, objectType);
|
|
3410
3426
|
return next;
|
|
3411
3427
|
});
|
|
3412
|
-
if (
|
|
3413
|
-
onFilterClauseChanged?.(
|
|
3428
|
+
if (computedClause !== void 0) {
|
|
3429
|
+
onFilterClauseChanged?.(computedClause);
|
|
3414
3430
|
}
|
|
3415
3431
|
const definition = filterDefinitions?.find((d) => getFilterKey(d) === filterKey);
|
|
3416
3432
|
if (definition) {
|
|
3417
3433
|
onFilterStateChanged?.(definition, state);
|
|
3418
3434
|
}
|
|
3419
3435
|
}, [filterDefinitions, filterOperator, objectType, onFilterClauseChanged, onFilterStateChanged]);
|
|
3420
|
-
const whereClause =
|
|
3421
|
-
const perFilterWhereClauses =
|
|
3436
|
+
const whereClause = React54.useMemo(() => buildWhereClause(filterDefinitions, filterStates, filterOperator, objectType), [filterDefinitions, filterStates, filterOperator, objectType]);
|
|
3437
|
+
const perFilterWhereClauses = React54.useMemo(() => {
|
|
3422
3438
|
const map = /* @__PURE__ */ new Map();
|
|
3423
3439
|
if (!filterDefinitions) {
|
|
3424
3440
|
return map;
|
|
@@ -3429,7 +3445,7 @@ function useFilterListState(props) {
|
|
|
3429
3445
|
}
|
|
3430
3446
|
return map;
|
|
3431
3447
|
}, [filterDefinitions, filterStates, filterOperator, objectType]);
|
|
3432
|
-
const activeFilterCount =
|
|
3448
|
+
const activeFilterCount = React54.useMemo(() => {
|
|
3433
3449
|
let count = 0;
|
|
3434
3450
|
for (const state of filterStates.values()) {
|
|
3435
3451
|
if (filterHasActiveState(state)) {
|
|
@@ -3438,13 +3454,12 @@ function useFilterListState(props) {
|
|
|
3438
3454
|
}
|
|
3439
3455
|
return count;
|
|
3440
3456
|
}, [filterStates]);
|
|
3441
|
-
const reset =
|
|
3457
|
+
const reset = React54.useCallback(() => {
|
|
3442
3458
|
const initialStates = buildInitialStates(filterDefinitions);
|
|
3443
3459
|
setFilterStates(initialStates);
|
|
3444
|
-
|
|
3445
|
-
onFilterClauseChanged?.(newWhereClause);
|
|
3460
|
+
onFilterClauseChanged?.(buildWhereClause(filterDefinitions, initialStates, filterOperator, objectType));
|
|
3446
3461
|
}, [filterDefinitions, filterOperator, objectType, onFilterClauseChanged]);
|
|
3447
|
-
return
|
|
3462
|
+
return React54.useMemo(() => ({
|
|
3448
3463
|
filterStates,
|
|
3449
3464
|
setFilterState,
|
|
3450
3465
|
whereClause,
|
|
@@ -3499,22 +3514,22 @@ function FilterList(props) {
|
|
|
3499
3514
|
activeFilterCount,
|
|
3500
3515
|
reset
|
|
3501
3516
|
} = useFilterListState(props);
|
|
3502
|
-
const handleReset =
|
|
3517
|
+
const handleReset = React54.useCallback(() => {
|
|
3503
3518
|
reset();
|
|
3504
3519
|
onReset?.();
|
|
3505
3520
|
}, [reset, onReset]);
|
|
3506
|
-
const visibleFilterDefinitions =
|
|
3521
|
+
const visibleFilterDefinitions = React54.useMemo(() => {
|
|
3507
3522
|
if (!filterDefinitions) {
|
|
3508
3523
|
return void 0;
|
|
3509
3524
|
}
|
|
3510
3525
|
return filterDefinitions.filter((def) => def.isVisible !== false);
|
|
3511
3526
|
}, [filterDefinitions]);
|
|
3512
|
-
const renderInput =
|
|
3527
|
+
const renderInput = React54.useCallback(({
|
|
3513
3528
|
definition,
|
|
3514
3529
|
filterKey,
|
|
3515
3530
|
filterState,
|
|
3516
3531
|
onFilterStateChanged
|
|
3517
|
-
}) => /* @__PURE__ */
|
|
3532
|
+
}) => /* @__PURE__ */ React54__default.default.createElement(FilterInput, {
|
|
3518
3533
|
objectType,
|
|
3519
3534
|
objectSet,
|
|
3520
3535
|
definition,
|
|
@@ -3522,7 +3537,7 @@ function FilterList(props) {
|
|
|
3522
3537
|
onFilterStateChanged,
|
|
3523
3538
|
whereClause: perFilterWhereClauses.get(filterKey) ?? {}
|
|
3524
3539
|
}), [objectType, objectSet, perFilterWhereClauses]);
|
|
3525
|
-
return /* @__PURE__ */
|
|
3540
|
+
return /* @__PURE__ */ React54__default.default.createElement(BaseFilterList, {
|
|
3526
3541
|
title,
|
|
3527
3542
|
titleIcon,
|
|
3528
3543
|
collapsed,
|
|
@@ -3571,6 +3586,89 @@ function deserializeFilterStates(json) {
|
|
|
3571
3586
|
}
|
|
3572
3587
|
}
|
|
3573
3588
|
|
|
3589
|
+
// src/base-components/tooltip/Tooltip.module.css
|
|
3590
|
+
var Tooltip_default = {};
|
|
3591
|
+
|
|
3592
|
+
// src/base-components/tooltip/Tooltip.tsx
|
|
3593
|
+
function _extends9() {
|
|
3594
|
+
return _extends9 = Object.assign ? Object.assign.bind() : function(n) {
|
|
3595
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
3596
|
+
var t = arguments[e];
|
|
3597
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
3598
|
+
}
|
|
3599
|
+
return n;
|
|
3600
|
+
}, _extends9.apply(null, arguments);
|
|
3601
|
+
}
|
|
3602
|
+
function TooltipRoot({
|
|
3603
|
+
children,
|
|
3604
|
+
...rest
|
|
3605
|
+
}) {
|
|
3606
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Root, rest, children);
|
|
3607
|
+
}
|
|
3608
|
+
function TooltipProvider({
|
|
3609
|
+
children,
|
|
3610
|
+
...rest
|
|
3611
|
+
}) {
|
|
3612
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Provider, rest, children);
|
|
3613
|
+
}
|
|
3614
|
+
function TooltipTrigger({
|
|
3615
|
+
className,
|
|
3616
|
+
children,
|
|
3617
|
+
...rest
|
|
3618
|
+
}) {
|
|
3619
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Trigger, _extends9({
|
|
3620
|
+
className: classnames14__default.default(Tooltip_default.osdkTooltipTrigger, className)
|
|
3621
|
+
}, rest), children);
|
|
3622
|
+
}
|
|
3623
|
+
function TooltipPositioner({
|
|
3624
|
+
className,
|
|
3625
|
+
children,
|
|
3626
|
+
sideOffset = 4,
|
|
3627
|
+
...rest
|
|
3628
|
+
}) {
|
|
3629
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Positioner, _extends9({
|
|
3630
|
+
className: classnames14__default.default(Tooltip_default.osdkTooltipPositioner, className),
|
|
3631
|
+
sideOffset
|
|
3632
|
+
}, rest), children);
|
|
3633
|
+
}
|
|
3634
|
+
function TooltipPopup({
|
|
3635
|
+
className,
|
|
3636
|
+
children,
|
|
3637
|
+
...rest
|
|
3638
|
+
}) {
|
|
3639
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Popup, _extends9({
|
|
3640
|
+
className: classnames14__default.default(Tooltip_default.osdkTooltipPopup, className)
|
|
3641
|
+
}, rest), children);
|
|
3642
|
+
}
|
|
3643
|
+
function TooltipArrow() {
|
|
3644
|
+
return /* @__PURE__ */ React54__default.default.createElement(tooltip.Tooltip.Arrow, {
|
|
3645
|
+
className: Tooltip_default.osdkTooltipArrow
|
|
3646
|
+
}, /* @__PURE__ */ React54__default.default.createElement(ArrowSvg, null));
|
|
3647
|
+
}
|
|
3648
|
+
function ArrowSvg(props) {
|
|
3649
|
+
return /* @__PURE__ */ React54__default.default.createElement("svg", _extends9({
|
|
3650
|
+
width: "20",
|
|
3651
|
+
height: "10",
|
|
3652
|
+
viewBox: "0 0 20 10",
|
|
3653
|
+
fill: "none"
|
|
3654
|
+
}, props), /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
3655
|
+
d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",
|
|
3656
|
+
className: Tooltip_default.tooltipArrowFill
|
|
3657
|
+
}), /* @__PURE__ */ React54__default.default.createElement("path", {
|
|
3658
|
+
d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",
|
|
3659
|
+
className: Tooltip_default.tooltipArrowOuterStroke
|
|
3660
|
+
}));
|
|
3661
|
+
}
|
|
3662
|
+
var Tooltip = {
|
|
3663
|
+
Root: TooltipRoot,
|
|
3664
|
+
Provider: TooltipProvider,
|
|
3665
|
+
Trigger: TooltipTrigger,
|
|
3666
|
+
Portal: tooltip.Tooltip.Portal,
|
|
3667
|
+
Positioner: TooltipPositioner,
|
|
3668
|
+
Popup: TooltipPopup,
|
|
3669
|
+
Arrow: TooltipArrow
|
|
3670
|
+
};
|
|
3671
|
+
|
|
3574
3672
|
// src/object-table/EditableCell.module.css
|
|
3575
3673
|
var EditableCell_default = {};
|
|
3576
3674
|
|
|
@@ -3598,26 +3696,46 @@ function parseValueByType(value, dataType) {
|
|
|
3598
3696
|
}
|
|
3599
3697
|
return parsedNumber;
|
|
3600
3698
|
}
|
|
3601
|
-
|
|
3699
|
+
var VALIDATION_ERROR_MESSAGE = "Validation error";
|
|
3700
|
+
function EditableCellInner({
|
|
3602
3701
|
initialValue,
|
|
3603
3702
|
currentValue,
|
|
3604
3703
|
cellId,
|
|
3605
3704
|
dataType,
|
|
3606
3705
|
onCellEdit,
|
|
3706
|
+
onCellValidationError,
|
|
3707
|
+
clearCellValidationError,
|
|
3607
3708
|
originalRowData,
|
|
3608
3709
|
rowId,
|
|
3609
|
-
columnId
|
|
3710
|
+
columnId,
|
|
3711
|
+
validateEdit,
|
|
3712
|
+
validationError
|
|
3610
3713
|
}) {
|
|
3611
|
-
const [inputValue, setInputValue] =
|
|
3612
|
-
const isCancelled =
|
|
3613
|
-
|
|
3714
|
+
const [inputValue, setInputValue] = React54.useState(valueToString(currentValue));
|
|
3715
|
+
const isCancelled = React54.useRef(false);
|
|
3716
|
+
const validationAbortControllerRef = React54.useRef(null);
|
|
3717
|
+
const abortController = React54.useCallback(() => {
|
|
3718
|
+
if (validationAbortControllerRef.current) {
|
|
3719
|
+
validationAbortControllerRef.current.abort();
|
|
3720
|
+
validationAbortControllerRef.current = null;
|
|
3721
|
+
}
|
|
3722
|
+
}, []);
|
|
3723
|
+
const hasValidationError = validationError != null;
|
|
3724
|
+
const isEdited = currentValue !== initialValue;
|
|
3725
|
+
React54.useEffect(() => {
|
|
3614
3726
|
setInputValue(valueToString(currentValue));
|
|
3615
3727
|
}, [currentValue]);
|
|
3616
|
-
|
|
3728
|
+
React54.useEffect(() => {
|
|
3729
|
+
return () => {
|
|
3730
|
+
abortController();
|
|
3731
|
+
};
|
|
3732
|
+
}, [abortController]);
|
|
3733
|
+
const handleBlur = React54.useCallback(() => {
|
|
3617
3734
|
if (isCancelled.current) {
|
|
3618
3735
|
isCancelled.current = false;
|
|
3619
3736
|
return;
|
|
3620
3737
|
}
|
|
3738
|
+
abortController();
|
|
3621
3739
|
const parsedValue = parseValueByType(inputValue, dataType);
|
|
3622
3740
|
onCellEdit(cellId, {
|
|
3623
3741
|
rowId,
|
|
@@ -3626,11 +3744,34 @@ function EditableCell({
|
|
|
3626
3744
|
oldValue: initialValue,
|
|
3627
3745
|
originalRowData
|
|
3628
3746
|
});
|
|
3629
|
-
|
|
3630
|
-
|
|
3747
|
+
if (validateEdit) {
|
|
3748
|
+
const abortController2 = new AbortController();
|
|
3749
|
+
validationAbortControllerRef.current = abortController2;
|
|
3750
|
+
const validationPromise = validateEdit(parsedValue);
|
|
3751
|
+
Promise.race([validationPromise, new Promise((_, reject) => {
|
|
3752
|
+
abortController2.signal.addEventListener("abort", () => {
|
|
3753
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
3754
|
+
});
|
|
3755
|
+
})]).then((errorMessage) => {
|
|
3756
|
+
if (!abortController2.signal.aborted) {
|
|
3757
|
+
if (errorMessage) {
|
|
3758
|
+
onCellValidationError?.(cellId, errorMessage);
|
|
3759
|
+
} else {
|
|
3760
|
+
clearCellValidationError?.(cellId);
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
}, (error) => {
|
|
3764
|
+
if (!abortController2.signal.aborted && error.name !== "AbortError") {
|
|
3765
|
+
onCellValidationError?.(cellId, VALIDATION_ERROR_MESSAGE);
|
|
3766
|
+
}
|
|
3767
|
+
});
|
|
3768
|
+
}
|
|
3769
|
+
}, [abortController, inputValue, dataType, onCellEdit, cellId, rowId, columnId, initialValue, originalRowData, validateEdit, onCellValidationError, clearCellValidationError]);
|
|
3770
|
+
const handleChange = React54.useCallback((value) => {
|
|
3771
|
+
abortController();
|
|
3631
3772
|
setInputValue(value);
|
|
3632
|
-
}, []);
|
|
3633
|
-
const handleKeyDown =
|
|
3773
|
+
}, [abortController]);
|
|
3774
|
+
const handleKeyDown = React54.useCallback((e) => {
|
|
3634
3775
|
if (e.key === "Enter") {
|
|
3635
3776
|
e.currentTarget.blur();
|
|
3636
3777
|
}
|
|
@@ -3641,18 +3782,33 @@ function EditableCell({
|
|
|
3641
3782
|
}
|
|
3642
3783
|
}, [currentValue]);
|
|
3643
3784
|
const inputType = dataType && NUMBER_TYPES.includes(dataType) ? "number" : "text";
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3785
|
+
return /* @__PURE__ */ React54__default.default.createElement(Tooltip.Provider, null, /* @__PURE__ */ React54__default.default.createElement(Tooltip.Root, {
|
|
3786
|
+
disabled: !hasValidationError
|
|
3787
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Tooltip.Trigger, null, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
3788
|
+
className: classnames14__default.default(EditableCell_default.osdkEditableCell, {
|
|
3789
|
+
[EditableCell_default.error]: hasValidationError,
|
|
3647
3790
|
[EditableCell_default.osdkEditedInput]: isEdited
|
|
3648
|
-
})
|
|
3791
|
+
})
|
|
3792
|
+
}, /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
3649
3793
|
type: inputType,
|
|
3650
3794
|
value: inputValue,
|
|
3795
|
+
className: EditableCell_default.osdkEditableInput,
|
|
3651
3796
|
onValueChange: handleChange,
|
|
3652
3797
|
onBlur: handleBlur,
|
|
3653
|
-
onKeyDown: handleKeyDown
|
|
3654
|
-
|
|
3655
|
-
}
|
|
3798
|
+
onKeyDown: handleKeyDown,
|
|
3799
|
+
"aria-invalid": hasValidationError
|
|
3800
|
+
}), hasValidationError && /* @__PURE__ */ React54__default.default.createElement(icons.Error, {
|
|
3801
|
+
className: EditableCell_default.errorIcon
|
|
3802
|
+
}))), /* @__PURE__ */ React54__default.default.createElement(Tooltip.Portal, null, /* @__PURE__ */ React54__default.default.createElement(Tooltip.Positioner, {
|
|
3803
|
+
sideOffset: 4,
|
|
3804
|
+
side: "bottom"
|
|
3805
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Tooltip.Popup, null, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
3806
|
+
className: EditableCell_default.validationError
|
|
3807
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Error, {
|
|
3808
|
+
className: EditableCell_default.errorIcon
|
|
3809
|
+
}), validationError), /* @__PURE__ */ React54__default.default.createElement(Tooltip.Arrow, null))))));
|
|
3810
|
+
}
|
|
3811
|
+
var EditableCell = /* @__PURE__ */ React54__default.default.memo(EditableCellInner);
|
|
3656
3812
|
|
|
3657
3813
|
// src/object-table/utils/getCellId.ts
|
|
3658
3814
|
function getCellId(cellIdentifier) {
|
|
@@ -3664,7 +3820,7 @@ function renderDefaultCell(cellContext) {
|
|
|
3664
3820
|
const meta = cellContext.table.options.meta;
|
|
3665
3821
|
const columnMeta = cellContext.column.columnDef.meta;
|
|
3666
3822
|
if (!columnMeta?.editable || !meta?.onCellEdit || !meta?.isInEditMode) {
|
|
3667
|
-
return /* @__PURE__ */
|
|
3823
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, cellContext.getValue());
|
|
3668
3824
|
}
|
|
3669
3825
|
const rowId = cellContext.row.id;
|
|
3670
3826
|
const columnId = cellContext.column.id;
|
|
@@ -3675,15 +3831,20 @@ function renderDefaultCell(cellContext) {
|
|
|
3675
3831
|
const cellEdits = meta.cellEdits;
|
|
3676
3832
|
const editedValue = cellEdits?.[cellId];
|
|
3677
3833
|
const currentValue = editedValue?.newValue ?? cellContext.getValue();
|
|
3678
|
-
|
|
3834
|
+
const validationError = meta.validationErrors?.get(cellId);
|
|
3835
|
+
return /* @__PURE__ */ React54__default.default.createElement(EditableCell, {
|
|
3679
3836
|
initialValue: cellContext.getValue(),
|
|
3680
3837
|
currentValue,
|
|
3681
3838
|
cellId,
|
|
3682
3839
|
dataType: columnMeta?.dataType,
|
|
3683
3840
|
onCellEdit: meta.onCellEdit,
|
|
3841
|
+
onCellValidationError: meta.onCellValidationError,
|
|
3842
|
+
clearCellValidationError: meta.clearCellValidationError,
|
|
3684
3843
|
originalRowData: cellContext.row.original,
|
|
3685
3844
|
rowId,
|
|
3686
|
-
columnId
|
|
3845
|
+
columnId,
|
|
3846
|
+
validateEdit: columnMeta?.validateEdit,
|
|
3847
|
+
validationError
|
|
3687
3848
|
});
|
|
3688
3849
|
}
|
|
3689
3850
|
|
|
@@ -3694,7 +3855,7 @@ function useColumnDefs(objectType, columnDefinitions) {
|
|
|
3694
3855
|
loading,
|
|
3695
3856
|
error
|
|
3696
3857
|
} = react.useOsdkMetadata(objectType);
|
|
3697
|
-
const columns =
|
|
3858
|
+
const columns = React54.useMemo(() => {
|
|
3698
3859
|
const objectProperties = metadata?.properties;
|
|
3699
3860
|
if (columnDefinitions) {
|
|
3700
3861
|
return getColumnsFromColumnDefinitions(columnDefinitions, objectProperties);
|
|
@@ -3733,7 +3894,8 @@ function getColumnsFromColumnDefinitions(columnDefinitions, objectProperties) {
|
|
|
3733
3894
|
columnName: columnName || propertyMetadata?.displayName,
|
|
3734
3895
|
isVisible: col.isVisible !== false,
|
|
3735
3896
|
editable,
|
|
3736
|
-
dataType
|
|
3897
|
+
dataType,
|
|
3898
|
+
validateEdit: col.validateEdit
|
|
3737
3899
|
},
|
|
3738
3900
|
size: width,
|
|
3739
3901
|
...minWidth ? {
|
|
@@ -3776,11 +3938,11 @@ var useColumnPinning = ({
|
|
|
3776
3938
|
hasSelectionColumn,
|
|
3777
3939
|
onColumnsPinnedChanged
|
|
3778
3940
|
}) => {
|
|
3779
|
-
const [columnPinning, setColumnPinning] =
|
|
3941
|
+
const [columnPinning, setColumnPinning] = React54.useState({
|
|
3780
3942
|
left: [],
|
|
3781
3943
|
right: []
|
|
3782
3944
|
});
|
|
3783
|
-
|
|
3945
|
+
React54.useEffect(() => {
|
|
3784
3946
|
const defaultState = getColumnPinningStateFromColumnDefs(columnDefinitions);
|
|
3785
3947
|
const selectionCol = hasSelectionColumn ? [SELECTION_COLUMN_ID] : [];
|
|
3786
3948
|
setColumnPinning({
|
|
@@ -3788,7 +3950,7 @@ var useColumnPinning = ({
|
|
|
3788
3950
|
right: [...defaultState.right ?? []]
|
|
3789
3951
|
});
|
|
3790
3952
|
}, [columnDefinitions, hasSelectionColumn]);
|
|
3791
|
-
const onColumnPinningChange =
|
|
3953
|
+
const onColumnPinningChange = React54.useCallback((updater) => {
|
|
3792
3954
|
setColumnPinning((prev) => {
|
|
3793
3955
|
const newPinning = typeof updater === "function" ? updater(prev) : updater;
|
|
3794
3956
|
if (onColumnsPinnedChanged) {
|
|
@@ -3845,8 +4007,8 @@ function convertColumnPinningStateToArray(pinningState) {
|
|
|
3845
4007
|
var useColumnResize = ({
|
|
3846
4008
|
onColumnResize
|
|
3847
4009
|
}) => {
|
|
3848
|
-
const [columnSizing, setColumnSizing] =
|
|
3849
|
-
const onColumnSizingChange =
|
|
4010
|
+
const [columnSizing, setColumnSizing] = React54.useState({});
|
|
4011
|
+
const onColumnSizingChange = React54.useCallback((updater) => {
|
|
3850
4012
|
setColumnSizing((prev) => {
|
|
3851
4013
|
const newState = typeof updater === "function" ? updater(prev) : updater;
|
|
3852
4014
|
if (onColumnResize) {
|
|
@@ -3873,15 +4035,15 @@ var useColumnVisibility = ({
|
|
|
3873
4035
|
allColumns,
|
|
3874
4036
|
onColumnVisibilityChanged
|
|
3875
4037
|
}) => {
|
|
3876
|
-
const [columnVisibility, setColumnVisibility] =
|
|
3877
|
-
const [columnOrder, setColumnOrder] =
|
|
3878
|
-
|
|
4038
|
+
const [columnVisibility, setColumnVisibility] = React54.useState(() => getColumnVisibilityState(allColumns));
|
|
4039
|
+
const [columnOrder, setColumnOrder] = React54.useState(() => getColumnOrder(allColumns));
|
|
4040
|
+
React54.useEffect(() => {
|
|
3879
4041
|
setColumnVisibility(getColumnVisibilityState(allColumns));
|
|
3880
4042
|
}, [allColumns]);
|
|
3881
|
-
|
|
4043
|
+
React54.useEffect(() => {
|
|
3882
4044
|
setColumnOrder(getColumnOrder(allColumns));
|
|
3883
4045
|
}, [allColumns]);
|
|
3884
|
-
const onColumnVisibilityChange =
|
|
4046
|
+
const onColumnVisibilityChange = React54.useCallback((updaterOrValue) => {
|
|
3885
4047
|
setColumnVisibility((prev) => {
|
|
3886
4048
|
const newState = typeof updaterOrValue === "function" ? updaterOrValue(prev) : updaterOrValue;
|
|
3887
4049
|
if (onColumnVisibilityChanged) {
|
|
@@ -3894,7 +4056,7 @@ var useColumnVisibility = ({
|
|
|
3894
4056
|
return newState;
|
|
3895
4057
|
});
|
|
3896
4058
|
}, [onColumnVisibilityChanged]);
|
|
3897
|
-
const onColumnOrderChange =
|
|
4059
|
+
const onColumnOrderChange = React54.useCallback((updaterOrValue) => {
|
|
3898
4060
|
setColumnOrder((prev) => {
|
|
3899
4061
|
const newState = typeof updaterOrValue === "function" ? updaterOrValue(prev) : updaterOrValue;
|
|
3900
4062
|
return newState;
|
|
@@ -3927,9 +4089,17 @@ function useEditableTable({
|
|
|
3927
4089
|
onCellValueChanged,
|
|
3928
4090
|
onSubmitEdits
|
|
3929
4091
|
}) {
|
|
3930
|
-
const [isActive, setActive] =
|
|
3931
|
-
const [cellEdits, setCellEdits] =
|
|
3932
|
-
const
|
|
4092
|
+
const [isActive, setActive] = React54.useState(editMode === "always");
|
|
4093
|
+
const [cellEdits, setCellEdits] = React54.useState({});
|
|
4094
|
+
const [validationErrors, setValidationErrors] = React54.useState(/* @__PURE__ */ new Map());
|
|
4095
|
+
const clearCellValidationError = React54.useCallback((cellId) => {
|
|
4096
|
+
setValidationErrors((prev) => {
|
|
4097
|
+
const newErrors = new Map(prev);
|
|
4098
|
+
newErrors.delete(cellId);
|
|
4099
|
+
return newErrors;
|
|
4100
|
+
});
|
|
4101
|
+
}, []);
|
|
4102
|
+
const handleCellEdit = React54.useCallback((cellId, info) => {
|
|
3933
4103
|
if (info.newValue === info.oldValue) {
|
|
3934
4104
|
setCellEdits((prev) => {
|
|
3935
4105
|
const {
|
|
@@ -3946,14 +4116,22 @@ function useEditableTable({
|
|
|
3946
4116
|
}
|
|
3947
4117
|
onCellValueChanged?.(info);
|
|
3948
4118
|
}, [onCellValueChanged]);
|
|
3949
|
-
const clearEdits =
|
|
4119
|
+
const clearEdits = React54.useCallback(() => {
|
|
3950
4120
|
setCellEdits({});
|
|
4121
|
+
setValidationErrors(/* @__PURE__ */ new Map());
|
|
3951
4122
|
}, []);
|
|
3952
|
-
const handleSubmitEdits =
|
|
4123
|
+
const handleSubmitEdits = React54.useCallback(async () => {
|
|
3953
4124
|
const edits = Object.values(cellEdits);
|
|
3954
4125
|
return onSubmitEdits ? onSubmitEdits(edits) : false;
|
|
3955
4126
|
}, [cellEdits, onSubmitEdits]);
|
|
3956
|
-
const
|
|
4127
|
+
const onCellValidationError = React54.useCallback((cellId, error) => {
|
|
4128
|
+
setValidationErrors((prev) => {
|
|
4129
|
+
const newErrors = new Map(prev);
|
|
4130
|
+
newErrors.set(cellId, error);
|
|
4131
|
+
return newErrors;
|
|
4132
|
+
});
|
|
4133
|
+
}, []);
|
|
4134
|
+
const editModeState = editMode === "always" ? {
|
|
3957
4135
|
type: "always",
|
|
3958
4136
|
isActive: true
|
|
3959
4137
|
} : {
|
|
@@ -3966,12 +4144,15 @@ function useEditableTable({
|
|
|
3966
4144
|
onCellEdit: handleCellEdit,
|
|
3967
4145
|
onSubmitEdits: onSubmitEdits ? handleSubmitEdits : void 0,
|
|
3968
4146
|
clearEdits,
|
|
3969
|
-
|
|
4147
|
+
editModeState,
|
|
4148
|
+
onCellValidationError,
|
|
4149
|
+
validationErrors,
|
|
4150
|
+
clearCellValidationError
|
|
3970
4151
|
};
|
|
3971
4152
|
}
|
|
3972
4153
|
var PAGE_SIZE = 50;
|
|
3973
4154
|
function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, sorting, objectSet, objectSetOptions) {
|
|
3974
|
-
const orderBy =
|
|
4155
|
+
const orderBy = React54.useMemo(() => {
|
|
3975
4156
|
if (!sorting || sorting.length === 0) {
|
|
3976
4157
|
return void 0;
|
|
3977
4158
|
}
|
|
@@ -3980,7 +4161,7 @@ function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, so
|
|
|
3980
4161
|
return acc;
|
|
3981
4162
|
}, {});
|
|
3982
4163
|
}, [sorting]);
|
|
3983
|
-
const withProperties =
|
|
4164
|
+
const withProperties = React54.useMemo(() => {
|
|
3984
4165
|
if (!columnDefinitions) {
|
|
3985
4166
|
return;
|
|
3986
4167
|
}
|
|
@@ -4042,11 +4223,11 @@ function useRowSelection({
|
|
|
4042
4223
|
onRowSelection,
|
|
4043
4224
|
data
|
|
4044
4225
|
}) {
|
|
4045
|
-
const [internalRowSelection, setInternalRowSelection] =
|
|
4046
|
-
const [lastSelectedRowIndex, setLastSelectedRowIndex] =
|
|
4226
|
+
const [internalRowSelection, setInternalRowSelection] = React54.useState({});
|
|
4227
|
+
const [lastSelectedRowIndex, setLastSelectedRowIndex] = React54.useState(null);
|
|
4047
4228
|
const isControlled = selectedRows !== void 0;
|
|
4048
4229
|
const enableRowSelection = selectionMode !== "none";
|
|
4049
|
-
const rowSelectionState =
|
|
4230
|
+
const rowSelectionState = React54.useMemo(() => {
|
|
4050
4231
|
if (!enableRowSelection) return {};
|
|
4051
4232
|
if (isControlled) {
|
|
4052
4233
|
const selectedRowIds = isAllSelectedProp ? (data ?? []).map((item) => item.$primaryKey) : selectedRows;
|
|
@@ -4058,7 +4239,7 @@ function useRowSelection({
|
|
|
4058
4239
|
const totalCount = data?.length ?? 0;
|
|
4059
4240
|
const isAllSelected = isControlled && isAllSelectedProp !== void 0 ? isAllSelectedProp : totalCount > 0 && selectedCount === totalCount;
|
|
4060
4241
|
const hasSelection = isAllSelected || selectedCount > 0;
|
|
4061
|
-
const onToggleAll =
|
|
4242
|
+
const onToggleAll = React54.useCallback(() => {
|
|
4062
4243
|
if (!enableRowSelection || !data) return;
|
|
4063
4244
|
const newSelectedRows = isAllSelected ? [] : data.map((item) => item.$primaryKey);
|
|
4064
4245
|
if (!isControlled) {
|
|
@@ -4066,7 +4247,7 @@ function useRowSelection({
|
|
|
4066
4247
|
}
|
|
4067
4248
|
onRowSelection?.(newSelectedRows, true);
|
|
4068
4249
|
}, [enableRowSelection, data, isAllSelected, isControlled, onRowSelection]);
|
|
4069
|
-
const onToggleRow =
|
|
4250
|
+
const onToggleRow = React54.useCallback((rowId, rowIndex, isShiftClick = false) => {
|
|
4070
4251
|
if (!enableRowSelection || !data) return;
|
|
4071
4252
|
let newSelectedRows = [];
|
|
4072
4253
|
if (selectionMode === "single") {
|
|
@@ -4193,7 +4374,7 @@ function SelectionHeaderCell({
|
|
|
4193
4374
|
hasSelection,
|
|
4194
4375
|
onToggleAll
|
|
4195
4376
|
}) {
|
|
4196
|
-
return /* @__PURE__ */
|
|
4377
|
+
return /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
4197
4378
|
indeterminate: hasSelection && !isAllSelected,
|
|
4198
4379
|
checked: isAllSelected,
|
|
4199
4380
|
onCheckedChange: onToggleAll,
|
|
@@ -4204,21 +4385,21 @@ function SelectionCell({
|
|
|
4204
4385
|
row,
|
|
4205
4386
|
onToggleRow
|
|
4206
4387
|
}) {
|
|
4207
|
-
const handleClick =
|
|
4388
|
+
const handleClick = React54.useCallback((event) => {
|
|
4208
4389
|
event.stopPropagation();
|
|
4209
4390
|
const isShiftClick = event.shiftKey;
|
|
4210
4391
|
onToggleRow(row.id, row.index, isShiftClick);
|
|
4211
4392
|
}, [onToggleRow, row.id, row.index]);
|
|
4212
|
-
const handleKeyDown =
|
|
4393
|
+
const handleKeyDown = React54.useCallback((event) => {
|
|
4213
4394
|
if (event.key === "Enter") {
|
|
4214
4395
|
const isShiftClick = event.shiftKey;
|
|
4215
4396
|
onToggleRow(row.id, row.index, isShiftClick);
|
|
4216
4397
|
}
|
|
4217
4398
|
}, [onToggleRow, row.id, row.index]);
|
|
4218
|
-
return /* @__PURE__ */
|
|
4399
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4219
4400
|
onClick: handleClick,
|
|
4220
4401
|
onKeyDown: handleKeyDown
|
|
4221
|
-
}, /* @__PURE__ */
|
|
4402
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
4222
4403
|
checked: row.getIsSelected(),
|
|
4223
4404
|
"aria-label": `Select row ${row.index + 1}`
|
|
4224
4405
|
}));
|
|
@@ -4232,26 +4413,26 @@ var useSelectionColumn = ({
|
|
|
4232
4413
|
onToggleAll,
|
|
4233
4414
|
onToggleRow
|
|
4234
4415
|
}) => {
|
|
4235
|
-
const isAllSelectedRef =
|
|
4416
|
+
const isAllSelectedRef = React54.useRef(isAllSelected);
|
|
4236
4417
|
isAllSelectedRef.current = isAllSelected;
|
|
4237
|
-
const hasSelectionRef =
|
|
4418
|
+
const hasSelectionRef = React54.useRef(hasSelection);
|
|
4238
4419
|
hasSelectionRef.current = hasSelection;
|
|
4239
|
-
const onToggleAllRef =
|
|
4420
|
+
const onToggleAllRef = React54.useRef(onToggleAll);
|
|
4240
4421
|
onToggleAllRef.current = onToggleAll;
|
|
4241
|
-
const onToggleRowRef =
|
|
4422
|
+
const onToggleRowRef = React54.useRef(onToggleRow);
|
|
4242
4423
|
onToggleRowRef.current = onToggleRow;
|
|
4243
|
-
const selectionColumn =
|
|
4424
|
+
const selectionColumn = React54.useMemo(() => {
|
|
4244
4425
|
if (selectionMode === "none") return null;
|
|
4245
4426
|
const colDef = {
|
|
4246
4427
|
id: SELECTION_COLUMN_ID,
|
|
4247
|
-
header: () => selectionMode === "multiple" ? /* @__PURE__ */
|
|
4428
|
+
header: () => selectionMode === "multiple" ? /* @__PURE__ */ React54__default.default.createElement(SelectionHeaderCell, {
|
|
4248
4429
|
isAllSelected: isAllSelectedRef.current,
|
|
4249
4430
|
hasSelection: hasSelectionRef.current,
|
|
4250
4431
|
onToggleAll: onToggleAllRef.current
|
|
4251
4432
|
}) : null,
|
|
4252
4433
|
cell: ({
|
|
4253
4434
|
row
|
|
4254
|
-
}) => /* @__PURE__ */
|
|
4435
|
+
}) => /* @__PURE__ */ React54__default.default.createElement(SelectionCell, {
|
|
4255
4436
|
row,
|
|
4256
4437
|
onToggleRow: onToggleRowRef.current
|
|
4257
4438
|
}),
|
|
@@ -4271,10 +4452,10 @@ var useTableSorting = ({
|
|
|
4271
4452
|
defaultOrderBy,
|
|
4272
4453
|
onOrderByChanged
|
|
4273
4454
|
}) => {
|
|
4274
|
-
const [internalSorting, setInternalSorting] =
|
|
4455
|
+
const [internalSorting, setInternalSorting] = React54.useState(() => defaultOrderBy ? convertOrderByToSortingState(defaultOrderBy) : []);
|
|
4275
4456
|
const isControlled = orderBy !== void 0;
|
|
4276
|
-
const sortingState =
|
|
4277
|
-
const onSortingChange =
|
|
4457
|
+
const sortingState = React54.useMemo(() => orderBy ? convertOrderByToSortingState(orderBy) : internalSorting, [orderBy, internalSorting]);
|
|
4458
|
+
const onSortingChange = React54.useCallback((updater) => {
|
|
4278
4459
|
const newSorting = typeof updater === "function" ? updater(sortingState) : updater;
|
|
4279
4460
|
if (!isControlled) {
|
|
4280
4461
|
setInternalSorting(newSorting);
|
|
@@ -4318,12 +4499,12 @@ var TableCell_default = {};
|
|
|
4318
4499
|
function LoadingCell({
|
|
4319
4500
|
width
|
|
4320
4501
|
}) {
|
|
4321
|
-
return /* @__PURE__ */
|
|
4502
|
+
return /* @__PURE__ */ React54__default.default.createElement("td", {
|
|
4322
4503
|
className: TableCell_default.osdkTableCell,
|
|
4323
4504
|
style: {
|
|
4324
4505
|
width
|
|
4325
4506
|
}
|
|
4326
|
-
}, /* @__PURE__ */
|
|
4507
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4327
4508
|
className: classnames14__default.default(LoadingCell_default.osdkLoadingCell, LoadingCell_default.osdkCellSkeleton)
|
|
4328
4509
|
}));
|
|
4329
4510
|
}
|
|
@@ -4339,17 +4520,17 @@ function LoadingRow({
|
|
|
4339
4520
|
rowHeight = 40,
|
|
4340
4521
|
columnWidth = 80
|
|
4341
4522
|
}) {
|
|
4342
|
-
return /* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ React54__default.default.createElement("tr", {
|
|
4343
4524
|
className: TableRow_default.osdkTableRow,
|
|
4344
4525
|
style: {
|
|
4345
4526
|
height: `${rowHeight}px`,
|
|
4346
4527
|
transform: `translateY(${translateY}px)`
|
|
4347
4528
|
}
|
|
4348
|
-
}, /* @__PURE__ */
|
|
4529
|
+
}, /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, Array.from({
|
|
4349
4530
|
length: columnCount
|
|
4350
4531
|
}).map((_, index) => {
|
|
4351
4532
|
const width = headers.length > index ? headers[index].getSize() : columnWidth;
|
|
4352
|
-
return /* @__PURE__ */
|
|
4533
|
+
return /* @__PURE__ */ React54__default.default.createElement(LoadingCell, {
|
|
4353
4534
|
key: `loading-cell-${index}`,
|
|
4354
4535
|
width
|
|
4355
4536
|
});
|
|
@@ -4363,21 +4544,21 @@ var TableBody_default = {};
|
|
|
4363
4544
|
var ActionButton_default = {};
|
|
4364
4545
|
|
|
4365
4546
|
// src/base-components/action-button/ActionButton.tsx
|
|
4366
|
-
function
|
|
4367
|
-
return
|
|
4547
|
+
function _extends10() {
|
|
4548
|
+
return _extends10 = Object.assign ? Object.assign.bind() : function(n) {
|
|
4368
4549
|
for (var e = 1; e < arguments.length; e++) {
|
|
4369
4550
|
var t = arguments[e];
|
|
4370
4551
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
4371
4552
|
}
|
|
4372
4553
|
return n;
|
|
4373
|
-
},
|
|
4554
|
+
}, _extends10.apply(null, arguments);
|
|
4374
4555
|
}
|
|
4375
4556
|
function ActionButton({
|
|
4376
4557
|
variant = "secondary",
|
|
4377
4558
|
className,
|
|
4378
4559
|
...rest
|
|
4379
4560
|
}) {
|
|
4380
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React54__default.default.createElement(button.Button, _extends10({
|
|
4381
4562
|
className: classnames14__default.default(ActionButton_default.button, variant === "primary" ? ActionButton_default.primaryButton : ActionButton_default.secondaryButton, className)
|
|
4382
4563
|
}, rest));
|
|
4383
4564
|
}
|
|
@@ -4394,25 +4575,25 @@ function Dialog({
|
|
|
4394
4575
|
footer,
|
|
4395
4576
|
className
|
|
4396
4577
|
}) {
|
|
4397
|
-
return /* @__PURE__ */
|
|
4578
|
+
return /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Root, {
|
|
4398
4579
|
open: isOpen,
|
|
4399
4580
|
onOpenChange
|
|
4400
|
-
}, /* @__PURE__ */
|
|
4581
|
+
}, /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Portal, null, /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Backdrop, {
|
|
4401
4582
|
className: Dialog_default.backdrop
|
|
4402
|
-
}), /* @__PURE__ */
|
|
4583
|
+
}), /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Popup, {
|
|
4403
4584
|
className: classnames14__default.default(Dialog_default.popup, className)
|
|
4404
|
-
}, /* @__PURE__ */
|
|
4585
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4405
4586
|
className: Dialog_default.header
|
|
4406
|
-
}, /* @__PURE__ */
|
|
4587
|
+
}, /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Title, {
|
|
4407
4588
|
className: Dialog_default.title
|
|
4408
|
-
}, title), /* @__PURE__ */
|
|
4589
|
+
}, title), /* @__PURE__ */ React54__default.default.createElement(dialog.Dialog.Close, {
|
|
4409
4590
|
className: Dialog_default.closeButton,
|
|
4410
4591
|
"aria-label": "Close dialog"
|
|
4411
|
-
}, /* @__PURE__ */
|
|
4592
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Cross, {
|
|
4412
4593
|
className: Dialog_default.closeIcon
|
|
4413
|
-
}))), /* @__PURE__ */
|
|
4594
|
+
}))), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4414
4595
|
className: Dialog_default.body
|
|
4415
|
-
}, children), footer != null && /* @__PURE__ */
|
|
4596
|
+
}, children), footer != null && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4416
4597
|
className: Dialog_default.footer
|
|
4417
4598
|
}, footer))));
|
|
4418
4599
|
}
|
|
@@ -4421,14 +4602,14 @@ function Dialog({
|
|
|
4421
4602
|
var DraggableList_default = {};
|
|
4422
4603
|
|
|
4423
4604
|
// src/base-components/draggable-list/DraggableList.tsx
|
|
4424
|
-
function
|
|
4425
|
-
return
|
|
4605
|
+
function _extends11() {
|
|
4606
|
+
return _extends11 = Object.assign ? Object.assign.bind() : function(n) {
|
|
4426
4607
|
for (var e = 1; e < arguments.length; e++) {
|
|
4427
4608
|
var t = arguments[e];
|
|
4428
4609
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
4429
4610
|
}
|
|
4430
4611
|
return n;
|
|
4431
|
-
},
|
|
4612
|
+
}, _extends11.apply(null, arguments);
|
|
4432
4613
|
}
|
|
4433
4614
|
function DraggableListItem({
|
|
4434
4615
|
item,
|
|
@@ -4450,28 +4631,28 @@ function DraggableListItem({
|
|
|
4450
4631
|
transform: utilities.CSS.Transform.toString(transform),
|
|
4451
4632
|
transition
|
|
4452
4633
|
};
|
|
4453
|
-
const handleRemove =
|
|
4634
|
+
const handleRemove = React54.useCallback(() => {
|
|
4454
4635
|
onRemove?.(item.id);
|
|
4455
4636
|
}, [item.id, onRemove]);
|
|
4456
4637
|
const RemoveIcon2 = removeIconVariant === "trash" ? icons.Trash : icons.SmallCross;
|
|
4457
|
-
return /* @__PURE__ */
|
|
4638
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4458
4639
|
ref: setNodeRef,
|
|
4459
4640
|
style,
|
|
4460
4641
|
className: DraggableList_default.draggableItem,
|
|
4461
4642
|
"data-dragging": isDragging
|
|
4462
|
-
}, /* @__PURE__ */
|
|
4643
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", _extends11({
|
|
4463
4644
|
className: DraggableList_default.dragHandle,
|
|
4464
4645
|
"aria-label": `Reorder ${item.label}`
|
|
4465
|
-
}, attributes, listeners), /* @__PURE__ */
|
|
4646
|
+
}, attributes, listeners), /* @__PURE__ */ React54__default.default.createElement(icons.DragHandleVertical, {
|
|
4466
4647
|
className: DraggableList_default.icon,
|
|
4467
4648
|
color: "currentColor"
|
|
4468
|
-
})), /* @__PURE__ */
|
|
4649
|
+
})), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4469
4650
|
className: DraggableList_default.itemContent
|
|
4470
|
-
}, renderContent ? renderContent(item) : item.label), onRemove && /* @__PURE__ */
|
|
4651
|
+
}, renderContent ? renderContent(item) : item.label), onRemove && /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
4471
4652
|
className: DraggableList_default.removeButton,
|
|
4472
4653
|
onClick: handleRemove,
|
|
4473
4654
|
"aria-label": `Remove ${item.label}`
|
|
4474
|
-
}, /* @__PURE__ */
|
|
4655
|
+
}, /* @__PURE__ */ React54__default.default.createElement(RemoveIcon2, {
|
|
4475
4656
|
className: DraggableList_default.icon,
|
|
4476
4657
|
color: "currentColor"
|
|
4477
4658
|
})));
|
|
@@ -4485,7 +4666,7 @@ function DraggableList({
|
|
|
4485
4666
|
emptyMessage,
|
|
4486
4667
|
className
|
|
4487
4668
|
}) {
|
|
4488
|
-
const itemIds =
|
|
4669
|
+
const itemIds = React54.useMemo(() => items.map((item) => item.id), [items]);
|
|
4489
4670
|
const sensors = core.useSensors(core.useSensor(core.PointerSensor, {
|
|
4490
4671
|
activationConstraint: {
|
|
4491
4672
|
distance: 5
|
|
@@ -4493,7 +4674,7 @@ function DraggableList({
|
|
|
4493
4674
|
}), core.useSensor(core.KeyboardSensor, {
|
|
4494
4675
|
coordinateGetter: sortable.sortableKeyboardCoordinates
|
|
4495
4676
|
}));
|
|
4496
|
-
const handleDragEnd =
|
|
4677
|
+
const handleDragEnd = React54.useCallback((event) => {
|
|
4497
4678
|
const {
|
|
4498
4679
|
active,
|
|
4499
4680
|
over
|
|
@@ -4504,31 +4685,31 @@ function DraggableList({
|
|
|
4504
4685
|
onReorder(oldIndex, newIndex);
|
|
4505
4686
|
}
|
|
4506
4687
|
}, [items, onReorder]);
|
|
4507
|
-
const containerRef =
|
|
4688
|
+
const containerRef = React54.useRef(null);
|
|
4508
4689
|
useKeyboardEvents(containerRef);
|
|
4509
4690
|
const DndContext2 = core.DndContext;
|
|
4510
|
-
return /* @__PURE__ */
|
|
4691
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4511
4692
|
ref: containerRef,
|
|
4512
4693
|
className: classnames14__default.default(DraggableList_default.draggableListContainer, className)
|
|
4513
|
-
}, /* @__PURE__ */
|
|
4694
|
+
}, /* @__PURE__ */ React54__default.default.createElement(DndContext2, {
|
|
4514
4695
|
sensors,
|
|
4515
4696
|
collisionDetection: core.closestCenter,
|
|
4516
4697
|
onDragEnd: handleDragEnd
|
|
4517
|
-
}, /* @__PURE__ */
|
|
4698
|
+
}, /* @__PURE__ */ React54__default.default.createElement(sortable.SortableContext, {
|
|
4518
4699
|
items: itemIds,
|
|
4519
4700
|
strategy: sortable.verticalListSortingStrategy
|
|
4520
|
-
}, items.map((item) => /* @__PURE__ */
|
|
4701
|
+
}, items.map((item) => /* @__PURE__ */ React54__default.default.createElement(DraggableListItem, {
|
|
4521
4702
|
key: item.id,
|
|
4522
4703
|
item,
|
|
4523
4704
|
onRemove,
|
|
4524
4705
|
removeIconVariant,
|
|
4525
4706
|
renderContent
|
|
4526
|
-
})))), items.length === 0 && emptyMessage && /* @__PURE__ */
|
|
4707
|
+
})))), items.length === 0 && emptyMessage && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4527
4708
|
className: DraggableList_default.emptyState
|
|
4528
4709
|
}, emptyMessage));
|
|
4529
4710
|
}
|
|
4530
4711
|
var useKeyboardEvents = (containerRef) => {
|
|
4531
|
-
|
|
4712
|
+
React54.useEffect(() => {
|
|
4532
4713
|
const el = containerRef.current;
|
|
4533
4714
|
if (el == null) {
|
|
4534
4715
|
return;
|
|
@@ -4565,11 +4746,11 @@ function SearchBar({
|
|
|
4565
4746
|
className,
|
|
4566
4747
|
onKeyDown
|
|
4567
4748
|
}) {
|
|
4568
|
-
return /* @__PURE__ */
|
|
4749
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4569
4750
|
className: classnames14__default.default(SearchBar_default.searchBar, className)
|
|
4570
|
-
}, /* @__PURE__ */
|
|
4751
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Search, {
|
|
4571
4752
|
className: SearchBar_default.searchIcon
|
|
4572
|
-
}), /* @__PURE__ */
|
|
4753
|
+
}), /* @__PURE__ */ React54__default.default.createElement(input.Input, {
|
|
4573
4754
|
type: "text",
|
|
4574
4755
|
placeholder,
|
|
4575
4756
|
"aria-label": ariaLabel ?? placeholder,
|
|
@@ -4593,9 +4774,9 @@ function ColumnConfigDialog({
|
|
|
4593
4774
|
onApply,
|
|
4594
4775
|
isValidConfig
|
|
4595
4776
|
}) {
|
|
4596
|
-
const [visibleColumns, setVisibleColumns] =
|
|
4597
|
-
const [searchQuery, setSearchQuery] =
|
|
4598
|
-
const allColumns =
|
|
4777
|
+
const [visibleColumns, setVisibleColumns] = React54.useState([]);
|
|
4778
|
+
const [searchQuery, setSearchQuery] = React54.useState("");
|
|
4779
|
+
const allColumns = React54.useMemo(() => {
|
|
4599
4780
|
return columnOptions.map((opt) => {
|
|
4600
4781
|
const isVisible = currentVisibility ? currentVisibility[opt.id] : false;
|
|
4601
4782
|
return {
|
|
@@ -4605,7 +4786,7 @@ function ColumnConfigDialog({
|
|
|
4605
4786
|
};
|
|
4606
4787
|
});
|
|
4607
4788
|
}, [columnOptions, currentVisibility]);
|
|
4608
|
-
|
|
4789
|
+
React54.useEffect(() => {
|
|
4609
4790
|
if (isOpen) {
|
|
4610
4791
|
const visibleCols = allColumns.filter((col) => col.isVisible);
|
|
4611
4792
|
if (!!currentColumnOrder?.length) {
|
|
@@ -4621,19 +4802,19 @@ function ColumnConfigDialog({
|
|
|
4621
4802
|
setSearchQuery("");
|
|
4622
4803
|
}
|
|
4623
4804
|
}, [isOpen, allColumns, currentColumnOrder]);
|
|
4624
|
-
const handleApply =
|
|
4805
|
+
const handleApply = React54.useCallback(() => {
|
|
4625
4806
|
onApply(getColumnConfig(allColumns, visibleColumns));
|
|
4626
4807
|
onClose();
|
|
4627
4808
|
}, [allColumns, visibleColumns, onApply, onClose]);
|
|
4628
4809
|
const isValid = isValidConfig ? isValidConfig(getColumnConfig(allColumns, visibleColumns)) : true;
|
|
4629
4810
|
const isApplyDisabled = visibleColumns.length === 0 || !isValid;
|
|
4630
|
-
const handleReorderColumns =
|
|
4811
|
+
const handleReorderColumns = React54.useCallback((fromIndex, toIndex) => {
|
|
4631
4812
|
setVisibleColumns((items) => sortable.arrayMove(items, fromIndex, toIndex));
|
|
4632
4813
|
}, []);
|
|
4633
|
-
const handleRemoveColumn =
|
|
4814
|
+
const handleRemoveColumn = React54.useCallback((columnId) => {
|
|
4634
4815
|
setVisibleColumns((prev) => prev.filter((col) => col.id !== columnId));
|
|
4635
4816
|
}, []);
|
|
4636
|
-
const handleToggleColumn =
|
|
4817
|
+
const handleToggleColumn = React54.useCallback((column) => {
|
|
4637
4818
|
setVisibleColumns((prev) => {
|
|
4638
4819
|
const isCurrentlyVisible = prev.some((col) => col.id === column.id);
|
|
4639
4820
|
if (isCurrentlyVisible) {
|
|
@@ -4643,10 +4824,10 @@ function ColumnConfigDialog({
|
|
|
4643
4824
|
}
|
|
4644
4825
|
});
|
|
4645
4826
|
}, []);
|
|
4646
|
-
const handleSearchChange =
|
|
4827
|
+
const handleSearchChange = React54.useCallback((event) => {
|
|
4647
4828
|
setSearchQuery(event.target.value);
|
|
4648
4829
|
}, []);
|
|
4649
|
-
const handleSelectAll =
|
|
4830
|
+
const handleSelectAll = React54.useCallback((columns) => {
|
|
4650
4831
|
setVisibleColumns((prev) => {
|
|
4651
4832
|
const allSelected = columns.every((col) => prev.some((v) => v.id === col.id));
|
|
4652
4833
|
if (allSelected) {
|
|
@@ -4657,33 +4838,33 @@ function ColumnConfigDialog({
|
|
|
4657
4838
|
}
|
|
4658
4839
|
});
|
|
4659
4840
|
}, []);
|
|
4660
|
-
const filteredAvailableColumns =
|
|
4841
|
+
const filteredAvailableColumns = React54.useMemo(() => {
|
|
4661
4842
|
const query = searchQuery.toLowerCase().trim();
|
|
4662
4843
|
if (!query) {
|
|
4663
4844
|
return allColumns;
|
|
4664
4845
|
}
|
|
4665
4846
|
return allColumns.filter((col) => (col.label?.toLowerCase().includes(query) ?? false) || col.id.toLowerCase().includes(query));
|
|
4666
4847
|
}, [allColumns, searchQuery]);
|
|
4667
|
-
const footer =
|
|
4848
|
+
const footer = React54.useMemo(() => /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
4668
4849
|
onClick: onClose
|
|
4669
|
-
}, "Cancel"), /* @__PURE__ */
|
|
4850
|
+
}, "Cancel"), /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
4670
4851
|
variant: "primary",
|
|
4671
4852
|
onClick: handleApply,
|
|
4672
4853
|
disabled: isApplyDisabled
|
|
4673
4854
|
}, "Apply")), [onClose, handleApply, isApplyDisabled]);
|
|
4674
|
-
return /* @__PURE__ */
|
|
4855
|
+
return /* @__PURE__ */ React54__default.default.createElement(Dialog, {
|
|
4675
4856
|
isOpen,
|
|
4676
4857
|
onOpenChange: onClose,
|
|
4677
4858
|
title: DialogTitle,
|
|
4678
4859
|
footer,
|
|
4679
4860
|
className: ColumnConfigDialog_default.columnConfigDialog
|
|
4680
|
-
}, /* @__PURE__ */
|
|
4861
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4681
4862
|
className: ColumnConfigDialog_default.dialogLayout
|
|
4682
|
-
}, /* @__PURE__ */
|
|
4863
|
+
}, /* @__PURE__ */ React54__default.default.createElement(VisibleColumnsList, {
|
|
4683
4864
|
columns: visibleColumns,
|
|
4684
4865
|
onReorder: handleReorderColumns,
|
|
4685
4866
|
onRemove: handleRemoveColumn
|
|
4686
|
-
}), /* @__PURE__ */
|
|
4867
|
+
}), /* @__PURE__ */ React54__default.default.createElement(AvailableColumnsList, {
|
|
4687
4868
|
visibleColumns,
|
|
4688
4869
|
searchQuery,
|
|
4689
4870
|
onSearchChange: handleSearchChange,
|
|
@@ -4692,9 +4873,9 @@ function ColumnConfigDialog({
|
|
|
4692
4873
|
filteredColumns: filteredAvailableColumns
|
|
4693
4874
|
})));
|
|
4694
4875
|
}
|
|
4695
|
-
var DialogTitle = /* @__PURE__ */
|
|
4876
|
+
var DialogTitle = /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4696
4877
|
className: ColumnConfigDialog_default.title
|
|
4697
|
-
}, /* @__PURE__ */
|
|
4878
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Cog, null), "Configure Table Columns");
|
|
4698
4879
|
var getColumnConfig = (allColumns, visibleColumns) => {
|
|
4699
4880
|
const hiddenColumns = allColumns.filter((col) => !visibleColumns.some((v) => v.id === col.id));
|
|
4700
4881
|
return [...visibleColumns.map((col) => ({
|
|
@@ -4710,17 +4891,17 @@ function VisibleColumnsList({
|
|
|
4710
4891
|
onReorder,
|
|
4711
4892
|
onRemove
|
|
4712
4893
|
}) {
|
|
4713
|
-
return /* @__PURE__ */
|
|
4894
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4714
4895
|
className: ColumnConfigDialog_default.visibleColumnsContainer
|
|
4715
|
-
}, /* @__PURE__ */
|
|
4896
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4716
4897
|
className: ColumnConfigDialog_default.sectionHeader
|
|
4717
|
-
}, /* @__PURE__ */
|
|
4898
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4718
4899
|
className: ColumnConfigDialog_default.sectionTitle
|
|
4719
|
-
}, /* @__PURE__ */
|
|
4900
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", null, "Visible Columns"), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
4720
4901
|
className: ColumnConfigDialog_default.countTag
|
|
4721
|
-
}, columns.length)), /* @__PURE__ */
|
|
4902
|
+
}, columns.length)), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4722
4903
|
className: ColumnConfigDialog_default.sectionHint
|
|
4723
|
-
}, "Drag to reorder")), /* @__PURE__ */
|
|
4904
|
+
}, "Drag to reorder")), /* @__PURE__ */ React54__default.default.createElement(DraggableList, {
|
|
4724
4905
|
items: columns,
|
|
4725
4906
|
onReorder,
|
|
4726
4907
|
onRemove,
|
|
@@ -4741,42 +4922,42 @@ function AvailableColumnsList({
|
|
|
4741
4922
|
const totalCount = filteredColumns.length;
|
|
4742
4923
|
const allFilteredSelected = filteredColumns.every((col) => visibleColumns.some((v) => v.id === col.id));
|
|
4743
4924
|
const someFilteredSelected = filteredColumns.some((col) => visibleColumns.some((v) => v.id === col.id));
|
|
4744
|
-
const handleSelectAllClick =
|
|
4925
|
+
const handleSelectAllClick = React54.useCallback(() => {
|
|
4745
4926
|
onSelectAll(filteredColumns);
|
|
4746
4927
|
}, [filteredColumns, onSelectAll]);
|
|
4747
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4748
4929
|
className: ColumnConfigDialog_default.availableColumnsContainer
|
|
4749
|
-
}, /* @__PURE__ */
|
|
4930
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4750
4931
|
className: classnames14__default.default(ColumnConfigDialog_default.sectionHeader, ColumnConfigDialog_default.sectionTitle)
|
|
4751
|
-
}, "Add or Remove Columns"), /* @__PURE__ */
|
|
4932
|
+
}, "Add or Remove Columns"), /* @__PURE__ */ React54__default.default.createElement(SearchBar, {
|
|
4752
4933
|
value: searchQuery,
|
|
4753
4934
|
onChange: onSearchChange,
|
|
4754
4935
|
placeholder: "Search...",
|
|
4755
4936
|
"aria-label": "Search available columns",
|
|
4756
4937
|
className: ColumnConfigDialog_default.searchContainer
|
|
4757
|
-
}), /* @__PURE__ */
|
|
4938
|
+
}), /* @__PURE__ */ React54__default.default.createElement(collapsible.Collapsible.Root, {
|
|
4758
4939
|
defaultOpen: true,
|
|
4759
4940
|
className: ColumnConfigDialog_default.propertiesList
|
|
4760
|
-
}, /* @__PURE__ */
|
|
4941
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4761
4942
|
className: ColumnConfigDialog_default.categoryHeader
|
|
4762
|
-
}, /* @__PURE__ */
|
|
4943
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
4763
4944
|
checked: allFilteredSelected,
|
|
4764
4945
|
indeterminate: someFilteredSelected && !allFilteredSelected,
|
|
4765
4946
|
onCheckedChange: handleSelectAllClick,
|
|
4766
4947
|
className: ColumnConfigDialog_default.checkbox
|
|
4767
|
-
}), /* @__PURE__ */
|
|
4948
|
+
}), /* @__PURE__ */ React54__default.default.createElement(collapsible.Collapsible.Trigger, {
|
|
4768
4949
|
className: ColumnConfigDialog_default.categoryTrigger
|
|
4769
|
-
}, /* @__PURE__ */
|
|
4950
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
4770
4951
|
className: ColumnConfigDialog_default.categoryTitle
|
|
4771
|
-
}, "All Columns"), /* @__PURE__ */
|
|
4952
|
+
}, "All Columns"), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
4772
4953
|
className: ColumnConfigDialog_default.categoryCount
|
|
4773
|
-
}, selectedCount, "/", totalCount), /* @__PURE__ */
|
|
4954
|
+
}, selectedCount, "/", totalCount), /* @__PURE__ */ React54__default.default.createElement(icons.CaretDown, {
|
|
4774
4955
|
className: ColumnConfigDialog_default.caretIcon
|
|
4775
|
-
}))), /* @__PURE__ */
|
|
4956
|
+
}))), /* @__PURE__ */ React54__default.default.createElement(collapsible.Collapsible.Panel, {
|
|
4776
4957
|
className: ColumnConfigDialog_default.propertyList
|
|
4777
|
-
}, filteredColumns.length === 0 ? /* @__PURE__ */
|
|
4958
|
+
}, filteredColumns.length === 0 ? /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4778
4959
|
className: ColumnConfigDialog_default.emptyState
|
|
4779
|
-
}, "No matching columns found") : filteredColumns.map((column) => /* @__PURE__ */
|
|
4960
|
+
}, "No matching columns found") : filteredColumns.map((column) => /* @__PURE__ */ React54__default.default.createElement(PropertyItem, {
|
|
4780
4961
|
key: column.id,
|
|
4781
4962
|
column,
|
|
4782
4963
|
isSelected: visibleColumns.some((v) => v.id === column.id),
|
|
@@ -4789,19 +4970,19 @@ function PropertyItem({
|
|
|
4789
4970
|
onToggle,
|
|
4790
4971
|
showInfoIcon = false
|
|
4791
4972
|
}) {
|
|
4792
|
-
const handleClick =
|
|
4973
|
+
const handleClick = React54.useCallback(() => {
|
|
4793
4974
|
onToggle(column);
|
|
4794
4975
|
}, [onToggle, column]);
|
|
4795
|
-
return /* @__PURE__ */
|
|
4976
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4796
4977
|
className: ColumnConfigDialog_default.propertyItem
|
|
4797
|
-
}, /* @__PURE__ */
|
|
4978
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Checkbox, {
|
|
4798
4979
|
checked: isSelected,
|
|
4799
4980
|
onCheckedChange: handleClick,
|
|
4800
4981
|
className: ColumnConfigDialog_default.checkbox
|
|
4801
|
-
}), /* @__PURE__ */
|
|
4982
|
+
}), /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
4802
4983
|
onClick: handleClick,
|
|
4803
4984
|
className: ColumnConfigDialog_default.propertyName
|
|
4804
|
-
}, column.label), showInfoIcon && /* @__PURE__ */
|
|
4985
|
+
}, column.label), showInfoIcon && /* @__PURE__ */ React54__default.default.createElement(icons.SmallInfoSign, {
|
|
4805
4986
|
className: ColumnConfigDialog_default.infoIcon
|
|
4806
4987
|
}));
|
|
4807
4988
|
}
|
|
@@ -4814,8 +4995,8 @@ function SortableItemsList({
|
|
|
4814
4995
|
onRemove,
|
|
4815
4996
|
className
|
|
4816
4997
|
}) {
|
|
4817
|
-
const renderContent =
|
|
4818
|
-
return /* @__PURE__ */
|
|
4998
|
+
const renderContent = React54.useCallback((item) => item.content, []);
|
|
4999
|
+
return /* @__PURE__ */ React54__default.default.createElement(DraggableList, {
|
|
4819
5000
|
items,
|
|
4820
5001
|
onReorder,
|
|
4821
5002
|
onRemove,
|
|
@@ -4833,9 +5014,9 @@ function MultiColumnSortDialog({
|
|
|
4833
5014
|
currentSorting,
|
|
4834
5015
|
columnOptions
|
|
4835
5016
|
}) {
|
|
4836
|
-
const [selectedSortColumns, setSelectedSortColumns] =
|
|
4837
|
-
const [menuSearchQuery, setMenuSearchQuery] =
|
|
4838
|
-
|
|
5017
|
+
const [selectedSortColumns, setSelectedSortColumns] = React54.useState([]);
|
|
5018
|
+
const [menuSearchQuery, setMenuSearchQuery] = React54.useState("");
|
|
5019
|
+
React54.useEffect(() => {
|
|
4839
5020
|
if (isOpen) {
|
|
4840
5021
|
const selectedColumns = [];
|
|
4841
5022
|
for (const sort of currentSorting) {
|
|
@@ -4850,25 +5031,25 @@ function MultiColumnSortDialog({
|
|
|
4850
5031
|
setSelectedSortColumns(selectedColumns);
|
|
4851
5032
|
}
|
|
4852
5033
|
}, [isOpen, currentSorting, columnOptions]);
|
|
4853
|
-
const handleAddColumn =
|
|
5034
|
+
const handleAddColumn = React54.useCallback((column) => {
|
|
4854
5035
|
setSelectedSortColumns((prev) => [...prev, {
|
|
4855
5036
|
...column,
|
|
4856
5037
|
direction: "asc"
|
|
4857
5038
|
}]);
|
|
4858
5039
|
}, []);
|
|
4859
|
-
const handleRemoveSortColumn =
|
|
5040
|
+
const handleRemoveSortColumn = React54.useCallback((id) => {
|
|
4860
5041
|
setSelectedSortColumns((prev) => prev.filter((item) => item.id !== id));
|
|
4861
5042
|
}, []);
|
|
4862
|
-
const handleReorderSortColumns =
|
|
5043
|
+
const handleReorderSortColumns = React54.useCallback((fromIndex, toIndex) => {
|
|
4863
5044
|
setSelectedSortColumns((items) => sortable.arrayMove(items, fromIndex, toIndex));
|
|
4864
5045
|
}, []);
|
|
4865
|
-
const handleToggleSortDirection =
|
|
5046
|
+
const handleToggleSortDirection = React54.useCallback((id) => {
|
|
4866
5047
|
setSelectedSortColumns((prev) => prev.map((item) => item.id === id ? {
|
|
4867
5048
|
...item,
|
|
4868
5049
|
direction: item.direction === "asc" ? "desc" : "asc"
|
|
4869
5050
|
} : item));
|
|
4870
5051
|
}, []);
|
|
4871
|
-
const handleApply =
|
|
5052
|
+
const handleApply = React54.useCallback(() => {
|
|
4872
5053
|
const sortingState = selectedSortColumns.map((col) => ({
|
|
4873
5054
|
id: col.id,
|
|
4874
5055
|
desc: col.direction === "desc"
|
|
@@ -4876,100 +5057,103 @@ function MultiColumnSortDialog({
|
|
|
4876
5057
|
onApply(sortingState);
|
|
4877
5058
|
onClose();
|
|
4878
5059
|
}, [selectedSortColumns, onApply, onClose]);
|
|
4879
|
-
const availableColumns =
|
|
4880
|
-
const filteredAvailableColumns =
|
|
5060
|
+
const availableColumns = React54.useMemo(() => columnOptions.filter((col) => col.canSort && !selectedSortColumns.some((selected) => selected.id === col.id)), [columnOptions, selectedSortColumns]);
|
|
5061
|
+
const filteredAvailableColumns = React54.useMemo(() => {
|
|
4881
5062
|
const query = menuSearchQuery.toLowerCase().trim();
|
|
4882
5063
|
if (!query) {
|
|
4883
5064
|
return availableColumns;
|
|
4884
5065
|
}
|
|
4885
5066
|
return availableColumns.filter((col) => col.name.toLowerCase().includes(query));
|
|
4886
5067
|
}, [availableColumns, menuSearchQuery]);
|
|
4887
|
-
const handleMenuSearchChange =
|
|
5068
|
+
const handleMenuSearchChange = React54.useCallback((event) => {
|
|
4888
5069
|
setMenuSearchQuery(event.target.value);
|
|
4889
5070
|
}, []);
|
|
4890
|
-
const handleMenuOpenChange =
|
|
5071
|
+
const handleMenuOpenChange = React54.useCallback((open) => {
|
|
4891
5072
|
if (open) {
|
|
4892
5073
|
setMenuSearchQuery("");
|
|
4893
5074
|
}
|
|
4894
5075
|
}, []);
|
|
4895
|
-
const sortableItems =
|
|
5076
|
+
const sortableItems = React54.useMemo(() => {
|
|
4896
5077
|
return selectedSortColumns.map((item) => ({
|
|
4897
5078
|
id: item.id,
|
|
4898
5079
|
label: item.name,
|
|
4899
|
-
content: /* @__PURE__ */
|
|
5080
|
+
content: /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4900
5081
|
className: MultiColumnSortDialog_default.sortColumnItem
|
|
4901
|
-
}, /* @__PURE__ */
|
|
5082
|
+
}, /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
4902
5083
|
className: classnames14__default.default(MultiColumnSortDialog_default.sortColumnName, MultiColumnSortDialog_default.truncate)
|
|
4903
|
-
}, item.name), /* @__PURE__ */
|
|
5084
|
+
}, item.name), /* @__PURE__ */ React54__default.default.createElement(button.Button, {
|
|
4904
5085
|
className: MultiColumnSortDialog_default.sortDirectionButton,
|
|
4905
5086
|
onClick: () => handleToggleSortDirection(item.id),
|
|
4906
5087
|
"aria-label": `Toggle sort direction for ${item.name}`
|
|
4907
|
-
}, item.direction === "asc" ? /* @__PURE__ */
|
|
5088
|
+
}, item.direction === "asc" ? /* @__PURE__ */ React54__default.default.createElement(icons.SortAlphabetical, {
|
|
4908
5089
|
className: MultiColumnSortDialog_default.sortIcon
|
|
4909
|
-
}) : /* @__PURE__ */
|
|
5090
|
+
}) : /* @__PURE__ */ React54__default.default.createElement(icons.SortAlphabeticalDesc, {
|
|
4910
5091
|
className: MultiColumnSortDialog_default.sortIcon
|
|
4911
5092
|
})))
|
|
4912
5093
|
}));
|
|
4913
5094
|
}, [selectedSortColumns, handleToggleSortDirection]);
|
|
4914
|
-
const footer =
|
|
5095
|
+
const footer = React54.useMemo(() => /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
4915
5096
|
onClick: onClose
|
|
4916
|
-
}, "Cancel"), /* @__PURE__ */
|
|
5097
|
+
}, "Cancel"), /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
4917
5098
|
variant: "primary",
|
|
4918
5099
|
onClick: handleApply
|
|
4919
5100
|
}, "Apply")), [handleApply, onClose]);
|
|
4920
|
-
|
|
5101
|
+
const handleKeyDown = React54.useCallback((event) => {
|
|
5102
|
+
event.stopPropagation();
|
|
5103
|
+
}, []);
|
|
5104
|
+
return /* @__PURE__ */ React54__default.default.createElement(Dialog, {
|
|
4921
5105
|
isOpen,
|
|
4922
5106
|
onOpenChange: onClose,
|
|
4923
5107
|
title: DialogTitle2,
|
|
4924
5108
|
footer
|
|
4925
|
-
}, /* @__PURE__ */
|
|
5109
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4926
5110
|
className: MultiColumnSortDialog_default.sortColumnsList
|
|
4927
|
-
}, /* @__PURE__ */
|
|
5111
|
+
}, /* @__PURE__ */ React54__default.default.createElement(SortableItemsList, {
|
|
4928
5112
|
items: sortableItems,
|
|
4929
5113
|
onReorder: handleReorderSortColumns,
|
|
4930
5114
|
onRemove: handleRemoveSortColumn,
|
|
4931
5115
|
className: MultiColumnSortDialog_default.sortableList
|
|
4932
|
-
}), /* @__PURE__ */
|
|
5116
|
+
}), /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Root, {
|
|
4933
5117
|
onOpenChange: handleMenuOpenChange
|
|
4934
|
-
}, /* @__PURE__ */
|
|
5118
|
+
}, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Trigger, {
|
|
4935
5119
|
className: MultiColumnSortDialog_default.addColumnButton,
|
|
4936
5120
|
disabled: availableColumns.length === 0,
|
|
4937
5121
|
"aria-label": "Add column to sort"
|
|
4938
|
-
}, /* @__PURE__ */
|
|
5122
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Add, {
|
|
4939
5123
|
className: MultiColumnSortDialog_default.addIcon
|
|
4940
|
-
}), /* @__PURE__ */
|
|
5124
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
4941
5125
|
className: MultiColumnSortDialog_default.addColumnText
|
|
4942
|
-
}, "Add Column to Sort"), /* @__PURE__ */
|
|
5126
|
+
}, "Add Column to Sort"), /* @__PURE__ */ React54__default.default.createElement(icons.CaretDown, {
|
|
4943
5127
|
color: "currentColor"
|
|
4944
|
-
})), /* @__PURE__ */
|
|
5128
|
+
})), /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Portal, null, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Positioner, {
|
|
4945
5129
|
className: MultiColumnSortDialog_default.menuPositioner,
|
|
4946
5130
|
sideOffset: 4
|
|
4947
|
-
}, /* @__PURE__ */
|
|
5131
|
+
}, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Popup, {
|
|
4948
5132
|
className: MultiColumnSortDialog_default.dropdownMenu
|
|
4949
|
-
}, /* @__PURE__ */
|
|
5133
|
+
}, /* @__PURE__ */ React54__default.default.createElement(SearchBar, {
|
|
4950
5134
|
value: menuSearchQuery,
|
|
4951
5135
|
onChange: handleMenuSearchChange,
|
|
4952
5136
|
placeholder: "Search columns",
|
|
4953
5137
|
"aria-label": "Search columns to sort",
|
|
4954
5138
|
className: MultiColumnSortDialog_default.menuSearchContainer,
|
|
4955
|
-
onKeyDown:
|
|
4956
|
-
}), filteredAvailableColumns.map((column) => /* @__PURE__ */
|
|
5139
|
+
onKeyDown: handleKeyDown
|
|
5140
|
+
}), filteredAvailableColumns.map((column) => /* @__PURE__ */ React54__default.default.createElement(AvailableColumnMenuItem, {
|
|
4957
5141
|
key: column.id,
|
|
4958
5142
|
column,
|
|
4959
5143
|
onAddColumn: handleAddColumn
|
|
4960
|
-
})), filteredAvailableColumns.length === 0 && /* @__PURE__ */
|
|
5144
|
+
})), filteredAvailableColumns.length === 0 && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4961
5145
|
className: MultiColumnSortDialog_default.menuEmptyState
|
|
4962
5146
|
}, "No matching columns")))))));
|
|
4963
5147
|
}
|
|
4964
|
-
var DialogTitle2 = /* @__PURE__ */
|
|
5148
|
+
var DialogTitle2 = /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4965
5149
|
className: MultiColumnSortDialog_default.title
|
|
4966
|
-
}, /* @__PURE__ */
|
|
5150
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Cog, null), "Sort on Multiple Columns");
|
|
4967
5151
|
function AvailableColumnMenuItem({
|
|
4968
5152
|
column,
|
|
4969
5153
|
onAddColumn
|
|
4970
5154
|
}) {
|
|
4971
|
-
const onClick =
|
|
4972
|
-
return /* @__PURE__ */
|
|
5155
|
+
const onClick = React54.useCallback(() => onAddColumn(column), [onAddColumn, column]);
|
|
5156
|
+
return /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Item, {
|
|
4973
5157
|
className: classnames14__default.default(MultiColumnSortDialog_default.dropdownItem, MultiColumnSortDialog_default.truncate),
|
|
4974
5158
|
onClick
|
|
4975
5159
|
}, column.name);
|
|
@@ -4985,7 +5169,7 @@ var TableHeaderContent_default = {};
|
|
|
4985
5169
|
function TableHeaderContent({
|
|
4986
5170
|
header
|
|
4987
5171
|
}) {
|
|
4988
|
-
return /* @__PURE__ */
|
|
5172
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
4989
5173
|
className: TableHeaderContent_default.osdkHeaderContent
|
|
4990
5174
|
}, reactTable.flexRender(header.column.columnDef.header, header.getContext()));
|
|
4991
5175
|
}
|
|
@@ -5000,14 +5184,14 @@ function HeaderMenuItem({
|
|
|
5000
5184
|
label,
|
|
5001
5185
|
active = false
|
|
5002
5186
|
}) {
|
|
5003
|
-
return /* @__PURE__ */
|
|
5187
|
+
return /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Item, {
|
|
5004
5188
|
closeOnClick: true,
|
|
5005
5189
|
className: classnames14__default.default(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderMenuItem, active && TableHeaderWithPopover_default.osdkHeaderActiveMenuItem),
|
|
5006
5190
|
onClick
|
|
5007
|
-
}, /* @__PURE__ */
|
|
5191
|
+
}, /* @__PURE__ */ React54__default.default.createElement(Icon, {
|
|
5008
5192
|
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
5009
5193
|
color: "currentColor"
|
|
5010
|
-
}), /* @__PURE__ */
|
|
5194
|
+
}), /* @__PURE__ */ React54__default.default.createElement("span", null, label));
|
|
5011
5195
|
}
|
|
5012
5196
|
function TableHeaderWithPopover({
|
|
5013
5197
|
header,
|
|
@@ -5030,8 +5214,8 @@ function TableHeaderWithPopover({
|
|
|
5030
5214
|
setSorting
|
|
5031
5215
|
} = table;
|
|
5032
5216
|
const currentSorting = table.getState().sorting;
|
|
5033
|
-
const [isOpen, setIsOpen] =
|
|
5034
|
-
const handlePinLeft =
|
|
5217
|
+
const [isOpen, setIsOpen] = React54.useState(false);
|
|
5218
|
+
const handlePinLeft = React54.useCallback(() => {
|
|
5035
5219
|
setColumnPinning((prev) => {
|
|
5036
5220
|
return {
|
|
5037
5221
|
left: [...prev.left || [], header.column.id],
|
|
@@ -5039,7 +5223,7 @@ function TableHeaderWithPopover({
|
|
|
5039
5223
|
};
|
|
5040
5224
|
});
|
|
5041
5225
|
}, [header.column.id, setColumnPinning]);
|
|
5042
|
-
const handleUnpin =
|
|
5226
|
+
const handleUnpin = React54.useCallback(() => {
|
|
5043
5227
|
setColumnPinning((prev) => {
|
|
5044
5228
|
return {
|
|
5045
5229
|
left: prev.left?.filter((id) => id !== header.column.id) || [],
|
|
@@ -5047,39 +5231,39 @@ function TableHeaderWithPopover({
|
|
|
5047
5231
|
};
|
|
5048
5232
|
});
|
|
5049
5233
|
}, [header.column.id, setColumnPinning]);
|
|
5050
|
-
const handleSortAscending =
|
|
5234
|
+
const handleSortAscending = React54.useCallback(() => {
|
|
5051
5235
|
header.column.toggleSorting(false);
|
|
5052
5236
|
setSorting?.([{
|
|
5053
5237
|
id: header.column.id,
|
|
5054
5238
|
desc: false
|
|
5055
5239
|
}]);
|
|
5056
5240
|
}, [header.column, setSorting]);
|
|
5057
|
-
const handleSortDescending =
|
|
5241
|
+
const handleSortDescending = React54.useCallback(() => {
|
|
5058
5242
|
header.column.toggleSorting(true);
|
|
5059
5243
|
setSorting?.([{
|
|
5060
5244
|
id: header.column.id,
|
|
5061
5245
|
desc: true
|
|
5062
5246
|
}]);
|
|
5063
5247
|
}, [header.column, setSorting]);
|
|
5064
|
-
const handleClearAllSorts =
|
|
5248
|
+
const handleClearAllSorts = React54.useCallback(() => {
|
|
5065
5249
|
header.column.clearSorting();
|
|
5066
5250
|
setSorting?.([]);
|
|
5067
5251
|
}, [header.column, setSorting]);
|
|
5068
|
-
const handleResetSize =
|
|
5252
|
+
const handleResetSize = React54.useCallback(() => {
|
|
5069
5253
|
header.column.resetSize();
|
|
5070
5254
|
if (onResetSize) {
|
|
5071
5255
|
onResetSize();
|
|
5072
5256
|
}
|
|
5073
5257
|
}, [header.column, onResetSize]);
|
|
5074
|
-
const handleInteraction =
|
|
5258
|
+
const handleInteraction = React54.useCallback((e) => {
|
|
5075
5259
|
e.preventDefault();
|
|
5076
5260
|
setIsOpen((prev) => !prev);
|
|
5077
5261
|
}, []);
|
|
5078
|
-
const handleOpenColumnConfig =
|
|
5262
|
+
const handleOpenColumnConfig = React54.useCallback(() => {
|
|
5079
5263
|
onOpenColumnConfig?.();
|
|
5080
5264
|
setIsOpen(false);
|
|
5081
5265
|
}, [onOpenColumnConfig]);
|
|
5082
|
-
const handleOpenMultiSort =
|
|
5266
|
+
const handleOpenMultiSort = React54.useCallback(() => {
|
|
5083
5267
|
onOpenMultiSort?.();
|
|
5084
5268
|
setIsOpen(false);
|
|
5085
5269
|
}, [onOpenMultiSort]);
|
|
@@ -5087,72 +5271,72 @@ function TableHeaderWithPopover({
|
|
|
5087
5271
|
const isSortable = header.column.getCanSort();
|
|
5088
5272
|
const sortIndex = currentSorting?.findIndex((s) => s.id === header.column.id) ?? -1;
|
|
5089
5273
|
const hasAnyMenuItems = showPinningItems || showSortingItems && isSortable || showResizeItem || showConfigItem;
|
|
5090
|
-
return /* @__PURE__ */
|
|
5274
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Root, {
|
|
5091
5275
|
open: isOpen,
|
|
5092
5276
|
onOpenChange: setIsOpen
|
|
5093
|
-
}, /* @__PURE__ */
|
|
5277
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5094
5278
|
className: classnames14__default.default(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContainer),
|
|
5095
5279
|
onContextMenu: handleInteraction
|
|
5096
|
-
}, /* @__PURE__ */
|
|
5280
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5097
5281
|
className: classnames14__default.default(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContentLeft)
|
|
5098
|
-
}, isColumnPinned && /* @__PURE__ */
|
|
5282
|
+
}, isColumnPinned && /* @__PURE__ */ React54__default.default.createElement(icons.Pin, {
|
|
5099
5283
|
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
5100
5284
|
color: "currentColor"
|
|
5101
|
-
}), /* @__PURE__ */
|
|
5285
|
+
}), /* @__PURE__ */ React54__default.default.createElement(TableHeaderContent, {
|
|
5102
5286
|
header
|
|
5103
|
-
})), /* @__PURE__ */
|
|
5287
|
+
})), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5104
5288
|
className: classnames14__default.default(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContentRight)
|
|
5105
|
-
}, isSorted && /* @__PURE__ */
|
|
5289
|
+
}, isSorted && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5106
5290
|
className: TableHeaderWithPopover_default.osdkCenterContainer
|
|
5107
|
-
}, isSorted === "asc" ? /* @__PURE__ */
|
|
5291
|
+
}, isSorted === "asc" ? /* @__PURE__ */ React54__default.default.createElement(icons.SortAlphabetical, {
|
|
5108
5292
|
className: TableHeaderWithPopover_default.osdkHeaderIcon
|
|
5109
|
-
}) : /* @__PURE__ */
|
|
5293
|
+
}) : /* @__PURE__ */ React54__default.default.createElement(icons.SortAlphabeticalDesc, {
|
|
5110
5294
|
className: TableHeaderWithPopover_default.osdkHeaderIcon
|
|
5111
|
-
}), currentSorting.length > 1 && sortIndex >= 0 && /* @__PURE__ */
|
|
5295
|
+
}), currentSorting.length > 1 && sortIndex >= 0 && /* @__PURE__ */ React54__default.default.createElement("span", {
|
|
5112
5296
|
className: TableHeaderWithPopover_default.sortIndex
|
|
5113
|
-
}, sortIndex + 1)), hasAnyMenuItems && /* @__PURE__ */
|
|
5297
|
+
}, sortIndex + 1)), hasAnyMenuItems && /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Trigger, {
|
|
5114
5298
|
"aria-label": `Open header menu for column with id=${header.column.id}`,
|
|
5115
5299
|
className: classnames14__default.default(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkHeaderPopoverTrigger)
|
|
5116
|
-
}, /* @__PURE__ */
|
|
5300
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.ChevronDown, {
|
|
5117
5301
|
className: TableHeaderWithPopover_default.osdkHeaderIcon
|
|
5118
|
-
}))), /* @__PURE__ */
|
|
5302
|
+
}))), /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Portal, {
|
|
5119
5303
|
container: document.body
|
|
5120
|
-
}, /* @__PURE__ */
|
|
5304
|
+
}, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Positioner, {
|
|
5121
5305
|
sideOffset: 4
|
|
5122
|
-
}, /* @__PURE__ */
|
|
5306
|
+
}, /* @__PURE__ */ React54__default.default.createElement(menu.Menu.Popup, {
|
|
5123
5307
|
className: TableHeaderWithPopover_default.osdkHeaderPopup
|
|
5124
|
-
}, showPinningItems && !isColumnPinned && /* @__PURE__ */
|
|
5308
|
+
}, showPinningItems && !isColumnPinned && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5125
5309
|
onClick: handlePinLeft,
|
|
5126
5310
|
icon: icons.Pin,
|
|
5127
5311
|
label: "Pin column"
|
|
5128
|
-
}), showPinningItems && isColumnPinned && /* @__PURE__ */
|
|
5312
|
+
}), showPinningItems && isColumnPinned && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5129
5313
|
onClick: handleUnpin,
|
|
5130
5314
|
icon: icons.Unpin,
|
|
5131
5315
|
label: "Unpin Column",
|
|
5132
5316
|
active: true
|
|
5133
|
-
}), showSortingItems && isSortable && /* @__PURE__ */
|
|
5317
|
+
}), showSortingItems && isSortable && /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5134
5318
|
onClick: handleSortAscending,
|
|
5135
5319
|
icon: icons.SortAlphabetical,
|
|
5136
5320
|
label: "Sort ascending",
|
|
5137
5321
|
active: isSorted === "asc"
|
|
5138
|
-
}), /* @__PURE__ */
|
|
5322
|
+
}), /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5139
5323
|
onClick: handleSortDescending,
|
|
5140
5324
|
icon: icons.SortAlphabeticalDesc,
|
|
5141
5325
|
label: "Sort descending",
|
|
5142
5326
|
active: isSorted === "desc"
|
|
5143
|
-
}), columnOptions?.some((col) => col.canSort) && /* @__PURE__ */
|
|
5327
|
+
}), columnOptions?.some((col) => col.canSort) && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5144
5328
|
onClick: handleOpenMultiSort,
|
|
5145
5329
|
icon: icons.Sort,
|
|
5146
5330
|
label: "Sort on multiple columns"
|
|
5147
|
-
})), showSortingItems && !!currentSorting?.length && /* @__PURE__ */
|
|
5331
|
+
})), showSortingItems && !!currentSorting?.length && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5148
5332
|
onClick: handleClearAllSorts,
|
|
5149
5333
|
icon: icons.Remove,
|
|
5150
5334
|
label: "Clear all sorts"
|
|
5151
|
-
}), showResizeItem && /* @__PURE__ */
|
|
5335
|
+
}), showResizeItem && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5152
5336
|
onClick: handleResetSize,
|
|
5153
5337
|
icon: icons.VerticalDistribution,
|
|
5154
5338
|
label: "Reset Column Size"
|
|
5155
|
-
}), showConfigItem && /* @__PURE__ */
|
|
5339
|
+
}), showConfigItem && /* @__PURE__ */ React54__default.default.createElement(HeaderMenuItem, {
|
|
5156
5340
|
onClick: handleOpenColumnConfig,
|
|
5157
5341
|
icon: icons.Settings,
|
|
5158
5342
|
label: "Configure Columns"
|
|
@@ -5206,25 +5390,25 @@ function TableHeader({
|
|
|
5206
5390
|
const currentVisibility = table.getState().columnVisibility;
|
|
5207
5391
|
const currentColumnOrder = table.getState().columnOrder;
|
|
5208
5392
|
const isResizing = !!table.getState().columnSizingInfo?.isResizingColumn;
|
|
5209
|
-
const [configDialogOpen, setConfigDialogOpen] =
|
|
5210
|
-
const [multiSortDialogOpen, setMultiSortDialogOpen] =
|
|
5211
|
-
const handleOpenColumnConfig =
|
|
5393
|
+
const [configDialogOpen, setConfigDialogOpen] = React54.useState(false);
|
|
5394
|
+
const [multiSortDialogOpen, setMultiSortDialogOpen] = React54.useState(false);
|
|
5395
|
+
const handleOpenColumnConfig = React54.useCallback(() => {
|
|
5212
5396
|
setConfigDialogOpen(true);
|
|
5213
5397
|
}, []);
|
|
5214
|
-
const handleCloseColumnConfig =
|
|
5398
|
+
const handleCloseColumnConfig = React54.useCallback(() => {
|
|
5215
5399
|
setConfigDialogOpen(false);
|
|
5216
5400
|
}, []);
|
|
5217
|
-
const handleOpenMultiSort =
|
|
5401
|
+
const handleOpenMultiSort = React54.useCallback(() => {
|
|
5218
5402
|
setMultiSortDialogOpen(true);
|
|
5219
5403
|
}, []);
|
|
5220
|
-
const handleCloseMultiSort =
|
|
5404
|
+
const handleCloseMultiSort = React54.useCallback(() => {
|
|
5221
5405
|
setMultiSortDialogOpen(false);
|
|
5222
5406
|
}, []);
|
|
5223
|
-
const handleApplyMultiSort =
|
|
5407
|
+
const handleApplyMultiSort = React54.useCallback((sortColumns) => {
|
|
5224
5408
|
setMultiSortDialogOpen(false);
|
|
5225
5409
|
setSorting?.(sortColumns);
|
|
5226
5410
|
}, [setSorting]);
|
|
5227
|
-
const handleApplyColumnConfig =
|
|
5411
|
+
const handleApplyColumnConfig = React54.useCallback((updates) => {
|
|
5228
5412
|
const newVisibilityState = {};
|
|
5229
5413
|
for (const update of updates) {
|
|
5230
5414
|
newVisibilityState[update.columnId] = update.isVisible;
|
|
@@ -5232,7 +5416,7 @@ function TableHeader({
|
|
|
5232
5416
|
setColumnOrder(updates.map((col) => col.columnId));
|
|
5233
5417
|
setColumnVisibility(newVisibilityState);
|
|
5234
5418
|
}, [setColumnOrder, setColumnVisibility]);
|
|
5235
|
-
const columnOptions =
|
|
5419
|
+
const columnOptions = React54.useMemo(() => {
|
|
5236
5420
|
const allHeaders = table.getHeaderGroups().flatMap((headerGroup) => headerGroup.headers);
|
|
5237
5421
|
return table.getAllColumns().filter((column) => column.id !== SELECTION_COLUMN_ID).map((column) => {
|
|
5238
5422
|
return {
|
|
@@ -5242,10 +5426,10 @@ function TableHeader({
|
|
|
5242
5426
|
};
|
|
5243
5427
|
});
|
|
5244
5428
|
}, [table]);
|
|
5245
|
-
return /* @__PURE__ */
|
|
5429
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement("thead", {
|
|
5246
5430
|
className: TableHeader_default.osdkTableHeader,
|
|
5247
5431
|
"data-resizing": isResizing
|
|
5248
|
-
}, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */
|
|
5432
|
+
}, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React54__default.default.createElement("tr", {
|
|
5249
5433
|
key: headerGroup.id,
|
|
5250
5434
|
className: TableHeader_default.osdkTableHeaderRow
|
|
5251
5435
|
}, headerGroup.headers.map((header) => {
|
|
@@ -5254,14 +5438,14 @@ function TableHeader({
|
|
|
5254
5438
|
} = getColumnPinningStyles(header.column);
|
|
5255
5439
|
const isColumnPinned = header.column.getIsPinned();
|
|
5256
5440
|
const isSelectColumn = header.id === SELECTION_COLUMN_ID;
|
|
5257
|
-
return /* @__PURE__ */
|
|
5441
|
+
return /* @__PURE__ */ React54__default.default.createElement("th", {
|
|
5258
5442
|
key: header.id,
|
|
5259
5443
|
"data-pinned": header.column.getIsPinned(),
|
|
5260
5444
|
className: TableHeader_default.osdkTableHeaderCell,
|
|
5261
5445
|
style: columnStyles
|
|
5262
|
-
}, header.isPlaceholder ? null : isSelectColumn ? /* @__PURE__ */
|
|
5446
|
+
}, header.isPlaceholder ? null : isSelectColumn ? /* @__PURE__ */ React54__default.default.createElement(TableHeaderContent, {
|
|
5263
5447
|
header
|
|
5264
|
-
}) : /* @__PURE__ */
|
|
5448
|
+
}) : /* @__PURE__ */ React54__default.default.createElement(TableHeaderWithPopover, {
|
|
5265
5449
|
table,
|
|
5266
5450
|
header,
|
|
5267
5451
|
isColumnPinned,
|
|
@@ -5269,20 +5453,20 @@ function TableHeader({
|
|
|
5269
5453
|
featureFlags: headerMenuFeatureFlags,
|
|
5270
5454
|
onOpenColumnConfig: handleOpenColumnConfig,
|
|
5271
5455
|
onOpenMultiSort: handleOpenMultiSort
|
|
5272
|
-
}), header.column.getCanResize() && headerMenuFeatureFlags?.showResizeItem !== false && /* @__PURE__ */
|
|
5456
|
+
}), header.column.getCanResize() && headerMenuFeatureFlags?.showResizeItem !== false && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5273
5457
|
className: TableHeader_default.osdkTableHeaderResizer,
|
|
5274
5458
|
onDoubleClick: () => header.column.resetSize(),
|
|
5275
5459
|
onMouseDown: header.getResizeHandler(),
|
|
5276
5460
|
onTouchStart: header.getResizeHandler()
|
|
5277
5461
|
}));
|
|
5278
|
-
})))), !!columnOptions?.length && /* @__PURE__ */
|
|
5462
|
+
})))), !!columnOptions?.length && /* @__PURE__ */ React54__default.default.createElement(ColumnConfigDialog, {
|
|
5279
5463
|
isOpen: configDialogOpen,
|
|
5280
5464
|
onClose: handleCloseColumnConfig,
|
|
5281
5465
|
columnOptions,
|
|
5282
5466
|
currentVisibility,
|
|
5283
5467
|
currentColumnOrder,
|
|
5284
5468
|
onApply: handleApplyColumnConfig
|
|
5285
|
-
}), columnOptions?.some((col) => col.canSort) && /* @__PURE__ */
|
|
5469
|
+
}), columnOptions?.some((col) => col.canSort) && /* @__PURE__ */ React54__default.default.createElement(MultiColumnSortDialog, {
|
|
5286
5470
|
isOpen: multiSortDialogOpen,
|
|
5287
5471
|
onClose: handleCloseMultiSort,
|
|
5288
5472
|
columnOptions,
|
|
@@ -5302,13 +5486,13 @@ function LoadingStateTable({
|
|
|
5302
5486
|
}) {
|
|
5303
5487
|
const enableRowSelection = table.options.enableRowSelection;
|
|
5304
5488
|
const minHeaderCount = enableRowSelection ? 1 : 0;
|
|
5305
|
-
const headers =
|
|
5489
|
+
const headers = React54.useMemo(() => headerGroups.length > 0 ? headerGroups[0].headers : [], [headerGroups]);
|
|
5306
5490
|
const hasHeadersLoaded = headers.length > minHeaderCount;
|
|
5307
|
-
const headerRef =
|
|
5308
|
-
const bodyRef =
|
|
5309
|
-
const [loadingRowCount, setLoadingRowCount] =
|
|
5310
|
-
const [loadingColumnCount, setLoadingColumnCount] =
|
|
5311
|
-
|
|
5491
|
+
const headerRef = React54.useRef(null);
|
|
5492
|
+
const bodyRef = React54.useRef(null);
|
|
5493
|
+
const [loadingRowCount, setLoadingRowCount] = React54.useState(MIN_ROWS);
|
|
5494
|
+
const [loadingColumnCount, setLoadingColumnCount] = React54.useState(headers.length);
|
|
5495
|
+
React54.useEffect(() => {
|
|
5312
5496
|
if (hasHeadersLoaded) {
|
|
5313
5497
|
setLoadingColumnCount(headers.length);
|
|
5314
5498
|
} else {
|
|
@@ -5321,7 +5505,7 @@ function LoadingStateTable({
|
|
|
5321
5505
|
}
|
|
5322
5506
|
}
|
|
5323
5507
|
}, [columnWidth, hasHeadersLoaded, headers, tableContainerRef]);
|
|
5324
|
-
|
|
5508
|
+
React54.useEffect(() => {
|
|
5325
5509
|
if (tableContainerRef.current) {
|
|
5326
5510
|
const containerHeight = tableContainerRef.current.clientHeight;
|
|
5327
5511
|
const availableHeight = containerHeight - rowHeight;
|
|
@@ -5331,32 +5515,32 @@ function LoadingStateTable({
|
|
|
5331
5515
|
}
|
|
5332
5516
|
}
|
|
5333
5517
|
}, [tableContainerRef, rowHeight]);
|
|
5334
|
-
return /* @__PURE__ */
|
|
5518
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, hasHeadersLoaded ? /* @__PURE__ */ React54__default.default.createElement(TableHeader, {
|
|
5335
5519
|
table
|
|
5336
|
-
}) : /* @__PURE__ */
|
|
5520
|
+
}) : /* @__PURE__ */ React54__default.default.createElement("thead", {
|
|
5337
5521
|
className: TableHeader_default.osdkTableHeader,
|
|
5338
5522
|
ref: headerRef
|
|
5339
|
-
}, /* @__PURE__ */
|
|
5523
|
+
}, /* @__PURE__ */ React54__default.default.createElement("tr", {
|
|
5340
5524
|
className: TableHeader_default.osdkTableHeaderRow
|
|
5341
5525
|
}, Array.from({
|
|
5342
5526
|
length: loadingColumnCount
|
|
5343
5527
|
}).map((_, index) => {
|
|
5344
5528
|
const width = headers.length > index ? headers[index].getSize() : columnWidth;
|
|
5345
|
-
return /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ React54__default.default.createElement("th", {
|
|
5346
5530
|
key: `loading-header-${index}`,
|
|
5347
5531
|
className: TableHeader_default.osdkTableHeaderCell,
|
|
5348
5532
|
style: {
|
|
5349
5533
|
width
|
|
5350
5534
|
}
|
|
5351
|
-
}, /* @__PURE__ */
|
|
5535
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5352
5536
|
className: classnames14__default.default(TableHeader_default.osdkLoadingHeaderCell, LoadingCell_default.osdkCellSkeleton)
|
|
5353
5537
|
}));
|
|
5354
|
-
}))), /* @__PURE__ */
|
|
5538
|
+
}))), /* @__PURE__ */ React54__default.default.createElement("tbody", {
|
|
5355
5539
|
className: TableBody_default.osdkTableBody,
|
|
5356
5540
|
ref: bodyRef
|
|
5357
5541
|
}, Array.from({
|
|
5358
5542
|
length: loadingRowCount
|
|
5359
|
-
}).map((_, index) => /* @__PURE__ */
|
|
5543
|
+
}).map((_, index) => /* @__PURE__ */ React54__default.default.createElement(LoadingRow, {
|
|
5360
5544
|
key: `skeleton-${index}`,
|
|
5361
5545
|
columnCount: loadingColumnCount,
|
|
5362
5546
|
headers,
|
|
@@ -5373,9 +5557,9 @@ var NonIdealState_default = {};
|
|
|
5373
5557
|
function NonIdealState({
|
|
5374
5558
|
message
|
|
5375
5559
|
}) {
|
|
5376
|
-
return /* @__PURE__ */
|
|
5560
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5377
5561
|
className: NonIdealState_default.container
|
|
5378
|
-
}, /* @__PURE__ */
|
|
5562
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5379
5563
|
className: NonIdealState_default.message
|
|
5380
5564
|
}, message));
|
|
5381
5565
|
}
|
|
@@ -5393,8 +5577,8 @@ function CellContextMenu({
|
|
|
5393
5577
|
onClose,
|
|
5394
5578
|
renderContent
|
|
5395
5579
|
}) {
|
|
5396
|
-
const ref =
|
|
5397
|
-
|
|
5580
|
+
const ref = React54.useRef(null);
|
|
5581
|
+
React54.useEffect(() => {
|
|
5398
5582
|
const handleClickOutside = (event) => {
|
|
5399
5583
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
5400
5584
|
onClose();
|
|
@@ -5405,7 +5589,7 @@ function CellContextMenu({
|
|
|
5405
5589
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5406
5590
|
};
|
|
5407
5591
|
}, [onClose]);
|
|
5408
|
-
return /* @__PURE__ */ reactDom.createPortal(/* @__PURE__ */
|
|
5592
|
+
return /* @__PURE__ */ reactDom.createPortal(/* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5409
5593
|
ref,
|
|
5410
5594
|
className: CellContextMenu_default.osdkCellContextMenu,
|
|
5411
5595
|
style: {
|
|
@@ -5418,9 +5602,9 @@ function CellContextMenu({
|
|
|
5418
5602
|
var useCellContextMenu = ({
|
|
5419
5603
|
tdRef
|
|
5420
5604
|
}) => {
|
|
5421
|
-
const [popoverPosition, setPopoverPosition] =
|
|
5422
|
-
const [isContextMenuOpen, setIsContextMenuOpen] =
|
|
5423
|
-
const handleOpenContextMenu =
|
|
5605
|
+
const [popoverPosition, setPopoverPosition] = React54.useState(null);
|
|
5606
|
+
const [isContextMenuOpen, setIsContextMenuOpen] = React54.useState(false);
|
|
5607
|
+
const handleOpenContextMenu = React54.useCallback((event) => {
|
|
5424
5608
|
event.preventDefault();
|
|
5425
5609
|
event.stopPropagation();
|
|
5426
5610
|
if (tdRef.current) {
|
|
@@ -5434,7 +5618,7 @@ var useCellContextMenu = ({
|
|
|
5434
5618
|
setIsContextMenuOpen(true);
|
|
5435
5619
|
}
|
|
5436
5620
|
}, [tdRef]);
|
|
5437
|
-
const handleCloseContextMenu =
|
|
5621
|
+
const handleCloseContextMenu = React54.useCallback(() => {
|
|
5438
5622
|
setIsContextMenuOpen(false);
|
|
5439
5623
|
setPopoverPosition(null);
|
|
5440
5624
|
}, []);
|
|
@@ -5451,7 +5635,7 @@ function TableCell({
|
|
|
5451
5635
|
cell,
|
|
5452
5636
|
renderCellContextMenu
|
|
5453
5637
|
}) {
|
|
5454
|
-
const tdRef =
|
|
5638
|
+
const tdRef = React54.useRef(null);
|
|
5455
5639
|
const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;
|
|
5456
5640
|
const {
|
|
5457
5641
|
isContextMenuOpen,
|
|
@@ -5465,15 +5649,15 @@ function TableCell({
|
|
|
5465
5649
|
const {
|
|
5466
5650
|
columnStyles
|
|
5467
5651
|
} = getColumnPinningStyles(cell.column);
|
|
5468
|
-
return /* @__PURE__ */
|
|
5652
|
+
return /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement("td", {
|
|
5469
5653
|
ref: tdRef,
|
|
5470
5654
|
"data-pinned": cell.column.getIsPinned(),
|
|
5471
5655
|
className: TableCell_default.osdkTableCell,
|
|
5472
5656
|
style: columnStyles,
|
|
5473
5657
|
onContextMenu: handleOpenContextMenu
|
|
5474
|
-
}, /* @__PURE__ */
|
|
5658
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5475
5659
|
className: TableCell_default.osdkTableCellContent
|
|
5476
|
-
}, reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))), shouldRenderContextMenu && /* @__PURE__ */
|
|
5660
|
+
}, reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()))), shouldRenderContextMenu && /* @__PURE__ */ React54__default.default.createElement(CellContextMenu, {
|
|
5477
5661
|
cell,
|
|
5478
5662
|
position: popoverPosition,
|
|
5479
5663
|
onClose: handleCloseContextMenu,
|
|
@@ -5487,26 +5671,26 @@ function TableRow({
|
|
|
5487
5671
|
virtualRow,
|
|
5488
5672
|
onRowClick,
|
|
5489
5673
|
renderCellContextMenu,
|
|
5490
|
-
|
|
5674
|
+
isFocused,
|
|
5491
5675
|
setFocusedRowId,
|
|
5492
5676
|
isInEditMode
|
|
5493
5677
|
}) {
|
|
5494
|
-
const handleClick =
|
|
5678
|
+
const handleClick = React54.useCallback(() => {
|
|
5495
5679
|
setFocusedRowId?.(row.id);
|
|
5496
5680
|
if (!isInEditMode) {
|
|
5497
5681
|
onRowClick?.(row.original);
|
|
5498
5682
|
}
|
|
5499
5683
|
}, [isInEditMode, onRowClick, row.original, row.id, setFocusedRowId]);
|
|
5500
|
-
return /* @__PURE__ */
|
|
5684
|
+
return /* @__PURE__ */ React54__default.default.createElement("tr", {
|
|
5501
5685
|
"data-selected": row.getIsSelected(),
|
|
5502
|
-
"data-focused":
|
|
5686
|
+
"data-focused": isFocused,
|
|
5503
5687
|
className: TableRow_default.osdkTableRow,
|
|
5504
5688
|
style: {
|
|
5505
5689
|
height: `${virtualRow.size}px`,
|
|
5506
5690
|
transform: `translateY(${virtualRow.start}px)`
|
|
5507
5691
|
},
|
|
5508
5692
|
onClick: handleClick
|
|
5509
|
-
}, row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
5693
|
+
}, row.getVisibleCells().map((cell) => /* @__PURE__ */ React54__default.default.createElement(TableCell, {
|
|
5510
5694
|
key: cell.id,
|
|
5511
5695
|
cell,
|
|
5512
5696
|
renderCellContextMenu
|
|
@@ -5532,30 +5716,30 @@ function TableBody({
|
|
|
5532
5716
|
getScrollElement: () => tableContainerRef.current,
|
|
5533
5717
|
overscan: 5
|
|
5534
5718
|
});
|
|
5535
|
-
|
|
5719
|
+
React54.useLayoutEffect(() => {
|
|
5536
5720
|
rowVirtualizer.measure();
|
|
5537
5721
|
}, [rowVirtualizer, rows.length]);
|
|
5538
5722
|
const totalSize = rowVirtualizer.getTotalSize();
|
|
5539
5723
|
const bodyHeight = isLoadingMore ? totalSize + rowHeight : totalSize;
|
|
5540
5724
|
const headers = headerGroups[0]?.headers ?? [];
|
|
5541
|
-
return /* @__PURE__ */
|
|
5725
|
+
return /* @__PURE__ */ React54__default.default.createElement("tbody", {
|
|
5542
5726
|
className: TableBody_default.osdkTableBody,
|
|
5543
5727
|
style: {
|
|
5544
5728
|
height: `${bodyHeight}px`
|
|
5545
5729
|
}
|
|
5546
5730
|
}, rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
5547
5731
|
const row = rows[virtualRow.index];
|
|
5548
|
-
return /* @__PURE__ */
|
|
5732
|
+
return /* @__PURE__ */ React54__default.default.createElement(TableRow, {
|
|
5549
5733
|
key: row.id,
|
|
5550
5734
|
row,
|
|
5551
5735
|
virtualRow,
|
|
5552
5736
|
onRowClick,
|
|
5553
5737
|
renderCellContextMenu,
|
|
5554
|
-
focusedRowId,
|
|
5738
|
+
isFocused: focusedRowId === row.id,
|
|
5555
5739
|
setFocusedRowId,
|
|
5556
5740
|
isInEditMode
|
|
5557
5741
|
});
|
|
5558
|
-
}), isLoadingMore && /* @__PURE__ */
|
|
5742
|
+
}), isLoadingMore && /* @__PURE__ */ React54__default.default.createElement(LoadingRow, {
|
|
5559
5743
|
headers,
|
|
5560
5744
|
translateY: totalSize,
|
|
5561
5745
|
rowHeight,
|
|
@@ -5575,55 +5759,65 @@ function TableEditContainer({
|
|
|
5575
5759
|
cellEdits,
|
|
5576
5760
|
onSubmitEdits,
|
|
5577
5761
|
clearEdits,
|
|
5578
|
-
|
|
5579
|
-
|
|
5762
|
+
editModeState,
|
|
5763
|
+
validationErrors
|
|
5764
|
+
} = editableConfig;
|
|
5580
5765
|
const hasEdits = Object.keys(cellEdits ?? {}).length > 0;
|
|
5581
|
-
const
|
|
5582
|
-
const
|
|
5583
|
-
const
|
|
5584
|
-
const
|
|
5766
|
+
const hasValidationError = (validationErrors?.size ?? 0) > 0;
|
|
5767
|
+
const [isSubmitting, setIsSubmitting] = React54.useState(false);
|
|
5768
|
+
const isInEditMode = editModeState.isActive;
|
|
5769
|
+
const canToggleEditMode = editModeState.type === "manual";
|
|
5770
|
+
const handleSubmitEdits = React54.useCallback(async () => {
|
|
5585
5771
|
setIsSubmitting(true);
|
|
5586
5772
|
try {
|
|
5587
5773
|
const success = await onSubmitEdits?.();
|
|
5588
5774
|
if (success) {
|
|
5589
5775
|
clearEdits?.();
|
|
5590
|
-
if (
|
|
5591
|
-
|
|
5776
|
+
if (editModeState?.type === "manual") {
|
|
5777
|
+
editModeState.setActive(false);
|
|
5592
5778
|
}
|
|
5593
5779
|
}
|
|
5594
5780
|
} finally {
|
|
5595
5781
|
setIsSubmitting(false);
|
|
5596
5782
|
}
|
|
5597
|
-
}, [
|
|
5598
|
-
const handleCancelEdits =
|
|
5783
|
+
}, [editModeState, onSubmitEdits, clearEdits]);
|
|
5784
|
+
const handleCancelEdits = React54.useCallback(() => {
|
|
5599
5785
|
clearEdits?.();
|
|
5600
|
-
if (
|
|
5601
|
-
|
|
5786
|
+
if (editModeState?.type === "manual") {
|
|
5787
|
+
editModeState.setActive(false);
|
|
5602
5788
|
}
|
|
5603
|
-
}, [clearEdits,
|
|
5604
|
-
const handleEnterEditMode =
|
|
5605
|
-
if (
|
|
5606
|
-
|
|
5789
|
+
}, [clearEdits, editModeState]);
|
|
5790
|
+
const handleEnterEditMode = React54.useCallback(() => {
|
|
5791
|
+
if (editModeState?.type === "manual") {
|
|
5792
|
+
editModeState.setActive(true);
|
|
5607
5793
|
}
|
|
5608
|
-
}, [
|
|
5609
|
-
return /* @__PURE__ */
|
|
5794
|
+
}, [editModeState]);
|
|
5795
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5610
5796
|
className: TableEditContainer_default.tableEditContainer
|
|
5611
|
-
}, hasEdits ? /* @__PURE__ */
|
|
5797
|
+
}, hasEdits || hasValidationError ? /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5798
|
+
className: TableEditContainer_default.editsInfoContainer
|
|
5799
|
+
}, hasEdits && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5612
5800
|
className: TableEditContainer_default.modificationCount
|
|
5613
|
-
}, `${cellEdits ? Object.keys(cellEdits).length : 0} modifications`)
|
|
5801
|
+
}, `${cellEdits ? Object.keys(cellEdits).length : 0} modifications`), hasEdits && hasValidationError && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5802
|
+
className: TableEditContainer_default.divider
|
|
5803
|
+
}), hasValidationError && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5804
|
+
className: TableEditContainer_default.validationError
|
|
5805
|
+
}, /* @__PURE__ */ React54__default.default.createElement(icons.Error, {
|
|
5806
|
+
className: TableEditContainer_default.errorIcon
|
|
5807
|
+
}), "Validation error")) : isInEditMode && !focusedRowId && /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5614
5808
|
className: TableEditContainer_default.placeholder
|
|
5615
|
-
}, "Select a row to edit data\u2026"), /* @__PURE__ */
|
|
5809
|
+
}, "Select a row to edit data\u2026"), /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5616
5810
|
className: TableEditContainer_default.editButtons
|
|
5617
|
-
}, !isInEditMode && canToggleEditMode && /* @__PURE__ */
|
|
5811
|
+
}, !isInEditMode && canToggleEditMode && /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
5618
5812
|
variant: "primary",
|
|
5619
5813
|
onClick: handleEnterEditMode
|
|
5620
|
-
}, "Edit Table"), isInEditMode && canToggleEditMode && /* @__PURE__ */
|
|
5814
|
+
}, "Edit Table"), isInEditMode && canToggleEditMode && /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
5621
5815
|
variant: "secondary",
|
|
5622
5816
|
onClick: handleCancelEdits
|
|
5623
|
-
}, "Cancel"), isInEditMode && !!onSubmitEdits && /* @__PURE__ */
|
|
5817
|
+
}, "Cancel"), isInEditMode && !!onSubmitEdits && /* @__PURE__ */ React54__default.default.createElement(ActionButton, {
|
|
5624
5818
|
variant: "primary",
|
|
5625
5819
|
onClick: handleSubmitEdits,
|
|
5626
|
-
disabled: !hasEdits || isSubmitting
|
|
5820
|
+
disabled: !hasEdits || isSubmitting || hasValidationError
|
|
5627
5821
|
}, "Submit Edits")));
|
|
5628
5822
|
}
|
|
5629
5823
|
|
|
@@ -5640,16 +5834,16 @@ function BaseTable({
|
|
|
5640
5834
|
headerMenuFeatureFlags,
|
|
5641
5835
|
editableConfig
|
|
5642
5836
|
}) {
|
|
5643
|
-
const tableContainerRef =
|
|
5644
|
-
const [isLoadingMore, setIsLoadingMore] =
|
|
5645
|
-
const [focusedRowId, setFocusedRowId] =
|
|
5646
|
-
const fetchingRef =
|
|
5647
|
-
|
|
5837
|
+
const tableContainerRef = React54.useRef(null);
|
|
5838
|
+
const [isLoadingMore, setIsLoadingMore] = React54.useState(false);
|
|
5839
|
+
const [focusedRowId, setFocusedRowId] = React54.useState(null);
|
|
5840
|
+
const fetchingRef = React54.useRef(false);
|
|
5841
|
+
React54.useEffect(() => {
|
|
5648
5842
|
if (!isLoading || fetchNextPage == null) {
|
|
5649
5843
|
setIsLoadingMore(false);
|
|
5650
5844
|
}
|
|
5651
5845
|
}, [isLoading, fetchNextPage]);
|
|
5652
|
-
const fetchMoreOnEndReached =
|
|
5846
|
+
const fetchMoreOnEndReached = React54.useCallback(async (containerRefElement) => {
|
|
5653
5847
|
if (containerRefElement && !fetchingRef.current && !isLoadingMore) {
|
|
5654
5848
|
const {
|
|
5655
5849
|
scrollHeight,
|
|
@@ -5667,14 +5861,14 @@ function BaseTable({
|
|
|
5667
5861
|
}
|
|
5668
5862
|
}
|
|
5669
5863
|
}, [fetchNextPage, isLoading, isLoadingMore]);
|
|
5670
|
-
const handleScroll =
|
|
5864
|
+
const handleScroll = React54.useCallback(async (e) => {
|
|
5671
5865
|
await fetchMoreOnEndReached(e.currentTarget);
|
|
5672
5866
|
}, [fetchMoreOnEndReached]);
|
|
5673
5867
|
const rows = table.getRowModel().rows;
|
|
5674
5868
|
const headerGroups = table.getHeaderGroups();
|
|
5675
5869
|
const hasData = rows.length > 0;
|
|
5676
5870
|
const hasEditableColumns = table.getAllColumns().some((column) => column.columnDef.meta?.editable === true);
|
|
5677
|
-
|
|
5871
|
+
React54.useEffect(() => {
|
|
5678
5872
|
const handleClickOutside = (event) => {
|
|
5679
5873
|
if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
|
|
5680
5874
|
setFocusedRowId(null);
|
|
@@ -5685,21 +5879,21 @@ function BaseTable({
|
|
|
5685
5879
|
document.removeEventListener("click", handleClickOutside);
|
|
5686
5880
|
};
|
|
5687
5881
|
}, []);
|
|
5688
|
-
return /* @__PURE__ */
|
|
5882
|
+
return /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5689
5883
|
className: classnames14__default.default(Table_default.osdkTableWrapper, className)
|
|
5690
|
-
}, /* @__PURE__ */
|
|
5884
|
+
}, /* @__PURE__ */ React54__default.default.createElement("div", {
|
|
5691
5885
|
ref: tableContainerRef,
|
|
5692
5886
|
className: Table_default.osdkTableContainer,
|
|
5693
5887
|
onScroll: handleScroll
|
|
5694
|
-
}, /* @__PURE__ */
|
|
5888
|
+
}, /* @__PURE__ */ React54__default.default.createElement("table", null, isLoading && !hasData ? /* @__PURE__ */ React54__default.default.createElement(LoadingStateTable, {
|
|
5695
5889
|
table,
|
|
5696
5890
|
headerGroups,
|
|
5697
5891
|
rowHeight,
|
|
5698
5892
|
tableContainerRef
|
|
5699
|
-
}) : /* @__PURE__ */
|
|
5893
|
+
}) : /* @__PURE__ */ React54__default.default.createElement(React54__default.default.Fragment, null, /* @__PURE__ */ React54__default.default.createElement(TableHeader, {
|
|
5700
5894
|
table,
|
|
5701
5895
|
headerMenuFeatureFlags
|
|
5702
|
-
}), /* @__PURE__ */
|
|
5896
|
+
}), /* @__PURE__ */ React54__default.default.createElement(TableBody, {
|
|
5703
5897
|
rows,
|
|
5704
5898
|
tableContainerRef,
|
|
5705
5899
|
onRowClick,
|
|
@@ -5709,12 +5903,12 @@ function BaseTable({
|
|
|
5709
5903
|
headerGroups,
|
|
5710
5904
|
focusedRowId,
|
|
5711
5905
|
setFocusedRowId,
|
|
5712
|
-
isInEditMode: editableConfig?.
|
|
5713
|
-
}))), !hasData && error == null && /* @__PURE__ */
|
|
5906
|
+
isInEditMode: editableConfig?.editModeState.isActive
|
|
5907
|
+
}))), !hasData && error == null && /* @__PURE__ */ React54__default.default.createElement(NonIdealState, {
|
|
5714
5908
|
message: "No Data"
|
|
5715
|
-
}), error != null && /* @__PURE__ */
|
|
5909
|
+
}), error != null && /* @__PURE__ */ React54__default.default.createElement(NonIdealState, {
|
|
5716
5910
|
message: `Error Loading Data: ${error.message}`
|
|
5717
|
-
})), hasEditableColumns && /* @__PURE__ */
|
|
5911
|
+
})), hasEditableColumns && editableConfig && /* @__PURE__ */ React54__default.default.createElement(TableEditContainer, {
|
|
5718
5912
|
editableConfig,
|
|
5719
5913
|
focusedRowId
|
|
5720
5914
|
}));
|
|
@@ -5810,7 +6004,7 @@ function ObjectTable({
|
|
|
5810
6004
|
hasSelectionColumn: enableRowSelection,
|
|
5811
6005
|
onColumnsPinnedChanged
|
|
5812
6006
|
});
|
|
5813
|
-
const allColumns =
|
|
6007
|
+
const allColumns = React54.useMemo(() => {
|
|
5814
6008
|
return selectionColumn ? [selectionColumn, ...columns] : columns;
|
|
5815
6009
|
}, [selectionColumn, columns]);
|
|
5816
6010
|
const editableConfig = useEditableTable({
|
|
@@ -5847,21 +6041,24 @@ function ObjectTable({
|
|
|
5847
6041
|
getRowId,
|
|
5848
6042
|
meta: {
|
|
5849
6043
|
onCellEdit: editableConfig.onCellEdit,
|
|
6044
|
+
onCellValidationError: editableConfig.onCellValidationError,
|
|
6045
|
+
clearCellValidationError: editableConfig.clearCellValidationError,
|
|
5850
6046
|
cellEdits: editableConfig.cellEdits,
|
|
5851
|
-
isInEditMode: editableConfig.
|
|
6047
|
+
isInEditMode: editableConfig.editModeState.isActive,
|
|
6048
|
+
validationErrors: editableConfig.validationErrors
|
|
5852
6049
|
}
|
|
5853
6050
|
});
|
|
5854
|
-
const onRenderCellContextMenu =
|
|
6051
|
+
const onRenderCellContextMenu = React54.useCallback((row, cell) => {
|
|
5855
6052
|
return renderCellContextMenu?.(row, cell.getValue());
|
|
5856
6053
|
}, [renderCellContextMenu]);
|
|
5857
6054
|
const isTableLoading = isLoading || isColumnsLoading;
|
|
5858
|
-
const headerMenuFeatureFlags =
|
|
6055
|
+
const headerMenuFeatureFlags = React54.useMemo(() => ({
|
|
5859
6056
|
showSortingItems: enableOrdering,
|
|
5860
6057
|
showPinningItems: enableColumnPinning,
|
|
5861
6058
|
showResizeItem: enableColumnResizing,
|
|
5862
6059
|
showConfigItem: enableColumnConfig
|
|
5863
6060
|
}), [enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig]);
|
|
5864
|
-
return /* @__PURE__ */
|
|
6061
|
+
return /* @__PURE__ */ React54__default.default.createElement(BaseTable, {
|
|
5865
6062
|
table,
|
|
5866
6063
|
isLoading: isTableLoading,
|
|
5867
6064
|
fetchNextPage: fetchMore,
|