@hybridcore/ui 1.6.17 → 1.6.18
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.
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as s, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Select as y, MenuItem as u, Checkbox as o, ListItemText as h } from "@mui/material";
|
|
3
|
+
const c = "__ALL__", P = (d) => {
|
|
4
|
+
const { value: m, options: l, onChange: a, variant: p = "outlined" } = d, t = m.listOfPossibleValues ?? [], r = l.length > 0 && t.length === l.length, g = t.length > 0 && !r;
|
|
5
|
+
return /* @__PURE__ */ s(
|
|
6
|
+
y,
|
|
7
|
+
{
|
|
8
|
+
multiple: !0,
|
|
9
|
+
size: "small",
|
|
10
|
+
fullWidth: !0,
|
|
11
|
+
displayEmpty: !0,
|
|
12
|
+
variant: p,
|
|
13
|
+
value: t,
|
|
14
|
+
onChange: (e) => {
|
|
15
|
+
const i = e.target.value;
|
|
16
|
+
if (i.includes(c)) {
|
|
17
|
+
a({ listOfPossibleValues: r ? [] : [...l] });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
a({ listOfPossibleValues: i });
|
|
21
|
+
},
|
|
22
|
+
MenuProps: { PaperProps: { sx: { maxHeight: 320 } } },
|
|
23
|
+
renderValue: (e) => e.length === 0 ? "Select values" : e.length === l.length ? "All values" : e.length <= 2 ? e.join(", ") : `${e.length} of ${l.length} selected`,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ s(u, { dense: !0, value: c, children: [
|
|
26
|
+
/* @__PURE__ */ n(
|
|
27
|
+
o,
|
|
28
|
+
{
|
|
29
|
+
size: "small",
|
|
30
|
+
sx: { py: 0.25, pl: 0, mr: 0.5 },
|
|
31
|
+
checked: r,
|
|
32
|
+
indeterminate: g
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ n(
|
|
36
|
+
h,
|
|
37
|
+
{
|
|
38
|
+
primary: "Select All",
|
|
39
|
+
primaryTypographyProps: { variant: "body2" }
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] }),
|
|
43
|
+
l.map((e) => /* @__PURE__ */ s(u, { dense: !0, value: e, children: [
|
|
44
|
+
/* @__PURE__ */ n(
|
|
45
|
+
o,
|
|
46
|
+
{
|
|
47
|
+
size: "small",
|
|
48
|
+
sx: { py: 0.25, pl: 0, mr: 0.5 },
|
|
49
|
+
checked: t.includes(e)
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ n(
|
|
53
|
+
h,
|
|
54
|
+
{
|
|
55
|
+
primary: e,
|
|
56
|
+
primaryTypographyProps: { variant: "body2" }
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }, e))
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
P as EnumRange
|
|
66
|
+
};
|
|
@@ -1,65 +1,75 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { CompositeListRange as
|
|
4
|
-
import { DateRange as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import g from "lodash";
|
|
3
|
+
import { CompositeListRange as u } from "./components/composite-list-range/index.js";
|
|
4
|
+
import { DateRange as f } from "./components/date-range/index.js";
|
|
5
|
+
import { EnumRange as c } from "./components/enum-range/index.js";
|
|
6
|
+
import { GeometryRange as R } from "./components/geometry-range/index.js";
|
|
7
|
+
import { NumberRange as D } from "./components/number-range/index.js";
|
|
8
|
+
import { StringRange as x } from "./components/string-range/index.js";
|
|
9
|
+
import { useRangeSelectorLogic as y } from "./logic.js";
|
|
10
|
+
import { RangeSelectorRoot as b } from "./styled.js";
|
|
11
|
+
const L = (t) => {
|
|
12
|
+
const { state: r } = y(t), { ownerState: l } = r, { type: e, value: i, mapboxAccessToken: o, onChange: m, sx: s } = t;
|
|
12
13
|
let a = null;
|
|
13
14
|
return e === "byte" || e === "double" || e === "integer" || e === "long" ? a = /* @__PURE__ */ n(
|
|
14
|
-
|
|
15
|
+
D,
|
|
15
16
|
{
|
|
16
|
-
value:
|
|
17
|
+
value: i || {
|
|
17
18
|
minValue: "",
|
|
18
19
|
maxValue: ""
|
|
19
20
|
},
|
|
20
|
-
onChange:
|
|
21
|
+
onChange: m
|
|
21
22
|
}
|
|
22
23
|
) : e === "string" || e === "text" ? a = /* @__PURE__ */ n(
|
|
23
|
-
|
|
24
|
+
x,
|
|
24
25
|
{
|
|
25
|
-
value:
|
|
26
|
+
value: i || {
|
|
26
27
|
listOfPossibleValues: []
|
|
27
28
|
},
|
|
28
|
-
onChange:
|
|
29
|
+
onChange: m
|
|
29
30
|
}
|
|
30
|
-
) : e === "
|
|
31
|
+
) : e === "enum" ? a = /* @__PURE__ */ n(
|
|
31
32
|
c,
|
|
32
33
|
{
|
|
33
|
-
value:
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
value: i || {
|
|
35
|
+
listOfPossibleValues: []
|
|
36
|
+
},
|
|
37
|
+
options: t.enumValues || [],
|
|
38
|
+
onChange: m
|
|
39
|
+
}
|
|
40
|
+
) : e === "geometry" ? a = /* @__PURE__ */ n(
|
|
41
|
+
R,
|
|
42
|
+
{
|
|
43
|
+
value: i || { geometryArea: "" },
|
|
44
|
+
mapboxAccessToken: o,
|
|
45
|
+
onChange: m
|
|
36
46
|
}
|
|
37
47
|
) : e === "date" ? a = /* @__PURE__ */ n(
|
|
38
|
-
|
|
48
|
+
f,
|
|
39
49
|
{
|
|
40
|
-
value:
|
|
41
|
-
startDate:
|
|
50
|
+
value: i || {
|
|
51
|
+
startDate: g.get(t, "minDate", ""),
|
|
42
52
|
timeUnit: "MINUTE",
|
|
43
53
|
endRange: 0,
|
|
44
54
|
startRange: 0,
|
|
45
55
|
limitForScenarioTimeRange: !1
|
|
46
56
|
},
|
|
47
|
-
onChange:
|
|
57
|
+
onChange: m,
|
|
48
58
|
minDate: t.minDate || "",
|
|
49
59
|
maxDate: t.maxDate || ""
|
|
50
60
|
}
|
|
51
61
|
) : e === "composite-list" && (a = /* @__PURE__ */ n(
|
|
52
|
-
|
|
62
|
+
u,
|
|
53
63
|
{
|
|
54
|
-
value:
|
|
55
|
-
mapboxAccessToken:
|
|
56
|
-
onChange:
|
|
64
|
+
value: i || { count: "" },
|
|
65
|
+
mapboxAccessToken: o,
|
|
66
|
+
onChange: m,
|
|
57
67
|
innerType: t.innerType,
|
|
58
68
|
minDate: t.minDate,
|
|
59
69
|
maxDate: t.maxDate
|
|
60
70
|
}
|
|
61
|
-
)), /* @__PURE__ */ n(
|
|
71
|
+
)), /* @__PURE__ */ n(b, { ownerState: l, sx: s, children: a });
|
|
62
72
|
};
|
|
63
73
|
export {
|
|
64
|
-
|
|
74
|
+
L as RangeSelector
|
|
65
75
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { styled as t, Box as o, TextField as n, Typography as a, IconButton as i, FormControl as r } from "@mui/material";
|
|
2
2
|
import { ArrowForward as g } from "@mui/icons-material";
|
|
3
3
|
import { DateTimePicker as s } from "@mui/x-date-pickers/DateTimePicker";
|
|
4
|
-
const l = (e) => e !== "ownerState",
|
|
4
|
+
const l = (e) => e !== "ownerState", p = t(o, {
|
|
5
5
|
name: "HCRangeSelector",
|
|
6
6
|
slot: "root",
|
|
7
7
|
shouldForwardProp: l
|
|
8
|
-
})({}), R = t(o, {
|
|
8
|
+
})({ width: "100%", minWidth: 0 }), R = t(o, {
|
|
9
9
|
name: "HCRangeSelector",
|
|
10
10
|
slot: "numberRow"
|
|
11
11
|
})({
|
|
@@ -17,12 +17,12 @@ const l = (e) => e !== "ownerState", d = t(o, {
|
|
|
17
17
|
})({
|
|
18
18
|
display: "flex",
|
|
19
19
|
width: "100%"
|
|
20
|
-
}),
|
|
20
|
+
}), w = t(n, {
|
|
21
21
|
name: "HCRangeSelector",
|
|
22
22
|
slot: "numberInput"
|
|
23
23
|
})(({ theme: e }) => ({
|
|
24
24
|
marginRight: e.spacing(0.25)
|
|
25
|
-
})),
|
|
25
|
+
})), u = t(n, {
|
|
26
26
|
name: "HCRangeSelector",
|
|
27
27
|
slot: "numberInput"
|
|
28
28
|
})(({ theme: e }) => ({
|
|
@@ -47,13 +47,13 @@ const l = (e) => e !== "ownerState", d = t(o, {
|
|
|
47
47
|
marginRight: e.spacing(0.5),
|
|
48
48
|
minWidth: 50,
|
|
49
49
|
width: 85
|
|
50
|
-
})),
|
|
50
|
+
})), h = t(o, {
|
|
51
51
|
name: "HCRangeSelector",
|
|
52
52
|
slot: "compositeChild"
|
|
53
53
|
})({
|
|
54
54
|
flex: 1,
|
|
55
55
|
maxWidth: 300
|
|
56
|
-
}),
|
|
56
|
+
}), H = t(o, {
|
|
57
57
|
name: "HCRangeSelector",
|
|
58
58
|
slot: "dateTrigger"
|
|
59
59
|
})(({ theme: e }) => ({
|
|
@@ -110,22 +110,22 @@ const l = (e) => e !== "ownerState", d = t(o, {
|
|
|
110
110
|
marginLeft: e.spacing(1)
|
|
111
111
|
}));
|
|
112
112
|
export {
|
|
113
|
-
|
|
113
|
+
h as CompositeChild,
|
|
114
114
|
x as CompositeCount,
|
|
115
115
|
S as CompositeRow,
|
|
116
116
|
I as DateLimitCaption,
|
|
117
117
|
y as DatePicker,
|
|
118
118
|
B as DateRangeInput,
|
|
119
|
-
|
|
119
|
+
H as DateTrigger,
|
|
120
120
|
b as DateTriggerArrow,
|
|
121
121
|
D as DateTriggerEditButton,
|
|
122
122
|
T as DateTriggerText,
|
|
123
123
|
N as DateUnitControl,
|
|
124
124
|
L as DateUnitRow,
|
|
125
125
|
f as ModeColumn,
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
u as NumberInputMax,
|
|
127
|
+
w as NumberInputMin,
|
|
128
128
|
C as NumberRangeRow,
|
|
129
129
|
R as NumberRow,
|
|
130
|
-
|
|
130
|
+
p as RangeSelectorRoot
|
|
131
131
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -727,6 +727,13 @@ export declare interface EditableTextProps extends TypographyProps {
|
|
|
727
727
|
onChange?(text: string | null): void;
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
export declare interface EnumRangeProps {
|
|
731
|
+
value: SIMULATION.RandomInfoString;
|
|
732
|
+
options: string[];
|
|
733
|
+
variant?: RangeSelectorVariant;
|
|
734
|
+
onChange(value: SIMULATION.RandomInfoString): void;
|
|
735
|
+
}
|
|
736
|
+
|
|
730
737
|
export declare const FlexCol: StyledComponent<BoxOwnProps<Theme> & Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
731
738
|
ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLDivElement> | null | undefined;
|
|
732
739
|
}, keyof BoxOwnProps<Theme>> & MUIStyledCommonProps<Theme>, {}, {}>;
|
|
@@ -1662,6 +1669,7 @@ export declare type RangeSelectorAcceptedType =
|
|
|
1662
1669
|
| "long"
|
|
1663
1670
|
| "string"
|
|
1664
1671
|
| "text"
|
|
1672
|
+
| "enum"
|
|
1665
1673
|
| "date"
|
|
1666
1674
|
| "geometry"
|
|
1667
1675
|
| "composite-list";
|
|
@@ -1686,6 +1694,14 @@ export declare type RangeSelectorProps =
|
|
|
1686
1694
|
sx?: SxProps<Theme>;
|
|
1687
1695
|
onChange(value: SIMULATION.RandomInfoString): void;
|
|
1688
1696
|
}
|
|
1697
|
+
| {
|
|
1698
|
+
type: "enum";
|
|
1699
|
+
value?: SIMULATION.RandomInfoString;
|
|
1700
|
+
enumValues: string[];
|
|
1701
|
+
mapboxAccessToken: string;
|
|
1702
|
+
sx?: SxProps<Theme>;
|
|
1703
|
+
onChange(value: SIMULATION.RandomInfoString): void;
|
|
1704
|
+
}
|
|
1689
1705
|
| {
|
|
1690
1706
|
type: "date";
|
|
1691
1707
|
value?: SIMULATION.RandomInfoDate;
|