|
| 1 | +{{ target: partial-matrix-body-corner-option }} |
| 2 | + |
| 3 | +#${prefix|default('##')} data(Array) |
| 4 | + |
| 5 | +{{ use: partial-version(version = "6.0.0") }} |
| 6 | + |
| 7 | +Only specify some special cell definitions for ${name}. |
| 8 | + |
| 9 | +```js |
| 10 | +data: [ |
| 11 | + { |
| 12 | + coord: [[3, 5], [1, 2]], // Required to locate the cell. |
| 13 | + // See the rule below. |
| 14 | + value: 'some_text', // Optional. The text to display. |
| 15 | + mergeCells: true, // Optional. `false` by default. |
| 16 | + }, |
| 17 | + { |
| 18 | + // ... |
| 19 | + }, |
| 20 | + // ... |
| 21 | +] |
| 22 | +``` |
| 23 | + |
| 24 | +Cell locating and reference: see the description in [matrix.body.data](~matrix.body.data.coord) |
| 25 | + |
| 26 | + |
| 27 | +##${prefix|default('##')} coord(Array) |
| 28 | + |
| 29 | +**Body/Corner Cell Locating** |
| 30 | + |
| 31 | +The rule is uniformly applied, such as, in `matrix.dataToPoint` and `matrix.dataToLayout` and `xxxComponent.coord`. |
| 32 | + |
| 33 | +Suppose the matrix.x/y dimensions (header) are defined as: |
| 34 | +```js |
| 35 | +matrix: { |
| 36 | + x: [{ value: 'Xa0', children: ['Xb0', 'Xb1'] }, 'Xa1'], |
| 37 | + y: [{ value: 'Ya0', children: ['Yb0', 'Yb1'] }], |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +``` |
| 42 | + ----------------------------------------- |
| 43 | + | | | Xa0 | | |
| 44 | + |-------+-------+---------------| Xa1 | |
| 45 | + |cornerQ|cornerP| Xb0 | Xb1 | | |
| 46 | + |-------+-------+-------+-------+-------- |
| 47 | + | | Yb0 | bodyR | bodyS | | |
| 48 | + | Ya0 |-------+-------+---------------| |
| 49 | + | | Yb1 | | bodyT | |
| 50 | + |---------------|------------------------ |
| 51 | +``` |
| 52 | ++ `Locator number`: |
| 53 | + + The term `locator` refers to a integer number to locate cells on x or y direction. |
| 54 | + + Use the top-left cell of the body as the origin point `(0, 0)`, |
| 55 | + + the non-negative locator indicates the right/bottom of the origin point; |
| 56 | + + the negative locator indicates the left/top of the origin point. |
| 57 | ++ `Ordinal number` (`OrdinalNumber`): |
| 58 | + + This term follows the same meaning as that in category axis of cartesian. They are non-negative integer, designating each string `matrix.x.data[i].value`/`matrix.y.data[i].value`. `'Xb0'`, `'Xb2'`, `'Xa1'`, `'Xa0'` are assigned with the ordinal numbers `0`, `1`, `2`, `3`. For every leaf dimension cell, `OrdinalNumber` and `MatrixXYLocator` is the same. |
| 59 | ++ A single cell or multiple cells can be determined/located by an array of `locator number` or `ordinal number` or the original `value` string as follows: |
| 60 | + - e.g., the body cell `bodyS` above can be located by: |
| 61 | + - `coord: [1, 0]` (Use non-negative integer) |
| 62 | + - `coord: ['Xb1', 'Yb0']` (Use the `value` properties in `matrix.x/y.data`) |
| 63 | + - `coord: ['Xb1', 0]` (mix them) |
| 64 | + - e.g., the corner cell `cornerQ` above can be located by: |
| 65 | + - `coord: [-2, -1]` (negative `MatrixXYLocator`) |
| 66 | + - But it is NOT supported to use `coord: ['Y1_0', 'X1_0']` (XY transposed form) here. |
| 67 | + - The dimension (header) cell can be located by negative integers. For example: |
| 68 | + - The center of the node `'Ya0'` can be located by `[-2, 'Ya0']`. |
| 69 | + - Cross cells: multiple cells can be located. e.g., if using `[['Xb0', 'Xb1'], ['Yb0']]`, or using a non-leaf dimension cell to locate, such as `['Xa0', 'Yb0']`, it returns only according to the center of the dimension cells, regardless of the body span. (therefore, the result can be on the boundary of two body cells.) And the ordinal number assigned to 'Xa0' is 3, thus input `[3, 'Yb0']` get the some result. |
| 70 | +- In a nutshell, **The formatter of `matrix.data.coord`** is as follows: |
| 71 | + - `[2, 8]` indicates a cell. |
| 72 | + - `[2, null/undefined/NaN]` means y is the entire column. |
| 73 | + - `[null/undefined/NaN, 8]` is the opposite. |
| 74 | + - `[[2, 5], 8]` indicates a rect of cells in x range of `2~5` and y `8`. |
| 75 | + - `[[2, 5], null/undefined/NaN]` indicates a x range of `2~5` and y is the entire column. |
| 76 | + - `[[2, 5], [7, 8]]` indicates a rect of cells in x range of `2~5` and y range of `7~8`. |
| 77 | + - `['aNonLeaf', 8]` indicates a rect of cells in x range of `aNonLeaf` and y `8`. |
| 78 | +- **NOTICE** |
| 79 | + - `bodyR` above is `[0, 0]`**. |
| 80 | + - The formatter of `matrix.data.coord` is `MatrixCoordRangeOption[]` as follows. |
| 81 | + |
| 82 | +- The API `dataToPoint` and `dataToLayout` also uses this locating rule: |
| 83 | + - Input `['Xa1', 'Yb1']` to `dataToPoint` will get a point in the center of "bodyT". |
| 84 | + - Input `['Xa1', 'Yb1']` to `dataToLayout` will get a rect of the "bodyT". |
| 85 | + |
| 86 | + |
| 87 | +##${prefix|default('##')} mergeCells(boolean) |
| 88 | + |
| 89 | +Body cells or corner cells can be merged. |
| 90 | + |
| 91 | +##${prefix|default('##')} value(string|number) |
| 92 | + |
| 93 | +Text to display in the cell. |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +{{ use: partial-matrix-cell-style-option( |
| 98 | + prefix='##', |
| 99 | + name=${name} |
| 100 | +) }} |
0 commit comments