@cloudparker/moldex.js 0.0.65 → 0.0.67
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 +11 -11
- package/dist/services/navigation/navigation-service.d.ts +17 -0
- package/dist/services/navigation/navigation-service.js +38 -0
- package/dist/services/utils/melody-service.d.ts +5 -0
- package/dist/services/utils/melody-service.js +41 -0
- package/dist/tailwind.css +1 -1
- package/dist/views/core/button/components/button/button.svelte +84 -133
- package/dist/views/core/button/components/button/button.svelte.d.ts +8 -7
- package/dist/views/core/button/components/button-back/button-back.svelte +16 -29
- package/dist/views/core/button/components/button-close/button-close.svelte +2 -4
- package/dist/views/core/button/components/button-close/button-close.svelte.d.ts +2 -2
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +16 -30
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte +86 -0
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte.d.ts +38 -0
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +65 -132
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte.d.ts +22 -31
- package/dist/views/core/button/components/button-menu/button-menu.svelte +72 -235
- package/dist/views/core/button/components/button-menu/button-menu.svelte.d.ts +23 -43
- package/dist/views/core/button/components/button-ok/button-ok.svelte +2 -4
- package/dist/views/core/button/components/button-ok/button-ok.svelte.d.ts +2 -2
- package/dist/views/core/button/components/button-search/button-search.svelte +39 -0
- package/dist/views/core/button/components/button-search/button-search.svelte.d.ts +31 -0
- package/dist/views/core/button/index.d.ts +8 -5
- package/dist/views/core/button/index.js +4 -2
- package/dist/views/core/content-area/components/content-area.svelte +27 -40
- package/dist/views/core/dialog/components/cropper-dialog/cropper-dialog.svelte +33 -49
- package/dist/views/core/dialog/components/dialog/dialog.svelte +164 -263
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +12 -12
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +112 -158
- package/dist/views/core/dialog/components/loading-dialog/loading-dialog.svelte +18 -30
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +13 -22
- package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte +35 -41
- package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte.d.ts +2 -2
- package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte +25 -40
- package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte.d.ts +2 -2
- package/dist/views/core/dialog/index.d.ts +2 -2
- package/dist/views/core/drawer/components/drawer/drawer.svelte +35 -57
- package/dist/views/core/icon/components/icon/icon.svelte +14 -26
- package/dist/views/core/icon/services/icon-path-service.d.ts +1 -0
- package/dist/views/core/icon/services/icon-path-service.js +1 -0
- package/dist/views/core/input/components/checkbox-field/checkbox-field.svelte +25 -44
- package/dist/views/core/input/components/color-field/color-field.svelte +69 -81
- package/dist/views/core/input/components/color-field/color-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +256 -331
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +18 -17
- package/dist/views/core/input/components/date-field/date-field.svelte +30 -39
- package/dist/views/core/input/components/date-field/date-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +12 -18
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/email-field/email-field.svelte +12 -17
- package/dist/views/core/input/components/email-field/email-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/file-field/file-field.svelte +64 -78
- package/dist/views/core/input/components/file-field/file-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/input-field/input-field.svelte +159 -261
- package/dist/views/core/input/components/input-field/input-field.svelte.d.ts +8 -8
- package/dist/views/core/input/components/label/label.svelte +10 -24
- package/dist/views/core/input/components/number-field/number-field.svelte +12 -18
- package/dist/views/core/input/components/number-field/number-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/password-field/password-field.svelte +57 -70
- package/dist/views/core/input/components/password-field/password-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/phone-field/phone-field.svelte +118 -172
- package/dist/views/core/input/components/phone-field/phone-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/radio-field/radio-field.svelte +53 -84
- package/dist/views/core/input/components/radio-field/radio-field.svelte.d.ts +7 -7
- package/dist/views/core/input/components/range-field/range-field.svelte +42 -66
- package/dist/views/core/input/components/range-field/range-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/search-field/search-field.svelte +45 -62
- package/dist/views/core/input/components/search-field/search-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/text-field/text-field.svelte +16 -21
- package/dist/views/core/input/components/text-field/text-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +12 -17
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte.d.ts +2 -2
- package/dist/views/core/input/components/time-field/time-field.svelte +12 -17
- package/dist/views/core/input/components/time-field/time-field.svelte.d.ts +2 -2
- package/dist/views/core/input/index.d.ts +4 -3
- package/dist/views/core/navbar/components/navbar/navbar.svelte +39 -77
- package/dist/views/core/no-data/components/no-data/no-data.svelte +20 -37
- package/dist/views/core/pagination/components/pagination/pagination.svelte +73 -102
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +23 -37
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +2 -6
- package/dist/views/core/screen-detector/components/screen-detector.svelte +9 -13
- package/dist/views/core/sidebar/components/sidebar.svelte +23 -36
- package/dist/views/core/spinner/components/spinner/spinner.svelte +2 -7
- package/dist/views/core/text/components/text-await/text-await.svelte +2 -8
- package/dist/views/core/text/components/text-copy/text-copy.svelte +17 -28
- package/dist/views/core/text/components/text-country/text-country.svelte +29 -41
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +29 -37
- package/dist/views/core/text/components/text-currency/text-currency.svelte +10 -21
- package/dist/views/core/text/components/text-date/text-date.svelte +21 -33
- package/dist/views/core/text/components/text-email/text-email.svelte +4 -13
- package/dist/views/core/text/components/text-html/text-html.svelte +2 -3
- package/dist/views/core/text/components/text-phone/text-phone.svelte +4 -13
- package/dist/views/core/toast/components/toast/toast.svelte +21 -44
- package/package.json +1 -1
|
@@ -1,73 +1,60 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
break;
|
|
59
|
-
case 'xs':
|
|
60
|
-
btnIconSizeClassName = '!h-4 !w-4';
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
$effect(() => {
|
|
67
|
-
if (!appearance || appearance == 'normal') {
|
|
68
|
-
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
69
|
-
}
|
|
70
|
-
});
|
|
1
|
+
<script lang="ts">import { ripple } from "../../../../../actions";
|
|
2
|
+
import { mdiEyeOffOutline, mdiEyeOutline } from "../../../icon";
|
|
3
|
+
import Icon from "../../../icon/components/icon/icon.svelte";
|
|
4
|
+
import InputField, {} from "../input-field/input-field.svelte";
|
|
5
|
+
let {
|
|
6
|
+
type = "password",
|
|
7
|
+
size,
|
|
8
|
+
appearance,
|
|
9
|
+
buttonClassName,
|
|
10
|
+
iconClassName,
|
|
11
|
+
name,
|
|
12
|
+
id,
|
|
13
|
+
value = $bindable(),
|
|
14
|
+
...props
|
|
15
|
+
} = $props();
|
|
16
|
+
let btnRoundedClassName = $state("");
|
|
17
|
+
let btnIconSizeClassName = $state("");
|
|
18
|
+
let inputFieldRef = $state(null);
|
|
19
|
+
export function focus() {
|
|
20
|
+
inputFieldRef?.focus();
|
|
21
|
+
}
|
|
22
|
+
export function getElement() {
|
|
23
|
+
return inputFieldRef;
|
|
24
|
+
}
|
|
25
|
+
export function select() {
|
|
26
|
+
inputFieldRef && inputFieldRef.select();
|
|
27
|
+
}
|
|
28
|
+
function handleTogglePassword() {
|
|
29
|
+
if (type == "password") {
|
|
30
|
+
type = "text";
|
|
31
|
+
} else {
|
|
32
|
+
type = "password";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
$effect(() => {
|
|
36
|
+
if (size) {
|
|
37
|
+
switch (size) {
|
|
38
|
+
case "lg":
|
|
39
|
+
btnIconSizeClassName = "!h-7 !w-7";
|
|
40
|
+
break;
|
|
41
|
+
case "md":
|
|
42
|
+
btnIconSizeClassName = "!h-6 !w-6";
|
|
43
|
+
break;
|
|
44
|
+
case "sm":
|
|
45
|
+
btnIconSizeClassName = "!h-5 !w-5";
|
|
46
|
+
break;
|
|
47
|
+
case "xs":
|
|
48
|
+
btnIconSizeClassName = "!h-4 !w-4";
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (!appearance || appearance == "normal") {
|
|
55
|
+
btnRoundedClassName = "rounded-tr-lg rounded-br-lg";
|
|
56
|
+
}
|
|
57
|
+
});
|
|
71
58
|
</script>
|
|
72
59
|
|
|
73
60
|
{#snippet showPasswordButton()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
2
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
4
|
$$bindings?: Bindings;
|
|
@@ -12,7 +12,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
12
12
|
};
|
|
13
13
|
z_$$bindings?: Bindings;
|
|
14
14
|
}
|
|
15
|
-
declare const PasswordField: $$__sveltets_2_IsomorphicComponent<
|
|
15
|
+
declare const PasswordField: $$__sveltets_2_IsomorphicComponent<InputFieldProps & {
|
|
16
16
|
buttonClassName?: string;
|
|
17
17
|
iconClassName?: string;
|
|
18
18
|
}, {
|
|
@@ -1,175 +1,121 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function handleEasyCountryDataScriptLoad(lib: EasyCountryDataType) {
|
|
124
|
-
EasyCountryData = lib;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function handleLibphonenumberScriptLoad(lib: LibPhoneNumberType) {
|
|
128
|
-
LibPhonenumber = lib;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function handleNumberInput(ev: InputEvent) {
|
|
132
|
-
let target: HTMLInputElement = ev.target as HTMLInputElement;
|
|
133
|
-
let _phoneNumber: string = target?.value || '';
|
|
134
|
-
updatePhonenumber(_dailCode, _phoneNumber);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function updatePhonenumber(_dialCode: string, _phoneNumber: string) {
|
|
138
|
-
if (LibPhonenumber) {
|
|
139
|
-
if (_phoneNumber) {
|
|
140
|
-
_dialCode = formatDialCode(_dialCode);
|
|
141
|
-
try {
|
|
142
|
-
// console.log('updatePhonenumber', { dialCode, phoneNumber });
|
|
143
|
-
let parsed = LibPhonenumber.parsePhoneNumber(_dialCode + _phoneNumber);
|
|
144
|
-
if (parsed && parsed.isValid()) {
|
|
145
|
-
dialCode = _dialCode;
|
|
146
|
-
value = _dialCode + _phoneNumber;
|
|
147
|
-
} else {
|
|
148
|
-
value = '';
|
|
149
|
-
}
|
|
150
|
-
} catch (error) {
|
|
151
|
-
value = '';
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function handleNumberKeyDown(ev: KeyboardEvent) {
|
|
158
|
-
if (
|
|
159
|
-
!(
|
|
160
|
-
(ev.key >= '0' && ev.key <= '9') ||
|
|
161
|
-
ev.key === 'Backspace' ||
|
|
162
|
-
ev.key === 'Delete' ||
|
|
163
|
-
ev.key === 'ArrowLeft' ||
|
|
164
|
-
ev.key === 'ArrowRight' ||
|
|
165
|
-
ev.key === 'ArrowUp' ||
|
|
166
|
-
ev.key === 'ArrowDown'||
|
|
167
|
-
ev.key === 'Tab'
|
|
168
|
-
)
|
|
169
|
-
) {
|
|
170
|
-
ev.preventDefault();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
1
|
+
<script module lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { ripple } from "../../../../../actions";
|
|
4
|
+
import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
|
|
5
|
+
import InputField, {} from "../input-field/input-field.svelte";
|
|
6
|
+
import { isMobileScreen, openListPickerDialog } from "../../../../../services";
|
|
7
|
+
let {
|
|
8
|
+
id,
|
|
9
|
+
name,
|
|
10
|
+
value = $bindable(""),
|
|
11
|
+
size,
|
|
12
|
+
appearance,
|
|
13
|
+
buttonClassName,
|
|
14
|
+
className,
|
|
15
|
+
dialCode = $bindable("+1"),
|
|
16
|
+
floatingLabel,
|
|
17
|
+
labelClassName,
|
|
18
|
+
...props
|
|
19
|
+
} = $props();
|
|
20
|
+
let EasyCountryData;
|
|
21
|
+
let LibPhonenumber = $state(null);
|
|
22
|
+
let inputFieldRef = $state(null);
|
|
23
|
+
let _dailCode = $state("");
|
|
24
|
+
let _phoneNumber = $state("");
|
|
25
|
+
$effect(() => {
|
|
26
|
+
if (!_dailCode && !_phoneNumber && LibPhonenumber) {
|
|
27
|
+
try {
|
|
28
|
+
if (dialCode) {
|
|
29
|
+
_dailCode = formatDialCode(dialCode);
|
|
30
|
+
}
|
|
31
|
+
if (value) {
|
|
32
|
+
let parsed = LibPhonenumber?.parsePhoneNumber(value);
|
|
33
|
+
if (parsed && parsed.isValid()) {
|
|
34
|
+
_phoneNumber = parsed.nationalNumber || "";
|
|
35
|
+
_dailCode = formatDialCode(parsed.countryCallingCode);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
let btnRoundedClassName = $derived.by(() => {
|
|
43
|
+
if (!appearance || appearance == "normal") {
|
|
44
|
+
return "rounded-tl-lg rounded-bl-lg";
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export function focus() {
|
|
48
|
+
inputFieldRef?.focus();
|
|
49
|
+
}
|
|
50
|
+
export function getElement() {
|
|
51
|
+
return inputFieldRef;
|
|
52
|
+
}
|
|
53
|
+
export function select() {
|
|
54
|
+
inputFieldRef && inputFieldRef.select();
|
|
55
|
+
}
|
|
56
|
+
function formatDialCode(dialcode) {
|
|
57
|
+
dialcode = `${dialCode}`.trim();
|
|
58
|
+
if (!dialCode.startsWith("+")) {
|
|
59
|
+
dialcode = `+${dialCode}`;
|
|
60
|
+
}
|
|
61
|
+
return dialcode;
|
|
62
|
+
}
|
|
63
|
+
async function hanleDialCodePicker() {
|
|
64
|
+
if (EasyCountryData) {
|
|
65
|
+
let items = EasyCountryData.getCountries();
|
|
66
|
+
let size2 = isMobileScreen() ? "full" : "sm";
|
|
67
|
+
let res = await openListPickerDialog({
|
|
68
|
+
items,
|
|
69
|
+
itemTitle: "dialCode",
|
|
70
|
+
itemSubtitle: "name",
|
|
71
|
+
size: size2,
|
|
72
|
+
hasCheck: true,
|
|
73
|
+
identity: "dialCode",
|
|
74
|
+
search: ["name", "dialCode", "isoCode"]
|
|
75
|
+
});
|
|
76
|
+
console.log(res);
|
|
77
|
+
if (res) {
|
|
78
|
+
_dailCode = res;
|
|
79
|
+
dialCode = _dailCode;
|
|
80
|
+
updatePhonenumber(_dailCode, _phoneNumber);
|
|
81
|
+
inputFieldRef && inputFieldRef.focus();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function handleEasyCountryDataScriptLoad(lib) {
|
|
86
|
+
EasyCountryData = lib;
|
|
87
|
+
}
|
|
88
|
+
function handleLibphonenumberScriptLoad(lib) {
|
|
89
|
+
LibPhonenumber = lib;
|
|
90
|
+
}
|
|
91
|
+
function handleNumberInput(ev) {
|
|
92
|
+
let target = ev.target;
|
|
93
|
+
let _phoneNumber2 = target?.value || "";
|
|
94
|
+
updatePhonenumber(_dailCode, _phoneNumber2);
|
|
95
|
+
}
|
|
96
|
+
function updatePhonenumber(_dialCode, _phoneNumber2) {
|
|
97
|
+
if (LibPhonenumber) {
|
|
98
|
+
if (_phoneNumber2) {
|
|
99
|
+
_dialCode = formatDialCode(_dialCode);
|
|
100
|
+
try {
|
|
101
|
+
let parsed = LibPhonenumber.parsePhoneNumber(_dialCode + _phoneNumber2);
|
|
102
|
+
if (parsed && parsed.isValid()) {
|
|
103
|
+
dialCode = _dialCode;
|
|
104
|
+
value = _dialCode + _phoneNumber2;
|
|
105
|
+
} else {
|
|
106
|
+
value = "";
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
value = "";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function handleNumberKeyDown(ev) {
|
|
115
|
+
if (!(ev.key >= "0" && ev.key <= "9" || ev.key === "Backspace" || ev.key === "Delete" || ev.key === "ArrowLeft" || ev.key === "ArrowRight" || ev.key === "ArrowUp" || ev.key === "ArrowDown" || ev.key === "Tab")) {
|
|
116
|
+
ev.preventDefault();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
173
119
|
</script>
|
|
174
120
|
|
|
175
121
|
{#snippet showPasswordButton()}
|
|
@@ -19,7 +19,7 @@ export type EasyCountryDataType = {
|
|
|
19
19
|
isoCode?: string;
|
|
20
20
|
}) => CountryType;
|
|
21
21
|
};
|
|
22
|
-
import { type
|
|
22
|
+
import { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
23
23
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
24
24
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
25
25
|
$$bindings?: Bindings;
|
|
@@ -33,7 +33,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
33
33
|
};
|
|
34
34
|
z_$$bindings?: Bindings;
|
|
35
35
|
}
|
|
36
|
-
declare const PhoneField: $$__sveltets_2_IsomorphicComponent<
|
|
36
|
+
declare const PhoneField: $$__sveltets_2_IsomorphicComponent<InputFieldProps & {
|
|
37
37
|
buttonClassName?: string;
|
|
38
38
|
dialCode?: string;
|
|
39
39
|
}, {
|
|
@@ -1,90 +1,59 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
export type RadioValuetype = string | boolean | number | Date;
|
|
3
|
-
export type RadioItemType = { value: any; label: string; desc?: string };
|
|
4
|
-
export type RadioItemsType = (RadioValuetype | RadioItemType)[];
|
|
5
|
-
export type RadioPositionType = 'left' | 'right';
|
|
6
|
-
export type RadioDirationType = 'vertical' | 'horizontal';
|
|
7
|
-
export type RadioPropsType = {
|
|
8
|
-
className?: string;
|
|
9
|
-
groupContainerClassName?: string;
|
|
10
|
-
hasPrimitiveItemsData?: boolean;
|
|
11
|
-
id?: string;
|
|
12
|
-
items?: RadioItemsType;
|
|
13
|
-
labelClassName?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
position?: RadioPositionType;
|
|
16
|
-
direction?: RadioDirationType;
|
|
17
|
-
radioContainerClassName?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
subtitle?: string;
|
|
20
|
-
subtitleClassName?: string;
|
|
21
|
-
title?: string;
|
|
22
|
-
titleClassName?: string;
|
|
23
|
-
value?: RadioValuetype;
|
|
24
|
-
descClassName?: string;
|
|
25
|
-
onChange?: (value: RadioValuetype) => void;
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<script lang="ts">
|
|
30
|
-
let {
|
|
31
|
-
direction = 'vertical',
|
|
32
|
-
className,
|
|
33
|
-
groupContainerClassName,
|
|
34
|
-
id,
|
|
35
|
-
items = [],
|
|
36
|
-
labelClassName,
|
|
37
|
-
name,
|
|
38
|
-
position = 'left',
|
|
39
|
-
radioContainerClassName,
|
|
40
|
-
required,
|
|
41
|
-
subtitle,
|
|
42
|
-
subtitleClassName,
|
|
43
|
-
title,
|
|
44
|
-
titleClassName,
|
|
45
|
-
value = $bindable(),
|
|
46
|
-
descClassName,
|
|
47
|
-
onChange
|
|
48
|
-
}: RadioPropsType = $props();
|
|
49
|
-
|
|
50
|
-
let hasPrimitiveItemsData = $derived.by(() => {
|
|
51
|
-
if (items?.length) {
|
|
52
|
-
let item = items[0];
|
|
53
|
-
if (typeof item === 'object' && item !== null) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
});
|
|
1
|
+
<script lang="ts" module></script>
|
|
59
2
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
3
|
+
<script lang="ts">let {
|
|
4
|
+
direction = "vertical",
|
|
5
|
+
className,
|
|
6
|
+
groupContainerClassName,
|
|
7
|
+
id,
|
|
8
|
+
items = [],
|
|
9
|
+
labelClassName,
|
|
10
|
+
name,
|
|
11
|
+
position = "left",
|
|
12
|
+
radioContainerClassName,
|
|
13
|
+
required,
|
|
14
|
+
subtitle,
|
|
15
|
+
subtitleClassName,
|
|
16
|
+
title,
|
|
17
|
+
titleClassName,
|
|
18
|
+
value = $bindable(),
|
|
19
|
+
descClassName,
|
|
20
|
+
onChange
|
|
21
|
+
} = $props();
|
|
22
|
+
let hasPrimitiveItemsData = $derived.by(() => {
|
|
23
|
+
if (items?.length) {
|
|
24
|
+
let item = items[0];
|
|
25
|
+
if (typeof item === "object" && item !== null) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
});
|
|
31
|
+
let fieldsetId = $derived.by(() => {
|
|
32
|
+
if (id) {
|
|
33
|
+
return id;
|
|
34
|
+
} else {
|
|
35
|
+
return name;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
let preparedItems = $derived.by(() => {
|
|
39
|
+
if (items?.length) {
|
|
40
|
+
if (hasPrimitiveItemsData) {
|
|
41
|
+
return items.map((item) => ({ label: item, value: item }));
|
|
42
|
+
} else {
|
|
43
|
+
return items;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
});
|
|
48
|
+
function handleChange(ev, item) {
|
|
49
|
+
value = item.value;
|
|
50
|
+
if (onChange && value) {
|
|
51
|
+
onChange(value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
85
54
|
</script>
|
|
86
55
|
|
|
87
|
-
{#snippet labelSnippet(item:
|
|
56
|
+
{#snippet labelSnippet(item: RadioItem, index: number)}
|
|
88
57
|
<div class="leading-6">
|
|
89
58
|
<div class="ml-4 block text-sm font-medium text-gray-900 flex-grow {labelClassName}">
|
|
90
59
|
{item.label || ''}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export type RadioValuetype = string | boolean | number | Date;
|
|
2
|
-
export type
|
|
2
|
+
export type RadioItem = {
|
|
3
3
|
value: any;
|
|
4
4
|
label: string;
|
|
5
5
|
desc?: string;
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
7
|
+
export type RadioItems = (RadioValuetype | RadioItem)[];
|
|
8
|
+
export type RadioPosition = 'left' | 'right';
|
|
9
|
+
export type RadioDiration = 'vertical' | 'horizontal';
|
|
10
10
|
export type RadioPropsType = {
|
|
11
11
|
className?: string;
|
|
12
12
|
groupContainerClassName?: string;
|
|
13
13
|
hasPrimitiveItemsData?: boolean;
|
|
14
14
|
id?: string;
|
|
15
|
-
items?:
|
|
15
|
+
items?: RadioItems;
|
|
16
16
|
labelClassName?: string;
|
|
17
17
|
name?: string;
|
|
18
|
-
position?:
|
|
19
|
-
direction?:
|
|
18
|
+
position?: RadioPosition;
|
|
19
|
+
direction?: RadioDiration;
|
|
20
20
|
radioContainerClassName?: string;
|
|
21
21
|
required?: boolean;
|
|
22
22
|
subtitle?: string;
|