@monolith-forensics/monolith-ui 1.2.91 → 1.2.93
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/Button/Button.d.ts +1 -0
- package/dist/Button/Button.js +3 -2
- package/dist/Calendar/CalendarStyles.d.ts +5 -15
- package/dist/Calendar/calendarHelpers.d.ts +1 -1
- package/dist/CheckBox/CheckBox.js +6 -4
- package/dist/DateInput/DateInput.d.ts +5 -3
- package/dist/DateInput/DateInput.js +41 -25
- package/dist/DropDownMenu/DropDownMenu.d.ts +2 -45
- package/dist/DropDownMenu/DropDownMenu.js +9 -315
- package/dist/DropDownMenu/components/Menu.d.ts +2 -0
- package/dist/DropDownMenu/components/Menu.js +11 -0
- package/dist/DropDownMenu/components/MenuComponent.d.ts +2 -0
- package/dist/DropDownMenu/components/MenuComponent.js +117 -0
- package/dist/DropDownMenu/components/MenuContext.d.ts +7 -0
- package/dist/DropDownMenu/components/MenuContext.js +8 -0
- package/dist/DropDownMenu/components/MenuItem.d.ts +7 -0
- package/dist/DropDownMenu/components/MenuItem.js +99 -0
- package/dist/DropDownMenu/components/MenuItemList.d.ts +18 -0
- package/dist/DropDownMenu/components/MenuItemList.js +92 -0
- package/dist/DropDownMenu/components/SearchInput.d.ts +1 -0
- package/dist/DropDownMenu/components/SearchInput.js +4 -0
- package/dist/DropDownMenu/components/StyledContent.d.ts +2 -0
- package/dist/DropDownMenu/components/StyledContent.js +42 -0
- package/dist/DropDownMenu/components/StyledFloatContainer.d.ts +1 -0
- package/dist/DropDownMenu/components/StyledFloatContainer.js +5 -0
- package/dist/DropDownMenu/components/StyledInnerItemContainer.d.ts +1 -0
- package/dist/DropDownMenu/components/StyledInnerItemContainer.js +9 -0
- package/dist/DropDownMenu/components/index.d.ts +9 -0
- package/dist/DropDownMenu/components/index.js +9 -0
- package/dist/DropDownMenu/index.d.ts +1 -1
- package/dist/DropDownMenu/index.js +1 -0
- package/dist/DropDownMenu/types.d.ts +52 -0
- package/dist/FieldLabel/FieldLabel.d.ts +1 -1
- package/dist/FileViewer/FileViewer.d.ts +13 -0
- package/dist/FileViewer/FileViewer.js +180 -0
- package/dist/FileViewer/index.d.ts +1 -0
- package/dist/FileViewer/index.js +1 -0
- package/dist/FileViewer/viewers/CodeViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/CodeViewer.js +106 -0
- package/dist/FileViewer/viewers/ImageViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/ImageViewer.js +58 -0
- package/dist/FileViewer/viewers/OfficeViewer.d.ts +5 -0
- package/dist/FileViewer/viewers/OfficeViewer.js +70 -0
- package/dist/FileViewer/viewers/PdfViewer.d.ts +8 -0
- package/dist/FileViewer/viewers/PdfViewer.js +63 -0
- package/dist/FileViewer/viewers/PlainTextViewer.d.ts +4 -0
- package/dist/FileViewer/viewers/PlainTextViewer.js +62 -0
- package/dist/FileViewer/viewers/VideoViewer.d.ts +6 -0
- package/dist/FileViewer/viewers/VideoViewer.js +30 -0
- package/dist/FileViewer/viewers/index.d.ts +6 -0
- package/dist/FileViewer/viewers/index.js +6 -0
- package/dist/FormSection/FormSection.d.ts +10 -2
- package/dist/FormSection/FormSection.js +43 -8
- package/dist/IconButton/IconButton.d.ts +1 -3
- package/dist/Input/Input.js +5 -0
- package/dist/MonolithUIProvider/GlobalStyle.d.ts +1 -1
- package/dist/MonolithUIProvider/GlobalStyle.js +1 -1
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +2 -2
- package/dist/MonolithUIProvider/MonolithUIProvider.js +8 -3
- package/dist/MonolithUIProvider/index.d.ts +2 -2
- package/dist/MonolithUIProvider/index.js +2 -2
- package/dist/MonolithUIProvider/useMonolithUITheme.d.ts +1 -2
- package/dist/MonolithUIProvider/useMonolithUITheme.js +1 -2
- package/dist/Pill/Pill.d.ts +2 -1
- package/dist/Pill/Pill.js +2 -2
- package/dist/QueryFilter/DefaultOperators.d.ts +2 -3
- package/dist/QueryFilter/DefaultOperators.js +2 -3
- package/dist/QueryFilter/QueryFilter.d.ts +2 -3
- package/dist/QueryFilter/QueryFilter.js +126 -49
- package/dist/QueryFilter/index.d.ts +4 -2
- package/dist/QueryFilter/index.js +4 -2
- package/dist/QueryFilter/types.d.ts +12 -8
- package/dist/QueryFilter/useFilterHelper.d.ts +20 -0
- package/dist/QueryFilter/useFilterHelper.js +61 -0
- package/dist/QueryFilter/useQueryFilter.d.ts +1 -2
- package/dist/QueryFilter/useQueryFilter.js +5 -2
- package/dist/RichTextEditor/Components/BubbleMenu.d.ts +3 -4
- package/dist/RichTextEditor/Components/BubbleMenu.js +29 -26
- package/dist/RichTextEditor/Components/ColorPicker.d.ts +4 -0
- package/dist/RichTextEditor/Components/ColorPicker.js +37 -0
- package/dist/RichTextEditor/Components/index.d.ts +1 -0
- package/dist/RichTextEditor/Components/index.js +1 -0
- package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
- package/dist/RichTextEditor/RichTextEditor.js +83 -86
- package/dist/RichTextEditor/Toolbar/ControlsGroup.d.ts +1 -3
- package/dist/RichTextEditor/Toolbar/Toolbar.d.ts +1 -1
- package/dist/RichTextEditor/Toolbar/Toolbar.js +10 -14
- package/dist/SelectBox/SelectBox.d.ts +1 -1
- package/dist/SelectBox/SelectBox.js +133 -92
- package/dist/SelectBox/types.d.ts +8 -5
- package/dist/Switch/Switch.js +4 -4
- package/dist/Table/ActionButton.d.ts +1 -3
- package/dist/Table/ActionCell.d.ts +1 -3
- package/dist/Table/SelectionCell.d.ts +1 -3
- package/dist/Table/StaticRows.d.ts +2 -2
- package/dist/Table/Table.d.ts +1 -2
- package/dist/Table/Table.js +9 -13
- package/dist/Table/TableComponents.d.ts +2 -6
- package/dist/Table/TableComponents.js +0 -5
- package/dist/Table/TableHeader.js +8 -2
- package/dist/Table/TableMenu/TableMenu.js +12 -10
- package/dist/Table/TableProvider.js +36 -30
- package/dist/Table/TableRow.js +5 -2
- package/dist/Table/VirtualIzedRows.d.ts +2 -2
- package/dist/Table/VirtualIzedRows.js +12 -10
- package/dist/Table/index.d.ts +1 -2
- package/dist/Table/index.js +1 -2
- package/dist/Table/types.d.ts +23 -3
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +180 -92
- package/dist/TagBox/TagBoxStyles.d.ts +1 -3
- package/dist/TagBox/types.d.ts +4 -2
- package/dist/TextArea/TextArea.d.ts +1 -3
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/theme/getTheme.d.ts +1 -1
- package/package.json +11 -5
- package/dist/RichTextEditor/Components/DefaultColorIcon.d.ts +0 -4
- package/dist/RichTextEditor/Components/DefaultColorIcon.js +0 -7
- package/dist/Table/Column.d.ts +0 -3
- package/dist/Table/Column.js +0 -5
|
@@ -36,6 +36,15 @@ export const StyledInputContainer = styled.div `
|
|
|
36
36
|
if (typeof width === "number")
|
|
37
37
|
return `${width}px`;
|
|
38
38
|
}};
|
|
39
|
+
|
|
40
|
+
&[data-disabled="true"] {
|
|
41
|
+
opacity: 0.5;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
|
|
44
|
+
> * {
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
39
48
|
`;
|
|
40
49
|
const StyledInnerItemContainer = styled.div `
|
|
41
50
|
overflow-y: auto;
|
|
@@ -143,12 +152,6 @@ const StyledItem = styled.div `
|
|
|
143
152
|
? "6px 16px"
|
|
144
153
|
: "2px 8px"};
|
|
145
154
|
|
|
146
|
-
// Mantine-Dev syntax, styles if the item is disabled
|
|
147
|
-
&[data-disabled] {
|
|
148
|
-
color: ${(props) => props.theme.palette.text.secondary};
|
|
149
|
-
pointer-events: "none";
|
|
150
|
-
}
|
|
151
|
-
|
|
152
155
|
&:hover {
|
|
153
156
|
background-color: ${(props) => props.theme.palette.action.hover};
|
|
154
157
|
color: ${(props) => props.theme.palette.text.primary};
|
|
@@ -159,15 +162,78 @@ const StyledItem = styled.div `
|
|
|
159
162
|
background-color: ${(props) => props.theme.palette.divider};
|
|
160
163
|
color: ${(props) => props.theme.palette.text.primary};
|
|
161
164
|
}
|
|
165
|
+
|
|
166
|
+
&[data-disabled] {
|
|
167
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
168
|
+
opacity: 0.5;
|
|
169
|
+
pointer-events: none;
|
|
170
|
+
}
|
|
162
171
|
`;
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
* Attempts to resolve the value to an Option object
|
|
175
|
+
* if the value is a string, it will attempt to find the corresponding Option object
|
|
176
|
+
* if the value is an Option object, it will attempt to find the corresponding Option object
|
|
177
|
+
* if the value is not found, it will return the value as is so that custom values can be displayed without a lookup
|
|
178
|
+
*/
|
|
179
|
+
const resolveValue = (value, data) => {
|
|
180
|
+
let foundOption;
|
|
181
|
+
if (value === undefined)
|
|
182
|
+
return undefined;
|
|
183
|
+
if (value === null)
|
|
184
|
+
return null;
|
|
185
|
+
if (typeof value === "string") {
|
|
186
|
+
foundOption = data.find((item) => item.value === value);
|
|
187
|
+
}
|
|
188
|
+
else if (typeof value === "number") {
|
|
189
|
+
foundOption = data.find((item) => item.value === value);
|
|
190
|
+
}
|
|
191
|
+
else if (typeof value === "object") {
|
|
192
|
+
foundOption = data.find((item) => item.value == value.value);
|
|
193
|
+
}
|
|
194
|
+
if (foundOption)
|
|
195
|
+
return foundOption;
|
|
196
|
+
if (typeof value === "string") {
|
|
197
|
+
return { value, label: value };
|
|
198
|
+
}
|
|
199
|
+
if (typeof value === "number") {
|
|
200
|
+
return { value, label: value.toString() };
|
|
201
|
+
}
|
|
202
|
+
return value;
|
|
203
|
+
};
|
|
163
204
|
const SelectBox = styled(({ className, data = [], placeholder = "Select...", arrow = true, onChange, onSearch, searchFn, onScroll, loading, defaultValue, value, onItemAdded, size = "sm", variant = "outlined", width = "100%", allowCustomValue = false, searchable = false, clearable = false, label, description, required = false, error, openOnFocus = true, renderOption, actionComponent, focused, grouped, OptionTooltip, // Custom tooltip component for search menu items
|
|
164
|
-
DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
165
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
205
|
+
DropDownProps = {}, debounceTime = 150, sort = false, disabled = false, }) => {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
166
207
|
const theme = useTheme();
|
|
167
208
|
const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
|
|
168
|
-
const
|
|
209
|
+
const isControlled = value !== undefined;
|
|
210
|
+
const resolvedOptions = data.map((item) => ({
|
|
211
|
+
value: isObjectArray ? item.value : item,
|
|
212
|
+
label: isObjectArray ? item.label : item,
|
|
213
|
+
group: isObjectArray ? item.group : undefined,
|
|
214
|
+
disabled: isObjectArray ? item.disabled : undefined,
|
|
215
|
+
data: isObjectArray ? item.data : undefined,
|
|
216
|
+
}));
|
|
217
|
+
/**
|
|
218
|
+
* Get the correct option if the default value is a string
|
|
219
|
+
* otherwise, use the default value as is
|
|
220
|
+
* this allows setting the value with a string or Option object
|
|
221
|
+
*/
|
|
222
|
+
const resolvedDefaultValue = resolveValue(defaultValue, resolvedOptions);
|
|
223
|
+
/**
|
|
224
|
+
* Get the correct option if the value is a string
|
|
225
|
+
* otherwise, use the value as is
|
|
226
|
+
* this allows setting the value with a string or Option object
|
|
227
|
+
*/
|
|
228
|
+
const resolvedValue = resolveValue(value, resolvedOptions);
|
|
229
|
+
const [valueState, setValueState] = useState(resolvedDefaultValue);
|
|
230
|
+
/**
|
|
231
|
+
* Get the correct value based on whether the component is controlled or not
|
|
232
|
+
* if controlled, use the controlled value, otherwise use the resolved value
|
|
233
|
+
*/
|
|
234
|
+
const _value = isControlled ? resolvedValue : valueState;
|
|
235
|
+
const [inputValue, setInputValue] = useState(typeof _value === "object" ? (_value === null || _value === void 0 ? void 0 : _value.label) || "" : _value || "");
|
|
169
236
|
const [isOpen, setIsOpen] = useState(false);
|
|
170
|
-
const [selected, setSelected] = useState(null);
|
|
171
237
|
const [searchValue, setSearchValue] = useState("");
|
|
172
238
|
const [customItems, setCustomItems] = useState([]);
|
|
173
239
|
const [placement, setPlacement] = useState("bottom-start");
|
|
@@ -176,18 +242,17 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
176
242
|
const containerRef = useRef(null);
|
|
177
243
|
const scrollContainerRef = useRef(null);
|
|
178
244
|
// Remove duplicates from search dropdown data
|
|
179
|
-
const uniqueItems = Array.from(new Map([...
|
|
180
|
-
isObjectArray ? item.value : item,
|
|
181
|
-
item,
|
|
182
|
-
])).values());
|
|
245
|
+
const uniqueItems = Array.from(new Map([...resolvedOptions, ...customItems].map((item) => [item.value, item])).values());
|
|
183
246
|
// search filter for dropdown items
|
|
184
247
|
const filteredItems = uniqueItems
|
|
185
248
|
.filter((item) => {
|
|
186
|
-
|
|
187
|
-
return
|
|
249
|
+
var _a;
|
|
250
|
+
return (_a = item.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchValue.toLowerCase());
|
|
188
251
|
})
|
|
189
252
|
.sort((a, b) => {
|
|
190
253
|
if (grouped) {
|
|
254
|
+
if (!a.group || !b.group)
|
|
255
|
+
return 0;
|
|
191
256
|
const aValue = a.group;
|
|
192
257
|
const bValue = b.group;
|
|
193
258
|
return aValue.localeCompare(bValue);
|
|
@@ -195,8 +260,8 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
195
260
|
if (!sort)
|
|
196
261
|
return 0;
|
|
197
262
|
// Secondary sort by label/value to ensure consistent ordering
|
|
198
|
-
const aLabel =
|
|
199
|
-
const bLabel =
|
|
263
|
+
const aLabel = a.label;
|
|
264
|
+
const bLabel = b.label;
|
|
200
265
|
return aLabel.localeCompare(bLabel);
|
|
201
266
|
});
|
|
202
267
|
const groupedItems = grouped
|
|
@@ -242,8 +307,8 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
242
307
|
};
|
|
243
308
|
const handleInputChange = (e) => {
|
|
244
309
|
const value = e.target.value;
|
|
310
|
+
setInputValue(value || "");
|
|
245
311
|
debouncedHandleChange(value);
|
|
246
|
-
setInputValue(value);
|
|
247
312
|
setIsOpen(true);
|
|
248
313
|
};
|
|
249
314
|
const debouncedHandleChange = useDebouncedCallback((value) => {
|
|
@@ -254,9 +319,7 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
254
319
|
setSearchValue(value);
|
|
255
320
|
}
|
|
256
321
|
if (allowCustomValue && value) {
|
|
257
|
-
const existingItem =
|
|
258
|
-
? item.label.toLowerCase() === value.toLowerCase()
|
|
259
|
-
: item.toLowerCase() === value.toLowerCase());
|
|
322
|
+
const existingItem = resolvedOptions.find((item) => item.value.toLowerCase() === value.toLowerCase());
|
|
260
323
|
if (existingItem)
|
|
261
324
|
handleChangeSelection(existingItem);
|
|
262
325
|
else
|
|
@@ -265,23 +328,21 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
265
328
|
update();
|
|
266
329
|
}, debounceTime);
|
|
267
330
|
const handleBlur = () => {
|
|
268
|
-
var _a, _b;
|
|
269
331
|
// add custom value if prop is set
|
|
270
332
|
// and input value is not empty
|
|
271
333
|
// and no item is selected
|
|
272
|
-
if (allowCustomValue && !
|
|
273
|
-
handleAddItem(
|
|
334
|
+
if (allowCustomValue && !_value && !!inputValue) {
|
|
335
|
+
handleAddItem(inputValue);
|
|
274
336
|
}
|
|
275
337
|
setIsOpen(false);
|
|
276
338
|
setSearchValue("");
|
|
277
339
|
};
|
|
278
340
|
const handleClear = (e) => {
|
|
279
341
|
e.preventDefault();
|
|
280
|
-
|
|
281
|
-
inputRef.current.value = "";
|
|
342
|
+
setInputValue("");
|
|
282
343
|
setIsOpen(false);
|
|
283
344
|
handleChangeSelection(null);
|
|
284
|
-
|
|
345
|
+
!isControlled && setValueState(null);
|
|
285
346
|
setSearchValue("");
|
|
286
347
|
searchFn === null || searchFn === void 0 ? void 0 : searchFn("");
|
|
287
348
|
update();
|
|
@@ -295,23 +356,21 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
295
356
|
setIsOpen(false);
|
|
296
357
|
};
|
|
297
358
|
const handleChangeSelection = useCallback((option) => {
|
|
298
|
-
|
|
299
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
359
|
+
!isControlled && setValueState(option);
|
|
360
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(option === null || option === void 0 ? void 0 : option.value, option);
|
|
300
361
|
}, [onChange]);
|
|
301
362
|
const handleAddItem = useCallback((newItem) => {
|
|
302
|
-
const newValue =
|
|
303
|
-
? { label: newItem, value: newItem }
|
|
304
|
-
: newItem;
|
|
363
|
+
const newValue = { label: newItem, value: newItem };
|
|
305
364
|
setCustomItems((prev) => [...prev, newValue]);
|
|
306
365
|
handleChangeSelection(newValue);
|
|
307
366
|
onItemAdded === null || onItemAdded === void 0 ? void 0 : onItemAdded(newValue);
|
|
308
367
|
}, [onItemAdded, isObjectArray, handleChangeSelection]);
|
|
309
368
|
const handleKeyDown = (e) => {
|
|
310
|
-
var _a
|
|
311
|
-
const currentInputValue =
|
|
369
|
+
var _a;
|
|
370
|
+
const currentInputValue = inputValue;
|
|
312
371
|
// Escape key
|
|
313
372
|
if (e.key === "Escape") {
|
|
314
|
-
const reference = (
|
|
373
|
+
const reference = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
|
|
315
374
|
reference === null || reference === void 0 ? void 0 : reference.blur();
|
|
316
375
|
setSearchValue("");
|
|
317
376
|
update();
|
|
@@ -326,52 +385,56 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
326
385
|
// Arrow down
|
|
327
386
|
if (e.key === "ArrowDown") {
|
|
328
387
|
e.preventDefault();
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
388
|
+
let newItem = filteredItems[0]; // Loop back to the first item
|
|
389
|
+
// Find the index of the currently selected item
|
|
390
|
+
const index = filteredItems.findIndex((item) => item.value === (_value === null || _value === void 0 ? void 0 : _value.value));
|
|
391
|
+
// find next available item
|
|
392
|
+
const nextItem = filteredItems.find((item, i) => i > index && !item.disabled);
|
|
393
|
+
if (nextItem) {
|
|
394
|
+
newItem = nextItem;
|
|
395
|
+
}
|
|
396
|
+
else if (index < filteredItems.length - 1) {
|
|
397
|
+
newItem = filteredItems[index + 1];
|
|
398
|
+
}
|
|
399
|
+
!isControlled && setValueState(newItem);
|
|
400
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newItem.value, newItem);
|
|
340
401
|
return;
|
|
341
402
|
}
|
|
342
403
|
// Arrow up
|
|
343
404
|
if (e.key === "ArrowUp") {
|
|
344
405
|
e.preventDefault();
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
406
|
+
let newItem = filteredItems[filteredItems.length - 1]; // Loop back to the last item
|
|
407
|
+
// Find the index of the currently selected item
|
|
408
|
+
const index = filteredItems.findIndex((item) => item.value === (_value === null || _value === void 0 ? void 0 : _value.value));
|
|
409
|
+
// find previous available item
|
|
410
|
+
const prevItem = filteredItems
|
|
411
|
+
.slice(0, index)
|
|
412
|
+
.reverse()
|
|
413
|
+
.find((item) => !item.disabled);
|
|
414
|
+
if (prevItem) {
|
|
415
|
+
newItem = prevItem;
|
|
416
|
+
}
|
|
417
|
+
else if (index > 0) {
|
|
418
|
+
newItem = filteredItems[index - 1];
|
|
419
|
+
}
|
|
420
|
+
!isControlled && setValueState(newItem);
|
|
421
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newItem.value, newItem);
|
|
356
422
|
return;
|
|
357
423
|
}
|
|
358
424
|
// Tab key
|
|
359
425
|
if (e.key === "Tab") {
|
|
360
|
-
if (allowCustomValue && !
|
|
426
|
+
if (allowCustomValue && !_value && !!currentInputValue) {
|
|
361
427
|
handleAddItem(currentInputValue);
|
|
362
428
|
setSearchValue("");
|
|
363
429
|
}
|
|
364
|
-
else if (!
|
|
430
|
+
else if (!_value) {
|
|
365
431
|
// clear input
|
|
366
|
-
|
|
367
|
-
inputRef.current.value = "";
|
|
368
|
-
}
|
|
432
|
+
setInputValue("");
|
|
369
433
|
}
|
|
370
434
|
setSearchValue("");
|
|
371
435
|
setIsOpen(false);
|
|
372
436
|
return;
|
|
373
437
|
}
|
|
374
|
-
// setSelected(null); // Reset selected value when input value changes
|
|
375
438
|
};
|
|
376
439
|
const handleFocus = () => {
|
|
377
440
|
if (openOnFocus) {
|
|
@@ -407,26 +470,10 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
407
470
|
document.addEventListener("click", close);
|
|
408
471
|
return () => document.removeEventListener("click", close);
|
|
409
472
|
}, [refs.floating, refs.reference, handleBlur]);
|
|
410
|
-
// Handle default value
|
|
411
|
-
useEffect(() => {
|
|
412
|
-
if (defaultValue) {
|
|
413
|
-
const isOption = defaultValue.value !== undefined;
|
|
414
|
-
const searchPattern = isOption
|
|
415
|
-
? defaultValue.value
|
|
416
|
-
: defaultValue;
|
|
417
|
-
setSelected(data.find((item) => isObjectArray
|
|
418
|
-
? item.value === searchPattern
|
|
419
|
-
: item === searchPattern) || null);
|
|
420
|
-
}
|
|
421
|
-
}, [data, defaultValue, isObjectArray]);
|
|
422
473
|
// handle input value change
|
|
423
474
|
useEffect(() => {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
? selected.label
|
|
427
|
-
: selected;
|
|
428
|
-
}
|
|
429
|
-
}, [selected]);
|
|
475
|
+
setInputValue((_value === null || _value === void 0 ? void 0 : _value.label) || "");
|
|
476
|
+
}, [_value]);
|
|
430
477
|
// handle scroll item into view
|
|
431
478
|
useEffect(() => {
|
|
432
479
|
var _a, _b;
|
|
@@ -434,7 +481,7 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
434
481
|
if (item) {
|
|
435
482
|
item.scrollIntoView({ block: "nearest" });
|
|
436
483
|
}
|
|
437
|
-
}, [
|
|
484
|
+
}, [_value]);
|
|
438
485
|
// make calls to onSearch callback
|
|
439
486
|
useEffect(() => {
|
|
440
487
|
if (searchable) {
|
|
@@ -456,7 +503,7 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
456
503
|
setDropDownHeight(bottomHeight);
|
|
457
504
|
};
|
|
458
505
|
}, [topHeight, bottomHeight, isOpen]);
|
|
459
|
-
return (_jsxs("div", { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: refs.setReference, onMouseDown: () => setIsOpen(true), width: width, onKeyDown: handleKeyDown, "data-open": isOpen, children: [_jsx(Input, { ref: inputRef, onChange: handleInputChange, onFocus: handleFocus, autoFocus: focused, placeholder: placeholder, size: size, readOnly: !searchable, "data-button-right": arrow || clearable, style: isOpen ? { borderColor: theme.palette.primary.main } : {} }), clearable && (
|
|
506
|
+
return (_jsxs("div", { className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { ref: refs.setReference, onMouseDown: () => setIsOpen(true), width: width, onKeyDown: handleKeyDown, "data-open": isOpen, "data-disabled": disabled, children: [_jsx(Input, { ref: inputRef, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, autoFocus: focused, placeholder: placeholder, size: size, readOnly: !searchable && !allowCustomValue, "data-button-right": arrow || clearable, style: isOpen ? { borderColor: theme.palette.primary.main } : {} }), clearable && (_value || !!inputValue) ? (_jsx(ClearButton, { className: "input-btn", onClick: handleClear, onMouseDown: (e) => {
|
|
460
507
|
e.preventDefault();
|
|
461
508
|
e.stopPropagation();
|
|
462
509
|
} })) : arrow ? (_jsx(ArrowButton, { onClick: (e) => {
|
|
@@ -476,16 +523,10 @@ DropDownProps = {}, debounceTime = 150, sort = false, }) => {
|
|
|
476
523
|
: "",
|
|
477
524
|
}, variant: variant, "data-empty": filteredItems.length === 0 }, DropDownProps, { children: [loading && _jsx(Loader, {}), !loading && actionComponent && (_jsx(ActionMenu, { children: actionComponent })), !loading && filteredItems.length === 0 && (_jsx(EmptyComponent, { children: "No Items" })), !loading && (_jsx(StyledInnerItemContainer, { ref: scrollContainerRef, "data-scroll-active": scrollActive, onScroll: onScroll, children: grouped
|
|
478
525
|
? groups.map((group, index) => (_jsxs("div", { children: [_jsx(GroupTitle, { size: size, children: group.label }), group.items.map((item, index) => {
|
|
479
|
-
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected":
|
|
480
|
-
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
481
|
-
item.value
|
|
482
|
-
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
526
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": (_value === null || _value === void 0 ? void 0 : _value.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
|
|
483
527
|
})] }, group.label)))
|
|
484
528
|
: filteredItems.map((item, index) => {
|
|
485
|
-
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected":
|
|
486
|
-
? (selected === null || selected === void 0 ? void 0 : selected.value) ===
|
|
487
|
-
(item === null || item === void 0 ? void 0 : item.value)
|
|
488
|
-
: selected === item, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || (_jsx(_Fragment, { children: (item === null || item === void 0 ? void 0 : item.label) || item })) }, index) }, index));
|
|
529
|
+
return (_jsx(Tooltip, { content: OptionTooltip ? (_jsx(OptionTooltip, { data: item.data })) : null, side: "left", children: _jsx(StyledItem, { className: "mfFloatingItem", onClick: (e) => handleItemClick(e, item), "data-selected": (_value === null || _value === void 0 ? void 0 : _value.value) === item.value, "data-disabled": item.disabled, size: size, children: (renderOption === null || renderOption === void 0 ? void 0 : renderOption(item)) || _jsx(_Fragment, { children: item === null || item === void 0 ? void 0 : item.label }) }, index) }, index));
|
|
489
530
|
}) }))] })) }) }))] }));
|
|
490
531
|
}) `
|
|
491
532
|
position: relative;
|
|
@@ -3,12 +3,14 @@ export type Option = {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: any;
|
|
5
5
|
group?: string;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
data?: any;
|
|
7
8
|
};
|
|
9
|
+
export type Value = number | boolean | string | Option;
|
|
8
10
|
export interface SelectBoxProps {
|
|
9
11
|
className?: string;
|
|
10
|
-
defaultValue?: Option | string;
|
|
11
|
-
value?: Option | string;
|
|
12
|
+
defaultValue?: Option | string | number;
|
|
13
|
+
value?: Option | string | number;
|
|
12
14
|
data?: Option[] | string[];
|
|
13
15
|
placeholder?: string;
|
|
14
16
|
arrow?: boolean;
|
|
@@ -25,18 +27,19 @@ export interface SelectBoxProps {
|
|
|
25
27
|
required?: boolean;
|
|
26
28
|
error?: string;
|
|
27
29
|
openOnFocus?: boolean;
|
|
28
|
-
actionComponent?:
|
|
30
|
+
actionComponent?: React.ReactNode;
|
|
29
31
|
focused?: boolean;
|
|
30
32
|
DropDownProps?: any;
|
|
31
33
|
debounceTime?: number;
|
|
32
34
|
sort?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
33
36
|
renderOption?: (item: Option | string) => React.ReactNode;
|
|
34
37
|
OptionTooltip?: (props: {
|
|
35
38
|
data: any;
|
|
36
|
-
}) =>
|
|
39
|
+
}) => React.ReactNode;
|
|
37
40
|
onChange?: (value: any, item: any) => void;
|
|
38
41
|
onScroll?: (e: any) => void;
|
|
39
42
|
onSearch?: (value: string) => void;
|
|
40
43
|
searchFn?: (value: string) => void;
|
|
41
|
-
onItemAdded?: (item:
|
|
44
|
+
onItemAdded?: (item: Option | string) => void;
|
|
42
45
|
}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -35,9 +35,9 @@ const StyledRoot = styled(RadixSwitch.Root) `
|
|
|
35
35
|
: size === "sm"
|
|
36
36
|
? "35px"
|
|
37
37
|
: size === "md"
|
|
38
|
-
? "
|
|
38
|
+
? "41px"
|
|
39
39
|
: size === "lg"
|
|
40
|
-
? "
|
|
40
|
+
? "53px"
|
|
41
41
|
: size === "xl"
|
|
42
42
|
? "70px"
|
|
43
43
|
: "26px"};
|
|
@@ -53,9 +53,9 @@ const StyledRoot = styled(RadixSwitch.Root) `
|
|
|
53
53
|
: size === "sm"
|
|
54
54
|
? "2px"
|
|
55
55
|
: size === "md"
|
|
56
|
-
? "
|
|
56
|
+
? "2px 9px 2px 3px"
|
|
57
57
|
: size === "lg"
|
|
58
|
-
? "
|
|
58
|
+
? "2px 9px 2px 3px"
|
|
59
59
|
: size === "xl"
|
|
60
60
|
? "2px 4px"
|
|
61
61
|
: "2px"};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const ActionButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<
|
|
2
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
3
|
-
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
1
|
+
declare const ActionButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
2
|
export default ActionButton;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const ActionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<
|
|
2
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
-
}, never>> & string;
|
|
1
|
+
declare const ActionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("./types").TDProps> & import("./types").TDProps, never>> & string;
|
|
4
2
|
export default ActionCell;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const SelectionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<
|
|
2
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
-
}, never>> & string;
|
|
1
|
+
declare const SelectionCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("./types").TDProps> & import("./types").TDProps, never>> & string;
|
|
4
2
|
export default SelectionCell;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const StaticRows: React.FC<{
|
|
2
|
-
targetElm: React.
|
|
3
|
-
listElm: React.
|
|
2
|
+
targetElm: React.MutableRefObject<HTMLDivElement | null>;
|
|
3
|
+
listElm: React.MutableRefObject<HTMLDivElement | null>;
|
|
4
4
|
}>;
|
|
5
5
|
export default StaticRows;
|
package/dist/Table/Table.d.ts
CHANGED
package/dist/Table/Table.js
CHANGED
|
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
14
|
-
import Column from "./Column";
|
|
15
14
|
import { useOverlayScrollbars } from "overlayscrollbars-react";
|
|
16
15
|
import { StyledTable } from "./TableComponents";
|
|
17
16
|
import TableHeader from "./TableHeader";
|
|
@@ -32,21 +31,21 @@ const StyledTableContainer = styled.div `
|
|
|
32
31
|
flex: 1 1 auto;
|
|
33
32
|
`;
|
|
34
33
|
const TableContent = () => {
|
|
35
|
-
const { columnState, tableElement, headerRowElm, tableDimensions, targetElm, listElm, rowHeight, headerRowHeight, compactState, virtualized, loading, } = useTable();
|
|
34
|
+
const { columnState, tableElement, tableHeight, tableMaxHeight, tableMinHeight, headerRowElm, tableDimensions, targetElm, listElm, rowHeight, headerRowHeight, compactState, virtualized, loading, } = useTable();
|
|
36
35
|
const visibleColumnCount = columnState.filter((column) => column.visible === true).length;
|
|
37
|
-
return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), _jsxs(StyledTable, { className: "mfui-table",
|
|
36
|
+
return (_jsxs(StyledTableContainer, { children: [_jsx(TableMenu, {}), _jsxs(StyledTable, { className: "mfui-table", style: {
|
|
37
|
+
height: tableHeight || "100%",
|
|
38
|
+
maxHeight: tableMaxHeight,
|
|
39
|
+
minHeight: tableMinHeight,
|
|
40
|
+
}, ref: tableElement, "data-compact": compactState, children: [_jsx(LoadingIndicator, { visible: loading }), _jsx(TableHeader, { headerRowElm: headerRowElm }), visibleColumnCount === 0 && _jsx(_Fragment, {}), virtualized === true ? (_jsx(VirtualizedRows, { tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm, rowHeight: rowHeight, headerRowHeight: headerRowHeight })) : (_jsx(StaticRows, { targetElm: targetElm, listElm: listElm }))] })] }));
|
|
38
41
|
};
|
|
39
|
-
const Table = (_a) => {
|
|
40
|
-
var { data,
|
|
42
|
+
export const Table = (_a) => {
|
|
43
|
+
var { data, columnProps } = _a, props = __rest(_a, ["data", "columnProps"]) // pass through props straight to table context
|
|
41
44
|
;
|
|
42
45
|
const tableElement = useRef(null);
|
|
43
46
|
const targetElm = useRef(null);
|
|
44
47
|
const listElm = useRef(null);
|
|
45
48
|
const headerRowElm = useRef(null);
|
|
46
|
-
// check if children is array and convert if not
|
|
47
|
-
if (!Array.isArray(children)) {
|
|
48
|
-
children = [children];
|
|
49
|
-
}
|
|
50
49
|
const [tableDimensions, setTableDimensions] = useState({
|
|
51
50
|
width: 0,
|
|
52
51
|
height: 0,
|
|
@@ -111,8 +110,5 @@ const Table = (_a) => {
|
|
|
111
110
|
};
|
|
112
111
|
}, []);
|
|
113
112
|
const __data = useMemo(() => data === null || data === void 0 ? void 0 : data.map((d, i) => (Object.assign(Object.assign({}, d), { __key: shortUUID.generate(), __index: i }))), [data]);
|
|
114
|
-
return (_jsx(TableProvider, Object.assign({ columns: children
|
|
115
|
-
.filter((child) => child.type === Column)
|
|
116
|
-
.map((child) => child.props), data: __data, tableElement: tableElement, headerRowElm: headerRowElm, tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm }, props, { children: _jsx(TableContent, {}) })));
|
|
113
|
+
return (_jsx(TableProvider, Object.assign({ columns: columnProps, data: __data, tableElement: tableElement, headerRowElm: headerRowElm, tableDimensions: tableDimensions, targetElm: targetElm, listElm: listElm }, props, { children: _jsx(TableContent, {}) })));
|
|
117
114
|
};
|
|
118
|
-
export default Table;
|
|
@@ -2,13 +2,9 @@ import { TDProps, TRProps } from "./types";
|
|
|
2
2
|
export declare const THead: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const TBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const TR: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TRProps>> & string;
|
|
5
|
-
export declare const THR: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<
|
|
6
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
-
}, never>> & string;
|
|
5
|
+
export declare const THR: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TRProps> & TRProps, never>> & string;
|
|
8
6
|
export declare const TD: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TDProps>> & string;
|
|
9
|
-
export declare const TH: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<
|
|
10
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
-
}, never>> & string;
|
|
7
|
+
export declare const TH: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof TDProps> & TDProps, never>> & string;
|
|
12
8
|
export declare const InnerCellContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
9
|
export declare const TableViewPort: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
14
10
|
export declare const TableListElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -116,15 +116,10 @@ export const TableWrapper = styled.div `
|
|
|
116
116
|
`;
|
|
117
117
|
export const StyledTable = styled.div `
|
|
118
118
|
position: relative;
|
|
119
|
-
flex: 1 1 auto;
|
|
120
119
|
overflow: hidden;
|
|
121
120
|
display: flex;
|
|
122
121
|
flex-direction: column;
|
|
123
122
|
|
|
124
|
-
// border-left: 1px solid ${({ theme }) => theme.palette.divider};
|
|
125
|
-
// border-right: 1px solid ${({ theme }) => theme.palette.divider};
|
|
126
|
-
// border-bottom: 1px solid ${({ theme }) => theme.palette.divider};
|
|
127
|
-
|
|
128
123
|
&[data-compact="true"] .mfui-tr,
|
|
129
124
|
&[data-compact="true"] .mfui-thr,
|
|
130
125
|
&[data-compact="true"] .mfui-td {
|
|
@@ -8,6 +8,12 @@ import CheckBox from "../CheckBox";
|
|
|
8
8
|
import { ArrowDownIcon, ArrowUpIcon } from "lucide-react";
|
|
9
9
|
import resolveColumnReorder from "./Utils/resolveColumnReorder";
|
|
10
10
|
import TableDefaults from "./TableDefaults";
|
|
11
|
+
import styled from "styled-components";
|
|
12
|
+
const StyledCaption = styled.span `
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
`;
|
|
11
17
|
const TableHeader = ({ headerRowElm }) => {
|
|
12
18
|
var _a;
|
|
13
19
|
const { columnState, sortState, setColumnState, onColumnResize, handleColumnReorder, enableColumnReorder, handleColumnHeaderClick, enableColumnResize, headerRowHeight, enableActionButton, enableSelection, selectionState, disableSelectAll, selectAllRows, clearSelections, compactState, } = useTable();
|
|
@@ -86,8 +92,8 @@ const TableHeader = ({ headerRowElm }) => {
|
|
|
86
92
|
// console.log("onResize", e);
|
|
87
93
|
}, onResizeFinished: (e) => {
|
|
88
94
|
handleResize(e);
|
|
89
|
-
} })), _jsxs(InnerCellContent, { className: "mfui inner-cell-content", children: [column.caption, (sortState === null || sortState === void 0 ? void 0 : sortState.dataField) === column.dataField &&
|
|
90
|
-
|
|
95
|
+
} })), _jsxs(InnerCellContent, { className: "mfui inner-cell-content", children: [_jsx(StyledCaption, { style: { flex: 1 }, children: column.caption }), _jsx(StyledCaption, { children: (sortState === null || sortState === void 0 ? void 0 : sortState.dataField) === column.dataField &&
|
|
96
|
+
(sortState.dir === "asc" ? (_jsx(ArrowUpIcon, { size: 14 })) : (_jsx(ArrowDownIcon, { size: 14 }))) })] })] }), column.columnId));
|
|
91
97
|
})] }) }));
|
|
92
98
|
};
|
|
93
99
|
export default TableHeader;
|