@etsoo/materialui 1.1.70 → 1.1.71

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/Tiplist.d.ts CHANGED
@@ -13,6 +13,10 @@ export type TiplistProps<T extends object, D extends DataTypes.Keys<T>> = Omit<A
13
13
  * Max items to read and display
14
14
  */
15
15
  maxItems?: number;
16
+ /**
17
+ * Width
18
+ */
19
+ width?: number;
16
20
  };
17
21
  /**
18
22
  * Tiplist
package/lib/Tiplist.js CHANGED
@@ -15,7 +15,9 @@ export function Tiplist(props) {
15
15
  // Labels
16
16
  const { noOptions, loading, more, open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
17
17
  // Destruct
18
- const { search = false, idField = "id", idValue, inputAutoComplete = "new-password", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, maxItems = 16, name, readOnly, onChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, ...rest } = props;
18
+ const { search = false, idField = "id", idValue, inputAutoComplete = "new-password", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width, name, readOnly, onChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, ...rest } = props;
19
+ if (width && sx)
20
+ Object.assign(sx, { width: `${width}px` });
19
21
  // Value input ref
20
22
  const inputRef = React.createRef();
21
23
  // Local value
@@ -156,7 +158,7 @@ export function Tiplist(props) {
156
158
  open: false,
157
159
  ...(!states.value && { options: [] })
158
160
  });
159
- }, loading: states.loading, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...addReadOnly(params), readOnly: readOnly, label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
161
+ }, loading: states.loading, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...addReadOnly(params), readOnly: readOnly, label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
160
162
  if (item[idField] === "n/a")
161
163
  return true;
162
164
  return getOptionDisabled ? getOptionDisabled(item) : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.70",
3
+ "version": "1.1.71",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/Tiplist.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactUtils, useDelayedExecutor } from "@etsoo/react";
2
2
  import { DataTypes, IdDefaultType, ListType } from "@etsoo/shared";
3
3
  import { Autocomplete, AutocompleteRenderInputParams } from "@mui/material";
4
+ import { width } from "@mui/system";
4
5
  import React from "react";
5
6
  import { globalApp } from "./app/ReactApp";
6
7
  import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
@@ -27,6 +28,11 @@ export type TiplistProps<T extends object, D extends DataTypes.Keys<T>> = Omit<
27
28
  * Max items to read and display
28
29
  */
29
30
  maxItems?: number;
31
+
32
+ /**
33
+ * Width
34
+ */
35
+ width?: number;
30
36
  };
31
37
 
32
38
  // Multiple states
@@ -71,6 +77,7 @@ export function Tiplist<
71
77
  defaultValue,
72
78
  value,
73
79
  maxItems = 16,
80
+ width,
74
81
  name,
75
82
  readOnly,
76
83
  onChange,
@@ -80,9 +87,12 @@ export function Tiplist<
80
87
  openText = openDefault,
81
88
  getOptionLabel,
82
89
  getOptionDisabled,
90
+ sx = {},
83
91
  ...rest
84
92
  } = props;
85
93
 
94
+ if (width && sx) Object.assign(sx, { width: `${width}px` });
95
+
86
96
  // Value input ref
87
97
  const inputRef = React.createRef<HTMLInputElement>();
88
98
 
@@ -314,6 +324,7 @@ export function Tiplist<
314
324
  isOptionEqualToValue={(option: T, value: T) =>
315
325
  option[idField] === value[idField]
316
326
  }
327
+ sx={sx}
317
328
  noOptionsText={noOptionsText}
318
329
  loadingText={loadingText}
319
330
  openText={openText}