@fui-org/fui-cli 1.2.1 → 1.3.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.
Files changed (51) hide show
  1. package/dist/fui-y8an39cn.js +420 -0
  2. package/dist/fui.js +1 -429
  3. package/package.json +7 -3
  4. package/skills/fui/SKILL.md +3 -3
  5. package/skills/fui-skill-cli/SKILL.md +139 -0
  6. package/skills/fui-skill-cli/references/INDEX.md +110 -0
  7. package/skills/fui-skill-cli/references/advanced-techniques.md +168 -0
  8. package/skills/fui-skill-cli/references/coding-standards.md +112 -0
  9. package/skills/fui-skill-cli/references/component-design.md +448 -0
  10. package/skills/fui-skill-cli/references/component-quickref.md +78 -0
  11. package/skills/fui-skill-cli/references/component-table.md +248 -0
  12. package/skills/fui-skill-cli/references/components-dialog.md +191 -0
  13. package/skills/fui-skill-cli/references/components-display.md +141 -0
  14. package/skills/fui-skill-cli/references/components-echart.md +316 -0
  15. package/skills/fui-skill-cli/references/components-input.md +335 -0
  16. package/skills/fui-skill-cli/references/controls-patterns.md +701 -0
  17. package/skills/fui-skill-cli/references/controls-styling-vocabulary.md +137 -0
  18. package/skills/fui-skill-cli/references/db-table-design.md +73 -0
  19. package/skills/fui-skill-cli/references/db-workflow.md +288 -0
  20. package/skills/fui-skill-cli/references/default-function.md +425 -0
  21. package/skills/fui-skill-cli/references/design-modes.md +57 -0
  22. package/skills/fui-skill-cli/references/echart-templates.md +489 -0
  23. package/skills/fui-skill-cli/references/fastproject.md +99 -0
  24. package/skills/fui-skill-cli/references/fsheet.md +203 -0
  25. package/skills/fui-skill-cli/references/fullstack-workflow.md +313 -0
  26. package/skills/fui-skill-cli/references/module-data-patterns.md +117 -0
  27. package/skills/fui-skill-cli/references/module-json-anatomy.md +132 -0
  28. package/skills/fui-skill-cli/references/module-structure.md +141 -0
  29. package/skills/fui-skill-cli/references/new-session.md +85 -0
  30. package/skills/fui-skill-cli/references/pdfmake.md +60 -0
  31. package/skills/fui-skill-cli/references/permission-system.md +150 -0
  32. package/skills/fui-skill-cli/references/platform-architecture.md +269 -0
  33. package/skills/fui-skill-cli/references/project-config.md +303 -0
  34. package/skills/fui-skill-cli/references/project-provisioning.md +278 -0
  35. package/skills/fui-skill-cli/references/script-map.md +262 -0
  36. package/skills/fui-skill-cli/references/sql-clr-functions.md +225 -0
  37. package/skills/fui-skill-cli/references/system-design.md +89 -0
  38. package/skills/fui-skill-cli/references/tapi-file-api.md +185 -0
  39. package/skills/fui-skill-cli/references/tapi-permission-patterns.md +156 -0
  40. package/skills/fui-skill-cli/references/tapi-reference.md +474 -0
  41. package/skills/fui-skill-cli/references/tools-registry.md +84 -0
  42. package/skills/fui-skill-cli/references/ui-crosswindow-patterns.md +321 -0
  43. package/skills/fui-skill-cli/references/ui-dialog-patterns.md +255 -0
  44. package/skills/fui-skill-cli/references/ui-layout-patterns.md +176 -0
  45. package/skills/fui-skill-cli/references/ui-patterns.md +303 -0
  46. package/skills/fui-skill-cli/references/ui-screenshot-review.md +95 -0
  47. package/skills/fui-skill-cli/references/ui-table-cell-patterns.md +318 -0
  48. package/skills/fui-skill-cli/references/ui-templates.md +22 -0
  49. package/skills/fui-skill-cli/references/verification.md +236 -0
  50. package/skills/fui-skill-cli/references/watcher-patterns.md +163 -0
  51. package/skills/fui-skill-cli/references/websocket-realtime.md +271 -0
