@ticatec/uniface-element 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +273 -1
- package/README_CN.md +341 -0
- package/dist/common/MouseClickHandler.d.ts +1 -1
- package/dist/dialog/CommonDialog.svelte +6 -3
- package/dist/dialog/CommonDialog.svelte.d.ts +2 -1
- package/dist/dialog/Dialog.svelte +36 -10
- 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/dialog/DialogWrapper.svelte.d.ts +22 -0
- package/dist/dialog/Dialogs.js +1 -1
- package/dist/dialog/ModalResult.d.ts +5 -0
- package/dist/dialog/ModalResult.js +5 -0
- 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 +38 -5
package/README.md
CHANGED
|
@@ -1,4 +1,276 @@
|
|
|
1
1
|
# Uniface Element
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/%40ticatec%2Funiface-element)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
|
|
6
|
+
A comprehensive enterprise-grade UI component library built with Svelte 5, designed for modern web applications.
|
|
7
|
+
|
|
8
|
+
[中文文档](./README_CN.md)
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
✨ **Enterprise-Grade Components** - Complete set of components for business applications
|
|
13
|
+
🎨 **Theme System** - CSS variables-based theming with customizable design tokens
|
|
14
|
+
📱 **Responsive Design** - Mobile-first responsive components
|
|
15
|
+
🌍 **Internationalization** - Built-in i18n support with English and Chinese resources
|
|
16
|
+
🎯 **TypeScript Support** - Full TypeScript definitions for better development experience
|
|
17
|
+
🔧 **Modular Architecture** - Tree-shakable imports for optimal bundle size
|
|
18
|
+
⚡ **High Performance** - Built with Svelte 5 for maximum performance
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @ticatec/uniface-element
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### 1. Import Styles
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// Import the main CSS file
|
|
32
|
+
import '@ticatec/uniface-element/ticatec-uniface-web.css';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Use Components
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import Button, DataTable, Dialog from '@ticatec/uniface-element/Button, DataTable, Dialog';
|
|
40
|
+
import type { DataColumn } from '@ticatec/uniface-element';
|
|
41
|
+
|
|
42
|
+
let columns: DataColumn[] = [
|
|
43
|
+
{ field: 'name', title: 'Name', width: 150 },
|
|
44
|
+
{ field: 'email', title: 'Email', width: 200 }
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
let data = [
|
|
48
|
+
{ name: 'John Doe', email: 'john@example.com' },
|
|
49
|
+
{ name: 'Jane Smith', email: 'jane@example.com' }
|
|
50
|
+
];
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<Button type="primary" on:click={() => console.log('Clicked!')}>
|
|
54
|
+
Click Me
|
|
55
|
+
</Button>
|
|
56
|
+
|
|
57
|
+
<DataTable {columns} list={data} />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Component Categories
|
|
61
|
+
|
|
62
|
+
### Layout Components
|
|
63
|
+
- **App Layouts**: `SidebarLayout`, `HeaderLayout`, `ClassicLayout`, `ColumnsLayout`, `RowsLayout`
|
|
64
|
+
- **Containers**: `Box`, `Card`, `Page`, `Accordion`
|
|
65
|
+
- **Form Layouts**: `FlexForm`, `GridForm`, `FormField`
|
|
66
|
+
- **Utilities**: `Split`, `Separator`
|
|
67
|
+
|
|
68
|
+
### Data Display
|
|
69
|
+
- **Tables**: `DataTable`, `ConciseDataTable`
|
|
70
|
+
- **Lists**: `ListBox`, `TreeView`
|
|
71
|
+
- **Navigation**: `Breadcrumbs`, `Tabs`, `NavigatorMenu` | [Navigation Components Docs](./docs/navigation/)
|
|
72
|
+
- **Indicators**: `ProgressBar`, `ProgressStepBar`, `Tag`
|
|
73
|
+
|
|
74
|
+
### Form Controls
|
|
75
|
+
- **Input**: `TextEditor`, `NumberEditor`, [`MemoEditor`](./docs/form-components/en/memoeditor.md), [`PasswordEditor`](./docs/form-components/en/passwordeditor.md)
|
|
76
|
+
- **Selection**: `OptionsSelect`, `OptionsMultiSelect`, `CascadeOptionsSelect`
|
|
77
|
+
- **Date/Time**: `DatePicker`, `DateTimePicker`, `TimeEditor`
|
|
78
|
+
- **Search/Filter**: [`SearchBox`, `NumberRange`, `DateRange`](./docs/search-filters/) - Advanced search and filtering components
|
|
79
|
+
- **Others**: `CheckBox`, `RadioButton`, `Switch`, `ColorPicker`
|
|
80
|
+
|
|
81
|
+
### Feedback Components
|
|
82
|
+
- **Dialogs**: `Dialog`, `MessageBox`, `Drawer`
|
|
83
|
+
- **Notifications**: `Toast`, `PopupHint`
|
|
84
|
+
- **Overlays**: `FullScreenOverlay`
|
|
85
|
+
|
|
86
|
+
### Advanced Components
|
|
87
|
+
- **Editors**: `InlineCellEditor`, `PropertyEditor`, `PromptsTextEditor`
|
|
88
|
+
- **File Upload**: `AttachmentFiles`, `ImageFiles`
|
|
89
|
+
- **Data Transfer**: `Transfer`
|
|
90
|
+
- **Search**: `SearchBox`, `CriteriaField`
|
|
91
|
+
|
|
92
|
+
## Usage Examples
|
|
93
|
+
|
|
94
|
+
### Data Table with Selection
|
|
95
|
+
|
|
96
|
+
```svelte
|
|
97
|
+
<script lang="ts">
|
|
98
|
+
import DataTable from '@ticatec/uniface-element/DataTable';
|
|
99
|
+
import type { DataColumn } from '@ticatec/uniface-element';
|
|
100
|
+
|
|
101
|
+
let columns: DataColumn[] = [
|
|
102
|
+
{
|
|
103
|
+
field: 'name',
|
|
104
|
+
title: 'Name',
|
|
105
|
+
width: 200
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
field: 'email',
|
|
109
|
+
title: 'Email',
|
|
110
|
+
width: 250
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
field: 'status',
|
|
114
|
+
title: 'Status',
|
|
115
|
+
width: 120
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
let data = [
|
|
120
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active' },
|
|
121
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
|
|
122
|
+
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', status: 'Active' }
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
let selectedRows = [];
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<DataTable {columns} list={data} bind:selectedRows />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Dialog with Form
|
|
132
|
+
|
|
133
|
+
```svelte
|
|
134
|
+
<script lang="ts">
|
|
135
|
+
import Dialog, Button, TextEditor, FormField from '@ticatec/uniface-element/Dialog, Button, TextEditor, FormField';
|
|
136
|
+
|
|
137
|
+
let showDialog = false;
|
|
138
|
+
let formData = { name: '', email: '' };
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<Button on:click={() => showDialog = true}>Open Dialog</Button>
|
|
142
|
+
|
|
143
|
+
<Dialog bind:visible={showDialog} title="Edit User">
|
|
144
|
+
<FormField label="Name">
|
|
145
|
+
<TextEditor bind:value={formData.name} />
|
|
146
|
+
</FormField>
|
|
147
|
+
|
|
148
|
+
<FormField label="Email">
|
|
149
|
+
<TextEditor bind:value={formData.email} type="email" />
|
|
150
|
+
</FormField>
|
|
151
|
+
|
|
152
|
+
<svelte:fragment slot="actions">
|
|
153
|
+
<Button on:click={() => showDialog = false}>Cancel</Button>
|
|
154
|
+
<Button type="primary" on:click={() => showDialog = false}>Save</Button>
|
|
155
|
+
</svelte:fragment>
|
|
156
|
+
</Dialog>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Theme Customization
|
|
160
|
+
|
|
161
|
+
The library uses CSS custom properties for theming. You can customize the appearance by overriding these variables:
|
|
162
|
+
|
|
163
|
+
```css
|
|
164
|
+
:root {
|
|
165
|
+
--uniface-primary-color: #0061FF;
|
|
166
|
+
--uniface-secondary-color: #22BDFF;
|
|
167
|
+
--uniface-primary-text-color: #374151;
|
|
168
|
+
--uniface-button-common-bg: #f0f0f0;
|
|
169
|
+
--uniface-hover-item-background: #f7f7f7;
|
|
170
|
+
/* ... more variables */
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Internationalization
|
|
175
|
+
|
|
176
|
+
The library includes built-in internationalization support:
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { i18n } from '@ticatec/uniface-element/i18n_resources';
|
|
180
|
+
|
|
181
|
+
// Set language
|
|
182
|
+
i18n.setLanguage('en'); // or 'zh-CN'
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Available Imports
|
|
186
|
+
|
|
187
|
+
### Modular Imports
|
|
188
|
+
```typescript
|
|
189
|
+
// Individual component imports
|
|
190
|
+
import { Button } from '@ticatec/uniface-element/Button';
|
|
191
|
+
import { DataTable } from '@ticatec/uniface-element/DataTable';
|
|
192
|
+
import { SidebarLayout } from '@ticatec/uniface-element/app-layout/SidebarLayout';
|
|
193
|
+
import { AttachmentFilesField } from '@ticatec/uniface-element/AttachmentFiles';
|
|
194
|
+
import { ImageFilesField } from '@ticatec/uniface-element/ImageFiles';
|
|
195
|
+
import { MemoEditor } from '@ticatec/uniface-element/MemoEditor';
|
|
196
|
+
|
|
197
|
+
// Utility imports
|
|
198
|
+
import { utils } from '@ticatec/uniface-element/utils';
|
|
199
|
+
import type { DataColumn } from '@ticatec/uniface-element/types';
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Barrel Imports
|
|
203
|
+
```typescript
|
|
204
|
+
// Import multiple components from main entry point
|
|
205
|
+
import Button, DataTable, Dialog, Card from '@ticatec/uniface-element/Button, DataTable, Dialog, Card';
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Install dependencies
|
|
212
|
+
npm install
|
|
213
|
+
|
|
214
|
+
# Start development server
|
|
215
|
+
npm run dev
|
|
216
|
+
|
|
217
|
+
# Build the library
|
|
218
|
+
npm run build
|
|
219
|
+
|
|
220
|
+
# Run type checking
|
|
221
|
+
npm run check
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Browser Support
|
|
225
|
+
|
|
226
|
+
- Chrome ≥ 88
|
|
227
|
+
- Firefox ≥ 85
|
|
228
|
+
- Safari ≥ 14
|
|
229
|
+
- Edge ≥ 88
|
|
230
|
+
|
|
231
|
+
## Contributing
|
|
232
|
+
|
|
233
|
+
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
|
238
|
+
|
|
239
|
+
## Author
|
|
240
|
+
|
|
241
|
+
**Henry Feng** - [Ticatec](https://github.com/ticatec-auckland)
|
|
242
|
+
|
|
243
|
+
## Documentation
|
|
244
|
+
|
|
245
|
+
Comprehensive component documentation is available in the `/docs` directory:
|
|
246
|
+
|
|
247
|
+
### Layout Components
|
|
248
|
+
- [SidebarLayout](./docs/layout/en/sidebarlayout.md) | [中文](./docs/layout/cn/sidebarlayout.md) - Left sidebar with resizable main content area
|
|
249
|
+
- [HeaderLayout](./docs/layout/en/headerlayout.md) | [中文](./docs/layout/cn/headerlayout.md) - Top header with content area and optional sidebar
|
|
250
|
+
- [ClassicLayout](./docs/layout/en/classiclayout.md) | [中文](./docs/layout/cn/classiclayout.md) - Full-screen layout with header, footer, sidebar, and content areas
|
|
251
|
+
|
|
252
|
+
### Button Components
|
|
253
|
+
- [Button System](./docs/buttons/en/README.md) | [中文](./docs/buttons/cn/README.md) - Complete button components including Button, TextButton, IconButton, and ActionBar
|
|
254
|
+
|
|
255
|
+
### Dialog Components
|
|
256
|
+
- [Dialog System](./docs/dialog/en/README.md) | [中文](./docs/dialog/cn/README.md) - Modal dialog system with DialogBoard, Dialog, and CommonDialog components
|
|
257
|
+
|
|
258
|
+
### Form Components
|
|
259
|
+
- [Form Controls](./docs/form/en/README.md) | [中文](./docs/form/cn/README.md) - Comprehensive form input components including TextEditor, NumberEditor, CheckBox, OptionsSelect, and more
|
|
260
|
+
|
|
261
|
+
### Global Components
|
|
262
|
+
- [Global Components](./docs/global/en/README.md) | [中文](./docs/global/cn/README.md) - Application-wide components including ToastBoard, DialogBoard, IndicatorBoard, and MessageBoxBoard
|
|
263
|
+
|
|
264
|
+
### Miscellaneous Components
|
|
265
|
+
- [Utility Components](./docs/misc/en/README.md) | [中文](./docs/misc/cn/README.md) - Additional components including Split, Drawer, Tag, and Card
|
|
266
|
+
|
|
267
|
+
Each component documentation includes:
|
|
268
|
+
- API reference with all props and methods
|
|
269
|
+
- Advanced usage examples and patterns
|
|
270
|
+
- Best practices and styling guides
|
|
271
|
+
- Accessibility considerations
|
|
272
|
+
- Integration tips
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
For more detailed documentation and examples, please visit our [documentation site](#) or check out the demo components in the `/src/routes/demo` directory.
|
package/README_CN.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Uniface Element
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40ticatec%2Funiface-element)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
基于 Svelte 5 构建的全面企业级 UI 组件库,专为现代化 Web 应用程序设计。
|
|
7
|
+
|
|
8
|
+
[English Documentation](./README.md)
|
|
9
|
+
|
|
10
|
+
## 特性
|
|
11
|
+
|
|
12
|
+
✨ **企业级组件** - 为商业应用提供完整的组件集合
|
|
13
|
+
🎨 **主题系统** - 基于 CSS 变量的主题化,可自定义设计令牌
|
|
14
|
+
📱 **响应式设计** - 移动优先的响应式组件
|
|
15
|
+
🌍 **国际化支持** - 内置中英文国际化资源
|
|
16
|
+
🎯 **TypeScript 支持** - 完整的 TypeScript 类型定义,提供更好的开发体验
|
|
17
|
+
🔧 **模块化架构** - 支持按需导入,优化打包体积
|
|
18
|
+
⚡ **高性能** - 基于 Svelte 5 构建,性能卓越
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @ticatec/uniface-element
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 快速开始
|
|
27
|
+
|
|
28
|
+
### 1. 导入样式
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// 导入主样式文件
|
|
32
|
+
import '@ticatec/uniface-element/ticatec-uniface-web.css';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. 使用组件
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import Button from '@ticatec/uniface-element/Button';
|
|
40
|
+
import DataTable, Dialog from '@ticatec/uniface-element/DataTable';
|
|
41
|
+
import Dialog from '@ticatec/uniface-element/Dialog';
|
|
42
|
+
import type { DataColumn } from '@ticatec/uniface-element/DataTable';
|
|
43
|
+
|
|
44
|
+
let columns: DataColumn[] = [
|
|
45
|
+
{ field: 'name', title: '姓名', width: 150 },
|
|
46
|
+
{ field: 'email', title: '邮箱', width: 200 }
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
let data = [
|
|
50
|
+
{ name: '张三', email: 'zhangsan@example.com' },
|
|
51
|
+
{ name: '李四', email: 'lisi@example.com' }
|
|
52
|
+
];
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<Button type="primary" on:click={() => console.log('点击了!')}>
|
|
56
|
+
点击我
|
|
57
|
+
</Button>
|
|
58
|
+
|
|
59
|
+
<DataTable {columns} list={data} />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 组件分类
|
|
63
|
+
|
|
64
|
+
### 布局组件
|
|
65
|
+
- **应用布局**: `SidebarLayout`、`HeaderLayout`、`ClassicLayout`、`ColumnsLayout`、`RowsLayout`
|
|
66
|
+
- **容器组件**: `Box`、`Card`、`Page`、`Accordion`
|
|
67
|
+
- **表单布局**: `FlexForm`、`GridForm`、`FormField`
|
|
68
|
+
- **工具组件**: `Split`、`Separator`
|
|
69
|
+
|
|
70
|
+
### 数据展示
|
|
71
|
+
- **表格组件**: `DataTable`、`ConciseDataTable`
|
|
72
|
+
- **列表组件**: `ListBox`、`TreeView`
|
|
73
|
+
- **导航组件**: `Breadcrumbs`、`Tabs`、`NavigatorMenu`
|
|
74
|
+
- **指示器**: `ProgressBar`、`ProgressStepBar`、`Tag`
|
|
75
|
+
|
|
76
|
+
### 表单控件
|
|
77
|
+
- **输入组件**: `TextEditor`、`NumberEditor`、`MemoEditor`、`PasswordEditor`
|
|
78
|
+
- **选择组件**: `OptionsSelect`、`OptionsMultiSelect`、`CascadeOptionsSelect`
|
|
79
|
+
- **日期时间**: `DatePicker`、`DateTimePicker`、`TimeEditor`
|
|
80
|
+
- **其他控件**: `CheckBox`、`RadioButton`、`Switch`、`ColorPicker`
|
|
81
|
+
|
|
82
|
+
### 反馈组件
|
|
83
|
+
- **对话框**: `Dialog`、`MessageBox`、`Drawer`
|
|
84
|
+
- **消息通知**: `Toast`、`PopupHint`
|
|
85
|
+
- **遮罩层**: `FullScreenOverlay`
|
|
86
|
+
|
|
87
|
+
### 高级组件
|
|
88
|
+
- **编辑器**: `InlineCellEditor`、`PropertyEditor`、`PromptsTextEditor`
|
|
89
|
+
- **文件上传**: `AttachmentFiles`、`ImageFiles`
|
|
90
|
+
- **数据传输**: `Transfer`
|
|
91
|
+
- **搜索组件**: `SearchBox`、`CriteriaField`
|
|
92
|
+
|
|
93
|
+
## 页面全局组件
|
|
94
|
+
|
|
95
|
+
页面全局组件直接加载在 body 上,使用时不需要单独引入,可通过全局方法直接使用。通常在系统主页面直接加载:
|
|
96
|
+
|
|
97
|
+
```svelte
|
|
98
|
+
<script lang="ts">
|
|
99
|
+
import ToastBoard from "@ticatec/uniface-element/ToastBoard";
|
|
100
|
+
import { DialogBoard } from "@ticatec/uniface-element/DialogBoard";
|
|
101
|
+
import IndicatorBoard from "@ticatec/uniface-element/IndicatorBoard";
|
|
102
|
+
import MessageBoxBoard from "@ticatec/uniface-element/MessageBoxBoard";
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<div>
|
|
106
|
+
<!-- 主页面内容 -->
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<IndicatorBoard/>
|
|
110
|
+
<DialogBoard/>
|
|
111
|
+
<ToastBoard/>
|
|
112
|
+
<MessageBoxBoard/>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 异步操作指示器 `Indicator`
|
|
116
|
+
|
|
117
|
+
用于异步操作时遮罩页面并显示操作信息,避免用户异常操作:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
try {
|
|
121
|
+
window.Indicator.show('正在加载数据...');
|
|
122
|
+
// 异步调用 await service.search();
|
|
123
|
+
} finally {
|
|
124
|
+
window.Indicator.hide();
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 弹出消息 `Toast`
|
|
129
|
+
|
|
130
|
+
用于显示操作结果和提示信息:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// 显示错误消息(默认3秒)
|
|
134
|
+
window.Toast.show("无法删除活跃用户", "error", 2);
|
|
135
|
+
|
|
136
|
+
// 显示成功消息
|
|
137
|
+
window.Toast.show("操作成功", "success");
|
|
138
|
+
|
|
139
|
+
// 显示信息提示
|
|
140
|
+
window.Toast.show("这是一条信息", "info");
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 消息提示框 `MessageBox`
|
|
144
|
+
|
|
145
|
+
用于确认操作和信息提示:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import ModalResult from '@ticatec/uniface-element/ModalResult';
|
|
149
|
+
|
|
150
|
+
const deleteConfirm = async (user: any) => {
|
|
151
|
+
const result = await window.MessageBox.showConfirm(`确定要删除用户[${user.name}]吗?`);
|
|
152
|
+
if (result === ModalResult.MR_OK) {
|
|
153
|
+
// 执行删除操作
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 显示信息提示
|
|
158
|
+
await window.MessageBox.showInfo("操作完成", "提示");
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 使用示例
|
|
162
|
+
|
|
163
|
+
### 带行选择的数据表格
|
|
164
|
+
|
|
165
|
+
```svelte
|
|
166
|
+
<script lang="ts">
|
|
167
|
+
import DataTable from '@ticatec/uniface-element/DataTable';
|
|
168
|
+
import type { DataColumn } from '@ticatec/uniface-element';
|
|
169
|
+
|
|
170
|
+
let columns: DataColumn[] = [
|
|
171
|
+
{
|
|
172
|
+
field: 'name',
|
|
173
|
+
title: '姓名',
|
|
174
|
+
width: 200
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
field: 'email',
|
|
178
|
+
title: '邮箱',
|
|
179
|
+
width: 250
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
field: 'status',
|
|
183
|
+
title: '状态',
|
|
184
|
+
width: 120
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
let data = [
|
|
189
|
+
{ id: 1, name: '张三', email: 'zhangsan@example.com', status: '活跃' },
|
|
190
|
+
{ id: 2, name: '李四', email: 'lisi@example.com', status: '非活跃' },
|
|
191
|
+
{ id: 3, name: '王五', email: 'wangwu@example.com', status: '活跃' }
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
let selectedRows = [];
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<DataTable {columns} list={data} bind:selectedRows />
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 表单对话框
|
|
201
|
+
|
|
202
|
+
```svelte
|
|
203
|
+
<script lang="ts">
|
|
204
|
+
import Dialog, Button, TextEditor, FormField from '@ticatec/uniface-element/Dialog, Button, TextEditor, FormField';
|
|
205
|
+
|
|
206
|
+
let showDialog = false;
|
|
207
|
+
let formData = { name: '', email: '' };
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<Button on:click={() => showDialog = true}>打开对话框</Button>
|
|
211
|
+
|
|
212
|
+
<Dialog bind:visible={showDialog} title="编辑用户">
|
|
213
|
+
<FormField label="姓名">
|
|
214
|
+
<TextEditor bind:value={formData.name} />
|
|
215
|
+
</FormField>
|
|
216
|
+
|
|
217
|
+
<FormField label="邮箱">
|
|
218
|
+
<TextEditor bind:value={formData.email} type="email" />
|
|
219
|
+
</FormField>
|
|
220
|
+
|
|
221
|
+
<svelte:fragment slot="actions">
|
|
222
|
+
<Button on:click={() => showDialog = false}>取消</Button>
|
|
223
|
+
<Button type="primary" on:click={() => showDialog = false}>保存</Button>
|
|
224
|
+
</svelte:fragment>
|
|
225
|
+
</Dialog>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 布局组件详细介绍
|
|
229
|
+
|
|
230
|
+
## 文档
|
|
231
|
+
|
|
232
|
+
`/docs` 目录中提供了全面的组件文档:
|
|
233
|
+
|
|
234
|
+
### 布局组件
|
|
235
|
+
- [SidebarLayout](./docs/layout/cn/sidebarlayout.md) | [English](./docs/layout/en/sidebarlayout.md) - 左侧边栏与可调整大小的主内容区域
|
|
236
|
+
- [HeaderLayout](./docs/layout/cn/headerlayout.md) | [English](./docs/layout/en/headerlayout.md) - 顶部头部与内容区域及可选侧边栏
|
|
237
|
+
- [ClassicLayout](./docs/layout/cn/classiclayout.md) | [English](./docs/layout/en/classiclayout.md) - 全屏布局,包含头部、底部、侧边栏和内容区域
|
|
238
|
+
|
|
239
|
+
### 按钮组件
|
|
240
|
+
- [按钮系统](./docs/buttons/cn/README.md) | [English](./docs/buttons/en/README.md) - 完整的按钮组件,包括 Button、TextButton、IconButton 和 ActionBar
|
|
241
|
+
|
|
242
|
+
### 对话框组件
|
|
243
|
+
- [对话框系统](./docs/dialog/cn/README.md) | [English](./docs/dialog/en/README.md) - 模态对话框系统,包含 DialogBoard、Dialog 和 CommonDialog 组件
|
|
244
|
+
|
|
245
|
+
### 表单组件
|
|
246
|
+
- [表单控件](./docs/form/cn/README.md) | [English](./docs/form/en/README.md) - 全面的表单输入组件,包括 TextEditor、NumberEditor、CheckBox、OptionsSelect 等
|
|
247
|
+
|
|
248
|
+
### 全局组件
|
|
249
|
+
- [全局组件](./docs/global/cn/README.md) | [English](./docs/global/en/README.md) - 应用程序级组件,包括 ToastBoard、DialogBoard、IndicatorBoard 和 MessageBoxBoard
|
|
250
|
+
|
|
251
|
+
### 杂项组件
|
|
252
|
+
- [实用组件](./docs/misc/cn/README.md) | [English](./docs/misc/en/README.md) - 其他组件,包括 Split、Drawer、Tag 和 Card
|
|
253
|
+
|
|
254
|
+
每个组件文档都包括:
|
|
255
|
+
- 包含所有属性和方法的 API 参考
|
|
256
|
+
- 高级用法示例和模式
|
|
257
|
+
- 最佳实践和样式指南
|
|
258
|
+
- 无障碍访问注意事项
|
|
259
|
+
- 集成提示
|
|
260
|
+
|
|
261
|
+
## 主题定制
|
|
262
|
+
|
|
263
|
+
组件库使用 CSS 自定义属性进行主题化。你可以通过覆盖这些变量来自定义外观:
|
|
264
|
+
|
|
265
|
+
```css
|
|
266
|
+
:root {
|
|
267
|
+
--uniface-primary-color: #0061FF;
|
|
268
|
+
--uniface-secondary-color: #22BDFF;
|
|
269
|
+
--uniface-primary-text-color: #374151;
|
|
270
|
+
--uniface-button-common-bg: #f0f0f0;
|
|
271
|
+
--uniface-hover-item-background: #f7f7f7;
|
|
272
|
+
/* ... 更多变量 */
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## 国际化
|
|
277
|
+
|
|
278
|
+
组件库内置国际化支持:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import { i18n } from '@ticatec/uniface-element/i18n_resources';
|
|
282
|
+
|
|
283
|
+
// 设置语言
|
|
284
|
+
i18n.setLanguage('zh-CN'); // 或 'en'
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## 可用导入
|
|
288
|
+
|
|
289
|
+
### 模块化导入
|
|
290
|
+
```typescript
|
|
291
|
+
// 单个组件导入
|
|
292
|
+
import Button from '@ticatec/uniface-element/Button';
|
|
293
|
+
import DataTable from '@ticatec/uniface-element/DataTable';
|
|
294
|
+
import SidebarLayout from '@ticatec/uniface-element/app-layout/SidebarLayout';
|
|
295
|
+
import AttachmentFilesField from '@ticatec/uniface-element/AttachmentFiles';
|
|
296
|
+
import ImageFilesField from '@ticatec/uniface-element/ImageFiles';
|
|
297
|
+
import MemoEditor from '@ticatec/uniface-element/MemoEditor';
|
|
298
|
+
|
|
299
|
+
// 工具导入
|
|
300
|
+
import { utils } from '@ticatec/uniface-element/utils';
|
|
301
|
+
import type { DataColumn } from '@ticatec/uniface-element/types';
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## 开发
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# 安装依赖
|
|
308
|
+
npm install
|
|
309
|
+
|
|
310
|
+
# 启动开发服务器
|
|
311
|
+
npm run dev
|
|
312
|
+
|
|
313
|
+
# 构建组件库
|
|
314
|
+
npm run build
|
|
315
|
+
|
|
316
|
+
# 运行类型检查
|
|
317
|
+
npm run check
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## 浏览器支持
|
|
321
|
+
|
|
322
|
+
- Chrome ≥ 88
|
|
323
|
+
- Firefox ≥ 85
|
|
324
|
+
- Safari ≥ 14
|
|
325
|
+
- Edge ≥ 88
|
|
326
|
+
|
|
327
|
+
## 贡献
|
|
328
|
+
|
|
329
|
+
欢迎贡献代码!请查看我们的 [贡献指南](./CONTRIBUTING.md) 了解详细信息。
|
|
330
|
+
|
|
331
|
+
## 许可证
|
|
332
|
+
|
|
333
|
+
MIT 许可证 - 查看 [LICENSE](./LICENSE) 文件了解详细信息。
|
|
334
|
+
|
|
335
|
+
## 作者
|
|
336
|
+
|
|
337
|
+
**Henry Feng** - [Ticatec](https://github.com/ticatec-auckland)
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
更多详细文档和示例,请访问我们的 [文档网站](#) 或查看 `/src/routes/demo` 目录中的示例组件。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type MouseClickHandler = (event: MouseEvent) => void
|
|
1
|
+
export type MouseClickHandler = (event: MouseEvent) => Promise<void>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type {ButtonAction, ButtonActions} from "../action-bar";
|
|
5
5
|
import i18n from "@ticatec/i18n";
|
|
6
6
|
import type {DialogCloseConfirm} from "./DialogCloseConfirm";
|
|
7
|
+
import {ModalResult, type OnClose} from "./ModalResult";
|
|
7
8
|
|
|
8
9
|
export let title: string;
|
|
9
10
|
export let width: string = 'unset';
|
|
@@ -11,10 +12,12 @@
|
|
|
11
12
|
|
|
12
13
|
export let closeConfirm: DialogCloseConfirm | null = null;
|
|
13
14
|
export let content$style: string = '';
|
|
14
|
-
export let closeHandler: () => void;
|
|
15
15
|
export let enableConfirm: boolean = true;
|
|
16
16
|
export let confirmHandler: (()=>Promise<any>) | null = null;
|
|
17
17
|
export let confirmText: string | null = null;
|
|
18
|
+
export let onClose: OnClose | null = null;
|
|
19
|
+
|
|
20
|
+
let dialog: any;
|
|
18
21
|
|
|
19
22
|
let confirmAction: ButtonAction = {
|
|
20
23
|
label: confirmText??i18n.getText('uniface.btnConfirm', 'OK'),
|
|
@@ -23,7 +26,7 @@
|
|
|
23
26
|
handler: async ()=> {
|
|
24
27
|
let result = await confirmHandler?.();
|
|
25
28
|
if (result && result==true) { //返回true自动关闭
|
|
26
|
-
|
|
29
|
+
dialog.close(ModalResult.Ok);
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
}
|
|
@@ -38,6 +41,6 @@
|
|
|
38
41
|
|
|
39
42
|
</script>
|
|
40
43
|
|
|
41
|
-
<Dialog {title} {content$style} {width} {height} {
|
|
44
|
+
<Dialog bind:this={dialog} {title} {content$style} {width} {height} {actions} {closeConfirm} {onClose}>
|
|
42
45
|
<slot></slot>
|
|
43
46
|
</Dialog>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DialogCloseConfirm } from "./DialogCloseConfirm";
|
|
2
|
+
import { type OnClose } from "./ModalResult";
|
|
2
3
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
4
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
5
|
$$bindings?: Bindings;
|
|
@@ -23,10 +24,10 @@ declare const CommonDialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_Pr
|
|
|
23
24
|
height?: string;
|
|
24
25
|
closeConfirm?: DialogCloseConfirm | null;
|
|
25
26
|
content$style?: string;
|
|
26
|
-
closeHandler: () => void;
|
|
27
27
|
enableConfirm?: boolean;
|
|
28
28
|
confirmHandler?: (() => Promise<any>) | null;
|
|
29
29
|
confirmText?: string | null;
|
|
30
|
+
onClose?: OnClose | null;
|
|
30
31
|
}, {
|
|
31
32
|
default: {};
|
|
32
33
|
}>, {
|