@eclipse-docks/core 0.7.108 → 0.7.109
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/dist/api/index.js +3 -3
- package/dist/api/services.d.ts +1 -1
- package/dist/api/services.d.ts.map +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/{api-BilEZ2UQ.js → api-CuHseuRW.js} +2 -2
- package/dist/{api-BilEZ2UQ.js.map → api-CuHseuRW.js.map} +1 -1
- package/dist/core/dialogservice.d.ts.map +1 -1
- package/dist/dialogs/form-dialog.d.ts +46 -0
- package/dist/dialogs/form-dialog.d.ts.map +1 -0
- package/dist/dialogs/index.d.ts +1 -0
- package/dist/dialogs/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/parts/index.js +1 -1
- package/dist/{parts-DECzUKtn.js → parts-D__47G7C.js} +164 -3
- package/dist/parts-D__47G7C.js.map +1 -0
- package/package.json +1 -1
- package/src/api/services.ts +7 -1
- package/src/api/types.ts +4 -1
- package/src/core/dialogservice.ts +6 -1
- package/src/dialogs/form-dialog.ts +239 -0
- package/src/dialogs/index.ts +8 -0
- package/dist/parts-DECzUKtn.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogservice.d.ts","sourceRoot":"","sources":["../../src/core/dialogservice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAwB,YAAY,EAAgC,MAAM,wBAAwB,CAAC;AAQ1G,eAAO,MAAM,0BAA0B,YAAY,CAAC;AAEpD,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC/E,QAAQ,CAAC,EAAE,OAAO,C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|
3
|
+
/** HTML input types supported by {@link formDialog}. */
|
|
4
|
+
export type FormDialogFieldType = "text" | "password" | "url" | "email" | "number";
|
|
5
|
+
export interface FormDialogField {
|
|
6
|
+
/** Key in the returned values record. */
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
type?: FormDialogFieldType;
|
|
10
|
+
value?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** When false, empty values are allowed. Defaults to true. */
|
|
13
|
+
required?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface FormDialogOptions {
|
|
16
|
+
/** Dialog window title (shown on `wa-dialog`). */
|
|
17
|
+
label: string;
|
|
18
|
+
fields: FormDialogField[];
|
|
19
|
+
/** Optional message above the fields (plain text or markdown). */
|
|
20
|
+
message?: string;
|
|
21
|
+
markdown?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class DocksFormDialogContent extends DocksDialogContent {
|
|
24
|
+
fields: FormDialogField[];
|
|
25
|
+
message: string;
|
|
26
|
+
markdown: boolean;
|
|
27
|
+
private values;
|
|
28
|
+
private validationError;
|
|
29
|
+
static styles: import('lit').CSSResult[];
|
|
30
|
+
firstUpdated(changedProperties: PropertyValues): Promise<void>;
|
|
31
|
+
getResult(): Record<string, string>;
|
|
32
|
+
setValidationError(message: string): void;
|
|
33
|
+
private updateField;
|
|
34
|
+
private handleKeyDown;
|
|
35
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
"docks-form-dialog-content": DocksFormDialogContent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Validates required fields; returns an error message or null if valid. */
|
|
43
|
+
export declare function validateFormDialogFields(fields: FormDialogField[], values: Record<string, string>): string | null;
|
|
44
|
+
export declare function formDialog(options: FormDialogOptions): Promise<Record<string, string> | null>;
|
|
45
|
+
export declare function formDialogRequired(options: FormDialogOptions): Promise<Record<string, string>>;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AC,aAAa;IAUrB,MAAM;CA6BT;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,2BAA2B,EAAE,sBAAsB,CAAC;KACvD;CACJ;AAYD,4EAA4E;AAC5E,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,eAAe,EAAE,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,MAAM,GAAG,IAAI,CAQf;AAwCD,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAI7F;AAED,wBAAsB,kBAAkB,CACpC,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAIjC"}
|
package/dist/dialogs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { promptDialog } from './prompt-dialog';
|
|
2
|
+
export { formDialog, formDialogRequired, validateFormDialogFields, type FormDialogField, type FormDialogFieldType, type FormDialogOptions, } from './form-dialog';
|
|
2
3
|
export { infoDialog } from './info-dialog';
|
|
3
4
|
export { confirmDialog } from './confirm-dialog';
|
|
4
5
|
export { navigableInfoDialog, type NavigableDialogAction } from './navigable-info-dialog';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialogs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EACL,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialogs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EACL,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SIDEBAR_MAIN, B as TOOLBAR_MAIN_RIGHT, C as appSettings, D as MouseButton, E as HIDE_DOT_RESOURCE, F as TOOLBAR_BOTTOM, I as TOOLBAR_BOTTOM_CENTER, L as TOOLBAR_BOTTOM_END, M as SIDEBAR_MAIN_TOOLBAR, N as SYSTEM_LAYOUTS, O as PANEL_BOTTOM, P as SYSTEM_VIEWS, R as TOOLBAR_MAIN, S as TOPIC_SETTINGS_CHANGED, T as EDITOR_AREA_MAIN, _ as DocksElement, a as filebrowserDialog, b as esmShService, c as infoDialog, d as validateFormDialogFields, f as promptDialog, g as DocksDialogContent, h as dialogService, i as parseIconSpec, j as SIDEBAR_MAIN_BOTTOM, k as SIDEBAR_AUXILIARY, l as formDialog, n as DocksContainer, o as navigableInfoDialog, p as appLoaderService, r as icon, s as confirmDialog, t as DocksPart, u as formDialogRequired, w as COMMAND_SAVE, x as taskService, y as extensionRegistry, z as TOOLBAR_MAIN_CENTER } from "./parts-D__47G7C.js";
|
|
2
2
|
import { i as setLogLevel, n as defaultLogger, o as rootContext, s as uiContext, t as createLogger } from "./logger-DT0_NW3S.js";
|
|
3
3
|
import { C as toastError, S as overrideContributionTargets, T as toastWarning, a as TOPIC_COMMAND_REGISTERED, b as contributionTargetMappingRegistry, c as EMPTY_SIGNALPORT, d as activeSelectionSignal, f as activeTasksSignal, g as contributionRegistry, h as TOPIC_CONTRIBUTEIONS_CHANGED, i as CommandStack, l as activeEditorSignal, m as perspectiveSwitchedSignal, n as watchSignal, o as commandRegistry, p as partDirtySignal, r as CommandRegistry, s as registerAll, t as DocksWidget, u as activePartSignal, w as toastInfo, x as listContributionNameRemaps, y as applyConfigNameRemaps } from "./widget-DbolQH0C.js";
|
|
4
4
|
import { n as subscribe, r as unsubscribe, t as publish } from "./events-B_ZxkU_G.js";
|
|
5
5
|
import { a as File, c as TOPIC_WORKSPACE_CHANGED, d as WorkspaceService, f as workspaceService, i as Directory, l as TOPIC_WORKSPACE_CONNECTED, o as FileContentType, p as persistenceService, r as CompositeDirectory, s as StringFile, t as FileSysDirHandleResource } from "./fs-access-D-fDaJ8V.js";
|
|
6
|
-
import { C as editorRegistry, S as treeNodeComparator, T as i18n, _ as TOOLBAR_LAYOUT_SWITCHER, a as DocksStandardLayout, b as VIEW_FILEBROWSER, c as SIDEBAR_TOOLBAR_EXTENSIONS, d as TOOLBAR_FAST_VIEWS, f as TOOLBAR_FILEBROWSER_DELETE, g as TOOLBAR_LANGUAGE_SELECTOR, h as TOOLBAR_INFO, i as createJsRuntime, l as SYSTEM_DEFAULT_FILE_ICONS, m as TOOLBAR_FULLSCREEN, n as getFrameworkConfig, o as CTXMENU_FILEBROWSER_DELETE, p as TOOLBAR_FILEBROWSER_RENAME, r as runJavaScriptCode, s as CTXMENU_FILEBROWSER_RENAME, t as configureFramework, u as TOOLBAR_ACTIVE_PART_NAME, v as TOOLBAR_TASKS, w as createLazyLabel, x as VIEW_LOG_TERMINAL, y as TOOLBAR_THEME_SWITCHER } from "./api-
|
|
7
|
-
export { COMMAND_SAVE, CTXMENU_FILEBROWSER_DELETE, CTXMENU_FILEBROWSER_RENAME, CommandRegistry, CommandStack, CompositeDirectory, Directory, DocksContainer, DocksDialogContent, DocksElement, DocksPart, DocksStandardLayout, DocksWidget, EDITOR_AREA_MAIN, EMPTY_SIGNALPORT, File, FileContentType, FileSysDirHandleResource, HIDE_DOT_RESOURCE, MouseButton, PANEL_BOTTOM, SIDEBAR_AUXILIARY, SIDEBAR_MAIN, SIDEBAR_MAIN_BOTTOM, SIDEBAR_MAIN_TOOLBAR, SIDEBAR_TOOLBAR_EXTENSIONS, SYSTEM_DEFAULT_FILE_ICONS, SYSTEM_LAYOUTS, SYSTEM_VIEWS, StringFile, TOOLBAR_ACTIVE_PART_NAME, TOOLBAR_BOTTOM, TOOLBAR_BOTTOM_CENTER, TOOLBAR_BOTTOM_END, TOOLBAR_FAST_VIEWS, TOOLBAR_FILEBROWSER_DELETE, TOOLBAR_FILEBROWSER_RENAME, TOOLBAR_FULLSCREEN, TOOLBAR_INFO, TOOLBAR_LANGUAGE_SELECTOR, TOOLBAR_LAYOUT_SWITCHER, TOOLBAR_MAIN, TOOLBAR_MAIN_CENTER, TOOLBAR_MAIN_RIGHT, TOOLBAR_TASKS, TOOLBAR_THEME_SWITCHER, TOPIC_COMMAND_REGISTERED, TOPIC_CONTRIBUTEIONS_CHANGED, TOPIC_SETTINGS_CHANGED, TOPIC_WORKSPACE_CHANGED, TOPIC_WORKSPACE_CONNECTED, VIEW_FILEBROWSER, VIEW_LOG_TERMINAL, WorkspaceService, activeEditorSignal, activePartSignal, activeSelectionSignal, activeTasksSignal, appLoaderService, appSettings, applyConfigNameRemaps, commandRegistry, configureFramework, confirmDialog, contributionRegistry, contributionTargetMappingRegistry, createJsRuntime, createLazyLabel, createLogger, dialogService, editorRegistry, esmShService, extensionRegistry, filebrowserDialog, getFrameworkConfig, i18n, icon, infoDialog, listContributionNameRemaps, defaultLogger as logger, navigableInfoDialog, overrideContributionTargets, parseIconSpec, partDirtySignal, persistenceService, perspectiveSwitchedSignal, promptDialog, publish, registerAll, rootContext, runJavaScriptCode, setLogLevel, subscribe, taskService, toastError, toastInfo, toastWarning, treeNodeComparator, uiContext, unsubscribe, watchSignal, workspaceService };
|
|
6
|
+
import { C as editorRegistry, S as treeNodeComparator, T as i18n, _ as TOOLBAR_LAYOUT_SWITCHER, a as DocksStandardLayout, b as VIEW_FILEBROWSER, c as SIDEBAR_TOOLBAR_EXTENSIONS, d as TOOLBAR_FAST_VIEWS, f as TOOLBAR_FILEBROWSER_DELETE, g as TOOLBAR_LANGUAGE_SELECTOR, h as TOOLBAR_INFO, i as createJsRuntime, l as SYSTEM_DEFAULT_FILE_ICONS, m as TOOLBAR_FULLSCREEN, n as getFrameworkConfig, o as CTXMENU_FILEBROWSER_DELETE, p as TOOLBAR_FILEBROWSER_RENAME, r as runJavaScriptCode, s as CTXMENU_FILEBROWSER_RENAME, t as configureFramework, u as TOOLBAR_ACTIVE_PART_NAME, v as TOOLBAR_TASKS, w as createLazyLabel, x as VIEW_LOG_TERMINAL, y as TOOLBAR_THEME_SWITCHER } from "./api-CuHseuRW.js";
|
|
7
|
+
export { COMMAND_SAVE, CTXMENU_FILEBROWSER_DELETE, CTXMENU_FILEBROWSER_RENAME, CommandRegistry, CommandStack, CompositeDirectory, Directory, DocksContainer, DocksDialogContent, DocksElement, DocksPart, DocksStandardLayout, DocksWidget, EDITOR_AREA_MAIN, EMPTY_SIGNALPORT, File, FileContentType, FileSysDirHandleResource, HIDE_DOT_RESOURCE, MouseButton, PANEL_BOTTOM, SIDEBAR_AUXILIARY, SIDEBAR_MAIN, SIDEBAR_MAIN_BOTTOM, SIDEBAR_MAIN_TOOLBAR, SIDEBAR_TOOLBAR_EXTENSIONS, SYSTEM_DEFAULT_FILE_ICONS, SYSTEM_LAYOUTS, SYSTEM_VIEWS, StringFile, TOOLBAR_ACTIVE_PART_NAME, TOOLBAR_BOTTOM, TOOLBAR_BOTTOM_CENTER, TOOLBAR_BOTTOM_END, TOOLBAR_FAST_VIEWS, TOOLBAR_FILEBROWSER_DELETE, TOOLBAR_FILEBROWSER_RENAME, TOOLBAR_FULLSCREEN, TOOLBAR_INFO, TOOLBAR_LANGUAGE_SELECTOR, TOOLBAR_LAYOUT_SWITCHER, TOOLBAR_MAIN, TOOLBAR_MAIN_CENTER, TOOLBAR_MAIN_RIGHT, TOOLBAR_TASKS, TOOLBAR_THEME_SWITCHER, TOPIC_COMMAND_REGISTERED, TOPIC_CONTRIBUTEIONS_CHANGED, TOPIC_SETTINGS_CHANGED, TOPIC_WORKSPACE_CHANGED, TOPIC_WORKSPACE_CONNECTED, VIEW_FILEBROWSER, VIEW_LOG_TERMINAL, WorkspaceService, activeEditorSignal, activePartSignal, activeSelectionSignal, activeTasksSignal, appLoaderService, appSettings, applyConfigNameRemaps, commandRegistry, configureFramework, confirmDialog, contributionRegistry, contributionTargetMappingRegistry, createJsRuntime, createLazyLabel, createLogger, dialogService, editorRegistry, esmShService, extensionRegistry, filebrowserDialog, formDialog, formDialogRequired, getFrameworkConfig, i18n, icon, infoDialog, listContributionNameRemaps, defaultLogger as logger, navigableInfoDialog, overrideContributionTargets, parseIconSpec, partDirtySignal, persistenceService, perspectiveSwitchedSignal, promptDialog, publish, registerAll, rootContext, runJavaScriptCode, setLogLevel, subscribe, taskService, toastError, toastInfo, toastWarning, treeNodeComparator, uiContext, unsubscribe, validateFormDialogFields, watchSignal, workspaceService };
|
package/dist/parts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../parts-
|
|
1
|
+
import "../parts-D__47G7C.js";
|
|
@@ -1149,7 +1149,7 @@ var DialogService = class {
|
|
|
1149
1149
|
close: cleanup
|
|
1150
1150
|
};
|
|
1151
1151
|
render(html`
|
|
1152
|
-
<wa-dialog label="${contribution.label || dialogId}" open @wa-request-close=${cleanup}>
|
|
1152
|
+
<wa-dialog label="${state && typeof state === "object" && typeof state.label === "string" ? state.label : contribution.label || dialogId}" open @wa-request-close=${cleanup}>
|
|
1153
1153
|
<style>
|
|
1154
1154
|
.dialog-service-content {
|
|
1155
1155
|
display: flex;
|
|
@@ -2299,6 +2299,167 @@ async function promptDialog(message, defaultValue = "", markdown = false) {
|
|
|
2299
2299
|
});
|
|
2300
2300
|
}
|
|
2301
2301
|
//#endregion
|
|
2302
|
+
//#region src/dialogs/form-dialog.ts
|
|
2303
|
+
var DocksFormDialogContent = class DocksFormDialogContent extends DocksDialogContent {
|
|
2304
|
+
constructor(..._args) {
|
|
2305
|
+
super(..._args);
|
|
2306
|
+
this.fields = [];
|
|
2307
|
+
this.message = "";
|
|
2308
|
+
this.markdown = false;
|
|
2309
|
+
this.values = {};
|
|
2310
|
+
this.validationError = "";
|
|
2311
|
+
}
|
|
2312
|
+
static {
|
|
2313
|
+
this.styles = [...DocksDialogContent.styles, css`
|
|
2314
|
+
.form-fields {
|
|
2315
|
+
display: flex;
|
|
2316
|
+
flex-direction: column;
|
|
2317
|
+
gap: 0.75rem;
|
|
2318
|
+
min-width: 22rem;
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
.field label {
|
|
2322
|
+
display: flex;
|
|
2323
|
+
flex-direction: column;
|
|
2324
|
+
gap: 0.25rem;
|
|
2325
|
+
font-size: var(--wa-font-size-s);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
.field-label {
|
|
2329
|
+
font-weight: 500;
|
|
2330
|
+
color: var(--wa-color-text-normal);
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
wa-input {
|
|
2334
|
+
width: 100%;
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
.validation-error {
|
|
2338
|
+
color: var(--wa-color-danger-600, #dc2626);
|
|
2339
|
+
font-size: var(--wa-font-size-s);
|
|
2340
|
+
}
|
|
2341
|
+
`];
|
|
2342
|
+
}
|
|
2343
|
+
async firstUpdated(changedProperties) {
|
|
2344
|
+
super.firstUpdated(changedProperties);
|
|
2345
|
+
const initial = {};
|
|
2346
|
+
for (const field of this.fields) initial[field.name] = field.value ?? "";
|
|
2347
|
+
this.values = initial;
|
|
2348
|
+
await this.updateComplete;
|
|
2349
|
+
((this.shadowRoot?.querySelector("wa-input"))?.shadowRoot?.querySelector("input"))?.focus();
|
|
2350
|
+
}
|
|
2351
|
+
getResult() {
|
|
2352
|
+
return { ...this.values };
|
|
2353
|
+
}
|
|
2354
|
+
setValidationError(message) {
|
|
2355
|
+
this.validationError = message;
|
|
2356
|
+
}
|
|
2357
|
+
updateField(name, value) {
|
|
2358
|
+
this.values = {
|
|
2359
|
+
...this.values,
|
|
2360
|
+
[name]: value
|
|
2361
|
+
};
|
|
2362
|
+
if (this.validationError) this.validationError = "";
|
|
2363
|
+
}
|
|
2364
|
+
handleKeyDown(event) {
|
|
2365
|
+
if (event.key === "Enter") {
|
|
2366
|
+
event.preventDefault();
|
|
2367
|
+
this.dispatchEvent(new CustomEvent("dialog-ok", {
|
|
2368
|
+
bubbles: true,
|
|
2369
|
+
composed: true
|
|
2370
|
+
}));
|
|
2371
|
+
} else if (event.key === "Escape") {
|
|
2372
|
+
event.preventDefault();
|
|
2373
|
+
this.dispatchEvent(new CustomEvent("dialog-cancel", {
|
|
2374
|
+
bubbles: true,
|
|
2375
|
+
composed: true
|
|
2376
|
+
}));
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
render() {
|
|
2380
|
+
return html`
|
|
2381
|
+
${this.message ? this.renderMessage(this.message, this.markdown) : null}
|
|
2382
|
+
<div class="form-fields" @keydown=${this.handleKeyDown}>
|
|
2383
|
+
${this.fields.map((field) => html`
|
|
2384
|
+
<div class="field">
|
|
2385
|
+
<label>
|
|
2386
|
+
<span class="field-label">${field.label}</span>
|
|
2387
|
+
<wa-input
|
|
2388
|
+
type=${field.type ?? "text"}
|
|
2389
|
+
.value=${this.values[field.name] ?? ""}
|
|
2390
|
+
placeholder=${field.placeholder ?? ""}
|
|
2391
|
+
@input=${(event) => this.updateField(field.name, event.target.value)}
|
|
2392
|
+
></wa-input>
|
|
2393
|
+
</label>
|
|
2394
|
+
</div>
|
|
2395
|
+
`)}
|
|
2396
|
+
${this.validationError ? html`<div class="validation-error">${this.validationError}</div>` : null}
|
|
2397
|
+
</div>
|
|
2398
|
+
`;
|
|
2399
|
+
}
|
|
2400
|
+
};
|
|
2401
|
+
_decorate([property({ attribute: false })], DocksFormDialogContent.prototype, "fields", void 0);
|
|
2402
|
+
_decorate([property({ type: String })], DocksFormDialogContent.prototype, "message", void 0);
|
|
2403
|
+
_decorate([property({ type: Boolean })], DocksFormDialogContent.prototype, "markdown", void 0);
|
|
2404
|
+
_decorate([state()], DocksFormDialogContent.prototype, "values", void 0);
|
|
2405
|
+
_decorate([state()], DocksFormDialogContent.prototype, "validationError", void 0);
|
|
2406
|
+
DocksFormDialogContent = _decorate([customElement("docks-form-dialog-content")], DocksFormDialogContent);
|
|
2407
|
+
function trimValues(values) {
|
|
2408
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, value.trim()]));
|
|
2409
|
+
}
|
|
2410
|
+
function findFormDialogContent() {
|
|
2411
|
+
return document.querySelector("docks-form-dialog-content");
|
|
2412
|
+
}
|
|
2413
|
+
/** Validates required fields; returns an error message or null if valid. */
|
|
2414
|
+
function validateFormDialogFields(fields, values) {
|
|
2415
|
+
for (const field of fields) {
|
|
2416
|
+
if (field.required === false) continue;
|
|
2417
|
+
if (!values[field.name]?.trim()) return `${field.label} is required.`;
|
|
2418
|
+
}
|
|
2419
|
+
return null;
|
|
2420
|
+
}
|
|
2421
|
+
contributionRegistry.registerContribution(DIALOG_CONTRIBUTION_TARGET, {
|
|
2422
|
+
id: "form",
|
|
2423
|
+
label: "Form",
|
|
2424
|
+
buttons: [OK_BUTTON, CANCEL_BUTTON],
|
|
2425
|
+
component: (state) => {
|
|
2426
|
+
if (!state) return html`<div>Error: No form dialog state</div>`;
|
|
2427
|
+
return html`
|
|
2428
|
+
<docks-form-dialog-content
|
|
2429
|
+
.message=${state.message ?? ""}
|
|
2430
|
+
.markdown=${state.markdown ?? false}
|
|
2431
|
+
.fields=${state.fields}
|
|
2432
|
+
></docks-form-dialog-content>
|
|
2433
|
+
`;
|
|
2434
|
+
},
|
|
2435
|
+
onButton: async (id, result, state) => {
|
|
2436
|
+
if (!state) return true;
|
|
2437
|
+
if (id === "ok") {
|
|
2438
|
+
const values = trimValues(result ?? {});
|
|
2439
|
+
const error = validateFormDialogFields(state.fields, values);
|
|
2440
|
+
if (error) {
|
|
2441
|
+
findFormDialogContent()?.setValidationError(error);
|
|
2442
|
+
return false;
|
|
2443
|
+
}
|
|
2444
|
+
state.resolve(values);
|
|
2445
|
+
} else state.resolve(null);
|
|
2446
|
+
return true;
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
function formDialog(options) {
|
|
2450
|
+
return new Promise((resolve) => {
|
|
2451
|
+
dialogService.open("form", {
|
|
2452
|
+
...options,
|
|
2453
|
+
resolve
|
|
2454
|
+
});
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
async function formDialogRequired(options) {
|
|
2458
|
+
const values = await formDialog(options);
|
|
2459
|
+
if (!values) throw new Error("Cancelled");
|
|
2460
|
+
return values;
|
|
2461
|
+
}
|
|
2462
|
+
//#endregion
|
|
2302
2463
|
//#region src/dialogs/info-dialog.ts
|
|
2303
2464
|
var DocksInfoDialogContent = class DocksInfoDialogContent extends DocksDialogContent {
|
|
2304
2465
|
constructor(..._args) {
|
|
@@ -4462,6 +4623,6 @@ _decorate([state()], DocksResizableGrid.prototype, "gridSizes", void 0);
|
|
|
4462
4623
|
_decorate([state()], DocksResizableGrid.prototype, "gridChildren", void 0);
|
|
4463
4624
|
DocksResizableGrid = _DocksResizableGrid = _decorate([customElement("docks-resizable-grid")], DocksResizableGrid);
|
|
4464
4625
|
//#endregion
|
|
4465
|
-
export {
|
|
4626
|
+
export { SIDEBAR_MAIN as A, TOOLBAR_MAIN_RIGHT as B, appSettings as C, MouseButton as D, HIDE_DOT_RESOURCE as E, TOOLBAR_BOTTOM as F, TOOLBAR_BOTTOM_CENTER as I, TOOLBAR_BOTTOM_END as L, SIDEBAR_MAIN_TOOLBAR as M, SYSTEM_LAYOUTS as N, PANEL_BOTTOM as O, SYSTEM_VIEWS as P, TOOLBAR_MAIN as R, TOPIC_SETTINGS_CHANGED as S, EDITOR_AREA_MAIN as T, constants_exports as V, DocksElement as _, filebrowserDialog as a, esmShService as b, infoDialog as c, validateFormDialogFields as d, promptDialog as f, DocksDialogContent as g, dialogService as h, parseIconSpec as i, SIDEBAR_MAIN_BOTTOM as j, SIDEBAR_AUXILIARY as k, formDialog as l, deleteIndexedDbWorkspaceData as m, DocksContainer as n, navigableInfoDialog as o, appLoaderService as p, icon as r, confirmDialog as s, DocksPart as t, formDialogRequired as u, TOPIC_EXTENSIONS_CHANGED as v, COMMAND_SAVE as w, taskService as x, extensionRegistry as y, TOOLBAR_MAIN_CENTER as z };
|
|
4466
4627
|
|
|
4467
|
-
//# sourceMappingURL=parts-
|
|
4628
|
+
//# sourceMappingURL=parts-D__47G7C.js.map
|