@ticatec/uniface-element 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/README.md +169 -0
- package/dist/accordion/README_CN.md +176 -0
- package/dist/action-bar/README.md +275 -0
- package/dist/action-bar/README_CN.md +285 -0
- package/dist/app-layout/README.md +374 -0
- package/dist/app-layout/README_CN.md +381 -0
- package/dist/app-top-bar/README.md +357 -0
- package/dist/app-top-bar/README_CN.md +365 -0
- package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
- package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
- package/dist/base-calendar/CalendarBase.svelte +0 -3
- package/dist/box/README.md +385 -0
- package/dist/box/README_CN.md +393 -0
- package/dist/breadcrumbs/README.md +442 -0
- package/dist/breadcrumbs/README_CN.md +442 -0
- package/dist/button/Button.svelte +27 -7
- package/dist/button/Button.svelte.d.ts +3 -1
- package/dist/button/IconButton.svelte +26 -6
- package/dist/button/IconButton.svelte.d.ts +3 -1
- package/dist/button/IconButton_README.md +513 -0
- package/dist/button/IconButton_README_CN.md +513 -0
- package/dist/button/README.md +428 -0
- package/dist/button/README_CN.md +428 -0
- package/dist/button/TextButton.svelte +26 -6
- package/dist/button/TextButton.svelte.d.ts +3 -1
- package/dist/button/TextButton_README.md +571 -0
- package/dist/button/TextButton_README_CN.md +571 -0
- package/dist/card/README.md +666 -0
- package/dist/card/README_CN.md +666 -0
- package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
- package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
- package/dist/cascade-options-select/README.md +663 -2
- package/dist/cascade-options-select/README_CN.md +664 -0
- package/dist/checkbox/CheckBox.svelte +20 -6
- package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
- package/dist/checkbox/README.md +562 -0
- package/dist/checkbox/README_CN.md +727 -0
- package/dist/common-editor/NumberInput.svelte +39 -26
- package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
- package/dist/concise-data-table/ConciseListTable.svelte +133 -36
- package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
- package/dist/concise-data-table/DataCell.svelte +5 -6
- package/dist/concise-data-table/DataRow.svelte +22 -2
- package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
- package/dist/concise-data-table/README.md +606 -0
- package/dist/concise-data-table/README_CN.md +611 -0
- package/dist/context-menu/ContextMenu.svelte +138 -21
- package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
- package/dist/context-menu/ContextMenuItem.d.ts +20 -4
- package/dist/context-menu/README.md +551 -0
- package/dist/context-menu/README_CN.md +551 -0
- package/dist/criteria-field/CriteriaField.svelte +3 -5
- package/dist/criteria-field/README.md +532 -0
- package/dist/criteria-field/README_CN.md +532 -0
- package/dist/data-table/README.md +712 -0
- package/dist/data-table/README_CN.md +712 -0
- package/dist/date-picker/DatePicker.svelte +44 -7
- package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
- package/dist/date-picker/DateTimePicker.svelte +32 -8
- package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
- package/dist/date-picker/README.md +326 -0
- package/dist/date-picker/README_CN.md +316 -0
- package/dist/date-picker/ScrollBar.svelte +18 -8
- package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
- package/dist/date-picker/TimePanel.svelte +5 -5
- package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
- package/dist/date-range/README.md +374 -0
- package/dist/date-range/README_CN.md +374 -0
- package/dist/dialog/README.md +596 -0
- package/dist/dialog/README_CN.md +596 -0
- package/dist/drawer/README.md +679 -1
- package/dist/drawer/README_CN.md +679 -0
- package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
- package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
- package/dist/group-box/group-check-box/README.md +749 -0
- package/dist/group-box/group-check-box/README_CN.md +750 -0
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
- package/dist/group-box/group-radio-box/README.md +920 -0
- package/dist/group-box/group-radio-box/README_CN.md +920 -0
- package/dist/image-files/README.md +1346 -0
- package/dist/image-files/README_CN.md +1346 -0
- package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
- package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
- package/dist/lib/forwardAllEvents.d.ts +3 -0
- package/dist/lib/forwardAllEvents.js +24 -0
- package/dist/list-box/README.md +579 -0
- package/dist/list-box/README_CN.md +682 -0
- package/dist/lookup-editor/LookupEditor.svelte +15 -3
- package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
- package/dist/lookup-editor/README.md +684 -0
- package/dist/lookup-editor/README_CN.md +684 -0
- package/dist/memo-editor/MemoEditor.svelte +77 -27
- package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
- package/dist/memo-editor/README.md +819 -0
- package/dist/memo-editor/README_CN.md +819 -0
- package/dist/message-box/README.md +398 -0
- package/dist/message-box/README_CN.md +398 -0
- package/dist/number-editor/NumberEditor.svelte +2 -2
- package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
- package/dist/number-editor/README.md +353 -22
- package/dist/number-editor/README_CN.md +357 -0
- package/dist/number-range/README.md +443 -0
- package/dist/number-range/README_CN.md +443 -0
- package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
- package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
- package/dist/options-multi-select/README.md +480 -0
- package/dist/options-multi-select/README_CN.md +480 -0
- package/dist/options-select/OptionsSelect.svelte +36 -5
- package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
- package/dist/options-select/README.md +632 -0
- package/dist/options-select/README_CN.md +632 -0
- package/dist/page/README.md +605 -0
- package/dist/page/README_CN.md +605 -0
- package/dist/pagination/README.md +946 -0
- package/dist/pagination/README_CN.md +946 -0
- package/dist/pagination-panel/README.md +1075 -0
- package/dist/pagination-panel/README_CN.md +1075 -0
- package/dist/popup-hint/README.md +841 -0
- package/dist/popup-hint/README_CN.md +840 -0
- package/dist/progress-bar/README.md +242 -0
- package/dist/progress-bar/README_CN.md +242 -0
- package/dist/progress-step-bar/README.md +316 -0
- package/dist/progress-step-bar/README_CN.md +316 -0
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
- package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
- package/dist/prompts-text-editor/README.md +329 -0
- package/dist/prompts-text-editor/README_CN.md +329 -0
- package/dist/property-editor/README.md +969 -0
- package/dist/property-editor/README_CN.md +969 -0
- package/dist/radio-button/README.md +372 -0
- package/dist/radio-button/README_CN.md +372 -0
- package/dist/radio-button/RadioButton.svelte +32 -3
- package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
- package/dist/search-box/README.md +425 -0
- package/dist/search-box/README_CN.md +424 -0
- package/dist/search-box/SearchBox.svelte +22 -6
- package/dist/search-box/SearchBox.svelte.d.ts +4 -1
- package/dist/tabs/README.md +919 -0
- package/dist/tabs/README_CN.md +920 -0
- package/dist/tag/README.md +922 -0
- package/dist/tag/README_CN.md +922 -0
- package/dist/text-editor/PasswordEditor.svelte +17 -2
- package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
- package/dist/text-editor/PasswordEditor_README.md +551 -0
- package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
- package/dist/text-editor/README.md +466 -0
- package/dist/text-editor/README_CN.md +466 -0
- package/dist/text-editor/TextEditor.svelte +51 -19
- package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
- package/dist/time-editor/README.md +498 -24
- package/dist/time-editor/README_CN.md +498 -0
- package/dist/time-editor/TimeEditor.svelte +7 -3
- package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
- package/dist/toast/README.md +667 -0
- package/dist/toast/README_CN.md +667 -0
- package/dist/transfer/README.md +795 -0
- package/dist/transfer/Transfer.svelte +6 -4
- package/dist/transfer/Transfer.svelte.d.ts +3 -1
- package/dist/tree-view/README.md +761 -0
- package/dist/tree-view/README_CN.md +761 -0
- package/dist/tree-view/TreeView.svelte +5 -3
- package/dist/tree-view/TreeView.svelte.d.ts +3 -1
- package/dist/unit-number-editor/README.md +546 -20
- package/dist/unit-number-editor/README_CN.md +525 -0
- package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
- package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
- package/docs/form-field/cn/README_CN.md +364 -0
- package/docs/form-field/en/README.md +364 -0
- package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
- package/docs/form-panel/flex-form/en/README.md +586 -0
- package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
- package/docs/form-panel/flex-row-form/en/README.md +787 -0
- package/docs/form-panel/grid-form/en/README.md +744 -0
- package/package.json +1 -1
- package/dist/drawer/README-CN.md +0 -1
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# ProgressStepBar
|
|
2
|
+
|
|
3
|
+
A multi-step progress indicator component that visualizes the completion status of sequential steps in a process. Supports both horizontal and vertical layouts.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ticatec/uniface-element
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic Usage
|
|
18
|
+
|
|
19
|
+
### Horizontal Step Progress
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<script>
|
|
23
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
24
|
+
|
|
25
|
+
let steps: Array<ProgressStep> = [
|
|
26
|
+
{
|
|
27
|
+
topic: 'Registration',
|
|
28
|
+
comment: 'Complete your profile',
|
|
29
|
+
status: ProgressStepStatus.Completed
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
topic: 'Verification',
|
|
33
|
+
comment: 'Verify your email',
|
|
34
|
+
status: ProgressStepStatus.Processing
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
topic: 'Setup',
|
|
38
|
+
comment: 'Configure preferences',
|
|
39
|
+
status: ProgressStepStatus.Pending
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<ProgressStepBar {steps} />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Vertical Step Progress
|
|
48
|
+
|
|
49
|
+
```svelte
|
|
50
|
+
<script>
|
|
51
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
52
|
+
|
|
53
|
+
let steps: Array<ProgressStep> = [
|
|
54
|
+
{
|
|
55
|
+
topic: 'Order Placed',
|
|
56
|
+
comment: 'Your order has been received',
|
|
57
|
+
status: ProgressStepStatus.Completed
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
topic: 'Processing',
|
|
61
|
+
comment: 'Preparing your items',
|
|
62
|
+
status: ProgressStepStatus.Processing
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
topic: 'Shipped',
|
|
66
|
+
comment: 'On the way to you',
|
|
67
|
+
status: ProgressStepStatus.Pending
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
topic: 'Delivered',
|
|
71
|
+
comment: 'Package delivered',
|
|
72
|
+
status: ProgressStepStatus.Pending
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<ProgressStepBar {steps} direction="vertical" />
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Props
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Default | Description |
|
|
83
|
+
|------|------|---------|-------------|
|
|
84
|
+
| `steps` | `Array<ProgressStep>` | Required | Array of progress steps |
|
|
85
|
+
| `direction` | `"horizontal" \| "vertical"` | `"horizontal"` | Layout direction of the steps |
|
|
86
|
+
| `backgroundColor` | `string` | `"var(--uniface-progress-step-bar-bg, #ffffff)"` | Background color of the step bar |
|
|
87
|
+
| `style` | `string` | `""` | Additional CSS styles |
|
|
88
|
+
|
|
89
|
+
## ProgressStep Interface
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
interface ProgressStep {
|
|
93
|
+
topic: string; // Step title/name
|
|
94
|
+
comment?: string; // Optional description
|
|
95
|
+
status: ProgressStepStatus; // Current status
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## ProgressStepStatus Enum
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
enum ProgressStepStatus {
|
|
103
|
+
Pending = 'pending', // Not yet started
|
|
104
|
+
Processing = 'processing', // Currently active
|
|
105
|
+
Completed = 'completed' // Finished
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Status Indicators
|
|
110
|
+
|
|
111
|
+
Each step displays different visual indicators based on its status:
|
|
112
|
+
|
|
113
|
+
- **Pending**: Shows step number in a muted style
|
|
114
|
+
- **Processing**: Shows step number with highlighted styling
|
|
115
|
+
- **Completed**: Shows checkmark (✔) with success styling
|
|
116
|
+
|
|
117
|
+
## Examples
|
|
118
|
+
|
|
119
|
+
### Dynamic Progress
|
|
120
|
+
|
|
121
|
+
```svelte
|
|
122
|
+
<script>
|
|
123
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
124
|
+
import { onMount } from 'svelte';
|
|
125
|
+
|
|
126
|
+
let steps: Array<ProgressStep> = [
|
|
127
|
+
{ topic: 'Initialization', comment: 'Setting up...', status: ProgressStepStatus.Pending },
|
|
128
|
+
{ topic: 'Data Loading', comment: 'Fetching data...', status: ProgressStepStatus.Pending },
|
|
129
|
+
{ topic: 'Processing', comment: 'Analyzing...', status: ProgressStepStatus.Pending },
|
|
130
|
+
{ topic: 'Completion', comment: 'Finalizing...', status: ProgressStepStatus.Pending }
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
let currentStep = 0;
|
|
134
|
+
|
|
135
|
+
onMount(() => {
|
|
136
|
+
const interval = setInterval(() => {
|
|
137
|
+
if (currentStep < steps.length) {
|
|
138
|
+
// Mark current step as processing
|
|
139
|
+
steps[currentStep].status = ProgressStepStatus.Processing;
|
|
140
|
+
steps = [...steps];
|
|
141
|
+
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
// Mark as completed and move to next
|
|
144
|
+
steps[currentStep].status = ProgressStepStatus.Completed;
|
|
145
|
+
currentStep++;
|
|
146
|
+
|
|
147
|
+
if (currentStep < steps.length) {
|
|
148
|
+
steps[currentStep].status = ProgressStepStatus.Processing;
|
|
149
|
+
}
|
|
150
|
+
steps = [...steps];
|
|
151
|
+
}, 1500);
|
|
152
|
+
} else {
|
|
153
|
+
clearInterval(interval);
|
|
154
|
+
}
|
|
155
|
+
}, 2000);
|
|
156
|
+
|
|
157
|
+
return () => clearInterval(interval);
|
|
158
|
+
});
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<ProgressStepBar {steps} />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Custom Background Color
|
|
165
|
+
|
|
166
|
+
```svelte
|
|
167
|
+
<script>
|
|
168
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
169
|
+
|
|
170
|
+
let steps: Array<ProgressStep> = [
|
|
171
|
+
{ topic: 'Step 1', status: ProgressStepStatus.Completed },
|
|
172
|
+
{ topic: 'Step 2', status: ProgressStepStatus.Processing },
|
|
173
|
+
{ topic: 'Step 3', status: ProgressStepStatus.Pending }
|
|
174
|
+
];
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<!-- Light gray background -->
|
|
178
|
+
<ProgressStepBar {steps} backgroundColor="#f8f9fa" />
|
|
179
|
+
|
|
180
|
+
<!-- Dark theme -->
|
|
181
|
+
<ProgressStepBar {steps} backgroundColor="#2d3748" />
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Without Comments
|
|
185
|
+
|
|
186
|
+
```svelte
|
|
187
|
+
<script>
|
|
188
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
189
|
+
|
|
190
|
+
let steps: Array<ProgressStep> = [
|
|
191
|
+
{ topic: 'Login', status: ProgressStepStatus.Completed },
|
|
192
|
+
{ topic: 'Verify', status: ProgressStepStatus.Processing },
|
|
193
|
+
{ topic: 'Complete', status: ProgressStepStatus.Pending }
|
|
194
|
+
];
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<ProgressStepBar {steps} />
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Workflow Example
|
|
201
|
+
|
|
202
|
+
```svelte
|
|
203
|
+
<script>
|
|
204
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
205
|
+
import Button from "@ticatec/uniface-element/Button";
|
|
206
|
+
|
|
207
|
+
let currentStepIndex = 0;
|
|
208
|
+
let steps: Array<ProgressStep> = [
|
|
209
|
+
{ topic: 'Account Setup', comment: 'Create your account', status: ProgressStepStatus.Processing },
|
|
210
|
+
{ topic: 'Profile Details', comment: 'Add personal information', status: ProgressStepStatus.Pending },
|
|
211
|
+
{ topic: 'Preferences', comment: 'Choose your settings', status: ProgressStepStatus.Pending },
|
|
212
|
+
{ topic: 'Confirmation', comment: 'Review and confirm', status: ProgressStepStatus.Pending }
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
function nextStep() {
|
|
216
|
+
if (currentStepIndex < steps.length - 1) {
|
|
217
|
+
steps[currentStepIndex].status = ProgressStepStatus.Completed;
|
|
218
|
+
currentStepIndex++;
|
|
219
|
+
steps[currentStepIndex].status = ProgressStepStatus.Processing;
|
|
220
|
+
steps = [...steps];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function prevStep() {
|
|
225
|
+
if (currentStepIndex > 0) {
|
|
226
|
+
steps[currentStepIndex].status = ProgressStepStatus.Pending;
|
|
227
|
+
currentStepIndex--;
|
|
228
|
+
steps[currentStepIndex].status = ProgressStepStatus.Processing;
|
|
229
|
+
steps = [...steps];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<ProgressStepBar {steps} />
|
|
235
|
+
|
|
236
|
+
<div style="margin-top: 20px;">
|
|
237
|
+
<Button label="Previous" onClick={prevStep} disabled={currentStepIndex === 0} />
|
|
238
|
+
<Button label="Next" onClick={nextStep} disabled={currentStepIndex === steps.length - 1} />
|
|
239
|
+
</div>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## CSS Custom Properties
|
|
243
|
+
|
|
244
|
+
The component uses CSS custom properties for theming:
|
|
245
|
+
|
|
246
|
+
```css
|
|
247
|
+
:root {
|
|
248
|
+
/* Background color */
|
|
249
|
+
--uniface-progress-step-bar-bg: #ffffff;
|
|
250
|
+
|
|
251
|
+
/* Step indicator colors (defined in uniface-progress-step-bar.scss) */
|
|
252
|
+
--progress-step-pending-color: #e2e8f0;
|
|
253
|
+
--progress-step-processing-color: #22bdff;
|
|
254
|
+
--progress-step-completed-color: #2dc071;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Styling Examples
|
|
259
|
+
|
|
260
|
+
### Custom Step Colors
|
|
261
|
+
|
|
262
|
+
```css
|
|
263
|
+
.custom-steps {
|
|
264
|
+
--progress-step-pending-color: #cbd5e0;
|
|
265
|
+
--progress-step-processing-color: #8b5cf6;
|
|
266
|
+
--progress-step-completed-color: #10b981;
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
```svelte
|
|
271
|
+
<div class="custom-steps">
|
|
272
|
+
<ProgressStepBar {steps} />
|
|
273
|
+
</div>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Layout Considerations
|
|
277
|
+
|
|
278
|
+
### Horizontal Layout
|
|
279
|
+
- Best for processes with 3-6 steps
|
|
280
|
+
- Takes full width of container
|
|
281
|
+
- Steps are evenly distributed
|
|
282
|
+
- Ideal for linear workflows
|
|
283
|
+
|
|
284
|
+
### Vertical Layout
|
|
285
|
+
- Better for detailed step descriptions
|
|
286
|
+
- Fixed width, grows in height
|
|
287
|
+
- Suitable for sidebar placement
|
|
288
|
+
- Good for processes with many steps
|
|
289
|
+
|
|
290
|
+
## Best Practices
|
|
291
|
+
|
|
292
|
+
1. **Step Count**: Keep steps between 3-7 for optimal user experience
|
|
293
|
+
2. **Clear Titles**: Use concise, descriptive step titles
|
|
294
|
+
3. **Helpful Comments**: Provide useful context in step comments
|
|
295
|
+
4. **Status Management**: Update step status appropriately during process flow
|
|
296
|
+
5. **Visual Hierarchy**: Use consistent styling and spacing
|
|
297
|
+
6. **Responsive Design**: Consider layout direction based on available space
|
|
298
|
+
|
|
299
|
+
## Accessibility
|
|
300
|
+
|
|
301
|
+
- Proper semantic markup for screen readers
|
|
302
|
+
- Clear visual distinction between step states
|
|
303
|
+
- Color is not the only indicator of step status
|
|
304
|
+
- Descriptive text for each step state
|
|
305
|
+
|
|
306
|
+
## Browser Support
|
|
307
|
+
|
|
308
|
+
- Modern browsers with CSS Grid support
|
|
309
|
+
- Compatible with Svelte 5+
|
|
310
|
+
- Responsive design principles
|
|
311
|
+
|
|
312
|
+
## Related Components
|
|
313
|
+
|
|
314
|
+
- `ProgressBar` - Simple progress indicator
|
|
315
|
+
- `Wizard` - Step-by-step form navigation
|
|
316
|
+
- `Breadcrumbs` - Navigation hierarchy display
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# ProgressStepBar 步骤进度条
|
|
2
|
+
|
|
3
|
+
一个多步骤进度指示器组件,用于可视化显示顺序流程中各步骤的完成状态。支持水平和垂直两种布局。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ticatec/uniface-element
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 导入
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 基本用法
|
|
18
|
+
|
|
19
|
+
### 水平步骤进度
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<script>
|
|
23
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
24
|
+
|
|
25
|
+
let steps: Array<ProgressStep> = [
|
|
26
|
+
{
|
|
27
|
+
topic: '注册',
|
|
28
|
+
comment: '完善您的资料',
|
|
29
|
+
status: ProgressStepStatus.Completed
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
topic: '验证',
|
|
33
|
+
comment: '验证您的邮箱',
|
|
34
|
+
status: ProgressStepStatus.Processing
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
topic: '设置',
|
|
38
|
+
comment: '配置偏好设置',
|
|
39
|
+
status: ProgressStepStatus.Pending
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<ProgressStepBar {steps} />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 垂直步骤进度
|
|
48
|
+
|
|
49
|
+
```svelte
|
|
50
|
+
<script>
|
|
51
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
52
|
+
|
|
53
|
+
let steps: Array<ProgressStep> = [
|
|
54
|
+
{
|
|
55
|
+
topic: '订单已下单',
|
|
56
|
+
comment: '您的订单已收到',
|
|
57
|
+
status: ProgressStepStatus.Completed
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
topic: '处理中',
|
|
61
|
+
comment: '正在准备您的商品',
|
|
62
|
+
status: ProgressStepStatus.Processing
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
topic: '已发货',
|
|
66
|
+
comment: '正在送往您的地址',
|
|
67
|
+
status: ProgressStepStatus.Pending
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
topic: '已送达',
|
|
71
|
+
comment: '包裹已送达',
|
|
72
|
+
status: ProgressStepStatus.Pending
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<ProgressStepBar {steps} direction="vertical" />
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 属性
|
|
81
|
+
|
|
82
|
+
| 属性 | 类型 | 默认值 | 描述 |
|
|
83
|
+
|------|------|--------|------|
|
|
84
|
+
| `steps` | `Array<ProgressStep>` | 必填 | 进度步骤数组 |
|
|
85
|
+
| `direction` | `"horizontal" \| "vertical"` | `"horizontal"` | 步骤布局方向 |
|
|
86
|
+
| `backgroundColor` | `string` | `"var(--uniface-progress-step-bar-bg, #ffffff)"` | 步骤条背景色 |
|
|
87
|
+
| `style` | `string` | `""` | 额外的CSS样式 |
|
|
88
|
+
|
|
89
|
+
## ProgressStep 接口
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
interface ProgressStep {
|
|
93
|
+
topic: string; // 步骤标题/名称
|
|
94
|
+
comment?: string; // 可选描述
|
|
95
|
+
status: ProgressStepStatus; // 当前状态
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## ProgressStepStatus 枚举
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
enum ProgressStepStatus {
|
|
103
|
+
Pending = 'pending', // 未开始
|
|
104
|
+
Processing = 'processing', // 进行中
|
|
105
|
+
Completed = 'completed' // 已完成
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 状态指示器
|
|
110
|
+
|
|
111
|
+
每个步骤根据其状态显示不同的视觉指示器:
|
|
112
|
+
|
|
113
|
+
- **待处理(Pending)**: 以柔和样式显示步骤编号
|
|
114
|
+
- **进行中(Processing)**: 以高亮样式显示步骤编号
|
|
115
|
+
- **已完成(Completed)**: 显示对勾标记(✔),使用成功样式
|
|
116
|
+
|
|
117
|
+
## 示例
|
|
118
|
+
|
|
119
|
+
### 动态进度
|
|
120
|
+
|
|
121
|
+
```svelte
|
|
122
|
+
<script>
|
|
123
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
124
|
+
import { onMount } from 'svelte';
|
|
125
|
+
|
|
126
|
+
let steps: Array<ProgressStep> = [
|
|
127
|
+
{ topic: '初始化', comment: '正在设置...', status: ProgressStepStatus.Pending },
|
|
128
|
+
{ topic: '数据加载', comment: '正在获取数据...', status: ProgressStepStatus.Pending },
|
|
129
|
+
{ topic: '处理中', comment: '正在分析...', status: ProgressStepStatus.Pending },
|
|
130
|
+
{ topic: '完成', comment: '正在完成...', status: ProgressStepStatus.Pending }
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
let currentStep = 0;
|
|
134
|
+
|
|
135
|
+
onMount(() => {
|
|
136
|
+
const interval = setInterval(() => {
|
|
137
|
+
if (currentStep < steps.length) {
|
|
138
|
+
// 标记当前步骤为进行中
|
|
139
|
+
steps[currentStep].status = ProgressStepStatus.Processing;
|
|
140
|
+
steps = [...steps];
|
|
141
|
+
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
// 标记为已完成并移动到下一步
|
|
144
|
+
steps[currentStep].status = ProgressStepStatus.Completed;
|
|
145
|
+
currentStep++;
|
|
146
|
+
|
|
147
|
+
if (currentStep < steps.length) {
|
|
148
|
+
steps[currentStep].status = ProgressStepStatus.Processing;
|
|
149
|
+
}
|
|
150
|
+
steps = [...steps];
|
|
151
|
+
}, 1500);
|
|
152
|
+
} else {
|
|
153
|
+
clearInterval(interval);
|
|
154
|
+
}
|
|
155
|
+
}, 2000);
|
|
156
|
+
|
|
157
|
+
return () => clearInterval(interval);
|
|
158
|
+
});
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<ProgressStepBar {steps} />
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 自定义背景颜色
|
|
165
|
+
|
|
166
|
+
```svelte
|
|
167
|
+
<script>
|
|
168
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
169
|
+
|
|
170
|
+
let steps: Array<ProgressStep> = [
|
|
171
|
+
{ topic: '步骤1', status: ProgressStepStatus.Completed },
|
|
172
|
+
{ topic: '步骤2', status: ProgressStepStatus.Processing },
|
|
173
|
+
{ topic: '步骤3', status: ProgressStepStatus.Pending }
|
|
174
|
+
];
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<!-- 浅灰色背景 -->
|
|
178
|
+
<ProgressStepBar {steps} backgroundColor="#f8f9fa" />
|
|
179
|
+
|
|
180
|
+
<!-- 深色主题 -->
|
|
181
|
+
<ProgressStepBar {steps} backgroundColor="#2d3748" />
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 不显示说明
|
|
185
|
+
|
|
186
|
+
```svelte
|
|
187
|
+
<script>
|
|
188
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
189
|
+
|
|
190
|
+
let steps: Array<ProgressStep> = [
|
|
191
|
+
{ topic: '登录', status: ProgressStepStatus.Completed },
|
|
192
|
+
{ topic: '验证', status: ProgressStepStatus.Processing },
|
|
193
|
+
{ topic: '完成', status: ProgressStepStatus.Pending }
|
|
194
|
+
];
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<ProgressStepBar {steps} />
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 工作流示例
|
|
201
|
+
|
|
202
|
+
```svelte
|
|
203
|
+
<script>
|
|
204
|
+
import ProgressStepBar, { ProgressStepStatus, type ProgressStep } from "@ticatec/uniface-element/ProgressStepBar";
|
|
205
|
+
import Button from "@ticatec/uniface-element/Button";
|
|
206
|
+
|
|
207
|
+
let currentStepIndex = 0;
|
|
208
|
+
let steps: Array<ProgressStep> = [
|
|
209
|
+
{ topic: '账户设置', comment: '创建您的账户', status: ProgressStepStatus.Processing },
|
|
210
|
+
{ topic: '个人信息', comment: '添加个人信息', status: ProgressStepStatus.Pending },
|
|
211
|
+
{ topic: '偏好设置', comment: '选择您的设置', status: ProgressStepStatus.Pending },
|
|
212
|
+
{ topic: '确认', comment: '检查并确认', status: ProgressStepStatus.Pending }
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
function nextStep() {
|
|
216
|
+
if (currentStepIndex < steps.length - 1) {
|
|
217
|
+
steps[currentStepIndex].status = ProgressStepStatus.Completed;
|
|
218
|
+
currentStepIndex++;
|
|
219
|
+
steps[currentStepIndex].status = ProgressStepStatus.Processing;
|
|
220
|
+
steps = [...steps];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function prevStep() {
|
|
225
|
+
if (currentStepIndex > 0) {
|
|
226
|
+
steps[currentStepIndex].status = ProgressStepStatus.Pending;
|
|
227
|
+
currentStepIndex--;
|
|
228
|
+
steps[currentStepIndex].status = ProgressStepStatus.Processing;
|
|
229
|
+
steps = [...steps];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<ProgressStepBar {steps} />
|
|
235
|
+
|
|
236
|
+
<div style="margin-top: 20px;">
|
|
237
|
+
<Button label="上一步" onClick={prevStep} disabled={currentStepIndex === 0} />
|
|
238
|
+
<Button label="下一步" onClick={nextStep} disabled={currentStepIndex === steps.length - 1} />
|
|
239
|
+
</div>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## CSS 自定义属性
|
|
243
|
+
|
|
244
|
+
组件使用 CSS 自定义属性进行主题定制:
|
|
245
|
+
|
|
246
|
+
```css
|
|
247
|
+
:root {
|
|
248
|
+
/* 背景颜色 */
|
|
249
|
+
--uniface-progress-step-bar-bg: #ffffff;
|
|
250
|
+
|
|
251
|
+
/* 步骤指示器颜色(在 uniface-progress-step-bar.scss 中定义) */
|
|
252
|
+
--progress-step-pending-color: #e2e8f0;
|
|
253
|
+
--progress-step-processing-color: #22bdff;
|
|
254
|
+
--progress-step-completed-color: #2dc071;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## 样式示例
|
|
259
|
+
|
|
260
|
+
### 自定义步骤颜色
|
|
261
|
+
|
|
262
|
+
```css
|
|
263
|
+
.custom-steps {
|
|
264
|
+
--progress-step-pending-color: #cbd5e0;
|
|
265
|
+
--progress-step-processing-color: #8b5cf6;
|
|
266
|
+
--progress-step-completed-color: #10b981;
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
```svelte
|
|
271
|
+
<div class="custom-steps">
|
|
272
|
+
<ProgressStepBar {steps} />
|
|
273
|
+
</div>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## 布局考虑
|
|
277
|
+
|
|
278
|
+
### 水平布局
|
|
279
|
+
- 适合3-6个步骤的流程
|
|
280
|
+
- 占用容器全宽
|
|
281
|
+
- 步骤均匀分布
|
|
282
|
+
- 适合线性工作流
|
|
283
|
+
|
|
284
|
+
### 垂直布局
|
|
285
|
+
- 更适合详细的步骤描述
|
|
286
|
+
- 固定宽度,高度可变
|
|
287
|
+
- 适合侧边栏放置
|
|
288
|
+
- 适合多步骤流程
|
|
289
|
+
|
|
290
|
+
## 最佳实践
|
|
291
|
+
|
|
292
|
+
1. **步骤数量**: 保持步骤在3-7个之间以获得最佳用户体验
|
|
293
|
+
2. **清晰标题**: 使用简洁、描述性的步骤标题
|
|
294
|
+
3. **有用说明**: 在步骤注释中提供有用的上下文
|
|
295
|
+
4. **状态管理**: 在流程进行期间适当更新步骤状态
|
|
296
|
+
5. **视觉层次**: 使用一致的样式和间距
|
|
297
|
+
6. **响应式设计**: 根据可用空间考虑布局方向
|
|
298
|
+
|
|
299
|
+
## 无障碍访问
|
|
300
|
+
|
|
301
|
+
- 为屏幕阅读器提供适当的语义标记
|
|
302
|
+
- 步骤状态之间有清晰的视觉区别
|
|
303
|
+
- 颜色不是步骤状态的唯一指示器
|
|
304
|
+
- 为每个步骤状态提供描述性文本
|
|
305
|
+
|
|
306
|
+
## 浏览器支持
|
|
307
|
+
|
|
308
|
+
- 支持CSS Grid的现代浏览器
|
|
309
|
+
- 兼容 Svelte 5+
|
|
310
|
+
- 响应式设计原则
|
|
311
|
+
|
|
312
|
+
## 相关组件
|
|
313
|
+
|
|
314
|
+
- `ProgressBar` - 简单进度指示器
|
|
315
|
+
- `Wizard` - 分步表单导航
|
|
316
|
+
- `Breadcrumbs` - 导航层次显示
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
export let suffix: string = '';
|
|
19
19
|
export let displayMode: DisplayMode = DisplayMode.Edit;
|
|
20
20
|
export let removable: boolean = true;
|
|
21
|
-
export let
|
|
21
|
+
export let onchange: OnChangeHandler<string | null> = null as unknown as OnChangeHandler<string | null>;
|
|
22
|
+
export let onfocus: ((event: FocusEvent) => void) | null = null;
|
|
23
|
+
export let onblur: ((event: FocusEvent) => void) | null = null;
|
|
22
24
|
export let words: Array<string>;
|
|
23
25
|
export let menu$height: number = 0;
|
|
24
26
|
export let placeholder: string = '';
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
$: if (oldValue != value) {
|
|
59
|
-
|
|
61
|
+
onchange?.(value);
|
|
60
62
|
oldValue = value;
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -71,7 +73,8 @@
|
|
|
71
73
|
<slot name="leading-icon"/>
|
|
72
74
|
{/if}
|
|
73
75
|
</svelte:fragment>
|
|
74
|
-
<input style="width: 100%" bind:this={editor} {disabled} {placeholder} bind:value={value} {readonly}
|
|
76
|
+
<input style="width: 100%" bind:this={editor} {disabled} {placeholder} bind:value={value} {readonly}
|
|
77
|
+
on:focus={onfocus} on:blur={onblur}/>
|
|
75
78
|
<svelte:fragment slot="trailing-icon">
|
|
76
79
|
{#if !disabled && !readonly}
|
|
77
80
|
<i class="option-dropdown icon_google_arrow_drop_down" aria-hidden="true" on:click={openPopup}></i>
|
|
@@ -26,7 +26,9 @@ declare const PromptsTextEditor: $$__sveltets_2_IsomorphicComponent<{
|
|
|
26
26
|
suffix?: string | undefined;
|
|
27
27
|
displayMode?: DisplayMode | undefined;
|
|
28
28
|
removable?: boolean | undefined;
|
|
29
|
-
|
|
29
|
+
onchange?: OnChangeHandler<string | null> | undefined;
|
|
30
|
+
onfocus?: ((event: FocusEvent) => void) | null | undefined;
|
|
31
|
+
onblur?: ((event: FocusEvent) => void) | null | undefined;
|
|
30
32
|
words: Array<string>;
|
|
31
33
|
menu$height?: number | undefined;
|
|
32
34
|
placeholder?: string | undefined;
|