@ticatec/uniface-element 0.2.4 → 0.3.0
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/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
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
# ConciseListTable Component
|
|
2
|
+
|
|
3
|
+
A high-performance, lightweight data table component with auto-scroll functionality, custom formatting, and responsive design. Perfect for dashboards, data displays, and real-time monitoring interfaces.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **High Performance**: Efficient rendering with minimal DOM manipulation
|
|
8
|
+
- **Auto-Scroll**: Seamless infinite scrolling for continuous data display
|
|
9
|
+
- **Flexible Columns**: Configurable width, alignment, and custom formatting
|
|
10
|
+
- **Responsive Design**: Automatic width adjustment with ResizeObserver
|
|
11
|
+
- **Accessibility**: ARIA attributes and keyboard navigation support
|
|
12
|
+
- **Custom Styling**: Comprehensive theming and styling options
|
|
13
|
+
- **Event Handling**: Row click events and focus management
|
|
14
|
+
- **Type Safety**: Full TypeScript support with detailed interfaces
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```svelte
|
|
19
|
+
<script>
|
|
20
|
+
import ConciseListTable, { type Column, type TableOptions } from '@ticatec/uniface-element/ConciseListTable';
|
|
21
|
+
|
|
22
|
+
const columns: Column[] = [
|
|
23
|
+
{ title: 'Name', field: 'name', width: 150, align: 'left' },
|
|
24
|
+
{ title: 'Age', field: 'age', width: 80, align: 'center' },
|
|
25
|
+
{ title: 'Email', field: 'email', width: 200, weight: 1 }
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const data = [
|
|
29
|
+
{ name: 'John Doe', age: 30, email: 'john@example.com' },
|
|
30
|
+
{ name: 'Jane Smith', age: 25, email: 'jane@example.com' },
|
|
31
|
+
{ name: 'Bob Johnson', age: 35, email: 'bob@example.com' }
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const options: TableOptions = {
|
|
35
|
+
headerHeight: 40,
|
|
36
|
+
rowHeight: 35,
|
|
37
|
+
backgroundColor: '#ffffff',
|
|
38
|
+
headerBackgroundColor: '#f5f5f5'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleRowClick = (row) => {
|
|
42
|
+
console.log('Clicked row:', row);
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<ConciseListTable
|
|
47
|
+
list={data}
|
|
48
|
+
{columns}
|
|
49
|
+
{options}
|
|
50
|
+
rowClickHandler={handleRowClick}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Props
|
|
55
|
+
|
|
56
|
+
| Prop | Type | Default | Description |
|
|
57
|
+
|------|------|---------|-------------|
|
|
58
|
+
| `list` | `Array<any>` | - | Array of data objects to display |
|
|
59
|
+
| `columns` | `Array<Column>` | - | Column definitions with configuration |
|
|
60
|
+
| `options` | `TableOptions` | - | Table styling and behavior options |
|
|
61
|
+
| `autoScroll` | `boolean` | `false` | Enable automatic scrolling |
|
|
62
|
+
| `scrollInterval` | `number` | `2000` | Milliseconds between scroll steps |
|
|
63
|
+
| `rowClickHandler` | `RowClickHandler \| null` | `null` | Row click event handler |
|
|
64
|
+
| `style` | `string` | `''` | Custom CSS styles for container |
|
|
65
|
+
| `className` | `string` | `''` | Additional CSS classes |
|
|
66
|
+
| `onfocus` | `((event: FocusEvent) => void) \| null` | `null` | Focus event handler |
|
|
67
|
+
| `onblur` | `((event: FocusEvent) => void) \| null` | `null` | Blur event handler |
|
|
68
|
+
|
|
69
|
+
## Methods
|
|
70
|
+
|
|
71
|
+
| Method | Description |
|
|
72
|
+
|--------|-------------|
|
|
73
|
+
| `setFocus()` | Programmatically focus the first table row |
|
|
74
|
+
|
|
75
|
+
## Column Interface
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
interface Column {
|
|
79
|
+
title: string; // Display title for column header
|
|
80
|
+
field: string; // Field name in data object
|
|
81
|
+
width: number; // Width in pixels
|
|
82
|
+
align?: "left" | "center" | "right"; // Text alignment
|
|
83
|
+
weight?: number; // Flex weight (0 = fixed, >0 = proportional)
|
|
84
|
+
formatter?: (value: any) => string; // Custom formatter function
|
|
85
|
+
escapeHTML?: boolean; // Allow HTML content in cells
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## TableOptions Interface
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
interface TableOptions {
|
|
93
|
+
backgroundColor?: string; // Table background color
|
|
94
|
+
color?: string; // Table text color
|
|
95
|
+
headerHeight?: number; // Header row height in pixels
|
|
96
|
+
headerBackgroundColor?: string; // Header background color
|
|
97
|
+
headerColor?: string; // Header text color
|
|
98
|
+
alternativeBackgroundColor?: string; // Alternate row background color
|
|
99
|
+
alternativeColor?: string; // Alternate row text color
|
|
100
|
+
rowHeight?: number; // Data row height in pixels
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Basic Examples
|
|
105
|
+
|
|
106
|
+
### Simple Data Table
|
|
107
|
+
|
|
108
|
+
```svelte
|
|
109
|
+
<script>
|
|
110
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
111
|
+
|
|
112
|
+
const employees = [
|
|
113
|
+
{ id: 1, name: 'Alice Johnson', department: 'Engineering', salary: 75000 },
|
|
114
|
+
{ id: 2, name: 'Bob Smith', department: 'Marketing', salary: 65000 },
|
|
115
|
+
{ id: 3, name: 'Carol Williams', department: 'Sales', salary: 70000 }
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const columns = [
|
|
119
|
+
{ title: 'ID', field: 'id', width: 60, align: 'center' },
|
|
120
|
+
{ title: 'Name', field: 'name', width: 150, align: 'left' },
|
|
121
|
+
{ title: 'Department', field: 'department', width: 120, align: 'center' },
|
|
122
|
+
{ title: 'Salary', field: 'salary', width: 100, align: 'right',
|
|
123
|
+
formatter: (value) => `$${value.toLocaleString()}` }
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
const options = {
|
|
127
|
+
headerHeight: 40,
|
|
128
|
+
rowHeight: 35,
|
|
129
|
+
headerBackgroundColor: '#f8f9fa',
|
|
130
|
+
alternativeBackgroundColor: '#f8f9fa'
|
|
131
|
+
};
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<ConciseListTable
|
|
135
|
+
list={employees}
|
|
136
|
+
{columns}
|
|
137
|
+
{options}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Table with Auto-Scroll
|
|
142
|
+
|
|
143
|
+
```svelte
|
|
144
|
+
<script>
|
|
145
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
146
|
+
|
|
147
|
+
const stockPrices = [
|
|
148
|
+
{ symbol: 'AAPL', price: 150.25, change: '+2.15', volume: '45.2M' },
|
|
149
|
+
{ symbol: 'GOOGL', price: 2800.50, change: '-12.30', volume: '1.8M' },
|
|
150
|
+
{ symbol: 'MSFT', price: 305.75, change: '+1.45', volume: '28.5M' },
|
|
151
|
+
{ symbol: 'TSLA', price: 850.20, change: '+15.60', volume: '35.1M' },
|
|
152
|
+
// ... more data
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const columns = [
|
|
156
|
+
{ title: 'Symbol', field: 'symbol', width: 80, align: 'center' },
|
|
157
|
+
{ title: 'Price', field: 'price', width: 100, align: 'right',
|
|
158
|
+
formatter: (value) => `$${value.toFixed(2)}` },
|
|
159
|
+
{ title: 'Change', field: 'change', width: 80, align: 'right' },
|
|
160
|
+
{ title: 'Volume', field: 'volume', width: 100, align: 'right' }
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
const options = {
|
|
164
|
+
rowHeight: 30,
|
|
165
|
+
headerHeight: 35,
|
|
166
|
+
backgroundColor: '#000',
|
|
167
|
+
color: '#00ff00',
|
|
168
|
+
headerBackgroundColor: '#333',
|
|
169
|
+
headerColor: '#fff'
|
|
170
|
+
};
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div style="height: 300px;">
|
|
174
|
+
<ConciseListTable
|
|
175
|
+
list={stockPrices}
|
|
176
|
+
{columns}
|
|
177
|
+
{options}
|
|
178
|
+
autoScroll={true}
|
|
179
|
+
scrollInterval={3000}
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Table with Custom Formatting
|
|
185
|
+
|
|
186
|
+
```svelte
|
|
187
|
+
<script>
|
|
188
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
189
|
+
|
|
190
|
+
const orders = [
|
|
191
|
+
{ id: 'ORD-001', customer: 'John Doe', date: '2024-01-15',
|
|
192
|
+
amount: 299.99, status: 'shipped' },
|
|
193
|
+
{ id: 'ORD-002', customer: 'Jane Smith', date: '2024-01-16',
|
|
194
|
+
amount: 149.50, status: 'pending' },
|
|
195
|
+
{ id: 'ORD-003', customer: 'Bob Johnson', date: '2024-01-17',
|
|
196
|
+
amount: 599.99, status: 'delivered' }
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
const formatDate = (dateStr) => {
|
|
200
|
+
return new Date(dateStr).toLocaleDateString('en-US', {
|
|
201
|
+
month: 'short', day: 'numeric', year: 'numeric'
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const formatStatus = (status) => {
|
|
206
|
+
const colors = {
|
|
207
|
+
shipped: '#ffc107',
|
|
208
|
+
pending: '#6c757d',
|
|
209
|
+
delivered: '#28a745'
|
|
210
|
+
};
|
|
211
|
+
return `<span style="color: ${colors[status]}; font-weight: bold;">${status.toUpperCase()}</span>`;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const columns = [
|
|
215
|
+
{ title: 'Order ID', field: 'id', width: 100, align: 'left' },
|
|
216
|
+
{ title: 'Customer', field: 'customer', width: 150, weight: 1 },
|
|
217
|
+
{ title: 'Date', field: 'date', width: 120, align: 'center',
|
|
218
|
+
formatter: formatDate },
|
|
219
|
+
{ title: 'Amount', field: 'amount', width: 100, align: 'right',
|
|
220
|
+
formatter: (value) => `$${value.toFixed(2)}` },
|
|
221
|
+
{ title: 'Status', field: 'status', width: 100, align: 'center',
|
|
222
|
+
formatter: formatStatus, escapeHTML: true }
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
const options = {
|
|
226
|
+
headerHeight: 45,
|
|
227
|
+
rowHeight: 40,
|
|
228
|
+
headerBackgroundColor: '#007bff',
|
|
229
|
+
headerColor: '#ffffff',
|
|
230
|
+
alternativeBackgroundColor: '#f8f9fa'
|
|
231
|
+
};
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<ConciseListTable
|
|
235
|
+
list={orders}
|
|
236
|
+
{columns}
|
|
237
|
+
{options}
|
|
238
|
+
/>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Responsive Table with Flexible Columns
|
|
242
|
+
|
|
243
|
+
```svelte
|
|
244
|
+
<script>
|
|
245
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
246
|
+
|
|
247
|
+
const products = [
|
|
248
|
+
{ id: 1, name: 'Wireless Headphones Premium Edition',
|
|
249
|
+
category: 'Electronics', price: 199.99, stock: 15 },
|
|
250
|
+
{ id: 2, name: 'Ergonomic Office Chair with Lumbar Support',
|
|
251
|
+
category: 'Furniture', price: 299.99, stock: 8 },
|
|
252
|
+
{ id: 3, name: 'Smart Home Security Camera System',
|
|
253
|
+
category: 'Electronics', price: 149.99, stock: 23 }
|
|
254
|
+
];
|
|
255
|
+
|
|
256
|
+
const columns = [
|
|
257
|
+
{ title: 'ID', field: 'id', width: 50, align: 'center' },
|
|
258
|
+
{ title: 'Product Name', field: 'name', width: 200, weight: 2 }, // Flexible
|
|
259
|
+
{ title: 'Category', field: 'category', width: 120, weight: 1 }, // Flexible
|
|
260
|
+
{ title: 'Price', field: 'price', width: 100, align: 'right',
|
|
261
|
+
formatter: (value) => `$${value.toFixed(2)}` },
|
|
262
|
+
{ title: 'Stock', field: 'stock', width: 80, align: 'center' }
|
|
263
|
+
];
|
|
264
|
+
|
|
265
|
+
const options = {
|
|
266
|
+
headerHeight: 40,
|
|
267
|
+
rowHeight: 45,
|
|
268
|
+
backgroundColor: '#ffffff',
|
|
269
|
+
headerBackgroundColor: '#e9ecef',
|
|
270
|
+
alternativeBackgroundColor: '#f8f9fa'
|
|
271
|
+
};
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<div style="width: 100%; min-width: 600px;">
|
|
275
|
+
<ConciseListTable
|
|
276
|
+
list={products}
|
|
277
|
+
{columns}
|
|
278
|
+
{options}
|
|
279
|
+
/>
|
|
280
|
+
</div>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Event Handling
|
|
284
|
+
|
|
285
|
+
```svelte
|
|
286
|
+
<script>
|
|
287
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
288
|
+
|
|
289
|
+
let selectedRow = null;
|
|
290
|
+
let focusCount = 0;
|
|
291
|
+
let tableRef;
|
|
292
|
+
|
|
293
|
+
const data = [
|
|
294
|
+
{ id: 1, name: 'Item 1', value: 100 },
|
|
295
|
+
{ id: 2, name: 'Item 2', value: 200 },
|
|
296
|
+
{ id: 3, name: 'Item 3', value: 300 }
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
const columns = [
|
|
300
|
+
{ title: 'ID', field: 'id', width: 60, align: 'center' },
|
|
301
|
+
{ title: 'Name', field: 'name', width: 150 },
|
|
302
|
+
{ title: 'Value', field: 'value', width: 100, align: 'right' }
|
|
303
|
+
];
|
|
304
|
+
|
|
305
|
+
const options = {
|
|
306
|
+
headerHeight: 35,
|
|
307
|
+
rowHeight: 30
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const handleRowClick = (row) => {
|
|
311
|
+
selectedRow = row;
|
|
312
|
+
console.log('Selected row:', row);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const handleFocus = (event) => {
|
|
316
|
+
focusCount++;
|
|
317
|
+
console.log('Table focused', focusCount);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const handleBlur = (event) => {
|
|
321
|
+
console.log('Table blurred');
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const focusTable = () => {
|
|
325
|
+
tableRef?.setFocus();
|
|
326
|
+
};
|
|
327
|
+
</script>
|
|
328
|
+
|
|
329
|
+
<div>
|
|
330
|
+
<button on:click={focusTable}>Focus Table</button>
|
|
331
|
+
|
|
332
|
+
<ConciseListTable
|
|
333
|
+
bind:this={tableRef}
|
|
334
|
+
list={data}
|
|
335
|
+
{columns}
|
|
336
|
+
{options}
|
|
337
|
+
rowClickHandler={handleRowClick}
|
|
338
|
+
onfocus={handleFocus}
|
|
339
|
+
onblur={handleBlur}
|
|
340
|
+
/>
|
|
341
|
+
|
|
342
|
+
{#if selectedRow}
|
|
343
|
+
<div class="selected-info">
|
|
344
|
+
Selected: {selectedRow.name} (ID: {selectedRow.id})
|
|
345
|
+
</div>
|
|
346
|
+
{/if}
|
|
347
|
+
|
|
348
|
+
<div class="focus-info">
|
|
349
|
+
Focus count: {focusCount}
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
|
|
353
|
+
<style>
|
|
354
|
+
.selected-info, .focus-info {
|
|
355
|
+
margin-top: 10px;
|
|
356
|
+
padding: 8px;
|
|
357
|
+
background: #e7f3ff;
|
|
358
|
+
border: 1px solid #b3d9ff;
|
|
359
|
+
border-radius: 4px;
|
|
360
|
+
}
|
|
361
|
+
</style>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Advanced Examples
|
|
365
|
+
|
|
366
|
+
### Real-Time Data Dashboard
|
|
367
|
+
|
|
368
|
+
```svelte
|
|
369
|
+
<script>
|
|
370
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
371
|
+
import { onMount, onDestroy } from 'svelte';
|
|
372
|
+
|
|
373
|
+
let realtimeData = [];
|
|
374
|
+
let updateInterval;
|
|
375
|
+
|
|
376
|
+
// Simulate real-time data updates
|
|
377
|
+
const generateRandomData = () => {
|
|
378
|
+
return Array.from({ length: 20 }, (_, i) => ({
|
|
379
|
+
id: `SRV-${String(i + 1).padStart(3, '0')}`,
|
|
380
|
+
name: `Server ${i + 1}`,
|
|
381
|
+
cpu: (Math.random() * 100).toFixed(1),
|
|
382
|
+
memory: (Math.random() * 100).toFixed(1),
|
|
383
|
+
disk: (Math.random() * 100).toFixed(1),
|
|
384
|
+
status: Math.random() > 0.8 ? 'warning' : 'healthy',
|
|
385
|
+
uptime: Math.floor(Math.random() * 365) + 1
|
|
386
|
+
}));
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const columns = [
|
|
390
|
+
{ title: 'Server ID', field: 'id', width: 100, align: 'center' },
|
|
391
|
+
{ title: 'Name', field: 'name', width: 120, weight: 1 },
|
|
392
|
+
{ title: 'CPU %', field: 'cpu', width: 80, align: 'right',
|
|
393
|
+
formatter: (value) => `${value}%` },
|
|
394
|
+
{ title: 'Memory %', field: 'memory', width: 80, align: 'right',
|
|
395
|
+
formatter: (value) => `${value}%` },
|
|
396
|
+
{ title: 'Disk %', field: 'disk', width: 80, align: 'right',
|
|
397
|
+
formatter: (value) => `${value}%` },
|
|
398
|
+
{ title: 'Status', field: 'status', width: 100, align: 'center',
|
|
399
|
+
formatter: (status) => {
|
|
400
|
+
const color = status === 'healthy' ? '#28a745' : '#ffc107';
|
|
401
|
+
return `<span style="color: ${color}; font-weight: bold;">${status.toUpperCase()}</span>`;
|
|
402
|
+
},
|
|
403
|
+
escapeHTML: true
|
|
404
|
+
},
|
|
405
|
+
{ title: 'Uptime (days)', field: 'uptime', width: 120, align: 'right' }
|
|
406
|
+
];
|
|
407
|
+
|
|
408
|
+
const options = {
|
|
409
|
+
headerHeight: 40,
|
|
410
|
+
rowHeight: 35,
|
|
411
|
+
backgroundColor: '#1a1a1a',
|
|
412
|
+
color: '#ffffff',
|
|
413
|
+
headerBackgroundColor: '#333333',
|
|
414
|
+
headerColor: '#ffffff',
|
|
415
|
+
alternativeBackgroundColor: '#2a2a2a'
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
onMount(() => {
|
|
419
|
+
realtimeData = generateRandomData();
|
|
420
|
+
|
|
421
|
+
// Update data every 5 seconds
|
|
422
|
+
updateInterval = setInterval(() => {
|
|
423
|
+
realtimeData = generateRandomData();
|
|
424
|
+
}, 5000);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
onDestroy(() => {
|
|
428
|
+
if (updateInterval) {
|
|
429
|
+
clearInterval(updateInterval);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
</script>
|
|
433
|
+
|
|
434
|
+
<div class="dashboard">
|
|
435
|
+
<h3>Server Monitoring Dashboard</h3>
|
|
436
|
+
<div style="height: 400px; border: 1px solid #333;">
|
|
437
|
+
<ConciseListTable
|
|
438
|
+
list={realtimeData}
|
|
439
|
+
{columns}
|
|
440
|
+
{options}
|
|
441
|
+
autoScroll={true}
|
|
442
|
+
scrollInterval={4000}
|
|
443
|
+
/>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<style>
|
|
448
|
+
.dashboard {
|
|
449
|
+
background: #1a1a1a;
|
|
450
|
+
color: #ffffff;
|
|
451
|
+
padding: 20px;
|
|
452
|
+
border-radius: 8px;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.dashboard h3 {
|
|
456
|
+
margin: 0 0 16px 0;
|
|
457
|
+
color: #ffffff;
|
|
458
|
+
}
|
|
459
|
+
</style>
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Financial Trading Table
|
|
463
|
+
|
|
464
|
+
```svelte
|
|
465
|
+
<script>
|
|
466
|
+
import ConciseListTable from '@ticatec/uniface-element/ConciseListTable';
|
|
467
|
+
|
|
468
|
+
const tradingData = [
|
|
469
|
+
{ symbol: 'AAPL', price: 150.25, change: 2.15, changePercent: 1.45, volume: 45200000 },
|
|
470
|
+
{ symbol: 'GOOGL', price: 2800.50, change: -12.30, changePercent: -0.44, volume: 1800000 },
|
|
471
|
+
{ symbol: 'MSFT', price: 305.75, change: 1.45, changePercent: 0.48, volume: 28500000 },
|
|
472
|
+
{ symbol: 'TSLA', price: 850.20, change: 15.60, changePercent: 1.87, volume: 35100000 }
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
const formatPrice = (value) => `$${value.toFixed(2)}`;
|
|
476
|
+
|
|
477
|
+
const formatChange = (value) => {
|
|
478
|
+
const color = value >= 0 ? '#28a745' : '#dc3545';
|
|
479
|
+
const sign = value >= 0 ? '+' : '';
|
|
480
|
+
return `<span style="color: ${color}; font-weight: bold;">${sign}${value.toFixed(2)}</span>`;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const formatPercent = (value) => {
|
|
484
|
+
const color = value >= 0 ? '#28a745' : '#dc3545';
|
|
485
|
+
const sign = value >= 0 ? '+' : '';
|
|
486
|
+
return `<span style="color: ${color};">${sign}${value.toFixed(2)}%</span>`;
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
const formatVolume = (value) => {
|
|
490
|
+
if (value >= 1000000) {
|
|
491
|
+
return `${(value / 1000000).toFixed(1)}M`;
|
|
492
|
+
} else if (value >= 1000) {
|
|
493
|
+
return `${(value / 1000).toFixed(1)}K`;
|
|
494
|
+
}
|
|
495
|
+
return value.toString();
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const columns = [
|
|
499
|
+
{ title: 'Symbol', field: 'symbol', width: 80, align: 'center' },
|
|
500
|
+
{ title: 'Price', field: 'price', width: 100, align: 'right',
|
|
501
|
+
formatter: formatPrice },
|
|
502
|
+
{ title: 'Change', field: 'change', width: 80, align: 'right',
|
|
503
|
+
formatter: formatChange, escapeHTML: true },
|
|
504
|
+
{ title: 'Change %', field: 'changePercent', width: 80, align: 'right',
|
|
505
|
+
formatter: formatPercent, escapeHTML: true },
|
|
506
|
+
{ title: 'Volume', field: 'volume', width: 80, align: 'right',
|
|
507
|
+
formatter: formatVolume }
|
|
508
|
+
];
|
|
509
|
+
|
|
510
|
+
const options = {
|
|
511
|
+
headerHeight: 35,
|
|
512
|
+
rowHeight: 30,
|
|
513
|
+
backgroundColor: '#000000',
|
|
514
|
+
color: '#ffffff',
|
|
515
|
+
headerBackgroundColor: '#1a1a1a',
|
|
516
|
+
headerColor: '#ffffff'
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
const handleStockClick = (stock) => {
|
|
520
|
+
console.log('Selected stock:', stock.symbol);
|
|
521
|
+
// Could open detailed view, place order, etc.
|
|
522
|
+
};
|
|
523
|
+
</script>
|
|
524
|
+
|
|
525
|
+
<div class="trading-table">
|
|
526
|
+
<h4>Live Stock Prices</h4>
|
|
527
|
+
<ConciseListTable
|
|
528
|
+
list={tradingData}
|
|
529
|
+
{columns}
|
|
530
|
+
{options}
|
|
531
|
+
rowClickHandler={handleStockClick}
|
|
532
|
+
/>
|
|
533
|
+
</div>
|
|
534
|
+
|
|
535
|
+
<style>
|
|
536
|
+
.trading-table {
|
|
537
|
+
background: #000;
|
|
538
|
+
color: #fff;
|
|
539
|
+
padding: 16px;
|
|
540
|
+
border-radius: 4px;
|
|
541
|
+
font-family: 'Courier New', monospace;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.trading-table h4 {
|
|
545
|
+
margin: 0 0 12px 0;
|
|
546
|
+
color: #00ff00;
|
|
547
|
+
}
|
|
548
|
+
</style>
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
## Accessibility
|
|
552
|
+
|
|
553
|
+
The ConciseListTable component includes comprehensive accessibility features:
|
|
554
|
+
|
|
555
|
+
- **ARIA Roles**: Proper `table`, `row`, `cell`, and `columnheader` roles
|
|
556
|
+
- **Keyboard Navigation**: Tab navigation and Enter/Space activation
|
|
557
|
+
- **Screen Reader Support**: Appropriate labeling and row indexing
|
|
558
|
+
- **Focus Management**: Programmatic focus control
|
|
559
|
+
- **Semantic Structure**: Proper table markup and relationships
|
|
560
|
+
|
|
561
|
+
### Best Practices
|
|
562
|
+
|
|
563
|
+
```svelte
|
|
564
|
+
<!-- Good: Descriptive table labeling -->
|
|
565
|
+
<ConciseListTable
|
|
566
|
+
list={data}
|
|
567
|
+
columns={columns}
|
|
568
|
+
options={options}
|
|
569
|
+
aria-label="Employee information table"
|
|
570
|
+
/>
|
|
571
|
+
|
|
572
|
+
<!-- Good: Consistent column alignment -->
|
|
573
|
+
const columns = [
|
|
574
|
+
{ title: 'ID', field: 'id', width: 60, align: 'center' },
|
|
575
|
+
{ title: 'Name', field: 'name', width: 150, align: 'left' },
|
|
576
|
+
{ title: 'Salary', field: 'salary', width: 100, align: 'right' }
|
|
577
|
+
];
|
|
578
|
+
|
|
579
|
+
<!-- Good: Meaningful formatters -->
|
|
580
|
+
{ title: 'Status', field: 'status', formatter: (value) =>
|
|
581
|
+
value ? 'Active' : 'Inactive' }
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
## Performance Optimization
|
|
585
|
+
|
|
586
|
+
- **Efficient Rendering**: Minimal DOM updates with reactive changes
|
|
587
|
+
- **Auto-Scroll Performance**: Optimized transform-based animation
|
|
588
|
+
- **ResizeObserver**: Efficient viewport size monitoring
|
|
589
|
+
- **Memory Management**: Proper cleanup of timers and observers
|
|
590
|
+
- **Type Safety**: Full TypeScript support reduces runtime errors
|
|
591
|
+
|
|
592
|
+
## Browser Support
|
|
593
|
+
|
|
594
|
+
Works in all modern browsers that support:
|
|
595
|
+
- ES6+ JavaScript
|
|
596
|
+
- ResizeObserver API
|
|
597
|
+
- CSS transforms and transitions
|
|
598
|
+
- Modern DOM APIs
|
|
599
|
+
|
|
600
|
+
## Migration Notes
|
|
601
|
+
|
|
602
|
+
When upgrading from older versions:
|
|
603
|
+
- `onChange` events are now `onchange` (lowercase)
|
|
604
|
+
- `onClick` events are now `onclick` (lowercase)
|
|
605
|
+
- New accessibility features require no code changes
|
|
606
|
+
- Enhanced TypeScript support provides better development experience
|