@cloudparker/moldex.js 0.0.29 → 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/views/core/button/components/button/button.svelte +54 -33
- package/dist/views/core/button/components/button-back/button-back.svelte +26 -14
- package/dist/views/core/button/components/button-close/button-close.svelte +4 -2
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +29 -15
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +78 -30
- package/dist/views/core/button/components/button-menu/button-menu.svelte +143 -90
- package/dist/views/core/button/components/button-ok/button-ok.svelte +4 -2
- package/dist/views/core/dialog/components/dialog/dialog.svelte +245 -158
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +2 -7
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +152 -108
- 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 +24 -13
- package/dist/views/core/input/components/color-field/color-field.svelte +71 -61
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +330 -248
- package/dist/views/core/input/components/date-field/date-field.svelte +10 -6
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +10 -6
- package/dist/views/core/input/components/email-field/email-field.svelte +9 -6
- package/dist/views/core/input/components/file-field/file-field.svelte +69 -57
- package/dist/views/core/input/components/input-field/input-field.svelte +251 -151
- package/dist/views/core/input/components/label/label.svelte +24 -10
- package/dist/views/core/input/components/number-field/number-field.svelte +10 -6
- package/dist/views/core/input/components/password-field/password-field.svelte +59 -48
- package/dist/views/core/input/components/phone-field/phone-field.svelte +62 -48
- package/dist/views/core/input/components/range-field/range-field.svelte +51 -32
- package/dist/views/core/input/components/search-field/search-field.svelte +52 -38
- package/dist/views/core/input/components/text-field/text-field.svelte +9 -6
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +9 -6
- package/dist/views/core/input/components/time-field/time-field.svelte +9 -6
- package/dist/views/core/navbar/components/navbar/navbar.svelte +63 -31
- package/dist/views/core/no-data/components/no-data/no-data.svelte +37 -20
- 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 +41 -29
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +37 -29
- 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 +1 -1
|
@@ -1,163 +1,250 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
};
|
|
10
73
|
</script>
|
|
11
74
|
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
let
|
|
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
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
+
});
|
|
161
248
|
</script>
|
|
162
249
|
|
|
163
250
|
{#snippet dialogContent()}
|
|
@@ -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;
|
|
@@ -50,7 +45,7 @@ export type DialogPropsType = {
|
|
|
50
45
|
bodyComponent?: any;
|
|
51
46
|
component?: any;
|
|
52
47
|
props?: any;
|
|
53
|
-
size?:
|
|
48
|
+
size?: DialogSizeType;
|
|
54
49
|
children?: Snippet;
|
|
55
50
|
headerSnippet?: Snippet<[dialogExports: DialogExportsType]>;
|
|
56
51
|
bodySnippet?: Snippet<[dialogExports: DialogExportsType]>;
|