@h-ai/ui 0.1.0-alpha.28 → 0.1.0-alpha.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/README.md +12 -0
- package/dist/components/compounds/Accordion.svelte +6 -3
- package/dist/components/compounds/Accordion.svelte.d.ts +3 -1
- package/dist/components/compounds/ActionSheet.svelte +11 -8
- package/dist/components/compounds/ActionSheet.svelte.d.ts +3 -1
- package/dist/components/compounds/Alert.svelte +6 -4
- package/dist/components/compounds/Alert.svelte.d.ts +3 -2
- package/dist/components/compounds/AppBar.svelte +13 -9
- package/dist/components/compounds/AppBar.svelte.d.ts +3 -1
- package/dist/components/compounds/BottomNav.svelte +13 -10
- package/dist/components/compounds/BottomNav.svelte.d.ts +3 -1
- package/dist/components/compounds/Breadcrumb.svelte +6 -4
- package/dist/components/compounds/Breadcrumb.svelte.d.ts +3 -2
- package/dist/components/compounds/Calendar.svelte +7 -2
- package/dist/components/compounds/Calendar.svelte.d.ts +3 -1
- package/dist/components/compounds/Card.svelte +6 -4
- package/dist/components/compounds/Card.svelte.d.ts +3 -2
- package/dist/components/compounds/Combobox.svelte +6 -2
- package/dist/components/compounds/Combobox.svelte.d.ts +3 -1
- package/dist/components/compounds/Confirm.svelte +9 -7
- package/dist/components/compounds/Confirm.svelte.d.ts +3 -2
- package/dist/components/compounds/DataTable.svelte +6 -2
- package/dist/components/compounds/DataTable.svelte.d.ts +2 -1
- package/dist/components/compounds/DatePicker.svelte +7 -2
- package/dist/components/compounds/DatePicker.svelte.d.ts +3 -1
- package/dist/components/compounds/Drawer.svelte +6 -4
- package/dist/components/compounds/Drawer.svelte.d.ts +3 -2
- package/dist/components/compounds/Dropdown.svelte +6 -4
- package/dist/components/compounds/Dropdown.svelte.d.ts +3 -2
- package/dist/components/compounds/Empty.svelte +6 -4
- package/dist/components/compounds/Empty.svelte.d.ts +3 -2
- package/dist/components/compounds/Form.svelte +11 -9
- package/dist/components/compounds/Form.svelte.d.ts +3 -2
- package/dist/components/compounds/FormField.svelte +6 -4
- package/dist/components/compounds/FormField.svelte.d.ts +3 -2
- package/dist/components/compounds/InfiniteScroll.svelte +10 -7
- package/dist/components/compounds/InfiniteScroll.svelte.d.ts +3 -1
- package/dist/components/compounds/MessageBoxContainer.svelte +6 -1
- package/dist/components/compounds/MessageBoxContainer.svelte.d.ts +3 -17
- package/dist/components/compounds/MessageBoxDialog.svelte +9 -7
- package/dist/components/compounds/MessageBoxDialog.svelte.d.ts +2 -1
- package/dist/components/compounds/MessageContainer.svelte +6 -2
- package/dist/components/compounds/MessageContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Modal.svelte +9 -7
- package/dist/components/compounds/Modal.svelte.d.ts +3 -2
- package/dist/components/compounds/PageHeader.svelte +6 -2
- package/dist/components/compounds/PageHeader.svelte.d.ts +3 -1
- package/dist/components/compounds/Pagination.svelte +6 -4
- package/dist/components/compounds/Pagination.svelte.d.ts +3 -2
- package/dist/components/compounds/Popover.svelte +10 -8
- package/dist/components/compounds/Popover.svelte.d.ts +3 -2
- package/dist/components/compounds/PullRefresh.svelte +11 -8
- package/dist/components/compounds/PullRefresh.svelte.d.ts +3 -1
- package/dist/components/compounds/Result.svelte +6 -4
- package/dist/components/compounds/Result.svelte.d.ts +3 -2
- package/dist/components/compounds/SafeArea.svelte +6 -3
- package/dist/components/compounds/SafeArea.svelte.d.ts +3 -1
- package/dist/components/compounds/Skeleton.svelte +6 -4
- package/dist/components/compounds/Skeleton.svelte.d.ts +3 -2
- package/dist/components/compounds/Steps.svelte +6 -4
- package/dist/components/compounds/Steps.svelte.d.ts +3 -2
- package/dist/components/compounds/SwipeCell.svelte +6 -3
- package/dist/components/compounds/SwipeCell.svelte.d.ts +3 -1
- package/dist/components/compounds/Tabs.svelte +6 -4
- package/dist/components/compounds/Tabs.svelte.d.ts +3 -2
- package/dist/components/compounds/TagInput.svelte +11 -9
- package/dist/components/compounds/TagInput.svelte.d.ts +3 -2
- package/dist/components/compounds/Timeline.svelte +6 -3
- package/dist/components/compounds/Timeline.svelte.d.ts +3 -1
- package/dist/components/compounds/ToastContainer.svelte +6 -2
- package/dist/components/compounds/ToastContainer.svelte.d.ts +2 -1
- package/dist/components/compounds/Tooltip.svelte +6 -4
- package/dist/components/compounds/Tooltip.svelte.d.ts +3 -2
- package/dist/components/primitives/Avatar.svelte +6 -4
- package/dist/components/primitives/Avatar.svelte.d.ts +3 -2
- package/dist/components/primitives/Badge.svelte +6 -4
- package/dist/components/primitives/Badge.svelte.d.ts +3 -2
- package/dist/components/primitives/BareButton.svelte +15 -12
- package/dist/components/primitives/BareButton.svelte.d.ts +3 -2
- package/dist/components/primitives/BareInput.svelte +37 -34
- package/dist/components/primitives/BareInput.svelte.d.ts +3 -2
- package/dist/components/primitives/Button.svelte +12 -10
- package/dist/components/primitives/Button.svelte.d.ts +3 -2
- package/dist/components/primitives/Checkbox.svelte +6 -4
- package/dist/components/primitives/Checkbox.svelte.d.ts +3 -2
- package/dist/components/primitives/IconButton.svelte +6 -4
- package/dist/components/primitives/IconButton.svelte.d.ts +3 -2
- package/dist/components/primitives/Input.svelte +6 -4
- package/dist/components/primitives/Input.svelte.d.ts +3 -2
- package/dist/components/primitives/Progress.svelte +6 -4
- package/dist/components/primitives/Progress.svelte.d.ts +3 -2
- package/dist/components/primitives/Radio.svelte +6 -4
- package/dist/components/primitives/Radio.svelte.d.ts +2 -2
- package/dist/components/primitives/Range.svelte +6 -3
- package/dist/components/primitives/Range.svelte.d.ts +3 -1
- package/dist/components/primitives/Rating.svelte +6 -3
- package/dist/components/primitives/Rating.svelte.d.ts +3 -1
- package/dist/components/primitives/Select.svelte +6 -4
- package/dist/components/primitives/Select.svelte.d.ts +2 -2
- package/dist/components/primitives/Spinner.svelte +6 -4
- package/dist/components/primitives/Spinner.svelte.d.ts +3 -2
- package/dist/components/primitives/Switch.svelte +6 -4
- package/dist/components/primitives/Switch.svelte.d.ts +3 -2
- package/dist/components/primitives/Tag.svelte +6 -4
- package/dist/components/primitives/Tag.svelte.d.ts +3 -2
- package/dist/components/primitives/Textarea.svelte +6 -4
- package/dist/components/primitives/Textarea.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleCheckbox.svelte +13 -10
- package/dist/components/primitives/ToggleCheckbox.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleInput.svelte +13 -10
- package/dist/components/primitives/ToggleInput.svelte.d.ts +3 -2
- package/dist/components/primitives/ToggleRadio.svelte +13 -10
- package/dist/components/primitives/ToggleRadio.svelte.d.ts +3 -2
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte +8 -5
- package/dist/components/scenes/ai/AiDocumentDownloadMenu.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/AiDocumentEditor.svelte +6 -3
- package/dist/components/scenes/ai/AiDocumentEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/MarkdownRenderer.svelte +8 -7
- package/dist/components/scenes/ai/MarkdownRenderer.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/document-types.d.ts +2 -1
- package/dist/components/scenes/ai/table/AiTableEditor.svelte +6 -3
- package/dist/components/scenes/ai/table/AiTableEditor.svelte.d.ts +3 -1
- package/dist/components/scenes/ai/table/table-types.d.ts +2 -1
- package/dist/components/scenes/app/FeedbackModal.svelte +5 -2
- package/dist/components/scenes/app/FeedbackModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/LanguageSwitch.svelte +6 -2
- package/dist/components/scenes/app/LanguageSwitch.svelte.d.ts +3 -1
- package/dist/components/scenes/app/SettingsLayout.svelte +6 -3
- package/dist/components/scenes/app/SettingsLayout.svelte.d.ts +2 -1
- package/dist/components/scenes/app/SettingsModal.svelte +6 -3
- package/dist/components/scenes/app/SettingsModal.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeColorPicker.svelte +6 -3
- package/dist/components/scenes/app/ThemeColorPicker.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeSelector.svelte +6 -3
- package/dist/components/scenes/app/ThemeSelector.svelte.d.ts +3 -1
- package/dist/components/scenes/app/ThemeToggle.svelte +6 -2
- package/dist/components/scenes/app/ThemeToggle.svelte.d.ts +3 -1
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte +16 -11
- package/dist/components/scenes/crud/CrudDeleteConfirm.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailDrawer.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudDetailPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudDetailPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudEditPanel.svelte +6 -3
- package/dist/components/scenes/crud/CrudEditPanel.svelte.d.ts +2 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte +6 -2
- package/dist/components/scenes/crud/CrudFilterBar.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/CrudPage.svelte +6 -2
- package/dist/components/scenes/crud/CrudPage.svelte.d.ts +2 -1
- package/dist/components/scenes/crud/crud-types.d.ts +2 -2
- package/dist/components/scenes/crypto/EncryptedInput.svelte +6 -3
- package/dist/components/scenes/crypto/EncryptedInput.svelte.d.ts +3 -2
- package/dist/components/scenes/crypto/HashDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/HashDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/crypto/SignatureDisplay.svelte +6 -3
- package/dist/components/scenes/crypto/SignatureDisplay.svelte.d.ts +3 -1
- package/dist/components/scenes/error/ErrorPage.svelte +6 -3
- package/dist/components/scenes/error/ErrorPage.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/AuthShell.svelte +6 -3
- package/dist/components/scenes/iam/AuthShell.svelte.d.ts +2 -1
- package/dist/components/scenes/iam/ChangePasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ChangePasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ForgotPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/LoginForm.svelte +6 -3
- package/dist/components/scenes/iam/LoginForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/PasswordInput.svelte +6 -4
- package/dist/components/scenes/iam/PasswordInput.svelte.d.ts +3 -2
- package/dist/components/scenes/iam/RegisterForm.svelte +6 -4
- package/dist/components/scenes/iam/RegisterForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/ResetPasswordForm.svelte +6 -3
- package/dist/components/scenes/iam/ResetPasswordForm.svelte.d.ts +3 -1
- package/dist/components/scenes/iam/UserProfile.svelte +6 -3
- package/dist/components/scenes/iam/UserProfile.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/AvatarUpload.svelte +11 -8
- package/dist/components/scenes/storage/AvatarUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileList.svelte +6 -3
- package/dist/components/scenes/storage/FileList.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/FileUpload.svelte +6 -3
- package/dist/components/scenes/storage/FileUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/storage/ImageUpload.svelte +12 -9
- package/dist/components/scenes/storage/ImageUpload.svelte.d.ts +3 -1
- package/dist/components/scenes/types.d.ts +16 -16
- package/dist/types.d.ts +43 -36
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +15 -0
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DrawerProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, DrawerProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = DrawerProps & DataAttributes;
|
|
3
|
+
declare const Drawer: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
3
4
|
type Drawer = ReturnType<typeof Drawer>;
|
|
4
5
|
export default Drawer;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
下拉菜单组件,支持 click/hover 触发。
|
|
4
4
|
-->
|
|
5
5
|
<script lang='ts'>
|
|
6
|
-
import type { DropdownProps } from '../../types.js'
|
|
7
|
-
import { cn } from '../../utils.js'
|
|
6
|
+
import type { DataAttributes, DropdownProps } from '../../types.js'
|
|
7
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
8
8
|
import BareButton from '../primitives/BareButton.svelte'
|
|
9
9
|
|
|
10
10
|
const {
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
class: className = '',
|
|
16
16
|
onselect,
|
|
17
17
|
children,
|
|
18
|
-
|
|
18
|
+
...restProps
|
|
19
|
+
}: DropdownProps & DataAttributes = $props()
|
|
19
20
|
|
|
21
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
20
22
|
let isOpen = $state(false)
|
|
21
23
|
|
|
22
24
|
const positionMap = {
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
}
|
|
56
58
|
</script>
|
|
57
59
|
|
|
58
|
-
<div class={dropdownClass}>
|
|
60
|
+
<div {...dataAttributes} class={dropdownClass}>
|
|
59
61
|
<BareButton
|
|
60
62
|
tabindex={0}
|
|
61
63
|
role='button'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { DropdownProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, DropdownProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = DropdownProps & DataAttributes;
|
|
2
3
|
/**
|
|
3
4
|
* Dropdown
|
|
4
5
|
* 下拉菜单组件,支持 click/hover 触发。
|
|
5
6
|
*/
|
|
6
|
-
declare const Dropdown: import("svelte").Component
|
|
7
|
+
declare const Dropdown: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
8
|
type Dropdown = ReturnType<typeof Dropdown>;
|
|
8
9
|
export default Dropdown;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { EmptyProps } from '../../types.js'
|
|
11
|
+
import type { DataAttributes, EmptyProps } from '../../types.js'
|
|
12
12
|
import { uiM } from '../../messages.js'
|
|
13
|
-
import { cn } from '../../utils.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
title,
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
class: className = '',
|
|
21
21
|
action,
|
|
22
22
|
children,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: EmptyProps & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
const displayTitle = $derived(title ?? uiM('empty_title'))
|
|
26
28
|
|
|
27
29
|
const containerClass = $derived(
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
)
|
|
43
45
|
</script>
|
|
44
46
|
|
|
45
|
-
<div class={containerClass}>
|
|
47
|
+
<div {...dataAttributes} class={containerClass}>
|
|
46
48
|
<!-- 图标区域 -->
|
|
47
49
|
<div class='text-base-content/30 mb-4 {iconSize}'>
|
|
48
50
|
{#if children}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EmptyProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, EmptyProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = EmptyProps & DataAttributes;
|
|
3
|
+
declare const Empty: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Empty = ReturnType<typeof Empty>;
|
|
4
5
|
export default Empty;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { FormProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, FormProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
id = '',
|
|
@@ -20,8 +20,10 @@
|
|
|
20
20
|
onreset,
|
|
21
21
|
onerror,
|
|
22
22
|
children,
|
|
23
|
-
|
|
23
|
+
...restProps
|
|
24
|
+
}: FormProps & DataAttributes = $props()
|
|
24
25
|
|
|
26
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
25
27
|
let formElement: HTMLFormElement
|
|
26
28
|
|
|
27
29
|
const formClass = $derived(
|
|
@@ -85,12 +87,12 @@
|
|
|
85
87
|
}
|
|
86
88
|
</script>
|
|
87
89
|
|
|
88
|
-
<form
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
<form {...dataAttributes}
|
|
91
|
+
bind:this={formElement}
|
|
92
|
+
id={id || undefined}
|
|
93
|
+
class={formClass}
|
|
94
|
+
onsubmit={handleSubmit}
|
|
95
|
+
onreset={handleReset}
|
|
94
96
|
>
|
|
95
97
|
{#if children}
|
|
96
98
|
{@render children()}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FormProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, FormProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = FormProps & DataAttributes;
|
|
3
|
+
declare const Form: import("svelte").Component<$$ComponentProps, {
|
|
3
4
|
reset: () => void;
|
|
4
5
|
getData: () => Record<string, unknown>;
|
|
5
6
|
}, "">;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { FormFieldProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, FormFieldProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
label = '',
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
required = false,
|
|
19
19
|
class: className = '',
|
|
20
20
|
children,
|
|
21
|
-
|
|
21
|
+
...restProps
|
|
22
|
+
}: FormFieldProps & DataAttributes = $props()
|
|
22
23
|
|
|
24
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
23
25
|
const fieldClass = $derived(
|
|
24
26
|
cn(
|
|
25
27
|
'fieldset w-full',
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
)
|
|
29
31
|
</script>
|
|
30
32
|
|
|
31
|
-
<div class={fieldClass}>
|
|
33
|
+
<div {...dataAttributes} class={fieldClass}>
|
|
32
34
|
{#if label}
|
|
33
35
|
<legend class='fieldset-legend'>
|
|
34
36
|
{label}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FormFieldProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, FormFieldProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = FormFieldProps & DataAttributes;
|
|
3
|
+
declare const FormField: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type FormField = ReturnType<typeof FormField>;
|
|
4
5
|
export default FormField;
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
12
|
import type { Snippet } from 'svelte'
|
|
13
|
-
import {
|
|
13
|
+
import type { DataAttributes } from '../../types.js'
|
|
14
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
16
17
|
/** 加载更多回调 */
|
|
@@ -40,8 +41,10 @@
|
|
|
40
41
|
noMoreText = 'No more data',
|
|
41
42
|
class: className,
|
|
42
43
|
children,
|
|
43
|
-
|
|
44
|
+
...restProps
|
|
45
|
+
}: Props & DataAttributes = $props()
|
|
44
46
|
|
|
47
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
45
48
|
let loading = $state(false)
|
|
46
49
|
let containerRef: HTMLDivElement | undefined = $state()
|
|
47
50
|
|
|
@@ -62,11 +65,11 @@
|
|
|
62
65
|
}
|
|
63
66
|
</script>
|
|
64
67
|
|
|
65
|
-
<div
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
<div {...dataAttributes}
|
|
69
|
+
bind:this={containerRef}
|
|
70
|
+
class={cn('overflow-y-auto', className)}
|
|
71
|
+
onscroll={checkAndLoad}
|
|
72
|
+
role='feed'
|
|
70
73
|
>
|
|
71
74
|
{@render children()}
|
|
72
75
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
/** 加载更多回调 */
|
|
4
5
|
onloadmore?: () => Promise<void>;
|
|
@@ -17,6 +18,7 @@ interface Props {
|
|
|
17
18
|
/** 列表内容 */
|
|
18
19
|
children: Snippet;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
22
|
+
declare const InfiniteScroll: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
21
23
|
type InfiniteScroll = ReturnType<typeof InfiniteScroll>;
|
|
22
24
|
export default InfiniteScroll;
|
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
=============================================================================
|
|
10
10
|
-->
|
|
11
11
|
<script lang='ts'>
|
|
12
|
+
import type { DataAttributes } from '../../types.js'
|
|
12
13
|
import { messageBox } from '../../messagebox.svelte.js'
|
|
14
|
+
import { getDataAttributes } from '../../utils.js'
|
|
13
15
|
import MessageBoxDialog from './MessageBoxDialog.svelte'
|
|
16
|
+
|
|
17
|
+
const { ...restProps }: DataAttributes = $props()
|
|
18
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
14
19
|
</script>
|
|
15
20
|
|
|
16
21
|
{#each messageBox.items as item (item.id)}
|
|
17
|
-
<MessageBoxDialog {item} />
|
|
22
|
+
<MessageBoxDialog {...dataAttributes} {item} />
|
|
18
23
|
{/each}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const MessageBoxContainer: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type MessageBoxContainer = InstanceType<typeof MessageBoxContainer>;
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
|
+
declare const MessageBoxContainer: import("svelte").Component<DataAttributes, {}, "">;
|
|
3
|
+
type MessageBoxContainer = ReturnType<typeof MessageBoxContainer>;
|
|
18
4
|
export default MessageBoxContainer;
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script lang='ts'>
|
|
9
9
|
import type { MessageBoxItem } from '../../messagebox.svelte.js'
|
|
10
|
+
import type { DataAttributes } from '../../types.js'
|
|
10
11
|
import { messageBox } from '../../messagebox.svelte.js'
|
|
11
12
|
import { uiM } from '../../messages.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
14
|
import Button from '../primitives/Button.svelte'
|
|
14
15
|
|
|
15
|
-
const { item }: { item: MessageBoxItem } = $props()
|
|
16
|
+
const { item, ...restProps }: { item: MessageBoxItem } & DataAttributes = $props()
|
|
16
17
|
|
|
18
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
17
19
|
/** 图标类型到 tabler icon 的映射 */
|
|
18
20
|
const iconMap: Record<string, string> = {
|
|
19
21
|
info: 'icon-[tabler--info-circle]',
|
|
@@ -46,11 +48,11 @@
|
|
|
46
48
|
</script>
|
|
47
49
|
|
|
48
50
|
<!-- 使用 hai-messagebox 而非 DaisyUI .modal,避免 ::backdrop 被隐藏 -->
|
|
49
|
-
<dialog
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
<dialog {...dataAttributes}
|
|
52
|
+
bind:this={dialogEl}
|
|
53
|
+
class='hai-messagebox'
|
|
54
|
+
oncancel={e => e.preventDefault()}
|
|
55
|
+
onclick={handleBackdropClick}
|
|
54
56
|
>
|
|
55
57
|
<div class='hai-messagebox__panel'>
|
|
56
58
|
<!-- 标题栏:始终显示,右侧关闭按钮 -->
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MessageBoxItem } from '../../messagebox.svelte.js';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
type $$ComponentProps = {
|
|
3
4
|
item: MessageBoxItem;
|
|
4
|
-
};
|
|
5
|
+
} & DataAttributes;
|
|
5
6
|
declare const MessageBoxDialog: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
7
|
type MessageBoxDialog = ReturnType<typeof MessageBoxDialog>;
|
|
7
8
|
export default MessageBoxDialog;
|
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
=============================================================================
|
|
12
12
|
-->
|
|
13
13
|
<script lang='ts'>
|
|
14
|
+
import type { DataAttributes } from '../../types.js'
|
|
14
15
|
import { onMount } from 'svelte'
|
|
15
16
|
import { message } from '../../message.svelte.js'
|
|
16
|
-
import { cn } from '../../utils.js'
|
|
17
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
17
18
|
import IconButton from '../primitives/IconButton.svelte'
|
|
18
19
|
|
|
20
|
+
const { ...restProps }: DataAttributes = $props()
|
|
21
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
22
|
+
|
|
19
23
|
/** 图标类型到 tabler icon 的映射 */
|
|
20
24
|
const iconMap: Record<string, string> = {
|
|
21
25
|
info: 'icon-[tabler--info-circle]',
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
})
|
|
125
129
|
</script>
|
|
126
130
|
|
|
127
|
-
<div bind:this={layerElement} popover='manual' class='hai-message-layer'>
|
|
131
|
+
<div {...dataAttributes} bind:this={layerElement} popover='manual' class='hai-message-layer'>
|
|
128
132
|
<div class='hai-message-stack'>
|
|
129
133
|
{#each message.items as item (item.id)}
|
|
130
134
|
<div
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
|
+
declare const MessageContainer: import("svelte").Component<DataAttributes, {}, "">;
|
|
2
3
|
type MessageContainer = ReturnType<typeof MessageContainer>;
|
|
3
4
|
export default MessageContainer;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
模态框组件,支持 backdrop-blur 和 scale-in 动画。
|
|
4
4
|
-->
|
|
5
5
|
<script lang='ts'>
|
|
6
|
-
import type { ModalProps } from '../../types.js'
|
|
6
|
+
import type { DataAttributes, ModalProps } from '../../types.js'
|
|
7
7
|
import { uiM } from '../../messages.js'
|
|
8
|
-
import { cn } from '../../utils.js'
|
|
8
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
open = $bindable(false),
|
|
@@ -24,8 +24,10 @@
|
|
|
24
24
|
header,
|
|
25
25
|
footer,
|
|
26
26
|
children,
|
|
27
|
-
|
|
27
|
+
...restProps
|
|
28
|
+
}: ModalProps & DataAttributes = $props()
|
|
28
29
|
|
|
30
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
29
31
|
// modalElement 持有原生 dialog 引用;
|
|
30
32
|
// 只有调用 `showModal()` 进入 top-layer 后,弹框才不会被父级布局和 overflow 裁剪。
|
|
31
33
|
let modalElement: HTMLDialogElement | undefined = $state()
|
|
@@ -136,10 +138,10 @@
|
|
|
136
138
|
})
|
|
137
139
|
</script>
|
|
138
140
|
|
|
139
|
-
<dialog
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
<dialog {...dataAttributes}
|
|
142
|
+
bind:this={modalElement}
|
|
143
|
+
class='hai-modal'
|
|
144
|
+
oncancel={handleDialogCancel}
|
|
143
145
|
>
|
|
144
146
|
<div
|
|
145
147
|
class='hai-modal__viewport'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ModalProps } from '../../types.js';
|
|
1
|
+
import type { DataAttributes, ModalProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = ModalProps & DataAttributes;
|
|
2
3
|
/**
|
|
3
4
|
* Modal
|
|
4
5
|
* 模态框组件,支持 backdrop-blur 和 scale-in 动画。
|
|
5
6
|
*/
|
|
6
|
-
declare const Modal: import("svelte").Component
|
|
7
|
+
declare const Modal: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
7
8
|
type Modal = ReturnType<typeof Modal>;
|
|
8
9
|
export default Modal;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
-->
|
|
19
19
|
<script lang='ts'>
|
|
20
20
|
import type { Snippet } from 'svelte'
|
|
21
|
+
import type { DataAttributes } from '../../types.js'
|
|
22
|
+
import { getDataAttributes } from '../../utils.js'
|
|
21
23
|
|
|
22
24
|
interface Props {
|
|
23
25
|
title: string
|
|
@@ -26,10 +28,12 @@
|
|
|
26
28
|
class?: string
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
const { title, description, actions, class: className = '' }: Props = $props()
|
|
31
|
+
const { title, description, actions, class: className = '', ...restProps }: Props & DataAttributes = $props()
|
|
32
|
+
|
|
33
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
30
34
|
</script>
|
|
31
35
|
|
|
32
|
-
<div class='flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5 {className}'>
|
|
36
|
+
<div {...dataAttributes} class='flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-5 {className}'>
|
|
33
37
|
<div>
|
|
34
38
|
<h1 class='text-xl font-semibold tracking-tight'>{title}</h1>
|
|
35
39
|
{#if description}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
title: string;
|
|
4
5
|
description?: string;
|
|
5
6
|
actions?: Snippet;
|
|
6
7
|
class?: string;
|
|
7
8
|
}
|
|
9
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
8
10
|
/**
|
|
9
11
|
* PageHeader
|
|
10
12
|
* 页面头部组件,包含标题、描述和操作按钮区域。
|
|
@@ -23,6 +25,6 @@ interface Props {
|
|
|
23
25
|
* {/snippet}
|
|
24
26
|
* </PageHeader>
|
|
25
27
|
*/
|
|
26
|
-
declare const PageHeader: import("svelte").Component
|
|
28
|
+
declare const PageHeader: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
27
29
|
type PageHeader = ReturnType<typeof PageHeader>;
|
|
28
30
|
export default PageHeader;
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { PaginationProps } from '../../types.js'
|
|
11
|
+
import type { DataAttributes, PaginationProps } from '../../types.js'
|
|
12
12
|
import { uiM } from '../../messages.js'
|
|
13
|
-
import { cn } from '../../utils.js'
|
|
13
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
14
14
|
import BareButton from '../primitives/BareButton.svelte'
|
|
15
15
|
|
|
16
16
|
import Input from '../primitives/Input.svelte'
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
class: className = '',
|
|
30
30
|
onchange,
|
|
31
31
|
onpagesizechange,
|
|
32
|
-
|
|
32
|
+
...restProps
|
|
33
|
+
}: PaginationProps & DataAttributes = $props()
|
|
33
34
|
|
|
35
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
34
36
|
// labels 优先,缺省回退到内置消息 uiM(...)
|
|
35
37
|
|
|
36
38
|
// 计算总页数(至少 1 页,保证分页栏在空数据时仍可渲染)
|
|
@@ -86,7 +88,7 @@
|
|
|
86
88
|
)
|
|
87
89
|
</script>
|
|
88
90
|
|
|
89
|
-
<div class={cn('flex flex-wrap items-center justify-between gap-4', className)}>
|
|
91
|
+
<div {...dataAttributes} class={cn('flex flex-wrap items-center justify-between gap-4', className)}>
|
|
90
92
|
{#if showTotal}
|
|
91
93
|
<span class={tableTextClass}>
|
|
92
94
|
{(labels.total ?? uiM('pagination_total')).replace('{count}', String(total))}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PaginationProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, PaginationProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = PaginationProps & DataAttributes;
|
|
3
|
+
declare const Pagination: import("svelte").Component<$$ComponentProps, {}, "page">;
|
|
3
4
|
type Pagination = ReturnType<typeof Pagination>;
|
|
4
5
|
export default Pagination;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { PopoverProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, PopoverProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
let {
|
|
15
15
|
open = $bindable(false),
|
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
onclose,
|
|
22
22
|
triggerContent,
|
|
23
23
|
children,
|
|
24
|
-
|
|
24
|
+
...restProps
|
|
25
|
+
}: PopoverProps & DataAttributes = $props()
|
|
25
26
|
|
|
27
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
26
28
|
let triggerElement = $state<HTMLDivElement | null>(null)
|
|
27
29
|
let popoverElement = $state<HTMLDivElement | null>(null)
|
|
28
30
|
|
|
@@ -95,11 +97,11 @@
|
|
|
95
97
|
})
|
|
96
98
|
</script>
|
|
97
99
|
|
|
98
|
-
<div
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
<div {...dataAttributes}
|
|
101
|
+
class={cn('relative inline-block', className)}
|
|
102
|
+
role='group'
|
|
103
|
+
onmouseenter={handleMouseEnter}
|
|
104
|
+
onmouseleave={handleMouseLeave}
|
|
103
105
|
>
|
|
104
106
|
<!-- 触发器 -->
|
|
105
107
|
<div
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { PopoverProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, PopoverProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = PopoverProps & DataAttributes;
|
|
3
|
+
declare const Popover: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
3
4
|
type Popover = ReturnType<typeof Popover>;
|
|
4
5
|
export default Popover;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
-->
|
|
9
9
|
<script lang='ts'>
|
|
10
10
|
import type { Snippet } from 'svelte'
|
|
11
|
-
import {
|
|
11
|
+
import type { DataAttributes } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
14
15
|
/** 刷新回调(需返回 Promise) */
|
|
@@ -29,8 +30,10 @@
|
|
|
29
30
|
disabled = false,
|
|
30
31
|
class: className,
|
|
31
32
|
children,
|
|
32
|
-
|
|
33
|
+
...restProps
|
|
34
|
+
}: Props & DataAttributes = $props()
|
|
33
35
|
|
|
36
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
34
37
|
let pulling = $state(false)
|
|
35
38
|
let refreshing = $state(false)
|
|
36
39
|
let pullDistance = $state(0)
|
|
@@ -71,12 +74,12 @@
|
|
|
71
74
|
}
|
|
72
75
|
</script>
|
|
73
76
|
|
|
74
|
-
<div
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
<div {...dataAttributes}
|
|
78
|
+
class={cn('relative overflow-hidden', className)}
|
|
79
|
+
ontouchstart={handleTouchStart}
|
|
80
|
+
ontouchmove={handleTouchMove}
|
|
81
|
+
ontouchend={handleTouchEnd}
|
|
82
|
+
role='region'
|
|
80
83
|
>
|
|
81
84
|
<!-- 刷新指示器 -->
|
|
82
85
|
<div
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { DataAttributes } from '../../types.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
/** 刷新回调(需返回 Promise) */
|
|
4
5
|
onrefresh?: () => Promise<void>;
|
|
@@ -11,6 +12,7 @@ interface Props {
|
|
|
11
12
|
/** 内容 */
|
|
12
13
|
children: Snippet;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
type $$ComponentProps = Props & DataAttributes;
|
|
16
|
+
declare const PullRefresh: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
15
17
|
type PullRefresh = ReturnType<typeof PullRefresh>;
|
|
16
18
|
export default PullRefresh;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
=============================================================================
|
|
9
9
|
-->
|
|
10
10
|
<script lang='ts'>
|
|
11
|
-
import type { ResultProps } from '../../types.js'
|
|
12
|
-
import { cn } from '../../utils.js'
|
|
11
|
+
import type { DataAttributes, ResultProps } from '../../types.js'
|
|
12
|
+
import { cn, getDataAttributes } from '../../utils.js'
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
status = 'info',
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
icon,
|
|
20
20
|
actions,
|
|
21
21
|
children,
|
|
22
|
-
|
|
22
|
+
...restProps
|
|
23
|
+
}: ResultProps & DataAttributes = $props()
|
|
23
24
|
|
|
25
|
+
const dataAttributes = $derived(getDataAttributes(restProps))
|
|
24
26
|
const containerClass = $derived(
|
|
25
27
|
cn(
|
|
26
28
|
'flex flex-col items-center justify-center py-12 text-center',
|
|
@@ -36,7 +38,7 @@
|
|
|
36
38
|
}[status])
|
|
37
39
|
</script>
|
|
38
40
|
|
|
39
|
-
<div class={containerClass}>
|
|
41
|
+
<div {...dataAttributes} class={containerClass}>
|
|
40
42
|
<!-- 图标区域 -->
|
|
41
43
|
<div class='w-20 h-20 mb-6 {iconColor}'>
|
|
42
44
|
{#if icon}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ResultProps } from '../../types.js';
|
|
2
|
-
|
|
1
|
+
import type { DataAttributes, ResultProps } from '../../types.js';
|
|
2
|
+
type $$ComponentProps = ResultProps & DataAttributes;
|
|
3
|
+
declare const Result: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
4
|
type Result = ReturnType<typeof Result>;
|
|
4
5
|
export default Result;
|