From d6ca20cf1150c6831ecfa449b0b2e8ab80c828a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Greg=C3=B3rio?= Date: Tue, 1 Jul 2025 15:47:07 -0300 Subject: [PATCH] feat(angular): deve ser utilizado o Angular v20 --- .eslintrc.json | 3 +- .github/workflows/ci.yml | 14 +- .../workflows/publish_po_angular_ci-beta.yml | 2 +- .../publish_po_angular_ci-latest.yml | 2 +- .../workflows/publish_po_angular_ci-next.yml | 2 +- README.md | 32 +- angular.json | 26 ++ docs/guides/getting-started.md | 32 +- docs/guides/migration-poui.md | 6 +- docs/guides/releases.md | 5 + docs/guides/sync-get-started.md | 59 ++-- package.json | 59 ++-- projects/code-editor/package.json | 8 +- projects/schematics/package.json | 6 +- projects/storage/package.json | 4 +- .../src/lib/services/po-storage.service.ts | 6 +- projects/sync/package.json | 4 +- projects/sync/schematics/migrations.json | 5 + .../sync/schematics/ng-update/v20/changes.ts | 12 + .../sync/schematics/ng-update/v20/index.ts | 16 + projects/templates/package.json | 18 +- .../po-page-change-password.component.spec.ts | 4 +- .../po-page-login-popover.component.spec.ts | 4 +- .../po-page-login.component.spec.ts | 4 +- projects/ui/package.json | 24 +- projects/ui/schematics/migrations.json | 5 + ...tyle__.template => app.__style__.template} | 0 ...ponent.html.template => app.html.template} | 0 ....spec.ts.template => app.spec.ts.template} | 8 +- ....component.ts.template => app.ts.template} | 6 +- ...tyle__.template => app.__style__.template} | 0 ...ponent.html.template => app.html.template} | 0 ....spec.ts.template => app.spec.ts.template} | 9 +- ....component.ts.template => app.ts.template} | 12 +- .../ui/schematics/ng-update/v20/changes.ts | 211 ++++++++++++ projects/ui/schematics/ng-update/v20/index.ts | 308 ++++++++++++++++++ .../po-combo/po-combo.component.spec.ts | 4 +- .../po-decimal/po-decimal.component.spec.ts | 4 +- .../po-icon/po-icon.component.spec.ts | 2 +- .../po-list-view.component.spec.ts | 4 +- .../po-navbar-item.component.spec.ts | 4 +- .../po-navbar-items.component.spec.ts | 4 +- .../po-slide-control.component.spec.ts | 4 +- .../po-slide-item.component.spec.ts | 4 +- .../po-tag/po-tag.component.spec.ts | 5 +- .../po-theme/po-theme.service.spec.ts | 3 +- .../lib/services/po-theme/po-theme.service.ts | 3 +- projects/ui/tsconfig.dts.json | 11 + 48 files changed, 789 insertions(+), 179 deletions(-) create mode 100644 projects/sync/schematics/ng-update/v20/changes.ts create mode 100644 projects/sync/schematics/ng-update/v20/index.ts rename projects/ui/schematics/ng-generate/sidemenu/files-standalone/{app.component.__style__.template => app.__style__.template} (100%) rename projects/ui/schematics/ng-generate/sidemenu/files-standalone/{app.component.html.template => app.html.template} (100%) rename projects/ui/schematics/ng-generate/sidemenu/files-standalone/{app.component.spec.ts.template => app.spec.ts.template} (71%) rename projects/ui/schematics/ng-generate/sidemenu/files-standalone/{app.component.ts.template => app.ts.template} (82%) rename projects/ui/schematics/ng-generate/sidemenu/files/{app.component.__style__.template => app.__style__.template} (100%) rename projects/ui/schematics/ng-generate/sidemenu/files/{app.component.html.template => app.html.template} (100%) rename projects/ui/schematics/ng-generate/sidemenu/files/{app.component.spec.ts.template => app.spec.ts.template} (79%) rename projects/ui/schematics/ng-generate/sidemenu/files/{app.component.ts.template => app.ts.template} (52%) create mode 100644 projects/ui/schematics/ng-update/v20/changes.ts create mode 100644 projects/ui/schematics/ng-update/v20/index.ts create mode 100644 projects/ui/tsconfig.dts.json diff --git a/.eslintrc.json b/.eslintrc.json index 8f775a9702..c0b84a0abc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -274,7 +274,8 @@ "space-in-parens": ["off", "never"], "@angular-eslint/prefer-standalone": "off", "@typescript-eslint/no-unsafe-function-type": "off", - "@typescript-eslint/no-empty-object-type": "off" + "@typescript-eslint/no-empty-object-type": "off", + "@angular-eslint/prefer-inject": "off" } }, { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42aa8eb7a3..82e7f9f2ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 # Executa um comando do projeto na máquina virtual - run: npm i @@ -65,7 +65,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run build @@ -88,7 +88,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run test:ui @@ -105,7 +105,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run build:ui:lite @@ -123,7 +123,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run test:code-editor @@ -140,7 +140,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run build:schematics @@ -158,7 +158,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - run: npm i - run: npm run build:storage:lite diff --git a/.github/workflows/publish_po_angular_ci-beta.yml b/.github/workflows/publish_po_angular_ci-beta.yml index 2d434fa05c..71250623e5 100644 --- a/.github/workflows/publish_po_angular_ci-beta.yml +++ b/.github/workflows/publish_po_angular_ci-beta.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Check out po-angular diff --git a/.github/workflows/publish_po_angular_ci-latest.yml b/.github/workflows/publish_po_angular_ci-latest.yml index 9cb17c79e6..2e661c4524 100644 --- a/.github/workflows/publish_po_angular_ci-latest.yml +++ b/.github/workflows/publish_po_angular_ci-latest.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Check out po-angular diff --git a/.github/workflows/publish_po_angular_ci-next.yml b/.github/workflows/publish_po_angular_ci-next.yml index c75eaab121..295ed5b9df 100644 --- a/.github/workflows/publish_po_angular_ci-next.yml +++ b/.github/workflows/publish_po_angular_ci-next.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Check out po-angular diff --git a/README.md b/README.md index 2e772ac6a4..82ef1f9d66 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,16 @@ Biblioteca de componentes de UI para Angular. ### Pré-requisitos -Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 18.19.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. +Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 20.11.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. Instalando com npm: ``` -npm i -g @angular/cli@19 +npm i -g @angular/cli@20 ``` Caso prefira instalar com o yarn: ``` -yarn global add @angular/cli@19 +yarn global add @angular/cli@20 ``` ### Passo 1 - Crie o seu primeiro projeto @@ -53,26 +53,26 @@ Veja abaixo a lista de dependências e as versões compatíveis, elas devem ser ```json "dependencies": { - "@angular/animations": "~19.0.0", - "@angular/common": "~19.0.0", - "@angular/compiler": "~19.0.0", - "@angular/core": "~19.0.0", - "@angular/forms": "~19.0.0", - "@angular/platform-browser": "~19.0.0", - "@angular/platform-browser-dynamic": "~19.0.0", - "@angular/router": "~19.0.0", + "@angular/animations": "~20.0.0", + "@angular/common": "~20.0.0", + "@angular/compiler": "~20.0.0", + "@angular/core": "~20.0.0", + "@angular/forms": "~20.0.0", + "@angular/platform-browser": "~20.0.0", + "@angular/platform-browser-dynamic": "~20.0.0", + "@angular/router": "~20.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" ... }, "devDependencies": { - "@angular-devkit/build-angular": "~19.2.3", - "@angular-devkit/schematics": "~19.0.5", - "@angular/cli": "~19.0.5", - "@angular/compiler-cli": "~19.0.0", + "@angular/build": "~20.0.6", + "@angular-devkit/schematics": "~20.0.0", + "@angular/cli": "~20.0.6", + "@angular/compiler-cli": "~20.0.0", ... - "typescript": "~5.6.2" + "typescript": "~5.8.2" } ``` diff --git a/angular.json b/angular.json index e23f75bcb6..e64238d454 100644 --- a/angular.json +++ b/angular.json @@ -366,5 +366,31 @@ "cli": { "analytics": false, "schematicCollections": ["@angular-eslint/schematics"] + }, + "schematics": { + "@schematics/angular:component": { + "type": "component" + }, + "@schematics/angular:directive": { + "type": "directive" + }, + "@schematics/angular:service": { + "type": "service" + }, + "@schematics/angular:guard": { + "typeSeparator": "." + }, + "@schematics/angular:interceptor": { + "typeSeparator": "." + }, + "@schematics/angular:module": { + "typeSeparator": "." + }, + "@schematics/angular:pipe": { + "typeSeparator": "." + }, + "@schematics/angular:resolver": { + "typeSeparator": "." + } } } diff --git a/docs/guides/getting-started.md b/docs/guides/getting-started.md index dff1f9f929..01c95da2d3 100644 --- a/docs/guides/getting-started.md +++ b/docs/guides/getting-started.md @@ -3,16 +3,16 @@ ### Pré-requisitos -Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 18.19.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. +Para começar a utilizar o **PO UI** é pré-requisito ter o `Node.js` instalado (versão 20.11.x ou acima) e o seu gerenciador de pacote favorito na versão mais atual. Caso você ainda não tenha instalado o pacote `@angular/cli`, instale-o via `npm` ou `yarn`. Instalando com npm: ``` -npm i -g @angular/cli@19 +npm i -g @angular/cli@20 ``` Caso prefira instalar com o yarn: ``` -yarn global add @angular/cli@19 +yarn global add @angular/cli@20 ``` ### Passo 1 - Crie o seu primeiro projeto @@ -36,26 +36,26 @@ Veja abaixo a lista de dependências e as versões compatíveis, elas devem ser ```json "dependencies": { - "@angular/animations": "~19.0.0", - "@angular/common": "~19.0.0", - "@angular/compiler": "~19.0.0", - "@angular/core": "~19.0.0", - "@angular/forms": "~19.0.0", - "@angular/platform-browser": "~19.0.0", - "@angular/platform-browser-dynamic": "~19.0.0", - "@angular/router": "~19.0.0", + "@angular/animations": "~20.0.0", + "@angular/common": "~20.0.0", + "@angular/compiler": "~20.0.0", + "@angular/core": "~20.0.0", + "@angular/forms": "~20.0.0", + "@angular/platform-browser": "~20.0.0", + "@angular/platform-browser-dynamic": "~20.0.0", + "@angular/router": "~20.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" ... }, "devDependencies": { - "@angular-devkit/build-angular": "~19.2.3", - "@angular-devkit/schematics": "~19.0.5", - "@angular/cli": "~19.0.5", - "@angular/compiler-cli": "~19.0.0", + "@angular/build": "~20.0.6", + "@angular-devkit/schematics": "~20.0.0", + "@angular/cli": "~20.0.6", + "@angular/compiler-cli": "~20.0.0", ... - "typescript": "~5.6.2" + "typescript": "~5.8.2" } ``` diff --git a/docs/guides/migration-poui.md b/docs/guides/migration-poui.md index e1075d8293..7399cd9c18 100644 --- a/docs/guides/migration-poui.md +++ b/docs/guides/migration-poui.md @@ -13,7 +13,7 @@ Antes de atualizar a versão do PO UI, é importante que você tenha atualizado o Angular que o PO UI está homologado, veja nossa [tabela de compatibilidade](https://github.com/po-ui/po-angular/wiki#vers%C3%B5es-angular-x-po-ui) em nosso Github Wiki. -> Caso o seu projeto esteja na versão Angular@16: +> Caso o seu projeto esteja na versão Angular@19: Realize a instalação do pacote Schematics do Angular para o nosso script de atualização funcionar corretamente: ``` @@ -29,7 +29,7 @@ ng update @angular/cli@ @angular/core@ --force Por exemplo: ``` -ng update @angular/cli@19 @angular/core@19 --force +ng update @angular/cli@20 @angular/core@20 --force ``` > Para realizar a migração completa e avaliar se não precisa fazer alguma alteração veja o [**Guia de Upgrade do Angular**](https://update.angular.io/). @@ -70,7 +70,7 @@ ng update @po-ui/ng-components --allow-dirty --force ```json "devDependencies": { ..., - "@angular-devkit/schematics": "~19.0.5", + "@angular-devkit/schematics": "~20.0.0", ... } ``` diff --git a/docs/guides/releases.md b/docs/guides/releases.md index 3e11fd021a..c0164b7cac 100644 --- a/docs/guides/releases.md +++ b/docs/guides/releases.md @@ -38,6 +38,11 @@ Consulte abaixo nossos guias de migração de versão para obter mais informaç + + 20.0.0 + 20.0.0 + Migração do PO UI + 19.0.0 19.0.0 diff --git a/docs/guides/sync-get-started.md b/docs/guides/sync-get-started.md index 7d132008ec..b914c3c8f5 100644 --- a/docs/guides/sync-get-started.md +++ b/docs/guides/sync-get-started.md @@ -9,9 +9,9 @@ Para maiores detalhes sobre os serviços e métodos utilizados neste tutorial, c ### Pré-requisitos - [Node.js e NPM](https://nodejs.org/en/) -- [Angular CLI](https://cli.angular.io/) (~19.0.0): +- [Angular CLI](https://cli.angular.io/) (~20.0.0): - ```shell - npm install -g @angular/cli@19 + npm install -g @angular/cli@20 ``` - [Ionic](https://ionicframework.com/docs/cli/) (^7.2.0): - ```shell @@ -49,32 +49,37 @@ Antes de executar a instalação, é necessário que todas as dependências do p ```json ... "dependencies": { - "@angular/animations": "~19.0.0", - "@angular/common": "~19.0.0", - "@angular/compiler": "~19.0.0", - "@angular/core": "~19.0.0", - "@angular/forms": "~19.0.0", - "@angular/platform-browser": "~19.0.0", - "@angular/platform-browser-dynamic": "~19.0.0", - "@angular/router": "~19.0.0", - "@angular/service-worker": "~19.0.0", - "@ionic/angular": "^8.0.0", - "@capacitor/network": "^6.0.1", - "@capacitor/splash-screen": "^6.0.1", - "@capacitor/status-bar": "6.0.0", + "@angular/animations": "~20.0.0", + "@angular/common": "~20.0.0", + "@angular/compiler": "~20.0.0", + "@angular/core": "~20.0.0", + "@angular/forms": "~20.0.0", + "@angular/platform-browser": "~20.0.0", + "@angular/platform-browser-dynamic": "~20.0.0", + "@angular/router": "~20.0.0", + "@capacitor/app": "7.0.2", + "@capacitor/core": "7.4.2", + "@capacitor/haptics": "7.0.2", + "@capacitor/keyboard": "7.0.2", + "@capacitor/splash-screen": "^7.0.2", + "@capacitor/status-bar": "7.0.2", + "@ionic/angular": "~8.0.0", + "ionicons": "^7.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" - ... }, "devDependencies": { - "@angular-devkit/build-angular": "~19.2.3", - "@angular-devkit/schematics": "~19.0.5", - "@angular/cli": "~19.0.5", - "@angular/compiler-cli": "~19.0.0", - "@angular/language-service": "~19.0.0", - "@ionic/angular-toolkit": "^11.0.1", - "typescript": "~5.6.2" + "@angular-devkit/build-angular": "~20.0.0", + "@angular-devkit/schematics": "~20.0.0", + ... + "@angular/cli": "~20.0.0", + "@angular/compiler-cli": "~20.0.0", + "@angular/language-service": "~20.0.0", + "@capacitor/cli": "7.4.2", + "@ionic/angular-toolkit": "^12.0.0", + ... + "typescript": "~5.8.0" }, ... ``` @@ -87,12 +92,6 @@ Execute o seguinte comando para instalar as dependências: npm install ``` -Após realizar a instalação, execute o seguinte comando: - -```shell -ionic cap sync -``` - ### Passo 3 - Instalando o po-sync Para instalar o `po-sync` no aplicativo execute o seguinte comando: @@ -388,6 +387,8 @@ Execute o comando `ionic serve` e verifique o funcionamento do aplicativo Ionic > Pode ocorrer o seguinte erro `TS2320: Interface 'HTMLIonIconElement' cannot simultaneously extend types 'IonIcon' and 'HTMLStencilElement'` por conta da versão do TypeScript (5.2.x) conforme esta [issue](https://github.com/ionic-team/ionicons/issues/1011), neste caso adicione no arquivo **tsconfig.json** `"skipLibCheck": true`. +> Ao executar um projeto standalone, pode ocorrer o seguinte erro: `[ERROR] Invalid project type: angular-standalone (project config: ./ionic.config.json).`. Para corrigir, edite o arquivo `ionic.config.json` e ajuste a propriedade `type` para o valor `angular`. + #### Passo 8.1 - Entendendo o funcionamento do `po-sync` - O aplicativo sincroniza os dados que estão no servidor através do método `PoSyncService.sync()`; diff --git a/package.json b/package.json index d44bb18f75..e2861e91a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "po-ui-sources", - "version": "19.26.0", + "version": "20.0.0", "description": "PO UI", "homepage": "https://po-ui.io", "license": "MIT", @@ -37,7 +37,7 @@ "test:code-editor:browse": "ng test code-editor --code-coverage --browsers=Chrome --source-map", "test:dev": "ng test --browsers=ChromeHeadless", "build:schematics": "cd ./projects/schematics && npm run build", - "build:ui": "ng build ui --configuration production && gulp build:schematics --lib ui && gulp replaceVersion && cd dist/ng-components && npm pack", + "build:ui": "ng build ui --configuration production && npm run create-definitions-typescript && gulp build:schematics --lib ui && gulp replaceVersion && cd dist/ng-components && npm pack", "build:ui:lite": "ng build ui --configuration production", "build:code-editor": "ng build code-editor --configuration production && gulp build:schematics --lib code-editor && gulp replaceVersion && cd dist/ng-code-editor && npm pack", "build:templates": "ng build templates --configuration production && gulp build:schematics --lib templates && gulp replaceVersion && cd dist/ng-templates && npm pack", @@ -61,22 +61,23 @@ "publish:schematics:local": "npm publish ./dist/ng-schematics --registry http://localhost:4873 --ignore-scripts", "publish:local": "npm run publish:schematics:local && npm run publish:ui:local && npm run publish:templates:local && npm run publish:code-editor:local && npm run publish:sync:local && npm run publish:storage:local", "prepare": "husky install", - "script:copy-icons": "node scripts/copy-icons.js" + "script:copy-icons": "node scripts/copy-icons.js", + "create-definitions-typescript": "tsc -p projects/ui/tsconfig.dts.json" }, "private": true, "dependencies": { - "@angular/animations": "~19.0.3", - "@angular/cdk": "~19.0.3", - "@angular/common": "~19.0.3", - "@angular/compiler": "~19.0.3", - "@angular/core": "~19.0.3", - "@angular/forms": "~19.0.3", - "@angular/platform-browser": "~19.0.3", - "@angular/platform-browser-dynamic": "~19.0.3", - "@angular/router": "~19.0.3", + "@angular/animations": "~20.0.6", + "@angular/cdk": "~20.0.4", + "@angular/common": "~20.0.6", + "@angular/compiler": "~20.0.6", + "@angular/core": "~20.0.6", + "@angular/forms": "~20.0.6", + "@angular/platform-browser": "~20.0.6", + "@angular/platform-browser-dynamic": "~20.0.6", + "@angular/router": "~20.0.6", "@capacitor/core": "5.7.2", "@capacitor/network": "^5.0.7", - "@po-ui/style": "19.26.0", + "@po-ui/style": "^20.0.0", "capitalize": "^2.0.4", "colors": "1.4.0", "core-js": "3.33.3", @@ -88,7 +89,7 @@ "localforage": "1.10.0", "lokijs": "1.5.12", "monaco-editor": "0.44.0", - "ngx-markdown": "^19.0.0", + "ngx-markdown": "^20.0.0", "run-sequence": "^2.2.1", "rxjs": "~7.8.1", "rxjs-compat": "~6.6.7", @@ -96,15 +97,15 @@ "zone.js": "~0.15.0" }, "devDependencies": { - "@angular-devkit/build-angular": "~19.2.3", - "@angular-eslint/builder": "^19.0.2", - "@angular-eslint/eslint-plugin": "^19.0.2", - "@angular-eslint/eslint-plugin-template": "^19.0.2", - "@angular-eslint/schematics": "^19.0.2", - "@angular-eslint/template-parser": "^19.0.2", - "@angular/cli": "~19.0.4", - "@angular/compiler-cli": "~19.0.3", - "@angular/language-service": "~19.0.3", + "@angular-devkit/build-angular": "~20.0.4", + "@angular-eslint/builder": "^20.1.1", + "@angular-eslint/eslint-plugin": "^20.1.1", + "@angular-eslint/eslint-plugin-template": "^20.1.1", + "@angular-eslint/schematics": "^20.1.1", + "@angular-eslint/template-parser": "^20.1.1", + "@angular/cli": "~20.0.4", + "@angular/compiler-cli": "~20.0.6", + "@angular/language-service": "~20.0.6", "@animaliads/animalia-icon": "1.0.2", "@commitlint/cli": "^18.4.3", "@commitlint/config-angular": "^18.4.3", @@ -114,18 +115,18 @@ "@types/node": "^20.10.0", "@types/resize-observer-browser": "^0.1.11", "@types/systemjs": "^6.13.5", - "@typescript-eslint/eslint-plugin": "^8.18.0", - "@typescript-eslint/parser": "^8.18.0", + "@typescript-eslint/eslint-plugin": "^8.33.1", + "@typescript-eslint/parser": "^8.33.1", "del": "^6.0.0", "dgeni": "file:libs/dgeni-0.4.15.tgz", "dgeni-packages": "file:libs/dgeni-packages-0.30.1.tgz", "dotenv": "^16.5.0", - "eslint": "^8.57.0", + "eslint": "^9.28.0", "eslint-plugin-import": "latest", "eslint-plugin-jsdoc": "latest", "eslint-plugin-prefer-arrow": "latest", "eslint-plugin-react": "latest", - "eslint-plugin-sonarjs": "^0.23.0", + "eslint-plugin-sonarjs": "3.0.4", "gulp": "^5.0.0", "gulp-tap": "^2.0.0", "husky": "^8.0.0", @@ -139,14 +140,14 @@ "karma-jasmine-html-reporter": "2.1.0", "lint-staged": "^15.1.0", "mkdirp": "3.0.1", - "ng-packagr": "~19.2.0", + "ng-packagr": "~20.0.1", "prettier": "^3.1.0", "rollup": "4.24.4", "sonarqube-scanner": "^4.2.2", "standard-version": "^9.5.0", "ts-node": "~10.9.1", "typemoq": "^2.1.0", - "typescript": "~5.6.3", + "typescript": "~5.8.3", "validate.js": "file:libs/validate.js-v0.13.2.tgz" }, "standard-version": { diff --git a/projects/code-editor/package.json b/projects/code-editor/package.json index 19e464f0d4..fec6a9557f 100644 --- a/projects/code-editor/package.json +++ b/projects/code-editor/package.json @@ -16,12 +16,12 @@ "monaco-editor": "0.44.0", "core-js": "^3.33.3", "intl": "^1.2.5", - "tslib": "^2.6.2" + "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/common": "^19", - "@angular/core": "^19", - "@angular/forms": "^19", + "@angular/common": "^20", + "@angular/core": "^20", + "@angular/forms": "^20", "@po-ui/ng-components": "0.0.0-PLACEHOLDER", "monaco-editor": "0.44.0", "zone.js": "~0.15.0" diff --git a/projects/schematics/package.json b/projects/schematics/package.json index d225c1dff8..81bb4aa19c 100644 --- a/projects/schematics/package.json +++ b/projects/schematics/package.json @@ -14,9 +14,9 @@ "postbuild": "gulp replaceVersion && cd ../../dist/ng-schematics && npm pack" }, "peerDependencies": { - "@angular-devkit/core": "^19", - "@angular-devkit/schematics": "^19", - "@schematics/angular": "^19" + "@angular-devkit/core": "^20", + "@angular-devkit/schematics": "^20", + "@schematics/angular": "^20" }, "dependencies": { "jsonc-parser": "^3.2.0" diff --git a/projects/storage/package.json b/projects/storage/package.json index e7654cea53..fa4c7c1e67 100644 --- a/projects/storage/package.json +++ b/projects/storage/package.json @@ -15,10 +15,10 @@ "custom-idle-queue": "3.0.1", "localforage": "1.10.0", "lokijs": "1.5.12", - "tslib": "^2.6.2" + "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/core": "^19", + "@angular/core": "^20", "custom-idle-queue": "3.0.1", "localforage": "1.10.0", "lokijs": "1.5.12", diff --git a/projects/storage/src/lib/services/po-storage.service.ts b/projects/storage/src/lib/services/po-storage.service.ts index 7a9de5e23d..031b835457 100644 --- a/projects/storage/src/lib/services/po-storage.service.ts +++ b/projects/storage/src/lib/services/po-storage.service.ts @@ -88,7 +88,7 @@ export const PO_STORAGE_CONFIG_TOKEN = new InjectionToken('PO_STORAGE_CONFIG_TOK export class PoStorageService { private driver: string = null; private idleQueue = new IdleQueue(); - private storagePromise: Promise; + private storagePromise: Promise; private lokijsDriver: PoLokiDriver; constructor(@Inject(PO_STORAGE_CONFIG_TOKEN) config?: PoStorageConfig) { @@ -351,10 +351,10 @@ export class PoStorageService { /** * Determina se o processo de inicialização do *driver* assíncrono foi concluído. * - * @returns {Promise} Promessa que é resolvida quando o processo de inicialização do *driver* assíncrono + * @returns {Promise} Promessa que é resolvida quando o processo de inicialização do *driver* assíncrono * for concluído. */ - ready(): Promise { + ready(): Promise { return this.storagePromise; } diff --git a/projects/sync/package.json b/projects/sync/package.json index 58bbb37ac6..aef625c29f 100644 --- a/projects/sync/package.json +++ b/projects/sync/package.json @@ -26,8 +26,8 @@ "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/core": "^19", - "@angular-devkit/schematics": "^19", + "@angular/core": "^20", + "@angular-devkit/schematics": "^20", "@capacitor/core": "^6.2.0", "@capacitor/network": "^6.0.1", "@po-ui/ng-storage": "0.0.0-PLACEHOLDER", diff --git a/projects/sync/schematics/migrations.json b/projects/sync/schematics/migrations.json index cba1e133d7..31de824d36 100644 --- a/projects/sync/schematics/migrations.json +++ b/projects/sync/schematics/migrations.json @@ -55,6 +55,11 @@ "version": "0.0.0-PLACEHOLDER", "description": "Atualiza @po-ui/ng-sync para v19", "factory": "./ng-update/v19/index" + }, + "migration-v20": { + "version": "0.0.0-PLACEHOLDER", + "description": "Atualiza @po-ui/ng-sync para v20", + "factory": "./ng-update/v20/index" } } } diff --git a/projects/sync/schematics/ng-update/v20/changes.ts b/projects/sync/schematics/ng-update/v20/changes.ts new file mode 100644 index 0000000000..197dbab8a9 --- /dev/null +++ b/projects/sync/schematics/ng-update/v20/changes.ts @@ -0,0 +1,12 @@ +import { UpdateDependencies } from '@po-ui/ng-schematics/package-config'; + +export const updateDepedenciesVersion: UpdateDependencies = { + dependencies: [ + '@po-ui/ng-components', + '@po-ui/ng-code-editor', + '@po-ui/ng-templates', + '@po-ui/ng-storage', + '@po-ui/ng-sync', + '@po-ui/style' + ] +}; diff --git a/projects/sync/schematics/ng-update/v20/index.ts b/projects/sync/schematics/ng-update/v20/index.ts new file mode 100644 index 0000000000..4a806ce232 --- /dev/null +++ b/projects/sync/schematics/ng-update/v20/index.ts @@ -0,0 +1,16 @@ +import { chain, Tree, SchematicContext } from '@angular-devkit/schematics'; +import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; + +import { updatePackageJson } from '@po-ui/ng-schematics/package-config'; + +import { updateDepedenciesVersion } from './changes'; + +export default function () { + return chain([updatePackageJson('0.0.0-PLACEHOLDER', updateDepedenciesVersion), postUpdate()]); +} + +function postUpdate() { + return (_: Tree, context: SchematicContext) => { + context.addTask(new NodePackageInstallTask()); + }; +} diff --git a/projects/templates/package.json b/projects/templates/package.json index d9becc16d7..0f9c4ed85b 100644 --- a/projects/templates/package.json +++ b/projects/templates/package.json @@ -13,17 +13,17 @@ "dependencies": { "@po-ui/ng-components": "0.0.0-PLACEHOLDER", "@po-ui/ng-schematics": "0.0.0-PLACEHOLDER", - "tslib": "^2.6.2" + "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/animations": "^19", - "@angular/common": "^19", - "@angular/compiler": "^19", - "@angular/core": "^19", - "@angular/forms": "^19", - "@angular/platform-browser": "^19", - "@angular/platform-browser-dynamic": "^19", - "@angular/router": "^19", + "@angular/animations": "^20", + "@angular/common": "^20", + "@angular/compiler": "^20", + "@angular/core": "^20", + "@angular/forms": "^20", + "@angular/platform-browser": "^20", + "@angular/platform-browser-dynamic": "^20", + "@angular/router": "^20", "@po-ui/ng-components": "0.0.0-PLACEHOLDER", "rxjs": "~7.8.1", "zone.js": "~0.15.0" diff --git a/projects/templates/src/lib/components/po-page-change-password/po-page-change-password.component.spec.ts b/projects/templates/src/lib/components/po-page-change-password/po-page-change-password.component.spec.ts index 3619f7282a..1ffcc77819 100644 --- a/projects/templates/src/lib/components/po-page-change-password/po-page-change-password.component.spec.ts +++ b/projects/templates/src/lib/components/po-page-change-password/po-page-change-password.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; -import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; +import { EventEmitter, NO_ERRORS_SCHEMA, provideNgReflectAttributes } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpClient, HttpHandler } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; @@ -25,7 +25,7 @@ describe('PoPageChangePasswordComponent:', () => { TestBed.configureTestingModule({ imports: [FormsModule, RouterTestingModule.withRoutes([]), PoModule, PoPageBackgroundModule], declarations: [PoPageChangePasswordComponent], - providers: [HttpClient, HttpHandler, PoPageChangePasswordService] + providers: [HttpClient, HttpHandler, PoPageChangePasswordService, provideNgReflectAttributes()] }).compileComponents(); })); diff --git a/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts b/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts index 5397900286..6f30d8e997 100644 --- a/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts +++ b/projects/templates/src/lib/components/po-page-login/po-page-login-popover/po-page-login-popover.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -13,7 +14,8 @@ describe('ThPageLoginPopoverComponent: ', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule.withRoutes([])], - declarations: [PoI18nPipe, PoPageLoginPopoverComponent] + declarations: [PoI18nPipe, PoPageLoginPopoverComponent], + providers: [provideNgReflectAttributes()] }).compileComponents(); })); diff --git a/projects/templates/src/lib/components/po-page-login/po-page-login.component.spec.ts b/projects/templates/src/lib/components/po-page-login/po-page-login.component.spec.ts index dc6889dbbc..bc3b863654 100644 --- a/projects/templates/src/lib/components/po-page-login/po-page-login.component.spec.ts +++ b/projects/templates/src/lib/components/po-page-login/po-page-login.component.spec.ts @@ -1,7 +1,7 @@ import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { HttpClient, HttpHandler } from '@angular/common/http'; -import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { NO_ERRORS_SCHEMA, provideNgReflectAttributes } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; import { @@ -48,7 +48,7 @@ describe('PoPageLoginComponent: ', () => { PoSelectComponent, PoSwitchComponent ], - providers: [HttpClient, HttpHandler, PoPageLoginService], + providers: [HttpClient, HttpHandler, PoPageLoginService, provideNgReflectAttributes()], schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); diff --git a/projects/ui/package.json b/projects/ui/package.json index ea7fc95410..6e1089b908 100644 --- a/projects/ui/package.json +++ b/projects/ui/package.json @@ -21,23 +21,23 @@ ] }, "dependencies": { - "@angular/cdk": "~19.0.3", + "@angular/cdk": "~20.0.3", "@po-ui/style": "0.0.0-PLACEHOLDER", "@po-ui/ng-schematics": "0.0.0-PLACEHOLDER", "echarts": "^5.6.0", - "tslib": "^2.6.2" + "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/animations": "^19", - "@angular/cdk": "^19", - "@angular/common": "^19", - "@angular/compiler": "^19", - "@angular/core": "^19", - "@angular/forms": "^19", - "@angular/platform-browser": "^19", - "@angular/platform-browser-dynamic": "^19", - "@angular/router": "^19", - "@angular-devkit/schematics": "^19", + "@angular/animations": "^20", + "@angular/cdk": "^20", + "@angular/common": "^20", + "@angular/compiler": "^20", + "@angular/core": "^20", + "@angular/forms": "^20", + "@angular/platform-browser": "^20", + "@angular/platform-browser-dynamic": "^20", + "@angular/router": "^20", + "@angular-devkit/schematics": "^20", "@po-ui/style": "0.0.0-PLACEHOLDER", "rxjs": "~7.8.1", "zone.js": "~0.15.0" diff --git a/projects/ui/schematics/migrations.json b/projects/ui/schematics/migrations.json index 9085cf87eb..d579f86b1d 100644 --- a/projects/ui/schematics/migrations.json +++ b/projects/ui/schematics/migrations.json @@ -55,6 +55,11 @@ "version": "19", "description": "Atualiza @po-ui/ng-components para v19", "factory": "./ng-update/v19/index" + }, + "migration-v20": { + "version": "20", + "description": "Atualiza @po-ui/ng-components para v20", + "factory": "./ng-update/v20/index" } } } diff --git a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.__style__.template b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.__style__.template similarity index 100% rename from projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.__style__.template rename to projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.__style__.template diff --git a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.html.template b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.html.template similarity index 100% rename from projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.html.template rename to projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.html.template diff --git a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.spec.ts.template b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.spec.ts.template similarity index 71% rename from projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.spec.ts.template rename to projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.spec.ts.template index 9b5a84bf5c..e9747c2727 100644 --- a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.spec.ts.template +++ b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.spec.ts.template @@ -1,18 +1,18 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; import { provideHttpClient } from '@angular/common/http'; -import { AppComponent } from './app.component'; +import { App } from './app'; -describe('AppComponent', () => { +describe('App', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [AppComponent], + imports: [App], providers: [provideHttpClient()], }).compileComponents(); })); it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); + const fixture = TestBed.createComponent(App); fixture.detectChanges(); const app = fixture.componentInstance; expect(app).toBeTruthy(); diff --git a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.ts.template b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.ts.template similarity index 82% rename from projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.ts.template rename to projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.ts.template index dab5dd15a8..48f6f5f0ca 100644 --- a/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.component.ts.template +++ b/projects/ui/schematics/ng-generate/sidemenu/files-standalone/app.ts.template @@ -16,10 +16,10 @@ import { PoMenuModule, PoPageModule ], - templateUrl: './app.component.html', - styleUrls: ['./app.component.css'], + templateUrl: './app.html', + styleUrls: ['./app.<%= style %>'], }) -export class AppComponent { +export class App { readonly menus: Array = [ { label: 'Home', action: this.onClick.bind(this) }, ]; diff --git a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.__style__.template b/projects/ui/schematics/ng-generate/sidemenu/files/app.__style__.template similarity index 100% rename from projects/ui/schematics/ng-generate/sidemenu/files/app.component.__style__.template rename to projects/ui/schematics/ng-generate/sidemenu/files/app.__style__.template diff --git a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.html.template b/projects/ui/schematics/ng-generate/sidemenu/files/app.html.template similarity index 100% rename from projects/ui/schematics/ng-generate/sidemenu/files/app.component.html.template rename to projects/ui/schematics/ng-generate/sidemenu/files/app.html.template diff --git a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.spec.ts.template b/projects/ui/schematics/ng-generate/sidemenu/files/app.spec.ts.template similarity index 79% rename from projects/ui/schematics/ng-generate/sidemenu/files/app.component.spec.ts.template rename to projects/ui/schematics/ng-generate/sidemenu/files/app.spec.ts.template index 433c89c1f1..c7d5ce58a8 100644 --- a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.spec.ts.template +++ b/projects/ui/schematics/ng-generate/sidemenu/files/app.spec.ts.template @@ -8,9 +8,9 @@ import { PoToolbarModule, } from '@po-ui/ng-components'; -import { AppComponent } from './app.component'; +import { App } from './app'; -describe('AppComponent', () => { +describe('App', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [ @@ -20,15 +20,14 @@ describe('AppComponent', () => { HttpClientTestingModule, RouterTestingModule, ], - declarations: [AppComponent], + declarations: [App], }).compileComponents(); })); it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); + const fixture = TestBed.createComponent(App); fixture.detectChanges(); const app = fixture.componentInstance; - expect(app).toBeTruthy(); }); }); diff --git a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.ts.template b/projects/ui/schematics/ng-generate/sidemenu/files/app.ts.template similarity index 52% rename from projects/ui/schematics/ng-generate/sidemenu/files/app.component.ts.template rename to projects/ui/schematics/ng-generate/sidemenu/files/app.ts.template index a6a4fad70f..6d99986da3 100644 --- a/projects/ui/schematics/ng-generate/sidemenu/files/app.component.ts.template +++ b/projects/ui/schematics/ng-generate/sidemenu/files/app.ts.template @@ -4,18 +4,16 @@ import { PoMenuItem } from '@po-ui/ng-components'; @Component({ selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.<%= style %>'], + templateUrl: './app.html', + styleUrls: ['./app.<%= style %>'], standalone: false }) -export class AppComponent { - +export class App { readonly menus: Array = [ - { label: 'Home', action: this.onClick.bind(this) } + { label: 'Home', action: this.onClick.bind(this) }, ]; private onClick() { - alert('Clicked in menu item') + alert('Clicked in menu item'); } - } diff --git a/projects/ui/schematics/ng-update/v20/changes.ts b/projects/ui/schematics/ng-update/v20/changes.ts new file mode 100644 index 0000000000..9215ad52bf --- /dev/null +++ b/projects/ui/schematics/ng-update/v20/changes.ts @@ -0,0 +1,211 @@ +import { UpdateDependencies } from '@po-ui/ng-schematics/package-config'; + +//regex para remover po-icon +const regexRemovePoIconInside = new RegExp('(?<=\\s|^)po-icon(?=\\s|$)', 'gmi'); +const regexRemovePoIcon = new RegExp('(? = [ + { replace: 'po-icon-a11y-elderly', replaceWith: 'an-elderly' }, + { replace: 'po-icon-a11y-pregnant', replaceWith: 'an-pregnant' }, + { replace: 'po-icon-a11y-wheelchair', replaceWith: 'an-wheelchair' }, + { replace: 'po-icon-agro-business', replaceWith: 'an-plant' }, + { replace: 'po-icon-align-center', replaceWith: 'an-text-align-center' }, + { replace: 'po-icon-align-justify', replaceWith: 'an-text-align-justify' }, + { replace: 'po-icon-align-left', replaceWith: 'an-text-align-left' }, + { replace: 'po-icon-align-right', replaceWith: 'an-text-align-right' }, + { replace: 'po-icon-anchor', replaceWith: 'an-anchor' }, + { replace: 'po-icon-archive', replaceWith: 'an-archive' }, + { replace: 'po-icon-arrow-down', replaceWith: 'an-caret-down' }, + { replace: 'po-icon-arrow-left', replaceWith: 'an-caret-left' }, + { replace: 'po-icon-arrow-right', replaceWith: 'an-caret-right' }, + { replace: 'po-icon-arrow-up', replaceWith: 'an-caret-up' }, + { replace: 'po-icon-attach', replaceWith: 'an-paperclip' }, + { replace: 'po-icon-automatic-barrier', replaceWith: 'an-automatic-barrier' }, + { replace: 'po-icon-balance', replaceWith: 'an-scales' }, + { replace: 'po-icon-balance-weight', replaceWith: 'an-balance-weight' }, + { replace: 'po-icon-bar-code', replaceWith: 'an-barcode' }, + { replace: 'po-icon-basket', replaceWith: 'an-basket' }, + { replace: 'po-icon-bluetooth', replaceWith: 'an-bluetooth' }, + { replace: 'po-icon-book', replaceWith: 'an-book-bookmark' }, + { replace: 'po-icon-calculator', replaceWith: 'an-calculator' }, + { replace: 'po-icon-calendar', replaceWith: 'an-calendar-dots' }, + { replace: 'po-icon-calendar-ok', replaceWith: 'an-calendar-check' }, + { replace: 'po-icon-calendar-settings', replaceWith: 'an-calendar-gear' }, + { replace: 'po-icon-camera', replaceWith: 'an-camera' }, + { replace: 'po-icon-cart', replaceWith: 'an-shopping-cart-simple' }, + { replace: 'po-icon-change', replaceWith: 'an-swap' }, + { replace: 'po-icon-chart-area', replaceWith: 'an-chart-line' }, + { replace: 'po-icon-chart-columns', replaceWith: 'an-chart-bar' }, + { replace: 'po-icon-chat', replaceWith: 'an-chats' }, + { replace: 'po-icon-clear-content', replaceWith: 'an-fill an-x-circle', fill: true }, + { replace: 'po-icon-clipboard', replaceWith: 'an-clipboard' }, + { replace: 'po-icon-clock', replaceWith: 'an-clock' }, + { replace: 'po-icon-close', replaceWith: 'an-x' }, + { replace: 'po-icon-company', replaceWith: 'an-building-apartment' }, + { replace: 'po-icon-construction', replaceWith: 'an-hard-hat' }, + { replace: 'po-icon-copy', replaceWith: 'an-copy' }, + { replace: 'po-icon-cotton', replaceWith: 'an-cotton' }, + { replace: 'po-icon-credit-payment', replaceWith: 'an-credit-card' }, + { replace: 'po-icon-cut', replaceWith: 'an-selection-background' }, + { replace: 'po-icon-database', replaceWith: 'an-database' }, + { replace: 'po-icon-debit-payment', replaceWith: 'an-debit-card' }, + { replace: 'po-icon-delete', replaceWith: 'an-trash' }, + { replace: 'po-icon-device-desktop', replaceWith: 'an-monitor' }, + { replace: 'po-icon-device-notebook', replaceWith: 'an-laptop' }, + { replace: 'po-icon-device-smartphone', replaceWith: 'an-device-mobile' }, + { replace: 'po-icon-device-tablet', replaceWith: 'an-device-tablet-speaker' }, + { replace: 'po-icon-doc-xls', replaceWith: 'an-file-xls' }, + { replace: 'po-icon-document', replaceWith: 'an-file' }, + { replace: 'po-icon-document-double', replaceWith: 'an-files' }, + { replace: 'po-icon-document-filled', replaceWith: 'an-file-text' }, + { replace: 'po-icon-download', replaceWith: 'an-download-simple' }, + { replace: 'po-icon-edit', replaceWith: 'an-pencil-simple' }, + { replace: 'po-icon-exam', replaceWith: 'an-flask' }, + { replace: 'po-icon-exclamation', replaceWith: 'an-warning-circle' }, + { replace: 'po-icon-exit', replaceWith: 'an-sign-out' }, + { replace: 'po-icon-export', replaceWith: 'an-arrow-square-out' }, + { replace: 'po-icon-eye', replaceWith: 'an-eye' }, + { replace: 'po-icon-eye-off', replaceWith: 'an-eye-closed' }, + { replace: 'po-icon-filter', replaceWith: 'an-funnel' }, + { replace: 'po-icon-finance', replaceWith: 'an-currency-circle-dollar' }, + { replace: 'po-icon-finance-bitcoin', replaceWith: 'an-currency-btc' }, + { replace: 'po-icon-finance-secure', replaceWith: 'an-currency-dollar-simple' }, + { replace: 'po-icon-first-page', replaceWith: 'an-caret-double-left' }, + { replace: 'po-icon-folder', replaceWith: 'an-folder' }, + { replace: 'po-icon-food', replaceWith: 'an-fork-knife' }, + { replace: 'po-icon-food-menu', replaceWith: 'an-fork-knife' }, + { replace: 'po-icon-gas', replaceWith: 'an-gas-pump' }, + { replace: 'po-icon-gift', replaceWith: 'an-gift' }, + { replace: 'po-icon-grid', replaceWith: 'an-squares-four' }, + { replace: 'po-icon-handshake', replaceWith: 'an-handshake' }, + { replace: 'po-icon-hdd', replaceWith: 'an-hard-drive-disk' }, + { replace: 'po-icon-help', replaceWith: 'an-question' }, + { replace: 'po-icon-history', replaceWith: 'an-clock-counter-clockwise' }, + { replace: 'po-icon-home', replaceWith: 'an-house-line' }, + { replace: 'po-icon-image-align-inline', replaceWith: 'an-image-align-inline' }, + { replace: 'po-icon-image-align-left', replaceWith: 'an-image-align-left' }, + { replace: 'po-icon-image-align-right', replaceWith: 'an-image-align-right' }, + { replace: 'po-icon-info', replaceWith: 'an-info' }, + { replace: 'po-icon-injector', replaceWith: 'an-syringe' }, + { replace: 'po-icon-keyboard', replaceWith: 'an-keyboard' }, + { replace: 'po-icon-last-page', replaceWith: 'an-caret-double-right' }, + { replace: 'po-icon-layers', replaceWith: 'an-stack-simple' }, + { replace: 'po-icon-light', replaceWith: 'an-lightbulb' }, + { replace: 'po-icon-like', replaceWith: 'an-heart' }, + { replace: 'po-icon-link', replaceWith: 'an-link' }, + { replace: 'po-icon-list', replaceWith: 'an-list-bullets' }, + { replace: 'po-icon-lock', replaceWith: 'an-lock' }, + { replace: 'po-icon-lock-off', replaceWith: 'an-lock-open' }, + { replace: 'po-icon-mail', replaceWith: 'an-envelope' }, + { replace: 'po-icon-manufacture', replaceWith: 'an-factory' }, + { replace: 'po-icon-map', replaceWith: 'an-map-trifold' }, + { replace: 'po-icon-menu', replaceWith: 'an-list' }, + { replace: 'po-icon-menu-close', replaceWith: 'an-menu-close' }, + { replace: 'po-icon-menu-open', replaceWith: 'an-menu-open' }, + { replace: 'po-icon-message', replaceWith: 'an-chat' }, + { replace: 'po-icon-microphone', replaceWith: 'an-microphone' }, + { replace: 'po-icon-minus', replaceWith: 'an-minus' }, + { replace: 'po-icon-minus-circle', replaceWith: 'an-minus-circle' }, + { replace: 'po-icon-money', replaceWith: 'an-money' }, + { replace: 'po-icon-more', replaceWith: 'an-dots-three' }, + { replace: 'po-icon-more-vert', replaceWith: 'an-dots-three-vertical' }, + { replace: 'po-icon-news', replaceWith: 'an-newspaper' }, + { replace: 'po-icon-no-signal', replaceWith: 'an-cloud-slash' }, + { replace: 'po-icon-notification', replaceWith: 'an-bell' }, + { replace: 'po-icon-oil', replaceWith: 'an-drop' }, + { replace: 'po-icon-oil-analysis', replaceWith: 'an-oil-magnifying-glass' }, + { replace: 'po-icon-ok', replaceWith: 'an-check' }, + { replace: 'po-icon-pallet-full', replaceWith: 'an-pallet-full' }, + { replace: 'po-icon-pallet-partial', replaceWith: 'an-pallet-partial' }, + { replace: 'po-icon-parameters', replaceWith: 'an-sliders-horizontal' }, + { replace: 'po-icon-paste', replaceWith: 'an-selection-foreground' }, + { replace: 'po-icon-payment', replaceWith: 'an-hand-coins' }, + { replace: 'po-icon-pdf', replaceWith: 'an-file-pdf' }, + { replace: 'po-icon-picker', replaceWith: 'an-eyedropper' }, + { replace: 'po-icon-picture', replaceWith: 'an-image' }, + { replace: 'po-icon-pin', replaceWith: 'an-map-pin' }, + { replace: 'po-icon-pix-logo', replaceWith: 'an-pix-logo' }, + { replace: 'po-icon-plus', replaceWith: 'an-plus' }, + { replace: 'po-icon-plus-circle', replaceWith: 'an-circle' }, + { replace: 'po-icon-print', replaceWith: 'an-printer' }, + { replace: 'po-icon-pushcart', replaceWith: 'an-shopping-cart-simple' }, + { replace: 'po-icon-qr-code', replaceWith: 'an-qr-code' }, + { replace: 'po-icon-refresh', replaceWith: 'an-arrows-clockwise' }, + { replace: 'po-icon-sale', replaceWith: 'an-newspaper-clipping' }, + { replace: 'po-icon-screen-full', replaceWith: 'an-corners-out' }, + { replace: 'po-icon-screen-minimize', replaceWith: 'an-corners-in' }, + { replace: 'po-icon-search', replaceWith: 'an-magnifying-glass' }, + { replace: 'po-icon-security-guard', replaceWith: 'an-shield-check' }, + { replace: 'po-icon-server', replaceWith: 'an-server' }, + { replace: 'po-icon-settings', replaceWith: 'an-gear' }, + { replace: 'po-icon-share', replaceWith: 'an-share' }, + { replace: 'po-icon-signal', replaceWith: 'an-radio-signal' }, + { replace: 'po-icon-sms', replaceWith: 'an-chat-dots' }, + { replace: 'po-icon-social-github', replaceWith: 'an-github-logo' }, + { replace: 'po-icon-social-instagram', replaceWith: 'an-instagram-logo' }, + { replace: 'po-icon-social-twitter', replaceWith: 'an-x-logo' }, + { replace: 'po-icon-social-whatsapp', replaceWith: 'an-whatsapp-logo' }, + { replace: 'po-icon-sort', replaceWith: 'an-arrows-down-up' }, + { replace: 'po-icon-sort-asc', replaceWith: 'an-arrow-down' }, + { replace: 'po-icon-sort-ascending', replaceWith: 'an-sort-ascending' }, + { replace: 'po-icon-sort-desc', replaceWith: 'an-arrow-up' }, + { replace: 'po-icon-sort-descending', replaceWith: 'an-sort-descending' }, + { replace: 'po-icon-star', replaceWith: 'an-star' }, + { replace: 'po-icon-star-filled', replaceWith: 'an-fill an-star', fill: true }, + { replace: 'po-icon-star-half', replaceWith: 'an-fill an-star-half', fill: true }, + { replace: 'po-icon-steering-wheel', replaceWith: 'an-steering-wheel' }, + { replace: 'po-icon-stock', replaceWith: 'an-package' }, + { replace: 'po-icon-table', replaceWith: 'an-desk' }, + { replace: 'po-icon-target', replaceWith: 'an-target' }, + { replace: 'po-icon-telephone', replaceWith: 'an-phone' }, + { replace: 'po-icon-text-bold', replaceWith: 'an-text-b' }, + { replace: 'po-icon-text-italic', replaceWith: 'an-text-italic' }, + { replace: 'po-icon-text-underline', replaceWith: 'an-text-underline' }, + { replace: 'po-icon-touch', replaceWith: 'an-hand-tap' }, + { replace: 'po-icon-travel', replaceWith: 'an-suitcase-rolling' }, + { replace: 'po-icon-truck', replaceWith: 'an-truck' }, + { replace: 'po-icon-upload', replaceWith: 'an-upload-simple' }, + { replace: 'po-icon-upload-cloud', replaceWith: 'an-cloud-arrow-up' }, + { replace: 'po-icon-user', replaceWith: 'an-user' }, + { replace: 'po-icon-user-add', replaceWith: 'an-user-plus' }, + { replace: 'po-icon-user-delete', replaceWith: 'an-user-x' }, + { replace: 'po-icon-users', replaceWith: 'an-users' }, + { replace: 'po-icon-video-call', replaceWith: 'an-video-camera' }, + { replace: 'po-icon-waiter', replaceWith: 'an-waiter' }, + { replace: 'po-icon-wallet', replaceWith: 'an-wallet' }, + { replace: 'po-icon-warehouse', replaceWith: 'an-warehouse' }, + { replace: 'po-icon-warning', replaceWith: 'an-warning-circle' }, + { replace: 'po-icon-weight', replaceWith: 'an-weight' }, + { replace: 'po-icon-world', replaceWith: 'an-globe' }, + { replace: 'po-icon-xml', replaceWith: 'an-file-xml' }, + { replace: 'po-icon-zoom-in', replaceWith: 'an-magnifying-glass-plus' }, + { replace: 'po-icon-zoom-out', replaceWith: 'an-magnifying-glass-minus' } +]; + +export interface ReplaceChanges { + replace: string | RegExp; + replaceWith: string | Function; + fill?: boolean; +} + +export const updateDepedenciesVersion: UpdateDependencies = { + dependencies: [ + '@po-ui/ng-components', + '@po-ui/ng-code-editor', + '@po-ui/ng-templates', + '@po-ui/ng-storage', + '@po-ui/ng-sync', + '@po-ui/style' + ] +}; + +export const poIconInsideReplaces: Array = [{ replace: regexRemovePoIconInside, replaceWith: '' }]; + +export const poIconReplaces: Array = [{ replace: regexRemovePoIcon, replaceWith: '' }]; + +export const phIconReplaces: Array = [{ replace: regexRemovePhIcon, replaceWith: 'an' }]; + +export const phIconHifenReplaces: Array = [{ replace: regexRemovePhHifenIcon, replaceWith: 'an-' }]; diff --git a/projects/ui/schematics/ng-update/v20/index.ts b/projects/ui/schematics/ng-update/v20/index.ts new file mode 100644 index 0000000000..772ad33b5d --- /dev/null +++ b/projects/ui/schematics/ng-update/v20/index.ts @@ -0,0 +1,308 @@ +import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; +import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; + +import { updatePackageJson } from '@po-ui/ng-schematics/package-config'; + +import { + getProjectFromWorkspace, + getProjectMainFile, + getWorkspaceConfigGracefully +} from '@po-ui/ng-schematics/project'; +import { addProviderToModule } from '@schematics/angular/utility/ast-utils'; +import { + iconsReplaced, + phIconHifenReplaces, + phIconReplaces, + poIconInsideReplaces, + poIconReplaces, + ReplaceChanges, + updateDepedenciesVersion +} from './changes'; + +import { getSourceFile } from '@po-ui/ng-schematics/module'; +import { getAppModulePath, isStandaloneApp } from '@schematics/angular/utility/ng-ast-utils'; +import { WorkspaceSchema } from '@schematics/angular/utility/workspace-models'; + +import * as readline from 'readline'; + +const IconsDictionaryName = 'ICONS_DICTIONARY'; +const poIconDictionary = 'PoIconDictionary'; +const poModuleSourcePath = '@po-ui/ng-components'; + +const newProviderDictionary = ` + { + provide: 'ICONS_DICTIONARY', + useValue: 'PoIconDictionary' + }`; + +function askQuestion(query: string): Promise { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + return new Promise(resolve => + rl.question(query, (answer: any) => { + rl.close(); + resolve(answer); + }) + ); +} + +async function main(options: any): Promise { + const configureNewIcon = await askQuestion( + 'A Lib de ícones PO Icon está depreciada e será removida na versão 20, gostaria de usar a nova lib?(yes/no)' + ); + + if ( + configureNewIcon.toLowerCase() === 'yes' || + configureNewIcon.toLowerCase() === 'y' || + configureNewIcon.toLowerCase() === 'sim' || + configureNewIcon.toLowerCase() === '' + ) { + return chain([updatePackageJson('0.0.0-PLACEHOLDER', updateDepedenciesVersion), createUpgradeRule(), postUpdate()]); + } else { + return chain([ + updatePackageJson('0.0.0-PLACEHOLDER', updateDepedenciesVersion), + addImportOnly(options, [IconsDictionaryName, poIconDictionary], poModuleSourcePath), + addProviderToAppModule(options, newProviderDictionary), + updateAppConfigFileRule(), + postUpdate() + ]); + } +} + +export default function (options: any): Rule { + return (_tree: Tree, _context: SchematicContext) => main(options); +} + +export function addImportOnly(_: any, moduleNames: string | Array, importPath: string) { + return (host: Tree) => { + const workspace = getWorkspaceConfigGracefully(host) ?? ({} as WorkspaceSchema); + + const projectNames = Object.keys(workspace.projects); + for (const projectName of projectNames) { + const project: any = getProjectFromWorkspace(workspace, projectName); + + const browserEntryPoint = getProjectMainFile(project); + + if (isStandaloneApp(host, browserEntryPoint)) { + return host; + } + + const modulePath = getAppModulePath(host, browserEntryPoint); + let importStatement: string; + + if (Array.isArray(moduleNames)) { + const names = moduleNames.join(', '); + importStatement = `import { ${names} } from '${importPath}';\n`; + } else { + importStatement = `import { ${moduleNames} } from '${importPath}';\n`; + } + + const recorder = host.beginUpdate(modulePath); + recorder.insertLeft(0, importStatement); + host.commitUpdate(recorder); + } + return host; + }; +} + +export function addProviderToAppModule(_: any, provider: { provide: string; useValue: string } | string) { + return (host: Tree) => { + const workspace = getWorkspaceConfigGracefully(host) ?? ({} as WorkspaceSchema); + const projectNames = Object.keys(workspace.projects); + for (const projectName of projectNames) { + const project: any = getProjectFromWorkspace(workspace, projectName); + const browserEntryPoint = getProjectMainFile(project); + + if (isStandaloneApp(host, browserEntryPoint)) { + return host; + } + + const appModulePath = getAppModulePath(host, browserEntryPoint); + + addProviderToModuleProvider(host, appModulePath, provider); + } + return host; + }; +} + +// para inserir variáveis no provider +export function addProviderToModuleProvider( + tree: Tree, + modulePath: string, + provider: { provide: string; useValue: string } | string +) { + const moduleSource = getSourceFile(tree, modulePath); + const changes = addProviderToModule( + moduleSource as any, + modulePath, + ` + ${provider}`, + null as any + ); + + return insertChanges(tree, changes, modulePath); +} + +function insertChanges(tree: Tree, changes: Array, modulePath: string) { + const recorder = tree.beginUpdate(modulePath); + + changes.forEach(change => { + if (change) { + recorder.insertLeft(change.pos, change.toAdd); + } + }); + + tree.commitUpdate(recorder); +} + +function updateAppConfigFileRule(): Rule { + return (tree: Tree) => { + const workspace = getWorkspaceConfigGracefully(tree) ?? ({} as WorkspaceSchema); + const projectNames = Object.keys(workspace.projects); + + for (const projectName of projectNames) { + const project: any = getProjectFromWorkspace(workspace, projectName); + const browserEntryPoint = getProjectMainFile(project); + + if (!isStandaloneApp(tree, browserEntryPoint)) { + return tree; + } + + const content = tree.read('src/app/app.config.ts')?.toString('utf-8') || ''; + + const conteudoModificado = updateAppConfigFile(content); + + tree.overwrite('src/app/app.config.ts', conteudoModificado); + } + return tree; + }; +} + +export function updateAppConfigFile(content: string): string { + const newImports = `import { ICONS_DICTIONARY, PoIconDictionary } from '@po-ui/ng-components';`; + + const newProvider = ` + { + provide: ICONS_DICTIONARY, + useValue: PoIconDictionary + },`; + + // Verificar se já existe o import e o provider + const importExists = content.includes(newImports); + const providerExists = content.includes(newProvider.trim()); + + let modifiedContent = content; + + if (!importExists) { + // Adiciona o novo import + modifiedContent = modifiedContent.replace( + /import { ApplicationConfig,[^}]+} from '@angular\/core';/, + match => `${match}\n${newImports}` + ); + } + + if (!providerExists) { + // Adiciona o novo provider + modifiedContent = modifiedContent.replace(/providers: \[[^\]]+\]/, match => + match.replace('providers: [', `providers: [${newProvider}`) + ); + } + + return modifiedContent.trim(); +} + +function createUpgradeRule() { + return (tree: Tree, context: SchematicContext) => { + const logger = context.logger; + const workspace = getWorkspaceConfigGracefully(tree) ?? ({} as WorkspaceSchema); + + if (workspace === null) { + logger.error('Não foi possível encontrar o arquivo de configuração de workspace.'); + return; + } + + const projectNames = Object.keys(workspace.projects); + for (const projectName of projectNames) { + const project = workspace.projects[projectName]; + const entryFolderProject = project.projectType === 'library' ? 'lib' : 'app'; + const sourceDir = `${project.sourceRoot}/${entryFolderProject}`; + + applyUpdateInContent(tree, sourceDir); + } + }; +} + +function applyUpdateInContent(tree: Tree, path: string) { + const directory = tree.getDir(path); + + // Função recursiva para processar arquivos e subdiretórios + const processDirectory = (dir: any) => { + // Processa todos os arquivos no diretório atual + if (dir.subfiles.length) { + dir.subfiles.forEach((file: string) => { + const filePath = dir.path + '/' + file; + const content = tree.read(filePath)!.toString('utf-8'); + if (!content) { + return; + } + + let updated = content; + + if (file.endsWith('.html') || file.endsWith('.ts')) { + // Atualiza para as instâncias dos novos ícones + updated = replaceWithChanges(poIconInsideReplaces, updated); + updated = replaceWithChanges(poIconReplaces, updated); + updated = replaceWithChanges(phIconReplaces, updated); + updated = replaceWithChanges(phIconHifenReplaces, updated); + + const icons = iconsReplaced.filter((icon: any) => updated.includes(icon.replace)); + + icons.forEach(icon => { + const regexChange = new RegExp('(class="\\s?)?' + icon.replace + '(\\s?)?(?="|>|\\s|$|\'|")', 'gmi'); + + if (icon.fill) { + updated = replaceWithChanges([{ replace: regexChange, replaceWith: `$1${icon.replaceWith}$2` }], updated); + } else { + updated = replaceWithChanges( + [{ replace: regexChange, replaceWith: `$1an ${icon.replaceWith}$2` }], + updated + ); + } + }); + + if (updated !== content) { + tree.overwrite(filePath, updated); + } + } + }); + } + + // Processa subdiretórios recursivamente + if (dir.subdirs.length) { + dir.subdirs.forEach((subdir: string) => { + processDirectory(tree.getDir(dir.path + '/' + subdir)); + }); + } + }; + + // Inicia o processamento a partir do diretório especificado + processDirectory(directory); +} + +function replaceWithChanges(replaces: Array, content: string = '') { + replaces.forEach(({ replace, replaceWith }) => { + const regex = new RegExp(replace, 'gi'); + content = content.replace(regex, replaceWith); + }); + + return content; +} + +function postUpdate() { + return (_: Tree, context: SchematicContext) => { + context.addTask(new NodePackageInstallTask()); + }; +} diff --git a/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts b/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts index 88c2167967..00db11b311 100644 --- a/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts @@ -19,7 +19,7 @@ import { PoComboOption } from './interfaces/po-combo-option.interface'; import { PoCleanComponent } from '../po-clean/po-clean.component'; import { OverlayModule } from '@angular/cdk/overlay'; import { PoControlPositionService } from '../../../services/po-control-position/po-control-position.service'; -import { ElementRef } from '@angular/core'; +import { ElementRef, provideNgReflectAttributes } from '@angular/core'; import { PoKeyCodeEnum } from '../../../enums/po-key-code.enum'; const eventKeyBoard = document.createEvent('KeyboardEvent'); @@ -39,7 +39,7 @@ describe('PoComboComponent:', () => { await TestBed.configureTestingModule({ imports: [PoLoadingModule, PoIconModule, OverlayModule], declarations: [PoComboComponent, PoFieldContainerComponent, PoFieldContainerBottomComponent, PoCleanComponent], - providers: [HttpClient, HttpHandler, PoControlPositionService] + providers: [HttpClient, HttpHandler, PoControlPositionService, provideNgReflectAttributes()] }).compileComponents(); fixture = TestBed.createComponent(PoComboComponent); diff --git a/projects/ui/src/lib/components/po-field/po-decimal/po-decimal.component.spec.ts b/projects/ui/src/lib/components/po-field/po-decimal/po-decimal.component.spec.ts index 812ba8ddc9..2c52e93d02 100644 --- a/projects/ui/src/lib/components/po-field/po-decimal/po-decimal.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-decimal/po-decimal.component.spec.ts @@ -3,7 +3,7 @@ import { UntypedFormControl } from '@angular/forms'; import { expectPropertiesValues } from '../../../util-test/util-expect.spec'; -import { ElementRef } from '@angular/core'; +import { ElementRef, provideNgReflectAttributes } from '@angular/core'; import { of, Subscription } from 'rxjs'; import { PoLanguageService } from '../../../services'; import { PoIconModule } from '../../po-icon'; @@ -24,7 +24,7 @@ describe('PoDecimalComponent:', () => { TestBed.configureTestingModule({ imports: [PoIconModule], declarations: [PoDecimalComponent, PoFieldContainerComponent, PoCleanComponent, PoFieldContainerBottomComponent], - providers: [PoLanguageService] + providers: [PoLanguageService, provideNgReflectAttributes()] }).compileComponents(); })); diff --git a/projects/ui/src/lib/components/po-icon/po-icon.component.spec.ts b/projects/ui/src/lib/components/po-icon/po-icon.component.spec.ts index 51e7a07a2c..20f79b3328 100644 --- a/projects/ui/src/lib/components/po-icon/po-icon.component.spec.ts +++ b/projects/ui/src/lib/components/po-icon/po-icon.component.spec.ts @@ -5,7 +5,7 @@ import { PoIconComponent } from './po-icon.component'; import { ICONS_DICTIONARY, PoIconDictionary } from './po-icon-dictionary'; class TemplateA extends TemplateRef { - elementRef; + declare elementRef; createEmbeddedView(context) { return null; } diff --git a/projects/ui/src/lib/components/po-list-view/po-list-view.component.spec.ts b/projects/ui/src/lib/components/po-list-view/po-list-view.component.spec.ts index 1a1bc0d1ef..b3b00ec0cb 100644 --- a/projects/ui/src/lib/components/po-list-view/po-list-view.component.spec.ts +++ b/projects/ui/src/lib/components/po-list-view/po-list-view.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -23,7 +24,8 @@ describe('PoListViewComponent:', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [PoListViewComponent], - imports: [BrowserAnimationsModule, RouterTestingModule.withRoutes([]), PoButtonModule, PoPopupModule] + imports: [BrowserAnimationsModule, RouterTestingModule.withRoutes([]), PoButtonModule, PoPopupModule], + providers: [provideNgReflectAttributes()] }).compileComponents(); detail = { test: 'test' }; diff --git a/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-item/po-navbar-item.component.spec.ts b/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-item/po-navbar-item.component.spec.ts index 135254e70f..357566fb2e 100644 --- a/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-item/po-navbar-item.component.spec.ts +++ b/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-item/po-navbar-item.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterModule } from '@angular/router'; @@ -11,7 +12,8 @@ describe('PoNavbarItemComponent:', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [PoNavbarItemComponent], - imports: [RouterModule.forRoot([], {})] + imports: [RouterModule.forRoot([], {})], + providers: [provideNgReflectAttributes()] }).compileComponents(); fixture = TestBed.createComponent(PoNavbarItemComponent); diff --git a/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-items.component.spec.ts b/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-items.component.spec.ts index a7315df778..83e923ef0a 100644 --- a/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-items.component.spec.ts +++ b/projects/ui/src/lib/components/po-navbar/po-navbar-items/po-navbar-items.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NavigationCancel, NavigationEnd, RouterModule } from '@angular/router'; @@ -14,7 +15,8 @@ describe('PoNavbarItemsComponent:', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [PoNavbarItemsComponent, PoNavbarItemComponent], - imports: [RouterModule.forRoot([], {})] + imports: [RouterModule.forRoot([], {})], + providers: [provideNgReflectAttributes()] }).compileComponents(); })); diff --git a/projects/ui/src/lib/components/po-slide/po-slide-control/po-slide-control.component.spec.ts b/projects/ui/src/lib/components/po-slide/po-slide-control/po-slide-control.component.spec.ts index 04d22bc3d5..b78679545c 100644 --- a/projects/ui/src/lib/components/po-slide/po-slide-control/po-slide-control.component.spec.ts +++ b/projects/ui/src/lib/components/po-slide/po-slide-control/po-slide-control.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PoIconModule } from '../../po-icon'; @@ -11,7 +12,8 @@ describe('PoSlideControlComponent:', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [PoSlideControlComponent], - imports: [PoIconModule] + imports: [PoIconModule], + providers: [provideNgReflectAttributes()] }).compileComponents(); fixture = TestBed.createComponent(PoSlideControlComponent); diff --git a/projects/ui/src/lib/components/po-slide/po-slide-item/po-slide-item.component.spec.ts b/projects/ui/src/lib/components/po-slide/po-slide-item/po-slide-item.component.spec.ts index 99bbbfaeef..00e481113b 100644 --- a/projects/ui/src/lib/components/po-slide/po-slide-item/po-slide-item.component.spec.ts +++ b/projects/ui/src/lib/components/po-slide/po-slide-item/po-slide-item.component.spec.ts @@ -1,3 +1,4 @@ +import { provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; @@ -11,7 +12,8 @@ describe('PoSlideItemComponent:', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [RouterTestingModule.withRoutes([])], - declarations: [PoSlideItemComponent] + declarations: [PoSlideItemComponent], + providers: [provideNgReflectAttributes()] }).compileComponents(); fixture = TestBed.createComponent(PoSlideItemComponent); diff --git a/projects/ui/src/lib/components/po-tag/po-tag.component.spec.ts b/projects/ui/src/lib/components/po-tag/po-tag.component.spec.ts index b24b4d4b3a..a2b5d18a7e 100644 --- a/projects/ui/src/lib/components/po-tag/po-tag.component.spec.ts +++ b/projects/ui/src/lib/components/po-tag/po-tag.component.spec.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, provideNgReflectAttributes } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; @@ -35,7 +35,8 @@ describe('PoTagComponent:', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [PoTagComponent, PoTagClickableComponent], - imports: [PoIconModule, PoTooltipModule] + imports: [PoIconModule, PoTooltipModule], + providers: [provideNgReflectAttributes()] }).compileComponents(); fixture = TestBed.createComponent(PoTagComponent); diff --git a/projects/ui/src/lib/services/po-theme/po-theme.service.spec.ts b/projects/ui/src/lib/services/po-theme/po-theme.service.spec.ts index 5257b1361f..127327e221 100644 --- a/projects/ui/src/lib/services/po-theme/po-theme.service.spec.ts +++ b/projects/ui/src/lib/services/po-theme/po-theme.service.spec.ts @@ -1,5 +1,4 @@ -import { DOCUMENT } from '@angular/common'; -import { Renderer2, RendererFactory2, RendererStyleFlags2 } from '@angular/core'; +import { Renderer2, RendererFactory2, RendererStyleFlags2, DOCUMENT } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { ICONS_DICTIONARY, PoIconDictionary } from '../../components/po-icon'; import { PoThemeA11yEnum } from './enum/po-theme-a11y.enum'; diff --git a/projects/ui/src/lib/services/po-theme/po-theme.service.ts b/projects/ui/src/lib/services/po-theme/po-theme.service.ts index b75f12ee3c..9f5d169e95 100644 --- a/projects/ui/src/lib/services/po-theme/po-theme.service.ts +++ b/projects/ui/src/lib/services/po-theme/po-theme.service.ts @@ -1,5 +1,4 @@ -import { DOCUMENT } from '@angular/common'; -import { Inject, Injectable, Optional, Renderer2, RendererFactory2 } from '@angular/core'; +import { Inject, Injectable, Optional, Renderer2, RendererFactory2, DOCUMENT } from '@angular/core'; import { AnimaliaIconDictionary, ICONS_DICTIONARY } from '../../components/po-icon/index'; import { PoThemeA11yEnum } from './enum/po-theme-a11y.enum'; diff --git a/projects/ui/tsconfig.dts.json b/projects/ui/tsconfig.dts.json new file mode 100644 index 0000000000..ed6cb6dc74 --- /dev/null +++ b/projects/ui/tsconfig.dts.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declaration": true, + "declarationMap": false, + "emitDeclarationOnly": true, + "outDir": "../../dist/ng-components" + }, + "include": ["src/**/*.ts"], + "exclude": ["test.ts", "**/*.spec.ts", "**/*.e2e-spec.ts", "**/*.po.ts", "./node_modules/", "**/samples/**"] +}