diff --git a/README.md b/README.md index 7b6b2ed..ee07466 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ const viewModel = new MyAwesomeReportVm(); //or something else })(); ``` +## More examples: + +for more example I invite to tests data: [click here and check `Renderer` folders](./tests/integration/data) # Documentation: @@ -43,11 +46,11 @@ const viewModel = new MyAwesomeReportVm(); //or something else | - | [BaseCell](./src/cell/BaseCell.ts) | n/o | n/o | All Cell\`s definition classes extend it. | **abstract** | | Content | [NormalCell](./src/cell/NormalCell.ts) | 1 | not started by `##` or `#!` | This one copy all styles, width, properties and value form template. | **default** | | Content | [VariableCell](./src/cell/VariableCell.ts) | 3 | `## pathToVariable ` | Write variable from `ViewModel`.
Paths to object's property or array item are allowed.
When asking about undefined variable it returns empty string. | **Paths examples:**
`simplePath`
`someObject.property`
`array.0.field`
`items.1.path.to.object.prop`| -| Content | **TODO: describe it!** [HyperlinkCell](./src/cell/HyperlinkCell.ts) | | | | | +| Content | [HyperlinkCell](./src/cell/HyperlinkCell.ts) | 5 | `#! HYPERLINK pathToLabel pathToTarget` | Create a hyperlink. | *Paths resolve exactly same as VariableCell* | | Content | **TODO: describe it!** [FormulaCell](./src/cell/FormulaCell.ts) | | | | | | Navigation | [EndRowCell](./src/cell/EndRowCell.ts) | 2 | `#! END_ROW` | Go to the beginning of next row | | | Worksheet
Navigation
Loop | [FinishCell](./src/cell/FinishCell.ts) | 7 | `#! FINISH conditionPath` | Finish rendering for current worksheet and:
1) go to next worksheet if `conditionPath===true`
2) repeat this template worksheet again (`conditionPath === false`) - looping through worksheets
3) finished whole rendering when this worksheet is the last one. | **Examples:**
`#! FINISHED ` or `#! FINISHED itemFromLoop.__iterated` | -| Worksheet | **TODO: describe it!** [WsNameCell](./src/cell/WsNameCell.ts) | | | | | +| Worksheet | [WsNameCell](./src/cell/WsNameCell.ts) | 13 | `#! WS_NAME pathToVariable` | Set worksheet's name. | **Examples:**
`#! WS_NAME worksheetName`
`#! WS_NAME item.title`
`#! WS_NAME translatedNames.0` | | View Model | **TODO: describe it!** [DeleteCell](./src/cell/DeleteCell.ts) | | | | | | Loop | **TODO: describe it!** [DumpColsCell](./src/cell/DumpColsCell.ts) | | | | | | Loop | **TODO: describe it!** [ForEachCell](./src/cell/ForEachCell.ts) | | | | | diff --git a/tests/integration/data/Renderer003-WsName/expected.xlsx b/tests/integration/data/Renderer003-WsName/expected.xlsx new file mode 100644 index 0000000..3bbaf5e Binary files /dev/null and b/tests/integration/data/Renderer003-WsName/expected.xlsx differ diff --git a/tests/integration/data/Renderer003-WsName/template.xlsx b/tests/integration/data/Renderer003-WsName/template.xlsx new file mode 100644 index 0000000..3940d3f Binary files /dev/null and b/tests/integration/data/Renderer003-WsName/template.xlsx differ diff --git a/tests/integration/data/Renderer003-WsName/viewModel.json b/tests/integration/data/Renderer003-WsName/viewModel.json new file mode 100644 index 0000000..0783d52 --- /dev/null +++ b/tests/integration/data/Renderer003-WsName/viewModel.json @@ -0,0 +1,6 @@ +{ + "translatedNames": [ + "Hello", + "World" + ] +} \ No newline at end of file diff --git a/tests/integration/data/Renderer004-Hyperlink/expected.xlsx b/tests/integration/data/Renderer004-Hyperlink/expected.xlsx new file mode 100644 index 0000000..b8cd5d9 Binary files /dev/null and b/tests/integration/data/Renderer004-Hyperlink/expected.xlsx differ diff --git a/tests/integration/data/Renderer004-Hyperlink/template.xlsx b/tests/integration/data/Renderer004-Hyperlink/template.xlsx new file mode 100644 index 0000000..8218962 Binary files /dev/null and b/tests/integration/data/Renderer004-Hyperlink/template.xlsx differ diff --git a/tests/integration/data/Renderer004-Hyperlink/viewModel.json b/tests/integration/data/Renderer004-Hyperlink/viewModel.json new file mode 100644 index 0000000..381c3af --- /dev/null +++ b/tests/integration/data/Renderer004-Hyperlink/viewModel.json @@ -0,0 +1,11 @@ +{ + "name": "Paweł Siemienik", + "github": { + "label": "@siemienik", + "url": "https://github.com/siemienik" + }, + "linkedIn": { + "label": "CEO Paweł Siemienik", + "url": "https://www.linkedin.com/in/pawe%C5%82-siemienik-a6715175/" + } +} \ No newline at end of file