@lowdefy/docs 3.22.0 → 4.0.0-alpha.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/CHANGELOG.md +72 -0
- package/actions/JsAction.yaml +2 -2
- package/blocks/all_icons.yaml +1 -0
- package/blocks/{display → container}/Alert.yaml +3 -2
- package/blocks/{display → container}/Descriptions.yaml +3 -1
- package/blocks/container/Drawer.yaml +1 -0
- package/blocks/{context → container}/PageHCF.yaml +2 -2
- package/blocks/{context → container}/PageHCSF.yaml +2 -2
- package/blocks/{context → container}/PageHSCF.yaml +2 -2
- package/blocks/{context → container}/PageHeaderMenu.yaml +2 -2
- package/blocks/{context → container}/PageSHCF.yaml +2 -2
- package/blocks/{context → container}/PageSiderMenu.yaml +2 -2
- package/blocks/display/DangerousHtml.yaml +11 -12
- package/blocks/display/DangerousMarkdown.yaml +8 -8
- package/blocks/display/Img.yaml +1 -1
- package/blocks/input/MultipleSelector.yaml +80 -0
- package/blocks/input/Selector.yaml +62 -0
- package/concepts/custom-blocks.yaml +2 -2
- package/concepts/custom-code.yaml +3 -3
- package/concepts/lowdefy-schema.yaml +16 -0
- package/connections/AxiosHttp.yaml +1 -1
- package/deployment/aws-lambda.yaml +2 -2
- package/deployment/docker.yaml +2 -2
- package/head.html +2 -0
- package/howto/generate-csv.yaml.njk +251 -0
- package/howto/generate-pdf.yaml.njk +651 -0
- package/howto/generateCsv/lowdefy.yaml +63 -0
- package/howto/generateCsv/public/csvMake.js +27 -0
- package/howto/generatePdf/inv_template.yaml +200 -0
- package/howto/generatePdf/lowdefy.yaml +116 -0
- package/howto/generatePdf/my_header.html +1 -0
- package/howto/generatePdf/public/logo_example.png +0 -0
- package/howto/generatePdf/public/modules/importUmd.js +7 -0
- package/howto/generatePdf/public/modules/pdfMake.js +7 -0
- package/howto/generatePdf/public/modules/vfs_fonts.js +12 -0
- package/howto/use-refrences.md +5 -0
- package/lowdefy.yaml +1 -1
- package/menus.yaml +41 -26
- package/operators/_actions.yaml +1 -1
- package/operators/_change_case.yaml +4 -4
- package/operators/_event.yaml +1 -0
- package/operators/_global.yaml +1 -0
- package/operators/_index.yaml +1 -0
- package/operators/_input.yaml +1 -0
- package/operators/_js.yaml +2 -2
- package/operators/_ref.yaml +16 -8
- package/operators/_state.yaml +1 -0
- package/operators/_switch.yaml +51 -0
- package/operators/_url_query.yaml +1 -0
- package/package.json +7 -7
- package/pages.yaml +18 -8
- package/public/images/authors/gervwyk.jpeg +0 -0
- package/public/images/authors/sandile.jpeg +0 -0
- package/public/images/howto/header_generate_csv.jpg +0 -0
- package/public/images/howto/header_generate_pdf.jpg +0 -0
- package/public/logo_example.png +0 -0
- package/public/modules/csvMake.js +27 -0
- package/public/modules/importUmd.js +7 -0
- package/public/modules/pdfMake.js +7 -0
- package/public/modules/vfs_fonts.js +12 -0
- package/public/sitemap.xml +216 -201
- package/templates/blocks/exampleTransformer.js +1 -1
- package/templates/blog.yaml.njk +221 -0
- package/templates/footer.yaml.njk +2 -2
- package/tutorial/tutorial-create-page.yaml +1 -1
- package/tutorial/tutorial-start.yaml +1 -1
- package/users/login-and-logout.yaml +2 -2
- package/users/openid-connect.yaml +1 -0
- package/users/protected-pages.yaml +2 -2
- package/users/roles.yaml +2 -2
- package/users/users-introduction.yaml +1 -1
- package/version.yaml +1 -1
- package/blocks/context/Context.yaml +0 -27
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# How to use references
|
|
2
|
+
|
|
3
|
+
When starting a new Lowdefy application, your app is simple, uncomplicated and easy to navigate between pages, blocks, requests and actions. Unfortunately as with any software application, as you add more functionality, your app code start to grow to thousands of lines of code. When writing an app using conventional tools like javascript, you'd deal with this complexity by splitting your app into methods, files and folders. A experienced programmer will make design choices to best abstract portions of the code to make the app more understandable and maintainable.
|
|
4
|
+
|
|
5
|
+
With Lowdefy the built configuration is served in one giant JSON blob. you can do the same by splitting portions of your Lowdefy config into separate files and folders, and stich them together and
|
package/lowdefy.yaml
CHANGED
package/menus.yaml
CHANGED
|
@@ -47,6 +47,22 @@
|
|
|
47
47
|
pageId: next-steps
|
|
48
48
|
properties:
|
|
49
49
|
title: Next steps
|
|
50
|
+
- id: howto
|
|
51
|
+
type: MenuGroup
|
|
52
|
+
properties:
|
|
53
|
+
title: How To
|
|
54
|
+
icon: QuestionOutlined
|
|
55
|
+
links:
|
|
56
|
+
- id: generate-csv
|
|
57
|
+
type: MenuLink
|
|
58
|
+
pageId: generate-csv-files-from-data
|
|
59
|
+
properties:
|
|
60
|
+
title: Generate CSVs
|
|
61
|
+
- id: generate-pdf
|
|
62
|
+
type: MenuLink
|
|
63
|
+
pageId: generate-pdf-document-from-data
|
|
64
|
+
properties:
|
|
65
|
+
title: Generate PDFs
|
|
50
66
|
- id: concepts
|
|
51
67
|
type: MenuGroup
|
|
52
68
|
properties:
|
|
@@ -397,31 +413,6 @@
|
|
|
397
413
|
- id: Modal
|
|
398
414
|
type: MenuLink
|
|
399
415
|
pageId: Modal
|
|
400
|
-
- id: Result
|
|
401
|
-
type: MenuLink
|
|
402
|
-
pageId: Result
|
|
403
|
-
- id: Span
|
|
404
|
-
type: MenuLink
|
|
405
|
-
pageId: Span
|
|
406
|
-
- id: Spin
|
|
407
|
-
type: MenuLink
|
|
408
|
-
pageId: Spin
|
|
409
|
-
- id: Tabs
|
|
410
|
-
type: MenuLink
|
|
411
|
-
pageId: Tabs
|
|
412
|
-
- id: Tooltip
|
|
413
|
-
type: MenuLink
|
|
414
|
-
pageId: Tooltip
|
|
415
|
-
|
|
416
|
-
- id: blocks_context
|
|
417
|
-
type: MenuGroup
|
|
418
|
-
properties:
|
|
419
|
-
title: Context Blocks
|
|
420
|
-
icon: GroupOutlined
|
|
421
|
-
links:
|
|
422
|
-
- id: Context
|
|
423
|
-
type: MenuLink
|
|
424
|
-
pageId: Context
|
|
425
416
|
- id: PageHCF
|
|
426
417
|
type: MenuLink
|
|
427
418
|
pageId: PageHCF
|
|
@@ -440,6 +431,22 @@
|
|
|
440
431
|
- id: PageSiderMenu
|
|
441
432
|
type: MenuLink
|
|
442
433
|
pageId: PageSiderMenu
|
|
434
|
+
- id: Result
|
|
435
|
+
type: MenuLink
|
|
436
|
+
pageId: Result
|
|
437
|
+
- id: Span
|
|
438
|
+
type: MenuLink
|
|
439
|
+
pageId: Span
|
|
440
|
+
- id: Spin
|
|
441
|
+
type: MenuLink
|
|
442
|
+
pageId: Spin
|
|
443
|
+
- id: Tabs
|
|
444
|
+
type: MenuLink
|
|
445
|
+
pageId: Tabs
|
|
446
|
+
- id: Tooltip
|
|
447
|
+
type: MenuLink
|
|
448
|
+
pageId: Tooltip
|
|
449
|
+
|
|
443
450
|
- id: blocks_list
|
|
444
451
|
type: MenuGroup
|
|
445
452
|
properties:
|
|
@@ -733,6 +740,9 @@
|
|
|
733
740
|
- id: _sum
|
|
734
741
|
type: MenuLink
|
|
735
742
|
pageId: _sum
|
|
743
|
+
- id: _switch
|
|
744
|
+
type: MenuLink
|
|
745
|
+
pageId: _switch
|
|
736
746
|
- id: _type
|
|
737
747
|
type: MenuLink
|
|
738
748
|
pageId: _type
|
|
@@ -760,9 +770,14 @@
|
|
|
760
770
|
title: Lowdefy Versions
|
|
761
771
|
icon: BranchesOutlined
|
|
762
772
|
links:
|
|
763
|
-
- id: v3.
|
|
773
|
+
- id: v3.23.1
|
|
764
774
|
type: MenuLink
|
|
765
775
|
url: https://docs.lowdefy.com
|
|
776
|
+
properties:
|
|
777
|
+
title: v3.23.1
|
|
778
|
+
- id: v3.22.0
|
|
779
|
+
type: MenuLink
|
|
780
|
+
url: https://61519bcb8b8ed4412aae3057--lowdefy-docs.netlify.app
|
|
766
781
|
properties:
|
|
767
782
|
title: v3.22.0
|
|
768
783
|
- id: v3.21.2
|
package/operators/_actions.yaml
CHANGED
|
@@ -72,8 +72,8 @@ _ref:
|
|
|
72
72
|
_change_case.capitalCase:
|
|
73
73
|
on:
|
|
74
74
|
foo: 'bar'
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
options:
|
|
76
|
+
convertKeys: true
|
|
77
77
|
```
|
|
78
78
|
Returns: `{ "Foo": "Bar" }`
|
|
79
79
|
|
|
@@ -82,8 +82,8 @@ _ref:
|
|
|
82
82
|
_change_case.capitalCase:
|
|
83
83
|
on:
|
|
84
84
|
foo: 'bar'
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
options:
|
|
86
|
+
convertValues: false
|
|
87
87
|
```
|
|
88
88
|
Returns: `{ "foo": "bar" }`
|
|
89
89
|
|
package/operators/_event.yaml
CHANGED
package/operators/_global.yaml
CHANGED
package/operators/_index.yaml
CHANGED
package/operators/_input.yaml
CHANGED
package/operators/_js.yaml
CHANGED
|
@@ -51,7 +51,7 @@ _ref:
|
|
|
51
51
|
```yaml
|
|
52
52
|
# lowdefy.yaml
|
|
53
53
|
name: make-me-primes
|
|
54
|
-
lowdefy: '3.
|
|
54
|
+
lowdefy: '3.23.1'
|
|
55
55
|
app:
|
|
56
56
|
html:
|
|
57
57
|
# This HTML will be appended to the head HTML tag in the Lowdefy app
|
|
@@ -119,7 +119,7 @@ _ref:
|
|
|
119
119
|
```yaml
|
|
120
120
|
# file: lowdefy.yaml
|
|
121
121
|
name: my-chart
|
|
122
|
-
lowdefy: '3.
|
|
122
|
+
lowdefy: '3.23.1'
|
|
123
123
|
app:
|
|
124
124
|
html:
|
|
125
125
|
appendHead:
|
package/operators/_ref.yaml
CHANGED
|
@@ -73,7 +73,7 @@ _ref:
|
|
|
73
73
|
###### Reference pages:
|
|
74
74
|
```yaml
|
|
75
75
|
# lowdefy.yaml
|
|
76
|
-
lowdefy: '3.
|
|
76
|
+
lowdefy: '3.23.1'
|
|
77
77
|
pages:
|
|
78
78
|
- _ref: pages/page1.yaml
|
|
79
79
|
- _ref: pages/page2.yaml
|
|
@@ -94,7 +94,7 @@ _ref:
|
|
|
94
94
|
```
|
|
95
95
|
Returns:
|
|
96
96
|
```
|
|
97
|
-
lowdefy: '3.
|
|
97
|
+
lowdefy: '3.23.1'
|
|
98
98
|
pages:
|
|
99
99
|
- id: page1
|
|
100
100
|
type: PageHeaderMenu
|
|
@@ -176,12 +176,20 @@ _ref:
|
|
|
176
176
|
|
|
177
177
|
const readFilePromise = promisify(fs.readFile);
|
|
178
178
|
|
|
179
|
-
async function useLocalOrSharedConfig(
|
|
180
|
-
|
|
179
|
+
async function useLocalOrSharedConfig(refPath, vars, context) {
|
|
180
|
+
let fileContent
|
|
181
|
+
try {
|
|
182
|
+
fileContent = await readFilePromise(path.resolve(refPath), 'utf8');
|
|
183
|
+
return fileContent;
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (error.code === 'ENOENT') {
|
|
186
|
+
fileContent = readFilePromise(path.resolve('../shared', refPath), 'utf8');
|
|
187
|
+
return fileContent;
|
|
188
|
+
}
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
181
191
|
|
|
182
|
-
if (localFile) return localFile;
|
|
183
192
|
|
|
184
|
-
return readFilePromise(path.resolve('../shared', path), 'utf8');
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
module.exports = useLocalOrSharedConfig;
|
|
@@ -189,7 +197,7 @@ _ref:
|
|
|
189
197
|
|
|
190
198
|
```yaml
|
|
191
199
|
// lowdefy.yaml
|
|
192
|
-
lowdefy: 3.
|
|
200
|
+
lowdefy: 3.23.1
|
|
193
201
|
|
|
194
202
|
cli:
|
|
195
203
|
refResolver: resolvers/useLocalOrSharedConfig.js
|
|
@@ -215,7 +223,7 @@ _ref:
|
|
|
215
223
|
```
|
|
216
224
|
```yaml
|
|
217
225
|
// lowdefy.yaml
|
|
218
|
-
lowdefy: 3.
|
|
226
|
+
lowdefy: 3.23.1
|
|
219
227
|
|
|
220
228
|
pages:
|
|
221
229
|
- _ref:
|
package/operators/_state.yaml
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Copyright 2020-2021 Lowdefy, Inc
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
_ref:
|
|
16
|
+
path: templates/operators.yaml.njk
|
|
17
|
+
transformer: templates/operatorsMethodTransformer.js
|
|
18
|
+
vars:
|
|
19
|
+
pageId: _switch
|
|
20
|
+
pageTitle: _switch
|
|
21
|
+
filePath: operators/_switch.yaml
|
|
22
|
+
types: |
|
|
23
|
+
```
|
|
24
|
+
(arguments: {branches: {if: boolean, then: any}[], default: any}): any
|
|
25
|
+
```
|
|
26
|
+
description: |
|
|
27
|
+
The `_switch` operator evaluates an array of conditions and returns the `then` argument of the first item for which the `if` argument evaluates to `true`. If no condition evaluates to `true`, the value of the `default` argument is returned.
|
|
28
|
+
arguments: |
|
|
29
|
+
###### object
|
|
30
|
+
- `branches:`
|
|
31
|
+
`if: boolean`: The boolean result of a test.
|
|
32
|
+
`then: any`: The value to return if the test is `true`.
|
|
33
|
+
- `default: any`: The value to return if all the `if` tests are `false`.
|
|
34
|
+
examples: |
|
|
35
|
+
###### Return a value based on a series of conditions:
|
|
36
|
+
```yaml
|
|
37
|
+
_switch:
|
|
38
|
+
branches:
|
|
39
|
+
- if:
|
|
40
|
+
_eq:
|
|
41
|
+
- x
|
|
42
|
+
- y
|
|
43
|
+
then: A
|
|
44
|
+
- if:
|
|
45
|
+
_eq:
|
|
46
|
+
- x
|
|
47
|
+
- z
|
|
48
|
+
then: B
|
|
49
|
+
default: C
|
|
50
|
+
```
|
|
51
|
+
Returns: `"C"` since both of the `if` tests are `false`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/docs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"test": "jest --coverage"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@babel/cli": "7.
|
|
35
|
-
"@babel/core": "7.
|
|
36
|
-
"@babel/preset-env": "7.
|
|
37
|
-
"babel-jest": "
|
|
38
|
-
"jest": "
|
|
34
|
+
"@babel/cli": "7.15.7",
|
|
35
|
+
"@babel/core": "7.15.8",
|
|
36
|
+
"@babel/preset-env": "7.15.8",
|
|
37
|
+
"babel-jest": "27.3.1",
|
|
38
|
+
"jest": "27.3.1"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c97a8fa6b5a641e7d50df09f5601a9c586eeb65a"
|
|
44
44
|
}
|
package/pages.yaml
CHANGED
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
- _ref: tutorial/tutorial-deploy.yaml
|
|
12
12
|
- _ref: tutorial/next-steps.yaml
|
|
13
13
|
|
|
14
|
+
- _ref:
|
|
15
|
+
path: howto/generate-csv.yaml.njk
|
|
16
|
+
vars:
|
|
17
|
+
version:
|
|
18
|
+
_ref: version.yaml
|
|
19
|
+
- _ref:
|
|
20
|
+
path: howto/generate-pdf.yaml.njk
|
|
21
|
+
vars:
|
|
22
|
+
version:
|
|
23
|
+
_ref: version.yaml
|
|
24
|
+
|
|
14
25
|
- _ref: concepts/overview.yaml
|
|
15
26
|
- _ref: concepts/cli.yaml
|
|
16
27
|
- _ref: concepts/lowdefy-schema.yaml
|
|
@@ -104,20 +115,18 @@
|
|
|
104
115
|
- _ref: blocks/container/Drawer.yaml
|
|
105
116
|
- _ref: blocks/container/Label.yaml
|
|
106
117
|
- _ref: blocks/container/Modal.yaml
|
|
118
|
+
- _ref: blocks/container/PageHCF.yaml
|
|
119
|
+
- _ref: blocks/container/PageHCSF.yaml
|
|
120
|
+
- _ref: blocks/container/PageHeaderMenu.yaml
|
|
121
|
+
- _ref: blocks/container/PageHSCF.yaml
|
|
122
|
+
- _ref: blocks/container/PageSHCF.yaml
|
|
123
|
+
- _ref: blocks/container/PageSiderMenu.yaml
|
|
107
124
|
- _ref: blocks/container/Result.yaml
|
|
108
125
|
- _ref: blocks/container/Span.yaml
|
|
109
126
|
- _ref: blocks/container/Spin.yaml
|
|
110
127
|
- _ref: blocks/container/Tabs.yaml
|
|
111
128
|
- _ref: blocks/container/Tooltip.yaml
|
|
112
129
|
|
|
113
|
-
- _ref: blocks/context/Context.yaml
|
|
114
|
-
- _ref: blocks/context/PageHCF.yaml
|
|
115
|
-
- _ref: blocks/context/PageHCSF.yaml
|
|
116
|
-
- _ref: blocks/context/PageHeaderMenu.yaml
|
|
117
|
-
- _ref: blocks/context/PageHSCF.yaml
|
|
118
|
-
- _ref: blocks/context/PageSHCF.yaml
|
|
119
|
-
- _ref: blocks/context/PageSiderMenu.yaml
|
|
120
|
-
|
|
121
130
|
- _ref: blocks/list/ControlledList.yaml
|
|
122
131
|
- _ref: blocks/list/List.yaml
|
|
123
132
|
# - _ref: blocks/list/TimelineList.yaml
|
|
@@ -205,6 +214,7 @@
|
|
|
205
214
|
- _ref: operators/_string.yaml
|
|
206
215
|
- _ref: operators/_subtract.yaml
|
|
207
216
|
- _ref: operators/_sum.yaml
|
|
217
|
+
- _ref: operators/_switch.yaml
|
|
208
218
|
- _ref: operators/_type.yaml
|
|
209
219
|
- _ref: operators/_uri.yaml
|
|
210
220
|
- _ref: operators/_url_query.yaml
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const csvMakeFn = async (context, filename, data, fields) => {
|
|
2
|
+
if (!Array.isArray(data) || typeof data[0] !== 'object') {
|
|
3
|
+
throw new Error('csvMake data takes an array of objects');
|
|
4
|
+
}
|
|
5
|
+
if (!fields) {
|
|
6
|
+
fields = Object.keys(data[0]);
|
|
7
|
+
}
|
|
8
|
+
const arrays = [fields];
|
|
9
|
+
data.forEach((obj) => arrays.push(fields.map((field) => obj[field])));
|
|
10
|
+
const csv = arrays
|
|
11
|
+
.map((row) =>
|
|
12
|
+
row
|
|
13
|
+
.map((cell) => (typeof cell === 'undefined' || cell === null ? '' : cell))
|
|
14
|
+
.map(String)
|
|
15
|
+
.map((v) => v.replaceAll('"', '""'))
|
|
16
|
+
.map((v) => `"${v}"`)
|
|
17
|
+
.join(',')
|
|
18
|
+
)
|
|
19
|
+
.join('\r\n');
|
|
20
|
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
|
21
|
+
const url = URL.createObjectURL(blob);
|
|
22
|
+
const el = document.createElement('a');
|
|
23
|
+
el.href = url;
|
|
24
|
+
el.setAttribute('download', filename);
|
|
25
|
+
el.click();
|
|
26
|
+
};
|
|
27
|
+
window.lowdefy.registerJsAction('csvMake', csvMakeFn);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import importUmd from './importUmd.js';
|
|
2
|
+
import vfs from './vfs_fonts.js';
|
|
3
|
+
const pdfMake = await importUmd(`https://unpkg.com/pdfmake@0.1.71/build/pdfmake.min.js`);
|
|
4
|
+
const pdfMakeFn = async (context, filename, docDefinition, tableLayouts, fonts) => {
|
|
5
|
+
await pdfMake.createPdf(docDefinition, tableLayouts, fonts, vfs).download(filename);
|
|
6
|
+
};
|
|
7
|
+
window.lowdefy.registerJsAction('pdfMake', pdfMakeFn);
|