@ticatec/uniface-element 0.2.0 → 0.2.2
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 +320 -1
- package/README_CN.md +392 -0
- package/dist/accordion/Accordion.svelte +1 -1
- package/dist/action-bar/ActionBar.svelte +7 -1
- package/dist/attachment-files/FileRender.svelte +1 -1
- package/dist/attachment-files/FileUploadBar.svelte +7 -6
- package/dist/attachment-files/FileUploadPanel.svelte +2 -2
- package/dist/base-calendar/DateContext.js +5 -4
- package/dist/base-calendar/YearPickupPanel.svelte +4 -4
- package/dist/card/Card.svelte +1 -1
- package/dist/card/Card.svelte.d.ts +1 -1
- package/dist/cascade-options-select/CascadeOptionSelect.svelte +2 -3
- package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +46 -1
- package/dist/cascade-options-select/CascadePanel.svelte +1 -1
- package/dist/checkbox/CheckBox.svelte +1 -1
- package/dist/color-picker/ColorPicker.svelte +9 -9
- package/dist/color-picker/ColorPicker.svelte.d.ts +0 -2
- package/dist/color-picker/ColorPickerPanel.svelte +11 -15
- package/dist/color-picker/ColorPickerPanel.svelte.d.ts +1 -1
- package/dist/common/CommonPicker.svelte +2 -2
- package/dist/common/CommonPicker.svelte.d.ts +1 -1
- package/dist/common/MouseClickHandler.d.ts +1 -1
- package/dist/common/Popover.svelte +28 -6
- package/dist/common/Popover.svelte.d.ts +9 -3
- package/dist/common/uniface-utils.js +6 -4
- package/dist/common-editor/CommonEditor.svelte +1 -1
- package/dist/common-editor/CommonEditor.svelte.d.ts +1 -1
- package/dist/common-editor/NumberInput.svelte +1 -1
- package/dist/common-editor/NumberInput.svelte.d.ts +1 -1
- package/dist/concise-data-table/ConciseListTable.svelte +7 -2
- package/dist/concise-data-table/ConciseListTable.svelte.d.ts +1 -0
- package/dist/concise-data-table/DataRow.svelte +1 -1
- package/dist/concise-data-table/TableOptions.d.ts +1 -1
- package/dist/data-table/DataTable.svelte +1 -1
- package/dist/data-table/parts/ActionsPanel.svelte +4 -3
- package/dist/data-table/parts/ActionsRow.svelte +3 -3
- package/dist/data-table/parts/ContentPanel.svelte +3 -2
- package/dist/data-table/parts/FixedColumnsPanel.svelte +0 -1
- package/dist/data-table/parts/FixedColumnsPanel.svelte.d.ts +1 -2
- package/dist/data-table/parts/FixedHeaderPanel.svelte +2 -2
- package/dist/data-table/parts/FixedRow.svelte +2 -1
- package/dist/data-table/parts/FixedRow.svelte.d.ts +1 -1
- package/dist/data-table/parts/HrefCell.svelte +23 -2
- package/dist/data-table/parts/PopupMenu.svelte +25 -2
- package/dist/data-table/parts/PopupMenu.svelte.d.ts +8 -1
- package/dist/date-picker/DatePicker.svelte +0 -1
- package/dist/date-picker/DateTimePicker.svelte +3 -3
- package/dist/date-picker/ScrollBar.svelte +4 -7
- package/dist/date-range/DateRangeEditor.svelte +1 -1
- package/dist/dialog/CommonDialog.svelte +8 -5
- package/dist/dialog/CommonDialog.svelte.d.ts +2 -1
- package/dist/dialog/Dialog.svelte +37 -12
- package/dist/dialog/Dialog.svelte.d.ts +4 -3
- package/dist/dialog/DialogBoard.svelte +11 -8
- package/dist/dialog/DialogWrapper.svelte +10 -0
- package/dist/{common-editor/DateInput.svelte.d.ts → dialog/DialogWrapper.svelte.d.ts} +6 -13
- package/dist/dialog/Dialogs.js +1 -1
- package/dist/dialog/ModalResult.d.ts +5 -0
- package/dist/dialog/ModalResult.js +5 -0
- package/dist/drawer/Drawer.svelte +1 -1
- package/dist/form-field/FormField.svelte +2 -1
- package/dist/form-field/FormField.svelte.d.ts +1 -0
- package/dist/form-panel/flex-row-form/FormContainer.svelte +1 -1
- package/dist/form-panel/grid-form/EmptyCell.svelte +8 -7
- package/dist/form-panel/grid-form/EmptyCell.svelte.d.ts +2 -2
- package/dist/form-panel/grid-form/GridField.svelte +1 -1
- package/dist/i18nRes/i18nRes.d.ts +2 -0
- package/dist/i18nRes/i18nRes.js +44 -0
- package/dist/i18nRes/index.d.ts +2 -0
- package/dist/i18nRes/index.js +2 -0
- package/dist/image-files/ImageFilesField.svelte +1 -1
- package/dist/indicator/IndicatorBoard.svelte +1 -1
- package/dist/inline-cell-editor/InvalidEditor.svelte +1 -0
- package/dist/input-options-select/InputOptionsSelect.svelte +6 -6
- package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +1 -1
- package/dist/layout/flex/FlexBlock.svelte +1 -1
- package/dist/lookup-editor/LookupEditor.svelte +1 -1
- package/dist/memo-editor/MemoEditor.svelte +2 -2
- package/dist/message-box/IMessageBox.d.ts +2 -4
- package/dist/message-box/IMessageBox.js +4 -6
- package/dist/message-box/MessageBoxBoard.svelte +1 -3
- package/dist/options-multi-select/OptionsMultiSelect.svelte +1 -1
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +2 -2
- package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +1 -1
- package/dist/property-editor/PropertyEditor.svelte +3 -3
- package/dist/text-editor/PasswordEditor.svelte +1 -1
- package/dist/transfer/Transfer.svelte +17 -12
- package/dist/transfer/Transfer.svelte.d.ts +0 -1
- package/dist/unit-number-editor/UnitNumberEditor.svelte +2 -2
- package/docs/buttons/cn/ActionBar.md +459 -0
- package/docs/buttons/cn/Button.md +228 -0
- package/docs/buttons/cn/IconButton.md +294 -0
- package/docs/buttons/cn/README.md +600 -0
- package/docs/buttons/cn/TextButton.md +163 -0
- package/docs/buttons/en/ActionBar.md +459 -0
- package/docs/buttons/en/Button.md +228 -0
- package/docs/buttons/en/IconButton.md +294 -0
- package/docs/buttons/en/README.md +600 -0
- package/docs/buttons/en/TextButton.md +163 -0
- package/docs/containers/cn/accordion.md +622 -0
- package/docs/containers/cn/box.md +445 -0
- package/docs/containers/cn/card.md +404 -0
- package/docs/containers/cn/page.md +576 -0
- package/docs/containers/cn/tabs.md +686 -0
- package/docs/containers/en/accordion.md +622 -0
- package/docs/containers/en/box.md +445 -0
- package/docs/containers/en/card.md +404 -0
- package/docs/containers/en/page.md +576 -0
- package/docs/containers/en/tabs.md +686 -0
- package/docs/data-display/cn/concise-data-table.md +731 -0
- package/docs/data-display/cn/listbox.md +786 -0
- package/docs/data-display/cn/treeview.md +863 -0
- package/docs/data-display/en/concise-data-table.md +732 -0
- package/docs/data-display/en/listbox.md +786 -0
- package/docs/data-display/en/treeview.md +863 -0
- package/docs/data-table/cn/README.md +596 -0
- package/docs/data-table/en/README.md +596 -0
- package/docs/dialog/cn/README.md +767 -0
- package/docs/dialog/en/README.md +767 -0
- package/docs/form/cn/README.md +847 -0
- package/docs/form/en/README.md +847 -0
- package/docs/form-components/cn/README.md +495 -0
- package/docs/form-components/cn/attachmentfilesfield.md +757 -0
- package/docs/form-components/cn/cascade-options-select.md +374 -0
- package/docs/form-components/cn/checkbox.md +58 -0
- package/docs/form-components/cn/date-picker.md +138 -0
- package/docs/form-components/cn/datetime-picker.md +228 -0
- package/docs/form-components/cn/group-checkbox.md +405 -0
- package/docs/form-components/cn/group-radiobox.md +525 -0
- package/docs/form-components/cn/imagefilesfield.md +651 -0
- package/docs/form-components/cn/input-options-select.md +250 -0
- package/docs/form-components/cn/lookup-editor.md +406 -0
- package/docs/form-components/cn/memoeditor.md +409 -0
- package/docs/form-components/cn/number-editor.md +261 -0
- package/docs/form-components/cn/options-multi-select.md +177 -0
- package/docs/form-components/cn/options-select.md +83 -0
- package/docs/form-components/cn/passwordeditor.md +538 -0
- package/docs/form-components/cn/prompts-text-editor.md +241 -0
- package/docs/form-components/cn/radiobutton.md +84 -0
- package/docs/form-components/cn/switch.md +178 -0
- package/docs/form-components/cn/text-editor.md +142 -0
- package/docs/form-components/cn/time-editor.md +159 -0
- package/docs/form-components/cn/unit-number-editor.md +164 -0
- package/docs/form-components/en/README.md +463 -0
- package/docs/form-components/en/attachmentfilesfield.md +757 -0
- package/docs/form-components/en/cascade-options-select.md +358 -0
- package/docs/form-components/en/checkbox.md +59 -0
- package/docs/form-components/en/date-picker.md +138 -0
- package/docs/form-components/en/datetime-picker.md +228 -0
- package/docs/form-components/en/group-checkbox.md +395 -0
- package/docs/form-components/en/group-radiobox.md +498 -0
- package/docs/form-components/en/imagefilesfield.md +651 -0
- package/docs/form-components/en/input-options-select.md +239 -0
- package/docs/form-components/en/lookup-editor.md +389 -0
- package/docs/form-components/en/memoeditor.md +409 -0
- package/docs/form-components/en/number-editor.md +249 -0
- package/docs/form-components/en/options-multi-select.md +177 -0
- package/docs/form-components/en/options-select.md +83 -0
- package/docs/form-components/en/passwordeditor.md +538 -0
- package/docs/form-components/en/prompts-text-editor.md +241 -0
- package/docs/form-components/en/radiobutton.md +84 -0
- package/docs/form-components/en/switch.md +180 -0
- package/docs/form-components/en/text-editor.md +142 -0
- package/docs/form-components/en/time-editor.md +159 -0
- package/docs/form-components/en/unit-number-editor.md +164 -0
- package/docs/form-layout/cn/criteria-field.md +652 -0
- package/docs/form-layout/cn/flex-form.md +454 -0
- package/docs/form-layout/cn/flex-row-form.md +542 -0
- package/docs/form-layout/cn/form-field.md +923 -0
- package/docs/form-layout/cn/grid-form.md +676 -0
- package/docs/form-layout/en/criteria-field.md +652 -0
- package/docs/form-layout/en/flex-form.md +454 -0
- package/docs/form-layout/en/flex-row-form.md +542 -0
- package/docs/form-layout/en/form-field.md +923 -0
- package/docs/form-layout/en/grid-form.md +676 -0
- package/docs/global/cn/README.md +534 -0
- package/docs/global/en/README.md +534 -0
- package/docs/layout/cn/classiclayout.md +460 -0
- package/docs/layout/cn/headerlayout.md +524 -0
- package/docs/layout/cn/sidebarlayout.md +263 -0
- package/docs/layout/en/classiclayout.md +951 -0
- package/docs/layout/en/headerlayout.md +524 -0
- package/docs/layout/en/sidebarlayout.md +262 -0
- package/docs/misc/cn/README.md +1217 -0
- package/docs/misc/en/README.md +1217 -0
- package/docs/navigation/cn/breadcrumb.md +291 -0
- package/docs/navigation/cn/navigator.md +322 -0
- package/docs/navigation/cn/navigatormenu.md +512 -0
- package/docs/navigation/cn/progressbar.md +199 -0
- package/docs/navigation/cn/progressstepbar.md +299 -0
- package/docs/navigation/en/breadcrumb.md +291 -0
- package/docs/navigation/en/navigator.md +322 -0
- package/docs/navigation/en/navigatormenu.md +512 -0
- package/docs/navigation/en/progressbar.md +199 -0
- package/docs/navigation/en/progressstepbar.md +299 -0
- package/docs/search-filters/cn/daterange.md +1156 -0
- package/docs/search-filters/cn/numberrange.md +688 -0
- package/docs/search-filters/cn/searchbox.md +1582 -0
- package/docs/search-filters/en/daterange.md +1156 -0
- package/docs/search-filters/en/numberrange.md +688 -0
- package/docs/search-filters/en/searchbox.md +1582 -0
- package/package.json +53 -13
- package/dist/common-editor/DateInput.svelte +0 -27
- package/dist/i18n_resources/index.d.ts +0 -3
- package/dist/i18n_resources/index.js +0 -3
- /package/dist/{i18n_resources → i18nRes}/uniface_cn_resource.d.ts +0 -0
- /package/dist/{i18n_resources → i18nRes}/uniface_cn_resource.js +0 -0
- /package/dist/{i18n_resources → i18nRes}/uniface_en_resource.d.ts +0 -0
- /package/dist/{i18n_resources → i18nRes}/uniface_en_resource.js +0 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
# Accordion Component
|
|
2
|
+
|
|
3
|
+
A collapsible content container component that allows organizing multiple sections of content in a space-efficient expandable/collapsible format.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Accordion component provides an elegant way to display multiple sections of content where users can expand and collapse individual sections. It supports both exclusive (only one section open at a time) and multi-open modes, making it perfect for FAQs, navigation menus, content organization, and dashboard sections.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
13
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Basic Usage
|
|
17
|
+
|
|
18
|
+
```svelte
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
21
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
22
|
+
|
|
23
|
+
// Import your components
|
|
24
|
+
import UserProfile from './UserProfile.svelte';
|
|
25
|
+
import Settings from './Settings.svelte';
|
|
26
|
+
import Reports from './Reports.svelte';
|
|
27
|
+
|
|
28
|
+
let accordionItems: AccordionItem[] = [
|
|
29
|
+
{
|
|
30
|
+
title: 'User Profile',
|
|
31
|
+
component: UserProfile,
|
|
32
|
+
params: { userId: 123 }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'Settings',
|
|
36
|
+
component: Settings
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: 'Reports',
|
|
40
|
+
component: Reports,
|
|
41
|
+
params: { type: 'monthly' }
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<Accordion accordions={accordionItems} />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Properties
|
|
50
|
+
|
|
51
|
+
| Property | Type | Default | Description |
|
|
52
|
+
|----------|------|---------|-------------|
|
|
53
|
+
| `style` | `string` | `''` | Custom CSS styles for the accordion container |
|
|
54
|
+
| `class` | `string` | `''` | Additional CSS class names |
|
|
55
|
+
| `compact` | `boolean` | `false` | Use compact styling with reduced padding |
|
|
56
|
+
| `accordions` | `Array<AccordionItem>` | `[]` | Array of accordion items to display |
|
|
57
|
+
| `exclusive` | `boolean` | `false` | Only allow one accordion to be open at a time |
|
|
58
|
+
| `activeItem` | `AccordionItem` | `null` | Currently active item (used with exclusive mode) |
|
|
59
|
+
|
|
60
|
+
## AccordionItem Interface
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
interface AccordionItem {
|
|
64
|
+
/**
|
|
65
|
+
* Display title for the accordion section
|
|
66
|
+
*/
|
|
67
|
+
title: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Svelte component to render in the accordion content
|
|
71
|
+
*/
|
|
72
|
+
component: any;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Parameters/props to pass to the component
|
|
76
|
+
*/
|
|
77
|
+
params?: any;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage Examples
|
|
82
|
+
|
|
83
|
+
### Basic Accordion
|
|
84
|
+
|
|
85
|
+
```svelte
|
|
86
|
+
<script lang="ts">
|
|
87
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
88
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
89
|
+
|
|
90
|
+
// Simple text components for demo
|
|
91
|
+
let TextSection = (text: string) => `<div class="section-content"><p>${text}</p></div>`;
|
|
92
|
+
|
|
93
|
+
let items: AccordionItem[] = [
|
|
94
|
+
{
|
|
95
|
+
title: 'Getting Started',
|
|
96
|
+
component: TextSection,
|
|
97
|
+
params: { text: 'Welcome to our platform! Here you\'ll find everything you need to get started.' }
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: 'Features',
|
|
101
|
+
component: TextSection,
|
|
102
|
+
params: { text: 'Explore the powerful features available in our application.' }
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Support',
|
|
106
|
+
component: TextSection,
|
|
107
|
+
params: { text: 'Need help? Contact our support team for assistance.' }
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<Accordion accordions={items} />
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Exclusive Mode Accordion
|
|
116
|
+
|
|
117
|
+
```svelte
|
|
118
|
+
<script lang="ts">
|
|
119
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
120
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
121
|
+
|
|
122
|
+
import DashboardPanel from './DashboardPanel.svelte';
|
|
123
|
+
import AnalyticsPanel from './AnalyticsPanel.svelte';
|
|
124
|
+
import SettingsPanel from './SettingsPanel.svelte';
|
|
125
|
+
|
|
126
|
+
let dashboardItems: AccordionItem[] = [
|
|
127
|
+
{
|
|
128
|
+
title: 'Dashboard Overview',
|
|
129
|
+
component: DashboardPanel,
|
|
130
|
+
params: { view: 'overview' }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
title: 'Analytics',
|
|
134
|
+
component: AnalyticsPanel,
|
|
135
|
+
params: { period: '30d' }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: 'Settings',
|
|
139
|
+
component: SettingsPanel
|
|
140
|
+
}
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
let activeItem: AccordionItem = dashboardItems[0];
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<Accordion
|
|
147
|
+
accordions={dashboardItems}
|
|
148
|
+
exclusive={true}
|
|
149
|
+
bind:activeItem
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Compact Accordion
|
|
154
|
+
|
|
155
|
+
```svelte
|
|
156
|
+
<script lang="ts">
|
|
157
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
158
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
159
|
+
|
|
160
|
+
import QuickAction from './QuickAction.svelte';
|
|
161
|
+
|
|
162
|
+
let quickActions: AccordionItem[] = [
|
|
163
|
+
{
|
|
164
|
+
title: 'Quick Actions',
|
|
165
|
+
component: QuickAction,
|
|
166
|
+
params: { actions: ['create', 'edit', 'delete'] }
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
title: 'Recent Items',
|
|
170
|
+
component: QuickAction,
|
|
171
|
+
params: { type: 'recent', limit: 5 }
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
title: 'Favorites',
|
|
175
|
+
component: QuickAction,
|
|
176
|
+
params: { type: 'favorites' }
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<Accordion
|
|
182
|
+
accordions={quickActions}
|
|
183
|
+
compact={true}
|
|
184
|
+
class="sidebar-accordion"
|
|
185
|
+
style="max-width: 300px;"
|
|
186
|
+
/>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Dynamic Accordion with Real Components
|
|
190
|
+
|
|
191
|
+
```svelte
|
|
192
|
+
<script lang="ts">
|
|
193
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
194
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
195
|
+
|
|
196
|
+
// Import actual components
|
|
197
|
+
import UserListComponent from './components/UserListComponent.svelte';
|
|
198
|
+
import ProductCatalog from './components/ProductCatalog.svelte';
|
|
199
|
+
import OrderHistory from './components/OrderHistory.svelte';
|
|
200
|
+
import SystemLogs from './components/SystemLogs.svelte';
|
|
201
|
+
|
|
202
|
+
let currentUser = { id: 1, role: 'admin' };
|
|
203
|
+
|
|
204
|
+
let adminSections: AccordionItem[] = [
|
|
205
|
+
{
|
|
206
|
+
title: 'User Management',
|
|
207
|
+
component: UserListComponent,
|
|
208
|
+
params: {
|
|
209
|
+
editable: true,
|
|
210
|
+
filters: ['active', 'pending'],
|
|
211
|
+
currentUser: currentUser
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: 'Product Catalog',
|
|
216
|
+
component: ProductCatalog,
|
|
217
|
+
params: {
|
|
218
|
+
mode: 'admin',
|
|
219
|
+
showHidden: true,
|
|
220
|
+
allowEdit: true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
title: 'Order History',
|
|
225
|
+
component: OrderHistory,
|
|
226
|
+
params: {
|
|
227
|
+
dateRange: '30d',
|
|
228
|
+
status: 'all',
|
|
229
|
+
exportEnabled: true
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
title: 'System Logs',
|
|
234
|
+
component: SystemLogs,
|
|
235
|
+
params: {
|
|
236
|
+
level: 'info',
|
|
237
|
+
realTime: true,
|
|
238
|
+
maxLines: 1000
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
// Handle dynamic updates
|
|
244
|
+
function refreshAccordion() {
|
|
245
|
+
adminSections = [...adminSections];
|
|
246
|
+
}
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<div class="admin-dashboard">
|
|
250
|
+
<h2>Admin Dashboard</h2>
|
|
251
|
+
|
|
252
|
+
<Accordion
|
|
253
|
+
accordions={adminSections}
|
|
254
|
+
style="border: 1px solid #e0e0e0; border-radius: 8px;"
|
|
255
|
+
class="admin-accordion"
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
<button on:click={refreshAccordion} class="refresh-btn">
|
|
259
|
+
Refresh Data
|
|
260
|
+
</button>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<style>
|
|
264
|
+
.admin-dashboard {
|
|
265
|
+
max-width: 1200px;
|
|
266
|
+
margin: 0 auto;
|
|
267
|
+
padding: 20px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.refresh-btn {
|
|
271
|
+
margin-top: 20px;
|
|
272
|
+
padding: 10px 20px;
|
|
273
|
+
background: #007bff;
|
|
274
|
+
color: white;
|
|
275
|
+
border: none;
|
|
276
|
+
border-radius: 4px;
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.refresh-btn:hover {
|
|
281
|
+
background: #0056b3;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
:global(.admin-accordion) {
|
|
285
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
286
|
+
}
|
|
287
|
+
</style>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### FAQ Accordion
|
|
291
|
+
|
|
292
|
+
```svelte
|
|
293
|
+
<script lang="ts">
|
|
294
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
295
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
296
|
+
|
|
297
|
+
// Create a simple FAQ content component
|
|
298
|
+
const FAQContent = (content: string) => {
|
|
299
|
+
return `<div class="faq-content">${content}</div>`;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
let faqItems: AccordionItem[] = [
|
|
303
|
+
{
|
|
304
|
+
title: 'What is this platform?',
|
|
305
|
+
component: FAQContent,
|
|
306
|
+
params: 'Our platform is a comprehensive solution for managing your business operations, including user management, analytics, and reporting tools.'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
title: 'How do I get started?',
|
|
310
|
+
component: FAQContent,
|
|
311
|
+
params: 'Getting started is easy! Sign up for an account, complete your profile, and follow our step-by-step onboarding guide.'
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
title: 'What are the pricing options?',
|
|
315
|
+
component: FAQContent,
|
|
316
|
+
params: 'We offer flexible pricing plans including a free tier, professional plan at $29/month, and enterprise solutions. Contact our sales team for custom pricing.'
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
title: 'How can I contact support?',
|
|
320
|
+
component: FAQContent,
|
|
321
|
+
params: 'You can reach our support team 24/7 through the chat widget, email us at support@company.com, or call our hotline at 1-800-SUPPORT.'
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
title: 'Is my data secure?',
|
|
325
|
+
component: FAQContent,
|
|
326
|
+
params: 'Absolutely! We use enterprise-grade encryption, regular security audits, and comply with GDPR, SOC 2, and other security standards.'
|
|
327
|
+
}
|
|
328
|
+
];
|
|
329
|
+
</script>
|
|
330
|
+
|
|
331
|
+
<div class="faq-section">
|
|
332
|
+
<h2>Frequently Asked Questions</h2>
|
|
333
|
+
<p class="faq-subtitle">Find answers to common questions about our platform</p>
|
|
334
|
+
|
|
335
|
+
<Accordion
|
|
336
|
+
accordions={faqItems}
|
|
337
|
+
class="faq-accordion"
|
|
338
|
+
style="margin-top: 30px;"
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<style>
|
|
343
|
+
.faq-section {
|
|
344
|
+
max-width: 800px;
|
|
345
|
+
margin: 0 auto;
|
|
346
|
+
padding: 40px 20px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.faq-section h2 {
|
|
350
|
+
text-align: center;
|
|
351
|
+
color: #333;
|
|
352
|
+
margin-bottom: 10px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.faq-subtitle {
|
|
356
|
+
text-align: center;
|
|
357
|
+
color: #666;
|
|
358
|
+
margin-bottom: 0;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
:global(.faq-content) {
|
|
362
|
+
padding: 16px;
|
|
363
|
+
line-height: 1.6;
|
|
364
|
+
color: #555;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
:global(.faq-accordion .uniface-accordion-panel) {
|
|
368
|
+
border: 1px solid #e0e0e0;
|
|
369
|
+
border-radius: 8px;
|
|
370
|
+
margin-bottom: 12px;
|
|
371
|
+
}
|
|
372
|
+
</style>
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Nested Content Accordion
|
|
376
|
+
|
|
377
|
+
```svelte
|
|
378
|
+
<script lang="ts">
|
|
379
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
380
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
381
|
+
|
|
382
|
+
// Complex nested component example
|
|
383
|
+
import ProjectDetails from './ProjectDetails.svelte';
|
|
384
|
+
import TaskManager from './TaskManager.svelte';
|
|
385
|
+
import TeamOverview from './TeamOverview.svelte';
|
|
386
|
+
import FileManager from './FileManager.svelte';
|
|
387
|
+
|
|
388
|
+
let projectId = 'proj-123';
|
|
389
|
+
let projectData = {
|
|
390
|
+
name: 'Website Redesign',
|
|
391
|
+
status: 'active',
|
|
392
|
+
deadline: '2024-06-30'
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
let projectSections: AccordionItem[] = [
|
|
396
|
+
{
|
|
397
|
+
title: `Project Details - ${projectData.name}`,
|
|
398
|
+
component: ProjectDetails,
|
|
399
|
+
params: {
|
|
400
|
+
projectId,
|
|
401
|
+
projectData,
|
|
402
|
+
editable: true,
|
|
403
|
+
showTimeline: true
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
title: 'Task Management',
|
|
408
|
+
component: TaskManager,
|
|
409
|
+
params: {
|
|
410
|
+
projectId,
|
|
411
|
+
view: 'kanban',
|
|
412
|
+
allowAssignment: true,
|
|
413
|
+
filters: ['all', 'assigned', 'completed']
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
title: 'Team & Collaboration',
|
|
418
|
+
component: TeamOverview,
|
|
419
|
+
params: {
|
|
420
|
+
projectId,
|
|
421
|
+
showActivity: true,
|
|
422
|
+
allowInvite: true,
|
|
423
|
+
roles: ['admin', 'member', 'viewer']
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
title: 'Files & Documents',
|
|
428
|
+
component: FileManager,
|
|
429
|
+
params: {
|
|
430
|
+
projectId,
|
|
431
|
+
allowUpload: true,
|
|
432
|
+
maxFileSize: '10MB',
|
|
433
|
+
allowedTypes: ['.pdf', '.doc', '.jpg', '.png']
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
// Auto-select first item
|
|
439
|
+
let activeSection = projectSections[0];
|
|
440
|
+
</script>
|
|
441
|
+
|
|
442
|
+
<div class="project-workspace">
|
|
443
|
+
<div class="project-header">
|
|
444
|
+
<h1>{projectData.name}</h1>
|
|
445
|
+
<span class="status-badge status-{projectData.status}">
|
|
446
|
+
{projectData.status.toUpperCase()}
|
|
447
|
+
</span>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<Accordion
|
|
451
|
+
accordions={projectSections}
|
|
452
|
+
exclusive={true}
|
|
453
|
+
bind:activeItem={activeSection}
|
|
454
|
+
class="project-accordion"
|
|
455
|
+
style="margin-top: 20px;"
|
|
456
|
+
/>
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
<style>
|
|
460
|
+
.project-workspace {
|
|
461
|
+
max-width: 1200px;
|
|
462
|
+
margin: 0 auto;
|
|
463
|
+
padding: 20px;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.project-header {
|
|
467
|
+
display: flex;
|
|
468
|
+
align-items: center;
|
|
469
|
+
gap: 16px;
|
|
470
|
+
margin-bottom: 20px;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.project-header h1 {
|
|
474
|
+
margin: 0;
|
|
475
|
+
color: #333;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.status-badge {
|
|
479
|
+
padding: 4px 12px;
|
|
480
|
+
border-radius: 16px;
|
|
481
|
+
font-size: 0.75rem;
|
|
482
|
+
font-weight: 600;
|
|
483
|
+
text-transform: uppercase;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.status-active {
|
|
487
|
+
background: #d4edda;
|
|
488
|
+
color: #155724;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
:global(.project-accordion) {
|
|
492
|
+
border: 1px solid #dee2e6;
|
|
493
|
+
border-radius: 8px;
|
|
494
|
+
overflow: hidden;
|
|
495
|
+
}
|
|
496
|
+
</style>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
## Styling
|
|
500
|
+
|
|
501
|
+
The Accordion component uses the following CSS classes:
|
|
502
|
+
|
|
503
|
+
```css
|
|
504
|
+
.uniface-accordion-panel {
|
|
505
|
+
/* Main accordion container */
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.uniface-accordion-panel.compact {
|
|
509
|
+
/* Compact variant with reduced padding */
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/* Individual accordion items are styled by the AccordionItemView component */
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Advanced Usage
|
|
516
|
+
|
|
517
|
+
### Programmatic Control
|
|
518
|
+
|
|
519
|
+
```svelte
|
|
520
|
+
<script lang="ts">
|
|
521
|
+
import Accordion from '@ticatec/uniface-element/Accordion';
|
|
522
|
+
import type { AccordionItem } from '@ticatec/uniface-element/Accordion';
|
|
523
|
+
|
|
524
|
+
let accordionRef: Accordion;
|
|
525
|
+
let items: AccordionItem[] = [...];
|
|
526
|
+
let activeItem: AccordionItem;
|
|
527
|
+
|
|
528
|
+
function openSpecificSection(index: number) {
|
|
529
|
+
if (items[index]) {
|
|
530
|
+
activeItem = items[index];
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function addNewSection() {
|
|
535
|
+
const newItem: AccordionItem = {
|
|
536
|
+
title: `New Section ${items.length + 1}`,
|
|
537
|
+
component: SomeComponent,
|
|
538
|
+
params: { id: Date.now() }
|
|
539
|
+
};
|
|
540
|
+
items = [...items, newItem];
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function removeSection(index: number) {
|
|
544
|
+
items = items.filter((_, i) => i !== index);
|
|
545
|
+
}
|
|
546
|
+
</script>
|
|
547
|
+
|
|
548
|
+
<div class="controls">
|
|
549
|
+
<button on:click={() => openSpecificSection(0)}>Open First</button>
|
|
550
|
+
<button on:click={addNewSection}>Add Section</button>
|
|
551
|
+
</div>
|
|
552
|
+
|
|
553
|
+
<Accordion
|
|
554
|
+
bind:this={accordionRef}
|
|
555
|
+
accordions={items}
|
|
556
|
+
bind:activeItem
|
|
557
|
+
exclusive={true}
|
|
558
|
+
/>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
## API Reference
|
|
562
|
+
|
|
563
|
+
### Accordion Component Props
|
|
564
|
+
|
|
565
|
+
```typescript
|
|
566
|
+
interface AccordionProps {
|
|
567
|
+
style?: string; // Custom CSS styles
|
|
568
|
+
class?: string; // Additional CSS classes
|
|
569
|
+
compact?: boolean; // Use compact styling
|
|
570
|
+
accordions: Array<AccordionItem>; // Accordion items array
|
|
571
|
+
exclusive?: boolean; // Only one open at a time
|
|
572
|
+
activeItem?: AccordionItem; // Currently active item
|
|
573
|
+
}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
### AccordionItem Interface
|
|
577
|
+
|
|
578
|
+
```typescript
|
|
579
|
+
interface AccordionItem {
|
|
580
|
+
/**
|
|
581
|
+
* Display title for the accordion section
|
|
582
|
+
*/
|
|
583
|
+
title: string;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Svelte component to render in accordion content
|
|
587
|
+
*/
|
|
588
|
+
component: any;
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Parameters/props to pass to the component
|
|
592
|
+
*/
|
|
593
|
+
params?: any;
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## Best Practices
|
|
598
|
+
|
|
599
|
+
1. **Meaningful Titles** - Use clear, descriptive titles that indicate what content the section contains
|
|
600
|
+
2. **Component Organization** - Keep accordion content components focused and self-contained
|
|
601
|
+
3. **Performance** - Consider lazy loading for heavy content components
|
|
602
|
+
4. **Exclusive Mode** - Use exclusive mode for navigation-style accordions, multi-open for content organization
|
|
603
|
+
5. **Responsive Design** - Ensure accordion content works well on mobile devices
|
|
604
|
+
6. **Loading States** - Handle loading states gracefully when accordion content requires data fetching
|
|
605
|
+
7. **Keyboard Navigation** - Ensure accordion sections are keyboard accessible
|
|
606
|
+
8. **Visual Hierarchy** - Use consistent styling to maintain visual hierarchy within accordion content
|
|
607
|
+
|
|
608
|
+
## Accessibility
|
|
609
|
+
|
|
610
|
+
The Accordion component follows accessibility best practices:
|
|
611
|
+
|
|
612
|
+
- Proper ARIA attributes for screen readers
|
|
613
|
+
- Keyboard navigation support
|
|
614
|
+
- Focus management when expanding/collapsing
|
|
615
|
+
- Semantic HTML structure
|
|
616
|
+
|
|
617
|
+
## Performance Considerations
|
|
618
|
+
|
|
619
|
+
- Components are only instantiated when their accordion section is opened
|
|
620
|
+
- Use the `params` prop to pass only necessary data to components
|
|
621
|
+
- Consider implementing lazy loading for data-heavy components
|
|
622
|
+
- Avoid deeply nested accordion structures for better performance
|