@konomi-app/ui 3.0.0 → 4.0.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 +1059 -638
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -116
- package/dist/index.d.ts +147 -116
- package/dist/index.js +1059 -633
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,128 +1,159 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
3
|
+
|
|
4
|
+
type DialogType = 'loading' | 'alert' | 'confirm' | 'queue' | 'steps';
|
|
5
|
+
type AlertIcon = 'success' | 'error' | 'warning' | 'info';
|
|
6
|
+
type QueueItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
7
|
+
type StepItemStatus = 'pending' | 'active' | 'done' | 'skipped' | 'error';
|
|
8
|
+
interface QueueItem {
|
|
9
|
+
label: string;
|
|
10
|
+
status: QueueItemStatus;
|
|
11
|
+
}
|
|
12
|
+
interface StepItem {
|
|
13
|
+
label: string;
|
|
14
|
+
status: StepItemStatus;
|
|
15
|
+
}
|
|
16
|
+
interface ShowOptions {
|
|
17
|
+
type: DialogType;
|
|
18
|
+
label?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
icon?: AlertIcon;
|
|
21
|
+
progress?: number;
|
|
22
|
+
allowOutsideClick?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface AlertOptions {
|
|
25
|
+
type?: AlertIcon;
|
|
26
|
+
label?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
html?: string;
|
|
29
|
+
showCancelButton?: boolean;
|
|
30
|
+
confirmButtonText?: string;
|
|
31
|
+
cancelButtonText?: string;
|
|
32
|
+
allowOutsideClick?: boolean;
|
|
33
|
+
allowEscapeKey?: boolean;
|
|
34
|
+
timer?: number;
|
|
35
|
+
}
|
|
36
|
+
interface ConfirmOptions {
|
|
37
|
+
label?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
type?: AlertIcon;
|
|
40
|
+
confirmButtonText?: string;
|
|
41
|
+
cancelButtonText?: string;
|
|
42
|
+
allowOutsideClick?: boolean;
|
|
43
|
+
allowEscapeKey?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface DialogResult {
|
|
46
|
+
isConfirmed: boolean;
|
|
47
|
+
isCanceled: boolean;
|
|
48
|
+
isDismissed: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface DialogState {
|
|
51
|
+
open: boolean;
|
|
52
|
+
dialogType: DialogType;
|
|
53
|
+
icon: AlertIcon | null;
|
|
54
|
+
label: string;
|
|
55
|
+
description: string;
|
|
56
|
+
html: string;
|
|
57
|
+
progress: number | null;
|
|
58
|
+
showConfirmButton: boolean;
|
|
59
|
+
showCancelButton: boolean;
|
|
60
|
+
confirmButtonText: string;
|
|
61
|
+
cancelButtonText: string;
|
|
62
|
+
allowOutsideClick: boolean;
|
|
63
|
+
allowEscapeKey: boolean;
|
|
64
|
+
queues: QueueItem[];
|
|
65
|
+
steps: StepItem[];
|
|
66
|
+
timer: number | null;
|
|
26
67
|
}
|
|
27
68
|
|
|
28
|
-
type
|
|
29
|
-
|
|
30
|
-
label: Label$2;
|
|
31
|
-
progress: number;
|
|
32
|
-
}>>;
|
|
33
|
-
declare const ATTRIBUTE_ANIMATION = "data-animation";
|
|
34
|
-
declare class LoadingOverlay extends Overlay {
|
|
69
|
+
type Listener = (state: DialogState) => void;
|
|
70
|
+
declare class DialogController {
|
|
35
71
|
#private;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
show(): void;
|
|
72
|
+
constructor();
|
|
73
|
+
get state(): Readonly<DialogState>;
|
|
74
|
+
subscribe(fn: Listener): () => void;
|
|
75
|
+
show(options?: ShowOptions): void;
|
|
41
76
|
hide(): void;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
77
|
+
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
78
|
+
confirm(optionsOrLabel: string | ConfirmOptions): Promise<boolean>;
|
|
79
|
+
loading(label?: string): void;
|
|
80
|
+
progress(percent: number): void;
|
|
81
|
+
label(label: string): void;
|
|
82
|
+
description(description: string): void;
|
|
83
|
+
setQueues(labels: string[]): void;
|
|
84
|
+
queue(labels: string[]): void;
|
|
85
|
+
startQueue(label: string): void;
|
|
86
|
+
finishQueue(label: string): void;
|
|
87
|
+
skipQueue(label: string): void;
|
|
88
|
+
errorQueue(label: string): void;
|
|
89
|
+
clearQueues(): void;
|
|
90
|
+
setSteps(labels: string[]): void;
|
|
91
|
+
steps(labels: string[]): void;
|
|
92
|
+
startStep(label: string): void;
|
|
93
|
+
finishStep(label: string): void;
|
|
94
|
+
skipStep(label: string): void;
|
|
95
|
+
errorStep(label: string): void;
|
|
96
|
+
clearSteps(): void;
|
|
97
|
+
onConfirm(): void;
|
|
98
|
+
onCancel(): void;
|
|
99
|
+
onOutsideClick(): void;
|
|
100
|
+
onEscapeKey(): void;
|
|
50
101
|
}
|
|
51
102
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
private contentStyle;
|
|
79
|
-
private taskListContainerStyle;
|
|
80
|
-
private taskContainerStyle;
|
|
81
|
-
private taskLabelStyle;
|
|
82
|
-
private taskStatusStyle;
|
|
103
|
+
declare class OverlayDialog extends LitElement {
|
|
104
|
+
static styles: lit.CSSResult;
|
|
105
|
+
controller: DialogController;
|
|
106
|
+
private _state;
|
|
107
|
+
private _unsubscribe?;
|
|
108
|
+
private _beforeUnloadHandler;
|
|
109
|
+
connectedCallback(): void;
|
|
110
|
+
disconnectedCallback(): void;
|
|
111
|
+
private _syncBodyScroll;
|
|
112
|
+
private _onBackdropClick;
|
|
113
|
+
private _onKeyDown;
|
|
114
|
+
private _renderIcon;
|
|
115
|
+
private _renderSpinner;
|
|
116
|
+
private _renderTaskIcon;
|
|
117
|
+
private _getQueueWindow;
|
|
118
|
+
private _renderQueueList;
|
|
119
|
+
private _renderStepsHeader;
|
|
120
|
+
private _renderStepsList;
|
|
121
|
+
private _renderButtons;
|
|
122
|
+
private _renderBody;
|
|
123
|
+
render(): TemplateResult;
|
|
124
|
+
}
|
|
125
|
+
declare global {
|
|
126
|
+
interface HTMLElementTagNameMap {
|
|
127
|
+
'overlay-dialog': OverlayDialog;
|
|
128
|
+
}
|
|
83
129
|
}
|
|
84
130
|
|
|
85
|
-
|
|
86
|
-
type ConstructorProps = Readonly<Partial<{
|
|
87
|
-
label: Label;
|
|
88
|
-
progress: number;
|
|
89
|
-
}>>;
|
|
90
|
-
declare class Modal extends Overlay {
|
|
131
|
+
declare class DialogSingleton {
|
|
91
132
|
#private;
|
|
92
|
-
|
|
93
|
-
protected readonly _iconElement: HTMLDivElement;
|
|
94
|
-
protected readonly _titleElement: HTMLDivElement;
|
|
95
|
-
protected readonly _loaderElement: HTMLDivElement;
|
|
96
|
-
protected readonly _progressElement: HTMLDivElement;
|
|
97
|
-
protected readonly _contentElement: HTMLDivElement;
|
|
98
|
-
protected readonly _actionsElement: HTMLDivElement;
|
|
99
|
-
protected readonly _okButtonElement: HTMLButtonElement;
|
|
100
|
-
protected readonly _cancelButtonElement: HTMLButtonElement;
|
|
101
|
-
constructor(props?: ConstructorProps);
|
|
102
|
-
alert(params: {
|
|
103
|
-
title?: string;
|
|
104
|
-
text?: string;
|
|
105
|
-
icon?: string;
|
|
106
|
-
disableClose?: boolean;
|
|
107
|
-
disableEscape?: boolean;
|
|
108
|
-
}): Promise<any>;
|
|
109
|
-
loading(): void;
|
|
133
|
+
show(options?: ShowOptions): void;
|
|
110
134
|
hide(): void;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
|
|
136
|
+
confirm(optionsOrLabel: string | ConfirmOptions): Promise<boolean>;
|
|
137
|
+
loading(label?: string): void;
|
|
138
|
+
progress(percent: number): void;
|
|
139
|
+
label(label: string): void;
|
|
140
|
+
description(description: string): void;
|
|
141
|
+
setQueues(labels: string[]): void;
|
|
142
|
+
queue(labels: string[]): void;
|
|
143
|
+
startQueue(label: string): void;
|
|
144
|
+
finishQueue(label: string): void;
|
|
145
|
+
skipQueue(label: string): void;
|
|
146
|
+
errorQueue(label: string): void;
|
|
147
|
+
clearQueues(): void;
|
|
148
|
+
setSteps(labels: string[]): void;
|
|
149
|
+
steps(labels: string[]): void;
|
|
150
|
+
startStep(label: string): void;
|
|
151
|
+
finishStep(label: string): void;
|
|
152
|
+
skipStep(label: string): void;
|
|
153
|
+
errorStep(label: string): void;
|
|
154
|
+
clearSteps(): void;
|
|
155
|
+
get controller(): DialogController;
|
|
116
156
|
}
|
|
157
|
+
declare const dialog: DialogSingleton;
|
|
117
158
|
|
|
118
|
-
|
|
119
|
-
* 指定された関数をラップし、実行中にローディングオーバーレイを表示する高階関数。
|
|
120
|
-
*
|
|
121
|
-
* @template T - 任意の引数を取り、任意の値を返す関数の型。
|
|
122
|
-
* @param {T} fn - 実行する関数。
|
|
123
|
-
* @param {string} [label='Loading...'] - ローディングオーバーレイに表示するラベル。デフォルトは 'Loading...'。
|
|
124
|
-
* @returns {(...args: Parameters<T>) => Promise<ReturnType<T>>} - ラップされた関数。実行中にローディングオーバーレイを表示し、完了後に非表示にする。
|
|
125
|
-
*/
|
|
126
|
-
declare const withLoading: <T extends (...args: any[]) => any>(fn: T, label?: string) => (...args: Parameters<T>) => Promise<ReturnType<T>>;
|
|
127
|
-
|
|
128
|
-
export { ATTRIBUTE_ANIMATION, LoadingOverlay, Modal, TaskListOverlay, withLoading };
|
|
159
|
+
export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepItem, type StepItemStatus, dialog };
|