From 9019eb749d3475326bad05fe6504520ed7de9576 Mon Sep 17 00:00:00 2001 From: guichoquette <159962452+guichoquette@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:14:49 -0400 Subject: [PATCH] 2321-draft version aoi (#2325) --- .vscode/settings.json | 2 +- common/config/rush/pnpm-lock.yaml | 193 ++++++++++++------ packages/geoview-aoi-panel/README.md | 4 + .../default-config-area-of-interest.json | 4 + packages/geoview-aoi-panel/package.json | 41 ++++ packages/geoview-aoi-panel/schema.json | 26 +++ packages/geoview-aoi-panel/src/aoi-panel.tsx | 38 ++++ .../src/area-of-interest-style.ts | 91 +++++++++ packages/geoview-aoi-panel/src/index.tsx | 83 ++++++++ packages/geoview-aoi-panel/tsconfig.json | 30 +++ .../configs/loading-packages-config.json | 2 +- .../26-package-area-of-interest.json | 21 ++ .../public/templates/demos-navigator.html | 1 + .../geoview-core/public/templates/events.html | 3 +- .../public/templates/loading-packages.html | 19 ++ .../types/config-validation-schema.json | 2 +- .../src/api/config/types/map-schema-types.ts | 1 + .../src/core/components/app-bar/app-bar.tsx | 47 +++-- packages/geoview-core/src/ui/icons/index.ts | 1 + packages/geoview-core/webpack.common.js | 5 + rush.json | 4 + 21 files changed, 530 insertions(+), 88 deletions(-) create mode 100644 packages/geoview-aoi-panel/README.md create mode 100644 packages/geoview-aoi-panel/default-config-area-of-interest.json create mode 100644 packages/geoview-aoi-panel/package.json create mode 100644 packages/geoview-aoi-panel/schema.json create mode 100644 packages/geoview-aoi-panel/src/aoi-panel.tsx create mode 100644 packages/geoview-aoi-panel/src/area-of-interest-style.ts create mode 100644 packages/geoview-aoi-panel/src/index.tsx create mode 100644 packages/geoview-aoi-panel/tsconfig.json create mode 100644 packages/geoview-core/public/configs/navigator/26-package-area-of-interest.json diff --git a/.vscode/settings.json b/.vscode/settings.json index b648cc781fe..b3529d0853a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -75,5 +75,5 @@ "bold": false, "italic": false } - ] + ], } diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 7aede62badb..38562e1ec25 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -56,6 +56,73 @@ importers: specifier: ^4.5.5 version: 4.9.5 + ../../packages/geoview-aoi-panel: + dependencies: + geoview-core: + specifier: workspace:~1.0.0 + version: link:../geoview-core + devDependencies: + '@babel/core': + specifier: ^7.17.0 + version: 7.24.7 + '@babel/eslint-parser': + specifier: ^7.17.0 + version: 7.24.7(@babel/core@7.24.7)(eslint@8.57.0) + '@babel/runtime': + specifier: ^7.17.0 + version: 7.24.7 + '@types/react': + specifier: ^18.2.0 + version: 18.3.3 + '@types/react-dom': + specifier: ^18.2.0 + version: 18.3.0 + '@typescript-eslint/eslint-plugin': + specifier: ~7.8.0 + version: 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@4.9.5) + '@typescript-eslint/parser': + specifier: ~7.8.0 + version: 7.8.0(eslint@8.57.0)(typescript@4.9.5) + eslint: + specifier: ^8.8.0 + version: 8.57.0 + eslint-config-airbnb: + specifier: ^19.0.4 + version: 19.0.4(eslint-plugin-import@2.29.1)(eslint-plugin-jsx-a11y@6.9.0)(eslint-plugin-react-hooks@4.6.2)(eslint-plugin-react@7.34.3)(eslint@8.57.0) + eslint-config-prettier: + specifier: ^8.3.0 + version: 8.10.0(eslint@8.57.0) + eslint-plugin-import: + specifier: ^2.25.4 + version: 2.29.1(eslint@8.57.0) + eslint-plugin-jest: + specifier: ^26.0.0 + version: 26.9.0(@typescript-eslint/eslint-plugin@7.8.0)(eslint@8.57.0)(jest@27.5.1)(typescript@4.9.5) + eslint-plugin-jsx-a11y: + specifier: ^6.5.1 + version: 6.9.0(eslint@8.57.0) + eslint-plugin-prettier: + specifier: ^4.0.0 + version: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.57.0)(prettier@2.8.8) + eslint-plugin-react: + specifier: ^7.28.0 + version: 7.34.3(eslint@8.57.0) + eslint-plugin-react-hooks: + specifier: ^4.3.0 + version: 4.6.2(eslint@8.57.0) + prettier: + specifier: ^2.6.0 + version: 2.8.8 + react: + specifier: ^18.2.0 + version: 18.3.1 + react-dom: + specifier: ^18.2.0 + version: 18.3.1(react@18.3.1) + typescript: + specifier: ^4.5.5 + version: 4.9.5 + ../../packages/geoview-basemap-panel: dependencies: geoview-core: @@ -154,7 +221,7 @@ importers: version: 5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react@18.3.1) '@mui/x-date-pickers': specifier: ^7.6.1 - version: 7.7.1(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1) + version: 7.8.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1) '@nieuwlandgeo/sldreader': specifier: ^0.3.1 version: 0.3.1(ol@9.2.4) @@ -208,7 +275,7 @@ importers: version: 7.4.7(react@18.3.1) material-react-table: specifier: ^2.13.0 - version: 2.13.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/icons-material@5.15.21)(@mui/material@5.15.21)(@mui/x-date-pickers@7.7.1)(react-dom@18.3.1)(react@18.3.1) + version: 2.13.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/icons-material@5.15.21)(@mui/material@5.15.21)(@mui/x-date-pickers@7.8.0)(react-dom@18.3.1)(react@18.3.1) ol: specifier: ^9.2.4 version: 9.2.4 @@ -247,7 +314,7 @@ importers: version: 1.10.3 yet-another-react-lightbox: specifier: ^3.11.3 - version: 3.20.1(react-dom@18.3.1)(react@18.3.1) + version: 3.21.0(react-dom@18.3.1)(react@18.3.1) zustand: specifier: ~4.4.1 version: 4.4.7(@types/react@18.3.3)(react@18.3.1) @@ -2450,17 +2517,17 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@floating-ui/core@1.6.3: - resolution: {integrity: sha512-1ZpCvYf788/ZXOhRQGFxnYQOVgeU+pi0i+d0Ow34La7qjIXETi6RNswGVKkA6KcDO8/+Ysu2E/CeUmmeEBDvTg==} + /@floating-ui/core@1.6.4: + resolution: {integrity: sha512-a4IowK4QkXl4SCWTGUR0INAfEOX3wtsYw3rKK5InQEHMGObkR8Xk44qYQD9P4r6HHw0iIfK6GUKECmY8sTkqRA==} dependencies: - '@floating-ui/utils': 0.2.3 + '@floating-ui/utils': 0.2.4 dev: false - /@floating-ui/dom@1.6.6: - resolution: {integrity: sha512-qiTYajAnh3P+38kECeffMSQgbvXty2VB6rS+42iWR4FPIlZjLK84E9qtLnMTLIpPz2znD/TaFqaiavMUrS+Hcw==} + /@floating-ui/dom@1.6.7: + resolution: {integrity: sha512-wmVfPG5o2xnKDU4jx/m4w5qva9FWHcnZ8BvzEe90D/RpwsJaTAVYPEPdQ8sbr/N8zZTAHlZUTQdqg8ZUbzHmng==} dependencies: - '@floating-ui/core': 1.6.3 - '@floating-ui/utils': 0.2.3 + '@floating-ui/core': 1.6.4 + '@floating-ui/utils': 0.2.4 dev: false /@floating-ui/react-dom@2.1.1(react-dom@18.3.1)(react@18.3.1): @@ -2469,13 +2536,13 @@ packages: react: '>=16.8.0' react-dom: '>=16.8.0' dependencies: - '@floating-ui/dom': 1.6.6 + '@floating-ui/dom': 1.6.7 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) dev: false - /@floating-ui/utils@0.2.3: - resolution: {integrity: sha512-XGndio0l5/Gvd6CLIABvsav9HHezgDFFhDfHk1bvLfr9ni8dojqLSvBbotJEjmIwNHL7vK4QzBJTdBRoB+c1ww==} + /@floating-ui/utils@0.2.4: + resolution: {integrity: sha512-dWO2pw8hhi+WrXq1YJy2yCuWoL20PddgGaqTgVe4cOS9Q6qklXCiA1tJEqX6BEwRNSCP84/afac9hd4MS+zEUA==} dev: false /@fontsource/roboto@5.0.13: @@ -3066,8 +3133,8 @@ packages: react-is: 18.3.1 dev: false - /@mui/x-date-pickers@7.7.1(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-p7/TY8QcdQd6RelNqzW5q89GeUFctvZnDHTfQVEC0l0nAy7ArE6u21uNF8QWGrijZoJXCM+OlIRzlZADaUPpWA==} + /@mui/x-date-pickers@7.8.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-SkolW0vZ4XiUeD5FBevG9NQ3pAgfNYlJA5XFhSLFD/swNQRO4EYOUXw38O/ccOh1lkAcwVR+rrGPCoT4/0YGEg==} engines: {node: '>=14.0.0'} peerDependencies: '@emotion/react': ^11.9.0 @@ -4003,20 +4070,20 @@ packages: acorn-walk: 7.2.0 dev: true - /acorn-import-attributes@1.9.5(acorn@8.12.0): + /acorn-import-attributes@1.9.5(acorn@8.12.1): resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} peerDependencies: acorn: ^8 dependencies: - acorn: 8.12.0 + acorn: 8.12.1 dev: true - /acorn-jsx@5.3.2(acorn@8.12.0): + /acorn-jsx@5.3.2(acorn@8.12.1): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.12.0 + acorn: 8.12.1 dev: true /acorn-walk@7.2.0: @@ -4028,7 +4095,7 @@ packages: resolution: {integrity: sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==} engines: {node: '>=0.4.0'} dependencies: - acorn: 8.12.0 + acorn: 8.12.1 dev: true /acorn@7.4.1: @@ -4037,8 +4104,8 @@ packages: hasBin: true dev: true - /acorn@8.12.0: - resolution: {integrity: sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==} + /acorn@8.12.1: + resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -4554,10 +4621,10 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001638 - electron-to-chromium: 1.4.814 + caniuse-lite: 1.0.30001640 + electron-to-chromium: 1.4.816 node-releases: 2.0.14 - update-browserslist-db: 1.0.16(browserslist@4.23.1) + update-browserslist-db: 1.1.0(browserslist@4.23.1) dev: true /bser@2.1.1: @@ -4612,8 +4679,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001638: - resolution: {integrity: sha512-5SuJUJ7cZnhPpeLHaH0c/HPAnAHZvS6ElWyHK9GSIbVOQABLzowiI2pjmpvZ1WEbkyz46iFd4UXlOHR5SqgfMQ==} + /caniuse-lite@1.0.30001640: + resolution: {integrity: sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==} dev: true /chalk@2.4.2: @@ -4947,12 +5014,12 @@ packages: webpack: optional: true dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 - postcss-modules-extract-imports: 3.1.0(postcss@8.4.38) - postcss-modules-local-by-default: 4.0.5(postcss@8.4.38) - postcss-modules-scope: 3.2.0(postcss@8.4.38) - postcss-modules-values: 4.0.0(postcss@8.4.38) + icss-utils: 5.1.0(postcss@8.4.39) + postcss: 8.4.39 + postcss-modules-extract-imports: 3.1.0(postcss@8.4.39) + postcss-modules-local-by-default: 4.0.5(postcss@8.4.39) + postcss-modules-scope: 3.2.0(postcss@8.4.39) + postcss-modules-values: 4.0.0(postcss@8.4.39) postcss-value-parser: 4.2.0 semver: 7.6.2 webpack: 5.92.1(webpack-cli@4.10.0) @@ -5298,8 +5365,8 @@ packages: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: true - /electron-to-chromium@1.4.814: - resolution: {integrity: sha512-GVulpHjFu1Y9ZvikvbArHmAhZXtm3wHlpjTMcXNGKl4IQ4jMQjlnz8yMQYYqdLHKi/jEL2+CBC2akWVCoIGUdw==} + /electron-to-chromium@1.4.816: + resolution: {integrity: sha512-EKH5X5oqC6hLmiS7/vYtZHZFTNdhsYG5NVPRN6Yn0kQHNBlT59+xSM8HBy66P5fxWpKgZbPqb+diC64ng295Jw==} dev: true /email-addresses@3.1.0: @@ -5795,8 +5862,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.12.0 - acorn-jsx: 5.3.2(acorn@8.12.0) + acorn: 8.12.1 + acorn-jsx: 5.3.2(acorn@8.12.1) eslint-visitor-keys: 3.4.3 dev: true @@ -6688,13 +6755,13 @@ packages: safer-buffer: 2.1.2 dev: true - /icss-utils@5.1.0(postcss@8.4.38): + /icss-utils@5.1.0(postcss@8.4.39): resolution: {integrity: sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.38 + postcss: 8.4.39 dev: true /ieee754@1.2.1: @@ -7584,7 +7651,7 @@ packages: optional: true dependencies: abab: 2.0.6 - acorn: 8.12.0 + acorn: 8.12.1 acorn-globals: 6.0.0 cssom: 0.4.4 cssstyle: 2.3.0 @@ -7940,7 +8007,7 @@ packages: hasBin: true dev: true - /material-react-table@2.13.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/icons-material@5.15.21)(@mui/material@5.15.21)(@mui/x-date-pickers@7.7.1)(react-dom@18.3.1)(react@18.3.1): + /material-react-table@2.13.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/icons-material@5.15.21)(@mui/material@5.15.21)(@mui/x-date-pickers@7.8.0)(react-dom@18.3.1)(react@18.3.1): resolution: {integrity: sha512-ds4/cupDsXvoz8K8OpM3UqUyqKoAMkVdvmvP/+ovuWA23fPcjYvFFkUpBxtnZq5GKWM0+SZWzr14KQ1DgKCaFQ==} engines: {node: '>=16'} peerDependencies: @@ -7956,7 +8023,7 @@ packages: '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1) '@mui/icons-material': 5.15.21(@mui/material@5.15.21)(@types/react@18.3.3)(react@18.3.1) '@mui/material': 5.15.21(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) - '@mui/x-date-pickers': 7.7.1(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1) + '@mui/x-date-pickers': 7.8.0(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@mui/material@5.15.21)(@types/react@18.3.3)(dayjs@1.11.11)(react-dom@18.3.1)(react@18.3.1) '@tanstack/match-sorter-utils': 8.15.1 '@tanstack/react-table': 8.16.0(react-dom@18.3.1)(react@18.3.1) '@tanstack/react-virtual': 3.3.0(react-dom@18.3.1)(react@18.3.1) @@ -8487,45 +8554,45 @@ packages: engines: {node: '>= 0.4'} dev: true - /postcss-modules-extract-imports@3.1.0(postcss@8.4.38): + /postcss-modules-extract-imports@3.1.0(postcss@8.4.39): resolution: {integrity: sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.38 + postcss: 8.4.39 dev: true - /postcss-modules-local-by-default@4.0.5(postcss@8.4.38): + /postcss-modules-local-by-default@4.0.5(postcss@8.4.39): resolution: {integrity: sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 + icss-utils: 5.1.0(postcss@8.4.39) + postcss: 8.4.39 postcss-selector-parser: 6.1.0 postcss-value-parser: 4.2.0 dev: true - /postcss-modules-scope@3.2.0(postcss@8.4.38): + /postcss-modules-scope@3.2.0(postcss@8.4.39): resolution: {integrity: sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - postcss: 8.4.38 + postcss: 8.4.39 postcss-selector-parser: 6.1.0 dev: true - /postcss-modules-values@4.0.0(postcss@8.4.38): + /postcss-modules-values@4.0.0(postcss@8.4.39): resolution: {integrity: sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==} engines: {node: ^10 || ^12 || >= 14} peerDependencies: postcss: ^8.1.0 dependencies: - icss-utils: 5.1.0(postcss@8.4.38) - postcss: 8.4.38 + icss-utils: 5.1.0(postcss@8.4.39) + postcss: 8.4.39 dev: true /postcss-selector-parser@6.1.0: @@ -8540,8 +8607,8 @@ packages: resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} dev: true - /postcss@8.4.38: - resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} + /postcss@8.4.39: + resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} engines: {node: ^10 || ^12 || >=14} dependencies: nanoid: 3.3.7 @@ -9077,7 +9144,7 @@ packages: htmlparser2: 8.0.2 is-plain-object: 5.0.0 parse-srcset: 1.0.2 - postcss: 8.4.38 + postcss: 8.4.39 dev: false /sass-loader@12.6.0(sass@1.77.6)(webpack@5.92.1): @@ -9694,7 +9761,7 @@ packages: hasBin: true dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.12.0 + acorn: 8.12.1 commander: 2.20.3 source-map-support: 0.5.21 dev: true @@ -9964,8 +10031,8 @@ packages: engines: {node: '>= 0.8'} dev: true - /update-browserslist-db@1.0.16(browserslist@4.23.1): - resolution: {integrity: sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==} + /update-browserslist-db@1.1.0(browserslist@4.23.1): + resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' @@ -10097,7 +10164,7 @@ packages: hasBin: true dependencies: '@discoveryjs/json-ext': 0.5.7 - acorn: 8.12.0 + acorn: 8.12.1 acorn-walk: 8.3.3 commander: 7.2.0 debounce: 1.2.1 @@ -10254,8 +10321,8 @@ packages: '@webassemblyjs/ast': 1.12.1 '@webassemblyjs/wasm-edit': 1.12.1 '@webassemblyjs/wasm-parser': 1.12.1 - acorn: 8.12.0 - acorn-import-attributes: 1.9.5(acorn@8.12.0) + acorn: 8.12.1 + acorn-import-attributes: 1.9.5(acorn@8.12.1) browserslist: 4.23.1 chrome-trace-event: 1.0.4 enhanced-resolve: 5.17.0 @@ -10482,8 +10549,8 @@ packages: yargs-parser: 20.2.9 dev: true - /yet-another-react-lightbox@3.20.1(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-Fz5ye8BctGtK5jFDVV+t8mCF6PmCH69UGkC/FFaGvL4oMsUgdUSDt6wk1Yo6yzt3V7PqHkCziOkWtIsF1rlvHA==} + /yet-another-react-lightbox@3.21.0(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-mBDnQ4dttseCxCUz1ECnnlbnD5+HfYB9LUmAd9mXyL91CwP+GYiSxk4pTMCfl6MLGyJ6aLvJKrbRP26Fbg6UrA==} engines: {node: '>=14'} peerDependencies: react: '>=16.8.0' diff --git a/packages/geoview-aoi-panel/README.md b/packages/geoview-aoi-panel/README.md new file mode 100644 index 00000000000..86147750369 --- /dev/null +++ b/packages/geoview-aoi-panel/README.md @@ -0,0 +1,4 @@ +# geoview-Area-of-interest + +A package that allows a user to display a collection of areas to visit on the map. + diff --git a/packages/geoview-aoi-panel/default-config-area-of-interest.json b/packages/geoview-aoi-panel/default-config-area-of-interest.json new file mode 100644 index 00000000000..61f93ee19e3 --- /dev/null +++ b/packages/geoview-aoi-panel/default-config-area-of-interest.json @@ -0,0 +1,4 @@ +{ + "isOpen": false +} + diff --git a/packages/geoview-aoi-panel/package.json b/packages/geoview-aoi-panel/package.json new file mode 100644 index 00000000000..b7c3dd40f7e --- /dev/null +++ b/packages/geoview-aoi-panel/package.json @@ -0,0 +1,41 @@ +{ + "name": "geoview-aoi-panel", + "version": "1.0.0", + "description": "A area of interest panel for the geoview project", + "main": "src/index.tsx", + "keywords": [ + "react", + "aoi-panel" + ], + "author": "Guillaume Choquette", + "license": "MIT", + "dependencies": { + "geoview-core": "workspace:~1.0.0" + }, + "devDependencies": { + "@babel/core": "^7.17.0", + "@babel/runtime": "^7.17.0", + "@types/react": "^18.2.0", + "@types/react-dom": "^18.2.0", + "@babel/eslint-parser": "^7.17.0", + "@typescript-eslint/eslint-plugin": "~7.8.0", + "@typescript-eslint/parser": "~7.8.0", + "eslint": "^8.8.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-jsx-a11y": "^6.5.1", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.28.0", + "eslint-plugin-react-hooks": "^4.3.0", + "prettier": "^2.6.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "typescript": "^4.5.5" + }, + "resolutions": { + "@types/react": "^18.2.0" + } +} + diff --git a/packages/geoview-aoi-panel/schema.json b/packages/geoview-aoi-panel/schema.json new file mode 100644 index 00000000000..15e81bca19a --- /dev/null +++ b/packages/geoview-aoi-panel/schema.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "GeoView Area of Interest Panel Schema", + "type": "object", + "version": 1.0, + "comments": "Configuration for GeoView Area of interest package.", + "additionalProperties": false, + "properties": { + "isOpen": { + "type": "boolean", + "description": "Specifies whether the area of interest panel is initially open or closed", + "default": false + }, + "version": { + "type": "string", + "enum": [ + "1.0" + ], + "description": "The schema version used to validate the configuration file. The schema should enumerate the list of versions accepted by this version of the viewer." + } + }, + "required": [ + "isOpen" + ] +} + diff --git a/packages/geoview-aoi-panel/src/aoi-panel.tsx b/packages/geoview-aoi-panel/src/aoi-panel.tsx new file mode 100644 index 00000000000..afbb441dc0d --- /dev/null +++ b/packages/geoview-aoi-panel/src/aoi-panel.tsx @@ -0,0 +1,38 @@ +// import { TypeBasemapProps } from 'geoview-core/src/geo/layer/basemap/basemap-types'; +// import { TypeJsonObject } from 'geoview-core/src/core/types/global-types'; +// import { useMapProjection } from 'geoview-core/src/core/stores/store-interface-and-intial-values/map-state'; +// import { useAppDisplayLanguage } from 'geoview-core/src/core/stores/store-interface-and-intial-values/app-state'; +// import { TypeValidMapProjectionCodes, TypeDisplayLanguage } from 'geoview-core/src/api/config/types/map-schema-types'; +// import { logger } from 'geoview-core/src/core/utils/logger'; +// import { getLocalizedMessage } from 'geoview-core/src/core/utils/utilities'; +// import { getSxClasses } from './area-of-interest-style'; + +/* +interface AoiPanelProps { + mapId: string; + config: TypeJsonObject; +} +*/ + +export function AoiPanel(/* props: AoiPanelProps */): JSX.Element { + // const { mapId, config } = props; + + // const { cgpv } = window; + // const myMap = cgpv.api.maps[mapId]; + + // const { api, ui, react } = cgpv; + // const { Select, Card, Box } = ui.elements; + + // const { useState } = react; + + // const theme = ui.useTheme(); + // const sxClasses = getSxClasses(theme); + + // internal state and store values + // const language = useAppDisplayLanguage(); + + // #region PRIVATE UTILITY FUNCTIONS + // #endregion + + return
; +} diff --git a/packages/geoview-aoi-panel/src/area-of-interest-style.ts b/packages/geoview-aoi-panel/src/area-of-interest-style.ts new file mode 100644 index 00000000000..a59fc66dd2a --- /dev/null +++ b/packages/geoview-aoi-panel/src/area-of-interest-style.ts @@ -0,0 +1,91 @@ +/* @ts-expect-error there is no mui style in this package */ + +// ? I doubt we want to define an explicit type for style properties? +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const getSxClasses = (theme): any => ({ + aoiCard: { + '& .MuiCard-root': { + backgroundColor: theme.palette.grey.A700, + color: theme.palette.primary.light, + display: 'flex', + flexDirection: 'column', + backgroundClip: 'padding-box', + border: '2px solid rgba(255,255,255,0.25)', + borderRadius: '6px', + boxShadow: 'none', + marginBottom: '16px', + width: '300px', + transition: 'all 0.3s ease-in-out', + '&:last-child': { + marginBottom: '0px', + }, + '&:hover': { + border: `2px solid #FFFF00`, + }, + '&.active': { + border: `2px solid #FFFFFF`, + }, + }, + '& .MuiCardHeader-root': { + backgroundColor: `${theme.palette.geoViewColor.grey.dark[900]} !important`, + color: theme.palette.geoViewColor.grey.light[900], + fontSize: 14, + fontWeight: 400, + margin: 0, + padding: '0 12px', + height: 60, + width: '100%', + order: 2, + }, + '& .MuiCardContent-root': { + order: 1, + height: 190, + position: 'relative', + padding: 0, + '&:last-child': { + padding: 0, + }, + '& .aoiCardThumbnail': { + position: 'absolute', + height: '100%', + width: '100%', + objectFit: 'cover', + top: 0, + left: 0, + }, + '& .aoiCardThumbnailOverlay': { + display: 'block', + height: '100%', + width: '100%', + position: 'absolute', + backgroundColor: theme.palette.geoViewColor.grey.lighten(0.5, 0.85), + transition: 'all 0.3s ease-in-out', + }, + }, + '&:hover': { + cursor: 'pointer', + borderColor: theme.palette.geoViewColor.primary.main, + '& .MuiCardContent-root': { + '& .aoiCardThumbnailOverlay': { + backgroundColor: theme.palette.geoViewColor.grey.lighten(0.5, 0.55), + }, + }, + }, + '&.active': { + borderColor: theme.palette.geoViewColor.primary.light[200], + '& .MuiCardContent-root': { + '& .aoiCardThumbnailOverlay': { + backgroundColor: 'transparent', + }, + }, + '&:hover': { + borderColor: 'rgba(255,255,255,0.75)', + '& .MuiCardContent-root': { + '& .aoiCardThumbnailOverlay': { + backgroundColor: 'rgba(0,0,0,0)', + }, + }, + }, + }, + }, +}); diff --git a/packages/geoview-aoi-panel/src/index.tsx b/packages/geoview-aoi-panel/src/index.tsx new file mode 100644 index 00000000000..c12c881bcae --- /dev/null +++ b/packages/geoview-aoi-panel/src/index.tsx @@ -0,0 +1,83 @@ +import { TypeJsonObject, toJsonObject, AnySchemaObject, Cast } from 'geoview-core/src/core/types/global-types'; +import { AppBarPlugin } from 'geoview-core/src/api/plugin/appbar-plugin'; +import { AoiIcon } from 'geoview-core/src/ui/icons'; +import { TypeIconButtonProps } from 'geoview-core/src/ui/icon-button/icon-button-types'; +import { TypePanelProps } from 'geoview-core/src/ui/panel/panel-types'; +import { AoiPanel } from './aoi-panel'; +import schema from '../schema.json'; +import defaultConfig from '../default-config-area-of-interest.json'; + +/** + * Create a class for the plugin instance + */ +class AoiPanelPlugin extends AppBarPlugin { + /** + * Return the package schema + * + * @returns {AnySchemaObject} the package schema + */ + override schema(): AnySchemaObject { + return schema; + } + + /** + * Return the default config for this package + * + * @returns {TypeJsonObject} the default config + */ + override defaultConfig(): TypeJsonObject { + return toJsonObject(defaultConfig); + } + + /** + * translations object to inject to the viewer translations + */ + translations = toJsonObject({ + en: { + AoiPanel: { + title: 'Area of Interest', + }, + }, + fr: { + AoiPanel: { + title: "Région d'intérêt", + }, + }, + }); + + override onCreateButtonProps(): TypeIconButtonProps { + // Button props + return { + id: `${this.pluginProps.mapId}-AoiPanelButton`, + tooltip: 'AoiPanel.title', + tooltipPlacement: 'right', + children: , + visible: true, + }; + } + + override onCreateContentProps(): TypePanelProps { + // Panel props + return { + title: 'AoiPanel.title', + icon: , + width: 350, + status: this.configObj?.isOpen as boolean, + }; + } + + override onCreateContent = (): JSX.Element => { + return ; + }; + + /** + * Function called when the plugin is removed, used for clean up + */ + override onRemoved(): void {} +} + +export default AoiPanelPlugin; + +// Keep a reference to the AOI Panel Plugin as part of the geoviewPlugins property stored in the window object +window.geoviewPlugins = window.geoviewPlugins || {}; +window.geoviewPlugins['aoi-panel'] = Cast(AoiPanelPlugin); diff --git a/packages/geoview-aoi-panel/tsconfig.json b/packages/geoview-aoi-panel/tsconfig.json new file mode 100644 index 00000000000..9cc6e63c556 --- /dev/null +++ b/packages/geoview-aoi-panel/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "strict": true, + "importHelpers": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "strictPropertyInitialization": true, + "sourceMap": true, + "skipLibCheck": true, + "jsx": "preserve", + "allowJs": true, + "noEmit": true, + "noUnusedLocals": true, + "noImplicitReturns": true, + "noImplicitOverride": true, + "noImplicitThis": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["esnext", "dom", "dom.iterable", "scripthost"], + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["src"] +} diff --git a/packages/geoview-core/public/configs/loading-packages-config.json b/packages/geoview-core/public/configs/loading-packages-config.json index c43be211119..a95ba7d8cf1 100644 --- a/packages/geoview-core/public/configs/loading-packages-config.json +++ b/packages/geoview-core/public/configs/loading-packages-config.json @@ -15,7 +15,7 @@ "corePackages": [], "appBar": { "tabs": { - "core": ["basemap-panel"] + "core": ["basemap-panel", "aoi-panel"] } } } diff --git a/packages/geoview-core/public/configs/navigator/26-package-area-of-interest.json b/packages/geoview-core/public/configs/navigator/26-package-area-of-interest.json new file mode 100644 index 00000000000..1a882ca28f4 --- /dev/null +++ b/packages/geoview-core/public/configs/navigator/26-package-area-of-interest.json @@ -0,0 +1,21 @@ +{ + "map": { + "interaction": "dynamic", + "viewSettings": { + "projection": 3978 + }, + "basemapOptions": { + "basemapId": "transport", + "shaded": false, + "labeled": true + } + }, + "theme": "geo.ca", + "components": ["north-arrow", "overview-map"], + "corePackages": [], + "appBar": { + "tabs": { + "core": ["aoi-panel"] + } + } +} diff --git a/packages/geoview-core/public/templates/demos-navigator.html b/packages/geoview-core/public/templates/demos-navigator.html index c67b0690b1e..9ceffc0f539 100644 --- a/packages/geoview-core/public/templates/demos-navigator.html +++ b/packages/geoview-core/public/templates/demos-navigator.html @@ -127,6 +127,7 @@

