@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,542 @@
|
|
|
1
|
+
# FlexRowForm Component
|
|
2
|
+
|
|
3
|
+
Flexible row-based form layout component providing a row-based form container with support for vertical and horizontal field layout modes.
|
|
4
|
+
|
|
5
|
+
## Component Description
|
|
6
|
+
|
|
7
|
+
The FlexRowForm component consists of the following sub-components:
|
|
8
|
+
- **FormContainer** - Main container component
|
|
9
|
+
- **Row** - Row component for organizing form rows
|
|
10
|
+
- **Cell** - Cell component for placing form fields
|
|
11
|
+
|
|
12
|
+
## FormContainer Properties
|
|
13
|
+
|
|
14
|
+
| Property | Type | Default | Description |
|
|
15
|
+
|----------|------|---------|-------------|
|
|
16
|
+
| `style` | `string` | `''` | Custom styles |
|
|
17
|
+
| `fieldLayout` | `'vertical' \| 'horizontal'` | `'vertical'` | Field layout direction |
|
|
18
|
+
|
|
19
|
+
## Usage Examples
|
|
20
|
+
|
|
21
|
+
### Basic Row-based Layout
|
|
22
|
+
|
|
23
|
+
```svelte
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import FormContainer, Row, Cell, FormField, TextEditor, NumberEditor from '@ticatec/uniface-element/FormContainer, Row, Cell, FormField, TextEditor, NumberEditor';
|
|
26
|
+
|
|
27
|
+
interface UserInfo {
|
|
28
|
+
firstName: string;
|
|
29
|
+
lastName: string;
|
|
30
|
+
age: number | null;
|
|
31
|
+
email: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let userInfo: UserInfo = {
|
|
35
|
+
firstName: '',
|
|
36
|
+
lastName: '',
|
|
37
|
+
age: null,
|
|
38
|
+
email: ''
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleSubmit = (): void => {
|
|
42
|
+
console.log('Submit user info:', userInfo);
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<FormContainer fieldLayout="horizontal">
|
|
47
|
+
<Row>
|
|
48
|
+
<Cell>
|
|
49
|
+
<FormField label="First Name">
|
|
50
|
+
<TextEditor
|
|
51
|
+
placeholder="Enter first name"
|
|
52
|
+
bind:value={userInfo.firstName}
|
|
53
|
+
/>
|
|
54
|
+
</FormField>
|
|
55
|
+
</Cell>
|
|
56
|
+
|
|
57
|
+
<Cell>
|
|
58
|
+
<FormField label="Last Name">
|
|
59
|
+
<TextEditor
|
|
60
|
+
placeholder="Enter last name"
|
|
61
|
+
bind:value={userInfo.lastName}
|
|
62
|
+
/>
|
|
63
|
+
</FormField>
|
|
64
|
+
</Cell>
|
|
65
|
+
|
|
66
|
+
<Cell>
|
|
67
|
+
<FormField label="Age">
|
|
68
|
+
<NumberEditor
|
|
69
|
+
placeholder="Enter age"
|
|
70
|
+
min={1}
|
|
71
|
+
max={120}
|
|
72
|
+
bind:value={userInfo.age}
|
|
73
|
+
/>
|
|
74
|
+
</FormField>
|
|
75
|
+
</Cell>
|
|
76
|
+
</Row>
|
|
77
|
+
|
|
78
|
+
<Row>
|
|
79
|
+
<Cell>
|
|
80
|
+
<FormField label="Email">
|
|
81
|
+
<TextEditor
|
|
82
|
+
placeholder="Enter email address"
|
|
83
|
+
bind:value={userInfo.email}
|
|
84
|
+
/>
|
|
85
|
+
</FormField>
|
|
86
|
+
</Cell>
|
|
87
|
+
</Row>
|
|
88
|
+
|
|
89
|
+
<Row>
|
|
90
|
+
<Cell>
|
|
91
|
+
<div class="form-actions">
|
|
92
|
+
<button type="button" on:click={handleSubmit}>
|
|
93
|
+
Submit
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
</Cell>
|
|
97
|
+
</Row>
|
|
98
|
+
</FormContainer>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Complex Form Layout
|
|
102
|
+
|
|
103
|
+
```svelte
|
|
104
|
+
<script lang="ts">
|
|
105
|
+
import FormContainer, Row, Cell, FormField, TextEditor, OptionsSelect, DatePicker, CheckBox from '@ticatec/uniface-element/FormContainer, Row, Cell, FormField, TextEditor, OptionsSelect, DatePicker, CheckBox';
|
|
106
|
+
|
|
107
|
+
interface EmployeeForm {
|
|
108
|
+
personalInfo: {
|
|
109
|
+
firstName: string;
|
|
110
|
+
lastName: string;
|
|
111
|
+
gender: string;
|
|
112
|
+
birthDate: Date | null;
|
|
113
|
+
};
|
|
114
|
+
workInfo: {
|
|
115
|
+
department: string;
|
|
116
|
+
position: string;
|
|
117
|
+
startDate: Date | null;
|
|
118
|
+
};
|
|
119
|
+
contact: {
|
|
120
|
+
phone: string;
|
|
121
|
+
email: string;
|
|
122
|
+
address: string;
|
|
123
|
+
};
|
|
124
|
+
preferences: {
|
|
125
|
+
emailNotifications: boolean;
|
|
126
|
+
newsletter: boolean;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let employeeData: EmployeeForm = {
|
|
131
|
+
personalInfo: {
|
|
132
|
+
firstName: '',
|
|
133
|
+
lastName: '',
|
|
134
|
+
gender: '',
|
|
135
|
+
birthDate: null
|
|
136
|
+
},
|
|
137
|
+
workInfo: {
|
|
138
|
+
department: '',
|
|
139
|
+
position: '',
|
|
140
|
+
startDate: null
|
|
141
|
+
},
|
|
142
|
+
contact: {
|
|
143
|
+
phone: '',
|
|
144
|
+
email: '',
|
|
145
|
+
address: ''
|
|
146
|
+
},
|
|
147
|
+
preferences: {
|
|
148
|
+
emailNotifications: true,
|
|
149
|
+
newsletter: false
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const genderOptions = [
|
|
154
|
+
{ code: 'male', text: 'Male' },
|
|
155
|
+
{ code: 'female', text: 'Female' },
|
|
156
|
+
{ code: 'other', text: 'Other' }
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
const departmentOptions = [
|
|
160
|
+
{ code: 'engineering', text: 'Engineering' },
|
|
161
|
+
{ code: 'marketing', text: 'Marketing' },
|
|
162
|
+
{ code: 'sales', text: 'Sales' },
|
|
163
|
+
{ code: 'hr', text: 'Human Resources' }
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
const validateForm = (): boolean => {
|
|
167
|
+
return employeeData.personalInfo.firstName.length > 0 &&
|
|
168
|
+
employeeData.personalInfo.lastName.length > 0 &&
|
|
169
|
+
employeeData.contact.email.length > 0;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const handleSave = (): void => {
|
|
173
|
+
if (validateForm()) {
|
|
174
|
+
console.log('Save employee info:', employeeData);
|
|
175
|
+
} else {
|
|
176
|
+
alert('Please fill in required fields');
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<div class="employee-form">
|
|
182
|
+
<h2>Employee Information Form</h2>
|
|
183
|
+
|
|
184
|
+
<FormContainer fieldLayout="horizontal">
|
|
185
|
+
<!-- Personal Information Row -->
|
|
186
|
+
<Row>
|
|
187
|
+
<Cell>
|
|
188
|
+
<h3>Personal Information</h3>
|
|
189
|
+
</Cell>
|
|
190
|
+
</Row>
|
|
191
|
+
|
|
192
|
+
<Row>
|
|
193
|
+
<Cell>
|
|
194
|
+
<FormField label="First Name" required>
|
|
195
|
+
<TextEditor bind:value={employeeData.personalInfo.firstName} />
|
|
196
|
+
</FormField>
|
|
197
|
+
</Cell>
|
|
198
|
+
|
|
199
|
+
<Cell>
|
|
200
|
+
<FormField label="Last Name" required>
|
|
201
|
+
<TextEditor bind:value={employeeData.personalInfo.lastName} />
|
|
202
|
+
</FormField>
|
|
203
|
+
</Cell>
|
|
204
|
+
|
|
205
|
+
<Cell>
|
|
206
|
+
<FormField label="Gender">
|
|
207
|
+
<OptionsSelect
|
|
208
|
+
options={genderOptions}
|
|
209
|
+
keyField="code"
|
|
210
|
+
textField="text"
|
|
211
|
+
bind:value={employeeData.personalInfo.gender}
|
|
212
|
+
/>
|
|
213
|
+
</FormField>
|
|
214
|
+
</Cell>
|
|
215
|
+
</Row>
|
|
216
|
+
|
|
217
|
+
<Row>
|
|
218
|
+
<Cell>
|
|
219
|
+
<FormField label="Birth Date">
|
|
220
|
+
<DatePicker bind:value={employeeData.personalInfo.birthDate} />
|
|
221
|
+
</FormField>
|
|
222
|
+
</Cell>
|
|
223
|
+
</Row>
|
|
224
|
+
|
|
225
|
+
<!-- Work Information Row -->
|
|
226
|
+
<Row>
|
|
227
|
+
<Cell>
|
|
228
|
+
<h3>Work Information</h3>
|
|
229
|
+
</Cell>
|
|
230
|
+
</Row>
|
|
231
|
+
|
|
232
|
+
<Row>
|
|
233
|
+
<Cell>
|
|
234
|
+
<FormField label="Department">
|
|
235
|
+
<OptionsSelect
|
|
236
|
+
options={departmentOptions}
|
|
237
|
+
keyField="code"
|
|
238
|
+
textField="text"
|
|
239
|
+
bind:value={employeeData.workInfo.department}
|
|
240
|
+
/>
|
|
241
|
+
</FormField>
|
|
242
|
+
</Cell>
|
|
243
|
+
|
|
244
|
+
<Cell>
|
|
245
|
+
<FormField label="Position">
|
|
246
|
+
<TextEditor bind:value={employeeData.workInfo.position} />
|
|
247
|
+
</FormField>
|
|
248
|
+
</Cell>
|
|
249
|
+
|
|
250
|
+
<Cell>
|
|
251
|
+
<FormField label="Start Date">
|
|
252
|
+
<DatePicker bind:value={employeeData.workInfo.startDate} />
|
|
253
|
+
</FormField>
|
|
254
|
+
</Cell>
|
|
255
|
+
</Row>
|
|
256
|
+
|
|
257
|
+
<!-- Contact Information Row -->
|
|
258
|
+
<Row>
|
|
259
|
+
<Cell>
|
|
260
|
+
<h3>Contact Information</h3>
|
|
261
|
+
</Cell>
|
|
262
|
+
</Row>
|
|
263
|
+
|
|
264
|
+
<Row>
|
|
265
|
+
<Cell>
|
|
266
|
+
<FormField label="Phone">
|
|
267
|
+
<TextEditor bind:value={employeeData.contact.phone} />
|
|
268
|
+
</FormField>
|
|
269
|
+
</Cell>
|
|
270
|
+
|
|
271
|
+
<Cell>
|
|
272
|
+
<FormField label="Email" required>
|
|
273
|
+
<TextEditor bind:value={employeeData.contact.email} />
|
|
274
|
+
</FormField>
|
|
275
|
+
</Cell>
|
|
276
|
+
</Row>
|
|
277
|
+
|
|
278
|
+
<Row>
|
|
279
|
+
<Cell>
|
|
280
|
+
<FormField label="Address">
|
|
281
|
+
<TextEditor
|
|
282
|
+
multiline
|
|
283
|
+
rows={2}
|
|
284
|
+
bind:value={employeeData.contact.address}
|
|
285
|
+
/>
|
|
286
|
+
</FormField>
|
|
287
|
+
</Cell>
|
|
288
|
+
</Row>
|
|
289
|
+
|
|
290
|
+
<!-- Preferences Row -->
|
|
291
|
+
<Row>
|
|
292
|
+
<Cell>
|
|
293
|
+
<h3>Notification Preferences</h3>
|
|
294
|
+
</Cell>
|
|
295
|
+
</Row>
|
|
296
|
+
|
|
297
|
+
<Row>
|
|
298
|
+
<Cell>
|
|
299
|
+
<FormField label="">
|
|
300
|
+
<CheckBox
|
|
301
|
+
label="Receive email notifications"
|
|
302
|
+
bind:value={employeeData.preferences.emailNotifications}
|
|
303
|
+
/>
|
|
304
|
+
</FormField>
|
|
305
|
+
</Cell>
|
|
306
|
+
|
|
307
|
+
<Cell>
|
|
308
|
+
<FormField label="">
|
|
309
|
+
<CheckBox
|
|
310
|
+
label="Subscribe to company newsletter"
|
|
311
|
+
bind:value={employeeData.preferences.newsletter}
|
|
312
|
+
/>
|
|
313
|
+
</FormField>
|
|
314
|
+
</Cell>
|
|
315
|
+
</Row>
|
|
316
|
+
|
|
317
|
+
<!-- Action Buttons Row -->
|
|
318
|
+
<Row>
|
|
319
|
+
<Cell>
|
|
320
|
+
<div class="form-actions">
|
|
321
|
+
<button type="button" class="btn-secondary">
|
|
322
|
+
Cancel
|
|
323
|
+
</button>
|
|
324
|
+
<button type="button" class="btn-primary" on:click={handleSave}>
|
|
325
|
+
Save
|
|
326
|
+
</button>
|
|
327
|
+
</div>
|
|
328
|
+
</Cell>
|
|
329
|
+
</Row>
|
|
330
|
+
</FormContainer>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<style>
|
|
334
|
+
.employee-form {
|
|
335
|
+
max-width: 800px;
|
|
336
|
+
margin: 0 auto;
|
|
337
|
+
padding: 20px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.employee-form h2 {
|
|
341
|
+
margin-bottom: 30px;
|
|
342
|
+
color: #333;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.employee-form h3 {
|
|
346
|
+
margin: 20px 0 10px 0;
|
|
347
|
+
color: #666;
|
|
348
|
+
font-size: 16px;
|
|
349
|
+
border-bottom: 1px solid #e1e5e9;
|
|
350
|
+
padding-bottom: 5px;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.form-actions {
|
|
354
|
+
display: flex;
|
|
355
|
+
gap: 10px;
|
|
356
|
+
justify-content: flex-end;
|
|
357
|
+
margin-top: 20px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.btn-primary, .btn-secondary {
|
|
361
|
+
padding: 10px 20px;
|
|
362
|
+
border: none;
|
|
363
|
+
border-radius: 4px;
|
|
364
|
+
font-size: 14px;
|
|
365
|
+
cursor: pointer;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.btn-primary {
|
|
369
|
+
background: #007bff;
|
|
370
|
+
color: white;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.btn-secondary {
|
|
374
|
+
background: #6c757d;
|
|
375
|
+
color: white;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.btn-primary:hover {
|
|
379
|
+
background: #0056b3;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.btn-secondary:hover {
|
|
383
|
+
background: #545b62;
|
|
384
|
+
}
|
|
385
|
+
</style>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Responsive Row Layout
|
|
389
|
+
|
|
390
|
+
```svelte
|
|
391
|
+
<script lang="ts">
|
|
392
|
+
import { onMount } from 'svelte';
|
|
393
|
+
|
|
394
|
+
let screenWidth: number = 0;
|
|
395
|
+
|
|
396
|
+
const updateScreenWidth = (): void => {
|
|
397
|
+
screenWidth = window.innerWidth;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
onMount(() => {
|
|
401
|
+
updateScreenWidth();
|
|
402
|
+
window.addEventListener('resize', updateScreenWidth);
|
|
403
|
+
return () => window.removeEventListener('resize', updateScreenWidth);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
// Adjust layout based on screen width
|
|
407
|
+
$: fieldLayout = screenWidth < 768 ? 'vertical' : 'horizontal';
|
|
408
|
+
$: cellsPerRow = screenWidth < 768 ? 1 : (screenWidth < 1024 ? 2 : 3);
|
|
409
|
+
</script>
|
|
410
|
+
|
|
411
|
+
<FormContainer {fieldLayout}>
|
|
412
|
+
<Row>
|
|
413
|
+
{#each Array(cellsPerRow) as _, i}
|
|
414
|
+
<Cell>
|
|
415
|
+
<FormField label={`Field ${i + 1}`}>
|
|
416
|
+
<TextEditor placeholder={`Enter field ${i + 1}`} />
|
|
417
|
+
</FormField>
|
|
418
|
+
</Cell>
|
|
419
|
+
{/each}
|
|
420
|
+
</Row>
|
|
421
|
+
</FormContainer>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Component Features
|
|
425
|
+
|
|
426
|
+
### 1. Flexible Row-Column Structure
|
|
427
|
+
- **Row** component defines form rows
|
|
428
|
+
- **Cell** component defines cells within rows
|
|
429
|
+
- Free combination of row and column layouts
|
|
430
|
+
|
|
431
|
+
### 2. Multiple Layout Mode Support
|
|
432
|
+
- **Vertical layout**: Label on top, control below
|
|
433
|
+
- **Horizontal layout**: Label on left, control on right
|
|
434
|
+
|
|
435
|
+
### 3. Responsive Design Friendly
|
|
436
|
+
- Can adjust number of cells per row based on screen size
|
|
437
|
+
- Supports switching layout modes on different devices
|
|
438
|
+
|
|
439
|
+
## Comparison with FlexForm
|
|
440
|
+
|
|
441
|
+
| Feature | FlexForm | FlexRowForm |
|
|
442
|
+
|---------|----------|-------------|
|
|
443
|
+
| Structure | Simple container structure | Grid structure based on rows and columns |
|
|
444
|
+
| Layout Control | Overall layout mode | Row-by-row layout control |
|
|
445
|
+
| Complexity | Simple, suitable for basic forms | Complex, suitable for large forms |
|
|
446
|
+
| Responsiveness | Overall responsiveness | Precise control of responsive behavior per row |
|
|
447
|
+
| Use Case | Simple forms | Complex multi-section forms |
|
|
448
|
+
|
|
449
|
+
## Best Practices
|
|
450
|
+
|
|
451
|
+
### 1. Plan Row Structure Reasonably
|
|
452
|
+
```svelte
|
|
453
|
+
<!-- Group related fields in the same row -->
|
|
454
|
+
<Row>
|
|
455
|
+
<Cell><FormField label="First Name"><TextEditor /></FormField></Cell>
|
|
456
|
+
<Cell><FormField label="Last Name"><TextEditor /></FormField></Cell>
|
|
457
|
+
</Row>
|
|
458
|
+
|
|
459
|
+
<!-- Independent fields in separate rows -->
|
|
460
|
+
<Row>
|
|
461
|
+
<Cell><FormField label="Detailed Address"><TextEditor multiline /></FormField></Cell>
|
|
462
|
+
</Row>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### 2. Responsive Design
|
|
466
|
+
```svelte
|
|
467
|
+
<script lang="ts">
|
|
468
|
+
// Adjust number of fields per row based on screen size
|
|
469
|
+
$: isMobile = window.innerWidth < 768;
|
|
470
|
+
</script>
|
|
471
|
+
|
|
472
|
+
{#if isMobile}
|
|
473
|
+
<!-- Mobile: one field per row -->
|
|
474
|
+
<Row><Cell><FormField label="Name"><TextEditor /></FormField></Cell></Row>
|
|
475
|
+
<Row><Cell><FormField label="Email"><TextEditor /></FormField></Cell></Row>
|
|
476
|
+
{:else}
|
|
477
|
+
<!-- Desktop: multiple fields per row -->
|
|
478
|
+
<Row>
|
|
479
|
+
<Cell><FormField label="Name"><TextEditor /></FormField></Cell>
|
|
480
|
+
<Cell><FormField label="Email"><TextEditor /></FormField></Cell>
|
|
481
|
+
</Row>
|
|
482
|
+
{/if}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### 3. Headings and Grouping
|
|
486
|
+
```svelte
|
|
487
|
+
<FormContainer>
|
|
488
|
+
<!-- Group heading row -->
|
|
489
|
+
<Row>
|
|
490
|
+
<Cell><h3>Personal Information</h3></Cell>
|
|
491
|
+
</Row>
|
|
492
|
+
|
|
493
|
+
<!-- Related field rows -->
|
|
494
|
+
<Row>
|
|
495
|
+
<Cell><FormField label="Name"><TextEditor /></FormField></Cell>
|
|
496
|
+
<Cell><FormField label="Age"><NumberEditor /></FormField></Cell>
|
|
497
|
+
</Row>
|
|
498
|
+
</FormContainer>
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
## Style Customization
|
|
502
|
+
|
|
503
|
+
```css
|
|
504
|
+
/* Row container styles */
|
|
505
|
+
:global(.flex-row-form) {
|
|
506
|
+
display: flex;
|
|
507
|
+
flex-direction: column;
|
|
508
|
+
gap: 16px;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/* Horizontal layout styles */
|
|
512
|
+
:global(.flex-row-form.field-layout-horizontal) {
|
|
513
|
+
gap: 12px;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/* Custom row styles */
|
|
517
|
+
.custom-row {
|
|
518
|
+
padding: 10px;
|
|
519
|
+
border: 1px solid #e1e5e9;
|
|
520
|
+
border-radius: 4px;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/* Custom cell styles */
|
|
524
|
+
.custom-cell {
|
|
525
|
+
padding: 8px;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/* Responsive styles */
|
|
529
|
+
@media (max-width: 768px) {
|
|
530
|
+
:global(.flex-row-form) {
|
|
531
|
+
gap: 8px;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
## Component Advantages
|
|
537
|
+
|
|
538
|
+
1. **Precise Layout Control** - Row-by-row control of layout and field arrangement
|
|
539
|
+
2. **Structured Organization** - Clear row-column structure, easy to manage complex forms
|
|
540
|
+
3. **Highly Customizable** - Each row and cell can be independently styled
|
|
541
|
+
4. **Responsive Friendly** - Supports precise responsive layout control
|
|
542
|
+
5. **High Maintainability** - Structured organization facilitates maintenance and modifications
|