@seniorsistemas/angular-components 19.5.5 → 19.6.0

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 (98) hide show
  1. package/accordion/README.md +95 -59
  2. package/calendar-mask/lib/calendar-mask/calendar-mask.directive.d.ts +4 -0
  3. package/datepicker/README.md +175 -0
  4. package/datepicker/index.d.ts +5 -0
  5. package/datepicker/lib/datepicker/date.utils.d.ts +21 -0
  6. package/datepicker/lib/datepicker/datepicker.component.d.ts +254 -0
  7. package/datepicker/lib/datepicker/models/index.d.ts +16 -0
  8. package/datepicker/public-api.d.ts +2 -0
  9. package/dynamic-form/dynamic-form/components/lookup/lookup.component.d.ts +3 -1
  10. package/dynamic-form/dynamic-form/components/lookup/models/lookup-alert-config.d.ts +5 -0
  11. package/dynamic-form/dynamic-form/form-field/configurations/fields/calendar-field.d.ts +119 -24
  12. package/dynamic-form/dynamic-form/form-field/configurations/fields/lookup-field.d.ts +6 -0
  13. package/dynamic-form/dynamic-form/form-field/fields/calendar/calendar-field.component.d.ts +6 -23
  14. package/dynamic-form/public-api.d.ts +1 -0
  15. package/editor/README.md +229 -0
  16. package/editor/index.d.ts +5 -0
  17. package/editor/lib/editor/editor.component.d.ts +127 -0
  18. package/editor/lib/editor/link-dialog/link-dialog.component.d.ts +18 -0
  19. package/editor/lib/editor/models/index.d.ts +12 -0
  20. package/editor/lib/editor/toolbar-button/editor-toolbar-button.component.d.ts +10 -0
  21. package/editor/public-api.d.ts +2 -0
  22. package/esm2022/calendar-mask/lib/calendar-mask/calendar-mask.directive.mjs +5 -1
  23. package/esm2022/datepicker/lib/datepicker/date.utils.mjs +182 -0
  24. package/esm2022/datepicker/lib/datepicker/datepicker.component.mjs +1062 -0
  25. package/esm2022/datepicker/lib/datepicker/models/index.mjs +2 -0
  26. package/esm2022/datepicker/public-api.mjs +2 -0
  27. package/esm2022/datepicker/seniorsistemas-angular-components-datepicker.mjs +5 -0
  28. package/esm2022/dynamic-form/dynamic-form/components/lookup/lookup.component.mjs +11 -5
  29. package/esm2022/dynamic-form/dynamic-form/components/lookup/models/lookup-alert-config.mjs +2 -0
  30. package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/calendar-field.mjs +1 -1
  31. package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/lookup-field.mjs +1 -1
  32. package/esm2022/dynamic-form/dynamic-form/form-field/fields/autocomplete/autocomplete-field.component.mjs +2 -2
  33. package/esm2022/dynamic-form/dynamic-form/form-field/fields/calendar/calendar-field.component.mjs +23 -116
  34. package/esm2022/dynamic-form/dynamic-form/form-field/fields/lookup/lookup-field.component.mjs +3 -3
  35. package/esm2022/dynamic-form/public-api.mjs +1 -1
  36. package/esm2022/editor/lib/editor/editor.component.mjs +375 -0
  37. package/esm2022/editor/lib/editor/link-dialog/link-dialog.component.mjs +48 -0
  38. package/esm2022/editor/lib/editor/models/index.mjs +3 -0
  39. package/esm2022/editor/lib/editor/toolbar-button/editor-toolbar-button.component.mjs +17 -0
  40. package/esm2022/editor/public-api.mjs +3 -0
  41. package/esm2022/editor/seniorsistemas-angular-components-editor.mjs +5 -0
  42. package/esm2022/inline-edit/lib/inline-edit/components/fields/inline-edit-calendar/inline-edit-calendar.component.mjs +22 -12
  43. package/esm2022/inline-edit/lib/inline-edit/inline-edit.module.mjs +5 -5
  44. package/esm2022/lib/locale/fallback.mjs +82 -3
  45. package/esm2022/optional-fields/editor/editor-field/editor-field.component.mjs +5 -6
  46. package/esm2022/optional-fields/editor/editor-field.mjs +1 -1
  47. package/esm2022/panel/lib/panel/panel.component.mjs +7 -3
  48. package/esm2022/select/lib/select/select.component.mjs +4 -8
  49. package/esm2022/shared/lib/accessibility/datepicker-no-period-tab.directive.mjs +5 -1
  50. package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs +4 -0
  51. package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs.map +1 -1
  52. package/fesm2022/seniorsistemas-angular-components-datepicker.mjs +1250 -0
  53. package/fesm2022/seniorsistemas-angular-components-datepicker.mjs.map +1 -0
  54. package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +49 -135
  55. package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
  56. package/fesm2022/seniorsistemas-angular-components-editor.mjs +437 -0
  57. package/fesm2022/seniorsistemas-angular-components-editor.mjs.map +1 -0
  58. package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs +24 -15
  59. package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs.map +1 -1
  60. package/fesm2022/seniorsistemas-angular-components-optional-fields-editor.mjs +4 -5
  61. package/fesm2022/seniorsistemas-angular-components-optional-fields-editor.mjs.map +1 -1
  62. package/fesm2022/seniorsistemas-angular-components-panel.mjs +6 -2
  63. package/fesm2022/seniorsistemas-angular-components-panel.mjs.map +1 -1
  64. package/fesm2022/seniorsistemas-angular-components-select.mjs +3 -7
  65. package/fesm2022/seniorsistemas-angular-components-select.mjs.map +1 -1
  66. package/fesm2022/seniorsistemas-angular-components-shared.mjs +4 -0
  67. package/fesm2022/seniorsistemas-angular-components-shared.mjs.map +1 -1
  68. package/fesm2022/seniorsistemas-angular-components.mjs +81 -2
  69. package/fesm2022/seniorsistemas-angular-components.mjs.map +1 -1
  70. package/inline-edit/lib/inline-edit/components/fields/inline-edit-calendar/inline-edit-calendar.component.d.ts +6 -4
  71. package/inline-edit/lib/inline-edit/inline-edit.module.d.ts +2 -2
  72. package/loading-state/README.md +57 -17
  73. package/optional-fields/editor/editor-field.d.ts +9 -6
  74. package/package.json +74 -8
  75. package/panel/README.md +12 -1
  76. package/panel/lib/panel/panel.component.d.ts +3 -1
  77. package/schematics/collection.json +4 -0
  78. package/schematics/migrations/migrate-p-datepicker/index.d.ts +2 -0
  79. package/schematics/migrations/migrate-p-datepicker/index.js +141 -0
  80. package/schematics/migrations/migrate-p-datepicker/index.js.map +1 -0
  81. package/schematics/migrations/migrate-p-datepicker/index.test.d.ts +1 -0
  82. package/schematics/migrations/migrate-p-datepicker/index.test.js +392 -0
  83. package/schematics/migrations/migrate-p-datepicker/index.test.js.map +1 -0
  84. package/schematics/migrations.json +10 -0
  85. package/schematics/utils/ast-utils.d.ts +28 -0
  86. package/schematics/utils/ast-utils.js +116 -0
  87. package/schematics/utils/ast-utils.js.map +1 -0
  88. package/schematics/utils/ast-utils.test.d.ts +1 -0
  89. package/schematics/utils/ast-utils.test.js +138 -0
  90. package/schematics/utils/ast-utils.test.js.map +1 -0
  91. package/schematics/utils/workspace-utils.d.ts +6 -0
  92. package/schematics/utils/workspace-utils.js +37 -0
  93. package/schematics/utils/workspace-utils.js.map +1 -0
  94. package/schematics/utils/workspace-utils.test.d.ts +1 -0
  95. package/schematics/utils/workspace-utils.test.js +152 -0
  96. package/schematics/utils/workspace-utils.test.js.map +1 -0
  97. package/shared/lib/accessibility/datepicker-no-period-tab.directive.d.ts +4 -0
  98. package/stats-card/README.md +80 -45
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrate = migrate;
4
+ const ts = require("typescript");
5
+ const ast_utils_1 = require("../../utils/ast-utils");
6
+ const workspace_utils_1 = require("../../utils/workspace-utils");
7
+ const UNSUPPORTED_ATTRS = ['inline', 'touchUI', 'showWeek', 'numberOfMonths', 'variant', 'size', 'fluid'];
8
+ const SILENT_REMOVE_ATTRS = ['appendTo', 'dataType', 'sDatepickerNoPeriodTab'];
9
+ const WARN_EVENTS = ['(onClear)', '(onClickOutside)'];
10
+ const PRIMENG_DATEPICKER_MODULES = ['DatePickerModule', 'CalendarModule'];
11
+ const REQUIRED_STYLE = 'node_modules/@seniorsistemas/angular-components/styles.css';
12
+ function migrate() {
13
+ return (tree, context) => {
14
+ (0, workspace_utils_1.ensureAngularJsonStyle)(tree, REQUIRED_STYLE, context);
15
+ tree.visit((path) => {
16
+ if (path.includes('/node_modules/'))
17
+ return;
18
+ if (path.endsWith('.html')) {
19
+ migrateTemplate(tree, path, context);
20
+ }
21
+ else if (path.endsWith('.ts')) {
22
+ migrateTypeScript(tree, path, context);
23
+ }
24
+ });
25
+ };
26
+ }
27
+ function migrateTemplate(tree, path, context) {
28
+ const content = tree.readText(path);
29
+ if (!content.includes('p-datepicker'))
30
+ return;
31
+ let updated = content;
32
+ // Warn about unsupported events before removing them
33
+ for (const event of WARN_EVENTS) {
34
+ if (updated.includes(event)) {
35
+ context.logger.warn(`${path}: ${event} não tem equivalente no s-datepicker e foi removido. Remova o handler manualmente.`);
36
+ updated = removeAttribute(updated, event.replace(/[()]/g, '\\$&'));
37
+ }
38
+ }
39
+ // Warn about ng-template inside p-datepicker (custom templates not migrated)
40
+ if (/<p-datepicker[^>]*>[\s\S]*?<ng-template/.test(updated)) {
41
+ context.logger.warn(`${path}: ng-template dentro de p-datepicker não é migrado automaticamente. Revise manualmente.`);
42
+ }
43
+ // Warn about (onShow) if handler uses $event
44
+ if (/\(onShow\)\s*=\s*"[^"]*\$event/.test(updated)) {
45
+ context.logger.warn(`${path}: (onShow) agora emite void (sem HTMLElement). Remova o uso de $event no handler.`);
46
+ }
47
+ // Warn about (onSelect) with typed $event usage (common pattern)
48
+ if (/\(onSelect\)\s*=\s*"[^"]*\$event/.test(updated)) {
49
+ context.logger.warn(`${path}: (selected) agora emite Date | DateRange | Date[] | null. Verifique o tipo do handler se usar $event tipado.`);
50
+ }
51
+ // Warn about range value array access (value[0] / value[1] pattern)
52
+ if (updated.includes('[0]') || updated.includes('[1]')) {
53
+ context.logger.warn(`${path}: Verifique acessos a value[0]/value[1] para mode="range" — o s-datepicker retorna { start, end } em vez de array.`);
54
+ }
55
+ // Warn about unsupported attributes
56
+ for (const attr of UNSUPPORTED_ATTRS) {
57
+ const pattern = new RegExp(`\\[?${attr}\\]?\\s*=`, 'g');
58
+ if (pattern.test(updated)) {
59
+ context.logger.warn(`${path}: Atributo "${attr}" não é suportado pelo s-datepicker e foi removido.`);
60
+ }
61
+ }
62
+ // 1. Handle showTime + view combos → mode="datetime"
63
+ updated = updated.replace(/(<p-datepicker\b[^>]*?)\[showTime\]="true"([^>]*?)view="date"([^>]*?>)/gs, '$1mode="datetime"$2$3');
64
+ updated = updated.replace(/(<p-datepicker\b[^>]*?)view="date"([^>]*?)\[showTime\]="true"([^>]*?>)/gs, '$1mode="datetime"$2$3');
65
+ // showTime without explicit view also becomes datetime
66
+ updated = updated.replace(/(<p-datepicker\b[^>]*?)\[showTime\]="true"([^>]*?>)/gs, '$1mode="datetime"$2');
67
+ // 2. timeOnly → mode="time"
68
+ updated = updated.replace(/(<p-datepicker\b[^>]*?)\[timeOnly\]="true"([^>]*?>)/gs, '$1mode="time"$2');
69
+ // 3. selectionMode="range" / [selectionMode]="'range'" → mode="range"
70
+ updated = updated.replace(/\[selectionMode\]="'range'"/g, 'mode="range"');
71
+ updated = updated.replace(/selectionMode="range"/g, 'mode="range"');
72
+ // 4. selectionMode="multiple" / [selectionMode]="'multiple'" → selectionMode="multiple" (stays, no-op for static)
73
+ updated = updated.replace(/\[selectionMode\]="'multiple'"/g, 'selectionMode="multiple"');
74
+ // 5. view="month" / view="year" → mode="..."
75
+ updated = updated.replace(/\bview="month"/g, 'mode="month"');
76
+ updated = updated.replace(/\bview="year"/g, 'mode="year"');
77
+ // view="date" → remove (it's the default)
78
+ updated = updated.replace(/\s*\bview="date"/g, '');
79
+ // 6. minDate / maxDate → min / max
80
+ updated = updated.replace(/\[minDate\]/g, '[min]');
81
+ updated = updated.replace(/\bminDate=/g, 'min=');
82
+ updated = updated.replace(/\[maxDate\]/g, '[max]');
83
+ updated = updated.replace(/\bmaxDate=/g, 'max=');
84
+ // 7. stepMinute → minuteStep
85
+ updated = updated.replace(/\[stepMinute\]/g, '[minuteStep]');
86
+ updated = updated.replace(/\bstepMinute=/g, 'minuteStep=');
87
+ // 8. Event renames
88
+ updated = updated.replace(/\(onFocus\)/g, '(focused)');
89
+ updated = updated.replace(/\(onBlur\)/g, '(blurred)');
90
+ updated = updated.replace(/\(onSelect\)/g, '(selected)');
91
+ updated = updated.replace(/\(onInput\)/g, '(valueInput)');
92
+ updated = updated.replace(/\(onClose\)/g, '(closed)');
93
+ updated = updated.replace(/\(onShow\)/g, '(show)');
94
+ updated = updated.replace(/\(onTodayClick\)/g, '(todayClick)');
95
+ updated = updated.replace(/\(onClearClick\)/g, '(clearClick)');
96
+ updated = updated.replace(/\(onMonthChange\)/g, '(monthChange)');
97
+ updated = updated.replace(/\(onYearChange\)/g, '(yearChange)');
98
+ // 9. Remove attributes without equivalent (silent)
99
+ for (const attr of SILENT_REMOVE_ATTRS) {
100
+ updated = removeAttribute(updated, attr);
101
+ }
102
+ // 10. Remove unsupported attributes (already warned above)
103
+ for (const attr of UNSUPPORTED_ATTRS) {
104
+ updated = removeAttribute(updated, attr);
105
+ }
106
+ // 11. Rename tag (opening and closing)
107
+ updated = updated.replace(/<p-datepicker\b/g, '<s-datepicker');
108
+ updated = updated.replace(/<\/p-datepicker>/g, '</s-datepicker>');
109
+ if (updated !== content) {
110
+ tree.overwrite(path, updated);
111
+ }
112
+ }
113
+ function removeAttribute(content, attrName) {
114
+ // Matches: [attr]="..." attr="..." [attr] attr (boolean)
115
+ // Works for both bound and unbound, with or without value
116
+ return content.replace(new RegExp(`\\s*\\[?${attrName}\\]?(?:\\s*=\\s*"[^"]*")?`, 'g'), '');
117
+ }
118
+ function migrateTypeScript(tree, path, context) {
119
+ const content = tree.readText(path);
120
+ if (!PRIMENG_DATEPICKER_MODULES.some((m) => content.includes(m)))
121
+ return;
122
+ const sourceFile = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);
123
+ const { changes: importChanges } = (0, ast_utils_1.buildRemoveNamedImportsChanges)(sourceFile, PRIMENG_DATEPICKER_MODULES, 'primeng');
124
+ const decoratorChanges = [
125
+ ...ast_utils_1.ngModule.replaceInImports(sourceFile, PRIMENG_DATEPICKER_MODULES, 'DatepickerComponent'),
126
+ ...ast_utils_1.ngModule.replaceInExports(sourceFile, PRIMENG_DATEPICKER_MODULES, 'DatepickerComponent'),
127
+ ...ast_utils_1.ngComponent.replaceInImports(sourceFile, PRIMENG_DATEPICKER_MODULES, 'DatepickerComponent'),
128
+ ];
129
+ if (importChanges.length === 0 && decoratorChanges.length === 0)
130
+ return;
131
+ if (/\[\s*0\s*\]|\[\s*1\s*\]/.test(content) && /range/i.test(content)) {
132
+ context.logger.warn(`${path}: Possível acesso a value[0]/value[1] em modo range detectado. O s-datepicker retorna { start, end } — revise manualmente.`);
133
+ }
134
+ let updated = (0, ast_utils_1.applyChanges)(content, [...importChanges, ...decoratorChanges]);
135
+ updated = updated.replace(/\n\n+/g, '\n\n');
136
+ updated = (0, ast_utils_1.insertImportStatement)(updated, 'DatepickerComponent', '@seniorsistemas/angular-components/datepicker');
137
+ if (updated !== content) {
138
+ tree.overwrite(path, updated);
139
+ }
140
+ }
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/angular-components/schematics/migrations/migrate-p-datepicker/index.ts"],"names":[],"mappings":";;AAiBA,0BAYC;AA5BD,iCAAiC;AACjC,qDAM+B;AAC/B,iEAAqE;AAErE,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1G,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;AAC/E,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;AACtD,MAAM,0BAA0B,GAAG,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;AAC1E,MAAM,cAAc,GAAG,4DAA4D,CAAC;AAEpF,SAAgB,OAAO;IACnB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC7C,IAAA,wCAAsB,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QACtD,IA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,EAC3B,OAAO,EACP,qBAAqB,EACrB,+CAA+C,CAClD,CAAC;IAEF,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;AACL,CAAC"}
@@ -0,0 +1,392 @@
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-0-p-datepicker';
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-p-datepicker', () => {
17
+ // ─── Tag rename ──────────────────────────────────────────────────────────
18
+ it('deve renomear a tag p-datepicker para s-datepicker', async () => {
19
+ const result = await runMigration({
20
+ 'app.component.html': `<p-datepicker [(ngModel)]="date" />`,
21
+ });
22
+ expect(result.readText('app.component.html')).toContain('<s-datepicker');
23
+ expect(result.readText('app.component.html')).not.toContain('p-datepicker');
24
+ });
25
+ it('deve renomear a tag de fechamento </p-datepicker>', async () => {
26
+ const result = await runMigration({
27
+ 'app.component.html': `<p-datepicker [(ngModel)]="date"></p-datepicker>`,
28
+ });
29
+ expect(result.readText('app.component.html')).toContain('</s-datepicker>');
30
+ expect(result.readText('app.component.html')).not.toContain('</p-datepicker>');
31
+ });
32
+ // ─── Atributo view → mode ────────────────────────────────────────────────
33
+ it('deve converter view="month" para mode="month"', async () => {
34
+ const result = await runMigration({
35
+ 'app.component.html': `<p-datepicker view="month" />`,
36
+ });
37
+ expect(result.readText('app.component.html')).toContain('mode="month"');
38
+ expect(result.readText('app.component.html')).not.toContain('view=');
39
+ });
40
+ it('deve converter view="year" para mode="year"', async () => {
41
+ const result = await runMigration({
42
+ 'app.component.html': `<p-datepicker view="year" />`,
43
+ });
44
+ expect(result.readText('app.component.html')).toContain('mode="year"');
45
+ expect(result.readText('app.component.html')).not.toContain('view=');
46
+ });
47
+ it('deve remover view="date" (é o default do s-datepicker)', async () => {
48
+ const result = await runMigration({
49
+ 'app.component.html': `<p-datepicker view="date" />`,
50
+ });
51
+ expect(result.readText('app.component.html')).not.toContain('view=');
52
+ expect(result.readText('app.component.html')).not.toContain('mode="date"');
53
+ });
54
+ // ─── showTime / timeOnly → mode ──────────────────────────────────────────
55
+ it('deve converter [showTime]="true" para mode="datetime"', async () => {
56
+ const result = await runMigration({
57
+ 'app.component.html': `<p-datepicker [showTime]="true" />`,
58
+ });
59
+ expect(result.readText('app.component.html')).toContain('mode="datetime"');
60
+ expect(result.readText('app.component.html')).not.toContain('showTime');
61
+ });
62
+ it('deve converter [timeOnly]="true" para mode="time"', async () => {
63
+ const result = await runMigration({
64
+ 'app.component.html': `<p-datepicker [timeOnly]="true" />`,
65
+ });
66
+ expect(result.readText('app.component.html')).toContain('mode="time"');
67
+ expect(result.readText('app.component.html')).not.toContain('timeOnly');
68
+ });
69
+ // ─── selectionMode ───────────────────────────────────────────────────────
70
+ it('deve converter selectionMode="range" para mode="range"', async () => {
71
+ const result = await runMigration({
72
+ 'app.component.html': `<p-datepicker selectionMode="range" />`,
73
+ });
74
+ expect(result.readText('app.component.html')).toContain('mode="range"');
75
+ expect(result.readText('app.component.html')).not.toContain('selectionMode="range"');
76
+ });
77
+ it('deve converter [selectionMode]="\'range\'" para mode="range"', async () => {
78
+ const result = await runMigration({
79
+ 'app.component.html': `<p-datepicker [selectionMode]="'range'" />`,
80
+ });
81
+ expect(result.readText('app.component.html')).toContain('mode="range"');
82
+ });
83
+ it('deve manter selectionMode="multiple" (agora suportado nativamente)', async () => {
84
+ const result = await runMigration({
85
+ 'app.component.html': `<p-datepicker selectionMode="multiple" />`,
86
+ });
87
+ expect(result.readText('app.component.html')).toContain('selectionMode="multiple"');
88
+ });
89
+ it('deve converter [selectionMode]="\'multiple\'" para selectionMode="multiple"', async () => {
90
+ const result = await runMigration({
91
+ 'app.component.html': `<p-datepicker [selectionMode]="'multiple'" />`,
92
+ });
93
+ expect(result.readText('app.component.html')).toContain('selectionMode="multiple"');
94
+ });
95
+ // ─── minDate / maxDate ───────────────────────────────────────────────────
96
+ it('deve renomear [minDate] para [min]', async () => {
97
+ const result = await runMigration({
98
+ 'app.component.html': `<p-datepicker [minDate]="minDate" />`,
99
+ });
100
+ expect(result.readText('app.component.html')).toContain('[min]="minDate"');
101
+ expect(result.readText('app.component.html')).not.toContain('[minDate]');
102
+ });
103
+ it('deve renomear [maxDate] para [max]', async () => {
104
+ const result = await runMigration({
105
+ 'app.component.html': `<p-datepicker [maxDate]="maxDate" />`,
106
+ });
107
+ expect(result.readText('app.component.html')).toContain('[max]="maxDate"');
108
+ expect(result.readText('app.component.html')).not.toContain('[maxDate]');
109
+ });
110
+ it('deve renomear minDate= (estático) para min=', async () => {
111
+ const result = await runMigration({
112
+ 'app.component.html': `<p-datepicker minDate="2024-01-01" />`,
113
+ });
114
+ expect(result.readText('app.component.html')).toContain('min="2024-01-01"');
115
+ expect(result.readText('app.component.html')).not.toContain('minDate=');
116
+ });
117
+ // ─── stepMinute → minuteStep ─────────────────────────────────────────────
118
+ it('deve renomear [stepMinute] para [minuteStep]', async () => {
119
+ const result = await runMigration({
120
+ 'app.component.html': `<p-datepicker [stepMinute]="10" />`,
121
+ });
122
+ expect(result.readText('app.component.html')).toContain('[minuteStep]="10"');
123
+ expect(result.readText('app.component.html')).not.toContain('stepMinute');
124
+ });
125
+ // ─── Eventos ─────────────────────────────────────────────────────────────
126
+ it('deve renomear (onFocus) para (focused)', async () => {
127
+ const result = await runMigration({
128
+ 'app.component.html': `<p-datepicker (onFocus)="onFocus($event)" />`,
129
+ });
130
+ expect(result.readText('app.component.html')).toContain('(focused)="onFocus($event)"');
131
+ });
132
+ it('deve renomear (onBlur) para (blurred)', async () => {
133
+ const result = await runMigration({
134
+ 'app.component.html': `<p-datepicker (onBlur)="onBlur($event)" />`,
135
+ });
136
+ expect(result.readText('app.component.html')).toContain('(blurred)="onBlur($event)"');
137
+ });
138
+ it('deve renomear (onSelect) para (selected)', async () => {
139
+ const result = await runMigration({
140
+ 'app.component.html': `<p-datepicker (onSelect)="onSelect($event)" />`,
141
+ });
142
+ expect(result.readText('app.component.html')).toContain('(selected)="onSelect($event)"');
143
+ });
144
+ it('deve renomear (onClose) para (closed)', async () => {
145
+ const result = await runMigration({
146
+ 'app.component.html': `<p-datepicker (onClose)="onClose($event)" />`,
147
+ });
148
+ expect(result.readText('app.component.html')).toContain('(closed)="onClose($event)"');
149
+ });
150
+ it('deve renomear (onShow) para (show)', async () => {
151
+ const result = await runMigration({
152
+ 'app.component.html': `<p-datepicker (onShow)="onShow()" />`,
153
+ });
154
+ expect(result.readText('app.component.html')).toContain('(show)="onShow()"');
155
+ });
156
+ it('deve renomear (onInput) para (valueInput)', async () => {
157
+ const result = await runMigration({
158
+ 'app.component.html': `<p-datepicker (onInput)="onInput($event)" />`,
159
+ });
160
+ expect(result.readText('app.component.html')).toContain('(valueInput)="onInput($event)"');
161
+ });
162
+ it('deve renomear (onTodayClick) para (todayClick)', async () => {
163
+ const result = await runMigration({
164
+ 'app.component.html': `<p-datepicker (onTodayClick)="today($event)" />`,
165
+ });
166
+ expect(result.readText('app.component.html')).toContain('(todayClick)="today($event)"');
167
+ });
168
+ it('deve renomear (onClearClick) para (clearClick)', async () => {
169
+ const result = await runMigration({
170
+ 'app.component.html': `<p-datepicker (onClearClick)="clear($event)" />`,
171
+ });
172
+ expect(result.readText('app.component.html')).toContain('(clearClick)="clear($event)"');
173
+ });
174
+ it('deve renomear (onMonthChange) para (monthChange)', async () => {
175
+ const result = await runMigration({
176
+ 'app.component.html': `<p-datepicker (onMonthChange)="monthChange($event)" />`,
177
+ });
178
+ expect(result.readText('app.component.html')).toContain('(monthChange)="monthChange($event)"');
179
+ });
180
+ it('deve renomear (onYearChange) para (yearChange)', async () => {
181
+ const result = await runMigration({
182
+ 'app.component.html': `<p-datepicker (onYearChange)="yearChange($event)" />`,
183
+ });
184
+ expect(result.readText('app.component.html')).toContain('(yearChange)="yearChange($event)"');
185
+ });
186
+ it('deve remover (onClear) sem equivalente', async () => {
187
+ const result = await runMigration({
188
+ 'app.component.html': `<p-datepicker (onClear)="clear()" />`,
189
+ });
190
+ expect(result.readText('app.component.html')).not.toContain('(onClear)');
191
+ });
192
+ it('deve remover (onClickOutside) sem equivalente', async () => {
193
+ const result = await runMigration({
194
+ 'app.component.html': `<p-datepicker (onClickOutside)="outside()" />`,
195
+ });
196
+ expect(result.readText('app.component.html')).not.toContain('(onClickOutside)');
197
+ });
198
+ // ─── Atributos removidos ─────────────────────────────────────────────────
199
+ it('deve remover sDatepickerNoPeriodTab (a11y nativa no s-datepicker)', async () => {
200
+ const result = await runMigration({
201
+ 'app.component.html': `<p-datepicker sDatepickerNoPeriodTab />`,
202
+ });
203
+ expect(result.readText('app.component.html')).not.toContain('sDatepickerNoPeriodTab');
204
+ });
205
+ it('deve remover appendTo', async () => {
206
+ const result = await runMigration({
207
+ 'app.component.html': `<p-datepicker [appendTo]="'body'" />`,
208
+ });
209
+ expect(result.readText('app.component.html')).not.toContain('appendTo');
210
+ });
211
+ it('deve remover dataType', async () => {
212
+ const result = await runMigration({
213
+ 'app.component.html': `<p-datepicker dataType="date" />`,
214
+ });
215
+ expect(result.readText('app.component.html')).not.toContain('dataType');
216
+ });
217
+ it('deve remover atributos não suportados (inline, touchUI, showWeek, etc.)', async () => {
218
+ const result = await runMigration({
219
+ 'app.component.html': `<p-datepicker [inline]="true" [touchUI]="true" [showWeek]="true" [numberOfMonths]="2" />`,
220
+ });
221
+ const html = result.readText('app.component.html');
222
+ expect(html).not.toContain('inline');
223
+ expect(html).not.toContain('touchUI');
224
+ expect(html).not.toContain('showWeek');
225
+ expect(html).not.toContain('numberOfMonths');
226
+ });
227
+ // ─── Migração completa ───────────────────────────────────────────────────
228
+ it('deve migrar um template completo com múltiplos atributos', async () => {
229
+ const result = await runMigration({
230
+ 'app.component.html': `
231
+ <p-datepicker
232
+ [(ngModel)]="date"
233
+ sDatepickerNoPeriodTab
234
+ view="month"
235
+ [minDate]="min"
236
+ [maxDate]="max"
237
+ [stepMinute]="10"
238
+ (onSelect)="onSelect($event)"
239
+ (onClose)="onClose($event)"
240
+ (onFocus)="onFocus($event)"
241
+ (onBlur)="onBlur($event)"
242
+ [appendTo]="'body'"
243
+ placeholder="Selecione"
244
+ />`,
245
+ });
246
+ const html = result.readText('app.component.html');
247
+ expect(html).toContain('<s-datepicker');
248
+ expect(html).toContain('mode="month"');
249
+ expect(html).toContain('[min]="min"');
250
+ expect(html).toContain('[max]="max"');
251
+ expect(html).toContain('[minuteStep]="10"');
252
+ expect(html).toContain('(selected)="onSelect($event)"');
253
+ expect(html).toContain('(closed)="onClose($event)"');
254
+ expect(html).toContain('(focused)="onFocus($event)"');
255
+ expect(html).toContain('(blurred)="onBlur($event)"');
256
+ expect(html).not.toContain('p-datepicker');
257
+ expect(html).not.toContain('sDatepickerNoPeriodTab');
258
+ expect(html).not.toContain('appendTo');
259
+ expect(html).not.toContain('view=');
260
+ });
261
+ // ─── Migração TypeScript ─────────────────────────────────────────────────
262
+ it('deve remover import DatePickerModule do PrimeNG', async () => {
263
+ const result = await runMigration({
264
+ 'app.component.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@Component({}) export class AppComponent {}`,
265
+ });
266
+ expect(result.readText('app.component.ts')).not.toContain('DatePickerModule');
267
+ expect(result.readText('app.component.ts')).not.toContain("from 'primeng/datepicker'");
268
+ });
269
+ it('deve adicionar import DatepickerComponent após remover PrimeNG', async () => {
270
+ const result = await runMigration({
271
+ 'app.component.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@Component({}) export class AppComponent {}`,
272
+ });
273
+ expect(result.readText('app.component.ts')).toContain('DatepickerComponent');
274
+ expect(result.readText('app.component.ts')).toContain("@seniorsistemas/angular-components/datepicker");
275
+ });
276
+ it('deve preservar outros imports do mesmo pacote primeng ao remover DatePickerModule', async () => {
277
+ const result = await runMigration({
278
+ 'app.component.ts': `import { DatePickerModule, ButtonModule } from 'primeng/datepicker';\n@Component({}) export class AppComponent {}`,
279
+ });
280
+ const ts = result.readText('app.component.ts');
281
+ expect(ts).toContain('ButtonModule');
282
+ expect(ts).not.toContain('DatePickerModule');
283
+ });
284
+ it('não deve modificar arquivo .ts sem imports do primeng', async () => {
285
+ const content = `import { Component } from '@angular/core';\n@Component({}) export class AppComponent {}`;
286
+ const result = await runMigration({ 'app.component.ts': content });
287
+ expect(result.readText('app.component.ts')).toBe(content);
288
+ });
289
+ it('não deve modificar arquivo .html sem p-datepicker', async () => {
290
+ const content = `<div class="container"><p>Olá</p></div>`;
291
+ const result = await runMigration({ 'app.component.html': content });
292
+ expect(result.readText('app.component.html')).toBe(content);
293
+ });
294
+ // ─── Decorator imports array ─────────────────────────────────────────────
295
+ it('deve substituir DatePickerModule por DatepickerComponent no array exports de @NgModule', async () => {
296
+ const result = await runMigration({
297
+ 'app.module.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@NgModule({ imports: [BrowserModule], exports: [DatePickerModule, DropdownModule] })\nexport class AppModule {}`,
298
+ });
299
+ const ts = result.readText('app.module.ts');
300
+ expect(ts).not.toContain('DatePickerModule');
301
+ expect(ts).toContain('DatepickerComponent');
302
+ expect(ts).toContain('DropdownModule');
303
+ });
304
+ it('deve substituir DatePickerModule por DatepickerComponent no array imports de @NgModule', async () => {
305
+ const result = await runMigration({
306
+ 'app.module.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@NgModule({ imports: [CommonModule, DatePickerModule] })\nexport class AppModule {}`,
307
+ });
308
+ const ts = result.readText('app.module.ts');
309
+ expect(ts).toContain('DatepickerComponent');
310
+ expect(ts).not.toContain('DatePickerModule');
311
+ expect(ts).toContain('CommonModule');
312
+ });
313
+ it('deve substituir DatePickerModule por DatepickerComponent no array imports de @Component standalone', async () => {
314
+ const result = await runMigration({
315
+ 'app.component.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@Component({ imports: [DatePickerModule], template: '' })\nexport class AppComponent {}`,
316
+ });
317
+ const ts = result.readText('app.component.ts');
318
+ expect(ts).toContain('DatepickerComponent');
319
+ expect(ts).not.toContain('DatePickerModule');
320
+ });
321
+ it('deve preservar outros imports no array ao substituir DatePickerModule', async () => {
322
+ const result = await runMigration({
323
+ 'app.module.ts': `import { DatePickerModule } from 'primeng/datepicker';\n@NgModule({ imports: [CommonModule, RouterModule, DatePickerModule] })\nexport class AppModule {}`,
324
+ });
325
+ const ts = result.readText('app.module.ts');
326
+ expect(ts).toContain('DatepickerComponent');
327
+ expect(ts).toContain('CommonModule');
328
+ expect(ts).toContain('RouterModule');
329
+ expect(ts).not.toContain('DatePickerModule');
330
+ });
331
+ it('deve substituir CalendarModule (alias PrimeNG legado) no array imports', async () => {
332
+ const result = await runMigration({
333
+ 'app.module.ts': `import { CalendarModule } from 'primeng/calendar';\n@NgModule({ imports: [CalendarModule] })\nexport class AppModule {}`,
334
+ });
335
+ const ts = result.readText('app.module.ts');
336
+ expect(ts).toContain('DatepickerComponent');
337
+ expect(ts).not.toContain('CalendarModule');
338
+ });
339
+ it('deve substituir DatePickerModule no decorator mesmo quando importado via re-export (sem import direto do primeng)', async () => {
340
+ const result = await runMigration({
341
+ 'feature.module.ts': `import { NgModule } from '@angular/core';\nimport { DatePickerModule } from '../shared/primeng';\n\n@NgModule({ imports: [DatePickerModule] })\nexport class FeatureModule {}`,
342
+ });
343
+ const ts = result.readText('feature.module.ts');
344
+ expect(ts).not.toContain('DatePickerModule');
345
+ expect(ts).toContain('DatepickerComponent');
346
+ expect(ts).toContain("@seniorsistemas/angular-components/datepicker");
347
+ });
348
+ // ─── angular.json styles injection ───────────────────────────────────────
349
+ it('deve adicionar o styles.css da lib ao angular.json', async () => {
350
+ const angularJson = {
351
+ projects: {
352
+ app: {
353
+ architect: {
354
+ build: {
355
+ builder: '@angular-devkit/build-angular:browser',
356
+ options: { styles: ['src/styles.css'] },
357
+ },
358
+ },
359
+ },
360
+ },
361
+ };
362
+ const result = await runMigration({
363
+ '/angular.json': JSON.stringify(angularJson, null, 2),
364
+ 'app.component.html': `<p-datepicker [(ngModel)]="date" />`,
365
+ });
366
+ const json = JSON.parse(result.readText('/angular.json'));
367
+ expect(json.projects.app.architect.build.options.styles).toContain('node_modules/@seniorsistemas/angular-components/styles.css');
368
+ });
369
+ it('não deve duplicar o style se angular.json já tiver a entrada', async () => {
370
+ const style = 'node_modules/@seniorsistemas/angular-components/styles.css';
371
+ const angularJson = {
372
+ projects: {
373
+ app: {
374
+ architect: {
375
+ build: {
376
+ builder: '@angular-devkit/build-angular:browser',
377
+ options: { styles: ['src/styles.css', style] },
378
+ },
379
+ },
380
+ },
381
+ },
382
+ };
383
+ const result = await runMigration({
384
+ '/angular.json': JSON.stringify(angularJson, null, 2),
385
+ 'app.component.html': `<p-datepicker [(ngModel)]="date" />`,
386
+ });
387
+ const json = JSON.parse(result.readText('/angular.json'));
388
+ const count = json.projects.app.architect.build.options.styles.filter((s) => s === style).length;
389
+ expect(count).toBe(1);
390
+ });
391
+ });
392
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../projects/angular-components/schematics/migrations/migrate-p-datepicker/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,gCAAgC,CAAC;AAEnD,KAAK,UAAU,YAAY,CAAC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AC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;YACrD,oBAAoB,EAAE,qCAAqC;SAC9D,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CACjE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAC7B,CAAC,MAAM,CAAC;QACT,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "migration-v19-6-0-p-datepicker": {
5
+ "version": "19.6.0",
6
+ "description": "Migra p-datepicker (PrimeNG) para s-datepicker (@seniorsistemas/angular-components)",
7
+ "factory": "./migrations/migrate-p-datepicker/index#migrate"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,28 @@
1
+ import * as ts from 'typescript';
2
+ export interface AstChange {
3
+ start: number;
4
+ end: number;
5
+ replacement: string;
6
+ }
7
+ export declare function applyChanges(content: string, changes: AstChange[]): string;
8
+ /**
9
+ * Removes named imports from a module matching `fromModulePattern`.
10
+ * If the import statement becomes empty, removes the entire statement.
11
+ * Returns the changes and the list of names that were actually removed.
12
+ */
13
+ export declare function buildRemoveNamedImportsChanges(sourceFile: ts.SourceFile, names: string[], fromModulePattern: string): {
14
+ changes: AstChange[];
15
+ removedNames: string[];
16
+ };
17
+ /**
18
+ * Inserts `import { name } from 'fromModule';` after the last existing import statement.
19
+ * If no imports exist, prepends to the file.
20
+ */
21
+ export declare function insertImportStatement(content: string, name: string, fromModule: string): string;
22
+ export declare const ngModule: {
23
+ replaceInImports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[];
24
+ replaceInExports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[];
25
+ };
26
+ export declare const ngComponent: {
27
+ replaceInImports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[];
28
+ };