@cloudparker/moldex.js 0.0.29 → 0.0.31
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/tailwind.css +1 -1
- 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/combobox-field/combobox-field.svelte.d.ts +1 -1
- 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/radio-field/radio-field.svelte +120 -0
- package/dist/views/core/input/components/radio-field/radio-field.svelte.d.ts +45 -0
- 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/input/index.d.ts +4 -2
- package/dist/views/core/input/index.js +2 -2
- 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/no-data/components/no-data/no-data.svelte.d.ts +1 -1
- 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,51 +1,62 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ripple } from '../../../../../actions';
|
|
3
|
+
import { mdiEyeOffOutline, mdiEyeOutline } from '../../../icon';
|
|
4
|
+
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
5
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
type = 'password',
|
|
9
|
+
size,
|
|
10
|
+
appearance,
|
|
11
|
+
buttonClassName,
|
|
12
|
+
iconClassName,
|
|
13
|
+
...props
|
|
14
|
+
}: InputFieldPropsType & {
|
|
15
|
+
buttonClassName?: string;
|
|
16
|
+
iconClassName?: string;
|
|
17
|
+
} = $props();
|
|
18
|
+
|
|
19
|
+
let btnRoundedClassName = $state('');
|
|
20
|
+
let btnIconSizeClassName = $state('');
|
|
21
|
+
|
|
22
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
23
|
+
|
|
24
|
+
export function focus() {
|
|
25
|
+
inputFieldRef?.focus();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function handleTogglePassword() {
|
|
29
|
+
if (type == 'password') {
|
|
30
|
+
type = 'text';
|
|
31
|
+
} else {
|
|
32
|
+
type = 'password';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
$effect(() => {
|
|
37
|
+
if (size) {
|
|
38
|
+
switch (size) {
|
|
39
|
+
case 'lg':
|
|
40
|
+
btnIconSizeClassName = '!h-7 !w-7';
|
|
41
|
+
break;
|
|
42
|
+
case 'md':
|
|
43
|
+
btnIconSizeClassName = '!h-6 !w-6';
|
|
44
|
+
break;
|
|
45
|
+
case 'sm':
|
|
46
|
+
btnIconSizeClassName = '!h-5 !w-5';
|
|
47
|
+
break;
|
|
48
|
+
case 'xs':
|
|
49
|
+
btnIconSizeClassName = '!h-4 !w-4';
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
$effect(() => {
|
|
56
|
+
if (!appearance || appearance == 'normal') {
|
|
57
|
+
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
58
|
+
}
|
|
59
|
+
});
|
|
49
60
|
</script>
|
|
50
61
|
|
|
51
62
|
{#snippet showPasswordButton()}
|
|
@@ -1,51 +1,65 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ripple } from '../../../../../actions';
|
|
3
|
+
import EasyScriptLoader from '@cloudparker/easy-script-loader-svelte';
|
|
4
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
5
|
+
import { isMobileScreen, openListPickerDialog } from '../../../../../services';
|
|
6
|
+
import type { DialogSizeType } from '../../../dialog';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
value,
|
|
10
|
+
size,
|
|
11
|
+
appearance,
|
|
12
|
+
buttonClassName,
|
|
13
|
+
className,
|
|
14
|
+
dialCode = $bindable('+1'),
|
|
15
|
+
...props
|
|
16
|
+
}: InputFieldPropsType & {
|
|
17
|
+
buttonClassName?: string;
|
|
18
|
+
dialCode?: string;
|
|
19
|
+
} = $props();
|
|
20
|
+
|
|
21
|
+
let btnRoundedClassName = $state('');
|
|
22
|
+
|
|
23
|
+
let EasyCountryData: any;
|
|
24
|
+
|
|
25
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
26
|
+
|
|
27
|
+
export function focus() {
|
|
28
|
+
inputFieldRef?.focus();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function hanleDialCodePicker() {
|
|
32
|
+
if (EasyCountryData) {
|
|
33
|
+
let items = EasyCountryData.getCountries();
|
|
34
|
+
// console.log('Countries', items);
|
|
35
|
+
let size: DialogSizeType = isMobileScreen() ? 'full' : 'sm';
|
|
36
|
+
let res: string = await openListPickerDialog<string>({
|
|
37
|
+
items,
|
|
38
|
+
itemTitle: 'dialCode',
|
|
39
|
+
itemSubtitle: 'name',
|
|
40
|
+
size,
|
|
41
|
+
hasCheck: true,
|
|
42
|
+
identity: 'dialCode'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(res);
|
|
46
|
+
if (res) {
|
|
47
|
+
dialCode = res;
|
|
48
|
+
inputFieldRef && inputFieldRef.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function handleScriptLoad(lib: any) {
|
|
54
|
+
console.log(lib);
|
|
55
|
+
EasyCountryData = lib;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$effect(() => {
|
|
59
|
+
if (!appearance || appearance == 'normal') {
|
|
60
|
+
btnRoundedClassName = 'rounded-tl-lg rounded-bl-lg';
|
|
61
|
+
}
|
|
62
|
+
});
|
|
49
63
|
</script>
|
|
50
64
|
|
|
51
65
|
{#snippet showPasswordButton()}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type RadioValuetype = string | boolean | number | Date;
|
|
3
|
+
export type RadioItemType = { value: any; label: 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
|
+
onChange?: (value: RadioValuetype) => void;
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
let {
|
|
30
|
+
direction = 'vertical',
|
|
31
|
+
className,
|
|
32
|
+
groupContainerClassName,
|
|
33
|
+
hasPrimitiveItemsData,
|
|
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
|
+
onChange
|
|
47
|
+
}: RadioPropsType = $props();
|
|
48
|
+
|
|
49
|
+
let fieldsetId = $derived.by(() => {
|
|
50
|
+
if (id) {
|
|
51
|
+
return id;
|
|
52
|
+
} else {
|
|
53
|
+
return name;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
let preparedItems: RadioItemType[] = $derived.by(() => {
|
|
58
|
+
if (items?.length) {
|
|
59
|
+
if (hasPrimitiveItemsData) {
|
|
60
|
+
return items.map((item) => ({ label: item, value: item }) as RadioItemType);
|
|
61
|
+
} else {
|
|
62
|
+
return items as RadioItemType[];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return [];
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
function handleChange(ev: Event, item: RadioItemType) {
|
|
69
|
+
value = item.value;
|
|
70
|
+
if (onChange && value) {
|
|
71
|
+
onChange(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
{#snippet labelSnippet(item: RadioItemType, index: number)}
|
|
77
|
+
<label
|
|
78
|
+
for="option-{index}"
|
|
79
|
+
class="ml-3 block text-sm font-medium leading-6 text-gray-900 flex-grow cursor-pointer select-none {required
|
|
80
|
+
? 'required'
|
|
81
|
+
: ''} {labelClassName}">{item.label || ''}</label
|
|
82
|
+
>
|
|
83
|
+
{/snippet}
|
|
84
|
+
|
|
85
|
+
<fieldset id={fieldsetId}>
|
|
86
|
+
{#if title}
|
|
87
|
+
<legend class="text-sm font-semibold leading-6 text-gray-900 {titleClassName}">{title}</legend>
|
|
88
|
+
{/if}
|
|
89
|
+
{#if subtitle}
|
|
90
|
+
<p class="mt-1 text-sm leading-6 text-gray-600 {subtitleClassName}">{subtitle}</p>
|
|
91
|
+
{/if}
|
|
92
|
+
|
|
93
|
+
<div
|
|
94
|
+
class="{title || subtitle ? 'mt-6' : ''} {direction == 'vertical'
|
|
95
|
+
? 'space-y-4'
|
|
96
|
+
: 'space-x-6 flex items-center'} {groupContainerClassName} "
|
|
97
|
+
>
|
|
98
|
+
{#each preparedItems || [] as item, index}
|
|
99
|
+
<div class="flex items-center {radioContainerClassName}">
|
|
100
|
+
{#if position == 'right'}
|
|
101
|
+
{@render labelSnippet(item, index)}
|
|
102
|
+
{/if}
|
|
103
|
+
|
|
104
|
+
<input
|
|
105
|
+
id="option-{index}"
|
|
106
|
+
{name}
|
|
107
|
+
type="radio"
|
|
108
|
+
value={item.value}
|
|
109
|
+
checked={value === item.value}
|
|
110
|
+
class="h-4 w-4 cursor-pointer select-none border-gray-300 text-indigo-600 focus:ring-indigo-600 {className}"
|
|
111
|
+
onchange={(ev) => handleChange(ev, item)}
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
{#if position == 'left'}
|
|
115
|
+
{@render labelSnippet(item, index)}
|
|
116
|
+
{/if}
|
|
117
|
+
</div>
|
|
118
|
+
{/each}
|
|
119
|
+
</div>
|
|
120
|
+
</fieldset>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type RadioValuetype = string | boolean | number | Date;
|
|
2
|
+
export type RadioItemType = {
|
|
3
|
+
value: any;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
export type RadioItemsType = (RadioValuetype | RadioItemType)[];
|
|
7
|
+
export type RadioPositionType = 'left' | 'right';
|
|
8
|
+
export type RadioDirationType = 'vertical' | 'horizontal';
|
|
9
|
+
export type RadioPropsType = {
|
|
10
|
+
className?: string;
|
|
11
|
+
groupContainerClassName?: string;
|
|
12
|
+
hasPrimitiveItemsData?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
items?: RadioItemsType;
|
|
15
|
+
labelClassName?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
position?: RadioPositionType;
|
|
18
|
+
direction?: RadioDirationType;
|
|
19
|
+
radioContainerClassName?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
subtitle?: string;
|
|
22
|
+
subtitleClassName?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
titleClassName?: string;
|
|
25
|
+
value?: RadioValuetype;
|
|
26
|
+
onChange?: (value: RadioValuetype) => void;
|
|
27
|
+
};
|
|
28
|
+
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> {
|
|
29
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
30
|
+
$$bindings?: Bindings;
|
|
31
|
+
} & Exports;
|
|
32
|
+
(internal: unknown, props: Props & {
|
|
33
|
+
$$events?: Events;
|
|
34
|
+
$$slots?: Slots;
|
|
35
|
+
}): Exports & {
|
|
36
|
+
$set?: any;
|
|
37
|
+
$on?: any;
|
|
38
|
+
};
|
|
39
|
+
z_$$bindings?: Bindings;
|
|
40
|
+
}
|
|
41
|
+
declare const RadioField: $$__sveltets_2_IsomorphicComponent<RadioPropsType, {
|
|
42
|
+
[evt: string]: CustomEvent<any>;
|
|
43
|
+
}, {}, {}, "value">;
|
|
44
|
+
type RadioField = InstanceType<typeof RadioField>;
|
|
45
|
+
export default RadioField;
|
|
@@ -1,35 +1,54 @@
|
|
|
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
|
-
});
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, {
|
|
3
|
+
type InputFieldSizeType
|
|
4
|
+
} from '../input-field/input-field.svelte';
|
|
5
|
+
|
|
6
|
+
type RangeFieldPropsType = {
|
|
7
|
+
id?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
size?: InputFieldSizeType;
|
|
11
|
+
value?: number;
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
step?: number;
|
|
15
|
+
oninput?: (ev: any) => void;
|
|
16
|
+
onfocus?: (ev: any) => void;
|
|
17
|
+
onblur?: (ev: any) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
id,
|
|
22
|
+
value = $bindable(50),
|
|
23
|
+
size = 'md',
|
|
24
|
+
min = 0,
|
|
25
|
+
max = 100,
|
|
26
|
+
name,
|
|
27
|
+
step,
|
|
28
|
+
className,
|
|
29
|
+
oninput,
|
|
30
|
+
onblur,
|
|
31
|
+
onfocus
|
|
32
|
+
}: RangeFieldPropsType = $props();
|
|
33
|
+
|
|
34
|
+
let rangeSizeClassName = $state('');
|
|
35
|
+
|
|
36
|
+
$effect(() => {
|
|
37
|
+
switch (size) {
|
|
38
|
+
case 'lg':
|
|
39
|
+
rangeSizeClassName = 'h-3 ';
|
|
40
|
+
break;
|
|
41
|
+
case 'md':
|
|
42
|
+
rangeSizeClassName = 'h-2 ';
|
|
43
|
+
break;
|
|
44
|
+
case 'sm':
|
|
45
|
+
rangeSizeClassName = 'h-1 ';
|
|
46
|
+
break;
|
|
47
|
+
case 'xs':
|
|
48
|
+
rangeSizeClassName = 'h-2-px ';
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
33
52
|
</script>
|
|
34
53
|
|
|
35
54
|
<input
|
|
@@ -1,41 +1,55 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { mdiMagnify } from '../../../icon';
|
|
3
|
+
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
4
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
className,
|
|
8
|
+
placeholder,
|
|
9
|
+
iconClassName,
|
|
10
|
+
onSearch,
|
|
11
|
+
...props
|
|
12
|
+
}: InputFieldPropsType & { iconClassName?: string; onSearch?: (value: string) => void } =
|
|
13
|
+
$props();
|
|
14
|
+
|
|
15
|
+
const debouncedSearch = debounce(search, 300);
|
|
16
|
+
let lastQuery: string;
|
|
17
|
+
|
|
18
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
19
|
+
|
|
20
|
+
export function focus() {
|
|
21
|
+
inputFieldRef?.focus();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function handleInput(ev: any) {
|
|
25
|
+
// console.log(ev);
|
|
26
|
+
let input: HTMLInputElement = ev?.target;
|
|
27
|
+
if (input) {
|
|
28
|
+
let searchText = (input.value || '').toLowerCase().trim();
|
|
29
|
+
debouncedSearch(searchText);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function search(query: string) {
|
|
34
|
+
if (lastQuery != query) {
|
|
35
|
+
onSearch && onSearch(query);
|
|
36
|
+
lastQuery = query;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function debounce<T extends (...args: any[]) => void>(
|
|
41
|
+
func: T,
|
|
42
|
+
wait: number
|
|
43
|
+
): (...args: Parameters<T>) => void {
|
|
44
|
+
let timeout: ReturnType<typeof setTimeout>;
|
|
45
|
+
|
|
46
|
+
return function (...args: Parameters<T>) {
|
|
47
|
+
clearTimeout(timeout);
|
|
48
|
+
timeout = setTimeout(() => {
|
|
49
|
+
func(...args);
|
|
50
|
+
}, wait);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
39
53
|
</script>
|
|
40
54
|
|
|
41
55
|
{#snippet searchIcon()}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
3
|
+
|
|
4
|
+
let { maxlength, ...props }: InputFieldPropsType = $props();
|
|
5
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
6
|
+
|
|
7
|
+
export function focus() {
|
|
8
|
+
inputFieldRef?.focus();
|
|
9
|
+
}
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<InputField bind:this={inputFieldRef} {...props} type="text" maxlength={maxlength || 200} />
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
3
|
+
|
|
4
|
+
let props: InputFieldPropsType = $props();
|
|
5
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
6
|
+
|
|
7
|
+
export function focus() {
|
|
8
|
+
inputFieldRef?.focus();
|
|
9
|
+
}
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<InputField bind:this={inputFieldRef} {...props} type="textarea" maxlength={props?.maxlength || 200} />
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
3
|
+
|
|
4
|
+
let props: InputFieldPropsType = $props();
|
|
5
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
6
|
+
|
|
7
|
+
export function focus() {
|
|
8
|
+
inputFieldRef?.focus();
|
|
9
|
+
}
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<InputField bind:this={inputFieldRef} {...props} type="time" />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type InputFieldAppearanceType, type InputFieldPropsType, type InputFieldSizeType } from "./components/input-field/input-field.svelte";
|
|
2
|
+
import type { RadioDirationType, RadioItemsType, RadioItemType, RadioPositionType, RadioPropsType, RadioValuetype } from "./components/radio-field/radio-field.svelte";
|
|
2
3
|
import ColorField from "./components/color-field/color-field.svelte";
|
|
3
4
|
import ComboboxField from "./components/combobox-field/combobox-field.svelte";
|
|
4
5
|
import DateField from "./components/date-field/date-field.svelte";
|
|
@@ -10,10 +11,11 @@ import Label from "./components/label/label.svelte";
|
|
|
10
11
|
import NumberField from "./components/number-field/number-field.svelte";
|
|
11
12
|
import PasswordField from "./components/password-field/password-field.svelte";
|
|
12
13
|
import PhoneField from "./components/phone-field/phone-field.svelte";
|
|
14
|
+
import RadioField from "./components/radio-field/radio-field.svelte";
|
|
13
15
|
import RangeField from "./components/range-field/range-field.svelte";
|
|
14
16
|
import SearchField from "./components/search-field/search-field.svelte";
|
|
15
17
|
import TextField from "./components/text-field/text-field.svelte";
|
|
16
18
|
import TextareaField from "./components/textarea-field/textarea-field.svelte";
|
|
17
19
|
import TimeField from "./components/time-field/time-field.svelte";
|
|
18
|
-
export {
|
|
19
|
-
export { ColorField, ComboboxField, DateField, DatetimeField, EmailField, FileField, InputField, Label, NumberField, PasswordField, PhoneField, RangeField, SearchField, TextareaField, TextField, TimeField };
|
|
20
|
+
export type { InputFieldAppearanceType, InputFieldPropsType, InputFieldSizeType, RadioDirationType, RadioItemsType, RadioItemType, RadioPositionType, RadioPropsType, RadioValuetype };
|
|
21
|
+
export { ColorField, ComboboxField, DateField, DatetimeField, EmailField, FileField, InputField, Label, NumberField, PasswordField, PhoneField, RadioField, RangeField, SearchField, TextareaField, TextField, TimeField };
|