Skip to content

Commit 27534f7

Browse files
committed
feat: add noteline of config.yaml, unique and cross of field property
1 parent 73eb052 commit 27534f7

3 files changed

Lines changed: 39 additions & 4 deletions

File tree

config/_default/menus/menus.en.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646
[[footer]]
4747
name = "Privacy"
4848
url = "/privacy-policy/"
49-
weight = 10
49+
weight = 10

content/en/docs/excel/field-property.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ toc: true
1414

1515
| Option | Type | Description |
1616
| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17-
| `unique` | bool | Check map key uniqueness. <br> Default: `false`. |
17+
| `unique` | bool | Check field uniqueness. <br> Default: `false`. Specially for map (or KeyedList) key, default will be auto deduced. |
1818
| `range` | string | Format: `"left, right"`. E.g.: `"1,10"`, `"1,~"`, `"~,10"`. <br> Different interpretations of range: <br> - number: value range. <br> - string: count of utf-8 code point. |
1919
| `refer` | string | Format: `"SheetName(SheetAlias).ColumnName"`.<br>Ensure this field is in another sheet's column value space. Multiple refers are comma-separated. |
2020
| `sequence` | int64 | Ensure this field's value is a sequence and begins with this value. |
@@ -28,13 +28,27 @@ toc: true
2828
| `patch` | Patch | Field patch type. <br> - `PATCH_REPLACE` <br> - `PATCH_MERGE` |
2929
| `sep` | string | Field-level separator. |
3030
| `subsep` | string | Field-level subseparator. |
31+
| `cross` | int32 | Specify count of crossed nodes/cells/fields of composite types with cardinality, such as list and map. |
3132
{.table-striped .table-hover}
3233

3334
## Option `unique`
3435

35-
Option `unique` can be specified as `true` in the map field property. Then tableau will report an error if a duplicate key is appeared.
36+
Option `unique` can be specified as `true` or `false` in the field property.
3637

37-
{{< alert icon="👉" context="info" text="In most cases, tableau will auto deduce the map key is unique or not. The rule is: if a map's value type has no same layout map/list field, then this map key must be unique. So it is not neccessary to config it." />}}
38+
- If you set `unique` to `true` explicitly, then tableau will report an error if a duplicate key is appeared.
39+
- If you set `unique` to `false` explicitly, no check will be performed.
40+
41+
### Map (or KeyedList) key
42+
43+
Tableau will auto deduce the map (or KeyedList) key's `unique` as true or not.
44+
45+
**The rule is**: if a map's value type (or KeyedList element type) has no sub map/list field of the same layout (vertical/horizontal), then the key must be unique.
46+
47+
So in most cases, it's not neccessary to config it explicitly.
48+
49+
### General scalar field
50+
51+
If you specify a general scalar field's property `unique` as true, then tableau will check the field's uniquness in map or list.
3852

3953
## Option `range`
4054

@@ -171,3 +185,21 @@ If not set, it will use **sheet-level** seq in [metasheet](../metasheet/#option-
171185
- struct fields of each incell struct list element.
172186

173187
If not set, it will use **sheet-level** subseq in [metasheet](../metasheet/#option-subsep).
188+
189+
## Option `cross`
190+
191+
Specify count of crossed nodes/cells/fields of composite types with
192+
cardinality, such as list and map.
193+
194+
### union list field
195+
196+
Specify the count of union fields the list will cross and occupy
197+
(one list element for each field). It will also change this list
198+
field's layout from incell to horizontal.
199+
200+
- Value 0 means it is an incell list.
201+
- Value > 0 means it is a horizontal list occupying N fields.
202+
- Value < 0 means it is a horizontal list occupying all following fields.
203+
204+
> TODO: example illustrated.
205+

content/en/docs/tutorial/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ proto:
5858
# The line number of column type definition in a cell.
5959
# Value 0 means the whole cell.
6060
typeline: 0
61+
# The line number of column note definition in a cell.
62+
# Value 0 means the whole cell.
63+
noteline: 0
6164
# Separator for separating:
6265
# - incell list elements (scalar or struct).
6366
# - incell map items.

0 commit comments

Comments
 (0)