@etsoo/materialui 1.4.22 → 1.4.24

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.
Files changed (93) hide show
  1. package/README.md +2 -1
  2. package/__tests__/ReactAppTests.tsx +6 -4
  3. package/babel.config.json +12 -12
  4. package/lib/AddresSelector.d.ts +8 -2
  5. package/lib/AddresSelector.js +1 -1
  6. package/lib/AuditDisplay.d.ts +1 -1
  7. package/lib/BackButton.d.ts +1 -1
  8. package/lib/BackButton.js +5 -5
  9. package/lib/CountryList.d.ts +5 -4
  10. package/lib/CountryList.js +3 -3
  11. package/lib/CustomFabProps.d.ts +3 -3
  12. package/lib/DataGridEx.js +3 -6
  13. package/lib/DataGridRenderers.d.ts +3 -3
  14. package/lib/DataGridRenderers.js +17 -17
  15. package/lib/DataTable.d.ts +1 -7
  16. package/lib/DataTable.js +3 -13
  17. package/lib/DialogButton.d.ts +2 -2
  18. package/lib/DialogButton.js +4 -4
  19. package/lib/EmailInput.d.ts +2 -2
  20. package/lib/EmailInput.js +2 -2
  21. package/lib/FlexBox.d.ts +3 -3
  22. package/lib/FlexBox.js +1 -1
  23. package/lib/GridDataFormat.d.ts +2 -2
  24. package/lib/GridDataFormat.js +7 -7
  25. package/lib/GridUtils.js +2 -1
  26. package/lib/ListItemRightIcon.d.ts +1 -1
  27. package/lib/ListItemRightIcon.js +2 -2
  28. package/lib/LoadingButton.d.ts +1 -1
  29. package/lib/LoadingButton.js +2 -2
  30. package/lib/MUGlobal.d.ts +6 -6
  31. package/lib/MUGlobal.js +20 -22
  32. package/lib/MobileListItemRenderer.d.ts +3 -3
  33. package/lib/MobileListItemRenderer.js +8 -10
  34. package/lib/PList.js +1 -1
  35. package/lib/ProgressCount.js +12 -12
  36. package/lib/RegionsRQ.d.ts +22 -0
  37. package/lib/RegionsRQ.js +1 -0
  38. package/lib/SearchField.d.ts +1 -1
  39. package/lib/SearchField.js +4 -4
  40. package/lib/SearchOptionGroup.d.ts +2 -2
  41. package/lib/SearchOptionGroup.js +3 -3
  42. package/lib/Switch.d.ts +3 -3
  43. package/lib/Switch.js +5 -5
  44. package/lib/TabBox.d.ts +5 -5
  45. package/lib/TabBox.js +5 -5
  46. package/lib/TableEx.js +4 -7
  47. package/lib/TooltipClick.d.ts +3 -3
  48. package/lib/TooltipClick.js +3 -3
  49. package/lib/TwoFieldInput.d.ts +2 -2
  50. package/lib/TwoFieldInput.js +13 -13
  51. package/lib/app/IServicePage.d.ts +1 -1
  52. package/lib/app/Labels.d.ts +1 -1
  53. package/lib/app/Labels.js +31 -31
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +1 -0
  56. package/lib/texts/MoneyText.d.ts +1 -1
  57. package/lib/texts/MoneyText.js +3 -3
  58. package/lib/texts/NumberText.d.ts +1 -1
  59. package/lib/texts/NumberText.js +3 -3
  60. package/package.json +20 -20
  61. package/src/AddresSelector.tsx +31 -4
  62. package/src/AuditDisplay.tsx +1 -1
  63. package/src/BackButton.tsx +39 -39
  64. package/src/CountryList.tsx +49 -48
  65. package/src/CustomFabProps.ts +19 -19
  66. package/src/DataGridEx.tsx +2 -7
  67. package/src/DataGridRenderers.tsx +119 -119
  68. package/src/DataTable.tsx +2 -31
  69. package/src/DialogButton.tsx +149 -151
  70. package/src/EmailInput.tsx +9 -11
  71. package/src/FlexBox.tsx +6 -6
  72. package/src/GridDataFormat.tsx +58 -58
  73. package/src/GridUtils.ts +2 -1
  74. package/src/ListItemRightIcon.tsx +3 -3
  75. package/src/LoadingButton.tsx +53 -53
  76. package/src/MUGlobal.ts +196 -203
  77. package/src/MobileListItemRenderer.tsx +63 -65
  78. package/src/NotifierPromptProps.ts +16 -16
  79. package/src/PList.tsx +14 -14
  80. package/src/ProgressCount.tsx +144 -148
  81. package/src/RegionsRQ.ts +26 -0
  82. package/src/SearchField.tsx +59 -59
  83. package/src/SearchOptionGroup.tsx +20 -20
  84. package/src/Switch.tsx +72 -72
  85. package/src/TabBox.tsx +87 -89
  86. package/src/TableEx.tsx +5 -8
  87. package/src/TooltipClick.tsx +62 -64
  88. package/src/TwoFieldInput.tsx +104 -104
  89. package/src/app/IServicePage.ts +1 -1
  90. package/src/app/Labels.ts +67 -67
  91. package/src/index.ts +1 -0
  92. package/src/texts/MoneyText.tsx +29 -35
  93. package/src/texts/NumberText.tsx +23 -23
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # AppReact
2
+
2
3
  **TypeScript Material-UI Implementation**
