@codezee/sixtify-brahma 0.2.169 → 0.2.171
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/package.json +1 -1
- package/packages/shared-components/dist/AgGrid/AgGrid.d.ts +8 -0
- package/packages/shared-components/dist/AgGrid/AgGrid.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/AgGrid.js +10 -6
- package/packages/shared-components/dist/AgGrid/hooks/index.d.ts +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/index.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/index.js +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.d.ts +46 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSelection.js +182 -0
- package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.js +5 -0
- package/packages/shared-components/dist/Button/SplitButton.d.ts.map +1 -1
- package/packages/shared-components/dist/Button/SplitButton.js +20 -5
- package/packages/shared-components/dist/Chips/FilterPill.d.ts +5 -0
- package/packages/shared-components/dist/Chips/FilterPill.d.ts.map +1 -1
- package/packages/shared-components/dist/Chips/FilterPill.js +16 -6
- package/packages/shared-components/dist/Dialog/DeleteDialog.d.ts.map +1 -1
- package/packages/shared-components/dist/Dialog/DeleteDialog.js +8 -0
- package/packages/shared-components/dist/Dialog/Dialog.d.ts.map +1 -1
- package/packages/shared-components/dist/Dialog/Dialog.js +3 -0
- package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.js +6 -0
- package/packages/shared-components/dist/FilterList/FilterListV2.d.ts.map +1 -1
- package/packages/shared-components/dist/FilterList/FilterListV2.js +54 -13
- package/packages/shared-components/dist/FormFields/Autocomplete/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/DatePicker/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/DateRangePicker/Skeleton.js +4 -4
- package/packages/shared-components/dist/FormFields/DateTimePicker/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/FileUpload/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/PhoneInputField/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/RadioGroupField/Skeleton.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/RadioGroupField/Skeleton.js +1 -1
- package/packages/shared-components/dist/FormFields/Rating/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/Select/Select.js +2 -2
- package/packages/shared-components/dist/FormFields/TextField/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/TextField/TextField.d.ts +1 -1
- package/packages/shared-components/dist/FormFields/TextField/TextField.d.ts.map +1 -1
- package/packages/shared-components/dist/FormFields/TextField/TextField.js +3 -3
- package/packages/shared-components/dist/FormFields/TimeField/Skeleton.js +2 -2
- package/packages/shared-components/dist/FormFields/TimePicker/Skeleton.js +2 -2
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.js +17 -2
package/package.json
CHANGED
|
@@ -10,12 +10,20 @@ export type AgGridProps<T = unknown> = AgGridReactProps<T> & {
|
|
|
10
10
|
height?: string;
|
|
11
11
|
ref?: Ref<AgGridReact<T>>;
|
|
12
12
|
totalRecords?: number;
|
|
13
|
+
onSelectAllClick?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
13
14
|
overlayNoRowsTemplate?: string;
|
|
14
15
|
loadingOverlayMessage?: string;
|
|
15
16
|
selectedItems?: number;
|
|
16
17
|
enableSecondRowFilter?: boolean;
|
|
17
18
|
disableKeyBoardEvent?: boolean;
|
|
18
19
|
enableFloatingFilter?: boolean;
|
|
20
|
+
isSelectAllVisible?: boolean;
|
|
21
|
+
selectAllMessage?: {
|
|
22
|
+
show: boolean;
|
|
23
|
+
text: string;
|
|
24
|
+
buttonText: string;
|
|
25
|
+
onButtonClick: () => void;
|
|
26
|
+
};
|
|
19
27
|
};
|
|
20
28
|
type AgGridType = React.ForwardRefExoticComponent<AgGridProps> & (<GenericType>(props: AgGridProps<GenericType>) => JSX.Element);
|
|
21
29
|
export declare const AgGrid: AgGridType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,yBAAyB,CAAC;AAWjC,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,CAAC,OAAO,CAAC,KAAG,IAczD,CAAC;AAEF,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,eAAe,UAAqB,CAAC;AAGlD,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACxE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE;QACjB,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,IAAI,CAAC;KAC3B,CAAC;CACH,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,GAC5D,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAElE,eAAO,MAAM,MAAM,EAuRd,UAAU,CAAC"}
|
|
@@ -11,6 +11,7 @@ const AgGridStyleProvider_1 = require("./AgGridStyleProvider");
|
|
|
11
11
|
const LoadingOverlay_1 = require("./LoadingOverlay");
|
|
12
12
|
const NoDataOverlay_1 = require("./NoDataOverlay");
|
|
13
13
|
require("./registerAgGridModules");
|
|
14
|
+
const Button_1 = require("../Button");
|
|
14
15
|
const hideNoRowsOverlay = (api) => {
|
|
15
16
|
if (!api) {
|
|
16
17
|
return;
|
|
@@ -35,9 +36,9 @@ exports.defaultPageSize = 100;
|
|
|
35
36
|
exports.pageSizeOptions = [20, 50, 100, 200];
|
|
36
37
|
exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
37
38
|
const { layout } = (0, utils_1.useGetDeviceType)();
|
|
38
|
-
const { height = "597px", rowHeight =
|
|
39
|
+
const { height = "597px", rowHeight = 50, rowModelType = "infinite", defaultColDef, rowBuffer = 5,
|
|
39
40
|
// eslint-disable-next-line quotes
|
|
40
|
-
overlayNoRowsTemplate = '<span class="ag-overlay-no-rows-center">No Data Found</span>', pagination = false, enableSecondRowFilter, disableKeyBoardEvent = false, onModelUpdated, onFirstDataRendered, onViewportChanged, onFilterChanged, paginationPageSize: paginationPageSizeProp, cacheBlockSize: cacheBlockSizeProp, infiniteInitialRowCount: infiniteInitialRowCountProp, loading: gridLoading = false, ...rest } = props;
|
|
41
|
+
overlayNoRowsTemplate = '<span class="ag-overlay-no-rows-center">No Data Found</span>', pagination = false, enableSecondRowFilter, disableKeyBoardEvent, isSelectAllVisible = false, onSelectAllClick, selectAllMessage, onModelUpdated, onFirstDataRendered, onViewportChanged, onFilterChanged, paginationPageSize: paginationPageSizeProp, cacheBlockSize: cacheBlockSizeProp, infiniteInitialRowCount: infiniteInitialRowCountProp, loading: gridLoading = false, ...rest } = props;
|
|
41
42
|
const resolvedPaginationPageSize = paginationPageSizeProp ?? exports.defaultPageSize;
|
|
42
43
|
const cacheBlockSize = cacheBlockSizeProp ?? resolvedPaginationPageSize;
|
|
43
44
|
const infiniteInitialRowCount = infiniteInitialRowCountProp ?? resolvedPaginationPageSize;
|
|
@@ -75,7 +76,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
75
76
|
if (datasource) {
|
|
76
77
|
setTimeout(() => {
|
|
77
78
|
const displayedCount = api.getDisplayedRowCount();
|
|
78
|
-
const renderedNodes = api.getRenderedNodes().length
|
|
79
|
+
const renderedNodes = api.getRenderedNodes().length;
|
|
79
80
|
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
80
81
|
}, 50);
|
|
81
82
|
}
|
|
@@ -83,7 +84,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
83
84
|
else {
|
|
84
85
|
setTimeout(() => {
|
|
85
86
|
const displayedCount = api.getDisplayedRowCount();
|
|
86
|
-
const renderedNodes = api.getRenderedNodes().length
|
|
87
|
+
const renderedNodes = api.getRenderedNodes().length;
|
|
87
88
|
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
88
89
|
}, 50);
|
|
89
90
|
}
|
|
@@ -152,10 +153,13 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
152
153
|
suppressFloatingFilterButton: enableSecondRowFilter,
|
|
153
154
|
filterParams: {
|
|
154
155
|
...defaultColumnDef.filterParams,
|
|
155
|
-
buttons:
|
|
156
|
+
buttons: !enableSecondRowFilter || disableKeyBoardEvent
|
|
157
|
+
? ["apply", "reset"]
|
|
158
|
+
: [],
|
|
156
159
|
},
|
|
157
160
|
}, rowHeight: rowHeight, rowModelType: rowModelType, rowBuffer: rowBuffer, infiniteInitialRowCount: infiniteInitialRowCount, overlayNoRowsTemplate: overlayNoRowsTemplate, loadingOverlayComponent: LoadingOverlay_1.LoadingOverlay, loading: gridLoading, noRowsOverlayComponent: NoDataOverlay_1.NoDataOverlay, suppressNoRowsOverlay: rowModelType === "infinite" || gridLoading, pagination: pagination, onModelUpdated: handleModelUpdated, onFirstDataRendered: handleFirstDataRendered, onViewportChanged: handleViewportChanged, onFilterChanged: handleFilterChanged, ...(pagination
|
|
158
161
|
? { paginationPageSize: resolvedPaginationPageSize }
|
|
159
|
-
: {}), paginationPageSizeSelector: pagination ? exports.pageSizeOptions : false, ...rest }),
|
|
162
|
+
: {}), paginationPageSizeSelector: pagination ? exports.pageSizeOptions : false, ...rest }), isSelectAllVisible && (onSelectAllClick || selectAllMessage) && ((0, jsx_runtime_1.jsx)(material_1.Box, { position: "absolute", bottom: selectAllMessage?.show ? "10px" : "15px", children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { paddingLeft: selectAllMessage?.text ? "20px" : "0px" }, children: (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", spacing: 1, alignItems: "center", children: selectAllMessage?.show ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: selectAllMessage.text }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", size: "small", onClick: selectAllMessage.onButtonClick, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: selectAllMessage.buttonText }) })] })) : (!!props.selectedItems &&
|
|
163
|
+
pagination && ((0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", children: ["Selected Rows ", props.selectedItems] }))) }) }) }))] }));
|
|
160
164
|
});
|
|
161
165
|
exports.AgGrid.displayName = "AgGrid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
|
|
@@ -20,3 +20,4 @@ __exportStar(require("./useAgGridKeyboardShortcuts"), exports);
|
|
|
20
20
|
__exportStar(require("./useAgGridRowSelectionConfig"), exports);
|
|
21
21
|
__exportStar(require("./useAgGridSummaryRow"), exports);
|
|
22
22
|
__exportStar(require("./useAgGridSummaryRowUpdate"), exports);
|
|
23
|
+
__exportStar(require("./useAgGridSelection"), exports);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IGetRowsParams } from "ag-grid-community";
|
|
2
|
+
import type { AgGridReact } from "ag-grid-react";
|
|
3
|
+
import type { RefObject } from "react";
|
|
4
|
+
type UseAgGridSelectionArgs<T extends {
|
|
5
|
+
id: string;
|
|
6
|
+
}> = {
|
|
7
|
+
gridRef: RefObject<AgGridReact<T>>;
|
|
8
|
+
currentPageItems: T[];
|
|
9
|
+
totalRecords: number;
|
|
10
|
+
selectedEmployee: string[];
|
|
11
|
+
fetchAll: (params: IGetRowsParams) => Promise<{
|
|
12
|
+
list: T[];
|
|
13
|
+
totalCount: number;
|
|
14
|
+
selectableCount?: number;
|
|
15
|
+
}>;
|
|
16
|
+
getExtraParams: () => Record<string, unknown>;
|
|
17
|
+
isRowSelectable?: (params: {
|
|
18
|
+
data: T;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
};
|
|
21
|
+
type UseAgGridSelectionReturn<T extends {
|
|
22
|
+
id: string;
|
|
23
|
+
}> = {
|
|
24
|
+
selectedIds: string[];
|
|
25
|
+
allDataCache: T[] | null;
|
|
26
|
+
setLastQueryParams: (params: IGetRowsParams) => void;
|
|
27
|
+
selectCurrentPage: () => void;
|
|
28
|
+
deselectCurrentPage: () => void;
|
|
29
|
+
clearSelection: () => void;
|
|
30
|
+
onSelectionChanged: () => void;
|
|
31
|
+
checkboxState: {
|
|
32
|
+
checked: boolean;
|
|
33
|
+
indeterminate: boolean;
|
|
34
|
+
};
|
|
35
|
+
message: {
|
|
36
|
+
show: boolean;
|
|
37
|
+
text: string;
|
|
38
|
+
buttonText: string;
|
|
39
|
+
onButtonClick: () => void;
|
|
40
|
+
} | null;
|
|
41
|
+
};
|
|
42
|
+
export declare const useAgGridSelection: <T extends {
|
|
43
|
+
id: string;
|
|
44
|
+
}>({ gridRef, currentPageItems, totalRecords, selectedEmployee, fetchAll, getExtraParams, isRowSelectable, }: UseAgGridSelectionArgs<T>) => UseAgGridSelectionReturn<T>;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=useAgGridSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridSelection.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridSelection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,sBAAsB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IACtD,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,gBAAgB,EAAE,CAAC,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC;QAC5C,IAAI,EAAE,CAAC,EAAE,CAAC;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IACH,cAAc,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC;CACpD,CAAC;AAEF,KAAK,wBAAwB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IACxD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;IACzB,kBAAkB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,aAAa,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,IAAI,CAAC;KAC3B,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,2GAQ1D,sBAAsB,CAAC,CAAC,CAAC,KAAG,wBAAwB,CAAC,CAAC,CAuPxD,CAAC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridSelection = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAgGridSelection = ({ gridRef, currentPageItems, totalRecords, selectedEmployee, fetchAll, getExtraParams, isRowSelectable, }) => {
|
|
6
|
+
const [selectedIds, setSelectedIds] = (0, react_1.useState)([]);
|
|
7
|
+
const [allDataCache, setAllDataCache] = (0, react_1.useState)(null);
|
|
8
|
+
const [selectableCount, setSelectableCount] = (0, react_1.useState)(null);
|
|
9
|
+
const lastQueryParamsRef = (0, react_1.useRef)(null);
|
|
10
|
+
const currentPageState = (0, react_1.useMemo)(() => {
|
|
11
|
+
if (!currentPageItems.length) {
|
|
12
|
+
return { selected: 0, checked: false, indeterminate: false };
|
|
13
|
+
}
|
|
14
|
+
// Filter to only selectable items for checkbox state calculation
|
|
15
|
+
const selectableItems = isRowSelectable
|
|
16
|
+
? currentPageItems.filter((item) => isRowSelectable({ data: item }))
|
|
17
|
+
: currentPageItems;
|
|
18
|
+
if (!selectableItems.length) {
|
|
19
|
+
return { selected: 0, checked: false, indeterminate: false };
|
|
20
|
+
}
|
|
21
|
+
const selected = selectableItems.filter(({ id }) => selectedIds.includes(id)).length;
|
|
22
|
+
return {
|
|
23
|
+
selected,
|
|
24
|
+
checked: selected === selectableItems.length,
|
|
25
|
+
indeterminate: selected > 0 && selected < selectableItems.length,
|
|
26
|
+
};
|
|
27
|
+
}, [currentPageItems, selectedIds, isRowSelectable]);
|
|
28
|
+
const syncGridSelection = (0, react_1.useCallback)(() => {
|
|
29
|
+
if (!gridRef.current) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const api = gridRef.current.api;
|
|
33
|
+
currentPageItems.forEach((item) => {
|
|
34
|
+
const node = api.getRowNode(item.id);
|
|
35
|
+
if (isRowSelectable && !isRowSelectable({ data: item })) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const shouldBeSelected = selectedIds.includes(item.id);
|
|
39
|
+
if (node && node.isSelected() !== shouldBeSelected) {
|
|
40
|
+
node.setSelected(shouldBeSelected, undefined, "api");
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, [gridRef, currentPageItems, selectedIds, isRowSelectable]);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
syncGridSelection();
|
|
46
|
+
}, [syncGridSelection]);
|
|
47
|
+
const selectCurrentPage = (0, react_1.useCallback)(() => {
|
|
48
|
+
// Filter to only selectable rows if isRowSelectable is provided
|
|
49
|
+
const selectableItems = isRowSelectable
|
|
50
|
+
? currentPageItems.filter((item) => isRowSelectable({ data: item }))
|
|
51
|
+
: currentPageItems;
|
|
52
|
+
const currentPageIds = selectableItems.map(({ id }) => id);
|
|
53
|
+
setSelectedIds((prev) => {
|
|
54
|
+
const newSet = new Set([...prev, ...currentPageIds]);
|
|
55
|
+
return Array.from(newSet);
|
|
56
|
+
});
|
|
57
|
+
}, [currentPageItems, isRowSelectable]);
|
|
58
|
+
const deselectCurrentPage = (0, react_1.useCallback)(() => {
|
|
59
|
+
const currentPageIds = new Set(currentPageItems.map(({ id }) => id));
|
|
60
|
+
setSelectedIds((prev) => prev.filter((id) => !currentPageIds.has(id)));
|
|
61
|
+
}, [currentPageItems]);
|
|
62
|
+
const selectAll = (0, react_1.useCallback)(async (params) => {
|
|
63
|
+
const extraParams = getExtraParams();
|
|
64
|
+
const base = params ??
|
|
65
|
+
lastQueryParamsRef.current ??
|
|
66
|
+
{ startRow: 0, endRow: totalRecords || 0 };
|
|
67
|
+
const { list, totalCount, selectableCount: apiSelectableCount, } = await fetchAll({
|
|
68
|
+
...base,
|
|
69
|
+
startRow: 0,
|
|
70
|
+
endRow: totalRecords ?? 0,
|
|
71
|
+
...extraParams,
|
|
72
|
+
quickFilter: null,
|
|
73
|
+
});
|
|
74
|
+
const selectableList = isRowSelectable
|
|
75
|
+
? list.filter((item) => isRowSelectable({ data: item }))
|
|
76
|
+
: list;
|
|
77
|
+
const allIds = Array.from(new Set(selectableList.map(({ id }) => id)));
|
|
78
|
+
setAllDataCache(list);
|
|
79
|
+
if (apiSelectableCount !== undefined) {
|
|
80
|
+
setSelectableCount(apiSelectableCount);
|
|
81
|
+
}
|
|
82
|
+
setSelectedIds(allIds);
|
|
83
|
+
if (totalRecords === 0 && totalCount) {
|
|
84
|
+
gridRef.current?.api?.setRowCount(totalCount, false);
|
|
85
|
+
}
|
|
86
|
+
}, [fetchAll, totalRecords, gridRef, isRowSelectable, getExtraParams]);
|
|
87
|
+
const clearSelection = (0, react_1.useCallback)(() => {
|
|
88
|
+
setSelectedIds([]);
|
|
89
|
+
setAllDataCache(null);
|
|
90
|
+
setSelectableCount(null);
|
|
91
|
+
if (gridRef.current) {
|
|
92
|
+
gridRef.current.api.deselectAll();
|
|
93
|
+
}
|
|
94
|
+
}, [gridRef]);
|
|
95
|
+
const onSelectionChanged = (0, react_1.useCallback)(() => {
|
|
96
|
+
if (!gridRef.current) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const selectedRows = gridRef.current.api.getSelectedRows();
|
|
100
|
+
const selectableSelectedRows = isRowSelectable
|
|
101
|
+
? selectedRows.filter((row) => isRowSelectable({ data: row }))
|
|
102
|
+
: selectedRows;
|
|
103
|
+
const selectedRowIds = selectableSelectedRows.map(({ id }) => id);
|
|
104
|
+
const currentPageIds = currentPageItems.map(({ id }) => id);
|
|
105
|
+
setSelectedIds((prev) => {
|
|
106
|
+
const base = prev.filter((id) => !currentPageIds.includes(id));
|
|
107
|
+
const merged = new Set([...base, ...selectedRowIds]);
|
|
108
|
+
return Array.from(merged);
|
|
109
|
+
});
|
|
110
|
+
}, [gridRef, currentPageItems, isRowSelectable]);
|
|
111
|
+
const setLastQueryParams = (0, react_1.useCallback)((params) => {
|
|
112
|
+
lastQueryParamsRef.current = params;
|
|
113
|
+
}, []);
|
|
114
|
+
const selectedRecords = selectedEmployee.length;
|
|
115
|
+
const totalRecordsCount = allDataCache?.length && allDataCache.length > totalRecords
|
|
116
|
+
? allDataCache.length
|
|
117
|
+
: totalRecords;
|
|
118
|
+
// Use selectableCount from API if available (after first select all), otherwise use total records
|
|
119
|
+
const displayRecordsCount = selectableCount ?? totalRecordsCount;
|
|
120
|
+
const message = (0, react_1.useMemo)(() => {
|
|
121
|
+
if (!selectedRecords) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (displayRecordsCount === selectedRecords) {
|
|
125
|
+
return {
|
|
126
|
+
show: true,
|
|
127
|
+
text: `All ${displayRecordsCount} rows are selected.`,
|
|
128
|
+
buttonText: "Clear selection",
|
|
129
|
+
onButtonClick: clearSelection,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
show: true,
|
|
134
|
+
text: `${selectedRecords} rows selected.`,
|
|
135
|
+
buttonText: `Select all ${displayRecordsCount} rows`,
|
|
136
|
+
onButtonClick: () => void selectAll(),
|
|
137
|
+
};
|
|
138
|
+
}, [selectedRecords, displayRecordsCount, clearSelection, selectAll]);
|
|
139
|
+
(0, react_1.useEffect)(() => {
|
|
140
|
+
const handleKeyDown = (event) => {
|
|
141
|
+
if (event.key.toLowerCase() === "a" && (event.ctrlKey || event.metaKey)) {
|
|
142
|
+
const activeElement = document.activeElement;
|
|
143
|
+
const isInputField = activeElement?.tagName === "INPUT" ||
|
|
144
|
+
activeElement?.tagName === "TEXTAREA" ||
|
|
145
|
+
activeElement?.contentEditable === "true";
|
|
146
|
+
if (isInputField || !currentPageItems.length) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
selectCurrentPage();
|
|
151
|
+
}
|
|
152
|
+
if (event.key.toLowerCase() === "a" && event.altKey) {
|
|
153
|
+
const activeElement = document.activeElement;
|
|
154
|
+
const isInputField = activeElement?.tagName === "INPUT" ||
|
|
155
|
+
activeElement?.tagName === "TEXTAREA" ||
|
|
156
|
+
activeElement?.contentEditable === "true";
|
|
157
|
+
if (isInputField || !currentPageItems.length) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
deselectCurrentPage();
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
165
|
+
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
166
|
+
}, [currentPageItems.length, selectCurrentPage, deselectCurrentPage]);
|
|
167
|
+
return {
|
|
168
|
+
selectedIds,
|
|
169
|
+
allDataCache,
|
|
170
|
+
setLastQueryParams,
|
|
171
|
+
selectCurrentPage,
|
|
172
|
+
deselectCurrentPage,
|
|
173
|
+
clearSelection,
|
|
174
|
+
onSelectionChanged,
|
|
175
|
+
checkboxState: {
|
|
176
|
+
checked: currentPageState.checked,
|
|
177
|
+
indeterminate: currentPageState.indeterminate,
|
|
178
|
+
},
|
|
179
|
+
message,
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
exports.useAgGridSelection = useAgGridSelection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCellEnterClick.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useCellEnterClick.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,GACb,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useCellEnterClick.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useCellEnterClick.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,GACb,EAAE,qBAAqB,QAuEvB"}
|
|
@@ -9,6 +9,11 @@ function useCellEnterClick({ buttonRef, disabled, popoverOpen, onPressEnter, })
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
const handleKeyDown = (event) => {
|
|
12
|
+
if (document.querySelector(
|
|
13
|
+
// eslint-disable-next-line quotes
|
|
14
|
+
'.MuiDialog-root, [role="dialog"], .MuiPopover-root, .MuiModal-root')) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
12
17
|
const keyIsClickTrigger = event.key === "Enter" || event.key === " ";
|
|
13
18
|
if (!keyIsClickTrigger ||
|
|
14
19
|
event.shiftKey ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitButton.d.ts","sourceRoot":"","sources":["../../src/Button/SplitButton.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"SplitButton.d.ts","sourceRoot":"","sources":["../../src/Button/SplitButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAYL,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,QAAQ,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAElC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,0IAgBzB,gBAAgB,mDAsNlB,CAAC"}
|
|
@@ -57,11 +57,21 @@ const SplitButton = ({ icon, label, size = "medium", onClick, menuItems = [], sx
|
|
|
57
57
|
setOpen((prev) => !prev);
|
|
58
58
|
};
|
|
59
59
|
const handleClose = (event) => {
|
|
60
|
-
if (anchorRef.current?.contains(event.target)
|
|
60
|
+
if (anchorRef.current?.contains(event.target) ||
|
|
61
|
+
// eslint-disable-next-line quotes
|
|
62
|
+
event.target?.closest('[role="menu"]')) {
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
63
65
|
setOpen(false);
|
|
64
66
|
};
|
|
67
|
+
const handleMenuKeyDown = (event) => {
|
|
68
|
+
if (event.key === "Escape") {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
setOpen(false);
|
|
71
|
+
anchorRef.current?.querySelector("button[aria-expanded]")?.focus();
|
|
72
|
+
}
|
|
73
|
+
// Allow Tab to work naturally without closing the menu
|
|
74
|
+
};
|
|
65
75
|
const handleMainClick = () => {
|
|
66
76
|
if (disabled || effectiveMain.disabled || loading) {
|
|
67
77
|
return;
|
|
@@ -79,17 +89,22 @@ const SplitButton = ({ icon, label, size = "medium", onClick, menuItems = [], sx
|
|
|
79
89
|
}
|
|
80
90
|
setOpen(false);
|
|
81
91
|
};
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.ButtonGroup, { ref: anchorRef, sx: {
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.ButtonGroup, { ref: anchorRef, id: "split-button", sx: {
|
|
83
93
|
boxShadow: "none",
|
|
84
94
|
border: "none !important",
|
|
85
95
|
position: "relative",
|
|
86
96
|
minWidth: "60px",
|
|
87
97
|
...containerSx,
|
|
88
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: variant, size: size, startIcon: !loading ? effectiveMain.icon : null, disabled: disabled || effectiveMain.disabled, onClick: handleMainClick, sx: sx, children: loading ? (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 18 }) : effectiveMain.label }), filteredMenuItems.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Button, { size: size, variant: variant, disabled: disabled || arrowDisabled || loading, "aria-controls": open ? "split-button-menu" : undefined, "aria-expanded": open ? "true" : undefined,
|
|
98
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: variant, size: size, startIcon: !loading ? effectiveMain.icon : null, disabled: disabled || effectiveMain.disabled, onClick: handleMainClick, sx: sx, children: loading ? (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 18 }) : effectiveMain.label }), filteredMenuItems.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Button, { size: size, variant: variant, disabled: disabled || arrowDisabled || loading, "aria-controls": open ? "split-button-menu" : undefined, "aria-expanded": open ? "true" : undefined, "aria-haspopup": "true", onClick: handleToggle, onKeyDown: (e) => {
|
|
99
|
+
if (e.key === "ArrowDown" && !open) {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
setOpen(true);
|
|
102
|
+
}
|
|
103
|
+
}, sx: { width: "32px", minWidth: "32px", ...sx }, children: (0, jsx_runtime_1.jsx)(ArrowDropDown_1.default, {}) }))] }), (0, jsx_runtime_1.jsx)(material_1.Popper, { open: open, anchorEl: anchorRef.current, role: undefined, transition: true, disablePortal: true, placement: "bottom-end", sx: { zIndex: 1300 }, children: ({ TransitionProps, placement }) => ((0, jsx_runtime_1.jsx)(material_1.Grow, { ...TransitionProps, style: {
|
|
89
104
|
transformOrigin: placement === "bottom" ? "center top" : "center bottom",
|
|
90
|
-
}, children: (0, jsx_runtime_1.jsx)(material_1.Paper, { elevation: 3, children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClose, children: (0, jsx_runtime_1.jsx)(material_1.MenuList, { sx: { padding: "2px" }, children: filteredMenuItems.map((item) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.
|
|
105
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Paper, { elevation: 3, children: (0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClose, children: (0, jsx_runtime_1.jsx)(material_1.MenuList, { sx: { padding: "2px" }, id: "split-button-menu", autoFocusItem: open, onKeyDown: handleMenuKeyDown, role: "menu", "aria-labelledby": "split-button", children: filteredMenuItems.map((item) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemButton, { disabled: item.disabled, sx: {
|
|
91
106
|
padding: "5px 16px 5px 10px",
|
|
92
|
-
}, onClick: () => handleMenuItemClick(item), children: item.label }), item.divider && ((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
107
|
+
}, onClick: () => handleMenuItemClick(item), children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: "15px" }, children: item.label }) }), item.divider && ((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
93
108
|
border: "none",
|
|
94
109
|
borderTop: "1px solid #eee",
|
|
95
110
|
margin: 0,
|
|
@@ -6,6 +6,11 @@ type FilterPillProps = {
|
|
|
6
6
|
onClick?: (e: {
|
|
7
7
|
currentTarget: HTMLDivElement | null;
|
|
8
8
|
}) => void;
|
|
9
|
+
isFocused?: boolean;
|
|
10
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
11
|
+
onFocus?: () => void;
|
|
12
|
+
onBlur?: () => void;
|
|
13
|
+
tabIndex?: number;
|
|
9
14
|
};
|
|
10
15
|
export declare const FilterPill: React.ForwardRefExoticComponent<FilterPillProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
16
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterPill.d.ts","sourceRoot":"","sources":["../../src/Chips/FilterPill.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,aAAa,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterPill.d.ts","sourceRoot":"","sources":["../../src/Chips/FilterPill.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,aAAa,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,wFA2DtB,CAAC"}
|
|
@@ -6,22 +6,32 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const icons_1 = require("@mui/x-date-pickers/icons");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const Chips_1 = require("../Chips");
|
|
9
|
-
exports.FilterPill = (0, react_1.forwardRef)(({ onDelete, label, onClick }, ref) => {
|
|
9
|
+
exports.FilterPill = (0, react_1.forwardRef)(({ onDelete, label, onClick, isFocused = false, onKeyDown, onFocus, onBlur, tabIndex = 0, }, ref) => {
|
|
10
10
|
const theme = (0, material_1.useTheme)();
|
|
11
|
-
const { black,
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(Chips_1.Chip, { ref: ref, label: label, variant: "filled", deleteIcon: onDelete && (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}), sx: {
|
|
11
|
+
const { black, butterflyBlue, iron } = theme.palette.app.color;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(Chips_1.Chip, { ref: ref, label: label, variant: "filled", deleteIcon: onDelete && (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}), tabIndex: tabIndex, onKeyDown: onKeyDown, onFocus: onFocus, onBlur: onBlur, sx: {
|
|
13
13
|
maxWidth: "200px",
|
|
14
14
|
borderRadius: "20px",
|
|
15
15
|
color: black[900],
|
|
16
|
-
backgroundColor: `${
|
|
16
|
+
backgroundColor: `${butterflyBlue[600]} !important`,
|
|
17
17
|
"&:hover": {
|
|
18
|
-
backgroundColor:
|
|
18
|
+
backgroundColor: (0, material_1.darken)(butterflyBlue[600], 0.1),
|
|
19
19
|
},
|
|
20
|
+
"&:focus-visible": {
|
|
21
|
+
outline: `1px solid ${butterflyBlue[600]}`,
|
|
22
|
+
outlineOffset: "2px",
|
|
23
|
+
backgroundColor: `${(0, material_1.darken)(butterflyBlue[600], 0.1)} !important`,
|
|
24
|
+
},
|
|
25
|
+
...(isFocused && {
|
|
26
|
+
outline: `2px solid ${butterflyBlue[600]}`,
|
|
27
|
+
outlineOffset: "2px",
|
|
28
|
+
backgroundColor: `${(0, material_1.darken)(butterflyBlue[600], 0.1)} !important`,
|
|
29
|
+
}),
|
|
20
30
|
"& .MuiChip-deleteIcon": {
|
|
21
31
|
color: iron[800],
|
|
22
32
|
"&:hover": {
|
|
23
33
|
color: iron[900],
|
|
24
|
-
backgroundColor:
|
|
34
|
+
backgroundColor: butterflyBlue[600],
|
|
25
35
|
},
|
|
26
36
|
},
|
|
27
37
|
}, onDelete: onDelete, onClick: onClick }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/DeleteDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"DeleteDialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/DeleteDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,sDAM1B,iBAAiB,4CAyCnB,CAAC"}
|
|
@@ -10,7 +10,15 @@ const material_1 = require("@mui/material");
|
|
|
10
10
|
const Button_1 = require("../Button");
|
|
11
11
|
const Layouts_1 = require("../Layouts");
|
|
12
12
|
const Dialog_1 = require("./Dialog");
|
|
13
|
+
const utils_1 = require("../utils");
|
|
13
14
|
const DeleteDialog = ({ title, open, isDeleteLoading, onDelete, onClose, }) => {
|
|
15
|
+
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
16
|
+
key: "escape",
|
|
17
|
+
withoutModifiers: true,
|
|
18
|
+
onTrigger: () => {
|
|
19
|
+
onClose();
|
|
20
|
+
},
|
|
21
|
+
});
|
|
14
22
|
return ((0, jsx_runtime_1.jsx)(Dialog_1.Dialog, { isDeleteDialog: true, maxWidth: "xs", isHideCloseIcon: true, isHideDividers: true, open: open, actions: (0, jsx_runtime_1.jsxs)(Layouts_1.ButtonContainer, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { disabled: isDeleteLoading, onClick: onClose, variant: "outlined", children: "Cancel" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: onDelete, color: "error", loading: isDeleteLoading, children: "Delete" })] }), children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", direction: "row", children: [(0, jsx_runtime_1.jsx)(InfoTwoTone_1.default, { color: "error", sx: { mt: "1px" } }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle1", fontWeight: 700, children: title })] }) }));
|
|
15
23
|
};
|
|
16
24
|
exports.DeleteDialog = DeleteDialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,WAAW,IAAI,cAAc,EAEnC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAiB,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,MAAM,MAAM,WAAW,GAAG,iBAAiB,CACzC,cAAc,GAAG;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,kGASpB,WAAW,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,WAAW,IAAI,cAAc,EAEnC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAiB,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,MAAM,MAAM,WAAW,GAAG,iBAAiB,CACzC,cAAc,GAAG;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CACF,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,kGASpB,WAAW,4CAqDb,CAAC"}
|
|
@@ -9,6 +9,9 @@ const HighlightOff_1 = __importDefault(require("@mui/icons-material/HighlightOff
|
|
|
9
9
|
const material_1 = require("@mui/material");
|
|
10
10
|
const Dialog = ({ title, isHideCloseIcon = false, isHideDividers = false, children, onClose, isDeleteDialog = false, actions, ...props }) => {
|
|
11
11
|
const handleKeyDown = (event) => {
|
|
12
|
+
if (event.defaultPrevented) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
12
15
|
if (event.key === "Escape" && onClose) {
|
|
13
16
|
onClose(event, "escapeKeyDown");
|
|
14
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePickerPopUp.d.ts","sourceRoot":"","sources":["../../src/FilterList/DateRangePickerPopUp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAYlD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,yBAAyB,GAAG,OAAO,CACtC,iBAAiB,CAAC,YAAY,CAAC,GAAG;IAChC,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CACF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,+EASlC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"DateRangePickerPopUp.d.ts","sourceRoot":"","sources":["../../src/FilterList/DateRangePickerPopUp.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAYlD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,yBAAyB,GAAG,OAAO,CACtC,iBAAiB,CAAC,YAAY,CAAC,GAAG;IAChC,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CACF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,+EASlC,yBAAyB,4CAuE3B,CAAC"}
|
|
@@ -19,6 +19,12 @@ const DateRangePickerPopUp = ({ open = false, anchorEl, onClose, children, onApp
|
|
|
19
19
|
};
|
|
20
20
|
return ((0, jsx_runtime_1.jsxs)(material_1.Popover, { open: open, anchorEl: anchorEl, anchorOrigin: { vertical: "bottom", horizontal: "left" }, onClose: () => {
|
|
21
21
|
handleClose();
|
|
22
|
+
}, onKeyDown: (e) => {
|
|
23
|
+
if (e.key === "Escape") {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
handleClose();
|
|
27
|
+
}
|
|
22
28
|
}, sx: { "& .MuiPaper-root": { minWidth: "300px" } }, children: [showDivider && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "flex-end", children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "5px", children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "h6", children: [title, " "] }), required && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", color: "error", children: "*" }))] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.ClearIcon, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
23
29
|
background: slate[600],
|
|
24
30
|
borderRadius: "5px",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,QAAQ,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,cAAc,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAiB7B;AAED,eAAO,MAAM,YAAY,GAAI,8EAO1B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"FilterListV2.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterListV2.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,OAAO,EAAE,QAAQ,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,cAAc,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAiB7B;AAED,eAAO,MAAM,YAAY,GAAI,8EAO1B,iBAAiB,4CA6vBnB,CAAC"}
|
|
@@ -61,6 +61,8 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
61
61
|
const [currentFilter, setCurrentFilter] = (0, react_1.useState)(null);
|
|
62
62
|
const filterListV2AnchorRef = (0, react_1.useRef)(null);
|
|
63
63
|
const [isPopupOpen, setIsPopupOpen] = (0, react_1.useState)(false);
|
|
64
|
+
const [focusedChipKey, setFocusedChipKey] = (0, react_1.useState)(null);
|
|
65
|
+
const chipRefs = (0, react_1.useRef)({});
|
|
64
66
|
const handleDateRange = (filter) => {
|
|
65
67
|
setCurrentFilter(filter);
|
|
66
68
|
setDatePickerPopup(true);
|
|
@@ -237,8 +239,42 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
237
239
|
}
|
|
238
240
|
return keyValue;
|
|
239
241
|
}
|
|
242
|
+
const handleChipClick = (key, e) => {
|
|
243
|
+
if (key === "company_id" &&
|
|
244
|
+
filterListItems?.some(({ required }) => required)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
setOpenFilterPopup(true);
|
|
248
|
+
filterPopupAnchorElm.current = e.currentTarget;
|
|
249
|
+
const item = getFilterItem(key);
|
|
250
|
+
if (item) {
|
|
251
|
+
setCurrentFilter(item);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const handleChipKeyDown = (key, e) => {
|
|
255
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
256
|
+
e.preventDefault();
|
|
257
|
+
const chipElement = chipRefs.current[key];
|
|
258
|
+
if (chipElement) {
|
|
259
|
+
handleChipClick(key, { currentTarget: chipElement });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
const chipKeys = Object.keys(filterListData || {}).filter((k) => filterListData?.[k]);
|
|
265
|
+
const currentIndex = chipKeys.indexOf(key);
|
|
266
|
+
const nextIndex = e.key === "ArrowRight"
|
|
267
|
+
? (currentIndex + 1) % chipKeys.length
|
|
268
|
+
: (currentIndex - 1 + chipKeys.length) % chipKeys.length;
|
|
269
|
+
const nextKey = chipKeys[nextIndex];
|
|
270
|
+
if (nextKey && chipRefs.current[nextKey]) {
|
|
271
|
+
chipRefs.current[nextKey]?.focus();
|
|
272
|
+
setFocusedChipKey(nextKey);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
};
|
|
240
276
|
const renderChips = (data) => {
|
|
241
|
-
return Object.entries(data).map(([key, value]) => {
|
|
277
|
+
return Object.entries(data).map(([key, value], index) => {
|
|
242
278
|
if (typeof value !== "boolean" && !value) {
|
|
243
279
|
return;
|
|
244
280
|
}
|
|
@@ -250,22 +286,26 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
250
286
|
if (typeof value !== "boolean" && !formattedValue) {
|
|
251
287
|
return;
|
|
252
288
|
}
|
|
253
|
-
|
|
289
|
+
const isFocused = focusedChipKey === key;
|
|
290
|
+
return ((0, jsx_runtime_1.jsx)(FilterPill_1.FilterPill, { ref: (el) => {
|
|
291
|
+
chipRefs.current[key] = el;
|
|
292
|
+
if (index === 0 && !focusedChipKey) {
|
|
293
|
+
filterPopupAnchorElm.current = el;
|
|
294
|
+
}
|
|
295
|
+
}, label: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip
|
|
254
296
|
// eslint-disable-next-line sonarjs/no-base-to-string
|
|
255
297
|
, {
|
|
256
298
|
// eslint-disable-next-line sonarjs/no-base-to-string
|
|
257
299
|
toolTipLabel: `${formattedValue}`, children: `${item?.label}: ${formattedValue}` }), onDelete: () => handleDelete(key), onClick: (e) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
} }, key));
|
|
300
|
+
handleChipClick(key, e);
|
|
301
|
+
}, isFocused: isFocused, onKeyDown: (e) => handleChipKeyDown(key, e), onFocus: () => setFocusedChipKey(key), onBlur: () => {
|
|
302
|
+
// Only clear focus if focus is moving to another chip
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
if (!Object.values(chipRefs.current).some((ref) => ref === document.activeElement)) {
|
|
305
|
+
setFocusedChipKey(null);
|
|
306
|
+
}
|
|
307
|
+
}, 0);
|
|
308
|
+
}, tabIndex: 0 }, key));
|
|
269
309
|
});
|
|
270
310
|
};
|
|
271
311
|
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
@@ -289,6 +329,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
|
|
|
289
329
|
}, children: filterListData &&
|
|
290
330
|
Object.values(filterListData).some((value) => value) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", sx: {
|
|
291
331
|
minWidth: "50px",
|
|
332
|
+
marginRight: "10px",
|
|
292
333
|
}, children: "Filters:" }), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", gap: "5px", alignItems: "center", sx: { flexWrap: "wrap", maxWidth: "100%" }, children: renderChips(filterListData) })] })) })), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "flex-start", children: [filterListData &&
|
|
293
334
|
Object.values(filterListData).some((value) => value) && ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: () => handlerReset(), variant: "text", sx: { minWidth: { xs: "60px", sm: "100px" } }, children: !isMobile ? "Clear Filter" : "Clear" })), !isDisabled && ((0, jsx_runtime_1.jsx)(Actions_1.FilterIconAction, { isFiltered: !(0, isEmpty_1.default)(filterListData), onClick: handleClick, ref: filterListV2AnchorRef }))] })] }), (0, jsx_runtime_1.jsx)("form", { onSubmit: (e) => {
|
|
294
335
|
e.preventDefault();
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ label, styling }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ label, styling }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
|
@@ -4,13 +4,13 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = () => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
|
-
} })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
11
|
+
} })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
12
12
|
transform: "scale(1)",
|
|
13
|
-
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
13
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", sx: {
|
|
14
14
|
transform: "scale(1)",
|
|
15
15
|
} })] })] }));
|
|
16
16
|
};
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ label, styling }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", width: "100%", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = () => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "136px", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
|
@@ -4,8 +4,8 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ rows, label }) => {
|
|
7
|
-
const height = rows === undefined ?
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
const height = rows === undefined ? 35.69 : rows * 26.5;
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
9
9
|
transform: "scale(1)",
|
|
10
10
|
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: `${height}px`, sx: {
|
|
11
11
|
transform: "scale(1)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../src/FormFields/RadioGroupField/Skeleton.tsx"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,+
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../src/FormFields/RadioGroupField/Skeleton.tsx"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,+CA+BpB,CAAC"}
|
|
@@ -4,6 +4,6 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = () => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "18.69px", width: "70px", sx: { transform: "scale(1)" } }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "50px", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", height: "25px", width: "25px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "21px", width: "45px", sx: { transform: "scale(1)" } })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", height: "25px", width: "25px" }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "21px", width: "45px", sx: { transform: "scale(1)" } })] })] })] }));
|
|
8
8
|
};
|
|
9
9
|
exports.Skeleton = Skeleton;
|
|
@@ -5,9 +5,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const STAR_KEYS = ["star-1", "star-2", "star-3", "star-4", "star-5"];
|
|
7
7
|
const RatingSkeleton = ({ label }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
9
9
|
transform: "scale(1)",
|
|
10
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", gap: "5px", children: STAR_KEYS.map((key) => ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width:
|
|
10
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", gap: "5px", children: STAR_KEYS.map((key) => ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 25, height: 25, sx: {
|
|
11
11
|
transform: "scale(1)",
|
|
12
12
|
} }, key))) })] }));
|
|
13
13
|
};
|
|
@@ -109,9 +109,9 @@ function Select({ control, defaultValue, name, required = false, label, multiple
|
|
|
109
109
|
return groups;
|
|
110
110
|
}, [options]);
|
|
111
111
|
if (loading) {
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
113
113
|
transform: "scale(1)",
|
|
114
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
114
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", sx: {
|
|
115
115
|
transform: "scale(1)",
|
|
116
116
|
} })] }));
|
|
117
117
|
}
|
|
@@ -4,8 +4,8 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ rows, label, styling }) => {
|
|
7
|
-
const height = rows === undefined ?
|
|
8
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
const height = rows === undefined ? 35.69 : rows * 26.5;
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
9
9
|
transform: "scale(1)",
|
|
10
10
|
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: `${height}px`, sx: {
|
|
11
11
|
transform: "scale(1)",
|
|
@@ -24,5 +24,5 @@ export type TextFieldProps<P extends FieldValues> = UseControllerProps<P> & Omit
|
|
|
24
24
|
};
|
|
25
25
|
customOnChange?: (value: string | null | number) => void;
|
|
26
26
|
};
|
|
27
|
-
export declare function TextField<P extends FieldValues>({ control, name, defaultValue, label, rules, type, required, disabled, loading, placeholder, isCapitalize, isTrimStartDisabled, rows, characterType, letterCase, setError, containerProps, styling, infoMessage, regexExpression, customOnChange, ...inputFieldProps }: TextFieldProps<P>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function TextField<P extends FieldValues>({ control, name, defaultValue, label, rules, type, required, disabled, loading, placeholder, isCapitalize, isTrimStartDisabled, rows, characterType, letterCase, setError, containerProps, styling, infoMessage, regexExpression, customOnChange, multiline, ...inputFieldProps }: TextFieldProps<P>): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,IAAI,iBAAiB,EACxC,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAYzB,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,eAAe,GACf,uBAAuB,GACvB,gBAAgB,GAChB,oBAAoB,GACpB,QAAQ,CAAC;AAEb,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;AAY7D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GACvE,IAAI,CAAC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,CACT,IAAI,EAAE,MAAM,CAAC,EACb,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KACnD,IAAI,CAAC;IACV,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE;QAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEJ,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,EAC/C,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAU,EACV,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAe,EACf,WAAgB,EAChB,YAAoB,EACpB,mBAA2B,EAC3B,IAAI,EACJ,aAAuC,EACvC,UAAoB,EACpB,QAAQ,EACR,cAAc,EACd,OAAkB,EAClB,WAAW,EACX,eAGC,EACD,cAAc,EACd,GAAG,eAAe,EACnB,EAAE,cAAc,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,IAAI,iBAAiB,EACxC,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AAYzB,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,eAAe,GACf,uBAAuB,GACvB,gBAAgB,GAChB,oBAAoB,GACpB,QAAQ,CAAC;AAEb,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;AAY7D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GACvE,IAAI,CAAC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,CACT,IAAI,EAAE,MAAM,CAAC,EACb,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KACnD,IAAI,CAAC;IACV,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE;QAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEJ,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,EAC/C,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAU,EACV,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAe,EACf,WAAgB,EAChB,YAAoB,EACpB,mBAA2B,EAC3B,IAAI,EACJ,aAAuC,EACvC,UAAoB,EACpB,QAAQ,EACR,cAAc,EACd,OAAkB,EAClB,WAAW,EACX,eAGC,EACD,cAAc,EACd,SAAS,EACT,GAAG,eAAe,EACnB,EAAE,cAAc,CAAC,CAAC,CAAC,2CAoKnB"}
|
|
@@ -20,7 +20,7 @@ const characterTypeMessages = {
|
|
|
20
20
|
function TextField({ control, name, defaultValue, label = "", rules, type, required, disabled, loading = false, placeholder = "", isCapitalize = false, isTrimStartDisabled = false, rows, characterType = "string-number-special", letterCase = "mixed", setError, containerProps, styling = "custom", infoMessage, regexExpression = {
|
|
21
21
|
message: null,
|
|
22
22
|
regex: /^[\s\S]*$/,
|
|
23
|
-
}, customOnChange, ...inputFieldProps }) {
|
|
23
|
+
}, customOnChange, multiline, ...inputFieldProps }) {
|
|
24
24
|
const { field: { value, onChange, ...restField }, fieldState: { error }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
|
|
25
25
|
const { inputRef, maintainFocus } = (0, hooks_1.useFormFieldFocus)();
|
|
26
26
|
const handleKeyDown = (event) => {
|
|
@@ -68,7 +68,7 @@ function TextField({ control, name, defaultValue, label = "", rules, type, requi
|
|
|
68
68
|
? characterTypeMessages[characterType]
|
|
69
69
|
: message;
|
|
70
70
|
if (loading) {
|
|
71
|
-
return (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { label: label, rows: rows, styling: styling });
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { label: label, rows: multiline && !rows ? 2 : rows, styling: styling }));
|
|
72
72
|
}
|
|
73
73
|
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { ...containerProps, gap: "5px", children: [label && styling === "custom" && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { required: required, disabled: disabled, children: label }), infoMessage && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { toolTipLabel: infoMessage, children: (0, jsx_runtime_1.jsx)(icons_material_1.InfoOutlined, { sx: {
|
|
74
74
|
fontSize: 13,
|
|
@@ -108,5 +108,5 @@ function TextField({ control, name, defaultValue, label = "", rules, type, requi
|
|
|
108
108
|
}
|
|
109
109
|
maintainFocus();
|
|
110
110
|
});
|
|
111
|
-
}, value: typeof value === "string" ? value.trimStart() : (value ?? ""), ...restField, ...inputFieldProps })] }));
|
|
111
|
+
}, value: typeof value === "string" ? value.trimStart() : (value ?? ""), multiline: multiline, ...restField, ...inputFieldProps })] }));
|
|
112
112
|
}
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ label, styling }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", width: "100%", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
|
@@ -4,9 +4,9 @@ exports.Skeleton = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const Skeleton = ({ label, styling }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", flex: 1, children: [label && styling === "custom" && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { width: 120, height: "18.69px", sx: {
|
|
8
8
|
transform: "scale(1)",
|
|
9
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "
|
|
9
|
+
} })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { height: "35.69px", width: "100%", sx: {
|
|
10
10
|
transform: "scale(1)",
|
|
11
11
|
} })] }));
|
|
12
12
|
};
|
package/packages/shared-components/dist/SmartGrid/Components/FacetedFilter/FacetedFilter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetedFilter.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/FacetedFilter/FacetedFilter.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"FacetedFilter.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/FacetedFilter/FacetedFilter.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAWpD,KAAK,kBAAkB,CAAC,CAAC,IAAI;IAC3B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,EAAG,8BAG/B,kBAAkB,CAAC,CAAC,CAAC,4CAiVvB,CAAC"}
|
|
@@ -7,6 +7,7 @@ const material_1 = require("@mui/material");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const DebouncedInput_1 = require("../SearchFilterRow/DebouncedInput");
|
|
9
9
|
const useGetDynamicOptionData_1 = require("./hooks/useGetDynamicOptionData");
|
|
10
|
+
const ActionButtons_1 = require("../../../ActionButtons");
|
|
10
11
|
const Tooltip_1 = require("../../../Tooltip");
|
|
11
12
|
const VirtualCheckboxList_1 = require("./VirtualCheckboxList");
|
|
12
13
|
const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
@@ -132,6 +133,11 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
132
133
|
}
|
|
133
134
|
}, [resetAllFilters]);
|
|
134
135
|
const hasActiveFilter = activeFilterCount > 0;
|
|
136
|
+
(0, react_1.useEffect)(() => {
|
|
137
|
+
if (isOpen) {
|
|
138
|
+
popoverRef.current?.focus();
|
|
139
|
+
}
|
|
140
|
+
}, [isOpen]);
|
|
135
141
|
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative" }, children: [(0, jsx_runtime_1.jsxs)(material_1.IconButton, { ref: buttonRef, onClick: () => setIsOpen(!isOpen), sx: {
|
|
136
142
|
padding: "2px",
|
|
137
143
|
position: "relative",
|
|
@@ -154,7 +160,12 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
154
160
|
right: 4,
|
|
155
161
|
top: 4,
|
|
156
162
|
width: "7px",
|
|
157
|
-
} }))] }), isOpen && ((0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClickAway, children: (0, jsx_runtime_1.jsxs)("div", { ref: popoverRef,
|
|
163
|
+
} }))] }), isOpen && ((0, jsx_runtime_1.jsx)(material_1.ClickAwayListener, { onClickAway: handleClickAway, children: (0, jsx_runtime_1.jsxs)("div", { ref: popoverRef, tabIndex: -1, onKeyDown: (e) => {
|
|
164
|
+
if (e.key === "Escape") {
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
handleClickAway();
|
|
167
|
+
}
|
|
168
|
+
}, style: {
|
|
158
169
|
backgroundColor: iron[600],
|
|
159
170
|
borderRadius: "6px",
|
|
160
171
|
boxShadow: `0 0 20px ${mirage[50]}`,
|
|
@@ -186,6 +197,10 @@ const FacetedFilter = ({ header, resetAllFilters, }) => {
|
|
|
186
197
|
display: "flex",
|
|
187
198
|
justifyContent: "space-between",
|
|
188
199
|
paddingTop: "8px",
|
|
189
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", size: "small", sx: { fontSize: "12px", height: "22px", minWidth: "40px" }, onClick: handleReset, children: "Reset" }), (0, jsx_runtime_1.jsx)(
|
|
200
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "text", size: "small", sx: { fontSize: "12px", height: "22px", minWidth: "40px" }, onClick: handleReset, children: "Reset" }), (0, jsx_runtime_1.jsx)(ActionButtons_1.FormActionButton, { actionType: "save", label: "Apply", onClick: handleApply, withoutModifiers: true, shortcutKey: "Enter", variant: "contained", sx: {
|
|
201
|
+
height: "22px",
|
|
202
|
+
fontSize: "12px",
|
|
203
|
+
minWidth: "40px",
|
|
204
|
+
} })] })] }) }))] }));
|
|
190
205
|
};
|
|
191
206
|
exports.FacetedFilter = FacetedFilter;
|