@etsoo/materialui 1.1.69 → 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, sx = { minWidth: "180px" }, 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, sx: sx, 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.69",
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,19 +77,22 @@ export function Tiplist<
71
77
  defaultValue,
72
78
  value,
73
79
  maxItems = 16,
80
+ width,
74
81
  name,
75
82
  readOnly,
76
83
  onChange,
77
84
  openOnFocus = true,
78
- sx = { minWidth: "180px" },
79
85
  noOptionsText = noOptions,
80
86
  loadingText = loading,
81
87
  openText = openDefault,
82
88
  getOptionLabel,
83
89
  getOptionDisabled,
90
+ sx = {},
84
91
  ...rest
85
92
  } = props;
86
93
 
94
+ if (width && sx) Object.assign(sx, { width: `${width}px` });
95
+
87
96
  // Value input ref
88
97
  const inputRef = React.createRef<HTMLInputElement>();
89
98
 
@@ -282,7 +291,6 @@ export function Tiplist<
282
291
  });
283
292
  }}
284
293
  loading={states.loading}
285
- sx={sx}
286
294
  renderInput={(params) =>
287
295
  search ? (
288
296
  <SearchField
@@ -316,6 +324,7 @@ export function Tiplist<
316
324
  isOptionEqualToValue={(option: T, value: T) =>
317
325
  option[idField] === value[idField]
318
326
  }
327
+ sx={sx}
319
328
  noOptionsText={noOptionsText}
320
329
  loadingText={loadingText}
321
330
  openText={openText}