File tree Expand file tree Collapse file tree 5 files changed +38
-12
lines changed Expand file tree Collapse file tree 5 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ export class SearchCombobox<T> extends TailwindElement {
5858 @property ( { type : String } )
5959 name ?: string ;
6060
61+ @property ( { type : Number } )
62+ maxlength ?: number ;
63+
6164 @property ( { type : Boolean } )
6265 required ?: boolean ;
6366
@@ -149,6 +152,7 @@ export class SearchCombobox<T> extends TailwindElement {
149152 placeholder =${ this . placeholder }
150153 label =${ ifDefined ( this . label ) }
151154 size=${ ifDefined ( this . size ) }
155+ maxlength=${ ifDefined ( this . maxlength ) }
152156 ?disabled=${ this . disabled }
153157 clearable
154158 value=${ this . searchByValue }
Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ import { BtrixElement } from "@/classes/BtrixElement";
1717import type { Dialog } from "@/components/ui/dialog" ;
1818import type { SelectCollectionAccess } from "@/features/collections/select-collection-access" ;
1919import { alerts } from "@/strings/collections/alerts" ;
20- import { CollectionAccess , type Collection } from "@/types/collection" ;
20+ import {
21+ COLLECTION_CAPTION_MAX_LENGTH ,
22+ COLLECTION_NAME_MAX_LENGTH ,
23+ CollectionAccess ,
24+ type Collection ,
25+ } from "@/types/collection" ;
2126import { isApiError } from "@/utils/api" ;
2227import { maxLengthValidator } from "@/utils/form" ;
2328
@@ -49,8 +54,12 @@ export class CollectionCreateDialog extends BtrixElement {
4954 @queryAsync ( "#collectionForm" )
5055 private readonly form ! : Promise < HTMLFormElement > ;
5156
52- private readonly validateNameMax = maxLengthValidator ( 50 ) ;
53- private readonly validateCaptionMax = maxLengthValidator ( 150 ) ;
57+ private readonly validateNameMax = maxLengthValidator (
58+ COLLECTION_NAME_MAX_LENGTH ,
59+ ) ;
60+ private readonly validateCaptionMax = maxLengthValidator (
61+ COLLECTION_CAPTION_MAX_LENGTH ,
62+ ) ;
5463
5564 protected firstUpdated ( ) : void {
5665 if ( this . open ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ import type { BtrixChangeEvent } from "@/events/btrix-change";
1616import { FormControl } from "@/mixins/FormControl" ;
1717import { validationMessageFor } from "@/strings/validation" ;
1818import type { APIPaginatedList } from "@/types/api" ;
19- import type { Collection } from "@/types/collection" ;
19+ import {
20+ COLLECTION_NAME_MAX_LENGTH ,
21+ type Collection ,
22+ } from "@/types/collection" ;
2023import appState from "@/utils/state" ;
2124
2225export type CollectionNameInputChangeEvent = BtrixChangeEvent < {
@@ -42,8 +45,9 @@ export class CollectionNameInput extends WithSearchOrgContext(
4245 collectionId = "" ;
4346
4447 placeholder = msg ( "Enter existing or new collection name" ) ;
45- searchKeys = searchQueryKeys ;
4648 createNew = true ;
49+ readonly searchKeys = searchQueryKeys ;
50+ readonly maxlength = COLLECTION_NAME_MAX_LENGTH ;
4751
4852 #collection?: Collection ;
4953
Original file line number Diff line number Diff line change @@ -2427,13 +2427,19 @@ https://archiveweb.page/images/${"logo.svg"}`}
24272427 ${ when (
24282428 this . formState . dedupeCollectionName &&
24292429 ! this . formState . dedupeCollectionId ,
2430- ( ) => html `
2431- <div class="form-help-text">
2432- ${ msg (
2433- "A new collection will be created when this workflow is saved." ,
2434- ) }
2435- </div>
2436- ` ,
2430+ ( ) => {
2431+ const workflow_name = html `<strong class="font-medium"
2432+ >${ this . formState . dedupeCollectionName } </strong
2433+ >` ;
2434+ return html `
2435+ <div class="form-help-text">
2436+ ${ msg (
2437+ html `A new collection named “${ workflow_name } ” will be created
2438+ when this workflow is saved.` ,
2439+ ) }
2440+ </div>
2441+ ` ;
2442+ } ,
24372443 ) }
24382444 ` ) }
24392445 ${ this . renderHelpTextCol (
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { z } from "zod";
22
33import { storageFileSchema } from "./storage" ;
44
5+ export const COLLECTION_NAME_MAX_LENGTH = 50 ;
6+ export const COLLECTION_CAPTION_MAX_LENGTH = 150 ;
7+
58export enum CollectionAccess {
69 Private = "private" ,
710 Public = "public" ,
You can’t perform that action at this time.
0 commit comments