@lowdefy/docs 3.22.0 → 3.23.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 (54) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/actions/JsAction.yaml +2 -2
  3. package/blocks/display/DangerousHtml.yaml +11 -12
  4. package/blocks/display/DangerousMarkdown.yaml +8 -8
  5. package/blocks/input/MultipleSelector.yaml +80 -0
  6. package/blocks/input/Selector.yaml +62 -0
  7. package/concepts/custom-blocks.yaml +2 -2
  8. package/concepts/custom-code.yaml +3 -3
  9. package/concepts/lowdefy-schema.yaml +16 -0
  10. package/connections/AxiosHttp.yaml +1 -1
  11. package/deployment/aws-lambda.yaml +2 -2
  12. package/deployment/docker.yaml +2 -2
  13. package/head.html +2 -0
  14. package/howto/generate-csv.yaml.njk +251 -0
  15. package/howto/generate-pdf.yaml.njk +651 -0
  16. package/howto/generateCsv/lowdefy.yaml +63 -0
  17. package/howto/generateCsv/public/csvMake.js +27 -0
  18. package/howto/generatePdf/inv_template.yaml +200 -0
  19. package/howto/generatePdf/lowdefy.yaml +116 -0
  20. package/howto/generatePdf/my_header.html +1 -0
  21. package/howto/generatePdf/public/logo_example.png +0 -0
  22. package/howto/generatePdf/public/modules/importUmd.js +7 -0
  23. package/howto/generatePdf/public/modules/pdfMake.js +7 -0
  24. package/howto/generatePdf/public/modules/vfs_fonts.js +12 -0
  25. package/lowdefy.yaml +1 -1
  26. package/menus.yaml +25 -1
  27. package/operators/_actions.yaml +1 -1
  28. package/operators/_change_case.yaml +4 -4
  29. package/operators/_js.yaml +2 -2
  30. package/operators/_ref.yaml +16 -8
  31. package/operators/_switch.yaml +51 -0
  32. package/package.json +2 -2
  33. package/pages.yaml +12 -0
  34. package/public/images/authors/gervwyk.jpeg +0 -0
  35. package/public/images/authors/sandile.jpeg +0 -0
  36. package/public/images/howto/header_generate_csv.jpg +0 -0
  37. package/public/images/howto/header_generate_pdf.jpg +0 -0
  38. package/public/logo_example.png +0 -0
  39. package/public/modules/csvMake.js +27 -0
  40. package/public/modules/importUmd.js +7 -0
  41. package/public/modules/pdfMake.js +7 -0
  42. package/public/modules/vfs_fonts.js +12 -0
  43. package/public/sitemap.xml +216 -201
  44. package/templates/blocks/exampleTransformer.js +1 -1
  45. package/templates/blog.yaml.njk +221 -0
  46. package/templates/footer.yaml.njk +2 -2
  47. package/tutorial/tutorial-create-page.yaml +1 -1
  48. package/tutorial/tutorial-start.yaml +1 -1
  49. package/users/login-and-logout.yaml +2 -2
  50. package/users/openid-connect.yaml +1 -0
  51. package/users/protected-pages.yaml +2 -2
  52. package/users/roles.yaml +2 -2
  53. package/users/users-introduction.yaml +1 -1
  54. package/version.yaml +1 -1
package/lowdefy.yaml CHANGED
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  name: '@lowdefy/docs'
16
- lowdefy: 3.22.0
16
+ lowdefy: 3.23.2
17
17
  licence: Apache-2.0
18
18
 
19
19
  cli:
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:
@@ -733,6 +749,9 @@
733
749
  - id: _sum
734
750
  type: MenuLink
735
751
  pageId: _sum
752
+ - id: _switch
753
+ type: MenuLink
754
+ pageId: _switch
736
755
  - id: _type
737
756
  type: MenuLink
738
757
  pageId: _type
@@ -760,9 +779,14 @@
760
779
  title: Lowdefy Versions
761
780
  icon: BranchesOutlined
762
781
  links:
763
- - id: v3.22.0
782
+ - id: v3.23.2
764
783
  type: MenuLink
765
784
  url: https://docs.lowdefy.com
785
+ properties:
786
+ title: v3.23.2
787
+ - id: v3.22.0
788
+ type: MenuLink
789
+ url: https://61519bcb8b8ed4412aae3057--lowdefy-docs.netlify.app
766
790
  properties:
767
791
  title: v3.22.0
768
792
  - id: v3.21.2
@@ -77,7 +77,7 @@ _ref:
77
77
  First register a custom JavaScript action: `getNormalizedEigenvector`
78
78
  ```yaml
79
79
  # file: lowdefy.yaml
80
- lowdefy: '3.22.0'
80
+ lowdefy: '3.23.2'
81
81
  app:
82
82
  html:
83
83
  appendHead: |
@@ -72,8 +72,8 @@ _ref:
72
72
  _change_case.capitalCase:
73
73
  on:
74
74
  foo: 'bar'
75
- options:
76
- convertKeys: true
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
- options:
86
- convertValues: false
85
+ options:
86
+ convertValues: false
87
87
  ```
88
88
  Returns: `{ "foo": "bar" }`
89
89
 
@@ -51,7 +51,7 @@ _ref:
51
51
  ```yaml
52
52
  # lowdefy.yaml
53
53
  name: make-me-primes
54
- lowdefy: '3.22.0'
54
+ lowdefy: '3.23.2'
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.22.0'
122
+ lowdefy: '3.23.2'
123
123
  app:
124
124
  html:
125
125
  appendHead:
@@ -73,7 +73,7 @@ _ref:
73
73
  ###### Reference pages:
74
74
  ```yaml
75
75
  # lowdefy.yaml
76
- lowdefy: '3.22.0'
76
+ lowdefy: '3.23.2'
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.22.0'
97
+ lowdefy: '3.23.2'
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(path, vars, context) {
180
- const localFile = await readFilePromise(path.resolve(path), 'utf8');
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.22.0
200
+ lowdefy: 3.23.2
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.22.0
226
+ lowdefy: 3.23.2
219
227
 
220
228
  pages:
221
229
  - _ref:
@@ -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.22.0",
3
+ "version": "3.23.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "af37daa86e1ba73397eb65f65cacbcbb5461ec79"
43
+ "gitHead": "4c30d3cdfa99ae4e90fc891825938c28bad45760"
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
@@ -205,6 +216,7 @@
205
216
  - _ref: operators/_string.yaml
206
217
  - _ref: operators/_subtract.yaml
207
218
  - _ref: operators/_sum.yaml
219
+ - _ref: operators/_switch.yaml
208
220
  - _ref: operators/_type.yaml
209
221
  - _ref: operators/_uri.yaml
210
222
  - _ref: operators/_url_query.yaml
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
+ export default async (url, module = { exports: {} }) =>
2
+ (Function('module', 'exports', await (await fetch(url)).text()).call(
3
+ module,
4
+ module,
5
+ module.exports
6
+ ),
7
+ module).exports;
@@ -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);