@apia/table 4.0.16 → 4.0.17
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.ts +2 -1
- package/dist/index.js +42 -35
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
package/dist/index.d.ts
CHANGED
|
@@ -552,6 +552,7 @@ interface IPagination {
|
|
|
552
552
|
currentPage: number | string;
|
|
553
553
|
disabled?: boolean;
|
|
554
554
|
disableReduced?: boolean;
|
|
555
|
+
hideInfo?: boolean;
|
|
555
556
|
hideMaximizeButton?: boolean;
|
|
556
557
|
hideRefreshButton?: boolean;
|
|
557
558
|
isLoading?: boolean;
|
|
@@ -582,7 +583,7 @@ interface IPagination {
|
|
|
582
583
|
showMaximizeOnSmallBreakpoints?: boolean;
|
|
583
584
|
variant?: 'primary' | 'secondary' | 'datagrid';
|
|
584
585
|
}
|
|
585
|
-
declare const Pagination: React__default.MemoExoticComponent<({ appliedFilters, areAllFiltersApplied, className, currentPage, disabled, disableReduced, hasMore, hideMaximizeButton, hideRefreshButton, isLoading, isPerforming, listId: outerListId, onDeleteFilters, onPageChange, onRefresh, pageCount, recordsCount: outerRecordsCount, reachedMax, showMaximizeOnSmallBreakpoints, variant, }: IPagination) => React__default.JSX.Element>;
|
|
586
|
+
declare const Pagination: React__default.MemoExoticComponent<({ appliedFilters, areAllFiltersApplied, className, currentPage, disabled, disableReduced, hasMore, hideInfo, hideMaximizeButton, hideRefreshButton, isLoading, isPerforming, listId: outerListId, onDeleteFilters, onPageChange, onRefresh, pageCount, recordsCount: outerRecordsCount, reachedMax, showMaximizeOnSmallBreakpoints, variant, }: IPagination) => React__default.JSX.Element>;
|
|
586
587
|
|
|
587
588
|
declare function getResponsiveTableContext(tableName: string): TResponsiveTableContext;
|
|
588
589
|
declare function useResponsiveTableContext(tableName?: string): TResponsiveTableContext;
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import React, { useMemo, useRef, useState, memo, useEffect, useCallback, createR
|
|
|
3
3
|
import { Box, getVariant, Input, Select, useBreakpointIndex, Label, Link, Spinner } from '@apia/theme';
|
|
4
4
|
import { useMount, useUpdateEffect, useUnmount, useThrottleFn } from 'ahooks';
|
|
5
5
|
import uniqueId from 'lodash-es/uniqueId';
|
|
6
|
-
import {
|
|
7
|
-
import { addBoundary, useLatest, useUpdateEffect as useUpdateEffect$1, getSpecificParent, isChild, autoDisconnectMutationObserver, getFocusSelector, cantFocusSelector, globalFocus, scrollParentIntoElement, customEvents,
|
|
6
|
+
import { injectReducers, createSlice, shallowEqual as shallowEqual$1 } from '@apia/store';
|
|
7
|
+
import { addBoundary, useLatest, useUpdateEffect as useUpdateEffect$1, getSpecificParent, isChild, autoDisconnectMutationObserver, getFocusSelector, cantFocusSelector, globalFocus, scrollParentIntoElement, customEvents, persistentStorage, EventEmitter, debugDispatcher, usePrevious, useIntermediateValue, getLabel, formatMessage, getDateFormat, noNaN, getIndex, downloadUrl, arrayOrArray, useMount as useMount$1 } from '@apia/util';
|
|
8
8
|
import { shallowEqual } from 'react-redux';
|
|
9
9
|
import { useOtherTagButton, AutoEllipsis, ApiaFilter, IconButton, AccordionItem, Accordion, RequiredMark, ApiaUtil, SimpleButton } from '@apia/components';
|
|
10
10
|
import { Icon } from '@apia/icons';
|
|
@@ -161,7 +161,6 @@ function willHandleKey(ev, state) {
|
|
|
161
161
|
}
|
|
162
162
|
function handleKey(state, { ev }) {
|
|
163
163
|
const {
|
|
164
|
-
altKey: isAltPressed,
|
|
165
164
|
ctrlKey: isCtrlPressed,
|
|
166
165
|
key,
|
|
167
166
|
shiftKey: isShiftPressed
|
|
@@ -174,7 +173,6 @@ function handleKey(state, { ev }) {
|
|
|
174
173
|
newFocusedRow,
|
|
175
174
|
...rest
|
|
176
175
|
}) => setNewFocused(state, {
|
|
177
|
-
altKey: isAltPressed,
|
|
178
176
|
ctrlKey: isCtrlPressed,
|
|
179
177
|
shiftKey: isShiftPressed,
|
|
180
178
|
newFocusedColumn,
|
|
@@ -345,7 +343,6 @@ const responsiveTableSlice = createSlice({
|
|
|
345
343
|
state[tableName] = { ...state[tableName], ...rest };
|
|
346
344
|
if (handleFocus !== false) {
|
|
347
345
|
setNewFocused(state[tableName], {
|
|
348
|
-
altKey: false,
|
|
349
346
|
ctrlKey: false,
|
|
350
347
|
shiftKey: false,
|
|
351
348
|
shouldSelectNewFocused: rest.isFocused ?? state[tableName].isFocused
|
|
@@ -379,7 +376,6 @@ const responsiveTableSlice = createSlice({
|
|
|
379
376
|
...payload.newRows
|
|
380
377
|
);
|
|
381
378
|
setNewFocused(state[payload.tableName], {
|
|
382
|
-
altKey: false,
|
|
383
379
|
ctrlKey: false,
|
|
384
380
|
shiftKey: false,
|
|
385
381
|
shouldSelectNewFocused: true,
|
|
@@ -395,7 +391,6 @@ const responsiveTableSlice = createSlice({
|
|
|
395
391
|
(_, index) => !payload.rowIndices.includes(index)
|
|
396
392
|
);
|
|
397
393
|
setNewFocused(state[payload.tableName], {
|
|
398
|
-
altKey: false,
|
|
399
394
|
ctrlKey: false,
|
|
400
395
|
shiftKey: false,
|
|
401
396
|
shouldSelectNewFocused: true,
|
|
@@ -2594,7 +2589,7 @@ const Responsive = React.memo(NoMemoResponsive);
|
|
|
2594
2589
|
var __defProp$1 = Object.defineProperty;
|
|
2595
2590
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2596
2591
|
var __publicField$1 = (obj, key, value) => {
|
|
2597
|
-
__defNormalProp$1(obj,
|
|
2592
|
+
__defNormalProp$1(obj, key + "" , value);
|
|
2598
2593
|
return value;
|
|
2599
2594
|
};
|
|
2600
2595
|
const maximizationPersist = {
|
|
@@ -2699,6 +2694,7 @@ const NoMemoPagination = ({
|
|
|
2699
2694
|
disabled,
|
|
2700
2695
|
disableReduced,
|
|
2701
2696
|
hasMore,
|
|
2697
|
+
hideInfo,
|
|
2702
2698
|
hideMaximizeButton,
|
|
2703
2699
|
hideRefreshButton,
|
|
2704
2700
|
isLoading,
|
|
@@ -2782,28 +2778,30 @@ const NoMemoPagination = ({
|
|
|
2782
2778
|
iconSize: "Md"
|
|
2783
2779
|
}
|
|
2784
2780
|
),
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2781
|
+
!hideInfo && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2782
|
+
((reachedMax || hasMore) && breakPoint > 3 || breakPoint <= 3) && className !== "grid__pagination" ? /* @__PURE__ */ jsx(
|
|
2783
|
+
IconButton,
|
|
2784
|
+
{
|
|
2785
|
+
variant: "icon-primary",
|
|
2786
|
+
icon: "Info",
|
|
2787
|
+
className: `pagination__information ${reachedMax || hasMore ? "pagination__alertInfo" : ""}`,
|
|
2788
|
+
onClick: () => ApiaUtil.instance.tooltips.open(tooltipProps),
|
|
2789
|
+
ref: setInfoButtonRef,
|
|
2790
|
+
iconSize: "Md",
|
|
2791
|
+
"aria-label": window.BTN_FILE_INFO_TOOLTIP,
|
|
2792
|
+
title: window.BTN_FILE_INFO_TOOLTIP
|
|
2793
|
+
}
|
|
2794
|
+
) : "",
|
|
2795
|
+
breakPoint > 3 && /* @__PURE__ */ jsx(
|
|
2796
|
+
Box,
|
|
2797
|
+
{
|
|
2798
|
+
as: "span",
|
|
2799
|
+
className: "recordsCounter pagination__deleteLabels",
|
|
2800
|
+
title: recordsCountLabel,
|
|
2801
|
+
children: recordsCount !== -1 && `${window.GNR_TOT_RECORDS}: ${recordsCount} `
|
|
2802
|
+
}
|
|
2803
|
+
)
|
|
2804
|
+
] })
|
|
2807
2805
|
] }),
|
|
2808
2806
|
/* @__PURE__ */ jsx(Box, { className: "pagination__controls", children: (numberPageCount > 0 || disableReduced) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2809
2807
|
breakPoint > 2 && /* @__PURE__ */ jsx(
|
|
@@ -2978,7 +2976,7 @@ const NoMemoPagination = ({
|
|
|
2978
2976
|
};
|
|
2979
2977
|
const Pagination = React.memo(NoMemoPagination);
|
|
2980
2978
|
|
|
2981
|
-
function applyFocusAttributes(table, _previousState, state, focus = state.isFocused) {
|
|
2979
|
+
function applyFocusAttributes(table, _previousState, state, focus = state.isFocused, target) {
|
|
2982
2980
|
table.querySelectorAll(getFocusSelector()).forEach((e) => {
|
|
2983
2981
|
e.tabIndex = -1;
|
|
2984
2982
|
});
|
|
@@ -2998,6 +2996,9 @@ function applyFocusAttributes(table, _previousState, state, focus = state.isFocu
|
|
|
2998
2996
|
const focusedCell = table.querySelector(
|
|
2999
2997
|
`tr[data-rowindex="${state.focusedRow}"] td[aria-colindex="${state.focusedColumn}"], tr[data-rowindex="${state.focusedRow}"] th[aria-colindex="${state.focusedColumn}"]`
|
|
3000
2998
|
);
|
|
2999
|
+
if (target) {
|
|
3000
|
+
target.focus();
|
|
3001
|
+
}
|
|
3001
3002
|
if (focusedCell instanceof HTMLElement) {
|
|
3002
3003
|
const widgets = [];
|
|
3003
3004
|
if (state.isEditionMode) {
|
|
@@ -3015,7 +3016,7 @@ function applyFocusAttributes(table, _previousState, state, focus = state.isFocu
|
|
|
3015
3016
|
widget.tabIndex = 0;
|
|
3016
3017
|
if (i === 0)
|
|
3017
3018
|
window.requestAnimationFrame(() => {
|
|
3018
|
-
if (focus) {
|
|
3019
|
+
if (!target && focus) {
|
|
3019
3020
|
widget.focus();
|
|
3020
3021
|
}
|
|
3021
3022
|
});
|
|
@@ -3023,7 +3024,7 @@ function applyFocusAttributes(table, _previousState, state, focus = state.isFocu
|
|
|
3023
3024
|
} else {
|
|
3024
3025
|
focusedCell.tabIndex = 0;
|
|
3025
3026
|
window.requestAnimationFrame(() => {
|
|
3026
|
-
if (focus) {
|
|
3027
|
+
if (!target && focus) {
|
|
3027
3028
|
focusedCell.focus();
|
|
3028
3029
|
}
|
|
3029
3030
|
});
|
|
@@ -3118,7 +3119,13 @@ function handleMouseDownEvent(ev) {
|
|
|
3118
3119
|
state.focusedRow = rowIndex;
|
|
3119
3120
|
state.isFocused = true;
|
|
3120
3121
|
applySelectionAttributes(table, this.getState(), state);
|
|
3121
|
-
applyFocusAttributes(
|
|
3122
|
+
applyFocusAttributes(
|
|
3123
|
+
table,
|
|
3124
|
+
this.getState(),
|
|
3125
|
+
state,
|
|
3126
|
+
state.isFocused,
|
|
3127
|
+
target
|
|
3128
|
+
);
|
|
3122
3129
|
this.setState(state);
|
|
3123
3130
|
this.events.onRowClick?.(
|
|
3124
3131
|
{ row: state.rows[state.focusedRow], index: state.focusedRow },
|
|
@@ -3345,7 +3352,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
3345
3352
|
};
|
|
3346
3353
|
var __privateSet = (obj, member, value, setter) => {
|
|
3347
3354
|
__accessCheck(obj, member, "write to private field");
|
|
3348
|
-
|
|
3355
|
+
member.set(obj, value);
|
|
3349
3356
|
return value;
|
|
3350
3357
|
};
|
|
3351
3358
|
var _unsubscribe;
|