@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,512 @@
|
|
|
1
|
+
# NavigatorMenu Component
|
|
2
|
+
|
|
3
|
+
The NavigatorMenu component provides a hierarchical menu system with expandable/collapsible tree-like navigation, supporting nested menu structures with smooth animations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Hierarchical Navigation**: Multi-level tree menu structure
|
|
8
|
+
- **Expandable Items**: Collapsible menu items with child navigation
|
|
9
|
+
- **Smooth Animations**: Slide transitions for expanding/collapsing
|
|
10
|
+
- **Flexible Data Structure**: Support for any menu item data format
|
|
11
|
+
- **Custom Text Fields**: Configurable text extraction from menu items
|
|
12
|
+
- **Click Handling**: Custom click handlers for menu actions
|
|
13
|
+
- **Recursive Rendering**: Automatically handles nested menu levels
|
|
14
|
+
|
|
15
|
+
## Import
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { NavigatorMenu, MenuItem } from '@ticatec/uniface-element/NavigatorMenu';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
### Simple Menu
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<script>
|
|
27
|
+
import { NavigatorMenu } from '@ticatec/uniface-element/NavigatorMenu';
|
|
28
|
+
|
|
29
|
+
const menuItems = [
|
|
30
|
+
{
|
|
31
|
+
item: { name: "Dashboard", route: "/dashboard" },
|
|
32
|
+
expand: false,
|
|
33
|
+
children: null
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
item: { name: "Users", route: "/users" },
|
|
37
|
+
expand: false,
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
item: { name: "All Users", route: "/users/list" },
|
|
41
|
+
expand: false,
|
|
42
|
+
children: null
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
item: { name: "Add User", route: "/users/add" },
|
|
46
|
+
expand: false,
|
|
47
|
+
children: null
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
item: { name: "Settings", route: "/settings" },
|
|
53
|
+
expand: false,
|
|
54
|
+
children: null
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const handleMenuClick = (menuItem) => {
|
|
59
|
+
console.log('Menu clicked:', menuItem.item.name);
|
|
60
|
+
console.log('Navigate to:', menuItem.item.route);
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<NavigatorMenu
|
|
65
|
+
menuItems={menuItems}
|
|
66
|
+
textField="name"
|
|
67
|
+
onItemClick={handleMenuClick}
|
|
68
|
+
/>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Menu with Custom Text Extraction
|
|
72
|
+
|
|
73
|
+
```svelte
|
|
74
|
+
<script>
|
|
75
|
+
import { NavigatorMenu } from '@ticatec/uniface-element/NavigatorMenu';
|
|
76
|
+
|
|
77
|
+
const navigationMenu = [
|
|
78
|
+
{
|
|
79
|
+
item: { title: "Home", icon: "home", path: "/" },
|
|
80
|
+
expand: false,
|
|
81
|
+
children: null
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
item: { title: "Products", icon: "products", path: "/products" },
|
|
85
|
+
expand: true, // Initially expanded
|
|
86
|
+
children: [
|
|
87
|
+
{
|
|
88
|
+
item: { title: "Electronics", path: "/products/electronics" },
|
|
89
|
+
expand: false,
|
|
90
|
+
children: [
|
|
91
|
+
{
|
|
92
|
+
item: { title: "Computers", path: "/products/electronics/computers" },
|
|
93
|
+
expand: false,
|
|
94
|
+
children: null
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
item: { title: "Phones", path: "/products/electronics/phones" },
|
|
98
|
+
expand: false,
|
|
99
|
+
children: null
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
item: { title: "Clothing", path: "/products/clothing" },
|
|
105
|
+
expand: false,
|
|
106
|
+
children: null
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
// Custom function to extract text from menu items
|
|
113
|
+
const getMenuText = (item) => {
|
|
114
|
+
return `${item.icon ? '📁 ' : '📄 '}${item.title}`;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const handleItemClick = (menuItem) => {
|
|
118
|
+
console.log('Clicked:', menuItem.item.title);
|
|
119
|
+
};
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<NavigatorMenu
|
|
123
|
+
menuItems={navigationMenu}
|
|
124
|
+
textField={getMenuText}
|
|
125
|
+
onItemClick={handleItemClick}
|
|
126
|
+
style="width: 300px; border: 1px solid #e0e0e0; border-radius: 4px;"
|
|
127
|
+
/>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## API Reference
|
|
131
|
+
|
|
132
|
+
### Props
|
|
133
|
+
|
|
134
|
+
| Property | Type | Default | Description |
|
|
135
|
+
|----------|------|---------|-------------|
|
|
136
|
+
| `menuItems` | `Array<MenuItem>` | required | Array of menu item objects |
|
|
137
|
+
| `style` | `string` | `''` | Additional CSS styles |
|
|
138
|
+
| `textField` | `string \| GetText<MenuItem>` | required | Field name or function to extract text |
|
|
139
|
+
| `onItemClick` | `OnMenuClick` | required | Click handler for menu items |
|
|
140
|
+
|
|
141
|
+
### MenuItem Interface
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
interface MenuItem {
|
|
145
|
+
[key: string]: any; // Flexible item data structure
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface MenuNode extends TreeNode<MenuItem> {
|
|
149
|
+
item: MenuItem; // The actual menu data
|
|
150
|
+
expand: boolean; // Whether this node is expanded
|
|
151
|
+
children: MenuNode[] | null; // Child menu items
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Types
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
type OnMenuClick = (item: MenuItem) => void;
|
|
159
|
+
type GetText<T> = (item: T) => string;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Advanced Examples
|
|
163
|
+
|
|
164
|
+
### Application Navigation with Icons
|
|
165
|
+
|
|
166
|
+
```svelte
|
|
167
|
+
<script>
|
|
168
|
+
import { NavigatorMenu } from '@ticatec/uniface-element/NavigatorMenu';
|
|
169
|
+
|
|
170
|
+
let appNavigation = [
|
|
171
|
+
{
|
|
172
|
+
item: {
|
|
173
|
+
id: 'dashboard',
|
|
174
|
+
label: "Dashboard",
|
|
175
|
+
icon: "📊",
|
|
176
|
+
route: "/dashboard",
|
|
177
|
+
permissions: ["read"]
|
|
178
|
+
},
|
|
179
|
+
expand: false,
|
|
180
|
+
children: null
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
item: {
|
|
184
|
+
id: 'admin',
|
|
185
|
+
label: "Administration",
|
|
186
|
+
icon: "⚙️",
|
|
187
|
+
permissions: ["admin"]
|
|
188
|
+
},
|
|
189
|
+
expand: false,
|
|
190
|
+
children: [
|
|
191
|
+
{
|
|
192
|
+
item: {
|
|
193
|
+
id: 'users',
|
|
194
|
+
label: "User Management",
|
|
195
|
+
route: "/admin/users",
|
|
196
|
+
permissions: ["admin", "user_management"]
|
|
197
|
+
},
|
|
198
|
+
expand: false,
|
|
199
|
+
children: [
|
|
200
|
+
{
|
|
201
|
+
item: {
|
|
202
|
+
id: 'user_list',
|
|
203
|
+
label: "View Users",
|
|
204
|
+
route: "/admin/users/list"
|
|
205
|
+
},
|
|
206
|
+
expand: false,
|
|
207
|
+
children: null
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
item: {
|
|
211
|
+
id: 'user_create',
|
|
212
|
+
label: "Create User",
|
|
213
|
+
route: "/admin/users/create"
|
|
214
|
+
},
|
|
215
|
+
expand: false,
|
|
216
|
+
children: null
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
item: {
|
|
220
|
+
id: 'user_roles',
|
|
221
|
+
label: "Manage Roles",
|
|
222
|
+
route: "/admin/users/roles"
|
|
223
|
+
},
|
|
224
|
+
expand: false,
|
|
225
|
+
children: null
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
item: {
|
|
231
|
+
id: 'system',
|
|
232
|
+
label: "System Settings",
|
|
233
|
+
route: "/admin/system"
|
|
234
|
+
},
|
|
235
|
+
expand: false,
|
|
236
|
+
children: null
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
item: {
|
|
242
|
+
id: 'reports',
|
|
243
|
+
label: "Reports",
|
|
244
|
+
icon: "📈",
|
|
245
|
+
route: "/reports"
|
|
246
|
+
},
|
|
247
|
+
expand: false,
|
|
248
|
+
children: [
|
|
249
|
+
{
|
|
250
|
+
item: {
|
|
251
|
+
id: 'sales_reports',
|
|
252
|
+
label: "Sales Reports",
|
|
253
|
+
route: "/reports/sales"
|
|
254
|
+
},
|
|
255
|
+
expand: false,
|
|
256
|
+
children: null
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
item: {
|
|
260
|
+
id: 'user_reports',
|
|
261
|
+
label: "User Reports",
|
|
262
|
+
route: "/reports/users"
|
|
263
|
+
},
|
|
264
|
+
expand: false,
|
|
265
|
+
children: null
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
const formatMenuText = (item) => {
|
|
272
|
+
return `${item.icon || '📄'} ${item.label}`;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const handleNavigation = (menuNode) => {
|
|
276
|
+
const item = menuNode.item;
|
|
277
|
+
|
|
278
|
+
if (item.route) {
|
|
279
|
+
console.log(`Navigating to: ${item.route}`);
|
|
280
|
+
// Handle actual navigation here
|
|
281
|
+
} else {
|
|
282
|
+
console.log(`Menu section: ${item.label}`);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<div class="app-navigation">
|
|
288
|
+
<h3>Application Menu</h3>
|
|
289
|
+
<NavigatorMenu
|
|
290
|
+
menuItems={appNavigation}
|
|
291
|
+
textField={formatMenuText}
|
|
292
|
+
onItemClick={handleNavigation}
|
|
293
|
+
style="background: #f8f9fa; border-radius: 8px; padding: 10px;"
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### File System Explorer Menu
|
|
299
|
+
|
|
300
|
+
```svelte
|
|
301
|
+
<script>
|
|
302
|
+
import { NavigatorMenu } from '@ticatec/uniface-element/NavigatorMenu';
|
|
303
|
+
|
|
304
|
+
let fileSystemMenu = [
|
|
305
|
+
{
|
|
306
|
+
item: {
|
|
307
|
+
name: "Documents",
|
|
308
|
+
type: "folder",
|
|
309
|
+
path: "/documents",
|
|
310
|
+
size: null
|
|
311
|
+
},
|
|
312
|
+
expand: true,
|
|
313
|
+
children: [
|
|
314
|
+
{
|
|
315
|
+
item: {
|
|
316
|
+
name: "Projects",
|
|
317
|
+
type: "folder",
|
|
318
|
+
path: "/documents/projects"
|
|
319
|
+
},
|
|
320
|
+
expand: false,
|
|
321
|
+
children: [
|
|
322
|
+
{
|
|
323
|
+
item: {
|
|
324
|
+
name: "webapp",
|
|
325
|
+
type: "folder",
|
|
326
|
+
path: "/documents/projects/webapp"
|
|
327
|
+
},
|
|
328
|
+
expand: false,
|
|
329
|
+
children: [
|
|
330
|
+
{
|
|
331
|
+
item: {
|
|
332
|
+
name: "src",
|
|
333
|
+
type: "folder",
|
|
334
|
+
path: "/documents/projects/webapp/src"
|
|
335
|
+
},
|
|
336
|
+
expand: false,
|
|
337
|
+
children: null
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
item: {
|
|
341
|
+
name: "package.json",
|
|
342
|
+
type: "file",
|
|
343
|
+
path: "/documents/projects/webapp/package.json",
|
|
344
|
+
size: "2.1 KB"
|
|
345
|
+
},
|
|
346
|
+
expand: false,
|
|
347
|
+
children: null
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
item: {
|
|
355
|
+
name: "resume.pdf",
|
|
356
|
+
type: "file",
|
|
357
|
+
path: "/documents/resume.pdf",
|
|
358
|
+
size: "145 KB"
|
|
359
|
+
},
|
|
360
|
+
expand: false,
|
|
361
|
+
children: null
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
item: {
|
|
367
|
+
name: "Downloads",
|
|
368
|
+
type: "folder",
|
|
369
|
+
path: "/downloads"
|
|
370
|
+
},
|
|
371
|
+
expand: false,
|
|
372
|
+
children: [
|
|
373
|
+
{
|
|
374
|
+
item: {
|
|
375
|
+
name: "installer.exe",
|
|
376
|
+
type: "file",
|
|
377
|
+
path: "/downloads/installer.exe",
|
|
378
|
+
size: "12.3 MB"
|
|
379
|
+
},
|
|
380
|
+
expand: false,
|
|
381
|
+
children: null
|
|
382
|
+
}
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
];
|
|
386
|
+
|
|
387
|
+
const getFileDisplayText = (item) => {
|
|
388
|
+
const icon = item.type === 'folder' ? '📁' : '📄';
|
|
389
|
+
const sizeText = item.size ? ` (${item.size})` : '';
|
|
390
|
+
return `${icon} ${item.name}${sizeText}`;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const handleFileClick = (menuNode) => {
|
|
394
|
+
const file = menuNode.item;
|
|
395
|
+
|
|
396
|
+
if (file.type === 'file') {
|
|
397
|
+
console.log(`Opening file: ${file.path}`);
|
|
398
|
+
} else {
|
|
399
|
+
console.log(`Accessing folder: ${file.path}`);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
</script>
|
|
403
|
+
|
|
404
|
+
<div class="file-explorer">
|
|
405
|
+
<h3>File Explorer</h3>
|
|
406
|
+
<NavigatorMenu
|
|
407
|
+
menuItems={fileSystemMenu}
|
|
408
|
+
textField={getFileDisplayText}
|
|
409
|
+
onItemClick={handleFileClick}
|
|
410
|
+
style="font-family: 'Courier New', monospace; border: 1px solid #ccc; max-height: 400px; overflow-y: auto;"
|
|
411
|
+
/>
|
|
412
|
+
</div>
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Dynamic Menu with State Management
|
|
416
|
+
|
|
417
|
+
```svelte
|
|
418
|
+
<script>
|
|
419
|
+
import { NavigatorMenu } from '@ticatec/uniface-element/NavigatorMenu';
|
|
420
|
+
|
|
421
|
+
let dynamicMenu = [
|
|
422
|
+
{
|
|
423
|
+
item: { id: 1, title: "Main Section", active: false },
|
|
424
|
+
expand: false,
|
|
425
|
+
children: [
|
|
426
|
+
{
|
|
427
|
+
item: { id: 11, title: "Subsection A", active: false },
|
|
428
|
+
expand: false,
|
|
429
|
+
children: null
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
item: { id: 12, title: "Subsection B", active: true },
|
|
433
|
+
expand: false,
|
|
434
|
+
children: null
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
item: { id: 2, title: "Secondary Section", active: false },
|
|
440
|
+
expand: false,
|
|
441
|
+
children: null
|
|
442
|
+
}
|
|
443
|
+
];
|
|
444
|
+
|
|
445
|
+
let activeItemId = 12;
|
|
446
|
+
|
|
447
|
+
const getMenuText = (item) => {
|
|
448
|
+
const activeIndicator = item.id === activeItemId ? '▶ ' : '';
|
|
449
|
+
return `${activeIndicator}${item.title}`;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const handleMenuSelection = (menuNode) => {
|
|
453
|
+
const item = menuNode.item;
|
|
454
|
+
|
|
455
|
+
// Update active state
|
|
456
|
+
activeItemId = item.id;
|
|
457
|
+
console.log(`Selected: ${item.title} (ID: ${item.id})`);
|
|
458
|
+
|
|
459
|
+
// Force menu refresh by triggering reactivity
|
|
460
|
+
dynamicMenu = [...dynamicMenu];
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
const addMenuItem = () => {
|
|
464
|
+
const newId = Date.now();
|
|
465
|
+
dynamicMenu[0].children.push({
|
|
466
|
+
item: { id: newId, title: `New Item ${newId}`, active: false },
|
|
467
|
+
expand: false,
|
|
468
|
+
children: null
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
dynamicMenu = [...dynamicMenu]; // Trigger reactivity
|
|
472
|
+
};
|
|
473
|
+
</script>
|
|
474
|
+
|
|
475
|
+
<div class="dynamic-menu">
|
|
476
|
+
<NavigatorMenu
|
|
477
|
+
menuItems={dynamicMenu}
|
|
478
|
+
textField={getMenuText}
|
|
479
|
+
onItemClick={handleMenuSelection}
|
|
480
|
+
style="border: 2px solid #007acc; border-radius: 6px; padding: 8px;"
|
|
481
|
+
/>
|
|
482
|
+
|
|
483
|
+
<button on:click={addMenuItem} style="margin-top: 10px;">
|
|
484
|
+
Add New Menu Item
|
|
485
|
+
</button>
|
|
486
|
+
</div>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
## Best Practices
|
|
490
|
+
|
|
491
|
+
1. **Clear Hierarchy**: Design menu structure that reflects your application's organization
|
|
492
|
+
2. **Appropriate Nesting**: Avoid too many nested levels (3-4 levels maximum)
|
|
493
|
+
3. **Consistent Text**: Use consistent naming conventions across menu items
|
|
494
|
+
4. **Performance**: Consider lazy loading for very large menu structures
|
|
495
|
+
5. **State Management**: Keep track of expanded/collapsed states appropriately
|
|
496
|
+
6. **Accessibility**: Ensure keyboard navigation support for menu items
|
|
497
|
+
7. **Visual Feedback**: Provide clear indicators for expandable items and current selection
|
|
498
|
+
|
|
499
|
+
## Styling Notes
|
|
500
|
+
|
|
501
|
+
- The component uses `<ul>` and `<li>` elements for semantic menu structure
|
|
502
|
+
- Expandable items have distinct styling classes
|
|
503
|
+
- Slide transitions provide smooth expand/collapse animations
|
|
504
|
+
- Custom CSS can be applied via the `style` prop
|
|
505
|
+
|
|
506
|
+
## Integration Tips
|
|
507
|
+
|
|
508
|
+
- Use with routing libraries for navigation handling
|
|
509
|
+
- Consider state persistence for menu expansion states
|
|
510
|
+
- Implement search/filter functionality for large menus
|
|
511
|
+
- Add keyboard shortcuts for common menu actions
|
|
512
|
+
- Test with various data structures to ensure flexibility
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# ProgressBar Component
|
|
2
|
+
|
|
3
|
+
The ProgressBar component provides visual progress indication with support for both circular and linear display modes, along with various status states.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multiple Display Types**: Circular and linear progress bars
|
|
8
|
+
- **Status Indicators**: Success, failure, canceled, and progressing states
|
|
9
|
+
- **Customizable Appearance**: Configurable size, colors, and text display
|
|
10
|
+
- **Visual Feedback**: Icons and color coding for different states
|
|
11
|
+
- **CSS Custom Properties**: Theme support through CSS variables
|
|
12
|
+
|
|
13
|
+
## Import
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { ProgressBar, ProgressStatus } from '@ticatec/uniface-element/ProgressBar';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Basic Usage
|
|
20
|
+
|
|
21
|
+
### Circular Progress Bar
|
|
22
|
+
|
|
23
|
+
```svelte
|
|
24
|
+
<script>
|
|
25
|
+
import { ProgressBar, ProgressStatus } from '@ticatec/uniface-element/ProgressBar';
|
|
26
|
+
|
|
27
|
+
let progress = 65;
|
|
28
|
+
let status = ProgressStatus.progressing;
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ProgressBar
|
|
32
|
+
{progress}
|
|
33
|
+
{status}
|
|
34
|
+
type="circular"
|
|
35
|
+
size={120}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Linear Progress Bar
|
|
40
|
+
|
|
41
|
+
```svelte
|
|
42
|
+
<script>
|
|
43
|
+
import { ProgressBar, ProgressStatus } from '@ticatec/uniface-element/ProgressBar';
|
|
44
|
+
|
|
45
|
+
let progress = 45;
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<ProgressBar
|
|
49
|
+
{progress}
|
|
50
|
+
type="liner"
|
|
51
|
+
height={8}
|
|
52
|
+
showText={true}
|
|
53
|
+
/>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API Reference
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
|
|
60
|
+
| Property | Type | Default | Description |
|
|
61
|
+
|----------|------|---------|-------------|
|
|
62
|
+
| `progress` | `number` | `0` | Progress value (0-100) |
|
|
63
|
+
| `size` | `number` | `100` | Size of circular progress bar |
|
|
64
|
+
| `type` | `'circular' \| 'liner'` | `'circular'` | Progress bar type |
|
|
65
|
+
| `height` | `number` | `5` | Height/thickness of progress bar |
|
|
66
|
+
| `showText` | `boolean` | `true` | Whether to show progress text |
|
|
67
|
+
| `status` | `ProgressStatus` | `ProgressStatus.progressing` | Progress status |
|
|
68
|
+
|
|
69
|
+
### ProgressStatus Enum
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
enum ProgressStatus {
|
|
73
|
+
progressing = 'progressing',
|
|
74
|
+
successful = 'successful',
|
|
75
|
+
failure = 'failure',
|
|
76
|
+
canceled = 'canceled'
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Status Examples
|
|
81
|
+
|
|
82
|
+
### Success State
|
|
83
|
+
|
|
84
|
+
```svelte
|
|
85
|
+
<ProgressBar
|
|
86
|
+
progress={100}
|
|
87
|
+
status={ProgressStatus.successful}
|
|
88
|
+
type="circular"
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Failure State
|
|
93
|
+
|
|
94
|
+
```svelte
|
|
95
|
+
<ProgressBar
|
|
96
|
+
progress={50}
|
|
97
|
+
status={ProgressStatus.failure}
|
|
98
|
+
type="liner"
|
|
99
|
+
/>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Canceled State
|
|
103
|
+
|
|
104
|
+
```svelte
|
|
105
|
+
<ProgressBar
|
|
106
|
+
progress={30}
|
|
107
|
+
status={ProgressStatus.canceled}
|
|
108
|
+
type="circular"
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Styling
|
|
113
|
+
|
|
114
|
+
The component uses CSS custom properties for theming:
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
:root {
|
|
118
|
+
--uniface-progress-bar-color: #22BDFF;
|
|
119
|
+
--uniface-progress-bar-success-color: #2DC071;
|
|
120
|
+
--uniface-progress-bar-failure-color: #FF685B;
|
|
121
|
+
--uniface-progress-bar-canceled-color: #FFC533;
|
|
122
|
+
--uniface-progress-bar-bg: #E2E8F0;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Advanced Examples
|
|
127
|
+
|
|
128
|
+
### Dynamic Progress with Status Updates
|
|
129
|
+
|
|
130
|
+
```svelte
|
|
131
|
+
<script>
|
|
132
|
+
import { ProgressBar, ProgressStatus } from '@ticatec/uniface-element/ProgressBar';
|
|
133
|
+
|
|
134
|
+
let progress = 0;
|
|
135
|
+
let status = ProgressStatus.progressing;
|
|
136
|
+
|
|
137
|
+
const simulate = () => {
|
|
138
|
+
const timer = setInterval(() => {
|
|
139
|
+
progress += 10;
|
|
140
|
+
if (progress >= 100) {
|
|
141
|
+
clearInterval(timer);
|
|
142
|
+
status = ProgressStatus.successful;
|
|
143
|
+
}
|
|
144
|
+
}, 500);
|
|
145
|
+
};
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<ProgressBar {progress} {status} type="circular" size={100} />
|
|
149
|
+
<button on:click={simulate}>Start Progress</button>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Upload Progress Indicator
|
|
153
|
+
|
|
154
|
+
```svelte
|
|
155
|
+
<script>
|
|
156
|
+
import { ProgressBar, ProgressStatus } from '@ticatec/uniface-element/ProgressBar';
|
|
157
|
+
|
|
158
|
+
let uploadProgress = 0;
|
|
159
|
+
let uploadStatus = ProgressStatus.progressing;
|
|
160
|
+
|
|
161
|
+
const handleUpload = async (file) => {
|
|
162
|
+
uploadStatus = ProgressStatus.progressing;
|
|
163
|
+
|
|
164
|
+
// Simulate upload progress
|
|
165
|
+
for (let i = 0; i <= 100; i += 10) {
|
|
166
|
+
uploadProgress = i;
|
|
167
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
uploadStatus = ProgressStatus.successful;
|
|
171
|
+
};
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<div class="upload-container">
|
|
175
|
+
<ProgressBar
|
|
176
|
+
progress={uploadProgress}
|
|
177
|
+
status={uploadStatus}
|
|
178
|
+
type="liner"
|
|
179
|
+
height={6}
|
|
180
|
+
/>
|
|
181
|
+
<input type="file" on:change={handleUpload} />
|
|
182
|
+
</div>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Best Practices
|
|
186
|
+
|
|
187
|
+
1. **Choose Appropriate Type**: Use circular for compact spaces, linear for wide layouts
|
|
188
|
+
2. **Status Indication**: Always update status to reflect the actual state of the operation
|
|
189
|
+
3. **User Feedback**: Provide clear text or visual cues about what's happening
|
|
190
|
+
4. **Accessibility**: Ensure adequate color contrast and consider screen readers
|
|
191
|
+
5. **Performance**: Avoid excessive progress updates; throttle to reasonable intervals
|
|
192
|
+
6. **Error Handling**: Use failure status and provide retry mechanisms when appropriate
|
|
193
|
+
|
|
194
|
+
## Accessibility Notes
|
|
195
|
+
|
|
196
|
+
- Progress bars convey completion status through visual indicators
|
|
197
|
+
- Status-specific icons (✔, ✗, !) provide additional context
|
|
198
|
+
- Color coding supports different progress states
|
|
199
|
+
- Text display can be toggled for different accessibility needs
|