From d95b0cb8de48e0cc911ae6e346fd59fcc2acf7b2 Mon Sep 17 00:00:00 2001 From: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:55:51 +0200 Subject: [PATCH 01/12] Fix Next peer dependency (#2544) The peer dependency was incorrectly set to `14`. We require `14.2.0` or later due to relying on [optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports). --- .changeset/angry-paws-pay.md | 8 ++++++++ packages/site/cms-site/package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/angry-paws-pay.md diff --git a/.changeset/angry-paws-pay.md b/.changeset/angry-paws-pay.md new file mode 100644 index 0000000000..fc68b7ff53 --- /dev/null +++ b/.changeset/angry-paws-pay.md @@ -0,0 +1,8 @@ +--- +"@comet/cms-site": patch +--- + +Fix Next peer dependency + +The peer dependency was incorrectly set to `14`. +We require `14.2.0` or later due to relying on [optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports). diff --git a/packages/site/cms-site/package.json b/packages/site/cms-site/package.json index b3df4f67b5..e86e6cd269 100644 --- a/packages/site/cms-site/package.json +++ b/packages/site/cms-site/package.json @@ -57,7 +57,7 @@ "typescript": "^4.0.0" }, "peerDependencies": { - "next": "14", + "next": "^14.2.0", "react": "^18.0.0", "react-dom": "^18.0.0", "styled-components": "^6.0.0" From 83c905917dfd6f2cc85727df261e41abb6f62a17 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:22:49 +0200 Subject: [PATCH 02/12] Version Packages (#2557) This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @comet/admin@7.4.2 ### Patch Changes - @comet/admin-icons@7.4.2 - @comet/admin-theme@7.4.2 ## @comet/admin-color-picker@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-icons@7.4.2 ## @comet/admin-date-time@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-icons@7.4.2 ## @comet/admin-react-select@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-icons@7.4.2 ## @comet/admin-rte@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-icons@7.4.2 ## @comet/admin-theme@7.4.2 ### Patch Changes - @comet/admin-icons@7.4.2 ## @comet/blocks-admin@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-icons@7.4.2 ## @comet/cms-admin@7.4.2 ### Patch Changes - @comet/admin@7.4.2 - @comet/admin-date-time@7.4.2 - @comet/admin-icons@7.4.2 - @comet/admin-rte@7.4.2 - @comet/admin-theme@7.4.2 - @comet/blocks-admin@7.4.2 ## @comet/cms-api@7.4.2 ### Patch Changes - @comet/blocks-api@7.4.2 ## @comet/eslint-config@7.4.2 ### Patch Changes - @comet/eslint-plugin@7.4.2 ## @comet/cms-site@7.4.2 ### Patch Changes - d95b0cb8d: Fix Next peer dependency The peer dependency was incorrectly set to `14`. We require `14.2.0` or later due to relying on [optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports). ## @comet/admin-babel-preset@7.4.2 ## @comet/admin-icons@7.4.2 ## @comet/blocks-api@7.4.2 ## @comet/cli@7.4.2 ## @comet/eslint-plugin@7.4.2 Co-authored-by: github-actions[bot] --- .changeset/angry-paws-pay.md | 8 -- .../admin/admin-babel-preset/CHANGELOG.md | 2 + .../admin/admin-babel-preset/package.json | 2 +- .../admin/admin-color-picker/CHANGELOG.md | 7 ++ .../admin/admin-color-picker/package.json | 10 +- packages/admin/admin-date-time/CHANGELOG.md | 7 ++ packages/admin/admin-date-time/package.json | 10 +- packages/admin/admin-icons/CHANGELOG.md | 2 + packages/admin/admin-icons/package.json | 6 +- .../admin/admin-react-select/CHANGELOG.md | 7 ++ .../admin/admin-react-select/package.json | 10 +- packages/admin/admin-rte/CHANGELOG.md | 7 ++ packages/admin/admin-rte/package.json | 10 +- packages/admin/admin-theme/CHANGELOG.md | 6 ++ packages/admin/admin-theme/package.json | 8 +- packages/admin/admin/CHANGELOG.md | 7 ++ packages/admin/admin/package.json | 10 +- packages/admin/blocks-admin/CHANGELOG.md | 7 ++ packages/admin/blocks-admin/package.json | 12 +-- packages/admin/cms-admin/CHANGELOG.md | 11 +++ packages/admin/cms-admin/package.json | 20 ++-- packages/api/blocks-api/CHANGELOG.md | 2 + packages/api/blocks-api/package.json | 4 +- packages/api/cms-api/CHANGELOG.md | 6 ++ packages/api/cms-api/package.json | 6 +- packages/cli/CHANGELOG.md | 2 + packages/cli/package.json | 4 +- packages/eslint-config/CHANGELOG.md | 6 ++ packages/eslint-config/package.json | 4 +- packages/eslint-plugin/CHANGELOG.md | 2 + packages/eslint-plugin/package.json | 2 +- packages/site/cms-site/CHANGELOG.md | 9 ++ packages/site/cms-site/package.json | 6 +- pnpm-lock.yaml | 92 +++++++++---------- 34 files changed, 198 insertions(+), 116 deletions(-) delete mode 100644 .changeset/angry-paws-pay.md diff --git a/.changeset/angry-paws-pay.md b/.changeset/angry-paws-pay.md deleted file mode 100644 index fc68b7ff53..0000000000 --- a/.changeset/angry-paws-pay.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@comet/cms-site": patch ---- - -Fix Next peer dependency - -The peer dependency was incorrectly set to `14`. -We require `14.2.0` or later due to relying on [optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports). diff --git a/packages/admin/admin-babel-preset/CHANGELOG.md b/packages/admin/admin-babel-preset/CHANGELOG.md index 7b416cab42..2cbcb5b4b9 100644 --- a/packages/admin/admin-babel-preset/CHANGELOG.md +++ b/packages/admin/admin-babel-preset/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/admin-babel-preset +## 7.4.2 + ## 7.4.1 ## 7.4.0 diff --git a/packages/admin/admin-babel-preset/package.json b/packages/admin/admin-babel-preset/package.json index 74bdb4cf27..2b1fbcec71 100644 --- a/packages/admin/admin-babel-preset/package.json +++ b/packages/admin/admin-babel-preset/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-babel-preset", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", diff --git a/packages/admin/admin-color-picker/CHANGELOG.md b/packages/admin/admin-color-picker/CHANGELOG.md index 9accc15938..953c43d9b1 100644 --- a/packages/admin/admin-color-picker/CHANGELOG.md +++ b/packages/admin/admin-color-picker/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/admin-color-picker +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin-color-picker/package.json b/packages/admin/admin-color-picker/package.json index 96e3faa5df..8ced86aa17 100644 --- a/packages/admin/admin-color-picker/package.json +++ b/packages/admin/admin-color-picker/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-color-picker", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -26,8 +26,8 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", "clsx": "^1.1.1", "react-colorful": "^5.5.1", "tinycolor2": "^1.4.1", @@ -36,8 +36,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", diff --git a/packages/admin/admin-date-time/CHANGELOG.md b/packages/admin/admin-date-time/CHANGELOG.md index daaaae059f..74b98ea9ae 100644 --- a/packages/admin/admin-date-time/CHANGELOG.md +++ b/packages/admin/admin-date-time/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/admin-date-time +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin-date-time/package.json b/packages/admin/admin-date-time/package.json index ffc46dd317..d27c81b6d8 100644 --- a/packages/admin/admin-date-time/package.json +++ b/packages/admin/admin-date-time/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-date-time", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -26,8 +26,8 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", "@mui/utils": "^5.4.1", "clsx": "^1.1.1", "date-fns": "^2.28.0", @@ -36,8 +36,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@types/react": "^17.0", "@types/react-date-range": "^1.4.3", diff --git a/packages/admin/admin-icons/CHANGELOG.md b/packages/admin/admin-icons/CHANGELOG.md index 67c1239c0a..b8fdf170f1 100644 --- a/packages/admin/admin-icons/CHANGELOG.md +++ b/packages/admin/admin-icons/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/admin-icons +## 7.4.2 + ## 7.4.1 ## 7.4.0 diff --git a/packages/admin/admin-icons/package.json b/packages/admin/admin-icons/package.json index 8b400c52fd..746385f7f8 100644 --- a/packages/admin/admin-icons/package.json +++ b/packages/admin/admin-icons/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-icons", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -29,8 +29,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@types/cli-progress": "^3.8.0", "@types/node": "^18.0.0", diff --git a/packages/admin/admin-react-select/CHANGELOG.md b/packages/admin/admin-react-select/CHANGELOG.md index 378c7984d4..184515a932 100644 --- a/packages/admin/admin-react-select/CHANGELOG.md +++ b/packages/admin/admin-react-select/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/admin-react-select +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin-react-select/package.json b/packages/admin/admin-react-select/package.json index 6e5d3f97cf..a98f0eed79 100644 --- a/packages/admin/admin-react-select/package.json +++ b/packages/admin/admin-react-select/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-react-select", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -26,15 +26,15 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", "classnames": "^2.2.6" }, "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", diff --git a/packages/admin/admin-rte/CHANGELOG.md b/packages/admin/admin-rte/CHANGELOG.md index c5c090d1d1..617a96f30f 100644 --- a/packages/admin/admin-rte/CHANGELOG.md +++ b/packages/admin/admin-rte/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/admin-rte +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin-rte/package.json b/packages/admin/admin-rte/package.json index 58a28950f8..0d385a9384 100644 --- a/packages/admin/admin-rte/package.json +++ b/packages/admin/admin-rte/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-rte", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -28,8 +28,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", "detect-browser": "^5.2.1", "draft-js-export-html": "^1.4.1", "draft-js-import-html": "^1.4.1", @@ -39,8 +39,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^12.0.0", diff --git a/packages/admin/admin-theme/CHANGELOG.md b/packages/admin/admin-theme/CHANGELOG.md index 5d8d2a9a94..d191f7f712 100644 --- a/packages/admin/admin-theme/CHANGELOG.md +++ b/packages/admin/admin-theme/CHANGELOG.md @@ -1,5 +1,11 @@ # @comet/admin-theme +## 7.4.2 + +### Patch Changes + +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin-theme/package.json b/packages/admin/admin-theme/package.json index d9957f63b4..4e04152b60 100644 --- a/packages/admin/admin-theme/package.json +++ b/packages/admin/admin-theme/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-theme", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -26,14 +26,14 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin-icons": "workspace:^7.4.2", "@mui/utils": "^5.4.1" }, "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@mui/material": "^5.0.0", "@mui/system": "^5.0.0", "@mui/x-data-grid": "^5.0.0", diff --git a/packages/admin/admin/CHANGELOG.md b/packages/admin/admin/CHANGELOG.md index 7207bfa346..ab4968f2cb 100644 --- a/packages/admin/admin/CHANGELOG.md +++ b/packages/admin/admin/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/admin +## 7.4.2 + +### Patch Changes + +- @comet/admin-icons@7.4.2 +- @comet/admin-theme@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/admin/package.json b/packages/admin/admin/package.json index 3a13f5b35c..2b66d99076 100644 --- a/packages/admin/admin/package.json +++ b/packages/admin/admin/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -28,8 +28,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@comet/admin-icons": "workspace:^7.4.1", - "@comet/admin-theme": "workspace:^7.4.1", + "@comet/admin-icons": "workspace:^7.4.2", + "@comet/admin-theme": "workspace:^7.4.2", "@mui/lab": "^5.0.0-alpha.76", "@mui/private-theming": "^5.0.0", "clsx": "^1.1.1", @@ -49,8 +49,8 @@ "@apollo/client": "^3.7.0", "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", "@mui/material": "^5.0.0", diff --git a/packages/admin/blocks-admin/CHANGELOG.md b/packages/admin/blocks-admin/CHANGELOG.md index c216539b4e..63cb9529f0 100644 --- a/packages/admin/blocks-admin/CHANGELOG.md +++ b/packages/admin/blocks-admin/CHANGELOG.md @@ -1,5 +1,12 @@ # @comet/blocks-admin +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-icons@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/blocks-admin/package.json b/packages/admin/blocks-admin/package.json index 5d56f7136f..5da1230d5f 100644 --- a/packages/admin/blocks-admin/package.json +++ b/packages/admin/blocks-admin/package.json @@ -1,6 +1,6 @@ { "name": "@comet/blocks-admin", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -30,8 +30,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", "@mui/lab": "^5.0.0-alpha.76", "clipboard-copy": "^4.0.0", "clsx": "^1.1.1", @@ -43,9 +43,9 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/cli": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/cli": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", "@mui/lab": "^5.0.0-alpha.76", diff --git a/packages/admin/cms-admin/CHANGELOG.md b/packages/admin/cms-admin/CHANGELOG.md index d0b66dbbea..5d5fb9f2d0 100644 --- a/packages/admin/cms-admin/CHANGELOG.md +++ b/packages/admin/cms-admin/CHANGELOG.md @@ -1,5 +1,16 @@ # @comet/cms-admin +## 7.4.2 + +### Patch Changes + +- @comet/admin@7.4.2 +- @comet/admin-date-time@7.4.2 +- @comet/admin-icons@7.4.2 +- @comet/admin-rte@7.4.2 +- @comet/admin-theme@7.4.2 +- @comet/blocks-admin@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/admin/cms-admin/package.json b/packages/admin/cms-admin/package.json index ac071d58f0..ac3196aad3 100644 --- a/packages/admin/cms-admin/package.json +++ b/packages/admin/cms-admin/package.json @@ -1,6 +1,6 @@ { "name": "@comet/cms-admin", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -35,12 +35,12 @@ "test:watch": "jest --watch" }, "dependencies": { - "@comet/admin": "workspace:^7.4.1", - "@comet/admin-date-time": "workspace:^7.4.1", - "@comet/admin-icons": "workspace:^7.4.1", - "@comet/admin-rte": "workspace:^7.4.1", - "@comet/admin-theme": "workspace:^7.4.1", - "@comet/blocks-admin": "workspace:^7.4.1", + "@comet/admin": "workspace:^7.4.2", + "@comet/admin-date-time": "workspace:^7.4.2", + "@comet/admin-icons": "workspace:^7.4.2", + "@comet/admin-rte": "workspace:^7.4.2", + "@comet/admin-theme": "workspace:^7.4.2", + "@comet/blocks-admin": "workspace:^7.4.2", "@graphql-tools/graphql-file-loader": "^7.5.17", "@graphql-tools/load": "^7.8.14", "@graphql-typed-document-node/core": "^3.1.1", @@ -83,9 +83,9 @@ "@apollo/client": "^3.7.0", "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^7.4.1", - "@comet/cli": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/admin-babel-preset": "workspace:^7.4.2", + "@comet/cli": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", "@graphql-codegen/cli": "^2.0.0", diff --git a/packages/api/blocks-api/CHANGELOG.md b/packages/api/blocks-api/CHANGELOG.md index da5147ec22..94920ec9d2 100644 --- a/packages/api/blocks-api/CHANGELOG.md +++ b/packages/api/blocks-api/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/blocks-api +## 7.4.2 + ## 7.4.1 ## 7.4.0 diff --git a/packages/api/blocks-api/package.json b/packages/api/blocks-api/package.json index 751f302188..73a982bcb3 100644 --- a/packages/api/blocks-api/package.json +++ b/packages/api/blocks-api/package.json @@ -1,6 +1,6 @@ { "name": "@comet/blocks-api", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -31,7 +31,7 @@ "rimraf": "^3.0.0" }, "devDependencies": { - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/eslint-config": "workspace:^7.4.2", "@nestjs/common": "^9.0.0", "@types/draft-js": "^0.11.10", "@types/jest": "^29.5.0", diff --git a/packages/api/cms-api/CHANGELOG.md b/packages/api/cms-api/CHANGELOG.md index 6839d51c23..a29a28619c 100644 --- a/packages/api/cms-api/CHANGELOG.md +++ b/packages/api/cms-api/CHANGELOG.md @@ -1,5 +1,11 @@ # @comet/cms-api +## 7.4.2 + +### Patch Changes + +- @comet/blocks-api@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/api/cms-api/package.json b/packages/api/cms-api/package.json index d10278f31d..ba97006b8a 100644 --- a/packages/api/cms-api/package.json +++ b/packages/api/cms-api/package.json @@ -1,6 +1,6 @@ { "name": "@comet/cms-api", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -36,7 +36,7 @@ "@azure-rest/ai-translation-text": "^1.0.0-beta.1", "@azure/openai": "1.0.0-beta.11", "@azure/storage-blob": "^12.23.0", - "@comet/blocks-api": "workspace:^7.4.1", + "@comet/blocks-api": "workspace:^7.4.2", "@fast-csv/parse": "^4.3.6", "@golevelup/nestjs-discovery": "^3.0.0", "@hapi/accept": "^5.0.2", @@ -84,7 +84,7 @@ }, "devDependencies": { "@aws-sdk/types": "^3.47.0", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/eslint-config": "workspace:^7.4.2", "@golevelup/ts-jest": "^0.4.0", "@kubernetes/client-node": "^0.18.1", "@mikro-orm/core": "^5.9.8", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 9b1db3a411..1aa1e13fab 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/cli +## 7.4.2 + ## 7.4.1 ## 7.4.0 diff --git a/packages/cli/package.json b/packages/cli/package.json index 3dc6706c66..6a0c15f9bc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@comet/cli", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -30,7 +30,7 @@ "prettier": "^2.7.1" }, "devDependencies": { - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/eslint-config": "workspace:^7.4.2", "@types/node": "^18.0.0", "eslint": "^8.0.0", "npm-run-all": "^4.1.5", diff --git a/packages/eslint-config/CHANGELOG.md b/packages/eslint-config/CHANGELOG.md index a0031add06..40dab5515e 100644 --- a/packages/eslint-config/CHANGELOG.md +++ b/packages/eslint-config/CHANGELOG.md @@ -1,5 +1,11 @@ # @comet/eslint-config +## 7.4.2 + +### Patch Changes + +- @comet/eslint-plugin@7.4.2 + ## 7.4.1 ### Patch Changes diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 131d0c7282..688f9d993f 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@comet/eslint-config", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -15,7 +15,7 @@ }, "dependencies": { "@calm/eslint-plugin-react-intl": "^1.4.1", - "@comet/eslint-plugin": "workspace:^7.4.1", + "@comet/eslint-plugin": "workspace:^7.4.2", "@next/eslint-plugin-next": "^14.0.0", "@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/parser": "^5.48.2", diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index b286550b8e..15307dd0c5 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/eslint-plugin +## 7.4.2 + ## 7.4.1 ## 7.4.0 diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 8c6e127fb2..be1a745881 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@comet/eslint-plugin", - "version": "7.4.1", + "version": "7.4.2", "main": "lib/index.js", "scripts": { "build": "$npm_execpath run clean && tsc", diff --git a/packages/site/cms-site/CHANGELOG.md b/packages/site/cms-site/CHANGELOG.md index 91622e1079..8bb79a7737 100644 --- a/packages/site/cms-site/CHANGELOG.md +++ b/packages/site/cms-site/CHANGELOG.md @@ -1,5 +1,14 @@ # @comet/cms-site +## 7.4.2 + +### Patch Changes + +- d95b0cb8d: Fix Next peer dependency + + The peer dependency was incorrectly set to `14`. + We require `14.2.0` or later due to relying on [optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports). + ## 7.4.1 ## 7.4.0 diff --git a/packages/site/cms-site/package.json b/packages/site/cms-site/package.json index e86e6cd269..2f6ffa47d3 100644 --- a/packages/site/cms-site/package.json +++ b/packages/site/cms-site/package.json @@ -1,6 +1,6 @@ { "name": "@comet/cms-site", - "version": "7.4.1", + "version": "7.4.2", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -34,8 +34,8 @@ "usehooks-ts": "^3.1.0" }, "devDependencies": { - "@comet/cli": "workspace:^7.4.1", - "@comet/eslint-config": "workspace:^7.4.1", + "@comet/cli": "workspace:^7.4.2", + "@comet/eslint-config": "workspace:^7.4.2", "@gitbeaker/node": "^34.0.0", "@types/draft-js": "^0.11.10", "@types/jest": "^29.5.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01fcdaddd0..b5d63f4303 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1082,10 +1082,10 @@ importers: packages/admin/admin: dependencies: '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons '@comet/admin-theme': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-theme '@mui/lab': specifier: ^5.0.0-alpha.76 @@ -1140,10 +1140,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@emotion/react': specifier: ^11.5.0 @@ -1305,10 +1305,10 @@ importers: packages/admin/admin-color-picker: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons clsx: specifier: ^1.1.1 @@ -1330,10 +1330,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1381,10 +1381,10 @@ importers: packages/admin/admin-date-time: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons '@mui/utils': specifier: ^5.4.1 @@ -1406,10 +1406,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1470,10 +1470,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1530,10 +1530,10 @@ importers: packages/admin/admin-react-select: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons classnames: specifier: ^2.2.6 @@ -1546,10 +1546,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1597,10 +1597,10 @@ importers: packages/admin/admin-rte: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons detect-browser: specifier: ^5.2.1 @@ -1625,10 +1625,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1706,7 +1706,7 @@ importers: packages/admin/admin-theme: dependencies: '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons '@mui/utils': specifier: ^5.4.1 @@ -1719,10 +1719,10 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@mui/material': specifier: ^5.0.0 @@ -1764,10 +1764,10 @@ importers: packages/admin/blocks-admin: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons '@mui/lab': specifier: ^5.0.0-alpha.76 @@ -1798,13 +1798,13 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/cli': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../cli '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@emotion/react': specifier: ^11.5.0 @@ -1894,22 +1894,22 @@ importers: packages/admin/cms-admin: dependencies: '@comet/admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin '@comet/admin-date-time': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-date-time '@comet/admin-icons': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-icons '@comet/admin-rte': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-rte '@comet/admin-theme': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-theme '@comet/blocks-admin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../blocks-admin '@graphql-tools/graphql-file-loader': specifier: ^7.5.17 @@ -2033,13 +2033,13 @@ importers: specifier: ^7.20.12 version: 7.20.12 '@comet/admin-babel-preset': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../admin-babel-preset '@comet/cli': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../cli '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@emotion/react': specifier: ^11.5.0 @@ -2217,7 +2217,7 @@ importers: version: 3.0.2 devDependencies: '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@nestjs/common': specifier: ^9.0.0 @@ -2280,7 +2280,7 @@ importers: specifier: ^12.23.0 version: 12.24.0 '@comet/blocks-api': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../blocks-api '@fast-csv/parse': specifier: ^4.3.6 @@ -2419,7 +2419,7 @@ importers: specifier: ^3.47.0 version: 3.254.0 '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@golevelup/ts-jest': specifier: ^0.4.0 @@ -2555,7 +2555,7 @@ importers: version: 2.8.3 devDependencies: '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../eslint-config '@types/node': specifier: ^18.0.0 @@ -2582,7 +2582,7 @@ importers: specifier: ^1.4.1 version: 1.4.1 '@comet/eslint-plugin': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../eslint-plugin '@next/eslint-plugin-next': specifier: ^14.0.0 @@ -2689,10 +2689,10 @@ importers: version: 3.1.0(react@18.3.1) devDependencies: '@comet/cli': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../cli '@comet/eslint-config': - specifier: workspace:^7.4.1 + specifier: workspace:^7.4.2 version: link:../../eslint-config '@gitbeaker/node': specifier: ^34.0.0 From b392fea4879d934baf73cc53fa57b39054c6f644 Mon Sep 17 00:00:00 2001 From: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:42:36 +0200 Subject: [PATCH 03/12] Move `createHashedPath` util to blob storage module (#2540) It's always used in combination with the blob storage, so it should be there. Also it's used by both the DAM and file uploads module, so having it in the DAM module seems wrong. --- Adresses https://github.com/vivid-planet/comet/pull/2409#discussion_r1713394502. --- demo/api/schema.gql | 34 +++++++++---------- packages/api/cms-api/schema.gql | 34 +++++++++---------- .../backends/blob-storage-backend.service.ts | 2 +- .../utils/create-hashed-path.util.ts | 5 +++ .../dam/cache/scaled-images-cache.service.ts | 2 +- .../cms-api/src/dam/files/files.controller.ts | 3 +- .../cms-api/src/dam/files/files.service.ts | 3 +- .../api/cms-api/src/dam/files/files.utils.ts | 3 -- .../cms-api/src/dam/files/folders.service.ts | 2 +- .../src/dam/images/images.controller.ts | 2 +- .../file-uploads-download.controller.ts | 3 +- 11 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 packages/api/cms-api/src/blob-storage/utils/create-hashed-path.util.ts diff --git a/demo/api/schema.gql b/demo/api/schema.gql index 0e6cf3af7c..7feaa2a072 100644 --- a/demo/api/schema.gql +++ b/demo/api/schema.gql @@ -43,6 +43,23 @@ A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date """ scalar DateTime +type Dependency { + rootId: String! + rootGraphqlObjectType: String! + rootColumnName: String! + jsonPath: String! + visible: Boolean! + targetGraphqlObjectType: String! + targetId: String! + name: String + secondaryInformation: String +} + +type PaginatedDependencies { + nodes: [Dependency!]! + totalCount: Int! +} + type ImageCropArea { focalPoint: FocalPoint! width: Float @@ -90,23 +107,6 @@ enum LicenseType { RIGHTS_MANAGED } -type Dependency { - rootId: String! - rootGraphqlObjectType: String! - rootColumnName: String! - jsonPath: String! - visible: Boolean! - targetGraphqlObjectType: String! - targetId: String! - name: String - secondaryInformation: String -} - -type PaginatedDependencies { - nodes: [Dependency!]! - totalCount: Int! -} - type BuildTemplate { id: ID! name: String! diff --git a/packages/api/cms-api/schema.gql b/packages/api/cms-api/schema.gql index f43e214b9a..1a66864e82 100644 --- a/packages/api/cms-api/schema.gql +++ b/packages/api/cms-api/schema.gql @@ -39,6 +39,23 @@ A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date """ scalar DateTime +type Dependency { + rootId: String! + rootGraphqlObjectType: String! + rootColumnName: String! + jsonPath: String! + visible: Boolean! + targetGraphqlObjectType: String! + targetId: String! + name: String + secondaryInformation: String +} + +type PaginatedDependencies { + nodes: [Dependency!]! + totalCount: Int! +} + type ImageCropArea { focalPoint: FocalPoint! width: Float @@ -86,23 +103,6 @@ enum LicenseType { RIGHTS_MANAGED } -type Dependency { - rootId: String! - rootGraphqlObjectType: String! - rootColumnName: String! - jsonPath: String! - visible: Boolean! - targetGraphqlObjectType: String! - targetId: String! - name: String - secondaryInformation: String -} - -type PaginatedDependencies { - nodes: [Dependency!]! - totalCount: Int! -} - type BuildTemplate { id: ID! name: String! diff --git a/packages/api/cms-api/src/blob-storage/backends/blob-storage-backend.service.ts b/packages/api/cms-api/src/blob-storage/backends/blob-storage-backend.service.ts index 4973b6ee16..8aeeb8cd3d 100644 --- a/packages/api/cms-api/src/blob-storage/backends/blob-storage-backend.service.ts +++ b/packages/api/cms-api/src/blob-storage/backends/blob-storage-backend.service.ts @@ -1,9 +1,9 @@ import { Inject, Injectable } from "@nestjs/common"; -import { createHashedPath } from "../../dam/files/files.utils"; import { BlobStorageConfig } from "../blob-storage.config"; import { BLOB_STORAGE_CONFIG } from "../blob-storage.constants"; import { BlobStorageFileUploadInterface } from "../dto/blob-storage-file-upload.interface"; +import { createHashedPath } from "../utils/create-hashed-path.util"; import { BlobStorageAzureStorage } from "./azure/blob-storage-azure.storage"; import { BlobStorageBackendInterface, CreateFileOptions, StorageMetaData } from "./blob-storage-backend.interface"; import { BlobStorageFileStorage } from "./file/blob-storage-file.storage"; diff --git a/packages/api/cms-api/src/blob-storage/utils/create-hashed-path.util.ts b/packages/api/cms-api/src/blob-storage/utils/create-hashed-path.util.ts new file mode 100644 index 0000000000..6e59a6e8ed --- /dev/null +++ b/packages/api/cms-api/src/blob-storage/utils/create-hashed-path.util.ts @@ -0,0 +1,5 @@ +import { sep } from "path"; + +export function createHashedPath(contentHash: string) { + return [contentHash.substr(0, 2), contentHash.substr(2, 2), contentHash].join(sep); +} diff --git a/packages/api/cms-api/src/dam/cache/scaled-images-cache.service.ts b/packages/api/cms-api/src/dam/cache/scaled-images-cache.service.ts index 72e21bf87d..c656812d47 100644 --- a/packages/api/cms-api/src/dam/cache/scaled-images-cache.service.ts +++ b/packages/api/cms-api/src/dam/cache/scaled-images-cache.service.ts @@ -3,9 +3,9 @@ import hasha from "hasha"; import { sep } from "path"; import { BlobStorageBackendService } from "../../blob-storage/backends/blob-storage-backend.service"; +import { createHashedPath } from "../../blob-storage/utils/create-hashed-path.util"; import { DamConfig } from "../dam.config"; import { DAM_CONFIG } from "../dam.constants"; -import { createHashedPath } from "../files/files.utils"; import { FileCache } from "./dto/file-cache.interface"; @Injectable() diff --git a/packages/api/cms-api/src/dam/files/files.controller.ts b/packages/api/cms-api/src/dam/files/files.controller.ts index 6cf17aa993..b21be05d4a 100644 --- a/packages/api/cms-api/src/dam/files/files.controller.ts +++ b/packages/api/cms-api/src/dam/files/files.controller.ts @@ -22,6 +22,7 @@ import { OutgoingHttpHeaders } from "http"; import { DisableCometGuards } from "../../auth/decorators/disable-comet-guards.decorator"; import { GetCurrentUser } from "../../auth/decorators/get-current-user.decorator"; import { BlobStorageBackendService } from "../../blob-storage/backends/blob-storage-backend.service"; +import { createHashedPath } from "../../blob-storage/utils/create-hashed-path.util"; import { CometValidationException } from "../../common/errors/validation.exception"; import { RequiredPermission } from "../../user-permissions/decorators/required-permission.decorator"; import { CurrentUser } from "../../user-permissions/dto/current-user"; @@ -37,7 +38,7 @@ import { FileParams, HashFileParams } from "./dto/file.params"; import { FileUploadInput } from "./dto/file-upload.input"; import { FileInterface } from "./entities/file.entity"; import { FilesService } from "./files.service"; -import { calculatePartialRanges, createHashedPath } from "./files.utils"; +import { calculatePartialRanges } from "./files.utils"; const fileUrl = `:fileId/:filename`; diff --git a/packages/api/cms-api/src/dam/files/files.service.ts b/packages/api/cms-api/src/dam/files/files.service.ts index 5fbab12c9d..3458e41489 100644 --- a/packages/api/cms-api/src/dam/files/files.service.ts +++ b/packages/api/cms-api/src/dam/files/files.service.ts @@ -13,6 +13,7 @@ import probe from "probe-image-size"; import * as rimraf from "rimraf"; import { BlobStorageBackendService } from "../../blob-storage/backends/blob-storage-backend.service"; +import { createHashedPath } from "../../blob-storage/utils/create-hashed-path.util"; import { CometEntityNotFoundException } from "../../common/errors/entity-not-found.exception"; import { SortDirection } from "../../common/sorting/sort-direction.enum"; import { ContentScopeService } from "../../user-permissions/content-scope.service"; @@ -35,7 +36,7 @@ import { FILE_TABLE_NAME, FileInterface } from "./entities/file.entity"; import { DamFileImage } from "./entities/file-image.entity"; import { FolderInterface } from "./entities/folder.entity"; import { FileValidationService } from "./file-validation.service"; -import { createHashedPath, slugifyFilename } from "./files.utils"; +import { slugifyFilename } from "./files.utils"; import { FoldersService } from "./folders.service"; const exifrSupportedMimetypes = ["image/jpeg", "image/tiff", "image/x-iiq", "image/heif", "image/heic", "image/avif", "image/png"]; diff --git a/packages/api/cms-api/src/dam/files/files.utils.ts b/packages/api/cms-api/src/dam/files/files.utils.ts index 1804028d74..3ecb47f2b8 100644 --- a/packages/api/cms-api/src/dam/files/files.utils.ts +++ b/packages/api/cms-api/src/dam/files/files.utils.ts @@ -5,7 +5,6 @@ import { unlink } from "fs/promises"; import got from "got"; import * as mimedb from "mime-db"; import os from "os"; -import { sep } from "path"; import slugify from "slugify"; import stream from "stream"; import { promisify } from "util"; @@ -21,8 +20,6 @@ export function slugifyFilename(filename: string, extension: string): string { return `${slugify(filename)}${extensionWithDot}`; } -export const createHashedPath = (contentHash: string): string => [contentHash.substr(0, 2), contentHash.substr(2, 2), contentHash].join(sep); - export const calculatePartialRanges = (size: number, range: string): { start: number; end: number; contentLength: number } => { let [start, end] = range.replace(/bytes=/, "").split("-") as Array; start = parseInt(start as string, 10); diff --git a/packages/api/cms-api/src/dam/files/folders.service.ts b/packages/api/cms-api/src/dam/files/folders.service.ts index eb92d0eb42..4b479a27e0 100644 --- a/packages/api/cms-api/src/dam/files/folders.service.ts +++ b/packages/api/cms-api/src/dam/files/folders.service.ts @@ -6,6 +6,7 @@ import JSZip from "jszip"; import isEqual from "lodash.isequal"; import { BlobStorageBackendService } from "../../blob-storage/backends/blob-storage-backend.service"; +import { createHashedPath } from "../../blob-storage/utils/create-hashed-path.util"; import { CometEntityNotFoundException } from "../../common/errors/entity-not-found.exception"; import { SortDirection } from "../../common/sorting/sort-direction.enum"; import { DamConfig } from "../dam.config"; @@ -15,7 +16,6 @@ import { DamFolderListPositionArgs, FolderArgsInterface } from "./dto/folder.arg import { UpdateFolderInput } from "./dto/folder.input"; import { FOLDER_TABLE_NAME, FolderInterface } from "./entities/folder.entity"; import { FilesService } from "./files.service"; -import { createHashedPath } from "./files.utils"; export const withFoldersSelect = ( qb: QueryBuilder, diff --git a/packages/api/cms-api/src/dam/images/images.controller.ts b/packages/api/cms-api/src/dam/images/images.controller.ts index 510a076153..85f72e7aa9 100644 --- a/packages/api/cms-api/src/dam/images/images.controller.ts +++ b/packages/api/cms-api/src/dam/images/images.controller.ts @@ -9,6 +9,7 @@ import { PassThrough } from "stream"; import { DisableCometGuards } from "../../auth/decorators/disable-comet-guards.decorator"; import { GetCurrentUser } from "../../auth/decorators/get-current-user.decorator"; import { BlobStorageBackendService } from "../../blob-storage/backends/blob-storage-backend.service"; +import { createHashedPath } from "../../blob-storage/utils/create-hashed-path.util"; import { RequiredPermission } from "../../user-permissions/decorators/required-permission.decorator"; import { CurrentUser } from "../../user-permissions/dto/current-user"; import { ACCESS_CONTROL_SERVICE } from "../../user-permissions/user-permissions.constants"; @@ -19,7 +20,6 @@ import { DamConfig } from "../dam.config"; import { DAM_CONFIG } from "../dam.constants"; import { FileInterface } from "../files/entities/file.entity"; import { FilesService } from "../files/files.service"; -import { createHashedPath } from "../files/files.utils"; import { Extension, Gravity, ResizingType } from "../imgproxy/imgproxy.enum"; import { ImgproxyService } from "../imgproxy/imgproxy.service"; import { HashImageParams, ImageParams } from "./dto/image.params"; diff --git a/packages/api/cms-api/src/file-uploads/file-uploads-download.controller.ts b/packages/api/cms-api/src/file-uploads/file-uploads-download.controller.ts index f219ad9c7a..151bdfbc05 100644 --- a/packages/api/cms-api/src/file-uploads/file-uploads-download.controller.ts +++ b/packages/api/cms-api/src/file-uploads/file-uploads-download.controller.ts @@ -5,7 +5,8 @@ import { Response } from "express"; import { DisableCometGuards } from "../auth/decorators/disable-comet-guards.decorator"; import { BlobStorageBackendService } from "../blob-storage/backends/blob-storage-backend.service"; -import { calculatePartialRanges, createHashedPath } from "../dam/files/files.utils"; +import { createHashedPath } from "../blob-storage/utils/create-hashed-path.util"; +import { calculatePartialRanges } from "../dam/files/files.utils"; import { RequiredPermission } from "../user-permissions/decorators/required-permission.decorator"; import { DownloadParams, HashDownloadParams } from "./dto/file-uploads-download.params"; import { FileUpload } from "./entities/file-upload.entity"; From 645db7c3c86882d6f0ed6c920ec5e247bbe4f624 Mon Sep 17 00:00:00 2001 From: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:19:30 +0200 Subject: [PATCH 04/12] Remove predefined page type from page link fragment (#2565) Leftover from https://github.com/vivid-planet/comet/pull/2293. --- demo/site/src/header/PageLink.fragment.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/demo/site/src/header/PageLink.fragment.ts b/demo/site/src/header/PageLink.fragment.ts index c4d24b2a0c..8e3be6d94f 100644 --- a/demo/site/src/header/PageLink.fragment.ts +++ b/demo/site/src/header/PageLink.fragment.ts @@ -12,9 +12,6 @@ export const pageLinkFragment = gql` ... on Link { content } - ... on PredefinedPage { - type - } } } `; From cd0dfd7e7d1fd5bcacdb4da744ef26f83093df0b Mon Sep 17 00:00:00 2001 From: Thomas Dax Date: Mon, 23 Sep 2024 11:27:20 +0200 Subject: [PATCH 05/12] Update SECURITY.md (#2567) --- SECURITY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index e842f38ad0..95d16c4baa 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,7 +6,8 @@ The versions of the project that are currently supported with security updates. | Version | Supported | | ------: | :------------------------------------ | -| 6.x | :white_check_mark: | +| 7.x | :white_check_mark: | +| 6.x | :white_check_mark: (until 2025-07-31) | | 5.x | :white_check_mark: (until 2025-01-30) | | 4.x | :white_check_mark: (until 2024-11-21) | | < 4.x | :x: | From 986e3c58468f29ba711363cf947c2771019bb44e Mon Sep 17 00:00:00 2001 From: Ricky James Smith Date: Mon, 23 Sep 2024 12:29:49 +0200 Subject: [PATCH 06/12] Update dev story for SelectField to showcase and test different use cases (#2563) --- storybook/src/admin/form/Select.tsx | 211 +++++++++++++++------------- 1 file changed, 115 insertions(+), 96 deletions(-) diff --git a/storybook/src/admin/form/Select.tsx b/storybook/src/admin/form/Select.tsx index fbbdc2c010..724c8da3c1 100644 --- a/storybook/src/admin/form/Select.tsx +++ b/storybook/src/admin/form/Select.tsx @@ -1,6 +1,6 @@ -import { Field, FinalFormSelect, SelectField, SelectFieldOption } from "@comet/admin"; +import { Field, FieldSet, FinalFormSelect, SelectField, SelectFieldOption } from "@comet/admin"; import { Account } from "@comet/admin-icons"; -import { Card, CardContent, InputAdornment, MenuItem } from "@mui/material"; +import { Box, Checkbox, InputAdornment, ListItemIcon, ListItemText, MenuItem } from "@mui/material"; import { storiesOf } from "@storybook/react"; import * as React from "react"; import { Form } from "react-final-form"; @@ -10,109 +10,128 @@ function Story() { { value: "chocolate", label: "Chocolate" }, { value: "strawberry", label: "Strawberry" }, { value: "raspberry", label: "Raspberry" }, - { value: "vanilla", label: "Vanilla" }, + { value: "vanilla", label: "Vanilla", disabled: true }, { value: "mango", label: "Mango" }, ]; + const numberOptions: SelectFieldOption[] = [ + { value: 0, label: "Zero" }, + { value: 1, label: "One" }, + { value: 2, label: "Two" }, + { value: 3, label: "Three" }, + { value: 4, label: "Four", disabled: true }, + { value: 5, label: "Five" }, + ]; + return ( -
-

- If an options-prop or the props from the useAsyncOptionsProps-Hook are passed, FinalFormSelect automatically renders the options by - itself and uses objects as values. -

-
-
{ - // - }} - render={({ handleSubmit }) => ( - - - - - {(props) => ( - - {options.map((option) => ( - - {option.label} - - ))} - - )} - + + { + // + }} + render={({ handleSubmit, values }) => ( + +
+ + + {JSON.stringify({ flavor: values.flavor, number: values.number }, null, 2)} +
- +
+ + + + {JSON.stringify({ multipleFlavors: values.multipleFlavors, multipleNumbers: values.multipleNumbers }, null, 2)} + +
- - {(props) => ( - - {options.map((option) => ( - - {option.label} - - ))} - - )} - +
+ + + + + {JSON.stringify( + { + requiredFlavor: values.requiredFlavor, + requiredNumber: values.requiredNumber, + multipleRequiredFlavors: values.multipleRequiredFlavors, + }, + null, + 2, + )} + +
- - {(props) => ( - - {options.map((option) => ( - - {option.label} - - ))} - - )} - +
+ {/* TODO: Make this work with SelectField */} + + {(props) => ( + + + + } + > + {options.map((option) => ( + + {option.label} + + ))} + + )} + - - {(props) => ( - - - - } - endAdornment={ - - - - } - > - {options.map((option) => ( - - {option.label} - - ))} - - )} - + {/* TODO: Make this work with SelectField */} + + {(props) => ( + options.find((option) => option.value === value)?.label} + fullWidth + > + {options.map((option) => ( + + + + + + + + ))} + + )} + - - {(props) => ( - - {options.map((option) => ( - - {option.label} - - ))} - - )} - - - - - )} - /> -
-
+ + {JSON.stringify( + { + flavorMultipleAdornments: values.flavorMultipleAdornments, + flavorWithCustomOptionsRendering: values.flavorWithCustomOptionsRendering, + }, + null, + 2, + )} + + + + )} + /> + ); } From 000330fbcb0271d781570e1aa5e3d58bc33c7461 Mon Sep 17 00:00:00 2001 From: Abel Castro <26894614+abel-castro@users.noreply.github.com> Date: Tue, 24 Sep 2024 08:21:24 +0200 Subject: [PATCH 07/12] Demo: Start API in debug mode by default (#2532) --- demo/api/package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demo/api/package.json b/demo/api/package.json index 045e76cb2b..ec99d1bbed 100644 --- a/demo/api/package.json +++ b/demo/api/package.json @@ -20,9 +20,8 @@ "mikro-orm": "mikro-orm", "mikro-orm:drop": "mikro-orm schema:drop -r", "mikro-orm:migration:generate": "mikro-orm migration:create", - "start": "$npm_execpath prebuild && dotenv -c -- nest start", - "start:debug": "$npm_execpath prebuild && dotenv -c -- nest start --debug --watch --preserveWatchOutput", - "start:dev": "$npm_execpath prebuild && $npm_execpath db:migrate && $npm_execpath console createBlockIndexViews && dotenv -c -- nest start --watch --preserveWatchOutput", + "start": "$npm_execpath prebuild && dotenv -c -- nest start --debug --watch --preserveWatchOutput", + "start:dev": "$npm_execpath prebuild && $npm_execpath db:migrate && $npm_execpath console createBlockIndexViews && dotenv -c -- nest start --debug --watch --preserveWatchOutput", "start:prod": "node dist/main" }, "dependencies": { From c8f37fbd1dafd5adfef57f2af4f99d468227398b Mon Sep 17 00:00:00 2001 From: Ricky James Smith Date: Tue, 24 Sep 2024 08:24:54 +0200 Subject: [PATCH 08/12] Allow setting all props of `FinalFormSelect` via `componentsProps` in `SelectField` (#2566) This was previously limited as the `FinalFormSelectProps` type is not the only type that defines the props of `FinalFormSelect`. --- .changeset/soft-flies-collect.md | 5 ++ .../admin/src/form/fields/SelectField.tsx | 6 +- storybook/src/admin/form/Select.tsx | 73 +++++++++---------- 3 files changed, 41 insertions(+), 43 deletions(-) create mode 100644 .changeset/soft-flies-collect.md diff --git a/.changeset/soft-flies-collect.md b/.changeset/soft-flies-collect.md new file mode 100644 index 0000000000..7f8f9d9576 --- /dev/null +++ b/.changeset/soft-flies-collect.md @@ -0,0 +1,5 @@ +--- +"@comet/admin": patch +--- + +Allow setting all props of `FinalFormSelect` via `componentsProps` in `SelectField` diff --git a/packages/admin/admin/src/form/fields/SelectField.tsx b/packages/admin/admin/src/form/fields/SelectField.tsx index d21a54fc9f..53f14414a2 100644 --- a/packages/admin/admin/src/form/fields/SelectField.tsx +++ b/packages/admin/admin/src/form/fields/SelectField.tsx @@ -1,8 +1,8 @@ import { MenuItem } from "@mui/material"; -import { ReactNode } from "react"; +import { ComponentProps, ReactNode } from "react"; import { Field, FieldProps } from "../Field"; -import { FinalFormSelect, FinalFormSelectProps } from "../FinalFormSelect"; +import { FinalFormSelect } from "../FinalFormSelect"; export type SelectFieldOption = { label: ReactNode; @@ -21,7 +21,7 @@ export interface SelectFieldProps extends SelectF children?: ReturnType>["children"]>; options?: SelectFieldOption[]; componentsProps?: { - finalFormSelect?: FinalFormSelectProps; + finalFormSelect?: Partial>>; }; } diff --git a/storybook/src/admin/form/Select.tsx b/storybook/src/admin/form/Select.tsx index 724c8da3c1..2f19871086 100644 --- a/storybook/src/admin/form/Select.tsx +++ b/storybook/src/admin/form/Select.tsx @@ -1,4 +1,4 @@ -import { Field, FieldSet, FinalFormSelect, SelectField, SelectFieldOption } from "@comet/admin"; +import { FieldSet, SelectField, SelectFieldOption } from "@comet/admin"; import { Account } from "@comet/admin-icons"; import { Box, Checkbox, InputAdornment, ListItemIcon, ListItemText, MenuItem } from "@mui/material"; import { storiesOf } from "@storybook/react"; @@ -75,48 +75,41 @@ function Story() {
- {/* TODO: Make this work with SelectField */} - - {(props) => ( - - } - > - {options.map((option) => ( - - {option.label} - - ))} - - )} - - - {/* TODO: Make this work with SelectField */} - - {(props) => ( - options.find((option) => option.value === value)?.label} - fullWidth - > - {options.map((option) => ( - - - - - - - - ))} - - )} - - + ), + }, + }} + /> + options.find((option) => option.value === value)?.label, + }, + }} + > + {options.map((option) => ( + + + + + + + + ))} + {JSON.stringify( { From b5838209b242a188a1bc208f743ea16c169d3352 Mon Sep 17 00:00:00 2001 From: Ricky James Smith Date: Tue, 24 Sep 2024 08:27:13 +0200 Subject: [PATCH 09/12] Fix showing the clear button when the value of SelectField is empty (#2564) When the fields value in the form state is `undefined`, the internal value of the input itself is an empty string, as is always the case when accessing the value of an empty HTML input. --- .changeset/six-rules-hope.md | 5 +++++ packages/admin/admin/src/form/FinalFormSelect.tsx | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/six-rules-hope.md diff --git a/.changeset/six-rules-hope.md b/.changeset/six-rules-hope.md new file mode 100644 index 0000000000..3e5e9eaad0 --- /dev/null +++ b/.changeset/six-rules-hope.md @@ -0,0 +1,5 @@ +--- +"@comet/admin": patch +--- + +Fix an issue where the clear button of `SelectField` would be shown, even if the value is `undefined` diff --git a/packages/admin/admin/src/form/FinalFormSelect.tsx b/packages/admin/admin/src/form/FinalFormSelect.tsx index 8938e88a4b..e7b6786f85 100644 --- a/packages/admin/admin/src/form/FinalFormSelect.tsx +++ b/packages/admin/admin/src/form/FinalFormSelect.tsx @@ -13,6 +13,14 @@ export interface FinalFormSelectProps extends FieldRenderProps { + if (multiple && Array.isArray(value)) { + return value.length > 0; + } + + return value !== undefined && value !== ""; +}; + export const FinalFormSelect = ({ input: { checked, value, name, onChange, onFocus, onBlur, ...restInput }, meta, @@ -47,7 +55,7 @@ export const FinalFormSelect = ({ const endAdornment = !required ? ( onChange(multiple ? [] : undefined)} /> ) : null; From bc124d2678e2e564b559d2d512143b57445591e0 Mon Sep 17 00:00:00 2001 From: Franz Unger Date: Tue, 24 Sep 2024 08:29:21 +0200 Subject: [PATCH 10/12] Support numbers as content scope values (#2551) Problem was that numeric content scope value were not displayed in the user permissions admin panel. --- .changeset/yellow-toes-beg.md | 5 +++++ .../src/userPermissions/utils/camelCaseToHumanReadable.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/yellow-toes-beg.md diff --git a/.changeset/yellow-toes-beg.md b/.changeset/yellow-toes-beg.md new file mode 100644 index 0000000000..cbc32dfaa9 --- /dev/null +++ b/.changeset/yellow-toes-beg.md @@ -0,0 +1,5 @@ +--- +"@comet/cms-admin": patch +--- + +Support numbers as content scope values in User Permissions administration panel diff --git a/packages/admin/cms-admin/src/userPermissions/utils/camelCaseToHumanReadable.ts b/packages/admin/cms-admin/src/userPermissions/utils/camelCaseToHumanReadable.ts index c32142ca45..58a96da36e 100644 --- a/packages/admin/cms-admin/src/userPermissions/utils/camelCaseToHumanReadable.ts +++ b/packages/admin/cms-admin/src/userPermissions/utils/camelCaseToHumanReadable.ts @@ -1,4 +1,4 @@ -export function camelCaseToHumanReadable(s: string) { - const words = s.match(/[A-Za-z][a-z]*/g) || []; +export function camelCaseToHumanReadable(s: string | number) { + const words = s.toString().match(/[A-Za-z0-9][a-z0-9]*/g) || []; return words.map((word) => word.charAt(0).toUpperCase() + word.substring(1)).join(" "); } From 566d5be455e39201c192d6665de0920bcc52c11f Mon Sep 17 00:00:00 2001 From: andrearutrecht <122883866+andrearutrecht@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:11:14 +0200 Subject: [PATCH 11/12] Admin Generator (Future): Implement option to set tooltips for grid column headers (#2362) --- demo/admin/src/products/ManufacturersGrid.tsx | 18 ++--- .../future/ManufacturersGrid.cometGen.ts | 9 ++- .../products/future/ProductsGrid.cometGen.ts | 2 +- .../future/generated/ManufacturersGrid.tsx | 48 +++++++++++- .../future/generated/ProductsGrid.tsx | 23 ++++-- .../src/generator/future/generateGrid.ts | 73 ++++++++++++++----- .../future/generateGrid/combinationColumn.ts | 4 +- .../src/generator/future/generator.ts | 7 +- 8 files changed, 136 insertions(+), 48 deletions(-) diff --git a/demo/admin/src/products/ManufacturersGrid.tsx b/demo/admin/src/products/ManufacturersGrid.tsx index 8c4e47524b..7440282513 100644 --- a/demo/admin/src/products/ManufacturersGrid.tsx +++ b/demo/admin/src/products/ManufacturersGrid.tsx @@ -17,8 +17,8 @@ import { usePersistentColumnState, } from "@comet/admin"; import { Add as AddIcon, Edit, Info } from "@comet/admin-icons"; -import { Button, IconButton, Typography } from "@mui/material"; -import { DataGridPro, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; +import { Button, IconButton } from "@mui/material"; +import { DataGridPro, GridColumnHeaderTitle, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; import { GQLCreateManufacturerMutation, GQLCreateManufacturerMutationVariables, @@ -62,19 +62,15 @@ export function ManufacturersGrid() { field: "id", width: 150, renderHeader: () => ( -
- - {intl.formatMessage({ id: "manufacturers.id", defaultMessage: "ID" })} - + <> + } > - - - + -
+ ), }, { diff --git a/demo/admin/src/products/future/ManufacturersGrid.cometGen.ts b/demo/admin/src/products/future/ManufacturersGrid.cometGen.ts index 2827d74940..f8d56fcb28 100644 --- a/demo/admin/src/products/future/ManufacturersGrid.cometGen.ts +++ b/demo/admin/src/products/future/ManufacturersGrid.cometGen.ts @@ -10,8 +10,13 @@ export const ManufacturersGrid: GridConfig = { { type: "text", name: "name", headerName: "Name" }, { type: "text", name: "address.street", headerName: "Street" }, { type: "number", name: "address.streetNumber", headerName: "Street number" }, - { type: "text", name: "address.alternativeAddress.street", headerName: "Alt-Street" }, - { type: "number", name: "address.alternativeAddress.streetNumber", headerName: "Alt-Street number" }, + { type: "text", name: "address.alternativeAddress.street", headerName: "Alt-Street", headerInfoTooltip: "Street of alternative address" }, + { + type: "number", + name: "address.alternativeAddress.streetNumber", + headerName: "Alt-Street number", + headerInfoTooltip: "Street number of alternative address", + }, { type: "text", name: "addressAsEmbeddable.street", headerName: "Street 2" }, { type: "number", name: "addressAsEmbeddable.streetNumber", headerName: "Street number 2" }, { type: "text", name: "addressAsEmbeddable.alternativeAddress.street", headerName: "Alt-Street 2" }, diff --git a/demo/admin/src/products/future/ProductsGrid.cometGen.ts b/demo/admin/src/products/future/ProductsGrid.cometGen.ts index ac90434749..279fe70479 100644 --- a/demo/admin/src/products/future/ProductsGrid.cometGen.ts +++ b/demo/admin/src/products/future/ProductsGrid.cometGen.ts @@ -22,7 +22,7 @@ export const ProductsGrid: GridConfig = { }, { type: "text", name: "title", headerName: "Titel", minWidth: 200, maxWidth: 250, visible: "up('md')" }, { type: "text", name: "description", headerName: "Description", visible: "up('md')" }, - { type: "number", name: "price", headerName: "Price", maxWidth: 150 }, + { type: "number", name: "price", headerName: "Price", maxWidth: 150, headerInfoTooltip: "Price in EUR" }, { type: "boolean", name: "inStock", headerName: "In stock", width: 90 }, { type: "staticSelect", name: "type", maxWidth: 150, values: [{ value: "Cap", label: "great Cap" }, "Shirt", "Tie"] }, { type: "date", name: "availableSince", width: 140 }, diff --git a/demo/admin/src/products/future/generated/ManufacturersGrid.tsx b/demo/admin/src/products/future/generated/ManufacturersGrid.tsx index 19e7f80674..4f67231796 100644 --- a/demo/admin/src/products/future/generated/ManufacturersGrid.tsx +++ b/demo/admin/src/products/future/generated/ManufacturersGrid.tsx @@ -13,13 +13,14 @@ import { ToolbarActions, ToolbarFillSpace, ToolbarItem, + Tooltip, useBufferedRowCount, useDataGridRemote, usePersistentColumnState, } from "@comet/admin"; -import { Add as AddIcon, Edit } from "@comet/admin-icons"; +import { Add as AddIcon, Edit, Info } from "@comet/admin-icons"; import { Button, IconButton } from "@mui/material"; -import { DataGridPro, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; +import { DataGridPro, GridColumnHeaderTitle, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; import * as React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -137,7 +138,25 @@ export function ManufacturersGrid(): React.ReactElement { }, { field: "address_alternativeAddress_street", - headerName: intl.formatMessage({ id: "manufacturer.address.alternativeAddress.street", defaultMessage: "Alt-Street" }), + renderHeader: () => ( + <> + + + } + > + + + + ), filterable: false, sortable: false, valueGetter: ({ row }) => row.address?.alternativeAddress?.street, @@ -146,7 +165,28 @@ export function ManufacturersGrid(): React.ReactElement { }, { field: "address_alternativeAddress_streetNumber", - headerName: intl.formatMessage({ id: "manufacturer.address.alternativeAddress.streetNumber", defaultMessage: "Alt-Street number" }), + renderHeader: () => ( + <> + + + } + > + + + + ), type: "number", filterable: false, sortable: false, diff --git a/demo/admin/src/products/future/generated/ProductsGrid.tsx b/demo/admin/src/products/future/generated/ProductsGrid.tsx index b89c08d566..f4a59159de 100644 --- a/demo/admin/src/products/future/generated/ProductsGrid.tsx +++ b/demo/admin/src/products/future/generated/ProductsGrid.tsx @@ -13,16 +13,18 @@ import { ToolbarActions, ToolbarFillSpace, ToolbarItem, + Tooltip, useBufferedRowCount, useDataGridRemote, usePersistentColumnState, } from "@comet/admin"; +import { Info } from "@comet/admin-icons"; import { DamImageBlock } from "@comet/cms-admin"; import { useTheme } from "@mui/material"; -import { DataGridPro, GridRenderCellParams, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; +import { DataGridPro, GridColumnHeaderTitle, GridRenderCellParams, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; import { GQLProductFilter } from "@src/graphql.generated"; import * as React from "react"; -import { useIntl } from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; import { ProductsGridPreviewAction } from "../../ProductsGridPreviewAction"; import { @@ -115,16 +117,16 @@ export function ProductsGrid({ filter, toolbarAction, rowAction }: Props): React flex: 1, visible: theme.breakpoints.down("md"), sortBy: ["title", "description"], - maxWidth: 250, minWidth: 200, + maxWidth: 250, }, { field: "title", headerName: intl.formatMessage({ id: "product.title", defaultMessage: "Titel" }), flex: 1, visible: theme.breakpoints.up("md"), - maxWidth: 250, minWidth: 200, + maxWidth: 250, }, { field: "description", @@ -135,11 +137,18 @@ export function ProductsGrid({ filter, toolbarAction, rowAction }: Props): React }, { field: "price", - headerName: intl.formatMessage({ id: "product.price", defaultMessage: "Price" }), + renderHeader: () => ( + <> + + }> + + + + ), type: "number", flex: 1, - maxWidth: 150, minWidth: 150, + maxWidth: 150, }, { field: "inStock", headerName: intl.formatMessage({ id: "product.inStock", defaultMessage: "In stock" }), type: "boolean", width: 90 }, { @@ -163,8 +172,8 @@ export function ProductsGrid({ filter, toolbarAction, rowAction }: Props): React return row.type; }, flex: 1, - maxWidth: 150, minWidth: 150, + maxWidth: 150, }, { field: "availableSince", diff --git a/packages/admin/cms-admin/src/generator/future/generateGrid.ts b/packages/admin/cms-admin/src/generator/future/generateGrid.ts index f09eb53398..d253f4e3bb 100644 --- a/packages/admin/cms-admin/src/generator/future/generateGrid.ts +++ b/packages/admin/cms-admin/src/generator/future/generateGrid.ts @@ -331,6 +331,7 @@ export function generateGrid( minWidth: column.minWidth, maxWidth: column.maxWidth, flex: column.flex, + headerInfoTooltip: column.headerInfoTooltip, visible: column.visible && `theme.breakpoints.${column.visible}`, pinned: column.pinned, }; @@ -351,6 +352,7 @@ export function generateGrid( minWidth: column.minWidth, maxWidth: column.maxWidth, flex: column.flex, + headerInfoTooltip: column.headerInfoTooltip, visible: column.visible && `theme.breakpoints.${column.visible}`, pinned: column.pinned, sortBy: "sortBy" in column && column.sortBy, @@ -396,14 +398,15 @@ export function generateGrid( ToolbarActions, ToolbarFillSpace, ToolbarItem, + Tooltip, useBufferedRowCount, useDataGridRemote, usePersistentColumnState, } from "@comet/admin"; - import { Add as AddIcon, Edit } from "@comet/admin-icons"; + import { Add as AddIcon, Edit, Info } from "@comet/admin-icons"; import { BlockPreviewContent } from "@comet/blocks-admin"; - import { Alert, Button, Box, IconButton, useTheme } from "@mui/material"; - import { DataGridPro, GridRenderCellParams, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; + import { Alert, Button, Box, IconButton, Typography, useTheme } from "@mui/material"; + import { DataGridPro, GridColumnHeaderTitle, GridRenderCellParams, GridToolbarQuickFilter } from "@mui/x-data-grid-pro"; import { useContentScope } from "@src/common/ContentScopeProvider"; import { GQL${gqlTypePlural}GridQuery, @@ -540,11 +543,54 @@ export function generateGrid( const columns: GridColDef[] = [ ${gridColumnFields .map((column) => { + const defaultMinWidth = 150; + const defaultColumnFlex = 1; + let minWidth; + let maxWidth; + let tooltipColumnWidth = column.width; + + if (typeof column.width === "undefined") { + maxWidth = column.maxWidth; + + if ( + typeof column.minWidth === "undefined" && + (typeof column.maxWidth === "undefined" || column.maxWidth >= defaultMinWidth) + ) { + minWidth = defaultMinWidth; + tooltipColumnWidth = defaultMinWidth; + } else if (typeof column.minWidth !== "undefined") { + minWidth = column.minWidth; + tooltipColumnWidth = column.minWidth; + } + } + const columnDefinition: TsCodeRecordToStringObject = { field: `"${column.name.replace(/\./g, "_")}"`, // field-name is used for api-filter, and api nests with underscore - headerName: `intl.formatMessage({ id: "${instanceGqlType}.${column.name}", defaultMessage: "${ - column.headerName || camelCaseToHumanReadable(column.name) - }" })`, + renderHeader: column.headerInfoTooltip + ? `() => ( + <> + + } + > + + + + )` + : undefined, + headerName: !column.headerInfoTooltip + ? `intl.formatMessage({ id: "${instanceGqlType}.${column.name}", defaultMessage: "${ + column.headerName || camelCaseToHumanReadable(column.name) + }" })` + : undefined, type: column.gridType ? `"${column.gridType}"` : undefined, filterable: !filterFields.includes(column.name) ? `false` : undefined, sortable: !sortFields.includes(column.name) ? `false` : undefined, @@ -562,18 +608,9 @@ export function generateGrid( } if (typeof column.width === "undefined") { - const defaultMinWidth = 150; - columnDefinition.flex = 1; - columnDefinition.maxWidth = column.maxWidth; - - if ( - typeof column.minWidth === "undefined" && - (typeof column.maxWidth === "undefined" || column.maxWidth >= defaultMinWidth) - ) { - columnDefinition.minWidth = defaultMinWidth; - } else if (typeof column.minWidth !== "undefined") { - columnDefinition.minWidth = column.minWidth; - } + columnDefinition.flex = defaultColumnFlex; + columnDefinition.minWidth = minWidth; + columnDefinition.maxWidth = maxWidth; } return tsCodeRecordToString(columnDefinition); diff --git a/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts b/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts index 057bb09ff3..557d0e580e 100644 --- a/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts +++ b/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts @@ -1,7 +1,7 @@ import { GridColDef } from "@comet/admin"; import { FormattedNumber } from "react-intl"; -import { DataGridSettings } from "../generator"; +import { BaseColumnConfig } from "../generator"; type AbstractField = { field: FieldName; @@ -56,7 +56,7 @@ export type GridCombinationColumnConfig = { name: string; primaryText?: TextConfig; secondaryText?: TextConfig; -} & DataGridSettings & +} & BaseColumnConfig & Pick; const getTextForCellContent = (textConfig: TextConfig, messageIdPrefix: string) => { diff --git a/packages/admin/cms-admin/src/generator/future/generator.ts b/packages/admin/cms-admin/src/generator/future/generator.ts index cca5fab5e8..e90ed6fc31 100644 --- a/packages/admin/cms-admin/src/generator/future/generator.ts +++ b/packages/admin/cms-admin/src/generator/future/generator.ts @@ -80,7 +80,8 @@ export type FormConfig = { export type TabsConfig = { type: "tabs"; tabs: { name: string; content: GeneratorConfig }[] }; -export type DataGridSettings = Pick & { +export type BaseColumnConfig = Pick & { + headerInfoTooltip?: string; visible?: ColumnVisibleOption; }; @@ -92,9 +93,9 @@ export type GridColumnConfig = ( | { type: "dateTime" } | { type: "staticSelect"; values?: Array<{ value: string; label: string } | string> } | { type: "block"; block: ImportReference } -) & { name: UsableFields } & DataGridSettings; +) & { name: UsableFields } & BaseColumnConfig; -export type ActionsGridColumnConfig = { type: "actions"; component?: ImportReference } & DataGridSettings; +export type ActionsGridColumnConfig = { type: "actions"; component?: ImportReference } & BaseColumnConfig; export type GridConfig = { type: "grid"; From b433d53d6f2990e34bc8bc3aea864ee51e628061 Mon Sep 17 00:00:00 2001 From: Ricky James Smith Date: Tue, 24 Sep 2024 13:12:22 +0200 Subject: [PATCH 12/12] Admin Generator (Future): Rename combination column type `string` to `text` (#2556) This is to be more consistent with column types outside of combination columns. --- .../future/CombinationFieldsTestProductsGrid.cometGen.ts | 2 +- .../src/generator/future/generateGrid/combinationColumn.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/admin/src/products/future/CombinationFieldsTestProductsGrid.cometGen.ts b/demo/admin/src/products/future/CombinationFieldsTestProductsGrid.cometGen.ts index 170785ea70..c3164f2bcd 100644 --- a/demo/admin/src/products/future/CombinationFieldsTestProductsGrid.cometGen.ts +++ b/demo/admin/src/products/future/CombinationFieldsTestProductsGrid.cometGen.ts @@ -14,7 +14,7 @@ export const CombinationFieldsTestProductsGrid: GridConfig = { headerName: "Title and Category", primaryText: "title", secondaryText: { - type: "string", + type: "text", field: "category.title", emptyValue: "No category set", }, diff --git a/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts b/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts index 557d0e580e..b834513d90 100644 --- a/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts +++ b/packages/admin/cms-admin/src/generator/future/generateGrid/combinationColumn.ts @@ -8,8 +8,8 @@ type AbstractField = { emptyValue?: string; }; -type StringField = AbstractField & { - type: "string"; +type TextField = AbstractField & { + type: "text"; }; type StaticText = { @@ -47,7 +47,7 @@ type NumberField = AbstractField & // type TextConfig = Field | FieldGroup; -type Field = StaticText | FieldName | StringField | NumberField; +type Field = StaticText | FieldName | TextField | NumberField; type TextConfig = Field;