@siemens/element-ng 48.5.0 → 48.5.2
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/datepicker/index.d.ts +3 -2
- package/fesm2022/siemens-element-ng-application-header.mjs +2 -3
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-badge.mjs +3 -2
- package/fesm2022/siemens-element-ng-badge.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datepicker.mjs +13 -7
- package/fesm2022/siemens-element-ng-datepicker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-landing-page.mjs +2 -2
- package/fesm2022/siemens-element-ng-landing-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-strength.mjs +3 -3
- package/fesm2022/siemens-element-ng-password-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-counter.mjs +3 -3
- package/fesm2022/siemens-element-ng-status-counter.mjs.map +1 -1
- package/package.json +19 -19
- package/schematics/scss-import-to-siemens-migration/index.js +3 -0
- package/schematics/ts-import-to-siemens-migration/index.js +31 -24
|
@@ -139,31 +139,38 @@ const updateDecoratorImports = (recorder, sourceFile) => {
|
|
|
139
139
|
if (!decoratorNode || !ts.isObjectLiteralExpression(decoratorNode)) {
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
!
|
|
146
|
-
|
|
142
|
+
for (const metaDataField of ['imports', 'exports']) {
|
|
143
|
+
const matchingProperties = getMetadataField(decoratorNode, metaDataField);
|
|
144
|
+
const propertyAssignment = matchingProperties[0];
|
|
145
|
+
if (!propertyAssignment ||
|
|
146
|
+
!ts.isPropertyAssignment(propertyAssignment) ||
|
|
147
|
+
!ts.isArrayLiteralExpression(propertyAssignment.initializer)) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const elements = propertyAssignment.initializer.elements;
|
|
151
|
+
if (elements.find(e => e.getText() === 'SimplElementNgModule') === undefined) {
|
|
152
|
+
// No SimplElementNgModule found, nothing to do
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
// Filter out SimplElementNgModule and get existing modules
|
|
156
|
+
const existingModules = elements
|
|
157
|
+
.filter(e => e.getText() !== 'SimplElementNgModule')
|
|
158
|
+
.map(e => e.getText());
|
|
159
|
+
const existingModulesSet = new Set(existingModules);
|
|
160
|
+
// Only add modules that don't already exist
|
|
161
|
+
const newModulesToAdd = SIMPL_ELEMENT_NG_MODULES.filter(m => !existingModulesSet.has(m));
|
|
162
|
+
// Combine existing (without SimplElementNgModule) + new modules
|
|
163
|
+
const allModules = [...existingModules, ...newModulesToAdd];
|
|
164
|
+
// Remove existing imports array
|
|
165
|
+
recorder.remove(propertyAssignment.getFullStart(), propertyAssignment.getFullWidth());
|
|
166
|
+
// Create and insert the updated property assignment
|
|
167
|
+
const printer = ts.createPrinter();
|
|
168
|
+
const newNode = ts.factory.createArrayLiteralExpression(allModules.map(m => ts.factory.createIdentifier(m)), true);
|
|
169
|
+
const newProperty = ts.factory.updatePropertyAssignment(propertyAssignment, propertyAssignment.name, newNode);
|
|
170
|
+
const propertyText = printer.printNode(ts.EmitHint.Unspecified, newProperty, sourceFile);
|
|
171
|
+
// Had to add extra indentation to align properly
|
|
172
|
+
recorder.insertLeft(propertyAssignment.getStart(), `\n ` + propertyText);
|
|
147
173
|
}
|
|
148
|
-
const elements = importsAssignment.initializer.elements;
|
|
149
|
-
// Filter out SimplElementNgModule and get existing modules
|
|
150
|
-
const existingModules = elements
|
|
151
|
-
.filter(e => e.getText() !== 'SimplElementNgModule')
|
|
152
|
-
.map(e => e.getText());
|
|
153
|
-
const existingModulesSet = new Set(existingModules);
|
|
154
|
-
// Only add modules that don't already exist
|
|
155
|
-
const newModulesToAdd = SIMPL_ELEMENT_NG_MODULES.filter(m => !existingModulesSet.has(m));
|
|
156
|
-
// Combine existing (without SimplElementNgModule) + new modules
|
|
157
|
-
const allModules = [...existingModules, ...newModulesToAdd];
|
|
158
|
-
// Remove existing imports array
|
|
159
|
-
recorder.remove(importsAssignment.getFullStart(), importsAssignment.getFullWidth());
|
|
160
|
-
// Create and insert the updated property assignment
|
|
161
|
-
const printer = ts.createPrinter();
|
|
162
|
-
const newNode = ts.factory.createArrayLiteralExpression(allModules.map(m => ts.factory.createIdentifier(m)), true);
|
|
163
|
-
const newProperty = ts.factory.updatePropertyAssignment(importsAssignment, importsAssignment.name, newNode);
|
|
164
|
-
const propertyText = printer.printNode(ts.EmitHint.Unspecified, newProperty, sourceFile);
|
|
165
|
-
// Had to add extra indentation to align properly
|
|
166
|
-
recorder.insertLeft(importsAssignment.getStart(), `\n ` + propertyText);
|
|
167
174
|
};
|
|
168
175
|
/**
|
|
169
176
|
* Removes old import declarations from the file
|