react-better-html 1.1.103 → 1.1.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +50 -5
- package/dist/index.d.ts +50 -5
- package/dist/index.js +640 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +726 -136
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1495,6 +1495,26 @@ var icons = {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
]
|
|
1497
1497
|
},
|
|
1498
|
+
doubleChevronLeft: {
|
|
1499
|
+
width: 512,
|
|
1500
|
+
height: 512,
|
|
1501
|
+
paths: [
|
|
1502
|
+
{
|
|
1503
|
+
d: "M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z",
|
|
1504
|
+
type: "fill"
|
|
1505
|
+
}
|
|
1506
|
+
]
|
|
1507
|
+
},
|
|
1508
|
+
doubleChevronRight: {
|
|
1509
|
+
width: 512,
|
|
1510
|
+
height: 512,
|
|
1511
|
+
paths: [
|
|
1512
|
+
{
|
|
1513
|
+
d: "M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z",
|
|
1514
|
+
type: "fill"
|
|
1515
|
+
}
|
|
1516
|
+
]
|
|
1517
|
+
},
|
|
1498
1518
|
eye: {
|
|
1499
1519
|
width: 576,
|
|
1500
1520
|
height: 512,
|
|
@@ -1534,6 +1554,16 @@ var icons = {
|
|
|
1534
1554
|
type: "fill"
|
|
1535
1555
|
}
|
|
1536
1556
|
]
|
|
1557
|
+
},
|
|
1558
|
+
filter: {
|
|
1559
|
+
width: 512,
|
|
1560
|
+
height: 512,
|
|
1561
|
+
paths: [
|
|
1562
|
+
{
|
|
1563
|
+
d: "M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z",
|
|
1564
|
+
type: "fill"
|
|
1565
|
+
}
|
|
1566
|
+
]
|
|
1537
1567
|
}
|
|
1538
1568
|
};
|
|
1539
1569
|
|
|
@@ -2315,14 +2345,19 @@ DivComponent.column = (0, import_react3.forwardRef)(function Column({ flexRevers
|
|
|
2315
2345
|
DivComponent.grid = (0, import_react3.forwardRef)(function Grid(props, ref) {
|
|
2316
2346
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DivComponent, { display: "grid", ref, ...props });
|
|
2317
2347
|
});
|
|
2318
|
-
DivComponent.box = (0, import_react3.forwardRef)(function Box(props, ref) {
|
|
2348
|
+
DivComponent.box = (0, import_react3.forwardRef)(function Box({ isActive, ...props }, ref) {
|
|
2319
2349
|
const theme2 = useTheme();
|
|
2350
|
+
const withClick = props.onClick || props.onClickWithValue;
|
|
2320
2351
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2321
2352
|
DivComponent,
|
|
2322
2353
|
{
|
|
2323
|
-
|
|
2324
|
-
|
|
2354
|
+
color: isActive ? theme2.colors.base : void 0,
|
|
2355
|
+
backgroundColor: isActive ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
2356
|
+
border: `1px solid ${isActive ? theme2.colors.primary : theme2.colors.border}`,
|
|
2325
2357
|
borderRadius: theme2.styles.borderRadius,
|
|
2358
|
+
borderColorHover: withClick && !isActive ? theme2.colors.primary : void 0,
|
|
2359
|
+
filterHover: withClick && isActive ? "brightness(0.9)" : void 0,
|
|
2360
|
+
cursor: withClick ? "pointer" : void 0,
|
|
2326
2361
|
paddingBlock: theme2.styles.gap,
|
|
2327
2362
|
paddingInline: theme2.styles.space,
|
|
2328
2363
|
ref,
|
|
@@ -3130,7 +3165,7 @@ var Modal_default = Modal2;
|
|
|
3130
3165
|
// src/components/PageHolder.tsx
|
|
3131
3166
|
var import_react12 = require("react");
|
|
3132
3167
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3133
|
-
var PageHolderComponent = (0, import_react12.forwardRef)(function PageHolder({ noMaxContentWidth,
|
|
3168
|
+
var PageHolderComponent = (0, import_react12.forwardRef)(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3134
3169
|
const theme2 = useTheme();
|
|
3135
3170
|
const { app } = useBetterHtmlContextInternal();
|
|
3136
3171
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -3139,7 +3174,6 @@ var PageHolderComponent = (0, import_react12.forwardRef)(function PageHolder({ n
|
|
|
3139
3174
|
as: "main",
|
|
3140
3175
|
width: "100%",
|
|
3141
3176
|
maxWidth: !noMaxContentWidth ? app.contentMaxWidth : void 0,
|
|
3142
|
-
backgroundColor,
|
|
3143
3177
|
margin: "0px auto",
|
|
3144
3178
|
padding: theme2.styles.space,
|
|
3145
3179
|
...props,
|
|
@@ -3148,8 +3182,55 @@ var PageHolderComponent = (0, import_react12.forwardRef)(function PageHolder({ n
|
|
|
3148
3182
|
}
|
|
3149
3183
|
);
|
|
3150
3184
|
});
|
|
3151
|
-
PageHolderComponent.center = (0, import_react12.forwardRef)(function Center(
|
|
3152
|
-
|
|
3185
|
+
PageHolderComponent.center = (0, import_react12.forwardRef)(function Center({
|
|
3186
|
+
decorationImageSrc,
|
|
3187
|
+
decorationImageName,
|
|
3188
|
+
decorationImagePosition = "right",
|
|
3189
|
+
noMaxContentWidth,
|
|
3190
|
+
children,
|
|
3191
|
+
...props
|
|
3192
|
+
}, ref) {
|
|
3193
|
+
const theme2 = useTheme();
|
|
3194
|
+
const mediaQuery = useMediaQuery();
|
|
3195
|
+
const { app } = useBetterHtmlContextInternal();
|
|
3196
|
+
const breakingPoint = mediaQuery.size1000;
|
|
3197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.row, { width: "100%", minHeight: "100svh", alignItems: "center", justifyContent: "center", children: [
|
|
3198
|
+
decorationImagePosition === "left" && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { width: "50%" }),
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3200
|
+
Div_default.column,
|
|
3201
|
+
{
|
|
3202
|
+
width: `${!breakingPoint && (decorationImageSrc || decorationImageName) ? 50 : 100}%`,
|
|
3203
|
+
alignItems: "center",
|
|
3204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3205
|
+
Div_default.box,
|
|
3206
|
+
{
|
|
3207
|
+
width: `calc(100% - ${theme2.styles.space}px * 2)`,
|
|
3208
|
+
maxWidth: !noMaxContentWidth ? app.contentMaxWidth / 2 : void 0,
|
|
3209
|
+
marginInline: theme2.styles.space,
|
|
3210
|
+
marginBlock: theme2.styles.space,
|
|
3211
|
+
...props,
|
|
3212
|
+
ref,
|
|
3213
|
+
children
|
|
3214
|
+
}
|
|
3215
|
+
)
|
|
3216
|
+
}
|
|
3217
|
+
),
|
|
3218
|
+
decorationImagePosition === "right" && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { width: "50%" }),
|
|
3219
|
+
(decorationImageSrc || decorationImageName) && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3220
|
+
Image_default,
|
|
3221
|
+
{
|
|
3222
|
+
position: "fixed",
|
|
3223
|
+
name: decorationImageName,
|
|
3224
|
+
src: decorationImageSrc,
|
|
3225
|
+
width: "50%",
|
|
3226
|
+
height: "100svh",
|
|
3227
|
+
top: 0,
|
|
3228
|
+
left: decorationImagePosition === "left" ? 0 : "auto",
|
|
3229
|
+
right: decorationImagePosition === "right" ? 0 : "auto",
|
|
3230
|
+
objectFit: "cover"
|
|
3231
|
+
}
|
|
3232
|
+
)
|
|
3233
|
+
] });
|
|
3153
3234
|
});
|
|
3154
3235
|
var PageHolder2 = (0, import_react12.memo)(PageHolderComponent);
|
|
3155
3236
|
PageHolder2.center = PageHolderComponent.center;
|
|
@@ -5508,10 +5589,19 @@ var InputElement = import_styled_components9.default.input.withConfig({
|
|
|
5508
5589
|
cursor: not-allowed;
|
|
5509
5590
|
}
|
|
5510
5591
|
|
|
5592
|
+
&::-webkit-outer-spin-button,
|
|
5593
|
+
&::-webkit-inner-spin-button {
|
|
5594
|
+
-webkit-appearance: none;
|
|
5595
|
+
margin: 0;
|
|
5596
|
+
}
|
|
5597
|
+
|
|
5598
|
+
&[type="number"] {
|
|
5599
|
+
-moz-appearance: textfield;
|
|
5600
|
+
}
|
|
5601
|
+
|
|
5511
5602
|
&[type="date"],
|
|
5512
5603
|
&[type="datetime-local"],
|
|
5513
5604
|
&[type="time"] {
|
|
5514
|
-
// min-height: 46px;
|
|
5515
5605
|
-webkit-appearance: none;
|
|
5516
5606
|
-moz-appearance: textfield;
|
|
5517
5607
|
|
|
@@ -5665,7 +5755,7 @@ var InputFieldComponent = (0, import_react18.forwardRef)(function InputField({
|
|
|
5665
5755
|
onChangeValue?.(debouncedValue);
|
|
5666
5756
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
5667
5757
|
const readyId = id ?? internalId;
|
|
5668
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
|
|
5758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [
|
|
5669
5759
|
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5670
5760
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
|
|
5671
5761
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -5760,7 +5850,7 @@ InputFieldComponent.multiline = (0, import_react18.forwardRef)(function Multilin
|
|
|
5760
5850
|
[onChange, onChangeValue]
|
|
5761
5851
|
);
|
|
5762
5852
|
const readyId = id ?? internalId;
|
|
5763
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap, children: [
|
|
5853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
5764
5854
|
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
|
|
5765
5855
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
5766
5856
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -5911,7 +6001,7 @@ InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneN
|
|
|
5911
6001
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
5912
6002
|
}, [value]);
|
|
5913
6003
|
const readyId = id ?? internalId;
|
|
5914
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, children: [
|
|
6004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
5915
6005
|
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5916
6006
|
Label_default,
|
|
5917
6007
|
{
|
|
@@ -5937,7 +6027,8 @@ InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneN
|
|
|
5937
6027
|
value: dropdownValue,
|
|
5938
6028
|
disabled: props.disabled,
|
|
5939
6029
|
onChange: setDropdownValue,
|
|
5940
|
-
withoutClearButton: true
|
|
6030
|
+
withoutClearButton: true,
|
|
6031
|
+
withoutRenderingOptionsWhenClosed: true
|
|
5941
6032
|
}
|
|
5942
6033
|
),
|
|
5943
6034
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -6593,11 +6684,13 @@ var FormComponent = (0, import_react20.forwardRef)(function Form({
|
|
|
6593
6684
|
submitButtonLoaderName,
|
|
6594
6685
|
submitButtonId,
|
|
6595
6686
|
submitButtonIsDisabled,
|
|
6687
|
+
cancelButtonText,
|
|
6596
6688
|
actionButtonsLocation = "right",
|
|
6597
6689
|
gap,
|
|
6598
6690
|
isSubmitting,
|
|
6599
6691
|
isDestructive,
|
|
6600
6692
|
withDividers,
|
|
6693
|
+
renderActionButtons,
|
|
6601
6694
|
onClickCancel,
|
|
6602
6695
|
onSubmit,
|
|
6603
6696
|
children,
|
|
@@ -6625,7 +6718,8 @@ var FormComponent = (0, import_react20.forwardRef)(function Form({
|
|
|
6625
6718
|
gap: theme2.styles.gap,
|
|
6626
6719
|
marginTop: theme2.styles.space,
|
|
6627
6720
|
children: [
|
|
6628
|
-
|
|
6721
|
+
renderActionButtons,
|
|
6722
|
+
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.secondary, { text: cancelButtonText ?? "Cancel", onClick: onClickCancel }),
|
|
6629
6723
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
6630
6724
|
SubmitButtonTag,
|
|
6631
6725
|
{
|
|
@@ -6766,6 +6860,7 @@ var import_react23 = require("react");
|
|
|
6766
6860
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
6767
6861
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6768
6862
|
var defaultImageWidth = 120;
|
|
6863
|
+
var maximumVisiblePages = 11;
|
|
6769
6864
|
var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
6770
6865
|
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
6771
6866
|
})`
|
|
@@ -6781,6 +6876,10 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
|
6781
6876
|
font-weight: 700;
|
|
6782
6877
|
}
|
|
6783
6878
|
|
|
6879
|
+
&.isFooter {
|
|
6880
|
+
background-color: ${(props) => props.theme.colors.backgroundSecondary};
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6784
6883
|
&.isClickable {
|
|
6785
6884
|
cursor: pointer;
|
|
6786
6885
|
}
|
|
@@ -6829,6 +6928,19 @@ var TdStyledComponent = import_styled_components11.default.td.withConfig({
|
|
|
6829
6928
|
})`
|
|
6830
6929
|
${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
|
|
6831
6930
|
`;
|
|
6931
|
+
var filterPresetsText = {
|
|
6932
|
+
today: "Today",
|
|
6933
|
+
yesterday: "Yesterday",
|
|
6934
|
+
thisWeek: "This week",
|
|
6935
|
+
thisMonth: "This month",
|
|
6936
|
+
thisYear: "This year",
|
|
6937
|
+
lastWeek: "Last week",
|
|
6938
|
+
lastMonth: "Last month",
|
|
6939
|
+
lastYear: "Last year",
|
|
6940
|
+
nextWeek: "Next week",
|
|
6941
|
+
nextMonth: "Next month",
|
|
6942
|
+
nextYear: "Next year"
|
|
6943
|
+
};
|
|
6832
6944
|
var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
6833
6945
|
columns,
|
|
6834
6946
|
data,
|
|
@@ -6836,13 +6948,50 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
6836
6948
|
isLoading,
|
|
6837
6949
|
withStickyHeader,
|
|
6838
6950
|
noDataItemsMessage = "No data available",
|
|
6951
|
+
pageSize,
|
|
6839
6952
|
onClickRow,
|
|
6840
6953
|
onClickAllCheckboxes,
|
|
6954
|
+
onChangePage,
|
|
6955
|
+
onChangeFilter,
|
|
6841
6956
|
...props
|
|
6842
6957
|
}, ref) {
|
|
6843
|
-
const { colorTheme } = useBetterHtmlContextInternal();
|
|
6844
6958
|
const theme2 = useTheme();
|
|
6959
|
+
const mediumScreen = useMediaQuery();
|
|
6960
|
+
const { colorTheme } = useBetterHtmlContextInternal();
|
|
6961
|
+
const filterModalRef = (0, import_react23.useRef)(null);
|
|
6845
6962
|
const [checkedItems, setCheckedItems] = (0, import_react23.useState)([]);
|
|
6963
|
+
const [currentPage, setCurrentPage] = (0, import_react23.useState)(1);
|
|
6964
|
+
const [filterData, setFilterData] = (0, import_react23.useState)({});
|
|
6965
|
+
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react23.useState)();
|
|
6966
|
+
const [filterListSelectedItems, setFilterListSelectedItems] = (0, import_react23.useState)();
|
|
6967
|
+
const openedFilterData = openedFilterColumnIndex ? filterData[openedFilterColumnIndex] : void 0;
|
|
6968
|
+
const openedFilterColumn = openedFilterColumnIndex ? columns[openedFilterColumnIndex] : void 0;
|
|
6969
|
+
const filterForm = useForm({
|
|
6970
|
+
defaultValues: {
|
|
6971
|
+
min: void 0,
|
|
6972
|
+
max: void 0
|
|
6973
|
+
},
|
|
6974
|
+
onSubmit: (values) => {
|
|
6975
|
+
if (!openedFilterColumn?.filter) return;
|
|
6976
|
+
if (openedFilterColumnIndex === void 0) return;
|
|
6977
|
+
setFilterData((oldValue) => ({
|
|
6978
|
+
...oldValue,
|
|
6979
|
+
[openedFilterColumnIndex]: openedFilterColumn.filter === "number" ? {
|
|
6980
|
+
type: openedFilterColumn.filter,
|
|
6981
|
+
min: values.min,
|
|
6982
|
+
max: values.max
|
|
6983
|
+
} : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? {
|
|
6984
|
+
type: openedFilterColumn.filter,
|
|
6985
|
+
min: values.min,
|
|
6986
|
+
max: values.max
|
|
6987
|
+
} : openedFilterColumn.filter === "list" ? {
|
|
6988
|
+
type: openedFilterColumn.filter,
|
|
6989
|
+
list: filterListSelectedItems
|
|
6990
|
+
} : void 0
|
|
6991
|
+
}));
|
|
6992
|
+
filterModalRef.current?.close();
|
|
6993
|
+
}
|
|
6994
|
+
});
|
|
6846
6995
|
const renderCellContent = (0, import_react23.useCallback)(
|
|
6847
6996
|
(column, item, index) => {
|
|
6848
6997
|
switch (column.type) {
|
|
@@ -6895,57 +7044,489 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
6895
7044
|
},
|
|
6896
7045
|
[onClickAllCheckboxes, data]
|
|
6897
7046
|
);
|
|
7047
|
+
const onClickFilterButton = (0, import_react23.useCallback)(
|
|
7048
|
+
(columnIndex) => {
|
|
7049
|
+
const thisFilterData = filterData[columnIndex];
|
|
7050
|
+
if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
|
|
7051
|
+
filterForm.setFieldsValue({
|
|
7052
|
+
min: thisFilterData.min ?? void 0,
|
|
7053
|
+
max: thisFilterData.max ?? void 0
|
|
7054
|
+
});
|
|
7055
|
+
} else if (thisFilterData?.type === "list") {
|
|
7056
|
+
setFilterListSelectedItems(thisFilterData.list);
|
|
7057
|
+
}
|
|
7058
|
+
setOpenedFilterColumnIndex(columnIndex);
|
|
7059
|
+
filterModalRef.current?.open();
|
|
7060
|
+
},
|
|
7061
|
+
[filterData]
|
|
7062
|
+
);
|
|
7063
|
+
const onCloseFilterModal = (0, import_react23.useCallback)(() => {
|
|
7064
|
+
setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
|
|
7065
|
+
setFilterListSelectedItems(void 0);
|
|
7066
|
+
filterForm.reset();
|
|
7067
|
+
}, []);
|
|
7068
|
+
const onClickCancelFormFilter = (0, import_react23.useCallback)(() => {
|
|
7069
|
+
if (openedFilterColumnIndex === void 0) return;
|
|
7070
|
+
setFilterData((oldValue) => ({
|
|
7071
|
+
...oldValue,
|
|
7072
|
+
[openedFilterColumnIndex]: void 0
|
|
7073
|
+
}));
|
|
7074
|
+
filterModalRef.current?.close();
|
|
7075
|
+
}, [openedFilterColumnIndex]);
|
|
7076
|
+
const onClickFilterListItem = (0, import_react23.useCallback)(
|
|
7077
|
+
(value) => setFilterListSelectedItems((oldValue) => {
|
|
7078
|
+
if (!oldValue) return [value];
|
|
7079
|
+
if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
|
|
7080
|
+
return [...oldValue, value];
|
|
7081
|
+
}),
|
|
7082
|
+
[]
|
|
7083
|
+
);
|
|
7084
|
+
const onClickFilterPreset = (0, import_react23.useCallback)(
|
|
7085
|
+
(preset) => {
|
|
7086
|
+
const getValueForDate = (date) => {
|
|
7087
|
+
if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
|
|
7088
|
+
return date.toISOString();
|
|
7089
|
+
};
|
|
7090
|
+
switch (preset) {
|
|
7091
|
+
case "today":
|
|
7092
|
+
filterForm.setFieldsValue({
|
|
7093
|
+
min: getValueForDate(/* @__PURE__ */ new Date()),
|
|
7094
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7095
|
+
});
|
|
7096
|
+
break;
|
|
7097
|
+
case "yesterday":
|
|
7098
|
+
filterForm.setFieldsValue({
|
|
7099
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1))),
|
|
7100
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7101
|
+
});
|
|
7102
|
+
break;
|
|
7103
|
+
case "thisWeek":
|
|
7104
|
+
filterForm.setFieldsValue({
|
|
7105
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
|
|
7106
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7107
|
+
});
|
|
7108
|
+
break;
|
|
7109
|
+
case "thisMonth":
|
|
7110
|
+
filterForm.setFieldsValue({
|
|
7111
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
|
|
7112
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7113
|
+
});
|
|
7114
|
+
break;
|
|
7115
|
+
case "thisYear":
|
|
7116
|
+
filterForm.setFieldsValue({
|
|
7117
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
|
|
7118
|
+
max: getValueForDate(/* @__PURE__ */ new Date())
|
|
7119
|
+
});
|
|
7120
|
+
break;
|
|
7121
|
+
case "lastWeek":
|
|
7122
|
+
filterForm.setFieldsValue({
|
|
7123
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
|
|
7124
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7125
|
+
});
|
|
7126
|
+
break;
|
|
7127
|
+
case "lastMonth":
|
|
7128
|
+
filterForm.setFieldsValue({
|
|
7129
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
|
|
7130
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7131
|
+
});
|
|
7132
|
+
break;
|
|
7133
|
+
case "lastYear":
|
|
7134
|
+
filterForm.setFieldsValue({
|
|
7135
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
|
|
7136
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
|
|
7137
|
+
});
|
|
7138
|
+
break;
|
|
7139
|
+
case "nextWeek":
|
|
7140
|
+
filterForm.setFieldsValue({
|
|
7141
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7))),
|
|
7142
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7)))
|
|
7143
|
+
});
|
|
7144
|
+
break;
|
|
7145
|
+
case "nextMonth":
|
|
7146
|
+
filterForm.setFieldsValue({
|
|
7147
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1))),
|
|
7148
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1)))
|
|
7149
|
+
});
|
|
7150
|
+
break;
|
|
7151
|
+
case "nextYear":
|
|
7152
|
+
filterForm.setFieldsValue({
|
|
7153
|
+
min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1))),
|
|
7154
|
+
max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1)))
|
|
7155
|
+
});
|
|
7156
|
+
break;
|
|
7157
|
+
default:
|
|
7158
|
+
break;
|
|
7159
|
+
}
|
|
7160
|
+
},
|
|
7161
|
+
[openedFilterColumn]
|
|
7162
|
+
);
|
|
7163
|
+
const dataAfterFilter = (0, import_react23.useMemo)(
|
|
7164
|
+
() => data.filter(
|
|
7165
|
+
(item) => Object.entries(filterData).every(([columnIndex, filter]) => {
|
|
7166
|
+
if (!filter) return true;
|
|
7167
|
+
const column = columns[parseInt(columnIndex)];
|
|
7168
|
+
if (!column) return true;
|
|
7169
|
+
if (column.filter === "number" && filter.type === "number") {
|
|
7170
|
+
const itemValue = column.getValue?.(item) ?? (column.type === "text" && column.keyName ? Number(item[column.keyName]) : 0);
|
|
7171
|
+
if (filter.min !== void 0 && itemValue < filter.min) return false;
|
|
7172
|
+
if (filter.max !== void 0 && itemValue > filter.max) return false;
|
|
7173
|
+
} else if (column.filter === "date" && filter.type === "date" || column.filter === "date-time" && filter.type === "date-time") {
|
|
7174
|
+
const minDate = filter.min ? new Date(filter.min) : void 0;
|
|
7175
|
+
const maxDate = filter.max ? new Date(filter.max) : void 0;
|
|
7176
|
+
const itemValue = column.getValue?.(item) ?? new Date(column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7177
|
+
if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
|
|
7178
|
+
if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
|
|
7179
|
+
} else if (column.filter === "list" && filter.type === "list") {
|
|
7180
|
+
const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7181
|
+
if (!filter.list?.includes(itemValue)) return false;
|
|
7182
|
+
}
|
|
7183
|
+
return true;
|
|
7184
|
+
})
|
|
7185
|
+
),
|
|
7186
|
+
[data, filterData, columns]
|
|
7187
|
+
);
|
|
7188
|
+
const dataAfterPagination = (0, import_react23.useMemo)(() => {
|
|
7189
|
+
if (pageSize === void 0) return dataAfterFilter;
|
|
7190
|
+
const pageStartItemIndex = (currentPage - 1) * (pageSize ?? 0);
|
|
7191
|
+
const pageEndItemIndex = pageStartItemIndex + (pageSize ?? 0);
|
|
7192
|
+
return dataAfterFilter.slice(pageStartItemIndex, pageEndItemIndex);
|
|
7193
|
+
}, [dataAfterFilter, pageSize, currentPage]);
|
|
6898
7194
|
const everythingIsChecked = (0, import_react23.useMemo)(() => {
|
|
6899
7195
|
return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
|
|
6900
7196
|
}, [data, checkedItems]);
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
ThStyledComponent,
|
|
6920
|
-
{
|
|
6921
|
-
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
6922
|
-
minWidth: column.minWidth,
|
|
6923
|
-
maxWidth: column.maxWidth,
|
|
6924
|
-
textAlign: column.align,
|
|
6925
|
-
children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6926
|
-
ToggleInput_default.checkbox,
|
|
6927
|
-
{
|
|
6928
|
-
checked: everythingIsChecked,
|
|
6929
|
-
onChange: onClickAllCheckboxesElement
|
|
6930
|
-
}
|
|
6931
|
-
) : "")
|
|
6932
|
-
},
|
|
6933
|
-
column.type + column.label + index
|
|
6934
|
-
)) }) }),
|
|
6935
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6936
|
-
"tr",
|
|
6937
|
-
{
|
|
6938
|
-
className: onClickRow ? "isClickable" : void 0,
|
|
6939
|
-
onClick: () => onClickRowElement(item, rowIndex),
|
|
6940
|
-
children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
6941
|
-
},
|
|
6942
|
-
JSON.stringify(item) + rowIndex
|
|
6943
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) })
|
|
6944
|
-
]
|
|
7197
|
+
const possibleFilterListValues = (0, import_react23.useMemo)(() => {
|
|
7198
|
+
if (!openedFilterColumn) return [];
|
|
7199
|
+
return data.reduce(
|
|
7200
|
+
(previousValue, currentValue) => {
|
|
7201
|
+
const value = openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
|
|
7202
|
+
if (value !== void 0) {
|
|
7203
|
+
if (previousValue.some((item) => item.value === value)) {
|
|
7204
|
+
previousValue = previousValue.map(
|
|
7205
|
+
(item) => item.value === value ? {
|
|
7206
|
+
...item,
|
|
7207
|
+
count: item.count + 1
|
|
7208
|
+
} : item
|
|
7209
|
+
);
|
|
7210
|
+
} else
|
|
7211
|
+
previousValue.push({
|
|
7212
|
+
value,
|
|
7213
|
+
count: 1
|
|
7214
|
+
});
|
|
6945
7215
|
}
|
|
6946
|
-
|
|
7216
|
+
return previousValue;
|
|
7217
|
+
},
|
|
7218
|
+
[]
|
|
7219
|
+
);
|
|
7220
|
+
}, [data, openedFilterColumn]);
|
|
7221
|
+
const pagesCount = pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1;
|
|
7222
|
+
const paginationItems = (0, import_react23.useMemo)(() => {
|
|
7223
|
+
const halfRange = Math.floor(maximumVisiblePages / 2);
|
|
7224
|
+
let startPage = Math.max(1, currentPage - halfRange);
|
|
7225
|
+
let endPage = Math.min(pagesCount, currentPage + halfRange);
|
|
7226
|
+
if (endPage - startPage + 1 < maximumVisiblePages) {
|
|
7227
|
+
startPage = Math.max(1, endPage - maximumVisiblePages + 1);
|
|
7228
|
+
endPage = Math.min(pagesCount, startPage + maximumVisiblePages - 1);
|
|
6947
7229
|
}
|
|
7230
|
+
return Array.from(
|
|
7231
|
+
{
|
|
7232
|
+
length: endPage - startPage + 1
|
|
7233
|
+
},
|
|
7234
|
+
(_, index) => startPage + index
|
|
7235
|
+
);
|
|
7236
|
+
}, [pagesCount, currentPage]);
|
|
7237
|
+
const onClickNextPage = (0, import_react23.useCallback)(() => {
|
|
7238
|
+
setCurrentPage((oldValue) => oldValue >= pagesCount ? pagesCount : oldValue + 1);
|
|
7239
|
+
}, [pagesCount]);
|
|
7240
|
+
const onClickPreviousPage = (0, import_react23.useCallback)(() => {
|
|
7241
|
+
setCurrentPage((oldValue) => oldValue <= 1 ? 1 : oldValue - 1);
|
|
7242
|
+
}, []);
|
|
7243
|
+
const onClickSelectAllFilterListItems = (0, import_react23.useCallback)(
|
|
7244
|
+
() => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
|
|
7245
|
+
[possibleFilterListValues]
|
|
6948
7246
|
);
|
|
7247
|
+
const onClickDeselectAllFilterListItems = (0, import_react23.useCallback)(() => setFilterListSelectedItems([]), []);
|
|
7248
|
+
(0, import_react23.useEffect)(() => {
|
|
7249
|
+
onChangePage?.(currentPage);
|
|
7250
|
+
}, [onChangePage, currentPage]);
|
|
7251
|
+
(0, import_react23.useEffect)(() => {
|
|
7252
|
+
onChangeFilter?.(filterData);
|
|
7253
|
+
}, [onChangeFilter, filterData]);
|
|
7254
|
+
(0, import_react23.useImperativeHandle)(
|
|
7255
|
+
ref,
|
|
7256
|
+
() => {
|
|
7257
|
+
return {
|
|
7258
|
+
currentPage,
|
|
7259
|
+
setCurrentPage,
|
|
7260
|
+
pagesCount,
|
|
7261
|
+
setCheckedItems
|
|
7262
|
+
};
|
|
7263
|
+
},
|
|
7264
|
+
[currentPage, setCurrentPage, pagesCount, setCheckedItems]
|
|
7265
|
+
);
|
|
7266
|
+
const mobileFooterBreakingPoint = mediumScreen.size700 && pagesCount > maximumVisiblePages / 1.4;
|
|
7267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
7268
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7269
|
+
Div_default,
|
|
7270
|
+
{
|
|
7271
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
7272
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
7273
|
+
overflow: "auto",
|
|
7274
|
+
...props,
|
|
7275
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7276
|
+
TableStyledComponent,
|
|
7277
|
+
{
|
|
7278
|
+
isStriped,
|
|
7279
|
+
withHover: onClickRow !== void 0,
|
|
7280
|
+
withStickyHeader,
|
|
7281
|
+
colorTheme,
|
|
7282
|
+
theme: theme2,
|
|
7283
|
+
children: [
|
|
7284
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7285
|
+
ThStyledComponent,
|
|
7286
|
+
{
|
|
7287
|
+
width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
|
|
7288
|
+
minWidth: column.minWidth,
|
|
7289
|
+
maxWidth: column.maxWidth,
|
|
7290
|
+
textAlign: column.align,
|
|
7291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7292
|
+
Div_default.row,
|
|
7293
|
+
{
|
|
7294
|
+
width: "100%",
|
|
7295
|
+
alignItems: "center",
|
|
7296
|
+
justifyContent: "space-between",
|
|
7297
|
+
gap: theme2.styles.gap,
|
|
7298
|
+
children: [
|
|
7299
|
+
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7300
|
+
ToggleInput_default.checkbox,
|
|
7301
|
+
{
|
|
7302
|
+
checked: everythingIsChecked,
|
|
7303
|
+
onChange: onClickAllCheckboxesElement
|
|
7304
|
+
}
|
|
7305
|
+
) : column.label ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: column.label }) : void 0,
|
|
7306
|
+
column.filter && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7307
|
+
Button_default.icon,
|
|
7308
|
+
{
|
|
7309
|
+
icon: "filter",
|
|
7310
|
+
color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
7311
|
+
value: index,
|
|
7312
|
+
onClickWithValue: onClickFilterButton
|
|
7313
|
+
}
|
|
7314
|
+
)
|
|
7315
|
+
]
|
|
7316
|
+
}
|
|
7317
|
+
)
|
|
7318
|
+
},
|
|
7319
|
+
column.type + column.label + index
|
|
7320
|
+
)) }) }),
|
|
7321
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7322
|
+
"tr",
|
|
7323
|
+
{
|
|
7324
|
+
className: onClickRow ? "isClickable" : void 0,
|
|
7325
|
+
onClick: () => onClickRowElement(item, rowIndex),
|
|
7326
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
|
|
7327
|
+
},
|
|
7328
|
+
JSON.stringify(item) + rowIndex
|
|
7329
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
7330
|
+
pageSize !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7331
|
+
Div_default.column,
|
|
7332
|
+
{
|
|
7333
|
+
position: "relative",
|
|
7334
|
+
width: "100%",
|
|
7335
|
+
justifyContent: "center",
|
|
7336
|
+
flexReverse: true,
|
|
7337
|
+
gap: theme2.styles.gap / 2,
|
|
7338
|
+
children: [
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7340
|
+
Text_default,
|
|
7341
|
+
{
|
|
7342
|
+
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
7343
|
+
top: !mobileFooterBreakingPoint ? "50%" : void 0,
|
|
7344
|
+
color: theme2.colors.textSecondary,
|
|
7345
|
+
transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
|
|
7346
|
+
userSelect: "none",
|
|
7347
|
+
children: [
|
|
7348
|
+
currentPage,
|
|
7349
|
+
" / ",
|
|
7350
|
+
pagesCount
|
|
7351
|
+
]
|
|
7352
|
+
}
|
|
7353
|
+
),
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
7355
|
+
pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7356
|
+
Button_default.icon,
|
|
7357
|
+
{
|
|
7358
|
+
icon: "doubleChevronLeft",
|
|
7359
|
+
disabled: currentPage === 1,
|
|
7360
|
+
value: 1,
|
|
7361
|
+
onClickWithValue: setCurrentPage
|
|
7362
|
+
}
|
|
7363
|
+
),
|
|
7364
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7365
|
+
Button_default.icon,
|
|
7366
|
+
{
|
|
7367
|
+
icon: "chevronLeft",
|
|
7368
|
+
disabled: currentPage === 1,
|
|
7369
|
+
onClick: onClickPreviousPage
|
|
7370
|
+
}
|
|
7371
|
+
),
|
|
7372
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7373
|
+
Div_default.row,
|
|
7374
|
+
{
|
|
7375
|
+
alignItems: "center",
|
|
7376
|
+
justifyContent: "center",
|
|
7377
|
+
flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
|
|
7378
|
+
gap: theme2.styles.gap,
|
|
7379
|
+
children: paginationItems.map((pageIndex) => {
|
|
7380
|
+
const isActive = currentPage === pageIndex;
|
|
7381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7382
|
+
Div_default,
|
|
7383
|
+
{
|
|
7384
|
+
cursor: "pointer",
|
|
7385
|
+
userSelect: "none",
|
|
7386
|
+
value: pageIndex,
|
|
7387
|
+
onClickWithValue: setCurrentPage,
|
|
7388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7389
|
+
Text_default,
|
|
7390
|
+
{
|
|
7391
|
+
fontWeight: isActive ? 700 : 400,
|
|
7392
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
7393
|
+
transition: theme2.styles.transition,
|
|
7394
|
+
children: pageIndex
|
|
7395
|
+
}
|
|
7396
|
+
)
|
|
7397
|
+
},
|
|
7398
|
+
pageIndex
|
|
7399
|
+
);
|
|
7400
|
+
})
|
|
7401
|
+
}
|
|
7402
|
+
),
|
|
7403
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7404
|
+
Button_default.icon,
|
|
7405
|
+
{
|
|
7406
|
+
icon: "chevronRight",
|
|
7407
|
+
disabled: currentPage === pagesCount,
|
|
7408
|
+
onClick: onClickNextPage
|
|
7409
|
+
}
|
|
7410
|
+
),
|
|
7411
|
+
pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7412
|
+
Button_default.icon,
|
|
7413
|
+
{
|
|
7414
|
+
icon: "doubleChevronRight",
|
|
7415
|
+
disabled: currentPage === pagesCount,
|
|
7416
|
+
onClickWithValue: setCurrentPage,
|
|
7417
|
+
value: pagesCount
|
|
7418
|
+
}
|
|
7419
|
+
)
|
|
7420
|
+
] })
|
|
7421
|
+
]
|
|
7422
|
+
}
|
|
7423
|
+
) }) }) })
|
|
7424
|
+
]
|
|
7425
|
+
}
|
|
7426
|
+
)
|
|
7427
|
+
}
|
|
7428
|
+
),
|
|
7429
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7430
|
+
Modal_default,
|
|
7431
|
+
{
|
|
7432
|
+
title: `Filter ${openedFilterColumn?.label}`,
|
|
7433
|
+
description: openedFilterColumn?.filter === "number" ? "Enter minimum and maximum values to filter" : openedFilterColumn?.filter === "date" || openedFilterColumn?.filter === "date-time" ? "Enter minimum and maximum dates to filter" : openedFilterColumn?.filter === "list" ? "Select values to filter from the list bellow" : "",
|
|
7434
|
+
onClose: onCloseFilterModal,
|
|
7435
|
+
ref: filterModalRef,
|
|
7436
|
+
children: openedFilterColumn ? openedFilterColumn.filter === "number" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7437
|
+
Form_default,
|
|
7438
|
+
{
|
|
7439
|
+
form: filterForm,
|
|
7440
|
+
submitButtonText: "Filter",
|
|
7441
|
+
cancelButtonText: "Clear",
|
|
7442
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRow_default, { children: [
|
|
7444
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default, { type: "number", label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7445
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default, { type: "number", label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7446
|
+
] })
|
|
7447
|
+
}
|
|
7448
|
+
) : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7449
|
+
Form_default,
|
|
7450
|
+
{
|
|
7451
|
+
form: filterForm,
|
|
7452
|
+
gap: theme2.styles.gap,
|
|
7453
|
+
submitButtonText: "Filter",
|
|
7454
|
+
cancelButtonText: "Clear",
|
|
7455
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7456
|
+
children: [
|
|
7457
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRow_default, { children: [
|
|
7458
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default.date, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
7459
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default.date, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
7460
|
+
] }),
|
|
7461
|
+
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label_default, { text: "Presets" }),
|
|
7463
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => {
|
|
7464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7465
|
+
Button_default.secondary,
|
|
7466
|
+
{
|
|
7467
|
+
text: filterPresetsText[preset],
|
|
7468
|
+
value: preset,
|
|
7469
|
+
onClickWithValue: onClickFilterPreset
|
|
7470
|
+
},
|
|
7471
|
+
preset
|
|
7472
|
+
);
|
|
7473
|
+
}) })
|
|
7474
|
+
] })
|
|
7475
|
+
]
|
|
7476
|
+
}
|
|
7477
|
+
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7478
|
+
Form_default,
|
|
7479
|
+
{
|
|
7480
|
+
submitButtonText: "Filter",
|
|
7481
|
+
cancelButtonText: "Clear",
|
|
7482
|
+
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7483
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7484
|
+
Button_default.secondary,
|
|
7485
|
+
{
|
|
7486
|
+
text: "Select All",
|
|
7487
|
+
disabled: possibleFilterListValues.length === filterListSelectedItems?.length,
|
|
7488
|
+
onClick: onClickSelectAllFilterListItems
|
|
7489
|
+
}
|
|
7490
|
+
),
|
|
7491
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7492
|
+
Button_default.secondary,
|
|
7493
|
+
{
|
|
7494
|
+
text: "Deselect All",
|
|
7495
|
+
disabled: !filterListSelectedItems?.length,
|
|
7496
|
+
onClick: onClickDeselectAllFilterListItems
|
|
7497
|
+
}
|
|
7498
|
+
)
|
|
7499
|
+
] }),
|
|
7500
|
+
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
7501
|
+
onSubmit: filterForm.onSubmit,
|
|
7502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, marginBottom: theme2.styles.space, children: [
|
|
7503
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label_default, { text: "Possible values" }),
|
|
7504
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.map((value) => {
|
|
7505
|
+
const isActive = filterListSelectedItems?.includes(value.value);
|
|
7506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7507
|
+
Div_default.box,
|
|
7508
|
+
{
|
|
7509
|
+
isActive,
|
|
7510
|
+
value: value.value,
|
|
7511
|
+
onClickWithValue: onClickFilterListItem,
|
|
7512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7513
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.value }),
|
|
7514
|
+
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: [
|
|
7515
|
+
"(",
|
|
7516
|
+
value.count,
|
|
7517
|
+
")"
|
|
7518
|
+
] })
|
|
7519
|
+
] })
|
|
7520
|
+
},
|
|
7521
|
+
value.value
|
|
7522
|
+
);
|
|
7523
|
+
}) })
|
|
7524
|
+
] })
|
|
7525
|
+
}
|
|
7526
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: "Unknown filter" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {})
|
|
7527
|
+
}
|
|
7528
|
+
)
|
|
7529
|
+
] });
|
|
6949
7530
|
});
|
|
6950
7531
|
var Table2 = (0, import_react23.memo)(TableComponent);
|
|
6951
7532
|
var Table_default = Table2;
|