Configurations Navigator

+ diff --git a/packages/geoview-core/public/templates/events.html b/packages/geoview-core/public/templates/events.html index 0b5685ac5c9..a6390e686c3 100644 --- a/packages/geoview-core/public/templates/events.html +++ b/packages/geoview-core/public/templates/events.html @@ -63,7 +63,8 @@

1. Snackbar Notification

'components': [], 'corePackages': [], 'theme': 'geo.ca' - }">
+ }" + >
diff --git a/packages/geoview-core/public/templates/loading-packages.html b/packages/geoview-core/public/templates/loading-packages.html index 0fd610a5f2f..ae70e2ddadb 100644 --- a/packages/geoview-core/public/templates/loading-packages.html +++ b/packages/geoview-core/public/templates/loading-packages.html @@ -87,6 +87,8 @@

Loading Packages

+ +
@@ -118,6 +120,23 @@

Loading Packages

unloadBasemapPanelBtn.addEventListener('click', function (e) { cgpv.api.plugin.removePlugin('basemap-panel', 'mapWM'); }); + // get load aoi panel button element + var loadAoiPanelBtn = document.getElementById('load-aoi-panel-btn'); + + // add event handler to the load aoi panel button + loadAoiPanelBtn.addEventListener('click', function (e) { + cgpv.api.plugin.addPlugin('aoi-panel', 'mapWM', window.geoviewPlugins['aoi-panel'], { + mapId: 'mapWM', + }); + }); + + // get unload aoi panel button element + var unloadAoiPanelBtn = document.getElementById('unload-aoi-panel-btn'); + + // add event handler to the unload aoi panel button + unloadAoiPanelBtn.addEventListener('click', function (e) { + cgpv.api.plugin.removePlugin('aoi-panel', 'mapWM'); + }); } }); diff --git a/packages/geoview-core/src/api/config/types/config-validation-schema.json b/packages/geoview-core/src/api/config/types/config-validation-schema.json index 0f3cfb6d2ec..3901e01d65b 100644 --- a/packages/geoview-core/src/api/config/types/config-validation-schema.json +++ b/packages/geoview-core/src/api/config/types/config-validation-schema.json @@ -166,7 +166,7 @@ "TypeValidAppBarCoreProps": { "description": "Valid values for the app bar tabs core array.", "additionalProperties": false, - "enum": ["geolocator", "export", "basemap-panel", "geochart", "details", "legend", "guide", "data-table", "layers"] + "enum": ["geolocator", "export", "basemap-panel", "geochart", "details", "legend", "guide", "data-table", "layers", "aoi-panel"] }, "TypeAppBarProps": { "type": "object", diff --git a/packages/geoview-core/src/api/config/types/map-schema-types.ts b/packages/geoview-core/src/api/config/types/map-schema-types.ts index d664616a8a0..95443fa69f5 100644 --- a/packages/geoview-core/src/api/config/types/map-schema-types.ts +++ b/packages/geoview-core/src/api/config/types/map-schema-types.ts @@ -60,6 +60,7 @@ export type TypeValidAppBarCoreProps = | 'geolocator' | 'export' | 'basemap-panel' + | 'aoi-panel' | 'geochart' | 'guide' | 'legend' diff --git a/packages/geoview-core/src/core/components/app-bar/app-bar.tsx b/packages/geoview-core/src/core/components/app-bar/app-bar.tsx index 6a9d490c5b7..d04e6a23aa1 100644 --- a/packages/geoview-core/src/core/components/app-bar/app-bar.tsx +++ b/packages/geoview-core/src/core/components/app-bar/app-bar.tsx @@ -50,6 +50,7 @@ import { TypeJsonObject, TypeJsonValue, toJsonObject } from '@/core/types/global import { AbstractPlugin } from '@/api/plugin/abstract-plugin'; import { CV_DEFAULT_APPBAR_CORE, CV_DEFAULT_APPBAR_TABS_ORDER } from '@/api/config/types/config-constants'; import { CONTAINER_TYPE } from '@/core/utils/constant'; +import { TypeValidAppBarCoreProps } from '@/api/config/types/map-schema-types'; interface GroupPanelType { icon: ReactNode; @@ -122,7 +123,7 @@ export function AppBar(props: AppBarProps): JSX.Element { layers: { icon: , content: }, 'data-table': { icon: , content: }, } as unknown as Record; - }, []); + }, [interaction]); const closePanelById = useCallback( (buttonId: string, groupName: string | undefined) => { @@ -267,28 +268,32 @@ export function AppBar(props: AppBarProps): JSX.Element { // Log logger.logTraceUseEffect('APP-BAR - appBarConfig'); - // Packages tab - if (appBarConfig && appBarConfig.tabs.core.includes('basemap-panel')) { - // create a new tab by loading the plugin - Plugin.loadScript('basemap-panel') - .then((constructor: AbstractPlugin | ((pluginId: string, props: TypeJsonObject) => TypeJsonValue)) => { - Plugin.addPlugin( - 'basemap-panel', - mapId, - constructor, - toJsonObject({ + const processPlugin = (pluginName: TypeValidAppBarCoreProps): void => { + // Packages tab + if (appBarConfig && appBarConfig.tabs.core.includes(pluginName)) { + // create a new tab by loading the plugin + Plugin.loadScript(pluginName) + .then((constructor: AbstractPlugin | ((pluginId: string, props: TypeJsonObject) => TypeJsonValue)) => { + Plugin.addPlugin( + pluginName, mapId, - }) - ).catch((error) => { + constructor, + toJsonObject({ + mapId, + }) + ).catch((error) => { + // Log + logger.logPromiseFailed(`api.plugin.addPlugin in useEffect in app-bar for ${pluginName}`, error); + }); + }) + .catch((error) => { // Log - logger.logPromiseFailed('api.plugin.addPlugin in useEffect in app-bar', error); + logger.logPromiseFailed('api.plugin.loadScript in useEffect in app-bar', error); }); - }) - .catch((error) => { - // Log - logger.logPromiseFailed('api.plugin.loadScript in useEffect in app-bar', error); - }); - } + } + }; + processPlugin('basemap-panel'); + processPlugin('aoi-panel'); }, [appBarConfig, mapId]); useEffect(() => { @@ -325,7 +330,7 @@ export function AppBar(props: AppBarProps): JSX.Element { return [button, panel, tab]; }) .forEach((footerGroup) => appBarApi.createAppbarPanel(footerGroup[0], footerGroup[1], footerGroup[2])); - }, [appBarConfig?.tabs.core, appBarApi, t, memoPanels, geoviewElement, getPanelWidth]); + }, [footerBarConfig?.tabs.core, appBarConfig?.tabs.core, appBarApi, t, memoPanels, geoviewElement, getPanelWidth]); // #endregion diff --git a/packages/geoview-core/src/ui/icons/index.ts b/packages/geoview-core/src/ui/icons/index.ts index 9e33a183b41..cff7b85ecc0 100644 --- a/packages/geoview-core/src/ui/icons/index.ts +++ b/packages/geoview-core/src/ui/icons/index.ts @@ -22,6 +22,7 @@ export { ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon, Close as CloseIcon, + CropOriginal as AoiIcon, Delete as DeleteIcon, DeleteOutline as DeleteOutlineIcon, Details as DetailsIcon, diff --git a/packages/geoview-core/webpack.common.js b/packages/geoview-core/webpack.common.js index ea9f13cc1b3..476472f358d 100644 --- a/packages/geoview-core/webpack.common.js +++ b/packages/geoview-core/webpack.common.js @@ -69,6 +69,11 @@ const multipleHtmlPluginsOutliers = glob.sync('./public/templates/outliers/*.htm const config = { entry: { 'cgpv-main': './src/app.tsx', + 'geoview-aoi-panel': { + import: '../geoview-aoi-panel/src/index.tsx', + dependOn: 'cgpv-main', + filename: 'corePackages/[name].js', + }, 'geoview-basemap-panel': { import: '../geoview-basemap-panel/src/index.tsx', dependOn: 'cgpv-main', diff --git a/rush.json b/rush.json index 8ee11e76b3b..22b5518321c 100644 --- a/rush.json +++ b/rush.json @@ -19,6 +19,10 @@ "url": "https://github.com/Canadian-Geospatial-Platform/geoview" }, "projects": [ + { + "packageName": "geoview-aoi-panel", + "projectFolder": "packages/geoview-aoi-panel" + }, { "packageName": "geoview-basemap-panel", "projectFolder": "packages/geoview-basemap-panel"