@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,576 @@
|
|
|
1
|
+
# Page Component
|
|
2
|
+
|
|
3
|
+
A comprehensive page container component that provides a structured layout with header, navigation actions, and content area for building complete application pages.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Page component is designed to create consistent, full-page layouts with built-in header functionality, navigation actions (back/reload), and a content container. It's perfect for creating application pages, forms, dashboards, and detail views with a professional appearance.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
13
|
+
import { PageHeader } from '@ticatec/uniface-element/Page';
|
|
14
|
+
import type { PageAction } from '@ticatec/uniface-element/Page';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic Usage
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Page title="Dashboard" comment="Overview of system metrics">
|
|
25
|
+
<div class="dashboard-content">
|
|
26
|
+
<p>Your page content goes here...</p>
|
|
27
|
+
</div>
|
|
28
|
+
</Page>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
| Property | Type | Default | Description |
|
|
34
|
+
|----------|------|---------|-------------|
|
|
35
|
+
| `title` | `string` | `''` | Page title displayed in header |
|
|
36
|
+
| `comment` | `string` | `null` | Subtitle or description text |
|
|
37
|
+
| `header$style` | `string` | `''` | Custom styles for header area |
|
|
38
|
+
| `content$style` | `string` | `''` | Custom styles for content area |
|
|
39
|
+
| `round` | `boolean` | `false` | Apply rounded corners to page |
|
|
40
|
+
| `shadow` | `boolean` | `true` | Apply shadow effect to page |
|
|
41
|
+
| `goBack` | `PageAction \| null` | `null` | Back navigation action |
|
|
42
|
+
| `reload` | `PageAction \| null` | `null` | Reload/refresh action |
|
|
43
|
+
| `style` | `string` | `''` | Custom styles for page wrapper |
|
|
44
|
+
|
|
45
|
+
## Slots
|
|
46
|
+
|
|
47
|
+
| Slot | Description |
|
|
48
|
+
|------|-------------|
|
|
49
|
+
| `default` | Main content area of the page |
|
|
50
|
+
| `page-header` | Custom header content (overrides default header) |
|
|
51
|
+
| `header-ext` | Additional header content (extends default header) |
|
|
52
|
+
|
|
53
|
+
## PageAction Type
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
export type PageAction = () => any;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage Examples
|
|
60
|
+
|
|
61
|
+
### Basic Page
|
|
62
|
+
|
|
63
|
+
```svelte
|
|
64
|
+
<script lang="ts">
|
|
65
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<Page title="User Profile" comment="Manage your account settings">
|
|
69
|
+
<div class="profile-form">
|
|
70
|
+
<h3>Personal Information</h3>
|
|
71
|
+
<p>Edit your profile details below...</p>
|
|
72
|
+
<!-- Form content -->
|
|
73
|
+
</div>
|
|
74
|
+
</Page>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Page with Navigation Actions
|
|
78
|
+
|
|
79
|
+
```svelte
|
|
80
|
+
<script lang="ts">
|
|
81
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
82
|
+
import type { PageAction } from '@ticatec/uniface-element/Page';
|
|
83
|
+
|
|
84
|
+
const handleGoBack: PageAction = () => {
|
|
85
|
+
window.history.back();
|
|
86
|
+
console.log('Navigating back...');
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleReload: PageAction = () => {
|
|
90
|
+
window.location.reload();
|
|
91
|
+
console.log('Reloading page...');
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<Page
|
|
96
|
+
title="Order Details"
|
|
97
|
+
comment="Order #12345 - Processing"
|
|
98
|
+
goBack={handleGoBack}
|
|
99
|
+
reload={handleReload}
|
|
100
|
+
>
|
|
101
|
+
<div class="order-details">
|
|
102
|
+
<h3>Order Information</h3>
|
|
103
|
+
<p>Customer: John Doe</p>
|
|
104
|
+
<p>Total: $299.99</p>
|
|
105
|
+
<p>Status: Processing</p>
|
|
106
|
+
</div>
|
|
107
|
+
</Page>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Styled Page
|
|
111
|
+
|
|
112
|
+
```svelte
|
|
113
|
+
<script lang="ts">
|
|
114
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<Page
|
|
118
|
+
title="Analytics Dashboard"
|
|
119
|
+
comment="Real-time business metrics"
|
|
120
|
+
round={true}
|
|
121
|
+
shadow={true}
|
|
122
|
+
style="max-width: 1200px; margin: 0 auto;"
|
|
123
|
+
header$style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white;"
|
|
124
|
+
content$style="padding: 30px;"
|
|
125
|
+
>
|
|
126
|
+
<div class="dashboard-grid">
|
|
127
|
+
<div class="metric-card">
|
|
128
|
+
<h4>Revenue</h4>
|
|
129
|
+
<div class="metric-value">$45,231</div>
|
|
130
|
+
</div>
|
|
131
|
+
<div class="metric-card">
|
|
132
|
+
<h4>Users</h4>
|
|
133
|
+
<div class="metric-value">1,234</div>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="metric-card">
|
|
136
|
+
<h4>Conversion</h4>
|
|
137
|
+
<div class="metric-value">3.4%</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</Page>
|
|
141
|
+
|
|
142
|
+
<style>
|
|
143
|
+
.dashboard-grid {
|
|
144
|
+
display: grid;
|
|
145
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
146
|
+
gap: 20px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.metric-card {
|
|
150
|
+
background: white;
|
|
151
|
+
border-radius: 8px;
|
|
152
|
+
padding: 20px;
|
|
153
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
154
|
+
text-align: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.metric-card h4 {
|
|
158
|
+
margin: 0 0 10px 0;
|
|
159
|
+
color: #666;
|
|
160
|
+
font-weight: normal;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.metric-value {
|
|
164
|
+
font-size: 2rem;
|
|
165
|
+
font-weight: bold;
|
|
166
|
+
color: #333;
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Page with Custom Header
|
|
172
|
+
|
|
173
|
+
```svelte
|
|
174
|
+
<script lang="ts">
|
|
175
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
176
|
+
import { PageHeader } from '@ticatec/uniface-element/Page';
|
|
177
|
+
</script>
|
|
178
|
+
|
|
179
|
+
<Page>
|
|
180
|
+
<div slot="page-header" class="custom-header">
|
|
181
|
+
<div class="header-left">
|
|
182
|
+
<h1>Custom Dashboard</h1>
|
|
183
|
+
<p>Advanced analytics and reporting</p>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="header-right">
|
|
186
|
+
<button class="export-btn">Export Data</button>
|
|
187
|
+
<button class="settings-btn">Settings</button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
<div class="page-content">
|
|
192
|
+
<p>Custom header with action buttons and layout</p>
|
|
193
|
+
</div>
|
|
194
|
+
</Page>
|
|
195
|
+
|
|
196
|
+
<style>
|
|
197
|
+
.custom-header {
|
|
198
|
+
display: flex;
|
|
199
|
+
justify-content: space-between;
|
|
200
|
+
align-items: center;
|
|
201
|
+
padding: 20px;
|
|
202
|
+
background: #f8f9fa;
|
|
203
|
+
border-bottom: 1px solid #dee2e6;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.header-left h1 {
|
|
207
|
+
margin: 0 0 5px 0;
|
|
208
|
+
font-size: 1.5rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.header-left p {
|
|
212
|
+
margin: 0;
|
|
213
|
+
color: #666;
|
|
214
|
+
font-size: 0.875rem;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.header-right {
|
|
218
|
+
display: flex;
|
|
219
|
+
gap: 10px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.export-btn, .settings-btn {
|
|
223
|
+
padding: 8px 16px;
|
|
224
|
+
border: 1px solid #007bff;
|
|
225
|
+
background: #007bff;
|
|
226
|
+
color: white;
|
|
227
|
+
border-radius: 4px;
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.settings-btn {
|
|
232
|
+
background: transparent;
|
|
233
|
+
color: #007bff;
|
|
234
|
+
}
|
|
235
|
+
</style>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Page with Extended Header
|
|
239
|
+
|
|
240
|
+
```svelte
|
|
241
|
+
<script lang="ts">
|
|
242
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
243
|
+
import type { PageAction } from '@ticatec/uniface-element/Page';
|
|
244
|
+
|
|
245
|
+
const handleBack: PageAction = () => {
|
|
246
|
+
console.log('Going back...');
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
let activeTab = 'overview';
|
|
250
|
+
</script>
|
|
251
|
+
|
|
252
|
+
<Page
|
|
253
|
+
title="Project Management"
|
|
254
|
+
comment="Manage project tasks and team collaboration"
|
|
255
|
+
goBack={handleBack}
|
|
256
|
+
>
|
|
257
|
+
<div slot="header-ext" class="header-tabs">
|
|
258
|
+
<button
|
|
259
|
+
class="tab"
|
|
260
|
+
class:active={activeTab === 'overview'}
|
|
261
|
+
on:click={() => activeTab = 'overview'}
|
|
262
|
+
>
|
|
263
|
+
Overview
|
|
264
|
+
</button>
|
|
265
|
+
<button
|
|
266
|
+
class="tab"
|
|
267
|
+
class:active={activeTab === 'tasks'}
|
|
268
|
+
on:click={() => activeTab = 'tasks'}
|
|
269
|
+
>
|
|
270
|
+
Tasks
|
|
271
|
+
</button>
|
|
272
|
+
<button
|
|
273
|
+
class="tab"
|
|
274
|
+
class:active={activeTab === 'team'}
|
|
275
|
+
on:click={() => activeTab = 'team'}
|
|
276
|
+
>
|
|
277
|
+
Team
|
|
278
|
+
</button>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<div class="tab-content">
|
|
282
|
+
{#if activeTab === 'overview'}
|
|
283
|
+
<div class="overview-section">
|
|
284
|
+
<h3>Project Overview</h3>
|
|
285
|
+
<p>Current project status and key metrics</p>
|
|
286
|
+
</div>
|
|
287
|
+
{:else if activeTab === 'tasks'}
|
|
288
|
+
<div class="tasks-section">
|
|
289
|
+
<h3>Task Management</h3>
|
|
290
|
+
<p>View and manage project tasks</p>
|
|
291
|
+
</div>
|
|
292
|
+
{:else if activeTab === 'team'}
|
|
293
|
+
<div class="team-section">
|
|
294
|
+
<h3>Team Members</h3>
|
|
295
|
+
<p>Collaborate with your team</p>
|
|
296
|
+
</div>
|
|
297
|
+
{/if}
|
|
298
|
+
</div>
|
|
299
|
+
</Page>
|
|
300
|
+
|
|
301
|
+
<style>
|
|
302
|
+
.header-tabs {
|
|
303
|
+
display: flex;
|
|
304
|
+
gap: 1px;
|
|
305
|
+
background: #e9ecef;
|
|
306
|
+
border-radius: 4px;
|
|
307
|
+
padding: 4px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.tab {
|
|
311
|
+
padding: 8px 16px;
|
|
312
|
+
border: none;
|
|
313
|
+
background: transparent;
|
|
314
|
+
border-radius: 2px;
|
|
315
|
+
cursor: pointer;
|
|
316
|
+
font-size: 0.875rem;
|
|
317
|
+
transition: background-color 0.2s;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.tab:hover {
|
|
321
|
+
background: rgba(255,255,255,0.5);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.tab.active {
|
|
325
|
+
background: white;
|
|
326
|
+
font-weight: 500;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.tab-content {
|
|
330
|
+
padding: 20px 0;
|
|
331
|
+
}
|
|
332
|
+
</style>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Form Page Example
|
|
336
|
+
|
|
337
|
+
```svelte
|
|
338
|
+
<script lang="ts">
|
|
339
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
340
|
+
import type { PageAction } from '@ticatec/uniface-element/Page';
|
|
341
|
+
|
|
342
|
+
let formData = {
|
|
343
|
+
name: '',
|
|
344
|
+
email: '',
|
|
345
|
+
department: 'engineering'
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const handleBack: PageAction = () => {
|
|
349
|
+
if (confirm('Are you sure you want to leave? Unsaved changes will be lost.')) {
|
|
350
|
+
window.history.back();
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const handleReload: PageAction = () => {
|
|
355
|
+
if (confirm('Reload the page? Unsaved changes will be lost.')) {
|
|
356
|
+
window.location.reload();
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
function handleSubmit() {
|
|
361
|
+
console.log('Submitting form:', formData);
|
|
362
|
+
// Handle form submission
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function handleReset() {
|
|
366
|
+
formData = { name: '', email: '', department: 'engineering' };
|
|
367
|
+
}
|
|
368
|
+
</script>
|
|
369
|
+
|
|
370
|
+
<Page
|
|
371
|
+
title="Add New Employee"
|
|
372
|
+
comment="Complete the form to add a new team member"
|
|
373
|
+
goBack={handleBack}
|
|
374
|
+
reload={handleReload}
|
|
375
|
+
round={true}
|
|
376
|
+
content$style="max-width: 600px; margin: 0 auto; padding: 30px;"
|
|
377
|
+
>
|
|
378
|
+
<form class="employee-form" on:submit|preventDefault={handleSubmit}>
|
|
379
|
+
<div class="form-group">
|
|
380
|
+
<label for="name">Full Name *</label>
|
|
381
|
+
<input
|
|
382
|
+
id="name"
|
|
383
|
+
type="text"
|
|
384
|
+
bind:value={formData.name}
|
|
385
|
+
required
|
|
386
|
+
placeholder="Enter full name"
|
|
387
|
+
/>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
<div class="form-group">
|
|
391
|
+
<label for="email">Email Address *</label>
|
|
392
|
+
<input
|
|
393
|
+
id="email"
|
|
394
|
+
type="email"
|
|
395
|
+
bind:value={formData.email}
|
|
396
|
+
required
|
|
397
|
+
placeholder="Enter email address"
|
|
398
|
+
/>
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div class="form-group">
|
|
402
|
+
<label for="department">Department</label>
|
|
403
|
+
<select id="department" bind:value={formData.department}>
|
|
404
|
+
<option value="engineering">Engineering</option>
|
|
405
|
+
<option value="design">Design</option>
|
|
406
|
+
<option value="marketing">Marketing</option>
|
|
407
|
+
<option value="sales">Sales</option>
|
|
408
|
+
</select>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<div class="form-actions">
|
|
412
|
+
<button type="button" class="btn-secondary" on:click={handleReset}>
|
|
413
|
+
Reset
|
|
414
|
+
</button>
|
|
415
|
+
<button type="submit" class="btn-primary">
|
|
416
|
+
Add Employee
|
|
417
|
+
</button>
|
|
418
|
+
</div>
|
|
419
|
+
</form>
|
|
420
|
+
</Page>
|
|
421
|
+
|
|
422
|
+
<style>
|
|
423
|
+
.employee-form {
|
|
424
|
+
display: flex;
|
|
425
|
+
flex-direction: column;
|
|
426
|
+
gap: 20px;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.form-group {
|
|
430
|
+
display: flex;
|
|
431
|
+
flex-direction: column;
|
|
432
|
+
gap: 5px;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.form-group label {
|
|
436
|
+
font-weight: 500;
|
|
437
|
+
color: #333;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.form-group input,
|
|
441
|
+
.form-group select {
|
|
442
|
+
padding: 10px;
|
|
443
|
+
border: 1px solid #ddd;
|
|
444
|
+
border-radius: 4px;
|
|
445
|
+
font-size: 1rem;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.form-group input:focus,
|
|
449
|
+
.form-group select:focus {
|
|
450
|
+
outline: none;
|
|
451
|
+
border-color: #007bff;
|
|
452
|
+
box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.form-actions {
|
|
456
|
+
display: flex;
|
|
457
|
+
gap: 10px;
|
|
458
|
+
justify-content: flex-end;
|
|
459
|
+
margin-top: 20px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.btn-primary,
|
|
463
|
+
.btn-secondary {
|
|
464
|
+
padding: 10px 20px;
|
|
465
|
+
border-radius: 4px;
|
|
466
|
+
cursor: pointer;
|
|
467
|
+
font-size: 1rem;
|
|
468
|
+
border: none;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.btn-primary {
|
|
472
|
+
background: #007bff;
|
|
473
|
+
color: white;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.btn-secondary {
|
|
477
|
+
background: #6c757d;
|
|
478
|
+
color: white;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.btn-primary:hover {
|
|
482
|
+
background: #0056b3;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.btn-secondary:hover {
|
|
486
|
+
background: #545b62;
|
|
487
|
+
}
|
|
488
|
+
</style>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## Styling
|
|
492
|
+
|
|
493
|
+
The Page component uses the following CSS classes:
|
|
494
|
+
|
|
495
|
+
```css
|
|
496
|
+
.uniface-page-wrapper {
|
|
497
|
+
/* Page wrapper container */
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.uniface-page {
|
|
501
|
+
/* Main page container */
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.uniface-page.shadow {
|
|
505
|
+
/* Page with shadow effect */
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.uniface-page.round {
|
|
509
|
+
/* Page with rounded corners */
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.uniface-page-header {
|
|
513
|
+
/* Header container */
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.page-container {
|
|
517
|
+
/* Content container */
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## API Reference
|
|
522
|
+
|
|
523
|
+
### Page Component Props
|
|
524
|
+
|
|
525
|
+
All properties are optional unless marked as required.
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
interface PageProps {
|
|
529
|
+
title: string; // Page title
|
|
530
|
+
comment?: string | null; // Subtitle/description
|
|
531
|
+
header$style?: string; // Header custom styles
|
|
532
|
+
content$style?: string; // Content custom styles
|
|
533
|
+
round?: boolean; // Rounded corners
|
|
534
|
+
shadow?: boolean; // Shadow effect
|
|
535
|
+
goBack?: PageAction | null; // Back navigation
|
|
536
|
+
reload?: PageAction | null; // Reload action
|
|
537
|
+
style?: string; // Wrapper custom styles
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### PageAction Type
|
|
542
|
+
|
|
543
|
+
```typescript
|
|
544
|
+
export type PageAction = () => any;
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
## Best Practices
|
|
548
|
+
|
|
549
|
+
1. **Consistent Navigation** - Always provide back navigation for detail pages
|
|
550
|
+
2. **Descriptive Titles** - Use clear, descriptive page titles that explain the page purpose
|
|
551
|
+
3. **Helpful Comments** - Add subtitle/comment text to provide context
|
|
552
|
+
4. **Responsive Layout** - Use content styling to ensure proper responsive behavior
|
|
553
|
+
5. **Action Confirmation** - Confirm destructive actions like navigation away from unsaved forms
|
|
554
|
+
6. **Loading States** - Handle loading states gracefully when actions are async
|
|
555
|
+
7. **Error Handling** - Implement proper error handling for page actions
|
|
556
|
+
8. **Accessibility** - Ensure proper heading hierarchy and keyboard navigation
|
|
557
|
+
|
|
558
|
+
## Integration with Router
|
|
559
|
+
|
|
560
|
+
The Page component works well with routing libraries:
|
|
561
|
+
|
|
562
|
+
```svelte
|
|
563
|
+
<script lang="ts">
|
|
564
|
+
import Page from '@ticatec/uniface-element/Page';
|
|
565
|
+
import { goto } from '$app/navigation';
|
|
566
|
+
import type { PageAction } from '@ticatec/uniface-element/Page';
|
|
567
|
+
|
|
568
|
+
const handleBack: PageAction = () => {
|
|
569
|
+
goto('/dashboard');
|
|
570
|
+
};
|
|
571
|
+
</script>
|
|
572
|
+
|
|
573
|
+
<Page title="Settings" goBack={handleBack}>
|
|
574
|
+
<!-- Page content -->
|
|
575
|
+
</Page>
|
|
576
|
+
```
|