@eztrak/shared 0.14.0 → 0.15.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-JATUZDLG.mjs → chunk-HQPQ6TOE.mjs} +324 -14
- package/dist/chunk-HQPQ6TOE.mjs.map +1 -0
- package/dist/components/index.d.mts +157 -3
- package/dist/components/index.d.ts +157 -3
- package/dist/components/index.js +324 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +19 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +322 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -2
- package/package.json +1 -1
- package/dist/chunk-JATUZDLG.mjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ActionMenuItem,
|
|
2
3
|
CardSkeleton,
|
|
3
4
|
CustomCellEditor,
|
|
4
5
|
CustomPagination,
|
|
@@ -7,17 +8,25 @@ import {
|
|
|
7
8
|
Loader,
|
|
8
9
|
Modal,
|
|
9
10
|
PopupCellRenderer,
|
|
11
|
+
ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
12
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
13
|
+
ROW_ACTION_ITEM_HOVER_CLASS,
|
|
14
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
15
|
+
ROW_ACTION_PRESETS,
|
|
10
16
|
ResetColumnsButton,
|
|
11
17
|
ResetFiltersButton,
|
|
18
|
+
RowActions,
|
|
12
19
|
SearchInput,
|
|
13
20
|
TableErrorBoundary,
|
|
14
21
|
TableLayoutToolbarControls,
|
|
15
22
|
ToolTip,
|
|
16
23
|
TooltipText,
|
|
17
|
-
dropdownStyles
|
|
18
|
-
|
|
24
|
+
dropdownStyles,
|
|
25
|
+
resolveActions
|
|
26
|
+
} from "../chunk-HQPQ6TOE.mjs";
|
|
19
27
|
import "../chunk-EIX5CUQF.mjs";
|
|
20
28
|
export {
|
|
29
|
+
ActionMenuItem,
|
|
21
30
|
CardSkeleton,
|
|
22
31
|
CustomCellEditor,
|
|
23
32
|
CustomPagination,
|
|
@@ -26,13 +35,20 @@ export {
|
|
|
26
35
|
Loader,
|
|
27
36
|
Modal,
|
|
28
37
|
PopupCellRenderer,
|
|
38
|
+
ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
39
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
40
|
+
ROW_ACTION_ITEM_HOVER_CLASS,
|
|
41
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
42
|
+
ROW_ACTION_PRESETS,
|
|
29
43
|
ResetColumnsButton,
|
|
30
44
|
ResetFiltersButton,
|
|
45
|
+
RowActions,
|
|
31
46
|
SearchInput,
|
|
32
47
|
TableErrorBoundary,
|
|
33
48
|
TableLayoutToolbarControls,
|
|
34
49
|
ToolTip,
|
|
35
50
|
TooltipText,
|
|
36
|
-
dropdownStyles
|
|
51
|
+
dropdownStyles,
|
|
52
|
+
resolveActions
|
|
37
53
|
};
|
|
38
54
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CreateBaseQueryWithRetryOptions, PermissionRecord, TransformedPermissions, USER_STATE_STORAGE_KEY, capitalizeText, checkIfExistsInArray, cn, convertCommaDataToArray, createBaseQueryWithRetry, currencyFormatter, deserializeJson, flattenTableData, formatDate, formatDateTime, formatNumber, get, getApiError, getErrorMessages, getFieldsByCategory, getFieldsByInputType, getFieldsByName, getItem, getItemFromLocalStorage, isEmpty, loadUserState, normalizeApiListItems, parseCurrencyValueToNumber, removeByPropertyValues, removeItem, resetPageParam, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.mjs';
|
|
2
2
|
export { C as ConfirmationAlertOptions, E as ErrorClassification, a as ErrorSuggestedAction, H as HandleApiErrorOptions, R as RtkQueryError, c as classifyError, b as confirmationAlert, f as formatValidationErrorsHtml, h as handleApiError, i as isRetryableError } from './handleApiError-CwVIJOqO.mjs';
|
|
3
3
|
export { UseGridHeightOptions, useGridHeight, usePaginationUrlSync } from './hooks/index.mjs';
|
|
4
|
-
export { CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles } from './components/index.mjs';
|
|
4
|
+
export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_ITEM_TEXT_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.mjs';
|
|
5
5
|
import 'clsx';
|
|
6
6
|
import '@reduxjs/toolkit/query';
|
|
7
7
|
import 'react-router-dom';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CreateBaseQueryWithRetryOptions, PermissionRecord, TransformedPermissions, USER_STATE_STORAGE_KEY, capitalizeText, checkIfExistsInArray, cn, convertCommaDataToArray, createBaseQueryWithRetry, currencyFormatter, deserializeJson, flattenTableData, formatDate, formatDateTime, formatNumber, get, getApiError, getErrorMessages, getFieldsByCategory, getFieldsByInputType, getFieldsByName, getItem, getItemFromLocalStorage, isEmpty, loadUserState, normalizeApiListItems, parseCurrencyValueToNumber, removeByPropertyValues, removeItem, resetPageParam, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.js';
|
|
2
2
|
export { C as ConfirmationAlertOptions, E as ErrorClassification, a as ErrorSuggestedAction, H as HandleApiErrorOptions, R as RtkQueryError, c as classifyError, b as confirmationAlert, f as formatValidationErrorsHtml, h as handleApiError, i as isRetryableError } from './handleApiError-CwVIJOqO.js';
|
|
3
3
|
export { UseGridHeightOptions, useGridHeight, usePaginationUrlSync } from './hooks/index.js';
|
|
4
|
-
export { CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles } from './components/index.js';
|
|
4
|
+
export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_ITEM_TEXT_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.js';
|
|
5
5
|
import 'clsx';
|
|
6
6
|
import '@reduxjs/toolkit/query';
|
|
7
7
|
import 'react-router-dom';
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ActionMenuItem: () => ActionMenuItem,
|
|
33
34
|
CardSkeleton: () => CardSkeleton,
|
|
34
35
|
CustomCellEditor: () => CustomCellEditor,
|
|
35
36
|
CustomPagination: () => CustomPagination,
|
|
@@ -38,8 +39,14 @@ __export(src_exports, {
|
|
|
38
39
|
Loader: () => Loader,
|
|
39
40
|
Modal: () => Modal,
|
|
40
41
|
PopupCellRenderer: () => PopupCellRenderer,
|
|
42
|
+
ROW_ACTION_DEFAULT_ICON_SIZE: () => ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
43
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE: () => ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
44
|
+
ROW_ACTION_ITEM_HOVER_CLASS: () => ROW_ACTION_ITEM_HOVER_CLASS,
|
|
45
|
+
ROW_ACTION_ITEM_TEXT_CLASS: () => ROW_ACTION_ITEM_TEXT_CLASS,
|
|
46
|
+
ROW_ACTION_PRESETS: () => ROW_ACTION_PRESETS,
|
|
41
47
|
ResetColumnsButton: () => ResetColumnsButton,
|
|
42
48
|
ResetFiltersButton: () => ResetFiltersButton,
|
|
49
|
+
RowActions: () => RowActions,
|
|
43
50
|
SearchInput: () => SearchInput,
|
|
44
51
|
TableErrorBoundary: () => TableErrorBoundary,
|
|
45
52
|
TableLayoutToolbarControls: () => TableLayoutToolbarControls,
|
|
@@ -78,6 +85,7 @@ __export(src_exports, {
|
|
|
78
85
|
removeByPropertyValues: () => removeByPropertyValues,
|
|
79
86
|
removeItem: () => removeItem,
|
|
80
87
|
resetPageParam: () => resetPageParam,
|
|
88
|
+
resolveActions: () => resolveActions,
|
|
81
89
|
saveItemLocalStorage: () => saveItemLocalStorage,
|
|
82
90
|
saveUserState: () => saveUserState,
|
|
83
91
|
set: () => set,
|
|
@@ -2149,7 +2157,8 @@ function PopupCellRenderer({
|
|
|
2149
2157
|
params,
|
|
2150
2158
|
onAction,
|
|
2151
2159
|
placement = "bottom-end",
|
|
2152
|
-
tippyProps
|
|
2160
|
+
tippyProps,
|
|
2161
|
+
ariaLabel = "Row actions"
|
|
2153
2162
|
}) {
|
|
2154
2163
|
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
2155
2164
|
const show = () => setVisible(true);
|
|
@@ -2185,7 +2194,7 @@ function PopupCellRenderer({
|
|
|
2185
2194
|
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
2186
2195
|
className
|
|
2187
2196
|
),
|
|
2188
|
-
"aria-label":
|
|
2197
|
+
"aria-label": ariaLabel,
|
|
2189
2198
|
children: [
|
|
2190
2199
|
!hideTitle && title,
|
|
2191
2200
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ActionIcon, { "aria-hidden": true })
|
|
@@ -2196,10 +2205,302 @@ function PopupCellRenderer({
|
|
|
2196
2205
|
) });
|
|
2197
2206
|
}
|
|
2198
2207
|
|
|
2208
|
+
// src/components/row-actions/presets.ts
|
|
2209
|
+
var import_fa2 = require("react-icons/fa");
|
|
2210
|
+
var ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
|
|
2211
|
+
var ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
|
|
2212
|
+
var ROW_ACTION_DEFAULT_ICON_SIZE = 16;
|
|
2213
|
+
var ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE = {
|
|
2214
|
+
zIndex: 1e4
|
|
2215
|
+
};
|
|
2216
|
+
var ROW_ACTION_PRESETS = {
|
|
2217
|
+
edit: { label: "Edit", icon: import_fa2.FaEdit },
|
|
2218
|
+
delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true, iconClassName: "text-red-500" },
|
|
2219
|
+
view: { label: "View", icon: import_fa2.FaEye },
|
|
2220
|
+
notes: { label: "Notes", icon: import_fa2.FaFileAlt },
|
|
2221
|
+
history: { label: "History", icon: import_fa2.FaHistory },
|
|
2222
|
+
download: { label: "Download", icon: import_fa2.FaDownload },
|
|
2223
|
+
archive: { label: "Archive", icon: import_fa2.FaArchive },
|
|
2224
|
+
resolve: { label: "Resolve", icon: import_fa2.FaCheckCircle }
|
|
2225
|
+
};
|
|
2226
|
+
|
|
2227
|
+
// src/components/row-actions/ActionMenuItem.tsx
|
|
2228
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2229
|
+
function ActionMenuItem({
|
|
2230
|
+
label,
|
|
2231
|
+
icon: Icon,
|
|
2232
|
+
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
2233
|
+
iconClassName,
|
|
2234
|
+
labelClassName,
|
|
2235
|
+
tooltip,
|
|
2236
|
+
tooltipPlacement = "top",
|
|
2237
|
+
tooltipDelayShow,
|
|
2238
|
+
tooltipDelayHide,
|
|
2239
|
+
tooltipClassName,
|
|
2240
|
+
tooltipStyle,
|
|
2241
|
+
disabled = false,
|
|
2242
|
+
danger = false,
|
|
2243
|
+
highlight = false,
|
|
2244
|
+
showLabel = true,
|
|
2245
|
+
className,
|
|
2246
|
+
onClick
|
|
2247
|
+
}) {
|
|
2248
|
+
const tooltipText = tooltip ?? label;
|
|
2249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2250
|
+
ToolTip,
|
|
2251
|
+
{
|
|
2252
|
+
text: tooltipText,
|
|
2253
|
+
disabled: !tooltipText,
|
|
2254
|
+
placement: tooltipPlacement,
|
|
2255
|
+
delayShow: tooltipDelayShow,
|
|
2256
|
+
delayHide: tooltipDelayHide,
|
|
2257
|
+
tooltipClassName,
|
|
2258
|
+
tooltipStyle: { ...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ...tooltipStyle },
|
|
2259
|
+
className: showLabel ? "block w-full" : "inline-flex",
|
|
2260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2261
|
+
"button",
|
|
2262
|
+
{
|
|
2263
|
+
type: "button",
|
|
2264
|
+
disabled,
|
|
2265
|
+
"aria-label": label,
|
|
2266
|
+
onClick: (event) => {
|
|
2267
|
+
event.stopPropagation();
|
|
2268
|
+
if (disabled) return;
|
|
2269
|
+
onClick();
|
|
2270
|
+
},
|
|
2271
|
+
className: cn(
|
|
2272
|
+
"flex items-center gap-2 text-sm transition-colors duration-150",
|
|
2273
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
2274
|
+
showLabel ? "w-full rounded-xl px-3 py-2 text-left" : "justify-center rounded-md p-1",
|
|
2275
|
+
disabled ? "cursor-not-allowed opacity-50" : ROW_ACTION_ITEM_HOVER_CLASS,
|
|
2276
|
+
highlight && !danger && "text-primary-150",
|
|
2277
|
+
className
|
|
2278
|
+
),
|
|
2279
|
+
children: [
|
|
2280
|
+
Icon ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2281
|
+
Icon,
|
|
2282
|
+
{
|
|
2283
|
+
className: cn("shrink-0", iconClassName),
|
|
2284
|
+
"aria-hidden": true,
|
|
2285
|
+
size: iconSize
|
|
2286
|
+
}
|
|
2287
|
+
) : null,
|
|
2288
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: labelClassName, children: label }) : null
|
|
2289
|
+
]
|
|
2290
|
+
}
|
|
2291
|
+
)
|
|
2292
|
+
}
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// src/components/row-actions/resolveActions.ts
|
|
2297
|
+
function evalFlag(flag, data) {
|
|
2298
|
+
if (typeof flag === "function") return Boolean(flag(data));
|
|
2299
|
+
return Boolean(flag);
|
|
2300
|
+
}
|
|
2301
|
+
function mergePreset(name, overrides) {
|
|
2302
|
+
if (!name) return void 0;
|
|
2303
|
+
const base = ROW_ACTION_PRESETS[name];
|
|
2304
|
+
const extra = overrides?.[name];
|
|
2305
|
+
if (!extra) return base;
|
|
2306
|
+
return { ...base, ...extra };
|
|
2307
|
+
}
|
|
2308
|
+
function resolveActions(actions, data, hasPermission, presets) {
|
|
2309
|
+
const list = typeof actions === "function" ? actions(data) : actions;
|
|
2310
|
+
return list.flatMap((action, index) => {
|
|
2311
|
+
const type = action.type ?? "item";
|
|
2312
|
+
const preset = mergePreset(action.preset, presets);
|
|
2313
|
+
const key = action.key ?? action.preset ?? `action-${index}`;
|
|
2314
|
+
const label = action.label ?? preset?.label ?? key;
|
|
2315
|
+
if (action.permission && hasPermission && !hasPermission(action.permission)) {
|
|
2316
|
+
return [];
|
|
2317
|
+
}
|
|
2318
|
+
if (evalFlag(action.hidden, data)) {
|
|
2319
|
+
return [];
|
|
2320
|
+
}
|
|
2321
|
+
const tooltip = action.tooltip === false ? void 0 : action.tooltip ?? (type === "divider" ? void 0 : label);
|
|
2322
|
+
const resolved = {
|
|
2323
|
+
key,
|
|
2324
|
+
type,
|
|
2325
|
+
label,
|
|
2326
|
+
icon: action.icon ?? preset?.icon,
|
|
2327
|
+
iconSize: action.iconSize,
|
|
2328
|
+
content: action.content,
|
|
2329
|
+
onClick: action.onClick,
|
|
2330
|
+
disabled: evalFlag(action.disabled, data),
|
|
2331
|
+
danger: action.danger ?? preset?.danger ?? false,
|
|
2332
|
+
highlight: evalFlag(action.highlight, data),
|
|
2333
|
+
tooltip,
|
|
2334
|
+
tooltipPlacement: action.tooltipPlacement,
|
|
2335
|
+
confirm: action.confirm,
|
|
2336
|
+
closeOnClick: action.closeOnClick !== false,
|
|
2337
|
+
className: action.className,
|
|
2338
|
+
iconClassName: cn(preset?.iconClassName, action.iconClassName) || void 0,
|
|
2339
|
+
labelClassName: action.labelClassName
|
|
2340
|
+
};
|
|
2341
|
+
return [resolved];
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
// src/components/row-actions/RowActions.tsx
|
|
2346
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2347
|
+
function runAction(action, data, hide, confirmFn = confirmationAlert) {
|
|
2348
|
+
if (!action.onClick) {
|
|
2349
|
+
if (action.closeOnClick) hide?.();
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
const execute = () => action.onClick?.(data);
|
|
2353
|
+
if (action.confirm) {
|
|
2354
|
+
confirmFn?.(execute, action.confirm);
|
|
2355
|
+
} else {
|
|
2356
|
+
execute();
|
|
2357
|
+
}
|
|
2358
|
+
if (action.closeOnClick) {
|
|
2359
|
+
hide?.();
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
function RowActions({
|
|
2363
|
+
actions,
|
|
2364
|
+
data,
|
|
2365
|
+
mode = "menu",
|
|
2366
|
+
actionIcon,
|
|
2367
|
+
className,
|
|
2368
|
+
menuClassName,
|
|
2369
|
+
itemClassName,
|
|
2370
|
+
itemIconClassName,
|
|
2371
|
+
itemLabelClassName,
|
|
2372
|
+
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
2373
|
+
triggerTooltip = "Actions",
|
|
2374
|
+
triggerAriaLabel = "Row actions",
|
|
2375
|
+
hasPermission,
|
|
2376
|
+
placement = "bottom-end",
|
|
2377
|
+
tippyProps,
|
|
2378
|
+
presets,
|
|
2379
|
+
confirmFn = confirmationAlert,
|
|
2380
|
+
tooltipPlacement = "top",
|
|
2381
|
+
tooltipDelayShow,
|
|
2382
|
+
tooltipDelayHide,
|
|
2383
|
+
tooltipClassName,
|
|
2384
|
+
tooltipStyle,
|
|
2385
|
+
renderItem,
|
|
2386
|
+
renderMenu,
|
|
2387
|
+
renderTrigger
|
|
2388
|
+
}) {
|
|
2389
|
+
const resolved = resolveActions(actions, data, hasPermission, presets);
|
|
2390
|
+
if (resolved.length === 0) {
|
|
2391
|
+
return null;
|
|
2392
|
+
}
|
|
2393
|
+
const mergedTooltipStyle = {
|
|
2394
|
+
...ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
2395
|
+
...tooltipStyle
|
|
2396
|
+
};
|
|
2397
|
+
const renderDefaultItem = (action, hide, showLabel = true) => {
|
|
2398
|
+
if (action.type === "divider") {
|
|
2399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2400
|
+
"div",
|
|
2401
|
+
{
|
|
2402
|
+
role: "separator",
|
|
2403
|
+
className: cn("my-1 h-px bg-gray-100", action.className)
|
|
2404
|
+
},
|
|
2405
|
+
action.key
|
|
2406
|
+
);
|
|
2407
|
+
}
|
|
2408
|
+
if (action.content) {
|
|
2409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: action.className, children: action.content }, action.key);
|
|
2410
|
+
}
|
|
2411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2412
|
+
ActionMenuItem,
|
|
2413
|
+
{
|
|
2414
|
+
label: action.label,
|
|
2415
|
+
icon: action.icon,
|
|
2416
|
+
iconSize: action.iconSize ?? iconSize,
|
|
2417
|
+
iconClassName: cn(itemIconClassName, action.iconClassName),
|
|
2418
|
+
labelClassName: cn(itemLabelClassName, action.labelClassName),
|
|
2419
|
+
tooltip: action.tooltip,
|
|
2420
|
+
tooltipPlacement: action.tooltipPlacement ?? tooltipPlacement,
|
|
2421
|
+
tooltipDelayShow,
|
|
2422
|
+
tooltipDelayHide,
|
|
2423
|
+
tooltipClassName,
|
|
2424
|
+
tooltipStyle: mergedTooltipStyle,
|
|
2425
|
+
disabled: action.disabled,
|
|
2426
|
+
danger: action.danger,
|
|
2427
|
+
highlight: action.highlight,
|
|
2428
|
+
showLabel,
|
|
2429
|
+
className: cn(itemClassName, action.className),
|
|
2430
|
+
onClick: () => runAction(action, data, hide, confirmFn)
|
|
2431
|
+
},
|
|
2432
|
+
action.key
|
|
2433
|
+
);
|
|
2434
|
+
};
|
|
2435
|
+
const renderItems = (hide, showLabel = true) => resolved.map((action) => {
|
|
2436
|
+
const defaultItem = renderDefaultItem(action, hide, showLabel);
|
|
2437
|
+
if (!renderItem) return defaultItem;
|
|
2438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: renderItem(action, { data, hide: hide ?? (() => void 0), defaultItem }) }, action.key);
|
|
2439
|
+
});
|
|
2440
|
+
if (mode === "inline") {
|
|
2441
|
+
const inlineItems = renderItems(void 0, false);
|
|
2442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("flex h-full items-center justify-center gap-1", className), children: inlineItems });
|
|
2443
|
+
}
|
|
2444
|
+
const triggerTooltipText = triggerTooltip === false ? void 0 : triggerTooltip;
|
|
2445
|
+
const buildMenu = (hide) => {
|
|
2446
|
+
const defaultMenu = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2447
|
+
"div",
|
|
2448
|
+
{
|
|
2449
|
+
className: cn(
|
|
2450
|
+
"flex min-w-[180px] flex-col rounded-lg border border-gray-100 bg-white p-2 shadow-lg",
|
|
2451
|
+
menuClassName
|
|
2452
|
+
),
|
|
2453
|
+
children: renderItems(hide, true)
|
|
2454
|
+
}
|
|
2455
|
+
);
|
|
2456
|
+
if (!renderMenu) return defaultMenu;
|
|
2457
|
+
return renderMenu({
|
|
2458
|
+
data,
|
|
2459
|
+
actions: resolved,
|
|
2460
|
+
hide,
|
|
2461
|
+
defaultMenu
|
|
2462
|
+
});
|
|
2463
|
+
};
|
|
2464
|
+
if (renderTrigger) {
|
|
2465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: renderTrigger({
|
|
2466
|
+
data,
|
|
2467
|
+
actions: resolved,
|
|
2468
|
+
hide: () => void 0,
|
|
2469
|
+
defaultMenu: buildMenu(() => void 0)
|
|
2470
|
+
}) });
|
|
2471
|
+
}
|
|
2472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2473
|
+
ToolTip,
|
|
2474
|
+
{
|
|
2475
|
+
text: triggerTooltipText,
|
|
2476
|
+
disabled: !triggerTooltipText,
|
|
2477
|
+
placement: tooltipPlacement,
|
|
2478
|
+
delayShow: tooltipDelayShow,
|
|
2479
|
+
delayHide: tooltipDelayHide,
|
|
2480
|
+
tooltipClassName,
|
|
2481
|
+
tooltipStyle,
|
|
2482
|
+
className: "flex h-full items-center justify-center",
|
|
2483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2484
|
+
PopupCellRenderer,
|
|
2485
|
+
{
|
|
2486
|
+
params: { data },
|
|
2487
|
+
actionIcon,
|
|
2488
|
+
hideTitle: true,
|
|
2489
|
+
className,
|
|
2490
|
+
placement,
|
|
2491
|
+
tippyProps,
|
|
2492
|
+
ariaLabel: triggerAriaLabel,
|
|
2493
|
+
dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
|
|
2494
|
+
}
|
|
2495
|
+
)
|
|
2496
|
+
}
|
|
2497
|
+
);
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2199
2500
|
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
2200
2501
|
var import_react11 = require("react");
|
|
2201
2502
|
var import_fa6 = require("react-icons/fa6");
|
|
2202
|
-
var
|
|
2503
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2203
2504
|
var TableErrorBoundary = ({
|
|
2204
2505
|
isError,
|
|
2205
2506
|
isLoading = false,
|
|
@@ -2216,7 +2517,7 @@ var TableErrorBoundary = ({
|
|
|
2216
2517
|
return "Unable to load table data. Please try again.";
|
|
2217
2518
|
}, [error, errorMessage]);
|
|
2218
2519
|
if (isLoading && !isError) {
|
|
2219
|
-
return /* @__PURE__ */ (0,
|
|
2520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2220
2521
|
"div",
|
|
2221
2522
|
{
|
|
2222
2523
|
className: cn(
|
|
@@ -2227,12 +2528,12 @@ var TableErrorBoundary = ({
|
|
|
2227
2528
|
role: "status",
|
|
2228
2529
|
"aria-live": "polite",
|
|
2229
2530
|
"aria-busy": "true",
|
|
2230
|
-
children: /* @__PURE__ */ (0,
|
|
2531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loader, { size: "40px" })
|
|
2231
2532
|
}
|
|
2232
2533
|
);
|
|
2233
2534
|
}
|
|
2234
2535
|
if (isError) {
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2236
2537
|
"div",
|
|
2237
2538
|
{
|
|
2238
2539
|
className: cn(
|
|
@@ -2243,7 +2544,7 @@ var TableErrorBoundary = ({
|
|
|
2243
2544
|
role: "alert",
|
|
2244
2545
|
"aria-live": "assertive",
|
|
2245
2546
|
children: [
|
|
2246
|
-
/* @__PURE__ */ (0,
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2247
2548
|
import_fa6.FaTriangleExclamation,
|
|
2248
2549
|
{
|
|
2249
2550
|
className: "text-red-500",
|
|
@@ -2251,11 +2552,11 @@ var TableErrorBoundary = ({
|
|
|
2251
2552
|
"aria-hidden": true
|
|
2252
2553
|
}
|
|
2253
2554
|
),
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
2257
2558
|
] }),
|
|
2258
|
-
refetch && /* @__PURE__ */ (0,
|
|
2559
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2259
2560
|
"button",
|
|
2260
2561
|
{
|
|
2261
2562
|
type: "button",
|
|
@@ -2263,7 +2564,7 @@ var TableErrorBoundary = ({
|
|
|
2263
2564
|
disabled: isLoading,
|
|
2264
2565
|
className: "inline-flex items-center gap-2 rounded-lg bg-primary-150 px-4 py-2 text-sm font-medium text-white transition-colors hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
|
|
2265
2566
|
children: [
|
|
2266
|
-
/* @__PURE__ */ (0,
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
2267
2568
|
isLoading ? "Retrying..." : "Try again"
|
|
2268
2569
|
]
|
|
2269
2570
|
}
|
|
@@ -2272,10 +2573,11 @@ var TableErrorBoundary = ({
|
|
|
2272
2573
|
}
|
|
2273
2574
|
);
|
|
2274
2575
|
}
|
|
2275
|
-
return /* @__PURE__ */ (0,
|
|
2576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children });
|
|
2276
2577
|
};
|
|
2277
2578
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2278
2579
|
0 && (module.exports = {
|
|
2580
|
+
ActionMenuItem,
|
|
2279
2581
|
CardSkeleton,
|
|
2280
2582
|
CustomCellEditor,
|
|
2281
2583
|
CustomPagination,
|
|
@@ -2284,8 +2586,14 @@ var TableErrorBoundary = ({
|
|
|
2284
2586
|
Loader,
|
|
2285
2587
|
Modal,
|
|
2286
2588
|
PopupCellRenderer,
|
|
2589
|
+
ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
2590
|
+
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
2591
|
+
ROW_ACTION_ITEM_HOVER_CLASS,
|
|
2592
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
2593
|
+
ROW_ACTION_PRESETS,
|
|
2287
2594
|
ResetColumnsButton,
|
|
2288
2595
|
ResetFiltersButton,
|
|
2596
|
+
RowActions,
|
|
2289
2597
|
SearchInput,
|
|
2290
2598
|
TableErrorBoundary,
|
|
2291
2599
|
TableLayoutToolbarControls,
|
|
@@ -2324,6 +2632,7 @@ var TableErrorBoundary = ({
|
|
|
2324
2632
|
removeByPropertyValues,
|
|
2325
2633
|
removeItem,
|
|
2326
2634
|
resetPageParam,
|
|
2635
|
+
resolveActions,
|
|
2327
2636
|
saveItemLocalStorage,
|
|
2328
2637
|
saveUserState,
|
|
2329
2638
|
set,
|