@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,37 +1,58 @@
|
|
|
1
|
-
<script module lang="ts"
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type ButtonPropsType = {
|
|
3
|
+
id?: string;
|
|
4
|
+
type?: 'button' | 'submit' | 'reset';
|
|
5
|
+
form?: string | null;
|
|
6
|
+
className?: string;
|
|
7
|
+
iconPath?: string;
|
|
8
|
+
iconClassName?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
rightIconPath?: string;
|
|
11
|
+
rightIconClassName?: string;
|
|
12
|
+
spinner?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
spinnerClassName?: string;
|
|
15
|
+
onlySpinner?: boolean;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
useRipple?: boolean;
|
|
18
|
+
onClick?: (ev: MouseEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import '../../../../../tailwind.css';
|
|
24
|
+
import { ripple, type RipplePropsType } from '../../../../../actions/ripple.js';
|
|
25
|
+
import type { Snippet } from 'svelte';
|
|
26
|
+
import { Spinner } from '../../../spinner';
|
|
27
|
+
import { Icon } from '../../../icon';
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
id = '',
|
|
31
|
+
form = undefined,
|
|
32
|
+
type = 'button',
|
|
33
|
+
label = '',
|
|
34
|
+
className = '',
|
|
35
|
+
iconPath = '',
|
|
36
|
+
iconClassName = '',
|
|
37
|
+
rightIconPath = '',
|
|
38
|
+
rightIconClassName = '',
|
|
39
|
+
spinner = false,
|
|
40
|
+
disabled = false,
|
|
41
|
+
spinnerClassName = '',
|
|
42
|
+
onlySpinner = false,
|
|
43
|
+
children,
|
|
44
|
+
useRipple = true,
|
|
45
|
+
onClick = (ev: MouseEvent) => {}
|
|
46
|
+
}: ButtonPropsType = $props();
|
|
2
47
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
label = "",
|
|
12
|
-
className = "",
|
|
13
|
-
iconPath = "",
|
|
14
|
-
iconClassName = "",
|
|
15
|
-
rightIconPath = "",
|
|
16
|
-
rightIconClassName = "",
|
|
17
|
-
spinner = false,
|
|
18
|
-
disabled = false,
|
|
19
|
-
spinnerClassName = "",
|
|
20
|
-
onlySpinner = false,
|
|
21
|
-
children,
|
|
22
|
-
useRipple = true,
|
|
23
|
-
onClick = (ev) => {
|
|
24
|
-
}
|
|
25
|
-
} = $props();
|
|
26
|
-
function maybeRipple(node, options) {
|
|
27
|
-
if (useRipple) {
|
|
28
|
-
return ripple(node, options);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
destroy() {
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
48
|
+
function maybeRipple(node: HTMLElement, options?: RipplePropsType) {
|
|
49
|
+
if (useRipple) {
|
|
50
|
+
return ripple(node, options);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
destroy() {}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
35
56
|
</script>
|
|
36
57
|
|
|
37
58
|
{#snippet buttonContent()}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isSmallScreen } from '../../../../../services';
|
|
3
|
+
import { mdiArrowLeft, mdiChevronRight } from '../../../icon';
|
|
4
|
+
import Button from '../button/button.svelte';
|
|
5
|
+
|
|
6
|
+
type PropsType = {
|
|
7
|
+
iconPath?: string;
|
|
8
|
+
iconClassName?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
onlyMobile?: boolean;
|
|
11
|
+
onClick?: (ev: MouseEvent) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
iconPath = mdiArrowLeft,
|
|
16
|
+
iconClassName = '',
|
|
17
|
+
className = '',
|
|
18
|
+
onlyMobile,
|
|
19
|
+
onClick
|
|
20
|
+
}: PropsType = $props();
|
|
21
|
+
|
|
22
|
+
let isMobileScreen = $state(false);
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
isMobileScreen = isSmallScreen();
|
|
26
|
+
});
|
|
15
27
|
</script>
|
|
16
28
|
|
|
17
29
|
{#snippet button()}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button, { type ButtonPropsType } from '../button/button.svelte';
|
|
3
|
+
|
|
4
|
+
let { className, ...props }: ButtonPropsType = $props();
|
|
3
5
|
</script>
|
|
4
6
|
|
|
5
7
|
<Button {...props} className="bg-gray-100 focus:bg-gray-200 p-2 px-4 {className}" />
|
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isSmallScreen } from '../../../../../services';
|
|
3
|
+
import { mdiArrowLeft, mdiChevronRight, mdiClose } from '../../../icon';
|
|
4
|
+
import Button from '../button/button.svelte';
|
|
5
|
+
|
|
6
|
+
type PropsType = {
|
|
7
|
+
label?: string;
|
|
8
|
+
iconPath?: string;
|
|
9
|
+
iconClassName?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
onlyWeb?: boolean;
|
|
12
|
+
|
|
13
|
+
onClick?: (ev: MouseEvent) => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
label = 'Close',
|
|
18
|
+
iconPath = mdiClose,
|
|
19
|
+
iconClassName = '',
|
|
20
|
+
className = '',
|
|
21
|
+
onlyWeb,
|
|
22
|
+
onClick
|
|
23
|
+
}: PropsType = $props();
|
|
24
|
+
|
|
25
|
+
let isMobileScreen = $state(false);
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
isMobileScreen = isSmallScreen();
|
|
29
|
+
});
|
|
16
30
|
</script>
|
|
17
31
|
|
|
18
32
|
{#snippet button()}
|
|
@@ -1,34 +1,82 @@
|
|
|
1
|
-
<script module lang="ts"
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type ListItemType = {
|
|
3
|
+
id?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
titleClassName?: string;
|
|
7
|
+
subtitleClassName?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
iconPath?: string;
|
|
11
|
+
iconClassName?: string;
|
|
12
|
+
imgSrc?: string;
|
|
13
|
+
imgClassName?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
openInNewWindow?: boolean;
|
|
16
|
+
divider?: boolean;
|
|
17
|
+
hasArrow?: boolean;
|
|
18
|
+
arrowIconPath?: string;
|
|
19
|
+
arrowClassName?: string;
|
|
20
|
+
isChecked?: boolean;
|
|
21
|
+
onclick?: (ev: MouseEvent, item: ListItemType) => void;
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import '../../../../../tailwind.css';
|
|
27
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
28
|
+
|
|
29
|
+
import type { Snippet } from 'svelte';
|
|
30
|
+
import {
|
|
31
|
+
Icon,
|
|
32
|
+
mdiCheckCircle,
|
|
33
|
+
mdiCheckCircleOutline,
|
|
34
|
+
mdiChevronRight
|
|
35
|
+
} from '../../../icon';
|
|
36
|
+
|
|
37
|
+
type PropsType = {
|
|
38
|
+
item: ListItemType;
|
|
39
|
+
index: number;
|
|
40
|
+
id?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
hasCheckbox?: boolean;
|
|
43
|
+
checkIconPath?: string;
|
|
44
|
+
uncheckIconPath?: string;
|
|
45
|
+
checkIconClassName?: string;
|
|
46
|
+
uncheckIconClassName?: string;
|
|
47
|
+
checkClassName?: string;
|
|
48
|
+
iconClassName?: string;
|
|
49
|
+
imgClassName?: string;
|
|
50
|
+
titleClassName?: string;
|
|
51
|
+
subtitleClassName?: string;
|
|
52
|
+
hasArrow?: boolean;
|
|
53
|
+
arrowIconPath?: string;
|
|
54
|
+
arrowClassName?: string;
|
|
55
|
+
onClick?: (ev: MouseEvent, item: ListItemType, index: number) => void;
|
|
56
|
+
children?: Snippet<[ListItemType, number]>;
|
|
57
|
+
};
|
|
2
58
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
subtitleClassName = "",
|
|
25
|
-
checkClassName = "",
|
|
26
|
-
hasArrow = false,
|
|
27
|
-
arrowIconPath = mdiChevronRight,
|
|
28
|
-
arrowClassName = "",
|
|
29
|
-
onClick,
|
|
30
|
-
children
|
|
31
|
-
} = $props();
|
|
59
|
+
let {
|
|
60
|
+
item,
|
|
61
|
+
index,
|
|
62
|
+
id = '',
|
|
63
|
+
className = '',
|
|
64
|
+
hasCheckbox = false,
|
|
65
|
+
uncheckIconPath = mdiCheckCircleOutline,
|
|
66
|
+
checkIconPath = mdiCheckCircle,
|
|
67
|
+
checkIconClassName = '',
|
|
68
|
+
uncheckIconClassName = '',
|
|
69
|
+
iconClassName = '',
|
|
70
|
+
imgClassName = '',
|
|
71
|
+
titleClassName = '',
|
|
72
|
+
subtitleClassName = '',
|
|
73
|
+
checkClassName = '',
|
|
74
|
+
hasArrow = false,
|
|
75
|
+
arrowIconPath = mdiChevronRight,
|
|
76
|
+
arrowClassName = '',
|
|
77
|
+
onClick,
|
|
78
|
+
children
|
|
79
|
+
}: PropsType = $props();
|
|
32
80
|
</script>
|
|
33
81
|
|
|
34
82
|
{#snippet itemInternal()}
|
|
@@ -1,93 +1,146 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '../../../../../tailwind.css';
|
|
3
|
+
|
|
4
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
5
|
+
|
|
6
|
+
import { Icon, mdiCheckCircle, mdiCheckCircleOutline, mdiChevronDown } from '../../../icon';
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { ListItemType } from '../button-list-item/button-list-item.svelte';
|
|
9
|
+
import ButtonListItem from '../button-list-item/button-list-item.svelte';
|
|
10
|
+
|
|
11
|
+
enum MenuStateEnum {
|
|
12
|
+
OPENED,
|
|
13
|
+
CLOSED
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type PropsType = {
|
|
17
|
+
id?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
screenOnlyDesc?: string;
|
|
20
|
+
style?: string;
|
|
21
|
+
disabled?: boolean | undefined | null;
|
|
22
|
+
imgSrc?:string;
|
|
23
|
+
imgClassName?: string;
|
|
24
|
+
imgAlt?: string;
|
|
25
|
+
leftIconPath?: string;
|
|
26
|
+
leftIconClassName?: string;
|
|
27
|
+
rightIconPath?: string;
|
|
28
|
+
rightIconClassName?: string;
|
|
29
|
+
title?: string | any;
|
|
30
|
+
titleClassName?: string;
|
|
31
|
+
dropdownClassName?: string;
|
|
32
|
+
dropdownStyle?: string;
|
|
33
|
+
hasCheck?: boolean;
|
|
34
|
+
checkIconPath?: string;
|
|
35
|
+
checkIconClassName?: string;
|
|
36
|
+
menus?: string[] | ListItemType[];
|
|
37
|
+
containerClassName?: string;
|
|
38
|
+
backgropClassName?: string;
|
|
39
|
+
menuItemClassName?: string;
|
|
40
|
+
uncheckIconPath?: string;
|
|
41
|
+
uncheckIconClassName?: string;
|
|
42
|
+
dropdownOpenClassName?: string;
|
|
43
|
+
dropdownCloseClassName?: string;
|
|
44
|
+
checkClassName?: string;
|
|
45
|
+
listIconClassName?: string;
|
|
46
|
+
listImgClassName?: string;
|
|
47
|
+
listTitleClassName?: string;
|
|
48
|
+
listSubtitleClassName?: string;
|
|
49
|
+
dividerClassName?: string;
|
|
50
|
+
dropIconPath?: string;
|
|
51
|
+
dropIconClassName?: string;
|
|
52
|
+
onmenuclick?: (ev: MouseEvent, item: string | ListItemType, index: number) => void;
|
|
53
|
+
children?: Snippet;
|
|
54
|
+
buttonSnippet?: Snippet;
|
|
55
|
+
menuItemSnippet?: Snippet<[ListItemType, number]>;
|
|
56
|
+
menuItemInnerSnippet?: Snippet<[ListItemType, number]>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let {
|
|
60
|
+
id = 'menu',
|
|
61
|
+
className = '',
|
|
62
|
+
screenOnlyDesc = 'Menu',
|
|
63
|
+
style = '',
|
|
64
|
+
imgSrc = '',
|
|
65
|
+
imgClassName = '',
|
|
66
|
+
imgAlt = 'Menu',
|
|
67
|
+
leftIconPath = '',
|
|
68
|
+
leftIconClassName = '',
|
|
69
|
+
rightIconPath = '',
|
|
70
|
+
rightIconClassName = '',
|
|
71
|
+
dropIconPath = mdiChevronDown,
|
|
72
|
+
dropIconClassName = '',
|
|
73
|
+
titleClassName = '',
|
|
74
|
+
title = 'Button',
|
|
75
|
+
dropdownStyle = '',
|
|
76
|
+
dropdownClassName = '',
|
|
77
|
+
hasCheck = false,
|
|
78
|
+
uncheckIconPath = mdiCheckCircleOutline,
|
|
79
|
+
checkIconPath = mdiCheckCircle,
|
|
80
|
+
checkIconClassName = '',
|
|
81
|
+
containerClassName = '',
|
|
82
|
+
backgropClassName = '',
|
|
83
|
+
menus = [],
|
|
84
|
+
menuItemClassName = '',
|
|
85
|
+
uncheckIconClassName = '',
|
|
86
|
+
dropdownOpenClassName = '',
|
|
87
|
+
dropdownCloseClassName = '',
|
|
88
|
+
checkClassName = '',
|
|
89
|
+
listIconClassName = '',
|
|
90
|
+
listImgClassName = '',
|
|
91
|
+
listTitleClassName = '',
|
|
92
|
+
listSubtitleClassName = '',
|
|
93
|
+
dividerClassName = '',
|
|
94
|
+
onmenuclick = (ev: MouseEvent, item: string | ListItemType, index: number) => {},
|
|
95
|
+
children,
|
|
96
|
+
buttonSnippet,
|
|
97
|
+
menuItemSnippet,
|
|
98
|
+
menuItemInnerSnippet
|
|
99
|
+
}: PropsType = $props();
|
|
100
|
+
|
|
101
|
+
let expanded = $state(false);
|
|
102
|
+
let dropdownState: MenuStateEnum = $state(MenuStateEnum.CLOSED);
|
|
103
|
+
let options: ListItemType[] = $state([]);
|
|
104
|
+
let selectedMenu: ListItemType | null | undefined = $state(null);
|
|
105
|
+
|
|
106
|
+
function hendleToggleDropdown(ev: MouseEvent) {
|
|
107
|
+
ev && ev.stopPropagation();
|
|
108
|
+
if (dropdownState == MenuStateEnum.CLOSED) {
|
|
109
|
+
dropdownState = MenuStateEnum.OPENED;
|
|
110
|
+
} else {
|
|
111
|
+
dropdownState = MenuStateEnum.CLOSED;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function handlemenuItemClick(ev: MouseEvent, menu: ListItemType, index: number) {
|
|
116
|
+
hendleToggleDropdown(ev);
|
|
117
|
+
if (onmenuclick) {
|
|
118
|
+
let item = menus[index];
|
|
119
|
+
|
|
120
|
+
if (item) {
|
|
121
|
+
onmenuclick(ev, item, index);
|
|
122
|
+
}
|
|
123
|
+
selectedMenu = menu;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
$effect(() => {
|
|
128
|
+
if (menus?.length) {
|
|
129
|
+
let item = menus[0];
|
|
130
|
+
if (typeof item == 'string') {
|
|
131
|
+
options = menus.map((str) => {
|
|
132
|
+
if (str == '-' || str == '') {
|
|
133
|
+
return { divider: true } as ListItemType;
|
|
134
|
+
} else {
|
|
135
|
+
return { label: str } as ListItemType;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
options = [];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
91
144
|
</script>
|
|
92
145
|
|
|
93
146
|
<div class="relative min-h-max {containerClassName}">
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button, { type ButtonPropsType } from '../button/button.svelte';
|
|
3
|
+
|
|
4
|
+
let { className, ...props }: ButtonPropsType = $props();
|
|
3
5
|
</script>
|
|
4
6
|
|
|
5
7
|
<Button {...props} className="bg-indigo-600 focus:bg-indigo-700 text-white p-2 px-4 {className}" />
|