@etsoo/materialui 1.5.99 → 1.6.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/lib/cjs/ComboBox.js +2 -2
- package/lib/cjs/ComboBoxMultiple.js +3 -3
- package/lib/cjs/DownUpButton.d.ts +38 -0
- package/lib/cjs/DownUpButton.js +22 -0
- package/lib/cjs/Tiplist.js +2 -2
- package/lib/cjs/TiplistPro.js +2 -2
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/mjs/ComboBox.js +2 -2
- package/lib/mjs/ComboBoxMultiple.js +3 -3
- package/lib/mjs/DownUpButton.d.ts +38 -0
- package/lib/mjs/DownUpButton.js +16 -0
- package/lib/mjs/Tiplist.js +2 -2
- package/lib/mjs/TiplistPro.js +2 -2
- package/lib/mjs/index.d.ts +1 -0
- package/lib/mjs/index.js +1 -0
- package/package.json +6 -6
- package/src/ComboBox.tsx +3 -0
- package/src/ComboBoxMultiple.tsx +3 -0
- package/src/DownUpButton.tsx +73 -0
- package/src/Tiplist.tsx +3 -0
- package/src/TiplistPro.tsx +3 -0
- package/src/index.ts +1 -0
package/lib/cjs/ComboBox.js
CHANGED
|
@@ -27,7 +27,7 @@ function ComboBox(props) {
|
|
|
27
27
|
// Labels
|
|
28
28
|
const labels = app?.getLabels("noOptions", "loading", "open", "add");
|
|
29
29
|
// Destruct
|
|
30
|
-
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
|
|
30
|
+
const { disabled, search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
|
|
31
31
|
// Value input ref
|
|
32
32
|
const inputRef = react_1.default.createRef();
|
|
33
33
|
// Options state
|
|
@@ -124,7 +124,7 @@ function ComboBox(props) {
|
|
|
124
124
|
};
|
|
125
125
|
}, []);
|
|
126
126
|
// Layout
|
|
127
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
127
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
128
128
|
// Set value
|
|
129
129
|
setInputValue(value);
|
|
130
130
|
// Custom
|
|
@@ -29,7 +29,7 @@ function ComboBoxMultiple(props) {
|
|
|
29
29
|
// Labels
|
|
30
30
|
const labels = app?.getLabels("noOptions", "loading");
|
|
31
31
|
// Destruct
|
|
32
|
-
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
|
|
32
|
+
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, disabled, ...rest } = props;
|
|
33
33
|
// Value input ref
|
|
34
34
|
const inputRef = react_1.default.createRef();
|
|
35
35
|
// Options state
|
|
@@ -121,11 +121,11 @@ function ComboBoxMultiple(props) {
|
|
|
121
121
|
};
|
|
122
122
|
}, []);
|
|
123
123
|
// Layout
|
|
124
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue == null
|
|
124
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue == null
|
|
125
125
|
? []
|
|
126
126
|
: Array.isArray(stateValue)
|
|
127
127
|
? stateValue
|
|
128
|
-
: [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
128
|
+
: [stateValue], disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
129
129
|
// Set value
|
|
130
130
|
setInputValue(value.concat());
|
|
131
131
|
// Custom
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ButtonGroupProps } from "@mui/material/ButtonGroup";
|
|
2
|
+
/**
|
|
3
|
+
* Down & Up Button Props
|
|
4
|
+
*/
|
|
5
|
+
export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
|
|
6
|
+
/**
|
|
7
|
+
* Is down button disabled
|
|
8
|
+
*/
|
|
9
|
+
downDisabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Down button label
|
|
12
|
+
*/
|
|
13
|
+
downLabel?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Is up button disabled
|
|
16
|
+
*/
|
|
17
|
+
upDisabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Up button label
|
|
20
|
+
*/
|
|
21
|
+
upLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Down button click handler
|
|
24
|
+
* @param event Mouse click event
|
|
25
|
+
*/
|
|
26
|
+
onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Up button click handler
|
|
29
|
+
* @param event Mouse click event
|
|
30
|
+
*/
|
|
31
|
+
onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Down & Up Button
|
|
35
|
+
* @param props Props
|
|
36
|
+
* @returns Component
|
|
37
|
+
*/
|
|
38
|
+
export declare function DownUpButton(props: DownUpButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DownUpButton = DownUpButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
9
|
+
const ButtonGroup_1 = __importDefault(require("@mui/material/ButtonGroup"));
|
|
10
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
11
|
+
/**
|
|
12
|
+
* Down & Up Button
|
|
13
|
+
* @param props Props
|
|
14
|
+
* @returns Component
|
|
15
|
+
*/
|
|
16
|
+
function DownUpButton(props) {
|
|
17
|
+
// Global app
|
|
18
|
+
const app = (0, ReactApp_1.useAppContext)();
|
|
19
|
+
// Destruct
|
|
20
|
+
const { size = "small", downDisabled, downLabel = app?.get("moveDown") ?? "Down", upDisabled, upLabel = app?.get("moveUp") ?? "Up", onDownClick, onUpClick, ...rest } = props;
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)(ButtonGroup_1.default, { orientation: "vertical", size: size, ...rest, children: [(0, jsx_runtime_1.jsx)(Button_1.default, { disabled: upDisabled, onClick: onUpClick, children: upLabel }), (0, jsx_runtime_1.jsx)(Button_1.default, { disabled: downDisabled, onClick: onDownClick, children: downLabel })] }));
|
|
22
|
+
}
|
package/lib/cjs/Tiplist.js
CHANGED
|
@@ -23,7 +23,7 @@ function Tiplist(props) {
|
|
|
23
23
|
// Labels
|
|
24
24
|
const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
|
|
25
25
|
// Destruct
|
|
26
|
-
const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
|
|
26
|
+
const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, disabled, ...rest } = props;
|
|
27
27
|
if (width && sx)
|
|
28
28
|
Object.assign(sx, { width: `${width}px` });
|
|
29
29
|
// Value input ref
|
|
@@ -176,7 +176,7 @@ function Tiplist(props) {
|
|
|
176
176
|
};
|
|
177
177
|
}, []);
|
|
178
178
|
// Layout
|
|
179
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, disabled: disabled, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
180
180
|
// Set value
|
|
181
181
|
setInputValue(value);
|
|
182
182
|
// Custom
|
package/lib/cjs/TiplistPro.js
CHANGED
|
@@ -22,7 +22,7 @@ function TiplistPro(props) {
|
|
|
22
22
|
// Labels
|
|
23
23
|
const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
24
24
|
// Destruct
|
|
25
|
-
const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, ...rest } = props;
|
|
25
|
+
const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, disabled, ...rest } = props;
|
|
26
26
|
if (width && sx)
|
|
27
27
|
Object.assign(sx, { width: `${width}px` });
|
|
28
28
|
// Value input ref
|
|
@@ -162,7 +162,7 @@ function TiplistPro(props) {
|
|
|
162
162
|
};
|
|
163
163
|
}, []);
|
|
164
164
|
// Layout
|
|
165
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
165
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, disabled: disabled, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
166
166
|
if (typeof value === "object") {
|
|
167
167
|
// Set value
|
|
168
168
|
setInputValue(value);
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./DataSteps";
|
|
|
55
55
|
export * from "./DataTable";
|
|
56
56
|
export * from "./DialogButton";
|
|
57
57
|
export * from "./DnDList";
|
|
58
|
+
export * from "./DownUpButton";
|
|
58
59
|
export * from "./DraggablePaperComponent";
|
|
59
60
|
export * from "./EmailInput";
|
|
60
61
|
export * from "./ErrorAlert";
|
package/lib/cjs/index.js
CHANGED
|
@@ -71,6 +71,7 @@ __exportStar(require("./DataSteps"), exports);
|
|
|
71
71
|
__exportStar(require("./DataTable"), exports);
|
|
72
72
|
__exportStar(require("./DialogButton"), exports);
|
|
73
73
|
__exportStar(require("./DnDList"), exports);
|
|
74
|
+
__exportStar(require("./DownUpButton"), exports);
|
|
74
75
|
__exportStar(require("./DraggablePaperComponent"), exports);
|
|
75
76
|
__exportStar(require("./EmailInput"), exports);
|
|
76
77
|
__exportStar(require("./ErrorAlert"), exports);
|
package/lib/mjs/ComboBox.js
CHANGED
|
@@ -21,7 +21,7 @@ export function ComboBox(props) {
|
|
|
21
21
|
// Labels
|
|
22
22
|
const labels = app?.getLabels("noOptions", "loading", "open", "add");
|
|
23
23
|
// Destruct
|
|
24
|
-
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
|
|
24
|
+
const { disabled, search = false, autoAddBlankItem = search, idField = "id", idValue, idIsString = false, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
|
|
25
25
|
// Value input ref
|
|
26
26
|
const inputRef = React.createRef();
|
|
27
27
|
// Options state
|
|
@@ -118,7 +118,7 @@ export function ComboBox(props) {
|
|
|
118
118
|
};
|
|
119
119
|
}, []);
|
|
120
120
|
// Layout
|
|
121
|
-
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), _jsxs(Stack, { gap: 0.5, direction: "row", width: "100%", children: [_jsx(Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
121
|
+
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsxs(Stack, { gap: 0.5, direction: "row", width: "100%", children: [_jsx(Autocomplete, { value: stateValue, disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
122
122
|
// Set value
|
|
123
123
|
setInputValue(value);
|
|
124
124
|
// Custom
|
|
@@ -23,7 +23,7 @@ export function ComboBoxMultiple(props) {
|
|
|
23
23
|
// Labels
|
|
24
24
|
const labels = app?.getLabels("noOptions", "loading");
|
|
25
25
|
// Destruct
|
|
26
|
-
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
|
|
26
|
+
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, disabled, ...rest } = props;
|
|
27
27
|
// Value input ref
|
|
28
28
|
const inputRef = React.createRef();
|
|
29
29
|
// Options state
|
|
@@ -115,11 +115,11 @@ export function ComboBoxMultiple(props) {
|
|
|
115
115
|
};
|
|
116
116
|
}, []);
|
|
117
117
|
// Layout
|
|
118
|
-
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { value: stateValue == null
|
|
118
|
+
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsx(Autocomplete, { value: stateValue == null
|
|
119
119
|
? []
|
|
120
120
|
: Array.isArray(stateValue)
|
|
121
121
|
? stateValue
|
|
122
|
-
: [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
122
|
+
: [stateValue], disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
123
123
|
// Set value
|
|
124
124
|
setInputValue(value.concat());
|
|
125
125
|
// Custom
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ButtonGroupProps } from "@mui/material/ButtonGroup";
|
|
2
|
+
/**
|
|
3
|
+
* Down & Up Button Props
|
|
4
|
+
*/
|
|
5
|
+
export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
|
|
6
|
+
/**
|
|
7
|
+
* Is down button disabled
|
|
8
|
+
*/
|
|
9
|
+
downDisabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Down button label
|
|
12
|
+
*/
|
|
13
|
+
downLabel?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Is up button disabled
|
|
16
|
+
*/
|
|
17
|
+
upDisabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Up button label
|
|
20
|
+
*/
|
|
21
|
+
upLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Down button click handler
|
|
24
|
+
* @param event Mouse click event
|
|
25
|
+
*/
|
|
26
|
+
onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Up button click handler
|
|
29
|
+
* @param event Mouse click event
|
|
30
|
+
*/
|
|
31
|
+
onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Down & Up Button
|
|
35
|
+
* @param props Props
|
|
36
|
+
* @returns Component
|
|
37
|
+
*/
|
|
38
|
+
export declare function DownUpButton(props: DownUpButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import ButtonGroup from "@mui/material/ButtonGroup";
|
|
4
|
+
import { useAppContext } from "./app/ReactApp";
|
|
5
|
+
/**
|
|
6
|
+
* Down & Up Button
|
|
7
|
+
* @param props Props
|
|
8
|
+
* @returns Component
|
|
9
|
+
*/
|
|
10
|
+
export function DownUpButton(props) {
|
|
11
|
+
// Global app
|
|
12
|
+
const app = useAppContext();
|
|
13
|
+
// Destruct
|
|
14
|
+
const { size = "small", downDisabled, downLabel = app?.get("moveDown") ?? "Down", upDisabled, upLabel = app?.get("moveUp") ?? "Up", onDownClick, onUpClick, ...rest } = props;
|
|
15
|
+
return (_jsxs(ButtonGroup, { orientation: "vertical", size: size, ...rest, children: [_jsx(Button, { disabled: upDisabled, onClick: onUpClick, children: upLabel }), _jsx(Button, { disabled: downDisabled, onClick: onDownClick, children: downLabel })] }));
|
|
16
|
+
}
|
package/lib/mjs/Tiplist.js
CHANGED
|
@@ -17,7 +17,7 @@ export function Tiplist(props) {
|
|
|
17
17
|
// Labels
|
|
18
18
|
const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
|
|
19
19
|
// Destruct
|
|
20
|
-
const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
|
|
20
|
+
const { search = false, idField = "id", idValue, idIsString = false, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, disabled, ...rest } = props;
|
|
21
21
|
if (width && sx)
|
|
22
22
|
Object.assign(sx, { width: `${width}px` });
|
|
23
23
|
// Value input ref
|
|
@@ -170,7 +170,7 @@ export function Tiplist(props) {
|
|
|
170
170
|
};
|
|
171
171
|
}, []);
|
|
172
172
|
// Layout
|
|
173
|
-
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
173
|
+
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, disabled: disabled, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
174
174
|
// Set value
|
|
175
175
|
setInputValue(value);
|
|
176
176
|
// Custom
|
package/lib/mjs/TiplistPro.js
CHANGED
|
@@ -16,7 +16,7 @@ export function TiplistPro(props) {
|
|
|
16
16
|
// Labels
|
|
17
17
|
const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
|
|
18
18
|
// Destruct
|
|
19
|
-
const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, ...rest } = props;
|
|
19
|
+
const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, disabled, ...rest } = props;
|
|
20
20
|
if (width && sx)
|
|
21
21
|
Object.assign(sx, { width: `${width}px` });
|
|
22
22
|
// Value input ref
|
|
@@ -156,7 +156,7 @@ export function TiplistPro(props) {
|
|
|
156
156
|
};
|
|
157
157
|
}, []);
|
|
158
158
|
// Layout
|
|
159
|
-
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
159
|
+
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsx(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, disabled: disabled, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
160
160
|
if (typeof value === "object") {
|
|
161
161
|
// Set value
|
|
162
162
|
setInputValue(value);
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./DataSteps";
|
|
|
55
55
|
export * from "./DataTable";
|
|
56
56
|
export * from "./DialogButton";
|
|
57
57
|
export * from "./DnDList";
|
|
58
|
+
export * from "./DownUpButton";
|
|
58
59
|
export * from "./DraggablePaperComponent";
|
|
59
60
|
export * from "./EmailInput";
|
|
60
61
|
export * from "./ErrorAlert";
|
package/lib/mjs/index.js
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./DataSteps";
|
|
|
55
55
|
export * from "./DataTable";
|
|
56
56
|
export * from "./DialogButton";
|
|
57
57
|
export * from "./DnDList";
|
|
58
|
+
export * from "./DownUpButton";
|
|
58
59
|
export * from "./DraggablePaperComponent";
|
|
59
60
|
export * from "./EmailInput";
|
|
60
61
|
export * from "./ErrorAlert";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@dnd-kit/sortable": "^10.0.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.1",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.52",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.66",
|
|
45
|
-
"@etsoo/react": "^1.8.
|
|
45
|
+
"@etsoo/react": "^1.8.69",
|
|
46
46
|
"@etsoo/shared": "^1.2.80",
|
|
47
|
-
"@mui/icons-material": "^7.3.
|
|
48
|
-
"@mui/material": "^7.3.
|
|
49
|
-
"@mui/x-data-grid": "^8.
|
|
47
|
+
"@mui/icons-material": "^7.3.7",
|
|
48
|
+
"@mui/material": "^7.3.7",
|
|
49
|
+
"@mui/x-data-grid": "^8.24.0",
|
|
50
50
|
"chart.js": "^4.5.1",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"dompurify": "^3.3.1",
|
package/src/ComboBox.tsx
CHANGED
|
@@ -86,6 +86,7 @@ export function ComboBox<
|
|
|
86
86
|
|
|
87
87
|
// Destruct
|
|
88
88
|
const {
|
|
89
|
+
disabled,
|
|
89
90
|
search = false,
|
|
90
91
|
autoAddBlankItem = search,
|
|
91
92
|
idField = "id" as D,
|
|
@@ -246,11 +247,13 @@ export function ComboBox<
|
|
|
246
247
|
value={getValue(stateValue)}
|
|
247
248
|
readOnly
|
|
248
249
|
onChange={inputOnChange}
|
|
250
|
+
disabled={disabled}
|
|
249
251
|
/>
|
|
250
252
|
{/* Previous input will reset first with "disableClearable = false", next input trigger change works */}
|
|
251
253
|
<Stack gap={0.5} direction="row" width="100%">
|
|
252
254
|
<Autocomplete<T, false, false, false>
|
|
253
255
|
value={stateValue}
|
|
256
|
+
disabled={disabled}
|
|
254
257
|
disableCloseOnSelect={disableCloseOnSelect}
|
|
255
258
|
getOptionLabel={getOptionLabel}
|
|
256
259
|
isOptionEqualToValue={(option: T, value: T) =>
|
package/src/ComboBoxMultiple.tsx
CHANGED
|
@@ -126,6 +126,7 @@ export function ComboBoxMultiple<
|
|
|
126
126
|
sx = { minWidth: "150px" },
|
|
127
127
|
noOptionsText = labels?.noOptions,
|
|
128
128
|
loadingText = labels?.loading,
|
|
129
|
+
disabled,
|
|
129
130
|
...rest
|
|
130
131
|
} = props;
|
|
131
132
|
|
|
@@ -249,6 +250,7 @@ export function ComboBoxMultiple<
|
|
|
249
250
|
value={getValue(stateValue)}
|
|
250
251
|
readOnly
|
|
251
252
|
onChange={inputOnChange}
|
|
253
|
+
disabled={disabled}
|
|
252
254
|
/>
|
|
253
255
|
{/* Previous input will reset first with "disableClearable = false", next input trigger change works */}
|
|
254
256
|
<Autocomplete<T, true, false, false>
|
|
@@ -259,6 +261,7 @@ export function ComboBoxMultiple<
|
|
|
259
261
|
? stateValue
|
|
260
262
|
: [stateValue]
|
|
261
263
|
}
|
|
264
|
+
disabled={disabled}
|
|
262
265
|
disableCloseOnSelect={disableCloseOnSelect}
|
|
263
266
|
getOptionLabel={getOptionLabel}
|
|
264
267
|
getOptionKey={getOptionKey}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Button from "@mui/material/Button";
|
|
2
|
+
import ButtonGroup, { ButtonGroupProps } from "@mui/material/ButtonGroup";
|
|
3
|
+
import { useAppContext } from "./app/ReactApp";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Down & Up Button Props
|
|
7
|
+
*/
|
|
8
|
+
export type DownUpButtonProps = Omit<ButtonGroupProps, "orientation"> & {
|
|
9
|
+
/**
|
|
10
|
+
* Is down button disabled
|
|
11
|
+
*/
|
|
12
|
+
downDisabled?: boolean;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Down button label
|
|
16
|
+
*/
|
|
17
|
+
downLabel?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Is up button disabled
|
|
21
|
+
*/
|
|
22
|
+
upDisabled?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Up button label
|
|
26
|
+
*/
|
|
27
|
+
upLabel?: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Down button click handler
|
|
31
|
+
* @param event Mouse click event
|
|
32
|
+
*/
|
|
33
|
+
onDownClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Up button click handler
|
|
37
|
+
* @param event Mouse click event
|
|
38
|
+
*/
|
|
39
|
+
onUpClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Down & Up Button
|
|
44
|
+
* @param props Props
|
|
45
|
+
* @returns Component
|
|
46
|
+
*/
|
|
47
|
+
export function DownUpButton(props: DownUpButtonProps) {
|
|
48
|
+
// Global app
|
|
49
|
+
const app = useAppContext();
|
|
50
|
+
|
|
51
|
+
// Destruct
|
|
52
|
+
const {
|
|
53
|
+
size = "small",
|
|
54
|
+
downDisabled,
|
|
55
|
+
downLabel = app?.get("moveDown") ?? "Down",
|
|
56
|
+
upDisabled,
|
|
57
|
+
upLabel = app?.get("moveUp") ?? "Up",
|
|
58
|
+
onDownClick,
|
|
59
|
+
onUpClick,
|
|
60
|
+
...rest
|
|
61
|
+
} = props;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<ButtonGroup orientation="vertical" size={size} {...rest}>
|
|
65
|
+
<Button disabled={upDisabled} onClick={onUpClick}>
|
|
66
|
+
{upLabel}
|
|
67
|
+
</Button>
|
|
68
|
+
<Button disabled={downDisabled} onClick={onDownClick}>
|
|
69
|
+
{downLabel}
|
|
70
|
+
</Button>
|
|
71
|
+
</ButtonGroup>
|
|
72
|
+
);
|
|
73
|
+
}
|
package/src/Tiplist.tsx
CHANGED
|
@@ -102,6 +102,7 @@ export function Tiplist<
|
|
|
102
102
|
getOptionDisabled,
|
|
103
103
|
sx = {},
|
|
104
104
|
minChars,
|
|
105
|
+
disabled,
|
|
105
106
|
...rest
|
|
106
107
|
} = props;
|
|
107
108
|
|
|
@@ -302,10 +303,12 @@ export function Tiplist<
|
|
|
302
303
|
}`}
|
|
303
304
|
readOnly
|
|
304
305
|
onChange={inputOnChange}
|
|
306
|
+
disabled={disabled}
|
|
305
307
|
/>
|
|
306
308
|
{/* Previous input will reset first with "disableClearable = false", next input trigger change works */}
|
|
307
309
|
<Autocomplete<T, undefined, false, false>
|
|
308
310
|
filterOptions={(options, _state) => options}
|
|
311
|
+
disabled={disabled}
|
|
309
312
|
value={states.value}
|
|
310
313
|
options={states.options}
|
|
311
314
|
onChange={(event, value, reason, details) => {
|
package/src/TiplistPro.tsx
CHANGED
|
@@ -132,6 +132,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
|
|
|
132
132
|
onChange,
|
|
133
133
|
onValueChange,
|
|
134
134
|
minChars,
|
|
135
|
+
disabled,
|
|
135
136
|
...rest
|
|
136
137
|
} = props;
|
|
137
138
|
|
|
@@ -314,12 +315,14 @@ export function TiplistPro<T extends ListType2 = ListType2>(
|
|
|
314
315
|
value={inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}
|
|
315
316
|
readOnly
|
|
316
317
|
onChange={inputOnChange}
|
|
318
|
+
disabled={disabled}
|
|
317
319
|
/>
|
|
318
320
|
{/* Previous input will reset first with "disableClearable = false", next input trigger change works */}
|
|
319
321
|
<Autocomplete<T, false, false, true>
|
|
320
322
|
filterOptions={(options, _state) => options}
|
|
321
323
|
value={states.value}
|
|
322
324
|
options={states.options}
|
|
325
|
+
disabled={disabled}
|
|
323
326
|
freeSolo
|
|
324
327
|
clearOnBlur={false}
|
|
325
328
|
onChange={(event, value, reason, details) => {
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ export * from "./DataSteps";
|
|
|
61
61
|
export * from "./DataTable";
|
|
62
62
|
export * from "./DialogButton";
|
|
63
63
|
export * from "./DnDList";
|
|
64
|
+
export * from "./DownUpButton";
|
|
64
65
|
export * from "./DraggablePaperComponent";
|
|
65
66
|
export * from "./EmailInput";
|
|
66
67
|
export * from "./ErrorAlert";
|