Skip to content

Commit 5e0b043

Browse files
committed
fix(icons): corrige migração dos ícones para v19
Corrige migração de todos os ícones corretamente para v19 fixes DTHFUI-10714
1 parent ea74b53 commit 5e0b043

File tree

2 files changed

+13
-176
lines changed

2 files changed

+13
-176
lines changed

projects/ui/schematics/ng-update/v19/changes.ts

Lines changed: 8 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { UpdateDependencies } from '@po-ui/ng-schematics/package-config';
44
const regexRemovePoIconInside = new RegExp('(?<=\\s|^)po-icon(?=\\s|$)', 'gmi');
55
const regexRemovePoIcon = new RegExp('(?<!<)po-icon(?=\\s|$|"|\')', 'gmi');
66

7+
const regexRemovePhIcon = new RegExp('(?<=\\s|^|["\'`])ph(?=\\s|$|["\'`])', 'gmi');
8+
const regexRemovePhHifenIcon = new RegExp('(?<=\\s|^|["\'`])ph-(?=\\w)', 'gmi');
9+
710
export const iconsReplaced: Array<ReplaceChanges> = [
811
{ replace: 'po-icon-a11y-elderly', replaceWith: 'an-elderly' },
912
{ replace: 'po-icon-a11y-pregnant', replaceWith: 'an-pregnant' },
@@ -179,181 +182,7 @@ export const iconsReplaced: Array<ReplaceChanges> = [
179182
{ replace: 'po-icon-world', replaceWith: 'an-globe' },
180183
{ replace: 'po-icon-xml', replaceWith: 'an-file-xml' },
181184
{ replace: 'po-icon-zoom-in', replaceWith: 'an-magnifying-glass-plus' },
182-
{ replace: 'po-icon-zoom-out', replaceWith: 'an-magnifying-glass-minus' },
183-
{ replace: 'ph-elderly', replaceWith: 'an-elderly' },
184-
{ replace: 'ph-pregnant', replaceWith: 'an-pregnant' },
185-
{ replace: 'ph-wheelchair', replaceWith: 'an-wheelchair' },
186-
{ replace: 'ph-plant', replaceWith: 'an-plant' },
187-
{ replace: 'ph-text-align-center', replaceWith: 'an-text-align-center' },
188-
{ replace: 'ph-text-align-justify', replaceWith: 'an-text-align-justify' },
189-
{ replace: 'ph-text-align-left', replaceWith: 'an-text-align-left' },
190-
{ replace: 'ph-text-align-right', replaceWith: 'an-text-align-right' },
191-
{ replace: 'ph-anchor', replaceWith: 'an-anchor' },
192-
{ replace: 'ph-archive', replaceWith: 'an-archive' },
193-
{ replace: 'ph-caret-down', replaceWith: 'an-caret-down' },
194-
{ replace: 'ph-caret-left', replaceWith: 'an-caret-left' },
195-
{ replace: 'ph-caret-right', replaceWith: 'an-caret-right' },
196-
{ replace: 'ph-caret-up', replaceWith: 'an-caret-up' },
197-
{ replace: 'ph-paperclip', replaceWith: 'an-paperclip' },
198-
{ replace: 'ph-automatic-barrier', replaceWith: 'an-automatic-barrier' },
199-
{ replace: 'ph-scales', replaceWith: 'an-scales' },
200-
{ replace: 'ph-balance-weight', replaceWith: 'an-balance-weight' },
201-
{ replace: 'ph-barcode', replaceWith: 'an-barcode' },
202-
{ replace: 'ph-basket', replaceWith: 'an-basket' },
203-
{ replace: 'ph-bluetooth', replaceWith: 'an-bluetooth' },
204-
{ replace: 'ph-book-bookmark', replaceWith: 'an-book-bookmark' },
205-
{ replace: 'ph-calculator', replaceWith: 'an-calculator' },
206-
{ replace: 'ph-calendar-dots', replaceWith: 'an-calendar-dots' },
207-
{ replace: 'ph-calendar-check', replaceWith: 'an-calendar-check' },
208-
{ replace: 'ph-calendar-gear', replaceWith: 'an-calendar-gear' },
209-
{ replace: 'ph-camera', replaceWith: 'an-camera' },
210-
{ replace: 'ph-shopping-cart-simple', replaceWith: 'an-shopping-cart-simple' },
211-
{ replace: 'ph-swap', replaceWith: 'an-swap' },
212-
{ replace: 'ph-chart-line', replaceWith: 'an-chart-line' },
213-
{ replace: 'ph-chart-bar', replaceWith: 'an-chart-bar' },
214-
{ replace: 'ph-chats', replaceWith: 'an-chats' },
215-
{ replace: 'ph-fill ph-x-circle', replaceWith: 'an-fill an-x-circle' },
216-
{ replace: 'ph-clipboard', replaceWith: 'an-clipboard' },
217-
{ replace: 'ph-clock', replaceWith: 'an-clock' },
218-
{ replace: 'ph-x', replaceWith: 'an-x' },
219-
{ replace: 'ph-building-apartment', replaceWith: 'an-building-apartment' },
220-
{ replace: 'ph-hard-hat', replaceWith: 'an-hard-hat' },
221-
{ replace: 'ph-copy', replaceWith: 'an-copy' },
222-
{ replace: 'ph-cotton', replaceWith: 'an-cotton' },
223-
{ replace: 'ph-credit-card', replaceWith: 'an-credit-card' },
224-
{ replace: 'ph-selection-background', replaceWith: 'an-selection-background' },
225-
{ replace: 'ph-database', replaceWith: 'an-database' },
226-
{ replace: 'ph-debit-card', replaceWith: 'an-debit-card' },
227-
{ replace: 'ph-trash', replaceWith: 'an-trash' },
228-
{ replace: 'ph-monitor', replaceWith: 'an-monitor' },
229-
{ replace: 'ph-laptop', replaceWith: 'an-laptop' },
230-
{ replace: 'ph-device-mobile', replaceWith: 'an-device-mobile' },
231-
{ replace: 'ph-device-tablet-speaker', replaceWith: 'an-device-tablet-speaker' },
232-
{ replace: 'ph-file-xls', replaceWith: 'an-file-xls' },
233-
{ replace: 'ph-file', replaceWith: 'an-file' },
234-
{ replace: 'ph-files', replaceWith: 'an-files' },
235-
{ replace: 'ph-file-text', replaceWith: 'an-file-text' },
236-
{ replace: 'ph-download-simple', replaceWith: 'an-download-simple' },
237-
{ replace: 'ph-pencil-simple', replaceWith: 'an-pencil-simple' },
238-
{ replace: 'ph-flask', replaceWith: 'an-flask' },
239-
{ replace: 'ph-warning-circle', replaceWith: 'an-warning-circle' },
240-
{ replace: 'ph-sign-out', replaceWith: 'an-sign-out' },
241-
{ replace: 'ph-arrow-square-out', replaceWith: 'an-arrow-square-out' },
242-
{ replace: 'ph-eye', replaceWith: 'an-eye' },
243-
{ replace: 'ph-eye-closed', replaceWith: 'an-eye-closed' },
244-
{ replace: 'ph-funnel', replaceWith: 'an-funnel' },
245-
{ replace: 'ph-currency-circle-dollar', replaceWith: 'an-currency-circle-dollar' },
246-
{ replace: 'ph-currency-btc', replaceWith: 'an-currency-btc' },
247-
{ replace: 'ph-currency-dollar-simple', replaceWith: 'an-currency-dollar-simple' },
248-
{ replace: 'ph-caret-double-left', replaceWith: 'an-caret-double-left' },
249-
{ replace: 'ph-folder', replaceWith: 'an-folder' },
250-
{ replace: 'ph-fork-knife', replaceWith: 'an-fork-knife' },
251-
{ replace: 'ph-fork-knife', replaceWith: 'an-fork-knife' },
252-
{ replace: 'ph-gas-pump', replaceWith: 'an-gas-pump' },
253-
{ replace: 'ph-gift', replaceWith: 'an-gift' },
254-
{ replace: 'ph-squares-four', replaceWith: 'an-squares-four' },
255-
{ replace: 'ph-handshake', replaceWith: 'an-handshake' },
256-
{ replace: 'ph-hard-drive-disk', replaceWith: 'an-hard-drive-disk' },
257-
{ replace: 'ph-question', replaceWith: 'an-question' },
258-
{ replace: 'ph-clock-counter-clockwise', replaceWith: 'an-clock-counter-clockwise' },
259-
{ replace: 'ph-house-line', replaceWith: 'an-house-line' },
260-
{ replace: 'ph-image-align-inline', replaceWith: 'an-image-align-inline' },
261-
{ replace: 'ph-image-align-left', replaceWith: 'an-image-align-left' },
262-
{ replace: 'ph-image-align-right', replaceWith: 'an-image-align-right' },
263-
{ replace: 'ph-info', replaceWith: 'an-info' },
264-
{ replace: 'ph-syringe', replaceWith: 'an-syringe' },
265-
{ replace: 'ph-keyboard', replaceWith: 'an-keyboard' },
266-
{ replace: 'ph-caret-double-right', replaceWith: 'an-caret-double-right' },
267-
{ replace: 'ph-stack-simple', replaceWith: 'an-stack-simple' },
268-
{ replace: 'ph-lightbulb', replaceWith: 'an-lightbulb' },
269-
{ replace: 'ph-heart', replaceWith: 'an-heart' },
270-
{ replace: 'ph-link', replaceWith: 'an-link' },
271-
{ replace: 'ph-list-bullets', replaceWith: 'an-list-bullets' },
272-
{ replace: 'ph-lock', replaceWith: 'an-lock' },
273-
{ replace: 'ph-lock-open', replaceWith: 'an-lock-open' },
274-
{ replace: 'ph-envelope', replaceWith: 'an-envelope' },
275-
{ replace: 'ph-factory', replaceWith: 'an-factory' },
276-
{ replace: 'ph-map-trifold', replaceWith: 'an-map-trifold' },
277-
{ replace: 'ph-list', replaceWith: 'an-list' },
278-
{ replace: 'ph-menu-close', replaceWith: 'an-menu-close' },
279-
{ replace: 'ph-menu-open', replaceWith: 'an-menu-open' },
280-
{ replace: 'ph-chat', replaceWith: 'an-chat' },
281-
{ replace: 'ph-microphone', replaceWith: 'an-microphone' },
282-
{ replace: 'ph-minus', replaceWith: 'an-minus' },
283-
{ replace: 'ph-minus-circle', replaceWith: 'an-minus-circle' },
284-
{ replace: 'ph-money', replaceWith: 'an-money' },
285-
{ replace: 'ph-dots-three', replaceWith: 'an-dots-three' },
286-
{ replace: 'ph-dots-three-vertical', replaceWith: 'an-dots-three-vertical' },
287-
{ replace: 'ph-newspaper', replaceWith: 'an-newspaper' },
288-
{ replace: 'ph-cloud-slash', replaceWith: 'an-cloud-slash' },
289-
{ replace: 'ph-bell', replaceWith: 'an-bell' },
290-
{ replace: 'ph-drop', replaceWith: 'an-drop' },
291-
{ replace: 'ph-oil-magnifying-glass', replaceWith: 'an-oil-magnifying-glass' },
292-
{ replace: 'ph-check', replaceWith: 'an-check' },
293-
{ replace: 'ph-pallet-full', replaceWith: 'an-pallet-full' },
294-
{ replace: 'ph-pallet-partial', replaceWith: 'an-pallet-partial' },
295-
{ replace: 'ph-sliders-horizontal', replaceWith: 'an-sliders-horizontal' },
296-
{ replace: 'ph-selection-foreground', replaceWith: 'an-selection-foreground' },
297-
{ replace: 'ph-hand-coins', replaceWith: 'an-hand-coins' },
298-
{ replace: 'ph-file-pdf', replaceWith: 'an-file-pdf' },
299-
{ replace: 'ph-eyedropper', replaceWith: 'an-eyedropper' },
300-
{ replace: 'ph-image', replaceWith: 'an-image' },
301-
{ replace: 'ph-map-pin', replaceWith: 'an-map-pin' },
302-
{ replace: 'ph-pix-logo', replaceWith: 'an-pix-logo' },
303-
{ replace: 'ph-plus', replaceWith: 'an-plus' },
304-
{ replace: 'ph-circle', replaceWith: 'an-circle' },
305-
{ replace: 'ph-printer', replaceWith: 'an-printer' },
306-
{ replace: 'ph-shopping-cart-simple', replaceWith: 'an-shopping-cart-simple' },
307-
{ replace: 'ph-qr-code', replaceWith: 'an-qr-code' },
308-
{ replace: 'ph-arrows-clockwise', replaceWith: 'an-arrows-clockwise' },
309-
{ replace: 'ph-newspaper-clipping', replaceWith: 'an-newspaper-clipping' },
310-
{ replace: 'ph-corners-out', replaceWith: 'an-corners-out' },
311-
{ replace: 'ph-corners-in', replaceWith: 'an-corners-in' },
312-
{ replace: 'ph-magnifying-glass', replaceWith: 'an-magnifying-glass' },
313-
{ replace: 'ph-shield-check', replaceWith: 'an-shield-check' },
314-
{ replace: 'ph-server', replaceWith: 'an-server' },
315-
{ replace: 'ph-gear', replaceWith: 'an-gear' },
316-
{ replace: 'ph-share', replaceWith: 'an-share' },
317-
{ replace: 'ph-radio-signal', replaceWith: 'an-radio-signal' },
318-
{ replace: 'ph-chat-dots', replaceWith: 'an-chat-dots' },
319-
{ replace: 'ph-github-logo', replaceWith: 'an-github-logo' },
320-
{ replace: 'ph-instagram-logo', replaceWith: 'an-instagram-logo' },
321-
{ replace: 'ph-x-logo', replaceWith: 'an-x-logo' },
322-
{ replace: 'ph-whatsapp-logo', replaceWith: 'an-whatsapp-logo' },
323-
{ replace: 'ph-arrows-down-up', replaceWith: 'an-arrows-down-up' },
324-
{ replace: 'ph-arrow-down', replaceWith: 'an-arrow-down' },
325-
{ replace: 'ph-sort-ascending', replaceWith: 'an-sort-ascending' },
326-
{ replace: 'ph-arrow-up', replaceWith: 'an-arrow-up' },
327-
{ replace: 'ph-sort-descending', replaceWith: 'an-sort-descending' },
328-
{ replace: 'ph-fill ph-star', replaceWith: 'an-fill an-star' },
329-
{ replace: 'ph-fill ph-star-half', replaceWith: 'an-fill ph-star-half' },
330-
{ replace: 'ph-steering-wheel', replaceWith: 'an-steering-wheel' },
331-
{ replace: 'ph-package', replaceWith: 'an-package' },
332-
{ replace: 'ph-desk', replaceWith: 'an-desk' },
333-
{ replace: 'ph-target', replaceWith: 'an-target' },
334-
{ replace: 'ph-phone', replaceWith: 'an-phone' },
335-
{ replace: 'ph-text-b', replaceWith: 'an-text-b' },
336-
{ replace: 'ph-text-italic', replaceWith: 'an-text-italic' },
337-
{ replace: 'ph-text-underline', replaceWith: 'an-text-underline' },
338-
{ replace: 'ph-hand-tap', replaceWith: 'an-hand-tap' },
339-
{ replace: 'ph-suitcase-rolling', replaceWith: 'an-suitcase-rolling' },
340-
{ replace: 'ph-truck', replaceWith: 'an-truck' },
341-
{ replace: 'ph-upload-simple', replaceWith: 'an-upload-simple' },
342-
{ replace: 'ph-cloud-arrow-up', replaceWith: 'an-cloud-arrow-up' },
343-
{ replace: 'ph-user', replaceWith: 'an-user' },
344-
{ replace: 'ph-user-plus', replaceWith: 'an-user-plus' },
345-
{ replace: 'ph-user-x', replaceWith: 'an-user-x' },
346-
{ replace: 'ph-users', replaceWith: 'an-users' },
347-
{ replace: 'ph-video-camera', replaceWith: 'an-video-camera' },
348-
{ replace: 'ph-waiter', replaceWith: 'an-waiter' },
349-
{ replace: 'ph-wallet', replaceWith: 'an-wallet' },
350-
{ replace: 'ph-warehouse', replaceWith: 'an-warehouse' },
351-
{ replace: 'ph-warning-circle', replaceWith: 'an-warning-circle' },
352-
{ replace: 'ph-weight', replaceWith: 'an-weight' },
353-
{ replace: 'ph-globe', replaceWith: 'an-globe' },
354-
{ replace: 'ph-file-xml', replaceWith: 'an-file-xml' },
355-
{ replace: 'ph-magnifying-glass-plus', replaceWith: 'an-magnifying-glass-plus' },
356-
{ replace: 'ph-magnifying-glass-minus', replaceWith: 'an-magnifying-glass-minus' }
185+
{ replace: 'po-icon-zoom-out', replaceWith: 'an-magnifying-glass-minus' }
357186
];
358187

359188
export interface ReplaceChanges {
@@ -376,3 +205,7 @@ export const updateDepedenciesVersion: UpdateDependencies = {
376205
export const poIconInsideReplaces: Array<ReplaceChanges> = [{ replace: regexRemovePoIconInside, replaceWith: '' }];
377206

378207
export const poIconReplaces: Array<ReplaceChanges> = [{ replace: regexRemovePoIcon, replaceWith: '' }];
208+
209+
export const phIconReplaces: Array<ReplaceChanges> = [{ replace: regexRemovePhIcon, replaceWith: 'an' }];
210+
211+
export const phIconHifenReplaces: Array<ReplaceChanges> = [{ replace: regexRemovePhHifenIcon, replaceWith: 'an-' }];

projects/ui/schematics/ng-update/v19/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
1+
import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
22
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
33

44
import { updatePackageJson } from '@po-ui/ng-schematics/package-config';
@@ -11,6 +11,8 @@ import {
1111
import { addProviderToModule } from '@schematics/angular/utility/ast-utils';
1212
import {
1313
iconsReplaced,
14+
phIconHifenReplaces,
15+
phIconReplaces,
1416
poIconInsideReplaces,
1517
poIconReplaces,
1618
ReplaceChanges,
@@ -253,6 +255,8 @@ function applyUpdateInContent(tree: Tree, path: string) {
253255
// Atualiza para as instâncias dos novos ícones
254256
updated = replaceWithChanges(poIconInsideReplaces, updated);
255257
updated = replaceWithChanges(poIconReplaces, updated);
258+
updated = replaceWithChanges(phIconReplaces, updated);
259+
updated = replaceWithChanges(phIconHifenReplaces, updated);
256260

257261
const icons = iconsReplaced.filter((icon: any) => updated.includes(icon.replace));
258262

0 commit comments

Comments
 (0)