@ticatec/uniface-element 0.2.4 → 0.3.1
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/accordion/README.md +169 -0
- package/dist/accordion/README_CN.md +176 -0
- package/dist/action-bar/README.md +275 -0
- package/dist/action-bar/README_CN.md +285 -0
- package/dist/app-layout/README.md +374 -0
- package/dist/app-layout/README_CN.md +381 -0
- package/dist/app-top-bar/README.md +357 -0
- package/dist/app-top-bar/README_CN.md +365 -0
- package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
- package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
- package/dist/base-calendar/CalendarBase.svelte +0 -3
- package/dist/box/README.md +385 -0
- package/dist/box/README_CN.md +393 -0
- package/dist/breadcrumbs/README.md +442 -0
- package/dist/breadcrumbs/README_CN.md +442 -0
- package/dist/button/Button.svelte +27 -7
- package/dist/button/Button.svelte.d.ts +3 -1
- package/dist/button/IconButton.svelte +26 -6
- package/dist/button/IconButton.svelte.d.ts +3 -1
- package/dist/button/IconButton_README.md +513 -0
- package/dist/button/IconButton_README_CN.md +513 -0
- package/dist/button/README.md +428 -0
- package/dist/button/README_CN.md +428 -0
- package/dist/button/TextButton.svelte +26 -6
- package/dist/button/TextButton.svelte.d.ts +3 -1
- package/dist/button/TextButton_README.md +571 -0
- package/dist/button/TextButton_README_CN.md +571 -0
- package/dist/card/README.md +666 -0
- package/dist/card/README_CN.md +666 -0
- package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
- package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
- package/dist/cascade-options-select/README.md +663 -2
- package/dist/cascade-options-select/README_CN.md +664 -0
- package/dist/checkbox/CheckBox.svelte +20 -6
- package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
- package/dist/checkbox/README.md +562 -0
- package/dist/checkbox/README_CN.md +727 -0
- package/dist/common-editor/NumberInput.svelte +39 -26
- package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
- package/dist/concise-data-table/ConciseListTable.svelte +133 -36
- package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
- package/dist/concise-data-table/DataCell.svelte +5 -6
- package/dist/concise-data-table/DataRow.svelte +22 -2
- package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
- package/dist/concise-data-table/README.md +606 -0
- package/dist/concise-data-table/README_CN.md +611 -0
- package/dist/context-menu/ContextMenu.svelte +138 -21
- package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
- package/dist/context-menu/ContextMenuItem.d.ts +20 -4
- package/dist/context-menu/README.md +551 -0
- package/dist/context-menu/README_CN.md +551 -0
- package/dist/criteria-field/CriteriaField.svelte +3 -5
- package/dist/criteria-field/README.md +532 -0
- package/dist/criteria-field/README_CN.md +532 -0
- package/dist/data-table/README.md +712 -0
- package/dist/data-table/README_CN.md +712 -0
- package/dist/date-picker/DatePicker.svelte +44 -7
- package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
- package/dist/date-picker/DateTimePicker.svelte +32 -8
- package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
- package/dist/date-picker/README.md +326 -0
- package/dist/date-picker/README_CN.md +316 -0
- package/dist/date-picker/ScrollBar.svelte +18 -8
- package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
- package/dist/date-picker/TimePanel.svelte +5 -5
- package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
- package/dist/date-range/README.md +374 -0
- package/dist/date-range/README_CN.md +374 -0
- package/dist/dialog/README.md +596 -0
- package/dist/dialog/README_CN.md +596 -0
- package/dist/drawer/README.md +679 -1
- package/dist/drawer/README_CN.md +679 -0
- package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
- package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
- package/dist/group-box/group-check-box/README.md +749 -0
- package/dist/group-box/group-check-box/README_CN.md +750 -0
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
- package/dist/group-box/group-radio-box/README.md +920 -0
- package/dist/group-box/group-radio-box/README_CN.md +920 -0
- package/dist/image-files/README.md +1346 -0
- package/dist/image-files/README_CN.md +1346 -0
- package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
- package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
- package/dist/lib/forwardAllEvents.d.ts +3 -0
- package/dist/lib/forwardAllEvents.js +24 -0
- package/dist/list-box/README.md +579 -0
- package/dist/list-box/README_CN.md +682 -0
- package/dist/lookup-editor/LookupEditor.svelte +15 -3
- package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
- package/dist/lookup-editor/README.md +684 -0
- package/dist/lookup-editor/README_CN.md +684 -0
- package/dist/memo-editor/MemoEditor.svelte +77 -27
- package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
- package/dist/memo-editor/README.md +819 -0
- package/dist/memo-editor/README_CN.md +819 -0
- package/dist/message-box/README.md +398 -0
- package/dist/message-box/README_CN.md +398 -0
- package/dist/number-editor/NumberEditor.svelte +2 -2
- package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
- package/dist/number-editor/README.md +353 -22
- package/dist/number-editor/README_CN.md +357 -0
- package/dist/number-range/README.md +443 -0
- package/dist/number-range/README_CN.md +443 -0
- package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
- package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
- package/dist/options-multi-select/README.md +480 -0
- package/dist/options-multi-select/README_CN.md +480 -0
- package/dist/options-select/OptionsSelect.svelte +36 -5
- package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
- package/dist/options-select/README.md +632 -0
- package/dist/options-select/README_CN.md +632 -0
- package/dist/page/README.md +605 -0
- package/dist/page/README_CN.md +605 -0
- package/dist/pagination/README.md +946 -0
- package/dist/pagination/README_CN.md +946 -0
- package/dist/pagination-panel/README.md +1075 -0
- package/dist/pagination-panel/README_CN.md +1075 -0
- package/dist/popup-hint/README.md +841 -0
- package/dist/popup-hint/README_CN.md +840 -0
- package/dist/progress-bar/README.md +242 -0
- package/dist/progress-bar/README_CN.md +242 -0
- package/dist/progress-step-bar/README.md +316 -0
- package/dist/progress-step-bar/README_CN.md +316 -0
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
- package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
- package/dist/prompts-text-editor/README.md +329 -0
- package/dist/prompts-text-editor/README_CN.md +329 -0
- package/dist/property-editor/README.md +969 -0
- package/dist/property-editor/README_CN.md +969 -0
- package/dist/radio-button/README.md +372 -0
- package/dist/radio-button/README_CN.md +372 -0
- package/dist/radio-button/RadioButton.svelte +32 -3
- package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
- package/dist/search-box/README.md +425 -0
- package/dist/search-box/README_CN.md +424 -0
- package/dist/search-box/SearchBox.svelte +22 -6
- package/dist/search-box/SearchBox.svelte.d.ts +4 -1
- package/dist/tabs/README.md +919 -0
- package/dist/tabs/README_CN.md +920 -0
- package/dist/tag/README.md +922 -0
- package/dist/tag/README_CN.md +922 -0
- package/dist/text-editor/PasswordEditor.svelte +17 -2
- package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
- package/dist/text-editor/PasswordEditor_README.md +551 -0
- package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
- package/dist/text-editor/README.md +466 -0
- package/dist/text-editor/README_CN.md +466 -0
- package/dist/text-editor/TextEditor.svelte +51 -19
- package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
- package/dist/ticatec-uniface-web.css +2 -0
- package/dist/time-editor/README.md +498 -24
- package/dist/time-editor/README_CN.md +498 -0
- package/dist/time-editor/TimeEditor.svelte +7 -3
- package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
- package/dist/toast/README.md +667 -0
- package/dist/toast/README_CN.md +667 -0
- package/dist/transfer/README.md +795 -0
- package/dist/transfer/Transfer.svelte +6 -4
- package/dist/transfer/Transfer.svelte.d.ts +3 -1
- package/dist/tree-view/README.md +761 -0
- package/dist/tree-view/README_CN.md +761 -0
- package/dist/tree-view/TreeView.svelte +5 -3
- package/dist/tree-view/TreeView.svelte.d.ts +3 -1
- package/dist/unit-number-editor/README.md +546 -20
- package/dist/unit-number-editor/README_CN.md +525 -0
- package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
- package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
- package/docs/form-field/cn/README_CN.md +364 -0
- package/docs/form-field/en/README.md +364 -0
- package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
- package/docs/form-panel/flex-form/en/README.md +586 -0
- package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
- package/docs/form-panel/flex-row-form/en/README.md +787 -0
- package/docs/form-panel/grid-form/en/README.md +744 -0
- package/package.json +1 -1
- package/dist/drawer/README-CN.md +0 -1
|
@@ -18,19 +18,65 @@
|
|
|
18
18
|
export let displayMode: DisplayMode = DisplayMode.Edit;
|
|
19
19
|
export let removeFileConfirm: RemoveConfirm = null as unknown as RemoveConfirm;
|
|
20
20
|
export let uploadFile: FileUpload;
|
|
21
|
+
export let compact: boolean = false;
|
|
22
|
+
export let onfocus: (() => void) | null = null;
|
|
23
|
+
export let onblur: (() => void) | null = null;
|
|
24
|
+
export let onchange: ((files: Array<AttachmentFile>) => void) | null = null;
|
|
21
25
|
|
|
22
26
|
export let text: string | null = null;
|
|
23
27
|
|
|
28
|
+
export const setFocus = () => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
if (containerElement) {
|
|
31
|
+
containerElement.focus();
|
|
32
|
+
}
|
|
33
|
+
}, 50);
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
let showUpload: boolean = false;
|
|
37
|
+
let containerElement: HTMLDivElement;
|
|
38
|
+
let oldFiles = files;
|
|
39
|
+
let isUserChange: boolean = false;
|
|
40
|
+
let hasFocus: boolean = false;
|
|
25
41
|
|
|
26
42
|
onMount(() => {
|
|
27
43
|
|
|
28
44
|
})
|
|
29
45
|
|
|
46
|
+
// 处理focus/blur事件
|
|
47
|
+
const handleFocus = () => {
|
|
48
|
+
if (!hasFocus) {
|
|
49
|
+
hasFocus = true;
|
|
50
|
+
onfocus?.();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const handleBlur = () => {
|
|
55
|
+
if (hasFocus && !showUpload) {
|
|
56
|
+
hasFocus = false;
|
|
57
|
+
onblur?.();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleContainerFocus = (e: FocusEvent) => {
|
|
62
|
+
handleFocus();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const handleContainerBlur = (e: FocusEvent) => {
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
if (!showUpload && !containerElement?.contains(document.activeElement)) {
|
|
68
|
+
handleBlur();
|
|
69
|
+
}
|
|
70
|
+
}, 50);
|
|
71
|
+
}
|
|
72
|
+
|
|
30
73
|
const showDialog = () => {
|
|
74
|
+
handleFocus();
|
|
31
75
|
showUpload = true;
|
|
32
76
|
}
|
|
77
|
+
|
|
33
78
|
const appendNewFile = (file: UploadFile) => {
|
|
79
|
+
isUserChange = true;
|
|
34
80
|
files = [...files, {
|
|
35
81
|
name: file.file.name,
|
|
36
82
|
uri: file.url ?? '',
|
|
@@ -41,6 +87,7 @@
|
|
|
41
87
|
const removeFile = async (file: AttachmentFile) => {
|
|
42
88
|
let confirmed = removeFileConfirm == null ? true : await removeFileConfirm(file);
|
|
43
89
|
if (confirmed) {
|
|
90
|
+
isUserChange = true;
|
|
44
91
|
let pos = files.findIndex(item => item == file);
|
|
45
92
|
if (pos > -1) {
|
|
46
93
|
files.splice(pos, 1);
|
|
@@ -49,8 +96,26 @@
|
|
|
49
96
|
}
|
|
50
97
|
}
|
|
51
98
|
|
|
99
|
+
// 监听upload面板关闭
|
|
100
|
+
$: if (!showUpload && hasFocus) {
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
if (document.activeElement !== containerElement) {
|
|
103
|
+
handleBlur();
|
|
104
|
+
}
|
|
105
|
+
}, 50);
|
|
106
|
+
}
|
|
107
|
+
|
|
52
108
|
$: text = '<div>' + files.map(item => (item.name)).join("</div><div>") + '</div>'
|
|
53
109
|
|
|
110
|
+
// 处理onchange事件
|
|
111
|
+
$: if (oldFiles !== files) {
|
|
112
|
+
if (isUserChange) {
|
|
113
|
+
onchange?.(files);
|
|
114
|
+
isUserChange = false;
|
|
115
|
+
}
|
|
116
|
+
oldFiles = files;
|
|
117
|
+
}
|
|
118
|
+
|
|
54
119
|
</script>
|
|
55
120
|
|
|
56
121
|
{#if displayMode === DisplayMode.View}
|
|
@@ -59,7 +124,8 @@
|
|
|
59
124
|
</div>
|
|
60
125
|
{:else }
|
|
61
126
|
<div class="uniface-attachment-field" {style}>
|
|
62
|
-
<div class="uniface-common-editor {variant}"
|
|
127
|
+
<div bind:this={containerElement} class="uniface-common-editor {variant}" class:compact class:disabled
|
|
128
|
+
tabindex={disabled ? -1 : 0} on:focus={handleContainerFocus} on:blur={handleContainerBlur}>
|
|
63
129
|
<div class="files-field">
|
|
64
130
|
{#each files as file}
|
|
65
131
|
<FileRender {file} {readonly} onRemove={removeFile}/>
|
|
@@ -24,9 +24,16 @@ declare const AttachmentFilesField: $$__sveltets_2_IsomorphicComponent<{
|
|
|
24
24
|
displayMode?: DisplayMode;
|
|
25
25
|
removeFileConfirm?: RemoveConfirm;
|
|
26
26
|
uploadFile: FileUpload;
|
|
27
|
+
compact?: boolean;
|
|
28
|
+
onfocus?: (() => void) | null;
|
|
29
|
+
onblur?: (() => void) | null;
|
|
30
|
+
onchange?: ((files: Array<AttachmentFile>) => void) | null;
|
|
27
31
|
text?: string | null;
|
|
32
|
+
setFocus?: () => void;
|
|
28
33
|
}, {
|
|
29
34
|
[evt: string]: CustomEvent<any>;
|
|
30
|
-
}, {}, {
|
|
35
|
+
}, {}, {
|
|
36
|
+
setFocus: () => void;
|
|
37
|
+
}, string>;
|
|
31
38
|
type AttachmentFilesField = InstanceType<typeof AttachmentFilesField>;
|
|
32
39
|
export default AttachmentFilesField;
|
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
let weekTitle: Array<string> = dateCtx.weekTitleAbbr;
|
|
34
34
|
let monthTitle: Array<string> = dateCtx.months;
|
|
35
35
|
let weekBegin: number = dateCtx.weekBegin;
|
|
36
|
-
|
|
37
|
-
console.log("日期资源", dateCtx.weekTitle, dateCtx.months, dateCtx.weekTitleAbbr)
|
|
38
|
-
|
|
39
36
|
const onSelectDate = (date: dayjs.Dayjs) => {
|
|
40
37
|
value = date;
|
|
41
38
|
onSelect(value);
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Box Component
|
|
2
|
+
|
|
3
|
+
A flexible container component with optional header and footer sections, perfect for creating cards, panels, and content sections.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Structured Layout**: Header, content, and footer sections
|
|
8
|
+
- **Flexible Styling**: Individual styling for each section
|
|
9
|
+
- **Optional Elements**: Header and footer are only rendered when needed
|
|
10
|
+
- **Rounded Corners**: Optional rounded corner styling
|
|
11
|
+
- **Title Support**: Built-in title display or custom header content
|
|
12
|
+
- **Responsive**: Adapts to container size
|
|
13
|
+
|
|
14
|
+
## Basic Usage
|
|
15
|
+
|
|
16
|
+
```svelte
|
|
17
|
+
<script>
|
|
18
|
+
import Box from '@ticatec/uniface-element/Box';
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Box title="My Box">
|
|
22
|
+
<p>Content goes here</p>
|
|
23
|
+
</Box>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
|------|------|---------|-------------|
|
|
30
|
+
| `title` | `string` | `null` | Title text for the header section |
|
|
31
|
+
| `style` | `string \| null` | `null` | Custom CSS styles for the main container |
|
|
32
|
+
| `round` | `boolean` | `false` | Enable rounded corners |
|
|
33
|
+
| `content$style` | `string \| null` | `null` | Custom CSS styles for the content section |
|
|
34
|
+
| `header$style` | `string \| null` | `null` | Custom CSS styles for the header section |
|
|
35
|
+
| `footer$style` | `string \| null` | `null` | Custom CSS styles for the footer section |
|
|
36
|
+
| `class` | `string` | `null` | Additional CSS classes |
|
|
37
|
+
|
|
38
|
+
## Slots
|
|
39
|
+
|
|
40
|
+
| Slot | Description |
|
|
41
|
+
|------|-------------|
|
|
42
|
+
| `header` | Custom header content (overrides title prop) |
|
|
43
|
+
| `default` | Main content area |
|
|
44
|
+
| `footer` | Footer content |
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
### Basic Box with Title
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<Box title="Information">
|
|
52
|
+
<p>This is some important information that needs to be displayed in a box.</p>
|
|
53
|
+
</Box>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Custom Header Content
|
|
57
|
+
|
|
58
|
+
```svelte
|
|
59
|
+
<Box>
|
|
60
|
+
<div slot="header" style="display: flex; justify-content: space-between; align-items: center;">
|
|
61
|
+
<h3>Custom Header</h3>
|
|
62
|
+
<button>Action</button>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<p>Content with custom header</p>
|
|
66
|
+
</Box>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Complete Box with Footer
|
|
70
|
+
|
|
71
|
+
```svelte
|
|
72
|
+
<Box title="User Profile">
|
|
73
|
+
<div class="profile-content">
|
|
74
|
+
<img src="/avatar.jpg" alt="User Avatar" />
|
|
75
|
+
<h4>John Doe</h4>
|
|
76
|
+
<p>Software Developer</p>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div slot="footer">
|
|
80
|
+
<button>Edit Profile</button>
|
|
81
|
+
<button>View Details</button>
|
|
82
|
+
</div>
|
|
83
|
+
</Box>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Rounded Box
|
|
87
|
+
|
|
88
|
+
```svelte
|
|
89
|
+
<Box title="Rounded Card" round={true}>
|
|
90
|
+
<p>This box has rounded corners for a softer appearance.</p>
|
|
91
|
+
</Box>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Styled Sections
|
|
95
|
+
|
|
96
|
+
```svelte
|
|
97
|
+
<Box
|
|
98
|
+
title="Styled Box"
|
|
99
|
+
style="border: 2px solid #007acc; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"
|
|
100
|
+
header$style="background: #007acc; color: white; padding: 16px;"
|
|
101
|
+
content$style="padding: 20px; background: #f9f9f9;"
|
|
102
|
+
footer$style="background: #e9e9e9; padding: 12px; text-align: right;"
|
|
103
|
+
>
|
|
104
|
+
<p>Content with custom styling for each section.</p>
|
|
105
|
+
|
|
106
|
+
<div slot="footer">
|
|
107
|
+
<button>Cancel</button>
|
|
108
|
+
<button>Save</button>
|
|
109
|
+
</div>
|
|
110
|
+
</Box>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Dashboard Widget
|
|
114
|
+
|
|
115
|
+
```svelte
|
|
116
|
+
<Box
|
|
117
|
+
title="Sales Overview"
|
|
118
|
+
round={true}
|
|
119
|
+
style="margin: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);"
|
|
120
|
+
>
|
|
121
|
+
<div slot="header" style="display: flex; justify-content: space-between; align-items: center;">
|
|
122
|
+
<h3>Sales Overview</h3>
|
|
123
|
+
<select>
|
|
124
|
+
<option>This Month</option>
|
|
125
|
+
<option>Last Month</option>
|
|
126
|
+
<option>This Year</option>
|
|
127
|
+
</select>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div class="metrics">
|
|
131
|
+
<div class="metric">
|
|
132
|
+
<span class="value">$12,345</span>
|
|
133
|
+
<span class="label">Revenue</span>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="metric">
|
|
136
|
+
<span class="value">89</span>
|
|
137
|
+
<span class="label">Orders</span>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<div slot="footer">
|
|
142
|
+
<a href="/reports/sales">View Detailed Report →</a>
|
|
143
|
+
</div>
|
|
144
|
+
</Box>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Settings Panel
|
|
148
|
+
|
|
149
|
+
```svelte
|
|
150
|
+
<Box title="Account Settings">
|
|
151
|
+
<div class="settings-form">
|
|
152
|
+
<div class="form-group">
|
|
153
|
+
<label>Email Notifications</label>
|
|
154
|
+
<input type="checkbox" checked />
|
|
155
|
+
</div>
|
|
156
|
+
<div class="form-group">
|
|
157
|
+
<label>Language</label>
|
|
158
|
+
<select>
|
|
159
|
+
<option>English</option>
|
|
160
|
+
<option>Spanish</option>
|
|
161
|
+
<option>French</option>
|
|
162
|
+
</select>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div slot="footer" style="text-align: right; gap: 8px;">
|
|
167
|
+
<button type="button">Reset</button>
|
|
168
|
+
<button type="submit">Save Changes</button>
|
|
169
|
+
</div>
|
|
170
|
+
</Box>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Article Card
|
|
174
|
+
|
|
175
|
+
```svelte
|
|
176
|
+
<Box round={true} class="article-card">
|
|
177
|
+
<div slot="header">
|
|
178
|
+
<img src="/article-thumb.jpg" alt="Article" class="article-image" />
|
|
179
|
+
<div class="article-meta">
|
|
180
|
+
<h3>Understanding Svelte Components</h3>
|
|
181
|
+
<p class="byline">By Jane Smith • March 15, 2024</p>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<p>Learn the fundamentals of building reusable components in Svelte...</p>
|
|
186
|
+
|
|
187
|
+
<div slot="footer" style="display: flex; justify-content: space-between; align-items: center;">
|
|
188
|
+
<div class="tags">
|
|
189
|
+
<span class="tag">Svelte</span>
|
|
190
|
+
<span class="tag">Tutorial</span>
|
|
191
|
+
</div>
|
|
192
|
+
<button>Read More</button>
|
|
193
|
+
</div>
|
|
194
|
+
</Box>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Content-Only Box
|
|
198
|
+
|
|
199
|
+
```svelte
|
|
200
|
+
<!-- Box without header or footer, just styled content -->
|
|
201
|
+
<Box
|
|
202
|
+
style="border: 1px solid #ddd; border-radius: 8px; padding: 0;"
|
|
203
|
+
content$style="padding: 24px;"
|
|
204
|
+
>
|
|
205
|
+
<div class="notification">
|
|
206
|
+
<i class="icon-info"></i>
|
|
207
|
+
<p>This is an important notification message.</p>
|
|
208
|
+
</div>
|
|
209
|
+
</Box>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Layout Structure
|
|
213
|
+
|
|
214
|
+
The Box component consists of three main sections:
|
|
215
|
+
|
|
216
|
+
1. **Header** (optional): Displays title or custom content
|
|
217
|
+
2. **Content** (required): Main content area via default slot
|
|
218
|
+
3. **Footer** (optional): Action buttons or additional information
|
|
219
|
+
|
|
220
|
+
## Styling
|
|
221
|
+
|
|
222
|
+
The component uses the following CSS classes:
|
|
223
|
+
|
|
224
|
+
- `.uniface-box` - Main container
|
|
225
|
+
- `.box-header` - Header section container
|
|
226
|
+
- `.box-content` - Content section container
|
|
227
|
+
- `.box-footer` - Footer section container
|
|
228
|
+
- `.title` - Title text wrapper
|
|
229
|
+
- `.round` - Applied when round prop is true
|
|
230
|
+
|
|
231
|
+
### Example CSS
|
|
232
|
+
|
|
233
|
+
```css
|
|
234
|
+
.uniface-box {
|
|
235
|
+
border: 1px solid #e0e0e0;
|
|
236
|
+
background: #ffffff;
|
|
237
|
+
overflow: hidden;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.uniface-box.round {
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.box-header {
|
|
245
|
+
background: #f8f9fa;
|
|
246
|
+
border-bottom: 1px solid #e0e0e0;
|
|
247
|
+
padding: 16px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.box-content {
|
|
251
|
+
padding: 16px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.box-footer {
|
|
255
|
+
background: #f8f9fa;
|
|
256
|
+
border-top: 1px solid #e0e0e0;
|
|
257
|
+
padding: 12px 16px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.title {
|
|
261
|
+
font-weight: 600;
|
|
262
|
+
color: #333;
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Common Patterns
|
|
267
|
+
|
|
268
|
+
### Info Panel
|
|
269
|
+
|
|
270
|
+
```svelte
|
|
271
|
+
<Box title="System Information" round={true}>
|
|
272
|
+
<div class="info-grid">
|
|
273
|
+
<div class="info-item">
|
|
274
|
+
<strong>Version:</strong> 2.1.0
|
|
275
|
+
</div>
|
|
276
|
+
<div class="info-item">
|
|
277
|
+
<strong>Last Updated:</strong> March 15, 2024
|
|
278
|
+
</div>
|
|
279
|
+
<div class="info-item">
|
|
280
|
+
<strong>Status:</strong> Active
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
</Box>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Action Card
|
|
287
|
+
|
|
288
|
+
```svelte
|
|
289
|
+
<Box>
|
|
290
|
+
<div slot="header" style="text-align: center;">
|
|
291
|
+
<i class="large-icon icon-upload"></i>
|
|
292
|
+
<h3>Upload Files</h3>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<p style="text-align: center; color: #666;">
|
|
296
|
+
Drag and drop files here or click to browse
|
|
297
|
+
</p>
|
|
298
|
+
|
|
299
|
+
<div slot="footer" style="text-align: center;">
|
|
300
|
+
<button>Choose Files</button>
|
|
301
|
+
</div>
|
|
302
|
+
</Box>
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Stats Widget
|
|
306
|
+
|
|
307
|
+
```svelte
|
|
308
|
+
<Box title="Website Analytics" round={true}>
|
|
309
|
+
<div class="stats-grid">
|
|
310
|
+
<div class="stat">
|
|
311
|
+
<div class="stat-value">1,234</div>
|
|
312
|
+
<div class="stat-label">Visitors</div>
|
|
313
|
+
</div>
|
|
314
|
+
<div class="stat">
|
|
315
|
+
<div class="stat-value">89%</div>
|
|
316
|
+
<div class="stat-label">Bounce Rate</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div slot="footer">
|
|
321
|
+
<button>View Full Report</button>
|
|
322
|
+
</div>
|
|
323
|
+
</Box>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Responsive Design
|
|
327
|
+
|
|
328
|
+
For responsive layouts, consider using CSS Grid or Flexbox:
|
|
329
|
+
|
|
330
|
+
```css
|
|
331
|
+
.box-grid {
|
|
332
|
+
display: grid;
|
|
333
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
334
|
+
gap: 16px;
|
|
335
|
+
padding: 16px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
@media (max-width: 768px) {
|
|
339
|
+
.uniface-box {
|
|
340
|
+
margin: 8px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.box-header,
|
|
344
|
+
.box-content,
|
|
345
|
+
.box-footer {
|
|
346
|
+
padding: 12px;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Accessibility
|
|
352
|
+
|
|
353
|
+
- Use semantic HTML within slots
|
|
354
|
+
- Ensure proper heading hierarchy in headers
|
|
355
|
+
- Provide adequate color contrast
|
|
356
|
+
- Make interactive elements keyboard accessible
|
|
357
|
+
|
|
358
|
+
## Best Practices
|
|
359
|
+
|
|
360
|
+
1. **Consistent Spacing**: Use consistent padding/margins across boxes
|
|
361
|
+
2. **Visual Hierarchy**: Use appropriate typography in headers
|
|
362
|
+
3. **Action Placement**: Place primary actions in the footer
|
|
363
|
+
4. **Content Organization**: Group related content logically
|
|
364
|
+
5. **Responsive Design**: Test on different screen sizes
|
|
365
|
+
6. **Loading States**: Consider showing loading states for dynamic content
|
|
366
|
+
|
|
367
|
+
## Integration with Other Components
|
|
368
|
+
|
|
369
|
+
The Box component works well with other components:
|
|
370
|
+
|
|
371
|
+
```svelte
|
|
372
|
+
<Box title="Form Example">
|
|
373
|
+
<FormField label="Name">
|
|
374
|
+
<TextEditor value={name} />
|
|
375
|
+
</FormField>
|
|
376
|
+
|
|
377
|
+
<FormField label="Options">
|
|
378
|
+
<OptionsSelect options={choices} bind:value={selected} />
|
|
379
|
+
</FormField>
|
|
380
|
+
|
|
381
|
+
<div slot="footer">
|
|
382
|
+
<ActionBar buttons={formActions} />
|
|
383
|
+
</div>
|
|
384
|
+
</Box>
|
|
385
|
+
```
|