modal modals working
This commit is contained in:
@@ -90,6 +90,9 @@ export class UmbModalHandlerClass<ModalData extends object = object, ModalResult
|
||||
});
|
||||
|
||||
this.modalElement = this.#createContainerElement();
|
||||
this.modalElement.addEventListener('close', () => {
|
||||
this._submitRejecter?.();
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -97,6 +100,12 @@ export class UmbModalHandlerClass<ModalData extends object = object, ModalResult
|
||||
*
|
||||
*/
|
||||
if (router) {
|
||||
this.#modalRouterElement.routes = [
|
||||
{
|
||||
path: '',
|
||||
component: document.createElement('slot'),
|
||||
},
|
||||
];
|
||||
this.#modalRouterElement.parent = router;
|
||||
}
|
||||
this.modalElement.appendChild(this.#modalRouterElement);
|
||||
@@ -148,7 +157,6 @@ export class UmbModalHandlerClass<ModalData extends object = object, ModalResult
|
||||
}
|
||||
|
||||
public reject() {
|
||||
this._submitRejecter?.();
|
||||
this.modalElement.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// eslint-disable-next-line local-rules/no-external-imports
|
||||
import type { IRouterSlot } from 'router-slot/model';
|
||||
import { encodeFolderName } from '@umbraco-cms/internal/router';
|
||||
import { UmbModalHandler } from './modal-handler';
|
||||
import { UmbModalConfig, UmbModalContext } from './modal.context';
|
||||
import { UmbModalToken } from './token/modal-token';
|
||||
import { UmbId } from '@umbraco-cms/backoffice/id';
|
||||
import type { Params } from '@umbraco-cms/backoffice/router';
|
||||
import { encodeFolderName } from '@umbraco-cms/internal/router';
|
||||
|
||||
export type UmbModalRouteBuilder = (params: { [key: string]: string | number } | null) => string;
|
||||
|
||||
@@ -111,12 +111,13 @@ export class UmbModalRouteRegistration<UmbModalTokenData extends object = object
|
||||
};
|
||||
|
||||
routeSetup(router: IRouterSlot, modalContext: UmbModalContext, params: Params) {
|
||||
console.log('routeSetup', this.active);
|
||||
|
||||
// If already open, don't do anything:
|
||||
if (this.active) return;
|
||||
|
||||
const modalData = this.#onSetupCallback ? this.#onSetupCallback(params) : undefined;
|
||||
if (modalData !== false) {
|
||||
console.log('routeSetup has router:', router);
|
||||
this.#modalHandler = modalContext.open(this.#modalAlias, modalData, this.modalConfig, router);
|
||||
this.#modalHandler.onSubmit().then(this.#onSubmit, this.#onReject);
|
||||
return this.#modalHandler;
|
||||
|
||||
@@ -98,6 +98,7 @@ export class UmbRouteContext {
|
||||
public _internal_modalRouterChanged(activeModalPath: string | undefined) {
|
||||
if (this.#activeModalPath === activeModalPath) return;
|
||||
if (this.#activeModalPath) {
|
||||
console.log('_internal_modalRouterChanged', this.#activeModalPath);
|
||||
// If if there is a modal using the old path.
|
||||
const activeModal = this.#modalRegistrations.find(
|
||||
(registration) => '/' + registration.generateModalPath() === this.#activeModalPath
|
||||
|
||||
@@ -81,7 +81,7 @@ export class UmbInputDataTypeElement extends FormControlMixin(UmbLitElement) {
|
||||
alias=${this._selectedPropertyEditorUI.alias}
|
||||
property-editor-model-alias=${this._selectedPropertyEditorUI.meta.propertyEditorModel}
|
||||
@open=${() => {
|
||||
console.log('TO BE DONE..');
|
||||
console.warn('TO BE DONE..');
|
||||
}}
|
||||
border>
|
||||
<uui-icon name="${this._selectedPropertyEditorUI.meta.icon}" slot="icon"></uui-icon>
|
||||
|
||||
@@ -51,11 +51,10 @@ export class UmbDocumentTypeWorkspacePropertyElement extends UmbLitElement {
|
||||
this.#modalRegistration = new UmbModalRouteRegistrationController(this, UMB_PROPERTY_SETTINGS_MODAL)
|
||||
.addUniquePaths(['propertyId'])
|
||||
.onSetup(() => {
|
||||
console.log(this.property);
|
||||
console.log('UMB_PROPERTY_SETTINGS_MODAL setup!');
|
||||
return this.property ?? false;
|
||||
})
|
||||
.onSubmit((result) => {
|
||||
console.log(result);
|
||||
this._partialUpdate(result);
|
||||
})
|
||||
.observeRouteBuilder((routeBuilder) => {
|
||||
|
||||
@@ -38,7 +38,6 @@ export class UmbDocumentTypeWorkspaceViewStructureElement
|
||||
this._allowedContentTypeIDs = allowedContentTypes
|
||||
?.map((x) => x.id)
|
||||
.filter((x) => x !== undefined) as Array<string>;
|
||||
console.log('this._allowedContentTypeIDs', this._allowedContentTypeIDs);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,11 @@ export class UmbDocumentTypeWorkspaceViewTemplatesElement
|
||||
(defaultTemplateId) => (this._defaultTemplateId = defaultTemplateId)
|
||||
);
|
||||
this.observe(this.#workspaceContext.allowedTemplateIds, (allowedTemplateIds) => {
|
||||
console.log('allowedTemplateIds', allowedTemplateIds);
|
||||
this._allowedTemplateIds = allowedTemplateIds;
|
||||
});
|
||||
}
|
||||
|
||||
#templateInputChange(e: CustomEvent) {
|
||||
console.log('change', e);
|
||||
// save new allowed ids
|
||||
const input = e.target as UmbInputTemplateElement;
|
||||
const idsWithoutRoot = input.selectedIds.filter((id) => id !== null) as Array<string>;
|
||||
|
||||
@@ -47,11 +47,6 @@ export class UmbTagsInputElement extends FormControlMixin(UmbLitElement) {
|
||||
|
||||
#repository = new UmbTagRepository(this);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
console.log('tags-input');
|
||||
}
|
||||
|
||||
public focus() {
|
||||
this._tagInput.focus();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ export class UmbPartialViewsWorkspaceEditElement extends UmbLitElement {
|
||||
|
||||
// this.observe(this.#partialViewsWorkspaceContext.isNew, (isNew) => {
|
||||
// this.#isNew = !!isNew;
|
||||
// console.log(this.#isNew);
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user