@eztrak/shared 0.12.1 → 0.13.1
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/chunk-HGLO5LDS.mjs +1 -0
- package/dist/chunk-HGLO5LDS.mjs.map +1 -0
- package/dist/{chunk-3FD7O5VS.mjs → chunk-TN7TPFJ3.mjs} +106 -18
- package/dist/chunk-TN7TPFJ3.mjs.map +1 -0
- package/dist/{chunk-BMX2RODZ.mjs → chunk-YWS7JMII.mjs} +54 -1
- package/dist/chunk-YWS7JMII.mjs.map +1 -0
- package/dist/components/index.d.mts +34 -2
- package/dist/components/index.d.ts +34 -2
- package/dist/components/index.js +138 -21
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +107 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -15
- package/dist/utils/index.mjs +12 -13
- package/package.json +6 -2
- package/dist/chunk-3FD7O5VS.mjs.map +0 -1
- package/dist/chunk-7PPCJV2M.mjs +0 -56
- package/dist/chunk-7PPCJV2M.mjs.map +0 -1
- package/dist/chunk-BMX2RODZ.mjs.map +0 -1
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import react__default, { ReactNode, InputHTMLAttributes, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { Props, StylesConfig } from 'react-select';
|
|
4
4
|
import { PlacesType } from 'react-tooltip';
|
|
5
|
+
import { IconType } from 'react-icons';
|
|
6
|
+
import { TippyProps } from '@tippyjs/react';
|
|
5
7
|
|
|
6
8
|
type EztrakTab = {
|
|
7
9
|
id: string;
|
|
@@ -137,9 +139,11 @@ interface DropdownFilterProps<Option extends Record<string, unknown>> extends Om
|
|
|
137
139
|
/** Partial theme overrides merged with the default Eztrak palette. */
|
|
138
140
|
/** Border radius applied to the control, menu, and options. Defaults to "5px". */
|
|
139
141
|
borderRadius?: string;
|
|
142
|
+
/** When true, persists the selected value in localStorage under `name`. */
|
|
143
|
+
saveToLocalStorage?: boolean;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
declare function DropdownFilter<Option extends Record<string, unknown>>({ name, valueKey, options, placeholder, borderRadius, className, isClearable, isSearchable, isDisabled, isLoading, ...otherProps }: DropdownFilterProps<Option>): react.JSX.Element;
|
|
146
|
+
declare function DropdownFilter<Option extends Record<string, unknown>>({ name, valueKey, options, placeholder, borderRadius, className, isClearable, isSearchable, isDisabled, isLoading, saveToLocalStorage, ...otherProps }: DropdownFilterProps<Option>): react.JSX.Element;
|
|
143
147
|
|
|
144
148
|
declare function ResetFiltersButton({ label, showLabel, icon, variant, className, onReset, disabled, }: ResetFiltersButtonProps): react.JSX.Element;
|
|
145
149
|
|
|
@@ -285,4 +289,32 @@ interface CustomCellEditorProps {
|
|
|
285
289
|
|
|
286
290
|
declare const CustomCellEditor: react.ForwardRefExoticComponent<CustomCellEditorProps & react.RefAttributes<CustomCellEditorRef>>;
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
type PopupActionHandler<TRow = unknown> = (actionType: string, rowData?: TRow) => void;
|
|
293
|
+
type PopupDropDownContent<TRow = unknown> = ReactNode | ((handleAction: PopupActionHandler<TRow>) => ReactNode);
|
|
294
|
+
interface PopupCellRendererParams<TRow = unknown> {
|
|
295
|
+
data?: TRow;
|
|
296
|
+
[key: string]: unknown;
|
|
297
|
+
}
|
|
298
|
+
interface PopupCellRendererProps<TRow = unknown> {
|
|
299
|
+
dropDownContent: PopupDropDownContent<TRow>;
|
|
300
|
+
actionIcon?: IconType;
|
|
301
|
+
title?: string;
|
|
302
|
+
className?: string;
|
|
303
|
+
hideTitle?: boolean;
|
|
304
|
+
/** AG Grid cell renderer params; row data is read from `params.data`. */
|
|
305
|
+
params?: PopupCellRendererParams<TRow>;
|
|
306
|
+
onAction?: (actionType: string, rowData: TRow | undefined, hide: () => void) => void;
|
|
307
|
+
placement?: TippyProps["placement"];
|
|
308
|
+
tippyProps?: Omit<Partial<TippyProps>, "children" | "content" | "visible" | "placement">;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Interactive popup trigger for table row actions (e.g. AG Grid cell renderer).
|
|
313
|
+
*
|
|
314
|
+
* Import Tippy styles in your app once:
|
|
315
|
+
* `import "tippy.js/dist/tippy.css"`
|
|
316
|
+
* `import "tippy.js/themes/light.css"`
|
|
317
|
+
*/
|
|
318
|
+
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
319
|
+
|
|
320
|
+
export { CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type PopupDropDownContent, ResetColumnsButton, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, SearchInput, type SearchInputProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles };
|
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import react__default, { ReactNode, InputHTMLAttributes, HTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { Props, StylesConfig } from 'react-select';
|
|
4
4
|
import { PlacesType } from 'react-tooltip';
|
|
5
|
+
import { IconType } from 'react-icons';
|
|
6
|
+
import { TippyProps } from '@tippyjs/react';
|
|
5
7
|
|
|
6
8
|
type EztrakTab = {
|
|
7
9
|
id: string;
|
|
@@ -137,9 +139,11 @@ interface DropdownFilterProps<Option extends Record<string, unknown>> extends Om
|
|
|
137
139
|
/** Partial theme overrides merged with the default Eztrak palette. */
|
|
138
140
|
/** Border radius applied to the control, menu, and options. Defaults to "5px". */
|
|
139
141
|
borderRadius?: string;
|
|
142
|
+
/** When true, persists the selected value in localStorage under `name`. */
|
|
143
|
+
saveToLocalStorage?: boolean;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
declare function DropdownFilter<Option extends Record<string, unknown>>({ name, valueKey, options, placeholder, borderRadius, className, isClearable, isSearchable, isDisabled, isLoading, ...otherProps }: DropdownFilterProps<Option>): react.JSX.Element;
|
|
146
|
+
declare function DropdownFilter<Option extends Record<string, unknown>>({ name, valueKey, options, placeholder, borderRadius, className, isClearable, isSearchable, isDisabled, isLoading, saveToLocalStorage, ...otherProps }: DropdownFilterProps<Option>): react.JSX.Element;
|
|
143
147
|
|
|
144
148
|
declare function ResetFiltersButton({ label, showLabel, icon, variant, className, onReset, disabled, }: ResetFiltersButtonProps): react.JSX.Element;
|
|
145
149
|
|
|
@@ -285,4 +289,32 @@ interface CustomCellEditorProps {
|
|
|
285
289
|
|
|
286
290
|
declare const CustomCellEditor: react.ForwardRefExoticComponent<CustomCellEditorProps & react.RefAttributes<CustomCellEditorRef>>;
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
type PopupActionHandler<TRow = unknown> = (actionType: string, rowData?: TRow) => void;
|
|
293
|
+
type PopupDropDownContent<TRow = unknown> = ReactNode | ((handleAction: PopupActionHandler<TRow>) => ReactNode);
|
|
294
|
+
interface PopupCellRendererParams<TRow = unknown> {
|
|
295
|
+
data?: TRow;
|
|
296
|
+
[key: string]: unknown;
|
|
297
|
+
}
|
|
298
|
+
interface PopupCellRendererProps<TRow = unknown> {
|
|
299
|
+
dropDownContent: PopupDropDownContent<TRow>;
|
|
300
|
+
actionIcon?: IconType;
|
|
301
|
+
title?: string;
|
|
302
|
+
className?: string;
|
|
303
|
+
hideTitle?: boolean;
|
|
304
|
+
/** AG Grid cell renderer params; row data is read from `params.data`. */
|
|
305
|
+
params?: PopupCellRendererParams<TRow>;
|
|
306
|
+
onAction?: (actionType: string, rowData: TRow | undefined, hide: () => void) => void;
|
|
307
|
+
placement?: TippyProps["placement"];
|
|
308
|
+
tippyProps?: Omit<Partial<TippyProps>, "children" | "content" | "visible" | "placement">;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Interactive popup trigger for table row actions (e.g. AG Grid cell renderer).
|
|
313
|
+
*
|
|
314
|
+
* Import Tippy styles in your app once:
|
|
315
|
+
* `import "tippy.js/dist/tippy.css"`
|
|
316
|
+
* `import "tippy.js/themes/light.css"`
|
|
317
|
+
*/
|
|
318
|
+
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
319
|
+
|
|
320
|
+
export { CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type PopupDropDownContent, ResetColumnsButton, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, SearchInput, type SearchInputProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles };
|
package/dist/components/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(components_exports, {
|
|
|
37
37
|
EztrakTabs: () => EztrakTabs,
|
|
38
38
|
Loader: () => Loader,
|
|
39
39
|
Modal: () => Modal,
|
|
40
|
+
PopupCellRenderer: () => PopupCellRenderer,
|
|
40
41
|
ResetColumnsButton: () => ResetColumnsButton,
|
|
41
42
|
ResetFiltersButton: () => ResetFiltersButton,
|
|
42
43
|
SearchInput: () => SearchInput,
|
|
@@ -674,6 +675,7 @@ function CustomPagination({
|
|
|
674
675
|
}
|
|
675
676
|
|
|
676
677
|
// src/components/search-filters/DropdownFilter.tsx
|
|
678
|
+
var import_react2 = require("react");
|
|
677
679
|
var import_react_select = __toESM(require("react-select"));
|
|
678
680
|
var import_react_router_dom2 = require("react-router-dom");
|
|
679
681
|
|
|
@@ -745,6 +747,37 @@ var dropdownStyles = (_borderRadius = "5px") => ({
|
|
|
745
747
|
})
|
|
746
748
|
});
|
|
747
749
|
|
|
750
|
+
// src/utils/localStorage.ts
|
|
751
|
+
function getStorage() {
|
|
752
|
+
if (typeof window === "undefined") return null;
|
|
753
|
+
return window.localStorage;
|
|
754
|
+
}
|
|
755
|
+
function getItem(key, fallback = null) {
|
|
756
|
+
try {
|
|
757
|
+
const raw = getStorage()?.getItem(key);
|
|
758
|
+
if (raw === null || raw === void 0) {
|
|
759
|
+
return fallback;
|
|
760
|
+
}
|
|
761
|
+
return JSON.parse(raw);
|
|
762
|
+
} catch {
|
|
763
|
+
return fallback;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function setItem(key, value) {
|
|
767
|
+
try {
|
|
768
|
+
getStorage()?.setItem(key, JSON.stringify(value));
|
|
769
|
+
} catch {
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function removeItem(key) {
|
|
773
|
+
try {
|
|
774
|
+
getStorage()?.removeItem(key);
|
|
775
|
+
} catch {
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
var getItemFromLocalStorage = getItem;
|
|
779
|
+
var storeItemInLocalStorage = setItem;
|
|
780
|
+
|
|
748
781
|
// src/components/search-filters/DropdownFilter.tsx
|
|
749
782
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
750
783
|
function DropdownFilter({
|
|
@@ -758,22 +791,44 @@ function DropdownFilter({
|
|
|
758
791
|
isSearchable = true,
|
|
759
792
|
isDisabled = false,
|
|
760
793
|
isLoading = false,
|
|
794
|
+
saveToLocalStorage = false,
|
|
761
795
|
...otherProps
|
|
762
796
|
}) {
|
|
763
797
|
const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
|
|
798
|
+
const hasRestoredFromStorage = (0, import_react2.useRef)(false);
|
|
799
|
+
(0, import_react2.useEffect)(() => {
|
|
800
|
+
if (!saveToLocalStorage || hasRestoredFromStorage.current) return;
|
|
801
|
+
hasRestoredFromStorage.current = true;
|
|
802
|
+
if (searchParams.get(name)) return;
|
|
803
|
+
const stored = getItemFromLocalStorage(name);
|
|
804
|
+
if (stored != null && stored !== "") {
|
|
805
|
+
setSearchParams((prev) => {
|
|
806
|
+
prev.set(name, String(stored));
|
|
807
|
+
return prev;
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}, [saveToLocalStorage, name, searchParams, setSearchParams]);
|
|
764
811
|
const currentValue = searchParams.get(name);
|
|
765
812
|
const selectedOption = currentValue ? options?.find(
|
|
766
813
|
(option) => option[valueKey]?.toString() === currentValue
|
|
767
814
|
) ?? null : null;
|
|
768
815
|
const handleChange = (selected) => {
|
|
816
|
+
const selectedValue = selected && selected[valueKey] !== "" ? String(selected[valueKey]) : null;
|
|
769
817
|
setSearchParams((prev) => {
|
|
770
|
-
if (!
|
|
818
|
+
if (!selectedValue) {
|
|
771
819
|
prev.delete(name);
|
|
772
820
|
} else {
|
|
773
|
-
prev.set(name,
|
|
821
|
+
prev.set(name, selectedValue);
|
|
774
822
|
}
|
|
775
823
|
return prev;
|
|
776
824
|
});
|
|
825
|
+
if (saveToLocalStorage) {
|
|
826
|
+
if (selectedValue) {
|
|
827
|
+
storeItemInLocalStorage(name, selectedValue);
|
|
828
|
+
} else {
|
|
829
|
+
removeItem(name);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
777
832
|
};
|
|
778
833
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn(className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
779
834
|
import_react_select.default,
|
|
@@ -864,7 +919,7 @@ function ResetFiltersButton({
|
|
|
864
919
|
}
|
|
865
920
|
|
|
866
921
|
// src/components/search-filters/SearchInput.tsx
|
|
867
|
-
var
|
|
922
|
+
var import_react3 = require("react");
|
|
868
923
|
var import_fi = require("react-icons/fi");
|
|
869
924
|
var import_react_router_dom4 = require("react-router-dom");
|
|
870
925
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -886,8 +941,8 @@ function SearchInput({
|
|
|
886
941
|
}) {
|
|
887
942
|
const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
|
|
888
943
|
const queryParam = searchParams.get(defaultParam) || defaultValue || "";
|
|
889
|
-
const [inputValue, setInputValue] = (0,
|
|
890
|
-
const debounceTimerRef = (0,
|
|
944
|
+
const [inputValue, setInputValue] = (0, import_react3.useState)(queryParam);
|
|
945
|
+
const debounceTimerRef = (0, import_react3.useRef)(null);
|
|
891
946
|
const updateSearchParams = (searchQuery) => {
|
|
892
947
|
if (searchQuery?.trim()) {
|
|
893
948
|
setSearchParams((prev) => {
|
|
@@ -926,10 +981,10 @@ function SearchInput({
|
|
|
926
981
|
updateSearchParams("");
|
|
927
982
|
}
|
|
928
983
|
};
|
|
929
|
-
(0,
|
|
984
|
+
(0, import_react3.useEffect)(() => {
|
|
930
985
|
setInputValue(queryParam);
|
|
931
986
|
}, [queryParam]);
|
|
932
|
-
(0,
|
|
987
|
+
(0, import_react3.useEffect)(() => {
|
|
933
988
|
return () => {
|
|
934
989
|
if (debounceTimerRef.current) {
|
|
935
990
|
clearTimeout(debounceTimerRef.current);
|
|
@@ -980,7 +1035,7 @@ function SearchInput({
|
|
|
980
1035
|
|
|
981
1036
|
// src/components/modal/Modal.tsx
|
|
982
1037
|
var import_framer_motion = require("framer-motion");
|
|
983
|
-
var
|
|
1038
|
+
var import_react4 = require("react");
|
|
984
1039
|
var import_react_dom = require("react-dom");
|
|
985
1040
|
var import_fa = require("react-icons/fa");
|
|
986
1041
|
var import_io5 = require("react-icons/io5");
|
|
@@ -1025,13 +1080,13 @@ function Modal({
|
|
|
1025
1080
|
customLoader = null,
|
|
1026
1081
|
footerClassName
|
|
1027
1082
|
}) {
|
|
1028
|
-
const modalRef = (0,
|
|
1083
|
+
const modalRef = (0, import_react4.useRef)(null);
|
|
1029
1084
|
const handleBackdropClick = (e) => {
|
|
1030
1085
|
if (e.target === e.currentTarget && closeOnBackdropClick) {
|
|
1031
1086
|
onClose();
|
|
1032
1087
|
}
|
|
1033
1088
|
};
|
|
1034
|
-
(0,
|
|
1089
|
+
(0, import_react4.useEffect)(() => {
|
|
1035
1090
|
const handleEscape = (e) => {
|
|
1036
1091
|
if (e.key === "Escape" && isOpen && closeOnEscape) {
|
|
1037
1092
|
onClose();
|
|
@@ -1275,7 +1330,7 @@ function CardSkeleton({
|
|
|
1275
1330
|
}
|
|
1276
1331
|
|
|
1277
1332
|
// src/components/tooltip/ToolTip.tsx
|
|
1278
|
-
var
|
|
1333
|
+
var import_react5 = require("react");
|
|
1279
1334
|
var import_react_tooltip = require("react-tooltip");
|
|
1280
1335
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1281
1336
|
var defaultTooltipStyle = {
|
|
@@ -1300,7 +1355,7 @@ function ToolTip({
|
|
|
1300
1355
|
disabled = false,
|
|
1301
1356
|
children
|
|
1302
1357
|
}) {
|
|
1303
|
-
const generatedId = (0,
|
|
1358
|
+
const generatedId = (0, import_react5.useId)();
|
|
1304
1359
|
const tooltipId = `eztrak-tooltip-${generatedId.replace(/:/g, "")}`;
|
|
1305
1360
|
const tooltipText = String(text ?? "");
|
|
1306
1361
|
if (disabled || !tooltipText) {
|
|
@@ -1399,7 +1454,7 @@ function TooltipText({
|
|
|
1399
1454
|
}
|
|
1400
1455
|
|
|
1401
1456
|
// src/components/cell-editor/CustomCellEditor.tsx
|
|
1402
|
-
var
|
|
1457
|
+
var import_react6 = require("react");
|
|
1403
1458
|
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
1404
1459
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1405
1460
|
function ButtonSpinner() {
|
|
@@ -1446,7 +1501,7 @@ function normalizeInitialValue(initialValue, inputType) {
|
|
|
1446
1501
|
}
|
|
1447
1502
|
return initialValue;
|
|
1448
1503
|
}
|
|
1449
|
-
var CustomCellEditor = (0,
|
|
1504
|
+
var CustomCellEditor = (0, import_react6.forwardRef)(
|
|
1450
1505
|
({
|
|
1451
1506
|
value: initialValue,
|
|
1452
1507
|
name,
|
|
@@ -1471,11 +1526,11 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1471
1526
|
cancelButtonClassName
|
|
1472
1527
|
}, ref) => {
|
|
1473
1528
|
const normalizedInitial = normalizeInitialValue(initialValue, inputType);
|
|
1474
|
-
const [value, setValue] = (0,
|
|
1475
|
-
const [isLoading, setIsLoading] = (0,
|
|
1476
|
-
const inputRef = (0,
|
|
1477
|
-
const selectRef = (0,
|
|
1478
|
-
const normalizedOptions = (0,
|
|
1529
|
+
const [value, setValue] = (0, import_react6.useState)(normalizedInitial);
|
|
1530
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
|
1531
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
1532
|
+
const selectRef = (0, import_react6.useRef)(null);
|
|
1533
|
+
const normalizedOptions = (0, import_react6.useMemo)(() => {
|
|
1479
1534
|
if (customOptions && customOptions.length > 0) {
|
|
1480
1535
|
return customOptions.map((opt) => ({
|
|
1481
1536
|
value: String(opt[valueKey] ?? ""),
|
|
@@ -1485,13 +1540,13 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1485
1540
|
return dropdownOptions;
|
|
1486
1541
|
}, [customOptions, dropdownOptions, valueKey, labelKey]);
|
|
1487
1542
|
const isDropdown = inputType === "dropdown" || normalizedOptions.length > 0;
|
|
1488
|
-
(0,
|
|
1543
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({
|
|
1489
1544
|
getValue: () => value,
|
|
1490
1545
|
isCancelBeforeStart: () => false,
|
|
1491
1546
|
isCancelAfterEnd: () => false,
|
|
1492
1547
|
isPopup: () => true
|
|
1493
1548
|
}));
|
|
1494
|
-
(0,
|
|
1549
|
+
(0, import_react6.useEffect)(() => {
|
|
1495
1550
|
if (isDropdown) {
|
|
1496
1551
|
selectRef.current?.focus();
|
|
1497
1552
|
return;
|
|
@@ -1626,6 +1681,67 @@ var CustomCellEditor = (0, import_react5.forwardRef)(
|
|
|
1626
1681
|
}
|
|
1627
1682
|
);
|
|
1628
1683
|
CustomCellEditor.displayName = "CustomCellEditor";
|
|
1684
|
+
|
|
1685
|
+
// src/components/popup-cell-renderer/PopupCellRenderer.tsx
|
|
1686
|
+
var import_react7 = require("react");
|
|
1687
|
+
var import_react8 = __toESM(require("@tippyjs/react"));
|
|
1688
|
+
var import_bi = require("react-icons/bi");
|
|
1689
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1690
|
+
function PopupCellRenderer({
|
|
1691
|
+
dropDownContent,
|
|
1692
|
+
actionIcon: ActionIcon = import_bi.BiDotsVerticalRounded,
|
|
1693
|
+
title = "Actions",
|
|
1694
|
+
className,
|
|
1695
|
+
hideTitle = false,
|
|
1696
|
+
params,
|
|
1697
|
+
onAction,
|
|
1698
|
+
placement = "bottom-end",
|
|
1699
|
+
tippyProps
|
|
1700
|
+
}) {
|
|
1701
|
+
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
1702
|
+
const show = () => setVisible(true);
|
|
1703
|
+
const hide = () => setVisible(false);
|
|
1704
|
+
const rowData = params?.data;
|
|
1705
|
+
const handleAction = (actionType, actionRowData) => {
|
|
1706
|
+
onAction?.(actionType, actionRowData ?? rowData, hide);
|
|
1707
|
+
hide();
|
|
1708
|
+
};
|
|
1709
|
+
const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
|
|
1710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1711
|
+
import_react8.default,
|
|
1712
|
+
{
|
|
1713
|
+
content,
|
|
1714
|
+
visible,
|
|
1715
|
+
onClickOutside: hide,
|
|
1716
|
+
allowHTML: true,
|
|
1717
|
+
arrow: false,
|
|
1718
|
+
appendTo: () => document.body,
|
|
1719
|
+
interactive: true,
|
|
1720
|
+
placement,
|
|
1721
|
+
animation: "shift-away",
|
|
1722
|
+
theme: "light",
|
|
1723
|
+
maxWidth: "none",
|
|
1724
|
+
offset: [0, 5],
|
|
1725
|
+
...tippyProps,
|
|
1726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1727
|
+
"button",
|
|
1728
|
+
{
|
|
1729
|
+
type: "button",
|
|
1730
|
+
onClick: visible ? hide : show,
|
|
1731
|
+
className: cn(
|
|
1732
|
+
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
1733
|
+
className
|
|
1734
|
+
),
|
|
1735
|
+
"aria-label": "Row actions",
|
|
1736
|
+
children: [
|
|
1737
|
+
!hideTitle && title,
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ActionIcon, { "aria-hidden": true })
|
|
1739
|
+
]
|
|
1740
|
+
}
|
|
1741
|
+
)
|
|
1742
|
+
}
|
|
1743
|
+
) });
|
|
1744
|
+
}
|
|
1629
1745
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1630
1746
|
0 && (module.exports = {
|
|
1631
1747
|
CardSkeleton,
|
|
@@ -1635,6 +1751,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
|
|
|
1635
1751
|
EztrakTabs,
|
|
1636
1752
|
Loader,
|
|
1637
1753
|
Modal,
|
|
1754
|
+
PopupCellRenderer,
|
|
1638
1755
|
ResetColumnsButton,
|
|
1639
1756
|
ResetFiltersButton,
|
|
1640
1757
|
SearchInput,
|