From 545f291de18c09ea9a375ed92cb2ef57bb2c43e3 Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:33:33 -0400 Subject: [PATCH 01/38] fix(ColorPicker): remove unused deps (#1394) --- package-lock.json | 15 --------------- packages/geo/package.json | 1 - packages/geo/src/lib/draw/draw/draw.module.ts | 2 -- packages/geo/src/lib/layer/layer.module.ts | 3 --- packages/geo/src/lib/style/style.module.ts | 2 -- 5 files changed, 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index df3e78f69a..f541706ea8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19894,20 +19894,6 @@ "semver": "bin/semver.js" } }, - "node_modules/ngx-color-picker": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-14.0.0.tgz", - "integrity": "sha512-w28zx2DyVpIJeNsTB3T2LUI4Ed/Ujf5Uhxuh0dllputfpxXwZG9ocSJM/0L67+fxA3UnfvvXVZNUX1Ny5nZIIw==", - "peer": true, - "dependencies": { - "tslib": "^2.3.0" - }, - "peerDependencies": { - "@angular/common": ">=9.0.0", - "@angular/core": ">=9.0.0", - "@angular/forms": ">=9.0.0" - } - }, "node_modules/ngx-indexed-db": { "version": "11.0.2", "resolved": "https://registry.npmjs.org/ngx-indexed-db/-/ngx-indexed-db-11.0.2.tgz", @@ -28096,7 +28082,6 @@ "@igo2/utils": "^1.15.4", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", - "ngx-color-picker": "^14.0.0", "ngx-indexed-db": "^11.0.2", "ol": "^8.1.0", "ol-mapbox-style": "^12.0.0", diff --git a/packages/geo/package.json b/packages/geo/package.json index e37b8ee722..6bad36e87c 100644 --- a/packages/geo/package.json +++ b/packages/geo/package.json @@ -48,7 +48,6 @@ "proj4": "^2.9.0", "rxjs": "^7.8.0", "striptags": "^3.2.0", - "ngx-color-picker": "^14.0.0", "ngx-indexed-db": "^11.0.2" }, "optionalDependencies": { diff --git a/packages/geo/src/lib/draw/draw/draw.module.ts b/packages/geo/src/lib/draw/draw/draw.module.ts index 124f8c8822..6da2c4945f 100644 --- a/packages/geo/src/lib/draw/draw/draw.module.ts +++ b/packages/geo/src/lib/draw/draw/draw.module.ts @@ -14,7 +14,6 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatDividerModule } from '@angular/material/divider'; import { MatDialogModule } from '@angular/material/dialog'; import { MatCheckboxModule } from '@angular/material/checkbox'; -import { ColorPickerModule } from 'ngx-color-picker'; import { IgoLanguageModule } from '@igo2/core'; import { IgoEntityTableModule } from '@igo2/common'; @@ -52,7 +51,6 @@ import { MatRadioModule } from '@angular/material/radio'; MatDialogModule, IgoLanguageModule, IgoEntityTableModule, - ColorPickerModule, BrowserModule, BrowserAnimationsModule, MatRadioModule, diff --git a/packages/geo/src/lib/layer/layer.module.ts b/packages/geo/src/lib/layer/layer.module.ts index 2cdd14a6f8..e42af4af6b 100644 --- a/packages/geo/src/lib/layer/layer.module.ts +++ b/packages/geo/src/lib/layer/layer.module.ts @@ -15,8 +15,6 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatSliderModule } from '@angular/material/slider'; import { MatTooltipModule } from '@angular/material/tooltip'; -import { ColorPickerModule } from 'ngx-color-picker'; - import { IgoLanguageModule } from '@igo2/core'; import { IgoListModule, @@ -58,7 +56,6 @@ import { LayerLegendItemComponent } from './layer-legend-item/layer-legend-item. MatSliderModule, MatBadgeModule, MatCheckboxModule, - ColorPickerModule, IgoLanguageModule, IgoListModule, IgoCollapsibleModule, diff --git a/packages/geo/src/lib/style/style.module.ts b/packages/geo/src/lib/style/style.module.ts index 46908649a3..1579d28f2d 100644 --- a/packages/geo/src/lib/style/style.module.ts +++ b/packages/geo/src/lib/style/style.module.ts @@ -8,7 +8,6 @@ import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; import { MatTooltipModule } from '@angular/material/tooltip'; import { IgoLanguageModule } from '@igo2/core'; -import { ColorPickerModule } from 'ngx-color-picker'; import { IgoStyleListModule } from './style-list/style-list.module'; import { StyleModalDrawingComponent } from './style-modal/drawing/style-modal-drawing.component'; import { StyleModalLayerComponent } from './style-modal/layer/style-modal-layer.component'; @@ -20,7 +19,6 @@ import { ColorPickerFormFieldModule } from '@igo2/common'; @NgModule({ imports: [ - ColorPickerModule, CommonModule, FormsModule, IgoLanguageModule, From b9d98cee18096ed63fcc9820858e259cdca3efcc Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Tue, 19 Sep 2023 11:29:43 -0400 Subject: [PATCH 02/38] fix tsconfig for scripts --- scripts/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 4442bc0b2d..f0df337b2d 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -13,7 +13,7 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "NodeNext" }, "exclude": ["node_modules"] } From 47c7b0350793a19e91c3f07490766a208f31673e Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Tue, 19 Sep 2023 11:49:50 -0400 Subject: [PATCH 03/38] fix version scripts --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 416280ef5f..13fc879faf 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,8 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "changelog-current": "conventional-changelog -p angular -r 2", "publish": "gulp prepublishOnly && npm publish ./dist/utils && npm publish ./dist/core && npm publish ./dist/common && npm publish ./dist/auth && npm publish ./dist/geo && npm publish ./dist/context && npm publish ./dist/integration", - "preversion": "npm run test.all", - "preversion.linux": "npm run test.all", + "preversion": "npm run test && npm run e2e", + "preversion.linux": "npm run test && npm run e2e", "version": "gulp bumpVersion && rimraf ./dist && npm run build.all && npm run changelog && git add -u", "version.linux": "gulp bumpVersion && rimraf ./dist && npm run build.all && npm run changelog && git add -u", "postversion": "git push && git push --tags && npm run publish && npm run ghpages.win", From 1b0608453a12e006899d45088245686dfb95b81a Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Tue, 19 Sep 2023 12:04:33 -0400 Subject: [PATCH 04/38] 16.0.0-rc.0 --- CHANGELOG.md | 55 ++++++++++++++++++------- package-lock.json | 4 +- package.json | 2 +- packages/auth/package.json | 6 +-- packages/common/package.json | 6 +-- packages/context/package.json | 12 +++--- packages/core/package.json | 4 +- packages/core/src/lib/config/version.ts | 4 +- packages/geo/package.json | 8 ++-- packages/integration/package.json | 6 +-- packages/utils/package.json | 2 +- 11 files changed, 67 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 695ae79654..35b637b5cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,43 @@ -## [1.15.4](https://github.com/infra-geo-ouverte/igo2-lib/compare/1.15.2...1.15.4) (2023-07-05) - - -### Reverts - -* Revert "chore(searchSource): deletion of cadastre search source (#1152)" ([2e073d7](https://github.com/infra-geo-ouverte/igo2-lib/commit/2e073d71890d3b8aea68f84129f4600b9652d158)), closes [#1152](https://github.com/infra-geo-ouverte/igo2-lib/issues/1152) - - - -## [1.15.3](https://github.com/infra-geo-ouverte/igo2-lib/compare/1.15.2...1.15.3) (2023-06-12) - - -### Bug Fixes - -* **draw:** drawing circle crash whole drawing component. ([#1273](https://github.com/infra-geo-ouverte/igo2-lib/issues/1273)) ([e3ee3b5](https://github.com/infra-geo-ouverte/igo2-lib/commit/e3ee3b593e4afde201fc601373478aa8cf8556a3)) +# [16.0.0-rc.0](https://github.com/infra-geo-ouverte/igo2-lib/compare/1.15.2...16.0.0-rc.0) (2023-09-19) + + +### Bug Fixes + +* **catalog-library-item:** icon placement for external providers ([4b02550](https://github.com/infra-geo-ouverte/igo2-lib/commit/4b0255060405b8854c4686c07eac351aa4f759e8)) +* **catalog:** Composite catalog initialisation ([a6c6941](https://github.com/infra-geo-ouverte/igo2-lib/commit/a6c6941a52a71163c89086745a9a08826808f8cb)) +* **ColorPicker:** remove unused deps ([#1394](https://github.com/infra-geo-ouverte/igo2-lib/issues/1394)) ([545f291](https://github.com/infra-geo-ouverte/igo2-lib/commit/545f291de18c09ea9a375ed92cb2ef57bb2c43e3)) +* **directions:** padding for steps text ([a3b09a4](https://github.com/infra-geo-ouverte/igo2-lib/commit/a3b09a47dd9061d23af3071cb44fcad4b1dcfc8d)) +* **draw:** drawing circle crash whole drawing component. ([#1273](https://github.com/infra-geo-ouverte/igo2-lib/issues/1273)) ([3998dcc](https://github.com/infra-geo-ouverte/igo2-lib/commit/3998dccb9007a5fb4a2a98be492cca428417b5a0)) +* **EntityStore:** add strategy variant ([d28e9f3](https://github.com/infra-geo-ouverte/igo2-lib/commit/d28e9f39e35e9434920e254c1570bf89c978d545)) +* **EntityTable:** validate octal number ([#1293](https://github.com/infra-geo-ouverte/igo2-lib/issues/1293)) ([860ea7e](https://github.com/infra-geo-ouverte/igo2-lib/commit/860ea7ea773af1f6eb4796ef8d47b446e4bd1cc5)) +* **feature:** exported context with draw - radius is kept on context import ([#1380](https://github.com/infra-geo-ouverte/igo2-lib/issues/1380)) ([bf9ac19](https://github.com/infra-geo-ouverte/igo2-lib/commit/bf9ac19cd16adc95e17df7af86d942c30701cbba)) +* **geo,common:** create new color picker component ([#1368](https://github.com/infra-geo-ouverte/igo2-lib/issues/1368)) ([169379c](https://github.com/infra-geo-ouverte/igo2-lib/commit/169379ced1eaf30f98a60940670d1fb994207759)) +* **geo:** delete map legend after the printing from the DOM ([#1304](https://github.com/infra-geo-ouverte/igo2-lib/issues/1304)) ([d84a9e6](https://github.com/infra-geo-ouverte/igo2-lib/commit/d84a9e6608c08da02a7068a19542fa302b690073)) +* **geo:** google map links were not interpreted on mobile ([#1388](https://github.com/infra-geo-ouverte/igo2-lib/issues/1388)) ([a4da9c5](https://github.com/infra-geo-ouverte/igo2-lib/commit/a4da9c520a02a1863194fc31679fe5646defdbe4)) +* **geo:** Print without cursor position ([#1265](https://github.com/infra-geo-ouverte/igo2-lib/issues/1265)) ([e5592f8](https://github.com/infra-geo-ouverte/igo2-lib/commit/e5592f82636d57d591cc39898c278ee3374cdbdd)) +* https://github.com/angular/components/issues/27035 ([426204e](https://github.com/infra-geo-ouverte/igo2-lib/commit/426204e8b628a0c117d6e9d25c31ae6f7904b43c)) +* **ICherche:** add a custom cache hash to account for http params ([#1262](https://github.com/infra-geo-ouverte/igo2-lib/issues/1262)) ([776fc4b](https://github.com/infra-geo-ouverte/igo2-lib/commit/776fc4b0de39ab4b098d0872fb0991776ed2a503)), closes [infra-geo-ouverte/igo2#928](https://github.com/infra-geo-ouverte/igo2/issues/928) +* **integration:** import Action interface and add DatePipe in demo app.module to solve datepipe issue ([#1300](https://github.com/infra-geo-ouverte/igo2-lib/issues/1300)) ([459ee89](https://github.com/infra-geo-ouverte/igo2-lib/commit/459ee8939f474622a17cc8665133adf10f80397a)) +* **layer-list:** list on mobile was on 2 rows ([e3c825e](https://github.com/infra-geo-ouverte/igo2-lib/commit/e3c825e17b3822def32066dfdc8166ae020f7cc2)) +* **LayerContext:** subscribe once with first operator ([#1272](https://github.com/infra-geo-ouverte/igo2-lib/issues/1272)) ([b83ec47](https://github.com/infra-geo-ouverte/igo2-lib/commit/b83ec47f120153df05c36da19e60e96102066e0c)), closes [#1271](https://github.com/infra-geo-ouverte/igo2-lib/issues/1271) +* **pointer-summary:** error due layer creation when map is not ready ([87239f6](https://github.com/infra-geo-ouverte/igo2-lib/commit/87239f6b11cba16b97bea354482645e05edd9ef6)) +* **regex:** missing regexes for geoservice ([4bda3ce](https://github.com/infra-geo-ouverte/igo2-lib/commit/4bda3cebdf6e7f81fa24915f29e35b0efdf3a726)) +* **toggle buttons:** labels were before the toggle ([c87cb1f](https://github.com/infra-geo-ouverte/igo2-lib/commit/c87cb1faae444fa015f7176c81dc42221384c073)) + + +### Features + +* **context:** import export context in demo ([#1348](https://github.com/infra-geo-ouverte/igo2-lib/issues/1348)) ([41cfaa6](https://github.com/infra-geo-ouverte/igo2-lib/commit/41cfaa6b8a0f2bf0afde140ad483f5789ae770c3)) +* **context:** save layer opacity if export context ([#1322](https://github.com/infra-geo-ouverte/igo2-lib/issues/1322)) ([cdcfc9d](https://github.com/infra-geo-ouverte/igo2-lib/commit/cdcfc9d107c6c6996162b85502b70e1b67f4a2fb)) +* **context:** set map zoom level after importing context ([#1384](https://github.com/infra-geo-ouverte/igo2-lib/issues/1384)) ([c1a1491](https://github.com/infra-geo-ouverte/igo2-lib/commit/c1a1491a3a647fa6ce9db039f7789c4d222a4e1b)) +* **Debug:** add launch to debug in vscode with breakpoints ([#1299](https://github.com/infra-geo-ouverte/igo2-lib/issues/1299)) ([2ec8376](https://github.com/infra-geo-ouverte/igo2-lib/commit/2ec83760358ac1d38e67a76a419d4cdee7a2552d)) +* **geo:** add print route directions function ([#1289](https://github.com/infra-geo-ouverte/igo2-lib/issues/1289)) ([63a7435](https://github.com/infra-geo-ouverte/igo2-lib/commit/63a7435358bc278336341418135d36efc276b471)) +* **geo:** Added rotate option and north direction to the map when pr… ([#1256](https://github.com/infra-geo-ouverte/igo2-lib/issues/1256)) ([b79c7a0](https://github.com/infra-geo-ouverte/igo2-lib/commit/b79c7a012f2e95b12758a15116577c2a6f27337f)) +* **geo:** Print with resolution PDF and image ([#1264](https://github.com/infra-geo-ouverte/igo2-lib/issues/1264)) ([f492050](https://github.com/infra-geo-ouverte/igo2-lib/commit/f4920504e5190835312bfa3e4630aeac39da6047)) +* **iCherche:** add a config to hide advanced options ([#1386](https://github.com/infra-geo-ouverte/igo2-lib/issues/1386)) ([0fee36e](https://github.com/infra-geo-ouverte/igo2-lib/commit/0fee36eb34e64855ed4d10852286f8279b5225e2)) +* **SplashScreen:** add a replaceable image ([#1381](https://github.com/infra-geo-ouverte/igo2-lib/issues/1381)) ([1bc4bc7](https://github.com/infra-geo-ouverte/igo2-lib/commit/1bc4bc7798b484595ae9d0729fce0014a0a32d7a)) +* **workspace:** can now detect geoservice properties (wms...) to add/remove layer from workspace ([f49984f](https://github.com/infra-geo-ouverte/igo2-lib/commit/f49984ff80a3d069fa625f31c9a46c64254780d0)) +* **workspace:** workspaces table view are now printable ([#1291](https://github.com/infra-geo-ouverte/igo2-lib/issues/1291)) ([1b62cd4](https://github.com/infra-geo-ouverte/igo2-lib/commit/1b62cd48561682912738d88f3d60d030527fe4d2)) diff --git a/package-lock.json b/package-lock.json index f541706ea8..468794740e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@igo/demo", - "version": "1.15.4", + "version": "16.0.0-rc.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@igo/demo", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "workspaces": [ "./packages/*" diff --git a/package.json b/package.json index 13fc879faf..7ee7f8287d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "workspaces": [ "./packages/*" ], - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "license": "MIT", diff --git a/packages/auth/package.json b/packages/auth/package.json index 29b9dd9719..6bbfc02529 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/auth", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -26,8 +26,8 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/router": "^16.2.5", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "rxjs": "^7.5.6", "@azure/msal-angular": "^3.0.4" }, diff --git a/packages/common/package.json b/packages/common/package.json index f9a15dc5ec..6dc206c82b 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/common", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -26,8 +26,8 @@ "@angular/core": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "angular-shepherd": "16.0.0", "scroll-into-view-if-needed": "^3.0.0", "typy": "^3.3.0", diff --git a/packages/context/package.json b/packages/context/package.json index 9600bc4da9..5f42a03d59 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/context", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -20,11 +20,11 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/auth": "^1.15.4", - "@igo2/common": "^1.15.4", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", - "@igo2/geo": "^1.15.4", + "@igo2/auth": "^16.0.0-rc.0", + "@igo2/common": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", + "@igo2/geo": "^16.0.0-rc.0", "ol": "^8.1.0", "rxjs": "^7.8.0" }, diff --git a/packages/core/package.json b/packages/core/package.json index 309ed2a9b4..3c8438798b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/core", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -43,7 +43,7 @@ "@angular/core": "^16.2.5", "@angular/platform-browser": "^16.2.5", "@angular/router": "^16.2.5", - "@igo2/utils": "^1.15.4", + "@igo2/utils": "^16.0.0-rc.0", "rxjs": "^7.8.0", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0" diff --git a/packages/core/src/lib/config/version.ts b/packages/core/src/lib/config/version.ts index 544edc4859..889aa602ab 100644 --- a/packages/core/src/lib/config/version.ts +++ b/packages/core/src/lib/config/version.ts @@ -4,6 +4,6 @@ export interface Version { } export const version: Version = { - lib: '1.15.4', - releaseDate: 1689596479901 + lib: '16.0.0-rc.0', + releaseDate: 1695139270215 }; diff --git a/packages/geo/package.json b/packages/geo/package.json index 6bad36e87c..2bec7cac0f 100644 --- a/packages/geo/package.json +++ b/packages/geo/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/geo", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -38,9 +38,9 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/common": "^1.15.4", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/common": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", "ol": "^8.1.0", diff --git a/packages/integration/package.json b/packages/integration/package.json index 967fe5fe51..ae8ad17951 100644 --- a/packages/integration/package.json +++ b/packages/integration/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/integration", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -16,8 +16,8 @@ "peerDependencies": { "@angular/common": "^16.2.5", "@angular/core": "^16.2.5", - "@igo2/geo": "1.15.4", - "@igo2/context": "1.15.4", + "@igo2/geo": "16.0.0-rc.0", + "@igo2/context": "16.0.0-rc.0", "jspdf": "^2.5.1", "jspdf-autotable": "^3.5.29", "rxjs": "^7.8.0" diff --git a/packages/utils/package.json b/packages/utils/package.json index 0a414253ac..a9dcf35061 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/utils", - "version": "1.15.4", + "version": "16.0.0-rc.0", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], From 7567825c842a9a59c2ea8a44354156d9ede0ba1f Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Tue, 19 Sep 2023 12:15:24 -0400 Subject: [PATCH 05/38] fix scripts preghpages --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7ee7f8287d..074227b8e4 100644 --- a/package.json +++ b/package.json @@ -81,10 +81,10 @@ "version.linux": "gulp bumpVersion && rimraf ./dist && npm run build.all && npm run changelog && git add -u", "postversion": "git push && git push --tags && npm run publish && npm run ghpages.win", "postversion.linux": "git push && git push --tags && npm run publish && npm run ghpages", - "preghpages": "gulp bundleLocale && npm run build.ghpages && echo \"include: ['_default.json', '_contexts.json', '_base.json']\" > dist/ghpages/_config.yml", + "preghpages": "npm run build.ghpages && echo \"include: ['_default.json', '_contexts.json', '_base.json']\" > dist/ghpages/_config.yml", "ghpages": "VERSION=$(node -p -e \"require('./package.json').version\") && npx ngh --dir=dist/ghpages --no-silent=false --message=$VERSION", "postghpages": "rimraf ./dist/ghpages", - "preghpages.win": "gulp bundleLocale && npm run build.ghpages && echo include: ['_default.json', '_contexts.json', '_base.json'] > dist/ghpages/_config.yml", + "preghpages.win": "npm run build.ghpages && echo include: ['_default.json', '_contexts.json', '_base.json'] > dist/ghpages/_config.yml", "ghpages.win": "npx ngh --dir=dist/ghpages --no-silent=false --message=%npm_package_version%", "postghpages.win": "rimraf ./dist/ghpages" }, From a4be26ebbef5afe81e3e588fa99b2be77c26a3d4 Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Tue, 19 Sep 2023 16:43:13 -0400 Subject: [PATCH 06/38] feat(Prettier): be specific about the end of line --- .prettierrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index 32ebab4e50..b10dedda71 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,5 @@ { "singleQuote": true, - "trailingComma": "none" + "trailingComma": "none", + "endOfLine": "lf" } From a18905a57be9ea0ce120a50caf395b14f8a4cebc Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:32:34 -0400 Subject: [PATCH 07/38] fix(Openlayers): downgrade to 7.5.2 due to wms regression (#1402) --- package-lock.json | 67 ++++++++++++++++++++--------------- package.json | 2 +- packages/context/package.json | 2 +- packages/geo/package.json | 2 +- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 468794740e..42b5b52067 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "nosleep.js": "^0.12.0", - "ol": "^8.1.0", + "ol": "^7.5.2", "ol-mapbox-style": "^12.0.0", "proj4": "^2.9.0", "rxjs": "^7.8.0", @@ -20852,12 +20852,13 @@ "dev": true }, "node_modules/ol": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ol/-/ol-8.1.0.tgz", - "integrity": "sha512-cx3SH2plpFS9fM8pp1nCypgQXGJD7Mcb1E3mEySmy5XEw1DUEo+kkNzgtAZz5qupekqi7aU9iBJEjCoMfqvO2Q==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/ol/-/ol-7.5.2.tgz", + "integrity": "sha512-HJbb3CxXrksM6ct367LsP3N+uh+iBBMdP3DeGGipdV9YAYTP0vTJzqGnoqQ6C2IW4qf8krw9yuyQbc9fjOIaOQ==", "dependencies": { "earcut": "^2.2.3", "geotiff": "^2.0.7", + "ol-mapbox-style": "^10.1.0", "pbf": "3.2.1", "rbush": "^3.0.1" }, @@ -20878,6 +20879,16 @@ "ol": "8.x || 7.x" } }, + "node_modules/ol/node_modules/ol-mapbox-style": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-10.7.0.tgz", + "integrity": "sha512-S/UdYBuOjrotcR95Iq9AejGYbifKeZE85D9VtH11ryJLQPTZXZSW1J5bIXcr4AlAH6tyjPPHTK34AdkwB32Myw==", + "dependencies": { + "@mapbox/mapbox-gl-style-spec": "^13.23.1", + "mapbox-to-css-font": "^2.4.1", + "ol": "^7.3.0" + } + }, "node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -27950,7 +27961,7 @@ }, "packages/auth": { "name": "@igo2/auth", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "jwt-decode": "^2.2.0", @@ -27969,14 +27980,14 @@ "@angular/material": "^16.2.4", "@angular/router": "^16.2.5", "@azure/msal-angular": "^3.0.4", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "rxjs": "^7.5.6" } }, "packages/common": { "name": "@igo2/common", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "tslib": "^2.6.0" @@ -27989,8 +28000,8 @@ "@angular/core": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "angular-shepherd": "16.0.0", "scroll-into-view-if-needed": "^3.0.0", "tinycolor2": "^1.6.0", @@ -27999,7 +28010,7 @@ }, "packages/context": { "name": "@igo2/context", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "tslib": "^2.6.0" @@ -28014,18 +28025,18 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/auth": "^1.15.4", - "@igo2/common": "^1.15.4", - "@igo2/core": "^1.15.4", - "@igo2/geo": "^1.15.4", - "@igo2/utils": "^1.15.4", - "ol": "^8.1.0", + "@igo2/auth": "^16.0.0-rc.0", + "@igo2/common": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/geo": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", + "ol": "^7.5.2", "rxjs": "^7.8.0" } }, "packages/core": { "name": "@igo2/core", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "@ngx-translate/core": "^15.0.0", @@ -28040,7 +28051,7 @@ "@angular/core": "^16.2.5", "@angular/platform-browser": "^16.2.5", "@angular/router": "^16.2.5", - "@igo2/utils": "^1.15.4", + "@igo2/utils": "^16.0.0-rc.0", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "rxjs": "^7.8.0" @@ -28048,7 +28059,7 @@ }, "packages/geo": { "name": "@igo2/geo", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "@turf/helpers": "^6.5.0", @@ -28077,13 +28088,13 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/common": "^1.15.4", - "@igo2/core": "^1.15.4", - "@igo2/utils": "^1.15.4", + "@igo2/common": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.0", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", "ngx-indexed-db": "^11.0.2", - "ol": "^8.1.0", + "ol": "^7.5.2", "ol-mapbox-style": "^12.0.0", "proj4": "^2.9.0", "rxjs": "^7.8.0", @@ -28092,7 +28103,7 @@ }, "packages/integration": { "name": "@igo2/integration", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "tslib": "^2.6.0" @@ -28103,8 +28114,8 @@ "peerDependencies": { "@angular/common": "^16.2.5", "@angular/core": "^16.2.5", - "@igo2/context": "1.15.4", - "@igo2/geo": "1.15.4", + "@igo2/context": "16.0.0-rc.0", + "@igo2/geo": "16.0.0-rc.0", "jspdf": "^2.5.1", "jspdf-autotable": "^3.5.29", "rxjs": "^7.8.0" @@ -28112,7 +28123,7 @@ }, "packages/utils": { "name": "@igo2/utils", - "version": "1.15.4", + "version": "16.0.0-rc.0", "license": "MIT", "dependencies": { "bowser": "^2.10.0", diff --git a/package.json b/package.json index 074227b8e4..7e47650aef 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "nosleep.js": "^0.12.0", - "ol": "^8.1.0", + "ol": "^7.5.2", "ol-mapbox-style": "^12.0.0", "proj4": "^2.9.0", "rxjs": "^7.8.0", diff --git a/packages/context/package.json b/packages/context/package.json index 5f42a03d59..974306a434 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -25,7 +25,7 @@ "@igo2/core": "^16.0.0-rc.0", "@igo2/utils": "^16.0.0-rc.0", "@igo2/geo": "^16.0.0-rc.0", - "ol": "^8.1.0", + "ol": "^7.5.2", "rxjs": "^7.8.0" }, "dependencies": { diff --git a/packages/geo/package.json b/packages/geo/package.json index 2bec7cac0f..1106793a9b 100644 --- a/packages/geo/package.json +++ b/packages/geo/package.json @@ -43,7 +43,7 @@ "@igo2/utils": "^16.0.0-rc.0", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", - "ol": "^8.1.0", + "ol": "^7.5.2", "ol-mapbox-style": "^12.0.0", "proj4": "^2.9.0", "rxjs": "^7.8.0", From cdea45704ef2c347eeae3800e3be3b534dfe9a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:33:04 -0400 Subject: [PATCH 08/38] feat(direction): add a toogle to control user interaction with map (#1396) * feat(direction): add a toogle to control user interaction with map * wip * wip * wip * refactor(directions): review optimisations * refactor(directions): changed based on review --- .../lib/directions/directions.component.html | 10 ++++++ .../lib/directions/directions.component.scss | 17 +++++++++ .../lib/directions/directions.component.ts | 36 ++++++++++++++----- .../src/lib/directions/directions.module.ts | 2 ++ packages/geo/src/locale/en.geo.json | 3 +- packages/geo/src/locale/fr.geo.json | 3 +- 6 files changed, 60 insertions(+), 11 deletions(-) diff --git a/packages/geo/src/lib/directions/directions.component.html b/packages/geo/src/lib/directions/directions.component.html index c4b551f12b..d5d311ee16 100644 --- a/packages/geo/src/lib/directions/directions.component.html +++ b/packages/geo/src/lib/directions/directions.component.html @@ -1,3 +1,13 @@ +
+ + {{ 'igo.geo.directionsForm.toggleActive' | translate }} + +
+ = new Subject(); + /** + * Wheter one of the direction control is active + * @internal + */ + get directionControlIsActive(): boolean { + return !this.queryService.queryEnabled; + } + + get interactions(): olInteraction.Interaction[] { + return [this.selectStopInteraction, this.translateStop, this.selectedRoute]; + } + constructor( private cdRef: ChangeDetectorRef, private languageService: LanguageService, @@ -113,11 +125,9 @@ export class DirectionsComponent implements OnInit, OnDestroy { } private freezeStores() { - this.stopsFeatureStore.layer.map.ol.removeInteraction( - this.selectStopInteraction + this.interactions.map((interaction) => + this.routesFeatureStore.layer.map.ol.removeInteraction(interaction) ); - this.stopsFeatureStore.layer.map.ol.removeInteraction(this.translateStop); - this.routesFeatureStore.layer.map.ol.removeInteraction(this.selectedRoute); this.stopsFeatureStore.deactivateStrategyOfType( FeatureStoreLoadingStrategy ); @@ -201,11 +211,9 @@ export class DirectionsComponent implements OnInit, OnDestroy { } }); - this.stopsFeatureStore.layer.map.ol.addInteraction( - this.selectStopInteraction + this.interactions.map((interaction) => + this.routesFeatureStore.layer.map.ol.addInteraction(interaction) ); - this.stopsFeatureStore.layer.map.ol.addInteraction(this.translateStop); - this.routesFeatureStore.layer.map.ol.addInteraction(this.selectedRoute); } onStopInputHasFocusChange(stopInputHasFocus: boolean) { @@ -435,4 +443,14 @@ export class DirectionsComponent implements OnInit, OnDestroy { this.languageService ); } + + onToggleDirectionsControl(isActive: boolean) { + this.queryService.queryEnabled = !isActive; + const ol = this.routesFeatureStore.layer.map.ol; + this.interactions.map((interaction) => + isActive + ? ol.addInteraction(interaction) + : ol.removeInteraction(interaction) + ); + } } diff --git a/packages/geo/src/lib/directions/directions.module.ts b/packages/geo/src/lib/directions/directions.module.ts index e7b0026477..2ebeec428d 100644 --- a/packages/geo/src/lib/directions/directions.module.ts +++ b/packages/geo/src/lib/directions/directions.module.ts @@ -21,6 +21,7 @@ import { DirectionsInputsComponent } from './directions-inputs/directions-inputs import { DirectionsComponent } from './directions.component'; import { DirectionsButtonsComponent } from './directions-buttons/directions-buttons.component'; import { DirectionsResultsComponent } from './directions-results/directions-results.component'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; @NgModule({ imports: [ @@ -36,6 +37,7 @@ import { DirectionsResultsComponent } from './directions-results/directions-resu MatInputModule, MatOptionModule, MatSelectModule, + MatSlideToggleModule, MatTooltipModule, MatAutocompleteModule, IgoLanguageModule diff --git a/packages/geo/src/locale/en.geo.json b/packages/geo/src/locale/en.geo.json index 3923cac3df..fc996613b0 100644 --- a/packages/geo/src/locale/en.geo.json +++ b/packages/geo/src/locale/en.geo.json @@ -376,7 +376,8 @@ "copyMsg": "Directions copied to clipboard", "copyMsgLink": "Link for directions copied to clipboard", "copyTitle": "Directions" - } + }, + "toggleActive": "Activate direction control" }, "directions": { "uturn": "u-turn", diff --git a/packages/geo/src/locale/fr.geo.json b/packages/geo/src/locale/fr.geo.json index 4a5f3436fd..f206c0bc50 100644 --- a/packages/geo/src/locale/fr.geo.json +++ b/packages/geo/src/locale/fr.geo.json @@ -376,7 +376,8 @@ "copyMsg": "Itinéraire copié dans le presse-papier", "copyMsgLink": "Le lien de l'itinéraire est copié dans le presse-papier", "copyTitle": "Itinéraire" - } + }, + "toggleActive": "Activer le contrôle d'itinéraire" }, "directions": { "uturn": "demi-tour", From fbc4ff7a26f501c8d42e28760440d4b45b99cbc6 Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:46:22 -0400 Subject: [PATCH 09/38] fix(InteractiveTour): options migration from popperJS to floatingUI (#1399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(InteractiveTour): options migration from popperJS to floatingUI * refactor(demo): specify position for interactive tour modals --------- Co-authored-by: Pierre-Étienne Lord --- demo/src/config/interactiveTour.json | 1 + .../lib/interactive-tour/interactive-tour.service.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/demo/src/config/interactiveTour.json b/demo/src/config/interactiveTour.json index afd4065f40..6aba0e99a5 100644 --- a/demo/src/config/interactiveTour.json +++ b/demo/src/config/interactiveTour.json @@ -1,6 +1,7 @@ { "global": { "title": "interactiveTour.title", + "position": "right", "highlightClass": "mat-form-field", "class": "mat-form-field", "steps": [ diff --git a/packages/common/src/lib/interactive-tour/interactive-tour.service.ts b/packages/common/src/lib/interactive-tour/interactive-tour.service.ts index bc45f5abe5..ead06d27c1 100644 --- a/packages/common/src/lib/interactive-tour/interactive-tour.service.ts +++ b/packages/common/src/lib/interactive-tour/interactive-tour.service.ts @@ -1,5 +1,7 @@ import { Injectable } from '@angular/core'; import { ShepherdService } from 'angular-shepherd'; +import Shepherd from 'shepherd.js'; +import { offset } from '@floating-ui/dom'; import { ConfigService, MediaService, LanguageService } from '@igo2/core'; import { InteractiveTourLoader } from './interactive-tour.loader'; @@ -282,17 +284,17 @@ export class InteractiveTourService { } private getShepherdSteps(stepConfig: InteractiveTourOptions) { - const shepherdSteps = []; + const shepherdSteps: Shepherd.Step.StepOptions[] = []; let i = 0; for (const step of stepConfig.steps) { shepherdSteps.push({ attachTo: { element: step.element, - on: step.position || stepConfig.position + on: (step.position || stepConfig.position) as any // PopperPlacement }, - popperOptions: { - modifiers: [{ name: 'offset', options: { offset: [0, 15] } }] + floatingUIOptions: { + middleware: [offset({ mainAxis: 15 })] }, beforeShowPromise: () => { return Promise.all([ @@ -331,7 +333,7 @@ export class InteractiveTourService { this.executeAction(step, step.onHide); } } - }); + } satisfies Shepherd.Step.StepOptions); i++; } From 70560945d92ea9e12e56f65662f061d53be4fa11 Mon Sep 17 00:00:00 2001 From: Aziz <119948730+aziz-access@users.noreply.github.com> Date: Thu, 21 Sep 2023 19:54:01 +0200 Subject: [PATCH 10/38] ui:(core, geo): fix input form width, change overly pane to fit-content (#1395) * ui:(core, geo): fix input form width, change overly pane to fit-content * change cdk-overlay-pane from core to filter theming * add providers mat_autocomplite and mat_select config to set overly fit-content * set the style locally --- .../ogc-filter-form.component.scss | 36 +++++++++---------- .../ogc-filter-time.component.scss | 1 + .../ogc-filterable-form.component.ts | 15 +++++++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.scss b/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.scss index 99d2238463..1061e8db2b 100644 --- a/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.scss +++ b/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.scss @@ -28,17 +28,15 @@ .logical { flex-flow: column nowrap; - width: 10%; - max-width: 84px; - margin-left: 5px; + width: 100%; + max-width: 60px; + margin-right: 5px; } .logicalHidden { - flex-flow: column nowrap; - width: 10%; + width: 0px; visibility: hidden; - max-width: 45px; - margin-left: 5px; + max-width: 0px; } ::ng-deep .logical .mat-mdc-select-arrow { @@ -50,7 +48,8 @@ } .field { - width: 20%; + width: 150px; + margin-right: 5px; } ::ng-deep .field .mat-mdc-select-arrow { @@ -58,9 +57,8 @@ } .operator { - width: 12%; - min-width: 150px; - margin-left: 10px; + width: 150px; + margin-right: 5px; text-align: center; } @@ -69,8 +67,8 @@ } .spatialSelector { - width: 15%; - margin-left: 5px; + width: 110px; + margin-right: 5px; } ::ng-deep .spatialSelector .mat-mdc-select-arrow { @@ -78,16 +76,16 @@ } .singleInput { - width: 30%; - margin-left: 5px; + width: 150px; + margin-right: 5px; @include mobile { width: 27%; } } .snrc { - width: 20%; - margin-left: 5px; + width: 110px; + margin-right: 5px; } ::ng-deep .singleInput .mat-mdc-select-arrow { @@ -95,8 +93,8 @@ } .dualInput { - width: 20%; - margin-left: 5px; + width: 150px; + margin-right: 5px; } ::ng-deep .dualInput .mat-mdc-select-arrow { diff --git a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time.component.scss b/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time.component.scss index c9ab78936e..839b3b223d 100644 --- a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time.component.scss +++ b/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time.component.scss @@ -68,6 +68,7 @@ .year-input-only-year { width: 120px; margin-right: 25px; + text-align: left !important; } // to disable selection month and day for year picker diff --git a/packages/geo/src/lib/filter/ogc-filterable-form/ogc-filterable-form.component.ts b/packages/geo/src/lib/filter/ogc-filterable-form/ogc-filterable-form.component.ts index a0f7d692e4..d7fbbe5b68 100644 --- a/packages/geo/src/lib/filter/ogc-filterable-form/ogc-filterable-form.component.ts +++ b/packages/geo/src/lib/filter/ogc-filterable-form/ogc-filterable-form.component.ts @@ -1,10 +1,23 @@ import { Component, Input } from '@angular/core'; import { OgcFilterableDataSource } from '../shared/ogc-filter.interface'; import { IgoMap } from '../../map/shared'; +import { MAT_SELECT_CONFIG } from '@angular/material/select'; +import { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS } from '@angular/material/autocomplete'; @Component({ selector: 'igo-ogc-filterable-form', - templateUrl: './ogc-filterable-form.component.html' + templateUrl: './ogc-filterable-form.component.html', + styles: ['::ng-deep.igo-overlay-panel-width { min-width: fit-content;}'], + providers: [ + { + provide: MAT_SELECT_CONFIG, + useValue: { overlayPanelClass: 'igo-overlay-panel-width' } + }, + { + provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, + useValue: { overlayPanelClass: 'igo-overlay-panel-width' } + } + ] }) export class OgcFilterableFormComponent { @Input() datasource: OgcFilterableDataSource; From 44b3d4ac88a23a83bc4704dde03a563230b90c53 Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:55:54 -0400 Subject: [PATCH 11/38] fix(InteractiveTour): add Placement types from @floating-ui (#1407) * fix(InteractiveTour): add Placement types from @floating-ui --- package-lock.json | 1 + package.json | 1 + packages/common/package.json | 1 + .../src/lib/interactive-tour/interactive-tour.interface.ts | 4 +++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 42b5b52067..91a9d9cd4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "@angular/platform-browser-dynamic": "^16.2.5", "@angular/router": "^16.2.5", "@azure/msal-angular": "^3.0.4", + "@floating-ui/utils": "^0.1.4", "@mat-datetimepicker/core": "~12.0.0", "@mdi/angular-material": "^7.2.96", "@ngx-translate/core": "^15.0.0", diff --git a/package.json b/package.json index 7e47650aef..5d1614cd35 100644 --- a/package.json +++ b/package.json @@ -101,6 +101,7 @@ "@angular/platform-browser-dynamic": "^16.2.5", "@angular/router": "^16.2.5", "@azure/msal-angular": "^3.0.4", + "@floating-ui/utils": "^0.1.4", "@mat-datetimepicker/core": "~12.0.0", "@mdi/angular-material": "^7.2.96", "@ngx-translate/core": "^15.0.0", diff --git a/packages/common/package.json b/packages/common/package.json index 6dc206c82b..7187c25af2 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -26,6 +26,7 @@ "@angular/core": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", + "@floating-ui/utils": "^0.1.4", "@igo2/core": "^16.0.0-rc.0", "@igo2/utils": "^16.0.0-rc.0", "angular-shepherd": "16.0.0", diff --git a/packages/common/src/lib/interactive-tour/interactive-tour.interface.ts b/packages/common/src/lib/interactive-tour/interactive-tour.interface.ts index 97ef2c3e78..d75198aa7f 100644 --- a/packages/common/src/lib/interactive-tour/interactive-tour.interface.ts +++ b/packages/common/src/lib/interactive-tour/interactive-tour.interface.ts @@ -1,6 +1,8 @@ +import { Placement } from '@floating-ui/utils'; + export interface InteractiveTourStep { element?: string; - position?: string; + position?: Placement; title?: string; text: string; beforeShow?: InteractiveTourAction; From c92b488dcae1329e82e0c42274c0fed49cae5c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:09:50 -0400 Subject: [PATCH 12/38] fix(menu-button): fix v16.0.0 regression form menu button color configuration (#1403) * fix(menu-button): fix v16.0.0 regression form menu button color configuration * refactor(menu-button): ensure to controls configs and legacy configs --- .../menu-button/menu-button.component.scss | 21 ----------- .../map/menu-button/menu-button.component.ts | 36 +++++++++---------- .../map/menu-button/menu-button.theming.scss | 16 ++++----- 3 files changed, 22 insertions(+), 51 deletions(-) diff --git a/packages/geo/src/lib/map/menu-button/menu-button.component.scss b/packages/geo/src/lib/map/menu-button/menu-button.component.scss index 41b43a8af5..160a2d4818 100644 --- a/packages/geo/src/lib/map/menu-button/menu-button.component.scss +++ b/packages/geo/src/lib/map/menu-button/menu-button.component.scss @@ -1,26 +1,5 @@ @use '../../../../../common/src/style/partial/common-utils'; -@import '../../../../../core/src/style/partial/core.variables'; :host { @include common-utils.square-button(); - - #menu-button { - background-color: $app-background-color; - border-radius: 0; - } - - #menu-button.menu-button-reverse-color { - height: 40px; - border-radius: 0; - height: 45px; - width: 48px; - } - - #menu-button.menu-button-reverse-color-close { - border-radius: 0; - } - - mat-icon.disabled { - color: rgba(0, 0, 0, 0.38); - } } diff --git a/packages/geo/src/lib/map/menu-button/menu-button.component.ts b/packages/geo/src/lib/map/menu-button/menu-button.component.ts index 498f743e6a..36b39c62fd 100644 --- a/packages/geo/src/lib/map/menu-button/menu-button.component.ts +++ b/packages/geo/src/lib/map/menu-button/menu-button.component.ts @@ -20,33 +20,29 @@ export class MenuButtonComponent { @Output() openSidenav = new EventEmitter(); - public menuButtonReverseColor = false; + public useThemeColor: boolean; public menuButtonClass; constructor(public configService: ConfigService) { - if ( - typeof this.configService.getConfig('menuButtonReverseColor') !== - 'undefined' - ) { - this.menuButtonReverseColor = this.configService.getConfig( - 'menuButtonReverseColor' - ); - } + const configValue = this.configService.getConfig( + 'menu.button.useThemeColor' + ); + const configReverseColor = this.configService.getConfig( + 'menuButtonReverseColor' + ); + this.useThemeColor = + configValue !== undefined + ? configValue + : configReverseColor !== undefined + ? configReverseColor + : false; } getClassMenuButton() { - if (this.sidenavOpened) { - this.menuButtonClass = { - 'menu-button': this.menuButtonReverseColor === false, - 'menu-button-reverse-color': this.menuButtonReverseColor === true - }; - } else { - this.menuButtonClass = { - 'menu-button': this.menuButtonReverseColor === false, - 'menu-button-reverse-color-close': this.menuButtonReverseColor === true - }; - } + this.menuButtonClass = { + 'menu-button-white-background': !this.useThemeColor + }; } onToggleSidenavClick() { diff --git a/packages/geo/src/lib/map/menu-button/menu-button.theming.scss b/packages/geo/src/lib/map/menu-button/menu-button.theming.scss index 79b5cab7e2..bf8b0a4bd2 100644 --- a/packages/geo/src/lib/map/menu-button/menu-button.theming.scss +++ b/packages/geo/src/lib/map/menu-button/menu-button.theming.scss @@ -1,5 +1,6 @@ @use 'sass:map'; @use '@angular/material' as mat; +@import '../../../../../core/src/style/partial/core.variables'; @mixin theme($theme) { @include color($theme); @@ -8,17 +9,12 @@ @mixin color($theme) { $primary: map.get($theme, primary); - igo-menu-button > #menu-button { - color: mat.get-color-from-palette($primary); - } - - igo-menu-button > #menu-button.menu-button-reverse-color-close { + igo-menu-button > button#menu-button { + color: $app-background-color; background-color: mat.get-color-from-palette($primary); - color: mat.get-color-from-palette($primary, default-contrast); } - - igo-menu-button > #menu-button.menu-button-reverse-color { - background-color: mat.get-color-from-palette($primary); - color: mat.get-color-from-palette($primary, default-contrast); + igo-menu-button > button#menu-button.menu-button-white-background { + color: mat.get-color-from-palette($primary); + background-color: $app-background-color; } } From 8d00c6b5b94ae8ee1f06fb1c2d5e4f582280deee Mon Sep 17 00:00:00 2001 From: Maxime Lamer <83651899+LAMM26@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:30:24 -0400 Subject: [PATCH 13/38] =?UTF-8?q?feat(qcca-theme):=20ajout=20de=20style=20?= =?UTF-8?q?pour=20la=20barre=20de=20d=C3=A9filement=20qc-ca=20(#1400)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added scrollbar theming for qc-ca theme --- .../prebuilt-themes/qcca/components/_index.scss | 1 + .../qcca/components/scrollbar.scss | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 packages/core/src/theming/prebuilt-themes/qcca/components/scrollbar.scss diff --git a/packages/core/src/theming/prebuilt-themes/qcca/components/_index.scss b/packages/core/src/theming/prebuilt-themes/qcca/components/_index.scss index b4c6c7daf4..cd50619ec3 100644 --- a/packages/core/src/theming/prebuilt-themes/qcca/components/_index.scss +++ b/packages/core/src/theming/prebuilt-themes/qcca/components/_index.scss @@ -5,5 +5,6 @@ @use './list'; @use './panel'; @use './search-bar'; +@use './scrollbar'; @forward './_index.theme' as all-component-*; diff --git a/packages/core/src/theming/prebuilt-themes/qcca/components/scrollbar.scss b/packages/core/src/theming/prebuilt-themes/qcca/components/scrollbar.scss new file mode 100644 index 0000000000..f9b06daf5c --- /dev/null +++ b/packages/core/src/theming/prebuilt-themes/qcca/components/scrollbar.scss @@ -0,0 +1,15 @@ +@use '../base'; + +*::-webkit-scrollbar { + width: 6px; +} + +*::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px base.$blue-light; + border-radius: 10px; +} + +*::-webkit-scrollbar-thumb { + background: base.$blue-normal-piv; + border-radius: 10px; +} \ No newline at end of file From 801930010a15696eb201401150c94d46591d6884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:59:48 -0400 Subject: [PATCH 14/38] feat(core): add a new method to handle deprecated configs (#1408) * feat(core): add a new method to handle deprecated configs * refactor(core): propose the right alternate key for menuButtonReverseColor * feat(Config): add the deprecated configuration - Allow to search via the AlternateConfig for optimisation and simplification * feat(Config): review the code style * fix(ConfigDeprecated): change show for visible * fix(Config): bad return type * refactor(menu-button): delete deprecated key --------- Co-authored-by: Alexandre Caron --- .../core/src/lib/config/config-deprecated.ts | 26 +++++++++++++ .../core/src/lib/config/config.interface.ts | 9 +++++ .../core/src/lib/config/config.service.ts | 39 ++++++++++++++++++- .../map/menu-button/menu-button.component.ts | 10 +---- 4 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 packages/core/src/lib/config/config-deprecated.ts diff --git a/packages/core/src/lib/config/config-deprecated.ts b/packages/core/src/lib/config/config-deprecated.ts new file mode 100644 index 0000000000..4725b41c65 --- /dev/null +++ b/packages/core/src/lib/config/config-deprecated.ts @@ -0,0 +1,26 @@ +import { DeprecatedOptions, AlternateConfigOptions } from './config.interface'; + +export const CONFIG_DEPRECATED: { [key: string]: DeprecatedOptions } = { + showMenuButton: { + alternativeKey: 'menu.button.visible', + mayBeRemoveIn: new Date('2024-06-06') + }, + menuButtonReverseColor: { + alternativeKey: 'menu.button.useThemeColor', + mayBeRemoveIn: new Date('2024-06-06') + } +}; + +export const ALTERNATE_CONFIG_FROM_DEPRECATION = new Map< + string, + AlternateConfigOptions +>( + Object.entries(CONFIG_DEPRECATED) + .filter(([_, options]) => options.alternativeKey) + .map(([key, options]) => [ + options.alternativeKey, + { + deprecatedKey: key + } satisfies AlternateConfigOptions + ]) +); diff --git a/packages/core/src/lib/config/config.interface.ts b/packages/core/src/lib/config/config.interface.ts index df6e811ceb..aba35deabd 100644 --- a/packages/core/src/lib/config/config.interface.ts +++ b/packages/core/src/lib/config/config.interface.ts @@ -2,3 +2,12 @@ export interface ConfigOptions { default?: { [key: string]: any }; path?: string; } + +export interface DeprecatedOptions { + alternativeKey?: string; + mayBeRemoveIn: Date; +} + +export interface AlternateConfigOptions { + deprecatedKey: string; +} diff --git a/packages/core/src/lib/config/config.service.ts b/packages/core/src/lib/config/config.service.ts index 4807409466..349c3c2f34 100644 --- a/packages/core/src/lib/config/config.service.ts +++ b/packages/core/src/lib/config/config.service.ts @@ -7,6 +7,10 @@ import { ObjectUtils } from '@igo2/utils'; import { ConfigOptions } from './config.interface'; import { version } from './version'; +import { + ALTERNATE_CONFIG_FROM_DEPRECATION, + CONFIG_DEPRECATED +} from './config-deprecated'; @Injectable({ providedIn: 'root' @@ -14,6 +18,7 @@ import { version } from './version'; export class ConfigService { private config: object = {}; private httpClient: HttpClient; + private configDeprecated = new Map(Object.entries(CONFIG_DEPRECATED)); constructor(handler: HttpBackend) { this.httpClient = new HttpClient(handler); @@ -23,7 +28,39 @@ export class ConfigService { * Use to get the data found in config file */ public getConfig(key: string): any { - return ObjectUtils.resolve(this.config, key); + const value = ObjectUtils.resolve(this.config, key); + + const isDeprecated = this.configDeprecated.get(key); + if (isDeprecated) { + this.handleDeprecatedConfig(key); + } else if (value === undefined) { + return this.handleDeprecationPossibility(key); + } + + return value; + } + + private handleDeprecatedConfig(key: string): void { + const options = this.configDeprecated.get(key); + + let message = `This config (${key}) is deprecated and will be removed shortly`; + if (options.alternativeKey) { + message += ` You should use this key (${options.alternativeKey}) as an alternate solution`; + } + + const currentDate = new Date(); + currentDate >= options.mayBeRemoveIn + ? console.error(message) + : console.warn(message); + } + + private handleDeprecationPossibility(key: string): any { + const options = ALTERNATE_CONFIG_FROM_DEPRECATION.get(key); + if (!options) { + return; + } + + return this.getConfig(options.deprecatedKey); } /** diff --git a/packages/geo/src/lib/map/menu-button/menu-button.component.ts b/packages/geo/src/lib/map/menu-button/menu-button.component.ts index 36b39c62fd..92d9912f67 100644 --- a/packages/geo/src/lib/map/menu-button/menu-button.component.ts +++ b/packages/geo/src/lib/map/menu-button/menu-button.component.ts @@ -28,15 +28,7 @@ export class MenuButtonComponent { const configValue = this.configService.getConfig( 'menu.button.useThemeColor' ); - const configReverseColor = this.configService.getConfig( - 'menuButtonReverseColor' - ); - this.useThemeColor = - configValue !== undefined - ? configValue - : configReverseColor !== undefined - ? configReverseColor - : false; + this.useThemeColor = configValue !== undefined ? configValue : false; } getClassMenuButton() { From 9cd1ba390a826fd8ec788dfb2b4ecb78dba8cf37 Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Fri, 22 Sep 2023 11:12:21 -0400 Subject: [PATCH 15/38] 16.0.0-rc.1 --- CHANGELOG.md | 20 ++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- packages/auth/package.json | 6 +++--- packages/common/package.json | 6 +++--- packages/context/package.json | 12 ++++++------ packages/core/package.json | 4 ++-- packages/core/src/lib/config/version.ts | 4 ++-- packages/geo/package.json | 8 ++++---- packages/integration/package.json | 6 +++--- packages/utils/package.json | 2 +- 11 files changed, 47 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35b637b5cd..e02d5bf2d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# [16.0.0-rc.1](https://github.com/infra-geo-ouverte/igo2-lib/compare/16.0.0-rc.0...16.0.0-rc.1) (2023-09-22) + + +### Bug Fixes + +* **InteractiveTour:** add Placement types from [@floating-ui](https://github.com/floating-ui) ([#1407](https://github.com/infra-geo-ouverte/igo2-lib/issues/1407)) ([44b3d4a](https://github.com/infra-geo-ouverte/igo2-lib/commit/44b3d4ac88a23a83bc4704dde03a563230b90c53)) +* **InteractiveTour:** options migration from popperJS to floatingUI ([#1399](https://github.com/infra-geo-ouverte/igo2-lib/issues/1399)) ([fbc4ff7](https://github.com/infra-geo-ouverte/igo2-lib/commit/fbc4ff7a26f501c8d42e28760440d4b45b99cbc6)) +* **menu-button:** fix v16.0.0 regression form menu button color configuration ([#1403](https://github.com/infra-geo-ouverte/igo2-lib/issues/1403)) ([c92b488](https://github.com/infra-geo-ouverte/igo2-lib/commit/c92b488dcae1329e82e0c42274c0fed49cae5c70)) +* **Openlayers:** downgrade to 7.5.2 due to wms regression ([#1402](https://github.com/infra-geo-ouverte/igo2-lib/issues/1402)) ([a18905a](https://github.com/infra-geo-ouverte/igo2-lib/commit/a18905a57be9ea0ce120a50caf395b14f8a4cebc)) + + +### Features + +* **core:** add a new method to handle deprecated configs ([#1408](https://github.com/infra-geo-ouverte/igo2-lib/issues/1408)) ([8019300](https://github.com/infra-geo-ouverte/igo2-lib/commit/801930010a15696eb201401150c94d46591d6884)) +* **direction:** add a toogle to control user interaction with map ([#1396](https://github.com/infra-geo-ouverte/igo2-lib/issues/1396)) ([cdea457](https://github.com/infra-geo-ouverte/igo2-lib/commit/cdea45704ef2c347eeae3800e3be3b534dfe9a1e)) +* **Prettier:** be specific about the end of line ([a4be26e](https://github.com/infra-geo-ouverte/igo2-lib/commit/a4be26ebbef5afe81e3e588fa99b2be77c26a3d4)) +* **qcca-theme:** ajout de style pour la barre de défilement qc-ca ([#1400](https://github.com/infra-geo-ouverte/igo2-lib/issues/1400)) ([8d00c6b](https://github.com/infra-geo-ouverte/igo2-lib/commit/8d00c6b5b94ae8ee1f06fb1c2d5e4f582280deee)) + + + # [16.0.0-rc.0](https://github.com/infra-geo-ouverte/igo2-lib/compare/1.15.2...16.0.0-rc.0) (2023-09-19) diff --git a/package-lock.json b/package-lock.json index 91a9d9cd4a..2a19aafc7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@igo/demo", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@igo/demo", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "workspaces": [ "./packages/*" diff --git a/package.json b/package.json index 5d1614cd35..f2158a529d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "workspaces": [ "./packages/*" ], - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "license": "MIT", diff --git a/packages/auth/package.json b/packages/auth/package.json index 6bbfc02529..7e22dab4e9 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/auth", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -26,8 +26,8 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/router": "^16.2.5", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "rxjs": "^7.5.6", "@azure/msal-angular": "^3.0.4" }, diff --git a/packages/common/package.json b/packages/common/package.json index 7187c25af2..2e842296b6 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/common", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -27,8 +27,8 @@ "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", "@floating-ui/utils": "^0.1.4", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "angular-shepherd": "16.0.0", "scroll-into-view-if-needed": "^3.0.0", "typy": "^3.3.0", diff --git a/packages/context/package.json b/packages/context/package.json index 974306a434..f08f01aafe 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/context", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -20,11 +20,11 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/auth": "^16.0.0-rc.0", - "@igo2/common": "^16.0.0-rc.0", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", - "@igo2/geo": "^16.0.0-rc.0", + "@igo2/auth": "^16.0.0-rc.1", + "@igo2/common": "^16.0.0-rc.1", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", + "@igo2/geo": "^16.0.0-rc.1", "ol": "^7.5.2", "rxjs": "^7.8.0" }, diff --git a/packages/core/package.json b/packages/core/package.json index 3c8438798b..4bac24c896 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/core", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -43,7 +43,7 @@ "@angular/core": "^16.2.5", "@angular/platform-browser": "^16.2.5", "@angular/router": "^16.2.5", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.1", "rxjs": "^7.8.0", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0" diff --git a/packages/core/src/lib/config/version.ts b/packages/core/src/lib/config/version.ts index 889aa602ab..07a22e5d8c 100644 --- a/packages/core/src/lib/config/version.ts +++ b/packages/core/src/lib/config/version.ts @@ -4,6 +4,6 @@ export interface Version { } export const version: Version = { - lib: '16.0.0-rc.0', - releaseDate: 1695139270215 + lib: '16.0.0-rc.1', + releaseDate: 1695395320530 }; diff --git a/packages/geo/package.json b/packages/geo/package.json index 1106793a9b..fb7e7edee1 100644 --- a/packages/geo/package.json +++ b/packages/geo/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/geo", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -38,9 +38,9 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/common": "^16.0.0-rc.0", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/common": "^16.0.0-rc.1", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", "ol": "^7.5.2", diff --git a/packages/integration/package.json b/packages/integration/package.json index ae8ad17951..c4cc559c77 100644 --- a/packages/integration/package.json +++ b/packages/integration/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/integration", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], @@ -16,8 +16,8 @@ "peerDependencies": { "@angular/common": "^16.2.5", "@angular/core": "^16.2.5", - "@igo2/geo": "16.0.0-rc.0", - "@igo2/context": "16.0.0-rc.0", + "@igo2/geo": "16.0.0-rc.1", + "@igo2/context": "16.0.0-rc.1", "jspdf": "^2.5.1", "jspdf-autotable": "^3.5.29", "rxjs": "^7.8.0" diff --git a/packages/utils/package.json b/packages/utils/package.json index a9dcf35061..357b92b6d4 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@igo2/utils", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "description": "IGO Library", "author": "IGO Community", "keywords": ["igo"], From ca1829c43275151615418b50d03a5aa6b91e3408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Fri, 22 Sep 2023 14:26:39 -0400 Subject: [PATCH 16/38] 16.0.0-rc.1 --- packages/core/src/lib/config/config.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/lib/config/config.service.ts b/packages/core/src/lib/config/config.service.ts index 349c3c2f34..4ebd3de5fd 100644 --- a/packages/core/src/lib/config/config.service.ts +++ b/packages/core/src/lib/config/config.service.ts @@ -31,7 +31,7 @@ export class ConfigService { const value = ObjectUtils.resolve(this.config, key); const isDeprecated = this.configDeprecated.get(key); - if (isDeprecated) { + if (isDeprecated && value !== undefined) { this.handleDeprecatedConfig(key); } else if (value === undefined) { return this.handleDeprecationPossibility(key); From 111f8514052cb0ebaab2bb392b9dfbe690feb6ac Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:22:21 -0400 Subject: [PATCH 17/38] fix(EditionWorkspace): pass the service context to the function parameter (#1415) - Clean unused methods --- .../src/lib/workspace/shared/edition-workspace.service.ts | 3 +-- packages/geo/src/lib/workspace/shared/edition-workspace.ts | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts index e6e6d1eef7..b5db5e2a39 100644 --- a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts +++ b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts @@ -222,8 +222,7 @@ export class EditionWorkspaceService { this.dialog, this.configService, this.adding$, - this.deleteFeature, - this.getDomainValues, + (relation: RelationOptions) => this.getDomainValues(relation), { id: layer.id, title: layer.title, diff --git a/packages/geo/src/lib/workspace/shared/edition-workspace.ts b/packages/geo/src/lib/workspace/shared/edition-workspace.ts index bddcbd905a..bf8a6b4e9e 100644 --- a/packages/geo/src/lib/workspace/shared/edition-workspace.ts +++ b/packages/geo/src/lib/workspace/shared/edition-workspace.ts @@ -81,7 +81,6 @@ export class EditionWorkspace extends Workspace { private dialog: MatDialog, private configService: ConfigService, private adding$: BehaviorSubject, - private _deleteFeature: (workspace: EditionWorkspace, url: string) => void, private getDomainValues: (relation: RelationOptions) => Observable, protected options: EditionWorkspaceOptions ) { @@ -116,10 +115,6 @@ export class EditionWorkspace extends Workspace { }); } - private getInResolutionRange(): boolean { - return this.inResolutionRange$.value; - } - deleteFeature(feature, workspace) { setTimeout(() => { const dialogRef = this.dialog.open(ConfirmationPopupComponent, { From bc0da58f1b90a4d785fd0b5c0c4c950eb29f63ee Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:28:05 -0400 Subject: [PATCH 18/38] fix(Core): resolve infinite loop between MessageService and the ErrorInterceptor (#1419) * fix(Core): resolve infinite loop between MessageService and the ErrorInterceptor * fix(Query): import IgoMessageModule in test * Revert "fix(Core): resolve infinite loop between MessageService and the ErrorInterceptor" This reverts commit 81bff351122c39af574e66e9b8b6f0aa4886a3a0. * fix(Core): resolve infinite loop between MessageService and the ErrorInterceptor --- packages/core/src/lib/message/shared/index.ts | 1 - .../core/src/lib/request/error.interceptor.ts | 49 ++++++++++--------- .../lib/query/shared/query.service.spec.ts | 3 +- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/packages/core/src/lib/message/shared/index.ts b/packages/core/src/lib/message/shared/index.ts index 3218bc0ae4..9d580e874f 100644 --- a/packages/core/src/lib/message/shared/index.ts +++ b/packages/core/src/lib/message/shared/index.ts @@ -1,4 +1,3 @@ export * from './message.enum'; export * from './message.interface'; export * from './message.service'; -export { ActiveToast } from 'ngx-toastr'; diff --git a/packages/core/src/lib/request/error.interceptor.ts b/packages/core/src/lib/request/error.interceptor.ts index 428c812504..9bce0eb89e 100644 --- a/packages/core/src/lib/request/error.interceptor.ts +++ b/packages/core/src/lib/request/error.interceptor.ts @@ -1,4 +1,4 @@ -import { Injectable, Injector } from '@angular/core'; +import { Injectable } from '@angular/core'; import { HttpInterceptor, HttpHandler, @@ -16,7 +16,7 @@ import { MessageService } from '../message/shared/message.service'; providedIn: 'root' }) export class ErrorInterceptor implements HttpInterceptor { - constructor(private injector: Injector) {} + constructor(private messageService: MessageService) {} intercept( originalReq: HttpRequest, @@ -33,8 +33,16 @@ export class ErrorInterceptor implements HttpInterceptor { return next.handle(req).pipe( catchError((error) => this.handleError(error, errorContainer)), finalize(() => { - this.handleCaughtError(errorContainer); - this.handleUncaughtError(errorContainer); + const httpError = errorContainer.httpError; + if (!httpError) { + return; + } + + if (httpError.error.toDisplay) { + this.handleCaughtError(httpError); + } else if (!httpError.error.caught) { + this.handleUncaughtError(httpError); + } }) ); } @@ -61,26 +69,21 @@ export class ErrorInterceptor implements HttpInterceptor { return throwError(httpError); } - private handleCaughtError(errorContainer: { httpError: HttpErrorResponse }) { - const httpError = errorContainer.httpError; - if (httpError && httpError.error.toDisplay) { - httpError.error.caught = true; - const messageService = this.injector.get(MessageService); - messageService.error(httpError.error.message, httpError.error.title); - } + private handleCaughtError(httpError: HttpErrorResponse) { + httpError.error.caught = true; + this.messageService.error(httpError.error.message, httpError.error.title, { + progressBar: false + }); } - private handleUncaughtError(errorContainer: { - httpError: HttpErrorResponse; - }) { - const httpError = errorContainer.httpError; - if (httpError && !httpError.error.caught) { - const messageService = this.injector.get(MessageService); - httpError.error.caught = true; - messageService.error( - 'igo.core.errors.uncaught.message', - 'igo.core.errors.uncaught.title' - ); - } + private handleUncaughtError(httpError: HttpErrorResponse) { + httpError.error.caught = true; + this.messageService.error( + 'igo.core.errors.uncaught.message', + 'igo.core.errors.uncaught.title', + { + progressBar: false + } + ); } } diff --git a/packages/geo/src/lib/query/shared/query.service.spec.ts b/packages/geo/src/lib/query/shared/query.service.spec.ts index ff8276ab33..456050dcf7 100644 --- a/packages/geo/src/lib/query/shared/query.service.spec.ts +++ b/packages/geo/src/lib/query/shared/query.service.spec.ts @@ -4,11 +4,12 @@ import { HttpClientModule } from '@angular/common/http'; import { TranslateModule } from '@ngx-translate/core'; import { QueryService } from './query.service'; +import { IgoMessageModule } from '@igo2/core'; describe('QueryService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientModule, TranslateModule.forRoot()], + imports: [HttpClientModule, TranslateModule.forRoot(), IgoMessageModule], providers: [QueryService] }); }); From 05454b9105ec0d1dbe7ffd55701a8c2138984d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:12:25 -0400 Subject: [PATCH 19/38] feat(core): add method to retrieve global configs (#1417) * feat(core): add method to retrieve global configs * refactor(config): refiew fix --- packages/core/src/lib/config/config.service.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/core/src/lib/config/config.service.ts b/packages/core/src/lib/config/config.service.ts index 4ebd3de5fd..26f46a57c3 100644 --- a/packages/core/src/lib/config/config.service.ts +++ b/packages/core/src/lib/config/config.service.ts @@ -24,6 +24,19 @@ export class ConfigService { this.httpClient = new HttpClient(handler); } + /** + * Use to get the all config file (merge from environnement.ts and config.json) + */ + public getConfigs(): any { + Array.from(this.configDeprecated.keys()).map((deprecatedKey) => { + const deprecatedValue = ObjectUtils.resolve(this.config, deprecatedKey); + if (deprecatedValue !== undefined) { + this.handleDeprecatedConfig(deprecatedKey); + } + }); + return this.config; + } + /** * Use to get the data found in config file */ From b27a1dde004d3add777965855e4532839a06274c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Fri, 29 Sep 2023 12:18:03 -0400 Subject: [PATCH 20/38] Performance - entity table related to workspaces (#1418) * perf(entity-table): intermediate rewrite entities with final value, class and indicator * perf(geo feature strategies): optimize and debounce state calculation * perf(workspace):refresh datasource on state change * perf(entity): lower debounce to refresh datasource --- .../entity-table/entity-table.component.html | 120 +++++++++--------- .../entity-table/entity-table.component.ts | 38 +++++- .../shared/strategies/geo-properties.ts | 4 +- .../shared/strategies/in-map-extent.ts | 38 ++---- .../shared/strategies/in-map-resolution.ts | 10 +- 5 files changed, 116 insertions(+), 94 deletions(-) diff --git a/packages/common/src/lib/entity/entity-table/entity-table.component.html b/packages/common/src/lib/entity/entity-table/entity-table.component.html index b663439918..f4525043d1 100644 --- a/packages/common/src/lib/entity/entity-table/entity-table.component.html +++ b/packages/common/src/lib/entity/entity-table/entity-table.component.html @@ -23,16 +23,16 @@ - + @@ -69,31 +69,33 @@ - + - {{ getValue(record, column) }} + {{ row.cellData[column.name].value }} @@ -108,30 +110,32 @@ - + @@ -148,13 +152,13 @@ - +
@@ -187,8 +191,8 @@ *ngIf="column.type === 'number'" [formControlName]="column.name" step="{{ column.step }}" - value="{{ getValue(record, column) }}" - (input)="onValueChange(column.name, record, $event)" + value="{{ row.cellData[column.name].value }}" + (input)="onValueChange(column.name, row.record, $event)" readonly="{{ getValidationAttributeValue(column, 'readonly') }}" required="{{ getValidationAttributeValue(column, 'mandatory') @@ -201,8 +205,8 @@ type="text" *ngIf="!column.type || column.type === 'string'" [formControlName]="column.name" - value="{{ getValue(record, column) }}" - (input)="onValueChange(column.name, record, $event)" + value="{{ row.cellData[column.name].value }}" + (input)="onValueChange(column.name, row.record, $event)" readonly="{{ getValidationAttributeValue(column, 'readonly') }}" required="{{ getValidationAttributeValue(column, 'mandatory') @@ -211,8 +215,8 @@ @@ -266,28 +270,30 @@ mat-cell class="mat-cell-text" *ngIf=" - !isUrl(getValue(record, column)); + !row.cellData[column.name].isUrl; else isAnUrlUnsanitizedHTML " - [ngClass]="getCellClass(record, column)" - [innerHTML]="getValue(record, column) | sanitizeHtml" + [ngClass]="row.cellData[column.name].class" + [innerHTML]="row.cellData[column.name].value | sanitizeHtml" >
@@ -305,34 +311,34 @@ - + - + @@ -341,7 +347,7 @@ igoStopPropagation mat-icon-button [color]="button.color" - (mousedown)="onButtonClick(button.click, record)" + (mousedown)="onButtonClick(button.click, row.record)" [disabled]="button.disabled" > @@ -351,7 +357,7 @@ igoStopPropagation mat-mini-fab [color]="button.color" - (mousedown)="onButtonClick(button.click, record)" + (mousedown)="onButtonClick(button.click, row.record)" [disabled]="button.disabled" > @@ -372,13 +378,13 @@ ; + cellData: CellData; +} + @Component({ selector: 'igo-entity-table', templateUrl: './entity-table.component.html', @@ -183,7 +197,7 @@ export class EntityTableComponent implements OnInit, OnChanges, OnDestroy { * Data source consumable by the underlying material table * @internal */ - dataSource = new MatTableDataSource(); + dataSource = new MatTableDataSource(); /** * Whether selection is supported @@ -244,6 +258,10 @@ export class EntityTableComponent implements OnInit, OnChanges, OnDestroy { ngOnInit() { this.handleDatasource(); this.dataSource.paginator = this.paginator; + this.store.state.change$.pipe(debounceTime(100)).subscribe(() => { + this.handleDatasource(); + this.refresh(); + }); } /** @@ -461,7 +479,21 @@ export class EntityTableComponent implements OnInit, OnChanges, OnDestroy { if (all[0]) { this.enableEdit(all[0]); } - this.dataSource.data = all; + this.dataSource.data = all.map((record) => { + return { + record, + cellData: this.template.columns.reduce((cellData, column) => { + const value = this.getValue(record, column); + cellData[column.name] = { + class: this.getCellClass(record, column), + value, + isUrl: this.isUrl(value), + isImg: this.isImg(value) + }; + return cellData; + }, {}) + }; + }); }); } diff --git a/packages/geo/src/lib/feature/shared/strategies/geo-properties.ts b/packages/geo/src/lib/feature/shared/strategies/geo-properties.ts index abf80b89de..2637a696f1 100644 --- a/packages/geo/src/lib/feature/shared/strategies/geo-properties.ts +++ b/packages/geo/src/lib/feature/shared/strategies/geo-properties.ts @@ -90,7 +90,7 @@ export class GeoPropertiesStrategy extends EntityStoreStrategy { this.updateEntitiesPropertiesState(store); this.states$$.push( this.map.layers$ - .pipe(debounceTime(750), pairwise()) + .pipe(debounceTime(250), pairwise()) .subscribe(([prevLayers, currentLayers]) => { let prevLayersId; if (prevLayers) { @@ -103,7 +103,7 @@ export class GeoPropertiesStrategy extends EntityStoreStrategy { }) ); this.states$$.push( - store.entities$.pipe(debounceTime(750)).subscribe((a) => { + store.entities$.pipe(debounceTime(250)).subscribe((a) => { this.updateEntitiesPropertiesState(store); }) ); diff --git a/packages/geo/src/lib/feature/shared/strategies/in-map-extent.ts b/packages/geo/src/lib/feature/shared/strategies/in-map-extent.ts index d992fb2a77..933d47ad1c 100644 --- a/packages/geo/src/lib/feature/shared/strategies/in-map-extent.ts +++ b/packages/geo/src/lib/feature/shared/strategies/in-map-extent.ts @@ -1,11 +1,9 @@ -import * as olextent from 'ol/extent'; - import { EntityStoreStrategy } from '@igo2/common'; import { FeatureStore } from '../store'; import { FeatureStoreInMapExtentStrategyOptions } from '../feature.interfaces'; import { Subscription } from 'rxjs'; -import { skipWhile } from 'rxjs/operators'; +import { debounceTime, skipWhile } from 'rxjs/operators'; /** * This strategy maintain the store features updated while the map is moved. @@ -75,43 +73,27 @@ export class FeatureStoreInMapExtentStrategy extends EntityStoreStrategy { this.updateEntitiesInExtent(store); this.states$$.push( - store.layer.map.viewController.state$.subscribe(() => { - this.updateEntitiesInExtent(store); - }) + store.layer.map.viewController.state$ + .pipe(debounceTime(250)) + .subscribe(() => this.updateEntitiesInExtent(store)) ); } - private updateEntitiesInExtent(store) { + private updateEntitiesInExtent(store: FeatureStore) { if (store?.layer?.map?.viewController) { store.state.updateAll({ inMapExtent: false }); const mapExtent = store.layer.map.viewController.getExtent(); - let entitiesInMapExtent = []; - let entitiesWithNoGeom = []; - for (const entity of store.entities$.value) { - if (entity.ol) { - if ( - olextent.intersects(entity.ol.getGeometry().getExtent(), mapExtent) - ) { - entitiesInMapExtent.push(entity); - } - } else { - entitiesWithNoGeom.push(entity); - } - } - if (entitiesInMapExtent.length > 0) { + let entitiesInMapExtent = store.layer.ol + .getSource() + .getFeaturesInExtent(mapExtent) + .map((f) => store.get(f.getId())); + if (entitiesInMapExtent) { store.state.updateMany( entitiesInMapExtent, { inMapExtent: true }, false ); } - if (entitiesWithNoGeom.length > 0) { - store.state.updateMany( - entitiesWithNoGeom, - { inMapExtent: true }, - false - ); - } } } diff --git a/packages/geo/src/lib/feature/shared/strategies/in-map-resolution.ts b/packages/geo/src/lib/feature/shared/strategies/in-map-resolution.ts index b645038882..bc060b8f9a 100644 --- a/packages/geo/src/lib/feature/shared/strategies/in-map-resolution.ts +++ b/packages/geo/src/lib/feature/shared/strategies/in-map-resolution.ts @@ -2,7 +2,7 @@ import { EntityStoreStrategy } from '@igo2/common'; import { FeatureStore } from '../store'; import { FeatureStoreInMapResolutionStrategyOptions } from '../feature.interfaces'; -import { Subscription } from 'rxjs'; +import { Subscription, debounceTime } from 'rxjs'; /** * This strategy maintain the store features updated while the map is scrolled. @@ -78,9 +78,11 @@ export class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy { store.layer.map.viewController.getResolution() ); this.resolution$$.push( - store.layer.map.viewController.resolution$.subscribe((res) => { - this.updateEntitiesInResolution(store, res); - }) + store.layer.map.viewController.resolution$ + .pipe(debounceTime(250)) + .subscribe((res) => { + this.updateEntitiesInResolution(store, res); + }) ); } From b796cec28417bc4d30a7ad5787b6c07f09f2bc3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:38:02 -0400 Subject: [PATCH 21/38] perf(wfs): cancel outgoing wfs xhr on pan/zoom (#1421) * perf(wfs): cancel outgoing wfs xhr on pan/zoom * chore(Geo): adding typing to vector-layer * perf(vector-layer): optimize xhr abort looping execution --- .../shared/datasources/wfs-datasource.ts | 2 - .../lib/layer/shared/layers/vector-layer.ts | 115 ++++++++++-------- .../lib/offline/shared/geo-network.service.ts | 9 +- .../shared/edition-workspace.service.ts | 11 +- 4 files changed, 77 insertions(+), 60 deletions(-) diff --git a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts index 9ffa03fff0..da7306647a 100644 --- a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts +++ b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts @@ -23,7 +23,6 @@ import { AuthInterceptor } from '@igo2/auth'; export class WFSDataSource extends DataSource { public declare ol: olSourceVector; - public mostRecentIdCallOGCFilter: number = 0; set ogcFilters(value: OgcFiltersOptions) { (this.options as OgcFilterableDataSourceOptions).ogcFilters = value; @@ -100,7 +99,6 @@ export class WFSDataSource extends DataSource { setOgcFilters(ogcFilters: OgcFiltersOptions, triggerEvent: boolean = false) { this.ogcFilters = ogcFilters; - this.mostRecentIdCallOGCFilter += 1; if (triggerEvent) { this.ol.notify('ogcFilters', this.ogcFilters); } diff --git a/packages/geo/src/lib/layer/shared/layers/vector-layer.ts b/packages/geo/src/lib/layer/shared/layers/vector-layer.ts index aa4ed7f9f6..089daf7197 100644 --- a/packages/geo/src/lib/layer/shared/layers/vector-layer.ts +++ b/packages/geo/src/lib/layer/shared/layers/vector-layer.ts @@ -9,6 +9,7 @@ import olFeature from 'ol/Feature'; import olProjection from 'ol/proj/Projection'; import * as olproj from 'ol/proj'; import * as olformat from 'ol/format'; +import OlFeature from 'ol/Feature'; import { FeatureDataSource } from '../../../datasource/shared/datasources/feature-datasource'; import { WFSDataSource } from '../../../datasource/shared/datasources/wfs-datasource'; @@ -27,7 +28,10 @@ import { buildUrl, defaultMaxFeatures } from '../../../datasource/shared/datasources/wms-wfs.utils'; -import { OgcFilterableDataSourceOptions } from '../../../filter/shared/ogc-filter.interface'; +import { + OgcFilterableDataSourceOptions, + OgcFiltersOptions +} from '../../../filter/shared/ogc-filter.interface'; import { GeoNetworkService, SimpleGetOptions @@ -48,8 +52,14 @@ import BaseEvent from 'ol/events/Event'; import { olStyleToBasicIgoStyle } from '../../../style/shared/vector/conversion.utils'; import { FeatureDataSourceOptions } from '../../../datasource/shared/datasources/feature-datasource.interface'; import { ObjectUtils } from '@igo2/utils'; +import { Extent } from 'ol/extent'; +import { FeatureLoader } from 'ol/featureloader'; export class VectorLayer extends Layer { + private previousLoadExtent: Extent; + private previousLoadResolution: number; + private previousOgcFilters: OgcFiltersOptions; + private xhrAccumulator: XMLHttpRequest[] = []; public declare dataSource: | FeatureDataSource | WFSDataSource @@ -167,8 +177,11 @@ export class VectorLayer extends Layer { const vector = new olLayerVector(olOptions); const vectorSource = vector.getSource() as olSourceVector; const url = vectorSource.getUrl(); + if (typeof url === 'function') { + return vector; + } if (url) { - let loader; + let loader: FeatureLoader; const wfsOptions = olOptions.sourceOptions as WFSDataSourceOptions; if ( wfsOptions?.type === 'wfs' && @@ -436,14 +449,14 @@ export class VectorLayer extends Layer { * @param randomParam random parameter to ensure cache is not causing problems in retrieving new data */ public customWFSLoader( - vectorSource, - options, - interceptor, - extent, - resolution, - proj, - success, - failure, + vectorSource: olSourceVector, + options: WFSDataSourceOptions, + interceptor: AuthInterceptor, + extent: Extent, + resolution: number, + proj: olProjection, + success: (features: olFeature[]) => void, + failure: () => void, randomParam?: boolean ) { { @@ -452,12 +465,31 @@ export class VectorLayer extends Layer { ? new olProjection({ code: paramsWFS.srsName }) : proj; const currentExtent = olproj.transformExtent(extent, proj, wfsProj); + const ogcFilters = (options as OgcFilterableDataSourceOptions).ogcFilters; + + if ( + (this.previousLoadExtent && + this.previousLoadExtent !== currentExtent) || + (this.previousLoadResolution && + this.previousLoadResolution !== resolution) || + (this.previousOgcFilters && this.previousOgcFilters !== ogcFilters) + ) { + vectorSource.removeLoadedExtent(this.previousLoadExtent); + for (let xhr of this.xhrAccumulator) { + xhr.abort(); + } + } + + this.previousLoadExtent = currentExtent; + this.previousLoadResolution = resolution; + this.previousOgcFilters = ogcFilters; + paramsWFS.srsName = paramsWFS.srsName || proj.getCode(); const url = buildUrl( options, currentExtent, wfsProj, - (options as OgcFilterableDataSourceOptions).ogcFilters, + ogcFilters, randomParam ); let startIndex = 0; @@ -481,7 +513,6 @@ export class VectorLayer extends Layer { wfsProj, proj, alteredUrl, - nbOfFeature, success, failure ); @@ -495,7 +526,6 @@ export class VectorLayer extends Layer { wfsProj, proj, url, - paramsWFS.maxFeatures, success, failure ); @@ -512,23 +542,19 @@ export class VectorLayer extends Layer { * @param dataProjection the projection of the retrieved data * @param featureProjection the projection of the created features * @param url the url string to retrieve the data - * @param threshold the threshold to manage "more features" (TODO) * @param success success callback * @param failure failure callback */ private getFeatures( vectorSource: olSourceVector, - interceptor, - extent, - dataProjection, - featureProjection, + interceptor: AuthInterceptor, + extent: Extent, + dataProjection: olProjection, + featureProjection: olProjection, url: string, - threshold: number, - success, - failure + success: (features: olFeature[]) => void, + failure: () => void ) { - const idAssociatedCall = (this.dataSource as WFSDataSource) - .mostRecentIdCallOGCFilter; const xhr = new XMLHttpRequest(); const alteredUrlWithKeyAuth = interceptor.alterUrlWithKeyAuth(url); let modifiedUrl = url; @@ -552,15 +578,7 @@ export class VectorLayer extends Layer { dataProjection, featureProjection }) as olFeature[]; - // TODO Manage "More feature" - /*if (features.length === 0 || features.length < threshold ) { - console.log('No more data to download at this resolution'); - }*/ - // Avoids retrieving an older call that took longer to be process - if ( - idAssociatedCall === - (this.dataSource as WFSDataSource).mostRecentIdCallOGCFilter - ) { + if (features) { vectorSource.addFeatures(features); success(features); } else { @@ -570,6 +588,7 @@ export class VectorLayer extends Layer { onError(); } }; + this.xhrAccumulator.push(xhr); xhr.send(); } @@ -584,14 +603,14 @@ export class VectorLayer extends Layer { * @param projection the projection to retrieve the data */ private customLoader( - vectorSource, - url, - interceptor, - extent, - resolution, - projection, - success, - failure + vectorSource: olSourceVector, + url: string, + interceptor: AuthInterceptor, + extent: Extent, + resolution: number, + projection: olProjection, + success: (features: olFeature[]) => void, + failure: () => void ) { const xhr = new XMLHttpRequest(); let modifiedUrl = url; @@ -600,8 +619,6 @@ export class VectorLayer extends Layer { if (alteredUrlWithKeyAuth) { modifiedUrl = alteredUrlWithKeyAuth; } - } else { - modifiedUrl = url(extent, resolution, projection); } if (this.geoNetworkService && typeof url !== 'function') { @@ -622,7 +639,7 @@ export class VectorLayer extends Layer { concatMap((r) => r ? of(r) - : this.geoNetworkService.get(modifiedUrl, options).pipe( + : this.geoNetworkService.get(modifiedUrl as string, options).pipe( first(), catchError((res) => { onError(); @@ -653,8 +670,8 @@ export class VectorLayer extends Layer { const features = format.readFeatures(source, { extent, featureProjection: projection - }); - vectorSource.addFeatures(features, format.readProjection(source)); + }) as OlFeature[]; + vectorSource.addFeatures(features); success(features); } else { onError(); @@ -662,13 +679,13 @@ export class VectorLayer extends Layer { } }); } else { - xhr.open('GET', modifiedUrl); + xhr.open('GET', modifiedUrl as string); const format = vectorSource.getFormat(); if (format.getType() === 'arraybuffer') { xhr.responseType = 'arraybuffer'; } if (interceptor) { - interceptor.interceptXhr(xhr, modifiedUrl); + interceptor.interceptXhr(xhr, modifiedUrl as string); } const onError = () => { @@ -698,8 +715,8 @@ export class VectorLayer extends Layer { const features = format.readFeatures(source, { extent, featureProjection: projection - }); - vectorSource.addFeatures(features, format.readProjection(source)); + }) as OlFeature[]; + vectorSource.addFeatures(features); success(features); } else { onError(); diff --git a/packages/geo/src/lib/offline/shared/geo-network.service.ts b/packages/geo/src/lib/offline/shared/geo-network.service.ts index 7fd38ca6a3..f7cd9145f5 100644 --- a/packages/geo/src/lib/offline/shared/geo-network.service.ts +++ b/packages/geo/src/lib/offline/shared/geo-network.service.ts @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; import { ConnectionState, NetworkService } from '@igo2/core'; import { Observable } from 'rxjs'; import { GeoDBService } from '../geoDB/geoDB.service'; +import { Type } from 'ol/format/Feature'; export enum ResponseType { Arraybuffer = 'arraybuffer', @@ -11,7 +12,7 @@ export enum ResponseType { Json = 'json' } export interface SimpleGetOptions { - responseType: ResponseType; + responseType: Type; withCredentials?: boolean; } @Injectable({ @@ -49,12 +50,6 @@ export class GeoNetworkService { withCredentials: simpleGetOptions.withCredentials }); break; - case 'blob': - request = this.http.get(url, { - responseType: 'blob', - withCredentials: simpleGetOptions.withCredentials - }); - break; case 'text': request = this.http.get(url, { responseType: 'text', diff --git a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts index b5db5e2a39..6ccc72c6b1 100644 --- a/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts +++ b/packages/geo/src/lib/workspace/shared/edition-workspace.service.ts @@ -54,6 +54,7 @@ import olSourceImageWMS from 'ol/source/ImageWMS'; import type { default as OlGeometry } from 'ol/geom/Geometry'; import { BehaviorSubject, Observable, throwError } from 'rxjs'; import { createFilterInMapExtentOrResolutionStrategy } from './workspace.utils'; +import { FeatureLoader } from 'ol/featureloader'; @Injectable({ providedIn: 'root' @@ -738,10 +739,16 @@ export class EditionWorkspaceService { */ refreshMap(layer: VectorLayer, map: MapBase) { const wfsOlLayer = layer.dataSource.ol; - const loader = (extent, resolution, proj, success, failure) => { + const loader: FeatureLoader = ( + extent, + resolution, + proj, + success, + failure + ) => { layer.customWFSLoader( layer.ol.getSource(), - layer.options.sourceOptions, + layer.options.sourceOptions as WFSDataSourceOptions, this.authInterceptor, extent, resolution, From dc0815ebaa9d95f0d303e575981c395e22d3af07 Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:11:56 -0400 Subject: [PATCH 22/38] fix(MDC): resolve all remaining TODO from MDC migration (#1416) --- .../geo/src/lib/filter/filter.theming.scss | 3 --- .../ogc-filter-time-slider.component.scss | 27 ------------------- .../ogc-filter-time-slider.theming.scss | 15 ----------- packages/geo/src/lib/layer/layer.theming.scss | 7 ----- .../baselayers-switcher.component.scss | 6 ----- .../search-results.component.scss | 3 +-- 6 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.theming.scss diff --git a/packages/geo/src/lib/filter/filter.theming.scss b/packages/geo/src/lib/filter/filter.theming.scss index a079feab22..bca2848878 100644 --- a/packages/geo/src/lib/filter/filter.theming.scss +++ b/packages/geo/src/lib/filter/filter.theming.scss @@ -2,8 +2,6 @@ datetimepicker; @use './time-filter-form/time-filter-form.theming.scss' as time-filter; -@use './ogc-filter-time/ogc-filter-time-slider.theming.scss' as - ogc-filter-slider; @use './ogc-filter-selection/ogc-filter-selection.theming.scss' as ogc-filter-selection; @@ -11,6 +9,5 @@ @include datetimepicker.mat-datetimepicker-theme($theme); @include time-filter.igo-time-filter-form-theming($theme); - @include ogc-filter-slider.igo-ogc-filter-time-slider-theming($theme); @include ogc-filter-selection.igo-ogc-filter-selection-theming($theme); } diff --git a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.component.scss b/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.component.scss index 0cf670198e..52f6d6e534 100644 --- a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.component.scss +++ b/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.component.scss @@ -4,33 +4,6 @@ margin: auto 5px auto 5px !important; } - ::ng-deep { - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-thumb { - transform: scale(0) !important; - } - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-thumb-label { - transform: rotate(45deg) !important; - border-radius: 50% 50% 0 !important; - background-color: #ffd740 !important; - } - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-thumb-label-text { - opacity: 1 !important; - transform: rotate(135deg) !important; - } - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-horizontal .mat-slider-thumb-label { - top: 10px !important; - transform: rotate(225deg) !important; - } - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label { - transform: rotate(225deg) !important; - } - } - .datetime-container { text-align: center; } diff --git a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.theming.scss b/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.theming.scss deleted file mode 100644 index de2b8337f1..0000000000 --- a/packages/geo/src/lib/filter/ogc-filter-time/ogc-filter-time-slider.theming.scss +++ /dev/null @@ -1,15 +0,0 @@ -@use 'sass:map'; -@use '@angular/material' as mat; - -@mixin igo-ogc-filter-time-slider-theming($theme) { - $primary: map.get($theme, primary); - $color: mat.define-palette(mat.$yellow-palette); - - igo-ogc-filter-time-slider { - /* TODO(mdc-migration): The following rule targets internal classes of slider that may no longer apply for the MDC version. */ - .mat-slider-thumb-label { - transform: rotate(45deg) !important; - border-radius: 50% 50% 0 !important; - } - } -} diff --git a/packages/geo/src/lib/layer/layer.theming.scss b/packages/geo/src/lib/layer/layer.theming.scss index c58af688e1..5f712f4795 100644 --- a/packages/geo/src/lib/layer/layer.theming.scss +++ b/packages/geo/src/lib/layer/layer.theming.scss @@ -14,11 +14,4 @@ background-color: mat.get-color-from-palette($accent, lighter); color: mat.get-color-from-palette($primary, default-contrast); } - /* TODO(mdc-migration): The following rule targets internal classes of menu that may no longer apply for the MDC version. */ - .mat-menu-opacity-slider { - box-shadow: - 0 2px 4px -1px rgba(0, 0, 0, 0.5), - 0 4px 5px 0 rgba(0, 0, 0, 0.15), - 0 1px 10px 0 rgba(0, 0, 0, 0.4); - } } diff --git a/packages/geo/src/lib/map/baselayers-switcher/baselayers-switcher.component.scss b/packages/geo/src/lib/map/baselayers-switcher/baselayers-switcher.component.scss index 026ac26118..20264da4cf 100644 --- a/packages/geo/src/lib/map/baselayers-switcher/baselayers-switcher.component.scss +++ b/packages/geo/src/lib/map/baselayers-switcher/baselayers-switcher.component.scss @@ -33,10 +33,4 @@ background-color: #efefef; } } - - /* TODO(mdc-migration): The following rule targets internal classes of button that may no longer apply for the MDC version. */ - button, - :host ::ng-deep button .mat-button-ripple-round { - border-radius: 0; - } } diff --git a/packages/geo/src/lib/search/search-results/search-results.component.scss b/packages/geo/src/lib/search/search-results/search-results.component.scss index 948aed04e8..487640a533 100644 --- a/packages/geo/src/lib/search/search-results/search-results.component.scss +++ b/packages/geo/src/lib/search/search-results/search-results.component.scss @@ -9,8 +9,7 @@ igo-list ::ng-deep mat-list { height: 100%; - /* TODO(mdc-migration): The following rule targets internal classes of tabs that may no longer apply for the MDC version. */ - .custom-tabs-view .mat-tab-header-pagination { + .custom-tabs-view .mat-mdc-tab-header-pagination { min-width: 20px; } } From 928d0374708a99351a983e189e7c9bb54d1058dd Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Mon, 2 Oct 2023 09:12:28 -0400 Subject: [PATCH 23/38] fix(Format): change endOfLine for auto --- .prettierrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index b10dedda71..36b322548d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "singleQuote": true, "trailingComma": "none", - "endOfLine": "lf" + "endOfLine": "auto" } From 8ba49d35fba496cbf1024fce01c61d0d2f1d2d09 Mon Sep 17 00:00:00 2001 From: Alexandre Caron Date: Mon, 2 Oct 2023 09:21:53 -0400 Subject: [PATCH 24/38] Revert "fix(Format): change endOfLine for auto" This reverts commit 928d0374708a99351a983e189e7c9bb54d1058dd. --- .prettierrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index 36b322548d..b10dedda71 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "singleQuote": true, "trailingComma": "none", - "endOfLine": "auto" + "endOfLine": "lf" } From 4ae8186c55d0286943bd26edb34558ae8b6bd145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:38:23 -0400 Subject: [PATCH 25/38] style(*): various style adjustement due current migration * style(common): adding density to list * style(common): list.component style now effective * style(geo): handling catalog density * style(common): delete unused entity-table-paginator theming * style(catalog): carret, 32px to 16px margin-right * refactor(entity-table): unused include * style(entity-table): table header class change and light grey background * style(entity-table): table header class change and light grey background * chore(entity-table): doubled value in theming * wip * wip --- .../entity-table/entity-table.component.html | 2 -- .../entity-table/entity-table.theming.scss | 5 ++++- .../common/src/lib/entity/entity.theming.scss | 3 --- .../common/src/lib/list/list.component.scss | 11 +++++------ packages/common/src/lib/list/list.theming.scss | 18 ++++++++++++++++++ packages/geo/src/geo-theme.scss | 6 ++++-- .../catalog-browser-group.component.html | 2 +- .../catalog-browser-group.component.scss | 4 ++++ .../catalog-browser-layer.component.html | 7 ++++++- .../catalog-browser-layer.component.scss | 4 ++++ .../catalog-browser.theming.scss} | 7 ++++--- .../geo/src/lib/catalog/catalog.theming.scss | 5 +++++ .../search-results-item.component.scss | 9 --------- 13 files changed, 55 insertions(+), 28 deletions(-) rename packages/{common/src/lib/entity/entity-table-paginator/entity-table-paginator.theming.scss => geo/src/lib/catalog/catalog-browser/catalog-browser.theming.scss} (62%) create mode 100644 packages/geo/src/lib/catalog/catalog.theming.scss diff --git a/packages/common/src/lib/entity/entity-table/entity-table.component.html b/packages/common/src/lib/entity/entity-table/entity-table.component.html index f4525043d1..3ad87ccf69 100644 --- a/packages/common/src/lib/entity/entity-table/entity-table.component.html +++ b/packages/common/src/lib/entity/entity-table/entity-table.component.html @@ -48,7 +48,6 @@ *matHeaderCellDef mat-sort-header [matTooltip]="column.tooltip ? column.tooltip : undefined" - class="mat-body-1" > {{ column.title }} @@ -59,7 +58,6 @@ mat-header-cell *matHeaderCellDef [matTooltip]="column.tooltip ? column.tooltip : undefined" - class="mat-body-1" > {{ column.title }} diff --git a/packages/common/src/lib/entity/entity-table/entity-table.theming.scss b/packages/common/src/lib/entity/entity-table/entity-table.theming.scss index 8ac4e80bcf..11a9c0171a 100644 --- a/packages/common/src/lib/entity/entity-table/entity-table.theming.scss +++ b/packages/common/src/lib/entity/entity-table/entity-table.theming.scss @@ -9,13 +9,16 @@ @mixin color($theme) { $primary: map.get($theme, primary); $accent: map.get($theme, accent); - + $background: map-get($theme, background); igo-entity-table table.igo-entity-table-with-selection tr.igo-entity-table-row-highlighted { background-color: mat.get-color-from-palette($primary, A100); color: mat.get-color-from-palette($primary, default-contrast); } + igo-entity-table .mat-mdc-table thead { + background-color: mat.get-color-from-palette($background, background); + } } @mixin density($theme) { diff --git a/packages/common/src/lib/entity/entity.theming.scss b/packages/common/src/lib/entity/entity.theming.scss index 271cdd9003..3fe214c060 100644 --- a/packages/common/src/lib/entity/entity.theming.scss +++ b/packages/common/src/lib/entity/entity.theming.scss @@ -1,10 +1,7 @@ @use './entity-table/entity-table.theming' as entity-table; -@use './entity-table-paginator/entity-table-paginator.theming' as - entity-table-paginator; @use './entity-selector/entity-selector.theming' as entity-selector; @mixin igo-entity-theming($theme) { @include entity-table.theme($theme); - @include entity-table-paginator.theme($theme); @include entity-selector.theme($theme); } diff --git a/packages/common/src/lib/list/list.component.scss b/packages/common/src/lib/list/list.component.scss index c8a26f4b01..1916b4ba5b 100644 --- a/packages/common/src/lib/list/list.component.scss +++ b/packages/common/src/lib/list/list.component.scss @@ -12,16 +12,15 @@ } } -:host - ::ng-deep - .mat-mdc-list - .mat-mdc-list-item - .mdc-list-item__primary-text - > * { +:host ::ng-deep .mat-mdc-list .mat-mdc-list-item .mdc-list-item__primary-text { white-space: normal; overflow: hidden; text-overflow: ellipsis; + display: -webkit-box; + max-height: 36px; line-height: 18px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; } :host diff --git a/packages/common/src/lib/list/list.theming.scss b/packages/common/src/lib/list/list.theming.scss index 23bc44ed0d..212790a02a 100644 --- a/packages/common/src/lib/list/list.theming.scss +++ b/packages/common/src/lib/list/list.theming.scss @@ -4,6 +4,7 @@ @mixin igo-list-theming($theme) { $primary: map.get($theme, primary); $accent: map.get($theme, accent); + @include density($theme); igo-list { [igolistitem] { @@ -38,3 +39,20 @@ } } } + +@mixin density($theme) { + $density: mat.get-density-config($theme); + + $theme: map.merge( + $theme, + ( + density: $density + ) + ); + + igo-list { + @include mat.icon-density($theme); + @include mat.icon-button-density($theme); + @include mat.list-density($theme); + } +} diff --git a/packages/geo/src/geo-theme.scss b/packages/geo/src/geo-theme.scss index 866251fb6b..a4433ed601 100644 --- a/packages/geo/src/geo-theme.scss +++ b/packages/geo/src/geo-theme.scss @@ -5,8 +5,9 @@ @use './lib/layer/layer.theming.scss' as layer-theme; @use './lib/map/map.theming.scss' as map-theme; @use './lib/measure/measure.theming.scss' as measure-theme; -@use './lib/search/search.theming.scss' as search; +@use './lib/search/search.theming.scss' as search-theme; @use './lib/workspace/workspace.theming.scss' as workspace-theme; +@use './lib/catalog/catalog.theming.scss' as catalog-theme; @mixin geo-component-themes($theme) { @include directions-theme.igo-directions-theming($theme); @@ -16,6 +17,7 @@ @include layer-theme.igo-layer-theming($theme); @include map-theme.igo-map-theming($theme); @include measure-theme.igo-measure-theming($theme); - @include search.theme($theme); + @include search-theme.theme($theme); @include workspace-theme.igo-workspace-theming($theme); + @include catalog-theme.themes($theme); } diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html index ff08de0330..cee22e4163 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.html @@ -3,7 +3,7 @@ matListItemIcon svgIcon="chevron-up" igoCollapse - class="igo-chevron" + class="igo-chevron catalog-browser-group-carret" [target]="items" [collapsed]="collapsed" (toggle)="onToggleCollapsed($event)" diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.scss b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.scss index 7057ec9739..1be13a3b21 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.scss +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-group.component.scss @@ -6,6 +6,10 @@ cursor: help; } +.catalog-browser-group-carret { + margin-right: 16px; +} + .igo-catalog-group-title { font-weight: 500; } diff --git a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html index e9e6ad1207..641a3f43e7 100644 --- a/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html +++ b/packages/geo/src/lib/catalog/catalog-browser/catalog-browser-layer.component.html @@ -1,5 +1,10 @@ - + Date: Mon, 2 Oct 2023 17:16:27 +0200 Subject: [PATCH 26/38] fix(geo, common): Integrate ngx color (#1422) * set default color * add ngx-color and tinycolor2 * feat(ColorPickerFormField): use the form control value - Style adjustment * fix(ColorPicker): define peer dependencies and remove types * fix(ColorPicker): remove unnecessary condition * add translate module --------- Co-authored-by: Alexandre Caron --- package-lock.json | 82 +++++++++----- package.json | 3 +- packages/common/package.json | 4 + .../color-picker-form-field.component.html | 30 +++++- .../color-picker-form-field.component.scss | 21 ++++ .../color-picker-form-field.component.ts | 101 +++++++----------- .../color-picker-form-field.module.ts | 12 ++- packages/common/src/locale/en.common.json | 3 +- packages/common/src/locale/fr.common.json | 3 +- .../style-modal-drawing.component.html | 11 +- .../drawing/style-modal-drawing.component.ts | 13 ++- .../layer/style-modal-layer.component.html | 10 -- .../layer/style-modal-layer.component.ts | 13 ++- 13 files changed, 176 insertions(+), 130 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a19aafc7d..b3a4e7d70c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "@turf/helpers": "^6.5.0", "@turf/line-intersect": "^6.5.0", "@turf/point-on-feature": "^6.5.0", + "@types/tinycolor2": "^1.4.4", "angular-shepherd": "16.0.0", "bowser": "^2.10.0", "core-js": "^3.32.2", @@ -44,6 +45,7 @@ "jszip": "^3.10.1", "jwt-decode": "^2.2.0", "moment": "^2.29.4", + "ngx-color": "^9.0.0", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "nosleep.js": "^0.12.0", @@ -79,7 +81,6 @@ "@types/jasmine": "~4.3.0", "@types/lodash": "^4.14.195", "@types/node": "^20.6.2", - "@types/tinycolor2": "^1.4.4", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", "angular-cli-ghpages": "^1.0.3", @@ -2909,6 +2910,14 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@ctrl/tinycolor": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz", + "integrity": "sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==", + "engines": { + "node": ">=10" + } + }, "node_modules/@cypress/request": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", @@ -5902,8 +5911,7 @@ "node_modules/@types/tinycolor2": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.4.tgz", - "integrity": "sha512-FYK4mlLxUUajo/mblv7EUDHku20qT6ThYNsGZsTHilcHRvIkF8WXqtZO+DVTYkpHWCaAT97LueV59H/5Ve3bGA==", - "dev": true + "integrity": "sha512-FYK4mlLxUUajo/mblv7EUDHku20qT6ThYNsGZsTHilcHRvIkF8WXqtZO+DVTYkpHWCaAT97LueV59H/5Ve3bGA==" }, "node_modules/@types/vinyl": { "version": "2.0.7", @@ -18508,6 +18516,11 @@ "node": ">=0.10.0" } }, + "node_modules/material-colors": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz", + "integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -19895,6 +19908,20 @@ "semver": "bin/semver.js" } }, + "node_modules/ngx-color": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ngx-color/-/ngx-color-9.0.0.tgz", + "integrity": "sha512-zyAFux+FRI4cACZ7g8DQQsBbNMhqmFkhtUPaxhkiVHhPzWU1iqXP8MqWH6By3guNOCch5oYrYNBWlHToklbdDg==", + "dependencies": { + "@ctrl/tinycolor": "^3.6.0", + "material-colors": "^1.2.6", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/common": ">=16.0.0-0", + "@angular/core": ">=16.0.0-0" + } + }, "node_modules/ngx-indexed-db": { "version": "11.0.2", "resolved": "https://registry.npmjs.org/ngx-indexed-db/-/ngx-indexed-db-11.0.2.tgz", @@ -27962,7 +27989,7 @@ }, "packages/auth": { "name": "@igo2/auth", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "jwt-decode": "^2.2.0", @@ -27981,18 +28008,21 @@ "@angular/material": "^16.2.4", "@angular/router": "^16.2.5", "@azure/msal-angular": "^3.0.4", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "rxjs": "^7.5.6" } }, "packages/common": { "name": "@igo2/common", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "tslib": "^2.6.0" }, + "devDependencies": { + "@types/tinycolor2": "^1.4.4" + }, "engines": { "node": ">=18.10.0" }, @@ -28001,9 +28031,11 @@ "@angular/core": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@floating-ui/utils": "^0.1.4", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "angular-shepherd": "16.0.0", + "ngx-color": "^9.0.0", "scroll-into-view-if-needed": "^3.0.0", "tinycolor2": "^1.6.0", "typy": "^3.3.0" @@ -28011,7 +28043,7 @@ }, "packages/context": { "name": "@igo2/context", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "tslib": "^2.6.0" @@ -28026,18 +28058,18 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/auth": "^16.0.0-rc.0", - "@igo2/common": "^16.0.0-rc.0", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/geo": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/auth": "^16.0.0-rc.1", + "@igo2/common": "^16.0.0-rc.1", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/geo": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "ol": "^7.5.2", "rxjs": "^7.8.0" } }, "packages/core": { "name": "@igo2/core", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "@ngx-translate/core": "^15.0.0", @@ -28052,7 +28084,7 @@ "@angular/core": "^16.2.5", "@angular/platform-browser": "^16.2.5", "@angular/router": "^16.2.5", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/utils": "^16.0.0-rc.1", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "rxjs": "^7.8.0" @@ -28060,7 +28092,7 @@ }, "packages/geo": { "name": "@igo2/geo", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "@turf/helpers": "^6.5.0", @@ -28089,9 +28121,9 @@ "@angular/forms": "^16.2.5", "@angular/material": "^16.2.4", "@angular/platform-browser": "^16.2.5", - "@igo2/common": "^16.0.0-rc.0", - "@igo2/core": "^16.0.0-rc.0", - "@igo2/utils": "^16.0.0-rc.0", + "@igo2/common": "^16.0.0-rc.1", + "@igo2/core": "^16.0.0-rc.1", + "@igo2/utils": "^16.0.0-rc.1", "@mat-datetimepicker/core": "~12.0.0", "flexsearch": "0.7.21", "ngx-indexed-db": "^11.0.2", @@ -28104,7 +28136,7 @@ }, "packages/integration": { "name": "@igo2/integration", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "tslib": "^2.6.0" @@ -28115,8 +28147,8 @@ "peerDependencies": { "@angular/common": "^16.2.5", "@angular/core": "^16.2.5", - "@igo2/context": "16.0.0-rc.0", - "@igo2/geo": "16.0.0-rc.0", + "@igo2/context": "16.0.0-rc.1", + "@igo2/geo": "16.0.0-rc.1", "jspdf": "^2.5.1", "jspdf-autotable": "^3.5.29", "rxjs": "^7.8.0" @@ -28124,7 +28156,7 @@ }, "packages/utils": { "name": "@igo2/utils", - "version": "16.0.0-rc.0", + "version": "16.0.0-rc.1", "license": "MIT", "dependencies": { "bowser": "^2.10.0", diff --git a/package.json b/package.json index f2158a529d..1949f1c71b 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,7 @@ "@turf/helpers": "^6.5.0", "@turf/line-intersect": "^6.5.0", "@turf/point-on-feature": "^6.5.0", + "@types/tinycolor2": "^1.4.4", "angular-shepherd": "16.0.0", "bowser": "^2.10.0", "core-js": "^3.32.2", @@ -122,6 +123,7 @@ "jszip": "^3.10.1", "jwt-decode": "^2.2.0", "moment": "^2.29.4", + "ngx-color": "^9.0.0", "ngx-indexed-db": "^11.0.2", "ngx-toastr": "^17.0.0", "nosleep.js": "^0.12.0", @@ -157,7 +159,6 @@ "@types/jasmine": "~4.3.0", "@types/lodash": "^4.14.195", "@types/node": "^20.6.2", - "@types/tinycolor2": "^1.4.4", "@typescript-eslint/eslint-plugin": "^6.2.0", "@typescript-eslint/parser": "^6.2.0", "angular-cli-ghpages": "^1.0.3", diff --git a/packages/common/package.json b/packages/common/package.json index 2e842296b6..2d2a621b27 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -32,11 +32,15 @@ "angular-shepherd": "16.0.0", "scroll-into-view-if-needed": "^3.0.0", "typy": "^3.3.0", + "ngx-color": "^9.0.0", "tinycolor2": "^1.6.0" }, "dependencies": { "tslib": "^2.6.0" }, + "devDependencies": { + "@types/tinycolor2": "^1.4.4" + }, "engines": { "node": ">=18.10.0" } diff --git a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.html b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.html index ee50d7da06..37a436bb23 100644 --- a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.html +++ b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.html @@ -4,14 +4,34 @@ tooltip-position="below" matTooltipShowDelay="500" subscriptSizing="dynamic" + cdkOverlayOrigin + #trigger="cdkOverlayOrigin" + (click)="isOpen = !isOpen" > - {{ value }} + {{ colorPicker }} + + +
+ + +
+ +
+
+
diff --git a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.scss b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.scss index e69de29bb2..3ff7084a6a 100644 --- a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.scss +++ b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.scss @@ -0,0 +1,21 @@ +@use '@angular/material' as mat; + +.picker { + left: 100%; + position: absolute; + top: 100%; + background-color: white; + border-radius: 8px; + overflow: hidden; + @include mat.elevation(2); + + ::ng-deep .chrome-picker { + box-shadow: none; + } + + .buttons { + padding: 4px 12px 8px; + display: flex; + justify-content: flex-end; + } +} diff --git a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.ts b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.ts index d5b689d2e3..c60febce63 100644 --- a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.ts +++ b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.component.ts @@ -1,13 +1,10 @@ -import { - Component, - EventEmitter, - forwardRef, - Output, - OnInit -} from '@angular/core'; -import { Input } from '@angular/core'; +import { Component, Input, forwardRef } from '@angular/core'; + import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import tinycolor from 'tinycolor2'; +import { ColorEvent } from 'ngx-color'; +import tinycolor, { ColorInput } from 'tinycolor2'; + +type ColorFormat = 'hex' | 'rgba' | 'hsla'; @Component({ selector: 'igo-color-picker-form-field', @@ -21,55 +18,27 @@ import tinycolor from 'tinycolor2'; } ] }) -export class ColorPickerFormFieldComponent - implements ControlValueAccessor, OnInit -{ - // native color picker can't give transparency - // set transparency manually - @Input() setAlpha: number = 1; - - // by default native color picker gives hex result - @Input() outputFormat: 'hex' | 'rgba' | 'hsla' = 'rgba'; +export class ColorPickerFormFieldComponent implements ControlValueAccessor { + isOpen: boolean = false; - // default color - @Input() color: string = '#000'; - - // open and close native color picker event - @Output() open = new EventEmitter(); - @Output() close = new EventEmitter(); - - onChange: any = () => {}; - onTouch: any = () => {}; - - // final value we get as result with custom format set value(value: string) { - value = !value ? this.color : value; - this.onChange(value); - this.onTouch(value); - this._value = value; + this._value = this.formatColor(value ?? '#000'); + this.colorPicker = this._value; + + this.onChange(this.value); + this.onTouch(this.value); } get value(): string { return this._value; } - public _value: string; + private _value: string; - // native color picker accept hex format - set hexColor(value: string) { - this.value = this.setFormat(value); - this._hexColor = value; - } - get hexColor(): string { - return this._hexColor; - } - public _hexColor: string; + @Input() outputFormat: ColorFormat = 'rgba'; - ngOnInit(): void { - if (this.color) { - this._hexColor = tinycolor(this.color) - .setAlpha(this.setAlpha) - .toHexString(); - } - } + colorPicker: string; + + onChange: any = () => {}; + onTouch: any = () => {}; writeValue(value: string) { this.value = value; @@ -83,27 +52,35 @@ export class ColorPickerFormFieldComponent this.onTouch = fn; } - setFormat(color: string): string { - switch (this.outputFormat) { + handleClick(event: MouseEvent) { + event.preventDefault(); + event.stopPropagation(); + this.isOpen = false; + this.value = this.colorPicker; + } + + handleChange($event: ColorEvent) { + this.colorPicker = this.formatColor($event.color.rgb, 'rgba'); + } + + private formatColor( + color: ColorInput, + format: ColorFormat = this.outputFormat + ): string { + switch (format) { case 'hex': - color = tinycolor(color).setAlpha(this.setAlpha).toHexString(); + color = tinycolor(color).toHexString(); break; case 'rgba': - color = tinycolor(color).setAlpha(this.setAlpha).toRgbString(); + color = tinycolor(color).toRgbString(); break; case 'hsla': - color = tinycolor(color).setAlpha(this.setAlpha).toHsvString(); + color = tinycolor(color).toHsvString(); break; default: - color = tinycolor(color).setAlpha(this.setAlpha).toRgbString(); + color = tinycolor(color).toRgbString(); break; } return color; } - - closePicker() { - setTimeout(() => { - this.close.emit(true); - }, 300); - } } diff --git a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.module.ts b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.module.ts index 3a0d18aecc..55514f633a 100644 --- a/packages/common/src/lib/color-picker-form-field/color-picker-form-field.module.ts +++ b/packages/common/src/lib/color-picker-form-field/color-picker-form-field.module.ts @@ -3,13 +3,23 @@ import { ColorPickerFormFieldComponent } from './color-picker-form-field.compone import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; +import { CommonModule } from '@angular/common'; +import { OverlayModule } from '@angular/cdk/overlay'; +import { ColorChromeModule } from 'ngx-color/chrome'; +import { MatButtonModule } from '@angular/material/button'; +import { TranslateModule } from '@ngx-translate/core'; @NgModule({ imports: [ FormsModule, + MatButtonModule, MatFormFieldModule, MatInputModule, - ReactiveFormsModule + ReactiveFormsModule, + CommonModule, + OverlayModule, + ColorChromeModule, + TranslateModule ], declarations: [ColorPickerFormFieldComponent], exports: [ColorPickerFormFieldComponent] diff --git a/packages/common/src/locale/en.common.json b/packages/common/src/locale/en.common.json index c883e9c7b0..9eb4c39220 100644 --- a/packages/common/src/locale/en.common.json +++ b/packages/common/src/locale/en.common.json @@ -4,7 +4,8 @@ "confirmDialog": { "cancelBtn": "Cancel", "confirmBtn": "Confirm", - "title": "Confirm" + "title": "Confirm", + "applyBtn": "Apply" }, "table": { "filter": "Filter" diff --git a/packages/common/src/locale/fr.common.json b/packages/common/src/locale/fr.common.json index 20f80da79b..54816155ba 100644 --- a/packages/common/src/locale/fr.common.json +++ b/packages/common/src/locale/fr.common.json @@ -4,7 +4,8 @@ "confirmDialog": { "cancelBtn": "Annuler", "confirmBtn": "Confirmer", - "title": "Confirmation" + "title": "Confirmation", + "applyBtn": "Appliquer" }, "table": { "filter": "Filtre" diff --git a/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.html b/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.html index 0a55497b7f..2269959d81 100644 --- a/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.html +++ b/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.html @@ -13,13 +13,9 @@

{{ 'igo.geo.style.fill' | translate }} + @@ -31,11 +27,6 @@

diff --git a/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.ts b/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.ts index 99bed8271d..991e62480f 100644 --- a/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.ts +++ b/packages/geo/src/lib/style/style-modal/drawing/style-modal-drawing.component.ts @@ -27,9 +27,7 @@ export class StyleModalDrawingComponent implements OnInit { private formBuilder: UntypedFormBuilder, private drawStyleService: DrawStyleService, @Inject(MAT_DIALOG_DATA) public data: DrawingMatDialogData - ) { - this.buildForm(); - } + ) {} ngOnInit() { this.linestringOnly = true; @@ -39,12 +37,13 @@ export class StyleModalDrawingComponent implements OnInit { } } this.buildStyleData(); + this.buildForm(); } private buildForm() { this.form = this.formBuilder.group({ - fill: [''], - stroke: [''] + fill: [this.getFeatureFillColor()], + stroke: [this.getFeatureStrokeColor()] }); } @@ -109,7 +108,7 @@ export class StyleModalDrawingComponent implements OnInit { } } - getFeatureFillColor() { + private getFeatureFillColor() { if (!this.styleModalData.fillColor) { return this.data.features.length > 0 ? this.data.features[0].properties.drawingStyle.fill @@ -119,7 +118,7 @@ export class StyleModalDrawingComponent implements OnInit { } } - getFeatureStrokeColor() { + private getFeatureStrokeColor() { if (!this.styleModalData.strokeColor) { return this.data.features.length > 0 ? this.data.features[0].properties.drawingStyle.stroke diff --git a/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.html b/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.html index 46d0b7f7e8..df70b6ef88 100644 --- a/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.html +++ b/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.html @@ -14,11 +14,6 @@

@@ -30,11 +25,6 @@

diff --git a/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.ts b/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.ts index e3c68b9901..07f0d75659 100644 --- a/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.ts +++ b/packages/geo/src/lib/style/style-modal/layer/style-modal-layer.component.ts @@ -38,9 +38,7 @@ export class StyleModalLayerComponent implements OnInit { public dialogRef: MatDialogRef, private formBuilder: UntypedFormBuilder, @Inject(MAT_DIALOG_DATA) public data: LayerMatDialogData - ) { - this.buildForm(); - } + ) {} ngOnInit() { this.linestringOnly = true; @@ -50,12 +48,13 @@ export class StyleModalLayerComponent implements OnInit { } } this.buildStyleData(); + this.buildForm(); } private buildForm() { this.form = this.formBuilder.group({ - fill: [''], - stroke: [''] + fill: [this.getLayerFillColor()], + stroke: [this.getLayerStrokeColor()] }); } @@ -70,7 +69,7 @@ export class StyleModalLayerComponent implements OnInit { }; } - getLayerFillColor() { + private getLayerFillColor() { let fillColor = this.defaultValues.fillColor; const style = this.layerOlStyle; if (style?.getFill()?.getColor()) { @@ -82,7 +81,7 @@ export class StyleModalLayerComponent implements OnInit { return fillColor; } - getLayerStrokeColor() { + private getLayerStrokeColor() { let strokeColor = this.defaultValues.strokeColor; const style = this.layerOlStyle; if (style?.getStroke()?.getColor()) { From 61880fcec7d67440759265869751b6e8897d78da Mon Sep 17 00:00:00 2001 From: MSPKarengeo <90481471+MSPKarengeo@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:42:11 -0400 Subject: [PATCH 27/38] traduction_couches_culture_mcc (#1428) Co-authored-by: karengeo --- packages/geo/src/locale/en.geo.json | 12 +++++++++--- packages/geo/src/locale/fr.geo.json | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/geo/src/locale/en.geo.json b/packages/geo/src/locale/en.geo.json index fc996613b0..94e40baf0c 100644 --- a/packages/geo/src/locale/en.geo.json +++ b/packages/geo/src/locale/en.geo.json @@ -616,7 +616,7 @@ "freehandControl": "Freehand", "group": { "toponyme": "Toponym", - "culturel": "Cultural", + "culture": "Culture", "education": "Education", "sante": "Health", "securite": "Security", @@ -645,8 +645,14 @@ "geographie": "Natural sites", "parc": "Parks", "secteur": "Sector", - "immeubles": "Tenement", - "sites": "Cultural sites", + "sites-archeologiques":"Complete archaeological sites (centroid and reservation)", + "sites-archeologiques-partiel-s":"Archaeological sites - surface area (partial)", + "zones-inf-archeologique":"Archaeological information zones", + "grille-borden":"Grille borden", + "immeubles-patrimoniaux":"Heritage buildings (classified and cited)", + "immeubles-patrimoniaux-s":"Protected land and protection area (of listed heritage buildings)", + "sites-patrimoniaux-declares":"Heritage sites (classified, declared, national)", + "sites-patrimoniaux":"Heritage sites cited", "service-garde": "Child care", "public": "Public schools", "prive": "Private school", diff --git a/packages/geo/src/locale/fr.geo.json b/packages/geo/src/locale/fr.geo.json index f206c0bc50..2f06a335b5 100644 --- a/packages/geo/src/locale/fr.geo.json +++ b/packages/geo/src/locale/fr.geo.json @@ -617,7 +617,7 @@ "freehandControl": "À main levée", "group": { "toponyme": "Toponyme", - "culturel": "Culturel", + "culture": "Culture", "education": "Éducation", "sante": "Santé", "securite": "Sécurité", @@ -646,8 +646,14 @@ "geographie": "Lieux naturels", "parc": "Parcs", "secteur": "Secteurs", - "immeubles": "Immeubles patrimoniaux", - "sites": "Sites patrimoniaux", + "sites-archeologiques":"Sites archéologiques complet (centroide et réservation)", + "sites-archeologiques-partiel-s":"Sites archéologiques - surfacique (partiel)", + "zones-inf-archeologique":"Zones d'information archéologiques", + "grille-borden":"Grille borden", + "immeubles-patrimoniaux":"Immeubles patrimoniaux (classés et cités)", + "immeubles-patrimoniaux-s":"Terrain protégé et aire de protection (d'immeuble patrimoniaux classé)", + "sites-patrimoniaux-declares":"Sites patrimoniaux (classés,déclarés,nationaux)", + "sites-patrimoniaux":"Sites patrimoniaux cités", "service-garde": "Services de garde", "public": "Écoles publiques", "prive": "Écoles privées", From b68e198439b47f9987ce1d8f3b62b98b7b306539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:04:25 -0400 Subject: [PATCH 28/38] refactor(vector-layer): make sure to have properties to select the right loader * refactor(demo): refine examples for layer(s) * refactor(wfs): typing and some null check addition * refactor(vector-layer): make sure to have properties to select the right loader * refactor(wfs): delete urlfunction on source creation. --- demo/src/app/geo/layer/layer.component.ts | 6 +++--- .../shared/datasources/wfs-datasource.ts | 16 +--------------- .../shared/datasources/wms-wfs.utils.ts | 13 +++++++------ packages/geo/src/lib/filter/shared/ogc-filter.ts | 5 +++-- .../src/lib/layer/shared/layers/vector-layer.ts | 5 +++-- 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/demo/src/app/geo/layer/layer.component.ts b/demo/src/app/geo/layer/layer.component.ts index 8039dedabc..28b0d5ec82 100644 --- a/demo/src/app/geo/layer/layer.component.ts +++ b/demo/src/app/geo/layer/layer.component.ts @@ -64,12 +64,12 @@ export class AppLayerComponent { fieldNameGeometry: 'geometry', maxFeatures: 10000, version: '2.0.0', - outputFormat: undefined, + outputFormat: 'geojson', outputFormatDownload: 'shp' }, ogcFilters: { enabled: true, - editable: true, + editable: false, filters: { operator: 'PropertyIsEqualTo', propertyName: 'code_municipalite', @@ -103,7 +103,7 @@ export class AppLayerComponent { }, ogcFilters: { enabled: true, - editable: true, + editable: false, filters: { operator: 'PropertyIsEqualTo', propertyName: 'code_municipalite', diff --git a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts index da7306647a..52fdc2e870 100644 --- a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts +++ b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts @@ -1,7 +1,5 @@ import olSourceVector from 'ol/source/Vector'; import * as OlLoadingStrategy from 'ol/loadingstrategy'; -import olProjection from 'ol/proj/Projection'; -import * as olproj from 'ol/proj'; import type { default as OlGeometry } from 'ol/geom/Geometry'; import { DataSource } from './datasource'; @@ -16,8 +14,7 @@ import { import { defaultFieldNameGeometry, checkWfsParams, - getFormatFromOptions, - buildUrl + getFormatFromOptions } from './wms-wfs.utils'; import { AuthInterceptor } from '@igo2/auth'; @@ -81,17 +78,6 @@ export class WFSDataSource extends DataSource { protected createOlSource(): olSourceVector { const vectorSource = new olSourceVector({ format: getFormatFromOptions(this.options), - url: (extent, resolution, proj: olProjection) => { - const paramsWFS = this.options.paramsWFS; - const wfsProj = paramsWFS.srsName - ? new olProjection({ code: paramsWFS.srsName }) - : proj; - const ogcFilters = (this.options as OgcFilterableDataSourceOptions) - .ogcFilters; - const currentExtent = olproj.transformExtent(extent, proj, wfsProj); - paramsWFS.srsName = paramsWFS.srsName || proj.getCode(); - return buildUrl(this.options, currentExtent, wfsProj, ogcFilters); - }, strategy: OlLoadingStrategy.bbox }); return vectorSource; diff --git a/packages/geo/src/lib/datasource/shared/datasources/wms-wfs.utils.ts b/packages/geo/src/lib/datasource/shared/datasources/wms-wfs.utils.ts index 1e1c48dfe7..6f7d4e90fa 100644 --- a/packages/geo/src/lib/datasource/shared/datasources/wms-wfs.utils.ts +++ b/packages/geo/src/lib/datasource/shared/datasources/wms-wfs.utils.ts @@ -9,6 +9,7 @@ import olFormatGML3 from 'ol/format/GML3'; import olFormatGML32 from 'ol/format/GML32'; import olFormatOSMXML from 'ol/format/OSMXML'; import olProjection from 'ol/proj/Projection'; +import { Extent } from 'ol/extent'; export const defaultEpsg = 'EPSG:3857'; export const defaultMaxFeatures = 5000; @@ -27,7 +28,7 @@ export const jsonRegex = new RegExp(/(.*)?json(.*)?/gi); */ export function buildUrl( options: WFSDataSourceOptions, - extent, + extent: Extent, proj: olProjection, ogcFilters: OgcFiltersOptions, randomParam?: boolean @@ -39,20 +40,20 @@ export function buildUrl( options.paramsWFS.srsName ); let igoFilters; - if (ogcFilters && ogcFilters.enabled) { - igoFilters = ogcFilters.filters; + if (ogcFilters?.enabled) { + igoFilters = ogcFilters?.filters; } const ogcFilterWriter = new OgcFilterWriter(); const filterOrBox = ogcFilterWriter.buildFilter( igoFilters, extent, proj, - ogcFilters.geometryName, + ogcFilters?.geometryName, options ); let filterOrPush = ogcFilterWriter.handleOgcFiltersAppliedValue( options, - ogcFilters.geometryName, + ogcFilters?.geometryName, extent, proj ); @@ -63,7 +64,7 @@ export function buildUrl( filterOrPush = extent.join(',') + ',' + proj.getCode(); } - paramsWFS.xmlFilter = ogcFilters.advancedOgcFilters + paramsWFS.xmlFilter = ogcFilters?.advancedOgcFilters ? filterOrBox : `${prefix}=${filterOrPush}`; let baseUrl = queryStringValues.find((f) => f.name === 'getfeature').value; diff --git a/packages/geo/src/lib/filter/shared/ogc-filter.ts b/packages/geo/src/lib/filter/shared/ogc-filter.ts index 73ab1d5c57..c9e34a39cf 100644 --- a/packages/geo/src/lib/filter/shared/ogc-filter.ts +++ b/packages/geo/src/lib/filter/shared/ogc-filter.ts @@ -21,6 +21,7 @@ import { import { OgcFilterOperatorType, OgcFilterOperator } from './ogc-filter.enum'; import { SourceFieldsOptionsParams } from '../../datasource/shared/datasources/datasource.interface'; import { default as moment } from 'moment'; +import { Extent } from 'ol/extent'; export class OgcFilterWriter { private filterSequence: OgcInterfaceFilterOptions[] = []; public operators = { @@ -106,7 +107,7 @@ export class OgcFilterWriter { public buildFilter( filters?: IgoOgcFilterObject, - extent?: [number, number, number, number], + extent?: Extent, proj?: olProjection, fieldNameGeometry?: string, options?: OgcFilterableDataSourceOptions @@ -711,7 +712,7 @@ export class OgcFilterWriter { public handleOgcFiltersAppliedValue( options: OgcFilterableDataSourceOptions, fieldNameGeometry: string, - extent?: [number, number, number, number], + extent?: Extent, proj?: olProjection ): string { const ogcFilters = options.ogcFilters; diff --git a/packages/geo/src/lib/layer/shared/layers/vector-layer.ts b/packages/geo/src/lib/layer/shared/layers/vector-layer.ts index 089daf7197..4699fffce7 100644 --- a/packages/geo/src/lib/layer/shared/layers/vector-layer.ts +++ b/packages/geo/src/lib/layer/shared/layers/vector-layer.ts @@ -125,7 +125,8 @@ export class VectorLayer extends Layer { } const olOptions = Object.assign({}, this.options, { - source: this.options.source.ol as olSourceVector + source: this.options.source.ol as olSourceVector, + sourceOptions: this.options.sourceOptions || this.options.source.options }); if (this.options.animation) { @@ -180,7 +181,7 @@ export class VectorLayer extends Layer { if (typeof url === 'function') { return vector; } - if (url) { + if (url || olOptions.sourceOptions?.type === 'wfs') { let loader: FeatureLoader; const wfsOptions = olOptions.sourceOptions as WFSDataSourceOptions; if ( From 3b75824a1c7273776c68621826a6658121859e03 Mon Sep 17 00:00:00 2001 From: alecarn <133774929+alecarn@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:44:07 -0400 Subject: [PATCH 29/38] feat(*): add types for app environment and config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(App): add types for app environment and config * fix(Environment): remove circular dependencies between packages * feat(Environment): add an environment file by package * fix(Environment): add missing options * fix(Storage): respect the generic type * Get config typed (#1430) * chore(auth): set type for each configService.getConfig usage * chore(common): set type for each configService.getConfig usage * chore(context): set type for each configService.getConfig usage * chore(core): set type for each configService.getConfig usage * chore(geo): set type for each configService.getConfig usage * chore(integration): set type for each configService.getConfig usage * chore(*): normalize EnvironmentOptions syntax * various fix * refactor(catalog): adapt the interface to handle catalo queryformat property * refactor(*): remove todo comments * refactor(*): minor interface changes * refactor(about-tool): adjust version handling based on config. * refactor(core): add a deprecated key (config) * refactor(*): minor adjustements to interfaces * refactor(integration): minor interface changes --------- Co-authored-by: Pierre-Étienne Lord Co-authored-by: Pierre-Étienne Lord <7397743+pelord@users.noreply.github.com> --- demo/src/environments/environment.prod.ts | 23 +++---- demo/src/environments/environment.ts | 35 ++++------- .../lib/environment/environment.interface.ts | 6 ++ packages/auth/src/lib/environment/index.ts | 1 + packages/auth/src/lib/shared/admin.guard.ts | 5 +- .../src/lib/shared/auth-microsoft.provider.ts | 12 ++-- packages/auth/src/lib/shared/auth.guard.ts | 5 +- .../auth/src/lib/shared/auth.interceptor.ts | 18 ++++-- .../auth/src/lib/shared/auth.interface.ts | 7 +-- packages/auth/src/lib/shared/auth.service.ts | 63 ++++++++++--------- packages/auth/src/lib/shared/logged.guard.ts | 5 +- packages/auth/src/lib/shared/profils.guard.ts | 5 +- packages/auth/src/public_api.ts | 1 + .../lib/environment/environment.interface.ts | 15 +++++ packages/common/src/lib/environment/index.ts | 1 + .../interactive-tour.service.ts | 6 +- packages/common/src/public_api.ts | 1 + .../context-list/context-list.component.html | 6 +- .../context-list/context-list.component.ts | 10 ++- .../shared/layer-context.directive.ts | 15 +---- .../lib/environment/environment.interface.ts | 10 +++ packages/context/src/lib/environment/index.ts | 1 + packages/context/src/public_api.ts | 1 + .../core/src/lib/config/config-deprecated.ts | 8 +++ .../core/src/lib/config/config.interface.ts | 8 ++- .../core/src/lib/config/config.service.ts | 12 ++-- packages/core/src/lib/config/version.ts | 6 +- .../lib/environment/environment.interface.ts | 18 ++++++ packages/core/src/lib/environment/index.ts | 1 + packages/core/src/lib/storage/storage.ts | 2 +- packages/core/src/public_api.ts | 1 + .../src/lib/catalog/shared/catalog.enum.ts | 6 ++ .../lib/catalog/shared/catalog.interface.ts | 17 +++-- .../src/lib/catalog/shared/catalog.service.ts | 10 +-- .../directions-source.interface.ts | 21 ++++--- .../osrm-directions-source.ts | 4 +- .../directions/shared/directions.service.ts | 5 +- .../src/lib/draw/shared/draw-icon.service.ts | 2 +- .../lib/environment/environment.interface.ts | 63 +++++++++++++++++++ packages/geo/src/lib/environment/index.ts | 1 + .../ogc-filter-selection.component.ts | 10 ++- .../import-export/import-export.component.ts | 46 +++++++------- .../shared/drop-geo-file.directive.ts | 14 +---- .../import-export/shared/import.interface.ts | 1 + .../home-extent-button.component.ts | 13 ++-- .../home-extent-button.interface.ts | 7 +++ .../src/lib/map/home-extent-button/index.ts | 1 + .../controllers/geolocation.interface.ts | 9 +++ packages/geo/src/lib/map/shared/map.ts | 10 +-- .../lib/map/shared/projection.interfaces.ts | 4 +- .../src/lib/map/shared/projection.service.ts | 5 +- .../lib/offline/shared/geo-network.service.ts | 1 - .../shared/vector/vector-style.interface.ts | 5 ++ .../shared/feature-workspace.service.ts | 8 ++- .../workspace/shared/wfs-workspace.service.ts | 8 ++- .../workspace/shared/wms-workspace.service.ts | 8 ++- packages/geo/src/public_api.ts | 1 + .../about-tool/about-tool.component.html | 2 +- .../about/about-tool/about-tool.component.ts | 31 ++++----- .../lib/environment/environment.interface.ts | 38 +++++++++++ .../integration/src/lib/environment/index.ts | 1 + .../advanced-coordinates.component.ts | 38 +++++++---- .../integration/src/lib/search/query.state.ts | 10 +-- .../src/lib/search/search.state.ts | 12 ++-- .../src/locale/en.integration.json | 2 +- .../src/locale/fr.integration.json | 2 +- packages/integration/src/public_api.ts | 1 + 67 files changed, 471 insertions(+), 254 deletions(-) create mode 100644 packages/auth/src/lib/environment/environment.interface.ts create mode 100644 packages/auth/src/lib/environment/index.ts create mode 100644 packages/common/src/lib/environment/environment.interface.ts create mode 100644 packages/common/src/lib/environment/index.ts create mode 100644 packages/context/src/lib/environment/environment.interface.ts create mode 100644 packages/context/src/lib/environment/index.ts create mode 100644 packages/core/src/lib/environment/environment.interface.ts create mode 100644 packages/core/src/lib/environment/index.ts create mode 100644 packages/geo/src/lib/environment/environment.interface.ts create mode 100644 packages/geo/src/lib/environment/index.ts create mode 100644 packages/geo/src/lib/map/home-extent-button/home-extent-button.interface.ts create mode 100644 packages/integration/src/lib/environment/environment.interface.ts create mode 100644 packages/integration/src/lib/environment/index.ts diff --git a/demo/src/environments/environment.prod.ts b/demo/src/environments/environment.prod.ts index 9aa82ba9a9..7b8491153b 100644 --- a/demo/src/environments/environment.prod.ts +++ b/demo/src/environments/environment.prod.ts @@ -1,9 +1,7 @@ -interface Environment { - production: boolean; - igo: any; -} +import { EnvironmentOptions } from '@igo2/integration'; +import { CatalogQueryFormatTypes, ICatalog, TooltipType } from '@igo2/geo'; -export const environment: Environment = { +export const environment: EnvironmentOptions = { production: true, igo: { projections: [ @@ -15,13 +13,15 @@ export const environment: Environment = { } ], auth: { + tokenKey: 'testIgo2Lib', intern: { enabled: true }, allowAnonymous: true }, interactiveTour: { - tourInMobile: true + tourInMobile: true, + activateInteractiveTour: true }, importExport: { url: 'https://geoegl.msp.gouv.qc.ca/apis/ogre' @@ -42,14 +42,11 @@ export const environment: Environment = { url: 'https://ws.mapserver.transports.gouv.qc.ca/swtq', queryFormat: { html: '*', - 'application/json': [ - 'stations_meteoroutieres', - 'histo_stations_meteoroutieres' - ] - }, + json: ['stations_meteoroutieres', 'histo_stations_meteoroutieres'] + } as CatalogQueryFormatTypes, queryHtmlTarget: 'iframe', count: 30 - }, + } as ICatalog, { id: 'catalogwithregex', title: 'Filtered catalog by regex', @@ -60,7 +57,7 @@ export const environment: Environment = { id: 'catalogwithtooltipcontrol', title: 'Controling tooltip format', url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/igo_gouvouvert.fcgi', - tooltipType: 'abstract' // or title + tooltipType: TooltipType.ABSTRACT } ] }, diff --git a/demo/src/environments/environment.ts b/demo/src/environments/environment.ts index eb5340325a..1b1d122e97 100644 --- a/demo/src/environments/environment.ts +++ b/demo/src/environments/environment.ts @@ -1,15 +1,7 @@ -// This file can be replaced during build by using the `fileReplacements` array. -// `ng build ---configuration production` replaces `environment.ts` with `environment.prod.ts`. -// The list of file replacements can be found in `angular.json`. +import { EnvironmentOptions } from '@igo2/integration'; +import { TooltipType, CatalogQueryFormatTypes, ICatalog } from '@igo2/geo'; -// import { IgoEnvironment } from '@igo2/core'; - -interface Environment { - production: boolean; - igo: any; -} - -export const environment: Environment = { +export const environment: EnvironmentOptions = { production: false, igo: { importWithStyle: true, @@ -54,14 +46,11 @@ export const environment: Environment = { url: 'https://ws.mapserver.transports.gouv.qc.ca/swtq', queryFormat: { html: '*', - 'application/json': [ - 'stations_meteoroutieres', - 'histo_stations_meteoroutieres' - ] - }, + json: ['stations_meteoroutieres', 'histo_stations_meteoroutieres'] + } as CatalogQueryFormatTypes, queryHtmlTarget: 'iframe', count: 30 - }, + } as ICatalog, { id: 'catalogwithregex', title: 'Filtered catalog by regex', @@ -72,7 +61,7 @@ export const environment: Environment = { id: 'catalogwithtooltipcontrol', title: 'Controling tooltip format', url: 'https://geoegl.msp.gouv.qc.ca/apis/ws/igo_gouvouvert.fcgi', - tooltipType: 'abstract' // or title + tooltipType: TooltipType.ABSTRACT }, { id: 'arcgisrestcompletecatalog', @@ -148,7 +137,7 @@ export const environment: Environment = { id: 'wmts_error', url: 'https://servicesmatriciels.mern.gouv.qc.ca/erdas-iws/ogc/wmts/Elevation?SERVICE=WMTS&REQUEST=GetCapabilities', type: 'wmts', - crossOrigin: true, + setCrossOriginAnonymous: true, matrixSet: 'EPSG_3857', version: '1.0.0', forcedProperties: [ @@ -166,7 +155,7 @@ export const environment: Environment = { id: 'wms', url: 'https://cartes.geogratis.gc.ca/wms/canvec_fr', type: 'wms', - crossOrigin: true, + setCrossOriginAnonymous: true, version: '1.3.0', forcedProperties: [ { @@ -223,7 +212,7 @@ export const environment: Environment = { id: 'wms', url: 'https://cartes.geogratis.gc.ca/wms/canvec_fr', type: 'wms', - crossOrigin: true, + setCrossOriginAnonymous: true, version: '1.3.0' }, { @@ -237,7 +226,7 @@ export const environment: Environment = { id: 'rn_wmts_1', url: 'https://servicesmatriciels.mern.gouv.qc.ca/erdas-iws/ogc/wmts/Cartes_Images', type: 'wmts', - crossOrigin: true, + setCrossOriginAnonymous: true, matrixSet: 'EPSG_3857', version: '1.0.0', forcedProperties: [ @@ -293,7 +282,7 @@ export const environment: Environment = { title: 'Feuillets SNRC', searchUrl: '/ws/mffpecofor.fcgi', storedquery_id: 'sq250et20kFeuillet', - fields: { name: 'no_feuillet', defaultValue: '0' }, + fields: [{ name: 'no_feuillet', defaultValue: '0' }], resultTitle: 'feuillet', params: { limit: '8' diff --git a/packages/auth/src/lib/environment/environment.interface.ts b/packages/auth/src/lib/environment/environment.interface.ts new file mode 100644 index 0000000000..fe5bce3498 --- /dev/null +++ b/packages/auth/src/lib/environment/environment.interface.ts @@ -0,0 +1,6 @@ +import { AuthOptions, AuthStorageOptions } from '../shared'; + +export interface EnvironmentOptions { + auth?: AuthOptions; + storage?: AuthStorageOptions; +} diff --git a/packages/auth/src/lib/environment/index.ts b/packages/auth/src/lib/environment/index.ts new file mode 100644 index 0000000000..3af98079bc --- /dev/null +++ b/packages/auth/src/lib/environment/index.ts @@ -0,0 +1 @@ +export * from './environment.interface'; diff --git a/packages/auth/src/lib/shared/admin.guard.ts b/packages/auth/src/lib/shared/admin.guard.ts index 72b01079ba..31145486f2 100644 --- a/packages/auth/src/lib/shared/admin.guard.ts +++ b/packages/auth/src/lib/shared/admin.guard.ts @@ -7,6 +7,7 @@ import { import { ConfigService } from '@igo2/core'; import { AuthService } from './auth.service'; +import { AuthOptions } from './auth.interface'; @Injectable({ providedIn: 'root' @@ -26,8 +27,8 @@ export class AdminGuard { this.authService.redirectUrl = state.url; - const authConfig = this.config.getConfig('auth'); - if (authConfig && authConfig.loginRoute) { + const authConfig = this.config.getConfig('auth') as AuthOptions; + if (authConfig?.loginRoute) { this.router.navigateByUrl(authConfig.loginRoute); } diff --git a/packages/auth/src/lib/shared/auth-microsoft.provider.ts b/packages/auth/src/lib/shared/auth-microsoft.provider.ts index a9e5326be0..0d8acab667 100644 --- a/packages/auth/src/lib/shared/auth-microsoft.provider.ts +++ b/packages/auth/src/lib/shared/auth-microsoft.provider.ts @@ -20,7 +20,7 @@ import { MsalServiceb2c } from './auth-msalServiceb2c.service.'; export function MSALConfigFactory( config: ConfigService ): PublicClientApplication { - const msConf: BrowserAuthOptions | null = config.getConfig('auth.microsoft'); + const msConf = config.getConfig('auth.microsoft') as AuthMicrosoftOptions; msConf.redirectUri = msConf?.redirectUri || window.location.href; msConf.authority = @@ -39,9 +39,9 @@ export function MSALConfigFactory( export function MSALConfigFactoryb2c( config: ConfigService ): PublicClientApplication { - const msConf: BrowserAuthOptions | null = config.getConfig( + const msConf = config.getConfig( 'auth.microsoftb2c.browserAuthOptions' - ); + ) as BrowserAuthOptions; msConf.redirectUri = msConf?.redirectUri || window.location.href; msConf.authority = msConf?.authority || 'https://login.microsoftonline.com/organizations'; @@ -59,7 +59,7 @@ export function MSALConfigFactoryb2c( export function MSALAngularConfigFactory( config: ConfigService ): MSPMsalGuardConfiguration { - const msConf: AuthMicrosoftOptions = config.getConfig('auth.microsoft'); + const msConf = config.getConfig('auth.microsoft') as AuthMicrosoftOptions; return { interactionType: InteractionType.Popup, @@ -74,9 +74,9 @@ export function MSALAngularConfigFactory( export function MSALAngularConfigFactoryb2c( config: ConfigService ): MSPMsalGuardConfiguration { - const msConf: BrowserAuthOptions | null = config.getConfig( + const msConf = config.getConfig( 'auth.microsoftb2c.browserAuthOptions' - ); + ) as BrowserAuthOptions; return { interactionType: InteractionType.Popup, diff --git a/packages/auth/src/lib/shared/auth.guard.ts b/packages/auth/src/lib/shared/auth.guard.ts index cdc0d41ece..727ee37520 100644 --- a/packages/auth/src/lib/shared/auth.guard.ts +++ b/packages/auth/src/lib/shared/auth.guard.ts @@ -7,6 +7,7 @@ import { import { ConfigService } from '@igo2/core'; import { AuthService } from './auth.service'; +import { AuthOptions } from './auth.interface'; @Injectable({ providedIn: 'root' @@ -25,8 +26,8 @@ export class AuthGuard { this.authService.redirectUrl = state.url; - const authConfig = this.config.getConfig('auth'); - if (authConfig && authConfig.loginRoute) { + const authConfig = this.config.getConfig('auth') as AuthOptions; + if (authConfig?.loginRoute) { this.router.navigateByUrl(authConfig.loginRoute); } diff --git a/packages/auth/src/lib/shared/auth.interceptor.ts b/packages/auth/src/lib/shared/auth.interceptor.ts index 802b9f8ed0..ffbba1e50b 100644 --- a/packages/auth/src/lib/shared/auth.interceptor.ts +++ b/packages/auth/src/lib/shared/auth.interceptor.ts @@ -11,12 +11,17 @@ import { Md5 } from 'ts-md5'; import { ConfigService } from '@igo2/core'; import { TokenService } from './token.service'; -import { AuthByKeyOptions, WithCredentialsOptions } from './auth.interface'; +import { + AuthByKeyOptions, + AuthOptions, + WithCredentialsOptions +} from './auth.interface'; @Injectable({ providedIn: 'root' }) export class AuthInterceptor implements HttpInterceptor { + private authOptions: AuthOptions; private refreshInProgress = false; private trustHosts: string[]; private hostsWithCredentials: WithCredentialsOptions[]; @@ -27,12 +32,13 @@ export class AuthInterceptor implements HttpInterceptor { private tokenService: TokenService, private http: HttpClient ) { - this.trustHosts = this.config.getConfig('auth.trustHosts') || []; + this.authOptions = this.config.getConfig('auth') as AuthOptions; + + this.trustHosts = this.authOptions?.trustHosts || []; this.trustHosts.push(window.location.hostname); - this.hostsWithCredentials = - this.config.getConfig('auth.hostsWithCredentials') || []; - this.hostsWithAuthByKey = this.config.getConfig('auth.hostsByKey') || []; + this.hostsWithCredentials = this.authOptions?.hostsWithCredentials || []; + this.hostsWithAuthByKey = this.authOptions?.hostsByKey || []; } intercept( @@ -171,7 +177,7 @@ export class AuthInterceptor implements HttpInterceptor { ) { this.refreshInProgress = true; - const url = this.config.getConfig('auth.url'); + const url = this.authOptions?.url; return this.http.post(`${url}/refresh`, {}).subscribe( (data: any) => { this.tokenService.set(data.token); diff --git a/packages/auth/src/lib/shared/auth.interface.ts b/packages/auth/src/lib/shared/auth.interface.ts index 17ac6490d3..4cad1e1410 100644 --- a/packages/auth/src/lib/shared/auth.interface.ts +++ b/packages/auth/src/lib/shared/auth.interface.ts @@ -16,11 +16,8 @@ export interface AuthGoogleOptions { clientId: string; } -export interface AuthMicrosoftOptions { +export interface AuthMicrosoftOptions extends BrowserAuthOptions { enabled?: boolean; - clientId: string; - redirectUri?: string; - authority?: string; } export interface AuthMicrosoftb2cOptions { @@ -54,7 +51,7 @@ export interface AuthMicrosoftb2cOptionsAuthority { export interface AuthOptions { url?: string; - tokenKey: string; + tokenKey?: string; allowAnonymous?: boolean; loginRoute?: string; logoutRoute?: string; diff --git a/packages/auth/src/lib/shared/auth.service.ts b/packages/auth/src/lib/shared/auth.service.ts index 4d04ba0b66..3a0cbd6a2c 100644 --- a/packages/auth/src/lib/shared/auth.service.ts +++ b/packages/auth/src/lib/shared/auth.service.ts @@ -9,7 +9,7 @@ import { globalCacheBusterNotifier } from 'ts-cacheable'; import { ConfigService, LanguageService, MessageService } from '@igo2/core'; import { Base64 } from '@igo2/utils'; -import { User, IInfosUser } from './auth.interface'; +import { User, IInfosUser, AuthOptions } from './auth.interface'; import { TokenService } from './token.service'; @Injectable({ @@ -21,9 +21,10 @@ export class AuthService { public redirectUrl: string; public languageForce = false; private anonymous = false; + private authOptions: AuthOptions; get hasAuthService() { - return this.config.getConfig('auth.url') !== undefined; + return this.authOptions?.url !== undefined; } constructor( @@ -34,6 +35,7 @@ export class AuthService { private messageService: MessageService, @Optional() private router: Router ) { + this.authOptions = this.config.getConfig('auth'); this.authenticate$.next(this.authenticated); this.authenticate$.subscribe((authenticated) => { this.logged$.next(authenticated); @@ -75,8 +77,7 @@ export class AuthService { } refresh(): Observable { - const url = this.config.getConfig('auth.url'); - return this.http.post(`${url}/refresh`, {}).pipe( + return this.http.post(`${this.authOptions?.url}/refresh`, {}).pipe( tap((data: any) => { this.tokenService.set(data.token); }), @@ -115,9 +116,8 @@ export class AuthService { } const redirectUrl = this.redirectUrl || this.router.url; - const options = this.config.getConfig('auth') || {}; - if (redirectUrl === options.loginRoute) { - const homeRoute = options.homeRoute || '/'; + if (redirectUrl === this.authOptions.loginRoute) { + const homeRoute = this.authOptions.homeRoute || '/'; this.router.navigateByUrl(homeRoute); } else if (redirectUrl) { this.router.navigateByUrl(redirectUrl); @@ -125,18 +125,18 @@ export class AuthService { } getUserInfo(): Observable { - const url = this.config.getConfig('auth.url') + '/info'; + const url = this.authOptions?.url + '/info'; return this.http.get(url); } getProfils(): Observable<{ profils: string[] }> { - const url = this.config.getConfig('auth.url'); - return this.http.get<{ profils: string[] }>(`${url}/profils`); + return this.http.get<{ profils: string[] }>( + `${this.authOptions?.url}/profils` + ); } updateUser(user: User): Observable { - const url = this.config.getConfig('auth.url'); - return this.http.patch(url, user); + return this.http.patch(this.authOptions?.url, user); } private encodePassword(password: string) { @@ -165,25 +165,26 @@ export class AuthService { } private loginCall(body, headers) { - const url = this.config.getConfig('auth.url'); - return this.http.post(`${url}/login`, body, { headers }).pipe( - tap((data: any) => { - this.tokenService.set(data.token); - const tokenDecoded = this.decodeToken(); - if (tokenDecoded && tokenDecoded.user) { - if (tokenDecoded.user.locale && !this.languageForce) { - this.languageService.setLanguage(tokenDecoded.user.locale); + return this.http + .post(`${this.authOptions?.url}/login`, body, { headers }) + .pipe( + tap((data: any) => { + this.tokenService.set(data.token); + const tokenDecoded = this.decodeToken(); + if (tokenDecoded && tokenDecoded.user) { + if (tokenDecoded.user.locale && !this.languageForce) { + this.languageService.setLanguage(tokenDecoded.user.locale); + } + if (tokenDecoded.user.isExpired) { + this.messageService.alert('igo.auth.error.Password expired'); + } } - if (tokenDecoded.user.isExpired) { - this.messageService.alert('igo.auth.error.Password expired'); - } - } - this.authenticate$.next(true); - }), - catchError((err) => { - err.error.caught = true; - throw err; - }) - ); + this.authenticate$.next(true); + }), + catchError((err) => { + err.error.caught = true; + throw err; + }) + ); } } diff --git a/packages/auth/src/lib/shared/logged.guard.ts b/packages/auth/src/lib/shared/logged.guard.ts index a6b67a67bb..7674d5bdfd 100644 --- a/packages/auth/src/lib/shared/logged.guard.ts +++ b/packages/auth/src/lib/shared/logged.guard.ts @@ -7,6 +7,7 @@ import { import { ConfigService } from '@igo2/core'; import { AuthService } from './auth.service'; +import { AuthOptions } from './auth.interface'; @Injectable({ providedIn: 'root' @@ -25,8 +26,8 @@ export class LoggedGuard { this.authService.redirectUrl = state.url; - const authConfig = this.config.getConfig('auth'); - if (authConfig && authConfig.loginRoute) { + const authConfig = this.config.getConfig('auth') as AuthOptions; + if (authConfig?.loginRoute) { this.router.navigateByUrl(authConfig.loginRoute); } diff --git a/packages/auth/src/lib/shared/profils.guard.ts b/packages/auth/src/lib/shared/profils.guard.ts index 31d1d7d55a..7c927855bd 100644 --- a/packages/auth/src/lib/shared/profils.guard.ts +++ b/packages/auth/src/lib/shared/profils.guard.ts @@ -8,6 +8,7 @@ import { map } from 'rxjs/operators'; import { ConfigService } from '@igo2/core'; import { AuthService } from './auth.service'; +import { AuthOptions } from './auth.interface'; @Injectable({ providedIn: 'root' @@ -22,7 +23,7 @@ export class ProfilsGuard { canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { return this.authService.getProfils().pipe( map((profils: { profils: string[] }) => { - const authConfig = this.config.getConfig('auth'); + const authConfig = this.config.getConfig('auth') as AuthOptions; if ( profils && profils.profils && @@ -33,7 +34,7 @@ export class ProfilsGuard { this.authService.redirectUrl = state.url; - if (authConfig && authConfig.loginRoute) { + if (authConfig?.loginRoute) { this.router.navigateByUrl(authConfig.loginRoute); } diff --git a/packages/auth/src/public_api.ts b/packages/auth/src/public_api.ts index 9d3fbd0ae0..a2345ee1e5 100644 --- a/packages/auth/src/public_api.ts +++ b/packages/auth/src/public_api.ts @@ -3,6 +3,7 @@ */ export { AuthFormComponent } from './lib/auth-form'; +export * from './lib/environment'; export * from './lib/shared/auth.service'; export * from './lib/shared/logged.guard'; export * from './lib/shared/auth.guard'; diff --git a/packages/common/src/lib/environment/environment.interface.ts b/packages/common/src/lib/environment/environment.interface.ts new file mode 100644 index 0000000000..035c51c42b --- /dev/null +++ b/packages/common/src/lib/environment/environment.interface.ts @@ -0,0 +1,15 @@ +export interface EnvironmentOptions { + depot?: DepotOptions; + interactiveTour?: InteractiveTourConfigOptions; +} + +export interface DepotOptions { + url: string; + trainingGuides?: string[]; +} + +export interface InteractiveTourConfigOptions { + activateInteractiveTour?: boolean; + tourInMobile?: boolean; + pathToConfigFile?: string; +} diff --git a/packages/common/src/lib/environment/index.ts b/packages/common/src/lib/environment/index.ts new file mode 100644 index 0000000000..3af98079bc --- /dev/null +++ b/packages/common/src/lib/environment/index.ts @@ -0,0 +1 @@ +export * from './environment.interface'; diff --git a/packages/common/src/lib/interactive-tour/interactive-tour.service.ts b/packages/common/src/lib/interactive-tour/interactive-tour.service.ts index ead06d27c1..448c1970fc 100644 --- a/packages/common/src/lib/interactive-tour/interactive-tour.service.ts +++ b/packages/common/src/lib/interactive-tour/interactive-tour.service.ts @@ -73,10 +73,8 @@ export class InteractiveTourService { const showInMobile = this.configService.getConfig( 'interactiveTour.tourInMobile' ); - if (showInMobile === undefined) { - return true; - } - return this.configService.getConfig('interactiveTour.tourInMobile'); + + return showInMobile === undefined ? true : showInMobile; } private getButtons(buttonKind?: 'first' | 'last' | 'noBackButton') { diff --git a/packages/common/src/public_api.ts b/packages/common/src/public_api.ts index 69f6470561..51b9e608e8 100644 --- a/packages/common/src/public_api.ts +++ b/packages/common/src/public_api.ts @@ -16,6 +16,7 @@ export * from './lib/dom/dom.module'; export * from './lib/drag-drop/drag-drop.module'; export * from './lib/dynamic-component/dynamic-component.module'; export * from './lib/dynamic-component/dynamic-outlet/dynamic-outlet.module'; +export * from './lib/environment'; export * from './lib/flexible/flexible.module'; export * from './lib/form/form.module'; export * from './lib/form/form/form.module'; diff --git a/packages/context/src/lib/context-manager/context-list/context-list.component.html b/packages/context/src/lib/context-manager/context-list/context-list.component.html index c931c445a3..49ee0926a2 100644 --- a/packages/context/src/lib/context-manager/context-list/context-list.component.html +++ b/packages/context/src/lib/context-manager/context-list/context-list.component.html @@ -53,7 +53,7 @@