@mailstep/design-system 0.13.0-beta.1 → 0.13.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/Blocks/Header/components/UserMenu/index.js +1 -1
- package/ui/Blocks/HidePrint/HidePrint.js +1 -1
- package/ui/Blocks/ImageList/ImageList.js +1 -1
- package/ui/Blocks/LoginPage/LoginPage.js +1 -1
- package/ui/Blocks/LoginPage/components/LoginForm.js +1 -1
- package/ui/Blocks/LoginPage/components/SocialLinks.js +1 -1
- package/ui/Blocks/Modal/Modal.js +1 -1
- package/ui/Blocks/Popover/index.js +1 -1
- package/ui/Blocks/Scheduler/components/BookedTimeSlots/index.js +1 -1
- package/ui/Blocks/Scheduler/components/DateChanger/index.js +1 -1
- package/ui/Blocks/SideMenu/components/Footer.js +1 -1
- package/ui/Blocks/SideMenu/components/HamburgerMenu.js +4 -4
- package/ui/Blocks/SideMenu/components/SubitemTooltip.js +1 -1
- package/ui/Blocks/Stepper/components/StepItem/index.js +1 -1
- package/ui/Elements/Alert/Alert.js +1 -1
- package/ui/Elements/Alert/styles.js +10 -10
- package/ui/Elements/Badge/Badge.js +1 -1
- package/ui/Elements/BarChartSymbol/BarChartSymbol.js +1 -1
- package/ui/Elements/BorderedBox/BorderedBox.js +1 -1
- package/ui/Elements/DatePicker/DatePicker.js +6 -2
- package/ui/Elements/DatePicker/Datetime/components/DateRepeater.js +1 -1
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/Timepicker.js +17 -7
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/constants.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/constants.js +2 -1
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/utils/index.d.ts +1 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/utils/index.js +2 -1
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.d.ts +3 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/utils/isTimeFieldComplete.js +5 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker/utils/sanitizeTimeField.js +1 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/DatePickerInput.d.ts +6 -2
- package/ui/Elements/DatePicker/components/DatePickerInput/DatePickerInput.js +35 -6
- package/ui/Elements/DatePicker/components/DatePickerInput/constants.d.ts +5 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/constants.js +16 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/applyDateMask.d.ts +3 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/applyDateMask.js +19 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/countDigits.d.ts +3 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/countDigits.js +5 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.d.ts +3 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/getMaskedCaretPosition.js +14 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/index.d.ts +4 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/index.js +5 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/isMaskableFormat.d.ts +3 -0
- package/ui/Elements/DatePicker/components/DatePickerInput/utils/isMaskableFormat.js +9 -0
- package/ui/Elements/DatePicker/utils/getInputFormat.d.ts +3 -0
- package/ui/Elements/DatePicker/utils/getInputFormat.js +10 -0
- package/ui/Elements/Dropdown/Dropdown.js +1 -1
- package/ui/Elements/DropdownMenu/DropdownMenu.js +1 -1
- package/ui/Elements/DropdownMenu/components/DefaultItem.js +1 -1
- package/ui/Elements/DropdownMenu/components/MenuItem.js +1 -1
- package/ui/Elements/DropdownSelect/DropdownSelect.js +1 -1
- package/ui/Elements/ErrorMessage/ErrorMessage.js +1 -1
- package/ui/Elements/HighlightBox/HighlightBox.js +1 -1
- package/ui/Elements/Icon/BadgeIcon.js +1 -1
- package/ui/Elements/Icon/Icon.js +1 -1
- package/ui/Elements/Line/Line.js +1 -1
- package/ui/Elements/Link/Link.js +1 -1
- package/ui/Elements/Logo/Logo.js +1 -1
- package/ui/Elements/Select/Select.js +1 -1
- package/ui/Elements/Select/components/CountMultiValue.js +1 -1
- package/ui/Elements/Select/components/DropdownIndicator.js +1 -1
- package/ui/Elements/Select/components/IconValueContainer.js +1 -1
- package/ui/Elements/Select/components/SelectAll.js +1 -1
- package/ui/Elements/SpaceAround/SpaceAround.js +1 -1
- package/ui/Elements/Tag/stories/components/predefinedTags.js +1 -1
- package/ui/Elements/Text/Text.js +1 -1
- package/ui/Elements/Toast/Toast.js +1 -1
- package/ui/Elements/Toggle/Toggle.js +1 -1
- package/ui/Elements/Tooltip/Tooltip.js +1 -1
- package/ui/Modules/CommonGrid/CommonGrid.d.ts +1 -1
- package/ui/Modules/CommonGrid/CommonGrid.js +7 -5
- package/ui/Modules/CommonGrid/CommonGridContainer.js +4 -4
- package/ui/Modules/CommonGrid/components/ActionHead/ActionHead.js +1 -1
- package/ui/Modules/CommonGrid/components/ActionHead/components/ActionDropdownMenu.js +1 -1
- package/ui/Modules/CommonGrid/components/ActionHead/components/ActionDropdownSelect.js +1 -1
- package/ui/Modules/CommonGrid/components/ButtonMore/ButtonMore.js +1 -1
- package/ui/Modules/CommonGrid/components/ColumnFilterCell.js +3 -2
- package/ui/Modules/CommonGrid/components/ColumnTitle/ColumnTitle.js +1 -1
- package/ui/Modules/CommonGrid/components/ColumnTitle.js +1 -1
- package/ui/Modules/CommonGrid/components/ControlButtons/ControlButtons.js +1 -1
- package/ui/Modules/CommonGrid/components/DropdownButton/DropdownButton.js +1 -1
- package/ui/Modules/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +1 -1
- package/ui/Modules/CommonGrid/components/FilterDropdown.js +1 -1
- package/ui/Modules/CommonGrid/components/FilterRow.d.ts +1 -0
- package/ui/Modules/CommonGrid/components/FilterRow.js +6 -1
- package/ui/Modules/CommonGrid/components/Filters/ActionsFilter/ActionsFilter.js +1 -1
- package/ui/Modules/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +1 -1
- package/ui/Modules/CommonGrid/components/FloatingButton/FloatingButton.js +1 -1
- package/ui/Modules/CommonGrid/components/GridInfo/index.js +1 -1
- package/ui/Modules/CommonGrid/components/HeadCell.js +1 -0
- package/ui/Modules/CommonGrid/components/HeadRow.d.ts +1 -0
- package/ui/Modules/CommonGrid/components/HeadRow.js +11 -6
- package/ui/Modules/CommonGrid/components/IconList/IconList.js +1 -1
- package/ui/Modules/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +1 -1
- package/ui/Modules/CommonGrid/components/ManageColumnForm/components/ManageColumnRow.js +1 -1
- package/ui/Modules/CommonGrid/components/MobileFilterModal.js +1 -1
- package/ui/Modules/CommonGrid/components/MobileSortModal.js +1 -1
- package/ui/Modules/CommonGrid/components/OversizedScroll.js +1 -1
- package/ui/Modules/CommonGrid/components/PresetsModalBody/index.js +1 -1
- package/ui/Modules/CommonGrid/components/QuickFilter/QuickFilter.js +1 -1
- package/ui/Modules/CommonGrid/components/Resize.js +1 -1
- package/ui/Modules/CommonGrid/components/TablePagination/TablePagination.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/BoolIcon.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/EnumInCell.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/HoverBubble.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/IconButtonInCell.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/ImageCell.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/RemoveItem.js +1 -1
- package/ui/Modules/CommonGrid/components/gridCells/RowActionsCell.js +1 -1
- package/ui/Modules/CommonGrid/styles.d.ts +1 -1
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/ItemConfigControls.js +1 -1
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/components/LabelsLine.js +1 -1
- package/ui/Modules/Dashboard/components/Widgets/PieChart/PieChart.js +1 -1
- package/ui/Modules/Dashboard/errors/ErrorMessage.js +1 -1
- package/ui/ThemeProvider/ThemeProvider.js +1 -1
- package/ui/index.js +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region packages/ui/Elements/DatePicker/utils/getInputFormat.ts
|
|
2
|
+
const getInputFormat = (dateFormat, timeFormat) => {
|
|
3
|
+
const date = typeof dateFormat === "string" ? dateFormat : "";
|
|
4
|
+
const time = typeof timeFormat === "string" ? timeFormat : "";
|
|
5
|
+
if (!date) return time;
|
|
6
|
+
if (!time) return date;
|
|
7
|
+
return `${date} ${time}`;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getInputFormat };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1, { th } from "@xstyled/styled-components";
|
|
3
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import styled$1, { th } from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Elements/Dropdown/Dropdown.tsx
|
|
5
5
|
const ArrowInnerB = styled$1.div``;
|
|
6
6
|
const ArrowInnerA = styled$1.div``;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import MenuItem from "./components/DefaultItem.js";
|
|
2
2
|
import MenuList from "./components/MenuList.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import styled$1 from "@xstyled/styled-components";
|
|
5
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import styled$1 from "@xstyled/styled-components";
|
|
6
6
|
//#region packages/ui/Elements/DropdownMenu/DropdownMenu.tsx
|
|
7
7
|
const StyledDropdownWrap = styled$1.div`
|
|
8
8
|
width: fit-content;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1, { css } from "@xstyled/styled-components";
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import styled$1, { css } from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Elements/DropdownMenu/components/DefaultItem.tsx
|
|
5
5
|
const StyledListItem = styled$1.li`
|
|
6
6
|
padding: 8px 10px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Link from "../../Link/Link.js";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import styled$1, { css } from "@xstyled/styled-components";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import styled$1, { css } from "@xstyled/styled-components";
|
|
5
5
|
import { useLocation } from "react-router";
|
|
6
6
|
//#region packages/ui/Elements/DropdownMenu/components/MenuItem.tsx
|
|
7
7
|
const StyledLink = styled$1(Link)`
|
|
@@ -4,8 +4,8 @@ import { DropdownMenu } from "../DropdownMenu/DropdownMenu.js";
|
|
|
4
4
|
import "../DropdownMenu/index.js";
|
|
5
5
|
import Popover from "../../Blocks/Popover/index.js";
|
|
6
6
|
import React, { useCallback, useRef } from "react";
|
|
7
|
-
import styled$1 from "@xstyled/styled-components";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import styled$1 from "@xstyled/styled-components";
|
|
9
9
|
//#region packages/ui/Elements/DropdownSelect/DropdownSelect.tsx
|
|
10
10
|
const ArrowIcon = styled$1(Icon)`
|
|
11
11
|
flex-shrink: 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1, { css, th } from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1, { css, th } from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Elements/ErrorMessage/ErrorMessage.tsx
|
|
5
5
|
const tooltip = css`
|
|
6
6
|
span {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1, { useTheme } from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1, { useTheme } from "@xstyled/styled-components";
|
|
4
4
|
import { th as th$1 } from "@xstyled/system";
|
|
5
5
|
//#region packages/ui/Elements/HighlightBox/HighlightBox.tsx
|
|
6
6
|
const StyledHighlightBox = styled$1.div`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Icon from "./Icon.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import styled$1 from "@xstyled/styled-components";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import styled$1 from "@xstyled/styled-components";
|
|
5
5
|
//#region packages/ui/Elements/Icon/BadgeIcon.tsx
|
|
6
6
|
const Badge = styled$1(Icon)`
|
|
7
7
|
display: inline-table;
|
package/ui/Elements/Icon/Icon.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { icons_exports } from "./icons/index.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
4
5
|
import { faFacebookF } from "@fortawesome/free-brands-svg-icons/faFacebookF";
|
|
5
6
|
import { faInstagram } from "@fortawesome/free-brands-svg-icons/faInstagram";
|
|
@@ -115,7 +116,6 @@ import { faWineGlassCrack } from "@fortawesome/pro-solid-svg-icons/faWineGlassCr
|
|
|
115
116
|
import { faXmark } from "@fortawesome/pro-solid-svg-icons/faXmark";
|
|
116
117
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
117
118
|
import styled$1, { th, useTheme } from "@xstyled/styled-components";
|
|
118
|
-
import { jsx } from "react/jsx-runtime";
|
|
119
119
|
//#region packages/ui/Elements/Icon/Icon.tsx
|
|
120
120
|
const iconDictionary = {
|
|
121
121
|
greaterThan: faAngleRight,
|
package/ui/Elements/Line/Line.js
CHANGED
package/ui/Elements/Link/Link.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRgba } from "../../utils/CreateRgba/createRgba.js";
|
|
2
2
|
import "../../utils/index.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import styled$1, { css, th, useTheme } from "@xstyled/styled-components";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import styled$1, { css, th, useTheme } from "@xstyled/styled-components";
|
|
6
6
|
import { NavLink } from "react-router-dom";
|
|
7
7
|
//#region packages/ui/Elements/Link/Link.tsx
|
|
8
8
|
const StyledLink = styled$1(NavLink)`
|
package/ui/Elements/Logo/Logo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1 from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1 from "@xstyled/styled-components";
|
|
4
4
|
import logoBlackImage from "./assets/mailship/logo_black.png";
|
|
5
5
|
import logoMImage from "./assets/mailship/logo_m.png";
|
|
6
6
|
import logoWhiteImage from "./assets/mailship/logo_white.png";
|
|
@@ -6,8 +6,8 @@ import SpaceAround_default from "../SpaceAround/index.js";
|
|
|
6
6
|
import { StyledAsyncSelect, StyledReactSelect, Wrapper } from "./styles.js";
|
|
7
7
|
import { useStylesAndComponents } from "./themes/index.js";
|
|
8
8
|
import { useCallback, useMemo, useRef } from "react";
|
|
9
|
-
import { useTheme } from "@xstyled/styled-components";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useTheme } from "@xstyled/styled-components";
|
|
11
11
|
import { i18n } from "@lingui/core";
|
|
12
12
|
//#region packages/ui/Elements/Select/Select.tsx
|
|
13
13
|
const emptyOptions = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import styled$1, { th } from "@xstyled/styled-components";
|
|
2
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled$1, { th } from "@xstyled/styled-components";
|
|
3
3
|
import { components } from "react-select";
|
|
4
4
|
//#region packages/ui/Elements/Select/components/CountMultiValue.tsx
|
|
5
5
|
const StyledNumber = styled$1.div`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArrowDown } from "../../Icon/icons/ArrowDown.js";
|
|
2
2
|
import { ArrowUp } from "../../Icon/icons/ArrowUp.js";
|
|
3
|
-
import styled$1 from "@xstyled/styled-components";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import styled$1 from "@xstyled/styled-components";
|
|
5
5
|
import { components } from "react-select";
|
|
6
6
|
//#region packages/ui/Elements/Select/components/DropdownIndicator.tsx
|
|
7
7
|
const ChevronDiv = styled$1.div`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Icon from "../../Icon/Icon.js";
|
|
2
|
-
import styled$1 from "@xstyled/styled-components";
|
|
3
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import styled$1 from "@xstyled/styled-components";
|
|
4
4
|
import { components } from "react-select";
|
|
5
5
|
//#region packages/ui/Elements/Select/components/IconValueContainer.tsx
|
|
6
6
|
const IconDiv = styled$1.div`
|
|
@@ -2,8 +2,8 @@ import Checkbox_default from "../../../Forms/Checkbox/Checkbox.js";
|
|
|
2
2
|
import Toggle from "../../Toggle/Toggle.js";
|
|
3
3
|
import SelectedIndicator from "./SelectedIndicator.js";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
import styled$1, { th } from "@xstyled/styled-components";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import styled$1, { th } from "@xstyled/styled-components";
|
|
7
7
|
import { Trans } from "@lingui/react";
|
|
8
8
|
//#region packages/ui/Elements/Select/components/SelectAll.tsx
|
|
9
9
|
const SelectAllWrap = styled$1.div`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1, { css, th, useTheme, x } from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1, { css, th, useTheme, x } from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Elements/SpaceAround/SpaceAround.tsx
|
|
5
5
|
const Wrapper = styled$1(x.div)`
|
|
6
6
|
width: ${({ $marginLeft, $marginRight }) => `calc(100% - ${$marginLeft || "0px"} - ${$marginRight || "0px"})`};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Tag from "../../Tag.js";
|
|
2
2
|
import { palettes } from "../../palettes.js";
|
|
3
|
-
import { x } from "@xstyled/styled-components";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { x } from "@xstyled/styled-components";
|
|
5
5
|
//#region packages/ui/Elements/Tag/stories/components/predefinedTags.tsx
|
|
6
6
|
const PredefinedTags = () => {
|
|
7
7
|
return /* @__PURE__ */ jsx(x.div, {
|
package/ui/Elements/Text/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import { x } from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { x } from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Elements/Text/Text.tsx
|
|
5
5
|
const Text = ({ as = "span", ...props }) => /* @__PURE__ */ jsx(x.div, {
|
|
6
6
|
as,
|
|
@@ -3,8 +3,8 @@ import "../Icon/index.js";
|
|
|
3
3
|
import { toastIconFill, toastIconMap, toastTitleMap } from "./constants.js";
|
|
4
4
|
import { CloseWrapper, Container, ContentWrapper, Text, Title } from "./styles.js";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
|
-
import { x } from "@xstyled/styled-components";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { x } from "@xstyled/styled-components";
|
|
8
8
|
//#region packages/ui/Elements/Toast/Toast.tsx
|
|
9
9
|
const Toast = ({ closeToast, title, text, type, autoClose }) => {
|
|
10
10
|
const icon = toastIconMap[type];
|
|
@@ -3,8 +3,8 @@ import "../Label/index.js";
|
|
|
3
3
|
import SpaceAroundWrap from "../SpaceAround/SpaceAround.js";
|
|
4
4
|
import "../SpaceAround/index.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import styled$1, { css } from "@xstyled/styled-components";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import styled$1, { css } from "@xstyled/styled-components";
|
|
8
8
|
//#region packages/ui/Elements/Toggle/Toggle.tsx
|
|
9
9
|
const isHorizontal = (position) => !!position && ["left", "right"].includes(position);
|
|
10
10
|
const StyledSpaceAroundWrap = styled$1(SpaceAroundWrap)`
|
|
@@ -2,8 +2,8 @@ import { Paragraph4 } from "../Typography/Typography.js";
|
|
|
2
2
|
import "../Typography/index.js";
|
|
3
3
|
import Popover from "../../Blocks/Popover/index.js";
|
|
4
4
|
import { useRef, useState } from "react";
|
|
5
|
-
import styled$1 from "@xstyled/styled-components";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import styled$1 from "@xstyled/styled-components";
|
|
7
7
|
//#region packages/ui/Elements/Tooltip/Tooltip.tsx
|
|
8
8
|
const Container = styled$1.div`
|
|
9
9
|
width: fit-content;
|
|
@@ -7,7 +7,7 @@ type Props = CommonGridProps & {
|
|
|
7
7
|
displayColumnsDefinitions: ColumnDefinition[];
|
|
8
8
|
hasGroups: boolean;
|
|
9
9
|
hasFilters: boolean;
|
|
10
|
-
|
|
10
|
+
onSetActiveColumn?: (columnName: string) => void;
|
|
11
11
|
};
|
|
12
12
|
declare const CommonGrid: FC<Props>;
|
|
13
13
|
export default CommonGrid;
|
|
@@ -11,14 +11,14 @@ import useRowsKeyControls from "./hooks/useRowsKeyControls.js";
|
|
|
11
11
|
import useUxReset from "./hooks/useUxReset.js";
|
|
12
12
|
import { initialState } from "./store/index.js";
|
|
13
13
|
import { useCallback, useMemo } from "react";
|
|
14
|
-
import { x } from "@xstyled/styled-components";
|
|
15
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { x } from "@xstyled/styled-components";
|
|
16
16
|
//#region packages/ui/Modules/CommonGrid/CommonGrid.tsx
|
|
17
17
|
const rowsStyles = { outline: "none" };
|
|
18
18
|
const defaultVoidFunction = (...args) => null;
|
|
19
19
|
const defaultUxState = initialState.uxState;
|
|
20
20
|
const defaultColumnsWidth = {};
|
|
21
|
-
const CommonGrid = ({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, onAsyncLoadFilterOptions, columnLayout = "normal", displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters, isSortTerminated
|
|
21
|
+
const CommonGrid = ({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, onAsyncLoadFilterOptions, onSetActiveColumn, columnLayout = "normal", displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters, isSortTerminated }) => {
|
|
22
22
|
const { uxState = defaultUxState, columnsWidth = defaultColumnsWidth, columnsWidthVariant, page = 1, filter, sorting, rowsPerPage = 10 } = gridSelectors;
|
|
23
23
|
const { clearUxState, handleUxChange, addFilter = defaultVoidFunction, addSorting = defaultVoidFunction, setColumnWidth = defaultVoidFunction } = gridActions;
|
|
24
24
|
const handleRowsKeyDown = useRowsKeyControls(rowsData, uxState, handleUxChange);
|
|
@@ -61,7 +61,8 @@ const CommonGrid = ({ filters, comparators, handleDragEnd, gridSelectors, gridAc
|
|
|
61
61
|
handleResizeDrag,
|
|
62
62
|
groups,
|
|
63
63
|
handleDragEnd,
|
|
64
|
-
isSortTerminated
|
|
64
|
+
isSortTerminated,
|
|
65
|
+
onCellClick: onSetActiveColumn
|
|
65
66
|
}),
|
|
66
67
|
hasFilters && /* @__PURE__ */ jsx(FilterRow, {
|
|
67
68
|
filters,
|
|
@@ -75,7 +76,8 @@ const CommonGrid = ({ filters, comparators, handleDragEnd, gridSelectors, gridAc
|
|
|
75
76
|
rowsData,
|
|
76
77
|
uxState,
|
|
77
78
|
handleUxChange,
|
|
78
|
-
onAsyncLoadFilterOptions
|
|
79
|
+
onAsyncLoadFilterOptions,
|
|
80
|
+
onCellClick: onSetActiveColumn
|
|
79
81
|
})
|
|
80
82
|
]
|
|
81
83
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -94,7 +96,7 @@ const CommonGrid = ({ filters, comparators, handleDragEnd, gridSelectors, gridAc
|
|
|
94
96
|
onRowAction,
|
|
95
97
|
onUxChange: handleUxChange,
|
|
96
98
|
onRowClick,
|
|
97
|
-
onCellClick,
|
|
99
|
+
onCellClick: onSetActiveColumn,
|
|
98
100
|
columns: displayColumnsDefinitions,
|
|
99
101
|
displayColumnsWidth,
|
|
100
102
|
groups
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import HidePrint from "../../Blocks/HidePrint/HidePrint.js";
|
|
2
|
+
import { useModal } from "../../Blocks/Modal/hooks/useModal.js";
|
|
1
3
|
import Pagination from "../../Elements/Pagination/Pagination.js";
|
|
2
4
|
import "../../Elements/Pagination/index.js";
|
|
3
5
|
import { useCheckDeviceWidth } from "../../utils/CheckDeviceWidth/checkDeviceWidth.js";
|
|
4
|
-
import HidePrint from "../../Blocks/HidePrint/HidePrint.js";
|
|
5
|
-
import { useModal } from "../../Blocks/Modal/hooks/useModal.js";
|
|
6
6
|
import ActionHead_default from "./components/ActionHead/index.js";
|
|
7
7
|
import { getFilters } from "./utils/index.js";
|
|
8
8
|
import { clearShareParams } from "./utils/shareUrl/clearShareParams.js";
|
|
@@ -25,8 +25,8 @@ import { getRowsPerPage } from "./utils/getRowsPerPage.js";
|
|
|
25
25
|
import { hasSortTerminated } from "./utils/hasSortTerminated.js";
|
|
26
26
|
import { BottomWrapper, CommonGridWithStyles, CommonGridWrap, ContentContainer, StyledButtonStrip } from "./styles.js";
|
|
27
27
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
28
|
-
import { x } from "@xstyled/styled-components";
|
|
29
28
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
29
|
+
import { x } from "@xstyled/styled-components";
|
|
30
30
|
//#region packages/ui/Modules/CommonGrid/CommonGridContainer.tsx
|
|
31
31
|
const CommonGridContainer = (props) => {
|
|
32
32
|
const { optimizeFilters = false, extraControlButtons, onBatchAction, processCheckedValues, processCheckedValuesTitle, hideControlButtons, quickFilter, floatingButtonProps, queryRowsParam, customPaginationHandler, autoHeight = true, gridName, withPresets = true, withManageColumnButton = true, withPagination = true, withAggregation = true, withShare = true, allowSortingOnlyUnderTotalRows, onReload, ...passDownProps } = props;
|
|
@@ -114,7 +114,7 @@ const CommonGridContainer = (props) => {
|
|
|
114
114
|
hasFilters,
|
|
115
115
|
hasGroups,
|
|
116
116
|
isSortTerminated,
|
|
117
|
-
|
|
117
|
+
onSetActiveColumn: setActiveColumnName,
|
|
118
118
|
hasColouredRows: true
|
|
119
119
|
})]
|
|
120
120
|
}), /* @__PURE__ */ jsxs(BottomWrapper, {
|
|
@@ -4,8 +4,8 @@ import { useGridActionTrigger } from "../../hooks/useGridActionTrigger.js";
|
|
|
4
4
|
import { useToggleAllCheckbox } from "../../hooks/useToggleAllCheckbox.js";
|
|
5
5
|
import ButtonMore from "../ButtonMore/ButtonMore.js";
|
|
6
6
|
import { useCallback, useMemo } from "react";
|
|
7
|
-
import styled$1 from "@xstyled/styled-components";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import styled$1 from "@xstyled/styled-components";
|
|
9
9
|
import { i18n } from "@lingui/core";
|
|
10
10
|
import { Trans } from "@lingui/react";
|
|
11
11
|
//#region packages/ui/Modules/CommonGrid/components/ActionHead/ActionHead.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import styled$1 from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1 from "@xstyled/styled-components";
|
|
4
4
|
import { th as th$1 } from "@xstyled/system";
|
|
5
5
|
//#region packages/ui/Modules/CommonGrid/components/ActionHead/components/ActionDropdownMenu.tsx
|
|
6
6
|
const StyledDropdownWrap = styled$1.div`
|
|
@@ -2,8 +2,8 @@ import Icon from "../../../../../Elements/Icon/Icon.js";
|
|
|
2
2
|
import Popover from "../../../../../Blocks/Popover/index.js";
|
|
3
3
|
import ActionDropdownMenu from "./ActionDropdownMenu.js";
|
|
4
4
|
import React, { memo, useRef } from "react";
|
|
5
|
-
import styled$1 from "@xstyled/styled-components";
|
|
6
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import styled$1 from "@xstyled/styled-components";
|
|
7
7
|
import { th as th$1 } from "@xstyled/system";
|
|
8
8
|
import { Trans } from "@lingui/react";
|
|
9
9
|
//#region packages/ui/Modules/CommonGrid/components/ActionHead/components/ActionDropdownSelect.tsx
|
|
@@ -3,8 +3,8 @@ import { DropdownMenu } from "../../../../Elements/DropdownMenu/DropdownMenu.js"
|
|
|
3
3
|
import "../../../../Elements/DropdownMenu/index.js";
|
|
4
4
|
import { useClickOutside } from "../../../../Blocks/Modal/hooks/useClickOutside.js";
|
|
5
5
|
import { useCallback, useState } from "react";
|
|
6
|
-
import styled$1 from "@xstyled/styled-components";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import styled$1 from "@xstyled/styled-components";
|
|
8
8
|
//#region packages/ui/Modules/CommonGrid/components/ButtonMore/ButtonMore.tsx
|
|
9
9
|
const ButtonWrapper = styled$1.div`
|
|
10
10
|
position: relative;
|
|
@@ -3,8 +3,8 @@ import { useAddFilter } from "../hooks/useAddFilter.js";
|
|
|
3
3
|
import { Cell } from "./Table.js";
|
|
4
4
|
import OverlayComponent from "./FilterDropdown.js";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { x } from "@xstyled/styled-components";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { x } from "@xstyled/styled-components";
|
|
8
8
|
//#region packages/ui/Modules/CommonGrid/components/ColumnFilterCell.tsx
|
|
9
9
|
const ColumnFilterCell = ({ onChange, value, others, displayColumnWidth, filters, column: columnDefinition, group, comparators, actionColumn, rowsData, uxState, handleUxChange, onAsyncLoadFilterOptions }) => {
|
|
10
10
|
const cellSizeProps = getCellSizeProps(columnDefinition, displayColumnWidth);
|
|
@@ -28,6 +28,7 @@ const ColumnFilterCell = ({ onChange, value, others, displayColumnWidth, filters
|
|
|
28
28
|
return /* @__PURE__ */ jsx(Cell, {
|
|
29
29
|
className: cellClassName,
|
|
30
30
|
...cellSizeProps,
|
|
31
|
+
"data-column-name": columnDefinition.name,
|
|
31
32
|
children: /* @__PURE__ */ jsx(x.div, { children: /* @__PURE__ */ jsx(RenderComponent, {
|
|
32
33
|
asyncLoadKey: columnDefinition.asyncLoadKey,
|
|
33
34
|
"data-test": columnDefinition.name,
|
|
@@ -44,7 +45,7 @@ const ColumnFilterCell = ({ onChange, value, others, displayColumnWidth, filters
|
|
|
44
45
|
onAsyncLoadFilterOptions,
|
|
45
46
|
...filterConfig?.defaultExtraProps,
|
|
46
47
|
...columnDefinition.filterExtraProps,
|
|
47
|
-
...filterType
|
|
48
|
+
...filterType === "options" && { options: columnDefinition.filterOptions },
|
|
48
49
|
columnWidth: cellSizeProps?.flexBasis
|
|
49
50
|
}) })
|
|
50
51
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Icon from "../../../../Elements/Icon/Icon.js";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
import styled$1, { css, x } from "@xstyled/styled-components";
|
|
4
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import styled$1, { css, x } from "@xstyled/styled-components";
|
|
5
5
|
//#region packages/ui/Modules/CommonGrid/components/ColumnTitle/ColumnTitle.tsx
|
|
6
6
|
const WRAPPER_WIDTH = 35;
|
|
7
7
|
const Wrap = styled$1.div`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SortingDown, SortingUp } from "./icons/Sorting.js";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import styled$1, { th, useTheme } from "@xstyled/styled-components";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import styled$1, { th, useTheme } from "@xstyled/styled-components";
|
|
5
5
|
//#region packages/ui/Modules/CommonGrid/components/ColumnTitle.tsx
|
|
6
6
|
const Title = styled$1.span`
|
|
7
7
|
& + * {
|
|
@@ -14,8 +14,8 @@ import ExtraControlButtons_default from "../ExtraControlButtons/index.js";
|
|
|
14
14
|
import QuickFilter_default from "../QuickFilter/index.js";
|
|
15
15
|
import { ControlButtonsContainer, CopiedMessage, Left, Right, ShareButtonWrapper, StyledColumnButton } from "./styles.js";
|
|
16
16
|
import { useEffect, useMemo } from "react";
|
|
17
|
-
import { useColor, x } from "@xstyled/styled-components";
|
|
18
17
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { useColor, x } from "@xstyled/styled-components";
|
|
19
19
|
import { i18n } from "@lingui/core";
|
|
20
20
|
import { Trans } from "@lingui/react";
|
|
21
21
|
//#region packages/ui/Modules/CommonGrid/components/ControlButtons/ControlButtons.tsx
|
|
@@ -6,8 +6,8 @@ import { DropdownMenu } from "../../../../Elements/DropdownMenu/DropdownMenu.js"
|
|
|
6
6
|
import "../../../../Elements/DropdownMenu/index.js";
|
|
7
7
|
import { useClickOutside } from "../../../../Blocks/Modal/hooks/useClickOutside.js";
|
|
8
8
|
import React, { useCallback, useState } from "react";
|
|
9
|
-
import styled$1 from "@xstyled/styled-components";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import styled$1 from "@xstyled/styled-components";
|
|
11
11
|
import { th as th$1 } from "@xstyled/system";
|
|
12
12
|
//#region packages/ui/Modules/CommonGrid/components/DropdownButton/DropdownButton.tsx
|
|
13
13
|
const ButtonWrapper = styled$1.div`
|
|
@@ -2,8 +2,8 @@ import Button from "../../../../Elements/Button/Button.js";
|
|
|
2
2
|
import ButtonMore from "../ButtonMore/ButtonMore.js";
|
|
3
3
|
import DropdownSelect_default from "../../../../Elements/DropdownSelect/index.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import styled$1, { x } from "@xstyled/styled-components";
|
|
6
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
|
+
import styled$1, { x } from "@xstyled/styled-components";
|
|
7
7
|
//#region packages/ui/Modules/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.tsx
|
|
8
8
|
const Row = styled$1.div`
|
|
9
9
|
display: flex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styled$1 from "@xstyled/styled-components";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import styled$1 from "@xstyled/styled-components";
|
|
4
4
|
//#region packages/ui/Modules/CommonGrid/components/FilterDropdown.tsx
|
|
5
5
|
const OverlayWrapper = styled$1.div`
|
|
6
6
|
position: absolute;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { getFilterName } from "../utils/index.js";
|
|
2
2
|
import { Row } from "./Table.js";
|
|
3
3
|
import ColumnFilterCell from "./ColumnFilterCell.js";
|
|
4
|
+
import { useCallback } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import get from "lodash/fp/get";
|
|
6
7
|
import throttle from "lodash/throttle";
|
|
7
8
|
//#region packages/ui/Modules/CommonGrid/components/FilterRow.tsx
|
|
8
|
-
const FilterRow = ({ columns, groups, actionColumn, onChange, filterValues = {}, displayColumnsWidth, filters, comparators, handleUxChange, onAsyncLoadFilterOptions, rowsData, uxState }) => {
|
|
9
|
+
const FilterRow = ({ columns, groups, actionColumn, onChange, filterValues = {}, displayColumnsWidth, filters, comparators, handleUxChange, onAsyncLoadFilterOptions, onCellClick, rowsData, uxState }) => {
|
|
9
10
|
const handleOnChange = throttle(onChange, 500);
|
|
10
11
|
return /* @__PURE__ */ jsx(Row, {
|
|
11
12
|
className: "filterRow",
|
|
13
|
+
onMouseDown: useCallback((e) => {
|
|
14
|
+
const columnName = e.target.closest(".cell")?.dataset?.columnName;
|
|
15
|
+
if (columnName) onCellClick?.(columnName);
|
|
16
|
+
}, [onCellClick]),
|
|
12
17
|
children: columns.map((column, index) => /* @__PURE__ */ jsx(ColumnFilterCell, {
|
|
13
18
|
column,
|
|
14
19
|
actionColumn,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useToggleAllCheckbox } from "../../../hooks/useToggleAllCheckbox.js";
|
|
2
2
|
import Checkbox_default from "../../../../../Forms/Checkbox/index.js";
|
|
3
|
-
import { x } from "@xstyled/styled-components";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { x } from "@xstyled/styled-components";
|
|
5
5
|
//#region packages/ui/Modules/CommonGrid/components/Filters/ActionsFilter/ActionsFilter.tsx
|
|
6
6
|
const ActionsFilter = ({ actionColumn, rowsData, uxState, handleUxChange }) => {
|
|
7
7
|
const [allChecked, toggleCheckbox] = useToggleAllCheckbox(rowsData, uxState, handleUxChange);
|
|
@@ -4,8 +4,8 @@ import DatePicker_default from "../../../../../Elements/DatePicker/index.js";
|
|
|
4
4
|
import { getCleanValues } from "./utils/getCleanValues.js";
|
|
5
5
|
import { pickerRangeToString } from "./utils/pickerRangeToString.js";
|
|
6
6
|
import React, { useCallback, useMemo, useState } from "react";
|
|
7
|
-
import styled$1, { css } from "@xstyled/styled-components";
|
|
8
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import styled$1, { css } from "@xstyled/styled-components";
|
|
9
9
|
import { i18n } from "@lingui/core";
|
|
10
10
|
import { DateTime } from "luxon";
|
|
11
11
|
//#region packages/ui/Modules/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.tsx
|
|
@@ -2,8 +2,8 @@ import { DropdownMenu } from "../../../../Elements/DropdownMenu/DropdownMenu.js"
|
|
|
2
2
|
import "../../../../Elements/DropdownMenu/index.js";
|
|
3
3
|
import Popover from "../../../../Blocks/Popover/index.js";
|
|
4
4
|
import { useCallback, useRef, useState } from "react";
|
|
5
|
-
import styled$1 from "@xstyled/styled-components";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import styled$1 from "@xstyled/styled-components";
|
|
7
7
|
//#region packages/ui/Modules/CommonGrid/components/FloatingButton/FloatingButton.tsx
|
|
8
8
|
const FloatingWrapper = styled$1.div`
|
|
9
9
|
display: block;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Icon from "../../../../Elements/Icon/Icon.js";
|
|
2
2
|
import "../../../../Elements/Icon/index.js";
|
|
3
|
-
import { x } from "@xstyled/styled-components";
|
|
4
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { x } from "@xstyled/styled-components";
|
|
5
5
|
import { Trans } from "@lingui/react";
|
|
6
6
|
//#region packages/ui/Modules/CommonGrid/components/GridInfo/index.tsx
|
|
7
7
|
const GridInfo = ({ isSortTerminatedAppeal, isSortTerminated }) => {
|
|
@@ -21,6 +21,7 @@ const HeadCell = ({ column, isDragDisabled, displayColumnsWidth, onResizeOut, on
|
|
|
21
21
|
transition,
|
|
22
22
|
transform: CSS.Transform.toString(transform),
|
|
23
23
|
ref: setNodeRef,
|
|
24
|
+
"data-column-name": column.name,
|
|
24
25
|
children: [/* @__PURE__ */ jsx(ColumnTitle_default, {
|
|
25
26
|
title: column?.title,
|
|
26
27
|
isSortable: !!column.sorting && !isSortTerminated,
|
|
@@ -2,7 +2,7 @@ import { getCellSizeProps, getStickyCollClassNames } from "../utils/index.js";
|
|
|
2
2
|
import { Cell, Row } from "./Table.js";
|
|
3
3
|
import ColumnTitle_default from "./ColumnTitle.js";
|
|
4
4
|
import { HeadCell } from "./HeadCell.js";
|
|
5
|
-
import
|
|
5
|
+
import { useCallback, useEffect, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { SortableContext, horizontalListSortingStrategy } from "@dnd-kit/sortable";
|
|
8
8
|
import { DndContext, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
@@ -19,24 +19,28 @@ const getStickyComponent = (columns, stickyTo, displayColumnsWidth) => columns?.
|
|
|
19
19
|
})
|
|
20
20
|
}, column.name);
|
|
21
21
|
});
|
|
22
|
-
const HeadRow = ({ columns, onAddSort, handleDragEnd, sortingValues = [], displayColumnsWidth, columnLayout, handleResizeDrag, groups, isSortTerminated }) => {
|
|
22
|
+
const HeadRow = ({ columns, onAddSort, handleDragEnd, sortingValues = [], displayColumnsWidth, columnLayout, handleResizeDrag, groups, isSortTerminated, onCellClick }) => {
|
|
23
23
|
const [showUIElements, setShowUIElements] = useState(false);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
setShowUIElements(true);
|
|
26
26
|
}, []);
|
|
27
27
|
const [isDragDisabled, setIsDragDisabled] = useState(false);
|
|
28
|
-
const onResizeOver =
|
|
28
|
+
const onResizeOver = useCallback(() => {
|
|
29
29
|
setIsDragDisabled(true);
|
|
30
30
|
}, [setIsDragDisabled]);
|
|
31
|
-
const onResizeOut =
|
|
31
|
+
const onResizeOut = useCallback(() => {
|
|
32
32
|
setIsDragDisabled(false);
|
|
33
33
|
}, [setIsDragDisabled]);
|
|
34
|
-
const onResize =
|
|
34
|
+
const onResize = useCallback((name) => (width) => {
|
|
35
35
|
handleResizeDrag?.(name, width);
|
|
36
36
|
}, [handleResizeDrag]);
|
|
37
|
-
const onSetSort =
|
|
37
|
+
const onSetSort = useCallback((name, systemName) => (value) => {
|
|
38
38
|
onAddSort?.(systemName || name, value);
|
|
39
39
|
}, [onAddSort]);
|
|
40
|
+
const onRowClick = useCallback((e) => {
|
|
41
|
+
const columnName = e.target.closest(".cell")?.dataset?.columnName;
|
|
42
|
+
if (columnName) onCellClick?.(columnName);
|
|
43
|
+
}, [onCellClick]);
|
|
40
44
|
const sensors = useSensors(useSensor(PointerSensor));
|
|
41
45
|
return /* @__PURE__ */ jsx(Fragment, { children: showUIElements && /* @__PURE__ */ jsx(DndContext, {
|
|
42
46
|
sensors,
|
|
@@ -47,6 +51,7 @@ const HeadRow = ({ columns, onAddSort, handleDragEnd, sortingValues = [], displa
|
|
|
47
51
|
strategy: horizontalListSortingStrategy,
|
|
48
52
|
children: /* @__PURE__ */ jsxs(Row, {
|
|
49
53
|
className: "headRow",
|
|
54
|
+
onMouseDown: onRowClick,
|
|
50
55
|
children: [
|
|
51
56
|
getStickyComponent(columns, "left", displayColumnsWidth),
|
|
52
57
|
columns.filter((item) => !item.sticky).map((column, index) => /* @__PURE__ */ jsx(HeadCell, {
|