@eztrak/shared 0.13.8 → 0.14.0
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/README.md +114 -3
- package/dist/{chunk-DSP67UYZ.mjs → chunk-EIX5CUQF.mjs} +10 -1
- package/dist/chunk-EIX5CUQF.mjs.map +1 -0
- package/dist/{chunk-4SOWLOGR.mjs → chunk-JATUZDLG.mjs} +21 -14
- package/dist/chunk-JATUZDLG.mjs.map +1 -0
- package/dist/{chunk-UIDXC5S2.mjs → chunk-WZVYTP6G.mjs} +2 -2
- package/dist/components/index.d.mts +12 -2
- package/dist/components/index.d.ts +12 -2
- package/dist/components/index.js +26 -12
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/utils/index.d.mts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/package.json +1 -1
- package/dist/chunk-4SOWLOGR.mjs.map +0 -1
- package/dist/chunk-DSP67UYZ.mjs.map +0 -1
- /package/dist/{chunk-UIDXC5S2.mjs.map → chunk-WZVYTP6G.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.mjs';
|
|
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
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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.js';
|
|
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
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';
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ __export(src_exports, {
|
|
|
77
77
|
parseCurrencyValueToNumber: () => parseCurrencyValueToNumber,
|
|
78
78
|
removeByPropertyValues: () => removeByPropertyValues,
|
|
79
79
|
removeItem: () => removeItem,
|
|
80
|
+
resetPageParam: () => resetPageParam,
|
|
80
81
|
saveItemLocalStorage: () => saveItemLocalStorage,
|
|
81
82
|
saveUserState: () => saveUserState,
|
|
82
83
|
set: () => set,
|
|
@@ -99,6 +100,14 @@ function cn(...inputs) {
|
|
|
99
100
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.default)(inputs));
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
// src/utils/resetPageParam.ts
|
|
104
|
+
function resetPageParam(params, pageKey = "page", defaultPage = "1") {
|
|
105
|
+
if (params.has(pageKey)) {
|
|
106
|
+
params.set(pageKey, defaultPage);
|
|
107
|
+
}
|
|
108
|
+
return params;
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
// src/utils/helpers.ts
|
|
103
112
|
var truncateText = (text, maxLength = 20) => {
|
|
104
113
|
if (text === null || text === void 0) return "";
|
|
@@ -1254,6 +1263,7 @@ function DropdownFilter({
|
|
|
1254
1263
|
isDisabled = false,
|
|
1255
1264
|
isLoading = false,
|
|
1256
1265
|
saveToLocalStorage = false,
|
|
1266
|
+
pageParam = "page",
|
|
1257
1267
|
...otherProps
|
|
1258
1268
|
}) {
|
|
1259
1269
|
const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
|
|
@@ -1266,10 +1276,10 @@ function DropdownFilter({
|
|
|
1266
1276
|
if (stored != null && stored !== "") {
|
|
1267
1277
|
setSearchParams((prev) => {
|
|
1268
1278
|
prev.set(name, String(stored));
|
|
1269
|
-
return prev;
|
|
1279
|
+
return resetPageParam(prev, pageParam);
|
|
1270
1280
|
});
|
|
1271
1281
|
}
|
|
1272
|
-
}, [saveToLocalStorage, name, searchParams, setSearchParams]);
|
|
1282
|
+
}, [saveToLocalStorage, name, pageParam, searchParams, setSearchParams]);
|
|
1273
1283
|
const currentValue = searchParams.get(name);
|
|
1274
1284
|
const selectedOption = currentValue ? options?.find(
|
|
1275
1285
|
(option) => option[valueKey]?.toString() === currentValue
|
|
@@ -1277,12 +1287,15 @@ function DropdownFilter({
|
|
|
1277
1287
|
const handleChange = (selected) => {
|
|
1278
1288
|
const selectedValue = selected && selected[valueKey] !== "" ? String(selected[valueKey]) : null;
|
|
1279
1289
|
setSearchParams((prev) => {
|
|
1290
|
+
if ((prev.get(name) ?? "") === (selectedValue ?? "")) {
|
|
1291
|
+
return prev;
|
|
1292
|
+
}
|
|
1280
1293
|
if (!selectedValue) {
|
|
1281
1294
|
prev.delete(name);
|
|
1282
1295
|
} else {
|
|
1283
1296
|
prev.set(name, selectedValue);
|
|
1284
1297
|
}
|
|
1285
|
-
return prev;
|
|
1298
|
+
return resetPageParam(prev, pageParam);
|
|
1286
1299
|
});
|
|
1287
1300
|
if (saveToLocalStorage) {
|
|
1288
1301
|
if (selectedValue) {
|
|
@@ -1399,6 +1412,7 @@ function SearchInput({
|
|
|
1399
1412
|
debounceDelay = 500,
|
|
1400
1413
|
customIcon = null,
|
|
1401
1414
|
defaultValue,
|
|
1415
|
+
pageParam = "page",
|
|
1402
1416
|
...props
|
|
1403
1417
|
}) {
|
|
1404
1418
|
const [searchParams, setSearchParams] = (0, import_react_router_dom4.useSearchParams)();
|
|
@@ -1406,17 +1420,18 @@ function SearchInput({
|
|
|
1406
1420
|
const [inputValue, setInputValue] = (0, import_react5.useState)(queryParam);
|
|
1407
1421
|
const debounceTimerRef = (0, import_react5.useRef)(null);
|
|
1408
1422
|
const updateSearchParams = (searchQuery) => {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1423
|
+
const nextValue = searchQuery?.trim() ?? "";
|
|
1424
|
+
setSearchParams((prev) => {
|
|
1425
|
+
if ((prev.get(defaultParam) ?? "") === nextValue) {
|
|
1412
1426
|
return prev;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1427
|
+
}
|
|
1428
|
+
if (nextValue) {
|
|
1429
|
+
prev.set(defaultParam, nextValue);
|
|
1430
|
+
} else {
|
|
1416
1431
|
prev.delete(defaultParam);
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
}
|
|
1432
|
+
}
|
|
1433
|
+
return resetPageParam(prev, pageParam);
|
|
1434
|
+
});
|
|
1420
1435
|
};
|
|
1421
1436
|
const handleSearch = (e) => {
|
|
1422
1437
|
e.preventDefault();
|
|
@@ -2308,6 +2323,7 @@ var TableErrorBoundary = ({
|
|
|
2308
2323
|
parseCurrencyValueToNumber,
|
|
2309
2324
|
removeByPropertyValues,
|
|
2310
2325
|
removeItem,
|
|
2326
|
+
resetPageParam,
|
|
2311
2327
|
saveItemLocalStorage,
|
|
2312
2328
|
saveUserState,
|
|
2313
2329
|
set,
|