@lowdefy/docs 4.0.0-alpha.7 → 4.0.0-alpha.8
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/dist/operators/client/filter_default_value.js +55 -0
- package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
- package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
- package/package.json +19 -3
- package/404.yaml +0 -26
- package/CHANGELOG.md +0 -697
- package/actions/CallMethod.yaml +0 -57
- package/actions/JsAction.yaml +0 -281
- package/actions/Link.yaml +0 -120
- package/actions/Login.yaml +0 -123
- package/actions/Logout.yaml +0 -44
- package/actions/Message.yaml +0 -68
- package/actions/Notification.yaml +0 -84
- package/actions/Request.yaml +0 -70
- package/actions/Reset.yaml +0 -42
- package/actions/ResetValidation.yaml +0 -102
- package/actions/ScrollTo.yaml +0 -100
- package/actions/SetGlobal.yaml +0 -78
- package/actions/SetState.yaml +0 -85
- package/actions/Throw.yaml +0 -89
- package/actions/Validate.yaml +0 -104
- package/actions/Wait.yaml +0 -40
- package/blocks/all_icons.yaml +0 -803
- package/blocks/container/Affix.yaml +0 -26
- package/blocks/container/Alert.yaml +0 -27
- package/blocks/container/Badge.yaml +0 -27
- package/blocks/container/Box.yaml +0 -27
- package/blocks/container/Card.yaml +0 -29
- package/blocks/container/Collapse.yaml +0 -38
- package/blocks/container/Comment.yaml +0 -43
- package/blocks/container/ConfirmModal.yaml +0 -36
- package/blocks/container/Descriptions.yaml +0 -51
- package/blocks/container/Drawer.yaml +0 -46
- package/blocks/container/Label.yaml +0 -28
- package/blocks/container/Modal.yaml +0 -46
- package/blocks/container/PageHCF.yaml +0 -28
- package/blocks/container/PageHCSF.yaml +0 -29
- package/blocks/container/PageHSCF.yaml +0 -29
- package/blocks/container/PageHeaderMenu.yaml +0 -52
- package/blocks/container/PageSHCF.yaml +0 -29
- package/blocks/container/PageSiderMenu.yaml +0 -53
- package/blocks/container/Result.yaml +0 -34
- package/blocks/container/Span.yaml +0 -27
- package/blocks/container/Spin.yaml +0 -27
- package/blocks/container/Tabs.yaml +0 -41
- package/blocks/container/Tooltip.yaml +0 -38
- package/blocks/display/Anchor.yaml +0 -25
- package/blocks/display/Avatar.yaml +0 -23
- package/blocks/display/Breadcrumb.yaml +0 -28
- package/blocks/display/Button.yaml +0 -43
- package/blocks/display/DangerousHtml.yaml +0 -62
- package/blocks/display/DangerousMarkdown.yaml +0 -46
- package/blocks/display/Divider.yaml +0 -23
- package/blocks/display/EChart.yaml +0 -53
- package/blocks/display/Html.yaml +0 -50
- package/blocks/display/Icon.yaml +0 -23
- package/blocks/display/Img.yaml +0 -40
- package/blocks/display/Markdown.yaml +0 -31
- package/blocks/display/MarkdownWithCode.yaml +0 -46
- package/blocks/display/Menu.yaml +0 -48
- package/blocks/display/Message.yaml +0 -34
- package/blocks/display/MobileMenu.yaml +0 -47
- package/blocks/display/Notification.yaml +0 -34
- package/blocks/display/Paragraph.yaml +0 -30
- package/blocks/display/Progress.yaml +0 -52
- package/blocks/display/Skeleton.yaml +0 -27
- package/blocks/display/Statistic.yaml +0 -35
- package/blocks/display/Title.yaml +0 -32
- package/blocks/input/AutoComplete.yaml +0 -30
- package/blocks/input/ButtonSelector.yaml +0 -36
- package/blocks/input/CheckboxSelector.yaml +0 -36
- package/blocks/input/CheckboxSwitch.yaml +0 -56
- package/blocks/input/ChromeColorSelector.yaml +0 -24
- package/blocks/input/CircleColorSelector.yaml +0 -24
- package/blocks/input/ColorSelector.yaml +0 -24
- package/blocks/input/CompactColorSelector.yaml +0 -24
- package/blocks/input/DateRangeSelector.yaml +0 -26
- package/blocks/input/DateSelector.yaml +0 -26
- package/blocks/input/DateTimeSelector.yaml +0 -28
- package/blocks/input/GithubColorSelector.yaml +0 -24
- package/blocks/input/MonthSelector.yaml +0 -26
- package/blocks/input/MultipleSelector.yaml +0 -117
- package/blocks/input/NumberInput.yaml +0 -24
- package/blocks/input/Pagination.yaml +0 -33
- package/blocks/input/ParagraphInput.yaml +0 -32
- package/blocks/input/PasswordInput.yaml +0 -48
- package/blocks/input/RadioSelector.yaml +0 -36
- package/blocks/input/RatingSlider.yaml +0 -24
- package/blocks/input/S3UploadButton.yaml +0 -28
- package/blocks/input/Selector.yaml +0 -98
- package/blocks/input/SliderColorSelector.yaml +0 -24
- package/blocks/input/SwatchesColorSelector.yaml +0 -24
- package/blocks/input/Switch.yaml +0 -24
- package/blocks/input/TextArea.yaml +0 -27
- package/blocks/input/TextInput.yaml +0 -59
- package/blocks/input/TitleInput.yaml +0 -32
- package/blocks/input/TwitterColorSelector.yaml +0 -24
- package/blocks/input/WeekSelector.yaml +0 -26
- package/blocks/list/ControlledList.yaml +0 -191
- package/blocks/list/List.yaml +0 -157
- package/blocks/list/TimelineList.yaml +0 -136
- package/body.html +0 -1
- package/concepts/blocks.yaml +0 -249
- package/concepts/cli.yaml +0 -173
- package/concepts/connections-and-requests.yaml +0 -114
- package/concepts/context-and-state.yaml +0 -82
- package/concepts/custom-blocks.yaml +0 -190
- package/concepts/custom-code.yaml +0 -197
- package/concepts/events-and-actions.yaml +0 -224
- package/concepts/hosting-files.yaml +0 -50
- package/concepts/layout.yaml +0 -1464
- package/concepts/lists.yaml +0 -162
- package/concepts/lowdefy-schema.yaml +0 -245
- package/concepts/operators.yaml +0 -66
- package/concepts/overview.yaml +0 -48
- package/concepts/secrets.yaml +0 -56
- package/connections/AWSS3.yaml +0 -228
- package/connections/AmazonRedshift.yaml +0 -75
- package/connections/AxiosHttp.yaml +0 -194
- package/connections/Elasticsearch.yaml +0 -378
- package/connections/GoogleSheet.yaml +0 -332
- package/connections/Knex.yaml +0 -181
- package/connections/KnexRequests.md +0 -121
- package/connections/MSSQL.yaml +0 -90
- package/connections/MariaDB.yaml +0 -77
- package/connections/MongoDB.yaml +0 -581
- package/connections/MySQL.yaml +0 -92
- package/connections/OracleDB.yaml +0 -73
- package/connections/PostgreSQL.yaml +0 -99
- package/connections/Redis.yaml +0 -147
- package/connections/SQLite.yaml +0 -94
- package/connections/SendGridMail.yaml +0 -113
- package/connections/Stripe.yaml +0 -139
- package/deployment/aws-lambda.yaml +0 -128
- package/deployment/docker.yaml +0 -118
- package/deployment/netlify.yaml +0 -69
- package/deployment/node-server.yaml +0 -111
- package/head.html +0 -7
- package/howto/generate-csv.yaml.njk +0 -252
- package/howto/generate-pdf.yaml.njk +0 -651
- package/howto/generateCsv/lowdefy.yaml +0 -64
- package/howto/generateCsv/public/csvMake.js +0 -27
- package/howto/generatePdf/inv_template.yaml +0 -200
- package/howto/generatePdf/lowdefy.yaml +0 -117
- package/howto/generatePdf/my_header.html +0 -1
- package/howto/generatePdf/public/logo_example.png +0 -0
- package/howto/generatePdf/public/modules/importUmd.js +0 -7
- package/howto/generatePdf/public/modules/pdfMake.js +0 -7
- package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
- package/howto/use-refrences.md +0 -5
- package/introduction.yaml +0 -100
- package/lowdefy.yaml +0 -66
- package/menus.yaml +0 -832
- package/operators/_actions.yaml +0 -123
- package/operators/_and.yaml +0 -90
- package/operators/_args.yaml +0 -79
- package/operators/_array.yaml +0 -326
- package/operators/_base64.yaml +0 -56
- package/operators/_change_case.yaml +0 -347
- package/operators/_date.yaml +0 -71
- package/operators/_diff.yaml +0 -75
- package/operators/_divide.yaml +0 -46
- package/operators/_eq.yaml +0 -67
- package/operators/_event.yaml +0 -103
- package/operators/_format.yaml +0 -209
- package/operators/_function.yaml +0 -66
- package/operators/_get.yaml +0 -108
- package/operators/_global.yaml +0 -107
- package/operators/_gt.yaml +0 -65
- package/operators/_gte.yaml +0 -65
- package/operators/_hash.yaml +0 -109
- package/operators/_if.yaml +0 -44
- package/operators/_if_none.yaml +0 -61
- package/operators/_index.yaml +0 -65
- package/operators/_input.yaml +0 -114
- package/operators/_js.yaml +0 -189
- package/operators/_json.yaml +0 -128
- package/operators/_list_contexts.yaml +0 -37
- package/operators/_location.yaml +0 -59
- package/operators/_log.yaml +0 -36
- package/operators/_lt.yaml +0 -65
- package/operators/_lte.yaml +0 -65
- package/operators/_math.yaml +0 -374
- package/operators/_media.yaml +0 -86
- package/operators/_menu.yaml +0 -81
- package/operators/_mql.yaml +0 -101
- package/operators/_ne.yaml +0 -77
- package/operators/_not.yaml +0 -47
- package/operators/_number.yaml +0 -157
- package/operators/_nunjucks.yaml +0 -73
- package/operators/_object.yaml +0 -193
- package/operators/_operator.yaml +0 -47
- package/operators/_or.yaml +0 -81
- package/operators/_product.yaml +0 -59
- package/operators/_random.yaml +0 -104
- package/operators/_ref.yaml +0 -266
- package/operators/_regex.yaml +0 -83
- package/operators/_request.yaml +0 -50
- package/operators/_secret.yaml +0 -74
- package/operators/_state.yaml +0 -114
- package/operators/_string.yaml +0 -283
- package/operators/_subtract.yaml +0 -38
- package/operators/_sum.yaml +0 -59
- package/operators/_switch.yaml +0 -51
- package/operators/_type.yaml +0 -92
- package/operators/_uri.yaml +0 -56
- package/operators/_url_query.yaml +0 -120
- package/operators/_user.yaml +0 -107
- package/operators/_uuid.yaml +0 -114
- package/operators/_var.yaml +0 -105
- package/operators/_yaml.yaml +0 -107
- package/pages.yaml +0 -227
- 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/lowdefy_app_schema.png +0 -0
- package/public/modules/csvMake.js +0 -27
- package/public/modules/filterDefaultValue.js +0 -48
- package/public/modules/importUmd.js +0 -7
- package/public/modules/index.js +0 -5
- package/public/modules/pdfMake.js +0 -7
- package/public/modules/test/filterDefaultValue.test.js +0 -91
- package/public/modules/vfs_fonts.js +0 -12
- package/public/sitemap.xml +0 -1024
- package/templates/actions.yaml.njk +0 -68
- package/templates/blocks/defaultValueTransformer.js +0 -53
- package/templates/blocks/exampleTransformer.js +0 -81
- package/templates/blocks/layout.yaml +0 -114
- package/templates/blocks/propertiesFormTransformer.js +0 -419
- package/templates/blocks/propertiesGetterTransformer.js +0 -132
- package/templates/blocks/schema.yaml.njk +0 -42
- package/templates/blocks/style.yaml +0 -26
- package/templates/blocks/template.yaml.njk +0 -495
- package/templates/blog.yaml.njk +0 -221
- package/templates/cli_command.yaml.njk +0 -37
- package/templates/footer.yaml.njk +0 -604
- package/templates/general.yaml.njk +0 -124
- package/templates/generateSitemap.js +0 -41
- package/templates/header.yaml +0 -138
- package/templates/navigation_buttons.yaml +0 -68
- package/templates/operators.yaml.njk +0 -82
- package/templates/operatorsMethodTransformer.js +0 -119
- package/templates/test/array.test.js +0 -1335
- package/templates/test/boolean.test.js +0 -98
- package/templates/test/button.test.js +0 -166
- package/templates/test/color.test.js +0 -126
- package/templates/test/enum.test.js +0 -105
- package/templates/test/icon.test.js +0 -109
- package/templates/test/integer.test.js +0 -99
- package/templates/test/manual.test.js +0 -238
- package/templates/test/number.test.js +0 -99
- package/templates/test/object.test.js +0 -434
- package/templates/test/oneOf.test.js +0 -794
- package/templates/test/string.test.js +0 -98
- package/templates/test/yaml.test.js +0 -605
- package/tutorial/next-steps.yaml +0 -83
- package/tutorial/tutorial-actions-operators-config.yaml +0 -142
- package/tutorial/tutorial-actions-operators.yaml +0 -436
- package/tutorial/tutorial-add-blocks-config.yaml +0 -109
- package/tutorial/tutorial-add-blocks.yaml +0 -195
- package/tutorial/tutorial-create-page-config.yaml +0 -77
- package/tutorial/tutorial-create-page.yaml +0 -196
- package/tutorial/tutorial-deploy.yaml +0 -146
- package/tutorial/tutorial-requests-config.yaml +0 -186
- package/tutorial/tutorial-requests.yaml +0 -338
- package/tutorial/tutorial-start.yaml +0 -282
- package/users/login-and-logout.yaml +0 -164
- package/users/openid-connect.yaml +0 -84
- package/users/protected-pages.yaml +0 -67
- package/users/roles.yaml +0 -70
- package/users/user-object.yaml +0 -73
- package/users/users-introduction.yaml +0 -80
- package/version.yaml +0 -1
package/actions/CallMethod.yaml
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: CallMethod
|
|
19
|
-
pageTitle: CallMethod
|
|
20
|
-
filePath: actions/CallMethod.yaml
|
|
21
|
-
types: |
|
|
22
|
-
```
|
|
23
|
-
(params: {
|
|
24
|
-
blockId: string,
|
|
25
|
-
method: string,
|
|
26
|
-
args?: any[]
|
|
27
|
-
}): void
|
|
28
|
-
```
|
|
29
|
-
description: |
|
|
30
|
-
The `CallMethod` action is used to call a method defined by another block.
|
|
31
|
-
params: |
|
|
32
|
-
###### object
|
|
33
|
-
- `blockId: string`: __Required__ - The id of the block.
|
|
34
|
-
- `method: string`: __Required__ - The name of the method that should be called.
|
|
35
|
-
- `args: any[]`: The array of positional arguments with which the method should be called.
|
|
36
|
-
|
|
37
|
-
examples: |
|
|
38
|
-
###### Open a modal:
|
|
39
|
-
```yaml
|
|
40
|
-
- id: toggle_modal
|
|
41
|
-
type: CallMethod
|
|
42
|
-
params:
|
|
43
|
-
blockId: my_modal
|
|
44
|
-
method: toggleOpen
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
###### Display a message with args:
|
|
48
|
-
```yaml
|
|
49
|
-
- id: display_message
|
|
50
|
-
type: CallMethod
|
|
51
|
-
params:
|
|
52
|
-
blockId: my_message
|
|
53
|
-
method: open
|
|
54
|
-
args:
|
|
55
|
-
- content: Hello
|
|
56
|
-
duration: 4
|
|
57
|
-
```
|
package/actions/JsAction.yaml
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: JsAction
|
|
19
|
-
pageTitle: JsAction
|
|
20
|
-
filePath: actions/JsAction.yaml
|
|
21
|
-
warning: |
|
|
22
|
-
SECURITY WARNING: The JsAction executes JavaScript inside your Lowdefy app. Insecure code can expose your app or data. Since Lowdefy doesn't validate your JavaScript, make sure that you only load trusted code.
|
|
23
|
-
types: |
|
|
24
|
-
```
|
|
25
|
-
(params: {
|
|
26
|
-
name: string,
|
|
27
|
-
args?: any[]
|
|
28
|
-
}): void
|
|
29
|
-
```
|
|
30
|
-
description: |
|
|
31
|
-
The `JsAction` action is used to call a custom JavaScript function which was loaded onto the page using the `window.lowdefy.registerJsAction()` method. This JavaScript function can be asynchronous. See [Custom Code](/custom-code) for more details on how to register a new JavaScript action.
|
|
32
|
-
|
|
33
|
-
The returned result of the JavaScript function is accessible through the [`_actions`](/_actions) operator for subsequent actions in the event action list.
|
|
34
|
-
|
|
35
|
-
#### JsAction function parameters
|
|
36
|
-
|
|
37
|
-
A `JsAction` function is called with a context object which includes all [`context` data objects](/context-and-state) as well as the list of `args` passed to the action.
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
|
-
(context: {
|
|
41
|
-
actions: object,
|
|
42
|
-
contextId: string,
|
|
43
|
-
global: object,
|
|
44
|
-
input: object,
|
|
45
|
-
pageId: string,
|
|
46
|
-
requests: object,
|
|
47
|
-
state: object,
|
|
48
|
-
urlQuery: object,
|
|
49
|
-
user: object,
|
|
50
|
-
},
|
|
51
|
-
...args?: any[]): any
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
#### Using Lowdefy actions in a JsAction
|
|
55
|
-
|
|
56
|
-
The context passed to the custom JsAction function contains an object called `actions`. This object contains all the Lowdefy action functions like `SetState`, `Request`, and `CallMethod`. The functions can be called using the same parameters as when they are used directly in the Lowdefy configuration. Operators in these parameters are not evaluated.
|
|
57
|
-
|
|
58
|
-
params: |
|
|
59
|
-
###### object
|
|
60
|
-
- `name: string`: __Required__ - The registered name of the JavaScript function to call when the action is triggered.
|
|
61
|
-
- `args: any[]`: The array of positional arguments with which the JavaScript function should be called.
|
|
62
|
-
|
|
63
|
-
examples: |
|
|
64
|
-
##### Set a [Intercom](https://www.intercom.com/) user when a page is initialized:
|
|
65
|
-
|
|
66
|
-
```yaml
|
|
67
|
-
# lowdefy.yaml
|
|
68
|
-
name: intercom-example
|
|
69
|
-
lowdefy: '3.23.2'
|
|
70
|
-
app:
|
|
71
|
-
html:
|
|
72
|
-
appendBody: |
|
|
73
|
-
<script>
|
|
74
|
-
function setIntercomUser(context) {
|
|
75
|
-
window.intercomSettings = {
|
|
76
|
-
app_id: "{{ your_intercom_app_id }}",
|
|
77
|
-
name: context.user.name,
|
|
78
|
-
email: context.user.email,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
window.lowdefy.registerJsAction('setIntercomUser', setIntercomUser);
|
|
82
|
-
</script>
|
|
83
|
-
<script>
|
|
84
|
-
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');
|
|
85
|
-
ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];
|
|
86
|
-
i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');
|
|
87
|
-
s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/{{ your_intercom_app_id }}';
|
|
88
|
-
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};
|
|
89
|
-
if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
|
|
90
|
-
</script>
|
|
91
|
-
pages:
|
|
92
|
-
- id: home
|
|
93
|
-
type: PageHeaderMenu
|
|
94
|
-
events:
|
|
95
|
-
onInitAsync:
|
|
96
|
-
- id: set_intercom_user
|
|
97
|
-
type: JsAction # TODO:
|
|
98
|
-
params:
|
|
99
|
-
name: setIntercomUser
|
|
100
|
-
blocks:
|
|
101
|
-
# ...
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
##### Highlight search term returned by [MongoDB Search Highlight](https://docs.atlas.mongodb.com/reference/atlas-search/highlighting/):
|
|
105
|
-
Add a JavaScript file to highlight the search text by wapping the highlighted text with `<span style="background: yellow;">{{ value }}</span>`:
|
|
106
|
-
```js
|
|
107
|
-
// file: /public/highlightText.js
|
|
108
|
-
function highlightText(context, data) {
|
|
109
|
-
return data.map((item) => {
|
|
110
|
-
item.highlights.forEach((light) => {
|
|
111
|
-
const paths = light.path.split('.');
|
|
112
|
-
const key = paths[paths.length - 1];
|
|
113
|
-
paths.pop();
|
|
114
|
-
let res = item;
|
|
115
|
-
paths.forEach((key) => {
|
|
116
|
-
res = res[key];
|
|
117
|
-
});
|
|
118
|
-
res[key] = light.texts.reduce((acc, obj) => {
|
|
119
|
-
if (obj.type === 'hit') {
|
|
120
|
-
return acc.concat('<span style="background: yellow;">', obj.value, '</span>');
|
|
121
|
-
}
|
|
122
|
-
return acc.concat(obj.value);
|
|
123
|
-
}, '');
|
|
124
|
-
});
|
|
125
|
-
return item;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
export default highlightText;
|
|
129
|
-
```
|
|
130
|
-
Import custom JavaScript modules:
|
|
131
|
-
```js
|
|
132
|
-
// file: /public/modules.js
|
|
133
|
-
import highlightText from './highlightText.js';
|
|
134
|
-
window.lowdefy.registerJsAction('highlightText', highlightText);
|
|
135
|
-
````
|
|
136
|
-
Lowdefy setup:
|
|
137
|
-
```yaml
|
|
138
|
-
# file: lowdefy.yaml
|
|
139
|
-
name: text-highlight-example
|
|
140
|
-
lowdefy: '3.23.2'
|
|
141
|
-
app:
|
|
142
|
-
html:
|
|
143
|
-
# Load the custom modules into the index.html head tag.
|
|
144
|
-
appendHead: |
|
|
145
|
-
<script type="module" src="/public/modules.js"></script>
|
|
146
|
-
connections:
|
|
147
|
-
- id: products
|
|
148
|
-
type: MongoDBCollection
|
|
149
|
-
properties:
|
|
150
|
-
collection: products
|
|
151
|
-
databaseUri:
|
|
152
|
-
_secret: MDB_URI
|
|
153
|
-
pages:
|
|
154
|
-
- id: home
|
|
155
|
-
type: PageHeaderMenu
|
|
156
|
-
requests:
|
|
157
|
-
- id: search_products
|
|
158
|
-
type: MongoDBAggregation
|
|
159
|
-
connectionId: products
|
|
160
|
-
properties:
|
|
161
|
-
pipeline:
|
|
162
|
-
_array.concat:
|
|
163
|
-
- - $search:
|
|
164
|
-
compound:
|
|
165
|
-
should:
|
|
166
|
-
- text:
|
|
167
|
-
query:
|
|
168
|
-
_string.concat:
|
|
169
|
-
- '*'
|
|
170
|
-
- _state: search.input
|
|
171
|
-
- '*'
|
|
172
|
-
path:
|
|
173
|
-
- title
|
|
174
|
-
- description
|
|
175
|
-
- wildcard:
|
|
176
|
-
query:
|
|
177
|
-
_string.concat:
|
|
178
|
-
- '*'
|
|
179
|
-
- _state: search.input
|
|
180
|
-
- '*'
|
|
181
|
-
path:
|
|
182
|
-
- title
|
|
183
|
-
- description
|
|
184
|
-
allowAnalyzedField: true
|
|
185
|
-
highlight:
|
|
186
|
-
path:
|
|
187
|
-
- title
|
|
188
|
-
- description
|
|
189
|
-
- $addFields:
|
|
190
|
-
score:
|
|
191
|
-
$meta: searchScore
|
|
192
|
-
highlights:
|
|
193
|
-
$meta: searchHighlights
|
|
194
|
-
blocks:
|
|
195
|
-
- id: search.input
|
|
196
|
-
type: TextInput
|
|
197
|
-
properties:
|
|
198
|
-
title: Type to search products
|
|
199
|
-
prefix: AiOutlinedSearch
|
|
200
|
-
events:
|
|
201
|
-
onChange:
|
|
202
|
-
- id: get_search # get search_products query for search.input
|
|
203
|
-
type: Request
|
|
204
|
-
params: search_products
|
|
205
|
-
- id: apply_highlight # apply the highlight transformation to the request data.
|
|
206
|
-
type: JsAction # TODO:
|
|
207
|
-
params:
|
|
208
|
-
name: highlightText
|
|
209
|
-
args:
|
|
210
|
-
- _request: search_products
|
|
211
|
-
- id: set_state # set the response of the apply_highlight action to state
|
|
212
|
-
type: SetState
|
|
213
|
-
params:
|
|
214
|
-
found_products:
|
|
215
|
-
_actions: apply_highlight.response
|
|
216
|
-
- id: product_results
|
|
217
|
-
type: Html
|
|
218
|
-
properties:
|
|
219
|
-
html:
|
|
220
|
-
_nunjucks:
|
|
221
|
-
template: |
|
|
222
|
-
<ul>
|
|
223
|
-
{% for item in found_products %}
|
|
224
|
-
<li>{{ item.title | safe }} - {{ item.description | safe}}</li>
|
|
225
|
-
{% endfor %}
|
|
226
|
-
</ul>
|
|
227
|
-
on:
|
|
228
|
-
found_products:
|
|
229
|
-
_state: found_products
|
|
230
|
-
```
|
|
231
|
-
NOTE: For this example to work, you will need a `products` collection in your MongoDB database, populated with `{title: '...', description: '...'}` data objects including the following search index on the `products` collection:
|
|
232
|
-
```json
|
|
233
|
-
{
|
|
234
|
-
"mappings": {
|
|
235
|
-
"dynamic": true,
|
|
236
|
-
"fields": {
|
|
237
|
-
"title": {
|
|
238
|
-
"type": "string"
|
|
239
|
-
},
|
|
240
|
-
"description": {
|
|
241
|
-
"type": "string"
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
##### Use Lowdefy SetState action:
|
|
249
|
-
|
|
250
|
-
```js
|
|
251
|
-
// file: /public/theAnswer.js
|
|
252
|
-
function theAnswer({actions}) {
|
|
253
|
-
// Think for a while...
|
|
254
|
-
return actions.SetState({ answer: 42 })
|
|
255
|
-
}
|
|
256
|
-
export default theAnswer;
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
##### Use Lowdefy Request action to loop over a list of requests:
|
|
260
|
-
```js
|
|
261
|
-
// file: /public/loopRequests.js
|
|
262
|
-
function loopRequests({ actions }, ...requestIds) {
|
|
263
|
-
return Promise.all(requestIds.map((id) => actions.Request(id)));
|
|
264
|
-
}
|
|
265
|
-
export default loopRequests;
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
```yaml
|
|
269
|
-
id: call_all_requests
|
|
270
|
-
type: Button
|
|
271
|
-
events:
|
|
272
|
-
onClick:
|
|
273
|
-
- id: loop_requests
|
|
274
|
-
type: JsAction # TODO:
|
|
275
|
-
params:
|
|
276
|
-
name: loopRequests
|
|
277
|
-
args:
|
|
278
|
-
- request_1
|
|
279
|
-
- request_2
|
|
280
|
-
- request_3
|
|
281
|
-
```
|
package/actions/Link.yaml
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: Link
|
|
19
|
-
pageTitle: Link
|
|
20
|
-
filePath: actions/Link.yaml
|
|
21
|
-
types: |
|
|
22
|
-
```
|
|
23
|
-
(pageId: string): void
|
|
24
|
-
(params: {
|
|
25
|
-
back?: boolean,
|
|
26
|
-
home?: boolean,
|
|
27
|
-
input?: object,
|
|
28
|
-
newTab?:boolean,
|
|
29
|
-
pageId?: string,
|
|
30
|
-
url?: string,
|
|
31
|
-
urlQuery? object
|
|
32
|
-
}): void
|
|
33
|
-
```
|
|
34
|
-
description: |
|
|
35
|
-
The `Link` action is used to link a user to another page. An input can be passed to the next page using either the
|
|
36
|
-
`urlQuery`, which is visible to the user, but persists if the browser is refreshed, or by using the `input` object, which is not
|
|
37
|
-
visible to the user.
|
|
38
|
-
params: |
|
|
39
|
-
###### string
|
|
40
|
-
The pageId of a page in the app to link to.
|
|
41
|
-
|
|
42
|
-
###### object
|
|
43
|
-
- `back: boolean`: Go to the previous page if true (has the same effect as using the browser back button).
|
|
44
|
-
- `home: boolean`: Link to the home page. This is either the configured public or authenticated homepage, or the first page in the default menu visible to the user.
|
|
45
|
-
- `input: object`: Object to set as the input for the linked page.
|
|
46
|
-
- `newTab: boolean`: Open the link in a new tab.
|
|
47
|
-
- `pageId: string`: The pageId of a page in the app to link to.
|
|
48
|
-
- `url: string`: Link to an external url.
|
|
49
|
-
- `urlQuery: object`: Object to set as the urlQuery for the linked page.
|
|
50
|
-
|
|
51
|
-
examples: |
|
|
52
|
-
###### Shorthand, only specify pageId as string:
|
|
53
|
-
```yaml
|
|
54
|
-
- id: shorthand
|
|
55
|
-
type: Link
|
|
56
|
-
params: my_page_id
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
###### Specify pageId:
|
|
60
|
-
```yaml
|
|
61
|
-
- id: link_page_id
|
|
62
|
-
type: Link
|
|
63
|
-
params:
|
|
64
|
-
pageId: myPageId
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
###### Link to home page:
|
|
68
|
-
```yaml
|
|
69
|
-
- id: link_home
|
|
70
|
-
type: Link
|
|
71
|
-
params:
|
|
72
|
-
home: true
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
###### Link to an external url:
|
|
76
|
-
```yaml
|
|
77
|
-
- id: link_url
|
|
78
|
-
type: Link
|
|
79
|
-
params:
|
|
80
|
-
url: www.lowdefy.com
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
###### Open a link in a new tab:
|
|
84
|
-
```yaml
|
|
85
|
-
- id: link_new_tab
|
|
86
|
-
type: Link
|
|
87
|
-
params:
|
|
88
|
-
pageId: my_page_id
|
|
89
|
-
newTab: true
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
###### Set the urlQuery of the page that is linked to:
|
|
93
|
-
```yaml
|
|
94
|
-
- id: link_url_query
|
|
95
|
-
type: Link
|
|
96
|
-
params:
|
|
97
|
-
pageId: my_page_id
|
|
98
|
-
urlQuery:
|
|
99
|
-
id:
|
|
100
|
-
_state: id
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
###### Set the input of the page that is linked to:
|
|
104
|
-
```yaml
|
|
105
|
-
- id: link_input
|
|
106
|
-
type: Link
|
|
107
|
-
params:
|
|
108
|
-
pageId: my_page_id
|
|
109
|
-
input:
|
|
110
|
-
id:
|
|
111
|
-
_args: row.id
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
###### Go to the previous page:
|
|
115
|
-
```yaml
|
|
116
|
-
- id: link_back
|
|
117
|
-
type: Link
|
|
118
|
-
params:
|
|
119
|
-
back: true
|
|
120
|
-
```
|
package/actions/Login.yaml
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: Login
|
|
19
|
-
pageTitle: Login
|
|
20
|
-
filePath: actions/Login.yaml
|
|
21
|
-
types: |
|
|
22
|
-
```
|
|
23
|
-
(pageId: string): void
|
|
24
|
-
(params: {
|
|
25
|
-
authUrlQueryParams?: object
|
|
26
|
-
pageId?: string,
|
|
27
|
-
input?: object,
|
|
28
|
-
urlQuery? object
|
|
29
|
-
}): void
|
|
30
|
-
```
|
|
31
|
-
description: |
|
|
32
|
-
The `Login` action requests the OpenID provider's authorization URL from the Lowdefy server. The user is redirected to this URL, which normally hosts a login page. If the user is already logged in at the provider, the provider might redirect the user back without requiring a password again.
|
|
33
|
-
|
|
34
|
-
The `Login` action can be used to update the `user` object, for example to update the user profile after it has been edited, or to make sure the user token is still valid before editing or creating a record in a database.
|
|
35
|
-
|
|
36
|
-
See [here](/login-and-logout) for information on logging in.
|
|
37
|
-
params: |
|
|
38
|
-
###### object
|
|
39
|
-
- `authUrlQueryParams: object`: Query parameters to set for the authorization URL.
|
|
40
|
-
- `pageId: string`: The pageId of the page to redirect to after the login flow is complete
|
|
41
|
-
- `input: object`: The input to set for the page the user is redirected to after login.
|
|
42
|
-
- `urlQuery: object`: The urlQuery to set for the page the user is redirected to after login.
|
|
43
|
-
|
|
44
|
-
examples: |
|
|
45
|
-
###### Login and redirect to home:
|
|
46
|
-
```yaml
|
|
47
|
-
- id: login
|
|
48
|
-
type: Login
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
###### Login, with input, pageId and urlQuery:
|
|
52
|
-
```yaml
|
|
53
|
-
- id: login
|
|
54
|
-
type: Login
|
|
55
|
-
params:
|
|
56
|
-
input:
|
|
57
|
-
input1: value
|
|
58
|
-
pageId: page1
|
|
59
|
-
urlQuery:
|
|
60
|
-
url1: value
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
###### Only login if user is not logged in:
|
|
64
|
-
```yaml
|
|
65
|
-
- id: login
|
|
66
|
-
type: Login
|
|
67
|
-
skip:
|
|
68
|
-
_ne:
|
|
69
|
-
- _user: sub
|
|
70
|
-
- null
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
###### Request the signup page from the provider:
|
|
74
|
-
```yaml
|
|
75
|
-
- id: Signup
|
|
76
|
-
type: Button
|
|
77
|
-
events:
|
|
78
|
-
onClick:
|
|
79
|
-
- id: login
|
|
80
|
-
type: Login
|
|
81
|
-
params:
|
|
82
|
-
authUrlQueryParams:
|
|
83
|
-
screen_hint: signup
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
###### Link to an external url:
|
|
87
|
-
```yaml
|
|
88
|
-
- id: link_url
|
|
89
|
-
type: Link
|
|
90
|
-
params:
|
|
91
|
-
url: www.lowdefy.com
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
###### Open a link in a new tab:
|
|
95
|
-
```yaml
|
|
96
|
-
- id: link_new_tab
|
|
97
|
-
type: Link
|
|
98
|
-
params:
|
|
99
|
-
pageId: my_page_id
|
|
100
|
-
newTab: true
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
###### Set the urlQuery of the page that is linked to:
|
|
104
|
-
```yaml
|
|
105
|
-
- id: link_url_query
|
|
106
|
-
type: Link
|
|
107
|
-
params:
|
|
108
|
-
pageId: my_page_id
|
|
109
|
-
urlQuery:
|
|
110
|
-
id:
|
|
111
|
-
_state: id
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
###### Set the input of the page that is linked to:
|
|
115
|
-
```yaml
|
|
116
|
-
- id: link_input
|
|
117
|
-
type: Link
|
|
118
|
-
params:
|
|
119
|
-
pageId: my_page_id
|
|
120
|
-
input:
|
|
121
|
-
id:
|
|
122
|
-
_args: row.id
|
|
123
|
-
```
|
package/actions/Logout.yaml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: Logout
|
|
19
|
-
pageTitle: Logout
|
|
20
|
-
filePath: actions/Logout.yaml
|
|
21
|
-
types: |
|
|
22
|
-
```
|
|
23
|
-
(void): void
|
|
24
|
-
```
|
|
25
|
-
description: |
|
|
26
|
-
When the `Logout` action is called, the user data and authorization cookie are cleared by the app. The `Logout` action does not take any parameters. The user is then redirected to the URL configured in `logoutRedirectUri`, or the app homepage if this is not configured.
|
|
27
|
-
|
|
28
|
-
Some OpenID Connect providers provide a URL that the user can be directed to to logout the user from the the provider. These urls normally have a query parameter that specifies where the provider should redirect the user after they have logged out the user. These redirect URLs are normally configured with the provider.
|
|
29
|
-
|
|
30
|
-
See [here](/login-and-logout) for information on how to configure the logout url.
|
|
31
|
-
params: |
|
|
32
|
-
The `Logout` action does not take any parameters.
|
|
33
|
-
examples: |
|
|
34
|
-
###### A logout button:
|
|
35
|
-
```yaml
|
|
36
|
-
- id: logout_button
|
|
37
|
-
type: Logout
|
|
38
|
-
properties:
|
|
39
|
-
title: Logout
|
|
40
|
-
events:
|
|
41
|
-
onClick:
|
|
42
|
-
- id: logout
|
|
43
|
-
type: Logout
|
|
44
|
-
```
|
package/actions/Message.yaml
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
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/actions.yaml.njk
|
|
17
|
-
vars:
|
|
18
|
-
pageId: MessageAction
|
|
19
|
-
pageTitle: Message
|
|
20
|
-
filePath: actions/Message.yaml
|
|
21
|
-
types: |
|
|
22
|
-
```
|
|
23
|
-
(params: {
|
|
24
|
-
status?: enum,
|
|
25
|
-
duration?: number,
|
|
26
|
-
content?: string,
|
|
27
|
-
}): void
|
|
28
|
-
```
|
|
29
|
-
description: |
|
|
30
|
-
The `Message` action is used to display a message to a user.
|
|
31
|
-
params: |
|
|
32
|
-
###### object
|
|
33
|
-
- `status: enum`: Message status type. Defaults to `success`. One of:
|
|
34
|
-
- `success`
|
|
35
|
-
- `error`
|
|
36
|
-
- `info`
|
|
37
|
-
- `warning`
|
|
38
|
-
- `loading`.
|
|
39
|
-
- `duration: number`: Time in seconds before message disappears. The default is 5.
|
|
40
|
-
- `content: string`: The content of the message.
|
|
41
|
-
examples: |
|
|
42
|
-
###### Display a success message:
|
|
43
|
-
```yaml
|
|
44
|
-
- id: success_message
|
|
45
|
-
type: Message
|
|
46
|
-
params:
|
|
47
|
-
content: Success
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
###### Display an info message that remains visible for 10 seconds:
|
|
51
|
-
```yaml
|
|
52
|
-
- id: info_message
|
|
53
|
-
type: Message
|
|
54
|
-
params:
|
|
55
|
-
content: Something happened
|
|
56
|
-
status: info
|
|
57
|
-
duration: 10
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
###### Display an error message that never disappears:
|
|
61
|
-
```yaml
|
|
62
|
-
- id: error_message
|
|
63
|
-
type: Message
|
|
64
|
-
params:
|
|
65
|
-
content: Something bad happened
|
|
66
|
-
status: error
|
|
67
|
-
duration: 0
|
|
68
|
-
```
|