@mui/x-codemod 6.0.0-alpha.13 → 6.0.0-alpha.15
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/README.md +116 -6
- package/package.json +4 -4
- package/util/renameProps.js +7 -8
- package/v6.0.0/component-rename-prop/index.js +3 -2
- package/v6.0.0/data-grid/column-menu-components-rename/index.js +49 -0
- package/v6.0.0/data-grid/preset-safe/index.js +12 -0
- package/v6.0.0/pickers/adapter-change-import/index.js +56 -0
- package/v6.0.0/{localization-provider-rename-locale → pickers/localization-provider-rename-locale}/index.js +4 -3
- package/v6.0.0/pickers/preset-safe/index.js +22 -0
- package/v6.0.0/{text-props-to-localeText → pickers/text-props-to-localeText}/index.js +0 -0
- package/v6.0.0/{view-components-rename → pickers/view-components-rename}/index.js +0 -0
- package/v6.0.0/pickers/view-components-rename-value-prop/index.js +22 -0
- package/v6.0.0/preset-safe/index.js +4 -8
package/README.md
CHANGED
|
@@ -62,20 +62,89 @@ npx @mui/x-codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":
|
|
|
62
62
|
|
|
63
63
|
#### 🚀 `preset-safe`
|
|
64
64
|
|
|
65
|
-
A combination of all important transformers for migrating v5 to v6. ⚠️ This codemod should be run only once.
|
|
65
|
+
A combination of all important transformers for migrating v5 to v6. ⚠️ This codemod should be run only once. It runs codemods for both Data Grid and Date and Time Pickers packages. To run codemods for a specific package, refer to the respective section.
|
|
66
66
|
|
|
67
67
|
```sh
|
|
68
68
|
npx @mui/x-codemod v6.0.0/preset-safe <path|folder>
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
The corresponding sub-sections are listed below
|
|
72
|
+
|
|
73
|
+
- [`preset-safe-for-pickers`](#preset-safe-for-pickers)
|
|
74
|
+
- [`preset-safe-for-data-grid`](#preset-safe-for-data-grid)
|
|
75
|
+
|
|
76
|
+
### Pickers codemods
|
|
77
|
+
|
|
78
|
+
#### `preset-safe` for pickers
|
|
79
|
+
|
|
80
|
+
The `preset-safe` codemods for pickers.
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npx @mui/x-codemod v6.0.0/pickers/preset-safe <path|folder>
|
|
84
|
+
```
|
|
85
|
+
|
|
71
86
|
The list includes these transformers
|
|
72
87
|
|
|
88
|
+
- [`adapter-change-import`](#adapter-change-import)
|
|
89
|
+
- [`view-components-rename`](#view-components-rename)
|
|
90
|
+
- [`view-components-rename-value-prop`](#view-components-rename)
|
|
73
91
|
- [`localization-provider-rename-locale`](#localization-provider-rename-locale)
|
|
74
92
|
- [`text-props-to-localeText`](#text-props-to-localeText)
|
|
75
93
|
|
|
94
|
+
#### `adapter-change-import`
|
|
95
|
+
|
|
96
|
+
Import the adapters from `@mui/x-date-pickers` instead of `@date-io`.
|
|
97
|
+
|
|
98
|
+
```diff
|
|
99
|
+
-import AdapterJalaali from '@date-io/jalaali';
|
|
100
|
+
+import { AdapterMomentJalaali } from '@mui/x-date-pickers/AdapterMomentJalaali';
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### `view-components-rename`
|
|
104
|
+
|
|
105
|
+
Renames the view components.
|
|
106
|
+
|
|
107
|
+
```diff
|
|
108
|
+
-<CalendarPicker {...props} />
|
|
109
|
+
+<DateCalendar {...props} />
|
|
110
|
+
|
|
111
|
+
-<DayPicker {...props} />
|
|
112
|
+
+<DayCalendar {...props} />
|
|
113
|
+
|
|
114
|
+
-<CalendarPickerSkeleton {...props} />
|
|
115
|
+
+<DayCalendarSkeleton {...props} />
|
|
116
|
+
|
|
117
|
+
-<MonthPicker {...props} />
|
|
118
|
+
+<MonthCalendar {...props} />
|
|
119
|
+
|
|
120
|
+
-<YearPicker {...props} />
|
|
121
|
+
+<YearCalendar {...props} />
|
|
122
|
+
|
|
123
|
+
-<ClockPicker {...props} />
|
|
124
|
+
+<TimeClock {...props} />
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### `view-components-rename-value-prop`
|
|
128
|
+
|
|
129
|
+
Renames the `date` prop of the view components into `value`.
|
|
130
|
+
|
|
131
|
+
```diff
|
|
132
|
+
-<MonthPicker date={dayjs()} />
|
|
133
|
+
+<MonthCalendar value={dayjs()} />
|
|
134
|
+
|
|
135
|
+
-<YearPicker date={dayjs()} />
|
|
136
|
+
+<YearCalendar value={dayjs()} />
|
|
137
|
+
|
|
138
|
+
-<ClockPicker date={dayjs()} />
|
|
139
|
+
+<TimeClock value={dayjs()} />
|
|
140
|
+
|
|
141
|
+
-<CalendarPicker date={dayjs()} />
|
|
142
|
+
+<DateCalendar value={dayjs()} />
|
|
143
|
+
```
|
|
144
|
+
|
|
76
145
|
#### `localization-provider-rename-locale`
|
|
77
146
|
|
|
78
|
-
Renames `locale`
|
|
147
|
+
Renames the `locale` prop of the `LocalizationProvider` component into `adapterLocale`.
|
|
79
148
|
|
|
80
149
|
```diff
|
|
81
150
|
<LocalizationProvider
|
|
@@ -89,12 +158,12 @@ Renames `locale` into `adapterLocale` (or `LocalizationProvider`)
|
|
|
89
158
|
```
|
|
90
159
|
|
|
91
160
|
```sh
|
|
92
|
-
npx @mui/x-codemod v6.0.0/localization-provider-rename-locale <path>
|
|
161
|
+
npx @mui/x-codemod v6.0.0/pickers/localization-provider-rename-locale <path>
|
|
93
162
|
```
|
|
94
163
|
|
|
95
164
|
#### `text-props-to-localeText`
|
|
96
165
|
|
|
97
|
-
Replace props used for localization such as `cancelText` to their corresponding `localeText` key.
|
|
166
|
+
Replace props used for localization such as `cancelText` to their corresponding `localeText` key on all the Date and Time Pickers components.
|
|
98
167
|
|
|
99
168
|
```diff
|
|
100
169
|
<DatePicker
|
|
@@ -106,7 +175,7 @@ Replace props used for localization such as `cancelText` to their corresponding
|
|
|
106
175
|
```
|
|
107
176
|
|
|
108
177
|
```sh
|
|
109
|
-
npx @mui/x-codemod v6.0.0/text-props-to-localeText <path>
|
|
178
|
+
npx @mui/x-codemod v6.0.0/pickers/text-props-to-localeText <path>
|
|
110
179
|
```
|
|
111
180
|
|
|
112
181
|
If you were always using the same text value in all your components, consider moving those translation from the component to the `LocalizationProvider` by hand.
|
|
@@ -125,4 +194,45 @@ If you were always using the same text value in all your components, consider mo
|
|
|
125
194
|
</LocalizationProvider>
|
|
126
195
|
```
|
|
127
196
|
|
|
128
|
-
You can find more details about
|
|
197
|
+
You can find more details about Date and Time breaking changes in [the migration guide](https://next.mui.com/x/migration/migration-pickers-v5/).
|
|
198
|
+
|
|
199
|
+
### Data grid codemods
|
|
200
|
+
|
|
201
|
+
#### `preset-safe` for data grid
|
|
202
|
+
|
|
203
|
+
The `preset-safe` codemods for data grid.
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
npx @mui/x-codemod v6.0.0/data-grid/preset-safe <path|folder>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The list includes these transformers
|
|
210
|
+
|
|
211
|
+
- [`column-menu-components-rename`](#column-menu-components-rename)
|
|
212
|
+
|
|
213
|
+
#### `column-menu-components-rename`
|
|
214
|
+
|
|
215
|
+
Replace column menu items that have been renamed.
|
|
216
|
+
|
|
217
|
+
```diff
|
|
218
|
+
<CustomColumnMenu>
|
|
219
|
+
- <GridFilterMenuItem column={column} onClick={hideMenu} />
|
|
220
|
+
+ <GridColumnMenuFilterItem colDef={column} onClick={hideMenu} />
|
|
221
|
+
- <HideGridColMenuItem column={column} onClick={hideMenu} />
|
|
222
|
+
+ <GridColumnMenuHideItem colDef={column} onClick={hideMenu} />
|
|
223
|
+
- <GridColumnsMenuItem column={column} onClick={hideMenu} />
|
|
224
|
+
+ <GridColumnMenuColumnsItem colDef={column} onClick={hideMenu} />
|
|
225
|
+
- <SortGridMenuItems column={column} onClick={hideMenu} />
|
|
226
|
+
+ <GridColumnMenuSortItem colDef={column} onClick={hideMenu} />
|
|
227
|
+
- <GridColumnPinningMenuItems column={column} onClick={hideMenu} />
|
|
228
|
+
+ <GridColumnMenuPinningItem colDef={column} onClick={hideMenu} />
|
|
229
|
+
</CustomColumnMenu>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
```sh
|
|
233
|
+
npx @mui/x-codemod v6.0.0/data-grid/column-menu-components-rename <path>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
If you are using `GridRowGroupingColumnMenuItems` and `GridRowGroupableColumnMenuItems` for grouping, consider fixing them manually as these imports are replaced by `GridColumnMenuGroupingItem` and may require some extra work to port.
|
|
237
|
+
|
|
238
|
+
You can find more details about Data Grid breaking change in [the migration guide](https://next.mui.com/x/migration/migration-data-grid-v5/).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-codemod",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.15",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"url": "https://opencollective.com/mui"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@babel/core": "^7.20.
|
|
35
|
-
"@babel/runtime": "^7.20.
|
|
36
|
-
"@babel/traverse": "^7.20.
|
|
34
|
+
"@babel/core": "^7.20.12",
|
|
35
|
+
"@babel/runtime": "^7.20.7",
|
|
36
|
+
"@babel/traverse": "^7.20.12",
|
|
37
37
|
"jscodeshift": "0.13.1",
|
|
38
38
|
"jscodeshift-add-imports": "^1.0.10",
|
|
39
39
|
"yargs": "^17.6.2"
|
package/util/renameProps.js
CHANGED
|
@@ -6,14 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = renameProps;
|
|
7
7
|
function renameProps({
|
|
8
8
|
root,
|
|
9
|
-
|
|
10
|
-
props
|
|
9
|
+
componentNames,
|
|
10
|
+
props,
|
|
11
|
+
j
|
|
11
12
|
}) {
|
|
12
|
-
return root.
|
|
13
|
-
path.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
});
|
|
13
|
+
return root.find(j.JSXElement).filter(path => {
|
|
14
|
+
return componentNames.includes(path.value.openingElement.name.name);
|
|
15
|
+
}).find(j.JSXAttribute).filter(attribute => Object.keys(props).includes(attribute.node.name.name)).forEach(attribute => {
|
|
16
|
+
j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(props[attribute.node.name.name]), attribute.node.value));
|
|
18
17
|
});
|
|
19
18
|
}
|
|
@@ -12,9 +12,10 @@ function transformer(file, api, options) {
|
|
|
12
12
|
const printOptions = options.printOptions;
|
|
13
13
|
return (0, _renameProps.default)({
|
|
14
14
|
root,
|
|
15
|
-
|
|
15
|
+
componentNames: [options.component],
|
|
16
16
|
props: {
|
|
17
17
|
[options.from]: options.to
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
j
|
|
19
20
|
}).toSource(printOptions);
|
|
20
21
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
|
|
9
|
+
const VARIABLES = {
|
|
10
|
+
GridFilterMenuItem: 'GridColumnMenuFilterItem',
|
|
11
|
+
HideGridColMenuItem: 'GridColumnMenuHideItem',
|
|
12
|
+
GridColumnsMenuItem: 'GridColumnMenuColumnsItem',
|
|
13
|
+
SortGridMenuItems: 'GridColumnMenuSortItem',
|
|
14
|
+
GridColumnPinningMenuItems: 'GridColumnMenuPinningItem',
|
|
15
|
+
GridAggregationColumnMenuItem: 'GridColumnMenuAggregationItem'
|
|
16
|
+
};
|
|
17
|
+
const PACKAGE_REGEXP = /@mui\/x-data-grid(-pro|-premium)(\/(.*)|)/;
|
|
18
|
+
const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
|
|
19
|
+
function transformer(file, api, options) {
|
|
20
|
+
const j = api.jscodeshift;
|
|
21
|
+
const root = j(file.source);
|
|
22
|
+
const printOptions = options.printOptions || {
|
|
23
|
+
quote: 'single',
|
|
24
|
+
trailingComma: true
|
|
25
|
+
};
|
|
26
|
+
const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
|
|
27
|
+
|
|
28
|
+
// Rename the import specifiers
|
|
29
|
+
// - import { GridFilterMenuItem } from '@mui/x-data-grid'
|
|
30
|
+
// + import { GridColumnMenuFilterItem } from '@mui/x-data-grid'
|
|
31
|
+
matchingImports.find(j.ImportSpecifier).filter(path => !!VARIABLES[path.node.imported.name]).replaceWith(path => j.importSpecifier(j.identifier(VARIABLES[path.node.imported.name])));
|
|
32
|
+
|
|
33
|
+
// Rename the import usage
|
|
34
|
+
// - <GridFilterMenuItem />
|
|
35
|
+
// + <GridColumnMenuFilterItem />
|
|
36
|
+
root.find(j.Identifier).filter(path => !!VARIABLES[path.node.name]).replaceWith(path => j.identifier(VARIABLES[path.node.name]));
|
|
37
|
+
|
|
38
|
+
// Rename `column` prop to `colDef`
|
|
39
|
+
// - <GridFilterMenuItem column={col} onClick={onClick} />
|
|
40
|
+
// + <GridFilterMenuItem colDef={col} onClick={onClick} />
|
|
41
|
+
return (0, _renameProps.default)({
|
|
42
|
+
root,
|
|
43
|
+
componentNames: Object.values(VARIABLES),
|
|
44
|
+
props: {
|
|
45
|
+
column: 'colDef'
|
|
46
|
+
},
|
|
47
|
+
j
|
|
48
|
+
}).toSource(printOptions);
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _columnMenuComponentsRename = _interopRequireDefault(require("../column-menu-components-rename"));
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
file.source = (0, _columnMenuComponentsRename.default)(file, api, options);
|
|
11
|
+
return file.source;
|
|
12
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
const adapters = {
|
|
8
|
+
'date-fns': 'AdapterDateFns',
|
|
9
|
+
'date-fns-jalali': 'AdapterDateFnsJalali',
|
|
10
|
+
dayjs: 'AdapterDayjs',
|
|
11
|
+
luxon: 'AdapterLuxon',
|
|
12
|
+
moment: 'AdapterMoment',
|
|
13
|
+
hijri: 'AdapterMomentHijri',
|
|
14
|
+
jalaali: 'AdapterMomentJalaali'
|
|
15
|
+
};
|
|
16
|
+
const getDateIoSubPackage = path => (path.node.source.value?.toString() ?? '').match(/@date-io\/(.*)/)?.[1];
|
|
17
|
+
function transformer(file, api, options) {
|
|
18
|
+
const j = api.jscodeshift;
|
|
19
|
+
const root = j(file.source);
|
|
20
|
+
const printOptions = options.printOptions || {
|
|
21
|
+
quote: 'single',
|
|
22
|
+
trailingComma: true
|
|
23
|
+
};
|
|
24
|
+
const matchingImports = root.find(j.ImportDeclaration).filter(path => {
|
|
25
|
+
const subPackage = getDateIoSubPackage(path);
|
|
26
|
+
return !!subPackage && !!adapters[subPackage];
|
|
27
|
+
});
|
|
28
|
+
const adapterVariableNames = {};
|
|
29
|
+
|
|
30
|
+
// Replace the default import specifier by an import specifiers
|
|
31
|
+
// - import WhateverDateFns from '@mui/x-date-pickers/MonthPicker'
|
|
32
|
+
// + import { AdapterDateFns } from '@mui/x-date-pickers/MonthPicker'
|
|
33
|
+
matchingImports.find(j.ImportDefaultSpecifier).replaceWith(path => {
|
|
34
|
+
const subPackage = getDateIoSubPackage(path.parentPath.parentPath);
|
|
35
|
+
const adapterVariableName = path.value.local?.name ?? '';
|
|
36
|
+
adapterVariableNames[adapterVariableName] = adapters[subPackage];
|
|
37
|
+
return j.importSpecifier(j.identifier(adapters[subPackage]));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Rename the import declarations
|
|
41
|
+
// - import {} from '@date-io/date-fns'
|
|
42
|
+
// + import {} from '@mui/x-date-pickers/AdapterDateFns'
|
|
43
|
+
matchingImports.replaceWith(path => {
|
|
44
|
+
const subPackage = getDateIoSubPackage(path);
|
|
45
|
+
return j.importDeclaration(path.node.specifiers,
|
|
46
|
+
// copy over the existing import specifiers
|
|
47
|
+
j.stringLiteral(`@mui/x-date-pickers/${adapters[subPackage]}`) // Replace the source with our new source
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Rename the import usage
|
|
52
|
+
// - <LocalizationProvider dateAdapter={WhateverDateFns} />
|
|
53
|
+
// + <LocalizationProvider dateAdapter={AdapterDateFns} />
|
|
54
|
+
root.find(j.Identifier).filter(path => !!adapterVariableNames[path.node.name]).replaceWith(path => j.identifier(adapterVariableNames[path.node.name]));
|
|
55
|
+
return root.toSource(printOptions);
|
|
56
|
+
}
|
|
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
|
-
var _renameProps = _interopRequireDefault(require("
|
|
8
|
+
var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
|
|
9
9
|
function transformer(file, api, options) {
|
|
10
10
|
const j = api.jscodeshift;
|
|
11
11
|
const root = j(file.source);
|
|
12
12
|
const printOptions = options.printOptions;
|
|
13
13
|
return (0, _renameProps.default)({
|
|
14
14
|
root,
|
|
15
|
-
|
|
15
|
+
componentNames: ['LocalizationProvider'],
|
|
16
16
|
props: {
|
|
17
17
|
locale: 'adapterLocale'
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
j
|
|
19
20
|
}).toSource(printOptions);
|
|
20
21
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _localizationProviderRenameLocale = _interopRequireDefault(require("../localization-provider-rename-locale"));
|
|
9
|
+
var _textPropsToLocaleText = _interopRequireDefault(require("../text-props-to-localeText"));
|
|
10
|
+
var _viewComponentsRename = _interopRequireDefault(require("../view-components-rename"));
|
|
11
|
+
var _viewComponentsRenameValueProp = _interopRequireDefault(require("../view-components-rename-value-prop"));
|
|
12
|
+
var _adapterChangeImport = _interopRequireDefault(require("../adapter-change-import"));
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
file.source = (0, _localizationProviderRenameLocale.default)(file, api, options);
|
|
15
|
+
|
|
16
|
+
// All the codemods impacting the view components should be run before renaming these components
|
|
17
|
+
file.source = (0, _textPropsToLocaleText.default)(file, api, options);
|
|
18
|
+
file.source = (0, _viewComponentsRenameValueProp.default)(file, api, options);
|
|
19
|
+
file.source = (0, _viewComponentsRename.default)(file, api, options);
|
|
20
|
+
file.source = (0, _adapterChangeImport.default)(file, api, options);
|
|
21
|
+
return file.source;
|
|
22
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
|
|
9
|
+
function transformer(file, api, options) {
|
|
10
|
+
const j = api.jscodeshift;
|
|
11
|
+
const root = j(file.source);
|
|
12
|
+
const printOptions = options.printOptions;
|
|
13
|
+
const result = (0, _renameProps.default)({
|
|
14
|
+
root,
|
|
15
|
+
componentNames: ['MonthPicker', 'YearPicker', 'CalendarPicker', 'ClockPicker'],
|
|
16
|
+
props: {
|
|
17
|
+
date: 'value'
|
|
18
|
+
},
|
|
19
|
+
j
|
|
20
|
+
});
|
|
21
|
+
return result.toSource(printOptions);
|
|
22
|
+
}
|
|
@@ -5,14 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = transformer;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var _viewComponentsRename = _interopRequireDefault(require("../view-components-rename"));
|
|
8
|
+
var _presetSafe = _interopRequireDefault(require("../pickers/preset-safe"));
|
|
9
|
+
var _presetSafe2 = _interopRequireDefault(require("../data-grid/preset-safe"));
|
|
11
10
|
function transformer(file, api, options) {
|
|
12
|
-
file.source = (0,
|
|
13
|
-
|
|
14
|
-
// Should be run before the renaming of components such as `ClockPicker` to `TimeClock`.
|
|
15
|
-
file.source = (0, _textPropsToLocaleText.default)(file, api, options);
|
|
16
|
-
file.source = (0, _viewComponentsRename.default)(file, api, options);
|
|
11
|
+
file.source = (0, _presetSafe.default)(file, api, options);
|
|
12
|
+
file.source = (0, _presetSafe2.default)(file, api, options);
|
|
17
13
|
return file.source;
|
|
18
14
|
}
|