@pie-lib/config-ui 13.0.4-next.30 → 13.0.4-next.34
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/CHANGELOG.json +32 -0
- package/CHANGELOG.md +2419 -0
- package/LICENSE.md +5 -0
- package/lib/alert-dialog.js +68 -0
- package/lib/alert-dialog.js.map +1 -0
- package/lib/checkbox.js +84 -0
- package/lib/checkbox.js.map +1 -0
- package/lib/choice-configuration/feedback-menu.js +129 -0
- package/lib/choice-configuration/feedback-menu.js.map +1 -0
- package/lib/choice-configuration/index.js +381 -0
- package/lib/choice-configuration/index.js.map +1 -0
- package/lib/choice-utils.js +42 -0
- package/lib/choice-utils.js.map +1 -0
- package/lib/feedback-config/feedback-selector.js +155 -0
- package/lib/feedback-config/feedback-selector.js.map +1 -0
- package/lib/feedback-config/group.js +61 -0
- package/lib/feedback-config/group.js.map +1 -0
- package/lib/feedback-config/index.js +146 -0
- package/lib/feedback-config/index.js.map +1 -0
- package/lib/form-section.js +44 -0
- package/lib/form-section.js.map +1 -0
- package/lib/help.js +106 -0
- package/lib/help.js.map +1 -0
- package/lib/index.js +186 -0
- package/lib/index.js.map +1 -0
- package/lib/input.js +106 -0
- package/lib/input.js.map +1 -0
- package/lib/inputs.js +105 -0
- package/lib/inputs.js.map +1 -0
- package/lib/langs.js +136 -0
- package/lib/langs.js.map +1 -0
- package/lib/layout/config-layout.js +137 -0
- package/lib/layout/config-layout.js.map +1 -0
- package/lib/layout/index.js +21 -0
- package/lib/layout/index.js.map +1 -0
- package/lib/layout/layout-contents.js +160 -0
- package/lib/layout/layout-contents.js.map +1 -0
- package/lib/layout/settings-box.js +57 -0
- package/lib/layout/settings-box.js.map +1 -0
- package/lib/mui-box/index.js +63 -0
- package/lib/mui-box/index.js.map +1 -0
- package/lib/number-text-field-custom.js +376 -0
- package/lib/number-text-field-custom.js.map +1 -0
- package/lib/number-text-field.js +229 -0
- package/lib/number-text-field.js.map +1 -0
- package/lib/radio-with-label.js +48 -0
- package/lib/radio-with-label.js.map +1 -0
- package/lib/settings/display-size.js +61 -0
- package/lib/settings/display-size.js.map +1 -0
- package/lib/settings/index.js +110 -0
- package/lib/settings/index.js.map +1 -0
- package/lib/settings/panel.js +392 -0
- package/lib/settings/panel.js.map +1 -0
- package/lib/settings/settings-radio-label.js +51 -0
- package/lib/settings/settings-radio-label.js.map +1 -0
- package/lib/settings/toggle.js +63 -0
- package/lib/settings/toggle.js.map +1 -0
- package/lib/tabs/index.js +75 -0
- package/lib/tabs/index.js.map +1 -0
- package/lib/tags-input/index.js +149 -0
- package/lib/tags-input/index.js.map +1 -0
- package/lib/two-choice.js +136 -0
- package/lib/two-choice.js.map +1 -0
- package/lib/with-stateful-model.js +61 -0
- package/lib/with-stateful-model.js.map +1 -0
- package/package.json +19 -33
- package/src/__tests__/alert-dialog.test.jsx +183 -0
- package/src/__tests__/checkbox.test.jsx +152 -0
- package/src/__tests__/choice-utils.test.js +12 -0
- package/src/__tests__/form-section.test.jsx +328 -0
- package/src/__tests__/help.test.jsx +184 -0
- package/src/__tests__/input.test.jsx +156 -0
- package/src/__tests__/langs.test.jsx +376 -0
- package/src/__tests__/number-text-field-custom.test.jsx +255 -0
- package/src/__tests__/number-text-field.test.jsx +263 -0
- package/src/__tests__/radio-with-label.test.jsx +155 -0
- package/src/__tests__/settings-panel.test.js +187 -0
- package/src/__tests__/settings.test.jsx +452 -0
- package/src/__tests__/tabs.test.jsx +188 -0
- package/src/__tests__/two-choice.test.js +110 -0
- package/src/__tests__/with-stateful-model.test.jsx +139 -0
- package/src/alert-dialog.jsx +75 -0
- package/src/checkbox.jsx +61 -0
- package/src/choice-configuration/__tests__/feedback-menu.test.jsx +151 -0
- package/src/choice-configuration/__tests__/index.test.jsx +234 -0
- package/src/choice-configuration/feedback-menu.jsx +96 -0
- package/src/choice-configuration/index.jsx +357 -0
- package/src/choice-utils.js +30 -0
- package/src/feedback-config/__tests__/feedback-config.test.jsx +141 -0
- package/src/feedback-config/__tests__/feedback-selector.test.jsx +97 -0
- package/src/feedback-config/feedback-selector.jsx +112 -0
- package/src/feedback-config/group.jsx +51 -0
- package/src/feedback-config/index.jsx +111 -0
- package/src/form-section.jsx +31 -0
- package/src/help.jsx +79 -0
- package/src/index.js +55 -0
- package/src/input.jsx +72 -0
- package/src/inputs.jsx +69 -0
- package/src/langs.jsx +111 -0
- package/src/layout/__tests__/config.layout.test.jsx +59 -0
- package/src/layout/__tests__/layout-content.test.jsx +3 -0
- package/src/layout/config-layout.jsx +103 -0
- package/src/layout/index.js +4 -0
- package/src/layout/layout-contents.jsx +117 -0
- package/src/layout/settings-box.jsx +32 -0
- package/src/mui-box/index.jsx +56 -0
- package/src/number-text-field-custom.jsx +333 -0
- package/src/number-text-field.jsx +215 -0
- package/src/radio-with-label.jsx +30 -0
- package/src/settings/display-size.jsx +53 -0
- package/src/settings/index.js +83 -0
- package/src/settings/panel.jsx +333 -0
- package/src/settings/settings-radio-label.jsx +32 -0
- package/src/settings/toggle.jsx +46 -0
- package/src/tabs/index.jsx +47 -0
- package/src/tags-input/__tests__/index.test.jsx +113 -0
- package/src/tags-input/index.jsx +116 -0
- package/src/two-choice.jsx +90 -0
- package/src/with-stateful-model.jsx +36 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -11
- package/dist/alert-dialog.d.ts +0 -44
- package/dist/alert-dialog.js +0 -47
- package/dist/checkbox.d.ts +0 -34
- package/dist/checkbox.js +0 -57
- package/dist/choice-configuration/feedback-menu.d.ts +0 -32
- package/dist/choice-configuration/feedback-menu.js +0 -85
- package/dist/choice-configuration/index.d.ts +0 -62
- package/dist/choice-configuration/index.js +0 -240
- package/dist/choice-utils.d.ts +0 -21
- package/dist/choice-utils.js +0 -15
- package/dist/feedback-config/feedback-selector.d.ts +0 -33
- package/dist/feedback-config/feedback-selector.js +0 -92
- package/dist/feedback-config/group.d.ts +0 -21
- package/dist/feedback-config/group.js +0 -33
- package/dist/feedback-config/index.d.ts +0 -48
- package/dist/feedback-config/index.js +0 -96
- package/dist/form-section.d.ts +0 -25
- package/dist/form-section.js +0 -25
- package/dist/fraction-to-number.d.ts +0 -7
- package/dist/fraction-to-number.js +0 -9
- package/dist/help.d.ts +0 -41
- package/dist/help.js +0 -61
- package/dist/index.d.ts +0 -31
- package/dist/index.js +0 -34
- package/dist/input.d.ts +0 -29
- package/dist/input.js +0 -65
- package/dist/inputs.d.ts +0 -63
- package/dist/inputs.js +0 -70
- package/dist/langs.d.ts +0 -41
- package/dist/langs.js +0 -76
- package/dist/layout/config-layout.d.ts +0 -10
- package/dist/layout/config-layout.js +0 -75
- package/dist/layout/index.d.ts +0 -11
- package/dist/layout/index.js +0 -10
- package/dist/layout/layout-contents.d.ts +0 -21
- package/dist/layout/layout-contents.js +0 -70
- package/dist/layout/settings-box.d.ts +0 -19
- package/dist/layout/settings-box.js +0 -31
- package/dist/mui-box/index.d.ts +0 -21
- package/dist/mui-box/index.js +0 -47
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +0 -12
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -7
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -12
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
- package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +0 -122
- package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -276
- package/dist/number-text-field-custom.d.ts +0 -51
- package/dist/number-text-field-custom.js +0 -192
- package/dist/number-text-field.d.ts +0 -47
- package/dist/number-text-field.js +0 -122
- package/dist/radio-with-label.d.ts +0 -25
- package/dist/radio-with-label.js +0 -27
- package/dist/settings/display-size.d.ts +0 -26
- package/dist/settings/display-size.js +0 -45
- package/dist/settings/index.d.ts +0 -45
- package/dist/settings/index.js +0 -63
- package/dist/settings/panel.d.ts +0 -27
- package/dist/settings/panel.js +0 -201
- package/dist/settings/settings-radio-label.d.ts +0 -25
- package/dist/settings/settings-radio-label.js +0 -29
- package/dist/settings/toggle.d.ts +0 -25
- package/dist/settings/toggle.js +0 -33
- package/dist/tabs/index.d.ts +0 -22
- package/dist/tabs/index.js +0 -39
- package/dist/tags-input/index.d.ts +0 -21
- package/dist/tags-input/index.js +0 -83
- package/dist/two-choice.d.ts +0 -43
- package/dist/two-choice.js +0 -79
- package/dist/with-stateful-model.d.ts +0 -42
- package/dist/with-stateful-model.js +0 -32
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { fractionToNumber as e } from "./fraction-to-number.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import { styled as r } from "@mui/material/styles";
|
|
5
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
import { isFinite as a } from "@pie-element/shared-lodash";
|
|
7
|
-
import o from "@mui/material/IconButton";
|
|
8
|
-
import s from "@mui/material/TextField";
|
|
9
|
-
import c from "@mui/material/InputAdornment";
|
|
10
|
-
import l from "@mui/icons-material/Remove";
|
|
11
|
-
import u from "@mui/icons-material/Add";
|
|
12
|
-
//#region src/number-text-field-custom.tsx
|
|
13
|
-
var d = r(s)(() => ({
|
|
14
|
-
"& input[type=number]": { MozAppearance: "textfield" },
|
|
15
|
-
"& input[type=number]::-webkit-outer-spin-button": {
|
|
16
|
-
WebkitAppearance: "none",
|
|
17
|
-
margin: 0
|
|
18
|
-
},
|
|
19
|
-
"& input[type=number]::-webkit-inner-spin-button": {
|
|
20
|
-
WebkitAppearance: "none",
|
|
21
|
-
margin: 0
|
|
22
|
-
}
|
|
23
|
-
})), f = r(o)(() => ({ padding: "2px" })), p = (e, t) => {
|
|
24
|
-
if (!a(e) && !a(t)) return 0;
|
|
25
|
-
if (!a(e) && a(t)) return t;
|
|
26
|
-
if (a(e)) return e;
|
|
27
|
-
}, m = class extends t.Component {
|
|
28
|
-
static propTypes = {
|
|
29
|
-
className: n.string,
|
|
30
|
-
customValues: n.array,
|
|
31
|
-
disabled: n.bool,
|
|
32
|
-
error: n.bool,
|
|
33
|
-
inputClassName: n.string,
|
|
34
|
-
helperText: n.string,
|
|
35
|
-
onChange: n.func.isRequired,
|
|
36
|
-
onlyIntegersAllowed: n.bool,
|
|
37
|
-
value: n.any,
|
|
38
|
-
min: n.number,
|
|
39
|
-
max: n.number,
|
|
40
|
-
step: n.number,
|
|
41
|
-
label: n.string,
|
|
42
|
-
disableUnderline: n.bool,
|
|
43
|
-
textAlign: n.string,
|
|
44
|
-
variant: n.string,
|
|
45
|
-
type: n.string
|
|
46
|
-
};
|
|
47
|
-
static defaultProps = {
|
|
48
|
-
step: 1,
|
|
49
|
-
customValues: [],
|
|
50
|
-
textAlign: "center",
|
|
51
|
-
variant: "standard",
|
|
52
|
-
onlyIntegersAllowed: !1
|
|
53
|
-
};
|
|
54
|
-
constructor(e) {
|
|
55
|
-
super(e);
|
|
56
|
-
let { value: t, currentIndex: n } = this.normalizeValueAndIndex(e.customValues, e.value);
|
|
57
|
-
this.state = {
|
|
58
|
-
value: t,
|
|
59
|
-
currentIndex: n
|
|
60
|
-
}, t !== e.value && this.props.onChange({}, t), this.onChange = this.onChange.bind(this);
|
|
61
|
-
}
|
|
62
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
63
|
-
let { value: t, currentIndex: n } = this.normalizeValueAndIndex(e.customValues, e.value, e.min, e.max);
|
|
64
|
-
this.setState({
|
|
65
|
-
value: t,
|
|
66
|
-
currentIndex: n
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
clamp(e, t = this.props.min, n = this.props.max) {
|
|
70
|
-
let { customValues: r } = this.props;
|
|
71
|
-
return (r || []).length > 0 ? e : a(e) ? (a(n) && (e = Math.min(e, n)), a(t) && (e = Math.max(e, t)), e) : p(t, n);
|
|
72
|
-
}
|
|
73
|
-
normalizeValueAndIndex = (e, t, n, r) => {
|
|
74
|
-
let { type: i } = this.props, a = this.clamp(t, n, r), o = (e || []).findIndex((e) => e === a);
|
|
75
|
-
if ((e || []).length > 0 && o === -1) {
|
|
76
|
-
let t = i === "text" ? this.getClosestFractionValue(e, a) : this.getClosestValue(e, a);
|
|
77
|
-
return {
|
|
78
|
-
value: t.value,
|
|
79
|
-
currentIndex: t.index
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
value: a,
|
|
84
|
-
currentIndex: o
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
getClosestValue = (e, t) => e.reduce((e, n, r) => Math.abs(n - t) < Math.abs(e.value - t) ? {
|
|
88
|
-
value: n,
|
|
89
|
-
index: r
|
|
90
|
-
} : e, {
|
|
91
|
-
value: e[0],
|
|
92
|
-
index: 0
|
|
93
|
-
});
|
|
94
|
-
getClosestFractionValue = (t, n) => t.reduce((t, r, i) => Math.abs(e(r) - e(n)) < Math.abs(e(t.value) - e(n)) ? {
|
|
95
|
-
value: r,
|
|
96
|
-
index: i
|
|
97
|
-
} : t, {
|
|
98
|
-
value: t[0],
|
|
99
|
-
index: 0
|
|
100
|
-
});
|
|
101
|
-
getValidFraction = (e) => {
|
|
102
|
-
if (this.isPositiveInteger(e.trim())) return e.trim();
|
|
103
|
-
if (e.trim() === "" || e.trim().split("/").length !== 2) return !1;
|
|
104
|
-
let [t, n] = e.trim().split("/");
|
|
105
|
-
return isNaN(t) || isNaN(n) || (t = parseFloat(t), n = parseFloat(n), !Number.isInteger(t) || !Number.isInteger(n)) || t < 0 || n < 1 ? !1 : t + "/" + n;
|
|
106
|
-
};
|
|
107
|
-
isPositiveInteger = (e) => e >>> 0 === parseFloat(e);
|
|
108
|
-
onBlur = (e) => {
|
|
109
|
-
let { customValues: t, onlyIntegersAllowed: n, type: r } = this.props, { value: i } = e.target;
|
|
110
|
-
r === "text" && (i = this.getValidFraction(i) || this.props.value);
|
|
111
|
-
let a = n ? Math.round(parseFloat(i)) : parseFloat(i);
|
|
112
|
-
r === "text" && (a = i.trim());
|
|
113
|
-
let { value: o, currentIndex: s } = this.normalizeValueAndIndex(t, a);
|
|
114
|
-
this.setState({
|
|
115
|
-
value: o.toString(),
|
|
116
|
-
currentIndex: s
|
|
117
|
-
}, () => this.props.onChange(e, o));
|
|
118
|
-
};
|
|
119
|
-
onChange(e) {
|
|
120
|
-
let { type: t } = this.props, { value: n } = e.target;
|
|
121
|
-
t !== "text" && typeof n == "string" && n.trim() === "" || this.setState({ value: n });
|
|
122
|
-
}
|
|
123
|
-
changeValue(e, t = 1, n = !1) {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
let { customValues: r, step: i, onlyIntegersAllowed: a, onChange: o } = this.props, { currentIndex: s, value: c } = this.state, l = s + t * 1, u;
|
|
126
|
-
if (r.length > 0) {
|
|
127
|
-
if (l < 0 || l >= r.length) return;
|
|
128
|
-
u = r[l];
|
|
129
|
-
} else {
|
|
130
|
-
let e = ((a ? parseInt(c) : parseFloat(c)) * 1e4 + i * t * 1e4) / 1e4;
|
|
131
|
-
u = this.clamp(e);
|
|
132
|
-
}
|
|
133
|
-
this.setState({
|
|
134
|
-
value: u.toString(),
|
|
135
|
-
currentIndex: l
|
|
136
|
-
}, () => {
|
|
137
|
-
n && o(e, u);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
render() {
|
|
141
|
-
let { className: e, label: t, disabled: n, error: r, min: o, max: s, customValues: p, inputClassName: m, disableUnderline: h, helperText: g, variant: _, textAlign: v, type: y = "number" } = this.props, { value: b } = this.state, x = e, S = !1, C = !1;
|
|
142
|
-
return p.length > 0 ? (S = b === p[0], C = b === p[p.length - 1]) : a(o) && a(s) && (S = b === o, C = b === s), /* @__PURE__ */ i(d, {
|
|
143
|
-
variant: _,
|
|
144
|
-
inputRef: (e) => this.inputRef = e,
|
|
145
|
-
disabled: n,
|
|
146
|
-
label: t,
|
|
147
|
-
value: b,
|
|
148
|
-
error: r,
|
|
149
|
-
helperText: g,
|
|
150
|
-
onChange: this.onChange,
|
|
151
|
-
onBlur: this.onBlur,
|
|
152
|
-
onKeyPress: (e) => {
|
|
153
|
-
e.key === "Enter" && this.inputRef && this.inputRef.blur();
|
|
154
|
-
},
|
|
155
|
-
onKeyDown: (e) => {
|
|
156
|
-
e.key === "ArrowUp" && this.changeValue(e), e.key === "ArrowDown" && this.changeValue(e, -1);
|
|
157
|
-
},
|
|
158
|
-
title: "",
|
|
159
|
-
type: y,
|
|
160
|
-
className: x,
|
|
161
|
-
InputProps: {
|
|
162
|
-
className: m,
|
|
163
|
-
disableUnderline: h,
|
|
164
|
-
startAdornment: /* @__PURE__ */ i(c, {
|
|
165
|
-
position: "start",
|
|
166
|
-
children: /* @__PURE__ */ i(f, {
|
|
167
|
-
disabled: n || S,
|
|
168
|
-
onClick: (e) => this.changeValue(e, -1, !0),
|
|
169
|
-
size: "large",
|
|
170
|
-
children: /* @__PURE__ */ i(l, { fontSize: "small" })
|
|
171
|
-
})
|
|
172
|
-
}),
|
|
173
|
-
endAdornment: /* @__PURE__ */ i(c, {
|
|
174
|
-
position: "end",
|
|
175
|
-
children: /* @__PURE__ */ i(f, {
|
|
176
|
-
disabled: n || C,
|
|
177
|
-
onClick: (e) => this.changeValue(e, 1, !0),
|
|
178
|
-
size: "large",
|
|
179
|
-
children: /* @__PURE__ */ i(u, { fontSize: "small" })
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
},
|
|
183
|
-
inputProps: {
|
|
184
|
-
style: { textAlign: v },
|
|
185
|
-
min: o,
|
|
186
|
-
max: s
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
//#endregion
|
|
192
|
-
export { m as default };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/config-ui/src/number-text-field.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
export declare class NumberTextField extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
14
|
-
className: PropTypes.Requireable<string>;
|
|
15
|
-
inputClassName: PropTypes.Requireable<string>;
|
|
16
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
value: PropTypes.Requireable<number>;
|
|
18
|
-
min: PropTypes.Requireable<number>;
|
|
19
|
-
max: PropTypes.Requireable<number>;
|
|
20
|
-
label: PropTypes.Requireable<string>;
|
|
21
|
-
suffix: PropTypes.Requireable<string>;
|
|
22
|
-
showErrorWhenOutsideRange: PropTypes.Requireable<boolean>;
|
|
23
|
-
disableUnderline: PropTypes.Requireable<boolean>;
|
|
24
|
-
variant: PropTypes.Requireable<string>;
|
|
25
|
-
};
|
|
26
|
-
static defaultProps: {
|
|
27
|
-
showErrorWhenOutsideRange: boolean;
|
|
28
|
-
};
|
|
29
|
-
constructor(props: any);
|
|
30
|
-
UNSAFE_componentWillReceiveProps(props: any): void;
|
|
31
|
-
clamp(value: any, min?: any, max?: any): any;
|
|
32
|
-
/**
|
|
33
|
-
* on Blur (this can be triggered by pressing Enter, see below)
|
|
34
|
-
* we check the entered value and reset it if needed
|
|
35
|
-
*/
|
|
36
|
-
onBlur: any;
|
|
37
|
-
onChange(event: any): void;
|
|
38
|
-
errorMessage: any;
|
|
39
|
-
/**
|
|
40
|
-
* if the input has to show error when outside range,
|
|
41
|
-
* and the entered value is not matching the requirements
|
|
42
|
-
* we display error message
|
|
43
|
-
*/
|
|
44
|
-
getError: any;
|
|
45
|
-
render(): React.JSX.Element;
|
|
46
|
-
}
|
|
47
|
-
export default NumberTextField;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { styled as n } from "@mui/material/styles";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import { isFinite as i } from "@pie-element/shared-lodash";
|
|
6
|
-
import a from "debug";
|
|
7
|
-
import o from "@mui/material/TextField";
|
|
8
|
-
import s from "@mui/material/InputAdornment";
|
|
9
|
-
//#region src/number-text-field.tsx
|
|
10
|
-
var c = a("@pie-lib:config-ui:number-text-field"), l = n(o)(({ theme: e }) => ({
|
|
11
|
-
marginRight: e.spacing(1),
|
|
12
|
-
"& .MuiInputLabel-root": {
|
|
13
|
-
width: "auto",
|
|
14
|
-
minWidth: "max-content",
|
|
15
|
-
maxWidth: "none",
|
|
16
|
-
whiteSpace: "nowrap",
|
|
17
|
-
overflow: "visible",
|
|
18
|
-
transform: "translate(0, 8px) scale(0.75)",
|
|
19
|
-
transformOrigin: "top left",
|
|
20
|
-
position: "relative"
|
|
21
|
-
},
|
|
22
|
-
"& .MuiInputBase-root, & .MuiInput-root, & .MuiFilledInput-root, & .MuiOutlinedInput-root": {
|
|
23
|
-
height: "auto",
|
|
24
|
-
minHeight: "auto",
|
|
25
|
-
marginTop: 0
|
|
26
|
-
},
|
|
27
|
-
"& .MuiInputBase-input": {
|
|
28
|
-
height: "auto",
|
|
29
|
-
minHeight: "auto",
|
|
30
|
-
padding: "6px 0 7px"
|
|
31
|
-
}
|
|
32
|
-
})), u = (e, t) => {
|
|
33
|
-
if (!i(e) && !i(t)) return 0;
|
|
34
|
-
if (!i(e) && i(t)) return t;
|
|
35
|
-
if (i(e)) return e;
|
|
36
|
-
}, d = class extends e.Component {
|
|
37
|
-
static propTypes = {
|
|
38
|
-
disabled: t.bool,
|
|
39
|
-
className: t.string,
|
|
40
|
-
inputClassName: t.string,
|
|
41
|
-
onChange: t.func.isRequired,
|
|
42
|
-
value: t.number,
|
|
43
|
-
min: t.number,
|
|
44
|
-
max: t.number,
|
|
45
|
-
label: t.string,
|
|
46
|
-
suffix: t.string,
|
|
47
|
-
showErrorWhenOutsideRange: t.bool,
|
|
48
|
-
disableUnderline: t.bool,
|
|
49
|
-
variant: t.string
|
|
50
|
-
};
|
|
51
|
-
static defaultProps = { showErrorWhenOutsideRange: !1 };
|
|
52
|
-
constructor(e) {
|
|
53
|
-
super(e);
|
|
54
|
-
let t = this.clamp(e.value);
|
|
55
|
-
this.state = { value: t }, t !== e.value && this.props.onChange({}, t), this.onChange = this.onChange.bind(this);
|
|
56
|
-
}
|
|
57
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
58
|
-
let t = this.clamp(e.value, e.min, e.max);
|
|
59
|
-
this.setState({ value: t });
|
|
60
|
-
}
|
|
61
|
-
clamp(e, t = this.props.min, n = this.props.max) {
|
|
62
|
-
return i(e) ? (i(n) && (e = Math.min(e, n)), i(t) && (e = Math.max(e, t)), e) : u(t, n);
|
|
63
|
-
}
|
|
64
|
-
onBlur = (e) => {
|
|
65
|
-
let t = e.target.value, n = parseFloat(t);
|
|
66
|
-
c("rawNumber: ", n);
|
|
67
|
-
let r = this.clamp(n);
|
|
68
|
-
c("number: ", r), r !== this.state.value && (c("trigger update..."), this.setState({ value: r.toString() }, () => {
|
|
69
|
-
this.props.onChange(e, r);
|
|
70
|
-
}));
|
|
71
|
-
};
|
|
72
|
-
onChange(e) {
|
|
73
|
-
let t = e.target.value;
|
|
74
|
-
this.setState({ value: t });
|
|
75
|
-
}
|
|
76
|
-
errorMessage = () => {
|
|
77
|
-
let { min: e, max: t } = this.props;
|
|
78
|
-
if (e && t) return `The value must be between ${e} and ${t}`;
|
|
79
|
-
if (e) return `The value must be greater than ${e}`;
|
|
80
|
-
if (t) return `The value must be less than ${t}`;
|
|
81
|
-
};
|
|
82
|
-
getError = () => {
|
|
83
|
-
let { value: e } = this.state, t = parseFloat(e);
|
|
84
|
-
if (this.clamp(t) !== t) return this.errorMessage();
|
|
85
|
-
};
|
|
86
|
-
render() {
|
|
87
|
-
let { className: e, label: t, disabled: n, suffix: i, min: a, max: o, inputClassName: c, disableUnderline: u, showErrorWhenOutsideRange: d, variant: f } = this.props, p = d && this.getError();
|
|
88
|
-
return /* @__PURE__ */ r(l, {
|
|
89
|
-
variant: u ? "filled" : f || "standard",
|
|
90
|
-
inputRef: (e) => {
|
|
91
|
-
this.inputRef = e;
|
|
92
|
-
},
|
|
93
|
-
disabled: n,
|
|
94
|
-
label: t,
|
|
95
|
-
InputLabelProps: { shrink: !0 },
|
|
96
|
-
value: this.state.value,
|
|
97
|
-
error: !!p,
|
|
98
|
-
helperText: p,
|
|
99
|
-
onChange: this.onChange,
|
|
100
|
-
onBlur: this.onBlur,
|
|
101
|
-
onKeyDown: (e) => {
|
|
102
|
-
e.key === "Enter" && this.inputRef && this.inputRef.blur();
|
|
103
|
-
},
|
|
104
|
-
type: "number",
|
|
105
|
-
className: e,
|
|
106
|
-
slotProps: { input: {
|
|
107
|
-
endAdornment: i && /* @__PURE__ */ r(s, {
|
|
108
|
-
position: "end",
|
|
109
|
-
children: i
|
|
110
|
-
}),
|
|
111
|
-
className: c,
|
|
112
|
-
inputProps: {
|
|
113
|
-
min: a,
|
|
114
|
-
max: o
|
|
115
|
-
}
|
|
116
|
-
} },
|
|
117
|
-
margin: "normal"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
//#endregion
|
|
122
|
-
export { d as default };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/config-ui/src/radio-with-label.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
declare const RadioWithLabel: {
|
|
12
|
-
({ label, value, checked, onChange }: {
|
|
13
|
-
label: any;
|
|
14
|
-
value: any;
|
|
15
|
-
checked: any;
|
|
16
|
-
onChange: any;
|
|
17
|
-
}): React.JSX.Element;
|
|
18
|
-
propTypes: {
|
|
19
|
-
label: PropTypes.Requireable<string>;
|
|
20
|
-
value: PropTypes.Requireable<string>;
|
|
21
|
-
checked: PropTypes.Requireable<boolean>;
|
|
22
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export default RadioWithLabel;
|
package/dist/radio-with-label.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import e from "prop-types";
|
|
3
|
-
import { styled as t } from "@mui/material/styles";
|
|
4
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
-
import { color as r } from "@pie-lib/render-ui";
|
|
6
|
-
import i from "@mui/material/FormControlLabel";
|
|
7
|
-
import a from "@mui/material/Radio";
|
|
8
|
-
//#region src/radio-with-label.tsx
|
|
9
|
-
var o = t(i)(() => ({ "& .MuiFormControlLabel-label": {
|
|
10
|
-
left: "-5px",
|
|
11
|
-
position: "relative"
|
|
12
|
-
} })), s = t(a)(() => ({ color: `${r.tertiary()} !important` })), c = ({ label: e, value: t, checked: r, onChange: i }) => /* @__PURE__ */ n(o, {
|
|
13
|
-
value: t,
|
|
14
|
-
control: /* @__PURE__ */ n(s, {
|
|
15
|
-
checked: r,
|
|
16
|
-
onChange: i
|
|
17
|
-
}),
|
|
18
|
-
label: e
|
|
19
|
-
});
|
|
20
|
-
c.propTypes = {
|
|
21
|
-
label: e.string,
|
|
22
|
-
value: e.string,
|
|
23
|
-
checked: e.bool,
|
|
24
|
-
onChange: e.func
|
|
25
|
-
};
|
|
26
|
-
//#endregion
|
|
27
|
-
export { c as default };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/config-ui/src/settings/display-size.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
declare const DisplaySize: {
|
|
12
|
-
({ size, label, onChange }: {
|
|
13
|
-
size: any;
|
|
14
|
-
label: any;
|
|
15
|
-
onChange: any;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
propTypes: {
|
|
18
|
-
size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
19
|
-
width: PropTypes.Validator<number>;
|
|
20
|
-
height: PropTypes.Validator<number>;
|
|
21
|
-
}>>>;
|
|
22
|
-
label: PropTypes.Validator<string>;
|
|
23
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export default DisplaySize;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import e from "../number-text-field.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import t from "prop-types";
|
|
4
|
-
import { styled as n } from "@mui/material/styles";
|
|
5
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
-
import a from "@mui/material/Typography";
|
|
7
|
-
//#region src/settings/display-size.tsx
|
|
8
|
-
var o = n("div")(({ theme: e }) => ({
|
|
9
|
-
display: "flex",
|
|
10
|
-
paddingTop: e.spacing(1)
|
|
11
|
-
})), s = ({ size: t, label: n, onChange: s }) => {
|
|
12
|
-
let c = (e, n) => {
|
|
13
|
-
s({
|
|
14
|
-
...t,
|
|
15
|
-
[e]: n
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(a, { children: n }), /* @__PURE__ */ i(o, { children: [/* @__PURE__ */ r(e, {
|
|
19
|
-
label: "Width",
|
|
20
|
-
type: "number",
|
|
21
|
-
variant: "outlined",
|
|
22
|
-
value: t.width,
|
|
23
|
-
min: 150,
|
|
24
|
-
max: 1e3,
|
|
25
|
-
onChange: (e, t) => c("width", t)
|
|
26
|
-
}), /* @__PURE__ */ r(e, {
|
|
27
|
-
label: "Height",
|
|
28
|
-
type: "number",
|
|
29
|
-
variant: "outlined",
|
|
30
|
-
min: 150,
|
|
31
|
-
max: 1e3,
|
|
32
|
-
value: t.height,
|
|
33
|
-
onChange: (e, t) => c("height", t)
|
|
34
|
-
})] })] });
|
|
35
|
-
};
|
|
36
|
-
s.propTypes = {
|
|
37
|
-
size: t.shape({
|
|
38
|
-
width: t.number.isRequired,
|
|
39
|
-
height: t.number.isRequired
|
|
40
|
-
}).isRequired,
|
|
41
|
-
label: t.string.isRequired,
|
|
42
|
-
onChange: t.func
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { s as default };
|
package/dist/settings/index.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/config-ui/src/settings/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import Panel from './panel.js';
|
|
10
|
-
export { Panel };
|
|
11
|
-
export declare const textField: (label: any, isConfigProperty?: boolean) => {
|
|
12
|
-
label: any;
|
|
13
|
-
type: string;
|
|
14
|
-
isConfigProperty: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare const toggle: (label: any, isConfigProperty?: boolean, disabled?: boolean) => {
|
|
17
|
-
type: string;
|
|
18
|
-
label: any;
|
|
19
|
-
isConfigProperty: boolean;
|
|
20
|
-
disabled: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare const radio: () => {
|
|
23
|
-
type: string;
|
|
24
|
-
label: any;
|
|
25
|
-
choices: any;
|
|
26
|
-
isConfigProperty: any;
|
|
27
|
-
};
|
|
28
|
-
export declare const dropdown: (label: any, choices: any, isConfigProperty?: boolean) => {
|
|
29
|
-
type: string;
|
|
30
|
-
label: any;
|
|
31
|
-
choices: any;
|
|
32
|
-
isConfigProperty: boolean;
|
|
33
|
-
};
|
|
34
|
-
export declare const numberField: (label: any, options: any, isConfigProperty?: boolean) => any;
|
|
35
|
-
export declare const numberFields: (label: any, fields: any, isConfigProperty?: boolean) => {
|
|
36
|
-
type: string;
|
|
37
|
-
label: any;
|
|
38
|
-
fields: any;
|
|
39
|
-
};
|
|
40
|
-
export declare const checkbox: (label: any, settings: any, isConfigProperty?: boolean) => any;
|
|
41
|
-
export declare const checkboxes: (label: any, choices: any, isConfigProperty?: boolean) => {
|
|
42
|
-
type: string;
|
|
43
|
-
label: any;
|
|
44
|
-
choices: any;
|
|
45
|
-
};
|
package/dist/settings/index.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import t from "./panel.js";
|
|
3
|
-
//#region src/settings/index.ts
|
|
4
|
-
var n = /* @__PURE__ */ e({
|
|
5
|
-
Panel: () => t,
|
|
6
|
-
checkbox: () => u,
|
|
7
|
-
checkboxes: () => d,
|
|
8
|
-
dropdown: () => s,
|
|
9
|
-
numberField: () => c,
|
|
10
|
-
numberFields: () => l,
|
|
11
|
-
radio: () => o,
|
|
12
|
-
textField: () => r,
|
|
13
|
-
toggle: () => i
|
|
14
|
-
}), r = (e, t = !0) => ({
|
|
15
|
-
label: e,
|
|
16
|
-
type: "textField",
|
|
17
|
-
isConfigProperty: t
|
|
18
|
-
}), i = (e, t = !1, n = !1) => ({
|
|
19
|
-
type: "toggle",
|
|
20
|
-
label: e,
|
|
21
|
-
isConfigProperty: t,
|
|
22
|
-
disabled: n
|
|
23
|
-
}), a = (e) => typeof e == "string" ? {
|
|
24
|
-
label: e,
|
|
25
|
-
value: e
|
|
26
|
-
} : e, o = function() {
|
|
27
|
-
let [e, t, n = !1] = Array.prototype.slice.call(arguments);
|
|
28
|
-
return {
|
|
29
|
-
type: "radio",
|
|
30
|
-
label: e,
|
|
31
|
-
choices: t && t.map((e) => a(e)),
|
|
32
|
-
isConfigProperty: n
|
|
33
|
-
};
|
|
34
|
-
}, s = (e, t, n = !1) => ({
|
|
35
|
-
type: "dropdown",
|
|
36
|
-
label: e,
|
|
37
|
-
choices: t,
|
|
38
|
-
isConfigProperty: n
|
|
39
|
-
}), c = (e, t, n = !1) => ({
|
|
40
|
-
...t,
|
|
41
|
-
label: e,
|
|
42
|
-
type: "numberField",
|
|
43
|
-
isConfigProperty: n
|
|
44
|
-
}), l = (e, t, n = !1) => (Object.keys(t).map((e) => {
|
|
45
|
-
t[e] = c(t[e].label, t[e], n);
|
|
46
|
-
}), {
|
|
47
|
-
type: "numberFields",
|
|
48
|
-
label: e,
|
|
49
|
-
fields: t
|
|
50
|
-
}), u = (e, t, n = !1) => ({
|
|
51
|
-
...t,
|
|
52
|
-
label: e,
|
|
53
|
-
type: "checkbox",
|
|
54
|
-
isConfigProperty: n
|
|
55
|
-
}), d = (e, t, n = !1) => (Object.keys(t).map((e) => {
|
|
56
|
-
t[e] = u(t[e].label, t[e], n);
|
|
57
|
-
}), {
|
|
58
|
-
type: "checkboxes",
|
|
59
|
-
label: e,
|
|
60
|
-
choices: t
|
|
61
|
-
});
|
|
62
|
-
//#endregion
|
|
63
|
-
export { n as settings_exports };
|
package/dist/settings/panel.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/config-ui/src/settings/panel.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Panel extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Requireable<object>;
|
|
14
|
-
configuration: PropTypes.Requireable<object>;
|
|
15
|
-
groups: PropTypes.Requireable<object>;
|
|
16
|
-
onChangeModel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
onChangeConfiguration: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
-
modal: PropTypes.Requireable<object>;
|
|
19
|
-
};
|
|
20
|
-
static defaultProps: {
|
|
21
|
-
onChangeModel: () => void;
|
|
22
|
-
onChangeConfiguration: () => void;
|
|
23
|
-
};
|
|
24
|
-
change: any;
|
|
25
|
-
render(): React.JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
export default Panel;
|