3
4
 
4
5
  ## Installing
@@ -13,4 +14,4 @@ Using yarn:
13
14
 
14
15
  ```bash
15
16
  $ yarn add @etsoo/materialui
16
- ```
17
+ ```
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  AddressUtils,
3
3
  ApiAuthorizationScheme,
4
- ExternalSettings,
5
- en,
6
- zhHans
4
+ Culture,
5
+ ExternalSettings
7
6
  } from "@etsoo/appscript";
8
7
  import { ReactApp } from "../src";
9
8
  import { DataTypes, DomUtils, IActionResult, Utils } from "@etsoo/shared";
@@ -21,7 +20,10 @@ const { detectedCountry } = DomUtils;
21
20
  const { detectedCulture } = DomUtils;
22
21
 
23
22
  // Supported cultures
24
- const supportedCultures: DataTypes.CultureDefinition[] = [zhHans({}), en({})];
23
+ const supportedCultures: DataTypes.CultureDefinition[] = [
24
+ Culture.zhHans({}),
25
+ Culture.en({})
26
+ ];
25
27
 
26
28
  // Supported regions
27
29
  const supportedRegions = ["CN"];
package/babel.config.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
- "presets": [
3
- ["@babel/env"],
4
- "@babel/preset-typescript",
5
- "@babel/preset-react"
6
- ],
7
- "plugins": [
8
- [
9
- "@babel/plugin-transform-runtime",
10
- {
11
- "corejs": 3
12
- }
13
- ]
2
+ "presets": [
3
+ ["@babel/env"],
4
+ "@babel/preset-typescript",
5
+ "@babel/preset-react"
6
+ ],
7
+ "plugins": [
8
+ [
9
+ "@babel/plugin-transform-runtime",
10
+ {
11
+ "corejs": 3
12
+ }
14
13
  ]
14
+ ]
15
15
  }
@@ -1,7 +1,8 @@
1
- import { AddressApi, AddressCity, AddressDistrict, AddressRegionDb, AddressState } from "@etsoo/appscript";
1
+ import { AddressCity, AddressDistrict, AddressRegionDb, AddressState, IApiPayload } from "@etsoo/appscript";
2
2
  import { GridSize } from "@mui/material";
3
3
  import React from "react";
4
4
  import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
5
+ import { RegionsRQ } from "./RegionsRQ";
5
6
  /**
6
7
  * Address field
7
8
  */
@@ -20,7 +21,12 @@ export type AddressSelectorProps = {
20
21
  /**
21
22
  * Address API
22
23
  */
23
- api: AddressApi;
24
+ api: {
25
+ regions(rq: RegionsRQ, payload?: IApiPayload<AddressRegionDb[]>): Promise<AddressRegionDb[] | undefined>;
26
+ states(regionId: string, favoredIds?: string[], payload?: IApiPayload<AddressState[]>, culture?: string): Promise<AddressState[] | undefined>;
27
+ cities(stateId: string, favoredIds?: number[], payload?: IApiPayload<AddressCity[]>, culture?: string): Promise<AddressCity[] | undefined>;
28
+ districts(cityId: number, favoredIds?: number[], payload?: IApiPayload<AddressDistrict[]>, culture?: string): Promise<AddressDistrict[] | undefined>;
29
+ };
24
30
  /**
25
31
  * Break points
26
32
  */
@@ -123,7 +123,7 @@ export function AddressSelector(props) {
123
123
  }
124
124
  };
125
125
  // Layout
126
- return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid2, { size: { xs: 12 }, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), !hideRegion && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: regionLabel, name: AddressField.Region, search: search, fullWidth: true, idValue: regionState, loadData: (keyword, id, items) => api.getRegions({
126
+ return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid2, { size: { xs: 12 }, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), !hideRegion && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: regionLabel, name: AddressField.Region, search: search, fullWidth: true, idValue: regionState, loadData: (keyword, id, items) => api.regions({
127
127
  keyword,
128
128
  id,
129
129
  items,
@@ -1,7 +1,7 @@
1
- import { AuditLineDto } from "@etsoo/appscript";
2
1
  import { Theme } from "@mui/material";
3
2
  import React, { CSSProperties } from "react";
4
3
  import { ListMoreDisplayProps } from "./ListMoreDisplay";
4
+ import { AuditLineDto } from "@etsoo/appscript";
5
5
  /**
6
6
  * Audit display props
7
7
  */
@@ -1,4 +1,4 @@
1
- import { IconButtonProps } from '@mui/material';
1
+ import { IconButtonProps } from "@mui/material";
2
2
  /**
3
3
  * BackButton props
4
4
  */
package/lib/BackButton.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { IconButton, useTheme } from '@mui/material';
3
- import ArrowBackIcon from '@mui/icons-material/ArrowBack';
4
- import { useNavigate } from 'react-router-dom';
2
+ import { IconButton, useTheme } from "@mui/material";
3
+ import ArrowBackIcon from "@mui/icons-material/ArrowBack";
4
+ import { useNavigate } from "react-router-dom";
5
5
  /**
6
6
  * BackButton
7
7
  * @param props Props
@@ -9,13 +9,13 @@ import { useNavigate } from 'react-router-dom';
9
9
  */
10
10
  export function BackButton(props) {
11
11
  // Destruct
12
- const { color = 'primary', size = 'small', onClick, ...rest } = props;
12
+ const { color = "primary", size = "small", onClick, ...rest } = props;
13
13
  // Theme
14
14
  const theme = useTheme();
15
15
  // Navigate
16
16
  const navigate = useNavigate();
17
17
  // Color
18
- const pColor = color != 'inherit' && color != 'default' && color in theme.palette
18
+ const pColor = color != "inherit" && color != "default" && color in theme.palette
19
19
  ? theme.palette[color]
20
20
  : theme.palette.primary;
21
21
  // Click handler
@@ -1,10 +1,11 @@
1
- import { AddressRegionDb, RegionsRQ } from '@etsoo/appscript';
2
- import { DataTypes } from '@etsoo/shared';
3
- import { TiplistProps } from './Tiplist';
1
+ import { AddressRegionDb } from "@etsoo/appscript";
2
+ import { DataTypes } from "@etsoo/shared";
3
+ import { TiplistProps } from "./Tiplist";
4
+ import { RegionsRQ } from "./RegionsRQ";
4
5
  /**
5
6
  * Country list props
6
7
  */
7
- export type CountryListProps = Omit<DataTypes.Optional<TiplistProps<AddressRegionDb, 'id'>, 'name'>, 'loadData'> & {
8
+ export type CountryListProps = Omit<DataTypes.Optional<TiplistProps<AddressRegionDb, "id">, "name">, "loadData"> & {
8
9
  /**
9
10
  * Load data
10
11
  * @param rq Request data
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { Tiplist } from './Tiplist';
2
+ import React from "react";
3
+ import { Tiplist } from "./Tiplist";
4
4
  /**
5
5
  * Country list
6
6
  * @param props Props
@@ -8,7 +8,7 @@ import { Tiplist } from './Tiplist';
8
8
  */
9
9
  export function CountryList(props) {
10
10
  // Destruct
11
- const { items = 16, loadData, loadFavoredIds, name = 'countryId', ...rest } = props;
11
+ const { items = 16, loadData, loadFavoredIds, name = "countryId", ...rest } = props;
12
12
  // Ref
13
13
  const favoredIds = React.useRef([]);
14
14
  // Ready
@@ -1,9 +1,9 @@
1
- import { FabPropsColorOverrides, PropTypes } from '@mui/material';
2
- import { OverridableStringUnion } from '@mui/types';
1
+ import { FabPropsColorOverrides, PropTypes } from "@mui/material";
2
+ import { OverridableStringUnion } from "@mui/types";
3
3
  /**
4
4
  * Custom fab size
5
5
  */
6
- export type CustomFabSize = 'small' | 'medium' | 'large';
6
+ export type CustomFabSize = "small" | "medium" | "large";
7
7
  /**
8
8
  * Custom fab props
9
9
  */
package/lib/DataGridEx.js CHANGED
@@ -91,7 +91,7 @@ export function DataGridEx(props) {
91
91
  });
92
92
  }
93
93
  else if (sortable && field != null) {
94
- const active = orderBy === field;
94
+ const active = orderBy != null && orderBy[field] != null;
95
95
  sortLabel = (_jsx(TableSortLabel, { active: active, direction: sortAsc ? "asc" : "desc", onClick: (_event) => {
96
96
  if (active)
97
97
  column.sortAsc = !sortAsc;
@@ -165,7 +165,7 @@ export function DataGridEx(props) {
165
165
  });
166
166
  // New sort
167
167
  const handleSort = (field, asc) => {
168
- reset({ queryPaging: { orderBy: field, orderByAsc: asc } });
168
+ reset({ queryPaging: { orderBy: { [field]: asc ?? true } } });
169
169
  };
170
170
  // Reset
171
171
  const reset = (add) => {
@@ -283,10 +283,7 @@ export function DataGridEx(props) {
283
283
  }, [columns, width]);
284
284
  // Table
285
285
  const table = React.useMemo(() => {
286
- const defaultOrderByAsc = defaultOrderBy
287
- ? columns.find((column) => column.field === defaultOrderBy)?.sortAsc
288
- : undefined;
289
- return (_jsx(ScrollerGrid, { className: Utils.mergeClasses("DataGridEx-Body", "DataGridEx-CustomBar", className, createGridStyle(alternatingColors, selectedColor, hoverColor)), columnCount: columns.length, columnWidth: columnWidth, defaultOrderBy: defaultOrderBy, defaultOrderByAsc: defaultOrderByAsc, height: height -
286
+ return (_jsx(ScrollerGrid, { className: Utils.mergeClasses("DataGridEx-Body", "DataGridEx-CustomBar", className, createGridStyle(alternatingColors, selectedColor, hoverColor)), columnCount: columns.length, columnWidth: columnWidth, defaultOrderBy: defaultOrderBy, height: height -
290
287
  headerHeight -
291
288
  (hideFooter ? 0 : bottomHeight + 1) -
292
289
  scrollbarSize, headerRenderer: headerRenderer, idField: idField, itemRenderer: itemRenderer, footerRenderer: hideFooter ? undefined : footerRenderer, width: Math.max(width ?? 0, widthCalculator.total), mRef: mRefLocal, ...rest }));
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { DataGridExFooterItemRendererProps } from './DataGridEx';
3
- import { GridCellRendererProps } from '@etsoo/react';
1
+ import React from "react";
2
+ import { DataGridExFooterItemRendererProps } from "./DataGridEx";
3
+ import { GridCellRendererProps } from "@etsoo/react";
4
4
  /**
5
5
  * Data grid renderers
6
6
  */
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CircularProgress } from '@mui/material';
3
- import { DateUtils, NumberUtils } from '@etsoo/shared';
4
- import CheckIcon from '@mui/icons-material/Check';
5
- import ClearIcon from '@mui/icons-material/Clear';
6
- import { DateText } from './texts/DateText';
7
- import { GridDataType } from '@etsoo/react';
2
+ import { CircularProgress } from "@mui/material";
3
+ import { DateUtils, NumberUtils } from "@etsoo/shared";
4
+ import CheckIcon from "@mui/icons-material/Check";
5
+ import ClearIcon from "@mui/icons-material/Clear";
6
+ import { DateText } from "./texts/DateText";
7
+ import { GridDataType } from "@etsoo/react";
8
8
  /**
9
9
  * Data grid renderers
10
10
  */
@@ -35,7 +35,7 @@ export var DataGridRenderers;
35
35
  // Conversion if necessary
36
36
  if (type === GridDataType.Date || type === GridDataType.DateTime) {
37
37
  const dateValue = value instanceof Date ? value : new Date(value);
38
- const option = type === GridDataType.DateTime ? 'ds' : 'd';
38
+ const option = type === GridDataType.DateTime ? "ds" : "d";
39
39
  const nearDays = renderProps?.nearDays;
40
40
  if (nearDays != null) {
41
41
  return (_jsx(DateText, { value: dateValue, locale: renderProps?.culture, timeZone: renderProps?.timeZone, options: option, nearDays: nearDays }));
@@ -43,25 +43,25 @@ export var DataGridRenderers;
43
43
  return DateUtils.format(dateValue, renderProps?.culture, option, renderProps?.timeZone);
44
44
  }
45
45
  // For numbers
46
- if (typeof value === 'number') {
46
+ if (typeof value === "number") {
47
47
  if (type === GridDataType.Money || type === GridDataType.IntMoney)
48
48
  return NumberUtils.formatMoney(value, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
49
49
  else
50
50
  return NumberUtils.format(value, renderProps?.culture, renderProps?.numberFormatOptions);
51
51
  }
52
52
  // For boolean
53
- if (typeof value === 'boolean') {
53
+ if (typeof value === "boolean") {
54
54
  // Add style
55
- if ('align' in cellProps) {
55
+ if ("align" in cellProps) {
56
56
  cellProps.sx = {
57
- paddingTop: '12px!important',
58
- paddingBottom: '6px!important'
57
+ paddingTop: "12px!important",
58
+ paddingBottom: "6px!important"
59
59
  };
60
60
  }
61
61
  else {
62
62
  cellProps.sx = {
63
- paddingTop: '16px!important',
64
- paddingBottom: '8px!important'
63
+ paddingTop: "16px!important",
64
+ paddingBottom: "8px!important"
65
65
  };
66
66
  }
67
67
  if (value)
@@ -86,11 +86,11 @@ export var DataGridRenderers;
86
86
  if (checkable) {
87
87
  return [
88
88
  selectedItems.length,
89
- loadedItems.toLocaleString() + (hasNextPage ? '+' : '')
90
- ].join(' / ');
89
+ loadedItems.toLocaleString() + (hasNextPage ? "+" : "")
90
+ ].join(" / ");
91
91
  }
92
92
  else {
93
- return loadedItems.toLocaleString() + (hasNextPage ? '+' : '');
93
+ return loadedItems.toLocaleString() + (hasNextPage ? "+" : "");
94
94
  }
95
95
  }
96
96
  return undefined;
@@ -1,6 +1,5 @@
1
- import { GridCellModesModel, GridRowId, GridValidRowModel } from "@mui/x-data-grid";
1
+ import { GridRowId, GridValidRowModel } from "@mui/x-data-grid";
2
2
  import { DataGridProps } from "@mui/x-data-grid/models/props/DataGridProps";
3
- import React from "react";
4
3
  /**
5
4
  * Data table selected cell params
6
5
  */
@@ -19,11 +18,6 @@ export type DataTableProps<R extends GridValidRowModel = any> = Omit<DataGridPro
19
18
  * @returns Result
20
19
  */
21
20
  onCellSelection?: (params: DataTableSelectedCellParams) => void | false;
22
- /**
23
- * Toolbar creator
24
- * @returns Toolbar
25
- */
26
- toolbarCreator?: (selectedCellParams: DataTableSelectedCellParams | null, setCellModesModel: React.Dispatch<React.SetStateAction<GridCellModesModel>>, cellModesModel: GridCellModesModel) => React.ReactElement;
27
21
  };
28
22
  /**
29
23
  * Data table
package/lib/DataTable.js CHANGED
@@ -9,12 +9,11 @@ import { globalApp } from "./app/ReactApp";
9
9
  */
10
10
  export function DataTable(props) {
11
11
  // Destructor
12
- const { localeText = {}, onCellSelection, toolbarCreator, onProcessRowUpdateError = (error) => console.log("onProcessRowUpdateError", error), ...rest } = props;
12
+ const { localeText = {}, onCellSelection, onProcessRowUpdateError = (error) => console.log("onProcessRowUpdateError", error), slotProps, ...rest } = props;
13
13
  // Labels
14
14
  const { noRows } = globalApp?.getLabels("noRows") ?? {};
15
15
  if (noRows && !localeText.noRowsLabel)
16
16
  localeText.noRowsLabel = noRows;
17
- const [selectedCellParams, setSelectedCellParams] = React.useState(null);
18
17
  const [cellModesModel, setCellModesModel] = React.useState({});
19
18
  const handleCellFocus = React.useCallback((event) => {
20
19
  // event.target is the element that triggered the event
@@ -37,18 +36,9 @@ export function DataTable(props) {
37
36
  if (onCellSelection(params) === false)
38
37
  return;
39
38
  }
40
- setSelectedCellParams(params);
41
39
  }, []);
42
- return (_jsx(DataGrid, { disableColumnMenu: true, hideFooter: true, localeText: localeText, cellModesModel: cellModesModel, onCellModesModelChange: (model) => setCellModesModel(model), onProcessRowUpdateError: onProcessRowUpdateError, slots: {
43
- toolbar: toolbarCreator
44
- ? ({ selectedCellParams, setCellModesModel, cellModesModel }) => toolbarCreator(selectedCellParams, setCellModesModel, cellModesModel)
45
- : undefined
46
- }, slotProps: {
47
- toolbar: {
48
- selectedCellParams,
49
- setCellModesModel,
50
- cellModesModel
51
- },
40
+ return (_jsx(DataGrid, { disableColumnMenu: true, hideFooter: true, localeText: localeText, cellModesModel: cellModesModel, onCellModesModelChange: (model) => setCellModesModel(model), onProcessRowUpdateError: onProcessRowUpdateError, slotProps: {
41
+ ...slotProps,
52
42
  cell: {
53
43
  onFocus: handleCellFocus
54
44
  }
@@ -1,5 +1,5 @@
1
- import { Breakpoint, ButtonProps } from '@mui/material';
2
- import React from 'react';
1
+ import { Breakpoint, ButtonProps } from "@mui/material";
2
+ import React from "react";
3
3
  export interface DialogButtonProps extends ButtonProps {
4
4
  /**
5
5
  * Button label
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton } from '@mui/material';
3
- import React from 'react';
4
- import { Labels } from './app/Labels';
2
+ import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, IconButton } from "@mui/material";
3
+ import React from "react";
4
+ import { Labels } from "./app/Labels";
5
5
  /**
6
6
  * Dialog button
7
7
  * @param props Props
@@ -33,5 +33,5 @@ export function DialogButton(props) {
33
33
  // The dialog will be embeded and the click event will bubble up
34
34
  // Stop propatation but will also cancel onClose and onBackdropClick event
35
35
  event.stopPropagation();
36
- }, children: [_jsx(DialogTitle, { children: dialogTitle ?? title ?? children }), _jsxs(DialogContent, { children: [_jsx(DialogContentText, { component: contentPre ? 'pre' : 'span', children: content }), inputs] }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setOpen(false), children: buttonLabel }) })] })] }));
36
+ }, children: [_jsx(DialogTitle, { children: dialogTitle ?? title ?? children }), _jsxs(DialogContent, { children: [_jsx(DialogContentText, { component: contentPre ? "pre" : "span", children: content }), inputs] }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setOpen(false), children: buttonLabel }) })] })] }));
37
37
  }
@@ -1,8 +1,8 @@
1
- import { TextFieldProps } from '@mui/material';
1
+ import { TextFieldProps } from "@mui/material";
2
2
  /**
3
3
  * Email input props
4
4
  */
5
- export type EmailInputProps = Omit<TextFieldProps, 'type'> & {};
5
+ export type EmailInputProps = Omit<TextFieldProps, "type"> & {};
6
6
  /**
7
7
  * Email input
8
8
  * @param props Props
package/lib/EmailInput.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { TextField } from '@mui/material';
2
+ import { TextField } from "@mui/material";
3
3
  /**
4
4
  * Email input
5
5
  * @param props Props
@@ -10,5 +10,5 @@ export function EmailInput(props) {
10
10
  // Default max length
11
11
  inputProps.maxLength ?? (inputProps.maxLength = 128);
12
12
  // Layout
13
- return (_jsx(TextField, { type: "email", fullWidth: true, inputProps: inputProps, ...rest }));
13
+ return _jsx(TextField, { type: "email", fullWidth: true, inputProps: inputProps, ...rest });
14
14
  }
package/lib/FlexBox.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { StackProps } from '@mui/material';
1
+ import { StackProps } from "@mui/material";
2
2
  /**
3
3
  * Horizonal box
4
4
  * @param props Props
5
5
  * @returns Component
6
6
  */
7
- export declare function HBox(props: Omit<StackProps, 'ref'>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function HBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
8
8
  /**
9
9
  * Vertial box
10
10
  * @param props Props
11
11
  * @returns Component
12
12
  */
13
- export declare function VBox(props: Omit<StackProps, 'ref'>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function VBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
package/lib/FlexBox.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Stack } from '@mui/material';
2
+ import { Stack } from "@mui/material";
3
3
  /**
4
4
  * Horizonal box
5
5
  * @param props Props
@@ -1,5 +1,5 @@
1
- import { GridColumnRenderProps, GridDataType } from '@etsoo/react';
2
- import React from 'react';
1
+ import { GridColumnRenderProps, GridDataType } from "@etsoo/react";
2
+ import React from "react";
3
3
  /**
4
4
  * Grid data format
5
5
  * @param data Input data
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { GridDataType } from '@etsoo/react';
3
- import { DateUtils, NumberUtils } from '@etsoo/shared';
4
- import { DateText } from './texts/DateText';
2
+ import { GridDataType } from "@etsoo/react";
3
+ import { DateUtils, NumberUtils } from "@etsoo/shared";
4
+ import { DateText } from "./texts/DateText";
5
5
  /**
6
6
  * Grid data format
7
7
  * @param data Input data
@@ -18,12 +18,12 @@ export function GridDataFormat(data, type, renderProps) {
18
18
  if (type === GridDataType.Date || type === GridDataType.DateTime) {
19
19
  const dateValue = data instanceof Date
20
20
  ? data
21
- : typeof data === 'number' || typeof data === 'string'
21
+ : typeof data === "number" || typeof data === "string"
22
22
  ? new Date(data)
23
23
  : undefined;
24
24
  if (dateValue == null)
25
25
  return undefined;
26
- const option = type === GridDataType.DateTime ? 'ds' : 'd';
26
+ const option = type === GridDataType.DateTime ? "ds" : "d";
27
27
  const nearDays = renderProps?.nearDays;
28
28
  if (nearDays != null) {
29
29
  return (_jsx(DateText, { value: dateValue, locale: renderProps?.culture, timeZone: renderProps?.timeZone, options: option, nearDays: nearDays }));
@@ -31,13 +31,13 @@ export function GridDataFormat(data, type, renderProps) {
31
31
  return DateUtils.format(dateValue, renderProps?.culture, option, renderProps?.timeZone);
32
32
  }
33
33
  // For numbers
34
- if (typeof data === 'number') {
34
+ if (typeof data === "number") {
35
35
  if (type === GridDataType.Money || type === GridDataType.IntMoney)
36
36
  return NumberUtils.formatMoney(data, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
37
37
  else
38
38
  return NumberUtils.format(data, renderProps?.culture, renderProps?.numberFormatOptions);
39
39
  }
40
- if (typeof data === 'string')
40
+ if (typeof data === "string")
41
41
  return data;
42
42
  return `${data}`;
43
43
  }
package/lib/GridUtils.js CHANGED
@@ -59,7 +59,8 @@ export var GridUtils;
59
59
  */
60
60
  function getUpdateRowsHandler(cacheKey) {
61
61
  return (rows, state) => {
62
- if (state.queryPaging.currentPage > 0 && cacheKey) {
62
+ const page = state.queryPaging.currentPage ?? 0;
63
+ if (page > 0 && cacheKey) {
63
64
  const data = {
64
65
  rows,
65
66
  state,
@@ -1,4 +1,4 @@
1
- import { ListItemIcon } from '@mui/material';
1
+ import { ListItemIcon } from "@mui/material";
2
2
  /**
3
3
  * List item right icon component
4
4
  */
@@ -1,8 +1,8 @@
1
- import { ListItemIcon, styled } from '@mui/material';
1
+ import { ListItemIcon, styled } from "@mui/material";
2
2
  /**
3
3
  * List item right icon component
4
4
  */
5
5
  export const ListItemRightIcon = styled(ListItemIcon)(({ theme }) => ({
6
- minWidth: '20px!important',
6
+ minWidth: "20px!important",
7
7
  paddingLeft: theme.spacing(2)
8
8
  }));
@@ -1,4 +1,4 @@
1
- import { ButtonProps, CircularProgressProps } from '@mui/material';
1
+ import { ButtonProps, CircularProgressProps } from "@mui/material";
2
2
  /**
3
3
  * Loading button props
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button, CircularProgress } from '@mui/material';
3
- import React from 'react';
2
+ import { Button, CircularProgress } from "@mui/material";
3
+ import React from "react";
4
4
  /**
5
5
  * Loading button
6
6
  * @param props Props
package/lib/MUGlobal.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ListItemButtonProps, Theme } from '@mui/material';
1
+ import { ListItemButtonProps, Theme } from "@mui/material";
2
2
  /**
3
3
  * Mouse event handler with data
4
4
  */
@@ -14,11 +14,11 @@ export declare class MUGlobal {
14
14
  /**
15
15
  * Search field size
16
16
  */
17
- static searchFieldSize: 'small' | 'medium';
17
+ static searchFieldSize: "small" | "medium";
18
18
  /**
19
19
  * Search field variant
20
20
  */
21
- static searchFieldVariant: 'standard' | 'filled' | 'outlined';
21
+ static searchFieldVariant: "standard" | "filled" | "outlined";
22
22
  /**
23
23
  * Input field shrink
24
24
  */
@@ -26,15 +26,15 @@ export declare class MUGlobal {
26
26
  /**
27
27
  * Input field size
28
28
  */
29
- static inputFieldSize: 'small' | 'medium';
29
+ static inputFieldSize: "small" | "medium";
30
30
  /**
31
31
  * Input field variant
32
32
  */
33
- static inputFieldVariant: 'standard' | 'filled' | 'outlined';
33
+ static inputFieldVariant: "standard" | "filled" | "outlined";
34
34
  /**
35
35
  * TextField variant
36
36
  */
37
- static textFieldVariant: 'standard' | 'filled' | 'outlined';
37
+ static textFieldVariant: "standard" | "filled" | "outlined";
38
38
  /**
39
39
  * Page default paddings
40
40
  */