Add more info lock (#15995)

* Add more info lock

* Use same height for pending state

* Fix attributes

* Add unlocking/locking to switch

* Improve code support
This commit is contained in:
Paul Bottein
2023-06-20 15:25:26 +02:00
committed by GitHub
parent 922e95b895
commit 7bc2ca3b65
10 changed files with 438 additions and 65 deletions

View File

@@ -0,0 +1,40 @@
import { fireEvent } from "../../common/dom/fire_event";
export interface EnterCodeDialogParams {
codeFormat: "text" | "number";
codePattern?: string;
submitText?: string;
cancelText?: string;
title?: string;
submit?: (code?: string) => void;
cancel?: () => void;
}
export const showEnterCodeDialogDialog = (
element: HTMLElement,
dialogParams: EnterCodeDialogParams
) =>
new Promise<string | null>((resolve) => {
const origCancel = dialogParams.cancel;
const origSubmit = dialogParams.submit;
fireEvent(element, "show-dialog", {
dialogTag: "dialog-enter-code",
dialogImport: () => import("./dialog-enter-code"),
dialogParams: {
...dialogParams,
cancel: () => {
resolve(null);
if (origCancel) {
origCancel();
}
},
submit: (code: string) => {
resolve(code);
if (origSubmit) {
origSubmit(code);
}
},
},
});
});