@comet/cms-admin 9.0.0-beta.0 → 9.0.0-beta.1
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/blocks/createTableBlock.d.ts +23 -0
- package/lib/blocks/createTableBlock.d.ts.map +1 -0
- package/lib/blocks/createTableBlock.js +243 -0
- package/lib/blocks/table/CellValue.d.ts +9 -0
- package/lib/blocks/table/CellValue.d.ts.map +1 -0
- package/lib/blocks/table/CellValue.js +86 -0
- package/lib/blocks/table/ColumnHeader.d.ts +16 -0
- package/lib/blocks/table/ColumnHeader.d.ts.map +1 -0
- package/lib/blocks/table/ColumnHeader.js +296 -0
- package/lib/blocks/table/EditCell.d.ts +3 -0
- package/lib/blocks/table/EditCell.d.ts.map +1 -0
- package/lib/blocks/table/EditCell.js +119 -0
- package/lib/blocks/table/FailedToPasteSnackbar.d.ts +3 -0
- package/lib/blocks/table/FailedToPasteSnackbar.d.ts.map +1 -0
- package/lib/blocks/table/FailedToPasteSnackbar.js +23 -0
- package/lib/blocks/table/RowActionsCell.d.ts +13 -0
- package/lib/blocks/table/RowActionsCell.d.ts.map +1 -0
- package/lib/blocks/table/RowActionsCell.js +240 -0
- package/lib/blocks/table/TableBlockContext.d.ts +11 -0
- package/lib/blocks/table/TableBlockContext.d.ts.map +1 -0
- package/lib/blocks/table/TableBlockContext.js +18 -0
- package/lib/blocks/table/TableBlockGrid.d.ts +9 -0
- package/lib/blocks/table/TableBlockGrid.d.ts.map +1 -0
- package/lib/blocks/table/TableBlockGrid.js +231 -0
- package/lib/blocks/table/__mocks__/TableBlockData.mocks.js +203 -0
- package/lib/blocks/table/dataGridStyles.d.ts +3 -0
- package/lib/blocks/table/dataGridStyles.d.ts.map +1 -0
- package/lib/blocks/table/dataGridStyles.js +59 -0
- package/lib/blocks/table/utils/column.d.ts +48 -0
- package/lib/blocks/table/utils/column.d.ts.map +1 -0
- package/lib/blocks/table/utils/column.js +149 -0
- package/lib/blocks/table/utils/ensureMinimumTableState.d.ts +4 -0
- package/lib/blocks/table/utils/ensureMinimumTableState.d.ts.map +1 -0
- package/lib/blocks/table/utils/ensureMinimumTableState.js +49 -0
- package/lib/blocks/table/utils/getClipboardValueForSchema.d.ts +3 -0
- package/lib/blocks/table/utils/getClipboardValueForSchema.d.ts.map +1 -0
- package/lib/blocks/table/utils/getClipboardValueForSchema.js +45 -0
- package/lib/blocks/table/utils/row.d.ts +33 -0
- package/lib/blocks/table/utils/row.d.ts.map +1 -0
- package/lib/blocks/table/utils/row.js +124 -0
- package/lib/blocks/table/utils/rteSchema.d.ts +9 -0
- package/lib/blocks/table/utils/rteSchema.d.ts.map +1 -0
- package/lib/blocks/table/utils/rteSchema.js +4 -0
- package/lib/blocks/table/utils/useRecentlyPastedIds.d.ts +5 -0
- package/lib/blocks/table/utils/useRecentlyPastedIds.d.ts.map +1 -0
- package/lib/blocks/table/utils/useRecentlyPastedIds.js +45 -0
- package/lib/blocks.generated.d.ts +31 -1
- package/lib/blocks.generated.d.ts.map +1 -1
- package/lib/dam/DataGrid/DamContextMenu.d.ts.map +1 -1
- package/lib/dam/DataGrid/DamContextMenu.js +2 -3
- package/lib/dam/DataGrid/FolderDataGrid.d.ts.map +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.gql.d.ts.map +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.gql.generated.d.ts +8 -0
- package/lib/dam/DataGrid/FolderDataGrid.gql.generated.d.ts.map +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.gql.js +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.js +47 -7
- package/lib/dam/DataGrid/selection/DamSelectionContext.js +2 -2
- package/lib/dam/FileForm/EditFile.gql.d.ts.map +1 -1
- package/lib/dam/FileForm/EditFile.gql.generated.d.ts +3 -0
- package/lib/dam/FileForm/EditFile.gql.generated.d.ts.map +1 -1
- package/lib/dam/FileForm/EditFile.gql.js +1 -1
- package/lib/dam/FileForm/EditFile.js +4 -4
- package/lib/dam/FileForm/FilePreview.d.ts.map +1 -1
- package/lib/dam/FileForm/FilePreview.js +6 -7
- package/lib/dependencies/DependenciesList.d.ts +30 -0
- package/lib/dependencies/DependenciesList.d.ts.map +1 -0
- package/lib/dependencies/DependenciesList.js +282 -0
- package/lib/dependencies/DependentsList.d.ts +30 -0
- package/lib/dependencies/DependentsList.d.ts.map +1 -0
- package/lib/dependencies/{DependencyList.js → DependentsList.js} +165 -135
- package/lib/dependencies/getDisplayNameString.d.ts +4 -0
- package/lib/dependencies/getDisplayNameString.d.ts.map +1 -0
- package/lib/dependencies/getDisplayNameString.js +12 -0
- package/lib/graphql.generated.d.ts +27 -3
- package/lib/graphql.generated.d.ts.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/redirects/RedirectForm.d.ts.map +1 -1
- package/lib/redirects/RedirectForm.js +23 -6
- package/lib/testing/test-utils.d.ts +6 -0
- package/lib/testing/test-utils.d.ts.map +1 -0
- package/lib/testing/test-utils.js +34 -0
- package/package.json +23 -15
- package/lib/dependencies/DependencyList.d.ts +0 -29
- package/lib/dependencies/DependencyList.d.ts.map +0 -1
- package/lib/dependencies/DependencyList.sc.d.ts +0 -7
- package/lib/dependencies/DependencyList.sc.d.ts.map +0 -1
- package/lib/dependencies/DependencyList.sc.js +0 -73
|
@@ -0,0 +1,240 @@
|
|
|
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
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); }
|
|
11
|
+
import { Alert, RowActionsItem, RowActionsMenu, useSnackbarApi, writeClipboardText } from "@comet/admin";
|
|
12
|
+
import { Add, ArrowDown, ArrowUp, Copy, Delete, Duplicate, Paste, Remove } from "@comet/admin-icons";
|
|
13
|
+
import { Divider, Snackbar } from "@mui/material";
|
|
14
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
15
|
+
import { v4 as uuid } from "uuid";
|
|
16
|
+
import { useBlockContext } from "../context/useBlockContext";
|
|
17
|
+
import { FailedToPasteSnackbar } from "./FailedToPasteSnackbar";
|
|
18
|
+
import { useTableBlockContext } from "./TableBlockContext";
|
|
19
|
+
import { getClipboardValueForSchema } from "./utils/getClipboardValueForSchema";
|
|
20
|
+
import { deleteRowById, getDuplicatedRowInsertData, getInsertDataFromRowById, insertRowDataAtIndex, rowInsertSchema } from "./utils/row";
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
export var RowActionsCell = function RowActionsCell(_ref) {
|
|
23
|
+
var row = _ref.row,
|
|
24
|
+
updateState = _ref.updateState,
|
|
25
|
+
state = _ref.state,
|
|
26
|
+
addToRecentlyPastedIds = _ref.addToRecentlyPastedIds;
|
|
27
|
+
var snackbarApi = useSnackbarApi();
|
|
28
|
+
var blockContext = useBlockContext();
|
|
29
|
+
var stateRow = state.rows.find(function (rowInState) {
|
|
30
|
+
return rowInState.id === row.id;
|
|
31
|
+
});
|
|
32
|
+
var intl = useIntl();
|
|
33
|
+
var _useTableBlockContext = useTableBlockContext(),
|
|
34
|
+
RichTextBlock = _useTableBlockContext.RichTextBlock;
|
|
35
|
+
var handleInsertNewRow = function handleInsertNewRow(where) {
|
|
36
|
+
updateState(function (state) {
|
|
37
|
+
var currentRowIndex = state.rows.findIndex(function (_ref2) {
|
|
38
|
+
var id = _ref2.id;
|
|
39
|
+
return id === row.id;
|
|
40
|
+
});
|
|
41
|
+
var newRowIndex = where === "above" ? currentRowIndex : currentRowIndex + 1;
|
|
42
|
+
var insertData = {
|
|
43
|
+
highlighted: false,
|
|
44
|
+
cellValues: state.columns.map(function () {
|
|
45
|
+
return RichTextBlock.defaultValues();
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
return insertRowDataAtIndex(state, insertData, newRowIndex, RichTextBlock);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var handleDeleteRow = function handleDeleteRow() {
|
|
52
|
+
updateState(function (state) {
|
|
53
|
+
return deleteRowById(state, row.id);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var toggleRowHighlight = function toggleRowHighlight() {
|
|
57
|
+
updateState(function (state) {
|
|
58
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
59
|
+
rows: state.rows.map(function (rowInState) {
|
|
60
|
+
if (rowInState.id === row.id) {
|
|
61
|
+
return _objectSpread(_objectSpread({}, rowInState), {}, {
|
|
62
|
+
highlighted: !rowInState.highlighted
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return rowInState;
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
var handleDuplicateRow = function handleDuplicateRow() {
|
|
71
|
+
var duplicatedRowInsertData = getDuplicatedRowInsertData(state, row.id, RichTextBlock);
|
|
72
|
+
var currentRowIndex = state.rows.findIndex(function (_ref3) {
|
|
73
|
+
var id = _ref3.id;
|
|
74
|
+
return id === row.id;
|
|
75
|
+
});
|
|
76
|
+
if (!duplicatedRowInsertData) {
|
|
77
|
+
snackbarApi.showSnackbar(/*#__PURE__*/_jsx(Snackbar, {
|
|
78
|
+
autoHideDuration: 5000,
|
|
79
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
80
|
+
severity: "error",
|
|
81
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
82
|
+
id: "comet.tableBlock.failedToDuplicateRow",
|
|
83
|
+
defaultMessage: "Failed to duplicate row"
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
}));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
updateState(function (state) {
|
|
90
|
+
var newRowId = uuid();
|
|
91
|
+
addToRecentlyPastedIds(newRowId);
|
|
92
|
+
return insertRowDataAtIndex(state, duplicatedRowInsertData, currentRowIndex + 1, RichTextBlock, newRowId);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
var handleCopyRowToClipboard = function handleCopyRowToClipboard() {
|
|
96
|
+
var rowInsertData = getInsertDataFromRowById(state, row.id, RichTextBlock);
|
|
97
|
+
if (!rowInsertData) {
|
|
98
|
+
snackbarApi.showSnackbar(/*#__PURE__*/_jsx(Snackbar, {
|
|
99
|
+
autoHideDuration: 5000,
|
|
100
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
101
|
+
severity: "error",
|
|
102
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
103
|
+
id: "comet.tableBlock.failedToCopyRow",
|
|
104
|
+
defaultMessage: "Failed to copy row"
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
}));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
writeClipboardText(JSON.stringify(rowInsertData));
|
|
111
|
+
};
|
|
112
|
+
var pasteRowFromClipboard = /*#__PURE__*/function () {
|
|
113
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
114
|
+
var clipboardData, cellValuesToInsert, _t;
|
|
115
|
+
return _regenerator().w(function (_context) {
|
|
116
|
+
while (1) switch (_context.p = _context.n) {
|
|
117
|
+
case 0:
|
|
118
|
+
_context.n = 1;
|
|
119
|
+
return getClipboardValueForSchema(rowInsertSchema);
|
|
120
|
+
case 1:
|
|
121
|
+
clipboardData = _context.v;
|
|
122
|
+
if (clipboardData) {
|
|
123
|
+
_context.n = 2;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
snackbarApi.showSnackbar(/*#__PURE__*/_jsx(FailedToPasteSnackbar, {}));
|
|
127
|
+
return _context.a(2);
|
|
128
|
+
case 2:
|
|
129
|
+
cellValuesToInsert = [];
|
|
130
|
+
_context.p = 3;
|
|
131
|
+
_context.n = 4;
|
|
132
|
+
return Promise.all(clipboardData.cellValues.map(function (cellValue) {
|
|
133
|
+
return RichTextBlock.output2State(cellValue, blockContext);
|
|
134
|
+
}));
|
|
135
|
+
case 4:
|
|
136
|
+
cellValuesToInsert = _context.v;
|
|
137
|
+
_context.n = 6;
|
|
138
|
+
break;
|
|
139
|
+
case 5:
|
|
140
|
+
_context.p = 5;
|
|
141
|
+
_t = _context.v;
|
|
142
|
+
console.error(_t);
|
|
143
|
+
snackbarApi.showSnackbar(/*#__PURE__*/_jsx(FailedToPasteSnackbar, {}));
|
|
144
|
+
case 6:
|
|
145
|
+
updateState(function (state) {
|
|
146
|
+
var newRowId = uuid();
|
|
147
|
+
addToRecentlyPastedIds(newRowId);
|
|
148
|
+
var currentRowIndex = state.rows.findIndex(function (_ref5) {
|
|
149
|
+
var id = _ref5.id;
|
|
150
|
+
return id === row.id;
|
|
151
|
+
});
|
|
152
|
+
return insertRowDataAtIndex(state, _objectSpread(_objectSpread({}, clipboardData), {}, {
|
|
153
|
+
cellValues: cellValuesToInsert
|
|
154
|
+
}), currentRowIndex + 1, RichTextBlock, newRowId);
|
|
155
|
+
});
|
|
156
|
+
case 7:
|
|
157
|
+
return _context.a(2);
|
|
158
|
+
}
|
|
159
|
+
}, _callee, null, [[3, 5]]);
|
|
160
|
+
}));
|
|
161
|
+
return function pasteRowFromClipboard() {
|
|
162
|
+
return _ref4.apply(this, arguments);
|
|
163
|
+
};
|
|
164
|
+
}();
|
|
165
|
+
return /*#__PURE__*/_jsx(RowActionsMenu, {
|
|
166
|
+
children: /*#__PURE__*/_jsxs(RowActionsMenu, {
|
|
167
|
+
componentsProps: {
|
|
168
|
+
rowActionsIconItem: {
|
|
169
|
+
componentsProps: {
|
|
170
|
+
iconButton: {
|
|
171
|
+
"aria-label": intl.formatMessage({
|
|
172
|
+
id: "comet.tableBlock.openRowOptions",
|
|
173
|
+
defaultMessage: "Open row options"
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
children: [/*#__PURE__*/_jsx(RowActionsItem, {
|
|
180
|
+
icon: stateRow !== null && stateRow !== void 0 && stateRow.highlighted ? /*#__PURE__*/_jsx(Remove, {}) : /*#__PURE__*/_jsx(Add, {}),
|
|
181
|
+
onClick: function onClick() {
|
|
182
|
+
toggleRowHighlight();
|
|
183
|
+
},
|
|
184
|
+
children: stateRow !== null && stateRow !== void 0 && stateRow.highlighted ? /*#__PURE__*/_jsx(FormattedMessage, {
|
|
185
|
+
id: "comet.tableBlock.removeHighlighting",
|
|
186
|
+
defaultMessage: "Remove highlighting"
|
|
187
|
+
}) : /*#__PURE__*/_jsx(FormattedMessage, {
|
|
188
|
+
id: "comet.tableBlock.highlightRow",
|
|
189
|
+
defaultMessage: "Highlight row"
|
|
190
|
+
})
|
|
191
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
192
|
+
icon: /*#__PURE__*/_jsx(ArrowUp, {}),
|
|
193
|
+
onClick: function onClick() {
|
|
194
|
+
handleInsertNewRow("above");
|
|
195
|
+
},
|
|
196
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
197
|
+
id: "comet.tableBlock.addRowAbove",
|
|
198
|
+
defaultMessage: "Add row above"
|
|
199
|
+
})
|
|
200
|
+
}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
201
|
+
icon: /*#__PURE__*/_jsx(ArrowDown, {}),
|
|
202
|
+
onClick: function onClick() {
|
|
203
|
+
handleInsertNewRow("below");
|
|
204
|
+
},
|
|
205
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
206
|
+
id: "comet.tableBlock.addRowBelow",
|
|
207
|
+
defaultMessage: "Add row below"
|
|
208
|
+
})
|
|
209
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
210
|
+
icon: /*#__PURE__*/_jsx(Copy, {}),
|
|
211
|
+
onClick: handleCopyRowToClipboard,
|
|
212
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
213
|
+
id: "comet.tableBlock.copyRow",
|
|
214
|
+
defaultMessage: "Copy"
|
|
215
|
+
})
|
|
216
|
+
}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
217
|
+
icon: /*#__PURE__*/_jsx(Paste, {}),
|
|
218
|
+
onClick: pasteRowFromClipboard,
|
|
219
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
220
|
+
id: "comet.tableBlock.pasteRow",
|
|
221
|
+
defaultMessage: "Paste"
|
|
222
|
+
})
|
|
223
|
+
}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
224
|
+
icon: /*#__PURE__*/_jsx(Duplicate, {}),
|
|
225
|
+
onClick: handleDuplicateRow,
|
|
226
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
227
|
+
id: "comet.tableBlock.duplicateRow",
|
|
228
|
+
defaultMessage: "Duplicate"
|
|
229
|
+
})
|
|
230
|
+
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(RowActionsItem, {
|
|
231
|
+
icon: /*#__PURE__*/_jsx(Delete, {}),
|
|
232
|
+
onClick: handleDeleteRow,
|
|
233
|
+
children: /*#__PURE__*/_jsx(FormattedMessage, {
|
|
234
|
+
id: "comet.tableBlock.deleteRow",
|
|
235
|
+
defaultMessage: "Delete"
|
|
236
|
+
})
|
|
237
|
+
})]
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type RichTextBlock } from "../createRichTextBlock";
|
|
3
|
+
type TableBlockContextValue = {
|
|
4
|
+
RichTextBlock: RichTextBlock;
|
|
5
|
+
};
|
|
6
|
+
export declare const TableBlockContextProvider: ({ RichTextBlock, children }: TableBlockContextValue & {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useTableBlockContext: () => TableBlockContextValue;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=TableBlockContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableBlockContext.d.ts","sourceRoot":"","sources":["../../../src/blocks/table/TableBlockContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,KAAK,sBAAsB,GAAG;IAC1B,aAAa,EAAE,aAAa,CAAC;CAChC,CAAC;AAIF,eAAO,MAAM,yBAAyB,GAAI,6BAA6B,sBAAsB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAEtH,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAO,sBAIvC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
var TableBlockContext = /*#__PURE__*/createContext(undefined);
|
|
4
|
+
export var TableBlockContextProvider = function TableBlockContextProvider(_ref) {
|
|
5
|
+
var RichTextBlock = _ref.RichTextBlock,
|
|
6
|
+
children = _ref.children;
|
|
7
|
+
return /*#__PURE__*/_jsx(TableBlockContext.Provider, {
|
|
8
|
+
value: {
|
|
9
|
+
RichTextBlock: RichTextBlock
|
|
10
|
+
},
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export var useTableBlockContext = function useTableBlockContext() {
|
|
15
|
+
var context = useContext(TableBlockContext);
|
|
16
|
+
if (!context) throw new Error("useTableBlockContext must be used within a TableBlockContextProvider");
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
import { type TableBlockState } from "../createTableBlock";
|
|
3
|
+
type Props = {
|
|
4
|
+
state: TableBlockState;
|
|
5
|
+
updateState: Dispatch<SetStateAction<TableBlockState>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const TableBlockGrid: ({ state, updateState }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=TableBlockGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableBlockGrid.d.ts","sourceRoot":"","sources":["../../../src/blocks/table/TableBlockGrid.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAuB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAa,MAAM,OAAO,CAAC;AAG3F,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA6B3D,KAAK,KAAK,GAAG;IACT,KAAK,EAAE,eAAe,CAAC;IACvB,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,wBAAwB,KAAK,4CAiK3D,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
var _excluded = ["id"];
|
|
2
|
+
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); }
|
|
3
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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; } }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
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); }
|
|
20
|
+
import { DragIndicator } from "@comet/admin-icons";
|
|
21
|
+
// eslint-disable-next-line no-restricted-imports
|
|
22
|
+
|
|
23
|
+
import { DataGridPro, GRID_REORDER_COL_DEF, useGridApiRef } from "@mui/x-data-grid-pro";
|
|
24
|
+
import { useEffect } from "react";
|
|
25
|
+
import { CellValue } from "./CellValue";
|
|
26
|
+
import { ColumnHeader } from "./ColumnHeader";
|
|
27
|
+
import { dataGridStyles } from "./dataGridStyles";
|
|
28
|
+
import { EditCell } from "./EditCell";
|
|
29
|
+
import { RowActionsCell } from "./RowActionsCell";
|
|
30
|
+
import { useTableBlockContext } from "./TableBlockContext";
|
|
31
|
+
import { ensureMinimumTableState } from "./utils/ensureMinimumTableState";
|
|
32
|
+
import { useRecentlyPastedIds } from "./utils/useRecentlyPastedIds";
|
|
33
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
+
var widthForColumnSize = {
|
|
35
|
+
extraSmall: 100,
|
|
36
|
+
small: 200,
|
|
37
|
+
standard: 300,
|
|
38
|
+
large: 400,
|
|
39
|
+
extraLarge: 500
|
|
40
|
+
};
|
|
41
|
+
var flexForColumnSize = {
|
|
42
|
+
extraSmall: 1,
|
|
43
|
+
small: 2,
|
|
44
|
+
standard: 3,
|
|
45
|
+
large: 4,
|
|
46
|
+
extraLarge: 5
|
|
47
|
+
};
|
|
48
|
+
export var TableBlockGrid = function TableBlockGrid(_ref) {
|
|
49
|
+
var state = _ref.state,
|
|
50
|
+
updateState = _ref.updateState;
|
|
51
|
+
var _useTableBlockContext = useTableBlockContext(),
|
|
52
|
+
RichTextBlock = _useTableBlockContext.RichTextBlock;
|
|
53
|
+
var apiRef = useGridApiRef();
|
|
54
|
+
var _useRecentlyPastedIds = useRecentlyPastedIds(),
|
|
55
|
+
recentlyPastedRowIds = _useRecentlyPastedIds.recentlyPastedIds,
|
|
56
|
+
addToRecentlyPastedRowIds = _useRecentlyPastedIds.addToRecentlyPastedIds;
|
|
57
|
+
var _useRecentlyPastedIds2 = useRecentlyPastedIds(),
|
|
58
|
+
recentlyPastedColumnIds = _useRecentlyPastedIds2.recentlyPastedIds,
|
|
59
|
+
addToRecentlyPastedColumnIds = _useRecentlyPastedIds2.addToRecentlyPastedIds;
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (state.columns.length === 0 || state.rows.length === 0) {
|
|
62
|
+
updateState(function (prevState) {
|
|
63
|
+
return ensureMinimumTableState(prevState, RichTextBlock);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, [state.columns.length, state.rows.length, updateState, RichTextBlock]);
|
|
67
|
+
var setRowData = function setRowData(newRows) {
|
|
68
|
+
updateState(function (state) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
70
|
+
rows: typeof newRows === "function" ? newRows(state.rows) : newRows
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
var processRowUpdate = function processRowUpdate(newRow) {
|
|
75
|
+
var newRowId = newRow.id,
|
|
76
|
+
newRowValuesRecord = _objectWithoutProperties(newRow, _excluded);
|
|
77
|
+
setRowData(function (previousRowData) {
|
|
78
|
+
return previousRowData.map(function (existingRow) {
|
|
79
|
+
if (existingRow.id === newRowId) {
|
|
80
|
+
return _objectSpread(_objectSpread({}, existingRow), {}, {
|
|
81
|
+
cellValues: Object.entries(newRowValuesRecord).map(function (_ref2) {
|
|
82
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
83
|
+
columnId = _ref3[0],
|
|
84
|
+
value = _ref3[1];
|
|
85
|
+
return {
|
|
86
|
+
columnId: columnId,
|
|
87
|
+
value: value
|
|
88
|
+
};
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return existingRow;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return newRow;
|
|
96
|
+
};
|
|
97
|
+
var moveRow = function moveRow(targetIndex, rowId) {
|
|
98
|
+
updateState(function (state) {
|
|
99
|
+
var movingRow = state.rows.find(function (row) {
|
|
100
|
+
return row.id === rowId;
|
|
101
|
+
});
|
|
102
|
+
if (!movingRow) {
|
|
103
|
+
return state;
|
|
104
|
+
}
|
|
105
|
+
var otherRows = state.rows.filter(function (row) {
|
|
106
|
+
return row.id !== rowId;
|
|
107
|
+
});
|
|
108
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
109
|
+
rows: [].concat(_toConsumableArray(otherRows.slice(0, targetIndex)), [movingRow], _toConsumableArray(otherRows.slice(targetIndex)))
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
var handleMoveColumn = function handleMoveColumn(_ref4) {
|
|
115
|
+
var columnId = _ref4.field;
|
|
116
|
+
var targetIndex = apiRef.current.getColumnIndex(columnId) - 1;
|
|
117
|
+
updateState(function (state) {
|
|
118
|
+
var movingColumn = state.columns.find(function (column) {
|
|
119
|
+
return column.id === columnId;
|
|
120
|
+
});
|
|
121
|
+
if (!movingColumn) {
|
|
122
|
+
return state;
|
|
123
|
+
}
|
|
124
|
+
var otherColumns = state.columns.filter(function (column) {
|
|
125
|
+
return column.id !== columnId;
|
|
126
|
+
});
|
|
127
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
128
|
+
columns: [].concat(_toConsumableArray(otherColumns.slice(0, targetIndex)), [movingColumn], _toConsumableArray(otherColumns.slice(targetIndex)))
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
return apiRef.current.subscribeEvent("columnHeaderDragEnd", handleMoveColumn);
|
|
133
|
+
}, [apiRef, updateState]);
|
|
134
|
+
var dataGridColumns = [_objectSpread(_objectSpread({}, GRID_REORDER_COL_DEF), {}, {
|
|
135
|
+
minWidth: 36,
|
|
136
|
+
maxWidth: 36
|
|
137
|
+
})].concat(_toConsumableArray(state.columns.map(function (_ref5, index) {
|
|
138
|
+
var columnId = _ref5.id,
|
|
139
|
+
highlighted = _ref5.highlighted,
|
|
140
|
+
size = _ref5.size;
|
|
141
|
+
return {
|
|
142
|
+
field: columnId,
|
|
143
|
+
editable: true,
|
|
144
|
+
sortable: false,
|
|
145
|
+
flex: flexForColumnSize[size],
|
|
146
|
+
minWidth: widthForColumnSize[size],
|
|
147
|
+
renderHeader: function renderHeader(params) {
|
|
148
|
+
return /*#__PURE__*/_jsx(ColumnHeader, _objectSpread(_objectSpread({}, params), {}, {
|
|
149
|
+
state: state,
|
|
150
|
+
columnSize: size,
|
|
151
|
+
highlighted: highlighted,
|
|
152
|
+
updateState: updateState,
|
|
153
|
+
columnIndex: index,
|
|
154
|
+
addToRecentlyPastedIds: addToRecentlyPastedColumnIds
|
|
155
|
+
}));
|
|
156
|
+
},
|
|
157
|
+
renderCell: function renderCell(_ref6) {
|
|
158
|
+
var value = _ref6.value,
|
|
159
|
+
row = _ref6.row,
|
|
160
|
+
columnId = _ref6.field;
|
|
161
|
+
var rowFromState = state.rows.find(function (rowInState) {
|
|
162
|
+
return rowInState.id === row.id;
|
|
163
|
+
});
|
|
164
|
+
var rowWasRecentlyPasted = recentlyPastedRowIds.includes(row.id);
|
|
165
|
+
var columnWasRecentlyPasted = recentlyPastedColumnIds.includes(columnId);
|
|
166
|
+
return /*#__PURE__*/_jsx(CellValue, {
|
|
167
|
+
value: value,
|
|
168
|
+
highlighted: (rowFromState === null || rowFromState === void 0 ? void 0 : rowFromState.highlighted) || highlighted,
|
|
169
|
+
recentlyPasted: rowWasRecentlyPasted || columnWasRecentlyPasted
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
renderEditCell: function renderEditCell(params) {
|
|
173
|
+
return /*#__PURE__*/_jsx(EditCell, _objectSpread({}, params));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
})), [{
|
|
177
|
+
field: "actions",
|
|
178
|
+
sortable: false,
|
|
179
|
+
headerName: "",
|
|
180
|
+
minWidth: 36,
|
|
181
|
+
maxWidth: 36,
|
|
182
|
+
disableReorder: true,
|
|
183
|
+
renderCell: function renderCell(_ref7) {
|
|
184
|
+
var row = _ref7.row;
|
|
185
|
+
return /*#__PURE__*/_jsx(RowActionsCell, {
|
|
186
|
+
row: row,
|
|
187
|
+
updateState: updateState,
|
|
188
|
+
state: state,
|
|
189
|
+
addToRecentlyPastedIds: addToRecentlyPastedRowIds
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}]);
|
|
193
|
+
var rowsInDataGridFormat = state.rows.map(function (_ref8) {
|
|
194
|
+
var id = _ref8.id,
|
|
195
|
+
cellValues = _ref8.cellValues;
|
|
196
|
+
var dataGridRow = {
|
|
197
|
+
id: id
|
|
198
|
+
};
|
|
199
|
+
cellValues.forEach(function (_ref9) {
|
|
200
|
+
var columnId = _ref9.columnId,
|
|
201
|
+
value = _ref9.value;
|
|
202
|
+
dataGridRow[columnId] = value;
|
|
203
|
+
});
|
|
204
|
+
return dataGridRow;
|
|
205
|
+
});
|
|
206
|
+
return /*#__PURE__*/_jsx(DataGridPro, {
|
|
207
|
+
columns: dataGridColumns,
|
|
208
|
+
apiRef: apiRef,
|
|
209
|
+
rows: rowsInDataGridFormat,
|
|
210
|
+
rowHeight: 55,
|
|
211
|
+
rowReordering: true,
|
|
212
|
+
disableColumnResize: true,
|
|
213
|
+
disableColumnMenu: true,
|
|
214
|
+
disableRowSelectionOnClick: true,
|
|
215
|
+
hideFooter: true,
|
|
216
|
+
pinnedColumns: {
|
|
217
|
+
left: ["__reorder__"],
|
|
218
|
+
right: ["actions"]
|
|
219
|
+
},
|
|
220
|
+
slots: {
|
|
221
|
+
rowReorderIcon: DragIndicator
|
|
222
|
+
},
|
|
223
|
+
sx: dataGridStyles,
|
|
224
|
+
onRowOrderChange: function onRowOrderChange(_ref0) {
|
|
225
|
+
var targetIndex = _ref0.targetIndex,
|
|
226
|
+
row = _ref0.row;
|
|
227
|
+
moveRow(targetIndex, row.id);
|
|
228
|
+
},
|
|
229
|
+
processRowUpdate: processRowUpdate
|
|
230
|
+
});
|
|
231
|
+
};
|