@uniformdev/transformer 1.1.6 → 1.1.7
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/dist/cli/index.js +17 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -201,6 +201,7 @@ declare class ComponentService {
|
|
|
201
201
|
addSlot(component: ComponentDefinition, slot: SlotDefinition): ComponentDefinition;
|
|
202
202
|
updateSlotAllowedComponents(component: ComponentDefinition, slotId: string, allowedComponents: string[], options?: FindOptions$1): ComponentDefinition;
|
|
203
203
|
removeSlot(component: ComponentDefinition, slotId: string, options?: FindOptions$1): ComponentDefinition;
|
|
204
|
+
generateGroupId(name: string): string;
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
interface FindOptions {
|
package/dist/index.js
CHANGED
|
@@ -342,6 +342,16 @@ var ComponentService = class {
|
|
|
342
342
|
component.slots = component.slots.filter((s) => !this.compareIds(s.id, slotId, strict));
|
|
343
343
|
return component;
|
|
344
344
|
}
|
|
345
|
+
generateGroupId(name) {
|
|
346
|
+
const words = name.replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).filter((w) => w.length > 0);
|
|
347
|
+
if (words.length === 0) {
|
|
348
|
+
return "group_";
|
|
349
|
+
}
|
|
350
|
+
const camel = words.map(
|
|
351
|
+
(w, i) => i === 0 ? w.toLowerCase() : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
|
|
352
|
+
).join("");
|
|
353
|
+
return `group_${camel}`;
|
|
354
|
+
}
|
|
345
355
|
};
|
|
346
356
|
|
|
347
357
|
// src/core/services/composition.service.ts
|
|
@@ -580,17 +590,18 @@ var PropertyPropagatorService = class {
|
|
|
580
590
|
}
|
|
581
591
|
let modifiedComponent = { ...targetComponent };
|
|
582
592
|
let componentModified = false;
|
|
593
|
+
const groupId = this.componentService.generateGroupId(targetGroup);
|
|
583
594
|
const existingGroup = this.componentService.findParameter(
|
|
584
595
|
modifiedComponent,
|
|
585
|
-
|
|
596
|
+
groupId,
|
|
586
597
|
findOptions
|
|
587
598
|
);
|
|
588
599
|
if (!existingGroup) {
|
|
589
600
|
this.logger.action(whatIf, "CREATE", `Group "${targetGroup}" on ${targetComponentType}`);
|
|
590
601
|
modifiedComponent = this.componentService.ensureGroupExists(
|
|
591
602
|
modifiedComponent,
|
|
603
|
+
groupId,
|
|
592
604
|
targetGroup,
|
|
593
|
-
void 0,
|
|
594
605
|
findOptions
|
|
595
606
|
);
|
|
596
607
|
componentModified = true;
|
|
@@ -614,7 +625,7 @@ var PropertyPropagatorService = class {
|
|
|
614
625
|
);
|
|
615
626
|
modifiedComponent = this.componentService.addParameterToGroup(
|
|
616
627
|
modifiedComponent,
|
|
617
|
-
|
|
628
|
+
groupId,
|
|
618
629
|
param.id,
|
|
619
630
|
findOptions
|
|
620
631
|
);
|
|
@@ -623,7 +634,7 @@ var PropertyPropagatorService = class {
|
|
|
623
634
|
this.logger.info(`Parameter "${param.id}" already exists on ${targetComponentType}`);
|
|
624
635
|
const group = this.componentService.findParameter(
|
|
625
636
|
modifiedComponent,
|
|
626
|
-
|
|
637
|
+
groupId,
|
|
627
638
|
findOptions
|
|
628
639
|
);
|
|
629
640
|
if (group && this.componentService.isGroupParameter(group)) {
|
|
@@ -633,7 +644,7 @@ var PropertyPropagatorService = class {
|
|
|
633
644
|
if (!isInGroup) {
|
|
634
645
|
modifiedComponent = this.componentService.addParameterToGroup(
|
|
635
646
|
modifiedComponent,
|
|
636
|
-
|
|
647
|
+
groupId,
|
|
637
648
|
param.id,
|
|
638
649
|
findOptions
|
|
639
650
|
);
|