@etsoo/materialui 1.5.5 → 1.5.7

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.
@@ -20,7 +20,7 @@ function TagList(props) {
20
20
  const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
21
21
  const moreLabel = more + "...";
22
22
  // Destruct
23
- const { renderOption = (props, option, { selected }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), option] })), renderTags = (value, getTagProps) => value.map((option, index) => {
23
+ const { renderOption = ({ key, ...props }, option, { selected }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), option] }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
24
24
  const { key, ...rest } = getTagProps({ index });
25
25
  return (0, jsx_runtime_1.jsx)(Chip_1.default, { variant: "outlined", label: option, ...rest }, key);
26
26
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -22,7 +22,7 @@ function TagListPro(props) {
22
22
  const moreLabel = more + "...";
23
23
  const getLabel = (item) => shared_1.DataTypes.getListItemLabel(item);
24
24
  // Destruct
25
- const { renderOption = (props, option, { selected }) => ((0, jsx_runtime_1.jsx)("li", { ...props, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) })), renderTags = (value, getTagProps) => value.map((option, index) => {
25
+ const { renderOption = ({ key, ...props }, option, { selected }) => ((0, jsx_runtime_1.jsx)("li", { ...props, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
26
26
  const { key, ...rest } = getTagProps({ index });
27
27
  return ((0, jsx_runtime_1.jsx)(Chip_1.default, { variant: "outlined", label: getLabel(option), ...rest }, key));
28
28
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -38,6 +38,10 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
38
38
  * Operation message handler
39
39
  */
40
40
  operationMessageHandler?: OperationMessageHandlerAll;
41
+ /**
42
+ * Grid spacing
43
+ */
44
+ gridSpacing?: number | Record<string, string | number>;
41
45
  }
42
46
  /**
43
47
  * Add / Edit page
@@ -20,12 +20,12 @@ const Button_1 = __importDefault(require("@mui/material/Button"));
20
20
  */
21
21
  function EditPage(props) {
22
22
  // Destruct
23
- const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal_1.MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, ...rest } = props;
23
+ const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal_1.MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, gridSpacing = MUGlobal_1.MUGlobal.pagePaddings, ...rest } = props;
24
24
  // Labels
25
25
  const labels = Labels_1.Labels.CommonPage;
26
- return ((0, jsx_runtime_1.jsxs)(CommonPage_1.CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && ((0, jsx_runtime_1.jsx)(OperationMessageContainer_1.OperationMessageContainer, { handler: operationMessageHandler })), topPart, (0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, justifyContent: "left", spacing: paddings, paddingTop: 1, children: children }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, position: "sticky", display: "flex", gap: paddings, sx: {
26
+ return ((0, jsx_runtime_1.jsxs)(CommonPage_1.CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && ((0, jsx_runtime_1.jsx)(OperationMessageContainer_1.OperationMessageContainer, { handler: operationMessageHandler })), topPart, (0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, justifyContent: "left", spacing: gridSpacing, paddingTop: 1, children: children }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, position: "sticky", display: "flex", gap: gridSpacing, sx: {
27
27
  top: "auto",
28
- bottom: (theme) => MUGlobal_1.MUGlobal.updateWithTheme(paddings, theme.spacing),
29
- paddingTop: paddings
28
+ bottom: (theme) => MUGlobal_1.MUGlobal.updateWithTheme(gridSpacing, theme.spacing),
29
+ paddingTop: gridSpacing
30
30
  }, children: [isEditing && onDelete && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "primary", variant: "outlined", onClick: () => onDelete(), startIcon: (0, jsx_runtime_1.jsx)(Delete_1.default, { color: "warning" }), children: labels.delete })), (0, jsx_runtime_1.jsx)(Button_1.default, { variant: "contained", type: "submit", startIcon: (0, jsx_runtime_1.jsx)(Save_1.default, {}), sx: { flexGrow: 1 }, disabled: submitDisabled, children: labels.save }), supportBack && (0, jsx_runtime_1.jsx)(BackButton_1.BackButton, { title: labels.back })] })] }), bottomPart] }));
31
31
  }
