@elliemae/ds-data-table 3.8.0-rc.3 → 3.8.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/dist/cjs/exported-related/{FilterPopover.js → FilterPopover/index.js} +27 -75
- package/dist/cjs/exported-related/FilterPopover/index.js.map +7 -0
- package/dist/cjs/exported-related/FilterPopover/types.js +24 -0
- package/dist/cjs/exported-related/FilterPopover/types.js.map +7 -0
- package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js +76 -0
- package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js.map +7 -0
- package/dist/cjs/exported-related/FilterPopover/useGetFilterVisibility.js +48 -0
- package/dist/cjs/exported-related/FilterPopover/useGetFilterVisibility.js.map +7 -0
- package/dist/cjs/types/props.js.map +1 -1
- package/dist/esm/exported-related/FilterPopover/index.js +90 -0
- package/dist/esm/exported-related/FilterPopover/index.js.map +7 -0
- package/dist/esm/exported-related/FilterPopover/types.js +2 -0
- package/dist/esm/exported-related/FilterPopover/types.js.map +7 -0
- package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js +50 -0
- package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js.map +7 -0
- package/dist/esm/exported-related/FilterPopover/useGetFilterVisibility.js +22 -0
- package/dist/esm/exported-related/FilterPopover/useGetFilterVisibility.js.map +7 -0
- package/dist/esm/types/props.js.map +1 -1
- package/package.json +18 -18
- package/dist/cjs/exported-related/FilterPopover.js.map +0 -7
- package/dist/esm/exported-related/FilterPopover.js +0 -138
- package/dist/esm/exported-related/FilterPopover.js.map +0 -7
|
@@ -33,16 +33,15 @@ var import_react = require("react");
|
|
|
33
33
|
var import_ds_button = require("@elliemae/ds-button");
|
|
34
34
|
var import_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
35
35
|
var import_ds_system = require("@elliemae/ds-system");
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
37
|
+
var import_DataTableContext = __toESM(require("../../DataTableContext"));
|
|
38
|
+
var import_constants = require("../../configs/constants");
|
|
39
|
+
var import_useGetFilterVisibility = require("./useGetFilterVisibility");
|
|
40
|
+
var import_useGetFilterHandlers = require("./useGetFilterHandlers");
|
|
38
41
|
const FilterButton = import_ds_system.styled.span`
|
|
39
42
|
display: inline-grid;
|
|
40
43
|
${(props) => props.hide ? "opacity: 0; display: none; width: 0;" : ""}
|
|
41
44
|
`;
|
|
42
|
-
const Button = (0, import_ds_system.styled)(import_ds_button.DSButton)`
|
|
43
|
-
position: relative;
|
|
44
|
-
justify-self: flex-end;
|
|
45
|
-
`;
|
|
46
45
|
const PopperContent = import_ds_system.styled.div`
|
|
47
46
|
background-color: #fff;
|
|
48
47
|
`;
|
|
@@ -54,86 +53,39 @@ const ButtonTrap = ({ cb }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span
|
|
|
54
53
|
cb();
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
|
-
const FilterPopover = ({
|
|
58
|
-
column,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
reduxHeader,
|
|
65
|
-
innerRef,
|
|
66
|
-
ariaLabel,
|
|
67
|
-
customStyles
|
|
68
|
-
}) => {
|
|
69
|
-
const { hideFilterButton, hideFilterMenu } = reduxHeader || {
|
|
70
|
-
hideFilterButton: true,
|
|
71
|
-
hideFilterMenu: true
|
|
72
|
-
};
|
|
73
|
-
const { patchHeaderFilterButtonAndMenu, patchHeader } = (0, import_react.useContext)(import_DataTableContext.default);
|
|
74
|
-
const isIconVisible = !hideFilterButton || !hideFilterMenu;
|
|
75
|
-
const isMenuOpen = !hideFilterMenu;
|
|
76
|
-
const handleClickOutsideMenu = (e) => {
|
|
77
|
-
onClickOutsideMenu(columnId, e);
|
|
78
|
-
if (isMenuOpen)
|
|
79
|
-
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
80
|
-
};
|
|
81
|
-
(0, import_react.useEffect)(() => {
|
|
82
|
-
const closeMenu = () => {
|
|
83
|
-
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
84
|
-
};
|
|
85
|
-
window.addEventListener("blur", closeMenu);
|
|
86
|
-
return () => {
|
|
87
|
-
window.removeEventListener("blur", closeMenu);
|
|
88
|
-
};
|
|
89
|
-
}, [columnId, patchHeaderFilterButtonAndMenu]);
|
|
90
|
-
const handleTriggerClick = (0, import_react.useCallback)(
|
|
91
|
-
(e) => {
|
|
92
|
-
onTriggerClick(columnId, e);
|
|
93
|
-
patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });
|
|
94
|
-
e.stopPropagation();
|
|
95
|
-
},
|
|
96
|
-
[columnId, isMenuOpen, onTriggerClick, patchHeader]
|
|
97
|
-
);
|
|
98
|
-
const [referenceElement, setReferenceElement] = (0, import_react.useState)(null);
|
|
56
|
+
const FilterPopover = (props) => {
|
|
57
|
+
const { column, customStyles, reduxHeader, menuContent, columnId, ariaLabel, triggerIcon, innerRef } = props;
|
|
58
|
+
const { patchHeader } = (0, import_react.useContext)(import_DataTableContext.default);
|
|
59
|
+
const { isIconVisible, isMenuOpen } = (0, import_useGetFilterVisibility.useGetFilterVisibility)(reduxHeader);
|
|
60
|
+
const [buttonReference, setButtonReference] = (0, import_react.useState)(null);
|
|
61
|
+
const [isButtonFocused, setIsButtonFocused] = (0, import_react.useState)(false);
|
|
62
|
+
const { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur } = (0, import_useGetFilterHandlers.useGetFilterHandlers)(props, isMenuOpen, buttonReference, setIsButtonFocused);
|
|
99
63
|
const buttonTrapCallback = (0, import_react.useCallback)(() => {
|
|
100
64
|
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });
|
|
101
|
-
|
|
102
|
-
}, [columnId, patchHeader,
|
|
65
|
+
buttonReference?.focus();
|
|
66
|
+
}, [columnId, patchHeader, buttonReference]);
|
|
103
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
104
68
|
onClick: (e) => e.stopPropagation(),
|
|
105
|
-
onKeyDown:
|
|
106
|
-
e.stopPropagation();
|
|
107
|
-
if (e.code === "Escape") {
|
|
108
|
-
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false, withTabStops: true });
|
|
109
|
-
referenceElement.focus();
|
|
110
|
-
}
|
|
111
|
-
if (["ArrowUp", "ArrowDown"].includes(e.code)) {
|
|
112
|
-
e.preventDefault();
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
style: { display: "flex" },
|
|
69
|
+
onKeyDown: handleMenuOnKeyDown,
|
|
116
70
|
children: [
|
|
117
71
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilterButton, {
|
|
118
72
|
hide: !isIconVisible,
|
|
119
73
|
"data-testid": import_constants.DATA_TESTID.DATA_TABLE_FILTER_BUTTON,
|
|
120
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_button.DSButtonV2, {
|
|
75
|
+
buttonType: "icon",
|
|
76
|
+
size: "s",
|
|
121
77
|
onClick: handleTriggerClick,
|
|
122
|
-
|
|
78
|
+
onFocus: handleTriggerOnFocus,
|
|
79
|
+
onBlur: handleTriggerOnBlur,
|
|
80
|
+
innerRef: (0, import_ds_utilities.mergeRefs)(isIconVisible && setButtonReference, innerRef),
|
|
81
|
+
tabIndex: reduxHeader?.withTabStops ? 0 : -1,
|
|
123
82
|
"aria-label": ariaLabel,
|
|
124
|
-
"aria-hidden":
|
|
125
|
-
|
|
126
|
-
leftIcon: triggerIcon,
|
|
127
|
-
innerRef: (_ref) => {
|
|
128
|
-
if (isIconVisible)
|
|
129
|
-
setReferenceElement(_ref);
|
|
130
|
-
innerRef.current = _ref;
|
|
131
|
-
},
|
|
132
|
-
tabIndex: reduxHeader?.withTabStops ? 0 : -1
|
|
83
|
+
"aria-hidden": !isButtonFocused,
|
|
84
|
+
children: triggerIcon
|
|
133
85
|
})
|
|
134
86
|
}),
|
|
135
|
-
|
|
136
|
-
referenceElement,
|
|
87
|
+
buttonReference && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_popperjs.DSPopperJS, {
|
|
88
|
+
referenceElement: buttonReference,
|
|
137
89
|
showPopover: isMenuOpen,
|
|
138
90
|
closeContextMenu: handleClickOutsideMenu,
|
|
139
91
|
"data-testid": import_constants.DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT,
|
|
@@ -161,4 +113,4 @@ const FilterPopover = ({
|
|
|
161
113
|
]
|
|
162
114
|
});
|
|
163
115
|
};
|
|
164
|
-
//# sourceMappingURL=
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/FilterPopover/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useCallback, useContext, useState } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { styled } from '@elliemae/ds-system';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport DataTableContext from '../../DataTableContext';\nimport { DATA_TESTID } from '../../configs/constants';\nimport { useGetFilterVisibility } from './useGetFilterVisibility';\nimport { FilterPopoverProps } from './types';\nimport { useGetFilterHandlers } from './useGetFilterHandlers';\n\nconst FilterButton = styled.span<{ hide: boolean }>`\n display: inline-grid;\n ${(props) => (props.hide ? 'opacity: 0; display: none; width: 0;' : '')}\n`;\n\nconst PopperContent = styled.div`\n background-color: #fff;\n`;\n\nconst ButtonTrap = ({ cb }: { cb: () => void }) => (\n <span\n aria-hidden=\"true\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n onFocus={(e: React.FocusEvent) => {\n e.stopPropagation();\n cb();\n }}\n />\n);\n\nexport const FilterPopover: React.ComponentType<FilterPopoverProps> = (props: FilterPopoverProps) => {\n const { column, customStyles, reduxHeader, menuContent, columnId, ariaLabel, triggerIcon, innerRef } = props;\n\n const { patchHeader } = useContext(DataTableContext);\n\n const { isIconVisible, isMenuOpen } = useGetFilterVisibility(reduxHeader);\n\n const [buttonReference, setButtonReference] = useState<HTMLButtonElement | null>(null);\n\n const [isButtonFocused, setIsButtonFocused] = useState(false);\n\n const { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur } =\n useGetFilterHandlers(props, isMenuOpen, buttonReference, setIsButtonFocused);\n\n const buttonTrapCallback = useCallback(() => {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n buttonReference?.focus();\n }, [columnId, patchHeader, buttonReference]);\n\n return (\n <div\n // This is here to prevent propagation, and not trigger the sort functionality\n onClick={(e) => e.stopPropagation()}\n onKeyDown={handleMenuOnKeyDown}\n >\n <FilterButton hide={!isIconVisible} data-testid={DATA_TESTID.DATA_TABLE_FILTER_BUTTON}>\n <DSButtonV2\n buttonType=\"icon\"\n size=\"s\"\n onClick={handleTriggerClick}\n onFocus={handleTriggerOnFocus}\n onBlur={handleTriggerOnBlur}\n innerRef={mergeRefs(isIconVisible && setButtonReference, innerRef)}\n tabIndex={reduxHeader?.withTabStops ? 0 : -1}\n aria-label={ariaLabel}\n aria-hidden={!isButtonFocused}\n >\n {triggerIcon}\n </DSButtonV2>\n </FilterButton>\n {buttonReference && (\n <DSPopperJS\n referenceElement={buttonReference}\n showPopover={isMenuOpen}\n closeContextMenu={handleClickOutsideMenu}\n data-testid={DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT}\n startPlacementPreference=\"bottom-end\"\n customOffset={[5, 4]}\n withoutArrow\n withoutAnimation\n extraPopperStyles={{\n ...customStyles,\n minWidth: column.ref?.current?.offsetWidth ?? '0px',\n }}\n placementOrderPreference={['bottom-end']}\n >\n <PopperContent>\n <ButtonTrap cb={buttonTrapCallback} />\n {menuContent}\n <ButtonTrap cb={buttonTrapCallback} />\n </PopperContent>\n </DSPopperJS>\n )}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,mBAAyD;AACzD,uBAA2B;AAC3B,yBAA2B;AAC3B,uBAAuB;AACvB,0BAA0B;AAC1B,8BAA6B;AAC7B,uBAA4B;AAC5B,oCAAuC;AAEvC,kCAAqC;AAErC,MAAM,eAAe,wBAAO;AAAA;AAAA,IAExB,CAAC,UAAW,MAAM,OAAO,yCAAyC;AAAA;AAGtE,MAAM,gBAAgB,wBAAO;AAAA;AAAA;AAI7B,MAAM,aAAa,CAAC,EAAE,GAAG,MACvB,4CAAC;AAAA,EACC,eAAY;AAAA,EAEZ,UAAU;AAAA,EACV,SAAS,CAAC,MAAwB;AAChC,MAAE,gBAAgB;AAClB,OAAG;AAAA,EACL;AAAA,CACF;AAGK,MAAM,gBAAyD,CAAC,UAA8B;AACnG,QAAM,EAAE,QAAQ,cAAc,aAAa,aAAa,UAAU,WAAW,aAAa,SAAS,IAAI;AAEvG,QAAM,EAAE,YAAY,QAAI,yBAAW,wBAAAA,OAAgB;AAEnD,QAAM,EAAE,eAAe,WAAW,QAAI,sDAAuB,WAAW;AAExE,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAmC,IAAI;AAErF,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAS,KAAK;AAE5D,QAAM,EAAE,oBAAoB,wBAAwB,qBAAqB,sBAAsB,oBAAoB,QACjH,kDAAqB,OAAO,YAAY,iBAAiB,kBAAkB;AAE7E,QAAM,yBAAqB,0BAAY,MAAM;AAC3C,gBAAY,UAAU,EAAE,gBAAgB,MAAM,kBAAkB,MAAM,CAAC;AACvE,qBAAiB,MAAM;AAAA,EACzB,GAAG,CAAC,UAAU,aAAa,eAAe,CAAC;AAE3C,SACE,6CAAC;AAAA,IAEC,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,IAClC,WAAW;AAAA,IAEX;AAAA,kDAAC;AAAA,QAAa,MAAM,CAAC;AAAA,QAAe,eAAa,6BAAY;AAAA,QAC3D,sDAAC;AAAA,UACC,YAAW;AAAA,UACX,MAAK;AAAA,UACL,SAAS;AAAA,UACT,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,cAAU,+BAAU,iBAAiB,oBAAoB,QAAQ;AAAA,UACjE,UAAU,aAAa,eAAe,IAAI;AAAA,UAC1C,cAAY;AAAA,UACZ,eAAa,CAAC;AAAA,UAEb;AAAA,SACH;AAAA,OACF;AAAA,MACC,mBACC,4CAAC;AAAA,QACC,kBAAkB;AAAA,QAClB,aAAa;AAAA,QACb,kBAAkB;AAAA,QAClB,eAAa,6BAAY;AAAA,QACzB,0BAAyB;AAAA,QACzB,cAAc,CAAC,GAAG,CAAC;AAAA,QACnB,cAAY;AAAA,QACZ,kBAAgB;AAAA,QAChB,mBAAmB;AAAA,UACjB,GAAG;AAAA,UACH,UAAU,OAAO,KAAK,SAAS,eAAe;AAAA,QAChD;AAAA,QACA,0BAA0B,CAAC,YAAY;AAAA,QAEvC,uDAAC;AAAA,UACC;AAAA,wDAAC;AAAA,cAAW,IAAI;AAAA,aAAoB;AAAA,YACnC;AAAA,YACD,4CAAC;AAAA,cAAW,IAAI;AAAA,aAAoB;AAAA;AAAA,SACtC;AAAA,OACF;AAAA;AAAA,GAEJ;AAEJ;",
|
|
6
|
+
"names": ["DataTableContext"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var types_exports = {};
|
|
22
|
+
module.exports = __toCommonJS(types_exports);
|
|
23
|
+
var React = __toESM(require("react"));
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/FilterPopover/types.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { InternalTypescriptColumn, ReduxHeader } from '../../types/props';\n\nexport interface FilterPopoverProps {\n column: InternalTypescriptColumn;\n columnId: string;\n triggerIcon: JSX.Element;\n menuContent: JSX.Element;\n onTriggerClick?: (id: string, e: React.MouseEvent) => void;\n onClickOutsideMenu?: (id: string) => void;\n reduxHeader: ReduxHeader;\n innerRef: React.MutableRefObject<HTMLButtonElement | null>;\n ariaLabel: string;\n customStyles?: React.CSSProperties;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useGetFilterHandlers_exports = {};
|
|
26
|
+
__export(useGetFilterHandlers_exports, {
|
|
27
|
+
useGetFilterHandlers: () => useGetFilterHandlers
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useGetFilterHandlers_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_DataTableContext = __toESM(require("../../DataTableContext"));
|
|
33
|
+
const emptyFunc = () => null;
|
|
34
|
+
const useGetFilterHandlers = (props, isMenuOpen, buttonReference, setIsButtonFocused) => {
|
|
35
|
+
const { columnId, onTriggerClick = emptyFunc, onClickOutsideMenu = emptyFunc } = props;
|
|
36
|
+
const { patchHeaderFilterButtonAndMenu, patchHeader } = (0, import_react.useContext)(import_DataTableContext.default);
|
|
37
|
+
(0, import_react.useEffect)(() => {
|
|
38
|
+
const closeMenu = () => {
|
|
39
|
+
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener("blur", closeMenu);
|
|
42
|
+
return () => {
|
|
43
|
+
window.removeEventListener("blur", closeMenu);
|
|
44
|
+
};
|
|
45
|
+
}, [columnId, patchHeaderFilterButtonAndMenu]);
|
|
46
|
+
const handleTriggerClick = (0, import_react.useCallback)(
|
|
47
|
+
(e) => {
|
|
48
|
+
onTriggerClick(columnId, e);
|
|
49
|
+
patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
},
|
|
52
|
+
[columnId, isMenuOpen, onTriggerClick, patchHeader]
|
|
53
|
+
);
|
|
54
|
+
const handleTriggerOnFocus = (0, import_react.useCallback)(() => setIsButtonFocused(true), [setIsButtonFocused]);
|
|
55
|
+
const handleTriggerOnBlur = (0, import_react.useCallback)(() => setIsButtonFocused(false), [setIsButtonFocused]);
|
|
56
|
+
const handleClickOutsideMenu = () => {
|
|
57
|
+
onClickOutsideMenu(columnId);
|
|
58
|
+
if (isMenuOpen)
|
|
59
|
+
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
60
|
+
};
|
|
61
|
+
const handleMenuOnKeyDown = (0, import_react.useCallback)(
|
|
62
|
+
(e) => {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
if (e.code === "Escape") {
|
|
65
|
+
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });
|
|
66
|
+
buttonReference?.focus();
|
|
67
|
+
}
|
|
68
|
+
if (["ArrowUp", "ArrowDown"].includes(e.code)) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
[buttonReference, columnId, patchHeader]
|
|
73
|
+
);
|
|
74
|
+
return { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur };
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=useGetFilterHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/FilterPopover/useGetFilterHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-params */\nimport React, { useCallback, useContext, useEffect } from 'react';\nimport DataTableContext from '../../DataTableContext';\nimport { FilterPopoverProps } from './types';\n\nconst emptyFunc = () => null;\n\nexport const useGetFilterHandlers = (\n props: FilterPopoverProps,\n isMenuOpen: boolean,\n buttonReference: HTMLButtonElement | null,\n setIsButtonFocused: React.Dispatch<React.SetStateAction<boolean>>,\n) => {\n const { columnId, onTriggerClick = emptyFunc, onClickOutsideMenu = emptyFunc } = props;\n\n const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);\n\n useEffect(() => {\n const closeMenu = () => {\n patchHeaderFilterButtonAndMenu(columnId, true);\n };\n window.addEventListener('blur', closeMenu);\n\n return () => {\n window.removeEventListener('blur', closeMenu);\n };\n }, [columnId, patchHeaderFilterButtonAndMenu]);\n\n const handleTriggerClick = useCallback(\n (e: React.MouseEvent) => {\n onTriggerClick(columnId, e);\n patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });\n e.stopPropagation();\n },\n [columnId, isMenuOpen, onTriggerClick, patchHeader],\n );\n\n const handleTriggerOnFocus = useCallback(() => setIsButtonFocused(true), [setIsButtonFocused]);\n const handleTriggerOnBlur = useCallback(() => setIsButtonFocused(false), [setIsButtonFocused]);\n\n const handleClickOutsideMenu = () => {\n onClickOutsideMenu(columnId);\n if (isMenuOpen) patchHeaderFilterButtonAndMenu(columnId, true);\n };\n\n const handleMenuOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n e.stopPropagation();\n if (e.code === 'Escape') {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n buttonReference?.focus();\n }\n // Stop propagation for some reason is not enough to prevent scrolling of the datatable\n // so we just prevent default behaviour in this case\n if (['ArrowUp', 'ArrowDown'].includes(e.code)) {\n e.preventDefault();\n }\n },\n [buttonReference, columnId, patchHeader],\n );\n\n return { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA0D;AAC1D,8BAA6B;AAG7B,MAAM,YAAY,MAAM;AAEjB,MAAM,uBAAuB,CAClC,OACA,YACA,iBACA,uBACG;AACH,QAAM,EAAE,UAAU,iBAAiB,WAAW,qBAAqB,UAAU,IAAI;AAEjF,QAAM,EAAE,gCAAgC,YAAY,QAAI,yBAAW,wBAAAA,OAAgB;AAEnF,8BAAU,MAAM;AACd,UAAM,YAAY,MAAM;AACtB,qCAA+B,UAAU,IAAI;AAAA,IAC/C;AACA,WAAO,iBAAiB,QAAQ,SAAS;AAEzC,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,SAAS;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,UAAU,8BAA8B,CAAC;AAE7C,QAAM,yBAAqB;AAAA,IACzB,CAAC,MAAwB;AACvB,qBAAe,UAAU,CAAC;AAC1B,kBAAY,UAAU,EAAE,gBAAgB,YAAY,kBAAkB,MAAM,CAAC;AAC7E,QAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,CAAC,UAAU,YAAY,gBAAgB,WAAW;AAAA,EACpD;AAEA,QAAM,2BAAuB,0BAAY,MAAM,mBAAmB,IAAI,GAAG,CAAC,kBAAkB,CAAC;AAC7F,QAAM,0BAAsB,0BAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,kBAAkB,CAAC;AAE7F,QAAM,yBAAyB,MAAM;AACnC,uBAAmB,QAAQ;AAC3B,QAAI;AAAY,qCAA+B,UAAU,IAAI;AAAA,EAC/D;AAEA,QAAM,0BAAsB;AAAA,IAC1B,CAAC,MAA2B;AAC1B,QAAE,gBAAgB;AAClB,UAAI,EAAE,SAAS,UAAU;AACvB,oBAAY,UAAU,EAAE,gBAAgB,MAAM,kBAAkB,MAAM,CAAC;AACvE,yBAAiB,MAAM;AAAA,MACzB;AAGA,UAAI,CAAC,WAAW,WAAW,EAAE,SAAS,EAAE,IAAI,GAAG;AAC7C,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,UAAU,WAAW;AAAA,EACzC;AAEA,SAAO,EAAE,oBAAoB,wBAAwB,qBAAqB,sBAAsB,oBAAoB;AACtH;",
|
|
6
|
+
"names": ["DataTableContext"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useGetFilterVisibility_exports = {};
|
|
26
|
+
__export(useGetFilterVisibility_exports, {
|
|
27
|
+
useGetFilterVisibility: () => useGetFilterVisibility
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useGetFilterVisibility_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
const useGetFilterVisibility = (reduxHeader) => {
|
|
33
|
+
const { hideFilterButton, hideFilterMenu } = (0, import_react.useMemo)(
|
|
34
|
+
() => reduxHeader || {
|
|
35
|
+
hideFilterButton: true,
|
|
36
|
+
hideFilterMenu: true
|
|
37
|
+
},
|
|
38
|
+
[reduxHeader]
|
|
39
|
+
);
|
|
40
|
+
return (0, import_react.useMemo)(
|
|
41
|
+
() => ({
|
|
42
|
+
isIconVisible: !hideFilterButton || !hideFilterMenu,
|
|
43
|
+
isMenuOpen: !hideFilterMenu
|
|
44
|
+
}),
|
|
45
|
+
[hideFilterButton, hideFilterMenu]
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=useGetFilterVisibility.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/FilterPopover/useGetFilterVisibility.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react';\nimport { ReduxHeader } from '../../types/props';\n\nexport const useGetFilterVisibility = (reduxHeader: ReduxHeader) => {\n const { hideFilterButton, hideFilterMenu } = useMemo(\n () =>\n reduxHeader || {\n hideFilterButton: true,\n hideFilterMenu: true,\n },\n [reduxHeader],\n );\n\n return useMemo(\n () => ({\n isIconVisible: !hideFilterButton || !hideFilterMenu,\n isMenuOpen: !hideFilterMenu,\n }),\n [hideFilterButton, hideFilterMenu],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAGjB,MAAM,yBAAyB,CAAC,gBAA6B;AAClE,QAAM,EAAE,kBAAkB,eAAe,QAAI;AAAA,IAC3C,MACE,eAAe;AAAA,MACb,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB;AAAA,IACF,CAAC,WAAW;AAAA,EACd;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL,eAAe,CAAC,oBAAoB,CAAC;AAAA,MACrC,YAAY,CAAC;AAAA,IACf;AAAA,IACA,CAAC,kBAAkB,cAAc;AAAA,EACnC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/props.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { MutableRefObject } from 'react';\nimport { useVirtual } from 'react-virtual/types';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { ColsLayoutStyle } from '../configs/constants';\nimport { CSSProperties } from 'styled-components';\n\nexport type TypescriptGenericFunc = (...args: unknown[]) => unknown;\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface HeaderComponentProps {\n ctx: TypescriptContext;\n}\n\nexport type DraggablePropsT =\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n });\n\ninterface CellComponentProps<T = HTMLElement> {\n ctx: TypescriptContext;\n isRowSelected: boolean;\n row: InternalTypescriptRow;\n cell: TypescriptCell<T>;\n draggableProps: DraggablePropsT;\n isDragOverlay: boolean;\n}\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport interface TypescriptColumn<T extends HTMLElement = HTMLElement> {\n id?: string;\n Header: string | React.ComponentType<HeaderComponentProps>;\n accessor?: string;\n filter?: string;\n filterOptions?: FilterOptionT[] | (() => FilterOptionT[]);\n filterMinWidth?: number | string;\n Filter?: React.ComponentType<FilterProps>;\n Cell?: React.ComponentType<CellComponentProps<T>>;\n editable?: string | TypescriptGenericFunc;\n disableDnD?: boolean;\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n padding?: number;\n columns?: TypescriptColumn[];\n canSort?: boolean;\n isSortedDesc?: boolean;\n canResize?: boolean;\n isFocuseable?: boolean;\n textWrap?: 'wrap' | 'wrap-all' | 'truncate';\n ref?: React.MutableRefObject<HTMLTableColElement>;\n required?: boolean;\n cellStyle?: CSSProperties;\n alwaysDisplayEditIcon?: boolean;\n}\n\nexport interface InternalTypescriptColumn<T extends HTMLElement = HTMLElement> extends TypescriptColumn<T> {\n id: string;\n}\n\nexport interface TypescriptCell<T = HTMLElement> {\n column: TypescriptColumn;\n value: any;\n render: React.ComponentType<CellComponentProps>;\n row: InternalTypescriptRow;\n ref: React.RefObject<T>;\n id: string;\n}\n\nexport interface TypescriptRow {\n [key: string]: any;\n subRows: TypescriptRow[];\n tableRowDetails: React.ComponentType<any>;\n dimsumHeaderValue: string;\n}\n\nexport interface InternalTypescriptRow {\n id: string;\n uid: string;\n index: number;\n realIndex: number;\n parentId: string | null;\n parentIndex: number | null;\n depth: number;\n isExpanded: boolean;\n subRows: TypescriptRow[];\n childrenCount: number;\n original: TypescriptRow;\n cells: TypescriptCell[];\n}\n\nexport type RowVariant = 'ds-header-group-row' | 'ds-primary-row' | 'ds-secondary-row';\n\nexport type TypescriptRenderRowActionsConfig = {\n columnWidth: number;\n renderer: (...args: any[]) => JSX.Element;\n};\n\nexport type TypescriptRenderRowActions = false | TypescriptRenderRowActionsConfig;\n\nexport type TypescriptAppliedFilter = {\n id: string;\n type: string;\n value: any;\n};\n\nexport type TypescriptPagination = {\n page?: any[];\n pageIndex?: number;\n canPreviousPage?: boolean;\n canNextPage?: boolean;\n pageSize?: number;\n dataIsPage?: boolean;\n showPerPageSelector?: boolean;\n perPageOptions?: number[];\n perPageStep?: number;\n minPerPage?: number;\n maxPerPage?: number;\n onPageSizeChange?: (pageSize: number) => void;\n onPreviousPage?: () => void;\n onNextPage?: () => void;\n onPageChange?: (page: number) => void;\n pageCount?: number;\n pageDetails?: string[];\n pageDetailsTitle?: string;\n};\n\nexport type TypescriptSortBy = {\n id: string;\n desc: boolean;\n};\n\nexport type TypescriptSelectionItem = boolean | 'mixed';\n\nexport type TypescriptSelection = Record<string | number, TypescriptSelectionItem>;\n\nexport type UniqueRowAccessorType = string | string[] | ((row: TypescriptRow) => string) | undefined;\n\nexport interface ReduxHeader {\n hideFilterMenu
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { MutableRefObject } from 'react';\nimport { useVirtual } from 'react-virtual/types';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { ColsLayoutStyle } from '../configs/constants';\nimport { CSSProperties } from 'styled-components';\n\nexport type TypescriptGenericFunc = (...args: unknown[]) => unknown;\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface HeaderComponentProps {\n ctx: TypescriptContext;\n}\n\nexport type DraggablePropsT =\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n });\n\ninterface CellComponentProps<T = HTMLElement> {\n ctx: TypescriptContext;\n isRowSelected: boolean;\n row: InternalTypescriptRow;\n cell: TypescriptCell<T>;\n draggableProps: DraggablePropsT;\n isDragOverlay: boolean;\n}\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport interface TypescriptColumn<T extends HTMLElement = HTMLElement> {\n id?: string;\n Header: string | React.ComponentType<HeaderComponentProps>;\n accessor?: string;\n filter?: string;\n filterOptions?: FilterOptionT[] | (() => FilterOptionT[]);\n filterMinWidth?: number | string;\n Filter?: React.ComponentType<FilterProps>;\n Cell?: React.ComponentType<CellComponentProps<T>>;\n editable?: string | TypescriptGenericFunc;\n disableDnD?: boolean;\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n padding?: number;\n columns?: TypescriptColumn[];\n canSort?: boolean;\n isSortedDesc?: boolean;\n canResize?: boolean;\n isFocuseable?: boolean;\n textWrap?: 'wrap' | 'wrap-all' | 'truncate';\n ref?: React.MutableRefObject<HTMLTableColElement>;\n required?: boolean;\n cellStyle?: CSSProperties;\n alwaysDisplayEditIcon?: boolean;\n}\n\nexport interface InternalTypescriptColumn<T extends HTMLElement = HTMLElement> extends TypescriptColumn<T> {\n id: string;\n}\n\nexport interface TypescriptCell<T = HTMLElement> {\n column: TypescriptColumn;\n value: any;\n render: React.ComponentType<CellComponentProps>;\n row: InternalTypescriptRow;\n ref: React.RefObject<T>;\n id: string;\n}\n\nexport interface TypescriptRow {\n [key: string]: any;\n subRows: TypescriptRow[];\n tableRowDetails: React.ComponentType<any>;\n dimsumHeaderValue: string;\n}\n\nexport interface InternalTypescriptRow {\n id: string;\n uid: string;\n index: number;\n realIndex: number;\n parentId: string | null;\n parentIndex: number | null;\n depth: number;\n isExpanded: boolean;\n subRows: TypescriptRow[];\n childrenCount: number;\n original: TypescriptRow;\n cells: TypescriptCell[];\n}\n\nexport type RowVariant = 'ds-header-group-row' | 'ds-primary-row' | 'ds-secondary-row';\n\nexport type TypescriptRenderRowActionsConfig = {\n columnWidth: number;\n renderer: (...args: any[]) => JSX.Element;\n};\n\nexport type TypescriptRenderRowActions = false | TypescriptRenderRowActionsConfig;\n\nexport type TypescriptAppliedFilter = {\n id: string;\n type: string;\n value: any;\n};\n\nexport type TypescriptPagination = {\n page?: any[];\n pageIndex?: number;\n canPreviousPage?: boolean;\n canNextPage?: boolean;\n pageSize?: number;\n dataIsPage?: boolean;\n showPerPageSelector?: boolean;\n perPageOptions?: number[];\n perPageStep?: number;\n minPerPage?: number;\n maxPerPage?: number;\n onPageSizeChange?: (pageSize: number) => void;\n onPreviousPage?: () => void;\n onNextPage?: () => void;\n onPageChange?: (page: number) => void;\n pageCount?: number;\n pageDetails?: string[];\n pageDetailsTitle?: string;\n};\n\nexport type TypescriptSortBy = {\n id: string;\n desc: boolean;\n};\n\nexport type TypescriptSelectionItem = boolean | 'mixed';\n\nexport type TypescriptSelection = Record<string | number, TypescriptSelectionItem>;\n\nexport type UniqueRowAccessorType = string | string[] | ((row: TypescriptRow) => string) | undefined;\n\nexport interface ReduxHeader {\n hideFilterMenu?: boolean;\n hideFilterButton?: boolean;\n showDnDHandle?: boolean;\n withTabStops?: boolean;\n}\n\ninterface DataTableFilter {\n id: string;\n type: string;\n value: any;\n}\n\ninterface PropsWithDefault {\n height: string;\n width: string;\n renderRowActions: boolean;\n getRowVariant: (\n row: TypescriptRow,\n defaultCellRenderer: React.ComponentType<any>,\n ) => RowVariant | React.ComponentType<any>;\n withFilterBar: boolean;\n isExpandable: boolean;\n expandedRows: Record<string, boolean>;\n disabledRows: Record<string, boolean>;\n isResizeable: boolean;\n isLoading: boolean;\n pagination: false | TypescriptPagination;\n filters: DataTableFilter[];\n colsLayoutStyle: ColsLayoutStyle;\n hiddenColumns: string[];\n noResultsMessage: string;\n dragAndDropRows: boolean;\n maxDragAndDropLevel: number;\n onRowsReorder: (\n newData: TypescriptRow[],\n indexes: { targetIndex: number; fromIndex: number },\n considerExpanding: string,\n ) => void;\n dragAndDropColumns: boolean;\n onColumnsReorder: (newData: TypescriptColumn[], indexes: { targetIndex: number; fromIndex: number }) => void;\n onColumnResize: (headerId: string, width: number) => void;\n onColumnSizeChange: (newColumns: TypescriptColumn[], headerId: string, width: number) => void;\n onRowClick: TypescriptGenericFunc;\n onRowFocus: TypescriptGenericFunc;\n noSelectionColumn: boolean;\n selectSingle: boolean;\n onSelectionChange: (newSelection: TypescriptSelection, selectedControl: string, event: React.ChangeEvent) => void;\n textWrap: 'wrap' | 'wrap-all' | 'truncate';\n onCellValueChange: (cellChange: { value: any; property: any; rowIndex: number }) => void;\n onFiltersChange: TypescriptGenericFunc;\n onPageChanged: TypescriptGenericFunc;\n onRowExpand: (expandedRows: Record<string, boolean>, toggledRow: string) => void;\n onColumnSortChange: (newSortRequest: { column: any; direction: any }) => void;\n onColumnSort: (newColumns: TypescriptColumn[], headerId: string, direction: 'ASC' | 'DESC') => void;\n}\n\ninterface PropsRequired {\n columns: TypescriptColumn[];\n data: TypescriptRow[];\n}\n\ninterface PropsOptional {\n uniqueRowAccessor?: UniqueRowAccessorType;\n cellRendererProps?: Record<string, any>;\n selection?: TypescriptSelection;\n groupedRowsRenderHeader?: TypescriptGenericFunc | string;\n filterBarProps?: {\n filterBarAddonRenderer?: React.ComponentType<any>;\n customPillRenderer?: React.ComponentType<any>;\n extraOptions?: { type: string; id: string; label: string; onClick?: TypescriptGenericFunc }[];\n };\n actionRef?: React.RefObject<any>;\n noResultsSecondaryMessage?: string;\n noResultsButtonLabel?: string;\n noResultsPlaceholder?: TypescriptGenericFunc;\n onNoResultsButtonClick?: TypescriptGenericFunc;\n}\n\nexport interface TypescriptProps extends Partial<PropsWithDefault>, PropsRequired, PropsOptional {}\nexport interface InternalTypescriptProps extends PropsWithDefault, PropsRequired, PropsOptional {}\n\nexport interface FilterProps {\n column: TypescriptColumn;\n ctx: TypescriptContext;\n onFiltersChange?: (filters: DataTableFilter[]) => void;\n onValueChange: (type: string, value: any) => void;\n patchHeaderFilterButtonAndMenu: (headerId: string, newState: any) => void;\n patchHeader: (headerId: string, newHeader: any) => void;\n filterValue?: any;\n reduxHeader?: any;\n innerRef: MutableRefObject<HTMLDivElement | null>;\n}\n\nexport type TypescriptContext = {\n tableProps: InternalTypescriptProps;\n virtualListRef: React.RefObject<HTMLDivElement>;\n columnHeaderRef: React.RefObject<HTMLDivElement>;\n flattenedData: InternalTypescriptRow[];\n allDataFlattened: InternalTypescriptRow[];\n visibleColumns: TypescriptColumn[];\n virtualListHelpers?: ReturnType<typeof useVirtual>;\n layoutHelpers: {\n totalColumnsWidth?: number | string;\n gridLayout: string[];\n setGridLayout: React.Dispatch<React.SetStateAction<string[]>>;\n };\n paginationHelpers: TypescriptPagination;\n drilldownRowId: string | null;\n setDrilldownRowId: React.Dispatch<React.SetStateAction<string | null>>;\n focusedRowId: string | null;\n setFocusedRowId: React.Dispatch<React.SetStateAction<string | null>>;\n reduxHeaders: Record<string, ReduxHeader>;\n patchHeader: (headerId: string, newHeader: ReduxHeader) => void;\n patchHeaderFilterButtonAndMenu: (headerId: string, value: boolean) => void;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqChB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,8CAAA,UAAO,KAAP;AACA,EAAAA,8CAAA,YAAS,KAAT;AACA,EAAAA,8CAAA,WAAQ,KAAR;AACA,EAAAA,8CAAA,YAAS,KAAT;AAJU,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["DropIndicatorPosition"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useContext, useState } from "react";
|
|
4
|
+
import { DSButtonV2 } from "@elliemae/ds-button";
|
|
5
|
+
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
6
|
+
import { styled } from "@elliemae/ds-system";
|
|
7
|
+
import { mergeRefs } from "@elliemae/ds-utilities";
|
|
8
|
+
import DataTableContext from "../../DataTableContext";
|
|
9
|
+
import { DATA_TESTID } from "../../configs/constants";
|
|
10
|
+
import { useGetFilterVisibility } from "./useGetFilterVisibility";
|
|
11
|
+
import { useGetFilterHandlers } from "./useGetFilterHandlers";
|
|
12
|
+
const FilterButton = styled.span`
|
|
13
|
+
display: inline-grid;
|
|
14
|
+
${(props) => props.hide ? "opacity: 0; display: none; width: 0;" : ""}
|
|
15
|
+
`;
|
|
16
|
+
const PopperContent = styled.div`
|
|
17
|
+
background-color: #fff;
|
|
18
|
+
`;
|
|
19
|
+
const ButtonTrap = ({ cb }) => /* @__PURE__ */ jsx("span", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
tabIndex: 0,
|
|
22
|
+
onFocus: (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
cb();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const FilterPopover = (props) => {
|
|
28
|
+
const { column, customStyles, reduxHeader, menuContent, columnId, ariaLabel, triggerIcon, innerRef } = props;
|
|
29
|
+
const { patchHeader } = useContext(DataTableContext);
|
|
30
|
+
const { isIconVisible, isMenuOpen } = useGetFilterVisibility(reduxHeader);
|
|
31
|
+
const [buttonReference, setButtonReference] = useState(null);
|
|
32
|
+
const [isButtonFocused, setIsButtonFocused] = useState(false);
|
|
33
|
+
const { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur } = useGetFilterHandlers(props, isMenuOpen, buttonReference, setIsButtonFocused);
|
|
34
|
+
const buttonTrapCallback = useCallback(() => {
|
|
35
|
+
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });
|
|
36
|
+
buttonReference?.focus();
|
|
37
|
+
}, [columnId, patchHeader, buttonReference]);
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
onClick: (e) => e.stopPropagation(),
|
|
40
|
+
onKeyDown: handleMenuOnKeyDown,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx(FilterButton, {
|
|
43
|
+
hide: !isIconVisible,
|
|
44
|
+
"data-testid": DATA_TESTID.DATA_TABLE_FILTER_BUTTON,
|
|
45
|
+
children: /* @__PURE__ */ jsx(DSButtonV2, {
|
|
46
|
+
buttonType: "icon",
|
|
47
|
+
size: "s",
|
|
48
|
+
onClick: handleTriggerClick,
|
|
49
|
+
onFocus: handleTriggerOnFocus,
|
|
50
|
+
onBlur: handleTriggerOnBlur,
|
|
51
|
+
innerRef: mergeRefs(isIconVisible && setButtonReference, innerRef),
|
|
52
|
+
tabIndex: reduxHeader?.withTabStops ? 0 : -1,
|
|
53
|
+
"aria-label": ariaLabel,
|
|
54
|
+
"aria-hidden": !isButtonFocused,
|
|
55
|
+
children: triggerIcon
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
buttonReference && /* @__PURE__ */ jsx(DSPopperJS, {
|
|
59
|
+
referenceElement: buttonReference,
|
|
60
|
+
showPopover: isMenuOpen,
|
|
61
|
+
closeContextMenu: handleClickOutsideMenu,
|
|
62
|
+
"data-testid": DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT,
|
|
63
|
+
startPlacementPreference: "bottom-end",
|
|
64
|
+
customOffset: [5, 4],
|
|
65
|
+
withoutArrow: true,
|
|
66
|
+
withoutAnimation: true,
|
|
67
|
+
extraPopperStyles: {
|
|
68
|
+
...customStyles,
|
|
69
|
+
minWidth: column.ref?.current?.offsetWidth ?? "0px"
|
|
70
|
+
},
|
|
71
|
+
placementOrderPreference: ["bottom-end"],
|
|
72
|
+
children: /* @__PURE__ */ jsxs(PopperContent, {
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(ButtonTrap, {
|
|
75
|
+
cb: buttonTrapCallback
|
|
76
|
+
}),
|
|
77
|
+
menuContent,
|
|
78
|
+
/* @__PURE__ */ jsx(ButtonTrap, {
|
|
79
|
+
cb: buttonTrapCallback
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
FilterPopover
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/FilterPopover/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useCallback, useContext, useState } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { styled } from '@elliemae/ds-system';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport DataTableContext from '../../DataTableContext';\nimport { DATA_TESTID } from '../../configs/constants';\nimport { useGetFilterVisibility } from './useGetFilterVisibility';\nimport { FilterPopoverProps } from './types';\nimport { useGetFilterHandlers } from './useGetFilterHandlers';\n\nconst FilterButton = styled.span<{ hide: boolean }>`\n display: inline-grid;\n ${(props) => (props.hide ? 'opacity: 0; display: none; width: 0;' : '')}\n`;\n\nconst PopperContent = styled.div`\n background-color: #fff;\n`;\n\nconst ButtonTrap = ({ cb }: { cb: () => void }) => (\n <span\n aria-hidden=\"true\"\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n onFocus={(e: React.FocusEvent) => {\n e.stopPropagation();\n cb();\n }}\n />\n);\n\nexport const FilterPopover: React.ComponentType<FilterPopoverProps> = (props: FilterPopoverProps) => {\n const { column, customStyles, reduxHeader, menuContent, columnId, ariaLabel, triggerIcon, innerRef } = props;\n\n const { patchHeader } = useContext(DataTableContext);\n\n const { isIconVisible, isMenuOpen } = useGetFilterVisibility(reduxHeader);\n\n const [buttonReference, setButtonReference] = useState<HTMLButtonElement | null>(null);\n\n const [isButtonFocused, setIsButtonFocused] = useState(false);\n\n const { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur } =\n useGetFilterHandlers(props, isMenuOpen, buttonReference, setIsButtonFocused);\n\n const buttonTrapCallback = useCallback(() => {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n buttonReference?.focus();\n }, [columnId, patchHeader, buttonReference]);\n\n return (\n <div\n // This is here to prevent propagation, and not trigger the sort functionality\n onClick={(e) => e.stopPropagation()}\n onKeyDown={handleMenuOnKeyDown}\n >\n <FilterButton hide={!isIconVisible} data-testid={DATA_TESTID.DATA_TABLE_FILTER_BUTTON}>\n <DSButtonV2\n buttonType=\"icon\"\n size=\"s\"\n onClick={handleTriggerClick}\n onFocus={handleTriggerOnFocus}\n onBlur={handleTriggerOnBlur}\n innerRef={mergeRefs(isIconVisible && setButtonReference, innerRef)}\n tabIndex={reduxHeader?.withTabStops ? 0 : -1}\n aria-label={ariaLabel}\n aria-hidden={!isButtonFocused}\n >\n {triggerIcon}\n </DSButtonV2>\n </FilterButton>\n {buttonReference && (\n <DSPopperJS\n referenceElement={buttonReference}\n showPopover={isMenuOpen}\n closeContextMenu={handleClickOutsideMenu}\n data-testid={DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT}\n startPlacementPreference=\"bottom-end\"\n customOffset={[5, 4]}\n withoutArrow\n withoutAnimation\n extraPopperStyles={{\n ...customStyles,\n minWidth: column.ref?.current?.offsetWidth ?? '0px',\n }}\n placementOrderPreference={['bottom-end']}\n >\n <PopperContent>\n <ButtonTrap cb={buttonTrapCallback} />\n {menuContent}\n <ButtonTrap cb={buttonTrapCallback} />\n </PopperContent>\n </DSPopperJS>\n )}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,aAAa,YAAY,gBAAgB;AACzD,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,OAAO,sBAAsB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AAEvC,SAAS,4BAA4B;AAErC,MAAM,eAAe,OAAO;AAAA;AAAA,IAExB,CAAC,UAAW,MAAM,OAAO,yCAAyC;AAAA;AAGtE,MAAM,gBAAgB,OAAO;AAAA;AAAA;AAI7B,MAAM,aAAa,CAAC,EAAE,GAAG,MACvB,oBAAC;AAAA,EACC,eAAY;AAAA,EAEZ,UAAU;AAAA,EACV,SAAS,CAAC,MAAwB;AAChC,MAAE,gBAAgB;AAClB,OAAG;AAAA,EACL;AAAA,CACF;AAGK,MAAM,gBAAyD,CAAC,UAA8B;AACnG,QAAM,EAAE,QAAQ,cAAc,aAAa,aAAa,UAAU,WAAW,aAAa,SAAS,IAAI;AAEvG,QAAM,EAAE,YAAY,IAAI,WAAW,gBAAgB;AAEnD,QAAM,EAAE,eAAe,WAAW,IAAI,uBAAuB,WAAW;AAExE,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAmC,IAAI;AAErF,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,KAAK;AAE5D,QAAM,EAAE,oBAAoB,wBAAwB,qBAAqB,sBAAsB,oBAAoB,IACjH,qBAAqB,OAAO,YAAY,iBAAiB,kBAAkB;AAE7E,QAAM,qBAAqB,YAAY,MAAM;AAC3C,gBAAY,UAAU,EAAE,gBAAgB,MAAM,kBAAkB,MAAM,CAAC;AACvE,qBAAiB,MAAM;AAAA,EACzB,GAAG,CAAC,UAAU,aAAa,eAAe,CAAC;AAE3C,SACE,qBAAC;AAAA,IAEC,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,IAClC,WAAW;AAAA,IAEX;AAAA,0BAAC;AAAA,QAAa,MAAM,CAAC;AAAA,QAAe,eAAa,YAAY;AAAA,QAC3D,8BAAC;AAAA,UACC,YAAW;AAAA,UACX,MAAK;AAAA,UACL,SAAS;AAAA,UACT,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,UAAU,UAAU,iBAAiB,oBAAoB,QAAQ;AAAA,UACjE,UAAU,aAAa,eAAe,IAAI;AAAA,UAC1C,cAAY;AAAA,UACZ,eAAa,CAAC;AAAA,UAEb;AAAA,SACH;AAAA,OACF;AAAA,MACC,mBACC,oBAAC;AAAA,QACC,kBAAkB;AAAA,QAClB,aAAa;AAAA,QACb,kBAAkB;AAAA,QAClB,eAAa,YAAY;AAAA,QACzB,0BAAyB;AAAA,QACzB,cAAc,CAAC,GAAG,CAAC;AAAA,QACnB,cAAY;AAAA,QACZ,kBAAgB;AAAA,QAChB,mBAAmB;AAAA,UACjB,GAAG;AAAA,UACH,UAAU,OAAO,KAAK,SAAS,eAAe;AAAA,QAChD;AAAA,QACA,0BAA0B,CAAC,YAAY;AAAA,QAEvC,+BAAC;AAAA,UACC;AAAA,gCAAC;AAAA,cAAW,IAAI;AAAA,aAAoB;AAAA,YACnC;AAAA,YACD,oBAAC;AAAA,cAAW,IAAI;AAAA,aAAoB;AAAA;AAAA,SACtC;AAAA,OACF;AAAA;AAAA,GAEJ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useCallback, useContext, useEffect } from "react";
|
|
3
|
+
import DataTableContext from "../../DataTableContext";
|
|
4
|
+
const emptyFunc = () => null;
|
|
5
|
+
const useGetFilterHandlers = (props, isMenuOpen, buttonReference, setIsButtonFocused) => {
|
|
6
|
+
const { columnId, onTriggerClick = emptyFunc, onClickOutsideMenu = emptyFunc } = props;
|
|
7
|
+
const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const closeMenu = () => {
|
|
10
|
+
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
11
|
+
};
|
|
12
|
+
window.addEventListener("blur", closeMenu);
|
|
13
|
+
return () => {
|
|
14
|
+
window.removeEventListener("blur", closeMenu);
|
|
15
|
+
};
|
|
16
|
+
}, [columnId, patchHeaderFilterButtonAndMenu]);
|
|
17
|
+
const handleTriggerClick = useCallback(
|
|
18
|
+
(e) => {
|
|
19
|
+
onTriggerClick(columnId, e);
|
|
20
|
+
patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
},
|
|
23
|
+
[columnId, isMenuOpen, onTriggerClick, patchHeader]
|
|
24
|
+
);
|
|
25
|
+
const handleTriggerOnFocus = useCallback(() => setIsButtonFocused(true), [setIsButtonFocused]);
|
|
26
|
+
const handleTriggerOnBlur = useCallback(() => setIsButtonFocused(false), [setIsButtonFocused]);
|
|
27
|
+
const handleClickOutsideMenu = () => {
|
|
28
|
+
onClickOutsideMenu(columnId);
|
|
29
|
+
if (isMenuOpen)
|
|
30
|
+
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
31
|
+
};
|
|
32
|
+
const handleMenuOnKeyDown = useCallback(
|
|
33
|
+
(e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
if (e.code === "Escape") {
|
|
36
|
+
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });
|
|
37
|
+
buttonReference?.focus();
|
|
38
|
+
}
|
|
39
|
+
if (["ArrowUp", "ArrowDown"].includes(e.code)) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
[buttonReference, columnId, patchHeader]
|
|
44
|
+
);
|
|
45
|
+
return { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur };
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
useGetFilterHandlers
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useGetFilterHandlers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/FilterPopover/useGetFilterHandlers.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-params */\nimport React, { useCallback, useContext, useEffect } from 'react';\nimport DataTableContext from '../../DataTableContext';\nimport { FilterPopoverProps } from './types';\n\nconst emptyFunc = () => null;\n\nexport const useGetFilterHandlers = (\n props: FilterPopoverProps,\n isMenuOpen: boolean,\n buttonReference: HTMLButtonElement | null,\n setIsButtonFocused: React.Dispatch<React.SetStateAction<boolean>>,\n) => {\n const { columnId, onTriggerClick = emptyFunc, onClickOutsideMenu = emptyFunc } = props;\n\n const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);\n\n useEffect(() => {\n const closeMenu = () => {\n patchHeaderFilterButtonAndMenu(columnId, true);\n };\n window.addEventListener('blur', closeMenu);\n\n return () => {\n window.removeEventListener('blur', closeMenu);\n };\n }, [columnId, patchHeaderFilterButtonAndMenu]);\n\n const handleTriggerClick = useCallback(\n (e: React.MouseEvent) => {\n onTriggerClick(columnId, e);\n patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });\n e.stopPropagation();\n },\n [columnId, isMenuOpen, onTriggerClick, patchHeader],\n );\n\n const handleTriggerOnFocus = useCallback(() => setIsButtonFocused(true), [setIsButtonFocused]);\n const handleTriggerOnBlur = useCallback(() => setIsButtonFocused(false), [setIsButtonFocused]);\n\n const handleClickOutsideMenu = () => {\n onClickOutsideMenu(columnId);\n if (isMenuOpen) patchHeaderFilterButtonAndMenu(columnId, true);\n };\n\n const handleMenuOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n e.stopPropagation();\n if (e.code === 'Escape') {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n buttonReference?.focus();\n }\n // Stop propagation for some reason is not enough to prevent scrolling of the datatable\n // so we just prevent default behaviour in this case\n if (['ArrowUp', 'ArrowDown'].includes(e.code)) {\n e.preventDefault();\n }\n },\n [buttonReference, columnId, patchHeader],\n );\n\n return { handleTriggerClick, handleClickOutsideMenu, handleMenuOnKeyDown, handleTriggerOnFocus, handleTriggerOnBlur };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAgB,aAAa,YAAY,iBAAiB;AAC1D,OAAO,sBAAsB;AAG7B,MAAM,YAAY,MAAM;AAEjB,MAAM,uBAAuB,CAClC,OACA,YACA,iBACA,uBACG;AACH,QAAM,EAAE,UAAU,iBAAiB,WAAW,qBAAqB,UAAU,IAAI;AAEjF,QAAM,EAAE,gCAAgC,YAAY,IAAI,WAAW,gBAAgB;AAEnF,YAAU,MAAM;AACd,UAAM,YAAY,MAAM;AACtB,qCAA+B,UAAU,IAAI;AAAA,IAC/C;AACA,WAAO,iBAAiB,QAAQ,SAAS;AAEzC,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,SAAS;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,UAAU,8BAA8B,CAAC;AAE7C,QAAM,qBAAqB;AAAA,IACzB,CAAC,MAAwB;AACvB,qBAAe,UAAU,CAAC;AAC1B,kBAAY,UAAU,EAAE,gBAAgB,YAAY,kBAAkB,MAAM,CAAC;AAC7E,QAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,CAAC,UAAU,YAAY,gBAAgB,WAAW;AAAA,EACpD;AAEA,QAAM,uBAAuB,YAAY,MAAM,mBAAmB,IAAI,GAAG,CAAC,kBAAkB,CAAC;AAC7F,QAAM,sBAAsB,YAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,kBAAkB,CAAC;AAE7F,QAAM,yBAAyB,MAAM;AACnC,uBAAmB,QAAQ;AAC3B,QAAI;AAAY,qCAA+B,UAAU,IAAI;AAAA,EAC/D;AAEA,QAAM,sBAAsB;AAAA,IAC1B,CAAC,MAA2B;AAC1B,QAAE,gBAAgB;AAClB,UAAI,EAAE,SAAS,UAAU;AACvB,oBAAY,UAAU,EAAE,gBAAgB,MAAM,kBAAkB,MAAM,CAAC;AACvE,yBAAiB,MAAM;AAAA,MACzB;AAGA,UAAI,CAAC,WAAW,WAAW,EAAE,SAAS,EAAE,IAAI,GAAG;AAC7C,UAAE,eAAe;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,UAAU,WAAW;AAAA,EACzC;AAEA,SAAO,EAAE,oBAAoB,wBAAwB,qBAAqB,sBAAsB,oBAAoB;AACtH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
const useGetFilterVisibility = (reduxHeader) => {
|
|
4
|
+
const { hideFilterButton, hideFilterMenu } = useMemo(
|
|
5
|
+
() => reduxHeader || {
|
|
6
|
+
hideFilterButton: true,
|
|
7
|
+
hideFilterMenu: true
|
|
8
|
+
},
|
|
9
|
+
[reduxHeader]
|
|
10
|
+
);
|
|
11
|
+
return useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
isIconVisible: !hideFilterButton || !hideFilterMenu,
|
|
14
|
+
isMenuOpen: !hideFilterMenu
|
|
15
|
+
}),
|
|
16
|
+
[hideFilterButton, hideFilterMenu]
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
useGetFilterVisibility
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useGetFilterVisibility.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/exported-related/FilterPopover/useGetFilterVisibility.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { ReduxHeader } from '../../types/props';\n\nexport const useGetFilterVisibility = (reduxHeader: ReduxHeader) => {\n const { hideFilterButton, hideFilterMenu } = useMemo(\n () =>\n reduxHeader || {\n hideFilterButton: true,\n hideFilterMenu: true,\n },\n [reduxHeader],\n );\n\n return useMemo(\n () => ({\n isIconVisible: !hideFilterButton || !hideFilterMenu,\n isMenuOpen: !hideFilterMenu,\n }),\n [hideFilterButton, hideFilterMenu],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AAGjB,MAAM,yBAAyB,CAAC,gBAA6B;AAClE,QAAM,EAAE,kBAAkB,eAAe,IAAI;AAAA,IAC3C,MACE,eAAe;AAAA,MACb,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,IAClB;AAAA,IACF,CAAC,WAAW;AAAA,EACd;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL,eAAe,CAAC,oBAAoB,CAAC;AAAA,MACrC,YAAY,CAAC;AAAA,IACf;AAAA,IACA,CAAC,kBAAkB,cAAc;AAAA,EACnC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/types/props.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { MutableRefObject } from 'react';\nimport { useVirtual } from 'react-virtual/types';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { ColsLayoutStyle } from '../configs/constants';\nimport { CSSProperties } from 'styled-components';\n\nexport type TypescriptGenericFunc = (...args: unknown[]) => unknown;\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface HeaderComponentProps {\n ctx: TypescriptContext;\n}\n\nexport type DraggablePropsT =\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n });\n\ninterface CellComponentProps<T = HTMLElement> {\n ctx: TypescriptContext;\n isRowSelected: boolean;\n row: InternalTypescriptRow;\n cell: TypescriptCell<T>;\n draggableProps: DraggablePropsT;\n isDragOverlay: boolean;\n}\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport interface TypescriptColumn<T extends HTMLElement = HTMLElement> {\n id?: string;\n Header: string | React.ComponentType<HeaderComponentProps>;\n accessor?: string;\n filter?: string;\n filterOptions?: FilterOptionT[] | (() => FilterOptionT[]);\n filterMinWidth?: number | string;\n Filter?: React.ComponentType<FilterProps>;\n Cell?: React.ComponentType<CellComponentProps<T>>;\n editable?: string | TypescriptGenericFunc;\n disableDnD?: boolean;\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n padding?: number;\n columns?: TypescriptColumn[];\n canSort?: boolean;\n isSortedDesc?: boolean;\n canResize?: boolean;\n isFocuseable?: boolean;\n textWrap?: 'wrap' | 'wrap-all' | 'truncate';\n ref?: React.MutableRefObject<HTMLTableColElement>;\n required?: boolean;\n cellStyle?: CSSProperties;\n alwaysDisplayEditIcon?: boolean;\n}\n\nexport interface InternalTypescriptColumn<T extends HTMLElement = HTMLElement> extends TypescriptColumn<T> {\n id: string;\n}\n\nexport interface TypescriptCell<T = HTMLElement> {\n column: TypescriptColumn;\n value: any;\n render: React.ComponentType<CellComponentProps>;\n row: InternalTypescriptRow;\n ref: React.RefObject<T>;\n id: string;\n}\n\nexport interface TypescriptRow {\n [key: string]: any;\n subRows: TypescriptRow[];\n tableRowDetails: React.ComponentType<any>;\n dimsumHeaderValue: string;\n}\n\nexport interface InternalTypescriptRow {\n id: string;\n uid: string;\n index: number;\n realIndex: number;\n parentId: string | null;\n parentIndex: number | null;\n depth: number;\n isExpanded: boolean;\n subRows: TypescriptRow[];\n childrenCount: number;\n original: TypescriptRow;\n cells: TypescriptCell[];\n}\n\nexport type RowVariant = 'ds-header-group-row' | 'ds-primary-row' | 'ds-secondary-row';\n\nexport type TypescriptRenderRowActionsConfig = {\n columnWidth: number;\n renderer: (...args: any[]) => JSX.Element;\n};\n\nexport type TypescriptRenderRowActions = false | TypescriptRenderRowActionsConfig;\n\nexport type TypescriptAppliedFilter = {\n id: string;\n type: string;\n value: any;\n};\n\nexport type TypescriptPagination = {\n page?: any[];\n pageIndex?: number;\n canPreviousPage?: boolean;\n canNextPage?: boolean;\n pageSize?: number;\n dataIsPage?: boolean;\n showPerPageSelector?: boolean;\n perPageOptions?: number[];\n perPageStep?: number;\n minPerPage?: number;\n maxPerPage?: number;\n onPageSizeChange?: (pageSize: number) => void;\n onPreviousPage?: () => void;\n onNextPage?: () => void;\n onPageChange?: (page: number) => void;\n pageCount?: number;\n pageDetails?: string[];\n pageDetailsTitle?: string;\n};\n\nexport type TypescriptSortBy = {\n id: string;\n desc: boolean;\n};\n\nexport type TypescriptSelectionItem = boolean | 'mixed';\n\nexport type TypescriptSelection = Record<string | number, TypescriptSelectionItem>;\n\nexport type UniqueRowAccessorType = string | string[] | ((row: TypescriptRow) => string) | undefined;\n\nexport interface ReduxHeader {\n hideFilterMenu
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { MutableRefObject } from 'react';\nimport { useVirtual } from 'react-virtual/types';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { ColsLayoutStyle } from '../configs/constants';\nimport { CSSProperties } from 'styled-components';\n\nexport type TypescriptGenericFunc = (...args: unknown[]) => unknown;\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface HeaderComponentProps {\n ctx: TypescriptContext;\n}\n\nexport type DraggablePropsT =\n | false\n | (ReturnType<typeof useSortable> & {\n dropIndicatorPosition: DropIndicatorPosition;\n shouldShowDropIndicatorPosition: boolean;\n lastActiveId?: string;\n setLastActiveId?: React.Dispatch<React.SetStateAction<string>>;\n });\n\ninterface CellComponentProps<T = HTMLElement> {\n ctx: TypescriptContext;\n isRowSelected: boolean;\n row: InternalTypescriptRow;\n cell: TypescriptCell<T>;\n draggableProps: DraggablePropsT;\n isDragOverlay: boolean;\n}\n\nexport enum DropIndicatorPosition {\n None = 0,\n Before = 1,\n After = 2,\n Inside = 3,\n}\n\nexport interface TypescriptColumn<T extends HTMLElement = HTMLElement> {\n id?: string;\n Header: string | React.ComponentType<HeaderComponentProps>;\n accessor?: string;\n filter?: string;\n filterOptions?: FilterOptionT[] | (() => FilterOptionT[]);\n filterMinWidth?: number | string;\n Filter?: React.ComponentType<FilterProps>;\n Cell?: React.ComponentType<CellComponentProps<T>>;\n editable?: string | TypescriptGenericFunc;\n disableDnD?: boolean;\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n padding?: number;\n columns?: TypescriptColumn[];\n canSort?: boolean;\n isSortedDesc?: boolean;\n canResize?: boolean;\n isFocuseable?: boolean;\n textWrap?: 'wrap' | 'wrap-all' | 'truncate';\n ref?: React.MutableRefObject<HTMLTableColElement>;\n required?: boolean;\n cellStyle?: CSSProperties;\n alwaysDisplayEditIcon?: boolean;\n}\n\nexport interface InternalTypescriptColumn<T extends HTMLElement = HTMLElement> extends TypescriptColumn<T> {\n id: string;\n}\n\nexport interface TypescriptCell<T = HTMLElement> {\n column: TypescriptColumn;\n value: any;\n render: React.ComponentType<CellComponentProps>;\n row: InternalTypescriptRow;\n ref: React.RefObject<T>;\n id: string;\n}\n\nexport interface TypescriptRow {\n [key: string]: any;\n subRows: TypescriptRow[];\n tableRowDetails: React.ComponentType<any>;\n dimsumHeaderValue: string;\n}\n\nexport interface InternalTypescriptRow {\n id: string;\n uid: string;\n index: number;\n realIndex: number;\n parentId: string | null;\n parentIndex: number | null;\n depth: number;\n isExpanded: boolean;\n subRows: TypescriptRow[];\n childrenCount: number;\n original: TypescriptRow;\n cells: TypescriptCell[];\n}\n\nexport type RowVariant = 'ds-header-group-row' | 'ds-primary-row' | 'ds-secondary-row';\n\nexport type TypescriptRenderRowActionsConfig = {\n columnWidth: number;\n renderer: (...args: any[]) => JSX.Element;\n};\n\nexport type TypescriptRenderRowActions = false | TypescriptRenderRowActionsConfig;\n\nexport type TypescriptAppliedFilter = {\n id: string;\n type: string;\n value: any;\n};\n\nexport type TypescriptPagination = {\n page?: any[];\n pageIndex?: number;\n canPreviousPage?: boolean;\n canNextPage?: boolean;\n pageSize?: number;\n dataIsPage?: boolean;\n showPerPageSelector?: boolean;\n perPageOptions?: number[];\n perPageStep?: number;\n minPerPage?: number;\n maxPerPage?: number;\n onPageSizeChange?: (pageSize: number) => void;\n onPreviousPage?: () => void;\n onNextPage?: () => void;\n onPageChange?: (page: number) => void;\n pageCount?: number;\n pageDetails?: string[];\n pageDetailsTitle?: string;\n};\n\nexport type TypescriptSortBy = {\n id: string;\n desc: boolean;\n};\n\nexport type TypescriptSelectionItem = boolean | 'mixed';\n\nexport type TypescriptSelection = Record<string | number, TypescriptSelectionItem>;\n\nexport type UniqueRowAccessorType = string | string[] | ((row: TypescriptRow) => string) | undefined;\n\nexport interface ReduxHeader {\n hideFilterMenu?: boolean;\n hideFilterButton?: boolean;\n showDnDHandle?: boolean;\n withTabStops?: boolean;\n}\n\ninterface DataTableFilter {\n id: string;\n type: string;\n value: any;\n}\n\ninterface PropsWithDefault {\n height: string;\n width: string;\n renderRowActions: boolean;\n getRowVariant: (\n row: TypescriptRow,\n defaultCellRenderer: React.ComponentType<any>,\n ) => RowVariant | React.ComponentType<any>;\n withFilterBar: boolean;\n isExpandable: boolean;\n expandedRows: Record<string, boolean>;\n disabledRows: Record<string, boolean>;\n isResizeable: boolean;\n isLoading: boolean;\n pagination: false | TypescriptPagination;\n filters: DataTableFilter[];\n colsLayoutStyle: ColsLayoutStyle;\n hiddenColumns: string[];\n noResultsMessage: string;\n dragAndDropRows: boolean;\n maxDragAndDropLevel: number;\n onRowsReorder: (\n newData: TypescriptRow[],\n indexes: { targetIndex: number; fromIndex: number },\n considerExpanding: string,\n ) => void;\n dragAndDropColumns: boolean;\n onColumnsReorder: (newData: TypescriptColumn[], indexes: { targetIndex: number; fromIndex: number }) => void;\n onColumnResize: (headerId: string, width: number) => void;\n onColumnSizeChange: (newColumns: TypescriptColumn[], headerId: string, width: number) => void;\n onRowClick: TypescriptGenericFunc;\n onRowFocus: TypescriptGenericFunc;\n noSelectionColumn: boolean;\n selectSingle: boolean;\n onSelectionChange: (newSelection: TypescriptSelection, selectedControl: string, event: React.ChangeEvent) => void;\n textWrap: 'wrap' | 'wrap-all' | 'truncate';\n onCellValueChange: (cellChange: { value: any; property: any; rowIndex: number }) => void;\n onFiltersChange: TypescriptGenericFunc;\n onPageChanged: TypescriptGenericFunc;\n onRowExpand: (expandedRows: Record<string, boolean>, toggledRow: string) => void;\n onColumnSortChange: (newSortRequest: { column: any; direction: any }) => void;\n onColumnSort: (newColumns: TypescriptColumn[], headerId: string, direction: 'ASC' | 'DESC') => void;\n}\n\ninterface PropsRequired {\n columns: TypescriptColumn[];\n data: TypescriptRow[];\n}\n\ninterface PropsOptional {\n uniqueRowAccessor?: UniqueRowAccessorType;\n cellRendererProps?: Record<string, any>;\n selection?: TypescriptSelection;\n groupedRowsRenderHeader?: TypescriptGenericFunc | string;\n filterBarProps?: {\n filterBarAddonRenderer?: React.ComponentType<any>;\n customPillRenderer?: React.ComponentType<any>;\n extraOptions?: { type: string; id: string; label: string; onClick?: TypescriptGenericFunc }[];\n };\n actionRef?: React.RefObject<any>;\n noResultsSecondaryMessage?: string;\n noResultsButtonLabel?: string;\n noResultsPlaceholder?: TypescriptGenericFunc;\n onNoResultsButtonClick?: TypescriptGenericFunc;\n}\n\nexport interface TypescriptProps extends Partial<PropsWithDefault>, PropsRequired, PropsOptional {}\nexport interface InternalTypescriptProps extends PropsWithDefault, PropsRequired, PropsOptional {}\n\nexport interface FilterProps {\n column: TypescriptColumn;\n ctx: TypescriptContext;\n onFiltersChange?: (filters: DataTableFilter[]) => void;\n onValueChange: (type: string, value: any) => void;\n patchHeaderFilterButtonAndMenu: (headerId: string, newState: any) => void;\n patchHeader: (headerId: string, newHeader: any) => void;\n filterValue?: any;\n reduxHeader?: any;\n innerRef: MutableRefObject<HTMLDivElement | null>;\n}\n\nexport type TypescriptContext = {\n tableProps: InternalTypescriptProps;\n virtualListRef: React.RefObject<HTMLDivElement>;\n columnHeaderRef: React.RefObject<HTMLDivElement>;\n flattenedData: InternalTypescriptRow[];\n allDataFlattened: InternalTypescriptRow[];\n visibleColumns: TypescriptColumn[];\n virtualListHelpers?: ReturnType<typeof useVirtual>;\n layoutHelpers: {\n totalColumnsWidth?: number | string;\n gridLayout: string[];\n setGridLayout: React.Dispatch<React.SetStateAction<string[]>>;\n };\n paginationHelpers: TypescriptPagination;\n drilldownRowId: string | null;\n setDrilldownRowId: React.Dispatch<React.SetStateAction<string | null>>;\n focusedRowId: string | null;\n setFocusedRowId: React.Dispatch<React.SetStateAction<string | null>>;\n reduxHeaders: Record<string, ReduxHeader>;\n patchHeader: (headerId: string, newHeader: ReduxHeader) => void;\n patchHeaderFilterButtonAndMenu: (headerId: string, value: boolean) => void;\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACqChB,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,8CAAA,UAAO,KAAP;AACA,EAAAA,8CAAA,YAAS,KAAT;AACA,EAAAA,8CAAA,WAAQ,KAAR;AACA,EAAAA,8CAAA,YAAS,KAAT;AAJU,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["DropIndicatorPosition"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-data-table",
|
|
3
|
-
"version": "3.8.0
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Data Table",
|
|
6
6
|
"files": [
|
|
@@ -571,23 +571,23 @@
|
|
|
571
571
|
"indent": 4
|
|
572
572
|
},
|
|
573
573
|
"dependencies": {
|
|
574
|
-
"@elliemae/ds-button": "3.8.0
|
|
575
|
-
"@elliemae/ds-circular-progress-indicator": "3.8.0
|
|
576
|
-
"@elliemae/ds-controlled-form": "3.8.0
|
|
577
|
-
"@elliemae/ds-drag-and-drop": "3.8.0
|
|
578
|
-
"@elliemae/ds-dropdownmenu": "3.8.0
|
|
579
|
-
"@elliemae/ds-form": "3.8.0
|
|
580
|
-
"@elliemae/ds-form-layout-blocks": "3.8.0
|
|
581
|
-
"@elliemae/ds-grid": "3.8.0
|
|
582
|
-
"@elliemae/ds-icons": "3.8.0
|
|
583
|
-
"@elliemae/ds-pagination": "3.8.0
|
|
584
|
-
"@elliemae/ds-pills": "3.8.0
|
|
585
|
-
"@elliemae/ds-popperjs": "3.8.0
|
|
586
|
-
"@elliemae/ds-skeleton": "3.8.0
|
|
587
|
-
"@elliemae/ds-system": "3.8.0
|
|
588
|
-
"@elliemae/ds-toolbar": "3.8.0
|
|
589
|
-
"@elliemae/ds-truncated-tooltip-text": "3.8.0
|
|
590
|
-
"@elliemae/ds-utilities": "3.8.0
|
|
574
|
+
"@elliemae/ds-button": "3.8.0",
|
|
575
|
+
"@elliemae/ds-circular-progress-indicator": "3.8.0",
|
|
576
|
+
"@elliemae/ds-controlled-form": "3.8.0",
|
|
577
|
+
"@elliemae/ds-drag-and-drop": "3.8.0",
|
|
578
|
+
"@elliemae/ds-dropdownmenu": "3.8.0",
|
|
579
|
+
"@elliemae/ds-form": "3.8.0",
|
|
580
|
+
"@elliemae/ds-form-layout-blocks": "3.8.0",
|
|
581
|
+
"@elliemae/ds-grid": "3.8.0",
|
|
582
|
+
"@elliemae/ds-icons": "3.8.0",
|
|
583
|
+
"@elliemae/ds-pagination": "3.8.0",
|
|
584
|
+
"@elliemae/ds-pills": "3.8.0",
|
|
585
|
+
"@elliemae/ds-popperjs": "3.8.0",
|
|
586
|
+
"@elliemae/ds-skeleton": "3.8.0",
|
|
587
|
+
"@elliemae/ds-system": "3.8.0",
|
|
588
|
+
"@elliemae/ds-toolbar": "3.8.0",
|
|
589
|
+
"@elliemae/ds-truncated-tooltip-text": "3.8.0",
|
|
590
|
+
"@elliemae/ds-utilities": "3.8.0",
|
|
591
591
|
"react-virtual": "~2.10.4",
|
|
592
592
|
"uid": "~2.0.0"
|
|
593
593
|
},
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/exported-related/FilterPopover.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { MutableRefObject, useCallback, useContext, useEffect, useState } from 'react';\nimport { DSButton } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { styled } from '@elliemae/ds-system';\nimport DataTableContext from '../DataTableContext';\nimport { DATA_TESTID } from '../configs/constants';\nimport { ReduxHeader, TypescriptColumn } from '../types/props';\n\nconst FilterButton = styled.span<{ hide: boolean }>`\n display: inline-grid;\n ${(props) => (props.hide ? 'opacity: 0; display: none; width: 0;' : '')}\n`;\n\nconst Button = styled(DSButton)`\n position: relative;\n justify-self: flex-end;\n`;\n\nconst PopperContent = styled.div`\n background-color: #fff;\n`;\ninterface FilterPopoverProps {\n column: TypescriptColumn;\n columnId: string;\n triggerIcon: JSX.Element;\n menuContent: JSX.Element;\n onTriggerClick?: (id: string, e: UIEvent) => void;\n onClickOutsideMenu?: (id: string, e: UIEvent) => void;\n reduxHeader: ReduxHeader;\n innerRef: MutableRefObject<HTMLDivElement>;\n ariaLabel: string;\n customStyles?: React.CSSProperties;\n}\n\nconst ButtonTrap = ({ cb }) => (\n <span\n aria-hidden=\"true\"\n tabIndex={0}\n onFocus={(e) => {\n e.stopPropagation();\n cb();\n }}\n />\n);\n\nexport const FilterPopover: React.ComponentType<FilterPopoverProps> = ({\n column,\n columnId,\n triggerIcon,\n menuContent,\n onTriggerClick = () => null,\n onClickOutsideMenu = () => null,\n reduxHeader,\n innerRef,\n ariaLabel,\n customStyles,\n}) => {\n const { hideFilterButton, hideFilterMenu } = reduxHeader || {\n hideFilterButton: true,\n hideFilterMenu: true,\n };\n const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);\n const isIconVisible = !hideFilterButton || !hideFilterMenu;\n const isMenuOpen = !hideFilterMenu;\n\n const handleClickOutsideMenu = (e) => {\n onClickOutsideMenu(columnId, e);\n if (isMenuOpen) patchHeaderFilterButtonAndMenu(columnId, true);\n };\n\n useEffect(() => {\n const closeMenu = () => {\n patchHeaderFilterButtonAndMenu(columnId, true);\n };\n window.addEventListener('blur', closeMenu);\n\n return () => {\n window.removeEventListener('blur', closeMenu);\n };\n }, [columnId, patchHeaderFilterButtonAndMenu]);\n\n const handleTriggerClick = useCallback(\n (e) => {\n onTriggerClick(columnId, e);\n patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });\n e.stopPropagation();\n },\n [columnId, isMenuOpen, onTriggerClick, patchHeader],\n );\n\n const [referenceElement, setReferenceElement] = useState(null);\n\n const buttonTrapCallback = useCallback(() => {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n referenceElement?.focus();\n }, [columnId, patchHeader, referenceElement]);\n return (\n <div\n // This is here to prevent propagation, and not trigger the sort functionality\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n e.stopPropagation();\n if (e.code === 'Escape') {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false, withTabStops: true });\n referenceElement.focus();\n }\n // Stop propagation for some reason is not enough to prevent scrolling of the datatable\n // so we just prevent default behaviour in this case\n if (['ArrowUp', 'ArrowDown'].includes(e.code)) {\n e.preventDefault();\n }\n }}\n style={{ display: 'flex' }}\n >\n <FilterButton hide={!isIconVisible} data-testid={DATA_TESTID.DATA_TABLE_FILTER_BUTTON}>\n <Button\n onClick={handleTriggerClick}\n buttonType=\"text\"\n aria-label={ariaLabel}\n aria-hidden={reduxHeader?.withTabStops ? \"false\" : \"true\"}\n size=\"s\"\n leftIcon={triggerIcon}\n // implement treeview mergerefs\n innerRef={(_ref) => {\n if (isIconVisible) setReferenceElement(_ref);\n innerRef.current = _ref;\n }}\n tabIndex={reduxHeader?.withTabStops ? 0 : -1}\n />\n </FilterButton>\n {referenceElement && (\n <DSPopperJS\n referenceElement={referenceElement}\n showPopover={isMenuOpen}\n closeContextMenu={handleClickOutsideMenu}\n data-testid={DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT}\n startPlacementPreference=\"bottom-end\"\n customOffset={[5, 4]}\n withoutArrow\n withoutAnimation\n extraPopperStyles={{\n ...customStyles,\n minWidth: column.ref?.current?.offsetWidth ?? '0px',\n }}\n placementOrderPreference={['bottom-end']}\n >\n <PopperContent>\n <ButtonTrap cb={buttonTrapCallback} />\n {menuContent}\n <ButtonTrap cb={buttonTrapCallback} />\n </PopperContent>\n </DSPopperJS>\n )}\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["DataTableContext"]
|
|
7
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useContext, useEffect, useState } from "react";
|
|
4
|
-
import { DSButton } from "@elliemae/ds-button";
|
|
5
|
-
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
6
|
-
import { styled } from "@elliemae/ds-system";
|
|
7
|
-
import DataTableContext from "../DataTableContext";
|
|
8
|
-
import { DATA_TESTID } from "../configs/constants";
|
|
9
|
-
const FilterButton = styled.span`
|
|
10
|
-
display: inline-grid;
|
|
11
|
-
${(props) => props.hide ? "opacity: 0; display: none; width: 0;" : ""}
|
|
12
|
-
`;
|
|
13
|
-
const Button = styled(DSButton)`
|
|
14
|
-
position: relative;
|
|
15
|
-
justify-self: flex-end;
|
|
16
|
-
`;
|
|
17
|
-
const PopperContent = styled.div`
|
|
18
|
-
background-color: #fff;
|
|
19
|
-
`;
|
|
20
|
-
const ButtonTrap = ({ cb }) => /* @__PURE__ */ jsx("span", {
|
|
21
|
-
"aria-hidden": "true",
|
|
22
|
-
tabIndex: 0,
|
|
23
|
-
onFocus: (e) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
cb();
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const FilterPopover = ({
|
|
29
|
-
column,
|
|
30
|
-
columnId,
|
|
31
|
-
triggerIcon,
|
|
32
|
-
menuContent,
|
|
33
|
-
onTriggerClick = () => null,
|
|
34
|
-
onClickOutsideMenu = () => null,
|
|
35
|
-
reduxHeader,
|
|
36
|
-
innerRef,
|
|
37
|
-
ariaLabel,
|
|
38
|
-
customStyles
|
|
39
|
-
}) => {
|
|
40
|
-
const { hideFilterButton, hideFilterMenu } = reduxHeader || {
|
|
41
|
-
hideFilterButton: true,
|
|
42
|
-
hideFilterMenu: true
|
|
43
|
-
};
|
|
44
|
-
const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);
|
|
45
|
-
const isIconVisible = !hideFilterButton || !hideFilterMenu;
|
|
46
|
-
const isMenuOpen = !hideFilterMenu;
|
|
47
|
-
const handleClickOutsideMenu = (e) => {
|
|
48
|
-
onClickOutsideMenu(columnId, e);
|
|
49
|
-
if (isMenuOpen)
|
|
50
|
-
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
51
|
-
};
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
const closeMenu = () => {
|
|
54
|
-
patchHeaderFilterButtonAndMenu(columnId, true);
|
|
55
|
-
};
|
|
56
|
-
window.addEventListener("blur", closeMenu);
|
|
57
|
-
return () => {
|
|
58
|
-
window.removeEventListener("blur", closeMenu);
|
|
59
|
-
};
|
|
60
|
-
}, [columnId, patchHeaderFilterButtonAndMenu]);
|
|
61
|
-
const handleTriggerClick = useCallback(
|
|
62
|
-
(e) => {
|
|
63
|
-
onTriggerClick(columnId, e);
|
|
64
|
-
patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });
|
|
65
|
-
e.stopPropagation();
|
|
66
|
-
},
|
|
67
|
-
[columnId, isMenuOpen, onTriggerClick, patchHeader]
|
|
68
|
-
);
|
|
69
|
-
const [referenceElement, setReferenceElement] = useState(null);
|
|
70
|
-
const buttonTrapCallback = useCallback(() => {
|
|
71
|
-
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });
|
|
72
|
-
referenceElement?.focus();
|
|
73
|
-
}, [columnId, patchHeader, referenceElement]);
|
|
74
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
75
|
-
onClick: (e) => e.stopPropagation(),
|
|
76
|
-
onKeyDown: (e) => {
|
|
77
|
-
e.stopPropagation();
|
|
78
|
-
if (e.code === "Escape") {
|
|
79
|
-
patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false, withTabStops: true });
|
|
80
|
-
referenceElement.focus();
|
|
81
|
-
}
|
|
82
|
-
if (["ArrowUp", "ArrowDown"].includes(e.code)) {
|
|
83
|
-
e.preventDefault();
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
style: { display: "flex" },
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ jsx(FilterButton, {
|
|
89
|
-
hide: !isIconVisible,
|
|
90
|
-
"data-testid": DATA_TESTID.DATA_TABLE_FILTER_BUTTON,
|
|
91
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
92
|
-
onClick: handleTriggerClick,
|
|
93
|
-
buttonType: "text",
|
|
94
|
-
"aria-label": ariaLabel,
|
|
95
|
-
"aria-hidden": reduxHeader?.withTabStops ? "false" : "true",
|
|
96
|
-
size: "s",
|
|
97
|
-
leftIcon: triggerIcon,
|
|
98
|
-
innerRef: (_ref) => {
|
|
99
|
-
if (isIconVisible)
|
|
100
|
-
setReferenceElement(_ref);
|
|
101
|
-
innerRef.current = _ref;
|
|
102
|
-
},
|
|
103
|
-
tabIndex: reduxHeader?.withTabStops ? 0 : -1
|
|
104
|
-
})
|
|
105
|
-
}),
|
|
106
|
-
referenceElement && /* @__PURE__ */ jsx(DSPopperJS, {
|
|
107
|
-
referenceElement,
|
|
108
|
-
showPopover: isMenuOpen,
|
|
109
|
-
closeContextMenu: handleClickOutsideMenu,
|
|
110
|
-
"data-testid": DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT,
|
|
111
|
-
startPlacementPreference: "bottom-end",
|
|
112
|
-
customOffset: [5, 4],
|
|
113
|
-
withoutArrow: true,
|
|
114
|
-
withoutAnimation: true,
|
|
115
|
-
extraPopperStyles: {
|
|
116
|
-
...customStyles,
|
|
117
|
-
minWidth: column.ref?.current?.offsetWidth ?? "0px"
|
|
118
|
-
},
|
|
119
|
-
placementOrderPreference: ["bottom-end"],
|
|
120
|
-
children: /* @__PURE__ */ jsxs(PopperContent, {
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ jsx(ButtonTrap, {
|
|
123
|
-
cb: buttonTrapCallback
|
|
124
|
-
}),
|
|
125
|
-
menuContent,
|
|
126
|
-
/* @__PURE__ */ jsx(ButtonTrap, {
|
|
127
|
-
cb: buttonTrapCallback
|
|
128
|
-
})
|
|
129
|
-
]
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
]
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
export {
|
|
136
|
-
FilterPopover
|
|
137
|
-
};
|
|
138
|
-
//# sourceMappingURL=FilterPopover.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/FilterPopover.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { MutableRefObject, useCallback, useContext, useEffect, useState } from 'react';\nimport { DSButton } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { styled } from '@elliemae/ds-system';\nimport DataTableContext from '../DataTableContext';\nimport { DATA_TESTID } from '../configs/constants';\nimport { ReduxHeader, TypescriptColumn } from '../types/props';\n\nconst FilterButton = styled.span<{ hide: boolean }>`\n display: inline-grid;\n ${(props) => (props.hide ? 'opacity: 0; display: none; width: 0;' : '')}\n`;\n\nconst Button = styled(DSButton)`\n position: relative;\n justify-self: flex-end;\n`;\n\nconst PopperContent = styled.div`\n background-color: #fff;\n`;\ninterface FilterPopoverProps {\n column: TypescriptColumn;\n columnId: string;\n triggerIcon: JSX.Element;\n menuContent: JSX.Element;\n onTriggerClick?: (id: string, e: UIEvent) => void;\n onClickOutsideMenu?: (id: string, e: UIEvent) => void;\n reduxHeader: ReduxHeader;\n innerRef: MutableRefObject<HTMLDivElement>;\n ariaLabel: string;\n customStyles?: React.CSSProperties;\n}\n\nconst ButtonTrap = ({ cb }) => (\n <span\n aria-hidden=\"true\"\n tabIndex={0}\n onFocus={(e) => {\n e.stopPropagation();\n cb();\n }}\n />\n);\n\nexport const FilterPopover: React.ComponentType<FilterPopoverProps> = ({\n column,\n columnId,\n triggerIcon,\n menuContent,\n onTriggerClick = () => null,\n onClickOutsideMenu = () => null,\n reduxHeader,\n innerRef,\n ariaLabel,\n customStyles,\n}) => {\n const { hideFilterButton, hideFilterMenu } = reduxHeader || {\n hideFilterButton: true,\n hideFilterMenu: true,\n };\n const { patchHeaderFilterButtonAndMenu, patchHeader } = useContext(DataTableContext);\n const isIconVisible = !hideFilterButton || !hideFilterMenu;\n const isMenuOpen = !hideFilterMenu;\n\n const handleClickOutsideMenu = (e) => {\n onClickOutsideMenu(columnId, e);\n if (isMenuOpen) patchHeaderFilterButtonAndMenu(columnId, true);\n };\n\n useEffect(() => {\n const closeMenu = () => {\n patchHeaderFilterButtonAndMenu(columnId, true);\n };\n window.addEventListener('blur', closeMenu);\n\n return () => {\n window.removeEventListener('blur', closeMenu);\n };\n }, [columnId, patchHeaderFilterButtonAndMenu]);\n\n const handleTriggerClick = useCallback(\n (e) => {\n onTriggerClick(columnId, e);\n patchHeader(columnId, { hideFilterMenu: isMenuOpen, hideFilterButton: false });\n e.stopPropagation();\n },\n [columnId, isMenuOpen, onTriggerClick, patchHeader],\n );\n\n const [referenceElement, setReferenceElement] = useState(null);\n\n const buttonTrapCallback = useCallback(() => {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false });\n referenceElement?.focus();\n }, [columnId, patchHeader, referenceElement]);\n return (\n <div\n // This is here to prevent propagation, and not trigger the sort functionality\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n e.stopPropagation();\n if (e.code === 'Escape') {\n patchHeader(columnId, { hideFilterMenu: true, hideFilterButton: false, withTabStops: true });\n referenceElement.focus();\n }\n // Stop propagation for some reason is not enough to prevent scrolling of the datatable\n // so we just prevent default behaviour in this case\n if (['ArrowUp', 'ArrowDown'].includes(e.code)) {\n e.preventDefault();\n }\n }}\n style={{ display: 'flex' }}\n >\n <FilterButton hide={!isIconVisible} data-testid={DATA_TESTID.DATA_TABLE_FILTER_BUTTON}>\n <Button\n onClick={handleTriggerClick}\n buttonType=\"text\"\n aria-label={ariaLabel}\n aria-hidden={reduxHeader?.withTabStops ? \"false\" : \"true\"}\n size=\"s\"\n leftIcon={triggerIcon}\n // implement treeview mergerefs\n innerRef={(_ref) => {\n if (isIconVisible) setReferenceElement(_ref);\n innerRef.current = _ref;\n }}\n tabIndex={reduxHeader?.withTabStops ? 0 : -1}\n />\n </FilterButton>\n {referenceElement && (\n <DSPopperJS\n referenceElement={referenceElement}\n showPopover={isMenuOpen}\n closeContextMenu={handleClickOutsideMenu}\n data-testid={DATA_TESTID.DATA_TABLE_FILTER_MENU_CONTENT}\n startPlacementPreference=\"bottom-end\"\n customOffset={[5, 4]}\n withoutArrow\n withoutAnimation\n extraPopperStyles={{\n ...customStyles,\n minWidth: column.ref?.current?.offsetWidth ?? '0px',\n }}\n placementOrderPreference={['bottom-end']}\n >\n <PopperContent>\n <ButtonTrap cb={buttonTrapCallback} />\n {menuContent}\n <ButtonTrap cb={buttonTrapCallback} />\n </PopperContent>\n </DSPopperJS>\n )}\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|