@konomi-app/ui 5.2.1 → 5.4.0
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/index.cjs +1798 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +224 -4
- package/dist/index.d.ts +224 -4
- package/dist/index.js +1794 -7
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, TemplateResult } from 'lit';
|
|
3
3
|
|
|
4
|
-
type DialogType = 'loading' | 'alert' | 'confirm' | 'queue' | 'steps';
|
|
4
|
+
type DialogType = 'loading' | 'alert' | 'confirm' | 'queue' | 'steps' | 'form' | 'step-form';
|
|
5
5
|
type AlertIcon = 'success' | 'error' | 'warning' | 'info';
|
|
6
6
|
type QueueItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
7
7
|
type StepItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
@@ -19,6 +19,78 @@ type TaskItemInput = string | {
|
|
|
19
19
|
key: string;
|
|
20
20
|
label: string;
|
|
21
21
|
};
|
|
22
|
+
type FormInputType = 'text' | 'number' | 'checkbox' | 'select' | 'date' | 'email' | 'url';
|
|
23
|
+
interface FormFieldMeta {
|
|
24
|
+
key: string;
|
|
25
|
+
inputType: FormInputType;
|
|
26
|
+
label: string;
|
|
27
|
+
description: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
options: string[];
|
|
30
|
+
placeholder: string;
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
minLength?: number;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
defaultValue: unknown;
|
|
36
|
+
}
|
|
37
|
+
interface FormFieldGroup {
|
|
38
|
+
label?: string;
|
|
39
|
+
fields: string[];
|
|
40
|
+
columns?: number;
|
|
41
|
+
}
|
|
42
|
+
interface FormLayout {
|
|
43
|
+
columns?: number;
|
|
44
|
+
gap?: string;
|
|
45
|
+
fieldOrder?: string[];
|
|
46
|
+
groups?: FormFieldGroup[];
|
|
47
|
+
}
|
|
48
|
+
interface FormOptions<T = Record<string, unknown>> {
|
|
49
|
+
title?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
confirmButtonText?: string;
|
|
52
|
+
cancelButtonText?: string;
|
|
53
|
+
allowOutsideClick?: boolean;
|
|
54
|
+
allowEscapeKey?: boolean;
|
|
55
|
+
layout?: FormLayout;
|
|
56
|
+
defaultValues?: Partial<T>;
|
|
57
|
+
validateOnChange?: boolean;
|
|
58
|
+
validateOnBlur?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** フォームを持つ1ステップの描画状態 (コントローラー内部で管理) */
|
|
61
|
+
interface StepFormItem {
|
|
62
|
+
key: string;
|
|
63
|
+
label: string;
|
|
64
|
+
description: string;
|
|
65
|
+
fields: FormFieldMeta[];
|
|
66
|
+
values: Record<string, unknown>;
|
|
67
|
+
errors: Record<string, string>;
|
|
68
|
+
touched: Record<string, boolean>;
|
|
69
|
+
layout: FormLayout;
|
|
70
|
+
}
|
|
71
|
+
/** `showStepForm()` に渡す各ステップの定義 */
|
|
72
|
+
interface StepFormStepInput {
|
|
73
|
+
key: string;
|
|
74
|
+
label: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
/** Zod スキーマ。省略するとフォームなし (説明のみ) のステップになる */
|
|
77
|
+
schema?: {
|
|
78
|
+
_def: any;
|
|
79
|
+
safeParse: (data: unknown) => any;
|
|
80
|
+
};
|
|
81
|
+
layout?: FormLayout;
|
|
82
|
+
defaultValues?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
/** `showStepForm()` のオプション */
|
|
85
|
+
interface StepFormOptions {
|
|
86
|
+
title?: string;
|
|
87
|
+
allowOutsideClick?: boolean;
|
|
88
|
+
allowEscapeKey?: boolean;
|
|
89
|
+
nextButtonText?: string;
|
|
90
|
+
prevButtonText?: string;
|
|
91
|
+
submitButtonText?: string;
|
|
92
|
+
cancelButtonText?: string;
|
|
93
|
+
}
|
|
22
94
|
interface ShowOptions {
|
|
23
95
|
type: DialogType;
|
|
24
96
|
label?: string;
|
|
@@ -71,14 +143,26 @@ interface DialogState {
|
|
|
71
143
|
steps: StepItem[];
|
|
72
144
|
timer: number | null;
|
|
73
145
|
title: string;
|
|
146
|
+
formFields: FormFieldMeta[];
|
|
147
|
+
formValues: Record<string, unknown>;
|
|
148
|
+
formErrors: Record<string, string>;
|
|
149
|
+
formTouched: Record<string, boolean>;
|
|
150
|
+
formLayout: FormLayout;
|
|
151
|
+
formValidateOnChange: boolean;
|
|
152
|
+
formValidateOnBlur: boolean;
|
|
153
|
+
stepFormSteps: StepFormItem[];
|
|
154
|
+
stepFormCurrentIndex: number;
|
|
155
|
+
stepFormNextText: string;
|
|
156
|
+
stepFormPrevText: string;
|
|
157
|
+
stepFormSubmitText: string;
|
|
74
158
|
}
|
|
75
159
|
|
|
76
|
-
type Listener = (state: DialogState) => void;
|
|
160
|
+
type Listener$1 = (state: DialogState) => void;
|
|
77
161
|
declare class DialogController {
|
|
78
162
|
#private;
|
|
79
163
|
constructor();
|
|
80
164
|
get state(): Readonly<DialogState>;
|
|
81
|
-
subscribe(fn: Listener): () => void;
|
|
165
|
+
subscribe(fn: Listener$1): () => void;
|
|
82
166
|
show(options?: ShowOptions): void;
|
|
83
167
|
hide(): void;
|
|
84
168
|
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
@@ -102,6 +186,18 @@ declare class DialogController {
|
|
|
102
186
|
skipStep(key: string): void;
|
|
103
187
|
failStep(key: string): void;
|
|
104
188
|
clearSteps(): void;
|
|
189
|
+
form<TSchema extends {
|
|
190
|
+
_output: unknown;
|
|
191
|
+
safeParse: (data: unknown) => any;
|
|
192
|
+
_def: any;
|
|
193
|
+
}>(schema: TSchema, options?: FormOptions<TSchema['_output']>): Promise<TSchema['_output'] | null>;
|
|
194
|
+
updateFormField(key: string, value: unknown): void;
|
|
195
|
+
touchFormField(key: string): void;
|
|
196
|
+
showStepForm(steps: StepFormStepInput[], options?: StepFormOptions): Promise<Record<string, unknown> | null>;
|
|
197
|
+
onStepNext(): void;
|
|
198
|
+
onStepPrev(): void;
|
|
199
|
+
updateStepFormField(fieldKey: string, value: unknown): void;
|
|
200
|
+
touchStepFormField(fieldKey: string): void;
|
|
105
201
|
onConfirm(): void;
|
|
106
202
|
onCancel(): void;
|
|
107
203
|
onOutsideClick(): void;
|
|
@@ -129,7 +225,17 @@ declare class OverlayDialog extends LitElement {
|
|
|
129
225
|
private _renderQueueList;
|
|
130
226
|
private _renderStepsHeader;
|
|
131
227
|
private _renderStepsList;
|
|
228
|
+
private _createFormContext;
|
|
229
|
+
private _createStepFormContext;
|
|
230
|
+
private _getOrderedFields;
|
|
231
|
+
private _renderFormGrid;
|
|
232
|
+
private _renderGroupedForm;
|
|
233
|
+
private _renderForm;
|
|
234
|
+
private _renderFormField;
|
|
235
|
+
private _renderFormInput;
|
|
132
236
|
private _renderButtons;
|
|
237
|
+
private _renderStepFormButtons;
|
|
238
|
+
private _deriveStepItems;
|
|
133
239
|
private _renderBody;
|
|
134
240
|
render(): TemplateResult;
|
|
135
241
|
}
|
|
@@ -145,6 +251,16 @@ declare class DialogSingleton {
|
|
|
145
251
|
hide(): void;
|
|
146
252
|
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
147
253
|
confirm(optionsOrLabel: string | ConfirmOptions): Promise<boolean>;
|
|
254
|
+
form<TSchema extends {
|
|
255
|
+
_output: unknown;
|
|
256
|
+
safeParse: (data: unknown) => any;
|
|
257
|
+
_def: any;
|
|
258
|
+
}>(schema: TSchema, options?: FormOptions<TSchema['_output']>): Promise<TSchema['_output'] | null>;
|
|
259
|
+
showStepForm(steps: StepFormStepInput[], options?: StepFormOptions): Promise<Record<string, unknown> | null>;
|
|
260
|
+
onStepNext(): void;
|
|
261
|
+
onStepPrev(): void;
|
|
262
|
+
updateStepFormField(fieldKey: string, value: unknown): void;
|
|
263
|
+
touchStepFormField(fieldKey: string): void;
|
|
148
264
|
showLoading(label?: string): void;
|
|
149
265
|
setProgress(percent: number): void;
|
|
150
266
|
setLabel(label: string): void;
|
|
@@ -168,4 +284,108 @@ declare class DialogSingleton {
|
|
|
168
284
|
}
|
|
169
285
|
declare const dialog: DialogSingleton;
|
|
170
286
|
|
|
171
|
-
|
|
287
|
+
type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
288
|
+
type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
289
|
+
interface ToastAction {
|
|
290
|
+
label: string;
|
|
291
|
+
onClick: () => void;
|
|
292
|
+
}
|
|
293
|
+
interface ToastItem {
|
|
294
|
+
/** show() が返す一意な ID。dismiss(id) で使用 */
|
|
295
|
+
id: string;
|
|
296
|
+
/** アイコン・色を決定するビジュアルタイプ */
|
|
297
|
+
type: ToastType;
|
|
298
|
+
/** 主メッセージ */
|
|
299
|
+
message: string;
|
|
300
|
+
/** 補足説明 (省略可) */
|
|
301
|
+
description: string;
|
|
302
|
+
/** アクションボタン (省略可) */
|
|
303
|
+
action: ToastAction | null;
|
|
304
|
+
/** 自動非表示までの時間 (ms)。0 = 自動非表示なし */
|
|
305
|
+
duration: number;
|
|
306
|
+
/** 残り時間 (ms)。pause/resume で更新される */
|
|
307
|
+
remainingMs: number;
|
|
308
|
+
/** hover などで一時停止中かどうか */
|
|
309
|
+
paused: boolean;
|
|
310
|
+
/** 退出アニメーション再生中かどうか */
|
|
311
|
+
dismissing: boolean;
|
|
312
|
+
}
|
|
313
|
+
interface ToastOptions {
|
|
314
|
+
type?: ToastType;
|
|
315
|
+
message: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
action?: ToastAction;
|
|
318
|
+
/** 表示時間 (ms)。省略時は defaultDuration。0 = 永続表示 */
|
|
319
|
+
duration?: number;
|
|
320
|
+
}
|
|
321
|
+
interface ToastConfig {
|
|
322
|
+
position: ToastPosition;
|
|
323
|
+
maxVisible: number;
|
|
324
|
+
defaultDuration: number;
|
|
325
|
+
}
|
|
326
|
+
interface ToastState {
|
|
327
|
+
items: ToastItem[];
|
|
328
|
+
position: ToastPosition;
|
|
329
|
+
maxVisible: number;
|
|
330
|
+
defaultDuration: number;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
type Listener = (state: ToastState) => void;
|
|
334
|
+
declare class ToastController {
|
|
335
|
+
#private;
|
|
336
|
+
constructor();
|
|
337
|
+
get state(): Readonly<ToastState>;
|
|
338
|
+
subscribe(fn: Listener): () => void;
|
|
339
|
+
configure(config: Partial<ToastConfig>): void;
|
|
340
|
+
show(options: ToastOptions): string;
|
|
341
|
+
success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
342
|
+
error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
343
|
+
warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
344
|
+
info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
345
|
+
loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
346
|
+
dismiss(id: string): void;
|
|
347
|
+
dismissAll(): void;
|
|
348
|
+
update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
|
|
349
|
+
/** duration を変更する場合に指定。loading→非loading 遷移時は省略で defaultDuration を自動適用 */
|
|
350
|
+
duration?: number;
|
|
351
|
+
}): void;
|
|
352
|
+
pauseTimer(id: string): void;
|
|
353
|
+
resumeTimer(id: string): void;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare class ToastContainer extends LitElement {
|
|
357
|
+
static styles: lit.CSSResult;
|
|
358
|
+
controller: ToastController;
|
|
359
|
+
private _state;
|
|
360
|
+
private _unsubscribe?;
|
|
361
|
+
connectedCallback(): void;
|
|
362
|
+
disconnectedCallback(): void;
|
|
363
|
+
private _renderIcon;
|
|
364
|
+
private _renderToast;
|
|
365
|
+
render(): TemplateResult;
|
|
366
|
+
}
|
|
367
|
+
declare global {
|
|
368
|
+
interface HTMLElementTagNameMap {
|
|
369
|
+
'toast-container': ToastContainer;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class ToastSingleton {
|
|
374
|
+
#private;
|
|
375
|
+
configure(config: Partial<ToastConfig>): void;
|
|
376
|
+
show(options: ToastOptions): string;
|
|
377
|
+
success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
378
|
+
error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
379
|
+
warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
380
|
+
info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
381
|
+
loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
382
|
+
dismiss(id: string): void;
|
|
383
|
+
dismissAll(): void;
|
|
384
|
+
update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
|
|
385
|
+
duration?: number;
|
|
386
|
+
}): void;
|
|
387
|
+
get controller(): ToastController;
|
|
388
|
+
}
|
|
389
|
+
declare const toast: ToastSingleton;
|
|
390
|
+
|
|
391
|
+
export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, type ToastAction, type ToastConfig, ToastContainer, ToastController, type ToastItem, type ToastOptions, type ToastPosition, type ToastState, type ToastType, dialog, toast };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, TemplateResult } from 'lit';
|
|
3
3
|
|
|
4
|
-
type DialogType = 'loading' | 'alert' | 'confirm' | 'queue' | 'steps';
|
|
4
|
+
type DialogType = 'loading' | 'alert' | 'confirm' | 'queue' | 'steps' | 'form' | 'step-form';
|
|
5
5
|
type AlertIcon = 'success' | 'error' | 'warning' | 'info';
|
|
6
6
|
type QueueItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
7
7
|
type StepItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
@@ -19,6 +19,78 @@ type TaskItemInput = string | {
|
|
|
19
19
|
key: string;
|
|
20
20
|
label: string;
|
|
21
21
|
};
|
|
22
|
+
type FormInputType = 'text' | 'number' | 'checkbox' | 'select' | 'date' | 'email' | 'url';
|
|
23
|
+
interface FormFieldMeta {
|
|
24
|
+
key: string;
|
|
25
|
+
inputType: FormInputType;
|
|
26
|
+
label: string;
|
|
27
|
+
description: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
options: string[];
|
|
30
|
+
placeholder: string;
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
minLength?: number;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
defaultValue: unknown;
|
|
36
|
+
}
|
|
37
|
+
interface FormFieldGroup {
|
|
38
|
+
label?: string;
|
|
39
|
+
fields: string[];
|
|
40
|
+
columns?: number;
|
|
41
|
+
}
|
|
42
|
+
interface FormLayout {
|
|
43
|
+
columns?: number;
|
|
44
|
+
gap?: string;
|
|
45
|
+
fieldOrder?: string[];
|
|
46
|
+
groups?: FormFieldGroup[];
|
|
47
|
+
}
|
|
48
|
+
interface FormOptions<T = Record<string, unknown>> {
|
|
49
|
+
title?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
confirmButtonText?: string;
|
|
52
|
+
cancelButtonText?: string;
|
|
53
|
+
allowOutsideClick?: boolean;
|
|
54
|
+
allowEscapeKey?: boolean;
|
|
55
|
+
layout?: FormLayout;
|
|
56
|
+
defaultValues?: Partial<T>;
|
|
57
|
+
validateOnChange?: boolean;
|
|
58
|
+
validateOnBlur?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** フォームを持つ1ステップの描画状態 (コントローラー内部で管理) */
|
|
61
|
+
interface StepFormItem {
|
|
62
|
+
key: string;
|
|
63
|
+
label: string;
|
|
64
|
+
description: string;
|
|
65
|
+
fields: FormFieldMeta[];
|
|
66
|
+
values: Record<string, unknown>;
|
|
67
|
+
errors: Record<string, string>;
|
|
68
|
+
touched: Record<string, boolean>;
|
|
69
|
+
layout: FormLayout;
|
|
70
|
+
}
|
|
71
|
+
/** `showStepForm()` に渡す各ステップの定義 */
|
|
72
|
+
interface StepFormStepInput {
|
|
73
|
+
key: string;
|
|
74
|
+
label: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
/** Zod スキーマ。省略するとフォームなし (説明のみ) のステップになる */
|
|
77
|
+
schema?: {
|
|
78
|
+
_def: any;
|
|
79
|
+
safeParse: (data: unknown) => any;
|
|
80
|
+
};
|
|
81
|
+
layout?: FormLayout;
|
|
82
|
+
defaultValues?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
/** `showStepForm()` のオプション */
|
|
85
|
+
interface StepFormOptions {
|
|
86
|
+
title?: string;
|
|
87
|
+
allowOutsideClick?: boolean;
|
|
88
|
+
allowEscapeKey?: boolean;
|
|
89
|
+
nextButtonText?: string;
|
|
90
|
+
prevButtonText?: string;
|
|
91
|
+
submitButtonText?: string;
|
|
92
|
+
cancelButtonText?: string;
|
|
93
|
+
}
|
|
22
94
|
interface ShowOptions {
|
|
23
95
|
type: DialogType;
|
|
24
96
|
label?: string;
|
|
@@ -71,14 +143,26 @@ interface DialogState {
|
|
|
71
143
|
steps: StepItem[];
|
|
72
144
|
timer: number | null;
|
|
73
145
|
title: string;
|
|
146
|
+
formFields: FormFieldMeta[];
|
|
147
|
+
formValues: Record<string, unknown>;
|
|
148
|
+
formErrors: Record<string, string>;
|
|
149
|
+
formTouched: Record<string, boolean>;
|
|
150
|
+
formLayout: FormLayout;
|
|
151
|
+
formValidateOnChange: boolean;
|
|
152
|
+
formValidateOnBlur: boolean;
|
|
153
|
+
stepFormSteps: StepFormItem[];
|
|
154
|
+
stepFormCurrentIndex: number;
|
|
155
|
+
stepFormNextText: string;
|
|
156
|
+
stepFormPrevText: string;
|
|
157
|
+
stepFormSubmitText: string;
|
|
74
158
|
}
|
|
75
159
|
|
|
76
|
-
type Listener = (state: DialogState) => void;
|
|
160
|
+
type Listener$1 = (state: DialogState) => void;
|
|
77
161
|
declare class DialogController {
|
|
78
162
|
#private;
|
|
79
163
|
constructor();
|
|
80
164
|
get state(): Readonly<DialogState>;
|
|
81
|
-
subscribe(fn: Listener): () => void;
|
|
165
|
+
subscribe(fn: Listener$1): () => void;
|
|
82
166
|
show(options?: ShowOptions): void;
|
|
83
167
|
hide(): void;
|
|
84
168
|
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
@@ -102,6 +186,18 @@ declare class DialogController {
|
|
|
102
186
|
skipStep(key: string): void;
|
|
103
187
|
failStep(key: string): void;
|
|
104
188
|
clearSteps(): void;
|
|
189
|
+
form<TSchema extends {
|
|
190
|
+
_output: unknown;
|
|
191
|
+
safeParse: (data: unknown) => any;
|
|
192
|
+
_def: any;
|
|
193
|
+
}>(schema: TSchema, options?: FormOptions<TSchema['_output']>): Promise<TSchema['_output'] | null>;
|
|
194
|
+
updateFormField(key: string, value: unknown): void;
|
|
195
|
+
touchFormField(key: string): void;
|
|
196
|
+
showStepForm(steps: StepFormStepInput[], options?: StepFormOptions): Promise<Record<string, unknown> | null>;
|
|
197
|
+
onStepNext(): void;
|
|
198
|
+
onStepPrev(): void;
|
|
199
|
+
updateStepFormField(fieldKey: string, value: unknown): void;
|
|
200
|
+
touchStepFormField(fieldKey: string): void;
|
|
105
201
|
onConfirm(): void;
|
|
106
202
|
onCancel(): void;
|
|
107
203
|
onOutsideClick(): void;
|
|
@@ -129,7 +225,17 @@ declare class OverlayDialog extends LitElement {
|
|
|
129
225
|
private _renderQueueList;
|
|
130
226
|
private _renderStepsHeader;
|
|
131
227
|
private _renderStepsList;
|
|
228
|
+
private _createFormContext;
|
|
229
|
+
private _createStepFormContext;
|
|
230
|
+
private _getOrderedFields;
|
|
231
|
+
private _renderFormGrid;
|
|
232
|
+
private _renderGroupedForm;
|
|
233
|
+
private _renderForm;
|
|
234
|
+
private _renderFormField;
|
|
235
|
+
private _renderFormInput;
|
|
132
236
|
private _renderButtons;
|
|
237
|
+
private _renderStepFormButtons;
|
|
238
|
+
private _deriveStepItems;
|
|
133
239
|
private _renderBody;
|
|
134
240
|
render(): TemplateResult;
|
|
135
241
|
}
|
|
@@ -145,6 +251,16 @@ declare class DialogSingleton {
|
|
|
145
251
|
hide(): void;
|
|
146
252
|
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
147
253
|
confirm(optionsOrLabel: string | ConfirmOptions): Promise<boolean>;
|
|
254
|
+
form<TSchema extends {
|
|
255
|
+
_output: unknown;
|
|
256
|
+
safeParse: (data: unknown) => any;
|
|
257
|
+
_def: any;
|
|
258
|
+
}>(schema: TSchema, options?: FormOptions<TSchema['_output']>): Promise<TSchema['_output'] | null>;
|
|
259
|
+
showStepForm(steps: StepFormStepInput[], options?: StepFormOptions): Promise<Record<string, unknown> | null>;
|
|
260
|
+
onStepNext(): void;
|
|
261
|
+
onStepPrev(): void;
|
|
262
|
+
updateStepFormField(fieldKey: string, value: unknown): void;
|
|
263
|
+
touchStepFormField(fieldKey: string): void;
|
|
148
264
|
showLoading(label?: string): void;
|
|
149
265
|
setProgress(percent: number): void;
|
|
150
266
|
setLabel(label: string): void;
|
|
@@ -168,4 +284,108 @@ declare class DialogSingleton {
|
|
|
168
284
|
}
|
|
169
285
|
declare const dialog: DialogSingleton;
|
|
170
286
|
|
|
171
|
-
|
|
287
|
+
type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
288
|
+
type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
289
|
+
interface ToastAction {
|
|
290
|
+
label: string;
|
|
291
|
+
onClick: () => void;
|
|
292
|
+
}
|
|
293
|
+
interface ToastItem {
|
|
294
|
+
/** show() が返す一意な ID。dismiss(id) で使用 */
|
|
295
|
+
id: string;
|
|
296
|
+
/** アイコン・色を決定するビジュアルタイプ */
|
|
297
|
+
type: ToastType;
|
|
298
|
+
/** 主メッセージ */
|
|
299
|
+
message: string;
|
|
300
|
+
/** 補足説明 (省略可) */
|
|
301
|
+
description: string;
|
|
302
|
+
/** アクションボタン (省略可) */
|
|
303
|
+
action: ToastAction | null;
|
|
304
|
+
/** 自動非表示までの時間 (ms)。0 = 自動非表示なし */
|
|
305
|
+
duration: number;
|
|
306
|
+
/** 残り時間 (ms)。pause/resume で更新される */
|
|
307
|
+
remainingMs: number;
|
|
308
|
+
/** hover などで一時停止中かどうか */
|
|
309
|
+
paused: boolean;
|
|
310
|
+
/** 退出アニメーション再生中かどうか */
|
|
311
|
+
dismissing: boolean;
|
|
312
|
+
}
|
|
313
|
+
interface ToastOptions {
|
|
314
|
+
type?: ToastType;
|
|
315
|
+
message: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
action?: ToastAction;
|
|
318
|
+
/** 表示時間 (ms)。省略時は defaultDuration。0 = 永続表示 */
|
|
319
|
+
duration?: number;
|
|
320
|
+
}
|
|
321
|
+
interface ToastConfig {
|
|
322
|
+
position: ToastPosition;
|
|
323
|
+
maxVisible: number;
|
|
324
|
+
defaultDuration: number;
|
|
325
|
+
}
|
|
326
|
+
interface ToastState {
|
|
327
|
+
items: ToastItem[];
|
|
328
|
+
position: ToastPosition;
|
|
329
|
+
maxVisible: number;
|
|
330
|
+
defaultDuration: number;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
type Listener = (state: ToastState) => void;
|
|
334
|
+
declare class ToastController {
|
|
335
|
+
#private;
|
|
336
|
+
constructor();
|
|
337
|
+
get state(): Readonly<ToastState>;
|
|
338
|
+
subscribe(fn: Listener): () => void;
|
|
339
|
+
configure(config: Partial<ToastConfig>): void;
|
|
340
|
+
show(options: ToastOptions): string;
|
|
341
|
+
success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
342
|
+
error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
343
|
+
warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
344
|
+
info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
345
|
+
loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
346
|
+
dismiss(id: string): void;
|
|
347
|
+
dismissAll(): void;
|
|
348
|
+
update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
|
|
349
|
+
/** duration を変更する場合に指定。loading→非loading 遷移時は省略で defaultDuration を自動適用 */
|
|
350
|
+
duration?: number;
|
|
351
|
+
}): void;
|
|
352
|
+
pauseTimer(id: string): void;
|
|
353
|
+
resumeTimer(id: string): void;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare class ToastContainer extends LitElement {
|
|
357
|
+
static styles: lit.CSSResult;
|
|
358
|
+
controller: ToastController;
|
|
359
|
+
private _state;
|
|
360
|
+
private _unsubscribe?;
|
|
361
|
+
connectedCallback(): void;
|
|
362
|
+
disconnectedCallback(): void;
|
|
363
|
+
private _renderIcon;
|
|
364
|
+
private _renderToast;
|
|
365
|
+
render(): TemplateResult;
|
|
366
|
+
}
|
|
367
|
+
declare global {
|
|
368
|
+
interface HTMLElementTagNameMap {
|
|
369
|
+
'toast-container': ToastContainer;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class ToastSingleton {
|
|
374
|
+
#private;
|
|
375
|
+
configure(config: Partial<ToastConfig>): void;
|
|
376
|
+
show(options: ToastOptions): string;
|
|
377
|
+
success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
378
|
+
error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
379
|
+
warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
380
|
+
info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
381
|
+
loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
|
|
382
|
+
dismiss(id: string): void;
|
|
383
|
+
dismissAll(): void;
|
|
384
|
+
update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
|
|
385
|
+
duration?: number;
|
|
386
|
+
}): void;
|
|
387
|
+
get controller(): ToastController;
|
|
388
|
+
}
|
|
389
|
+
declare const toast: ToastSingleton;
|
|
390
|
+
|
|
391
|
+
export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, type ToastAction, type ToastConfig, ToastContainer, ToastController, type ToastItem, type ToastOptions, type ToastPosition, type ToastState, type ToastType, dialog, toast };
|