@worknice/whiteboard 0.49.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fields/ListBoxField.d.ts +12 -4
- package/dist/fields/ListBoxField.js +10 -3
- package/dist/forms/ToggleField_module.css +0 -1
- package/dist/inputs/ListBoxInput.d.ts +11 -3
- package/dist/inputs/ListBoxInput.js +73 -28
- package/dist/inputs/ListBoxInput.module.js +2 -0
- package/dist/inputs/ListBoxInput_module.css +10 -0
- package/dist/inputs/StringInput.d.ts +1 -1
- package/dist/presentation/CustomizableTable/ConfigureColumnsModal.d.ts +7 -3
- package/dist/presentation/CustomizableTable/ConfigureColumnsModal.js +10 -4
- package/dist/presentation/CustomizableTable/CustomizableTable.d.ts +6 -3
- package/dist/presentation/CustomizableTable/CustomizableTable.js +10 -19
- package/package.json +2 -2
|
@@ -11,13 +11,21 @@ type Props<Option> = {
|
|
|
11
11
|
labelFont?: LabelFontOption;
|
|
12
12
|
required?: boolean;
|
|
13
13
|
onChange: (option: Option) => void;
|
|
14
|
-
options: Array<Option>;
|
|
15
14
|
optionToId: (option: Option) => string;
|
|
16
15
|
optionToLabel: (option: Option) => ReactNode;
|
|
17
16
|
optionToDisabled?: (option: Option) => boolean;
|
|
18
17
|
searchField: keyof Option & string;
|
|
19
18
|
value: Array<Option>;
|
|
20
19
|
fixedHeight?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
} & ({
|
|
21
|
+
options: Array<Option>;
|
|
22
|
+
optionGroups?: never;
|
|
23
|
+
} | {
|
|
24
|
+
options?: never;
|
|
25
|
+
optionGroups: Array<{
|
|
26
|
+
header: string;
|
|
27
|
+
options: Array<Option>;
|
|
28
|
+
}>;
|
|
29
|
+
});
|
|
30
|
+
declare const ListBoxField: <Option>({ description, errors, id, includeValueInTracking, label, labelFont, required, onChange, optionToId, optionToLabel, searchField, value, optionToDisabled, fixedHeight, ...rest }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default ListBoxField;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__ from "../forms/RegularField.js";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__inputs_ListBoxInput_js_31ed5aa7__ from "../inputs/ListBoxInput.js";
|
|
4
|
-
const
|
|
4
|
+
const ListBoxField = ({ description, errors, id, includeValueInTracking, label, labelFont = "label", required = false, onChange, optionToId, optionToLabel, searchField, value, optionToDisabled, fixedHeight, ...rest })=>{
|
|
5
|
+
const optionProps = "options" in rest && null != rest.options ? {
|
|
6
|
+
options: rest.options
|
|
7
|
+
} : {
|
|
8
|
+
optionGroups: rest.optionGroups
|
|
9
|
+
};
|
|
10
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__forms_RegularField_js_c54537ba__["default"], {
|
|
5
11
|
description: description,
|
|
6
12
|
errors: errors,
|
|
7
13
|
inputId: id,
|
|
@@ -9,8 +15,8 @@ const SelectField = ({ description, errors, id, includeValueInTracking, label, l
|
|
|
9
15
|
labelFont: labelFont,
|
|
10
16
|
required: required,
|
|
11
17
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__inputs_ListBoxInput_js_31ed5aa7__["default"], {
|
|
18
|
+
...optionProps,
|
|
12
19
|
onChange: onChange,
|
|
13
|
-
options: options,
|
|
14
20
|
optionToId: optionToId,
|
|
15
21
|
optionToLabel: optionToLabel,
|
|
16
22
|
optionToDisabled: optionToDisabled,
|
|
@@ -21,5 +27,6 @@ const SelectField = ({ description, errors, id, includeValueInTracking, label, l
|
|
|
21
27
|
fixedHeight: fixedHeight
|
|
22
28
|
})
|
|
23
29
|
});
|
|
24
|
-
|
|
30
|
+
};
|
|
31
|
+
const ListBoxField_rslib_entry_ = ListBoxField;
|
|
25
32
|
export { ListBoxField_rslib_entry_ as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
type Props<Option> = {
|
|
3
3
|
onChange: (option: Option) => void;
|
|
4
|
-
options: Array<Option>;
|
|
5
4
|
optionToId: (option: Option) => string;
|
|
6
5
|
optionToLabel: (option: Option) => ReactNode;
|
|
7
6
|
optionToDisabled?: (option: Option) => boolean;
|
|
@@ -10,6 +9,15 @@ type Props<Option> = {
|
|
|
10
9
|
id?: string;
|
|
11
10
|
includeValueInTracking?: boolean;
|
|
12
11
|
fixedHeight?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
12
|
+
} & ({
|
|
13
|
+
options: Array<Option>;
|
|
14
|
+
optionGroups?: never;
|
|
15
|
+
} | {
|
|
16
|
+
options?: never;
|
|
17
|
+
optionGroups: Array<{
|
|
18
|
+
header: string;
|
|
19
|
+
options: Array<Option>;
|
|
20
|
+
}>;
|
|
21
|
+
});
|
|
22
|
+
declare const ListBoxInput: <Option>({ onChange, options, optionGroups, optionToId, optionToLabel, optionToDisabled, searchField, value, id, includeValueInTracking, fixedHeight, }: Props<Option>) => import("react/jsx-runtime").JSX.Element;
|
|
15
23
|
export default ListBoxInput;
|
|
@@ -1,20 +1,89 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__ from "../presentation/PlainText.js";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_search_js_89d5ae26__ from "../utils/search.js";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_TrackingContext_js_139012da__ from "../utils/TrackingContext.js";
|
|
6
7
|
import * as __WEBPACK_EXTERNAL_MODULE__CheckboxInput_js_1a7df59a__ from "./CheckboxInput.js";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__ from "./ListBoxInput.module.js";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE__StringInput_js_3cb68a8a__ from "./StringInput.js";
|
|
9
|
-
const ListBoxInput = ({ onChange, options, optionToId, optionToLabel, optionToDisabled, searchField, value, id, includeValueInTracking, fixedHeight = false })=>{
|
|
10
|
+
const ListBoxInput = ({ onChange, options, optionGroups, optionToId, optionToLabel, optionToDisabled, searchField, value, id, includeValueInTracking, fixedHeight = false })=>{
|
|
10
11
|
const [searchTerm, setSearchTerm] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)("");
|
|
11
12
|
const trackingContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__utils_TrackingContext_js_139012da__["default"]);
|
|
12
|
-
const
|
|
13
|
+
const allOptions = options ?? optionGroups.flatMap((group)=>group.options) ?? [];
|
|
14
|
+
const filteredOptions = "" !== searchTerm.trim() ? (0, __WEBPACK_EXTERNAL_MODULE__utils_search_js_89d5ae26__["default"])(allOptions.map((option)=>({
|
|
13
15
|
...option,
|
|
14
16
|
id: optionToId(option)
|
|
15
17
|
})), [
|
|
16
18
|
searchField
|
|
17
|
-
], searchTerm) :
|
|
19
|
+
], searchTerm) : allOptions;
|
|
20
|
+
const renderOption = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((option)=>{
|
|
21
|
+
const optionId = optionToId(option);
|
|
22
|
+
const optionLabel = optionToLabel(option);
|
|
23
|
+
const optionDisabled = optionToDisabled ? optionToDisabled(option) : false;
|
|
24
|
+
const selected = value.some((value)=>optionToId(value) === optionToId(option));
|
|
25
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("label", {
|
|
26
|
+
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].option, {
|
|
27
|
+
[__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].disabled]: optionDisabled
|
|
28
|
+
}),
|
|
29
|
+
children: [
|
|
30
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__CheckboxInput_js_1a7df59a__["default"], {
|
|
31
|
+
disabled: optionDisabled,
|
|
32
|
+
value: selected,
|
|
33
|
+
onChange: ()=>{
|
|
34
|
+
onChange(option);
|
|
35
|
+
if (trackingContext && id) trackingContext.trackInput(id, includeValueInTracking ? optionToId(option) : void 0);
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
optionLabel
|
|
39
|
+
]
|
|
40
|
+
}, optionId);
|
|
41
|
+
}, [
|
|
42
|
+
optionToId,
|
|
43
|
+
optionToLabel,
|
|
44
|
+
optionToDisabled,
|
|
45
|
+
value,
|
|
46
|
+
onChange,
|
|
47
|
+
trackingContext,
|
|
48
|
+
id,
|
|
49
|
+
includeValueInTracking
|
|
50
|
+
]);
|
|
51
|
+
const renderOptions = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
52
|
+
if (options) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
53
|
+
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].optionsContainer,
|
|
54
|
+
children: filteredOptions.map(renderOption)
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
57
|
+
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].optionGroupsContainer,
|
|
58
|
+
children: optionGroups.map((group)=>{
|
|
59
|
+
if (0 === group.options.length) return null;
|
|
60
|
+
const groupOptionIds = new Set(group.options.map((o)=>optionToId(o)));
|
|
61
|
+
const filteredGroupOptions = filteredOptions.filter((o)=>groupOptionIds.has(optionToId(o)));
|
|
62
|
+
if (0 === filteredGroupOptions.length) return null;
|
|
63
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react__.Fragment, {
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
66
|
+
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].optionGroupHeader,
|
|
67
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__presentation_PlainText_js_e98763ad__["default"], {
|
|
68
|
+
font: "regular-bold",
|
|
69
|
+
children: group.header
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
73
|
+
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].optionsContainer,
|
|
74
|
+
children: filteredGroupOptions.map(renderOption)
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}, group.header);
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}, [
|
|
81
|
+
filteredOptions,
|
|
82
|
+
optionGroups,
|
|
83
|
+
renderOption,
|
|
84
|
+
options,
|
|
85
|
+
optionToId
|
|
86
|
+
]);
|
|
18
87
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
19
88
|
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].container, {
|
|
20
89
|
[__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].fixedHeight]: fixedHeight
|
|
@@ -33,31 +102,7 @@ const ListBoxInput = ({ onChange, options, optionToId, optionToLabel, optionToDi
|
|
|
33
102
|
}),
|
|
34
103
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
35
104
|
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].listContainer,
|
|
36
|
-
children: 0 !== filteredOptions.length ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
37
|
-
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].optionsContainer,
|
|
38
|
-
children: filteredOptions.map((option)=>{
|
|
39
|
-
const optionId = optionToId(option);
|
|
40
|
-
const optionLabel = optionToLabel(option);
|
|
41
|
-
const optionDisabled = optionToDisabled ? optionToDisabled(option) : false;
|
|
42
|
-
const selected = value.some((value)=>optionToId(value) === optionToId(option));
|
|
43
|
-
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("label", {
|
|
44
|
-
className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].option, {
|
|
45
|
-
[__WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].disabled]: optionDisabled
|
|
46
|
-
}),
|
|
47
|
-
children: [
|
|
48
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__CheckboxInput_js_1a7df59a__["default"], {
|
|
49
|
-
disabled: optionDisabled,
|
|
50
|
-
value: selected,
|
|
51
|
-
onChange: ()=>{
|
|
52
|
-
onChange(option);
|
|
53
|
-
if (trackingContext && id) trackingContext.trackInput(id, includeValueInTracking ? optionToId(option) : void 0);
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
optionLabel
|
|
57
|
-
]
|
|
58
|
-
}, optionId);
|
|
59
|
-
})
|
|
60
|
-
}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
105
|
+
children: 0 !== filteredOptions.length ? renderOptions() : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
|
|
61
106
|
className: __WEBPACK_EXTERNAL_MODULE__ListBoxInput_module_js_52d8d802__["default"].noResultsContainer,
|
|
62
107
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
|
|
63
108
|
children: "No options found."
|
|
@@ -6,6 +6,8 @@ const ListBoxInput_module_rslib_entry_ = {
|
|
|
6
6
|
listContainer: "listContainer-a9BpgI",
|
|
7
7
|
optionsContainer: "optionsContainer-q0if3P",
|
|
8
8
|
noResultsContainer: "noResultsContainer-FEqb9D",
|
|
9
|
+
optionGroupsContainer: "optionGroupsContainer-DDCZK6",
|
|
10
|
+
optionGroupHeader: "optionGroupHeader-qd90r6",
|
|
9
11
|
option: "option-uViftw",
|
|
10
12
|
disabled: "disabled-wpSMEL"
|
|
11
13
|
};
|
|
@@ -34,6 +34,16 @@
|
|
|
34
34
|
padding: var(--size-00);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
.optionGroupsContainer-DDCZK6 .optionGroupHeader-qd90r6:first-child {
|
|
38
|
+
padding-top: var(--size-n1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.optionGroupHeader-qd90r6 {
|
|
42
|
+
padding-left: var(--size-n1);
|
|
43
|
+
padding-right: var(--size-n1);
|
|
44
|
+
padding-bottom: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
.option-uViftw {
|
|
38
48
|
padding: var(--size-n2);
|
|
39
49
|
gap: var(--size-n2);
|
|
@@ -9,7 +9,7 @@ type Props = {
|
|
|
9
9
|
type?: "text" | "multiline" | "email" | "tel" | "url" | "search" | "password";
|
|
10
10
|
value: string | null;
|
|
11
11
|
prefix?: ReactNode | null;
|
|
12
|
-
suffix?:
|
|
12
|
+
suffix?: ReactNode | null;
|
|
13
13
|
inputMode?: "text" | "numeric" | "decimal" | "numeric" | "tel" | "search" | "url" | "email";
|
|
14
14
|
maxLength?: number;
|
|
15
15
|
size?: number;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
type Column = {
|
|
2
2
|
id: string;
|
|
3
|
-
|
|
3
|
+
header: string;
|
|
4
|
+
};
|
|
5
|
+
type ColumnGroup = {
|
|
6
|
+
header: string;
|
|
7
|
+
columns: Column[];
|
|
4
8
|
};
|
|
5
9
|
type Props = {
|
|
6
10
|
selectedColumns: Column[];
|
|
7
|
-
|
|
11
|
+
availableColumnGroups: ColumnGroup[];
|
|
8
12
|
onClose: () => void;
|
|
9
13
|
onSave: (selectedColumns: Column[]) => void;
|
|
10
14
|
};
|
|
11
|
-
export declare const ConfigureColumnsModal: ({ selectedColumns,
|
|
15
|
+
export declare const ConfigureColumnsModal: ({ selectedColumns, availableColumnGroups, onClose, onSave, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
16
|
export {};
|
|
@@ -8,7 +8,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_Card_2c1
|
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_CardContent_7df3771e__ from "@worknice/whiteboard/presentation/CardContent";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_Modal_c387b97c__ from "@worknice/whiteboard/presentation/Modal";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_PlainText_c60690e6__ from "@worknice/whiteboard/presentation/PlainText";
|
|
11
|
-
const ConfigureColumnsModal = ({ selectedColumns,
|
|
11
|
+
const ConfigureColumnsModal = ({ selectedColumns, availableColumnGroups, onClose, onSave })=>{
|
|
12
12
|
const { data, setData, status, submit } = (0, __WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_forms_useForm_0e3543cc__["default"])({
|
|
13
13
|
initialValues: {
|
|
14
14
|
selectedColumns
|
|
@@ -34,6 +34,12 @@ const ConfigureColumnsModal = ({ selectedColumns, availableColumns, onClose, onS
|
|
|
34
34
|
data.selectedColumns,
|
|
35
35
|
setData
|
|
36
36
|
]);
|
|
37
|
+
const optionGroups = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>availableColumnGroups.map(({ header, columns })=>({
|
|
38
|
+
header,
|
|
39
|
+
options: columns
|
|
40
|
+
})), [
|
|
41
|
+
availableColumnGroups
|
|
42
|
+
]);
|
|
37
43
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_Modal_c387b97c__["default"], {
|
|
38
44
|
onClose: onClose,
|
|
39
45
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_presentation_Card_2c171bdf__["default"], {
|
|
@@ -58,10 +64,10 @@ const ConfigureColumnsModal = ({ selectedColumns, availableColumns, onClose, onS
|
|
|
58
64
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__worknice_whiteboard_fields_ListBoxField_ee41eec4__["default"], {
|
|
59
65
|
label: "Columns",
|
|
60
66
|
id: "columnsListBox",
|
|
61
|
-
|
|
67
|
+
optionGroups: optionGroups,
|
|
62
68
|
optionToId: (column)=>column.id,
|
|
63
|
-
optionToLabel: (column)=>column.
|
|
64
|
-
searchField: "
|
|
69
|
+
optionToLabel: (column)=>column.header,
|
|
70
|
+
searchField: "header",
|
|
65
71
|
value: data.selectedColumns,
|
|
66
72
|
onChange: onSelect
|
|
67
73
|
})
|
|
@@ -42,9 +42,12 @@ type Props<Type> = {
|
|
|
42
42
|
})>;
|
|
43
43
|
csvFilename?: string;
|
|
44
44
|
getRowId: (row: Type) => string;
|
|
45
|
-
|
|
46
|
-
id: string;
|
|
45
|
+
availableColumnGroups: Array<{
|
|
47
46
|
header: string;
|
|
47
|
+
columns: Array<{
|
|
48
|
+
id: string;
|
|
49
|
+
header: string;
|
|
50
|
+
}>;
|
|
48
51
|
}>;
|
|
49
52
|
view: CustomizableTableView;
|
|
50
53
|
onViewChange: (view: CustomizableTableView) => void;
|
|
@@ -52,5 +55,5 @@ type Props<Type> = {
|
|
|
52
55
|
estimatedRowSize?: number;
|
|
53
56
|
emptyState?: ReactNode;
|
|
54
57
|
};
|
|
55
|
-
declare const CustomizableTable: <Type>({ data, columns, csvFilename, getRowId,
|
|
58
|
+
declare const CustomizableTable: <Type>({ data, columns, csvFilename, getRowId, availableColumnGroups, view, onViewChange, isLoading, estimatedRowSize, emptyState, }: Props<Type>) => import("react/jsx-runtime").JSX.Element;
|
|
56
59
|
export default CustomizableTable;
|
|
@@ -81,10 +81,7 @@ const DraggableColumnHeader = ({ header, getColumnStyle, showResizer = true })=>
|
|
|
81
81
|
]
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
const CustomizableTable = ({ data, columns, csvFilename, getRowId,
|
|
85
|
-
id: col.id,
|
|
86
|
-
header: "string" == typeof col.header ? col.header : col.id
|
|
87
|
-
})), view, onViewChange, isLoading = false, estimatedRowSize = 100, emptyState = "No results" })=>{
|
|
84
|
+
const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColumnGroups, view, onViewChange, isLoading = false, estimatedRowSize = 100, emptyState = "No results" })=>{
|
|
88
85
|
const [searchTerm, setSearchTerm] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)("");
|
|
89
86
|
const [isFilterModalOpen, setIsFilterModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
90
87
|
const [activeId, setActiveId] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
|
|
@@ -367,8 +364,8 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
367
364
|
]);
|
|
368
365
|
const hasFilterableColumns = filterableColumnsForModal.length > 0;
|
|
369
366
|
const applyColumnSelection = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((selected)=>{
|
|
370
|
-
if (0 ===
|
|
371
|
-
const availableIds = new Set(
|
|
367
|
+
if (0 === availableColumnGroups.length) return;
|
|
368
|
+
const availableIds = new Set(availableColumnGroups.flatMap((group)=>group.columns.map((c)=>c.id)));
|
|
372
369
|
const selectedIds = new Set(selected.map((c)=>c.id));
|
|
373
370
|
const filtersBefore = reactTable.getState().columnFilters;
|
|
374
371
|
const visibility = {
|
|
@@ -385,18 +382,12 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
385
382
|
reactTable.setColumnOrder(newOrder);
|
|
386
383
|
reactTable.setColumnFilters(filtersBefore.filter((f)=>!availableIds.has(f.id) || selectedIds.has(f.id)));
|
|
387
384
|
}, [
|
|
388
|
-
|
|
385
|
+
availableColumnGroups,
|
|
389
386
|
reactTable
|
|
390
387
|
]);
|
|
391
|
-
const
|
|
392
|
-
id: col.id,
|
|
393
|
-
name: col.header
|
|
394
|
-
})), [
|
|
395
|
-
availableColumns
|
|
396
|
-
]);
|
|
397
|
-
const selectedConfigureColumns = availableColumns.filter((col)=>reactTable.getColumn(col.id)?.getIsVisible() ?? false).map((col)=>({
|
|
388
|
+
const selectedConfigureColumns = availableColumnGroups.flatMap((group)=>group.columns).filter((col)=>reactTable.getColumn(col.id)?.getIsVisible() ?? false).map((col)=>({
|
|
398
389
|
id: col.id,
|
|
399
|
-
|
|
390
|
+
header: col.header
|
|
400
391
|
}));
|
|
401
392
|
const handleDragStart = (event)=>{
|
|
402
393
|
setActiveId(event.active.id);
|
|
@@ -437,7 +428,7 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
437
428
|
reactTable,
|
|
438
429
|
scrollContainerWidth
|
|
439
430
|
]);
|
|
440
|
-
const showTableFilterBar = 0 !== globalFilterableColumns.length || 0 !== filterableColumns.length || 0 !==
|
|
431
|
+
const showTableFilterBar = 0 !== globalFilterableColumns.length || 0 !== filterableColumns.length || 0 !== availableColumnGroups.length;
|
|
441
432
|
const tableLayoutWidthPx = reactTable.getTotalSize();
|
|
442
433
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
443
434
|
className: __WEBPACK_EXTERNAL_MODULE__CustomizableTable_module_js_80cff08d__["default"].root,
|
|
@@ -466,7 +457,7 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
466
457
|
disabled: isLoading
|
|
467
458
|
})
|
|
468
459
|
}) : null,
|
|
469
|
-
0 !==
|
|
460
|
+
0 !== availableColumnGroups.length || 0 !== filterableColumns.length ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
470
461
|
className: __WEBPACK_EXTERNAL_MODULE__Table_module_js_61474ffd__["default"].filterSelectMenus,
|
|
471
462
|
children: [
|
|
472
463
|
0 !== filterableColumns.length ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_2f50b64a__["default"], {
|
|
@@ -481,7 +472,7 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
481
472
|
!isLoading && activeFilterCount > 0 ? ` (${activeFilterCount})` : ""
|
|
482
473
|
]
|
|
483
474
|
}) : null,
|
|
484
|
-
0 !==
|
|
475
|
+
0 !== availableColumnGroups.length ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Disclosure_js_07249afc__["default"], {
|
|
485
476
|
disabled: isLoading,
|
|
486
477
|
id: "columnVisibility",
|
|
487
478
|
icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_e5f9af80__["default"], {
|
|
@@ -490,7 +481,7 @@ const CustomizableTable = ({ data, columns, csvFilename, getRowId, availableColu
|
|
|
490
481
|
type: "secondary",
|
|
491
482
|
render: (onClose)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__ConfigureColumnsModal_js_cdac33d6__.ConfigureColumnsModal, {
|
|
492
483
|
selectedColumns: selectedConfigureColumns,
|
|
493
|
-
|
|
484
|
+
availableColumnGroups: availableColumnGroups,
|
|
494
485
|
onClose: onClose,
|
|
495
486
|
onSave: (selectedColumns)=>{
|
|
496
487
|
applyColumnSelection(selectedColumns);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worknice/whiteboard",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.51.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-markdown": "^10.1.0",
|
|
40
40
|
"utf8": "^3.0.0",
|
|
41
41
|
"zod": "^4.1.13",
|
|
42
|
-
"@worknice/utils": "^0.
|
|
42
|
+
"@worknice/utils": "^0.34.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@anolilab/semantic-release-pnpm": "^3.2.2",
|