react-better-html 1.1.176 → 1.1.178
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -755,6 +755,7 @@ type ListFilter<DataItem> = {
|
|
|
755
755
|
getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
|
|
756
756
|
};
|
|
757
757
|
type TableColumn<DataItem> = {
|
|
758
|
+
hidden?: boolean;
|
|
758
759
|
label?: string;
|
|
759
760
|
/** @requires label */
|
|
760
761
|
renderLabel?: (label: string) => React.ReactNode;
|
|
@@ -1069,4 +1070,4 @@ type LocalStoragePluginOptions = {
|
|
|
1069
1070
|
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1070
1071
|
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1071
1072
|
|
|
1072
|
-
export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, filterHover, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
|
1073
|
+
export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, type Styles, type TabGroup, Table, type TableColumn, type TableFilterData, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, filterHover, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -755,6 +755,7 @@ type ListFilter<DataItem> = {
|
|
|
755
755
|
getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
|
|
756
756
|
};
|
|
757
757
|
type TableColumn<DataItem> = {
|
|
758
|
+
hidden?: boolean;
|
|
758
759
|
label?: string;
|
|
759
760
|
/** @requires label */
|
|
760
761
|
renderLabel?: (label: string) => React.ReactNode;
|
|
@@ -1069,4 +1070,4 @@ type LocalStoragePluginOptions = {
|
|
|
1069
1070
|
declare const defaultLocalStoragePluginOptions: Required<LocalStoragePluginOptions>;
|
|
1070
1071
|
declare const localStoragePlugin: BetterHtmlPluginConstructor<LocalStoragePluginOptions>;
|
|
1071
1072
|
|
|
1072
|
-
export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, filterHover, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
|
1073
|
+
export { type Alert, type AlertType, type AlertsPluginOptions, type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderConfig, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type ComponentHoverStyle, type ComponentMarginProps, type ComponentPaddingProps, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, type LocalStoragePluginOptions, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type ReactRouterDomPluginOptions, type Styles, type TabGroup, Table, type TableColumn, type TableFilterData, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, Tooltip, type TooltipProps, type TooltipRef, type VerticalDividerProps, alertControls, alertsPlugin, colorThemeControls, countries, darkenColor, defaultAlertsPluginOptions, defaultLocalStoragePluginOptions, defaultReactRouterDomPluginOptions, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, filterHover, formatPhoneNumber, generateLocalStorage, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, localStoragePlugin, reactRouterDomPlugin, saturateColor, useAlertControls, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.js
CHANGED
|
@@ -7921,8 +7921,9 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
7921
7921
|
const mediaQuery = useMediaQuery();
|
|
7922
7922
|
const { colorTheme } = useBetterHtmlContextInternal();
|
|
7923
7923
|
const filterModalRef = (0, import_react25.useRef)(null);
|
|
7924
|
-
const
|
|
7925
|
-
columnsRef
|
|
7924
|
+
const readyColumns = (0, import_react25.useMemo)(() => columns.filter((column) => !column.hidden), [columns]);
|
|
7925
|
+
const columnsRef = (0, import_react25.useRef)(readyColumns);
|
|
7926
|
+
columnsRef.current = readyColumns;
|
|
7926
7927
|
const [checkedItems, setCheckedItems] = (0, import_react25.useState)([]);
|
|
7927
7928
|
const [expandedRows, setExpandedRows] = (0, import_react25.useState)([]);
|
|
7928
7929
|
const [currentPage, setCurrentPage] = (0, import_react25.useState)(1);
|
|
@@ -7938,7 +7939,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
7938
7939
|
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react25.useState)();
|
|
7939
7940
|
const [filterListSelectedItems, setFilterListSelectedItems] = (0, import_react25.useState)();
|
|
7940
7941
|
const openedFilterData = openedFilterColumnIndex ? filterData[openedFilterColumnIndex] : void 0;
|
|
7941
|
-
const openedFilterColumn = openedFilterColumnIndex ?
|
|
7942
|
+
const openedFilterColumn = openedFilterColumnIndex ? readyColumns[openedFilterColumnIndex] : void 0;
|
|
7942
7943
|
const filterForm = useForm({
|
|
7943
7944
|
defaultValues: {
|
|
7944
7945
|
min: void 0,
|
|
@@ -7966,7 +7967,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
7966
7967
|
filterModalRef.current?.close();
|
|
7967
7968
|
}
|
|
7968
7969
|
});
|
|
7969
|
-
const expandColumn = (0, import_react25.useMemo)(() =>
|
|
7970
|
+
const expandColumn = (0, import_react25.useMemo)(() => readyColumns.find((column) => column.type === "expand"), [readyColumns]);
|
|
7970
7971
|
const renderCellContent = (0, import_react25.useCallback)(
|
|
7971
7972
|
(column, item, itemIndex) => {
|
|
7972
7973
|
switch (column.type) {
|
|
@@ -8069,10 +8070,15 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
8069
8070
|
}, []);
|
|
8070
8071
|
const onClickCancelFormFilter = (0, import_react25.useCallback)(() => {
|
|
8071
8072
|
if (openedFilterColumnIndex === void 0) return;
|
|
8072
|
-
setFilterData(
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8073
|
+
setFilterData(
|
|
8074
|
+
(oldValue) => Object.entries({
|
|
8075
|
+
...oldValue,
|
|
8076
|
+
[openedFilterColumnIndex]: void 0
|
|
8077
|
+
}).reduce((previousValue, [key, value]) => {
|
|
8078
|
+
if (value !== void 0) previousValue[parseInt(key)] = value;
|
|
8079
|
+
return previousValue;
|
|
8080
|
+
}, {})
|
|
8081
|
+
);
|
|
8076
8082
|
filterModalRef.current?.close();
|
|
8077
8083
|
}, [openedFilterColumnIndex]);
|
|
8078
8084
|
const onClickFilterListItem = (0, import_react25.useCallback)(
|
|
@@ -8170,11 +8176,11 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
8170
8176
|
);
|
|
8171
8177
|
const renderExpandedRow = (0, import_react25.useCallback)(
|
|
8172
8178
|
(...props2) => {
|
|
8173
|
-
const expandColumn2 =
|
|
8179
|
+
const expandColumn2 = readyColumns.find((column) => column.type === "expand");
|
|
8174
8180
|
if (!expandColumn2) return;
|
|
8175
8181
|
return expandColumn2.render?.(...props2);
|
|
8176
8182
|
},
|
|
8177
|
-
[
|
|
8183
|
+
[readyColumns]
|
|
8178
8184
|
);
|
|
8179
8185
|
const dataAfterFilter = (0, import_react25.useMemo)(
|
|
8180
8186
|
() => data.filter(
|
|
@@ -8324,7 +8330,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
8324
8330
|
containsOverflowComponents,
|
|
8325
8331
|
withFooter,
|
|
8326
8332
|
children: [
|
|
8327
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isHeader", children:
|
|
8333
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isHeader", children: readyColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8328
8334
|
ThStyledComponent,
|
|
8329
8335
|
{
|
|
8330
8336
|
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.type === "expand" ? 16 : void 0),
|
|
@@ -8362,14 +8368,14 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
8362
8368
|
},
|
|
8363
8369
|
column.type + column.label + index
|
|
8364
8370
|
)) }) }),
|
|
8365
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "noData", colSpan:
|
|
8371
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react25.Fragment, { children: [
|
|
8366
8372
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8367
8373
|
"tr",
|
|
8368
8374
|
{
|
|
8369
8375
|
className: isInsideTableExpandRow && onClickRow === void 0 && expandColumn === void 0 ? "withoutHover" : void 0,
|
|
8370
8376
|
style: getRowStyle?.(item, rowIndex),
|
|
8371
8377
|
onClick: () => onClickRowElement(item, rowIndex),
|
|
8372
|
-
children:
|
|
8378
|
+
children: readyColumns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8373
8379
|
TdStyledComponent,
|
|
8374
8380
|
{
|
|
8375
8381
|
textAlign: column.align,
|
|
@@ -8382,9 +8388,9 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
|
|
|
8382
8388
|
))
|
|
8383
8389
|
}
|
|
8384
8390
|
),
|
|
8385
|
-
expandedRows[rowIndex] && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan:
|
|
8386
|
-
] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "noData", colSpan:
|
|
8387
|
-
withFooter && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan:
|
|
8391
|
+
expandedRows[rowIndex] && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: readyColumns.length, children: renderExpandedRow(item, rowIndex) }) })
|
|
8392
|
+
] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
8393
|
+
withFooter && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: readyColumns.length, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
8388
8394
|
Div_default.column,
|
|
8389
8395
|
{
|
|
8390
8396
|
position: "relative",
|