@progress/kendo-angular-layout 19.0.0-develop.26 → 19.0.0-develop.28
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/codemods/utils.js
CHANGED
@@ -3,13 +3,305 @@
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
5
5
|
"use strict";
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
8
|
+
};
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
-
exports.tsPropertyRemoval = exports.
|
8
|
-
const node_html_parser_1 = require("node-html-parser");
|
10
|
+
exports.tsComponentPropertyRemoval = exports.tsPropertyRemoval = exports.templateAttributeRemoval = exports.htmlAttributeRemoval = exports.htmlAttributeValueTransformer = exports.tsPropertyValueTransformer = exports.templateAttributeValueTransformer = exports.htmlAttributeTransformer = exports.htmlBoundAttributeTransformer = exports.htmlStaticAttributeTransformer = exports.tsPropertyTransformer = exports.templateAttributeTransformer = exports.templateBoundAttributeTransformer = exports.templateStaticAttributeTransformer = void 0;
|
11
|
+
const node_html_parser_1 = __importDefault(require("node-html-parser"));
|
12
|
+
const templateStaticAttributeTransformer = (root, tagName, attributeName, newAttributeName) => {
|
13
|
+
const elements = Array.from(root.getElementsByTagName(tagName)) || [];
|
14
|
+
for (const element of elements) {
|
15
|
+
// Handle static attributes like title="foo"
|
16
|
+
const staticAttr = element.getAttribute(attributeName);
|
17
|
+
if (staticAttr) {
|
18
|
+
element.setAttribute(newAttributeName, staticAttr);
|
19
|
+
element.removeAttribute(attributeName);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
};
|
23
|
+
exports.templateStaticAttributeTransformer = templateStaticAttributeTransformer;
|
24
|
+
const templateBoundAttributeTransformer = (root, tagName, attributeName, newAttributeName) => {
|
25
|
+
const elements = Array.from(root.getElementsByTagName(tagName)) || [];
|
26
|
+
for (const element of elements) {
|
27
|
+
// Handle bound attributes like [title]="foo" or [title]="'foo'"
|
28
|
+
const boundAttr = element.getAttribute(`[${attributeName}]`);
|
29
|
+
if (boundAttr) {
|
30
|
+
element.setAttribute(`[${newAttributeName}]`, boundAttr);
|
31
|
+
element.removeAttribute(`[${attributeName}]`);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
};
|
35
|
+
exports.templateBoundAttributeTransformer = templateBoundAttributeTransformer;
|
36
|
+
const templateAttributeTransformer = (root, tagName, attributeName, newAttributeName) => {
|
37
|
+
(0, exports.templateBoundAttributeTransformer)(root, tagName, attributeName, newAttributeName);
|
38
|
+
(0, exports.templateStaticAttributeTransformer)(root, tagName, attributeName, newAttributeName);
|
39
|
+
};
|
40
|
+
exports.templateAttributeTransformer = templateAttributeTransformer;
|
41
|
+
const tsPropertyTransformer = (root, j, componentType, propertyName, newPropertyName) => {
|
42
|
+
// Find all class properties that are of type DropDownListComponent
|
43
|
+
const properties = new Set();
|
44
|
+
// Find properties with type annotations
|
45
|
+
root
|
46
|
+
.find(j.ClassProperty, {
|
47
|
+
typeAnnotation: {
|
48
|
+
typeAnnotation: {
|
49
|
+
typeName: {
|
50
|
+
name: componentType
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
})
|
55
|
+
.forEach(path => {
|
56
|
+
if (path.node.key.type === 'Identifier') {
|
57
|
+
properties.add(path.node.key.name);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
// Find function parameters of type componentType
|
61
|
+
const parameters = new Set();
|
62
|
+
root
|
63
|
+
.find(j.FunctionDeclaration)
|
64
|
+
.forEach(path => {
|
65
|
+
if (path.node.params) {
|
66
|
+
path.node.params.forEach(param => {
|
67
|
+
if (param.type === 'Identifier' &&
|
68
|
+
param.typeAnnotation &&
|
69
|
+
param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
|
70
|
+
param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
71
|
+
param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
|
72
|
+
parameters.add(param.name);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
});
|
77
|
+
// Also check method declarations in classes
|
78
|
+
root
|
79
|
+
.find(j.ClassMethod)
|
80
|
+
.forEach(path => {
|
81
|
+
if (path.node.params) {
|
82
|
+
path.node.params.forEach(param => {
|
83
|
+
if (param.type === 'Identifier' &&
|
84
|
+
param.typeAnnotation &&
|
85
|
+
param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
|
86
|
+
param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
87
|
+
param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
|
88
|
+
parameters.add(param.name);
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
});
|
93
|
+
// Find all member expressions where title property is accessed on any componentType instance
|
94
|
+
root
|
95
|
+
.find(j.MemberExpression, {
|
96
|
+
property: {
|
97
|
+
type: 'Identifier',
|
98
|
+
name: propertyName
|
99
|
+
}
|
100
|
+
})
|
101
|
+
.filter(path => {
|
102
|
+
// Filter to only include accesses on properties that are componentType instances
|
103
|
+
if (path.node.object.type === 'MemberExpression' &&
|
104
|
+
path.node.object.property.type === 'Identifier') {
|
105
|
+
// handle properties of this
|
106
|
+
if (path.node.object.object.type === 'ThisExpression' &&
|
107
|
+
properties.has(path.node.object.property.name)) {
|
108
|
+
return true;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
// Handle function parameters
|
112
|
+
if (path.node.object.type === 'Identifier' &&
|
113
|
+
parameters.has(path.node.object.name)) {
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
})
|
118
|
+
.forEach(path => {
|
119
|
+
// Replace old property name with new property name
|
120
|
+
if (path.node.property.type === 'Identifier') {
|
121
|
+
path.node.property.name = newPropertyName;
|
122
|
+
}
|
123
|
+
});
|
124
|
+
};
|
125
|
+
exports.tsPropertyTransformer = tsPropertyTransformer;
|
126
|
+
const htmlStaticAttributeTransformer = (fileInfo, tagName, oldName, newName) => {
|
127
|
+
const fileContent = fileInfo.source;
|
128
|
+
const root = (0, node_html_parser_1.default)(fileContent);
|
129
|
+
let modified = false;
|
130
|
+
const elements = Array.from(root.querySelectorAll(tagName));
|
131
|
+
for (const element of elements) {
|
132
|
+
const staticAttr = element.getAttribute(oldName);
|
133
|
+
if (staticAttr) {
|
134
|
+
element.removeAttribute(oldName);
|
135
|
+
element.setAttribute(newName, staticAttr);
|
136
|
+
modified = true;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
if (modified) {
|
140
|
+
return root.toString();
|
141
|
+
}
|
142
|
+
return fileContent;
|
143
|
+
};
|
144
|
+
exports.htmlStaticAttributeTransformer = htmlStaticAttributeTransformer;
|
145
|
+
const htmlBoundAttributeTransformer = (fileInfo, tagName, oldName, newName) => {
|
146
|
+
const fileContent = fileInfo.source;
|
147
|
+
const root = (0, node_html_parser_1.default)(fileContent);
|
148
|
+
let modified = false;
|
149
|
+
const elements = Array.from(root.querySelectorAll(tagName));
|
150
|
+
for (const element of elements) {
|
151
|
+
const boundAttr = element.getAttribute(`[${oldName}]`);
|
152
|
+
if (boundAttr) {
|
153
|
+
element.removeAttribute(`[${oldName}]`);
|
154
|
+
element.setAttribute(`[${newName}]`, boundAttr);
|
155
|
+
modified = true;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (modified) {
|
159
|
+
return root.toString();
|
160
|
+
}
|
161
|
+
return fileContent;
|
162
|
+
};
|
163
|
+
exports.htmlBoundAttributeTransformer = htmlBoundAttributeTransformer;
|
164
|
+
const htmlAttributeTransformer = (fileInfo, tagName, oldName, newName) => {
|
165
|
+
let content = (0, exports.htmlBoundAttributeTransformer)(fileInfo, tagName, oldName, newName);
|
166
|
+
content = (0, exports.htmlStaticAttributeTransformer)({ path: fileInfo.path, source: content }, tagName, oldName, newName);
|
167
|
+
return content;
|
168
|
+
};
|
169
|
+
exports.htmlAttributeTransformer = htmlAttributeTransformer;
|
170
|
+
const templateAttributeValueTransformer = (root, tagName, attributeName, oldAttributeValue, newAttributeValue) => {
|
171
|
+
const elements = Array.from(root.getElementsByTagName(tagName)) || [];
|
172
|
+
for (const element of elements) {
|
173
|
+
// Handle bound attributes (e.g., [showText]="'overflow'")
|
174
|
+
const boundAttr = element.getAttribute(`[${attributeName}]`);
|
175
|
+
if (boundAttr === `'${oldAttributeValue}'`) {
|
176
|
+
// For bound literals like [showText]="'overflow'" or [showText]="\"overflow\""
|
177
|
+
element.setAttribute(`[${attributeName}]`, boundAttr.replace(oldAttributeValue, newAttributeValue));
|
178
|
+
}
|
179
|
+
// Handle static attributes like title="foo"
|
180
|
+
const staticAttrValue = element.getAttribute(attributeName);
|
181
|
+
if (staticAttrValue === oldAttributeValue) {
|
182
|
+
element.setAttribute(attributeName, newAttributeValue);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
};
|
186
|
+
exports.templateAttributeValueTransformer = templateAttributeValueTransformer;
|
187
|
+
const tsPropertyValueTransformer = (root, j, typeName, oldValue, newValue) => {
|
188
|
+
// 1. Find all class properties with the specified type
|
189
|
+
root
|
190
|
+
.find(j.ClassProperty)
|
191
|
+
.filter(path => {
|
192
|
+
// Check if the property has a type annotation matching the specified type
|
193
|
+
if (path.node.typeAnnotation?.typeAnnotation &&
|
194
|
+
path.node.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
|
195
|
+
path.node.typeAnnotation.typeAnnotation.typeName &&
|
196
|
+
path.node.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
197
|
+
path.node.typeAnnotation.typeAnnotation.typeName.name === typeName) {
|
198
|
+
return true;
|
199
|
+
}
|
200
|
+
return false;
|
201
|
+
})
|
202
|
+
.forEach(path => {
|
203
|
+
// Update the value if it matches the old value
|
204
|
+
if (path.node.value &&
|
205
|
+
path.node.value.type === 'StringLiteral' &&
|
206
|
+
path.node.value.value === oldValue) {
|
207
|
+
path.node.value.value = newValue;
|
208
|
+
}
|
209
|
+
});
|
210
|
+
// 2. Find all assignments to variables of the specified type
|
211
|
+
const variablesOfType = new Set();
|
212
|
+
// First, collect all variables with the specified type
|
213
|
+
root
|
214
|
+
.find(j.VariableDeclarator)
|
215
|
+
.filter(path => {
|
216
|
+
if (path.node.id.type === 'Identifier' &&
|
217
|
+
path.node.id.typeAnnotation?.typeAnnotation &&
|
218
|
+
path.node.id.typeAnnotation.typeAnnotation.type === 'TSTypeReference' &&
|
219
|
+
path.node.id.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
220
|
+
path.node.id.typeAnnotation.typeAnnotation.typeName.name === typeName) {
|
221
|
+
return true;
|
222
|
+
}
|
223
|
+
return false;
|
224
|
+
})
|
225
|
+
.forEach(path => {
|
226
|
+
if (path.node.id.type === 'Identifier') {
|
227
|
+
variablesOfType.add(path.node.id.name);
|
228
|
+
// Also update the initial value if it matches
|
229
|
+
if (path.node.init &&
|
230
|
+
path.node.init.type === 'StringLiteral' &&
|
231
|
+
path.node.init.value === oldValue) {
|
232
|
+
path.node.init.value = newValue;
|
233
|
+
}
|
234
|
+
}
|
235
|
+
});
|
236
|
+
// 3. Update literals in assignment expressions
|
237
|
+
root
|
238
|
+
.find(j.AssignmentExpression)
|
239
|
+
.filter(path => {
|
240
|
+
// Only process string literals with the old value
|
241
|
+
return path.node.right.type === 'StringLiteral' &&
|
242
|
+
path.node.right.value === oldValue;
|
243
|
+
})
|
244
|
+
.forEach(path => {
|
245
|
+
// Update the value
|
246
|
+
path.node.right.value = newValue;
|
247
|
+
});
|
248
|
+
// 4. Also look for string literals in attributes within JSX elements
|
249
|
+
root
|
250
|
+
.find(j.JSXAttribute, {
|
251
|
+
value: {
|
252
|
+
type: 'StringLiteral',
|
253
|
+
value: oldValue
|
254
|
+
}
|
255
|
+
})
|
256
|
+
.forEach(path => {
|
257
|
+
if (path.node.value?.type === 'StringLiteral') {
|
258
|
+
path.node.value.value = newValue;
|
259
|
+
}
|
260
|
+
});
|
261
|
+
};
|
262
|
+
exports.tsPropertyValueTransformer = tsPropertyValueTransformer;
|
263
|
+
const htmlAttributeValueTransformer = (fileInfo, tagName, attributeName, oldValue, newValue) => {
|
264
|
+
// Read file content from fileInfo
|
265
|
+
const fileContent = fileInfo.source;
|
266
|
+
// Parse the HTML content
|
267
|
+
const root = (0, node_html_parser_1.default)(fileContent);
|
268
|
+
// Find all elements matching the tagName
|
269
|
+
const elements = root.querySelectorAll(tagName);
|
270
|
+
let modified = false;
|
271
|
+
// Process each element
|
272
|
+
for (const element of elements) {
|
273
|
+
// Handle static attributes (e.g., showText="overflow")
|
274
|
+
const staticAttr = element.getAttribute(attributeName);
|
275
|
+
if (staticAttr === oldValue) {
|
276
|
+
element.setAttribute(attributeName, newValue);
|
277
|
+
modified = true;
|
278
|
+
console.log(`Modified static attribute ${attributeName} from "${oldValue}" to "${newValue}" in element:`, element.toString().substring(0, 100));
|
279
|
+
}
|
280
|
+
// Handle bound attributes (e.g., [showText]="overflow")
|
281
|
+
const boundAttr = element.getAttribute(`[${attributeName}]`);
|
282
|
+
if (boundAttr) {
|
283
|
+
// For bound literals like [showText]="'overflow'" or [showText]="\"overflow\""
|
284
|
+
if (boundAttr === `'${oldValue}'` || boundAttr === `"${oldValue}"`) {
|
285
|
+
const updatedValue = boundAttr.replace(oldValue, newValue);
|
286
|
+
element.setAttribute(`[${attributeName}]`, updatedValue);
|
287
|
+
modified = true;
|
288
|
+
console.log(`Modified bound attribute [${attributeName}] from "${boundAttr}" to "${updatedValue}" in element:`, element.toString().substring(0, 100));
|
289
|
+
}
|
290
|
+
}
|
291
|
+
}
|
292
|
+
// Return modified content if changes were made
|
293
|
+
if (modified) {
|
294
|
+
const updatedContent = root.toString();
|
295
|
+
return updatedContent;
|
296
|
+
}
|
297
|
+
// Return original content if no changes were made or if there was an error
|
298
|
+
return fileContent;
|
299
|
+
};
|
300
|
+
exports.htmlAttributeValueTransformer = htmlAttributeValueTransformer;
|
9
301
|
const htmlAttributeRemoval = (fileInfo, tagName, attributeName, propertyToRemove) => {
|
10
302
|
const filePath = fileInfo.path;
|
11
303
|
const fileContent = fileInfo.source;
|
12
|
-
const root = (0, node_html_parser_1.
|
304
|
+
const root = (0, node_html_parser_1.default)(fileContent);
|
13
305
|
// Use the same logic as templateAttributeRemoval
|
14
306
|
const elements = root.querySelectorAll(tagName);
|
15
307
|
for (const element of elements) {
|
@@ -90,109 +382,67 @@ const templateAttributeRemoval = (root, tagName, attributeName, propertyToRemove
|
|
90
382
|
}
|
91
383
|
};
|
92
384
|
exports.templateAttributeRemoval = templateAttributeRemoval;
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
if (staticAttr) {
|
105
|
-
element.setAttribute(newAttributeName, staticAttr);
|
106
|
-
element.removeAttribute(attributeName);
|
107
|
-
}
|
108
|
-
}
|
109
|
-
};
|
110
|
-
exports.templateAttributeTransformer = templateAttributeTransformer;
|
111
|
-
const tsPropertyTransformer = (root, j, componentType, propertyName, newPropertyName) => {
|
112
|
-
// Find all class properties that are of type DropDownListComponent
|
113
|
-
const properties = new Set();
|
114
|
-
// Find properties with type annotations
|
115
|
-
root
|
385
|
+
/**
|
386
|
+
* Removes a property from object literals of a specified type
|
387
|
+
*
|
388
|
+
* @param root - The AST root
|
389
|
+
* @param j - The JSCodeshift instance
|
390
|
+
* @param typeName - The type to target (e.g., 'TabStripScrollableSettings')
|
391
|
+
* @param propertyToRemove - The property to remove (e.g., 'mouseScrollSpeed')
|
392
|
+
*/
|
393
|
+
function tsPropertyRemoval(rootSource, j, typeName, propertyName) {
|
394
|
+
// Find class properties that have the specified type
|
395
|
+
rootSource
|
116
396
|
.find(j.ClassProperty, {
|
117
397
|
typeAnnotation: {
|
118
398
|
typeAnnotation: {
|
119
399
|
typeName: {
|
120
|
-
name:
|
400
|
+
name: typeName
|
121
401
|
}
|
122
402
|
}
|
123
403
|
}
|
124
404
|
})
|
125
405
|
.forEach(path => {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
if (
|
138
|
-
|
139
|
-
param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
|
140
|
-
param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
141
|
-
param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
|
142
|
-
parameters.add(param.name);
|
406
|
+
// Check if there's an object literal initializer
|
407
|
+
if (path.node.value && path.node.value.type === 'ObjectExpression') {
|
408
|
+
const properties = path.node.value.properties;
|
409
|
+
// Find the property we want to remove - safely handle different property types
|
410
|
+
const propIndex = properties.findIndex((p) => p.type === 'ObjectProperty' &&
|
411
|
+
p.key &&
|
412
|
+
p.key.type === 'Identifier' &&
|
413
|
+
p.key.name === propertyName);
|
414
|
+
if (propIndex !== -1) {
|
415
|
+
// If property exists, remove it
|
416
|
+
// Case 1: If it's the only property, remove the entire class property
|
417
|
+
if (properties.length === 1) {
|
418
|
+
j(path).remove();
|
143
419
|
}
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
// Also check method declarations in classes
|
148
|
-
root
|
149
|
-
.find(j.ClassMethod)
|
150
|
-
.forEach(path => {
|
151
|
-
if (path.node.params) {
|
152
|
-
path.node.params.forEach(param => {
|
153
|
-
if (param.type === 'Identifier' &&
|
154
|
-
param.typeAnnotation &&
|
155
|
-
param.typeAnnotation.typeAnnotation?.type === 'TSTypeReference' &&
|
156
|
-
param.typeAnnotation.typeAnnotation.typeName.type === 'Identifier' &&
|
157
|
-
param.typeAnnotation.typeAnnotation.typeName.name === componentType) {
|
158
|
-
parameters.add(param.name);
|
420
|
+
// Case 2: If there are other properties, just remove this one property
|
421
|
+
else {
|
422
|
+
properties.splice(propIndex, 1);
|
159
423
|
}
|
160
|
-
}
|
424
|
+
}
|
161
425
|
}
|
162
426
|
});
|
163
|
-
//
|
164
|
-
|
165
|
-
.find(j.
|
166
|
-
|
167
|
-
type: '
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
if (path.node.object.type === 'MemberExpression' &&
|
174
|
-
path.node.object.property.type === 'Identifier') {
|
175
|
-
// handle properties of this
|
176
|
-
if (path.node.object.object.type === 'ThisExpression' &&
|
177
|
-
properties.has(path.node.object.property.name)) {
|
178
|
-
return true;
|
427
|
+
// Also handle property assignments (e.g., in methods like ngOnInit)
|
428
|
+
rootSource
|
429
|
+
.find(j.AssignmentExpression, {
|
430
|
+
left: {
|
431
|
+
type: 'MemberExpression',
|
432
|
+
object: {
|
433
|
+
type: 'MemberExpression'
|
434
|
+
},
|
435
|
+
property: {
|
436
|
+
name: propertyName
|
179
437
|
}
|
180
438
|
}
|
181
|
-
// Handle function parameters
|
182
|
-
if (path.node.object.type === 'Identifier' &&
|
183
|
-
parameters.has(path.node.object.name)) {
|
184
|
-
return true;
|
185
|
-
}
|
186
|
-
return false;
|
187
439
|
})
|
188
440
|
.forEach(path => {
|
189
|
-
|
190
|
-
if (path.node.property.type === 'Identifier') {
|
191
|
-
path.node.property.name = newPropertyName;
|
192
|
-
}
|
441
|
+
j(path).remove();
|
193
442
|
});
|
194
|
-
|
195
|
-
|
443
|
+
return rootSource;
|
444
|
+
}
|
445
|
+
exports.tsPropertyRemoval = tsPropertyRemoval;
|
196
446
|
/**
|
197
447
|
* Removes assignments to a specific nested property of a component
|
198
448
|
*
|
@@ -301,64 +551,3 @@ function isComponentTypeMatch(root, j, node, componentType) {
|
|
301
551
|
}
|
302
552
|
return false;
|
303
553
|
}
|
304
|
-
/**
|
305
|
-
* Removes a property from object literals of a specified type
|
306
|
-
*
|
307
|
-
* @param root - The AST root
|
308
|
-
* @param j - The JSCodeshift instance
|
309
|
-
* @param typeName - The type to target (e.g., 'TabStripScrollableSettings')
|
310
|
-
* @param propertyToRemove - The property to remove (e.g., 'mouseScrollSpeed')
|
311
|
-
*/
|
312
|
-
function tsPropertyRemoval(rootSource, j, typeName, propertyName) {
|
313
|
-
// Find class properties that have the specified type
|
314
|
-
rootSource
|
315
|
-
.find(j.ClassProperty, {
|
316
|
-
typeAnnotation: {
|
317
|
-
typeAnnotation: {
|
318
|
-
typeName: {
|
319
|
-
name: typeName
|
320
|
-
}
|
321
|
-
}
|
322
|
-
}
|
323
|
-
})
|
324
|
-
.forEach(path => {
|
325
|
-
// Check if there's an object literal initializer
|
326
|
-
if (path.node.value && path.node.value.type === 'ObjectExpression') {
|
327
|
-
const properties = path.node.value.properties;
|
328
|
-
// Find the property we want to remove - safely handle different property types
|
329
|
-
const propIndex = properties.findIndex((p) => p.type === 'ObjectProperty' &&
|
330
|
-
p.key &&
|
331
|
-
p.key.type === 'Identifier' &&
|
332
|
-
p.key.name === propertyName);
|
333
|
-
if (propIndex !== -1) {
|
334
|
-
// If property exists, remove it
|
335
|
-
// Case 1: If it's the only property, remove the entire class property
|
336
|
-
if (properties.length === 1) {
|
337
|
-
j(path).remove();
|
338
|
-
}
|
339
|
-
// Case 2: If there are other properties, just remove this one property
|
340
|
-
else {
|
341
|
-
properties.splice(propIndex, 1);
|
342
|
-
}
|
343
|
-
}
|
344
|
-
}
|
345
|
-
});
|
346
|
-
// Also handle property assignments (e.g., in methods like ngOnInit)
|
347
|
-
rootSource
|
348
|
-
.find(j.AssignmentExpression, {
|
349
|
-
left: {
|
350
|
-
type: 'MemberExpression',
|
351
|
-
object: {
|
352
|
-
type: 'MemberExpression'
|
353
|
-
},
|
354
|
-
property: {
|
355
|
-
name: propertyName
|
356
|
-
}
|
357
|
-
}
|
358
|
-
})
|
359
|
-
.forEach(path => {
|
360
|
-
j(path).remove();
|
361
|
-
});
|
362
|
-
return rootSource;
|
363
|
-
}
|
364
|
-
exports.tsPropertyRemoval = tsPropertyRemoval;
|
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
27
27
|
return result;
|
28
28
|
};
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
30
|
-
const
|
30
|
+
const index_1 = require("../template-transformer/index");
|
31
31
|
const utils_1 = require("../utils");
|
32
32
|
const fs = __importStar(require("fs"));
|
33
33
|
function default_1(fileInfo, api) {
|
@@ -43,7 +43,7 @@ function default_1(fileInfo, api) {
|
|
43
43
|
}
|
44
44
|
const j = api.jscodeshift;
|
45
45
|
const rootSource = j(fileInfo.source);
|
46
|
-
(0,
|
46
|
+
(0, index_1.templateTransformer)(rootSource, j, (root) => {
|
47
47
|
// Using node-html-parser to parse and manipulate the template: https://github.com/taoqf/node-html-parser
|
48
48
|
(0, utils_1.templateAttributeRemoval)(root, 'kendo-tabstrip', 'scrollable', 'mouseScrollSpeed');
|
49
49
|
});
|
@@ -10,7 +10,7 @@ export const packageMetadata = {
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
11
11
|
productCode: 'KENDOUIANGULAR',
|
12
12
|
productCodes: ['KENDOUIANGULAR'],
|
13
|
-
publishDate:
|
14
|
-
version: '19.0.0-develop.
|
13
|
+
publishDate: 1747760820,
|
14
|
+
version: '19.0.0-develop.28',
|
15
15
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
16
16
|
};
|
@@ -29,8 +29,8 @@ const packageMetadata = {
|
|
29
29
|
productName: 'Kendo UI for Angular',
|
30
30
|
productCode: 'KENDOUIANGULAR',
|
31
31
|
productCodes: ['KENDOUIANGULAR'],
|
32
|
-
publishDate:
|
33
|
-
version: '19.0.0-develop.
|
32
|
+
publishDate: 1747760820,
|
33
|
+
version: '19.0.0-develop.28',
|
34
34
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
35
35
|
};
|
36
36
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@progress/kendo-angular-layout",
|
3
|
-
"version": "19.0.0-develop.
|
3
|
+
"version": "19.0.0-develop.28",
|
4
4
|
"description": "Kendo UI for Angular Layout Package - a collection of components to create professional application layoyts",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
6
6
|
"author": "Progress",
|
@@ -35,18 +35,13 @@
|
|
35
35
|
"migrations": {
|
36
36
|
"options": {
|
37
37
|
"parser": "tsx",
|
38
|
-
"pattern": "*.{
|
38
|
+
"pattern": "*.{ts,html}"
|
39
39
|
},
|
40
40
|
"codemods": {
|
41
41
|
"19": [
|
42
|
-
{
|
43
|
-
"description": "Migrate all breaking changes for the layout package",
|
44
|
-
"file": "codemods/v19/index.js",
|
45
|
-
"prompt": "true"
|
46
|
-
},
|
47
42
|
{
|
48
43
|
"description": "mousescrollspeed of TabStripScrollableSettings is deprecated",
|
49
|
-
"file": "codemods/v19/tabstrip-mousescrollspeed.
|
44
|
+
"file": "codemods/v19/tabstrip-mousescrollspeed.js",
|
50
45
|
"prompt": "true"
|
51
46
|
}
|
52
47
|
]
|
@@ -55,7 +50,7 @@
|
|
55
50
|
"package": {
|
56
51
|
"productName": "Kendo UI for Angular",
|
57
52
|
"productCode": "KENDOUIANGULAR",
|
58
|
-
"publishDate":
|
53
|
+
"publishDate": 1747760820,
|
59
54
|
"licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"
|
60
55
|
}
|
61
56
|
},
|
@@ -65,17 +60,17 @@
|
|
65
60
|
"@angular/core": "16 - 19",
|
66
61
|
"@angular/platform-browser": "16 - 19",
|
67
62
|
"@progress/kendo-licensing": "^1.5.0",
|
68
|
-
"@progress/kendo-angular-common": "19.0.0-develop.
|
69
|
-
"@progress/kendo-angular-l10n": "19.0.0-develop.
|
70
|
-
"@progress/kendo-angular-progressbar": "19.0.0-develop.
|
71
|
-
"@progress/kendo-angular-icons": "19.0.0-develop.
|
72
|
-
"@progress/kendo-angular-buttons": "19.0.0-develop.
|
73
|
-
"@progress/kendo-angular-intl": "19.0.0-develop.
|
63
|
+
"@progress/kendo-angular-common": "19.0.0-develop.28",
|
64
|
+
"@progress/kendo-angular-l10n": "19.0.0-develop.28",
|
65
|
+
"@progress/kendo-angular-progressbar": "19.0.0-develop.28",
|
66
|
+
"@progress/kendo-angular-icons": "19.0.0-develop.28",
|
67
|
+
"@progress/kendo-angular-buttons": "19.0.0-develop.28",
|
68
|
+
"@progress/kendo-angular-intl": "19.0.0-develop.28",
|
74
69
|
"rxjs": "^6.5.3 || ^7.0.0"
|
75
70
|
},
|
76
71
|
"dependencies": {
|
77
72
|
"tslib": "^2.3.1",
|
78
|
-
"@progress/kendo-angular-schematics": "19.0.0-develop.
|
73
|
+
"@progress/kendo-angular-schematics": "19.0.0-develop.28",
|
79
74
|
"@progress/kendo-draggable": "^3.0.2"
|
80
75
|
},
|
81
76
|
"schematics": "./schematics/collection.json",
|
package/codemods/v19/index.js
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
2
|
-
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
5
|
-
"use strict";
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
7
|
-
if (k2 === undefined) k2 = k;
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
11
|
-
}
|
12
|
-
Object.defineProperty(o, k2, desc);
|
13
|
-
}) : (function(o, m, k, k2) {
|
14
|
-
if (k2 === undefined) k2 = k;
|
15
|
-
o[k2] = m[k];
|
16
|
-
}));
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
19
|
-
}) : function(o, v) {
|
20
|
-
o["default"] = v;
|
21
|
-
});
|
22
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
23
|
-
if (mod && mod.__esModule) return mod;
|
24
|
-
var result = {};
|
25
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
26
|
-
__setModuleDefault(result, mod);
|
27
|
-
return result;
|
28
|
-
};
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
30
|
-
const template_transformer_1 = require("../template-transformer");
|
31
|
-
const fs = __importStar(require("fs"));
|
32
|
-
const utils_1 = require("../utils");
|
33
|
-
function default_1(fileInfo, api) {
|
34
|
-
const filePath = fileInfo.path;
|
35
|
-
// Check if the file is an HTML file
|
36
|
-
if (filePath.endsWith('.html')) {
|
37
|
-
const filePath = fileInfo.path;
|
38
|
-
let updatedContent = fileInfo.source;
|
39
|
-
updatedContent = (0, utils_1.htmlAttributeRemoval)({ ...fileInfo, source: updatedContent }, 'kendo-tabstrip', 'scrollable', 'mouseScrollSpeed');
|
40
|
-
// Only write to file once after all transformations
|
41
|
-
fs.writeFileSync(filePath, updatedContent, 'utf-8');
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
const j = api.jscodeshift;
|
45
|
-
const rootSource = j(fileInfo.source);
|
46
|
-
(0, template_transformer_1.templateTransformer)(rootSource, j, (root) => {
|
47
|
-
// Using node-html-parser to parse and manipulate the template: https://github.com/taoqf/node-html-parser
|
48
|
-
(0, utils_1.templateAttributeRemoval)(root, 'kendo-tabstrip', 'scrollable', 'mouseScrollSpeed');
|
49
|
-
});
|
50
|
-
// Remove mouseScrollSpeed property from TabStripScrollableSettings type
|
51
|
-
(0, utils_1.tsPropertyRemoval)(rootSource, j, 'TabStripScrollableSettings', 'mouseScrollSpeed');
|
52
|
-
// Remove assignments to tabstrip.scrollable.mouseScrollSpeed
|
53
|
-
(0, utils_1.tsComponentPropertyRemoval)(rootSource, j, 'TabStripComponent', 'scrollable', 'mouseScrollSpeed');
|
54
|
-
return rootSource.toSource();
|
55
|
-
}
|
56
|
-
exports.default = default_1;
|