@cloudparker/moldex.js 0.0.28 → 0.0.30
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/services/dialog/dialog-service.d.ts +16 -0
- package/dist/services/dialog/dialog-service.js +23 -1
- package/dist/services/utils/utils-service.d.ts +3 -0
- package/dist/services/utils/utils-service.js +26 -0
- package/dist/tailwind.css +1 -1
- package/dist/views/core/button/components/button/button.svelte +57 -34
- package/dist/views/core/button/components/button/button.svelte.d.ts +19 -18
- package/dist/views/core/button/components/button-back/button-back.svelte +44 -0
- package/dist/views/core/button/components/button-back/button-back.svelte.d.ts +24 -0
- package/dist/views/core/button/components/button-close/button-close.svelte +7 -0
- package/dist/views/core/button/components/button-close/button-close.svelte.d.ts +19 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +47 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte.d.ts +25 -0
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +94 -42
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte.d.ts +11 -11
- package/dist/views/core/button/components/button-menu/button-menu.svelte +155 -103
- package/dist/views/core/button/components/button-menu/button-menu.svelte.d.ts +7 -7
- package/dist/views/core/button/components/button-ok/button-ok.svelte +7 -0
- package/dist/views/core/button/components/button-ok/button-ok.svelte.d.ts +19 -0
- package/dist/views/core/button/index.d.ts +5 -1
- package/dist/views/core/button/index.js +10 -1
- package/dist/views/core/dialog/components/dialog/dialog.svelte +328 -231
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +6 -10
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +189 -0
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte.d.ts +41 -0
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +22 -13
- package/dist/views/core/dialog/index.d.ts +4 -2
- package/dist/views/core/dialog/index.js +2 -2
- package/dist/views/core/drawer/components/drawer/drawer.svelte +52 -34
- package/dist/views/core/icon/components/icon/icon.svelte +25 -12
- package/dist/views/core/icon/components/icon/icon.svelte.d.ts +1 -0
- package/dist/views/core/icon/services/icon-path-service.d.ts +6 -0
- package/dist/views/core/icon/services/icon-path-service.js +6 -0
- package/dist/views/core/index.d.ts +2 -0
- package/dist/views/core/index.js +2 -0
- package/dist/views/core/input/components/color-field/color-field.svelte +114 -0
- package/dist/views/core/input/components/color-field/color-field.svelte.d.ts +23 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +467 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +63 -0
- package/dist/views/core/input/components/date-field/date-field.svelte +13 -0
- package/dist/views/core/input/components/date-field/date-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +13 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/email-field/email-field.svelte +12 -0
- package/dist/views/core/input/components/email-field/email-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/file-field/file-field.svelte +92 -0
- package/dist/views/core/input/components/file-field/file-field.svelte.d.ts +25 -0
- package/dist/views/core/input/components/input-field/input-field.svelte +382 -0
- package/dist/views/core/{form → input}/components/input-field/input-field.svelte.d.ts +51 -35
- package/dist/views/core/input/components/label/label.svelte +46 -0
- package/dist/views/core/input/components/number-field/number-field.svelte +13 -0
- package/dist/views/core/input/components/number-field/number-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/password-field/password-field.svelte +83 -0
- package/dist/views/core/input/components/password-field/password-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte +90 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/range-field/range-field.svelte +72 -0
- package/dist/views/core/input/components/range-field/range-field.svelte.d.ts +31 -0
- package/dist/views/core/input/components/search-field/search-field.svelte +67 -0
- package/dist/views/core/input/components/search-field/search-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/text-field/text-field.svelte +12 -0
- package/dist/views/core/input/components/text-field/text-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +12 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/time-field/time-field.svelte +12 -0
- package/dist/views/core/input/components/time-field/time-field.svelte.d.ts +21 -0
- package/dist/views/core/input/index.d.ts +19 -0
- package/dist/views/core/input/index.js +19 -0
- package/dist/views/core/navbar/components/navbar/navbar.svelte +71 -39
- package/dist/views/core/navbar/components/navbar/navbar.svelte.d.ts +3 -3
- package/dist/views/core/no-data/components/no-data/no-data.svelte +51 -0
- package/dist/views/core/no-data/components/no-data/no-data.svelte.d.ts +27 -0
- package/dist/views/core/no-data/index.d.ts +2 -0
- package/dist/views/core/no-data/index.js +2 -0
- package/dist/views/core/pagination/components/pagination/pagination.svelte +100 -71
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +37 -23
- package/dist/views/core/referrer/components/referrer.svelte +15 -13
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +6 -2
- package/dist/views/core/screen-detector/components/screen-detector.svelte +13 -9
- package/dist/views/core/spinner/components/spinner/spinner.svelte +7 -2
- package/dist/views/core/text/components/text-await/text-await.svelte +8 -2
- package/dist/views/core/text/components/text-copy/text-copy.svelte +28 -17
- package/dist/views/core/text/components/text-country/text-country.svelte +42 -29
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +38 -30
- package/dist/views/core/text/components/text-currency/text-currency.svelte +21 -10
- package/dist/views/core/text/components/text-date/text-date.svelte +33 -21
- package/dist/views/core/text/components/text-email/text-email.svelte +13 -4
- package/dist/views/core/text/components/text-html/text-html.svelte +3 -2
- package/dist/views/core/text/components/text-phone/text-phone.svelte +13 -4
- package/dist/views/core/toast/components/toast/toast.svelte +44 -21
- package/package.json +2 -2
- package/dist/views/core/form/components/input-field/input-field.svelte +0 -233
- package/dist/views/core/form/components/label/label.svelte +0 -32
- package/dist/views/core/form/index.d.ts +0 -3
- package/dist/views/core/form/index.js +0 -3
- /package/dist/views/core/{form → input}/components/label/label.svelte.d.ts +0 -0
|
@@ -1,156 +1,250 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import ButtonBack from '../../../button/components/button-back/button-back.svelte';
|
|
3
|
+
import ButtonClose from '../../../button/components/button-close-icon/button-close-icon.svelte';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Return a Promise<boolean> value, whic=h will indiacate dialog to close or not.
|
|
7
|
+
* false -> Dont close Dialog
|
|
8
|
+
* true -> Close dialog
|
|
9
|
+
*/
|
|
10
|
+
export type DialogCloseButtonClickType = (ev: MouseEvent | TouchEvent) => Promise<boolean>;
|
|
11
|
+
|
|
12
|
+
export type DialogSizeType = 'sm' | 'md' | 'lg' | 'full';
|
|
13
|
+
|
|
14
|
+
export type DialogPropsType = {
|
|
15
|
+
id?: string;
|
|
16
|
+
cancelable?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
containerClassName?: string;
|
|
19
|
+
backdropClassName?: string;
|
|
20
|
+
hasTitle?: boolean;
|
|
21
|
+
hasSubtitle?: boolean;
|
|
22
|
+
title?: string;
|
|
23
|
+
subtitle?: string;
|
|
24
|
+
titleClassName?: string;
|
|
25
|
+
subtitleClassName?: string;
|
|
26
|
+
hasHeader?: boolean;
|
|
27
|
+
hasHeaderShadow?: boolean;
|
|
28
|
+
headerClassName?: string;
|
|
29
|
+
hasHeaderClose?: boolean;
|
|
30
|
+
headerCloseButtonClassName?: string;
|
|
31
|
+
headerCloseIconPath?: string;
|
|
32
|
+
headerCloseIconClassName?: string;
|
|
33
|
+
hasHeaderBack?: boolean;
|
|
34
|
+
headerBackButtonClassName?: string;
|
|
35
|
+
headerBackIconPath?: string;
|
|
36
|
+
headerBackIconClassName?: string;
|
|
37
|
+
hasFooter?: boolean;
|
|
38
|
+
hasFooterShadow?: boolean;
|
|
39
|
+
hasFooterCloseButton?: boolean;
|
|
40
|
+
hasFooterOkButton?: boolean;
|
|
41
|
+
footerClassName?: string;
|
|
42
|
+
footerCloseLabel?: string;
|
|
43
|
+
footerCloseButtonClassName?: string;
|
|
44
|
+
footerOkLable?: string;
|
|
45
|
+
footerOkButtonClassName?: string;
|
|
46
|
+
footerOkButtonType?: 'button' | 'submit' | 'reset';
|
|
47
|
+
footerOkButtonSpinner?: boolean;
|
|
48
|
+
footerOkButtonDisabled?: boolean;
|
|
49
|
+
submitButtonFormId?: string;
|
|
50
|
+
bodyClassName?: string;
|
|
51
|
+
bodyComponent?: any;
|
|
52
|
+
component?: any;
|
|
53
|
+
props?: any;
|
|
54
|
+
size?: DialogSizeType;
|
|
55
|
+
children?: Snippet;
|
|
56
|
+
headerSnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
57
|
+
bodySnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
58
|
+
footerSnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
59
|
+
onClose?: () => void;
|
|
60
|
+
onResult?: (value: any) => void;
|
|
61
|
+
onOkClick?: (ev: MouseEvent | TouchEvent, options: DialogExportsType) => void;
|
|
62
|
+
onCloseClick?: DialogCloseButtonClickType;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type DialogExportsType = {
|
|
66
|
+
closeDialog: () => void;
|
|
67
|
+
setResult: (value: any) => void;
|
|
68
|
+
setOkSpinner: (value: boolean) => void;
|
|
69
|
+
setOkDisabled: (value: boolean) => void;
|
|
70
|
+
setOnOkClick: (onclick: (ev: MouseEvent | TouchEvent) => void) => void;
|
|
71
|
+
setOnCloseClick: (onclick: DialogCloseButtonClickType) => void;
|
|
72
|
+
};
|
|
8
73
|
</script>
|
|
9
74
|
|
|
10
|
-
<script lang="ts">
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
let
|
|
77
|
-
let
|
|
78
|
-
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
export function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
75
|
+
<script lang="ts">
|
|
76
|
+
import Button from '../../../button/components/button/button.svelte';
|
|
77
|
+
import { type Component as ComponetType, type Snippet } from 'svelte';
|
|
78
|
+
import '../../../../../tailwind.css';
|
|
79
|
+
import { mdiArrowLeft, mdiClose } from '../../../icon';
|
|
80
|
+
|
|
81
|
+
let {
|
|
82
|
+
id = '',
|
|
83
|
+
cancelable = true,
|
|
84
|
+
className = '',
|
|
85
|
+
containerClassName = '',
|
|
86
|
+
backdropClassName = '',
|
|
87
|
+
hasHeaderShadow = false,
|
|
88
|
+
hasTitle = false,
|
|
89
|
+
hasSubtitle = false,
|
|
90
|
+
title = '',
|
|
91
|
+
subtitle = '',
|
|
92
|
+
titleClassName = '',
|
|
93
|
+
subtitleClassName = '',
|
|
94
|
+
hasHeader = false,
|
|
95
|
+
headerClassName = '',
|
|
96
|
+
hasHeaderClose = false,
|
|
97
|
+
headerCloseButtonClassName = '',
|
|
98
|
+
headerCloseIconPath = mdiClose,
|
|
99
|
+
headerCloseIconClassName = '',
|
|
100
|
+
hasHeaderBack = false,
|
|
101
|
+
headerBackButtonClassName = '',
|
|
102
|
+
headerBackIconPath = mdiArrowLeft,
|
|
103
|
+
headerBackIconClassName = '',
|
|
104
|
+
hasFooter = false,
|
|
105
|
+
hasFooterShadow = false,
|
|
106
|
+
hasFooterCloseButton = false,
|
|
107
|
+
hasFooterOkButton = false,
|
|
108
|
+
footerClassName = '',
|
|
109
|
+
footerCloseLabel = 'Close',
|
|
110
|
+
footerCloseButtonClassName = '',
|
|
111
|
+
footerOkLable = 'Save',
|
|
112
|
+
footerOkButtonClassName = '',
|
|
113
|
+
footerOkButtonType = 'button',
|
|
114
|
+
footerOkButtonSpinner = false,
|
|
115
|
+
footerOkButtonDisabled = false,
|
|
116
|
+
submitButtonFormId = undefined,
|
|
117
|
+
size = 'sm',
|
|
118
|
+
bodyClassName = '',
|
|
119
|
+
bodyComponent,
|
|
120
|
+
component,
|
|
121
|
+
props = {},
|
|
122
|
+
children,
|
|
123
|
+
headerSnippet,
|
|
124
|
+
bodySnippet,
|
|
125
|
+
footerSnippet,
|
|
126
|
+
onClose,
|
|
127
|
+
onResult,
|
|
128
|
+
onOkClick,
|
|
129
|
+
onCloseClick
|
|
130
|
+
}: DialogPropsType = $props();
|
|
131
|
+
|
|
132
|
+
let dialogExports: DialogExportsType = {
|
|
133
|
+
closeDialog,
|
|
134
|
+
setResult,
|
|
135
|
+
setOkSpinner,
|
|
136
|
+
setOkDisabled,
|
|
137
|
+
setOnCloseClick,
|
|
138
|
+
setOnOkClick
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
let isPlaced: boolean = $state(false);
|
|
142
|
+
let isOpened: boolean = $state(false);
|
|
143
|
+
|
|
144
|
+
let CustomComponent: ComponetType | null = $state(null);
|
|
145
|
+
|
|
146
|
+
let BodyComponent: ComponetType | null = $state(null);
|
|
147
|
+
|
|
148
|
+
let result: any;
|
|
149
|
+
|
|
150
|
+
let smSizeClassName = 'w-11/12 sm:w-3/4 md:w-1/2 lg:w-1/3 xl:w-1/4';
|
|
151
|
+
let mdSizeClassName = 'w-11/12 sm:w-3/4 md:w-2/3 lg:w-1/2 xl:w-1/3';
|
|
152
|
+
let lgSizeClassName = 'w-11/12 sm:w-3/4 md:w-3/4 lg:w-2/3 xl:w-1/2';
|
|
153
|
+
let fullSizeClassName = 'fixed inset-0 w-screen h-screen ';
|
|
154
|
+
|
|
155
|
+
let screenSizeClassNameMap: { [key: string]: string } = {
|
|
156
|
+
sm: smSizeClassName,
|
|
157
|
+
md: mdSizeClassName,
|
|
158
|
+
lg: lgSizeClassName,
|
|
159
|
+
full: fullSizeClassName
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export function toggleDialog() {
|
|
163
|
+
if (isOpened) {
|
|
164
|
+
closeDialog();
|
|
165
|
+
} else {
|
|
166
|
+
openDialog();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function openDialog() {
|
|
171
|
+
isPlaced = true;
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
isOpened = true;
|
|
174
|
+
}, 0);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function closeDialog(value?: any): Promise<any> {
|
|
178
|
+
return new Promise((resolve) => {
|
|
179
|
+
isOpened = false;
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
isPlaced = false;
|
|
182
|
+
onClose && onClose();
|
|
183
|
+
onResult && onResult(result || value);
|
|
184
|
+
resolve(result);
|
|
185
|
+
}, 300);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function setResult(value: any) {
|
|
190
|
+
result = value;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function setOkDisabled(value: boolean) {
|
|
194
|
+
footerOkButtonDisabled = value;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function setOkSpinner(value: boolean) {
|
|
198
|
+
footerOkButtonSpinner = value;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function setOnOkClick(
|
|
202
|
+
onclick: (event: MouseEvent | TouchEvent, options: DialogExportsType) => void
|
|
203
|
+
) {
|
|
204
|
+
onOkClick = onclick;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function setOnCloseClick(onclick: DialogCloseButtonClickType) {
|
|
208
|
+
onCloseClick = onclick;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function handleBackdropClick() {
|
|
212
|
+
if (cancelable) {
|
|
213
|
+
closeDialog();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function handleClose(ev: MouseEvent | TouchEvent) {
|
|
218
|
+
if (onCloseClick) {
|
|
219
|
+
if (await onCloseClick(ev)) {
|
|
220
|
+
closeDialog();
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
closeDialog();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
228
|
+
if (event.key === 'Escape' || event.key === 'Esc') {
|
|
229
|
+
if (cancelable) {
|
|
230
|
+
event.stopPropagation();
|
|
231
|
+
closeDialog();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function handleOkClick(event: MouseEvent | TouchEvent) {
|
|
237
|
+
if (onOkClick) {
|
|
238
|
+
onOkClick(event, dialogExports);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
$effect(() => {
|
|
243
|
+
BodyComponent = bodyComponent;
|
|
244
|
+
});
|
|
245
|
+
$effect(() => {
|
|
246
|
+
CustomComponent = component;
|
|
247
|
+
});
|
|
154
248
|
</script>
|
|
155
249
|
|
|
156
250
|
{#snippet dialogContent()}
|
|
@@ -167,93 +261,96 @@ $effect(() => {
|
|
|
167
261
|
: 'rounded-lg shadow-xl'} {className}"
|
|
168
262
|
onclick={(ev: MouseEvent) => ev.stopPropagation()}
|
|
169
263
|
>
|
|
170
|
-
{#if
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
264
|
+
{#if CustomComponent?.length == 2}
|
|
265
|
+
<CustomComponent {...{ ...props }} {...{ ...dialogExports }} />
|
|
266
|
+
{:else}
|
|
267
|
+
{#if hasHeader}
|
|
268
|
+
<div
|
|
269
|
+
class="flex items-start gap-4 w-full cursor-default py-2 {hasHeaderShadow
|
|
270
|
+
? 'border-b shadow-sm'
|
|
271
|
+
: ''} {headerClassName}"
|
|
272
|
+
>
|
|
273
|
+
<div>
|
|
274
|
+
{#if hasHeaderBack}
|
|
275
|
+
<ButtonBack
|
|
276
|
+
iconPath={headerBackIconPath}
|
|
277
|
+
iconClassName={headerBackIconClassName}
|
|
278
|
+
className={headerBackButtonClassName}
|
|
279
|
+
onClick={handleClose}
|
|
280
|
+
/>
|
|
281
|
+
{/if}
|
|
282
|
+
</div>
|
|
283
|
+
<div class="py-2">
|
|
284
|
+
{#if hasTitle}
|
|
285
|
+
<div class="text-xl {titleClassName}">{title || ''}</div>
|
|
286
|
+
{/if}
|
|
287
|
+
{#if hasSubtitle}
|
|
288
|
+
<div class="text-sm text-gray-500 {subtitleClassName}">{subtitle || ''}</div>
|
|
289
|
+
{/if}
|
|
290
|
+
</div>
|
|
291
|
+
<div class="flex-grow">
|
|
292
|
+
{#if headerSnippet}
|
|
293
|
+
{@render headerSnippet(dialogExports)}
|
|
294
|
+
{/if}
|
|
295
|
+
</div>
|
|
296
|
+
<div>
|
|
297
|
+
{#if hasHeaderClose}
|
|
298
|
+
<ButtonClose
|
|
299
|
+
className={headerCloseButtonClassName}
|
|
300
|
+
iconPath={headerCloseIconPath}
|
|
301
|
+
iconClassName={headerCloseIconClassName}
|
|
302
|
+
onClick={handleClose}
|
|
303
|
+
/>
|
|
304
|
+
{/if}
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
{/if}
|
|
308
|
+
|
|
309
|
+
<div class="flex-grow overflow-y-auto {bodyClassName}">
|
|
310
|
+
{#if children}
|
|
311
|
+
{@render children()}
|
|
312
|
+
{:else if bodySnippet}
|
|
313
|
+
{@render bodySnippet(dialogExports)}
|
|
314
|
+
{:else if BodyComponent?.length == 2}
|
|
315
|
+
<BodyComponent {...{ ...props }} {...{ ...dialogExports }} />
|
|
316
|
+
{/if}
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
{#if hasFooter}
|
|
320
|
+
<div
|
|
321
|
+
class="flex items-center justify-end p-4 gap-4 {hasFooterShadow
|
|
322
|
+
? 'border-t'
|
|
323
|
+
: ''} {footerClassName}"
|
|
324
|
+
>
|
|
325
|
+
<div class="flex-grow">
|
|
326
|
+
{#if footerSnippet}
|
|
327
|
+
{@render footerSnippet(dialogExports)}
|
|
328
|
+
{/if}
|
|
329
|
+
</div>
|
|
330
|
+
{#if hasFooterOkButton}
|
|
178
331
|
<Button
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
332
|
+
id="btn-ok"
|
|
333
|
+
form={submitButtonFormId}
|
|
334
|
+
type={submitButtonFormId ? 'submit' : footerOkButtonType}
|
|
335
|
+
className="p-2 px-5 rounded bg-indigo-600 hover:bg-indigo-700 focus:bg-indigo-700 text-white {footerOkButtonClassName}"
|
|
336
|
+
label={footerOkLable}
|
|
337
|
+
disabled={footerOkButtonDisabled}
|
|
338
|
+
spinner={footerOkButtonSpinner}
|
|
339
|
+
spinnerClassName="text-white w-4 h-4"
|
|
340
|
+
onClick={handleOkClick}
|
|
183
341
|
/>
|
|
184
342
|
{/if}
|
|
185
|
-
|
|
186
|
-
<div class="py-2">
|
|
187
|
-
{#if hasTitle}
|
|
188
|
-
<div class="text-xl {titleClassName}">{title || ''}</div>
|
|
189
|
-
{/if}
|
|
190
|
-
{#if hasSubtitle}
|
|
191
|
-
<div class="text-sm text-gray-500 {subtitleClassName}">{subtitle || ''}</div>
|
|
192
|
-
{/if}
|
|
193
|
-
</div>
|
|
194
|
-
<div class="flex-grow">
|
|
195
|
-
{#if headerChildren}
|
|
196
|
-
{@render headerChildren(dialogExports)}
|
|
197
|
-
{/if}
|
|
198
|
-
</div>
|
|
199
|
-
<div>
|
|
200
|
-
{#if hasHeaderClose}
|
|
343
|
+
{#if hasFooterCloseButton}
|
|
201
344
|
<Button
|
|
202
|
-
id="close"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
345
|
+
id="btn-close"
|
|
346
|
+
type="button"
|
|
347
|
+
className="p-2 px-5 rounded bg-gray-100 hover:bg-gray-200 {footerCloseButtonClassName}"
|
|
348
|
+
label={footerCloseLabel}
|
|
349
|
+
onClick={handleClose}
|
|
350
|
+
/>
|
|
208
351
|
{/if}
|
|
209
352
|
</div>
|
|
210
|
-
</div>
|
|
211
|
-
{/if}
|
|
212
|
-
|
|
213
|
-
<div class="flex-grow overflow-y-auto {bodyClassName}">
|
|
214
|
-
{#if children}
|
|
215
|
-
{@render children()}
|
|
216
|
-
{:else if bodyChildren}
|
|
217
|
-
{@render bodyChildren(dialogExports)}
|
|
218
|
-
{:else if CustomComponent?.length == 2}
|
|
219
|
-
<CustomComponent {...{ ...props }} {...{ ...dialogExports }} />
|
|
220
353
|
{/if}
|
|
221
|
-
</div>
|
|
222
|
-
|
|
223
|
-
{#if hasFooter}
|
|
224
|
-
<div
|
|
225
|
-
class="flex items-center justify-end p-4 gap-4 {hasFooterShadow
|
|
226
|
-
? 'border-t'
|
|
227
|
-
: ''} {footerClassName}"
|
|
228
|
-
>
|
|
229
|
-
<div class="flex-grow">
|
|
230
|
-
{#if footerChildren}
|
|
231
|
-
{@render footerChildren(dialogExports)}
|
|
232
|
-
{/if}
|
|
233
|
-
</div>
|
|
234
|
-
{#if hasFooterOkButton}
|
|
235
|
-
<Button
|
|
236
|
-
id="btn-ok"
|
|
237
|
-
form={submitButtonFormId}
|
|
238
|
-
type={submitButtonFormId ? 'submit' : footerOkButtonType}
|
|
239
|
-
className="p-2 px-5 rounded bg-indigo-600 hover:bg-indigo-700 focus:bg-indigo-700 text-white {footerOkButtonClassName}"
|
|
240
|
-
label={footerOkLable}
|
|
241
|
-
disabled={footerOkButtonDisabled}
|
|
242
|
-
spinner={footerOkButtonSpinner}
|
|
243
|
-
spinnerClassName="text-white w-4 h-4"
|
|
244
|
-
onclick={handleOkClick}
|
|
245
|
-
/>
|
|
246
|
-
{/if}
|
|
247
|
-
{#if hasFooterCloseButton}
|
|
248
|
-
<Button
|
|
249
|
-
id="btn-close"
|
|
250
|
-
type="button"
|
|
251
|
-
className="p-2 px-5 rounded bg-gray-100 hover:bg-gray-200 {footerCloseButtonClassName}"
|
|
252
|
-
label={footerCloseLabel}
|
|
253
|
-
onclick={handleClose}
|
|
254
|
-
/>
|
|
255
|
-
{/if}
|
|
256
|
-
</div>
|
|
257
354
|
{/if}
|
|
258
355
|
</div>
|
|
259
356
|
{/snippet}
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
* true -> Close dialog
|
|
5
5
|
*/
|
|
6
6
|
export type DialogCloseButtonClickType = (ev: MouseEvent | TouchEvent) => Promise<boolean>;
|
|
7
|
-
export
|
|
8
|
-
SM = "sm",
|
|
9
|
-
MD = "md",
|
|
10
|
-
LG = "lg",
|
|
11
|
-
FULL = "full"
|
|
12
|
-
}
|
|
7
|
+
export type DialogSizeType = 'sm' | 'md' | 'lg' | 'full';
|
|
13
8
|
export type DialogPropsType = {
|
|
14
9
|
id?: string;
|
|
15
10
|
cancelable?: boolean;
|
|
@@ -47,13 +42,14 @@ export type DialogPropsType = {
|
|
|
47
42
|
footerOkButtonDisabled?: boolean;
|
|
48
43
|
submitButtonFormId?: string;
|
|
49
44
|
bodyClassName?: string;
|
|
45
|
+
bodyComponent?: any;
|
|
50
46
|
component?: any;
|
|
51
47
|
props?: any;
|
|
52
|
-
size?:
|
|
48
|
+
size?: DialogSizeType;
|
|
53
49
|
children?: Snippet;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
headerSnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
51
|
+
bodySnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
52
|
+
footerSnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
57
53
|
onClose?: () => void;
|
|
58
54
|
onResult?: (value: any) => void;
|
|
59
55
|
onOkClick?: (ev: MouseEvent | TouchEvent, options: DialogExportsType) => void;
|