@cloudparker/moldex.js 4.1.21 → 4.1.23
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 +27 -2
- package/dist/services/dialog/dialog-service.js +37 -1
- package/dist/views/core/button/components/button/button.svelte +2 -1
- package/dist/views/core/button/types.d.ts +1 -0
- package/dist/views/core/dialog/components/date-field-dialog/date-field-dialog.svelte +56 -0
- package/dist/views/core/dialog/components/date-field-dialog/date-field-dialog.svelte.d.ts +15 -0
- package/dist/views/core/dialog/components/datetime-field-dialog/datetime-field-dialog.svelte +56 -0
- package/dist/views/core/dialog/components/datetime-field-dialog/datetime-field-dialog.svelte.d.ts +15 -0
- package/dist/views/core/dialog/index.d.ts +2 -0
- package/dist/views/core/dialog/index.js +2 -0
- package/package.json +1 -1
|
@@ -40,16 +40,41 @@ export declare function openNumberFieldDialog({ title, value, label, name, maxle
|
|
|
40
40
|
export declare function openTextFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, ...params }?: DialogProps & InputFieldProps & {
|
|
41
41
|
fieldClassName?: string;
|
|
42
42
|
}): Promise<unknown>;
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function openDateFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params }?: DialogProps & InputFieldProps & {
|
|
44
44
|
fieldClassName?: string;
|
|
45
45
|
}): Promise<unknown>;
|
|
46
|
+
export declare function openDateTimeFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params }?: DialogProps & InputFieldProps & {
|
|
47
|
+
fieldClassName?: string;
|
|
48
|
+
value?: Date | string | null;
|
|
49
|
+
}): Promise<Date>;
|
|
50
|
+
export declare function openTextareaFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params }?: DialogProps & InputFieldProps & {
|
|
51
|
+
fieldClassName?: string;
|
|
52
|
+
value?: Date | string | null;
|
|
53
|
+
}): Promise<Date>;
|
|
46
54
|
export declare function openLoadingDialog({ msg, loadingDialogContainerClassName, loadingDialogClassName, loadingDialogSpinnerClassName, loadingDialogMsgClassName, ...params }?: DialogProps & {
|
|
47
55
|
msg?: string;
|
|
48
56
|
loadingDialogContainerClassName?: string;
|
|
49
57
|
loadingDialogClassName?: string;
|
|
50
58
|
loadingDialogSpinnerClassName?: string;
|
|
51
59
|
loadingDialogMsgClassName?: string;
|
|
52
|
-
}): Promise<
|
|
60
|
+
}): Promise<{
|
|
61
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
62
|
+
$set?(props: Partial<DialogProps>): void;
|
|
63
|
+
} & {
|
|
64
|
+
toggleDialog: () => void;
|
|
65
|
+
openDialog: () => void;
|
|
66
|
+
closeDialog: (value?: any) => Promise<any>;
|
|
67
|
+
setResult: (value: any) => void;
|
|
68
|
+
setOkEnabled: (value: boolean) => void;
|
|
69
|
+
setOkSpinner: (value: boolean) => void;
|
|
70
|
+
setOnData: (listener: (data: any) => void) => void;
|
|
71
|
+
setOnOkClick: (onclick: (event: MouseEvent | TouchEvent, options: import("../../views/index.js").DialogExports) => void) => void;
|
|
72
|
+
setOnCloseClick: (onclick: import("../../views/index.js").DialogCloseButtonClickFunction) => void;
|
|
73
|
+
postData: (data: any) => void;
|
|
74
|
+
setHeaderSnippet: (snippet: import("svelte").Snippet) => void;
|
|
75
|
+
setFooterSnippet: (snippet: import("svelte").Snippet) => void;
|
|
76
|
+
setDialogTitle: (dialogTitle: string) => void;
|
|
77
|
+
}>;
|
|
53
78
|
/**
|
|
54
79
|
* Return Cropped Image DataUrl
|
|
55
80
|
* @param props
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from 'svelte';
|
|
2
2
|
import { cropImageFile, FilePickerAccepts, ImageCaptureEnum, OutputImageFormatEnum, processImageFile } from '../utils/image-service';
|
|
3
|
-
import { CropperDialog, Dialog, LoadingDialog, MsgDialog, NumberFieldDialog, PickerDialog, TextareaFieldDialog, TextFieldDialog } from '../../views/index.js';
|
|
3
|
+
import { CropperDialog, DateFieldDialog, DatetimeFieldDialog, Dialog, LoadingDialog, MsgDialog, NumberFieldDialog, PickerDialog, TextareaFieldDialog, TextFieldDialog } from '../../views/index.js';
|
|
4
4
|
import { getDialogSize, isMobileScreen } from '../screen/screen-service';
|
|
5
5
|
export var DialogSizeEnum;
|
|
6
6
|
(function (DialogSizeEnum) {
|
|
@@ -150,6 +150,42 @@ export async function openTextFieldDialog({ title, value, label, name, maxlength
|
|
|
150
150
|
targetFormId: 'text-field-dialog-form'
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
+
export async function openDateFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params } = {}) {
|
|
154
|
+
return await openDialog({
|
|
155
|
+
bodyComponent: DateFieldDialog,
|
|
156
|
+
props: { value, label, name, maxlength, className: fieldClassName, autofocus, required, appearance, size, floatingLabel, rows },
|
|
157
|
+
...params,
|
|
158
|
+
hasHeader: true,
|
|
159
|
+
hasHeaderBack: isMobileScreen(),
|
|
160
|
+
hasHeaderClose: !isMobileScreen(),
|
|
161
|
+
size: isMobileScreen() ? DialogSizeEnum.FULL : DialogSizeEnum.SM,
|
|
162
|
+
hasTitle: true,
|
|
163
|
+
title: title || 'Prompt',
|
|
164
|
+
hasFooter: true,
|
|
165
|
+
hasFooterCloseButton: true,
|
|
166
|
+
hasFooterOkButton: true,
|
|
167
|
+
footerOkButtonType: 'submit',
|
|
168
|
+
targetFormId: 'date-field-dialog-form'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
export async function openDateTimeFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params } = {}) {
|
|
172
|
+
return await openDialog({
|
|
173
|
+
bodyComponent: DatetimeFieldDialog,
|
|
174
|
+
props: { value, label, name, maxlength, className: fieldClassName, autofocus, required, appearance, size, floatingLabel, rows },
|
|
175
|
+
...params,
|
|
176
|
+
hasHeader: true,
|
|
177
|
+
hasHeaderBack: isMobileScreen(),
|
|
178
|
+
hasHeaderClose: !isMobileScreen(),
|
|
179
|
+
size: isMobileScreen() ? DialogSizeEnum.FULL : DialogSizeEnum.SM,
|
|
180
|
+
hasTitle: true,
|
|
181
|
+
title: title || 'Prompt',
|
|
182
|
+
hasFooter: true,
|
|
183
|
+
hasFooterCloseButton: true,
|
|
184
|
+
hasFooterOkButton: true,
|
|
185
|
+
footerOkButtonType: 'submit',
|
|
186
|
+
targetFormId: 'datetime-field-dialog-form'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
153
189
|
export async function openTextareaFieldDialog({ title, value, label, name, maxlength, fieldClassName, autofocus, required, appearance, size, floatingLabel, rows, ...params } = {}) {
|
|
154
190
|
return await openDialog({
|
|
155
191
|
bodyComponent: TextareaFieldDialog,
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
hasOpenInNew,
|
|
34
34
|
openInNewIconClassName,
|
|
35
35
|
openInNewIcon = mdiOpenInNew,
|
|
36
|
+
labelClassName="grow-1",
|
|
36
37
|
onDblClick,
|
|
37
38
|
onContextMenu,
|
|
38
39
|
onDrop,
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
<Icon path={iconPath} className="w-6 h-6 {iconClassName}" />
|
|
99
100
|
{/if}
|
|
100
101
|
{#if label}
|
|
101
|
-
<span>{label || ''}</span>
|
|
102
|
+
<span class=" {labelClassName}">{label || ''}</span>
|
|
102
103
|
{/if}
|
|
103
104
|
{#if rightIconPath}
|
|
104
105
|
<Icon path={rightIconPath} className="w-6 h-6 {rightIconClassName}" />
|
|
@@ -27,6 +27,7 @@ export type ButtonProps = {
|
|
|
27
27
|
hasOpenInNew?: boolean;
|
|
28
28
|
openInNewIconClassName?: string;
|
|
29
29
|
openInNewIcon?: string;
|
|
30
|
+
labelClassName?: string;
|
|
30
31
|
onClick?: (ev: MouseEvent) => void;
|
|
31
32
|
onDblClick?: (ev: MouseEvent) => void;
|
|
32
33
|
onContextMenu?: (ev: MouseEvent) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { showToast } from '../../../../../services/index.js';
|
|
3
|
+
import type { InputValue } from '../../../input';
|
|
4
|
+
import DatetimeField from '../../../input/components/datetime-field/datetime-field.svelte';
|
|
5
|
+
import type { DialogExports } from '../../types';
|
|
6
|
+
|
|
7
|
+
type PropsType = {
|
|
8
|
+
value?: InputValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
maxlength?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
autofocus?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
value = $bindable(''),
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
maxlength,
|
|
22
|
+
className,
|
|
23
|
+
autofocus,
|
|
24
|
+
required,
|
|
25
|
+
setOnOkClick,
|
|
26
|
+
setResult,
|
|
27
|
+
closeDialog,
|
|
28
|
+
...props
|
|
29
|
+
}: PropsType & DialogExports = $props();
|
|
30
|
+
|
|
31
|
+
function handleSubmit(ev: SubmitEvent) {
|
|
32
|
+
ev?.preventDefault();
|
|
33
|
+
value = ((value as string) || '').trim();
|
|
34
|
+
if (required && !value) {
|
|
35
|
+
showToast({ msg: 'This is a required field!' });
|
|
36
|
+
} else {
|
|
37
|
+
setResult(value);
|
|
38
|
+
closeDialog();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div class="p-6">
|
|
44
|
+
<form id="date-field-dialog-form" onsubmit={handleSubmit}>
|
|
45
|
+
<DatetimeField
|
|
46
|
+
{...props}
|
|
47
|
+
{label}
|
|
48
|
+
{name}
|
|
49
|
+
{maxlength}
|
|
50
|
+
{className}
|
|
51
|
+
{autofocus}
|
|
52
|
+
{required}
|
|
53
|
+
bind:value
|
|
54
|
+
/>
|
|
55
|
+
</form>
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InputValue } from '../../../input';
|
|
2
|
+
import type { DialogExports } from '../../types';
|
|
3
|
+
type PropsType = {
|
|
4
|
+
value?: InputValue;
|
|
5
|
+
label?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
maxlength?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
autofocus?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type $$ComponentProps = PropsType & DialogExports;
|
|
13
|
+
declare const DateFieldDialog: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
14
|
+
type DateFieldDialog = ReturnType<typeof DateFieldDialog>;
|
|
15
|
+
export default DateFieldDialog;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { showToast } from '../../../../../services/index.js';
|
|
3
|
+
import type { InputValue } from '../../../input';
|
|
4
|
+
import DatetimeField from '../../../input/components/datetime-field/datetime-field.svelte';
|
|
5
|
+
import type { DialogExports } from '../../types';
|
|
6
|
+
|
|
7
|
+
type PropsType = {
|
|
8
|
+
value?: InputValue;
|
|
9
|
+
label?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
maxlength?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
autofocus?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
value = $bindable(''),
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
maxlength,
|
|
22
|
+
className,
|
|
23
|
+
autofocus,
|
|
24
|
+
required,
|
|
25
|
+
setOnOkClick,
|
|
26
|
+
setResult,
|
|
27
|
+
closeDialog,
|
|
28
|
+
...props
|
|
29
|
+
}: PropsType & DialogExports = $props();
|
|
30
|
+
|
|
31
|
+
function handleSubmit(ev: SubmitEvent) {
|
|
32
|
+
ev?.preventDefault();
|
|
33
|
+
value = ((value as string) || '').trim();
|
|
34
|
+
if (required && !value) {
|
|
35
|
+
showToast({ msg: 'This is a required field!' });
|
|
36
|
+
} else {
|
|
37
|
+
setResult(value);
|
|
38
|
+
closeDialog();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div class="p-6">
|
|
44
|
+
<form id="datetime-field-dialog-form" onsubmit={handleSubmit}>
|
|
45
|
+
<DatetimeField
|
|
46
|
+
{...props}
|
|
47
|
+
{label}
|
|
48
|
+
{name}
|
|
49
|
+
{maxlength}
|
|
50
|
+
{className}
|
|
51
|
+
{autofocus}
|
|
52
|
+
{required}
|
|
53
|
+
bind:value
|
|
54
|
+
/>
|
|
55
|
+
</form>
|
|
56
|
+
</div>
|
package/dist/views/core/dialog/components/datetime-field-dialog/datetime-field-dialog.svelte.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InputValue } from '../../../input';
|
|
2
|
+
import type { DialogExports } from '../../types';
|
|
3
|
+
type PropsType = {
|
|
4
|
+
value?: InputValue;
|
|
5
|
+
label?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
maxlength?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
autofocus?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type $$ComponentProps = PropsType & DialogExports;
|
|
13
|
+
declare const DatetimeFieldDialog: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
14
|
+
type DatetimeFieldDialog = ReturnType<typeof DatetimeFieldDialog>;
|
|
15
|
+
export default DatetimeFieldDialog;
|
|
@@ -6,4 +6,6 @@ export { default as NumberFieldDialog } from './components/number-field-dialog/n
|
|
|
6
6
|
export { default as PickerDialog } from './components/picker-dialog/picker-dialog.svelte';
|
|
7
7
|
export { default as TextFieldDialog } from './components/text-field-dialog/text-field-dialog.svelte';
|
|
8
8
|
export { default as TextareaFieldDialog } from './components/textarea-field-dialog/textarea-field-dialog.svelte';
|
|
9
|
+
export { default as DateFieldDialog } from './components/date-field-dialog/date-field-dialog.svelte';
|
|
10
|
+
export { default as DatetimeFieldDialog } from './components/datetime-field-dialog/datetime-field-dialog.svelte';
|
|
9
11
|
export * from './types';
|
|
@@ -6,4 +6,6 @@ export { default as NumberFieldDialog } from './components/number-field-dialog/n
|
|
|
6
6
|
export { default as PickerDialog } from './components/picker-dialog/picker-dialog.svelte';
|
|
7
7
|
export { default as TextFieldDialog } from './components/text-field-dialog/text-field-dialog.svelte';
|
|
8
8
|
export { default as TextareaFieldDialog } from './components/textarea-field-dialog/textarea-field-dialog.svelte';
|
|
9
|
+
export { default as DateFieldDialog } from './components/date-field-dialog/date-field-dialog.svelte';
|
|
10
|
+
export { default as DatetimeFieldDialog } from './components/datetime-field-dialog/datetime-field-dialog.svelte';
|
|
9
11
|
export * from './types';
|