@@ -14,7 +14,7 @@ export function TagList(props) {
14
14
  const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
15
15
  const moreLabel = more + "...";
16
16
  // Destruct
17
- const { renderOption = (props, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), option] })), renderTags = (value, getTagProps) => value.map((option, index) => {
17
+ const { renderOption = ({ key, ...props }, option, { selected }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), option] }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
18
18
  const { key, ...rest } = getTagProps({ index });
19
19
  return _jsx(Chip, { variant: "outlined", label: option, ...rest }, key);
20
20
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -16,7 +16,7 @@ export function TagListPro(props) {
16
16
  const moreLabel = more + "...";
17
17
  const getLabel = (item) => DataTypes.getListItemLabel(item);
18
18
  // Destruct
19
- const { renderOption = (props, option, { selected }) => (_jsx("li", { ...props, children: _jsxs(_Fragment, { children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) })), renderTags = (value, getTagProps) => value.map((option, index) => {
19
+ const { renderOption = ({ key, ...props }, option, { selected }) => (_jsx("li", { ...props, children: _jsxs(_Fragment, { children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
20
20
  const { key, ...rest } = getTagProps({ index });
21
21
  return (_jsx(Chip, { variant: "outlined", label: getLabel(option), ...rest }, key));
22
22
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -38,6 +38,10 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
38
38
  * Operation message handler
39
39
  */
40
40
  operationMessageHandler?: OperationMessageHandlerAll;
41
+ /**
42
+ * Grid spacing
43
+ */
44
+ gridSpacing?: number | Record<string, string | number>;
41
45
  }
42
46
  /**
43
47
  * Add / Edit page
@@ -14,12 +14,12 @@ import Button from "@mui/material/Button";
14
14
  */
15
15
  export function EditPage(props) {
16
16
  // Destruct
17
- const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, ...rest } = props;
17
+ const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, gridSpacing = MUGlobal.pagePaddings, ...rest } = props;
18
18
  // Labels
19
19
  const labels = Labels.CommonPage;
20
- return (_jsxs(CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && (_jsx(OperationMessageContainer, { handler: operationMessageHandler })), topPart, _jsxs("form", { onSubmit: onSubmit, children: [_jsx(Grid, { container: true, justifyContent: "left", spacing: paddings, paddingTop: 1, children: children }), _jsxs(Grid, { container: true, position: "sticky", display: "flex", gap: paddings, sx: {
20
+ return (_jsxs(CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && (_jsx(OperationMessageContainer, { handler: operationMessageHandler })), topPart, _jsxs("form", { onSubmit: onSubmit, children: [_jsx(Grid, { container: true, justifyContent: "left", spacing: gridSpacing, paddingTop: 1, children: children }), _jsxs(Grid, { container: true, position: "sticky", display: "flex", gap: gridSpacing, sx: {
21
21
  top: "auto",
22
- bottom: (theme) => MUGlobal.updateWithTheme(paddings, theme.spacing),
23
- paddingTop: paddings
22
+ bottom: (theme) => MUGlobal.updateWithTheme(gridSpacing, theme.spacing),
23
+ paddingTop: gridSpacing
24
24
  }, children: [isEditing && onDelete && (_jsx(Button, { color: "primary", variant: "outlined", onClick: () => onDelete(), startIcon: _jsx(DeleteIcon, { color: "warning" }), children: labels.delete })), _jsx(Button, { variant: "contained", type: "submit", startIcon: _jsx(SaveIcon, {}), sx: { flexGrow: 1 }, disabled: submitDisabled, children: labels.save }), supportBack && _jsx(BackButton, { title: labels.back })] })] }), bottomPart] }));
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
package/src/TagList.tsx CHANGED
@@ -51,8 +51,8 @@ export function TagList(props: TagListProps) {
51
51
 
52
52
  // Destruct
53
53
  const {
54
- renderOption = (props, option, { selected }) => (
55
- <li {...props}>
54
+ renderOption = ({ key, ...props }, option, { selected }) => (
55
+ <li key={key} {...props}>
56
56
  <Checkbox
57
57
  icon={<CheckBoxOutlineBlankIcon fontSize="small" />}
58
58
  checkedIcon={<CheckBoxIcon fontSize="small" />}
@@ -56,8 +56,8 @@ export function TagListPro<D extends ListType2 = ListType2>(
56
56
 
57
57
  // Destruct
58
58
  const {
59
- renderOption = (props, option, { selected }) => (
60
- <li {...props}>
59
+ renderOption = ({ key, ...props }, option, { selected }) => (
60
+ <li key={key} {...props}>
61
61
  <>
62
62
  <Checkbox
63
63
  icon={<CheckBoxOutlineBlankIcon fontSize="small" />}
@@ -54,6 +54,11 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
54
54
  * Operation message handler
55
55
  */
56
56
  operationMessageHandler?: OperationMessageHandlerAll;
57
+
58
+ /**
59
+ * Grid spacing
60
+ */
61
+ gridSpacing?: number | Record<string, string | number>;
57
62
  }
58
63
 
59
64
  /**
@@ -74,6 +79,7 @@ export function EditPage(props: EditPageProps) {
74
79
  bottomPart,
75
80
  topPart,
76
81
  operationMessageHandler,
82
+ gridSpacing = MUGlobal.pagePaddings,
77
83
  ...rest
78
84
  } = props;
79
85
 
@@ -87,19 +93,24 @@ export function EditPage(props: EditPageProps) {
87
93
  )}
88
94
  {topPart}
89
95
  <form onSubmit={onSubmit}>
90
- <Grid container justifyContent="left" spacing={paddings} paddingTop={1}>
96
+ <Grid
97
+ container
98
+ justifyContent="left"
99
+ spacing={gridSpacing}
100
+ paddingTop={1}
101
+ >
91
102
  {children}
92
103
  </Grid>
93
104
  <Grid
94
105
  container
95
106
  position="sticky"
96
107
  display="flex"
97
- gap={paddings}
108
+ gap={gridSpacing}
98
109
  sx={{
99
110
  top: "auto",
100
111
  bottom: (theme) =>
101
- MUGlobal.updateWithTheme(paddings, theme.spacing),
102
- paddingTop: paddings
112
+ MUGlobal.updateWithTheme(gridSpacing, theme.spacing),
113
+ paddingTop: gridSpacing
103
114
  }}
104
115
  >
105
116
  {isEditing && onDelete && (