@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
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const avatar = (path) => ({
|
|
18
|
-
id: `${path}_avatar_card`,
|
|
19
|
-
type: 'Card',
|
|
20
|
-
layout: {
|
|
21
|
-
contentGutter: 0,
|
|
22
|
-
},
|
|
23
|
-
properties: {
|
|
24
|
-
size: 'small',
|
|
25
|
-
title: 'avatar:',
|
|
26
|
-
inner: true,
|
|
27
|
-
},
|
|
28
|
-
blocks: [
|
|
29
|
-
{
|
|
30
|
-
id: `${path}.color`,
|
|
31
|
-
type: 'CircleColorSelector',
|
|
32
|
-
layout: {
|
|
33
|
-
_global: 'settings_input_layout',
|
|
34
|
-
},
|
|
35
|
-
properties: {
|
|
36
|
-
title: 'color',
|
|
37
|
-
size: 'small',
|
|
38
|
-
label: {
|
|
39
|
-
span: 8,
|
|
40
|
-
align: 'right',
|
|
41
|
-
extra: 'The background color of the avatar. Should be a hex color string.',
|
|
42
|
-
},
|
|
43
|
-
circleSize: 14,
|
|
44
|
-
circleSpacing: 8,
|
|
45
|
-
colors: [
|
|
46
|
-
'#f5222d',
|
|
47
|
-
'#fa541c',
|
|
48
|
-
'#fa8c16',
|
|
49
|
-
'#faad14',
|
|
50
|
-
'#fadb14',
|
|
51
|
-
'#a0d911',
|
|
52
|
-
'#52c41a',
|
|
53
|
-
'#13c2c2',
|
|
54
|
-
'#1890ff',
|
|
55
|
-
'#2f54eb',
|
|
56
|
-
'#722ed1',
|
|
57
|
-
'#eb2f96',
|
|
58
|
-
'#595959',
|
|
59
|
-
'#bfbfbf',
|
|
60
|
-
'#d9d9d9',
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: `${path}.content`,
|
|
66
|
-
type: 'TextInput',
|
|
67
|
-
layout: {
|
|
68
|
-
_global: 'settings_input_layout',
|
|
69
|
-
},
|
|
70
|
-
properties: {
|
|
71
|
-
title: 'content',
|
|
72
|
-
size: 'small',
|
|
73
|
-
label: {
|
|
74
|
-
span: 8,
|
|
75
|
-
align: 'right',
|
|
76
|
-
extra: 'Text to display inside avatar.',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const button = (path) => ({
|
|
84
|
-
id: `${path}_button_card`,
|
|
85
|
-
type: 'Card',
|
|
86
|
-
layout: {
|
|
87
|
-
contentGutter: 0,
|
|
88
|
-
},
|
|
89
|
-
properties: {
|
|
90
|
-
size: 'small',
|
|
91
|
-
title: 'button:',
|
|
92
|
-
inner: true,
|
|
93
|
-
},
|
|
94
|
-
blocks: [
|
|
95
|
-
{
|
|
96
|
-
id: `${path}.icon`,
|
|
97
|
-
type: 'Selector',
|
|
98
|
-
layout: {
|
|
99
|
-
_global: 'settings_input_layout',
|
|
100
|
-
},
|
|
101
|
-
properties: {
|
|
102
|
-
title: 'icon',
|
|
103
|
-
size: 'small',
|
|
104
|
-
label: {
|
|
105
|
-
span: 8,
|
|
106
|
-
align: 'right',
|
|
107
|
-
extra: 'Name of an Ant Design Icon or properties of an Icon block to use icon in button.',
|
|
108
|
-
},
|
|
109
|
-
showSearch: true,
|
|
110
|
-
allowClear: true,
|
|
111
|
-
options: { _global: 'all_icons' },
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: `${path}.title`,
|
|
116
|
-
type: 'TextInput',
|
|
117
|
-
layout: {
|
|
118
|
-
_global: 'settings_input_layout',
|
|
119
|
-
},
|
|
120
|
-
properties: {
|
|
121
|
-
title: 'title',
|
|
122
|
-
size: 'small',
|
|
123
|
-
label: {
|
|
124
|
-
span: 8,
|
|
125
|
-
align: 'right',
|
|
126
|
-
extra: 'Title text on the button.',
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
id: `${path}.type`,
|
|
132
|
-
type: 'ButtonSelector',
|
|
133
|
-
layout: {
|
|
134
|
-
_global: 'settings_input_layout',
|
|
135
|
-
},
|
|
136
|
-
properties: {
|
|
137
|
-
title: 'type',
|
|
138
|
-
size: 'small',
|
|
139
|
-
options: ['primary', 'default', 'dashed', 'danger', 'link', 'text'],
|
|
140
|
-
label: {
|
|
141
|
-
span: 8,
|
|
142
|
-
align: 'right',
|
|
143
|
-
extra: 'The button type.',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const oneOf = ({ propertyName, propertyDescription, nameSpace }) => {
|
|
151
|
-
const block = {
|
|
152
|
-
id: propertyName,
|
|
153
|
-
type: 'Card',
|
|
154
|
-
layout: {
|
|
155
|
-
contentGutter: 0,
|
|
156
|
-
},
|
|
157
|
-
properties: {
|
|
158
|
-
size: 'small',
|
|
159
|
-
title: `Select ${propertyName} type`,
|
|
160
|
-
inner: true,
|
|
161
|
-
bodyStyle: { padding: 0 },
|
|
162
|
-
headerStyle: { color: 'rgba(0, 0, 0, 0.45)', background: 'rgba(0, 0, 0, 0.06)' },
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
block.areas = {
|
|
166
|
-
extra: {
|
|
167
|
-
blocks: [
|
|
168
|
-
{
|
|
169
|
-
id: `__type_${nameSpace}${propertyName}`,
|
|
170
|
-
type: 'ButtonSelector',
|
|
171
|
-
properties: {
|
|
172
|
-
options: propertyDescription.oneOf.map((item) =>
|
|
173
|
-
item.type === 'array' ? `${item.items.type}[]` : item.type
|
|
174
|
-
),
|
|
175
|
-
size: 'small',
|
|
176
|
-
color: 'rgba(0, 0, 0, 0.1)',
|
|
177
|
-
buttonStyle: 'outlined',
|
|
178
|
-
label: {
|
|
179
|
-
disabled: true,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
|
-
content: {
|
|
186
|
-
blocks: propertyDescription.oneOf.map((item) => {
|
|
187
|
-
const bl = makeBlockDefinition({
|
|
188
|
-
propertyName: propertyName,
|
|
189
|
-
propertyDescription: item,
|
|
190
|
-
requiredProperties: [],
|
|
191
|
-
nameSpace: `__${
|
|
192
|
-
item.type === 'array' ? `${item.items.type}_arr` : item.type
|
|
193
|
-
}_${nameSpace}`,
|
|
194
|
-
});
|
|
195
|
-
bl.visible = {
|
|
196
|
-
_if: {
|
|
197
|
-
test: {
|
|
198
|
-
_eq: [
|
|
199
|
-
{ _state: `__type_${nameSpace}${propertyName}` },
|
|
200
|
-
item.type === 'array' ? `${item.items.type}[]` : item.type,
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
then: true,
|
|
204
|
-
else: false,
|
|
205
|
-
},
|
|
206
|
-
};
|
|
207
|
-
return bl;
|
|
208
|
-
}),
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
return block;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
function makeBlockDefinition({
|
|
215
|
-
propertyName,
|
|
216
|
-
propertyDescription,
|
|
217
|
-
requiredProperties,
|
|
218
|
-
nameSpace,
|
|
219
|
-
labelDisabled,
|
|
220
|
-
}) {
|
|
221
|
-
let block = {
|
|
222
|
-
id: `${nameSpace}${propertyName}`,
|
|
223
|
-
layout: { _global: 'settings_input_layout' },
|
|
224
|
-
required: requiredProperties.includes(propertyName),
|
|
225
|
-
properties: {
|
|
226
|
-
title: propertyName,
|
|
227
|
-
size: 'small',
|
|
228
|
-
label: labelDisabled
|
|
229
|
-
? { disabled: true }
|
|
230
|
-
: {
|
|
231
|
-
span: 8,
|
|
232
|
-
align: 'right',
|
|
233
|
-
extra: propertyDescription.description,
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
if (
|
|
239
|
-
propertyDescription.docs &&
|
|
240
|
-
propertyDescription.docs.label &&
|
|
241
|
-
propertyDescription.docs.label.span
|
|
242
|
-
) {
|
|
243
|
-
block.properties.label.span = propertyDescription.docs.label.span;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// displayType
|
|
247
|
-
if (propertyDescription.docs && propertyDescription.docs.displayType) {
|
|
248
|
-
switch (propertyDescription.docs.displayType) {
|
|
249
|
-
case 'manual':
|
|
250
|
-
return propertyDescription.docs.block;
|
|
251
|
-
case 'icon':
|
|
252
|
-
block.type = 'Selector';
|
|
253
|
-
block.properties = {
|
|
254
|
-
...block.properties,
|
|
255
|
-
showSearch: true,
|
|
256
|
-
allowClear: true,
|
|
257
|
-
options: { _global: 'all_icons' },
|
|
258
|
-
};
|
|
259
|
-
return block;
|
|
260
|
-
case 'color':
|
|
261
|
-
block.type = 'CircleColorSelector';
|
|
262
|
-
block.properties.circleSize = 14;
|
|
263
|
-
block.properties.circleSpacing = 8;
|
|
264
|
-
block.properties.colors = [
|
|
265
|
-
'#f5222d',
|
|
266
|
-
'#fa541c',
|
|
267
|
-
'#fa8c16',
|
|
268
|
-
'#faad14',
|
|
269
|
-
'#fadb14',
|
|
270
|
-
'#a0d911',
|
|
271
|
-
'#52c41a',
|
|
272
|
-
'#13c2c2',
|
|
273
|
-
'#1890ff',
|
|
274
|
-
'#2f54eb',
|
|
275
|
-
'#722ed1',
|
|
276
|
-
'#eb2f96',
|
|
277
|
-
'#595959',
|
|
278
|
-
'#bfbfbf',
|
|
279
|
-
'#d9d9d9',
|
|
280
|
-
];
|
|
281
|
-
block.properties.showValue = true;
|
|
282
|
-
return block;
|
|
283
|
-
case 'date':
|
|
284
|
-
block.type = 'DateSelector';
|
|
285
|
-
return block;
|
|
286
|
-
case 'dateRange':
|
|
287
|
-
block.type = 'DateRangeSelector';
|
|
288
|
-
return block;
|
|
289
|
-
case 'yaml':
|
|
290
|
-
block.type = 'TextArea';
|
|
291
|
-
block.properties.placeholder = 'Type YAML here';
|
|
292
|
-
block.properties.autoSize = { minRows: 2 };
|
|
293
|
-
return block;
|
|
294
|
-
case 'text-area':
|
|
295
|
-
block.type = 'TextArea';
|
|
296
|
-
return block;
|
|
297
|
-
case 'button':
|
|
298
|
-
return button(`${nameSpace}${propertyName}`);
|
|
299
|
-
case 'avatar':
|
|
300
|
-
return avatar(`${nameSpace}${propertyName}`);
|
|
301
|
-
default:
|
|
302
|
-
propertyDescription.type = propertyDescription.docs.displayType;
|
|
303
|
-
break;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// enums
|
|
308
|
-
if (propertyDescription.enum) {
|
|
309
|
-
block.type = 'ButtonSelector';
|
|
310
|
-
if (propertyDescription.enum.length >= 5) {
|
|
311
|
-
block.type = 'Selector';
|
|
312
|
-
}
|
|
313
|
-
block.properties.options = propertyDescription.enum;
|
|
314
|
-
return block;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// defaults for type
|
|
318
|
-
switch (propertyDescription.type) {
|
|
319
|
-
case 'boolean':
|
|
320
|
-
block.type = 'Switch';
|
|
321
|
-
return block;
|
|
322
|
-
case 'string':
|
|
323
|
-
block.type = 'TextInput';
|
|
324
|
-
return block;
|
|
325
|
-
case 'number':
|
|
326
|
-
block.type = 'NumberInput';
|
|
327
|
-
block.properties.step = propertyDescription.step ? propertyDescription.step : 0.1;
|
|
328
|
-
if (propertyDescription.maximum != null) {
|
|
329
|
-
block.properties.max = propertyDescription.maximum;
|
|
330
|
-
}
|
|
331
|
-
if (propertyDescription.minimum != null) {
|
|
332
|
-
block.properties.min = propertyDescription.minimum;
|
|
333
|
-
}
|
|
334
|
-
return block;
|
|
335
|
-
case 'integer':
|
|
336
|
-
block.type = 'NumberInput';
|
|
337
|
-
block.properties.step = propertyDescription.step ? propertyDescription.step : 1;
|
|
338
|
-
if (propertyDescription.maximum != null) {
|
|
339
|
-
block.properties.max = propertyDescription.maximum;
|
|
340
|
-
}
|
|
341
|
-
if (propertyDescription.minimum != null) {
|
|
342
|
-
block.properties.min = propertyDescription.minimum;
|
|
343
|
-
}
|
|
344
|
-
return block;
|
|
345
|
-
case 'object':
|
|
346
|
-
block = {
|
|
347
|
-
id: `${nameSpace}${propertyName}`,
|
|
348
|
-
type: 'Card',
|
|
349
|
-
layout: {
|
|
350
|
-
contentGutter: 0,
|
|
351
|
-
},
|
|
352
|
-
properties: {
|
|
353
|
-
size: 'small',
|
|
354
|
-
title: !labelDisabled && `${propertyName}:`,
|
|
355
|
-
bodyStyle: { padding: 0 },
|
|
356
|
-
},
|
|
357
|
-
};
|
|
358
|
-
block.blocks = Object.keys(propertyDescription.properties)
|
|
359
|
-
.sort()
|
|
360
|
-
.map((objectPropertyName) => {
|
|
361
|
-
const bl = makeBlockDefinition({
|
|
362
|
-
propertyName: objectPropertyName,
|
|
363
|
-
propertyDescription: propertyDescription.properties[objectPropertyName],
|
|
364
|
-
requiredProperties: propertyDescription.required || [],
|
|
365
|
-
nameSpace: `${nameSpace}${propertyName}.`,
|
|
366
|
-
});
|
|
367
|
-
return bl;
|
|
368
|
-
});
|
|
369
|
-
return block;
|
|
370
|
-
case 'array':
|
|
371
|
-
block = {
|
|
372
|
-
id: `${nameSpace}${propertyName}`,
|
|
373
|
-
type: 'ControlledList',
|
|
374
|
-
layout: {
|
|
375
|
-
contentGutter: 0,
|
|
376
|
-
},
|
|
377
|
-
properties: {
|
|
378
|
-
size: 'small',
|
|
379
|
-
title: !labelDisabled && `${propertyName}:`,
|
|
380
|
-
itemStyle: { padding: 0 },
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
block.blocks = [
|
|
384
|
-
makeBlockDefinition({
|
|
385
|
-
propertyName: `$`,
|
|
386
|
-
propertyDescription: propertyDescription.items,
|
|
387
|
-
requiredProperties: [],
|
|
388
|
-
nameSpace: `${nameSpace}${propertyName}.`,
|
|
389
|
-
labelDisabled: true,
|
|
390
|
-
}),
|
|
391
|
-
];
|
|
392
|
-
return block;
|
|
393
|
-
case undefined:
|
|
394
|
-
if (propertyDescription.oneOf) {
|
|
395
|
-
return oneOf({ propertyName, propertyDescription, nameSpace });
|
|
396
|
-
}
|
|
397
|
-
return block;
|
|
398
|
-
default:
|
|
399
|
-
return block;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function transformer(obj) {
|
|
404
|
-
const blockProperties = obj.properties.properties;
|
|
405
|
-
const requiredProperties = obj.properties.required || [];
|
|
406
|
-
const blocks = Object.keys(blockProperties)
|
|
407
|
-
.sort()
|
|
408
|
-
.map((propertyName) => {
|
|
409
|
-
return makeBlockDefinition({
|
|
410
|
-
propertyName,
|
|
411
|
-
propertyDescription: blockProperties[propertyName],
|
|
412
|
-
requiredProperties,
|
|
413
|
-
nameSpace: 'block.properties.',
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
return blocks;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
export default transformer;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const oneOfGetter = ({ contextId, options, path, underscores }) => {
|
|
18
|
-
const types = options.map((option) => {
|
|
19
|
-
if (option.type === 'array') {
|
|
20
|
-
return { data: `${option.items.type}_arr`, selector: `${option.items.type}[]` };
|
|
21
|
-
}
|
|
22
|
-
return { data: option.type, selector: option.type };
|
|
23
|
-
});
|
|
24
|
-
const branches = types.map((type, index) => {
|
|
25
|
-
const getter = propertyGetter({
|
|
26
|
-
contextId,
|
|
27
|
-
data: 'state',
|
|
28
|
-
path: `__${type.data}_${path}`,
|
|
29
|
-
property: options[index],
|
|
30
|
-
underscores: underscores,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
case: { _eq: [{ _state: `__type_${path}` }, type.selector] },
|
|
34
|
-
then: getter || { _state: { key: `__${type.data}_${path}`, contextId } },
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
'_mql.expr': {
|
|
39
|
-
on: {},
|
|
40
|
-
expr: {
|
|
41
|
-
$switch: {
|
|
42
|
-
branches,
|
|
43
|
-
default: null,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const arrayGetter = ({ contextId, data, items, path, underscores }) => {
|
|
51
|
-
const getter = propertyGetter({
|
|
52
|
-
contextId: undefined, // Cannot use contextId with _args
|
|
53
|
-
data: 'args',
|
|
54
|
-
path: '0',
|
|
55
|
-
property: items,
|
|
56
|
-
underscores: underscores + '_',
|
|
57
|
-
});
|
|
58
|
-
if (getter) {
|
|
59
|
-
return {
|
|
60
|
-
[`${underscores}array.map`]: {
|
|
61
|
-
on: {
|
|
62
|
-
[`${underscores}if_none`]: [{ [`${underscores}${data}`]: { key: path, contextId } }, []],
|
|
63
|
-
},
|
|
64
|
-
callback: {
|
|
65
|
-
[`${underscores}function`]: getter,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const propertyGetter = ({ contextId, data, path, property, underscores }) => {
|
|
73
|
-
if (property.docs && property.docs.displayType === 'yaml') {
|
|
74
|
-
return {
|
|
75
|
-
[`${underscores}yaml.parse`]: {
|
|
76
|
-
[`${underscores}if_none`]: [{ [`${underscores}${data}`]: { key: path, contextId } }, ''],
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (property.docs && property.docs.displayType === 'manual' && property.docs.getter != null) {
|
|
81
|
-
return property.docs.getter;
|
|
82
|
-
}
|
|
83
|
-
if (property.type === 'object' && property.properties) {
|
|
84
|
-
return objectGetter({
|
|
85
|
-
contextId,
|
|
86
|
-
data,
|
|
87
|
-
path,
|
|
88
|
-
properties: property.properties,
|
|
89
|
-
underscores,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (property.type === 'array' && property.items) {
|
|
93
|
-
return arrayGetter({ contextId, data, items: property.items, path, underscores });
|
|
94
|
-
}
|
|
95
|
-
if (property.oneOf) {
|
|
96
|
-
return oneOfGetter({ contextId, data, options: property.oneOf, path, underscores });
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const objectGetter = ({ contextId, data, path, properties, underscores }) => {
|
|
101
|
-
const getters = [];
|
|
102
|
-
Object.keys(properties).forEach((key) => {
|
|
103
|
-
const getter = propertyGetter({
|
|
104
|
-
contextId,
|
|
105
|
-
data,
|
|
106
|
-
path: `${path}.${key}`,
|
|
107
|
-
property: properties[key],
|
|
108
|
-
underscores,
|
|
109
|
-
});
|
|
110
|
-
if (getter) {
|
|
111
|
-
getters.push({ [key]: getter });
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
return {
|
|
115
|
-
[`${underscores}object.assign`]: [
|
|
116
|
-
{ [`${underscores}${data}`]: { key: path, contextId, default: {} } },
|
|
117
|
-
].concat(getters),
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const transformer = (obj, vars) => {
|
|
122
|
-
const contextId = `${vars.block_type}:${vars.block_type}:{}`;
|
|
123
|
-
return objectGetter({
|
|
124
|
-
contextId,
|
|
125
|
-
data: 'state',
|
|
126
|
-
path: 'block.properties',
|
|
127
|
-
properties: obj.properties.properties,
|
|
128
|
-
underscores: '_',
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export default transformer;
|
|
@@ -1,42 +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
|
-
id: schema_definition
|
|
16
|
-
type: Box
|
|
17
|
-
layout:
|
|
18
|
-
contentGutter: 16
|
|
19
|
-
blocks:
|
|
20
|
-
- id: schema_divider_start
|
|
21
|
-
type: Divider
|
|
22
|
-
properties:
|
|
23
|
-
title: '{{ block_type }} JSON Schema Definition'
|
|
24
|
-
- id: schema_yaml
|
|
25
|
-
type: MarkdownWithCode
|
|
26
|
-
properties:
|
|
27
|
-
content:
|
|
28
|
-
_nunjucks:
|
|
29
|
-
template: |
|
|
30
|
-
{% raw %}
|
|
31
|
-
```yaml
|
|
32
|
-
type: object
|
|
33
|
-
properties:
|
|
34
|
-
{{ schema | safe | indent(2) }}
|
|
35
|
-
```
|
|
36
|
-
{% endraw %}
|
|
37
|
-
on:
|
|
38
|
-
schema:
|
|
39
|
-
_yaml.stringify:
|
|
40
|
-
- _var: schema_definition.schema
|
|
41
|
-
- id: schema_divider_end
|
|
42
|
-
type: Divider
|
|
@@ -1,26 +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
|
-
- id: style_block_input
|
|
16
|
-
type: TextArea
|
|
17
|
-
layout:
|
|
18
|
-
_global: settings_input_layout
|
|
19
|
-
properties:
|
|
20
|
-
title: block
|
|
21
|
-
rows: 3
|
|
22
|
-
size: small
|
|
23
|
-
label:
|
|
24
|
-
span: 8
|
|
25
|
-
align: right
|
|
26
|
-
extra: CSS Object style properties. Should be in YAML format.
|