diff --git a/.changeset/epic-treasure-search.md b/.changeset/epic-treasure-search.md new file mode 100644 index 0000000000..04b0141aeb --- /dev/null +++ b/.changeset/epic-treasure-search.md @@ -0,0 +1,5 @@ +--- +"@comet/admin-rte": patch +--- + +Hide translation button for `FinalFormSearchTextField` diff --git a/.changeset/few-actors-impress.md b/.changeset/few-actors-impress.md deleted file mode 100644 index 08d2173463..0000000000 --- a/.changeset/few-actors-impress.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@comet/cms-admin": minor ---- - -Allow disabling the "Open preview" button in the `PageTree` for certain document types - -The "Open preview" button is shown for all document types in the `PageTree`. -But some document types (e.g., links) don't have a preview. -Clicking on the preview button leads to an error page. - -Now, it's possible to disable the button by setting `hasNoSitePreview` for the document: - -```diff -export const Link: DocumentInterface, GQLLinkInput> = { - // ... -+ hasNoSitePreview: true, -}; -``` diff --git a/.changeset/fifty-lies-smell.md b/.changeset/fifty-lies-smell.md new file mode 100644 index 0000000000..6f019907ef --- /dev/null +++ b/.changeset/fifty-lies-smell.md @@ -0,0 +1,32 @@ +--- +"@comet/admin": minor +--- + +Add `FinalFormAsyncSelect`, `AsyncSelectField`, and `FinalFormAsyncAutocomplete` components + +Thin wrappers to ease using `useAsyncOptionsProps()` with `FinalFormSelect` and `FinalFormAutocomplete`. + +**Example** + +Previously: + +```tsx +const asyncOptionsProps = useAsyncOptionsProps(async () => { + // Load options here +}); + +// ... + +; +``` + +Now: + +```tsx + { + // Load options here + }} +/> +``` diff --git a/.changeset/green-years-drum.md b/.changeset/green-years-drum.md new file mode 100644 index 0000000000..7073e9b514 --- /dev/null +++ b/.changeset/green-years-drum.md @@ -0,0 +1,9 @@ +--- +"@comet/cms-admin": minor +"@comet/cms-site": minor +"@comet/cms-api": minor +--- + +Add a `DamFileDownloadLinkBlock` that can be used to download a file or open it in a new tab + +Also, add new `/dam/files/download/:hash/:fileId/:filename` endpoint for downloading assets. diff --git a/.changeset/lemon-eyes-kick.md b/.changeset/lemon-eyes-kick.md new file mode 100644 index 0000000000..0218b7330b --- /dev/null +++ b/.changeset/lemon-eyes-kick.md @@ -0,0 +1,5 @@ +--- +"@comet/cms-api": patch +--- + +API CrudSingleGenerator: Run `transformToBlockData()` for block fields on create diff --git a/.changeset/plenty-pillows-jog.md b/.changeset/plenty-pillows-jog.md deleted file mode 100644 index 4484348f0b..0000000000 --- a/.changeset/plenty-pillows-jog.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@comet/admin": minor ---- - -Change `writeClipboardText`/`readClipboardText` clipboard fallback to in-memory - -Using the local storage as a fallback caused issues when writing clipboard contents larger than 5MB. -Changing the fallback to in-memory resolves the issue. diff --git a/.changeset/thin-balloons-invite.md b/.changeset/thin-balloons-invite.md new file mode 100644 index 0000000000..28c05ee168 --- /dev/null +++ b/.changeset/thin-balloons-invite.md @@ -0,0 +1,10 @@ +--- +"@comet/cms-api": patch +--- + +ChangesCheckerConsole: Start exactly matching job or all partially matching jobs + +Previously, the first job with a partially matching content scope was started. +Doing so could lead to problems when multiple jobs with overlapping content scopes exist. +For instance, jobs with the scopes `{ domain: "main", language: "de" }` and `{ domain: "main", language: "en" }` both partially match a change in `{ domain: "main", language: "de" }`. +To fix this, we either start a single job if the content scope matches exactly or start all jobs with partially matching content scopes. diff --git a/.changeset/wild-suns-eat.md b/.changeset/wild-suns-eat.md new file mode 100644 index 0000000000..dd1f1a723e --- /dev/null +++ b/.changeset/wild-suns-eat.md @@ -0,0 +1,7 @@ +--- +"@comet/cms-api": minor +--- + +Add `DisablePermissionCheck` constant for use in `@RequiredPermission` decorator + +You can disable authorization for a resolver or operation by adding the decorator `@RequiredPermission(DisablePermissionCheck)` diff --git a/.changeset/young-hotels-sparkle.md b/.changeset/young-hotels-sparkle.md deleted file mode 100644 index 04ef4a4945..0000000000 --- a/.changeset/young-hotels-sparkle.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -"@comet/cms-api": minor ---- - -Add a console script to import redirects from a csv file - -You can use the script like this: `npm run console import-redirects file-to-import.csv` - -The CSV file must look like this: - -```csv -source;target;target_type;comment;scope_domain -/test-source;/test-target;internal;Internal Example;main -/test-source-external;https://www.comet-dxp.com/;external;External Example;secondary -``` diff --git a/demo/admin/src/common/blocks/LinkBlock.tsx b/demo/admin/src/common/blocks/LinkBlock.tsx index fdc1a68b92..c81fcff1a7 100644 --- a/demo/admin/src/common/blocks/LinkBlock.tsx +++ b/demo/admin/src/common/blocks/LinkBlock.tsx @@ -1,6 +1,11 @@ -import { createLinkBlock, ExternalLinkBlock, InternalLinkBlock } from "@comet/cms-admin"; +import { createLinkBlock, DamFileDownloadLinkBlock, ExternalLinkBlock, InternalLinkBlock } from "@comet/cms-admin"; import { NewsLinkBlock } from "@src/news/blocks/NewsLinkBlock"; export const LinkBlock = createLinkBlock({ - supportedBlocks: { internal: InternalLinkBlock, external: ExternalLinkBlock, news: NewsLinkBlock }, + supportedBlocks: { + internal: InternalLinkBlock, + external: ExternalLinkBlock, + news: NewsLinkBlock, + damFileDownload: DamFileDownloadLinkBlock, + }, }); diff --git a/demo/api/block-meta.json b/demo/api/block-meta.json index 166562457f..e9567a9b1e 100644 --- a/demo/api/block-meta.json +++ b/demo/api/block-meta.json @@ -160,6 +160,60 @@ } ] }, + { + "name": "DamFileDownloadLink", + "fields": [ + { + "name": "file", + "kind": "NestedObject", + "object": { + "fields": [ + { + "name": "id", + "kind": "String", + "nullable": false + }, + { + "name": "name", + "kind": "String", + "nullable": false + }, + { + "name": "fileUrl", + "kind": "String", + "nullable": false + } + ] + }, + "nullable": true + }, + { + "name": "openFileType", + "kind": "Enum", + "enum": [ + "NewTab", + "Download" + ], + "nullable": false + } + ], + "inputFields": [ + { + "name": "fileId", + "kind": "String", + "nullable": true + }, + { + "name": "openFileType", + "kind": "Enum", + "enum": [ + "NewTab", + "Download" + ], + "nullable": false + } + ] + }, { "name": "DamImage", "fields": [ @@ -746,7 +800,8 @@ "blocks": { "internal": "InternalLink", "external": "ExternalLink", - "news": "NewsLink" + "news": "NewsLink", + "damFileDownload": "DamFileDownloadLink" }, "nullable": false } @@ -775,7 +830,8 @@ "blocks": { "internal": "InternalLink", "external": "ExternalLink", - "news": "NewsLink" + "news": "NewsLink", + "damFileDownload": "DamFileDownloadLink" }, "nullable": false } @@ -2085,7 +2141,7 @@ { "name": "youtubeIdentifier", "kind": "String", - "nullable": false + "nullable": true }, { "name": "aspectRatio", diff --git a/demo/api/src/common/blocks/linkBlock/link.block.ts b/demo/api/src/common/blocks/linkBlock/link.block.ts index b67dcc04fc..5df9b0eb2c 100644 --- a/demo/api/src/common/blocks/linkBlock/link.block.ts +++ b/demo/api/src/common/blocks/linkBlock/link.block.ts @@ -1,5 +1,7 @@ import { ExternalLinkBlock } from "@comet/blocks-api"; -import { createLinkBlock, InternalLinkBlock } from "@comet/cms-api"; +import { createLinkBlock, DamFileDownloadLinkBlock, InternalLinkBlock } from "@comet/cms-api"; import { NewsLinkBlock } from "@src/news/blocks/news-link.block"; -export const LinkBlock = createLinkBlock({ supportedBlocks: { internal: InternalLinkBlock, external: ExternalLinkBlock, news: NewsLinkBlock } }); +export const LinkBlock = createLinkBlock({ + supportedBlocks: { internal: InternalLinkBlock, external: ExternalLinkBlock, news: NewsLinkBlock, damFileDownload: DamFileDownloadLinkBlock }, +}); diff --git a/demo/api/src/footer/generated/footer.resolver.ts b/demo/api/src/footer/generated/footer.resolver.ts index f89bd1e701..83787f2d09 100644 --- a/demo/api/src/footer/generated/footer.resolver.ts +++ b/demo/api/src/footer/generated/footer.resolver.ts @@ -39,6 +39,7 @@ export class FooterResolver { if (!footer) { footer = this.repository.create({ ...input, + content: input.content.transformToBlockData(), scope, }); } diff --git a/demo/site/src/blocks/LinkBlock.tsx b/demo/site/src/blocks/LinkBlock.tsx index 7f9ba37928..e076d800ae 100644 --- a/demo/site/src/blocks/LinkBlock.tsx +++ b/demo/site/src/blocks/LinkBlock.tsx @@ -1,5 +1,17 @@ +<<<<<<< HEAD "use client"; import { ExternalLinkBlock, OneOfBlock, PropsWithData, SupportedBlocks, withPreview } from "@comet/cms-site"; +======= +import { + DamFileDownloadLinkBlock, + ExternalLinkBlock, + InternalLinkBlock, + OneOfBlock, + PropsWithData, + SupportedBlocks, + withPreview, +} from "@comet/cms-site"; +>>>>>>> main import { LinkBlockData } from "@src/blocks.generated"; import { NewsLinkBlock } from "@src/news/blocks/NewsLinkBlock"; import * as React from "react"; @@ -22,6 +34,11 @@ const supportedBlocks: SupportedBlocks = { {children} ), + damFileDownload: ({ children, title, ...props }) => ( + + {children} + + ), }; interface LinkBlockProps extends PropsWithData { diff --git a/docs/docs/dependencies/index.md b/docs/docs/dependencies/index.md index ce59d7c625..0fe7a59d1e 100644 --- a/docs/docs/dependencies/index.md +++ b/docs/docs/dependencies/index.md @@ -1,45 +1,86 @@ +<<<<<<< HEAD --- title: Dependencies sidebar_position: 15 --- # Dependencies +======= +# Block Index / Dependencies +>>>>>>> main -## Register fields to be added to the block index +Blocks can have references to entities. +But since block data is stored as JSON, there is no actual database relationship. -### Add `@RootBlockEntity()` and `@RootBlock()` decorators to entity +If you still need to know which entities a block references or in which blocks an entity is used, you can use COMET's block index. -The entity needs to be annotated with `@RootBlockEntity()`. +--- -All fields containing block data need to be annotated with `@RootBlock()`. The Block used by this field must be passed as an argument. +## Configuration Guide -```ts -//... -@RootBlockEntity() -export class News extends BaseEntity { - // ... +Follow the upcoming guide if you want to - @RootBlock(DamImageBlock) - @Property({ customType: new RootBlockType(DamImageBlock) }) - @Field(() => RootBlockDataScalar(DamImageBlock)) - image: BlockDataInterface; +- make the "Dependents" tab in the DAM work +- display the dependencies or dependents of an entity somewhere in your admin app - @RootBlock(NewsContentBlock) - @Property({ customType: new RootBlockType(NewsContentBlock) }) - @Field(() => RootBlockDataScalar(NewsContentBlock)) - content: BlockDataInterface; +### Configuring the block index - // ... -} +#### 1. API: Register fields to be added to the block index + +First, you must "tell" the block index which database fields contain block data. +It will scan these fields for dependency information. + +To do that, you must + +- Annotate the entity with `@RootBlockEntity()` +- Annotate all columns containing block data with `@RootBlock(ExampleBlock)` + +For example: + +```diff ++ @RootBlockEntity() + export class News extends BaseEntity { + // ... + ++ @RootBlock(DamImageBlock) + @Property({ customType: new RootBlockType(DamImageBlock) }) + @Field(() => RootBlockDataScalar(DamImageBlock)) + image: BlockDataInterface; + ++ @RootBlock(NewsContentBlock) + @Property({ customType: new RootBlockType(NewsContentBlock) }) + @Field(() => RootBlockDataScalar(NewsContentBlock)) + content: BlockDataInterface; + + // ... + } ``` -## Correctly display a dependency target +#### 2. Create the block index -### 1. Add `@EntityInfo()` to entity (API) +You must then create the block index by calling `npm run console createBlockIndexViews` in your `/api` directory. +This creates a materialized view called `block_index_dependencies` in your database. -You can provide the entity info in two ways: +You must recreate the block index views after -#### `GetEntityInfo` Method +- executing database migrations +- executing the fixtures (because they drop the whole database and recreate it) + +You can automate this process by following the steps in the [migration guide](../migration/migration-from-v5-to-v6/#block-index). +For new projects, it should already be automated. + +### Displaying dependencies in the admin interface + +Next, you probably want to display the dependencies or dependents (usages) of an entity in the admin interface. + +#### 1. API: Add `@EntityInfo()` to entity + +The `@EntityInfo()` decorator allows you to configure which information about an entity should be displayed in the admin interface. +You can provide a `name` and `secondaryInformation`. + +The decorator accepts two inputs: + +##### `GetEntityInfo` method The simple way is to provide a function returning a `name` and (optional) `secondaryInformation` based on the entity instance. @@ -48,9 +89,10 @@ The simple way is to provide a function returning a `name` and (optional) `secon @EntityInfo((news) => ({ name: news.title, secondaryInformation: news.slug })) ``` -#### `EntityInfoService` +##### `EntityInfoService` -If you need to load additional information from a service or repository to provide the entity info, you can implement an `EntityInfoService`. In this service, you can use Nest's dependency injection. +If you need to load additional information from a service or repository, you can implement an `EntityInfoService`. +In this service, you can use Nest's dependency injection. The service must offer a `getEntityInfo()` method returning a `name` and (optional) `secondaryInformation`. @@ -74,11 +116,29 @@ export class FilesEntityInfoService implements EntityInfoServiceInterface implements DocumentInterface { + // ... +} +``` + +#### 2. Admin: Implement the `DependencyInterface` + +The DependencyInterface requires a translatable `displayName` and a `resolvePath()` method. +`resolvePath` provides a URL path to the edit page of an entity or a specific block. + +
+ +Example of a `resolvePath` method + +```tsx // NewsDependency.tsx export const NewsDependency: DependencyInterface = { displayName: , @@ -117,7 +177,23 @@ export const NewsDependency: DependencyInterface = { }; ``` -You may also use the `createDependencyMethods` helper to simplify resolving the path to the entity/block. Use the `basePath` option to specify where the entity is located in the Admin. +
+ +Usually, you don't have to write the `resolvePath` method yourself. +Instead, use one of our helpers: + +##### `createDependencyMethods` + +For most entities, you can use the `createDependencyMethods` helper. + +The `rootQueryName` specifies the name of the GraphQL query used to load the entity. +It should normally be the camelCase version of the entity name. + +The `rootBlocks` specify which of the entity's fields contain block data. +These should be the same fields you annotated with `@RootBlock()` in the API. +You must also specify the used Block and - if necessary - the path under which the block is available. + +The `basePath` option specifies the URL path to the entity's edit page. ```tsx // NewsDependency.tsx @@ -135,7 +211,10 @@ export const NewsDependency: DependencyInterface = { }; ``` -For document types you may use the `createDocumentDependencyMethods` helper that also loads the page tree node the document is attached to: +##### `createDocumentDependencyMethods` + +For document types you can use the `createDocumentDependencyMethods` helper. +It loads the document and also the `PageTreeNode` the document is attached to. ```tsx // Page.tsx @@ -158,11 +237,11 @@ export const Page: DocumentInterface, GQLPageIn }; ``` -### 3. Register the DependencyInterface at the DependenciesConfigProvider +#### 3. Admin: Register the `DependencyInterface` at the `DependenciesConfigProvider` The key must be the name of the GraphQL object type associated with the entity. -```ts +```tsx // App.tsx // ... // ... ``` + +Now, the DAM's "Dependents" tab should work. +If that was your goal, you can stop here. +Otherwise, continue following the guide. + +#### 4. API: Add field resolvers + +If you want to query the dependencies or dependents of an entity, use the factories provided by the library. +**Only do this where it makes sense.** + +```ts +// news.module.ts +@Module({ + // ... + providers: [ + // ... + DependenciesResolverFactory.create(News), + DependentsResolverFactory.create(News), + ], +}) +export class NewsModule {} +``` + +#### 5. Admin: Display dependencies with the `DependencyList` component + +You can use the `DependencyList` component provided by `@comet/cms-admin` to display dependencies or dependents. +The DAM uses this component in its "Dependents" tab. + +The component requires two props: + +- `query`: A GraphQL query. It must have a `dependencies` or `dependents` field resolver. +- `variables`: The variables for the query. + +
+ +A usage could look like this + +```tsx + +``` + +
diff --git a/docs/docs/migration/migration-from-v5-to-v6.md b/docs/docs/migration/migration-from-v5-to-v6.md index ba5787932f..b5d591710d 100644 --- a/docs/docs/migration/migration-from-v5-to-v6.md +++ b/docs/docs/migration/migration-from-v5-to-v6.md @@ -160,6 +160,43 @@ It automatically installs the new versions of all `@comet` libraries, runs an ES }), ``` +### Block Index + +Automate the creation of the block index during local development: + +1. Call `DependenciesService#createViews` in your `FixturesConsole`: + +```diff + // ... + await this.publicUploadsFixtureService.generatePublicUploads(); + ++ await this.dependenciesService.createViews(); + + await this.orm.em.flush(); + // ... +``` + +2. Call `createBlockIndexViews` before starting the API (after the migrations): + +Remove `db:migrate` from `dev-pm.config.js`: + +```diff +{ + name: "api", +- script: "npm --prefix api run db:migrate && npm --prefix api run start:dev", ++ script: "npm --prefix api run start:dev", + group: "api", + waitOn: ["tcp:$POSTGRESQL_PORT", "tcp:$IMGPROXY_PORT"], +}, +``` + +Add `db:migrate` and `createBlockIndexViews` to `start:dev` script in package.json: + +```diff +- "start:dev": "npm run prebuild && dotenv -c secrets -- nest start --watch --preserveWatchOutput", ++ "start:dev": "npm run prebuild && npm run db:migrate && npm run console createBlockIndexViews && dotenv -c secrets -- nest start --watch --preserveWatchOutput", +``` + ## Admin ### User Permissions diff --git a/packages/admin/admin-babel-preset/CHANGELOG.md b/packages/admin/admin-babel-preset/CHANGELOG.md index 1a5b09de9d..46d16f4d0a 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 +## 6.11.0 + ## 6.10.0 ## 6.9.0 diff --git a/packages/admin/admin-babel-preset/package.json b/packages/admin/admin-babel-preset/package.json index 50a727e48a..b93bee3097 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": "6.10.0", + "version": "6.11.0", "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 d666666bdf..775111de55 100644 --- a/packages/admin/admin-color-picker/CHANGELOG.md +++ b/packages/admin/admin-color-picker/CHANGELOG.md @@ -1,5 +1,13 @@ # @comet/admin-color-picker +## 6.11.0 + +### Patch Changes + +- Updated dependencies [8e3dec523] + - @comet/admin@6.11.0 + - @comet/admin-icons@6.11.0 + ## 6.10.0 ### Patch Changes diff --git a/packages/admin/admin-color-picker/package.json b/packages/admin/admin-color-picker/package.json index 1a8b4a9449..a58587d58c 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": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -25,8 +25,8 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^6.10.0", - "@comet/admin-icons": "workspace:^6.10.0", + "@comet/admin": "workspace:^6.11.0", + "@comet/admin-icons": "workspace:^6.11.0", "clsx": "^1.1.1", "react-colorful": "^5.5.1", "tinycolor2": "^1.4.1", @@ -35,8 +35,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@mui/icons-material": "^5.0.0", "@mui/material": "^5.0.0", "@types/react": "^17.0.0", diff --git a/packages/admin/admin-date-time/CHANGELOG.md b/packages/admin/admin-date-time/CHANGELOG.md index 0632d1a257..69f94fc2d1 100644 --- a/packages/admin/admin-date-time/CHANGELOG.md +++ b/packages/admin/admin-date-time/CHANGELOG.md @@ -1,5 +1,13 @@ # @comet/admin-date-time +## 6.11.0 + +### Patch Changes + +- Updated dependencies [8e3dec523] + - @comet/admin@6.11.0 + - @comet/admin-icons@6.11.0 + ## 6.10.0 ### Patch Changes diff --git a/packages/admin/admin-date-time/package.json b/packages/admin/admin-date-time/package.json index e563daf886..2785f8e824 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": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -25,8 +25,8 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^6.10.0", - "@comet/admin-icons": "workspace:^6.10.0", + "@comet/admin": "workspace:^6.11.0", + "@comet/admin-icons": "workspace:^6.11.0", "@mui/utils": "^5.4.1", "clsx": "^1.1.1", "date-fns": "^2.28.0", @@ -35,8 +35,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@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 b43a03529e..d10f42176d 100644 --- a/packages/admin/admin-icons/CHANGELOG.md +++ b/packages/admin/admin-icons/CHANGELOG.md @@ -1,5 +1,7 @@ # @comet/admin-icons +## 6.11.0 + ## 6.10.0 ## 6.9.0 diff --git a/packages/admin/admin-icons/package.json b/packages/admin/admin-icons/package.json index 5e57c24a69..26dba3c8a5 100644 --- a/packages/admin/admin-icons/package.json +++ b/packages/admin/admin-icons/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-icons", - "version": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -24,8 +24,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@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 adfe0c32a4..c3881d05e6 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 +## 6.11.0 + +### Patch Changes + +- Updated dependencies [8e3dec523] + - @comet/admin@6.11.0 + ## 6.10.0 ### Patch Changes diff --git a/packages/admin/admin-react-select/package.json b/packages/admin/admin-react-select/package.json index c9ec5705b6..8ec15337ae 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": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -25,14 +25,14 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin": "workspace:^6.10.0", + "@comet/admin": "workspace:^6.11.0", "classnames": "^2.2.6" }, "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@mui/icons-material": "^5.0.0", "@mui/material": "^5.0.0", "@types/react": "^17.0.0", diff --git a/packages/admin/admin-rte/CHANGELOG.md b/packages/admin/admin-rte/CHANGELOG.md index 436ad24345..6a4c9d5211 100644 --- a/packages/admin/admin-rte/CHANGELOG.md +++ b/packages/admin/admin-rte/CHANGELOG.md @@ -1,5 +1,13 @@ # @comet/admin-rte +## 6.11.0 + +### Patch Changes + +- Updated dependencies [8e3dec523] + - @comet/admin@6.11.0 + - @comet/admin-icons@6.11.0 + ## 6.10.0 ### Patch Changes diff --git a/packages/admin/admin-rte/package.json b/packages/admin/admin-rte/package.json index 070c0467a7..889e926583 100644 --- a/packages/admin/admin-rte/package.json +++ b/packages/admin/admin-rte/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-rte", - "version": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -27,8 +27,8 @@ "test:watch": "jest --watch" }, "dependencies": { - "@comet/admin": "workspace:^6.10.0", - "@comet/admin-icons": "workspace:^6.10.0", + "@comet/admin": "workspace:^6.11.0", + "@comet/admin-icons": "workspace:^6.11.0", "detect-browser": "^5.2.1", "draft-js-export-html": "^1.4.1", "draft-js-import-html": "^1.4.1", @@ -38,8 +38,8 @@ "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@mui/icons-material": "^5.0.0", "@mui/material": "^5.0.0", "@testing-library/jest-dom": "^5.16.5", diff --git a/packages/admin/admin-theme/CHANGELOG.md b/packages/admin/admin-theme/CHANGELOG.md index f24e9e2483..25184b3463 100644 --- a/packages/admin/admin-theme/CHANGELOG.md +++ b/packages/admin/admin-theme/CHANGELOG.md @@ -1,5 +1,11 @@ # @comet/admin-theme +## 6.11.0 + +### Patch Changes + +- @comet/admin-icons@6.11.0 + ## 6.10.0 ### Patch Changes diff --git a/packages/admin/admin-theme/package.json b/packages/admin/admin-theme/package.json index 37acd26cc4..ce0d690075 100644 --- a/packages/admin/admin-theme/package.json +++ b/packages/admin/admin-theme/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin-theme", - "version": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -25,14 +25,14 @@ "start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput" }, "dependencies": { - "@comet/admin-icons": "workspace:^6.10.0", + "@comet/admin-icons": "workspace:^6.11.0", "@mui/utils": "^5.4.1" }, "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", - "@comet/admin-babel-preset": "workspace:^6.10.0", - "@comet/eslint-config": "workspace:^6.10.0", + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", "@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 3f9a016388..e2f32a7021 100644 --- a/packages/admin/admin/CHANGELOG.md +++ b/packages/admin/admin/CHANGELOG.md @@ -1,5 +1,18 @@ # @comet/admin +## 6.11.0 + +### Minor Changes + +- 8e3dec523: Change `writeClipboardText`/`readClipboardText` clipboard fallback to in-memory + + Using the local storage as a fallback caused issues when writing clipboard contents larger than 5MB. + Changing the fallback to in-memory resolves the issue. + +### Patch Changes + +- @comet/admin-icons@6.11.0 + ## 6.10.0 ### Minor Changes diff --git a/packages/admin/admin/package.json b/packages/admin/admin/package.json index ab9699cdf4..900cc31a54 100644 --- a/packages/admin/admin/package.json +++ b/packages/admin/admin/package.json @@ -1,6 +1,6 @@ { "name": "@comet/admin", - "version": "6.10.0", + "version": "6.11.0", "repository": { "type": "git", "url": "https://github.com/vivid-planet/comet", @@ -27,8 +27,12 @@ "test:watch": "jest --watch" }, "dependencies": { +<<<<<<< HEAD "@comet/admin-icons": "workspace:^6.10.0", "@mui/lab": "^5.0.0-alpha.76", +======= + "@comet/admin-icons": "workspace:^6.11.0", +>>>>>>> main "@mui/private-theming": "^5.0.0", "clsx": "^1.1.1", "exceljs": "^3.4.0", @@ -47,9 +51,14 @@ "@apollo/client": "^3.7.0", "@babel/cli": "^7.17.6", "@babel/core": "^7.20.12", +<<<<<<< HEAD "@comet/admin-babel-preset": "workspace:^6.10.0", "@comet/admin-theme": "workspace:^6.10.0", "@comet/eslint-config": "workspace:^6.10.0", +======= + "@comet/admin-babel-preset": "workspace:^6.11.0", + "@comet/eslint-config": "workspace:^6.11.0", +>>>>>>> main "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", "@mui/icons-material": "^5.0.0", diff --git a/packages/admin/admin/src/form/FinalFormAsyncAutocomplete.tsx b/packages/admin/admin/src/form/FinalFormAsyncAutocomplete.tsx new file mode 100644 index 0000000000..988092084b --- /dev/null +++ b/packages/admin/admin/src/form/FinalFormAsyncAutocomplete.tsx @@ -0,0 +1,22 @@ +import React from "react"; + +import { useAsyncOptionsProps } from "../hooks/useAsyncOptionsProps"; +import FinalFormAutocomplete, { FinalFormAutocompleteProps } from "./Autocomplete"; + +export interface FinalFormAsyncAutocompleteProps< + T extends Record, + Multiple extends boolean | undefined, + DisableClearable extends boolean | undefined, + FreeSolo extends boolean | undefined, +> extends FinalFormAutocompleteProps { + loadOptions: () => Promise; +} + +export function FinalFormAsyncAutocomplete< + T extends Record, + Multiple extends boolean | undefined, + DisableClearable extends boolean | undefined, + FreeSolo extends boolean | undefined, +>({ loadOptions, ...rest }: FinalFormAsyncAutocompleteProps) { + return {...useAsyncOptionsProps(loadOptions)} {...rest} />; +} diff --git a/packages/admin/admin/src/form/FinalFormAsyncSelect.tsx b/packages/admin/admin/src/form/FinalFormAsyncSelect.tsx new file mode 100644 index 0000000000..a6911cec46 --- /dev/null +++ b/packages/admin/admin/src/form/FinalFormAsyncSelect.tsx @@ -0,0 +1,13 @@ +import { SelectProps } from "@mui/material"; +import React from "react"; + +import { useAsyncOptionsProps } from "../hooks/useAsyncOptionsProps"; +import { FinalFormSelect, FinalFormSelectProps } from "./FinalFormSelect"; + +export interface FinalFormAsyncSelectProps extends FinalFormSelectProps, Omit { + loadOptions: () => Promise; +} + +export function FinalFormAsyncSelect({ loadOptions, ...rest }: FinalFormAsyncSelectProps) { + return {...useAsyncOptionsProps(loadOptions)} {...rest} />; +} diff --git a/packages/admin/admin/src/form/FinalFormSearchTextField.tsx b/packages/admin/admin/src/form/FinalFormSearchTextField.tsx index 7e220a917f..907f5167b3 100644 --- a/packages/admin/admin/src/form/FinalFormSearchTextField.tsx +++ b/packages/admin/admin/src/form/FinalFormSearchTextField.tsx @@ -45,6 +45,7 @@ export function FinalFormSearchTextField(inProps: FinalFormSearchTextFieldProps) endAdornment ) } + disableContentTranslation={true} /> ); } diff --git a/packages/admin/admin/src/form/fields/AsyncSelectField.tsx b/packages/admin/admin/src/form/fields/AsyncSelectField.tsx new file mode 100644 index 0000000000..7fc7167f43 --- /dev/null +++ b/packages/admin/admin/src/form/fields/AsyncSelectField.tsx @@ -0,0 +1,15 @@ +import React from "react"; + +import { Field, FieldProps } from "../Field"; +import { FinalFormAsyncSelect } from "../FinalFormAsyncSelect"; + +export interface AsyncSelectFieldProps