@seniorsistemas/angular-components 19.6.0 → 19.6.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.
Files changed (21) hide show
  1. package/esm2022/chips/lib/chips/chips/chips.component.mjs +2 -2
  2. package/esm2022/dynamic-form/dynamic-form/form-field/fields/boolean/boolean-radio-field/boolean-field.component.mjs +3 -3
  3. package/esm2022/dynamic-form/dynamic-form/form-field/fields/chips/chips-field.component.mjs +3 -3
  4. package/esm2022/spotlight/lib/spotlight/spotlight-overlay/spotlight-overlay.component.mjs +22 -8
  5. package/esm2022/stats-card/lib/stats-card/stats-card.component.mjs +2 -2
  6. package/fesm2022/seniorsistemas-angular-components-chips.mjs.map +1 -1
  7. package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +4 -4
  8. package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
  9. package/fesm2022/seniorsistemas-angular-components-spotlight.mjs +21 -7
  10. package/fesm2022/seniorsistemas-angular-components-spotlight.mjs.map +1 -1
  11. package/fesm2022/seniorsistemas-angular-components-stats-card.mjs +1 -1
  12. package/fesm2022/seniorsistemas-angular-components-stats-card.mjs.map +1 -1
  13. package/package.json +1 -1
  14. package/schematics/migrations/migrate-s-chips-outputs/index.d.ts +2 -0
  15. package/schematics/migrations/migrate-s-chips-outputs/index.js +31 -0
  16. package/schematics/migrations/migrate-s-chips-outputs/index.js.map +1 -0
  17. package/schematics/migrations/migrate-s-chips-outputs/index.test.d.ts +1 -0
  18. package/schematics/migrations/migrate-s-chips-outputs/index.test.js +125 -0
  19. package/schematics/migrations/migrate-s-chips-outputs/index.test.js.map +1 -0
  20. package/schematics/migrations.json +5 -0
  21. package/stats-card/lib/stats-card/stats-card.component.d.ts +1 -0
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const testing_1 = require("@angular-devkit/schematics/testing");
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const path = require("path");
6
+ const migrationsPath = path.join(__dirname, '../../migrations.json');
7
+ const runner = new testing_1.SchematicTestRunner('migrations', migrationsPath);
8
+ const MIGRATION = 'migration-v19-6-2-s-chips-outputs';
9
+ async function runMigration(files) {
10
+ const tree = new testing_1.UnitTestTree(schematics_1.Tree.empty());
11
+ for (const [filePath, content] of Object.entries(files)) {
12
+ tree.create(filePath, content);
13
+ }
14
+ return runner.runSchematic(MIGRATION, {}, tree);
15
+ }
16
+ describe('migrate-s-chips-outputs', () => {
17
+ // ─── Renames individuais ─────────────────────────────────────────────────
18
+ it('deve renomear (onAdd) para (added)', async () => {
19
+ const result = await runMigration({
20
+ 'app.component.html': `<s-chips (onAdd)="onAdd($event)" />`,
21
+ });
22
+ expect(result.readText('app.component.html')).toContain('(added)="onAdd($event)"');
23
+ expect(result.readText('app.component.html')).not.toContain('(onAdd)');
24
+ });
25
+ it('deve renomear (onRemove) para (removed)', async () => {
26
+ const result = await runMigration({
27
+ 'app.component.html': `<s-chips (onRemove)="onRemove($event)" />`,
28
+ });
29
+ expect(result.readText('app.component.html')).toContain('(removed)="onRemove($event)"');
30
+ expect(result.readText('app.component.html')).not.toContain('(onRemove)');
31
+ });
32
+ it('deve renomear (onChipClick) para (chipClicked)', async () => {
33
+ const result = await runMigration({
34
+ 'app.component.html': `<s-chips (onChipClick)="onChipClick($event)" />`,
35
+ });
36
+ expect(result.readText('app.component.html')).toContain('(chipClicked)="onChipClick($event)"');
37
+ expect(result.readText('app.component.html')).not.toContain('(onChipClick)');
38
+ });
39
+ it('deve renomear (onFocus) para (focused) dentro de s-chips', async () => {
40
+ const result = await runMigration({
41
+ 'app.component.html': `<s-chips (onFocus)="onFocus($event)" />`,
42
+ });
43
+ expect(result.readText('app.component.html')).toContain('(focused)="onFocus($event)"');
44
+ expect(result.readText('app.component.html')).not.toContain('(onFocus)');
45
+ });
46
+ it('deve renomear (onBlur) para (focusLost) dentro de s-chips', async () => {
47
+ const result = await runMigration({
48
+ 'app.component.html': `<s-chips (onBlur)="onBlur($event)" />`,
49
+ });
50
+ expect(result.readText('app.component.html')).toContain('(focusLost)="onBlur($event)"');
51
+ expect(result.readText('app.component.html')).not.toContain('(onBlur)');
52
+ });
53
+ // ─── Escopo dos eventos genéricos ────────────────────────────────────────
54
+ it('não deve alterar (onFocus) em elementos que não são s-chips', async () => {
55
+ const result = await runMigration({
56
+ 'app.component.html': `<s-chips [value]="tags" />\n<input (onFocus)="focus()" />`,
57
+ });
58
+ expect(result.readText('app.component.html')).toContain('(onFocus)="focus()"');
59
+ });
60
+ it('não deve alterar (onBlur) em elementos que não são s-chips', async () => {
61
+ const result = await runMigration({
62
+ 'app.component.html': `<s-chips [value]="tags" />\n<input (onBlur)="blur()" />`,
63
+ });
64
+ expect(result.readText('app.component.html')).toContain('(onBlur)="blur()"');
65
+ });
66
+ // ─── Tag multi-linha ─────────────────────────────────────────────────────
67
+ it('deve renomear outputs em tag s-chips multi-linha', async () => {
68
+ const result = await runMigration({
69
+ 'app.component.html': `
70
+ <s-chips
71
+ [value]="chips"
72
+ (onAdd)="onAdd($event)"
73
+ (onFocus)="onFocus($event)"
74
+ (onBlur)="onBlur($event)"
75
+ />`,
76
+ });
77
+ const html = result.readText('app.component.html');
78
+ expect(html).toContain('(added)="onAdd($event)"');
79
+ expect(html).toContain('(focused)="onFocus($event)"');
80
+ expect(html).toContain('(focusLost)="onBlur($event)"');
81
+ expect(html).not.toContain('(onAdd)');
82
+ expect(html).not.toContain('(onFocus)');
83
+ expect(html).not.toContain('(onBlur)');
84
+ });
85
+ // ─── Template completo ───────────────────────────────────────────────────
86
+ it('deve migrar um template completo com todos os outputs legados', async () => {
87
+ const result = await runMigration({
88
+ 'app.component.html': `
89
+ <s-chips
90
+ [value]="chips"
91
+ [allowDuplicated]="false"
92
+ [addOnTab]="true"
93
+ [addOnBlur]="true"
94
+ (onAdd)="onAdd($event)"
95
+ (onRemove)="onRemove($event)"
96
+ (onChipClick)="onChipClick($event)"
97
+ (onFocus)="onFocus($event)"
98
+ (onBlur)="onBlur($event)"
99
+ />`,
100
+ });
101
+ const html = result.readText('app.component.html');
102
+ expect(html).toContain('(added)="onAdd($event)"');
103
+ expect(html).toContain('(removed)="onRemove($event)"');
104
+ expect(html).toContain('(chipClicked)="onChipClick($event)"');
105
+ expect(html).toContain('(focused)="onFocus($event)"');
106
+ expect(html).toContain('(focusLost)="onBlur($event)"');
107
+ expect(html).not.toContain('(onAdd)');
108
+ expect(html).not.toContain('(onRemove)');
109
+ expect(html).not.toContain('(onChipClick)');
110
+ expect(html).not.toContain('(onFocus)');
111
+ expect(html).not.toContain('(onBlur)');
112
+ });
113
+ // ─── Sem s-chips ─────────────────────────────────────────────────────────
114
+ it('não deve modificar arquivo sem s-chips', async () => {
115
+ const content = `<div class="container"><p>Olá</p></div>`;
116
+ const result = await runMigration({ 'app.component.html': content });
117
+ expect(result.readText('app.component.html')).toBe(content);
118
+ });
119
+ it('não deve modificar arquivo .ts', async () => {
120
+ const content = `import { Component } from '@angular/core';\n@Component({}) export class AppComponent {}`;
121
+ const result = await runMigration({ 'app.component.ts': content });
122
+ expect(result.readText('app.component.ts')).toBe(content);
123
+ });
124
+ });
125
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../projects/angular-components/schematics/migrations/migrate-s-chips-outputs/index.test.ts"],"names":[],"mappings":";;AAAA,gEAAuF;AACvF,2DAAkD;AAClD,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACrE,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AACrE,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAEtD,KAAK,UAAU,YAAY,CAAC,KAA6B;IACrD,MAAM,IAAI,GAAG,IAAI,sBAAY,CAAC,iBAAI,CAAC,KAAK,EAAE,CAAC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,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
3
  "schematics": {
4
+ "migration-v19-6-2-s-chips-outputs": {
5
+ "version": "19.6.2",
6
+ "description": "Renomeia outputs legados do s-chips: onAdd→added, onRemove→removed, onChipClick→chipClicked, onFocus→focused, onBlur→focusLost",
7
+ "factory": "./migrations/migrate-s-chips-outputs/index#migrate"
8
+ },
4
9
  "migration-v19-6-0-p-datepicker": {
5
10
  "version": "19.6.0",
6
11
  "description": "Migra p-datepicker (PrimeNG) para s-datepicker (@seniorsistemas/angular-components)",
@@ -1,4 +1,5 @@
1
1
  import { EventEmitter } from '@angular/core';
2
+ import BigNumber from 'bignumber.js';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
4
5
  * @description Card de estatística que exibe um valor numérico com ícone,