@@ -0,0 +1,316 @@
1
+ # f-echart — ECharts V5 (Core)
2
+
3
+ > Owns: **`f-echart` core: import, architecture, props, config, theme, DataView, common errors**. Per-chart templates + module.json patterns: [echart-templates.md](echart-templates.md).
4
+
5
+ Use `f-echart` for all charts: bar, line, pie, scatter, gauge, radar, heatmap, sankey, tree, map, graph...
6
+
7
+ > ⚠️ `:option`/`:config` most often break **"`:attr` takes a pure expression only"**. Multi-step option building → `script.js` function called via `EXE`; no IIFE / `var` / `return` in JSON (⇒ blank page, 0 JS errors, 0 Vue warnings). See [advanced-techniques.md](advanced-techniques.md) §1.
8
+
9
+ ---
10
+
11
+ ## Import — required, in order
12
+
13
+ Missing → no component, blank page.
14
+
15
+ ```
16
+ 1. /include/chart/echarts.min.js ← ECharts core (phải đứng TRƯỚC)
17
+ 2. /include/chart/fechart.js ← FUI wrapper (phải đứng SAU)
18
+ ```
19
+
20
+ `fui import list` → `fui import new` → `fui import delete`: [component-quickref.md](component-quickref.md). Sort = load order; `fechart.js` needs global `echarts` → **larger sort** (e.g. 100 / 110).
21
+
22
+ ---
23
+
24
+ ## Architecture — Direct Mode only
25
+
26
+ Built **entirely on Apache ECharts V5**; `fechart.js` is a thin wrapper (themes, `config` shortcuts, DataView, events). **`option` is plain ECharts option** — use ECharts knowledge; only `config` is FUI-specific. No Auto mode, no `config.type`.
27
+
28
+ - `option` — **primary**, full ECharts option → `echarts.setOption()`.
29
+ - `config` — FUI shortcuts (height, theme, title, toolbox...); defaults, overridden by `option`.
30
+
31
+ **Merge:** `config` base, then lodash `_.merge` with `option`: objects deep-merge, primitives replace, **arrays merge by index, NOT replace** ⚠️. `config` produces only `color` (`config.color`) and `dataZoom` (`config.zoom`); with both `config.color` and `option.color` the shorter can't drop the longer's tail:
32
+
33
+ ```js
34
+ config.color = ["#111", "#222", "#333", "#444"];
35
+ option.color = ["#aaa", "#bbb"];
36
+ // → ['#aaa','#bbb','#333','#444'] ← 2 màu cũ còn sót lại
37
+ ```
38
+
39
+ ⇒ Palette in **one place** (prefer `config.color`). `series`/`xAxis`/`yAxis`/`grid` never come from `config` — declare freely.
40
+
41
+ Rendered with `setOption(opt, true)` (**notMerge**): each render replaces the whole option.
42
+
43
+ ---
44
+
45
+ ## DEFAULT conventions (apply unprompted, unless user asks otherwise)
46
+
47
+ 1. **Show values** — bar: `label: { show: true, position: 'top' }` (horizontal → `'right'`); line: `label: { show: true, position: 'top' }`.
48
+ 2. **Grid**: axis charts default `left: 0`, `right: 0`, `top: 50`, `bottom: 50` (top/bottom auto-grow for title/legend). Declare only sides the user wants changed; `containLabel: true` if labels may clip.
49
+ 3. **Full numbers** (`1,500,000`), no `1.5M`/`1.2k` unless asked; tooltip default `formatFull` is correct — don't override.
50
+ 4. **Pie**: no long messy labelLines; short labels (name + % if needed) or rely on legend + tooltip.
51
+ 5. **No hand-built "View data" button** — `config.dataView: true`.
52
+
53
+ ---
54
+
55
+ ## Props
56
+
57
+ Only `config` (Object, `{}`) and `option` (Object, `{}`, primary). **No `data` prop.**
58
+
59
+ ## config keys
60
+
61
+ | Key | Default | Notes |
62
+ | -------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
63
+ | `height` | `400` | number = px; string e.g. `'50vh'` |
64
+ | `theme` | `'fui'` | **Only** `'fui'`\|`'shine'`\|`'v5'`; others (incl. `echarts.registerTheme` names) or `null` **silently → `'fui'`**. Recolor via `config.color` |
65
+ | `backgroundColor` | `'transparent'` | |
66
+ | `title` / `subtitle` | | → `option.title.text` / `.subtext` |
67
+ | `titleAlign` | `'center'` | `'left'`/`'center'`/`'right'` (old alias `titleLeft`) |
68
+ | `titleSize` | `16` | px |
69
+ | `titleColor` | | empty = theme |
70
+ | `titleWeight` | `'bold'` | `'normal'`/`'bold'`/`500`... |
71
+ | `titleFont` | | font-family, title + subtitle |
72
+ | `titleStyle` | | full ECharts textStyle — **wins over all `title*`** |
73
+ | `subtitleSize` / `subtitleColor` / `subtitleStyle` | `12` | same, subtitle |
74
+ | `color` | | palette (string[]) |
75
+ | `animation` | | `false` = off |
76
+ | `animationDuration` / `animationEasing` | | ms / ECharts easing |
77
+ | `legend` | | `false` hide; `true`/Object show, merged with `{ type:'scroll', left:'center' }`. **No top/bottom** — engine sets it |
78
+ | `legendPosition` | `'bottom'` | `'top'`/`'bottom'`; **only when legend enabled via `config.legend`/`config.legendConfig`** |
79
+ | `legendRows` | `1` | rows to reserve; >1 when items wrap. Any legend declaration |
80
+ | `legendConfig` | | extra legend props (after `legend`) |
81
+ | `tooltip` | | merged into `{ confine: true }`. **No default `trigger`** → `'item'`; multi-series axis charts need `tooltip: { trigger: 'axis' }` in `option` |
82
+ | `tooltipFormat` | `'auto'` | `'number'`/`'percent'`/`'currency'`/`'short'`/`'auto'`; `'auto'` = full with separators; `'short'` = `1.5M`, only if asked |
83
+ | `decimals` | | for `'number'`/`'percent'`/`'currency'` |
84
+ | `symbol` | `'₫'` | for `'currency'` |
85
+ | `tooltipFormatter` | | Function, **wins over `tooltipFormat`** |
86
+ | `toolbox` | `false` | saveAsImage + restore |
87
+ | `toolboxConfig` | | override/extend toolbox |
88
+ | `dataView` | `false` | table button (Vue overlay), data from `option` |
89
+ | `zoom` | | dataZoom inside + slider |
90
+ | `zoomConfig` | | Array, override dataZoom |
91
+ | `refreshInterval` | | ms auto-refresh |
92
+
93
+ **Default tooltip needs no config** (centered category title; dot + left label + right value; full numbers `2,535` not `2.5K`). Use `tooltipFormat`/`tooltipFormatter` only for another format.
94
+
95
+ ---
96
+
97
+ ## Grid padding vs `boundaryGap`
98
+
99
+ - Plot area ↔ canvas edge → `option.grid.top`/`bottom`/`left`/`right`.
100
+ - First/last point/bar ↔ axis ends → `boundaryGap` on that `xAxis`/`yAxis`.
101
+
102
+ No `padding` prop; `boundaryGap` doesn't replace `grid`. Numbers = px, `'10%'` = percent. Cartesian default:
103
+
104
+ ```js
105
+ grid: { top: 50, bottom: 50, left: 0, right: 0 }
106
+ ```
107
+
108
+ `top`/`bottom` are minimums (engine grows them for title/legend). A side declared in `option.grid` wins and is no longer auto-computed. Only horizontal change → declare only those:
109
+
110
+ ```js
111
+ grid: { left: 12, right: 24, containLabel: true }
112
+ ```
113
+
114
+ Exact values for all four → declare all four; check title/legend don't overlap:
115
+
116
+ ```js
117
+ grid: { top: 40, bottom: 60, left: 12, right: 24, containLabel: true }
118
+ ```
119
+
120
+ `containLabel: true` keeps long/edge axis labels inside. `grid` affects only axis charts; pie, funnel, treemap, sankey, graph ignore it → `series.top`/`bottom`/`left`/`right` (or `center`/`radius`).
121
+
122
+ No `boundaryGap` set by `fechart.js`; ECharts defaults: `category` → `true`; `value`/`time`/`log` → `[0, 0]`. Line touching both category ends:
123
+
124
+ ```js
125
+ xAxis: { type: 'category', boundaryGap: false, data: labels }
126
+ ```
127
+
128
+ Bars usually keep `true`. Horizontal bar → `yAxis.boundaryGap`. Value/time margins:
129
+
130
+ ```js
131
+ xAxis: { type: 'time', boundaryGap: ['5%', '5%'] }
132
+ ```
133
+
134
+ "Blank space at line ends" → `boundaryGap`; "padding around chart/canvas" → `grid`.
135
+
136
+ ---
137
+
138
+ ## Vertical layout engine
139
+
140
+ ECharts places title/legend/plot absolutely. After merge, `f-echart` stacks top-down and bottom-up: each present block takes **its height + a gap**; remainder = plot.
141
+
142
+ | Constant | px |
143
+ | ---------------------- | ----------------------------------------- |
144
+ | padding to canvas edge | 8 |
145
+ | min gap between blocks | 12 |
146
+ | grid left / right | 0 / 0 (overridable) |
147
+ | grid top / bottom min | 50 / 50 |
148
+ | title height | `round(fontSize × 1.4)` (16px → 22) |
149
+ | subtitle height | `4 + round(fontSize × 1.4)` (12px → 4+17) |
150
+ | legend row | 24 × `legendRows` |
151
+ | x-axis label reserve | +26 to `grid.bottom` |
152
+ | y-axis label reserve | +10 to `grid.top` |
153
+
154
+ Axis charts get the remainder as `grid.top`/`grid.bottom`; **pie / funnel / treemap / sankey / graph** as `series.top`/`series.bottom`, except a series with px `center` (left untouched).
155
+
156
+ Measured (axis chart, default title):
157
+
158
+ | Config | `title.top` | `legend` | `grid.top` | `grid.bottom` |
159
+ | -------------------------------- | ----------- | ----------- | ---------- | ------------- |
160
+ | no title, no legend | — | — | 50 | 50 |
161
+ | title only | 8 | — | 52 | 50 |
162
+ | title + `config.legend: true` | 8 | `bottom: 8` | 52 | 70 |
163
+ | title + `legendPosition:'top'` | 8 | `top: 42` | 88 | 50 |
164
+ | as above + `legendRows: 2` | 8 | `top: 42` | 112 | 50 |
165
+ | title `titleSize: 24` + subtitle | 8 | — | 85 | 50 |
166
+
167
+ **Legend edge, first match wins:**
168
+
169
+ 1. `legend.top` set → top; `legend.bottom` set → bottom (value kept).
170
+ 2. Enabled via `config.legend`/`config.legendConfig` → `config.legendPosition` (default **`'bottom'`**).
171
+ 3. Only in `option.legend` → **top**; ⚠️ `config.legendPosition` ignored — use `option.legend.bottom: 0` or `config.legend: true`.
172
+
173
+ Don't tweak `grid.top`/`grid.bottom`/`legend.top` to dodge a title — space is re-added. **Module-declared values are always kept** (`grid.top: 5` stays; later blocks stack from it) → declare only for a custom layout. Wrapping legend → `legendRows`.
174
+
175
+ Limits: only **px numbers** are computed (`'10%'`/`'middle'` keep just a minimum); array `option.grid` (multi-grid) is ignored — module handles layout.
176
+
177
+ ---
178
+
179
+ ## DataView
180
+
181
+ `config.dataView: true` → table icon top-right → overlay table. Data from `option.dataset.source` (object-array or array-of-arrays), else `option.series[].data` + `xAxis.data`/`yAxis.data`; none → button hidden.
182
+
183
+ ```json
184
+ {
185
+ "el": "f-echart",
186
+ "w": "12",
187
+ "attr": {
188
+ ":config": "{ title: 'Doanh thu', dataView: true, height: 350 }",
189
+ ":option": "vueData.chartOpt"
190
+ }
191
+ }
192
+ ```
193
+
194
+ Custom **Vue overlay**, **not** ECharts toolbox DataView (`config.toolbox: true` = saveAsImage + restore only). Omit without a clear series array (single-value gauge, sankey node/link, hierarchical tree...).
195
+
196
+ ---
197
+
198
+ ## Series auto-enhancement (theme policy)
199
+
200
+ | Policy | Applies to | Effect |
201
+ | ----------- | -------------------------- | ------------------------------------------------------------------------------------------- |
202
+ | `lighten` | `bar`, `pie`, `funnel` | 50% lighter fill + original-color border; bar per-series, pie/funnel per-item palette color |
203
+ | `separator` | `treemap`, `sunburst` | faint white border between cells/layers |
204
+ | `outline` | `scatter`, `effectScatter` | white outline around points |
205
+
206
+ Disable: bar → `itemStyle.color` in `option.series[]`; pie item → `itemStyle.color` on each `data[]` item; separator/outline → `itemStyle.borderWidth: 0` in `option.series[]`.
207
+
208
+ ---
209
+
210
+ ## Theme
211
+
212
+ Built in: `'fui'` (56 colors, **default**), `'shine'` (8, classic axis, strong colors), `'v5'` (9, ECharts V5 default).
213
+
214
+ ```json
215
+ ":config": "{ theme: 'shine' }"
216
+ ":config": "{ theme: 'v5' }"
217
+ ```
218
+
219
+ ⚠️ **Only these three.** Other names (incl. `echarts.registerTheme('myTheme', …)`) and `null` **silently → `'fui'`**, no error. Recolor with `config.color` (also read by auto-enhancement):
220
+
221
+ ```json
222
+ ":config": "{ color: ['#e63946', '#457b9d', '#2a9d8f'] }"
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Events & methods
228
+
229
+ Events: `chart-click` (params) · `drilldown` (alias) · `legend-change` (params) · `rendered` (after each `setOption`) · `finished` (animation done).
230
+
231
+ ```json
232
+ { "v-on:drilldown": "CALL(vueData.loadDetail, { row: $event })" }
233
+ ```
234
+
235
+ ```js
236
+ this.$refs.myChart.getInstance(); // ECharts instance gốc
237
+ this.$refs.myChart.refresh(); // Force re-render (gọi lại setOption)
238
+ this.$refs.myChart.exportImage("chart.png");
239
+ this.$refs.myChart.resizeChart(); // Hiếm khi cần — xem ghi chú dưới
240
+ ```
241
+
242
+ `resizeChart()` rarely needed: listens to `window.resize` **and** a `ResizeObserver` on its container (Vuetify grid settle, tab/dialog open, sidebar collapse).
243
+
244
+ ```js
245
+ // Native ECharts API
246
+ const chart = vueData.$refs.myChart.getInstance();
247
+ chart.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: 2 });
248
+ chart.on("mouseover", (p) => {
249
+ vueData.hoverLabel = p.name;
250
+ });
251
+ ```
252
+
253
+ ---
254
+
255
+ ## FEchartFormatter (global, script.js) — exactly 6 functions
256
+
257
+ ```js
258
+ FEchartFormatter.build("currency", { symbol: "₫", decimals: 0 })(1500000); // → '₫1,500,000'
259
+ FEchartFormatter.formatShort(1500000); // → '1.5M' (co gọn — chỉ dùng khi cần tiết kiệm chỗ, vd axis label)
260
+ FEchartFormatter.formatNumber(1500000); // → '1,500,000' (decimals thứ 2, mặc định 0)
261
+ FEchartFormatter.formatFull(2535.678); // → '2,535.68' (đầy đủ, tối đa 2 số thập phân — mặc định của tooltip)
262
+ // Tạo tooltip formatter từ config.tooltipFormat ('auto'/không khai → formatFull, số đầy đủ)
263
+ FEchartFormatter.buildTooltip({ tooltipFormat: "currency", symbol: "₫" });
264
+ FEchartFormatter.buildDefault(); // formatter tooltip mặc định (formatFull)
265
+ ```
266
+
267
+ - **No** `formatPercent`/`formatCurrency` → `build('percent', { decimals })` / `build('currency', { symbol, decimals })`.
268
+ - Bare `FEchartFormatter` only; `window.FEchartFormatter` is `undefined` (script-level `const`).
269
+
270
+ ---
271
+
272
+ ## Sorting
273
+
274
+ No `config.sort`; sort in `script.js` before assigning. Never ECharts `dataset.transform sort` on object-arrays (unstable in V5).
275
+
276
+ ```js
277
+ vueData.rows = (d.data || []).slice().sort((a, b) => b.doanhThu - a.doanhThu);
278
+ // String sort
279
+ vueData.rows = (d.data || []).slice().sort((a, b) => a.name.localeCompare(b.name));
280
+ ```
281
+
282
+ ---
283
+
284
+ ## module.json pattern
285
+
286
+ ```json
287
+ {
288
+ "el": "f-echart",
289
+ "w": "12",
290
+ "attr": {
291
+ ":config": "{ title: 'Tiêu đề', height: 350, dataView: true }",
292
+ ":option": "vueData.chartOpt"
293
+ }
294
+ }
295
+ ```
296
+
297
+ Build `vueData.chartOpt` in `script.js` (fetch callback). Per-type templates + 5 patterns (inline, vueData ref, dynamic height, conditional option, no-dataview): [echart-templates.md](echart-templates.md).
298
+
299
+ ---
300
+
301
+ ## Common errors
302
+
303
+ | Symptom | Cause | Fix |
304
+ | ------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
305
+ | Blank page / no component | `fechart.js` not imported | `fui import list` → add |
306
+ | `echarts is not defined` | `fechart.js` sort < `echarts.min.js` | swap sorts |
307
+ | Empty chart with data | data outside `option` (no `data` prop) | `option.series` |
308
+ | No DataView button | nothing extractable from `option` | add series/axis data |
309
+ | Pale bar fill | lighten (50%) | `itemStyle.color` in `option.series[]` |
310
+ | No update on filter change | `config`/`option` are **deep-watched** ⇒ variable **not declared in `data[]`** | declare in module.json `data[]`; at worst `$refs.myChart.refresh()` |
311
+ | `config.type` ignored | doesn't exist | `option.series[].type` |
312
+ | Custom theme ignored | silently `'fui'` | `config.color` |
313
+ | Stray colors | palette in both `config.color` and `option.color` | one place |
314
+ | Legend on top despite `legendPosition: 'bottom'` | legend in `option`, not `config.legend` | `option.legend.bottom: 0` or `config.legend: true` |
315
+ | Tooltip shows 1 series | no default `trigger` | `tooltip: { trigger: 'axis' }` in `option` |
316
+ | Multi-row legend overlaps | engine reserves **1 row** | `config.legendRows: 2`+ |
@@ -0,0 +1,335 @@
1
+ # FUI Input & Interaction Components
2
+
3
+ > Owns: **input components: `f-date`, `f-time`, `f-search`, `f-radiobox`, `f-button`, `f-menu`, upload**.
4
+
5
+ Components for input and user interaction. Prefix/binding rules: [components-display.md](components-display.md).
6
+
7
+ ## f-radiobox
8
+
9
+ - Props (source): `label`, `items`, `itemValue`, `itemText`
10
+ - Emit: `input` on change
11
+
12
+ ```json
13
+ {
14
+ "el": "f-radiobox",
15
+ "w": "6",
16
+ "attr": {
17
+ "label": "Loai",
18
+ "v-model": "formData.loai",
19
+ ":items": "loaiOptions",
20
+ "item-value": "value",
21
+ "item-text": "text"
22
+ }
23
+ }
24
+ ```
25
+
26
+ ## f-menu
27
+
28
+ - Props (source): `items`, `label`, `iconText`, `menuAttr`
29
+ - Dropdown button with menu items; `label` empty/undefined → icon-only button
30
+ - `items`: array of `{ text, visible, color, "icon-text", action, href, target }`
31
+ - `action`: FUI action object, run via `runAction`
32
+ - `href` + `target`: navigate like `<a>`
33
+ - `visible`: show/hide item (default `true`)
34
+
35
+ ```json
36
+ {
37
+ "el": "f-menu",
38
+ "w": "3",
39
+ "attr": {
40
+ "label": "Tac vu",
41
+ "icon-text": "mdi-dots-vertical",
42
+ ":items": [
43
+ { "text": "Xem chi tiết", "icon-text": "mdi-eye", "action": { "CALL": "vueData.viewDetail" } },
44
+ { "text": "Xuất Excel", "icon-text": "mdi-file-excel", "action": { "CALL": "vueData.exportExcel" } },
45
+ { "text": "Trang chủ", "icon-text": "mdi-home", "href": "/", "target": "_blank" }
46
+ ]
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## f-search
52
+
53
+ - Props (source): `api`, `apiData`, `items`
54
+ - Emit: `input` when selection changes
55
+ - Debounced API search (500ms); keywords < 2 chars ignored
56
+
57
+ ```json
58
+ {
59
+ "el": "f-search",
60
+ "w": "6",
61
+ "attr": {
62
+ "v-model": "filter.userID",
63
+ "api": "/api/user/search",
64
+ ":api-data": { "Keyword": "TEXT", "GroupID": "vueData.groupID" },
65
+ "item-text": "UserName",
66
+ "item-value": "UserID"
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## f-button
72
+
73
+ - Props (source): `label`, `checkvalid`, `ctrlhotkey`, `iconText`, `action`, `includeData`
74
+ - Debounced click (500ms, leading); validates form when `checkvalid=true`
75
+ - `$attrs.target == 'dialog'` → opens a window from attrs (`wid`, `title`, `url`, `onclose`)
76
+
77
+ ```json
78
+ {
79
+ "el": "f-button",
80
+ "w": "3",
81
+ "attr": {
82
+ "label": "Luu",
83
+ "color": "primary",
84
+ ":action": { "CALL": "handleSubmit" }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## f-date
90
+
91
+ - Props (source): `value`, `label`, `dateAdd`, `required`
92
+ - Emit: `input` with normalized date (or `null`)
93
+ - Typed mask + picker; accepts many input formats on init; `dateAdd` sets a date relative to today
94
+
95
+ ```json
96
+ {
97
+ "el": "f-date",
98
+ "w": "6",
99
+ "attr": {
100
+ "v-model": "filter.fromDate",
101
+ "label": "Tu ngay",
102
+ ":required": false,
103
+ ":date-add": -7
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## f-time
109
+
110
+ - Props (source): `value`, `label`, `timeAdd`, `required`
111
+ - Emit: `input` with `HH:mm` (or `null`)
112
+ - Typed mask + time picker
113
+
114
+ ```json
115
+ {
116
+ "el": "f-time",
117
+ "w": "6",
118
+ "attr": {
119
+ "v-model": "formData.startTime",
120
+ "label": "Gio bat dau",
121
+ ":required": false,
122
+ ":time-add": 30
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## f-time-counter
128
+
129
+ - Props (source): `value`, `type`, `labelFormat`, `format`
130
+ - `value`: seconds (Number) or datetime string (`"yyyy-MM-dd HH:mm:ss"`)
131
+ - `type`: `0` countdown with full days/hours/minutes/seconds · `1` countdown showing total remaining seconds only · `2` real-time clock (current time)
132
+ - `format`: `{ label, day, hour, minute, second }` — unit labels
133
+ - Emit: `input` (remaining seconds) when counting from seconds (Number value); `time-end` when timer hits 0
134
+
135
+ ```json
136
+ {
137
+ "el": "f-time-counter",
138
+ "w": "4",
139
+ "attr": {
140
+ ":value": 300,
141
+ ":type": 0,
142
+ ":format": { "label": "Còn lại: ", "day": " ngày", "hour": " giờ", "minute": " phút", "second": " giây" }
143
+ }
144
+ }
145
+ ```
146
+
147
+ ## f-qrcode
148
+
149
+ - Props (source): `value`, `logo`, `color`, `size`
150
+ - Renders a QR image from value
151
+
152
+ ```json
153
+ {
154
+ "el": "f-qrcode",
155
+ "w": "4",
156
+ "attr": {
157
+ "v-model": "formData.qrText",
158
+ ":size": 200,
159
+ "color": "#1e90ff"
160
+ }
161
+ }
162
+ ```
163
+
164
+ ## f-qrcode-reader
165
+
166
+ - Props (source): `value`, `label`, `width`
167
+ - Emit: `input` (closes dialog), `update` (decoded content)
168
+
169
+ ```json
170
+ {
171
+ "el": "f-qrcode-reader",
172
+ "w": "12",
173
+ "attr": {
174
+ "v-model": "scanDialog",
175
+ "label": "Doc ma QR",
176
+ "v-on:update": "CALL(vueData.handleScanResult, { item: $event })"
177
+ }
178
+ }
179
+ ```
180
+
181
+ ## f-image-update
182
+
183
+ - Props (source): `value`, `label`, `title`, `apiUpload`, `iconText`, `imageType`, `size`, `quality`, `dialogWidth`, `dialogHeight`, `imageBoxAttr`, `imageAttr`, `buttonAttr`, `croperAttr`
184
+ - Emit: `update` after successful upload (`{ returnData, imageData }`)
185
+
186
+ ```json
187
+ {
188
+ "el": "f-image-update",
189
+ "w": "4",
190
+ "attr": {
191
+ "v-model": "formData.avatar",
192
+ "label": "Anh dai dien",
193
+ "api-upload": "/api/upload/avatar",
194
+ ":dialog-width": 600,
195
+ ":dialog-height": 420
196
+ }
197
+ }
198
+ ```
199
+
200
+ ## f-file-upload
201
+
202
+ - Props (source): `label`, `url`, `autoclose`, `iconText`, `filters`, `resize`, `onclose`
203
+ - Emit: `input` on upload complete
204
+ - Uses Plupload; uploads on file select; runs `onclose` action when the dialog closes
205
+
206
+ ```json
207
+ {
208
+ "el": "f-file-upload",
209
+ "w": "4",
210
+ "attr": {
211
+ "label": "Tai tep",
212
+ "url": "/api/upload/file",
213
+ ":filters": {
214
+ "max_file_size": "20mb",
215
+ "mime_types": [{ "title": "PDF", "extensions": "pdf" }]
216
+ },
217
+ ":onclose": { "CALL": "handleUploadClosed" }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ## f-excel-reader
223
+
224
+ Button: reads Excel/CSV → `v-model` (array of objects, or of arrays per `:header`). XLSX lazy-loads on first pick; **no import** in module.json.
225
+
226
+ **Outputs:**
227
+
228
+ - `v-model` — parsed data array
229
+ - `load` — metadata `{ rows, rowCount, headers, sheetName, sheetNames, fileName }`
230
+ - `error` — `{ message, fileName }` when file too large, read fails, or XLSX load times out
231
+ - `action-error` — `{ message, fileName }` when the action callback throws (Excel data still valid)
232
+
233
+ **Props — display:**
234
+
235
+ | Prop | Default | Description |
236
+ | ----------- | ------------------------------------------------------------ | ------------------------------ |
237
+ | `label` | `'Load Excel'` | Button label |
238
+ | `icon-text` | `'mdi-grid'` | MDI icon; `null`/`''` hides it |
239
+ | `accept` | `.xlsx,.xlsb,.xlsm,.xls,.csv,.txt,.ods,.dbf,.prn,.html,.htm` | Accepted file types |
240
+
241
+ **Props — reading:**
242
+
243
+ | Prop | Default | Description |
244
+ | ------------- | -------------- | ------------------------------------------------------------- |
245
+ | `:header` | `null` | Decides the object keys in the result (table below) |
246
+ | `:raw` | `false` | `false` = parse numbers and dates; `true` = keep raw strings |
247
+ | `date-format` | `'dd/mm/yyyy'` | Date format when `:raw="false"` |
248
+ | `:defval` | `''` | Value for empty cells |
249
+ | `:sheet` | `0` | Sheet to read — number (0-based index) or sheet name (string) |
250
+ | `:skip-rows` | `0` | Skip N leading rows before header/data |
251
+
252
+ **`:header` values:**
253
+
254
+ | Value | Result |
255
+ | ------------------ | ------------------------------------------------------------- |
256
+ | `null` _(default)_ | First sheet row as keys: `[{MSSV:"1234", HoTen:"An"}]` |
257
+ | `1` | Array of arrays, no keys: `[["MSSV","HoTen"],["1234","An"]]` |
258
+ | `"A"` | Excel column letters as keys: `[{A:"MSSV", B:"HoTen"}]` |
259
+ | `["ma","ten"]` | Your own key names by column order (file header row not used) |
260
+
261
+ ⚠️ **`:sheet` trap — wrong name does NOT error:**
262
+
263
+ - Nonexistent **name** → **silently reads the first sheet** (wrong data, no sign).
264
+ - **Number** beyond sheet count → `Không tìm thấy sheet: N` via `error`.
265
+
266
+ With a name, compare `load`.`sheetName` to the expected name.
267
+
268
+ **Props — limits & timeout:**
269
+
270
+ | Prop | Default | Description |
271
+ | --------------- | ------- | ------------------------------------------------------------- |
272
+ | `:max-size` | `20` | File size limit, **in MB** (name has no "MB"); `0` = no limit |
273
+ | `:load-timeout` | `15000` | XLSX library load timeout (ms) |
274
+
275
+ Unparseable `:max-size` → **20 MB**, not unlimited; no limit = exactly number `0`.
276
+
277
+ **Prop — callback:**
278
+
279
+ | Prop | Description |
280
+ | --------- | ------------------------------------------------------------------------------------------------ |
281
+ | `:action` | Action object run after parsing, once `v-model` has the data — usually `{ "CALL": "tenAction" }` |
282
+
283
+ **Error boundary — reading and action are separate stages:**
284
+
285
+ - `action` runs after `v-model` has the data (`$nextTick`); read `vueData.excelRows` directly.
286
+ - After reading, **nothing becomes `error`** — action errors → `action-error`, parsed data kept, no rollback. `error` ⇒ reading failed; `action-error` ⇒ processing failed.
287
+ - Clicks while parsing are ignored; a new file picked before the old finishes discards the old result (never overwrites the new).
288
+
289
+ **Basic — header from first row (default):**
290
+
291
+ ```json
292
+ {
293
+ "el": "f-excel-reader",
294
+ "w": "4",
295
+ "attr": {
296
+ "label": "Nhập từ Excel",
297
+ "icon-text": "mdi-microsoft-excel",
298
+ ":action": { "CALL": "cmdImportExcel" },
299
+ "v-model": "excelRows"
300
+ }
301
+ }
302
+ ```
303
+
304
+ **Sheet by name, skip 2 rows, keep raw strings:**
305
+
306
+ ```json
307
+ {
308
+ "el": "f-excel-reader",
309
+ "w": "4",
310
+ "attr": {
311
+ "label": "Nhập DanhSach",
312
+ ":sheet": "DanhSach",
313
+ ":skip-rows": 2,
314
+ ":raw": true,
315
+ ":action": { "CALL": "cmdImportExcel" },
316
+ "v-model": "excelRows"
317
+ }
318
+ }
319
+ ```
320
+
321
+ **Custom column names, 5 MB limit:**
322
+
323
+ ```json
324
+ {
325
+ "el": "f-excel-reader",
326
+ "w": "4",
327
+ "attr": {
328
+ "label": "Nhập Excel",
329
+ ":header": ["mssv", "hoTen", "diemTB"],
330
+ ":max-size": 5,
331
+ ":action": { "CALL": "cmdImportExcel" },
332
+ "v-model": "excelRows"
333
+ }
334
+ }
335
+ ```