react-better-html 1.1.122 → 1.1.123
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +22 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -647,6 +647,11 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
|
|
|
647
647
|
};
|
|
648
648
|
|
|
649
649
|
type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
|
|
650
|
+
type ListFilterValue = {
|
|
651
|
+
label?: string;
|
|
652
|
+
value: string;
|
|
653
|
+
count: number;
|
|
654
|
+
};
|
|
650
655
|
type TableFilterData = {
|
|
651
656
|
type: "number";
|
|
652
657
|
min?: number;
|
|
@@ -694,7 +699,7 @@ type DateFilter<DataItem> = {
|
|
|
694
699
|
type ListFilter<DataItem> = {
|
|
695
700
|
filter?: "list";
|
|
696
701
|
withTotalNumber?: boolean;
|
|
697
|
-
getValueForList?: (item: DataItem) =>
|
|
702
|
+
getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
|
|
698
703
|
};
|
|
699
704
|
type TableColumn<DataItem> = {
|
|
700
705
|
label?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -647,6 +647,11 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
|
|
|
647
647
|
};
|
|
648
648
|
|
|
649
649
|
type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
|
|
650
|
+
type ListFilterValue = {
|
|
651
|
+
label?: string;
|
|
652
|
+
value: string;
|
|
653
|
+
count: number;
|
|
654
|
+
};
|
|
650
655
|
type TableFilterData = {
|
|
651
656
|
type: "number";
|
|
652
657
|
min?: number;
|
|
@@ -694,7 +699,7 @@ type DateFilter<DataItem> = {
|
|
|
694
699
|
type ListFilter<DataItem> = {
|
|
695
700
|
filter?: "list";
|
|
696
701
|
withTotalNumber?: boolean;
|
|
697
|
-
getValueForList?: (item: DataItem) =>
|
|
702
|
+
getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
|
|
698
703
|
};
|
|
699
704
|
type TableColumn<DataItem> = {
|
|
700
705
|
label?: string;
|
package/dist/index.js
CHANGED
|
@@ -7291,7 +7291,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7291
7291
|
if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
|
|
7292
7292
|
if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
|
|
7293
7293
|
} else if (column.filter === "list" && filter.type === "list") {
|
|
7294
|
-
const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7294
|
+
const itemValue = column.getValueForList?.(item).value ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
|
|
7295
7295
|
if (!filter.list?.includes(itemValue)) return false;
|
|
7296
7296
|
}
|
|
7297
7297
|
return true;
|
|
@@ -7311,27 +7311,26 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7311
7311
|
}, [data, checkedItems]);
|
|
7312
7312
|
const possibleFilterListValues = (0, import_react23.useMemo)(() => {
|
|
7313
7313
|
if (!openedFilterColumn) return [];
|
|
7314
|
-
return data.reduce(
|
|
7315
|
-
(
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
);
|
|
7314
|
+
return data.reduce((previousValue, currentValue) => {
|
|
7315
|
+
const valueFromList = openedFilterColumn.filter === "list" && openedFilterColumn.getValueForList ? openedFilterColumn.getValueForList(currentValue) : void 0;
|
|
7316
|
+
const value = valueFromList ? valueFromList.value : openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
|
|
7317
|
+
if (value !== void 0) {
|
|
7318
|
+
if (previousValue.some((item) => item.value === value)) {
|
|
7319
|
+
previousValue = previousValue.map(
|
|
7320
|
+
(item) => item.value === value ? {
|
|
7321
|
+
...item,
|
|
7322
|
+
count: item.count + 1
|
|
7323
|
+
} : item
|
|
7324
|
+
);
|
|
7325
|
+
} else
|
|
7326
|
+
previousValue.push({
|
|
7327
|
+
label: valueFromList ? valueFromList.label : value,
|
|
7328
|
+
value,
|
|
7329
|
+
count: 1
|
|
7330
|
+
});
|
|
7331
|
+
}
|
|
7332
|
+
return previousValue;
|
|
7333
|
+
}, []);
|
|
7335
7334
|
}, [data, openedFilterColumn]);
|
|
7336
7335
|
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
7337
7336
|
const paginationItems = (0, import_react23.useMemo)(() => {
|
|
@@ -7638,7 +7637,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7638
7637
|
value: value.value,
|
|
7639
7638
|
onClickWithValue: onClickFilterListItem,
|
|
7640
7639
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7641
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.value }),
|
|
7640
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.label ?? value.value }),
|
|
7642
7641
|
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7643
7642
|
Text_default,
|
|
7644
7643
|
{
|