@umbraco-cms/backoffice 1.0.0-next.93a8a0e4 → 1.0.0-next.93ffdc6a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/modal.d.ts CHANGED
@@ -4,12 +4,117 @@ import * as lit from 'lit';
4
4
  import { LitElement, TemplateResult } from 'lit';
5
5
  import * as lit_html from 'lit-html';
6
6
  import { UUIModalDialogElement, UUIModalSidebarElement, UUIModalSidebarSize } from '@umbraco-ui/uui';
7
- import { UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller';
7
+ import { UmbController, UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller-api';
8
8
  import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
9
- import { Params } from '@umbraco-cms/backoffice/router';
10
- import { UmbModalToken as UmbModalToken$1, UmbModalConfig as UmbModalConfig$1, UmbPickerModalData as UmbPickerModalData$1 } from '@umbraco-cms/backoffice/modal';
11
- import { LanguageResponseModel, UserResponseModel, FolderReponseModel } from '@umbraco-cms/backoffice/backend-api';
12
- import { UserDetails } from '@umbraco-cms/backoffice/models';
9
+ import { Params as Params$1 } from '@umbraco-cms/backoffice/router';
10
+ import { UmbModalToken as UmbModalToken$1, UmbModalConfig as UmbModalConfig$1, UmbTreePickerModalData as UmbTreePickerModalData$1, UmbPickerModalResult as UmbPickerModalResult$1, UmbPickerModalData as UmbPickerModalData$1 } from '@umbraco-cms/backoffice/modal';
11
+ import { DocumentTreeItemResponseModel, EntityTreeItemResponseModel, LanguageResponseModel, ContentTreeItemResponseModel, PropertyTypeResponseModelBaseModel, UserResponseModel, FolderReponseModel, FolderTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api';
12
+
13
+ interface IRouterSlot<D = any, P = any> extends HTMLElement {
14
+ readonly route: IRoute<D> | null;
15
+ readonly isRoot: boolean;
16
+ readonly fragments: IPathFragments | null;
17
+ readonly params: Params | null;
18
+ readonly match: IRouteMatch<D> | null;
19
+ routes: IRoute<D>[];
20
+ add: ((routes: IRoute<D>[], navigate?: boolean) => void);
21
+ clear: (() => void);
22
+ render: (() => Promise<void>);
23
+ constructAbsolutePath: ((path: PathFragment) => string);
24
+ parent: IRouterSlot<P> | null | undefined;
25
+ queryParentRouterSlot: (() => IRouterSlot<P> | null);
26
+ }
27
+ type IRoutingInfo<D = any, P = any> = {
28
+ slot: IRouterSlot<D, P>;
29
+ match: IRouteMatch<D>;
30
+ };
31
+ type CustomResolver<D = any, P = any> = ((info: IRoutingInfo<D>) => boolean | void | Promise<boolean> | Promise<void>);
32
+ type Guard<D = any, P = any> = ((info: IRoutingInfo<D, P>) => boolean | Promise<boolean>);
33
+ type PageComponent = HTMLElement | undefined;
34
+ type ModuleResolver = Promise<{
35
+ default: any;
36
+ }>;
37
+ type Class<T extends PageComponent = PageComponent> = {
38
+ new (...args: any[]): T;
39
+ };
40
+ type Component = Class | ModuleResolver | PageComponent | (() => Class) | (() => PromiseLike<Class>) | (() => PageComponent) | (() => PromiseLike<PageComponent>) | (() => ModuleResolver) | (() => PromiseLike<ModuleResolver>);
41
+ type Setup<D = any> = ((component: PageComponent, info: IRoutingInfo<D>) => void);
42
+ type PathMatch = "prefix" | "suffix" | "full" | "fuzzy";
43
+ /**
44
+ * The base route interface.
45
+ * D = the data type of the data
46
+ */
47
+ interface IRouteBase<D = any> {
48
+ path: PathFragment;
49
+ data?: D;
50
+ guards?: Guard[];
51
+ pathMatch?: PathMatch;
52
+ }
53
+ /**
54
+ * Route type used for redirection.
55
+ */
56
+ interface IRedirectRoute<D = any> extends IRouteBase<D> {
57
+ redirectTo: string;
58
+ preserveQuery?: boolean;
59
+ }
60
+ /**
61
+ * Route type used to resolve and stamp components.
62
+ */
63
+ interface IComponentRoute<D = any> extends IRouteBase<D> {
64
+ component: Component | PromiseLike<Component>;
65
+ setup?: Setup;
66
+ }
67
+ /**
68
+ * Route type used to take control of how the route should resolve.
69
+ */
70
+ interface IResolverRoute<D = any> extends IRouteBase<D> {
71
+ resolve: CustomResolver;
72
+ }
73
+ type IRoute<D = any> = IRedirectRoute<D> | IComponentRoute<D> | IResolverRoute<D>;
74
+ type PathFragment = string;
75
+ type IPathFragments = {
76
+ consumed: PathFragment;
77
+ rest: PathFragment;
78
+ };
79
+ interface IRouteMatch<D = any> {
80
+ route: IRoute<D>;
81
+ params: Params;
82
+ fragments: IPathFragments;
83
+ match: RegExpMatchArray;
84
+ }
85
+ type PushStateEvent = CustomEvent<null>;
86
+ type ReplaceStateEvent = CustomEvent<null>;
87
+ type ChangeStateEvent = CustomEvent<null>;
88
+ type WillChangeStateEvent = CustomEvent<{
89
+ url?: string | null;
90
+ eventName: GlobalRouterEvent;
91
+ }>;
92
+ type NavigationStartEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
93
+ type NavigationSuccessEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
94
+ type NavigationCancelEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
95
+ type NavigationErrorEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
96
+ type NavigationEndEvent<D = any> = CustomEvent<IRoutingInfo<D>>;
97
+ type Params = {
98
+ [key: string]: string;
99
+ };
100
+ /**
101
+ * History related events.
102
+ */
103
+ type GlobalRouterEvent = "pushstate" | "replacestate" | "popstate" | "changestate" | "willchangestate" | "navigationstart" | "navigationcancel" | "navigationerror" | "navigationsuccess" | "navigationend";
104
+ declare global {
105
+ interface GlobalEventHandlersEventMap {
106
+ "pushstate": PushStateEvent;
107
+ "replacestate": ReplaceStateEvent;
108
+ "popstate": PopStateEvent;
109
+ "changestate": ChangeStateEvent;
110
+ "navigationstart": NavigationStartEvent;
111
+ "navigationend": NavigationEndEvent;
112
+ "navigationsuccess": NavigationSuccessEvent;
113
+ "navigationcancel": NavigationCancelEvent;
114
+ "navigationerror": NavigationErrorEvent;
115
+ "willchangestate": WillChangeStateEvent;
116
+ }
117
+ }
13
118
 
14
119
  declare class UmbSearchModalElement extends LitElement {
15
120
  #private;
@@ -27,38 +132,36 @@ declare global {
27
132
  }
28
133
  }
29
134
 
30
- declare class UmbModalToken<Data extends object = object, Result = unknown> {
135
+ declare class UmbModalToken<ModalDataType extends object = object, ModalResultType = unknown> {
31
136
  protected alias: string;
32
137
  protected defaultConfig?: UmbModalConfig | undefined;
33
- protected _desc?: string | undefined;
138
+ protected defaultData?: ModalDataType | undefined;
34
139
  /**
35
140
  * Get the data type of the token's data.
36
141
  *
37
142
  * @public
38
- * @type {Data}
143
+ * @type {ModalDataType}
39
144
  * @memberOf UmbModalToken
40
145
  * @example `typeof MyModal.TYPE`
41
146
  * @returns undefined
42
147
  */
43
- readonly DATA: Data;
148
+ readonly DATA: ModalDataType;
44
149
  /**
45
150
  * Get the result type of the token
46
151
  *
47
152
  * @public
48
- * @type {Result}
153
+ * @type {ModalResultType}
49
154
  * @memberOf UmbModalToken
50
155
  * @example `typeof MyModal.RESULT`
51
156
  * @returns undefined
52
157
  */
53
- readonly RESULT: Result;
158
+ readonly RESULT: ModalResultType;
54
159
  /**
55
160
  * @param alias Unique identifier for the token,
56
161
  * @param defaultConfig Default configuration for the modal,
57
- * @param _desc Description for the token,
58
- * used only for debugging purposes,
59
- * it should but does not need to be unique
162
+ * @param defaultData Default data for the modal,
60
163
  */
61
- constructor(alias: string, defaultConfig?: UmbModalConfig | undefined, _desc?: string | undefined);
164
+ constructor(alias: string, defaultConfig?: UmbModalConfig | undefined, defaultData?: ModalDataType | undefined);
62
165
  /**
63
166
  * This method must always return the unique alias of the token since that
64
167
  * will be used to look up the token in the injector.
@@ -67,6 +170,7 @@ declare class UmbModalToken<Data extends object = object, Result = unknown> {
67
170
  */
68
171
  toString(): string;
69
172
  getDefaultConfig(): UmbModalConfig | undefined;
173
+ getDefaultData(): ModalDataType | undefined;
70
174
  }
71
175
 
72
176
  /**
@@ -80,7 +184,7 @@ type OptionalSubmitArgumentIfUndefined<T> = T extends undefined ? {
80
184
  } : {
81
185
  submit: (arg: T) => void;
82
186
  };
83
- declare class UmbModalHandlerClass<ModalData extends object = object, ModalResult = unknown> {
187
+ declare class UmbModalHandlerClass<ModalData extends object = object, ModalResult = unknown> extends UmbController {
84
188
  #private;
85
189
  private _submitPromise;
86
190
  private _submitResolver?;
@@ -90,10 +194,14 @@ declare class UmbModalHandlerClass<ModalData extends object = object, ModalResul
90
194
  key: string;
91
195
  type: UmbModalType;
92
196
  size: UUIModalSidebarSize;
93
- constructor(host: UmbControllerHostElement, modalAlias: string | UmbModalToken<ModalData, ModalResult>, data?: ModalData, config?: UmbModalConfig);
197
+ private modalAlias;
198
+ constructor(host: UmbControllerHostElement, router: IRouterSlot | null, modalAlias: string | UmbModalToken<ModalData, ModalResult>, data?: ModalData, config?: UmbModalConfig);
199
+ hostConnected(): void;
200
+ hostDisconnected(): void;
94
201
  private submit;
95
202
  reject(): void;
96
203
  onSubmit(): Promise<ModalResult>;
204
+ destroy(): void;
97
205
  }
98
206
 
99
207
  type UmbModalType = 'dialog' | 'sidebar';
@@ -116,7 +224,7 @@ declare class UmbModalContext {
116
224
  * @return {*} {UmbModalHandler}
117
225
  * @memberof UmbModalContext
118
226
  */
119
- open<ModalData extends object = object, ModalResult = unknown>(modalAlias: string | UmbModalToken<ModalData, ModalResult>, data?: ModalData, config?: UmbModalConfig): UmbModalHandler<ModalData, ModalResult>;
227
+ open<ModalData extends object = object, ModalResult = unknown>(modalAlias: string | UmbModalToken<ModalData, ModalResult>, data?: ModalData, config?: UmbModalConfig, router?: IRouterSlot | null): UmbModalHandler<ModalData, ModalResult>;
120
228
  /**
121
229
  * Closes a modal or sidebar modal
122
230
  * @private
@@ -129,14 +237,15 @@ declare const UMB_MODAL_CONTEXT_TOKEN: UmbContextToken<UmbModalContext>;
129
237
 
130
238
  type UmbModalRouteBuilder = (params: {
131
239
  [key: string]: string | number;
132
- }) => string;
240
+ } | null) => string;
133
241
  declare class UmbModalRouteRegistration<UmbModalTokenData extends object = object, UmbModalTokenResult = any> {
134
242
  #private;
135
- constructor(modalAlias: UmbModalToken<UmbModalTokenData, UmbModalTokenResult> | string, path: string, modalConfig?: UmbModalConfig);
243
+ constructor(modalAlias: UmbModalToken<UmbModalTokenData, UmbModalTokenResult> | string, path?: string | null, modalConfig?: UmbModalConfig);
136
244
  get key(): string;
137
245
  get alias(): string | UmbModalToken<UmbModalTokenData, UmbModalTokenResult>;
138
- get path(): string;
139
- protected _setPath(path: string): void;
246
+ generateModalPath(): string;
247
+ get path(): string | null;
248
+ protected _setPath(path: string | null): void;
140
249
  get modalConfig(): UmbModalConfig | undefined;
141
250
  /**
142
251
  * Returns true if the modal is currently active.
@@ -151,18 +260,75 @@ declare class UmbModalRouteRegistration<UmbModalTokenData extends object = objec
151
260
  get modalHandler(): UmbModalHandler<UmbModalTokenData, UmbModalTokenResult> | undefined;
152
261
  observeRouteBuilder(callback: (urlBuilder: UmbModalRouteBuilder) => void): this;
153
262
  _internal_setRouteBuilder(urlBuilder: UmbModalRouteBuilder): void;
154
- onSetup(callback: (routingInfo: Params) => UmbModalTokenData | false): this;
263
+ onSetup(callback: (routingInfo: Params$1) => UmbModalTokenData | false): this;
155
264
  onSubmit(callback: (data: UmbModalTokenResult) => void): this;
156
265
  onReject(callback: () => void): this;
157
- routeSetup(modalContext: UmbModalContext, params: Params): UmbModalHandler<UmbModalTokenData, UmbModalTokenResult> | null;
266
+ routeSetup(router: IRouterSlot, modalContext: UmbModalContext, params: Params$1): UmbModalHandler<UmbModalTokenData, UmbModalTokenResult> | null | undefined;
158
267
  }
159
268
 
160
269
  declare class UmbModalRouteRegistrationController<D extends object = object, R = any> extends UmbModalRouteRegistration<D, R> implements UmbControllerInterface {
161
270
  #private;
162
271
  get unique(): undefined;
163
- constructor(host: UmbControllerHostElement, alias: UmbModalToken$1<D, R> | string, path: string, uniqueParts?: Map<string, string | undefined> | null, modalConfig?: UmbModalConfig$1);
164
- setUniqueIdentifier(identifier: string, value: string | undefined): void;
165
- private _registererModal;
272
+ /**
273
+ * Creates an instance of UmbModalRouteRegistrationController.
274
+ * @param {EventTarget} host - The host element of the modal, this is used to identify the modal.
275
+ * @param {UmbModalToken} alias - The alias of the modal, this is used to identify the modal.
276
+ * @param {UmbModalConfig} modalConfig - The configuration of the modal.
277
+ * @memberof UmbModalRouteRegistrationController
278
+ */
279
+ constructor(host: UmbControllerHostElement, alias: UmbModalToken$1<D, R> | string, modalConfig?: UmbModalConfig$1);
280
+ /**
281
+ * Appends an additional path to the modal route.
282
+ *
283
+ * This can help specify the URL for this modal, or used to add a parameter to the URL like this: "/modal/my-modal/:index/"
284
+ * A folder name starting with a colon ":" will be interpreted as a parameter. Then this modal can open with any value in that location.
285
+ * When modal is being setup the value of the parameter can be read from the route params. See the example:
286
+ * @param additionalPath
287
+ * @returns UmbModalRouteRegistrationController
288
+ * @memberof UmbContextConsumer
289
+ * @example <caption>Example of adding an additional path to the modal route</caption>
290
+ * const modalRegistration = new UmbModalRouteRegistrationController(this, MY_MODAL_TOKEN)
291
+ * modalRegistration.addAdditionalPath(':index')
292
+ *
293
+ * modalRegistration.onSetup((params) => {
294
+ * const index = params.index;
295
+ * // When entering the url of: "/modal/my-modal/hello-world/"
296
+ * // Then index will be "hello-world"
297
+ * }
298
+ */
299
+ addAdditionalPath(additionalPath: string): this;
300
+ /**
301
+ * Registerer one or more additional paths to the modal route, similar to addAdditionalPath. But without defining the actual path name. This enables this to be asynchronously defined and even changed later.
302
+ * This can be useful if your modal has to be unique for this registration, avoiding collision with other registrations.
303
+ * If you made a modal for editing one of multiple property, then you can add a unique path holding the property id.
304
+ * Making the URL unique to this modal registration: /modal/my-modal/my-unique-value/
305
+ *
306
+ * Notice the modal will only be available when all unique paths have a value.
307
+ * @param {Array<string>} uniquePathNames
308
+ * @returns UmbModalRouteRegistrationController
309
+ * @memberof UmbContextConsumer
310
+ * @example <caption>Example of adding an additional unique path to the modal route</caption>
311
+ * const modalRegistration = new UmbModalRouteRegistrationController(this, MY_MODAL_TOKEN)
312
+ * modalRegistration.addUniquePaths(['myAliasForIdentifyingThisPartOfThePath'])
313
+ *
314
+ * // Later:
315
+ * modalRegistration.setUniquePathValue('myAliasForIdentifyingThisPartOfThePath', 'myValue');
316
+ */
317
+ addUniquePaths(uniquePathNames: Array<string>): this;
318
+ /**
319
+ * Set or change the value of a unique path part.
320
+ * @param {string} identifier
321
+ * @param {value | undefined} value
322
+ * @returns UmbModalRouteRegistrationController
323
+ * @memberof UmbContextConsumer
324
+ * @example <caption>Example of adding an additional unique path to the modal route</caption>
325
+ * const modalRegistration = new UmbModalRouteRegistrationController(this, MY_MODAL_TOKEN)
326
+ * modalRegistration.addUniquePaths(['first-one', 'another-one'])
327
+ *
328
+ * // Later:
329
+ * modalRegistration.setUniquePathValue('first-one', 'myValue');
330
+ */
331
+ setUniquePathValue(identifier: string, value: string | undefined): void;
166
332
  hostConnected(): void;
167
333
  hostDisconnected(): void;
168
334
  destroy(): void;
@@ -208,23 +374,13 @@ interface UmbContextDebuggerModalData {
208
374
  }
209
375
  declare const UMB_CONTEXT_DEBUGGER_MODAL: UmbModalToken$1<UmbContextDebuggerModalData, unknown>;
210
376
 
211
- interface UmbDocumentPickerModalData {
212
- multiple?: boolean;
213
- selection?: Array<string>;
214
- }
215
- interface UmbDocumentPickerModalResult {
216
- selection: Array<string>;
217
- }
218
- declare const UMB_DOCUMENT_PICKER_MODAL: UmbModalToken$1<UmbDocumentPickerModalData, UmbDocumentPickerModalResult>;
377
+ type UmbDocumentPickerModalData = UmbTreePickerModalData$1<DocumentTreeItemResponseModel>;
378
+ type UmbDocumentPickerModalResult = UmbPickerModalResult$1;
379
+ declare const UMB_DOCUMENT_PICKER_MODAL: UmbModalToken$1<UmbDocumentPickerModalData, UmbPickerModalResult$1>;
219
380
 
220
- interface UmbDocumentTypePickerModalData {
221
- multiple?: boolean;
222
- selection?: Array<string>;
223
- }
224
- interface UmbDocumentTypePickerModalResult {
225
- selection: Array<string>;
226
- }
227
- declare const UMB_DOCUMENT_TYPE_PICKER_MODAL: UmbModalToken$1<UmbDocumentTypePickerModalData, UmbDocumentTypePickerModalResult>;
381
+ type UmbDocumentTypePickerModalData = UmbTreePickerModalData$1<EntityTreeItemResponseModel>;
382
+ type UmbDocumentTypePickerModalResult = UmbPickerModalResult$1;
383
+ declare const UMB_DOCUMENT_TYPE_PICKER_MODAL: UmbModalToken$1<UmbDocumentTypePickerModalData, UmbPickerModalResult$1>;
228
384
 
229
385
  declare enum OEmbedStatus {
230
386
  NotSupported = 0,
@@ -289,11 +445,11 @@ declare const UMB_INVITE_USER_MODAL: UmbModalToken$1<object, unknown>;
289
445
 
290
446
  interface UmbLanguagePickerModalData {
291
447
  multiple?: boolean;
292
- selection?: Array<string>;
448
+ selection?: Array<string | null>;
293
449
  filter?: (language: LanguageResponseModel) => boolean;
294
450
  }
295
451
  interface UmbLanguagePickerModalResult {
296
- selection: Array<string>;
452
+ selection: Array<string | null>;
297
453
  }
298
454
  declare const UMB_LANGUAGE_PICKER_MODAL: UmbModalToken$1<UmbLanguagePickerModalData, UmbLanguagePickerModalResult>;
299
455
 
@@ -323,14 +479,9 @@ interface UmbLinkPickerConfig {
323
479
  }
324
480
  declare const UMB_LINK_PICKER_MODAL: UmbModalToken$1<UmbLinkPickerModalData, UmbLinkPickerModalResult>;
325
481
 
326
- interface UmbMediaPickerModalData {
327
- multiple?: boolean;
328
- selection: Array<string>;
329
- }
330
- interface UmbMediaPickerModalResult {
331
- selection: Array<string>;
332
- }
333
- declare const UMB_MEDIA_PICKER_MODAL: UmbModalToken$1<UmbMediaPickerModalData, UmbMediaPickerModalResult>;
482
+ type UmbMediaTreePickerModalData = UmbTreePickerModalData$1<ContentTreeItemResponseModel>;
483
+ type UmbMediaTreePickerModalResult = UmbPickerModalResult$1;
484
+ declare const UMB_MEDIA_TREE_PICKER_MODAL: UmbModalToken$1<UmbMediaTreePickerModalData, UmbPickerModalResult$1>;
334
485
 
335
486
  interface UmbPropertyEditorUIPickerModalData {
336
487
  selection?: Array<string>;
@@ -341,28 +492,20 @@ type UmbPropertyEditorUIPickerModalResult = {
341
492
  };
342
493
  declare const UMB_PROPERTY_EDITOR_UI_PICKER_MODAL: UmbModalToken$1<UmbPropertyEditorUIPickerModalData, UmbPropertyEditorUIPickerModalResult>;
343
494
 
344
- interface UmbPropertySettingsModalResult {
345
- label: string;
346
- alias: string;
347
- description: string;
348
- propertyEditorUI?: string;
349
- labelOnTop: boolean;
350
- validation: {
351
- mandatory: boolean;
352
- mandatoryMessage: string;
353
- pattern: string;
354
- patternMessage: string;
355
- };
356
- }
357
- declare const UMB_PROPERTY_SETTINGS_MODAL: UmbModalToken$1<object, UmbPropertySettingsModalResult>;
495
+ type UmbPropertySettingsModalData = PropertyTypeResponseModelBaseModel;
496
+ type UmbPropertySettingsModalResult = PropertyTypeResponseModelBaseModel;
497
+ declare const UMB_PROPERTY_SETTINGS_MODAL: UmbModalToken$1<PropertyTypeResponseModelBaseModel, PropertyTypeResponseModelBaseModel>;
358
498
 
359
499
  declare const UMB_SEARCH_MODAL: UmbModalToken$1<object, unknown>;
360
500
 
361
501
  interface UmbSectionPickerModalData {
362
502
  multiple: boolean;
363
- selection: string[];
503
+ selection: Array<string | null>;
504
+ }
505
+ interface UmbSectionPickerModalResult {
506
+ selection: Array<string | null>;
364
507
  }
365
- declare const UMB_SECTION_PICKER_MODAL: UmbModalToken$1<UmbSectionPickerModalData, unknown>;
508
+ declare const UMB_SECTION_PICKER_MODAL: UmbModalToken$1<UmbSectionPickerModalData, UmbSectionPickerModalResult>;
366
509
 
367
510
  interface UmbTemplateModalData {
368
511
  id: string;
@@ -373,20 +516,15 @@ interface UmbTemplateModalResult {
373
516
  }
374
517
  declare const UMB_TEMPLATE_MODAL: UmbModalToken$1<UmbTemplateModalData, UmbTemplateModalResult>;
375
518
 
376
- interface UmbTemplatePickerModalData {
377
- multiple: boolean;
378
- selection: string[];
379
- }
380
- interface UmbTemplatePickerModalResult {
381
- selection: string[] | undefined;
382
- }
383
- declare const UMB_TEMPLATE_PICKER_MODAL: UmbModalToken$1<UmbTemplatePickerModalData, UmbTemplatePickerModalResult>;
519
+ type UmbTemplatePickerModalData = UmbTreePickerModalData$1<EntityTreeItemResponseModel>;
520
+ type UmbTemplatePickerModalResult = UmbPickerModalResult$1;
521
+ declare const UMB_TEMPLATE_PICKER_MODAL: UmbModalToken$1<UmbTemplatePickerModalData, UmbPickerModalResult$1>;
384
522
 
385
- declare const UMB_USER_GROUP_PICKER_MODAL: UmbModalToken$1<UmbPickerModalData$1<UserDetails>, unknown>;
523
+ declare const UMB_USER_GROUP_PICKER_MODAL: UmbModalToken$1<UmbPickerModalData$1<any>, unknown>;
386
524
 
387
525
  type UmbUserPickerModalData = UmbPickerModalData$1<UserResponseModel>;
388
526
  interface UmbUserPickerModalResult {
389
- selection: Array<string>;
527
+ selection: Array<string | null>;
390
528
  }
391
529
  declare const UMB_USER_PICKER_MODAL: UmbModalToken$1<UmbUserPickerModalData, UmbUserPickerModalResult>;
392
530
 
@@ -399,22 +537,50 @@ interface UmbFolderModalResult {
399
537
  }
400
538
  declare const UMB_FOLDER_MODAL: UmbModalToken$1<UmbFolderModalData, UmbFolderModalResult>;
401
539
 
402
- interface UmbDataTypePickerModalData {
403
- selection?: Array<string>;
404
- multiple?: boolean;
540
+ interface UmbPartialViewPickerModalData {
541
+ multiple: boolean;
542
+ selection: string[];
405
543
  }
406
- interface UmbDataTypePickerModalResult {
407
- selection: Array<string>;
544
+ interface UmbPartialViewPickerModalResult {
545
+ selection: Array<string | null> | undefined;
408
546
  }
409
- declare const UMB_DATA_TYPE_PICKER_MODAL: UmbModalToken$1<UmbDataTypePickerModalData, UmbDataTypePickerModalResult>;
547
+ declare const UMB_PARTIAL_VIEW_PICKER_MODAL_ALIAS = "Umb.Modal.PartialViewPicker";
548
+ declare const UMB_PARTIAL_VIEW_PICKER_MODAL: UmbModalToken$1<UmbPartialViewPickerModalData, UmbPartialViewPickerModalResult>;
410
549
 
411
- interface UmbPickerModalData<T> {
550
+ interface UmbDictionaryItemPickerModalData {
412
551
  multiple: boolean;
552
+ selection: string[];
553
+ }
554
+ interface UmbDictionaryItemPickerModalResult {
555
+ selection: Array<string | null>;
556
+ }
557
+ declare const UMB_DICTIONARY_ITEM_PICKER_MODAL_ALIAS = "Umb.Modal.DictionaryItemPicker";
558
+ declare const UMB_DICTIONARY_ITEM_PICKER_MODAL: UmbModalToken$1<UmbDictionaryItemPickerModalData, UmbDictionaryItemPickerModalResult>;
559
+
560
+ type UmbDataTypePickerModalData = UmbTreePickerModalData$1<FolderTreeItemResponseModel>;
561
+ type UmbDataTypePickerModalResult = UmbPickerModalResult$1;
562
+ declare const UMB_DATA_TYPE_PICKER_MODAL: UmbModalToken$1<UmbDataTypePickerModalData, UmbPickerModalResult$1>;
563
+
564
+ interface UmbDataTypePickerFlowModalData {
565
+ selection?: Array<string>;
566
+ submitLabel?: string;
567
+ }
568
+ type UmbDataTypePickerFlowModalResult = {
413
569
  selection: Array<string>;
414
- filter?: (item: T) => boolean;
570
+ };
571
+ declare const UMB_DATA_TYPE_PICKER_FLOW_MODAL: UmbModalToken$1<UmbDataTypePickerFlowModalData, UmbDataTypePickerFlowModalResult>;
572
+
573
+ interface UmbPickerModalData<ItemType> {
574
+ multiple?: boolean;
575
+ selection?: Array<string | null>;
576
+ filter?: (item: ItemType) => boolean;
577
+ pickableFilter?: (item: ItemType) => boolean;
415
578
  }
416
579
  interface UmbPickerModalResult {
417
- selection: Array<string>;
580
+ selection: Array<string | null>;
581
+ }
582
+ interface UmbTreePickerModalData<TreeItemType> extends UmbPickerModalData<TreeItemType> {
583
+ treeAlias?: string;
418
584
  }
419
585
 
420
- export { OEmbedResult, OEmbedStatus, UMB_ALLOWED_DOCUMENT_TYPES_MODAL, UMB_CHANGE_PASSWORD_MODAL, UMB_CONFIRM_MODAL, UMB_CONTEXT_DEBUGGER_MODAL, UMB_CREATE_DICTIONARY_MODAL, UMB_CREATE_USER_MODAL, UMB_CURRENT_USER_MODAL, UMB_DATA_TYPE_PICKER_MODAL, UMB_DOCUMENT_PICKER_MODAL, UMB_DOCUMENT_TYPE_PICKER_MODAL, UMB_EMBEDDED_MEDIA_MODAL, UMB_EXAMINE_FIELDS_SETTINGS_MODAL, UMB_EXPORT_DICTIONARY_MODAL, UMB_FOLDER_MODAL, UMB_ICON_PICKER_MODAL, UMB_IMPORT_DICTIONARY_MODAL, UMB_INVITE_USER_MODAL, UMB_LANGUAGE_PICKER_MODAL, UMB_LINK_PICKER_MODAL, UMB_MEDIA_PICKER_MODAL, UMB_MODAL_CONTEXT_TOKEN, UMB_PROPERTY_EDITOR_UI_PICKER_MODAL, UMB_PROPERTY_SETTINGS_MODAL, UMB_SEARCH_MODAL, UMB_SECTION_PICKER_MODAL, UMB_TEMPLATE_MODAL, UMB_TEMPLATE_PICKER_MODAL, UMB_USER_GROUP_PICKER_MODAL, UMB_USER_PICKER_MODAL, UmbAllowedDocumentTypesModalData, UmbAllowedDocumentTypesModalResult, UmbChangePasswordModalData, UmbConfirmModalData, UmbConfirmModalResult, UmbContextDebuggerModalData, UmbCreateDictionaryModalData, UmbCreateDictionaryModalResult, UmbCreateDocumentModalResultData, UmbDataTypePickerModalData, UmbDataTypePickerModalResult, UmbDocumentPickerModalData, UmbDocumentPickerModalResult, UmbDocumentTypePickerModalData, UmbDocumentTypePickerModalResult, UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalResult, UmbExamineFieldsSettingsModalData, UmbExportDictionaryModalData, UmbExportDictionaryModalResult, UmbFolderModalData, UmbFolderModalResult, UmbIconPickerModalData, UmbIconPickerModalResult, UmbImportDictionaryModalData, UmbImportDictionaryModalResult, UmbLanguagePickerModalData, UmbLanguagePickerModalResult, UmbLinkPickerConfig, UmbLinkPickerLink, UmbLinkPickerModalData, UmbLinkPickerModalResult, UmbMediaPickerModalData, UmbMediaPickerModalResult, UmbModalConfig, UmbModalContext, UmbModalHandler, UmbModalHandlerClass, UmbModalRouteBuilder, UmbModalRouteRegistration, UmbModalRouteRegistrationController, UmbModalToken, UmbModalType, UmbPickerModalData, UmbPickerModalResult, UmbPropertyEditorUIPickerModalData, UmbPropertyEditorUIPickerModalResult, UmbPropertySettingsModalResult, UmbSectionPickerModalData, UmbTemplateModalData, UmbTemplateModalResult, UmbTemplatePickerModalData, UmbTemplatePickerModalResult, UmbUserPickerModalData, UmbUserPickerModalResult };
586
+ export { OEmbedResult, OEmbedStatus, UMB_ALLOWED_DOCUMENT_TYPES_MODAL, UMB_CHANGE_PASSWORD_MODAL, UMB_CONFIRM_MODAL, UMB_CONTEXT_DEBUGGER_MODAL, UMB_CREATE_DICTIONARY_MODAL, UMB_CREATE_USER_MODAL, UMB_CURRENT_USER_MODAL, UMB_DATA_TYPE_PICKER_FLOW_MODAL, UMB_DATA_TYPE_PICKER_MODAL, UMB_DICTIONARY_ITEM_PICKER_MODAL, UMB_DICTIONARY_ITEM_PICKER_MODAL_ALIAS, UMB_DOCUMENT_PICKER_MODAL, UMB_DOCUMENT_TYPE_PICKER_MODAL, UMB_EMBEDDED_MEDIA_MODAL, UMB_EXAMINE_FIELDS_SETTINGS_MODAL, UMB_EXPORT_DICTIONARY_MODAL, UMB_FOLDER_MODAL, UMB_ICON_PICKER_MODAL, UMB_IMPORT_DICTIONARY_MODAL, UMB_INVITE_USER_MODAL, UMB_LANGUAGE_PICKER_MODAL, UMB_LINK_PICKER_MODAL, UMB_MEDIA_TREE_PICKER_MODAL, UMB_MODAL_CONTEXT_TOKEN, UMB_PARTIAL_VIEW_PICKER_MODAL, UMB_PARTIAL_VIEW_PICKER_MODAL_ALIAS, UMB_PROPERTY_EDITOR_UI_PICKER_MODAL, UMB_PROPERTY_SETTINGS_MODAL, UMB_SEARCH_MODAL, UMB_SECTION_PICKER_MODAL, UMB_TEMPLATE_MODAL, UMB_TEMPLATE_PICKER_MODAL, UMB_USER_GROUP_PICKER_MODAL, UMB_USER_PICKER_MODAL, UmbAllowedDocumentTypesModalData, UmbAllowedDocumentTypesModalResult, UmbChangePasswordModalData, UmbConfirmModalData, UmbConfirmModalResult, UmbContextDebuggerModalData, UmbCreateDictionaryModalData, UmbCreateDictionaryModalResult, UmbCreateDocumentModalResultData, UmbDataTypePickerFlowModalData, UmbDataTypePickerFlowModalResult, UmbDataTypePickerModalData, UmbDataTypePickerModalResult, UmbDictionaryItemPickerModalData, UmbDictionaryItemPickerModalResult, UmbDocumentPickerModalData, UmbDocumentPickerModalResult, UmbDocumentTypePickerModalData, UmbDocumentTypePickerModalResult, UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalResult, UmbExamineFieldsSettingsModalData, UmbExportDictionaryModalData, UmbExportDictionaryModalResult, UmbFolderModalData, UmbFolderModalResult, UmbIconPickerModalData, UmbIconPickerModalResult, UmbImportDictionaryModalData, UmbImportDictionaryModalResult, UmbLanguagePickerModalData, UmbLanguagePickerModalResult, UmbLinkPickerConfig, UmbLinkPickerLink, UmbLinkPickerModalData, UmbLinkPickerModalResult, UmbMediaTreePickerModalData, UmbMediaTreePickerModalResult, UmbModalConfig, UmbModalContext, UmbModalHandler, UmbModalHandlerClass, UmbModalRouteBuilder, UmbModalRouteRegistration, UmbModalRouteRegistrationController, UmbModalToken, UmbModalType, UmbPartialViewPickerModalData, UmbPartialViewPickerModalResult, UmbPickerModalData, UmbPickerModalResult, UmbPropertyEditorUIPickerModalData, UmbPropertyEditorUIPickerModalResult, UmbPropertySettingsModalData, UmbPropertySettingsModalResult, UmbSectionPickerModalData, UmbSectionPickerModalResult, UmbTemplateModalData, UmbTemplateModalResult, UmbTemplatePickerModalData, UmbTemplatePickerModalResult, UmbTreePickerModalData, UmbUserPickerModalData, UmbUserPickerModalResult };
package/models.d.ts CHANGED
@@ -1,85 +1,17 @@
1
- import { EntityTreeItemResponseModel, FolderTreeItemResponseModel, PackageManifestResponseModel } from '@umbraco-cms/backoffice/backend-api';
2
-
3
- type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
4
- type ClassConstructor<T> = new (...args: any[]) => T;
5
- interface Entity {
6
- id: string;
7
- name: string;
8
- icon: string;
9
- type: string;
10
- hasChildren: boolean;
11
- parentId: string | null;
12
- }
13
1
  /** Tried to find a common base of our entities — used by Entity Workspace Context */
14
- type BaseEntity = {
2
+ type UmbEntityBase = {
15
3
  id?: string;
16
4
  name?: string;
17
5
  };
18
- interface UserEntity extends Entity {
19
- type: 'user';
20
- }
21
- type UserStatus = 'enabled' | 'inactive' | 'invited' | 'disabled';
22
- interface UserDetails extends UserEntity {
23
- email: string;
24
- status: UserStatus;
25
- language: string;
26
- lastLoginDate?: string;
27
- lastLockoutDate?: string;
28
- lastPasswordChangeDate?: string;
29
- updateDate: string;
30
- createDate: string;
31
- failedLoginAttempts: number;
32
- userGroups: Array<string>;
33
- contentStartNodes: Array<string>;
34
- mediaStartNodes: Array<string>;
35
- }
36
- interface UserGroupEntity extends Entity {
37
- type: 'user-group';
38
- }
39
- interface UserGroupDetails extends UserGroupEntity {
40
- sections: Array<string>;
41
- contentStartNode?: string;
42
- mediaStartNode?: string;
43
- permissions: Array<string>;
44
- }
45
- interface MemberTypeDetails extends EntityTreeItemResponseModel {
46
- id: string;
47
- alias: string;
48
- properties: [];
49
- }
50
- interface MediaTypeDetails extends FolderTreeItemResponseModel {
51
- id: string;
52
- alias: string;
53
- properties: [];
54
- }
55
- interface MemberGroupDetails extends EntityTreeItemResponseModel {
56
- id: string;
57
- }
58
- interface MemberDetails extends EntityTreeItemResponseModel {
59
- id: string;
60
- }
61
- interface DocumentBlueprintDetails {
62
- id: string;
63
- name: string;
64
- type: 'document-blueprint';
65
- properties: Array<any>;
66
- data: Array<any>;
67
- icon: string;
68
- documentTypeKey: string;
69
- }
70
- interface SwatchDetails {
6
+ interface UmbSwatchDetails {
71
7
  label: string;
72
8
  value: string;
73
9
  }
74
- type UmbPackage = PackageManifestResponseModel;
75
- type PackageManifestResponse = UmbPackage[];
76
- type UmbPackageWithMigrationStatus = UmbPackage & {
77
- hasPendingMigrations: boolean;
78
- };
79
- interface UmbFilterModel {
80
- skip?: number;
81
- take?: number;
82
- filter?: string;
10
+ interface ServertimeOffset {
11
+ /**
12
+ * offset in minutes relative to UTC
13
+ */
14
+ offset: number;
83
15
  }
84
16
 
85
- export { BaseEntity, ClassConstructor, DocumentBlueprintDetails, Entity, HTMLElementConstructor, MediaTypeDetails, MemberDetails, MemberGroupDetails, MemberTypeDetails, PackageManifestResponse, SwatchDetails, UmbFilterModel, UmbPackage, UmbPackageWithMigrationStatus, UserDetails, UserEntity, UserGroupDetails, UserGroupEntity, UserStatus };
17
+ export { ServertimeOffset, UmbEntityBase, UmbSwatchDetails };
@@ -1,10 +1,11 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { Observable, BehaviorSubject } from 'rxjs';
3
- import { UmbControllerInterface, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
3
+ import { UmbControllerInterface, UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
4
4
 
5
5
  declare class UmbObserver<T> {
6
6
  #private;
7
7
  constructor(source: Observable<T>, callback: (_value: T) => void);
8
+ asPromise(): Promise<T>;
8
9
  hostConnected(): void;
9
10
  hostDisconnected(): void;
10
11
  destroy(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-cms/backoffice",
3
- "version": "1.0.0-next.93a8a0e4",
3
+ "version": "1.0.0-next.93ffdc6a",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "umbraco",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "peerDependencies": {
28
28
  "@types/uuid": "^9.0.1",
29
- "@umbraco-ui/uui": "^1.2.0-rc.0",
29
+ "@umbraco-ui/uui": "1.2.1",
30
30
  "rxjs": "^7.8.0"
31
31
  },
32
32
  "customElements": "custom-elements.json"
package/picker-input.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as rxjs from 'rxjs';
2
2
  import { UmbItemRepository } from '@umbraco-cms/backoffice/repository';
3
- import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller';
4
- import { UmbModalToken, UmbModalContext } from '@umbraco-cms/backoffice/modal';
3
+ import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
4
+ import { UmbModalToken, UmbModalContext, UmbPickerModalData } from '@umbraco-cms/backoffice/modal';
5
5
  import { ItemResponseModelBaseModel } from '@umbraco-cms/backoffice/backend-api';
6
6
 
7
7
  declare class UmbPickerInputContext<ItemType extends ItemResponseModelBaseModel> {
@@ -10,6 +10,7 @@ declare class UmbPickerInputContext<ItemType extends ItemResponseModelBaseModel>
10
10
  modalAlias: string | UmbModalToken;
11
11
  repository?: UmbItemRepository<ItemType>;
12
12
  modalContext?: UmbModalContext;
13
+ pickableFilter?: (item: ItemType) => boolean;
13
14
  selection: rxjs.Observable<string[]>;
14
15
  selectedItems: rxjs.Observable<ItemType[]>;
15
16
  max: number;
@@ -17,7 +18,7 @@ declare class UmbPickerInputContext<ItemType extends ItemResponseModelBaseModel>
17
18
  constructor(host: UmbControllerHostElement, repositoryAlias: string, modalAlias: string | UmbModalToken, getUniqueMethod?: (entry: ItemType) => string | undefined);
18
19
  getSelection(): string[];
19
20
  setSelection(selection: string[]): void;
20
- openPicker(pickerData?: any): void;
21
+ openPicker(pickerData?: Partial<UmbPickerModalData<ItemType>>): void;
21
22
  requestRemoveItem(unique: string): Promise<void>;
22
23
  }
23
24