@fui-org/fui-cli 1.2.0 → 1.3.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/dist/fui-x7kph78r.js +420 -0
- package/dist/fui.js +1 -429
- package/package.json +3 -3
- package/skills/fui/SKILL.md +3 -3
- package/skills/fui-skill-cli/SKILL.md +139 -0
- package/skills/fui-skill-cli/references/INDEX.md +110 -0
- package/skills/fui-skill-cli/references/advanced-techniques.md +168 -0
- package/skills/fui-skill-cli/references/coding-standards.md +112 -0
- package/skills/fui-skill-cli/references/component-design.md +448 -0
- package/skills/fui-skill-cli/references/component-quickref.md +78 -0
- package/skills/fui-skill-cli/references/component-table.md +248 -0
- package/skills/fui-skill-cli/references/components-dialog.md +191 -0
- package/skills/fui-skill-cli/references/components-display.md +141 -0
- package/skills/fui-skill-cli/references/components-echart.md +316 -0
- package/skills/fui-skill-cli/references/components-input.md +335 -0
- package/skills/fui-skill-cli/references/controls-patterns.md +701 -0
- package/skills/fui-skill-cli/references/controls-styling-vocabulary.md +137 -0
- package/skills/fui-skill-cli/references/db-table-design.md +73 -0
- package/skills/fui-skill-cli/references/db-workflow.md +288 -0
- package/skills/fui-skill-cli/references/default-function.md +425 -0
- package/skills/fui-skill-cli/references/design-modes.md +57 -0
- package/skills/fui-skill-cli/references/echart-templates.md +489 -0
- package/skills/fui-skill-cli/references/fastproject.md +99 -0
- package/skills/fui-skill-cli/references/fsheet.md +203 -0
- package/skills/fui-skill-cli/references/fullstack-workflow.md +313 -0
- package/skills/fui-skill-cli/references/module-data-patterns.md +117 -0
- package/skills/fui-skill-cli/references/module-json-anatomy.md +132 -0
- package/skills/fui-skill-cli/references/module-structure.md +141 -0
- package/skills/fui-skill-cli/references/new-session.md +85 -0
- package/skills/fui-skill-cli/references/pdfmake.md +60 -0
- package/skills/fui-skill-cli/references/permission-system.md +150 -0
- package/skills/fui-skill-cli/references/platform-architecture.md +269 -0
- package/skills/fui-skill-cli/references/project-config.md +303 -0
- package/skills/fui-skill-cli/references/project-provisioning.md +278 -0
- package/skills/fui-skill-cli/references/script-map.md +262 -0
- package/skills/fui-skill-cli/references/sql-clr-functions.md +225 -0
- package/skills/fui-skill-cli/references/system-design.md +89 -0
- package/skills/fui-skill-cli/references/tapi-file-api.md +185 -0
- package/skills/fui-skill-cli/references/tapi-permission-patterns.md +156 -0
- package/skills/fui-skill-cli/references/tapi-reference.md +474 -0
- package/skills/fui-skill-cli/references/tools-registry.md +84 -0
- package/skills/fui-skill-cli/references/ui-crosswindow-patterns.md +321 -0
- package/skills/fui-skill-cli/references/ui-dialog-patterns.md +255 -0
- package/skills/fui-skill-cli/references/ui-layout-patterns.md +176 -0
- package/skills/fui-skill-cli/references/ui-patterns.md +303 -0
- package/skills/fui-skill-cli/references/ui-screenshot-review.md +95 -0
- package/skills/fui-skill-cli/references/ui-table-cell-patterns.md +318 -0
- package/skills/fui-skill-cli/references/ui-templates.md +22 -0
- package/skills/fui-skill-cli/references/verification.md +236 -0
- package/skills/fui-skill-cli/references/watcher-patterns.md +163 -0
- package/skills/fui-skill-cli/references/websocket-realtime.md +271 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# FUI Table Components (Source-Based)
|
|
2
|
+
|
|
3
|
+
> Owns: **`f-table` in depth: all props, auto-header, `sum-format`, readonly table**. In-cell controls (`t-*`): [ui-table-cell-patterns.md](ui-table-cell-patterns.md).
|
|
4
|
+
|
|
5
|
+
Source: `scripts/componentTable.js` (V2), `scripts/componentTable-3.0.js` (V3).
|
|
6
|
+
|
|
7
|
+
> **Check the version before writing headers** — V2/V3 field names differ; wrong names = no render. See "V2 vs V3" below.
|
|
8
|
+
|
|
9
|
+
> `f-table` does CRUD and readonly. Readonly = no `:update-api` (or `:disabled-update true`); omit `:headers` to auto-build.
|
|
10
|
+
|
|
11
|
+
## Prefix Reminder
|
|
12
|
+
|
|
13
|
+
`f-table` = FUI component · `t-*` = FUI cell renderers · `v-data-table` = Vuetify internals (CRUD/action flow comes from FUI wrappers).
|
|
14
|
+
|
|
15
|
+
## f-table
|
|
16
|
+
|
|
17
|
+
### Props (exact from source)
|
|
18
|
+
|
|
19
|
+
`value`, `headers`, `updateForm`, `updateFormAttr`, `updateApi`, `items`, `label`, `excel`, `showSearch`, `sumFormat`, `disabledHover`, `returnObject`, `itemKey`, `itemsPerPage`, `disabledUpdate`, `hideDefaultFooter`, `template`, `headercomponent`, `height`, `fixedHeader`, `fixedCols`
|
|
20
|
+
|
|
21
|
+
### Real Behavior
|
|
22
|
+
|
|
23
|
+
1. Header item with `el` → custom slot renderer created automatically.
|
|
24
|
+
2. `updateApi.new` or `updateApi['new-action']` present → add button appears.
|
|
25
|
+
3. CRUD action slots rely on header `value: "ctrl-update"`.
|
|
26
|
+
4. Edit dialog is `f-dialog` with `updateForm`.
|
|
27
|
+
5. Selection emit: `returnObject=false` → array of `itemKey`; `returnObject=true` → selected row objects.
|
|
28
|
+
6. Row events from slots: `click:row`, `mouseover:row`, `mouseleave:row`.
|
|
29
|
+
7. **Auto headers**: no `:headers` → built from `items` (see Auto Headers).
|
|
30
|
+
8. **Sum row / sum line**: `sum-format` takes a string OR object — rendered differently (see sum-format).
|
|
31
|
+
|
|
32
|
+
### Fixed left columns (`fixed-cols`)
|
|
33
|
+
|
|
34
|
+
`fixed-cols="N"` keeps the first N columns during horizontal scroll. V2 and V3. Omitted, `0`, or invalid → normal behavior.
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"el": "f-table",
|
|
39
|
+
"w": 12,
|
|
40
|
+
"attr": {
|
|
41
|
+
":items": "dsNhanVien",
|
|
42
|
+
"fixed-cols": "2",
|
|
43
|
+
":headers": [
|
|
44
|
+
{ "text": "Mã", "value": "Ma", "width": "100px" },
|
|
45
|
+
{ "text": "Họ tên", "value": "HoTen", "width": "220px" },
|
|
46
|
+
{ "text": "Phòng ban", "value": "PhongBan", "width": "180px" }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- Set `width` on each fixed column; missing → `150px`.
|
|
53
|
+
- Numeric `width` = pixels; CSS strings like `"120px"` kept as-is.
|
|
54
|
+
- `fixed-cols` counts actual rendered columns; Vuetify select/group columns, if enabled, are counted.
|
|
55
|
+
- CSS is scoped per `f-table` instance, so several tables with different fixed counts can share a page.
|
|
56
|
+
|
|
57
|
+
### Auto Headers (no `:headers`)
|
|
58
|
+
|
|
59
|
+
With `:headers` omitted, `f-table` builds headers from the first row of `items` (via `buildHeader`):
|
|
60
|
+
|
|
61
|
+
- Each key → column `{ text: key, value: key, divider: true }`; numeric values → `el: "t-num"` (right-aligned number format).
|
|
62
|
+
- `:update-api` with `edit`/`delete` and no `disabled-update` → `ctrl-update` column appended.
|
|
63
|
+
- Rebuilt whenever `items` changes shape (watch on `items`) — safe with async loads.
|
|
64
|
+
|
|
65
|
+
**Use when** columns = API fields exactly (SP aliases nice Vietnamese names). **Declare `:headers` when** labels differ from fields, columns hidden, custom `t-*` (t-time, t-check, t-link...), specific width/align, or technical fields (internal IDs, flags) must not show.
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{ "el": "f-table", "w": "12", "attr": { "label": "Kết quả", ":items": "dsKetQua", "show-search": true } }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### sum-format — column totals (2 forms)
|
|
72
|
+
|
|
73
|
+
**Form 1 — string template → ONE total text line below the table** (in `v-card-actions`, NOT inside `v-data-table`, not column-aligned):
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
"sum-format": "Tổng đăng ký: [[DangKy]] | Nhập học: [[NhapHoc]]"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- `[[FieldName]]` → `_.sumBy(items, 'FieldName')`, fixed format `'0,0'` (numeral).
|
|
80
|
+
- Single right-aligned text line below the table (separated by `v-divider`).
|
|
81
|
+
- For one summary line / several totals in one sentence.
|
|
82
|
+
- Static string → attr WITHOUT `:` prefix.
|
|
83
|
+
|
|
84
|
+
**Form 2 — object → REAL total row inside the table** (`v-data-table` slot `body.append`, aligned per column):
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
":sum-format": { "DangKy": "0,0", "NhapHoc": "0,0", "HocPhi": "0,0.0" }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- Key = column `value` in headers; value = numeral format for that column (`"0,0"`, `"0,0.0"`, `"0.0%"`, ...).
|
|
91
|
+
- Renders a final `<tr>`: cells whose column key is in the object show `_.sumBy(items, key)` in that format; others empty. All cells right-aligned, `font-weight-medium`.
|
|
92
|
+
- Aligned with columns, scrolls with the body.
|
|
93
|
+
- Object → attr WITH `:` prefix.
|
|
94
|
+
|
|
95
|
+
**Choosing:** "total row under each column / total row in table / column-aligned totals" → object. "General summary text line" → string. **NEVER build a total row manually** (no pushing a "Tổng" row into items, no hand-written body.append template) — use `sum-format`.
|
|
96
|
+
|
|
97
|
+
Full object example:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"el": "f-table",
|
|
102
|
+
"w": "12",
|
|
103
|
+
"attr": {
|
|
104
|
+
"label": "Thống kê tuyển sinh",
|
|
105
|
+
":items": "dsThongKe",
|
|
106
|
+
":headers": [
|
|
107
|
+
{ "text": "Ngành", "value": "TenNganh" },
|
|
108
|
+
{ "text": "Đăng ký", "value": "DangKy", "el": "t-num" },
|
|
109
|
+
{ "text": "Nhập học", "value": "NhapHoc", "el": "t-num" }
|
|
110
|
+
],
|
|
111
|
+
":sum-format": { "DangKy": "0,0", "NhapHoc": "0,0" }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### updateApi Keys Used By Source
|
|
117
|
+
|
|
118
|
+
`new`, `edit`, `delete`, `default-item`, `new-action`, `edit-action`, `data-out`
|
|
119
|
+
|
|
120
|
+
### Minimal CRUD Example
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"el": "f-table",
|
|
125
|
+
"w": "12",
|
|
126
|
+
"attr": {
|
|
127
|
+
"label": "Danh sach nhan vien",
|
|
128
|
+
":items": "items",
|
|
129
|
+
"item-key": "ID",
|
|
130
|
+
":return-object": false,
|
|
131
|
+
"show-search": true,
|
|
132
|
+
"excel": true,
|
|
133
|
+
":headers": [
|
|
134
|
+
{ "text": "Ho ten", "value": "FullName" },
|
|
135
|
+
{ "text": "Email", "value": "Email" },
|
|
136
|
+
{ "text": "Trang thai", "value": "Active", "el": "t-boolean", "align": "center", "width": "90px" },
|
|
137
|
+
{ "text": "Tac vu", "value": "ctrl-update", "align": "center", "width": "120px" }
|
|
138
|
+
],
|
|
139
|
+
":update-form": [
|
|
140
|
+
{ "el": "v-text-field", "attr": { "v-model": "FullName", "label": "Ho ten", ":required": true } },
|
|
141
|
+
{ "el": "v-text-field", "attr": { "v-model": "Email", "label": "Email", ":required": true } }
|
|
142
|
+
],
|
|
143
|
+
":update-api": {
|
|
144
|
+
"default-item": { "FullName": "", "Email": "", "Active": true },
|
|
145
|
+
"new": {
|
|
146
|
+
"API": "/api/staff/create",
|
|
147
|
+
"IN": { "FullName": "item.FullName", "Email": "item.Email", "Active": "item.Active" },
|
|
148
|
+
"CALLBACK": { "CALL": "apiLoadItems" }
|
|
149
|
+
},
|
|
150
|
+
"edit": {
|
|
151
|
+
"API": "/api/staff/update",
|
|
152
|
+
"IN": { "ID": "item.ID", "FullName": "item.FullName", "Email": "item.Email", "Active": "item.Active" },
|
|
153
|
+
"CALLBACK": { "CALL": "apiLoadItems" }
|
|
154
|
+
},
|
|
155
|
+
"delete": {
|
|
156
|
+
"CONFIRM": "Xac nhan xoa?",
|
|
157
|
+
"API": "/api/staff/delete",
|
|
158
|
+
"IN": { "ID": "item.ID" },
|
|
159
|
+
"CALLBACK": { "CALL": "apiLoadItems" }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Readonly Table
|
|
167
|
+
|
|
168
|
+
`f-table` without `:update-api` (no add/edit/delete buttons); omit `:headers` to auto-build:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"el": "f-table",
|
|
173
|
+
"w": "12",
|
|
174
|
+
"attr": {
|
|
175
|
+
"label": "Danh sach xem nhanh",
|
|
176
|
+
":items": "items",
|
|
177
|
+
"item-key": "ID",
|
|
178
|
+
"show-search": true,
|
|
179
|
+
"excel": true,
|
|
180
|
+
":items-per-page": 20
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## t-* Cell Renderers
|
|
186
|
+
|
|
187
|
+
Set `el` in `headers`:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{ "text": "Ngay tao", "value": "CreatedAt", "el": "t-time", "attr": { "format": "DD/MM/YYYY HH:mm" } }
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Supported: `t-html`, `t-label`, `t-num`, `t-time`, `t-boolean`, `t-check`, `t-text`, `t-select`, `t-combobox`, `t-menu`, `t-link`, `t-button`
|
|
194
|
+
|
|
195
|
+
### Notes
|
|
196
|
+
|
|
197
|
+
1. Editable renderers (`t-check`, `t-text`, `t-select`, `t-combobox`, `t-menu`, `t-button`) use `tableActionEvent`.
|
|
198
|
+
2. Opening a dialog from a row action: `target: "dialog"` plus `wid`, `url`, `title`, `onclose`.
|
|
199
|
+
3. Literal-string rule applies only in Action `IN` mapping. Static props without `:` are plain strings by default.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## V2 vs V3 (source: `componentTable.js` vs `componentTable-3.0.js`)
|
|
204
|
+
|
|
205
|
+
Framework version comes from `_projectInfo.json` or `_moduleInfo.json` — check before writing headers.
|
|
206
|
+
|
|
207
|
+
### Header field names
|
|
208
|
+
|
|
209
|
+
**Most common mistake.** V2 `text`/`value` are renamed `title`/`key` in V3:
|
|
210
|
+
|
|
211
|
+
| Field | V2 (`componentTable.js`) | V3 (`componentTable-3.0.js`) |
|
|
212
|
+
| ------------ | ------------------------ | ---------------------------- |
|
|
213
|
+
| Column label | `"text": "Tên cột"` | `"title": "Tên cột"` |
|
|
214
|
+
| Data field | `"value": "TenField"` | `"key": "TenField"` |
|
|
215
|
+
| Ctrl column | `"value": "ctrl-update"` | `"key": "ctrl-update"` |
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
// V2 ✅
|
|
219
|
+
{ "text": "Họ tên", "value": "HoTen", "el": "t-label" }
|
|
220
|
+
{ "text": "Tác vụ", "value": "ctrl-update", "align": "center" }
|
|
221
|
+
|
|
222
|
+
// V3 ✅
|
|
223
|
+
{ "title": "Họ tên", "key": "HoTen", "el": "t-label" }
|
|
224
|
+
{ "title": "Tác vụ", "key": "ctrl-update", "align": "center" }
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
> `text`/`value` on V3 → columns render but **headers vanish, sort breaks** (Vuetify 3 ignores them). No JS error — only visible in a rendered screenshot.
|
|
228
|
+
|
|
229
|
+
### Extra V3 props
|
|
230
|
+
|
|
231
|
+
| Prop | V3 default | Note |
|
|
232
|
+
| ---------------- | ----------- | ------------------------------------------------------------------------ |
|
|
233
|
+
| `density` | `'compact'` | Row density — `'compact'`/`'comfortable'`/`'default'` |
|
|
234
|
+
| `disable-sort` | `false` | Disable sorting for the whole table |
|
|
235
|
+
| `slots` | `null` | Dynamic custom slots (object `{ name, html }`) |
|
|
236
|
+
| `group-template` | `null` | Template for groups (`groupBy`) |
|
|
237
|
+
| `height` | `null` | Same as V2: null/omitted = auto-grow; ≤0 = fill to bottom; >0 = fixed px |
|
|
238
|
+
|
|
239
|
+
### sum-format object in V3
|
|
240
|
+
|
|
241
|
+
In V3 the `sum-format` object keys must match header `key` (not `value`):
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
// V3 ✅ — key = "DangKy" khớp với header { "key": "DangKy" }
|
|
245
|
+
":sum-format": { "DangKy": "0,0", "NhapHoc": "0,0" }
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Otherwise identical to V2.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# FUI Dialog & Overlay Components
|
|
2
|
+
|
|
3
|
+
> Owns: **`f-dialog`, `f-window`, `f-editor`**. Hand-built dialog pattern (`v-dialog` + hidden-container): [ui-dialog-patterns.md](ui-dialog-patterns.md).
|
|
4
|
+
|
|
5
|
+
Dialog, overlay and content-editor components. Prefix/binding rules: [components-display.md](components-display.md).
|
|
6
|
+
|
|
7
|
+
## f-window
|
|
8
|
+
|
|
9
|
+
- Props (source): `id`
|
|
10
|
+
- Internal iframe dialog host, usually opened via `openWindow(...)`
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"FUN": "openWindow",
|
|
15
|
+
"IN": {
|
|
16
|
+
"id": "`winUser",
|
|
17
|
+
"url": "'/fp/module?mid=123'",
|
|
18
|
+
"title": "Chi tiet user",
|
|
19
|
+
"width": 1100
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## f-editor
|
|
25
|
+
|
|
26
|
+
- Props (source): `value`, `imageapi`, `height`, `toolbar`
|
|
27
|
+
- Emit: `input` with HTML content
|
|
28
|
+
- Wraps CKEditor with upload auth header
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"el": "f-editor",
|
|
33
|
+
"w": "12",
|
|
34
|
+
"attr": {
|
|
35
|
+
"v-model": "formData.contentHtml",
|
|
36
|
+
"imageapi": "/api/editor/upload",
|
|
37
|
+
":height": 360
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## f-editor-dialog
|
|
43
|
+
|
|
44
|
+
- Props (source): `value`, `imageapi`, `label`, `width`, `toolbar`
|
|
45
|
+
- `value` must be an object (`open`, `text`, `object`, `ok`), not a plain string
|
|
46
|
+
- Modal editor, writes back on OK
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"el": "f-editor-dialog",
|
|
51
|
+
"w": "6",
|
|
52
|
+
"attr": {
|
|
53
|
+
":value": "editorState",
|
|
54
|
+
"label": "Noi dung mo rong",
|
|
55
|
+
":width": 1000,
|
|
56
|
+
"imageapi": "/api/editor/upload"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## f-dialog
|
|
62
|
+
|
|
63
|
+
Modal that builds a form from a `controls` array; supports local watchers, validation and action buttons.
|
|
64
|
+
|
|
65
|
+
- Props:
|
|
66
|
+
- `value` (Boolean, default `false`) — v-model open/close
|
|
67
|
+
- `data` (Object, default `{}`) — input data, bind with `:data.sync`; copied into fields when the dialog opens
|
|
68
|
+
- `dataOut` (Object, default `{}`) — output, bind with `:data-out.sync`; receives the component instance on open
|
|
69
|
+
- `title` (String, default `''`)
|
|
70
|
+
- `controls` (Array, default `[]`) — control definitions (`el`, `attr`, `w` col width); any field whose `v-model` doesn't start with `vueData.` gets local data auto-created (init `null`)
|
|
71
|
+
- `watch` (Object, default `{}`) — local watchers; key = field name, value = action run on change; registered on open, removed on close
|
|
72
|
+
- `button` (Array, default `[]`) — button definitions (below)
|
|
73
|
+
- `disableValidate` (Boolean, default `false`) — skip form validation when `true`
|
|
74
|
+
- `width` (Number, default `800`) — px
|
|
75
|
+
- `openAction` (Object, default `null`) — action run as soon as the dialog opens
|
|
76
|
+
|
|
77
|
+
- Emits:
|
|
78
|
+
- `input` — open/close (v-model)
|
|
79
|
+
- `update:data-out` — component instance on open (parent can reach local data)
|
|
80
|
+
- `update:data` — `v_outData` when a button with `getoutdata: true` is clicked (after validation passes)
|
|
81
|
+
|
|
82
|
+
- On open (`value = true`):
|
|
83
|
+
1. Reset all fields from `:data` (`setDefaultData`)
|
|
84
|
+
2. Register watchers from `watch`
|
|
85
|
+
3. Run `openAction` if set
|
|
86
|
+
4. Emit `update:data-out` with the instance
|
|
87
|
+
|
|
88
|
+
- On close (`value = false`): remove all registered watchers.
|
|
89
|
+
|
|
90
|
+
- Button object:
|
|
91
|
+
- `label` (String)
|
|
92
|
+
- `color` (String, default `"primary"`)
|
|
93
|
+
- `elevation` (Number, default `0`)
|
|
94
|
+
- `text` (Boolean, default `true`) — text button
|
|
95
|
+
- `type` (String) — e.g. `"submit"`
|
|
96
|
+
- `:disabled` (String) — Vue expression, e.g. `"!checkBoxValue"`
|
|
97
|
+
- `v-if` (String) — Vue expression to show/hide, e.g. `"ModuleID==1"`
|
|
98
|
+
- `icon-text` (String) — MDI icon left of the label
|
|
99
|
+
- `checkvalid` (Boolean) — validate before running the action; stop if invalid
|
|
100
|
+
- `getoutdata` (Boolean) — sync field values into `v_outData` then emit `update:data`; also triggers validation
|
|
101
|
+
- `action` (Array | Function) — actions run on click; context = all `v_outData` fields plus `dData` pointing to `v_outData`
|
|
102
|
+
|
|
103
|
+
- Notes:
|
|
104
|
+
- Button clicks debounced 500ms (leading edge) against double-click
|
|
105
|
+
- Controls support `br: true` for a row break
|
|
106
|
+
- Template is built statically at `data()` init; no re-render when `controls` changes
|
|
107
|
+
- In the template, `watch` is `:watch` (dynamic bind), not Vue's default `watch`
|
|
108
|
+
- **Never put `f-dialog` inside a component template:** it works only when declared directly in the module JSON `controls`; inside a Vue component it misbehaves.
|
|
109
|
+
- **Declare `vueData` variables before binding them in controls:** a control bound to `vueData.someVar` needs that variable declared in the module `data` first — Vue can't make a variable reactive if it doesn't exist at init.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
"data": [
|
|
113
|
+
{ "projectList": [] }
|
|
114
|
+
],
|
|
115
|
+
"controls": [
|
|
116
|
+
{
|
|
117
|
+
"prop": "fluid pa-0",
|
|
118
|
+
"rows": [{ "prop": "", "cols": [
|
|
119
|
+
{
|
|
120
|
+
"el": "v-autocomplete",
|
|
121
|
+
"attr": {
|
|
122
|
+
"v-model": "pid",
|
|
123
|
+
"label": "Module name",
|
|
124
|
+
":items": "vueData.projectList",
|
|
125
|
+
"item-text": "ModuleName",
|
|
126
|
+
"item-value": "ModuleID"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]}]
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- Full example:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"el": "f-dialog",
|
|
139
|
+
"attr": {
|
|
140
|
+
"v-model": "dialogOpen",
|
|
141
|
+
":data.sync": "dialogData",
|
|
142
|
+
"title": "Nhap du lieu",
|
|
143
|
+
":open-action": { "MESSBOX": "Bạn vừa mở dialog" },
|
|
144
|
+
":controls": [
|
|
145
|
+
{ "el": "v-text-field", "attr": { "v-model": "Domain", "label": "Domain" }, "w": 4 },
|
|
146
|
+
{ "el": "v-text-field", "attr": { "v-model": "ModuleID", "label": "ModuleID" }, "w": 3 },
|
|
147
|
+
{ "el": "v-text-field", "attr": { "v-model": "ModuleName", "label": "ModuleName" }, "w": 8 },
|
|
148
|
+
{
|
|
149
|
+
"el": "v-checkbox",
|
|
150
|
+
"attr": { ":label": "`Tôi đã hiểu và đồng ý: ${checkBoxValue}`", "v-model": "checkBoxValue" }
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"el": "v-select",
|
|
154
|
+
"attr": {
|
|
155
|
+
"label": "select",
|
|
156
|
+
"v-model": "bienselect",
|
|
157
|
+
":items": "vueData.Mang",
|
|
158
|
+
"item-text": "AppName",
|
|
159
|
+
"item-value": "AppListID"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
":watch": {
|
|
164
|
+
"bienselect": { "MESSBOX": "Watch Select {{bienselect}}" },
|
|
165
|
+
"Domain": { "MESSBOX": "Watch textbox {{Domain}}" }
|
|
166
|
+
},
|
|
167
|
+
":button": [
|
|
168
|
+
{
|
|
169
|
+
"label": "Submit OK",
|
|
170
|
+
"type": "submit",
|
|
171
|
+
":disabled": "!checkBoxValue",
|
|
172
|
+
"action": [
|
|
173
|
+
{ "ModuleName": "gan gia tri cho ModuleName" },
|
|
174
|
+
{ "MESSBOX": "thong bao 1" },
|
|
175
|
+
{ "dialogOpen": false }
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"label": "Chay mot API",
|
|
180
|
+
"checkvalid": true,
|
|
181
|
+
"v-if": "ModuleID==1",
|
|
182
|
+
"action": [{ "API": "/chaymotapi" }]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"label": "Close",
|
|
186
|
+
"action": [{ "dialogOpen": false }]
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# FUI Display & Presentation Components
|
|
2
|
+
|
|
3
|
+
> Owns: **display components: `f-label`, `f-title`, `f-box`, `f-header`, `f-slider`, chip/badge**.
|
|
4
|
+
|
|
5
|
+
Components for showing info, charts, media. Also holds prefix/binding rules for all f-* components.
|
|
6
|
+
|
|
7
|
+
## Prefix and binding rules
|
|
8
|
+
|
|
9
|
+
- `f-*`: FUI components (FUI runtime)
|
|
10
|
+
- `v-*`: Vuetify components
|
|
11
|
+
- `uc-*`: custom module components from `components/`
|
|
12
|
+
- In `module.json`, pass props via `attr`
|
|
13
|
+
- Kebab-case in JSON for custom props (`api-upload`, `item-value`)
|
|
14
|
+
- Dynamic values use `:prop`
|
|
15
|
+
- Use `v-on:*` in JSON (not `@*`)
|
|
16
|
+
- Props without `:` (e.g. `url`, `api-upload`) are plain strings by default
|
|
17
|
+
- Literal-string forcing (backtick/quote) only in Action `IN` mappings, never for static props
|
|
18
|
+
|
|
19
|
+
## Minimal control pattern
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"el": "f-date",
|
|
24
|
+
"w": "6",
|
|
25
|
+
"attr": {
|
|
26
|
+
"v-model": "formData.fromDate",
|
|
27
|
+
"label": "From date"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## f-label
|
|
35
|
+
|
|
36
|
+
- Props (source): `items`, `text`, `color`, `iconText`
|
|
37
|
+
- Renders `v-chip` from `text` and/or `items`
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"el": "f-label",
|
|
42
|
+
"w": "12",
|
|
43
|
+
"attr": {
|
|
44
|
+
"text": "Trang thai",
|
|
45
|
+
"icon-text": "mdi-information"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## f-box
|
|
51
|
+
|
|
52
|
+
- Props (source): `rowFormat`, `items`, `label`, `edit`, `saveclick`
|
|
53
|
+
- Emits `input` when internal data changes
|
|
54
|
+
- Displays/edits key-value rows; auto-builds row format from data if missing
|
|
55
|
+
- `rowFormat`: array of `{ text, value, noEdit }` — `noEdit: true` locks that column when `edit=true`
|
|
56
|
+
- `items`: object or array; an object is auto-wrapped into a 1-element array
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"el": "f-box",
|
|
61
|
+
"w": "12",
|
|
62
|
+
"attr": {
|
|
63
|
+
"label": "Thong tin",
|
|
64
|
+
":items": "detailData",
|
|
65
|
+
":edit": "isEditMode",
|
|
66
|
+
":row-format": [
|
|
67
|
+
{ "text": "Mã", "value": "StudentID", "noEdit": true },
|
|
68
|
+
{ "text": "Họ tên", "value": "FullName" },
|
|
69
|
+
{ "text": "Ngày sinh", "value": "BirthDate" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## f-header
|
|
76
|
+
|
|
77
|
+
- Props (source): `label`
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"el": "f-header",
|
|
82
|
+
"w": "12",
|
|
83
|
+
"attr": { "label": "Bao cao tong hop" }
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## f-title
|
|
88
|
+
|
|
89
|
+
- Props (source): `label`
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"el": "f-title",
|
|
94
|
+
"w": "12",
|
|
95
|
+
"attr": { "label": "Danh sach ho so" }
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## f-slider
|
|
100
|
+
|
|
101
|
+
- Props (source): `items`, `itemAttr`
|
|
102
|
+
- Wraps `v-carousel` and `v-carousel-item`
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"el": "f-slider",
|
|
107
|
+
"w": "12",
|
|
108
|
+
"attr": {
|
|
109
|
+
":items": "slideItems",
|
|
110
|
+
":item-attr": { "contain": true }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## f-echart
|
|
116
|
+
|
|
117
|
+
→ See [`components-echart.md`](components-echart.md) — props, config, global `FEchartFormatter` module, examples.
|
|
118
|
+
|
|
119
|
+
## f-pdfmake
|
|
120
|
+
|
|
121
|
+
- Props (source): `data`
|
|
122
|
+
- Renders PDF in an iframe; re-renders when `data` changes (deep watch)
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"el": "f-pdfmake",
|
|
127
|
+
"w": "12",
|
|
128
|
+
"attr": {
|
|
129
|
+
":data": "pdfDefinition",
|
|
130
|
+
"height": "550"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Practical notes
|
|
138
|
+
|
|
139
|
+
1. Most `f-*` components forward unknown attrs via `v-bind="$attrs"` — Vuetify attrs still work when the child is a Vuetify control.
|
|
140
|
+
2. The literal-string rule applies only to API/path strings in Action `IN` mappings.
|
|
141
|
+
3. See `references/component-table.md` for `f-table`.
|