@comet/admin 9.0.0-beta.4 → 9.0.0-beta.5
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/common/DeleteDialog.d.ts +1 -0
- package/lib/common/DeleteDialog.d.ts.map +1 -1
- package/lib/common/DeleteDialog.js +8 -1
- package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
- package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
- package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
- package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
- package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
- package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
- package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
- package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
- package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
- package/lib/form/__stories__/Autocomplete.stories.js +188 -0
- package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
- package/lib/form/__stories__/Checkbox.stories.js +70 -0
- package/lib/form/__stories__/CheckboxField.stories.js +87 -0
- package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
- package/lib/form/__stories__/CustomButtons.stories.js +78 -0
- package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
- package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
- package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
- package/lib/form/__stories__/FieldContainer.stories.js +87 -0
- package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
- package/lib/form/__stories__/FormInStack.stories.js +133 -0
- package/lib/form/__stories__/FormLayouts.stories.js +174 -0
- package/lib/form/__stories__/FormValidation.stories.js +82 -0
- package/lib/form/__stories__/Input.stories.js +37 -0
- package/lib/form/__stories__/NumberField.stories.js +38 -0
- package/lib/form/__stories__/Radio.stories.js +101 -0
- package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
- package/lib/form/__stories__/RangeInput.stories.js +239 -0
- package/lib/form/__stories__/RouterTabs.stories.js +96 -0
- package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
- package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
- package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
- package/lib/form/__stories__/SearchField.stories.js +38 -0
- package/lib/form/__stories__/Select.stories.js +187 -0
- package/lib/form/__stories__/SelectField.stories.js +100 -0
- package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
- package/lib/form/__stories__/SingleTextField.stories.js +108 -0
- package/lib/form/__stories__/StackInForm.stories.js +53 -0
- package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
- package/lib/form/__stories__/Switch.stories.js +49 -0
- package/lib/form/__stories__/SwitchField.stories.js +87 -0
- package/lib/form/__stories__/Tabs.stories.js +78 -0
- package/lib/form/__stories__/TextAreaField.stories.js +38 -0
- package/lib/form/__stories__/TextField.stories.js +67 -0
- package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
- package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
- package/lib/form/__stories__/Typography.stories.js +71 -0
- package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
- package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
- package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
- package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
- package/lib/helpers/useTopOffset.js +1 -1
- package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
- package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
- package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
- package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
- package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
- package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
- package/lib/tabs/__stories__/Tabs.stories.js +219 -0
- package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteDialog.d.ts","sourceRoot":"","sources":["../../src/common/DeleteDialog.tsx"],"names":[],"mappings":"AAcA,UAAU,iBAAiB;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DeleteDialog.d.ts","sourceRoot":"","sources":["../../src/common/DeleteDialog.tsx"],"names":[],"mappings":"AAcA,UAAU,iBAAiB;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CA+CpD,CAAC"}
|
|
@@ -17,6 +17,7 @@ export var DeleteDialog = function DeleteDialog(props) {
|
|
|
17
17
|
var dialogOpen = props.dialogOpen,
|
|
18
18
|
_props$deleteType = props.deleteType,
|
|
19
19
|
deleteType = _props$deleteType === void 0 ? "delete" : _props$deleteType,
|
|
20
|
+
deleteCount = props.deleteCount,
|
|
20
21
|
onDelete = props.onDelete,
|
|
21
22
|
onCancel = props.onCancel;
|
|
22
23
|
return /*#__PURE__*/_jsxs(Dialog, {
|
|
@@ -41,7 +42,13 @@ export var DeleteDialog = function DeleteDialog(props) {
|
|
|
41
42
|
},
|
|
42
43
|
children: [/*#__PURE__*/_jsx(WarningSolid, {
|
|
43
44
|
color: "error"
|
|
44
|
-
}), deleteType === "delete" ? /*#__PURE__*/_jsx(FormattedMessage, {
|
|
45
|
+
}), deleteType === "delete" ? deleteCount !== undefined && deleteCount > 1 ? /*#__PURE__*/_jsx(FormattedMessage, {
|
|
46
|
+
id: "comet.table.deleteDialog.contentMultiple",
|
|
47
|
+
defaultMessage: "You are about to delete {count} items permanently.",
|
|
48
|
+
values: {
|
|
49
|
+
count: deleteCount
|
|
50
|
+
}
|
|
51
|
+
}) : /*#__PURE__*/_jsx(FormattedMessage, {
|
|
45
52
|
id: "comet.table.deleteDialog.content",
|
|
46
53
|
defaultMessage: "You are about to delete this item permanently."
|
|
47
54
|
}) : /*#__PURE__*/_jsx(FormattedMessage, {
|
|
@@ -23,7 +23,7 @@ var Root = createComponentSlot(ButtonBase)({
|
|
|
23
23
|
slotName: "root"
|
|
24
24
|
})(function (_ref) {
|
|
25
25
|
var theme = _ref.theme;
|
|
26
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n width: 40px;\n color: ", ";\n\n ", ":last-child & {\n margin-right: ", ";\n }\n\n ", ":first-
|
|
26
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n width: 40px;\n color: ", ";\n\n ", ":last-child & {\n margin-right: ", ";\n }\n\n ", ":first-of-type & {\n margin-left: ", ";\n }\n\n &:disabled {\n color: ", ";\n }\n "])), theme.palette.action.active, ".".concat(inputAdornmentClasses.positionEnd), theme.spacing(-2), ".".concat(inputAdornmentClasses.positionStart), theme.spacing(-2), theme.palette.action.disabled);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
import { Button, DataGridToolbar, FillSpace, GridColumnsButton, GridFilterButton, GridToolbarQuickFilter, StackLink, useDataGridRemote, usePersistentColumnState } from "@comet/admin";
|
|
8
|
+
import { Add as AddIcon } from "@comet/admin-icons";
|
|
9
|
+
import { DataGrid as DataGridCommunity } from "@mui/x-data-grid";
|
|
10
|
+
import { DataGridPro } from "@mui/x-data-grid-pro";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var data = [{
|
|
13
|
+
id: "1f30a6a0-5b9d-4b25-8307-9e8b4a4d2b1c",
|
|
14
|
+
firstname: "Emily",
|
|
15
|
+
lastname: "Smith"
|
|
16
|
+
}, {
|
|
17
|
+
id: "28b9bdf3-5646-4a22-9449-74112db67b5f",
|
|
18
|
+
firstname: "Daniel",
|
|
19
|
+
lastname: "Johnson"
|
|
20
|
+
}, {
|
|
21
|
+
id: "e60900ec-3c69-4e67-8d78-83a10c7573d3",
|
|
22
|
+
firstname: "Sophia",
|
|
23
|
+
lastname: "Williams"
|
|
24
|
+
}];
|
|
25
|
+
var gridOptions = ["Community", "Pro"];
|
|
26
|
+
export default {
|
|
27
|
+
title: "components/toolbar/DataGridToolbar",
|
|
28
|
+
argTypes: {
|
|
29
|
+
gridVersion: {
|
|
30
|
+
name: "Data Grid Version",
|
|
31
|
+
control: "select",
|
|
32
|
+
options: gridOptions
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
args: {
|
|
36
|
+
gridVersion: gridOptions[0]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export var _DataGridToolbar = {
|
|
40
|
+
render: function render(_ref) {
|
|
41
|
+
var gridVersion = _ref.gridVersion;
|
|
42
|
+
var dataGridProps = _objectSpread(_objectSpread({}, useDataGridRemote()), usePersistentColumnState("FooBar"));
|
|
43
|
+
var columns = [{
|
|
44
|
+
field: "firstname",
|
|
45
|
+
headerName: "First Name",
|
|
46
|
+
width: 150
|
|
47
|
+
}, {
|
|
48
|
+
field: "lastname",
|
|
49
|
+
headerName: "Last Name",
|
|
50
|
+
width: 150
|
|
51
|
+
}];
|
|
52
|
+
var ToolbarSlot = function ToolbarSlot() {
|
|
53
|
+
return /*#__PURE__*/_jsxs(DataGridToolbar, {
|
|
54
|
+
children: [/*#__PURE__*/_jsx(GridToolbarQuickFilter, {}), /*#__PURE__*/_jsx(GridFilterButton, {}), /*#__PURE__*/_jsx(GridColumnsButton, {}), /*#__PURE__*/_jsx(FillSpace, {}), /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
responsive: true,
|
|
56
|
+
startIcon: /*#__PURE__*/_jsx(AddIcon, {}),
|
|
57
|
+
component: StackLink,
|
|
58
|
+
pageName: "add",
|
|
59
|
+
payload: "add",
|
|
60
|
+
children: "Add person"
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var DataGrid = gridVersion === "Community" ? DataGridCommunity : DataGridPro;
|
|
65
|
+
return /*#__PURE__*/_jsx(DataGrid, _objectSpread(_objectSpread({}, dataGridProps), {}, {
|
|
66
|
+
autoHeight: true,
|
|
67
|
+
columns: columns,
|
|
68
|
+
rows: data,
|
|
69
|
+
slots: {
|
|
70
|
+
toolbar: ToolbarSlot
|
|
71
|
+
},
|
|
72
|
+
showToolbar: true
|
|
73
|
+
}));
|
|
74
|
+
},
|
|
75
|
+
name: "DataGrid Toolbar"
|
|
76
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Button, FillSpace, HelpDialogButton, Stack, StackLink, StackPage, StackSwitch, Toolbar, ToolbarActions, ToolbarAutomaticTitleItem, ToolbarBackButton, ToolbarItem } from "@comet/admin";
|
|
2
|
+
import { ArrowRight, Save } from "@comet/admin-icons";
|
|
3
|
+
import { Box, Chip, Typography } from "@mui/material";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
function StackWrapper(_ref) {
|
|
7
|
+
var children = _ref.children;
|
|
8
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
9
|
+
topLevelTitle: "Stack Root",
|
|
10
|
+
children: /*#__PURE__*/_jsxs(StackSwitch, {
|
|
11
|
+
initialPage: "root",
|
|
12
|
+
children: [/*#__PURE__*/_jsxs(StackPage, {
|
|
13
|
+
name: "root",
|
|
14
|
+
children: [children, /*#__PURE__*/_jsx(StackLink, {
|
|
15
|
+
pageName: "detail",
|
|
16
|
+
payload: "x",
|
|
17
|
+
children: "Go to detail page"
|
|
18
|
+
})]
|
|
19
|
+
}), /*#__PURE__*/_jsx(StackPage, {
|
|
20
|
+
name: "detail",
|
|
21
|
+
title: " Stack Detail",
|
|
22
|
+
children: children
|
|
23
|
+
})]
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function Story() {
|
|
28
|
+
return /*#__PURE__*/_jsxs(Toolbar, {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(ToolbarBackButton, {}), /*#__PURE__*/_jsx(ToolbarAutomaticTitleItem, {}), /*#__PURE__*/_jsx(ToolbarItem, {
|
|
30
|
+
children: /*#__PURE__*/_jsx(Chip, {
|
|
31
|
+
label: "Chip text"
|
|
32
|
+
})
|
|
33
|
+
}), /*#__PURE__*/_jsx(FillSpace, {}), /*#__PURE__*/_jsxs(ToolbarActions, {
|
|
34
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
35
|
+
responsive: true,
|
|
36
|
+
startIcon: /*#__PURE__*/_jsx(ArrowRight, {}),
|
|
37
|
+
variant: "outlined",
|
|
38
|
+
children: "Secondary button"
|
|
39
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
40
|
+
responsive: true,
|
|
41
|
+
startIcon: /*#__PURE__*/_jsx(Save, {}),
|
|
42
|
+
children: "Primary button"
|
|
43
|
+
})]
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export default {
|
|
48
|
+
title: "components/toolbar/Toolbar"
|
|
49
|
+
};
|
|
50
|
+
export var _Toolbar = function _Toolbar() {
|
|
51
|
+
return /*#__PURE__*/_jsx(StackWrapper, {
|
|
52
|
+
children: /*#__PURE__*/_jsx(Story, {})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export var ToolbarWithHelp = function ToolbarWithHelp() {
|
|
56
|
+
return /*#__PURE__*/_jsx(Toolbar, {
|
|
57
|
+
scopeIndicator: /*#__PURE__*/_jsx(Chip, {
|
|
58
|
+
label: "Global"
|
|
59
|
+
}),
|
|
60
|
+
topBarActions: /*#__PURE__*/_jsx(HelpDialogButton, {
|
|
61
|
+
dialogTitle: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
62
|
+
id: "story.toolbar.helpDialog.title",
|
|
63
|
+
defaultMessage: "Help"
|
|
64
|
+
}),
|
|
65
|
+
dialogDescription: /*#__PURE__*/_jsxs(_Fragment, {
|
|
66
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
67
|
+
sx: {
|
|
68
|
+
width: 150,
|
|
69
|
+
height: 150
|
|
70
|
+
},
|
|
71
|
+
component: "img",
|
|
72
|
+
src: "https://picsum.photos/id/35/300/300"
|
|
73
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
74
|
+
children: "This is some helpful text inside the help dialog."
|
|
75
|
+
})]
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
children: /*#__PURE__*/_jsx(ToolbarItem, {
|
|
79
|
+
children: "Some title"
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Edit } from "@comet/admin-icons";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
import { DataGrid } from "@mui/x-data-grid";
|
|
4
|
+
import { ToolbarBackButton } from "../../common/toolbar/backbutton/ToolbarBackButton";
|
|
5
|
+
import { ToolbarTitleItem } from "../../common/toolbar/titleitem/ToolbarTitleItem";
|
|
6
|
+
import { Toolbar } from "../../common/toolbar/Toolbar";
|
|
7
|
+
import { StackPage } from "../../stack/Page";
|
|
8
|
+
import { StackLink } from "../../stack/StackLink";
|
|
9
|
+
import { StackSwitch, useStackSwitchApi } from "../../stack/Switch";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var exampleRows = [{
|
|
12
|
+
id: 1,
|
|
13
|
+
lastName: "Snow",
|
|
14
|
+
firstName: "Jon"
|
|
15
|
+
}, {
|
|
16
|
+
id: 2,
|
|
17
|
+
lastName: "Lannister",
|
|
18
|
+
firstName: "Cersei"
|
|
19
|
+
}, {
|
|
20
|
+
id: 3,
|
|
21
|
+
lastName: "Lannister",
|
|
22
|
+
firstName: "Jaime"
|
|
23
|
+
}, {
|
|
24
|
+
id: 4,
|
|
25
|
+
lastName: "Stark",
|
|
26
|
+
firstName: "Arya"
|
|
27
|
+
}, {
|
|
28
|
+
id: 5,
|
|
29
|
+
lastName: "Targaryen",
|
|
30
|
+
firstName: "Daenerys"
|
|
31
|
+
}, {
|
|
32
|
+
id: 6,
|
|
33
|
+
lastName: "Melisandre",
|
|
34
|
+
firstName: null
|
|
35
|
+
}, {
|
|
36
|
+
id: 7,
|
|
37
|
+
lastName: "Clifford",
|
|
38
|
+
firstName: "Ferrara"
|
|
39
|
+
}, {
|
|
40
|
+
id: 8,
|
|
41
|
+
lastName: "Frances",
|
|
42
|
+
firstName: "Rossini"
|
|
43
|
+
}, {
|
|
44
|
+
id: 9,
|
|
45
|
+
lastName: "Roxie",
|
|
46
|
+
firstName: "Harvey"
|
|
47
|
+
}];
|
|
48
|
+
var exampleColumns = [{
|
|
49
|
+
field: "firstName",
|
|
50
|
+
headerName: "First name",
|
|
51
|
+
flex: 1
|
|
52
|
+
}, {
|
|
53
|
+
field: "lastName",
|
|
54
|
+
headerName: "Last name",
|
|
55
|
+
flex: 1
|
|
56
|
+
}];
|
|
57
|
+
export default {
|
|
58
|
+
title: "components/dataGrid/ClickableRows",
|
|
59
|
+
parameters: {
|
|
60
|
+
stack: {
|
|
61
|
+
topLevelTitle: "Example Page"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export var ClickableRows = function ClickableRows() {
|
|
66
|
+
// Grid must be a separate component to make sure the stackSwitchApi context is correct
|
|
67
|
+
var Grid = function Grid() {
|
|
68
|
+
var stackSwitchApi = useStackSwitchApi();
|
|
69
|
+
var columns = [].concat(exampleColumns, [{
|
|
70
|
+
field: "actions",
|
|
71
|
+
type: "actions",
|
|
72
|
+
headerName: "",
|
|
73
|
+
width: 52,
|
|
74
|
+
renderCell: function renderCell(params) {
|
|
75
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
76
|
+
color: "primary",
|
|
77
|
+
component: StackLink,
|
|
78
|
+
pageName: "edit",
|
|
79
|
+
payload: params.row.id,
|
|
80
|
+
children: /*#__PURE__*/_jsx(Edit, {})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}]);
|
|
84
|
+
return /*#__PURE__*/_jsx(DataGrid, {
|
|
85
|
+
rows: exampleRows,
|
|
86
|
+
columns: columns,
|
|
87
|
+
onRowClick: function onRowClick(params) {
|
|
88
|
+
stackSwitchApi.activatePage("edit", params.row.id);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/_jsxs(StackSwitch, {
|
|
93
|
+
children: [/*#__PURE__*/_jsx(StackPage, {
|
|
94
|
+
name: "grid",
|
|
95
|
+
children: /*#__PURE__*/_jsx(Grid, {})
|
|
96
|
+
}), /*#__PURE__*/_jsx(StackPage, {
|
|
97
|
+
name: "edit",
|
|
98
|
+
children: function children(id) {
|
|
99
|
+
return /*#__PURE__*/_jsxs(Toolbar, {
|
|
100
|
+
children: [/*#__PURE__*/_jsx(ToolbarBackButton, {}), /*#__PURE__*/_jsxs(ToolbarTitleItem, {
|
|
101
|
+
children: ["Editing item with id: ", /*#__PURE__*/_jsx("code", {
|
|
102
|
+
children: id
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Delete, Download, Excel, Favorite, Move } from "@comet/admin-icons";
|
|
2
|
+
import { ListItemIcon } from "@mui/material";
|
|
3
|
+
import { CrudMoreActionsMenu, CrudMoreActionsMenuItem } from "../CrudMoreActionsMenu";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export default {
|
|
6
|
+
title: "components/dataGrid/CrudMoreActionsMenu"
|
|
7
|
+
};
|
|
8
|
+
export var Basic = function Basic() {
|
|
9
|
+
return /*#__PURE__*/_jsx(CrudMoreActionsMenu, {
|
|
10
|
+
selectionSize: 2,
|
|
11
|
+
overallActions: [{
|
|
12
|
+
label: "Export to Excel",
|
|
13
|
+
onClick: function onClick() {},
|
|
14
|
+
icon: /*#__PURE__*/_jsx(Excel, {})
|
|
15
|
+
}],
|
|
16
|
+
selectiveActions: [{
|
|
17
|
+
label: "Move",
|
|
18
|
+
onClick: function onClick() {},
|
|
19
|
+
icon: /*#__PURE__*/_jsx(Move, {})
|
|
20
|
+
}, {
|
|
21
|
+
label: "Delete",
|
|
22
|
+
onClick: function onClick() {},
|
|
23
|
+
icon: /*#__PURE__*/_jsx(Delete, {}),
|
|
24
|
+
divider: true
|
|
25
|
+
}, {
|
|
26
|
+
label: "Download",
|
|
27
|
+
onClick: function onClick() {},
|
|
28
|
+
icon: /*#__PURE__*/_jsx(Download, {})
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export var CustomComponent = function CustomComponent() {
|
|
33
|
+
var CustomAction = function CustomAction() {
|
|
34
|
+
return /*#__PURE__*/_jsxs(CrudMoreActionsMenuItem, {
|
|
35
|
+
onClick: function onClick() {
|
|
36
|
+
window.alert("Hello from custom action");
|
|
37
|
+
},
|
|
38
|
+
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
39
|
+
children: /*#__PURE__*/_jsx(Favorite, {})
|
|
40
|
+
}), "Custom Action"]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/_jsx(CrudMoreActionsMenu, {
|
|
44
|
+
overallActions: [{
|
|
45
|
+
label: "Export to Excel",
|
|
46
|
+
onClick: function onClick() {},
|
|
47
|
+
icon: /*#__PURE__*/_jsx(Excel, {})
|
|
48
|
+
}, /*#__PURE__*/_jsx(CustomAction, {}, "custom-action")]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Add } from "@comet/admin-icons";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { DataGrid } from "@mui/x-data-grid";
|
|
4
|
+
import { Button } from "../../common/buttons/Button";
|
|
5
|
+
import { FillSpace } from "../../common/FillSpace";
|
|
6
|
+
import { DataGridToolbar } from "../../common/toolbar/DataGridToolbar";
|
|
7
|
+
import { ToolbarTitleItem } from "../../common/toolbar/titleitem/ToolbarTitleItem";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
var exampleRows = [{
|
|
10
|
+
id: 1,
|
|
11
|
+
lastName: "Snow",
|
|
12
|
+
firstName: "Jon"
|
|
13
|
+
}, {
|
|
14
|
+
id: 2,
|
|
15
|
+
lastName: "Lannister",
|
|
16
|
+
firstName: "Cersei"
|
|
17
|
+
}, {
|
|
18
|
+
id: 3,
|
|
19
|
+
lastName: "Lannister",
|
|
20
|
+
firstName: "Jaime"
|
|
21
|
+
}, {
|
|
22
|
+
id: 4,
|
|
23
|
+
lastName: "Stark",
|
|
24
|
+
firstName: "Arya"
|
|
25
|
+
}, {
|
|
26
|
+
id: 5,
|
|
27
|
+
lastName: "Targaryen",
|
|
28
|
+
firstName: "Daenerys"
|
|
29
|
+
}, {
|
|
30
|
+
id: 6,
|
|
31
|
+
lastName: "Melisandre",
|
|
32
|
+
firstName: null
|
|
33
|
+
}, {
|
|
34
|
+
id: 7,
|
|
35
|
+
lastName: "Clifford",
|
|
36
|
+
firstName: "Ferrara"
|
|
37
|
+
}, {
|
|
38
|
+
id: 8,
|
|
39
|
+
lastName: "Frances",
|
|
40
|
+
firstName: "Rossini"
|
|
41
|
+
}, {
|
|
42
|
+
id: 9,
|
|
43
|
+
lastName: "Roxie",
|
|
44
|
+
firstName: "Harvey"
|
|
45
|
+
}];
|
|
46
|
+
var exampleColumns = [{
|
|
47
|
+
field: "firstName",
|
|
48
|
+
headerName: "First name",
|
|
49
|
+
flex: 1
|
|
50
|
+
}, {
|
|
51
|
+
field: "lastName",
|
|
52
|
+
headerName: "Last name",
|
|
53
|
+
flex: 1
|
|
54
|
+
}];
|
|
55
|
+
export default {
|
|
56
|
+
title: "components/dataGrid/DataGrid"
|
|
57
|
+
};
|
|
58
|
+
export var Default = {
|
|
59
|
+
args: {
|
|
60
|
+
density: "standard"
|
|
61
|
+
},
|
|
62
|
+
argTypes: {
|
|
63
|
+
density: {
|
|
64
|
+
name: "Density",
|
|
65
|
+
control: "select",
|
|
66
|
+
options: ["standard", "comfortable", "compact"]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
render: function render(_ref) {
|
|
70
|
+
var density = _ref.density;
|
|
71
|
+
var ToolbarForGrid = function ToolbarForGrid() {
|
|
72
|
+
return /*#__PURE__*/_jsxs(DataGridToolbar, {
|
|
73
|
+
children: [/*#__PURE__*/_jsx(ToolbarTitleItem, {
|
|
74
|
+
children: "DataGrid example"
|
|
75
|
+
}), /*#__PURE__*/_jsx(FillSpace, {}), /*#__PURE__*/_jsx(Button, {
|
|
76
|
+
startIcon: /*#__PURE__*/_jsx(Add, {}),
|
|
77
|
+
children: "Add"
|
|
78
|
+
})]
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
82
|
+
height: 400,
|
|
83
|
+
children: /*#__PURE__*/_jsx(DataGrid, {
|
|
84
|
+
density: density,
|
|
85
|
+
rows: exampleRows,
|
|
86
|
+
columns: exampleColumns,
|
|
87
|
+
slots: {
|
|
88
|
+
toolbar: ToolbarForGrid
|
|
89
|
+
},
|
|
90
|
+
showToolbar: true
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|