@etsoo/materialui 1.4.49 → 1.4.51

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/ComboBox.js CHANGED
@@ -17,7 +17,7 @@ export function ComboBox(props) {
17
17
  // Labels
18
18
  const labels = globalApp?.getLabels("noOptions", "loading", "open", "add");
19
19
  // Destruct
20
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, 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, ...rest } = props;
20
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, 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;
21
21
  // Value input ref
22
22
  const inputRef = React.createRef();
23
23
  // Options state
@@ -122,7 +122,7 @@ export function ComboBox(props) {
122
122
  onChange(event, value, reason, details);
123
123
  if (onValueChange)
124
124
  onValueChange(value);
125
- }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (_jsx(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (_jsx(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, ...rest }), onAdd && (_jsx(IconButton, { size: "small", onClick: () => {
125
+ }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (_jsx(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (_jsx(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && (_jsx(IconButton, { size: "small", onClick: () => {
126
126
  onAdd(doLoadData);
127
127
  }, title: addLabel, children: _jsx(AddIcon, {}) }))] })] }));
128
128
  }
@@ -1,4 +1,4 @@
1
- import { GridColumn, GridLoaderStates, ScrollerGridProps } from "@etsoo/react";
1
+ import { GridColumn, GridJsonData, GridLoadDataProps, GridLoaderStates, ScrollerGridProps } from "@etsoo/react";
2
2
  import React from "react";
3
3
  import { MouseEventWithDataHandler } from "./MUGlobal";
4
4
  /**
@@ -14,7 +14,7 @@ export type DataGridExFooterItemRendererProps<T extends object> = {
14
14
  /**
15
15
  * Extended DataGrid with VariableSizeGrid props
16
16
  */
17
- export type DataGridExProps<T extends object> = Omit<ScrollerGridProps<T>, "itemRenderer" | "columnCount" | "columnWidth" | "width"> & {
17
+ export type DataGridExProps<T extends object, P extends GridJsonData = GridLoadDataProps> = Omit<ScrollerGridProps<T, P>, "itemRenderer" | "columnCount" | "columnWidth" | "width"> & {
18
18
  /**
19
19
  * Alternating colors for odd/even rows
20
20
  */
@@ -1,9 +1,10 @@
1
+ import { GridJsonData, GridTemplateType } from "@etsoo/react";
1
2
  import type { DataGridExProps } from "../DataGridEx";
2
3
  import type { SearchPageProps } from "./SearchPageProps";
3
4
  /**
4
5
  * DataGrid page props
5
6
  */
6
- export type DataGridPageProps<T extends object, F> = Omit<DataGridExProps<T>, "loadData" | "height"> & SearchPageProps<T, F> & {
7
+ export type DataGridPageProps<T extends object, F> = DataGridExProps<T, GridJsonData & GridTemplateType<F>> & SearchPageProps<T, F> & {
7
8
  /**
8
9
  * Height will be deducted
9
10
  * @param height Current calcuated height
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.49",
3
+ "version": "1.4.51",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -33,15 +33,15 @@
33
33
  "@dnd-kit/core": "^6.3.1",
34
34
  "@dnd-kit/sortable": "^10.0.0",
35
35
  "@emotion/css": "^11.13.5",
36
- "@emotion/react": "^11.13.5",
37
- "@emotion/styled": "^11.13.5",
38
- "@etsoo/appscript": "^1.5.78",
36
+ "@emotion/react": "^11.14.0",
37
+ "@emotion/styled": "^11.14.0",
38
+ "@etsoo/appscript": "^1.5.79",
39
39
  "@etsoo/notificationbase": "^1.1.54",
40
- "@etsoo/react": "^1.8.13",
40
+ "@etsoo/react": "^1.8.14",
41
41
  "@etsoo/shared": "^1.2.55",
42
- "@mui/icons-material": "^6.1.10",
43
- "@mui/material": "^6.1.10",
44
- "@mui/x-data-grid": "^7.23.1",
42
+ "@mui/icons-material": "^6.2.0",
43
+ "@mui/material": "^6.2.0",
44
+ "@mui/x-data-grid": "^7.23.2",
45
45
  "chart.js": "^4.4.7",
46
46
  "chartjs-plugin-datalabels": "^2.2.0",
47
47
  "eventemitter3": "^5.0.1",
package/src/ComboBox.tsx CHANGED
@@ -117,6 +117,7 @@ export function ComboBox<
117
117
  openText = labels?.open,
118
118
  addLabel = labels?.add,
119
119
  onAdd,
120
+ getOptionKey = (option: T) => `${option[idField]}`,
120
121
  ...rest
121
122
  } = props;
122
123
 
@@ -292,6 +293,7 @@ export function ComboBox<
292
293
  noOptionsText={noOptionsText}
293
294
  loadingText={loadingText}
294
295
  openText={openText}
296
+ getOptionKey={getOptionKey}
295
297
  {...rest}
296
298
  />
297
299
  {onAdd && (
@@ -5,6 +5,8 @@ import {
5
5
  GridCellRendererProps,
6
6
  GridColumn,
7
7
  GridHeaderCellRendererProps,
8
+ GridJsonData,
9
+ GridLoadDataProps,
8
10
  GridLoaderPartialStates,
9
11
  GridLoaderStates,
10
12
  ScrollerGrid,
@@ -40,8 +42,11 @@ export type DataGridExFooterItemRendererProps<T extends object> = {
40
42
  /**
41
43
  * Extended DataGrid with VariableSizeGrid props
42
44
  */
43
- export type DataGridExProps<T extends object> = Omit<
44
- ScrollerGridProps<T>,
45
+ export type DataGridExProps<
46
+ T extends object,
47
+ P extends GridJsonData = GridLoadDataProps
48
+ > = Omit<
49
+ ScrollerGridProps<T, P>,
45
50
  "itemRenderer" | "columnCount" | "columnWidth" | "width"
46
51
  > & {
47
52
  /**
@@ -1,12 +1,13 @@
1
+ import { GridJsonData, GridTemplateType } from "@etsoo/react";
1
2
  import type { DataGridExProps } from "../DataGridEx";
2
3
  import type { SearchPageProps } from "./SearchPageProps";
3
4
 
4
5
  /**
5
6
  * DataGrid page props
6
7
  */
7
- export type DataGridPageProps<T extends object, F> = Omit<
8
- DataGridExProps<T>,
9
- "loadData" | "height"
8
+ export type DataGridPageProps<T extends object, F> = DataGridExProps<
9
+ T,
10
+ GridJsonData & GridTemplateType<F>
10
11
  > &
11
12
  SearchPageProps<T, F> & {
12
13
  /**