@helpwave/hightide 0.1.11 → 0.1.13
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/components/date/DatePicker.js +37 -7
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +37 -7
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimePicker.js +27 -6
- package/dist/components/date/TimePicker.js.map +1 -1
- package/dist/components/date/TimePicker.mjs +27 -6
- package/dist/components/date/TimePicker.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +36 -6
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +36 -6
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +16 -2
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +16 -2
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +42 -9
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +42 -9
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.js +1 -1
- package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs +1 -1
- package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js +1 -1
- package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs +1 -1
- package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +16 -2
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +16 -2
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.d.mts +6 -3
- package/dist/components/layout-and-navigation/Pagination.d.ts +6 -3
- package/dist/components/layout-and-navigation/Pagination.js +404 -19
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +404 -19
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +187 -67
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +183 -63
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +37 -5
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +37 -5
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js +2 -0
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs +2 -0
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +2 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +2 -0
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js +2 -0
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs +2 -0
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +9 -0
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +9 -0
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +16 -2
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +16 -2
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +16 -2
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +16 -2
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.d.mts +1 -0
- package/dist/components/modals/InputModal.d.ts +1 -0
- package/dist/components/modals/InputModal.js +196 -76
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +189 -69
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +203 -83
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +192 -72
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +206 -86
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +193 -73
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +17 -5
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +17 -5
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +182 -65
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +179 -62
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.js +194 -74
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +187 -67
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +182 -65
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +179 -62
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +12 -1
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +12 -1
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.js +194 -74
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +187 -67
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +43 -34
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +43 -34
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/FillerRowElement.d.mts +8 -0
- package/dist/components/table/FillerRowElement.d.ts +8 -0
- package/dist/components/table/FillerRowElement.js +36 -0
- package/dist/components/table/FillerRowElement.js.map +1 -0
- package/dist/components/table/FillerRowElement.mjs +12 -0
- package/dist/components/table/FillerRowElement.mjs.map +1 -0
- package/dist/components/table/Filter.d.mts +5 -0
- package/dist/components/table/Filter.d.ts +5 -0
- package/dist/components/table/Filter.js +41 -0
- package/dist/components/table/Filter.js.map +1 -0
- package/dist/components/table/Filter.mjs +17 -0
- package/dist/components/table/Filter.mjs.map +1 -0
- package/dist/components/table/Table.d.mts +41 -0
- package/dist/components/table/Table.d.ts +41 -0
- package/dist/components/table/Table.js +1549 -0
- package/dist/components/table/Table.js.map +1 -0
- package/dist/components/table/Table.mjs +1520 -0
- package/dist/components/table/Table.mjs.map +1 -0
- package/dist/components/table/TableCell.d.mts +9 -0
- package/dist/components/table/TableCell.d.ts +9 -0
- package/dist/components/table/TableCell.js +37 -0
- package/dist/components/table/TableCell.js.map +1 -0
- package/dist/components/table/TableCell.mjs +13 -0
- package/dist/components/table/TableCell.mjs.map +1 -0
- package/dist/components/table/TableFilterButton.d.mts +11 -0
- package/dist/components/table/TableFilterButton.d.ts +11 -0
- package/dist/components/table/TableFilterButton.js +888 -0
- package/dist/components/table/TableFilterButton.js.map +1 -0
- package/dist/components/table/TableFilterButton.mjs +852 -0
- package/dist/components/table/TableFilterButton.mjs.map +1 -0
- package/dist/components/table/TableSortButton.d.mts +15 -0
- package/dist/components/table/TableSortButton.d.ts +15 -0
- package/dist/components/table/TableSortButton.js +136 -0
- package/dist/components/table/TableSortButton.js.map +1 -0
- package/dist/components/table/TableSortButton.mjs +102 -0
- package/dist/components/table/TableSortButton.mjs.map +1 -0
- package/dist/components/user-action/Button.d.mts +20 -5
- package/dist/components/user-action/Button.d.ts +20 -5
- package/dist/components/user-action/Button.js +12 -3
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +11 -3
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +5 -4
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +5 -4
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +41 -9
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +41 -9
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Input.d.mts +27 -7
- package/dist/components/user-action/Input.d.ts +27 -7
- package/dist/components/user-action/Input.js +173 -64
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +172 -63
- package/dist/components/user-action/Input.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.js +195 -75
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +187 -67
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +26 -5
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +26 -5
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/Select.js +195 -75
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +187 -67
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.d.mts +3 -1
- package/dist/components/user-action/Textarea.d.ts +3 -1
- package/dist/components/user-action/Textarea.js +31 -33
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +31 -33
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/components/user-action/ToggleableInput.d.mts +3 -1
- package/dist/components/user-action/ToggleableInput.d.ts +3 -1
- package/dist/components/user-action/ToggleableInput.js +31 -33
- package/dist/components/user-action/ToggleableInput.js.map +1 -1
- package/dist/components/user-action/ToggleableInput.mjs +31 -33
- package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
- package/dist/css/globals.css +431 -186
- package/dist/css/uncompiled/globals.css +36 -493
- package/dist/css/uncompiled/textstyles.css +69 -0
- package/dist/css/uncompiled/theme/colors-basic.css +72 -0
- package/dist/css/uncompiled/theme/colors-component.css +143 -0
- package/dist/css/uncompiled/theme/colors-semantic.css +99 -0
- package/dist/css/uncompiled/theme/index.css +5 -0
- package/dist/css/uncompiled/theme/theme.css +0 -0
- package/dist/css/uncompiled/theme/variants.css +3 -0
- package/dist/css/uncompiled/utitlity/animation.css +111 -0
- package/dist/css/uncompiled/utitlity/borderradius.css +23 -0
- package/dist/css/uncompiled/utitlity/general.css +11 -0
- package/dist/css/uncompiled/utitlity/index.css +4 -0
- package/dist/css/uncompiled/utitlity/shadow.css +29 -0
- package/dist/hooks/useDelay.d.mts +11 -0
- package/dist/hooks/useDelay.d.ts +11 -0
- package/dist/hooks/useDelay.js +64 -0
- package/dist/hooks/useDelay.js.map +1 -0
- package/dist/hooks/useDelay.mjs +40 -0
- package/dist/hooks/useDelay.mjs.map +1 -0
- package/dist/hooks/useFocusManagement.d.mts +9 -0
- package/dist/hooks/useFocusManagement.d.ts +9 -0
- package/dist/hooks/useFocusManagement.js +84 -0
- package/dist/hooks/useFocusManagement.js.map +1 -0
- package/dist/hooks/useFocusManagement.mjs +60 -0
- package/dist/hooks/useFocusManagement.mjs.map +1 -0
- package/dist/hooks/useFocusOnceVisible.d.mts +5 -0
- package/dist/hooks/useFocusOnceVisible.d.ts +5 -0
- package/dist/hooks/useFocusOnceVisible.js +60 -0
- package/dist/hooks/useFocusOnceVisible.js.map +1 -0
- package/dist/hooks/useFocusOnceVisible.mjs +26 -0
- package/dist/hooks/useFocusOnceVisible.mjs.map +1 -0
- package/dist/hooks/useRerender.d.mts +5 -0
- package/dist/hooks/useRerender.d.ts +5 -0
- package/dist/hooks/useRerender.js +33 -0
- package/dist/hooks/useRerender.js.map +1 -0
- package/dist/hooks/useRerender.mjs +9 -0
- package/dist/hooks/useRerender.mjs.map +1 -0
- package/dist/hooks/useResizeCallbackWrapper.d.mts +11 -0
- package/dist/hooks/useResizeCallbackWrapper.d.ts +11 -0
- package/dist/hooks/useResizeCallbackWrapper.js +38 -0
- package/dist/hooks/useResizeCallbackWrapper.js.map +1 -0
- package/dist/hooks/useResizeCallbackWrapper.mjs +14 -0
- package/dist/hooks/useResizeCallbackWrapper.mjs.map +1 -0
- package/dist/index.d.mts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +1428 -860
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1370 -799
- package/dist/index.mjs.map +1 -1
- package/dist/localization/defaults/form.d.mts +1 -0
- package/dist/localization/defaults/form.d.ts +1 -0
- package/dist/localization/defaults/form.js +2 -0
- package/dist/localization/defaults/form.js.map +1 -1
- package/dist/localization/defaults/form.mjs +2 -0
- package/dist/localization/defaults/form.mjs.map +1 -1
- package/dist/util/array.d.mts +11 -5
- package/dist/util/array.d.ts +11 -5
- package/dist/util/array.js +25 -4
- package/dist/util/array.js.map +1 -1
- package/dist/util/array.mjs +25 -4
- package/dist/util/array.mjs.map +1 -1
- package/dist/util/date.js.map +1 -1
- package/dist/util/date.mjs.map +1 -1
- package/dist/util/resolveSetState.d.mts +5 -0
- package/dist/util/resolveSetState.d.ts +5 -0
- package/dist/util/resolveSetState.js +32 -0
- package/dist/util/resolveSetState.js.map +1 -0
- package/dist/util/resolveSetState.mjs +8 -0
- package/dist/util/resolveSetState.mjs.map +1 -0
- package/package.json +4 -2
- package/dist/components/layout-and-navigation/Table.d.mts +0 -99
- package/dist/components/layout-and-navigation/Table.d.ts +0 -99
- package/dist/components/layout-and-navigation/Table.js +0 -688
- package/dist/components/layout-and-navigation/Table.js.map +0 -1
- package/dist/components/layout-and-navigation/Table.mjs +0 -645
- package/dist/components/layout-and-navigation/Table.mjs.map +0 -1
- package/dist/hooks/useSaveDelay.d.mts +0 -6
- package/dist/hooks/useSaveDelay.d.ts +0 -6
- package/dist/hooks/useSaveDelay.js +0 -67
- package/dist/hooks/useSaveDelay.js.map +0 -1
- package/dist/hooks/useSaveDelay.mjs +0 -43
- package/dist/hooks/useSaveDelay.mjs.map +0 -1
|
@@ -0,0 +1,1520 @@
|
|
|
1
|
+
// src/components/table/Table.tsx
|
|
2
|
+
import { useCallback as useCallback3, useEffect as useEffect11, useMemo, useRef as useRef3, useState as useState9 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/layout-and-navigation/Pagination.tsx
|
|
5
|
+
import { ChevronFirst, ChevronLast, ChevronLeft, ChevronRight } from "lucide-react";
|
|
6
|
+
import clsx4 from "clsx";
|
|
7
|
+
|
|
8
|
+
// src/localization/LanguageProvider.tsx
|
|
9
|
+
import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
|
|
10
|
+
|
|
11
|
+
// src/hooks/useLocalStorage.ts
|
|
12
|
+
import { useCallback, useEffect, useState } from "react";
|
|
13
|
+
|
|
14
|
+
// src/localization/util.ts
|
|
15
|
+
var languages = ["en", "de"];
|
|
16
|
+
var languagesLocalNames = {
|
|
17
|
+
en: "English",
|
|
18
|
+
de: "Deutsch"
|
|
19
|
+
};
|
|
20
|
+
var DEFAULT_LANGUAGE = "en";
|
|
21
|
+
var LanguageUtil = {
|
|
22
|
+
languages,
|
|
23
|
+
DEFAULT_LANGUAGE,
|
|
24
|
+
languagesLocalNames
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/localization/LanguageProvider.tsx
|
|
28
|
+
import { jsx } from "react/jsx-runtime";
|
|
29
|
+
var LanguageContext = createContext({
|
|
30
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
31
|
+
setLanguage: (v) => v
|
|
32
|
+
});
|
|
33
|
+
var useLanguage = () => useContext(LanguageContext);
|
|
34
|
+
|
|
35
|
+
// src/localization/useTranslation.ts
|
|
36
|
+
var TranslationPluralCount = {
|
|
37
|
+
zero: 0,
|
|
38
|
+
one: 1,
|
|
39
|
+
two: 2,
|
|
40
|
+
few: 3,
|
|
41
|
+
many: 11,
|
|
42
|
+
other: -1
|
|
43
|
+
};
|
|
44
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
45
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
46
|
+
const { language: inferredLanguage } = useLanguage();
|
|
47
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
48
|
+
const usedTranslations = [...translations];
|
|
49
|
+
if (overwrite) {
|
|
50
|
+
usedTranslations.push(overwrite);
|
|
51
|
+
}
|
|
52
|
+
return (key, options) => {
|
|
53
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
54
|
+
try {
|
|
55
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
56
|
+
const translation = translations[i];
|
|
57
|
+
const localizedTranslation = translation[usedLanguage];
|
|
58
|
+
if (!localizedTranslation) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const value = localizedTranslation[key];
|
|
62
|
+
if (!value) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let forProcessing;
|
|
66
|
+
if (typeof value !== "string") {
|
|
67
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
68
|
+
forProcessing = value.zero;
|
|
69
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
70
|
+
forProcessing = value.one;
|
|
71
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
72
|
+
forProcessing = value.two;
|
|
73
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
74
|
+
forProcessing = value.few;
|
|
75
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
76
|
+
forProcessing = value.many;
|
|
77
|
+
} else {
|
|
78
|
+
forProcessing = value.other;
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
forProcessing = value;
|
|
82
|
+
}
|
|
83
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
84
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
85
|
+
});
|
|
86
|
+
return forProcessing;
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error(e);
|
|
90
|
+
}
|
|
91
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/localization/defaults/form.ts
|
|
96
|
+
var formTranslation = {
|
|
97
|
+
en: {
|
|
98
|
+
all: "All",
|
|
99
|
+
apply: "Apply",
|
|
100
|
+
back: "Back",
|
|
101
|
+
cancel: "Cancel",
|
|
102
|
+
change: "Change",
|
|
103
|
+
clear: "Clear",
|
|
104
|
+
close: "Close",
|
|
105
|
+
confirm: "Confirm",
|
|
106
|
+
decline: "Decline",
|
|
107
|
+
delete: "Delete",
|
|
108
|
+
discard: "Discard",
|
|
109
|
+
discardChanges: "Discard Changes",
|
|
110
|
+
done: "Done",
|
|
111
|
+
edit: "Edit",
|
|
112
|
+
enterText: "Enter text here",
|
|
113
|
+
error: "Error",
|
|
114
|
+
exit: "Exit",
|
|
115
|
+
fieldRequiredError: "This field is required.",
|
|
116
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
117
|
+
less: "Less",
|
|
118
|
+
loading: "Loading",
|
|
119
|
+
maxLengthError: "Maximum length exceeded.",
|
|
120
|
+
minLengthError: "Minimum length not met.",
|
|
121
|
+
more: "More",
|
|
122
|
+
next: "Next",
|
|
123
|
+
no: "No",
|
|
124
|
+
none: "None",
|
|
125
|
+
of: "of",
|
|
126
|
+
optional: "Optional",
|
|
127
|
+
pleaseWait: "Please wait...",
|
|
128
|
+
previous: "Previous",
|
|
129
|
+
remove: "Remove",
|
|
130
|
+
required: "Required",
|
|
131
|
+
reset: "Reset",
|
|
132
|
+
save: "Save",
|
|
133
|
+
search: "Search",
|
|
134
|
+
select: "Select",
|
|
135
|
+
selectOption: "Select an option",
|
|
136
|
+
show: "Show",
|
|
137
|
+
showMore: "Show more",
|
|
138
|
+
showLess: "Show less",
|
|
139
|
+
submit: "Submit",
|
|
140
|
+
success: "Success",
|
|
141
|
+
update: "Update",
|
|
142
|
+
unsavedChanges: "Unsaved Changes",
|
|
143
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
144
|
+
yes: "Yes"
|
|
145
|
+
},
|
|
146
|
+
de: {
|
|
147
|
+
all: "Alle",
|
|
148
|
+
apply: "Anwenden",
|
|
149
|
+
back: "Zur\xFCck",
|
|
150
|
+
cancel: "Abbrechen",
|
|
151
|
+
change: "\xC4ndern",
|
|
152
|
+
clear: "L\xF6schen",
|
|
153
|
+
close: "Schlie\xDFen",
|
|
154
|
+
confirm: "Best\xE4tigen",
|
|
155
|
+
decline: "Ablehnen",
|
|
156
|
+
delete: "L\xF6schen",
|
|
157
|
+
discard: "Verwerfen",
|
|
158
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
159
|
+
done: "Fertig",
|
|
160
|
+
edit: "Bearbeiten",
|
|
161
|
+
enterText: "Text hier eingeben",
|
|
162
|
+
error: "Fehler",
|
|
163
|
+
exit: "Beenden",
|
|
164
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
165
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
166
|
+
less: "Weniger",
|
|
167
|
+
loading: "L\xE4dt",
|
|
168
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
169
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
170
|
+
more: "Mehr",
|
|
171
|
+
next: "Weiter",
|
|
172
|
+
no: "Nein",
|
|
173
|
+
none: "Nichts",
|
|
174
|
+
of: "von",
|
|
175
|
+
optional: "Optional",
|
|
176
|
+
pleaseWait: "Bitte warten...",
|
|
177
|
+
previous: "Vorherige",
|
|
178
|
+
remove: "Entfernen",
|
|
179
|
+
required: "Erforderlich",
|
|
180
|
+
reset: "Zur\xFCcksetzen",
|
|
181
|
+
save: "Speichern",
|
|
182
|
+
search: "Suche",
|
|
183
|
+
select: "Select",
|
|
184
|
+
selectOption: "Option ausw\xE4hlen",
|
|
185
|
+
show: "Anzeigen",
|
|
186
|
+
showMore: "Mehr anzeigen",
|
|
187
|
+
showLess: "Weniger anzeigen",
|
|
188
|
+
submit: "Abschicken",
|
|
189
|
+
success: "Erfolg",
|
|
190
|
+
update: "Update",
|
|
191
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
192
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
193
|
+
yes: "Ja"
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/components/user-action/Input.tsx
|
|
198
|
+
import { forwardRef, useEffect as useEffect5, useImperativeHandle, useRef, useState as useState4 } from "react";
|
|
199
|
+
import clsx2 from "clsx";
|
|
200
|
+
|
|
201
|
+
// src/hooks/useDelay.ts
|
|
202
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
203
|
+
var defaultOptions = {
|
|
204
|
+
delay: 3e3,
|
|
205
|
+
disabled: false
|
|
206
|
+
};
|
|
207
|
+
function useDelay(options) {
|
|
208
|
+
const [timer, setTimer] = useState3(void 0);
|
|
209
|
+
const { delay, disabled } = {
|
|
210
|
+
...defaultOptions,
|
|
211
|
+
...options
|
|
212
|
+
};
|
|
213
|
+
const restartTimer = (onDelayFinish) => {
|
|
214
|
+
if (disabled) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
clearTimeout(timer);
|
|
218
|
+
setTimer(setTimeout(() => {
|
|
219
|
+
onDelayFinish();
|
|
220
|
+
}, delay));
|
|
221
|
+
};
|
|
222
|
+
const clearTimer = () => {
|
|
223
|
+
clearTimeout(timer);
|
|
224
|
+
};
|
|
225
|
+
useEffect3(() => {
|
|
226
|
+
return () => {
|
|
227
|
+
clearTimeout(timer);
|
|
228
|
+
};
|
|
229
|
+
}, [timer]);
|
|
230
|
+
useEffect3(() => {
|
|
231
|
+
if (disabled) {
|
|
232
|
+
clearTimeout(timer);
|
|
233
|
+
}
|
|
234
|
+
}, [disabled, timer]);
|
|
235
|
+
return { restartTimer, clearTimer };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/util/noop.ts
|
|
239
|
+
var noop = () => void 0;
|
|
240
|
+
|
|
241
|
+
// src/components/user-action/Label.tsx
|
|
242
|
+
import clsx from "clsx";
|
|
243
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
244
|
+
var styleMapping = {
|
|
245
|
+
labelSmall: "textstyle-label-sm",
|
|
246
|
+
labelMedium: "textstyle-label-md",
|
|
247
|
+
labelBig: "textstyle-label-lg"
|
|
248
|
+
};
|
|
249
|
+
var Label = ({
|
|
250
|
+
children,
|
|
251
|
+
name,
|
|
252
|
+
labelType = "labelSmall",
|
|
253
|
+
className,
|
|
254
|
+
...props
|
|
255
|
+
}) => {
|
|
256
|
+
return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// src/hooks/useFocusManagement.ts
|
|
260
|
+
import { useCallback as useCallback2 } from "react";
|
|
261
|
+
function useFocusManagement() {
|
|
262
|
+
const getFocusableElements = useCallback2(() => {
|
|
263
|
+
return Array.from(
|
|
264
|
+
document.querySelectorAll(
|
|
265
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
266
|
+
)
|
|
267
|
+
).filter(
|
|
268
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
269
|
+
);
|
|
270
|
+
}, []);
|
|
271
|
+
const getNextFocusElement = useCallback2(() => {
|
|
272
|
+
const elements = getFocusableElements();
|
|
273
|
+
if (elements.length === 0) {
|
|
274
|
+
return void 0;
|
|
275
|
+
}
|
|
276
|
+
let nextElement = elements[0];
|
|
277
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
278
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
279
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
280
|
+
}
|
|
281
|
+
return nextElement;
|
|
282
|
+
}, [getFocusableElements]);
|
|
283
|
+
const focusNext = useCallback2(() => {
|
|
284
|
+
const nextElement = getNextFocusElement();
|
|
285
|
+
nextElement?.focus();
|
|
286
|
+
}, [getNextFocusElement]);
|
|
287
|
+
const getPreviousFocusElement = useCallback2(() => {
|
|
288
|
+
const elements = getFocusableElements();
|
|
289
|
+
if (elements.length === 0) {
|
|
290
|
+
return void 0;
|
|
291
|
+
}
|
|
292
|
+
let previousElement = elements[0];
|
|
293
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
294
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
295
|
+
if (currentIndex === 0) {
|
|
296
|
+
previousElement = elements[elements.length - 1];
|
|
297
|
+
} else {
|
|
298
|
+
previousElement = elements[currentIndex - 1];
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return previousElement;
|
|
302
|
+
}, [getFocusableElements]);
|
|
303
|
+
const focusPrevious = useCallback2(() => {
|
|
304
|
+
const previousElement = getPreviousFocusElement();
|
|
305
|
+
if (previousElement) previousElement.focus();
|
|
306
|
+
}, [getPreviousFocusElement]);
|
|
307
|
+
return {
|
|
308
|
+
getFocusableElements,
|
|
309
|
+
getNextFocusElement,
|
|
310
|
+
getPreviousFocusElement,
|
|
311
|
+
focusNext,
|
|
312
|
+
focusPrevious
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/hooks/useFocusOnceVisible.ts
|
|
317
|
+
import React, { useEffect as useEffect4 } from "react";
|
|
318
|
+
var useFocusOnceVisible = (ref, disable = false) => {
|
|
319
|
+
const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
|
|
320
|
+
useEffect4(() => {
|
|
321
|
+
if (disable || hasUsedFocus) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
325
|
+
if (entry.isIntersecting && !hasUsedFocus) {
|
|
326
|
+
ref.current?.focus();
|
|
327
|
+
setHasUsedFocus(hasUsedFocus);
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
threshold: 0.1
|
|
331
|
+
});
|
|
332
|
+
if (ref.current) {
|
|
333
|
+
observer.observe(ref.current);
|
|
334
|
+
}
|
|
335
|
+
return () => observer.disconnect();
|
|
336
|
+
}, [disable, hasUsedFocus, ref]);
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// src/components/user-action/Input.tsx
|
|
340
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
341
|
+
var getInputClassName = ({ disabled = false, hasError = false }) => {
|
|
342
|
+
return clsx2(
|
|
343
|
+
"px-2 py-1.5 rounded-md border-2",
|
|
344
|
+
{
|
|
345
|
+
"bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
|
|
346
|
+
"bg-on-negative text-negative border-negative-border hover:border-negative-border-hover": !disabled && hasError,
|
|
347
|
+
"bg-disabled-background text-disabled-text border-disabled-border": disabled
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
var defaultEditCompleteOptions = {
|
|
352
|
+
onBlur: true,
|
|
353
|
+
afterDelay: true,
|
|
354
|
+
delay: 2500
|
|
355
|
+
};
|
|
356
|
+
var Input = forwardRef(function Input2({
|
|
357
|
+
id,
|
|
358
|
+
type = "text",
|
|
359
|
+
value,
|
|
360
|
+
label,
|
|
361
|
+
onChange = noop,
|
|
362
|
+
onChangeText = noop,
|
|
363
|
+
onEditCompleted,
|
|
364
|
+
className = "",
|
|
365
|
+
allowEnterComplete = true,
|
|
366
|
+
expanded = true,
|
|
367
|
+
autoFocus = false,
|
|
368
|
+
onBlur,
|
|
369
|
+
editCompleteOptions,
|
|
370
|
+
containerClassName,
|
|
371
|
+
disabled,
|
|
372
|
+
...restProps
|
|
373
|
+
}, forwardedRef) {
|
|
374
|
+
const { onBlur: allowEditCompleteOnBlur, afterDelay, delay } = { ...defaultEditCompleteOptions, ...editCompleteOptions };
|
|
375
|
+
const {
|
|
376
|
+
restartTimer,
|
|
377
|
+
clearTimer
|
|
378
|
+
} = useDelay({ delay, disabled: !afterDelay });
|
|
379
|
+
const innerRef = useRef(null);
|
|
380
|
+
const { focusNext } = useFocusManagement();
|
|
381
|
+
useFocusOnceVisible(innerRef, !autoFocus);
|
|
382
|
+
useImperativeHandle(forwardedRef, () => innerRef.current);
|
|
383
|
+
const handleKeyDown = (e) => {
|
|
384
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
385
|
+
e.preventDefault();
|
|
386
|
+
innerRef.current?.blur();
|
|
387
|
+
focusNext();
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
|
|
391
|
+
label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
|
|
392
|
+
/* @__PURE__ */ jsx3(
|
|
393
|
+
"input",
|
|
394
|
+
{
|
|
395
|
+
...restProps,
|
|
396
|
+
ref: innerRef,
|
|
397
|
+
value,
|
|
398
|
+
id,
|
|
399
|
+
type,
|
|
400
|
+
disabled,
|
|
401
|
+
className: clsx2(getInputClassName({ disabled }), className),
|
|
402
|
+
onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
|
|
403
|
+
onBlur: (event) => {
|
|
404
|
+
onBlur?.(event);
|
|
405
|
+
if (onEditCompleted && allowEditCompleteOnBlur) {
|
|
406
|
+
onEditCompleted(event.target.value);
|
|
407
|
+
clearTimer();
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
onChange: (e) => {
|
|
411
|
+
const value2 = e.target.value;
|
|
412
|
+
if (onEditCompleted) {
|
|
413
|
+
restartTimer(() => {
|
|
414
|
+
if (innerRef.current) {
|
|
415
|
+
innerRef.current.blur();
|
|
416
|
+
if (!allowEditCompleteOnBlur) {
|
|
417
|
+
onEditCompleted(value2);
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
onEditCompleted(value2);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
onChange(e);
|
|
425
|
+
onChangeText(value2);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
] });
|
|
430
|
+
});
|
|
431
|
+
var FormInput = forwardRef(function FormInput2({
|
|
432
|
+
id,
|
|
433
|
+
labelText,
|
|
434
|
+
errorText,
|
|
435
|
+
className,
|
|
436
|
+
labelClassName,
|
|
437
|
+
errorClassName,
|
|
438
|
+
containerClassName,
|
|
439
|
+
required,
|
|
440
|
+
disabled,
|
|
441
|
+
...restProps
|
|
442
|
+
}, ref) {
|
|
443
|
+
const input = /* @__PURE__ */ jsx3(
|
|
444
|
+
"input",
|
|
445
|
+
{
|
|
446
|
+
...restProps,
|
|
447
|
+
ref,
|
|
448
|
+
id,
|
|
449
|
+
disabled,
|
|
450
|
+
className: clsx2(
|
|
451
|
+
getInputClassName({ disabled, hasError: !!errorText }),
|
|
452
|
+
className
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
|
|
457
|
+
labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
|
|
458
|
+
labelText,
|
|
459
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
|
|
460
|
+
] }),
|
|
461
|
+
input,
|
|
462
|
+
errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
|
|
463
|
+
] });
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// src/util/math.ts
|
|
467
|
+
var clamp = (value, min = 0, max = 1) => {
|
|
468
|
+
return Math.min(Math.max(value, min), max);
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// src/components/layout-and-navigation/Pagination.tsx
|
|
472
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
473
|
+
|
|
474
|
+
// src/components/user-action/Button.tsx
|
|
475
|
+
import clsx3 from "clsx";
|
|
476
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
477
|
+
var ButtonColorUtil = {
|
|
478
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
479
|
+
text: ["primary", "negative", "neutral"],
|
|
480
|
+
outline: ["primary"]
|
|
481
|
+
};
|
|
482
|
+
var IconButtonUtil = {
|
|
483
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
484
|
+
};
|
|
485
|
+
var paddingMapping = {
|
|
486
|
+
small: "btn-sm",
|
|
487
|
+
medium: "btn-md",
|
|
488
|
+
large: "btn-lg"
|
|
489
|
+
};
|
|
490
|
+
var iconPaddingMapping = {
|
|
491
|
+
tiny: "icon-btn-xs",
|
|
492
|
+
small: "icon-btn-sm",
|
|
493
|
+
medium: "icon-btn-md",
|
|
494
|
+
large: "icon-btn-lg"
|
|
495
|
+
};
|
|
496
|
+
var ButtonUtil = {
|
|
497
|
+
paddingMapping,
|
|
498
|
+
iconPaddingMapping
|
|
499
|
+
};
|
|
500
|
+
var SolidButton = ({
|
|
501
|
+
children,
|
|
502
|
+
disabled = false,
|
|
503
|
+
color = "primary",
|
|
504
|
+
size = "medium",
|
|
505
|
+
startIcon,
|
|
506
|
+
endIcon,
|
|
507
|
+
onClick,
|
|
508
|
+
className,
|
|
509
|
+
...restProps
|
|
510
|
+
}) => {
|
|
511
|
+
const colorClasses = {
|
|
512
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
513
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
514
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
515
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
516
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
517
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
518
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
|
|
519
|
+
}[color];
|
|
520
|
+
const iconColorClasses = {
|
|
521
|
+
primary: "text-button-solid-primary-icon",
|
|
522
|
+
secondary: "text-button-solid-secondary-icon",
|
|
523
|
+
tertiary: "text-button-solid-tertiary-icon",
|
|
524
|
+
positive: "text-button-solid-positive-icon",
|
|
525
|
+
warning: "text-button-solid-warning-icon",
|
|
526
|
+
negative: "text-button-solid-negative-icon",
|
|
527
|
+
neutral: "text-button-solid-neutral-icon"
|
|
528
|
+
}[color];
|
|
529
|
+
return /* @__PURE__ */ jsxs2(
|
|
530
|
+
"button",
|
|
531
|
+
{
|
|
532
|
+
onClick: disabled ? void 0 : onClick,
|
|
533
|
+
disabled: disabled || onClick === void 0,
|
|
534
|
+
className: clsx3(
|
|
535
|
+
{
|
|
536
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
|
|
537
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
538
|
+
},
|
|
539
|
+
ButtonUtil.paddingMapping[size],
|
|
540
|
+
className
|
|
541
|
+
),
|
|
542
|
+
...restProps,
|
|
543
|
+
children: [
|
|
544
|
+
startIcon && /* @__PURE__ */ jsx4(
|
|
545
|
+
"span",
|
|
546
|
+
{
|
|
547
|
+
className: clsx3({
|
|
548
|
+
[iconColorClasses]: !disabled,
|
|
549
|
+
[`text-disabled-icon`]: disabled
|
|
550
|
+
}),
|
|
551
|
+
children: startIcon
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
children,
|
|
555
|
+
endIcon && /* @__PURE__ */ jsx4(
|
|
556
|
+
"span",
|
|
557
|
+
{
|
|
558
|
+
className: clsx3({
|
|
559
|
+
[iconColorClasses]: !disabled,
|
|
560
|
+
[`text-disabled-icon`]: disabled
|
|
561
|
+
}),
|
|
562
|
+
children: endIcon
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
};
|
|
569
|
+
var IconButton = ({
|
|
570
|
+
children,
|
|
571
|
+
disabled = false,
|
|
572
|
+
color = "primary",
|
|
573
|
+
size = "medium",
|
|
574
|
+
onClick,
|
|
575
|
+
className,
|
|
576
|
+
...restProps
|
|
577
|
+
}) => {
|
|
578
|
+
const colorClasses = {
|
|
579
|
+
primary: "bg-button-solid-primary-background text-button-solid-primary-text",
|
|
580
|
+
secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
|
|
581
|
+
tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
|
|
582
|
+
positive: "bg-button-solid-positive-background text-button-solid-positive-text",
|
|
583
|
+
warning: "bg-button-solid-warning-background text-button-solid-warning-text",
|
|
584
|
+
negative: "bg-button-solid-negative-background text-button-solid-negative-text",
|
|
585
|
+
neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
|
|
586
|
+
transparent: "bg-transparent"
|
|
587
|
+
}[color];
|
|
588
|
+
return /* @__PURE__ */ jsx4(
|
|
589
|
+
"button",
|
|
590
|
+
{
|
|
591
|
+
onClick: disabled ? void 0 : onClick,
|
|
592
|
+
disabled: disabled || onClick === void 0,
|
|
593
|
+
className: clsx3(
|
|
594
|
+
{
|
|
595
|
+
"text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
|
|
596
|
+
"text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
|
|
597
|
+
"hover:bg-button-text-hover-background": !disabled && color === "transparent",
|
|
598
|
+
[clsx3(colorClasses, "hover:brightness-90")]: !disabled
|
|
599
|
+
},
|
|
600
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
601
|
+
className
|
|
602
|
+
),
|
|
603
|
+
...restProps,
|
|
604
|
+
children
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/components/layout-and-navigation/Pagination.tsx
|
|
610
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
611
|
+
var Pagination = ({
|
|
612
|
+
overwriteTranslation,
|
|
613
|
+
pageIndex,
|
|
614
|
+
pageCount,
|
|
615
|
+
onPageChanged,
|
|
616
|
+
className,
|
|
617
|
+
style
|
|
618
|
+
}) => {
|
|
619
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
620
|
+
const [value, setValue] = useState5((pageIndex + 1).toString());
|
|
621
|
+
const noPages = pageCount === 0;
|
|
622
|
+
const onFirstPage = pageIndex === 0 && !noPages;
|
|
623
|
+
const onLastPage = pageIndex === pageCount - 1;
|
|
624
|
+
useEffect6(() => {
|
|
625
|
+
if (noPages) {
|
|
626
|
+
setValue("0");
|
|
627
|
+
} else {
|
|
628
|
+
setValue((pageIndex + 1).toString());
|
|
629
|
+
}
|
|
630
|
+
}, [pageIndex, noPages]);
|
|
631
|
+
const changePage = (page) => {
|
|
632
|
+
onPageChanged(page);
|
|
633
|
+
};
|
|
634
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx4("row gap-x-1", className), style, children: [
|
|
635
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "transparent", onClick: () => changePage(0), disabled: onFirstPage || noPages, children: /* @__PURE__ */ jsx5(ChevronFirst, {}) }),
|
|
636
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "transparent", onClick: () => changePage(pageIndex - 1), disabled: onFirstPage || noPages, children: /* @__PURE__ */ jsx5(ChevronLeft, {}) }),
|
|
637
|
+
/* @__PURE__ */ jsxs3("div", { className: "row min-w-56 gap-x-2 items-center justify-center mx-2 text-center", children: [
|
|
638
|
+
/* @__PURE__ */ jsx5(
|
|
639
|
+
Input,
|
|
640
|
+
{
|
|
641
|
+
value,
|
|
642
|
+
containerClassName: "flex flex-1 h-10",
|
|
643
|
+
className: clsx4(
|
|
644
|
+
"w-full text-center font-bold input-indicator-hidden"
|
|
645
|
+
),
|
|
646
|
+
type: "number",
|
|
647
|
+
min: 1,
|
|
648
|
+
max: pageCount,
|
|
649
|
+
disabled: noPages,
|
|
650
|
+
onChangeText: (value2) => {
|
|
651
|
+
if (value2) {
|
|
652
|
+
setValue(clamp(Number(value2), 1, pageCount).toString());
|
|
653
|
+
} else {
|
|
654
|
+
setValue(value2);
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
onEditCompleted: (value2) => {
|
|
658
|
+
changePage(clamp(Number(value2) - 1, 0, pageCount - 1));
|
|
659
|
+
},
|
|
660
|
+
editCompleteOptions: { delay: 800 }
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ jsx5("span", { className: "select-none w-10", children: translation("of") }),
|
|
664
|
+
/* @__PURE__ */ jsx5(
|
|
665
|
+
"span",
|
|
666
|
+
{
|
|
667
|
+
className: "row flex-1 items-center justify-center select-none h-10 bg-surface text-on-surface rounded-md font-bold",
|
|
668
|
+
children: pageCount
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "transparent", onClick: () => changePage(pageIndex + 1), disabled: onLastPage || noPages, children: /* @__PURE__ */ jsx5(ChevronRight, {}) }),
|
|
673
|
+
/* @__PURE__ */ jsx5(IconButton, { color: "transparent", onClick: () => changePage(pageCount - 1), disabled: onLastPage || noPages, children: /* @__PURE__ */ jsx5(ChevronLast, {}) })
|
|
674
|
+
] });
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
// src/components/table/Table.tsx
|
|
678
|
+
import clsx10 from "clsx";
|
|
679
|
+
import {
|
|
680
|
+
flexRender,
|
|
681
|
+
getCoreRowModel,
|
|
682
|
+
getFilteredRowModel,
|
|
683
|
+
getPaginationRowModel,
|
|
684
|
+
getSortedRowModel,
|
|
685
|
+
useReactTable
|
|
686
|
+
} from "@tanstack/react-table";
|
|
687
|
+
|
|
688
|
+
// src/util/array.ts
|
|
689
|
+
var defaultRangeOptions = {
|
|
690
|
+
allowEmptyRange: false,
|
|
691
|
+
stepSize: 1,
|
|
692
|
+
exclusiveStart: false,
|
|
693
|
+
exclusiveEnd: true
|
|
694
|
+
};
|
|
695
|
+
var range = (endOrRange, options) => {
|
|
696
|
+
const { allowEmptyRange, stepSize, exclusiveStart, exclusiveEnd } = { ...defaultRangeOptions, ...options };
|
|
697
|
+
let start = 0;
|
|
698
|
+
let end;
|
|
699
|
+
if (typeof endOrRange === "number") {
|
|
700
|
+
end = endOrRange;
|
|
701
|
+
} else {
|
|
702
|
+
start = endOrRange[0];
|
|
703
|
+
end = endOrRange[1];
|
|
704
|
+
}
|
|
705
|
+
if (!exclusiveEnd) {
|
|
706
|
+
end -= 1;
|
|
707
|
+
}
|
|
708
|
+
if (exclusiveStart) {
|
|
709
|
+
start += 1;
|
|
710
|
+
}
|
|
711
|
+
if (end - 1 < start) {
|
|
712
|
+
if (!allowEmptyRange) {
|
|
713
|
+
console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set options.allowEmptyRange to true`);
|
|
714
|
+
}
|
|
715
|
+
return [];
|
|
716
|
+
}
|
|
717
|
+
return Array.from({ length: end - start }, (_, index) => index * stepSize + start);
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/components/table/Table.tsx
|
|
721
|
+
import { Scrollbars } from "react-custom-scrollbars-2";
|
|
722
|
+
|
|
723
|
+
// src/components/user-action/Checkbox.tsx
|
|
724
|
+
import { useState as useState6 } from "react";
|
|
725
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
726
|
+
import { Check, Minus } from "lucide-react";
|
|
727
|
+
import clsx5 from "clsx";
|
|
728
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
729
|
+
var checkboxSizeMapping = {
|
|
730
|
+
small: "size-4",
|
|
731
|
+
medium: "size-6",
|
|
732
|
+
large: "size-8"
|
|
733
|
+
};
|
|
734
|
+
var checkboxIconSizeMapping = {
|
|
735
|
+
small: "size-3",
|
|
736
|
+
medium: "size-5",
|
|
737
|
+
large: "size-7"
|
|
738
|
+
};
|
|
739
|
+
var Checkbox = ({
|
|
740
|
+
id,
|
|
741
|
+
label,
|
|
742
|
+
checked,
|
|
743
|
+
disabled,
|
|
744
|
+
onChange,
|
|
745
|
+
onChangeTristate,
|
|
746
|
+
size = "medium",
|
|
747
|
+
className = "",
|
|
748
|
+
containerClassName
|
|
749
|
+
}) => {
|
|
750
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
751
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
752
|
+
const propagateChange = (checked2) => {
|
|
753
|
+
if (onChangeTristate) {
|
|
754
|
+
onChangeTristate(checked2);
|
|
755
|
+
}
|
|
756
|
+
if (onChange) {
|
|
757
|
+
onChange(checked2 === "indeterminate" ? false : checked2);
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
const changeValue = () => {
|
|
761
|
+
const newValue = checked === "indeterminate" ? false : !checked;
|
|
762
|
+
propagateChange(newValue);
|
|
763
|
+
};
|
|
764
|
+
return /* @__PURE__ */ jsxs4("div", { className: clsx5("row justify-center items-center", containerClassName), children: [
|
|
765
|
+
/* @__PURE__ */ jsx6(
|
|
766
|
+
CheckboxPrimitive.Root,
|
|
767
|
+
{
|
|
768
|
+
onCheckedChange: propagateChange,
|
|
769
|
+
checked,
|
|
770
|
+
disabled,
|
|
771
|
+
id,
|
|
772
|
+
className: clsx5(usedSizeClass, `items-center border-2 rounded outline-none `, {
|
|
773
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
774
|
+
"focus:border-primary": !disabled,
|
|
775
|
+
"bg-surface": !disabled && !checked,
|
|
776
|
+
"bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate",
|
|
777
|
+
"hover:border-primary focus:hover:border-primary": !disabled && !checked
|
|
778
|
+
}, className),
|
|
779
|
+
children: /* @__PURE__ */ jsxs4(CheckboxPrimitive.Indicator, { children: [
|
|
780
|
+
checked === true && /* @__PURE__ */ jsx6(Check, { className: innerIconSize }),
|
|
781
|
+
checked === "indeterminate" && /* @__PURE__ */ jsx6(Minus, { className: innerIconSize })
|
|
782
|
+
] })
|
|
783
|
+
}
|
|
784
|
+
),
|
|
785
|
+
label && /* @__PURE__ */ jsx6(
|
|
786
|
+
Label,
|
|
787
|
+
{
|
|
788
|
+
...label,
|
|
789
|
+
className: clsx5("cursor-pointer", label.className),
|
|
790
|
+
htmlFor: id,
|
|
791
|
+
onClick: changeValue
|
|
792
|
+
}
|
|
793
|
+
)
|
|
794
|
+
] });
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
// src/components/table/TableFilterButton.tsx
|
|
798
|
+
import { FilterIcon } from "lucide-react";
|
|
799
|
+
|
|
800
|
+
// src/components/user-action/Menu.tsx
|
|
801
|
+
import { useRef as useRef2 } from "react";
|
|
802
|
+
import clsx6 from "clsx";
|
|
803
|
+
|
|
804
|
+
// src/hooks/useOutsideClick.ts
|
|
805
|
+
import { useEffect as useEffect7 } from "react";
|
|
806
|
+
var useOutsideClick = (refs, handler) => {
|
|
807
|
+
useEffect7(() => {
|
|
808
|
+
const listener = (event) => {
|
|
809
|
+
if (event.target === null) return;
|
|
810
|
+
if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
handler();
|
|
814
|
+
};
|
|
815
|
+
document.addEventListener("mousedown", listener);
|
|
816
|
+
document.addEventListener("touchstart", listener);
|
|
817
|
+
return () => {
|
|
818
|
+
document.removeEventListener("mousedown", listener);
|
|
819
|
+
document.removeEventListener("touchstart", listener);
|
|
820
|
+
};
|
|
821
|
+
}, [refs, handler]);
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// src/hooks/useHoverState.ts
|
|
825
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
826
|
+
var defaultUseHoverStateProps = {
|
|
827
|
+
closingDelay: 200,
|
|
828
|
+
isDisabled: false
|
|
829
|
+
};
|
|
830
|
+
var useHoverState = (props = void 0) => {
|
|
831
|
+
const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
|
|
832
|
+
const [isHovered, setIsHovered] = useState7(false);
|
|
833
|
+
const [timer, setTimer] = useState7();
|
|
834
|
+
const onMouseEnter = () => {
|
|
835
|
+
if (isDisabled) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
clearTimeout(timer);
|
|
839
|
+
setIsHovered(true);
|
|
840
|
+
};
|
|
841
|
+
const onMouseLeave = () => {
|
|
842
|
+
if (isDisabled) {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
setTimer(setTimeout(() => {
|
|
846
|
+
setIsHovered(false);
|
|
847
|
+
}, closingDelay));
|
|
848
|
+
};
|
|
849
|
+
useEffect8(() => {
|
|
850
|
+
if (timer) {
|
|
851
|
+
return () => {
|
|
852
|
+
clearTimeout(timer);
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
useEffect8(() => {
|
|
857
|
+
if (timer) {
|
|
858
|
+
clearTimeout(timer);
|
|
859
|
+
}
|
|
860
|
+
}, [isDisabled]);
|
|
861
|
+
return {
|
|
862
|
+
isHovered,
|
|
863
|
+
setIsHovered,
|
|
864
|
+
handlers: { onMouseEnter, onMouseLeave }
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
// src/util/PropsWithFunctionChildren.ts
|
|
869
|
+
var resolve = (children, bag) => {
|
|
870
|
+
if (typeof children === "function") {
|
|
871
|
+
return children(bag);
|
|
872
|
+
}
|
|
873
|
+
return children ?? void 0;
|
|
874
|
+
};
|
|
875
|
+
var BagFunctionUtil = {
|
|
876
|
+
resolve
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
// src/components/user-action/Menu.tsx
|
|
880
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
881
|
+
var Menu = ({
|
|
882
|
+
trigger,
|
|
883
|
+
children,
|
|
884
|
+
alignment = "tl",
|
|
885
|
+
showOnHover = false,
|
|
886
|
+
menuClassName = ""
|
|
887
|
+
}) => {
|
|
888
|
+
const { isHovered: isOpen, setIsHovered: setIsOpen, handlers } = useHoverState({ isDisabled: !showOnHover });
|
|
889
|
+
const triggerRef = useRef2(null);
|
|
890
|
+
const menuRef = useRef2(null);
|
|
891
|
+
useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
|
|
892
|
+
const bag = { isOpen, close: () => setIsOpen(false) };
|
|
893
|
+
return /* @__PURE__ */ jsxs5(
|
|
894
|
+
"div",
|
|
895
|
+
{
|
|
896
|
+
className: "relative",
|
|
897
|
+
...handlers,
|
|
898
|
+
children: [
|
|
899
|
+
trigger(() => setIsOpen(!isOpen), triggerRef),
|
|
900
|
+
/* @__PURE__ */ jsx7(
|
|
901
|
+
"div",
|
|
902
|
+
{
|
|
903
|
+
ref: menuRef,
|
|
904
|
+
onClick: (e) => e.stopPropagation(),
|
|
905
|
+
className: clsx6(
|
|
906
|
+
"absolute top-full mt-1 min-w-40 rounded-lg bg-menu-background text-menu-text shadow-around-lg z-10",
|
|
907
|
+
{
|
|
908
|
+
"top-0": alignment[0] === "t",
|
|
909
|
+
"bottom-0": alignment[0] === "b",
|
|
910
|
+
"left-0": alignment[1] === "l",
|
|
911
|
+
"right-0": alignment[1] === "r",
|
|
912
|
+
"hidden": !isOpen
|
|
913
|
+
},
|
|
914
|
+
menuClassName
|
|
915
|
+
),
|
|
916
|
+
children: BagFunctionUtil.resolve(children, bag)
|
|
917
|
+
}
|
|
918
|
+
)
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// src/components/table/TableFilterButton.tsx
|
|
925
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
926
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
927
|
+
var defaultTableFilterTranslation = {
|
|
928
|
+
en: {
|
|
929
|
+
filter: "Filter",
|
|
930
|
+
min: "Min",
|
|
931
|
+
max: "Max",
|
|
932
|
+
startDate: "Start",
|
|
933
|
+
endDate: "End",
|
|
934
|
+
text: "Text..."
|
|
935
|
+
},
|
|
936
|
+
de: {
|
|
937
|
+
filter: "Filter",
|
|
938
|
+
min: "Min",
|
|
939
|
+
max: "Max",
|
|
940
|
+
startDate: "Start",
|
|
941
|
+
endDate: "Ende",
|
|
942
|
+
text: "Text..."
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
var TableFilterButton = ({
|
|
946
|
+
filterType,
|
|
947
|
+
column
|
|
948
|
+
}) => {
|
|
949
|
+
const translation = useTranslation([formTranslation, defaultTableFilterTranslation]);
|
|
950
|
+
const columnFilterValue = column.getFilterValue();
|
|
951
|
+
const [filterValue, setFilterValue] = useState8(columnFilterValue);
|
|
952
|
+
const hasFilter = !!filterValue;
|
|
953
|
+
useEffect9(() => {
|
|
954
|
+
setFilterValue(columnFilterValue);
|
|
955
|
+
}, [columnFilterValue]);
|
|
956
|
+
return /* @__PURE__ */ jsx8(
|
|
957
|
+
Menu,
|
|
958
|
+
{
|
|
959
|
+
trigger: (onClick, ref) => /* @__PURE__ */ jsxs6("div", { ref, className: "relative", children: [
|
|
960
|
+
/* @__PURE__ */ jsx8(IconButton, { color: "neutral", size: "tiny", onClick, children: /* @__PURE__ */ jsx8(FilterIcon, {}) }),
|
|
961
|
+
hasFilter && /* @__PURE__ */ jsx8(
|
|
962
|
+
"div",
|
|
963
|
+
{
|
|
964
|
+
className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-primary pointer-events-none",
|
|
965
|
+
"aria-hidden": true
|
|
966
|
+
}
|
|
967
|
+
)
|
|
968
|
+
] }),
|
|
969
|
+
children: ({ close }) => /* @__PURE__ */ jsxs6("div", { className: "col gap-y-1 p-2 items-start font-normal text-menu-text", children: [
|
|
970
|
+
/* @__PURE__ */ jsx8("h4", { className: "textstyle-title-sm", children: translation("filter") }),
|
|
971
|
+
filterType === "text" && /* @__PURE__ */ jsx8(
|
|
972
|
+
Input,
|
|
973
|
+
{
|
|
974
|
+
value: filterValue ?? "",
|
|
975
|
+
autoFocus: true,
|
|
976
|
+
placeholder: translation("text"),
|
|
977
|
+
onChangeText: setFilterValue,
|
|
978
|
+
className: "h-10"
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
filterType === "range" && /* @__PURE__ */ jsxs6("div", { className: "row gap-x-2 items-center", children: [
|
|
982
|
+
/* @__PURE__ */ jsx8(
|
|
983
|
+
Input,
|
|
984
|
+
{
|
|
985
|
+
value: filterValue?.[0] ?? "",
|
|
986
|
+
type: "number",
|
|
987
|
+
placeholder: translation("min"),
|
|
988
|
+
onChangeText: (text) => {
|
|
989
|
+
const num = Number(text);
|
|
990
|
+
setFilterValue((old) => [num, old?.[1]]);
|
|
991
|
+
},
|
|
992
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ jsx8("span", { className: "font-bold", children: "-" }),
|
|
996
|
+
/* @__PURE__ */ jsx8(
|
|
997
|
+
Input,
|
|
998
|
+
{
|
|
999
|
+
value: filterValue?.[1] ?? "",
|
|
1000
|
+
type: "number",
|
|
1001
|
+
placeholder: translation("max"),
|
|
1002
|
+
onChangeText: (text) => {
|
|
1003
|
+
const num = Number(text);
|
|
1004
|
+
setFilterValue((old) => [old?.[0], num]);
|
|
1005
|
+
},
|
|
1006
|
+
className: "h-10 input-indicator-hidden w-40"
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
] }),
|
|
1010
|
+
filterType === "dateRange" && /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1011
|
+
/* @__PURE__ */ jsx8(
|
|
1012
|
+
Input,
|
|
1013
|
+
{
|
|
1014
|
+
value: filterValue?.[0] ? filterValue?.[0].toISOString().slice(0, 16) : "",
|
|
1015
|
+
type: "datetime-local",
|
|
1016
|
+
placeholder: translation("startDate"),
|
|
1017
|
+
onChangeText: (text) => {
|
|
1018
|
+
const value = new Date(text);
|
|
1019
|
+
setFilterValue((old) => [value, old?.[1]]);
|
|
1020
|
+
},
|
|
1021
|
+
className: "h-10 w-50"
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ jsx8(
|
|
1025
|
+
Input,
|
|
1026
|
+
{
|
|
1027
|
+
value: filterValue?.[1] ? filterValue?.[1].toISOString().slice(0, 16) : "",
|
|
1028
|
+
type: "datetime-local",
|
|
1029
|
+
placeholder: translation("endDate"),
|
|
1030
|
+
onChangeText: (text) => {
|
|
1031
|
+
const value = new Date(text);
|
|
1032
|
+
setFilterValue((old) => [old?.[0], value]);
|
|
1033
|
+
},
|
|
1034
|
+
className: "h-10 w-50"
|
|
1035
|
+
}
|
|
1036
|
+
)
|
|
1037
|
+
] }),
|
|
1038
|
+
/* @__PURE__ */ jsxs6("div", { className: "row justify-end w-full", children: [
|
|
1039
|
+
hasFilter && /* @__PURE__ */ jsx8(SolidButton, { color: "negative", size: "small", onClick: () => {
|
|
1040
|
+
column.setFilterValue(void 0);
|
|
1041
|
+
close();
|
|
1042
|
+
}, children: translation("remove") }),
|
|
1043
|
+
/* @__PURE__ */ jsx8(SolidButton, { size: "small", onClick: () => {
|
|
1044
|
+
column.setFilterValue(filterValue);
|
|
1045
|
+
close();
|
|
1046
|
+
}, children: translation("apply") })
|
|
1047
|
+
] })
|
|
1048
|
+
] })
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
// src/components/table/TableSortButton.tsx
|
|
1054
|
+
import { ChevronDown, ChevronsUpDown, ChevronUp } from "lucide-react";
|
|
1055
|
+
import clsx7 from "clsx";
|
|
1056
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1057
|
+
var TableSortButton = ({
|
|
1058
|
+
sortDirection,
|
|
1059
|
+
invert = false,
|
|
1060
|
+
color = "neutral",
|
|
1061
|
+
className,
|
|
1062
|
+
...buttonProps
|
|
1063
|
+
}) => {
|
|
1064
|
+
let icon = /* @__PURE__ */ jsx9(ChevronsUpDown, { className: "w-full h-full" });
|
|
1065
|
+
if (sortDirection) {
|
|
1066
|
+
let usedSortDirection = sortDirection;
|
|
1067
|
+
if (invert) {
|
|
1068
|
+
usedSortDirection = usedSortDirection === "desc" ? "asc" : "desc";
|
|
1069
|
+
}
|
|
1070
|
+
icon = usedSortDirection === "asc" ? /* @__PURE__ */ jsx9(ChevronUp, { className: "w-full h-full" }) : /* @__PURE__ */ jsx9(ChevronDown, { className: "w-full h-full" });
|
|
1071
|
+
}
|
|
1072
|
+
return /* @__PURE__ */ jsx9(
|
|
1073
|
+
IconButton,
|
|
1074
|
+
{
|
|
1075
|
+
size: "tiny",
|
|
1076
|
+
color,
|
|
1077
|
+
className: clsx7(className),
|
|
1078
|
+
...buttonProps,
|
|
1079
|
+
children: icon
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
// src/components/table/FillerRowElement.tsx
|
|
1085
|
+
import { clsx as clsx8 } from "clsx";
|
|
1086
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1087
|
+
var FillerRowElement = ({
|
|
1088
|
+
className
|
|
1089
|
+
}) => {
|
|
1090
|
+
return /* @__PURE__ */ jsx10("div", { className: clsx8("flex flex-row items-center w-1/2 h-4 text-disabled-text font-bold", className), children: "-" });
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
// src/components/table/Filter.ts
|
|
1094
|
+
var dateRange = (row, columnId, filterValue) => {
|
|
1095
|
+
const [min, max] = filterValue;
|
|
1096
|
+
const value = row.getValue(columnId);
|
|
1097
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
1098
|
+
if (isNaN(date.getTime())) return false;
|
|
1099
|
+
if (min && date < min) return false;
|
|
1100
|
+
if (max && date > max) return false;
|
|
1101
|
+
return true;
|
|
1102
|
+
};
|
|
1103
|
+
var TableFilters = {
|
|
1104
|
+
dateRange
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
// src/hooks/useResizeCallbackWrapper.ts
|
|
1108
|
+
import { useEffect as useEffect10 } from "react";
|
|
1109
|
+
var useResizeCallbackWrapper = (callback) => {
|
|
1110
|
+
useEffect10(() => {
|
|
1111
|
+
window.addEventListener("resize", callback);
|
|
1112
|
+
return () => {
|
|
1113
|
+
window.removeEventListener("resize", callback);
|
|
1114
|
+
};
|
|
1115
|
+
}, [callback]);
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
// src/components/table/TableCell.tsx
|
|
1119
|
+
import { clsx as clsx9 } from "clsx";
|
|
1120
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1121
|
+
var TableCell = ({
|
|
1122
|
+
children,
|
|
1123
|
+
className
|
|
1124
|
+
}) => {
|
|
1125
|
+
return /* @__PURE__ */ jsx11("span", { className: clsx9("block max-w-full overflow-ellipsis truncate", className), children });
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
// src/components/table/Table.tsx
|
|
1129
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1130
|
+
var Table = ({
|
|
1131
|
+
data,
|
|
1132
|
+
fillerRow,
|
|
1133
|
+
initialState,
|
|
1134
|
+
onRowClick = noop,
|
|
1135
|
+
className,
|
|
1136
|
+
tableClassName,
|
|
1137
|
+
defaultColumn,
|
|
1138
|
+
state,
|
|
1139
|
+
columns,
|
|
1140
|
+
...tableOptions
|
|
1141
|
+
}) => {
|
|
1142
|
+
const ref = useRef3(null);
|
|
1143
|
+
const tableRef = useRef3(null);
|
|
1144
|
+
const [columnSizing, setColumnSizing] = useState9(columns.reduce((previousValue, currentValue) => {
|
|
1145
|
+
return {
|
|
1146
|
+
...previousValue,
|
|
1147
|
+
[currentValue.id]: currentValue.minSize ?? defaultColumn.minSize
|
|
1148
|
+
};
|
|
1149
|
+
}, {}));
|
|
1150
|
+
const [columnSizingInfo, setColumnSizingInfo] = useState9();
|
|
1151
|
+
const [pagination, setPagination] = useState9({
|
|
1152
|
+
pageSize: 10,
|
|
1153
|
+
pageIndex: 0,
|
|
1154
|
+
...initialState?.pagination
|
|
1155
|
+
});
|
|
1156
|
+
const [columnFilters, setColumnFilters] = useState9(initialState?.columnFilters);
|
|
1157
|
+
const computedColumnMinWidths = useMemo(() => {
|
|
1158
|
+
return columns.reduce((previousValue, column) => {
|
|
1159
|
+
return {
|
|
1160
|
+
...previousValue,
|
|
1161
|
+
// every column is at least 12px wide
|
|
1162
|
+
[column.id]: column.minSize ?? defaultColumn?.minSize ?? 12
|
|
1163
|
+
};
|
|
1164
|
+
}, {});
|
|
1165
|
+
}, [columns, defaultColumn]);
|
|
1166
|
+
const computedColumnMaxWidths = useMemo(() => {
|
|
1167
|
+
return columns.reduce((previousValue, column) => {
|
|
1168
|
+
return {
|
|
1169
|
+
...previousValue,
|
|
1170
|
+
[column.id]: column.maxSize ?? defaultColumn?.maxSize
|
|
1171
|
+
};
|
|
1172
|
+
}, {});
|
|
1173
|
+
}, [columns, defaultColumn]);
|
|
1174
|
+
const tableMinWidth = useMemo(() => {
|
|
1175
|
+
return columns.reduce((sum, column) => {
|
|
1176
|
+
return sum + computedColumnMinWidths[column.id];
|
|
1177
|
+
}, 0);
|
|
1178
|
+
}, [columns, computedColumnMinWidths]);
|
|
1179
|
+
const updateColumnSizes = useMemo(() => {
|
|
1180
|
+
return (previous) => {
|
|
1181
|
+
const updateSizing = {
|
|
1182
|
+
...columnSizing,
|
|
1183
|
+
...previous
|
|
1184
|
+
};
|
|
1185
|
+
const containerWidth = ref.current.offsetWidth;
|
|
1186
|
+
columns.forEach((column) => {
|
|
1187
|
+
updateSizing[column.id] = clamp(updateSizing[column.id], computedColumnMinWidths[column.id], computedColumnMaxWidths[column.id] ?? containerWidth);
|
|
1188
|
+
});
|
|
1189
|
+
const width = columns.reduce((previousValue, currentValue) => previousValue + updateSizing[currentValue.id], 0);
|
|
1190
|
+
if (width > containerWidth) {
|
|
1191
|
+
if (tableMinWidth >= containerWidth) {
|
|
1192
|
+
return columns.reduce((previousValue, currentValue) => ({
|
|
1193
|
+
...previousValue,
|
|
1194
|
+
[currentValue.id]: computedColumnMinWidths[currentValue.id]
|
|
1195
|
+
}), {});
|
|
1196
|
+
}
|
|
1197
|
+
let reduceableColumns = columns.map((value) => value.id).filter((id) => updateSizing[id] - computedColumnMinWidths[id] > 0);
|
|
1198
|
+
let spaceToReduce = width - containerWidth;
|
|
1199
|
+
while (spaceToReduce > 0 && reduceableColumns.length > 0) {
|
|
1200
|
+
let maxReduceAmount = reduceableColumns.reduce((previousValue, id) => Math.max(previousValue, updateSizing[id] - computedColumnMinWidths[id]), 0);
|
|
1201
|
+
if (maxReduceAmount * reduceableColumns.length > spaceToReduce) {
|
|
1202
|
+
maxReduceAmount = spaceToReduce / reduceableColumns.length;
|
|
1203
|
+
}
|
|
1204
|
+
reduceableColumns.forEach((id) => {
|
|
1205
|
+
updateSizing[id] -= maxReduceAmount;
|
|
1206
|
+
});
|
|
1207
|
+
spaceToReduce -= maxReduceAmount * reduceableColumns.length;
|
|
1208
|
+
reduceableColumns = reduceableColumns.filter((id) => updateSizing[id] - computedColumnMinWidths[id] > 0);
|
|
1209
|
+
}
|
|
1210
|
+
} else if (width <= containerWidth) {
|
|
1211
|
+
let distributableWidth = containerWidth - width;
|
|
1212
|
+
const violatingColumns = columns.filter((value) => computedColumnMaxWidths[value.id] && updateSizing[value.id] > computedColumnMaxWidths[value.id]);
|
|
1213
|
+
const violationColumnsAmount = violatingColumns.reduce(
|
|
1214
|
+
(previousValue, column) => previousValue + updateSizing[column.id] - computedColumnMaxWidths[column.id],
|
|
1215
|
+
0
|
|
1216
|
+
);
|
|
1217
|
+
distributableWidth += violationColumnsAmount;
|
|
1218
|
+
let enlargeableColumns = columns.filter((col) => !computedColumnMaxWidths[col.id] || updateSizing[col.id] < computedColumnMaxWidths[col.id]).map((value) => value.id);
|
|
1219
|
+
while (distributableWidth > 0 && enlargeableColumns.length > 0) {
|
|
1220
|
+
let minEnlargeableAmount = enlargeableColumns.reduce((previousValue, id) => Math.min(previousValue, computedColumnMaxWidths[id] ? computedColumnMaxWidths[id] - updateSizing[id] : distributableWidth), distributableWidth);
|
|
1221
|
+
if (minEnlargeableAmount * enlargeableColumns.length > distributableWidth) {
|
|
1222
|
+
minEnlargeableAmount = distributableWidth / enlargeableColumns.length;
|
|
1223
|
+
}
|
|
1224
|
+
enlargeableColumns.forEach((id) => {
|
|
1225
|
+
updateSizing[id] += minEnlargeableAmount;
|
|
1226
|
+
});
|
|
1227
|
+
distributableWidth -= minEnlargeableAmount * enlargeableColumns.length;
|
|
1228
|
+
enlargeableColumns = enlargeableColumns.filter((id) => !computedColumnMaxWidths[id] || updateSizing[id] < computedColumnMaxWidths[id]);
|
|
1229
|
+
}
|
|
1230
|
+
if (distributableWidth > 0) {
|
|
1231
|
+
updateSizing[columns[columns.length - 1].id] += distributableWidth;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return updateSizing;
|
|
1235
|
+
};
|
|
1236
|
+
}, [columns, computedColumnMaxWidths, computedColumnMinWidths, tableMinWidth]);
|
|
1237
|
+
const table = useReactTable({
|
|
1238
|
+
data,
|
|
1239
|
+
getCoreRowModel: getCoreRowModel(),
|
|
1240
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
1241
|
+
getSortedRowModel: getSortedRowModel(),
|
|
1242
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
1243
|
+
initialState,
|
|
1244
|
+
defaultColumn: {
|
|
1245
|
+
minSize: 60,
|
|
1246
|
+
maxSize: 700,
|
|
1247
|
+
cell: ({ cell }) => {
|
|
1248
|
+
return /* @__PURE__ */ jsx12(TableCell, { children: cell.getValue() });
|
|
1249
|
+
},
|
|
1250
|
+
...defaultColumn
|
|
1251
|
+
},
|
|
1252
|
+
columns,
|
|
1253
|
+
state: {
|
|
1254
|
+
columnSizing,
|
|
1255
|
+
columnSizingInfo,
|
|
1256
|
+
pagination,
|
|
1257
|
+
columnFilters,
|
|
1258
|
+
...state
|
|
1259
|
+
},
|
|
1260
|
+
filterFns: {
|
|
1261
|
+
...tableOptions?.filterFns,
|
|
1262
|
+
dateRange: TableFilters.dateRange
|
|
1263
|
+
},
|
|
1264
|
+
onColumnSizingInfoChange: (updaterOrValue) => {
|
|
1265
|
+
setColumnSizingInfo(updaterOrValue);
|
|
1266
|
+
if (tableOptions.onColumnSizingInfoChange) {
|
|
1267
|
+
tableOptions?.onColumnSizingInfoChange(updaterOrValue);
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
onColumnSizingChange: (updaterOrValue) => {
|
|
1271
|
+
setColumnSizing((previous) => {
|
|
1272
|
+
const newSizing = typeof updaterOrValue === "function" ? updaterOrValue(previous) : updaterOrValue;
|
|
1273
|
+
return updateColumnSizes(newSizing);
|
|
1274
|
+
});
|
|
1275
|
+
if (tableOptions.onColumnSizingChange) {
|
|
1276
|
+
tableOptions.onColumnSizingChange(updaterOrValue);
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
onPaginationChange: (updaterOrValue) => {
|
|
1280
|
+
setPagination(updaterOrValue);
|
|
1281
|
+
if (tableOptions.onPaginationChange) {
|
|
1282
|
+
tableOptions.onPaginationChange(updaterOrValue);
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
onColumnFiltersChange: (updaterOrValue) => {
|
|
1286
|
+
setColumnFilters(updaterOrValue);
|
|
1287
|
+
table.toggleAllRowsSelected(false);
|
|
1288
|
+
if (tableOptions.onColumnFiltersChange) {
|
|
1289
|
+
tableOptions.onColumnFiltersChange(updaterOrValue);
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
1292
|
+
autoResetPageIndex: false,
|
|
1293
|
+
columnResizeMode: "onChange",
|
|
1294
|
+
...tableOptions
|
|
1295
|
+
});
|
|
1296
|
+
const [hasInitializedSizing, setHasInitializedSizing] = useState9(false);
|
|
1297
|
+
useEffect11(() => {
|
|
1298
|
+
if (!hasInitializedSizing && ref.current) {
|
|
1299
|
+
setHasInitializedSizing(true);
|
|
1300
|
+
table.setColumnSizing(updateColumnSizes(columnSizing));
|
|
1301
|
+
}
|
|
1302
|
+
}, [columnSizing, hasInitializedSizing]);
|
|
1303
|
+
useResizeCallbackWrapper(useCallback3(() => {
|
|
1304
|
+
table.setColumnSizing(updateColumnSizes);
|
|
1305
|
+
}, [updateColumnSizes]));
|
|
1306
|
+
const pageCount = table.getPageCount();
|
|
1307
|
+
useEffect11(() => {
|
|
1308
|
+
const totalPages = pageCount;
|
|
1309
|
+
if (totalPages === 0) {
|
|
1310
|
+
if (pagination.pageIndex !== 0) {
|
|
1311
|
+
table.setPagination((prevState) => ({
|
|
1312
|
+
...prevState,
|
|
1313
|
+
pageIndex: 0
|
|
1314
|
+
}));
|
|
1315
|
+
}
|
|
1316
|
+
} else if (pagination.pageIndex >= totalPages) {
|
|
1317
|
+
table.setPagination((prev) => ({
|
|
1318
|
+
...prev,
|
|
1319
|
+
pageIndex: totalPages - 1
|
|
1320
|
+
}));
|
|
1321
|
+
}
|
|
1322
|
+
}, [data, pageCount, pagination.pageSize, pagination.pageIndex]);
|
|
1323
|
+
const columnSizeVars = useMemo(() => {
|
|
1324
|
+
const headers = table.getFlatHeaders();
|
|
1325
|
+
const colSizes = {};
|
|
1326
|
+
for (let i = 0; i < headers.length; i++) {
|
|
1327
|
+
const header = headers[i];
|
|
1328
|
+
colSizes[`--header-${header.id}-size`] = header.getSize();
|
|
1329
|
+
colSizes[`--col-${header.column.id}-size`] = header.column.getSize();
|
|
1330
|
+
}
|
|
1331
|
+
return colSizes;
|
|
1332
|
+
}, [table.getState().columnSizingInfo, table.getState().columnSizing]);
|
|
1333
|
+
return /* @__PURE__ */ jsxs7("div", { ref, className: clsx10("col gap-y-4", className), children: [
|
|
1334
|
+
/* @__PURE__ */ jsx12(Scrollbars, { autoHeight: true, autoHeightMax: tableRef.current?.offsetHeight, autoHide: true, children: /* @__PURE__ */ jsxs7(
|
|
1335
|
+
"table",
|
|
1336
|
+
{
|
|
1337
|
+
ref: tableRef,
|
|
1338
|
+
className: clsx10(tableClassName),
|
|
1339
|
+
style: {
|
|
1340
|
+
...columnSizeVars,
|
|
1341
|
+
width: Math.max(table.getTotalSize(), ref.current?.offsetWidth ?? table.getTotalSize())
|
|
1342
|
+
},
|
|
1343
|
+
children: [
|
|
1344
|
+
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12("colgroup", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx12(
|
|
1345
|
+
"col",
|
|
1346
|
+
{
|
|
1347
|
+
style: {
|
|
1348
|
+
width: `calc(var(--header-${header?.id}-size) * 1px)`,
|
|
1349
|
+
minWidth: header.column.columnDef.minSize,
|
|
1350
|
+
maxWidth: header.column.columnDef.maxSize
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
header.id
|
|
1354
|
+
)) }, headerGroup.id)),
|
|
1355
|
+
/* @__PURE__ */ jsx12("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12("tr", { className: table.options.meta?.headerRowClassName, children: headerGroup.headers.map((header) => {
|
|
1356
|
+
return /* @__PURE__ */ jsxs7(
|
|
1357
|
+
"th",
|
|
1358
|
+
{
|
|
1359
|
+
colSpan: header.colSpan,
|
|
1360
|
+
className: clsx10("relative group", header.column.columnDef.meta?.className),
|
|
1361
|
+
children: [
|
|
1362
|
+
/* @__PURE__ */ jsx12("div", { className: "row w-full", children: header.isPlaceholder ? null : /* @__PURE__ */ jsxs7("div", { className: "row gap-x-1 items-center", children: [
|
|
1363
|
+
header.column.getCanSort() && /* @__PURE__ */ jsx12(
|
|
1364
|
+
TableSortButton,
|
|
1365
|
+
{
|
|
1366
|
+
sortDirection: header.column.getIsSorted(),
|
|
1367
|
+
onClick: () => header.column.toggleSorting()
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
header.column.getCanFilter() && header.column.columnDef.meta?.filterType ? /* @__PURE__ */ jsx12(
|
|
1371
|
+
TableFilterButton,
|
|
1372
|
+
{
|
|
1373
|
+
column: header.column,
|
|
1374
|
+
filterType: header.column.columnDef.meta.filterType
|
|
1375
|
+
}
|
|
1376
|
+
) : null,
|
|
1377
|
+
flexRender(
|
|
1378
|
+
header.column.columnDef.header,
|
|
1379
|
+
header.getContext()
|
|
1380
|
+
)
|
|
1381
|
+
] }) }),
|
|
1382
|
+
header.column.getCanResize() && /* @__PURE__ */ jsx12(
|
|
1383
|
+
"div",
|
|
1384
|
+
{
|
|
1385
|
+
onMouseDown: header.getResizeHandler(),
|
|
1386
|
+
onTouchStart: header.getResizeHandler(),
|
|
1387
|
+
onDoubleClick: () => {
|
|
1388
|
+
header.column.resetSize();
|
|
1389
|
+
},
|
|
1390
|
+
className: "table-resize-indicator w-2 rounded bg-primary cursor-col-resize select-none touch-none opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1391
|
+
style: {
|
|
1392
|
+
opacity: !columnSizingInfo?.columnSizingStart ? void 0 : columnSizingInfo?.columnSizingStart?.findIndex(([id, _]) => id === header.column.id) !== -1 ? 1 : columnSizingInfo?.columnSizingStart?.length !== 0 ? 0 : void 0
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
)
|
|
1396
|
+
]
|
|
1397
|
+
},
|
|
1398
|
+
header.id
|
|
1399
|
+
);
|
|
1400
|
+
}) }, headerGroup.id)) }),
|
|
1401
|
+
/* @__PURE__ */ jsxs7("tbody", { children: [
|
|
1402
|
+
table.getRowModel().rows.map((row) => {
|
|
1403
|
+
return /* @__PURE__ */ jsx12("tr", { onClick: () => onRowClick(row, table), className: table.options.meta?.bodyRowClassName, children: row.getVisibleCells().map((cell) => {
|
|
1404
|
+
return /* @__PURE__ */ jsx12("td", { children: flexRender(
|
|
1405
|
+
cell.column.columnDef.cell,
|
|
1406
|
+
cell.getContext()
|
|
1407
|
+
) }, cell.id);
|
|
1408
|
+
}) }, row.id);
|
|
1409
|
+
}),
|
|
1410
|
+
range(table.getState().pagination.pageSize - table.getRowModel().rows.length, { allowEmptyRange: true }).map((row, index) => {
|
|
1411
|
+
return /* @__PURE__ */ jsx12("tr", { children: columns.map((column) => {
|
|
1412
|
+
return /* @__PURE__ */ jsx12("td", { children: fillerRow ? fillerRow(column.id, table) : /* @__PURE__ */ jsx12(FillerRowElement, {}) }, column.id);
|
|
1413
|
+
}) }, "filler-row-" + index);
|
|
1414
|
+
})
|
|
1415
|
+
] })
|
|
1416
|
+
]
|
|
1417
|
+
}
|
|
1418
|
+
) }),
|
|
1419
|
+
/* @__PURE__ */ jsx12("div", { className: "row justify-center", children: /* @__PURE__ */ jsx12(
|
|
1420
|
+
Pagination,
|
|
1421
|
+
{
|
|
1422
|
+
pageIndex: table.getState().pagination.pageIndex,
|
|
1423
|
+
pageCount: table.getPageCount(),
|
|
1424
|
+
onPageChanged: (page) => table.setPageIndex(page)
|
|
1425
|
+
}
|
|
1426
|
+
) })
|
|
1427
|
+
] });
|
|
1428
|
+
};
|
|
1429
|
+
var TableUncontrolled = ({ data, ...props }) => {
|
|
1430
|
+
const [usedDate, setUsedData] = useState9(data);
|
|
1431
|
+
useEffect11(() => {
|
|
1432
|
+
setUsedData(data);
|
|
1433
|
+
}, [data]);
|
|
1434
|
+
return /* @__PURE__ */ jsx12(
|
|
1435
|
+
Table,
|
|
1436
|
+
{
|
|
1437
|
+
...props,
|
|
1438
|
+
data: usedDate
|
|
1439
|
+
}
|
|
1440
|
+
);
|
|
1441
|
+
};
|
|
1442
|
+
var TableWithSelection = ({
|
|
1443
|
+
columns,
|
|
1444
|
+
state,
|
|
1445
|
+
fillerRow,
|
|
1446
|
+
rowSelection,
|
|
1447
|
+
selectionRowId = "selection",
|
|
1448
|
+
onRowClick = noop,
|
|
1449
|
+
meta,
|
|
1450
|
+
...props
|
|
1451
|
+
}) => {
|
|
1452
|
+
const columnsWithSelection = useMemo(() => {
|
|
1453
|
+
return [
|
|
1454
|
+
{
|
|
1455
|
+
id: selectionRowId,
|
|
1456
|
+
header: ({ table }) => {
|
|
1457
|
+
return /* @__PURE__ */ jsx12(
|
|
1458
|
+
Checkbox,
|
|
1459
|
+
{
|
|
1460
|
+
checked: table.getIsSomeRowsSelected() ? "indeterminate" : table.getIsAllRowsSelected(),
|
|
1461
|
+
onChangeTristate: (value) => {
|
|
1462
|
+
const newValue = !!value;
|
|
1463
|
+
table.toggleAllRowsSelected(newValue);
|
|
1464
|
+
},
|
|
1465
|
+
containerClassName: "max-w-6"
|
|
1466
|
+
}
|
|
1467
|
+
);
|
|
1468
|
+
},
|
|
1469
|
+
cell: ({ row }) => {
|
|
1470
|
+
return /* @__PURE__ */ jsx12(
|
|
1471
|
+
Checkbox,
|
|
1472
|
+
{
|
|
1473
|
+
disabled: !row.getCanSelect(),
|
|
1474
|
+
checked: row.getIsSelected(),
|
|
1475
|
+
onChange: row.getToggleSelectedHandler(),
|
|
1476
|
+
containerClassName: "max-w-6"
|
|
1477
|
+
}
|
|
1478
|
+
);
|
|
1479
|
+
},
|
|
1480
|
+
size: 60,
|
|
1481
|
+
minSize: 60,
|
|
1482
|
+
maxSize: 60,
|
|
1483
|
+
enableResizing: false,
|
|
1484
|
+
enableSorting: false
|
|
1485
|
+
},
|
|
1486
|
+
...columns
|
|
1487
|
+
];
|
|
1488
|
+
}, [columns, selectionRowId]);
|
|
1489
|
+
return /* @__PURE__ */ jsx12(
|
|
1490
|
+
Table,
|
|
1491
|
+
{
|
|
1492
|
+
columns: columnsWithSelection,
|
|
1493
|
+
fillerRow: (columnId, table) => {
|
|
1494
|
+
if (columnId === selectionRowId) {
|
|
1495
|
+
return /* @__PURE__ */ jsx12(Checkbox, { checked: false, disabled: true, containerClassName: "max-w-6" });
|
|
1496
|
+
}
|
|
1497
|
+
return fillerRow ? fillerRow(columnId, table) : /* @__PURE__ */ jsx12(FillerRowElement, {});
|
|
1498
|
+
},
|
|
1499
|
+
state: {
|
|
1500
|
+
rowSelection,
|
|
1501
|
+
...state
|
|
1502
|
+
},
|
|
1503
|
+
onRowClick: (row, table) => {
|
|
1504
|
+
row.toggleSelected();
|
|
1505
|
+
onRowClick(row, table);
|
|
1506
|
+
},
|
|
1507
|
+
meta: {
|
|
1508
|
+
bodyRowClassName: "cursor-pointer",
|
|
1509
|
+
...meta
|
|
1510
|
+
},
|
|
1511
|
+
...props
|
|
1512
|
+
}
|
|
1513
|
+
);
|
|
1514
|
+
};
|
|
1515
|
+
export {
|
|
1516
|
+
Table,
|
|
1517
|
+
TableUncontrolled,
|
|
1518
|
+
TableWithSelection
|
|
1519
|
+
};
|
|
1520
|
+
//# sourceMappingURL=Table.mjs.map
|