@mui/x-data-grid-premium 7.22.3 → 8.0.0-alpha.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/CHANGELOG.md +348 -12
- package/README.md +4 -4
- package/components/GridColumnMenuAggregationItem.js +4 -6
- package/components/GridColumnMenuRowGroupItem.js +1 -2
- package/components/GridColumnMenuRowUngroupItem.js +2 -3
- package/components/GridExcelExportMenuItem.js +3 -2
- package/components/index.d.ts +1 -0
- package/components/index.js +12 -0
- package/components/promptControl/GridToolbarPromptControl.d.ts +26 -0
- package/components/promptControl/GridToolbarPromptControl.js +209 -0
- package/components/promptControl/RecordButton.d.ts +16 -0
- package/components/promptControl/RecordButton.js +119 -0
- package/components/promptControl/index.d.ts +1 -0
- package/components/promptControl/index.js +12 -0
- package/esm/components/GridColumnMenuAggregationItem.js +4 -6
- package/esm/components/GridColumnMenuRowGroupItem.js +1 -2
- package/esm/components/GridColumnMenuRowUngroupItem.js +2 -3
- package/esm/components/GridExcelExportMenuItem.js +3 -2
- package/esm/components/index.js +1 -0
- package/esm/components/promptControl/GridToolbarPromptControl.js +202 -0
- package/esm/components/promptControl/RecordButton.js +111 -0
- package/esm/components/promptControl/index.js +1 -0
- package/esm/hooks/features/cellSelection/useGridCellSelection.js +2 -1
- package/esm/hooks/features/index.js +2 -1
- package/esm/hooks/features/promptControl/api.js +22 -0
- package/esm/hooks/features/promptControl/index.js +1 -0
- package/esm/hooks/features/promptControl/types.js +1 -0
- package/esm/material/icons.js +7 -1
- package/esm/material/index.js +4 -2
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -0
- package/hooks/features/cellSelection/useGridCellSelection.js +7 -6
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +11 -0
- package/hooks/features/promptControl/api.d.ts +2 -0
- package/hooks/features/promptControl/api.js +28 -0
- package/hooks/features/promptControl/index.d.ts +2 -0
- package/hooks/features/promptControl/index.js +12 -0
- package/hooks/features/promptControl/types.d.ts +25 -0
- package/hooks/features/promptControl/types.js +5 -0
- package/index.js +1 -1
- package/material/icons.d.ts +6 -0
- package/material/icons.js +8 -2
- package/material/index.d.ts +2 -0
- package/material/index.js +3 -1
- package/models/gridPremiumIconSlotsComponent.d.ts +10 -0
- package/modern/components/GridColumnMenuAggregationItem.js +4 -6
- package/modern/components/GridColumnMenuRowGroupItem.js +1 -2
- package/modern/components/GridColumnMenuRowUngroupItem.js +2 -3
- package/modern/components/GridExcelExportMenuItem.js +3 -2
- package/modern/components/index.js +1 -0
- package/modern/components/promptControl/GridToolbarPromptControl.js +202 -0
- package/modern/components/promptControl/RecordButton.js +111 -0
- package/modern/components/promptControl/index.js +1 -0
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +2 -1
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/promptControl/api.js +22 -0
- package/modern/hooks/features/promptControl/index.js +1 -0
- package/modern/hooks/features/promptControl/types.js +1 -0
- package/modern/index.js +1 -1
- package/modern/material/icons.js +7 -1
- package/modern/material/index.js +4 -2
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +8 -8
- package/utils/releaseInfo.js +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Timeout } from '@mui/utils/useTimeout';
|
|
3
|
+
import useLazyRef from '@mui/utils/useLazyRef';
|
|
4
|
+
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
5
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const BrowserSpeechRecognition = globalThis.SpeechRecognition || globalThis.webkitSpeechRecognition;
|
|
8
|
+
function RecordButton(props) {
|
|
9
|
+
const apiRef = useGridApiContext();
|
|
10
|
+
const rootProps = useGridRootProps();
|
|
11
|
+
const {
|
|
12
|
+
lang,
|
|
13
|
+
recording,
|
|
14
|
+
setRecording,
|
|
15
|
+
disabled,
|
|
16
|
+
className,
|
|
17
|
+
onDone,
|
|
18
|
+
onUpdate,
|
|
19
|
+
onError
|
|
20
|
+
} = props;
|
|
21
|
+
const buttonRef = React.useRef(null);
|
|
22
|
+
const recognition = useLazyRef(() => {
|
|
23
|
+
if (!BrowserSpeechRecognition) {
|
|
24
|
+
return {
|
|
25
|
+
start: () => {},
|
|
26
|
+
abort: () => {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const timeout = new Timeout();
|
|
30
|
+
const instance = new BrowserSpeechRecognition();
|
|
31
|
+
instance.continuous = true;
|
|
32
|
+
instance.interimResults = true;
|
|
33
|
+
instance.lang = lang;
|
|
34
|
+
let finalResult = '';
|
|
35
|
+
let interimResult = '';
|
|
36
|
+
function start(options) {
|
|
37
|
+
if (recording) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setRecording(true);
|
|
41
|
+
instance.onresult = event => {
|
|
42
|
+
finalResult = '';
|
|
43
|
+
interimResult = '';
|
|
44
|
+
if (typeof event.results === 'undefined') {
|
|
45
|
+
instance.stop();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
for (let i = event.resultIndex; i < event.results.length; i += 1) {
|
|
49
|
+
if (event.results[i].isFinal) {
|
|
50
|
+
finalResult += event.results[i][0].transcript;
|
|
51
|
+
} else {
|
|
52
|
+
interimResult += event.results[i][0].transcript;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (finalResult === '') {
|
|
56
|
+
options.onUpdate(interimResult);
|
|
57
|
+
}
|
|
58
|
+
timeout.start(1000, () => instance.stop());
|
|
59
|
+
};
|
|
60
|
+
instance.onsoundend = () => {
|
|
61
|
+
instance.stop();
|
|
62
|
+
};
|
|
63
|
+
instance.onend = () => {
|
|
64
|
+
options.onDone(finalResult);
|
|
65
|
+
setRecording(false);
|
|
66
|
+
};
|
|
67
|
+
instance.onerror = error => {
|
|
68
|
+
options.onError(error.message);
|
|
69
|
+
instance.stop();
|
|
70
|
+
setRecording(false);
|
|
71
|
+
};
|
|
72
|
+
instance.start();
|
|
73
|
+
}
|
|
74
|
+
function abort() {
|
|
75
|
+
instance.abort();
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
start,
|
|
79
|
+
abort
|
|
80
|
+
};
|
|
81
|
+
}).current;
|
|
82
|
+
const handleClick = () => {
|
|
83
|
+
if (!recording) {
|
|
84
|
+
recognition.start({
|
|
85
|
+
onDone,
|
|
86
|
+
onUpdate,
|
|
87
|
+
onError
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
recognition.abort();
|
|
92
|
+
};
|
|
93
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
94
|
+
title: recording ? apiRef.current.getLocaleText('toolbarPromptControlRecordButtonActiveLabel') : apiRef.current.getLocaleText('toolbarPromptControlRecordButtonDefaultLabel'),
|
|
95
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
96
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, {
|
|
97
|
+
color: recording ? 'primary' : 'default',
|
|
98
|
+
className: className,
|
|
99
|
+
disabled: disabled,
|
|
100
|
+
onClick: handleClick,
|
|
101
|
+
ref: buttonRef,
|
|
102
|
+
size: "small",
|
|
103
|
+
edge: "start",
|
|
104
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.toolbarPromptRecordIcon, {
|
|
105
|
+
fontSize: "small"
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
export { RecordButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GridToolbarPromptControl as Unstable_GridToolbarPromptControl } from "./GridToolbarPromptControl.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import ownerDocument from '@mui/utils/ownerDocument';
|
|
4
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
5
|
import { getTotalHeaderHeight, getVisibleRows, isNavigationKey, serializeCellValue, useGridRegisterPipeProcessor, useGridVisibleRows } from '@mui/x-data-grid-pro/internals';
|
|
5
6
|
import { useGridApiEventHandler, useGridApiMethod, GRID_ACTIONS_COLUMN_TYPE, GRID_CHECKBOX_SELECTION_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, gridRowsDataRowIdToIdLookupSelector, gridClasses, gridFocusCellSelector, GRID_REORDER_COL_DEF, useGridSelector, gridSortedRowIdsSelector, gridDimensionsSelector } from '@mui/x-data-grid-pro';
|
|
6
7
|
import { gridCellSelectionStateSelector } from "./gridCellSelectionSelector.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function gridDefaultPromptResolver(url, context, query) {
|
|
2
|
+
return fetch(url, {
|
|
3
|
+
mode: 'cors',
|
|
4
|
+
method: 'POST',
|
|
5
|
+
headers: {
|
|
6
|
+
'content-type': 'application/json'
|
|
7
|
+
},
|
|
8
|
+
credentials: 'include',
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
context,
|
|
11
|
+
query
|
|
12
|
+
})
|
|
13
|
+
}).then(result => result.json()).then(result => {
|
|
14
|
+
if (result.ok === false) {
|
|
15
|
+
return Promise.reject(new Error(result.message));
|
|
16
|
+
}
|
|
17
|
+
if (result.data.error) {
|
|
18
|
+
return Promise.reject(new Error(result.data.error));
|
|
19
|
+
}
|
|
20
|
+
return result.data;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { gridDefaultPromptResolver as unstable_gridDefaultPromptResolver } from "./api.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/material/icons.js
CHANGED
|
@@ -11,4 +11,10 @@ export const GridGroupWorkIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
|
11
11
|
}), 'GroupWork');
|
|
12
12
|
export const GridFunctionsIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
13
13
|
d: "M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"
|
|
14
|
-
}), 'Functions');
|
|
14
|
+
}), 'Functions');
|
|
15
|
+
export const GridSendPromptIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
16
|
+
d: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
17
|
+
}), 'SendPrompt');
|
|
18
|
+
export const GridRecordPromptIcon = createSvgIcon(/*#__PURE__*/_jsx("path", {
|
|
19
|
+
d: "M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"
|
|
20
|
+
}), 'RecordPrompt');
|
package/esm/material/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon } from "./icons.js";
|
|
2
|
+
import { GridWorkspacesIcon, GridGroupWorkIcon, GridFunctionsIcon, GridSendPromptIcon, GridRecordPromptIcon } from "./icons.js";
|
|
3
3
|
const iconsSlots = {
|
|
4
4
|
columnMenuUngroupIcon: GridWorkspacesIcon,
|
|
5
5
|
columnMenuGroupIcon: GridGroupWorkIcon,
|
|
6
|
-
columnMenuAggregationIcon: GridFunctionsIcon
|
|
6
|
+
columnMenuAggregationIcon: GridFunctionsIcon,
|
|
7
|
+
toolbarPromptSendIcon: GridSendPromptIcon,
|
|
8
|
+
toolbarPromptRecordIcon: GridRecordPromptIcon
|
|
7
9
|
};
|
|
8
10
|
const materialSlots = _extends({}, iconsSlots);
|
|
9
11
|
export default materialSlots;
|
package/esm/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMjIzMDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -65,6 +65,7 @@ export declare const unwrapColumnFromAggregation: ({ column, }: {
|
|
|
65
65
|
disableReorder?: boolean;
|
|
66
66
|
disableExport?: boolean;
|
|
67
67
|
colSpan?: number | import("@mui/x-data-grid").GridColSpanFn<import("@mui/x-data-grid").GridValidRowModel, any, any> | undefined;
|
|
68
|
+
unstable_examples?: any[] | undefined;
|
|
68
69
|
renderHeaderFilter?: (params: import("@mui/x-data-grid-pro").GridRenderHeaderFilterProps) => React.ReactNode;
|
|
69
70
|
aggregable?: boolean;
|
|
70
71
|
availableAggregationFunctions?: string[];
|
|
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useGridCellSelection = exports.cellSelectionStateInitializer = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
12
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
13
|
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
13
14
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
14
15
|
var _gridCellSelectionSelector = require("./gridCellSelectionSelector");
|
|
@@ -141,7 +142,7 @@ const useGridCellSelection = (apiRef, props) => {
|
|
|
141
142
|
}
|
|
142
143
|
return params.rowNode.type !== 'pinnedRow';
|
|
143
144
|
}, [apiRef]);
|
|
144
|
-
const handleMouseUp = (0,
|
|
145
|
+
const handleMouseUp = (0, _useEventCallback.default)(() => {
|
|
145
146
|
lastMouseDownCell.current = null;
|
|
146
147
|
apiRef.current.rootElementRef?.current?.classList.remove(_xDataGridPro.gridClasses['root--disableUserSelection']);
|
|
147
148
|
|
|
@@ -167,7 +168,7 @@ const useGridCellSelection = (apiRef, props) => {
|
|
|
167
168
|
field: params.field
|
|
168
169
|
};
|
|
169
170
|
apiRef.current.rootElementRef?.current?.classList.add(_xDataGridPro.gridClasses['root--disableUserSelection']);
|
|
170
|
-
const document = (0,
|
|
171
|
+
const document = (0, _ownerDocument.default)(apiRef.current.rootElementRef?.current);
|
|
171
172
|
document.addEventListener('mouseup', handleMouseUp, {
|
|
172
173
|
once: true
|
|
173
174
|
});
|
|
@@ -280,7 +281,7 @@ const useGridCellSelection = (apiRef, props) => {
|
|
|
280
281
|
stopAutoScroll();
|
|
281
282
|
}
|
|
282
283
|
}, [apiRef, startAutoScroll, stopAutoScroll, totalHeaderHeight, dimensions]);
|
|
283
|
-
const handleCellClick = (0,
|
|
284
|
+
const handleCellClick = (0, _useEventCallback.default)((params, event) => {
|
|
284
285
|
const {
|
|
285
286
|
id,
|
|
286
287
|
field
|
|
@@ -317,7 +318,7 @@ const useGridCellSelection = (apiRef, props) => {
|
|
|
317
318
|
});
|
|
318
319
|
}
|
|
319
320
|
});
|
|
320
|
-
const handleCellKeyDown = (0,
|
|
321
|
+
const handleCellKeyDown = (0, _useEventCallback.default)((params, event) => {
|
|
321
322
|
if (!(0, _internals.isNavigationKey)(event.key) || !cellWithVirtualFocus.current) {
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
@@ -377,7 +378,7 @@ const useGridCellSelection = (apiRef, props) => {
|
|
|
377
378
|
const rootRef = apiRef.current.rootElementRef?.current;
|
|
378
379
|
return () => {
|
|
379
380
|
stopAutoScroll();
|
|
380
|
-
const document = (0,
|
|
381
|
+
const document = (0, _ownerDocument.default)(rootRef);
|
|
381
382
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
382
383
|
};
|
|
383
384
|
}, [apiRef, hasRootReference, handleMouseUp, stopAutoScroll]);
|
package/hooks/features/index.js
CHANGED
|
@@ -46,4 +46,15 @@ Object.keys(_cellSelection).forEach(function (key) {
|
|
|
46
46
|
return _cellSelection[key];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
+
});
|
|
50
|
+
var _promptControl = require("./promptControl");
|
|
51
|
+
Object.keys(_promptControl).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _promptControl[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _promptControl[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
49
60
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.gridDefaultPromptResolver = gridDefaultPromptResolver;
|
|
7
|
+
function gridDefaultPromptResolver(url, context, query) {
|
|
8
|
+
return fetch(url, {
|
|
9
|
+
mode: 'cors',
|
|
10
|
+
method: 'POST',
|
|
11
|
+
headers: {
|
|
12
|
+
'content-type': 'application/json'
|
|
13
|
+
},
|
|
14
|
+
credentials: 'include',
|
|
15
|
+
body: JSON.stringify({
|
|
16
|
+
context,
|
|
17
|
+
query
|
|
18
|
+
})
|
|
19
|
+
}).then(result => result.json()).then(result => {
|
|
20
|
+
if (result.ok === false) {
|
|
21
|
+
return Promise.reject(new Error(result.message));
|
|
22
|
+
}
|
|
23
|
+
if (result.data.error) {
|
|
24
|
+
return Promise.reject(new Error(result.data.error));
|
|
25
|
+
}
|
|
26
|
+
return result.data;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "unstable_gridDefaultPromptResolver", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _api.gridDefaultPromptResolver;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _api = require("./api");
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type Sort = {
|
|
2
|
+
column: string;
|
|
3
|
+
direction: 'asc' | 'desc';
|
|
4
|
+
};
|
|
5
|
+
export type Grouping = {
|
|
6
|
+
column: string;
|
|
7
|
+
};
|
|
8
|
+
export type Filter = {
|
|
9
|
+
operator: string;
|
|
10
|
+
value: string | number | boolean | string[] | number[];
|
|
11
|
+
column: string;
|
|
12
|
+
};
|
|
13
|
+
export type AggregationFunction = 'avg' | 'sum' | 'min' | 'max' | 'size';
|
|
14
|
+
export type Aggregation = {
|
|
15
|
+
[column: string]: AggregationFunction;
|
|
16
|
+
};
|
|
17
|
+
export type PromptResponse = {
|
|
18
|
+
select: number;
|
|
19
|
+
filters: Filter[];
|
|
20
|
+
filterOperator?: 'and' | 'or';
|
|
21
|
+
aggregation: Aggregation;
|
|
22
|
+
sorting: Sort[];
|
|
23
|
+
grouping: Grouping[];
|
|
24
|
+
error: string | null;
|
|
25
|
+
};
|
package/index.js
CHANGED
package/material/icons.d.ts
CHANGED
|
@@ -7,3 +7,9 @@ export declare const GridGroupWorkIcon: import("@mui/material/OverridableCompone
|
|
|
7
7
|
export declare const GridFunctionsIcon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
8
8
|
muiName: string;
|
|
9
9
|
};
|
|
10
|
+
export declare const GridSendPromptIcon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
11
|
+
muiName: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const GridRecordPromptIcon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
14
|
+
muiName: string;
|
|
15
|
+
};
|
package/material/icons.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.GridWorkspacesIcon = exports.GridGroupWorkIcon = exports.GridFunctionsIcon = void 0;
|
|
7
|
+
exports.GridWorkspacesIcon = exports.GridSendPromptIcon = exports.GridRecordPromptIcon = exports.GridGroupWorkIcon = exports.GridFunctionsIcon = void 0;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _utils = require("@mui/material/utils");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -18,4 +18,10 @@ const GridGroupWorkIcon = exports.GridGroupWorkIcon = (0, _utils.createSvgIcon)(
|
|
|
18
18
|
}), 'GroupWork');
|
|
19
19
|
const GridFunctionsIcon = exports.GridFunctionsIcon = (0, _utils.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
20
20
|
d: "M18 4H6v2l6.5 6L6 18v2h12v-3h-7l5-5-5-5h7z"
|
|
21
|
-
}), 'Functions');
|
|
21
|
+
}), 'Functions');
|
|
22
|
+
const GridSendPromptIcon = exports.GridSendPromptIcon = (0, _utils.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
23
|
+
d: "M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
24
|
+
}), 'SendPrompt');
|
|
25
|
+
const GridRecordPromptIcon = exports.GridRecordPromptIcon = (0, _utils.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
26
|
+
d: "M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3m5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72z"
|
|
27
|
+
}), 'RecordPrompt');
|
package/material/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ declare const materialSlots: {
|
|
|
2
2
|
columnMenuUngroupIcon: React.JSXElementConstructor<any>;
|
|
3
3
|
columnMenuGroupIcon: React.JSXElementConstructor<any>;
|
|
4
4
|
columnMenuAggregationIcon: React.JSXElementConstructor<any>;
|
|
5
|
+
toolbarPromptSendIcon: React.JSXElementConstructor<any>;
|
|
6
|
+
toolbarPromptRecordIcon: React.JSXElementConstructor<any>;
|
|
5
7
|
};
|
|
6
8
|
export default materialSlots;
|
package/material/index.js
CHANGED
|
@@ -10,7 +10,9 @@ var _icons = require("./icons");
|
|
|
10
10
|
const iconsSlots = {
|
|
11
11
|
columnMenuUngroupIcon: _icons.GridWorkspacesIcon,
|
|
12
12
|
columnMenuGroupIcon: _icons.GridGroupWorkIcon,
|
|
13
|
-
columnMenuAggregationIcon: _icons.GridFunctionsIcon
|
|
13
|
+
columnMenuAggregationIcon: _icons.GridFunctionsIcon,
|
|
14
|
+
toolbarPromptSendIcon: _icons.GridSendPromptIcon,
|
|
15
|
+
toolbarPromptRecordIcon: _icons.GridRecordPromptIcon
|
|
14
16
|
};
|
|
15
17
|
const materialSlots = (0, _extends2.default)({}, iconsSlots);
|
|
16
18
|
var _default = exports.default = materialSlots;
|
|
@@ -15,4 +15,14 @@ export interface GridPremiumIconSlotsComponent {
|
|
|
15
15
|
* @default GridFunctionsIcon
|
|
16
16
|
*/
|
|
17
17
|
columnMenuAggregationIcon: React.JSXElementConstructor<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Icon used for the button that sends a prompt
|
|
20
|
+
* @default GridFunctionsIcon
|
|
21
|
+
*/
|
|
22
|
+
toolbarPromptSendIcon: React.JSXElementConstructor<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Icon used for the button that starts/stops recording the prompt
|
|
25
|
+
* @default GridFunctionsIcon
|
|
26
|
+
*/
|
|
27
|
+
toolbarPromptRecordIcon: React.JSXElementConstructor<any>;
|
|
18
28
|
}
|
|
@@ -4,13 +4,11 @@ import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
7
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
8
7
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
9
8
|
import ListItemText from '@mui/material/ListItemText';
|
|
10
9
|
import FormControl from '@mui/material/FormControl';
|
|
11
10
|
import InputLabel from '@mui/material/InputLabel';
|
|
12
11
|
import { unstable_useId as useId } from '@mui/utils';
|
|
13
|
-
import Select from '@mui/material/Select';
|
|
14
12
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
15
13
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
16
14
|
import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../hooks/features/aggregation/gridAggregationUtils.js";
|
|
@@ -54,7 +52,7 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
54
52
|
apiRef.current.hideColumnMenu();
|
|
55
53
|
};
|
|
56
54
|
const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
|
|
57
|
-
return /*#__PURE__*/_jsxs(
|
|
55
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
58
56
|
disableRipple: true,
|
|
59
57
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
60
58
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
|
|
@@ -70,7 +68,7 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
70
68
|
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
71
69
|
id: `${id}-label`,
|
|
72
70
|
children: label
|
|
73
|
-
}), /*#__PURE__*/_jsxs(
|
|
71
|
+
}), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
|
|
74
72
|
labelId: `${id}-label`,
|
|
75
73
|
id: `${id}-input`,
|
|
76
74
|
value: selectedAggregationRule,
|
|
@@ -79,10 +77,10 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
79
77
|
onChange: handleAggregationItemChange,
|
|
80
78
|
onBlur: event => event.stopPropagation(),
|
|
81
79
|
fullWidth: true,
|
|
82
|
-
children: [/*#__PURE__*/_jsx(
|
|
80
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
83
81
|
value: "",
|
|
84
82
|
children: "..."
|
|
85
|
-
}), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(
|
|
83
|
+
}), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
86
84
|
value: aggFunc,
|
|
87
85
|
children: getAggregationFunctionLabel({
|
|
88
86
|
apiRef,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
3
2
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
4
3
|
import ListItemText from '@mui/material/ListItemText';
|
|
5
4
|
import { useGridSelector, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
|
|
@@ -24,7 +23,7 @@ export function GridColumnMenuRowGroupItem(props) {
|
|
|
24
23
|
};
|
|
25
24
|
const groupedColumn = columnsLookup[field];
|
|
26
25
|
const name = groupedColumn.headerName ?? field;
|
|
27
|
-
return /*#__PURE__*/_jsxs(
|
|
26
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
28
27
|
onClick: ungroupColumn,
|
|
29
28
|
disabled: !groupedColumn.groupable,
|
|
30
29
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
3
2
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
4
3
|
import ListItemText from '@mui/material/ListItemText';
|
|
5
4
|
import { gridColumnLookupSelector, useGridSelector } from '@mui/x-data-grid-pro';
|
|
@@ -29,7 +28,7 @@ export function GridColumnMenuRowUngroupItem(props) {
|
|
|
29
28
|
};
|
|
30
29
|
const name = columnsLookup[colDef.field].headerName ?? colDef.field;
|
|
31
30
|
if (rowGroupingModel.includes(colDef.field)) {
|
|
32
|
-
return /*#__PURE__*/_jsxs(
|
|
31
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
33
32
|
onClick: ungroupColumn,
|
|
34
33
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
35
34
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
|
|
@@ -40,7 +39,7 @@ export function GridColumnMenuRowUngroupItem(props) {
|
|
|
40
39
|
})]
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
return /*#__PURE__*/_jsxs(
|
|
42
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
44
43
|
onClick: groupColumn,
|
|
45
44
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
46
45
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
|
|
@@ -3,17 +3,18 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["hideMenu", "options"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
7
6
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
7
|
+
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
function GridExcelExportMenuItem(props) {
|
|
10
10
|
const apiRef = useGridApiContext();
|
|
11
|
+
const rootProps = useGridRootProps();
|
|
11
12
|
const {
|
|
12
13
|
hideMenu,
|
|
13
14
|
options
|
|
14
15
|
} = props,
|
|
15
16
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
|
-
return /*#__PURE__*/_jsx(
|
|
17
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
17
18
|
onClick: () => {
|
|
18
19
|
apiRef.current.exportDataAsExcel(options);
|
|
19
20
|
hideMenu?.();
|