@comet/admin 8.0.0-beta.0 → 8.0.0-beta.2
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/EditDialog.d.ts +1 -2
- package/lib/EditDialog.d.ts.map +1 -1
- package/lib/EditDialog.js +1 -3
- package/lib/FinalFormSaveButton.d.ts.map +1 -1
- package/lib/FinalFormSaveButton.js +4 -6
- package/lib/FinalFormSaveCancelButtonsLegacy.d.ts +1 -1
- package/lib/FinalFormSaveCancelButtonsLegacy.d.ts.map +1 -1
- package/lib/FinalFormSaveCancelButtonsLegacy.js +1 -1
- package/lib/FinalFormSaveSplitButton.d.ts.map +1 -1
- package/lib/FinalFormSaveSplitButton.js +42 -38
- package/lib/common/DeleteDialog.d.ts.map +1 -1
- package/lib/common/DeleteDialog.js +1 -2
- package/lib/common/FieldSet.d.ts.map +1 -1
- package/lib/common/FieldSet.js +16 -11
- package/lib/common/buttons/Button.d.ts.map +1 -1
- package/lib/common/buttons/Button.js +10 -12
- package/lib/common/buttons/SaveButton.d.ts +21 -0
- package/lib/common/buttons/SaveButton.d.ts.map +1 -0
- package/lib/common/buttons/SaveButton.js +41 -0
- package/lib/common/buttons/feedback/FeedbackButton.d.ts +3 -2
- package/lib/common/buttons/feedback/FeedbackButton.d.ts.map +1 -1
- package/lib/common/buttons/feedback/FeedbackButton.js +3 -9
- package/lib/dataGrid/DataGridPanel.d.ts +1 -1
- package/lib/dataGrid/DataGridPanel.d.ts.map +1 -1
- package/lib/dataGrid/DataGridPanel.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/inputWithPopper/InputWithPopper.slots.d.ts +1 -1
- package/lib/saveBoundary/SaveBoundarySaveButton.d.ts +1 -1
- package/lib/saveBoundary/SaveBoundarySaveButton.d.ts.map +1 -1
- package/lib/saveBoundary/SaveBoundarySaveButton.js +5 -4
- package/lib/stack/breadcrumbs/BreadcrumbsEntry.d.ts.map +1 -1
- package/lib/stack/breadcrumbs/BreadcrumbsEntry.js +2 -1
- package/lib/stack/breadcrumbs/StackBreadcrumbs.d.ts +1 -1
- package/lib/stack/breadcrumbs/StackBreadcrumbs.d.ts.map +1 -1
- package/lib/table/LocalChangesToolbar.js +1 -1
- package/lib/theme/componentsTheme/MuiButton.d.ts.map +1 -1
- package/lib/theme/componentsTheme/MuiButton.js +86 -24
- package/lib/theme/componentsTheme/MuiDataGrid.d.ts.map +1 -1
- package/lib/theme/componentsTheme/MuiDataGrid.js +78 -70
- package/lib/theme/componentsTheme/MuiLink.js +1 -1
- package/package.json +22 -19
- package/lib/common/buttons/save/SaveButton.d.ts +0 -34
- package/lib/common/buttons/save/SaveButton.d.ts.map +0 -1
- package/lib/common/buttons/save/SaveButton.js +0 -173
|
@@ -7,6 +7,8 @@ exports.getMuiDataGrid = void 0;
|
|
|
7
7
|
var _adminIcons = require("@comet/admin-icons");
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
9
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
10
|
+
var _reactIntl = require("react-intl");
|
|
11
|
+
var _DataGridPanel = require("../../dataGrid/DataGridPanel");
|
|
10
12
|
var _mergeOverrideStyles = require("../utils/mergeOverrideStyles");
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
14
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -15,14 +17,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
17
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
19
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
-
var getDensityHeightValue = function getDensityHeightValue(density
|
|
20
|
+
var getDensityHeightValue = function getDensityHeightValue(density) {
|
|
19
21
|
switch (density) {
|
|
20
22
|
case "compact":
|
|
21
|
-
return
|
|
23
|
+
return 40;
|
|
22
24
|
case "comfortable":
|
|
23
|
-
return
|
|
25
|
+
return 80;
|
|
24
26
|
default:
|
|
25
|
-
return
|
|
27
|
+
return 60;
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
var filtersLeftSectionWidth = 120;
|
|
@@ -30,7 +32,7 @@ var filterDeleteIconSize = 32;
|
|
|
30
32
|
var filterLeftSectionGap = 5;
|
|
31
33
|
var filterOperatorInputWidth = filtersLeftSectionWidth - filterDeleteIconSize - filterLeftSectionGap;
|
|
32
34
|
var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component, _ref) {
|
|
33
|
-
var _component$defaultPro, _component$defaultPro2, _component$defaultPro3, _component$defaultPro4;
|
|
35
|
+
var _component$defaultPro, _component$defaultPro2, _component$defaultPro3, _component$defaultPro4, _component$defaultPro5;
|
|
34
36
|
var palette = _ref.palette,
|
|
35
37
|
shadows = _ref.shadows,
|
|
36
38
|
spacing = _ref.spacing,
|
|
@@ -38,30 +40,34 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
38
40
|
return _objectSpread(_objectSpread({}, component), {}, {
|
|
39
41
|
defaultProps: _objectSpread(_objectSpread({}, component === null || component === void 0 ? void 0 : component.defaultProps), {}, {
|
|
40
42
|
disableRowSelectionOnClick: true,
|
|
43
|
+
getRowHeight: function getRowHeight(_ref2) {
|
|
44
|
+
var densityFactor = _ref2.densityFactor;
|
|
45
|
+
if (densityFactor === _xDataGrid.COMPACT_DENSITY_FACTOR) {
|
|
46
|
+
return getDensityHeightValue("compact");
|
|
47
|
+
}
|
|
48
|
+
if (densityFactor === _xDataGrid.COMFORTABLE_DENSITY_FACTOR) {
|
|
49
|
+
return getDensityHeightValue("comfortable");
|
|
50
|
+
}
|
|
51
|
+
return getDensityHeightValue("standard");
|
|
52
|
+
},
|
|
41
53
|
slots: _objectSpread({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
quickFilterIcon: _adminIcons.Search,
|
|
55
|
+
quickFilterClearIcon: _adminIcons.Clear,
|
|
56
|
+
filterPanelDeleteIcon: function filterPanelDeleteIcon(props) {
|
|
45
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.Delete, _objectSpread(_objectSpread({}, props), {}, {
|
|
46
58
|
fontSize: "medium"
|
|
47
59
|
}));
|
|
48
60
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, props), {}, {
|
|
55
|
-
InputLabelProps: {
|
|
56
|
-
shrink: true
|
|
57
|
-
}
|
|
58
|
-
}));
|
|
59
|
-
},
|
|
60
|
-
ColumnMenuIcon: function ColumnMenuIcon(props) {
|
|
61
|
+
booleanCellTrueIcon: _adminIcons.Check,
|
|
62
|
+
booleanCellFalseIcon: _adminIcons.Close,
|
|
63
|
+
columnSortedAscendingIcon: _adminIcons.ArrowUp,
|
|
64
|
+
columnSortedDescendingIcon: _adminIcons.ArrowDown,
|
|
65
|
+
columnMenuIcon: function columnMenuIcon(props) {
|
|
61
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.MoreVertical, _objectSpread(_objectSpread({}, props), {}, {
|
|
62
67
|
fontSize: "medium"
|
|
63
68
|
}));
|
|
64
|
-
}
|
|
69
|
+
},
|
|
70
|
+
panel: _DataGridPanel.DataGridPanel
|
|
65
71
|
}, component === null || component === void 0 || (_component$defaultPro = component.defaultProps) === null || _component$defaultPro === void 0 ? void 0 : _component$defaultPro.slots),
|
|
66
72
|
slotProps: _objectSpread(_objectSpread({}, component === null || component === void 0 || (_component$defaultPro2 = component.defaultProps) === null || _component$defaultPro2 === void 0 ? void 0 : _component$defaultPro2.slotProps), {}, {
|
|
67
73
|
baseButton: _objectSpread({
|
|
@@ -69,9 +75,30 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
69
75
|
}, component === null || component === void 0 || (_component$defaultPro3 = component.defaultProps) === null || _component$defaultPro3 === void 0 || (_component$defaultPro3 = _component$defaultPro3.slotProps) === null || _component$defaultPro3 === void 0 ? void 0 : _component$defaultPro3.baseButton)
|
|
70
76
|
}),
|
|
71
77
|
localeText: _objectSpread({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
MuiTablePagination: _objectSpread({
|
|
79
|
+
labelDisplayedRows: function labelDisplayedRows(_ref3) {
|
|
80
|
+
var from = _ref3.from,
|
|
81
|
+
to = _ref3.to,
|
|
82
|
+
count = _ref3.count;
|
|
83
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
84
|
+
id: "dataGrid.pagination.labelDisplayedRows",
|
|
85
|
+
defaultMessage: "{from}\u2013{to} of {formattedCount} {count, plural, one {item} other {items}}",
|
|
86
|
+
values: {
|
|
87
|
+
from: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
88
|
+
value: from
|
|
89
|
+
}),
|
|
90
|
+
to: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
91
|
+
value: to
|
|
92
|
+
}),
|
|
93
|
+
formattedCount: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedNumber, {
|
|
94
|
+
value: count
|
|
95
|
+
}),
|
|
96
|
+
count: count
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, component === null || component === void 0 || (_component$defaultPro4 = component.defaultProps) === null || _component$defaultPro4 === void 0 || (_component$defaultPro4 = _component$defaultPro4.localeText) === null || _component$defaultPro4 === void 0 ? void 0 : _component$defaultPro4.MuiTablePagination)
|
|
101
|
+
}, component === null || component === void 0 || (_component$defaultPro5 = component.defaultProps) === null || _component$defaultPro5 === void 0 ? void 0 : _component$defaultPro5.localeText)
|
|
75
102
|
}),
|
|
76
103
|
styleOverrides: (0, _mergeOverrideStyles.mergeOverrideStyles)(component === null || component === void 0 ? void 0 : component.styleOverrides, {
|
|
77
104
|
root: {
|
|
@@ -88,29 +115,21 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
88
115
|
padding: "4px 4px ".concat(spacing(1), " 4px"),
|
|
89
116
|
borderBottom: "1px solid ".concat(palette.divider)
|
|
90
117
|
},
|
|
91
|
-
columnsManagement: {
|
|
92
|
-
padding:
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
marginBottom: spacing(2),
|
|
118
|
+
columnsManagement: _defineProperty({
|
|
119
|
+
padding: spacing(4)
|
|
120
|
+
}, "& .".concat(_xDataGrid.gridClasses.columnsManagementRow), _defineProperty({
|
|
121
|
+
margin: 0,
|
|
96
122
|
"&:last-child": {
|
|
97
123
|
marginBottom: 0
|
|
98
124
|
}
|
|
99
|
-
}, "& .".concat(_material.
|
|
100
|
-
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}), "& .".concat(_material.switchClasses.root, " .").concat(_material.switchClasses.switchBase), {
|
|
105
|
-
padding: 3
|
|
106
|
-
}), "& .".concat(_material.switchClasses.root, " .").concat(_material.switchClasses.switchBase, ".").concat((0, _material.getSwitchUtilityClass)("checked")), {
|
|
107
|
-
transform: "translateX(20px)"
|
|
108
|
-
}),
|
|
109
|
-
columnHeader: function columnHeader(_ref2) {
|
|
110
|
-
var ownerState = _ref2.ownerState;
|
|
125
|
+
}, "& .".concat(_material.checkboxClasses.root), {
|
|
126
|
+
padding: 9
|
|
127
|
+
})),
|
|
128
|
+
columnHeader: function columnHeader(_ref4) {
|
|
129
|
+
var ownerState = _ref4.ownerState;
|
|
111
130
|
return {
|
|
112
131
|
/* !important is required to override inline styles */
|
|
113
|
-
height: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density
|
|
132
|
+
height: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density), "px !important"),
|
|
114
133
|
"&:focus": {
|
|
115
134
|
outline: "none"
|
|
116
135
|
},
|
|
@@ -119,28 +138,13 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
119
138
|
}
|
|
120
139
|
};
|
|
121
140
|
},
|
|
122
|
-
columnHeaderTitleContainer: function columnHeaderTitleContainer(_ref3) {
|
|
123
|
-
var ownerState = _ref3.ownerState;
|
|
124
|
-
return {
|
|
125
|
-
height: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density, spacing))
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
141
|
pinnedColumns: {
|
|
129
142
|
backgroundColor: "white",
|
|
130
143
|
boxShadow: shadows[2]
|
|
131
144
|
},
|
|
132
|
-
row: function row(_ref4) {
|
|
133
|
-
var ownerState = _ref4.ownerState;
|
|
134
|
-
return {
|
|
135
|
-
height: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density, spacing)),
|
|
136
|
-
/* !important is required to override inline styles */
|
|
137
|
-
minHeight: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density, spacing), " !important"),
|
|
138
|
-
maxHeight: "".concat(getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density, spacing), " !important")
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
145
|
cell: function cell(_ref5) {
|
|
142
146
|
var ownerState = _ref5.ownerState;
|
|
143
|
-
return _defineProperty(_defineProperty(
|
|
147
|
+
return _defineProperty(_defineProperty({
|
|
144
148
|
borderTop: "1px solid ".concat(palette.grey[100]),
|
|
145
149
|
"&:focus": {
|
|
146
150
|
outline: "none"
|
|
@@ -150,20 +154,20 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
150
154
|
}
|
|
151
155
|
}, "& .".concat((0, _xDataGrid.getDataGridUtilityClass)("booleanCell")), {
|
|
152
156
|
color: palette.grey[900]
|
|
153
|
-
}), "
|
|
157
|
+
}), "alignContent", "center");
|
|
154
158
|
},
|
|
155
159
|
footerContainer: function footerContainer(_ref7) {
|
|
156
160
|
var ownerState = _ref7.ownerState;
|
|
157
|
-
return {
|
|
161
|
+
return _defineProperty(_defineProperty({
|
|
158
162
|
borderTop: "1px solid ".concat(palette.grey[100]),
|
|
159
163
|
boxSizing: "border-box",
|
|
160
|
-
minHeight: getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
};
|
|
164
|
+
minHeight: getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density)
|
|
165
|
+
}, "& .".concat(_material.tablePaginationClasses.selectLabel, ", & .").concat(_material.tablePaginationClasses.displayedRows), {
|
|
166
|
+
marginTop: 0,
|
|
167
|
+
marginBottom: 0
|
|
168
|
+
}), "& .".concat(_material.tablePaginationClasses.root, " > .").concat(_material.toolbarClasses.root), {
|
|
169
|
+
minHeight: getDensityHeightValue(ownerState === null || ownerState === void 0 ? void 0 : ownerState.density)
|
|
170
|
+
});
|
|
167
171
|
},
|
|
168
172
|
iconSeparator: {
|
|
169
173
|
backgroundColor: palette.grey[100],
|
|
@@ -196,7 +200,7 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
196
200
|
paddingBottom: spacing(2),
|
|
197
201
|
marginBottom: spacing(2),
|
|
198
202
|
borderBottomColor: palette.grey[50]
|
|
199
|
-
})), "&:first-child .".concat(_xDataGrid.gridClasses.
|
|
203
|
+
})), "&:first-child .".concat(_xDataGrid.gridClasses.filterFormLogicOperatorInput), {
|
|
200
204
|
// The first "Operator"-select is fully hidden by default when there is only one filter.
|
|
201
205
|
// Setting `display: block` makes sure it takes up it's space as if it were visible to prevent the alignment from breaking.
|
|
202
206
|
// Even though `display: block` is set now, it's still not visible, due to it's default styling of `visibility: hidden`.
|
|
@@ -244,7 +248,7 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
244
248
|
marginTop: 0,
|
|
245
249
|
width: 110
|
|
246
250
|
}),
|
|
247
|
-
filterFormValueInput: _defineProperty(_defineProperty(_defineProperty({
|
|
251
|
+
filterFormValueInput: _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
248
252
|
width: "calc(100% - ".concat(filtersLeftSectionWidth, "px)"),
|
|
249
253
|
paddingLeft: spacing(2),
|
|
250
254
|
boxSizing: "border-box",
|
|
@@ -255,7 +259,11 @@ var getMuiDataGrid = exports.getMuiDataGrid = function getMuiDataGrid(component,
|
|
|
255
259
|
marginTop: 0
|
|
256
260
|
}), "&:empty", {
|
|
257
261
|
display: "none" // Make space for `filterFormOperatorInput` to expand and take up the full width
|
|
258
|
-
}), "
|
|
262
|
+
}), "&& .".concat(_material.autocompleteClasses.inputRoot), _defineProperty({
|
|
263
|
+
paddingBottom: 0
|
|
264
|
+
}, "& > .".concat(_material.autocompleteClasses.input), {
|
|
265
|
+
padding: "calc(".concat(spacing(2), " - 1px)")
|
|
266
|
+
})), "& .".concat(_material.inputBaseClasses.root), {
|
|
259
267
|
marginTop: 0
|
|
260
268
|
}),
|
|
261
269
|
panelFooter: {
|
|
@@ -19,7 +19,7 @@ var getMuiLink = exports.getMuiLink = function getMuiLink(component, _ref) {
|
|
|
19
19
|
}, component === null || component === void 0 ? void 0 : component.defaultProps),
|
|
20
20
|
styleOverrides: (0, _mergeOverrideStyles.mergeOverrideStyles)(component === null || component === void 0 ? void 0 : component.styleOverrides, {
|
|
21
21
|
root: {
|
|
22
|
-
color: palette.
|
|
22
|
+
color: palette.primary.main,
|
|
23
23
|
fontWeight: 250,
|
|
24
24
|
fontSize: 16,
|
|
25
25
|
lineHeight: "16px",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/admin",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/admin/admin",
|
|
6
6
|
"type": "git",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@mui/utils": "^6.4.3",
|
|
16
|
+
"@mui/utils": "^6.4.8",
|
|
18
17
|
"exceljs": "^4.4.0",
|
|
19
18
|
"file-saver": "^2.0.5",
|
|
20
19
|
"final-form-set-field-data": "^1.0.2",
|
|
@@ -25,21 +24,19 @@
|
|
|
25
24
|
"query-string": "^7.1.3",
|
|
26
25
|
"react-dropzone": "^14.3.8",
|
|
27
26
|
"use-constant": "^1.1.1",
|
|
28
|
-
"uuid": "^11.0
|
|
27
|
+
"uuid": "^11.1.0",
|
|
28
|
+
"@comet/admin-icons": "8.0.0-beta.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@apollo/client": "^3.13.
|
|
31
|
+
"@apollo/client": "^3.13.4",
|
|
32
32
|
"@babel/cli": "^7.26.4",
|
|
33
|
-
"@babel/core": "^7.26.
|
|
34
|
-
"@comet/admin-babel-preset": "^8.0.0-beta.0",
|
|
35
|
-
"@comet/eslint-config": "^8.0.0-beta.0",
|
|
36
|
-
"@comet/eslint-plugin": "^8.0.0-beta.0",
|
|
33
|
+
"@babel/core": "^7.26.10",
|
|
37
34
|
"@emotion/react": "^11.14.0",
|
|
38
35
|
"@emotion/styled": "^11.14.0",
|
|
39
|
-
"@mui/material": "^6.4.
|
|
40
|
-
"@mui/system": "^6.4.
|
|
41
|
-
"@mui/x-data-grid": "^7.27.
|
|
42
|
-
"@mui/x-data-grid-pro": "^7.27.
|
|
36
|
+
"@mui/material": "^6.4.8",
|
|
37
|
+
"@mui/system": "^6.4.8",
|
|
38
|
+
"@mui/x-data-grid": "^7.27.3",
|
|
39
|
+
"@mui/x-data-grid-pro": "^7.27.3",
|
|
43
40
|
"@testing-library/dom": "^10.4.0",
|
|
44
41
|
"@testing-library/jest-dom": "^6.6.3",
|
|
45
42
|
"@testing-library/react": "^16.2.0",
|
|
@@ -50,12 +47,12 @@
|
|
|
50
47
|
"@types/jest": "^29.5.14",
|
|
51
48
|
"@types/lodash.debounce": "^4.0.9",
|
|
52
49
|
"@types/lodash.isequal": "^4.5.8",
|
|
53
|
-
"@types/node": "^22.13.
|
|
50
|
+
"@types/node": "^22.13.10",
|
|
54
51
|
"@types/react": "^18.3.18",
|
|
55
52
|
"@types/react-dom": "^18.3.5",
|
|
56
53
|
"@types/react-router": "^5.1.20",
|
|
57
54
|
"@types/react-router-dom": "^5.3.3",
|
|
58
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.22.0",
|
|
59
56
|
"final-form": "^4.20.10",
|
|
60
57
|
"graphql": "^15.10.1",
|
|
61
58
|
"history": "^4.10.1",
|
|
@@ -63,17 +60,20 @@
|
|
|
63
60
|
"jest-environment-jsdom": "^29.7.0",
|
|
64
61
|
"jest-junit": "^16.0.0",
|
|
65
62
|
"npm-run-all2": "^5.0.2",
|
|
66
|
-
"prettier": "^3.5.
|
|
63
|
+
"prettier": "^3.5.3",
|
|
67
64
|
"react": "^18.3.1",
|
|
68
65
|
"react-dnd": "^16.0.1",
|
|
69
66
|
"react-dom": "^18.3.1",
|
|
70
67
|
"react-final-form": "^6.5.9",
|
|
71
|
-
"react-intl": "^
|
|
68
|
+
"react-intl": "^7.1.6",
|
|
72
69
|
"react-router": "^5.3.4",
|
|
73
70
|
"react-router-dom": "^5.3.4",
|
|
74
71
|
"rimraf": "^6.0.1",
|
|
75
72
|
"ts-jest": "^29.2.6",
|
|
76
|
-
"typescript": "^5.7.3"
|
|
73
|
+
"typescript": "^5.7.3",
|
|
74
|
+
"@comet/admin-babel-preset": "8.0.0-beta.2",
|
|
75
|
+
"@comet/eslint-config": "8.0.0-beta.2",
|
|
76
|
+
"@comet/eslint-plugin": "8.0.0-beta.2"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@apollo/client": "^3.7.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"react-dnd": "^16.0.0",
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
92
92
|
"react-final-form": "^6.3.1",
|
|
93
|
-
"react-intl": "^5.0.0 || ^6.0.0",
|
|
93
|
+
"react-intl": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
94
94
|
"react-router": "^5.1.2",
|
|
95
95
|
"react-router-dom": "^5.1.2"
|
|
96
96
|
},
|
|
@@ -102,6 +102,9 @@
|
|
|
102
102
|
"optional": true
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": ">=22.0.0"
|
|
107
|
+
},
|
|
105
108
|
"publishConfig": {
|
|
106
109
|
"access": "public",
|
|
107
110
|
"registry": "https://registry.npmjs.org"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type ButtonClassKey, type ButtonProps, type ComponentsOverrides } from "@mui/material";
|
|
2
|
-
import { type Theme } from "@mui/material/styles";
|
|
3
|
-
import { type ReactNode } from "react";
|
|
4
|
-
export type SaveButtonClassKey = "saving" | "error" | "success" | "conflict" | ButtonClassKey;
|
|
5
|
-
export interface SaveButtonProps extends ButtonProps {
|
|
6
|
-
saving?: boolean;
|
|
7
|
-
hasErrors?: boolean;
|
|
8
|
-
hasConflict?: boolean;
|
|
9
|
-
savingItem?: ReactNode;
|
|
10
|
-
successItem?: ReactNode;
|
|
11
|
-
errorItem?: ReactNode;
|
|
12
|
-
conflictItem?: ReactNode;
|
|
13
|
-
saveIcon?: ReactNode;
|
|
14
|
-
savingIcon?: ReactNode;
|
|
15
|
-
successIcon?: ReactNode;
|
|
16
|
-
errorIcon?: ReactNode;
|
|
17
|
-
conflictIcon?: ReactNode;
|
|
18
|
-
}
|
|
19
|
-
export declare function SaveButton(inProps: SaveButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
declare module "@mui/material/styles" {
|
|
21
|
-
interface ComponentNameToClassKey {
|
|
22
|
-
CometAdminSaveButton: SaveButtonClassKey;
|
|
23
|
-
}
|
|
24
|
-
interface ComponentsPropsList {
|
|
25
|
-
CometAdminSaveButton: SaveButtonProps;
|
|
26
|
-
}
|
|
27
|
-
interface Components {
|
|
28
|
-
CometAdminSaveButton?: {
|
|
29
|
-
defaultProps?: Partial<ComponentsPropsList["CometAdminSaveButton"]>;
|
|
30
|
-
styleOverrides?: ComponentsOverrides<Theme>["CometAdminSaveButton"];
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=SaveButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SaveButton.d.ts","sourceRoot":"","sources":["../../../../src/common/buttons/save/SaveButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAsB,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAO,KAAK,KAAK,EAAiB,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAO5D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,cAAc,CAAC;AA8D9F,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC5B;AAID,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,2CAsHlD;AACD,OAAO,QAAQ,sBAAsB,CAAC;IAClC,UAAU,uBAAuB;QAC7B,oBAAoB,EAAE,kBAAkB,CAAC;KAC5C;IAED,UAAU,mBAAmB;QACzB,oBAAoB,EAAE,eAAe,CAAC;KACzC;IAED,UAAU,UAAU;QAChB,oBAAoB,CAAC,EAAE;YACnB,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC,CAAC;YACpE,cAAc,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,sBAAsB,CAAC,CAAC;SACvE,CAAC;KACL;CACJ"}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.SaveButton = SaveButton;
|
|
8
|
-
var _adminIcons = require("@comet/admin-icons");
|
|
9
|
-
var _material = require("@mui/material");
|
|
10
|
-
var _styles = require("@mui/material/styles");
|
|
11
|
-
var _react = require("react");
|
|
12
|
-
var _reactIntl = require("react-intl");
|
|
13
|
-
var _createComponentSlot = require("../../../helpers/createComponentSlot");
|
|
14
|
-
var _messages = require("../../../messages");
|
|
15
|
-
var _useSplitButtonContext = require("../split/useSplitButtonContext");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
var _excluded = ["saving", "hasErrors", "hasConflict", "children", "savingItem", "successItem", "errorItem", "conflictItem", "saveIcon", "savingIcon", "successIcon", "errorIcon", "conflictIcon", "variant", "color", "disabled"];
|
|
18
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
19
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
24
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
25
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
28
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
31
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
32
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
33
|
-
var Root = (0, _createComponentSlot.createComponentSlot)(_material.Button)({
|
|
34
|
-
componentName: "SaveButton",
|
|
35
|
-
slotName: "root",
|
|
36
|
-
classesResolver: function classesResolver(ownerState) {
|
|
37
|
-
return [ownerState.displayState === "saving" && "saving", ownerState.displayState === "error" && "error", ownerState.displayState === "success" && "success", ownerState.displayState === "conflict" && "conflict"];
|
|
38
|
-
}
|
|
39
|
-
})(function (_ref) {
|
|
40
|
-
var ownerState = _ref.ownerState,
|
|
41
|
-
theme = _ref.theme;
|
|
42
|
-
return (0, _styles.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n ", "\n "])), ownerState.displayState === "saving" && (0, _styles.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &:disabled {\n ", ";\n ", "\n }\n "])), ownerState.variant === "contained" && ownerState.color === "primary" && (0, _styles.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n "])), theme.palette.primary.contrastText, theme.palette.primary.main), ownerState.variant === "contained" && ownerState.color === "secondary" && (0, _styles.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n "])), theme.palette.secondary.contrastText, theme.palette.secondary.main)), ownerState.displayState === "error" && (0, _styles.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:disabled {\n color: ", ";\n background-color: ", ";\n }\n "])), theme.palette.error.contrastText, theme.palette.error.light), ownerState.displayState === "success" && (0, _styles.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n &:disabled {\n color: ", ";\n background-color: ", ";\n }\n "])), theme.palette.success.contrastText, theme.palette.success.light), ownerState.displayState === "conflict" && (0, _styles.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n &:hover {\n background-color: ", ";\n }\n &.", ":not(:last-child) {\n border-right-color: ", ";\n }\n "])), theme.palette.error.contrastText, theme.palette.error.main, theme.palette.error.dark, _material.buttonGroupClasses.grouped, theme.palette.error.dark));
|
|
43
|
-
});
|
|
44
|
-
function SaveButton(inProps) {
|
|
45
|
-
var _useThemeProps = (0, _styles.useThemeProps)({
|
|
46
|
-
props: inProps,
|
|
47
|
-
name: "CometAdminSaveButton"
|
|
48
|
-
}),
|
|
49
|
-
_useThemeProps$saving = _useThemeProps.saving,
|
|
50
|
-
saving = _useThemeProps$saving === void 0 ? false : _useThemeProps$saving,
|
|
51
|
-
_useThemeProps$hasErr = _useThemeProps.hasErrors,
|
|
52
|
-
hasErrors = _useThemeProps$hasErr === void 0 ? false : _useThemeProps$hasErr,
|
|
53
|
-
_useThemeProps$hasCon = _useThemeProps.hasConflict,
|
|
54
|
-
hasConflict = _useThemeProps$hasCon === void 0 ? false : _useThemeProps$hasCon,
|
|
55
|
-
_useThemeProps$childr = _useThemeProps.children,
|
|
56
|
-
children = _useThemeProps$childr === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _objectSpread({}, _messages.messages.save)) : _useThemeProps$childr,
|
|
57
|
-
_useThemeProps$saving2 = _useThemeProps.savingItem,
|
|
58
|
-
savingItem = _useThemeProps$saving2 === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
59
|
-
id: "comet.saveButton.savingItem.title",
|
|
60
|
-
defaultMessage: "Saving"
|
|
61
|
-
}) : _useThemeProps$saving2,
|
|
62
|
-
_useThemeProps$succes = _useThemeProps.successItem,
|
|
63
|
-
successItem = _useThemeProps$succes === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
64
|
-
id: "comet.saveButton.successItem.title",
|
|
65
|
-
defaultMessage: "Successfully Saved"
|
|
66
|
-
}) : _useThemeProps$succes,
|
|
67
|
-
_useThemeProps$errorI = _useThemeProps.errorItem,
|
|
68
|
-
errorItem = _useThemeProps$errorI === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
69
|
-
id: "comet.saveButton.errorItem.title",
|
|
70
|
-
defaultMessage: "Save Error"
|
|
71
|
-
}) : _useThemeProps$errorI,
|
|
72
|
-
_useThemeProps$confli = _useThemeProps.conflictItem,
|
|
73
|
-
conflictItem = _useThemeProps$confli === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, _objectSpread({}, _messages.messages.saveConflict)) : _useThemeProps$confli,
|
|
74
|
-
_useThemeProps$saveIc = _useThemeProps.saveIcon,
|
|
75
|
-
saveIcon = _useThemeProps$saveIc === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.Save, {}) : _useThemeProps$saveIc,
|
|
76
|
-
_useThemeProps$saving3 = _useThemeProps.savingIcon,
|
|
77
|
-
savingIcon = _useThemeProps$saving3 === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.ThreeDotSaving, {}) : _useThemeProps$saving3,
|
|
78
|
-
_useThemeProps$succes2 = _useThemeProps.successIcon,
|
|
79
|
-
successIcon = _useThemeProps$succes2 === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.Check, {}) : _useThemeProps$succes2,
|
|
80
|
-
_useThemeProps$errorI2 = _useThemeProps.errorIcon,
|
|
81
|
-
errorIcon = _useThemeProps$errorI2 === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.Error, {}) : _useThemeProps$errorI2,
|
|
82
|
-
_useThemeProps$confli2 = _useThemeProps.conflictIcon,
|
|
83
|
-
conflictIcon = _useThemeProps$confli2 === void 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_adminIcons.Error, {}) : _useThemeProps$confli2,
|
|
84
|
-
_useThemeProps$varian = _useThemeProps.variant,
|
|
85
|
-
variant = _useThemeProps$varian === void 0 ? "contained" : _useThemeProps$varian,
|
|
86
|
-
_useThemeProps$color = _useThemeProps.color,
|
|
87
|
-
color = _useThemeProps$color === void 0 ? "primary" : _useThemeProps$color,
|
|
88
|
-
disabled = _useThemeProps.disabled,
|
|
89
|
-
restProps = _objectWithoutProperties(_useThemeProps, _excluded);
|
|
90
|
-
var _useState = (0, _react.useState)("idle"),
|
|
91
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
92
|
-
displayState = _useState2[0],
|
|
93
|
-
setDisplayState = _useState2[1];
|
|
94
|
-
var saveSplitButton = (0, _useSplitButtonContext.useSplitButtonContext)();
|
|
95
|
-
var ownerState = {
|
|
96
|
-
displayState: displayState,
|
|
97
|
-
variant: variant,
|
|
98
|
-
color: color
|
|
99
|
-
};
|
|
100
|
-
var resolveIconForDisplayState = function resolveIconForDisplayState(displayState) {
|
|
101
|
-
if (displayState === "saving") {
|
|
102
|
-
return savingIcon;
|
|
103
|
-
} else if (displayState === "success") {
|
|
104
|
-
return successIcon;
|
|
105
|
-
} else if (displayState === "error") {
|
|
106
|
-
return errorIcon;
|
|
107
|
-
} else if (displayState === "conflict") {
|
|
108
|
-
return conflictIcon;
|
|
109
|
-
}
|
|
110
|
-
return saveIcon;
|
|
111
|
-
};
|
|
112
|
-
(0, _react.useEffect)(function () {
|
|
113
|
-
var timeoutId;
|
|
114
|
-
if ((displayState === "idle" || displayState === "conflict") && saving) {
|
|
115
|
-
setDisplayState("saving");
|
|
116
|
-
}
|
|
117
|
-
// Display Conflict
|
|
118
|
-
else if (displayState === "idle" && hasConflict) {
|
|
119
|
-
setDisplayState("conflict");
|
|
120
|
-
}
|
|
121
|
-
// Display Error
|
|
122
|
-
else if (displayState === "saving" && hasErrors === true) {
|
|
123
|
-
timeoutId = window.setTimeout(function () {
|
|
124
|
-
setDisplayState("error");
|
|
125
|
-
}, 500);
|
|
126
|
-
}
|
|
127
|
-
// Display Success
|
|
128
|
-
else if (displayState === "saving" && saving === false && hasErrors === false) {
|
|
129
|
-
timeoutId = window.setTimeout(function () {
|
|
130
|
-
setDisplayState("success");
|
|
131
|
-
}, 500);
|
|
132
|
-
}
|
|
133
|
-
// Return to idle
|
|
134
|
-
else if (displayState === "error") {
|
|
135
|
-
timeoutId = window.setTimeout(function () {
|
|
136
|
-
setDisplayState("idle");
|
|
137
|
-
}, 5000);
|
|
138
|
-
}
|
|
139
|
-
// Return to idle
|
|
140
|
-
else if (displayState === "success") {
|
|
141
|
-
timeoutId = window.setTimeout(function () {
|
|
142
|
-
setDisplayState("idle");
|
|
143
|
-
}, 2000);
|
|
144
|
-
}
|
|
145
|
-
return function () {
|
|
146
|
-
if (timeoutId !== undefined) {
|
|
147
|
-
window.clearTimeout(timeoutId);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}, [displayState, saving, hasErrors, hasConflict]);
|
|
151
|
-
(0, _react.useEffect)(function () {
|
|
152
|
-
if (displayState === "idle") {
|
|
153
|
-
saveSplitButton === null || saveSplitButton === void 0 || saveSplitButton.setShowSelectButton(undefined);
|
|
154
|
-
} else if (displayState === "saving") {
|
|
155
|
-
saveSplitButton === null || saveSplitButton === void 0 || saveSplitButton.setShowSelectButton(false);
|
|
156
|
-
} else if (displayState === "success") {
|
|
157
|
-
saveSplitButton === null || saveSplitButton === void 0 || saveSplitButton.setShowSelectButton(false);
|
|
158
|
-
} else if (displayState === "error") {
|
|
159
|
-
saveSplitButton === null || saveSplitButton === void 0 || saveSplitButton.setShowSelectButton(false);
|
|
160
|
-
} else if (displayState === "conflict") {
|
|
161
|
-
saveSplitButton === null || saveSplitButton === void 0 || saveSplitButton.setShowSelectButton(undefined);
|
|
162
|
-
}
|
|
163
|
-
}, [displayState, saveSplitButton]);
|
|
164
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, _objectSpread(_objectSpread({
|
|
165
|
-
ownerState: ownerState
|
|
166
|
-
}, restProps), {}, {
|
|
167
|
-
startIcon: resolveIconForDisplayState(displayState),
|
|
168
|
-
variant: variant,
|
|
169
|
-
color: color,
|
|
170
|
-
disabled: disabled || displayState != "idle" && displayState != "conflict",
|
|
171
|
-
children: [displayState === "idle" && children, displayState === "saving" && savingItem, displayState === "success" && successItem, displayState === "error" && errorItem, displayState === "conflict" && conflictItem]
|
|
172
|
-
}));
|
|
173
|
-
}
|