@hitachivantara/uikit-react-core 5.97.0 → 5.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/AppSwitcher/Action/Action.cjs +4 -1
- package/dist/cjs/BaseRadio/BaseRadio.cjs +2 -2
- package/dist/cjs/BaseSwitch/BaseSwitch.cjs +2 -2
- package/dist/cjs/Card/Header/Header.styles.cjs +3 -1
- package/dist/cjs/CheckBox/CheckBox.cjs +2 -2
- package/dist/cjs/ColorPicker/Fields/Fields.cjs +0 -1
- package/dist/cjs/ColorPicker/Fields/Fields.styles.cjs +1 -3
- package/dist/cjs/ColorPicker/Picker/Picker.cjs +0 -1
- package/dist/cjs/ColorPicker/Picker/Picker.styles.cjs +1 -3
- package/dist/cjs/ColorPicker/PresetColors/PresetColors.cjs +0 -1
- package/dist/cjs/ColorPicker/PresetColors/PresetColors.styles.cjs +1 -3
- package/dist/cjs/ColorPicker/SavedColors/SavedColors.cjs +0 -1
- package/dist/cjs/ColorPicker/SavedColors/SavedColors.styles.cjs +1 -3
- package/dist/cjs/Dialog/Content/Content.cjs +26 -0
- package/dist/cjs/Dialog/Content/Content.styles.cjs +5 -2
- package/dist/cjs/Dialog/Dialog.styles.cjs +3 -1
- package/dist/cjs/Dialog/Title/Title.cjs +2 -2
- package/dist/cjs/DropdownButton/DropdownButton.cjs +2 -2
- package/dist/cjs/QueryBuilder/ConfirmationDialog.cjs +32 -0
- package/dist/cjs/QueryBuilder/QueryBuilder.cjs +4 -4
- package/dist/cjs/QueryBuilder/Rule/{Attribute/Attribute.cjs → Attribute.cjs} +3 -4
- package/dist/cjs/QueryBuilder/Rule/{Operator/Operator.cjs → Operator.cjs} +3 -4
- package/dist/cjs/QueryBuilder/Rule/Rule.cjs +3 -4
- package/dist/cjs/QueryBuilder/Rule/Rule.styles.cjs +46 -50
- package/dist/cjs/QueryBuilder/{RuleGroup/RuleGroup.cjs → RuleGroup.cjs} +9 -9
- package/dist/cjs/QueryBuilder/{Rule/Value/BooleanValue → Value}/BooleanValue.cjs +3 -5
- package/dist/cjs/QueryBuilder/{Rule/Value/DateTimeValue → Value}/DateTimeValue.cjs +67 -40
- package/dist/cjs/QueryBuilder/{Rule/Value/EmptyValue → Value}/EmptyValue.cjs +1 -1
- package/dist/cjs/QueryBuilder/{Rule/Value/NumericValue → Value}/NumericValue.cjs +33 -8
- package/dist/cjs/QueryBuilder/{Rule/Value/TextValue → Value}/TextValue.cjs +9 -5
- package/dist/cjs/QueryBuilder/{Rule/Value → Value}/Value.cjs +7 -9
- package/dist/cjs/Radio/Radio.cjs +3 -3
- package/dist/cjs/Section/Section.cjs +43 -18
- package/dist/cjs/Section/Section.styles.cjs +14 -2
- package/dist/cjs/Select/Select.cjs +2 -2
- package/dist/cjs/StatusIcon/StatusIcon.cjs +45 -0
- package/dist/cjs/StatusIcon/StatusIcon.styles.cjs +57 -0
- package/dist/cjs/Switch/Switch.cjs +1 -1
- package/dist/cjs/Table/TableSection/TableSection.styles.cjs +1 -7
- package/dist/cjs/TagsInput/TagsInput.cjs +2 -2
- package/dist/cjs/TextArea/TextArea.cjs +2 -2
- package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +2 -2
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/providers/Provider.cjs +1 -4
- package/dist/cjs/themes/ds3.cjs +23 -0
- package/dist/cjs/themes/ds5.cjs +31 -0
- package/dist/cjs/themes/pentahoPlus.cjs +52 -24
- package/dist/cjs/utils/Callout.cjs +10 -5
- package/dist/esm/AppSwitcher/Action/Action.js +4 -1
- package/dist/esm/BaseRadio/BaseRadio.js +2 -2
- package/dist/esm/BaseSwitch/BaseSwitch.js +2 -2
- package/dist/esm/Card/Header/Header.styles.js +3 -1
- package/dist/esm/CheckBox/CheckBox.js +2 -2
- package/dist/esm/ColorPicker/Fields/Fields.js +1 -3
- package/dist/esm/ColorPicker/Fields/Fields.styles.js +1 -3
- package/dist/esm/ColorPicker/Picker/Picker.js +1 -3
- package/dist/esm/ColorPicker/Picker/Picker.styles.js +1 -3
- package/dist/esm/ColorPicker/PresetColors/PresetColors.js +1 -3
- package/dist/esm/ColorPicker/PresetColors/PresetColors.styles.js +1 -3
- package/dist/esm/ColorPicker/SavedColors/SavedColors.js +1 -3
- package/dist/esm/ColorPicker/SavedColors/SavedColors.styles.js +1 -3
- package/dist/esm/Dialog/Content/Content.js +27 -1
- package/dist/esm/Dialog/Content/Content.styles.js +5 -2
- package/dist/esm/Dialog/Dialog.styles.js +3 -1
- package/dist/esm/Dialog/Title/Title.js +3 -3
- package/dist/esm/DropdownButton/DropdownButton.js +2 -2
- package/dist/esm/QueryBuilder/ConfirmationDialog.js +32 -0
- package/dist/esm/QueryBuilder/QueryBuilder.js +4 -4
- package/dist/esm/QueryBuilder/Rule/{Attribute/Attribute.js → Attribute.js} +4 -5
- package/dist/esm/QueryBuilder/Rule/{Operator/Operator.js → Operator.js} +4 -5
- package/dist/esm/QueryBuilder/Rule/Rule.js +4 -6
- package/dist/esm/QueryBuilder/Rule/Rule.styles.js +47 -51
- package/dist/esm/QueryBuilder/{RuleGroup/RuleGroup.js → RuleGroup.js} +9 -9
- package/dist/esm/QueryBuilder/{Rule/Value/BooleanValue → Value}/BooleanValue.js +3 -5
- package/dist/esm/QueryBuilder/{Rule/Value/DateTimeValue → Value}/DateTimeValue.js +63 -35
- package/dist/esm/QueryBuilder/{Rule/Value/EmptyValue → Value}/EmptyValue.js +1 -1
- package/dist/esm/QueryBuilder/{Rule/Value/NumericValue → Value}/NumericValue.js +33 -8
- package/dist/esm/QueryBuilder/{Rule/Value/TextValue → Value}/TextValue.js +9 -5
- package/dist/esm/QueryBuilder/{Rule/Value → Value}/Value.js +7 -9
- package/dist/esm/Radio/Radio.js +3 -3
- package/dist/esm/Section/Section.js +44 -19
- package/dist/esm/Section/Section.styles.js +14 -2
- package/dist/esm/Select/Select.js +2 -2
- package/dist/esm/StatusIcon/StatusIcon.js +46 -0
- package/dist/esm/StatusIcon/StatusIcon.styles.js +57 -0
- package/dist/esm/Switch/Switch.js +1 -1
- package/dist/esm/Table/TableSection/TableSection.styles.js +1 -7
- package/dist/esm/TagsInput/TagsInput.js +2 -2
- package/dist/esm/TextArea/TextArea.js +2 -2
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +2 -2
- package/dist/esm/index.js +63 -59
- package/dist/esm/providers/Provider.js +2 -5
- package/dist/esm/themes/ds3.js +23 -0
- package/dist/esm/themes/ds5.js +31 -0
- package/dist/esm/themes/pentahoPlus.js +52 -24
- package/dist/esm/utils/Callout.js +10 -5
- package/dist/types/index.d.ts +159 -114
- package/package.json +6 -6
- package/dist/cjs/QueryBuilder/ConfirmationDialog/ConfirmationDialog.cjs +0 -53
- package/dist/cjs/QueryBuilder/ConfirmationDialog/ConfirmationDialog.styles.cjs +0 -11
- package/dist/cjs/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.styles.cjs +0 -37
- package/dist/cjs/QueryBuilder/Rule/Value/DateTimeValue/utils.cjs +0 -36
- package/dist/cjs/QueryBuilder/Rule/Value/NumericValue/Numeric.styles.cjs +0 -34
- package/dist/cjs/QueryBuilder/Rule/Value/TextValue/TextValue.styles.cjs +0 -13
- package/dist/esm/QueryBuilder/ConfirmationDialog/ConfirmationDialog.js +0 -53
- package/dist/esm/QueryBuilder/ConfirmationDialog/ConfirmationDialog.styles.js +0 -11
- package/dist/esm/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.styles.js +0 -37
- package/dist/esm/QueryBuilder/Rule/Value/DateTimeValue/utils.js +0 -34
- package/dist/esm/QueryBuilder/Rule/Value/NumericValue/Numeric.styles.js +0 -34
- package/dist/esm/QueryBuilder/Rule/Value/TextValue/TextValue.styles.js +0 -13
|
@@ -4,13 +4,13 @@ import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
|
4
4
|
import { useControlled } from "../hooks/useControlled.js";
|
|
5
5
|
import { useLabels } from "../hooks/useLabels.js";
|
|
6
6
|
import { isEqual } from "../utils/helpers.js";
|
|
7
|
+
import { ConfirmationDialog } from "./ConfirmationDialog.js";
|
|
7
8
|
import { defaultOperators, defaultCombinators, HvQueryBuilderProvider, defaultLabels } from "./Context.js";
|
|
8
9
|
import { useClasses } from "./QueryBuilder.styles.js";
|
|
9
10
|
import { staticClasses } from "./QueryBuilder.styles.js";
|
|
11
|
+
import { RuleGroup } from "./RuleGroup.js";
|
|
10
12
|
import { emptyGroup, setNodeIds, clearNodeIds } from "./utils/index.js";
|
|
11
13
|
import reducer from "./utils/reducer.js";
|
|
12
|
-
import { RuleGroup } from "./RuleGroup/RuleGroup.js";
|
|
13
|
-
import { ConfirmationDialog } from "./ConfirmationDialog/ConfirmationDialog.js";
|
|
14
14
|
const HvQueryBuilder = (props) => {
|
|
15
15
|
const {
|
|
16
16
|
attributes,
|
|
@@ -131,14 +131,14 @@ const HvQueryBuilder = (props) => {
|
|
|
131
131
|
/* @__PURE__ */ jsx(
|
|
132
132
|
ConfirmationDialog,
|
|
133
133
|
{
|
|
134
|
-
|
|
134
|
+
open: pendingAction != null,
|
|
135
135
|
onConfirm: handleConfirm,
|
|
136
136
|
onCancel: handleCancel,
|
|
137
137
|
title: pendingAction?.dialog.dialogTitle,
|
|
138
138
|
message: pendingAction?.dialog.dialogMessage,
|
|
139
139
|
confirmButtonLabel: pendingAction?.dialog.dialogConfirm,
|
|
140
140
|
cancelButtonLabel: pendingAction?.dialog.dialogCancel,
|
|
141
|
-
|
|
141
|
+
buttonTitle: pendingAction?.dialog.dialogCloseTooltip
|
|
142
142
|
}
|
|
143
143
|
)
|
|
144
144
|
] });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo
|
|
3
|
-
import { useQueryBuilderContext } from "
|
|
4
|
-
import { isBigList } from "
|
|
5
|
-
import { HvDropdown } from "
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
4
|
+
import { isBigList } from "../utils/index.js";
|
|
5
|
+
import { HvDropdown } from "../../Dropdown/Dropdown.js";
|
|
6
6
|
const Attribute = ({
|
|
7
7
|
id,
|
|
8
8
|
attribute,
|
|
@@ -60,7 +60,6 @@ const Attribute = ({
|
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
62
|
};
|
|
63
|
-
memo(Attribute);
|
|
64
63
|
export {
|
|
65
64
|
Attribute
|
|
66
65
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo
|
|
3
|
-
import { useQueryBuilderContext } from "
|
|
4
|
-
import { isBigList } from "
|
|
5
|
-
import { HvDropdown } from "
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
4
|
+
import { isBigList } from "../utils/index.js";
|
|
5
|
+
import { HvDropdown } from "../../Dropdown/Dropdown.js";
|
|
6
6
|
const Operator = ({
|
|
7
7
|
id,
|
|
8
8
|
combinator,
|
|
@@ -55,7 +55,6 @@ const Operator = ({
|
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
};
|
|
58
|
-
memo(Operator);
|
|
59
58
|
export {
|
|
60
59
|
Operator
|
|
61
60
|
};
|
|
@@ -5,12 +5,11 @@ import useMediaQuery from "@mui/material/useMediaQuery";
|
|
|
5
5
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
6
6
|
import { HvIcon } from "../../icons.js";
|
|
7
7
|
import { useQueryBuilderContext } from "../Context.js";
|
|
8
|
+
import { Value } from "../Value/Value.js";
|
|
9
|
+
import { Attribute } from "./Attribute.js";
|
|
10
|
+
import { Operator } from "./Operator.js";
|
|
8
11
|
import { useClasses } from "./Rule.styles.js";
|
|
9
|
-
import { staticClasses } from "./Rule.styles.js";
|
|
10
12
|
import { HvGrid } from "../../Grid/Grid.js";
|
|
11
|
-
import { Attribute } from "./Attribute/Attribute.js";
|
|
12
|
-
import { Operator } from "./Operator/Operator.js";
|
|
13
|
-
import { Value } from "./Value/Value.js";
|
|
14
13
|
import { HvIconButton } from "../../IconButton/IconButton.js";
|
|
15
14
|
const Rule = (props) => {
|
|
16
15
|
const {
|
|
@@ -100,6 +99,5 @@ const Rule = (props) => {
|
|
|
100
99
|
);
|
|
101
100
|
};
|
|
102
101
|
export {
|
|
103
|
-
Rule
|
|
104
|
-
staticClasses as queryBuilderRuleClasses
|
|
102
|
+
Rule
|
|
105
103
|
};
|
|
@@ -1,60 +1,56 @@
|
|
|
1
1
|
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
|
-
import { staticClasses
|
|
4
|
-
const { useClasses
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"&>div:not(:last-child)": {
|
|
12
|
-
paddingRight: theme.space.md
|
|
13
|
-
},
|
|
14
|
-
// hide required * as all fields are required
|
|
15
|
-
"& label>span[aria-hidden]": {
|
|
16
|
-
visibility: "hidden"
|
|
17
|
-
},
|
|
18
|
-
"&::before": {
|
|
19
|
-
content: '""',
|
|
20
|
-
position: "absolute",
|
|
21
|
-
zIndex: 2,
|
|
22
|
-
width: "17px",
|
|
23
|
-
height: "44px",
|
|
24
|
-
borderBottom: `1px solid ${theme.colors.border}`,
|
|
25
|
-
borderLeft: `1px solid ${theme.colors.border}`,
|
|
26
|
-
top: 0,
|
|
27
|
-
left: `calc(-1 * 17px)`
|
|
28
|
-
},
|
|
29
|
-
[`:not(.${staticClasses$1.topRulesContainer})>&:last-child::after`]: {
|
|
30
|
-
content: '""',
|
|
31
|
-
position: "absolute",
|
|
32
|
-
zIndex: 1,
|
|
33
|
-
width: "17px",
|
|
34
|
-
height: "100%",
|
|
35
|
-
borderLeft: `1px solid ${theme.colors.border}`,
|
|
36
|
-
top: 0,
|
|
37
|
-
left: `calc(-1 * 17px)`
|
|
38
|
-
}
|
|
3
|
+
import { staticClasses } from "../QueryBuilder.styles.js";
|
|
4
|
+
const { useClasses } = createClasses("HvQueryBuilderRule", {
|
|
5
|
+
root: {
|
|
6
|
+
position: "relative",
|
|
7
|
+
marginTop: theme.space.xs,
|
|
8
|
+
minHeight: 94,
|
|
9
|
+
"&>div:not(:last-child)": {
|
|
10
|
+
paddingRight: theme.space.md
|
|
39
11
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"&>:not(:last-child)": {
|
|
44
|
-
marginRight: theme.space.xs
|
|
45
|
-
}
|
|
12
|
+
// hide required * as all fields are required
|
|
13
|
+
"& label>span[aria-hidden]": {
|
|
14
|
+
visibility: "hidden"
|
|
46
15
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
16
|
+
"&::before": {
|
|
17
|
+
content: '""',
|
|
18
|
+
position: "absolute",
|
|
19
|
+
zIndex: 2,
|
|
20
|
+
width: "17px",
|
|
21
|
+
height: "44px",
|
|
22
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
23
|
+
borderLeft: `1px solid ${theme.colors.border}`,
|
|
24
|
+
top: 0,
|
|
25
|
+
left: `calc(-1 * 17px)`
|
|
26
|
+
},
|
|
27
|
+
[`:not(.${staticClasses.topRulesContainer})>&:last-child::after`]: {
|
|
28
|
+
content: '""',
|
|
29
|
+
position: "absolute",
|
|
30
|
+
zIndex: 1,
|
|
31
|
+
width: "17px",
|
|
32
|
+
height: "100%",
|
|
33
|
+
borderLeft: `1px solid ${theme.colors.border}`,
|
|
34
|
+
top: 0,
|
|
35
|
+
left: `calc(-1 * 17px)`
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
actionsContainer: {
|
|
39
|
+
marginLeft: "auto",
|
|
40
|
+
marginTop: "24px",
|
|
41
|
+
"&>:not(:last-child)": {
|
|
42
|
+
marginRight: theme.space.xs
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
isMdDown: {
|
|
46
|
+
"&>div:not(:last-child)": {
|
|
47
|
+
paddingRight: 0
|
|
48
|
+
},
|
|
49
|
+
"&>div:not(:first-of-type)": {
|
|
50
|
+
marginTop: theme.space.xs
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
);
|
|
53
|
+
});
|
|
57
54
|
export {
|
|
58
|
-
staticClasses,
|
|
59
55
|
useClasses
|
|
60
56
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { HvIcon } from "
|
|
4
|
-
import { useQueryBuilderContext } from "
|
|
5
|
-
import { useClasses } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { HvEmptyState } from "
|
|
9
|
-
import { HvMultiButton } from "
|
|
10
|
-
import { HvIconButton } from "
|
|
11
|
-
import { HvTypography } from "
|
|
3
|
+
import { HvIcon } from "../icons.js";
|
|
4
|
+
import { useQueryBuilderContext } from "./Context.js";
|
|
5
|
+
import { useClasses } from "./QueryBuilder.styles.js";
|
|
6
|
+
import { Rule } from "./Rule/Rule.js";
|
|
7
|
+
import { HvButton } from "../Button/Button.js";
|
|
8
|
+
import { HvEmptyState } from "../EmptyState/EmptyState.js";
|
|
9
|
+
import { HvMultiButton } from "../MultiButton/MultiButton.js";
|
|
10
|
+
import { HvIconButton } from "../IconButton/IconButton.js";
|
|
11
|
+
import { HvTypography } from "../Typography/Typography.js";
|
|
12
12
|
const RuleGroup = ({
|
|
13
13
|
level = 0,
|
|
14
14
|
id,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { HvDropdown } from "../../../../Dropdown/Dropdown.js";
|
|
2
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
3
|
+
import { isBigList } from "../utils/index.js";
|
|
4
|
+
import { HvDropdown } from "../../Dropdown/Dropdown.js";
|
|
6
5
|
const BooleanValue = ({ id, value = true }) => {
|
|
7
6
|
const { labels, dispatchAction, readOnly } = useQueryBuilderContext();
|
|
8
7
|
const values = ["true", "false"].map((v) => ({
|
|
@@ -36,7 +35,6 @@ const BooleanValue = ({ id, value = true }) => {
|
|
|
36
35
|
}
|
|
37
36
|
);
|
|
38
37
|
};
|
|
39
|
-
memo(BooleanValue);
|
|
40
38
|
export {
|
|
41
39
|
BooleanValue
|
|
42
40
|
};
|
|
@@ -1,18 +1,63 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useMemo
|
|
2
|
+
import { useState, useCallback, useMemo } from "react";
|
|
3
3
|
import { useTheme } from "@mui/material/styles";
|
|
4
4
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return operator === "range";
|
|
5
|
+
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
6
|
+
import { theme } from "@hitachivantara/uikit-styles";
|
|
7
|
+
import { uniqueId } from "../../utils/helpers.js";
|
|
8
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
9
|
+
import { HvDatePicker } from "../../DatePicker/DatePicker.js";
|
|
10
|
+
import { HvTimePicker } from "../../TimePicker/TimePicker.js";
|
|
11
|
+
import { HvWarningText } from "../../FormElement/WarningText/WarningText.js";
|
|
12
|
+
function formatDate(date) {
|
|
13
|
+
return date?.toISOString().slice(0, 10);
|
|
15
14
|
}
|
|
15
|
+
function formatTime(time) {
|
|
16
|
+
if (!time) return void 0;
|
|
17
|
+
const { hours, minutes, seconds } = time;
|
|
18
|
+
const date = new Date(Date.UTC(2020, 8, 8, hours, minutes, seconds));
|
|
19
|
+
return date.toISOString().slice(11, 19);
|
|
20
|
+
}
|
|
21
|
+
function parseDate(date) {
|
|
22
|
+
return date ? new Date(date) : void 0;
|
|
23
|
+
}
|
|
24
|
+
function parseTime(time) {
|
|
25
|
+
if (!time) return null;
|
|
26
|
+
const parts = time.split(":");
|
|
27
|
+
return {
|
|
28
|
+
hours: Number(parts[0]),
|
|
29
|
+
minutes: Number(parts[1]),
|
|
30
|
+
seconds: Number(parts[2]) || 0
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const { useClasses } = createClasses("HvQueryBuilderDateTimeValue", {
|
|
34
|
+
root: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexDirection: "column"
|
|
37
|
+
},
|
|
38
|
+
row: {},
|
|
39
|
+
vertical: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column"
|
|
42
|
+
},
|
|
43
|
+
horizontal: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
"& > div:not(:last-child)": {
|
|
46
|
+
marginRight: theme.space.md
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
isMdDown: {
|
|
50
|
+
"& > div:not(:last-child)": {
|
|
51
|
+
marginRight: `calc(${theme.space.md} / 2)`
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
datePicker: {
|
|
55
|
+
flex: 1
|
|
56
|
+
},
|
|
57
|
+
timePicker: {
|
|
58
|
+
flex: 1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
16
61
|
const DateTimeValue = ({
|
|
17
62
|
id,
|
|
18
63
|
operator,
|
|
@@ -20,9 +65,9 @@ const DateTimeValue = ({
|
|
|
20
65
|
initialTouched = false
|
|
21
66
|
}) => {
|
|
22
67
|
const { classes, cx } = useClasses();
|
|
23
|
-
const
|
|
24
|
-
const isMdDown = useMediaQuery(
|
|
25
|
-
const isRange =
|
|
68
|
+
const theme2 = useTheme();
|
|
69
|
+
const isMdDown = useMediaQuery(theme2.breakpoints.down("md"));
|
|
70
|
+
const isRange = operator === "range";
|
|
26
71
|
const { labels, dispatchAction, readOnly } = useQueryBuilderContext();
|
|
27
72
|
const elementId = uniqueId(`datetime${id}`);
|
|
28
73
|
const [touchedDate, setTouchedDate] = useState(initialTouched);
|
|
@@ -32,10 +77,7 @@ const DateTimeValue = ({
|
|
|
32
77
|
const onDateChange = useCallback(
|
|
33
78
|
(data) => {
|
|
34
79
|
setTouchedDate(true);
|
|
35
|
-
|
|
36
|
-
if (data != null) {
|
|
37
|
-
date = dayjs(data).format("YYYY-MM-DD");
|
|
38
|
-
}
|
|
80
|
+
const date = formatDate(data);
|
|
39
81
|
const oldValue = !isRange ? valueProp?.date : valueProp?.start?.date;
|
|
40
82
|
if (date !== oldValue) {
|
|
41
83
|
let value;
|
|
@@ -65,12 +107,7 @@ const DateTimeValue = ({
|
|
|
65
107
|
const onTimeChange = useCallback(
|
|
66
108
|
(data) => {
|
|
67
109
|
setTouchedTime(true);
|
|
68
|
-
|
|
69
|
-
if (data != null) {
|
|
70
|
-
time = `${padTime(data.hours)}:${padTime(data.minutes)}:${padTime(
|
|
71
|
-
data.seconds
|
|
72
|
-
)}`;
|
|
73
|
-
}
|
|
110
|
+
const time = formatTime(data);
|
|
74
111
|
const oldValue = !isRange ? valueProp?.time : valueProp?.start?.time;
|
|
75
112
|
if (time !== oldValue) {
|
|
76
113
|
let value;
|
|
@@ -100,10 +137,7 @@ const DateTimeValue = ({
|
|
|
100
137
|
const onEndDateChange = useCallback(
|
|
101
138
|
(data) => {
|
|
102
139
|
setTouchedEndDate(true);
|
|
103
|
-
|
|
104
|
-
if (data != null) {
|
|
105
|
-
date = dayjs(data).format("YYYY-MM-DD");
|
|
106
|
-
}
|
|
140
|
+
const date = formatDate(data);
|
|
107
141
|
if (date !== valueProp?.end?.date) {
|
|
108
142
|
const value = {
|
|
109
143
|
start: valueProp?.start,
|
|
@@ -124,12 +158,7 @@ const DateTimeValue = ({
|
|
|
124
158
|
const onEndTimeChange = useCallback(
|
|
125
159
|
(data) => {
|
|
126
160
|
setTouchedEndTime(true);
|
|
127
|
-
|
|
128
|
-
if (data != null) {
|
|
129
|
-
time = `${padTime(data.hours)}:${padTime(data.minutes)}:${padTime(
|
|
130
|
-
data.seconds
|
|
131
|
-
)}`;
|
|
132
|
-
}
|
|
161
|
+
const time = formatTime(data);
|
|
133
162
|
if (time !== valueProp?.end?.time) {
|
|
134
163
|
const value = {
|
|
135
164
|
start: valueProp?.start,
|
|
@@ -274,7 +303,6 @@ const DateTimeValue = ({
|
|
|
274
303
|
] })
|
|
275
304
|
] });
|
|
276
305
|
};
|
|
277
|
-
memo(DateTimeValue);
|
|
278
306
|
export {
|
|
279
307
|
DateTimeValue
|
|
280
308
|
};
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
3
|
import { useTheme } from "@mui/material/styles";
|
|
4
4
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
6
|
+
import { theme } from "@hitachivantara/uikit-styles";
|
|
7
|
+
import { uniqueId } from "../../utils/helpers.js";
|
|
8
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
9
|
+
import { HvInput } from "../../Input/Input.js";
|
|
10
|
+
const { useClasses } = createClasses("HvQueryBuilderNumericValue", {
|
|
11
|
+
root: {},
|
|
12
|
+
label: {
|
|
13
|
+
paddingBottom: "6px"
|
|
14
|
+
},
|
|
15
|
+
inputContainer: {},
|
|
16
|
+
rangeContainer: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
"& $inputContainer": {
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
overflow: "auto"
|
|
21
|
+
},
|
|
22
|
+
"& > $inputContainer:not(:last-child)": {
|
|
23
|
+
marginRight: theme.space.md
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
input: {
|
|
27
|
+
flexGrow: 1
|
|
28
|
+
},
|
|
29
|
+
isMdDown: {
|
|
30
|
+
"& > $inputContainer:not(:last-child)": {
|
|
31
|
+
marginRight: `calc(${theme.space.md} / 2)`
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
9
35
|
const NumericValue = ({
|
|
10
36
|
id,
|
|
11
37
|
value,
|
|
@@ -15,8 +41,8 @@ const NumericValue = ({
|
|
|
15
41
|
const { classes, cx } = useClasses();
|
|
16
42
|
const isRange = operator === "range";
|
|
17
43
|
const { labels, dispatchAction, readOnly } = useQueryBuilderContext();
|
|
18
|
-
const
|
|
19
|
-
const isMdDown = useMediaQuery(
|
|
44
|
+
const theme2 = useTheme();
|
|
45
|
+
const isMdDown = useMediaQuery(theme2.breakpoints.down("md"));
|
|
20
46
|
const onSingleValueChange = useCallback(
|
|
21
47
|
(event, data) => {
|
|
22
48
|
dispatchAction({
|
|
@@ -177,7 +203,6 @@ const NumericValue = ({
|
|
|
177
203
|
) })
|
|
178
204
|
] });
|
|
179
205
|
};
|
|
180
|
-
memo(NumericValue);
|
|
181
206
|
export {
|
|
182
207
|
NumericValue
|
|
183
208
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { HvInput } from "
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
4
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
5
|
+
import { HvInput } from "../../Input/Input.js";
|
|
6
|
+
const { useClasses } = createClasses("HvQueryBuilderTextValue", {
|
|
7
|
+
location: {
|
|
8
|
+
flexGrow: 1
|
|
9
|
+
}
|
|
10
|
+
});
|
|
6
11
|
const TextValue = ({
|
|
7
12
|
id,
|
|
8
13
|
value = "",
|
|
@@ -46,7 +51,6 @@ const TextValue = ({
|
|
|
46
51
|
}
|
|
47
52
|
);
|
|
48
53
|
};
|
|
49
|
-
memo(TextValue);
|
|
50
54
|
export {
|
|
51
55
|
TextValue
|
|
52
56
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { BooleanValue } from "./BooleanValue/BooleanValue.js";
|
|
2
|
+
import { useQueryBuilderContext } from "../Context.js";
|
|
3
|
+
import { defaultRendererKey } from "../types.js";
|
|
4
|
+
import { BooleanValue } from "./BooleanValue.js";
|
|
5
|
+
import { DateTimeValue } from "./DateTimeValue.js";
|
|
6
|
+
import { EmptyValue } from "./EmptyValue.js";
|
|
7
|
+
import { NumericValue } from "./NumericValue.js";
|
|
8
|
+
import { TextValue } from "./TextValue.js";
|
|
10
9
|
const getRenderer = (renderer, operator) => (
|
|
11
10
|
// 1. Custom renderer
|
|
12
11
|
typeof renderer === "function" && renderer || // 2. Custom operator renderer
|
|
@@ -70,7 +69,6 @@ const Value = ({
|
|
|
70
69
|
return /* @__PURE__ */ jsx(TextValue, { id, value: valueProp, initialTouched });
|
|
71
70
|
}
|
|
72
71
|
};
|
|
73
|
-
memo(Value);
|
|
74
72
|
export {
|
|
75
73
|
Value
|
|
76
74
|
};
|
package/dist/esm/Radio/Radio.js
CHANGED
|
@@ -114,11 +114,11 @@ const HvRadio = forwardRef(
|
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
116
|
className: cx(classes.container, {
|
|
117
|
-
[classes.disabled]: disabled,
|
|
118
117
|
[classes.focusVisible]: !!(focusVisible && label),
|
|
119
|
-
[classes.
|
|
118
|
+
[classes.semantic]: semantic,
|
|
120
119
|
[classes.checked]: isChecked,
|
|
121
|
-
[classes.
|
|
120
|
+
[classes.invalidContainer]: isStateInvalid,
|
|
121
|
+
[classes.disabled]: disabled
|
|
122
122
|
}),
|
|
123
123
|
children: [
|
|
124
124
|
radio,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { forwardRef, useRef } from "react";
|
|
3
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
4
4
|
import { useExpandable } from "../hooks/useExpandable.js";
|
|
5
5
|
import { HvIcon } from "../icons.js";
|
|
@@ -15,6 +15,7 @@ const HvSection = forwardRef(
|
|
|
15
15
|
title,
|
|
16
16
|
expandable,
|
|
17
17
|
expanded,
|
|
18
|
+
expandableHeader,
|
|
18
19
|
defaultExpanded = true,
|
|
19
20
|
actions,
|
|
20
21
|
onToggle,
|
|
@@ -25,6 +26,7 @@ const HvSection = forwardRef(
|
|
|
25
26
|
...others
|
|
26
27
|
} = useDefaultProps("HvSection", props);
|
|
27
28
|
const { classes, cx } = useClasses(classesProp);
|
|
29
|
+
const expandButtonRef = useRef(null);
|
|
28
30
|
const { isOpen, toggleOpen, buttonProps, regionProps } = useExpandable({
|
|
29
31
|
id,
|
|
30
32
|
expanded,
|
|
@@ -41,24 +43,47 @@ const HvSection = forwardRef(
|
|
|
41
43
|
}),
|
|
42
44
|
...others,
|
|
43
45
|
children: [
|
|
44
|
-
hasHeader && /* @__PURE__ */ jsxs(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
hasHeader && /* @__PURE__ */ jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: cx(classes.header, {
|
|
50
|
+
[classes.headerExpandable]: expandable && expandableHeader
|
|
51
|
+
}),
|
|
52
|
+
onClick: () => {
|
|
53
|
+
if (!expandableHeader) return;
|
|
54
|
+
expandButtonRef.current?.click();
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
expandable && /* @__PURE__ */ jsx(
|
|
58
|
+
HvButton,
|
|
59
|
+
{
|
|
60
|
+
ref: expandButtonRef,
|
|
61
|
+
icon: true,
|
|
62
|
+
onClick: (event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
toggleOpen();
|
|
65
|
+
onToggle?.(event, !isOpen);
|
|
66
|
+
},
|
|
67
|
+
"aria-label": isOpen ? "Collapse" : "Expand",
|
|
68
|
+
...buttonProps,
|
|
69
|
+
...expandButtonProps,
|
|
70
|
+
children: /* @__PURE__ */ jsx(HvIcon, { name: "CaretDown", size: "xs", rotate: isOpen })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
title,
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: classes.actions,
|
|
78
|
+
onClick: (evt) => {
|
|
79
|
+
evt.stopPropagation();
|
|
80
|
+
},
|
|
81
|
+
children: actions
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
62
87
|
/* @__PURE__ */ jsx(
|
|
63
88
|
"div",
|
|
64
89
|
{
|
|
@@ -7,6 +7,7 @@ const { staticClasses, useClasses } = createClasses("HvSection", {
|
|
|
7
7
|
flexDirection: "column",
|
|
8
8
|
backgroundColor: theme.colors.bgContainer,
|
|
9
9
|
borderRadius: theme.radii.round,
|
|
10
|
+
overflow: "hidden",
|
|
10
11
|
border: `1px solid ${theme.colors.border}`
|
|
11
12
|
},
|
|
12
13
|
hidden: { height: 0, display: "none" },
|
|
@@ -15,12 +16,23 @@ const { staticClasses, useClasses } = createClasses("HvSection", {
|
|
|
15
16
|
alignItems: "center",
|
|
16
17
|
borderColor: "inherit",
|
|
17
18
|
position: "relative",
|
|
18
|
-
padding: theme.space.sm
|
|
19
|
+
padding: theme.space.sm,
|
|
20
|
+
"+ $content": {
|
|
21
|
+
borderTopLeftRadius: 0,
|
|
22
|
+
borderTopRightRadius: 0
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
headerExpandable: {
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
":hover": {
|
|
28
|
+
backgroundColor: theme.colors.bgHover
|
|
29
|
+
}
|
|
19
30
|
},
|
|
20
31
|
content: {
|
|
21
32
|
padding: theme.space.sm,
|
|
22
33
|
borderRadius: "inherit",
|
|
23
|
-
borderColor: "inherit"
|
|
34
|
+
borderColor: "inherit",
|
|
35
|
+
flex: 1
|
|
24
36
|
},
|
|
25
37
|
hasHeader: {
|
|
26
38
|
paddingTop: 0
|