@lowdefy/docs 3.23.2 → 4.0.0-alpha.10

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 (274) hide show
  1. package/dist/operators/client/filter_default_value.js +55 -0
  2. package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +2 -20
  3. package/{templates/blocks/schemaTransformer.js → dist/types.js} +6 -11
  4. package/package.json +23 -8
  5. package/404.yaml +0 -26
  6. package/CHANGELOG.md +0 -659
  7. package/actions/CallMethod.yaml +0 -57
  8. package/actions/JsAction.yaml +0 -281
  9. package/actions/Link.yaml +0 -120
  10. package/actions/Login.yaml +0 -123
  11. package/actions/Logout.yaml +0 -44
  12. package/actions/Message.yaml +0 -68
  13. package/actions/Notification.yaml +0 -84
  14. package/actions/Request.yaml +0 -70
  15. package/actions/Reset.yaml +0 -42
  16. package/actions/ResetValidation.yaml +0 -102
  17. package/actions/ScrollTo.yaml +0 -100
  18. package/actions/SetGlobal.yaml +0 -78
  19. package/actions/SetState.yaml +0 -85
  20. package/actions/Throw.yaml +0 -89
  21. package/actions/Validate.yaml +0 -104
  22. package/actions/Wait.yaml +0 -40
  23. package/blocks/all_icons.yaml +0 -802
  24. package/blocks/container/Affix.yaml +0 -26
  25. package/blocks/container/Badge.yaml +0 -27
  26. package/blocks/container/Box.yaml +0 -27
  27. package/blocks/container/Card.yaml +0 -29
  28. package/blocks/container/Collapse.yaml +0 -38
  29. package/blocks/container/Comment.yaml +0 -43
  30. package/blocks/container/ConfirmModal.yaml +0 -36
  31. package/blocks/container/Drawer.yaml +0 -45
  32. package/blocks/container/Label.yaml +0 -29
  33. package/blocks/container/Modal.yaml +0 -46
  34. package/blocks/container/Result.yaml +0 -34
  35. package/blocks/container/Span.yaml +0 -27
  36. package/blocks/container/Spin.yaml +0 -27
  37. package/blocks/container/Tabs.yaml +0 -41
  38. package/blocks/container/Tooltip.yaml +0 -38
  39. package/blocks/context/Context.yaml +0 -27
  40. package/blocks/context/PageHCF.yaml +0 -28
  41. package/blocks/context/PageHCSF.yaml +0 -29
  42. package/blocks/context/PageHSCF.yaml +0 -29
  43. package/blocks/context/PageHeaderMenu.yaml +0 -52
  44. package/blocks/context/PageSHCF.yaml +0 -29
  45. package/blocks/context/PageSiderMenu.yaml +0 -53
  46. package/blocks/display/Alert.yaml +0 -26
  47. package/blocks/display/Anchor.yaml +0 -26
  48. package/blocks/display/Avatar.yaml +0 -24
  49. package/blocks/display/Breadcrumb.yaml +0 -29
  50. package/blocks/display/Button.yaml +0 -43
  51. package/blocks/display/DangerousHtml.yaml +0 -62
  52. package/blocks/display/DangerousMarkdown.yaml +0 -46
  53. package/blocks/display/Descriptions.yaml +0 -49
  54. package/blocks/display/Divider.yaml +0 -25
  55. package/blocks/display/EChart.yaml +0 -53
  56. package/blocks/display/Html.yaml +0 -50
  57. package/blocks/display/Icon.yaml +0 -25
  58. package/blocks/display/Img.yaml +0 -40
  59. package/blocks/display/Markdown.yaml +0 -32
  60. package/blocks/display/MarkdownWithCode.yaml +0 -48
  61. package/blocks/display/Menu.yaml +0 -48
  62. package/blocks/display/Message.yaml +0 -34
  63. package/blocks/display/MobileMenu.yaml +0 -48
  64. package/blocks/display/Notification.yaml +0 -34
  65. package/blocks/display/Paragraph.yaml +0 -32
  66. package/blocks/display/Progress.yaml +0 -53
  67. package/blocks/display/Skeleton.yaml +0 -28
  68. package/blocks/display/Statistic.yaml +0 -37
  69. package/blocks/display/Title.yaml +0 -32
  70. package/blocks/input/AutoComplete.yaml +0 -31
  71. package/blocks/input/ButtonSelector.yaml +0 -37
  72. package/blocks/input/CheckboxSelector.yaml +0 -37
  73. package/blocks/input/CheckboxSwitch.yaml +0 -56
  74. package/blocks/input/ChromeColorSelector.yaml +0 -25
  75. package/blocks/input/CircleColorSelector.yaml +0 -25
  76. package/blocks/input/ColorSelector.yaml +0 -25
  77. package/blocks/input/CompactColorSelector.yaml +0 -25
  78. package/blocks/input/DateRangeSelector.yaml +0 -27
  79. package/blocks/input/DateSelector.yaml +0 -27
  80. package/blocks/input/DateTimeSelector.yaml +0 -29
  81. package/blocks/input/GithubColorSelector.yaml +0 -25
  82. package/blocks/input/MonthSelector.yaml +0 -27
  83. package/blocks/input/MultipleSelector.yaml +0 -117
  84. package/blocks/input/NumberInput.yaml +0 -24
  85. package/blocks/input/Pagination.yaml +0 -33
  86. package/blocks/input/ParagraphInput.yaml +0 -32
  87. package/blocks/input/PasswordInput.yaml +0 -48
  88. package/blocks/input/RadioSelector.yaml +0 -36
  89. package/blocks/input/RatingSlider.yaml +0 -24
  90. package/blocks/input/S3UploadButton.yaml +0 -28
  91. package/blocks/input/Selector.yaml +0 -98
  92. package/blocks/input/SliderColorSelector.yaml +0 -24
  93. package/blocks/input/SwatchesColorSelector.yaml +0 -24
  94. package/blocks/input/Switch.yaml +0 -24
  95. package/blocks/input/TextArea.yaml +0 -28
  96. package/blocks/input/TextInput.yaml +0 -59
  97. package/blocks/input/TitleInput.yaml +0 -32
  98. package/blocks/input/TwitterColorSelector.yaml +0 -24
  99. package/blocks/input/WeekSelector.yaml +0 -26
  100. package/blocks/list/ControlledList.yaml +0 -191
  101. package/blocks/list/List.yaml +0 -158
  102. package/blocks/list/TimelineList.yaml +0 -135
  103. package/body.html +0 -1
  104. package/concepts/blocks.yaml +0 -249
  105. package/concepts/cli.yaml +0 -173
  106. package/concepts/connections-and-requests.yaml +0 -114
  107. package/concepts/context-and-state.yaml +0 -82
  108. package/concepts/custom-blocks.yaml +0 -176
  109. package/concepts/custom-code.yaml +0 -196
  110. package/concepts/events-and-actions.yaml +0 -224
  111. package/concepts/hosting-files.yaml +0 -50
  112. package/concepts/layout.yaml +0 -1464
  113. package/concepts/lists.yaml +0 -162
  114. package/concepts/lowdefy-schema.yaml +0 -244
  115. package/concepts/operators.yaml +0 -66
  116. package/concepts/overview.yaml +0 -48
  117. package/concepts/secrets.yaml +0 -56
  118. package/connections/AWSS3.yaml +0 -228
  119. package/connections/AmazonRedshift.yaml +0 -75
  120. package/connections/AxiosHttp.yaml +0 -194
  121. package/connections/Elasticsearch.yaml +0 -378
  122. package/connections/GoogleSheet.yaml +0 -332
  123. package/connections/Knex.yaml +0 -181
  124. package/connections/KnexRequests.md +0 -121
  125. package/connections/MSSQL.yaml +0 -90
  126. package/connections/MariaDB.yaml +0 -77
  127. package/connections/MongoDB.yaml +0 -452
  128. package/connections/MySQL.yaml +0 -92
  129. package/connections/OracleDB.yaml +0 -73
  130. package/connections/PostgreSQL.yaml +0 -99
  131. package/connections/SQLite.yaml +0 -94
  132. package/connections/SendGridMail.yaml +0 -113
  133. package/connections/Stripe.yaml +0 -139
  134. package/deployment/aws-lambda.yaml +0 -128
  135. package/deployment/docker.yaml +0 -118
  136. package/deployment/netlify.yaml +0 -69
  137. package/deployment/node-server.yaml +0 -111
  138. package/head.html +0 -7
  139. package/howto/generate-csv.yaml.njk +0 -251
  140. package/howto/generate-pdf.yaml.njk +0 -651
  141. package/howto/generateCsv/lowdefy.yaml +0 -63
  142. package/howto/generateCsv/public/csvMake.js +0 -27
  143. package/howto/generatePdf/inv_template.yaml +0 -200
  144. package/howto/generatePdf/lowdefy.yaml +0 -116
  145. package/howto/generatePdf/my_header.html +0 -1
  146. package/howto/generatePdf/public/logo_example.png +0 -0
  147. package/howto/generatePdf/public/modules/importUmd.js +0 -7
  148. package/howto/generatePdf/public/modules/pdfMake.js +0 -7
  149. package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
  150. package/introduction.yaml +0 -100
  151. package/lowdefy.yaml +0 -66
  152. package/menus.yaml +0 -841
  153. package/operators/_actions.yaml +0 -123
  154. package/operators/_and.yaml +0 -90
  155. package/operators/_args.yaml +0 -79
  156. package/operators/_array.yaml +0 -326
  157. package/operators/_base64.yaml +0 -56
  158. package/operators/_change_case.yaml +0 -347
  159. package/operators/_date.yaml +0 -71
  160. package/operators/_diff.yaml +0 -76
  161. package/operators/_divide.yaml +0 -46
  162. package/operators/_eq.yaml +0 -67
  163. package/operators/_event.yaml +0 -102
  164. package/operators/_format.yaml +0 -209
  165. package/operators/_function.yaml +0 -66
  166. package/operators/_get.yaml +0 -108
  167. package/operators/_global.yaml +0 -106
  168. package/operators/_gt.yaml +0 -65
  169. package/operators/_gte.yaml +0 -65
  170. package/operators/_hash.yaml +0 -109
  171. package/operators/_if.yaml +0 -44
  172. package/operators/_if_none.yaml +0 -61
  173. package/operators/_index.yaml +0 -64
  174. package/operators/_input.yaml +0 -113
  175. package/operators/_js.yaml +0 -189
  176. package/operators/_json.yaml +0 -128
  177. package/operators/_list_contexts.yaml +0 -37
  178. package/operators/_location.yaml +0 -59
  179. package/operators/_log.yaml +0 -36
  180. package/operators/_lt.yaml +0 -65
  181. package/operators/_lte.yaml +0 -65
  182. package/operators/_math.yaml +0 -374
  183. package/operators/_media.yaml +0 -86
  184. package/operators/_menu.yaml +0 -81
  185. package/operators/_mql.yaml +0 -101
  186. package/operators/_ne.yaml +0 -77
  187. package/operators/_not.yaml +0 -47
  188. package/operators/_number.yaml +0 -157
  189. package/operators/_nunjucks.yaml +0 -73
  190. package/operators/_object.yaml +0 -193
  191. package/operators/_operator.yaml +0 -47
  192. package/operators/_or.yaml +0 -81
  193. package/operators/_product.yaml +0 -59
  194. package/operators/_random.yaml +0 -104
  195. package/operators/_ref.yaml +0 -232
  196. package/operators/_regex.yaml +0 -83
  197. package/operators/_request.yaml +0 -50
  198. package/operators/_secret.yaml +0 -74
  199. package/operators/_state.yaml +0 -113
  200. package/operators/_string.yaml +0 -283
  201. package/operators/_subtract.yaml +0 -38
  202. package/operators/_sum.yaml +0 -59
  203. package/operators/_switch.yaml +0 -51
  204. package/operators/_type.yaml +0 -92
  205. package/operators/_uri.yaml +0 -56
  206. package/operators/_url_query.yaml +0 -119
  207. package/operators/_user.yaml +0 -107
  208. package/operators/_uuid.yaml +0 -114
  209. package/operators/_var.yaml +0 -105
  210. package/operators/_yaml.yaml +0 -83
  211. package/pages.yaml +0 -228
  212. package/public/images/authors/gervwyk.jpeg +0 -0
  213. package/public/images/authors/sandile.jpeg +0 -0
  214. package/public/images/howto/header_generate_csv.jpg +0 -0
  215. package/public/images/howto/header_generate_pdf.jpg +0 -0
  216. package/public/logo_example.png +0 -0
  217. package/public/lowdefy_app_schema.png +0 -0
  218. package/public/modules/csvMake.js +0 -27
  219. package/public/modules/filterDefaultValue.js +0 -48
  220. package/public/modules/importUmd.js +0 -7
  221. package/public/modules/index.js +0 -5
  222. package/public/modules/pdfMake.js +0 -7
  223. package/public/modules/test/filterDefaultValue.test.js +0 -91
  224. package/public/modules/vfs_fonts.js +0 -12
  225. package/public/sitemap.xml +0 -1024
  226. package/templates/actions.yaml.njk +0 -68
  227. package/templates/blocks/defaultValueTransformer.js +0 -51
  228. package/templates/blocks/exampleTransformer.js +0 -81
  229. package/templates/blocks/layout.yaml +0 -114
  230. package/templates/blocks/propertiesFormTransformer.js +0 -419
  231. package/templates/blocks/propertiesGetterTransformer.js +0 -132
  232. package/templates/blocks/schema.yaml.njk +0 -42
  233. package/templates/blocks/style.yaml +0 -26
  234. package/templates/blocks/template.yaml.njk +0 -496
  235. package/templates/blog.yaml.njk +0 -221
  236. package/templates/cli_command.yaml.njk +0 -37
  237. package/templates/footer.yaml.njk +0 -604
  238. package/templates/general.yaml.njk +0 -124
  239. package/templates/generateSitemap.js +0 -42
  240. package/templates/header.yaml +0 -138
  241. package/templates/navigation_buttons.yaml +0 -68
  242. package/templates/operators.yaml.njk +0 -82
  243. package/templates/operatorsMethodTransformer.js +0 -119
  244. package/templates/test/array.test.js +0 -1355
  245. package/templates/test/boolean.test.js +0 -102
  246. package/templates/test/button.test.js +0 -170
  247. package/templates/test/color.test.js +0 -128
  248. package/templates/test/enum.test.js +0 -109
  249. package/templates/test/icon.test.js +0 -113
  250. package/templates/test/integer.test.js +0 -103
  251. package/templates/test/manual.test.js +0 -246
  252. package/templates/test/number.test.js +0 -103
  253. package/templates/test/object.test.js +0 -442
  254. package/templates/test/oneOf.test.js +0 -806
  255. package/templates/test/string.test.js +0 -102
  256. package/templates/test/yaml.test.js +0 -621
  257. package/tutorial/next-steps.yaml +0 -83
  258. package/tutorial/tutorial-actions-operators-config.yaml +0 -142
  259. package/tutorial/tutorial-actions-operators.yaml +0 -436
  260. package/tutorial/tutorial-add-blocks-config.yaml +0 -109
  261. package/tutorial/tutorial-add-blocks.yaml +0 -195
  262. package/tutorial/tutorial-create-page-config.yaml +0 -77
  263. package/tutorial/tutorial-create-page.yaml +0 -196
  264. package/tutorial/tutorial-deploy.yaml +0 -146
  265. package/tutorial/tutorial-requests-config.yaml +0 -186
  266. package/tutorial/tutorial-requests.yaml +0 -338
  267. package/tutorial/tutorial-start.yaml +0 -282
  268. package/users/login-and-logout.yaml +0 -164
  269. package/users/openid-connect.yaml +0 -84
  270. package/users/protected-pages.yaml +0 -67
  271. package/users/roles.yaml +0 -70
  272. package/users/user-object.yaml +0 -73
  273. package/users/users-introduction.yaml +0 -80
  274. package/version.yaml +0 -1
@@ -1,1355 +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
- import propertiesFormTransformer from '../blocks/propertiesFormTransformer';
18
- import propertiesGetterTransformer from '../blocks/propertiesGetterTransformer';
19
- import defaultValueTransformer from '../blocks/defaultValueTransformer';
20
-
21
- const schema = {
22
- schema: {
23
- properties: {
24
- type: 'object',
25
- properties: {
26
- options: {
27
- type: 'array',
28
- items: {
29
- type: 'string',
30
- description: 'string description',
31
- },
32
- },
33
- },
34
- },
35
- },
36
- };
37
-
38
- test('array propertiesFormTransformer', () => {
39
- expect(propertiesFormTransformer(schema)).toMatchInlineSnapshot(`
40
- Array [
41
- Object {
42
- "blocks": Array [
43
- Object {
44
- "id": "block.properties.options.$",
45
- "layout": Object {
46
- "_global": "settings_input_layout",
47
- },
48
- "properties": Object {
49
- "label": Object {
50
- "disabled": true,
51
- },
52
- "size": "small",
53
- "title": "$",
54
- },
55
- "required": false,
56
- "type": "TextInput",
57
- },
58
- ],
59
- "id": "block.properties.options",
60
- "layout": Object {
61
- "contentGutter": 0,
62
- },
63
- "properties": Object {
64
- "itemStyle": Object {
65
- "padding": 0,
66
- },
67
- "size": "small",
68
- "title": "options:",
69
- },
70
- "type": "ControlledList",
71
- },
72
- ]
73
- `);
74
- });
75
-
76
- test('array propertiesGetterTransformer', () => {
77
- expect(propertiesGetterTransformer(schema, { block_type: 'Block' })).toMatchInlineSnapshot(`
78
- Object {
79
- "_object.assign": Array [
80
- Object {
81
- "_state": Object {
82
- "contextId": "Block:Block:{}",
83
- "default": Object {},
84
- "key": "block.properties",
85
- },
86
- },
87
- ],
88
- }
89
- `);
90
- });
91
-
92
- test('array defaultValueTransformer', () => {
93
- expect(defaultValueTransformer(schema)).toMatchInlineSnapshot(`
94
- Object {
95
- "options": Array [],
96
- }
97
- `);
98
- const schemaDV = {
99
- schema: {
100
- properties: {
101
- type: 'object',
102
- properties: {
103
- options: {
104
- type: 'array',
105
- default: ['a'],
106
- items: {
107
- type: 'string',
108
- description: 'string description',
109
- },
110
- },
111
- },
112
- },
113
- },
114
- };
115
- expect(defaultValueTransformer(schemaDV)).toMatchInlineSnapshot(`
116
- Object {
117
- "options": Array [
118
- "a",
119
- ],
120
- }
121
- `);
122
- });
123
-
124
- const schemaArrayObject = {
125
- schema: {
126
- properties: {
127
- type: 'object',
128
- properties: {
129
- options: {
130
- type: 'array',
131
- items: {
132
- type: 'object',
133
- properties: {
134
- str: {
135
- type: 'string',
136
- description: 'string description',
137
- },
138
- num: {
139
- type: 'number',
140
- description: 'number description',
141
- },
142
- },
143
- },
144
- },
145
- },
146
- },
147
- },
148
- };
149
-
150
- test('array schemaArrayObject propertiesFormTransformer', () => {
151
- expect(propertiesFormTransformer(schemaArrayObject)).toMatchInlineSnapshot(`
152
- Array [
153
- Object {
154
- "blocks": Array [
155
- Object {
156
- "blocks": Array [
157
- Object {
158
- "id": "block.properties.options.$.num",
159
- "layout": Object {
160
- "_global": "settings_input_layout",
161
- },
162
- "properties": Object {
163
- "label": Object {
164
- "align": "right",
165
- "extra": "number description",
166
- "span": 8,
167
- },
168
- "size": "small",
169
- "step": 0.1,
170
- "title": "num",
171
- },
172
- "required": false,
173
- "type": "NumberInput",
174
- },
175
- Object {
176
- "id": "block.properties.options.$.str",
177
- "layout": Object {
178
- "_global": "settings_input_layout",
179
- },
180
- "properties": Object {
181
- "label": Object {
182
- "align": "right",
183
- "extra": "string description",
184
- "span": 8,
185
- },
186
- "size": "small",
187
- "title": "str",
188
- },
189
- "required": false,
190
- "type": "TextInput",
191
- },
192
- ],
193
- "id": "block.properties.options.$",
194
- "layout": Object {
195
- "contentGutter": 0,
196
- },
197
- "properties": Object {
198
- "bodyStyle": Object {
199
- "padding": 0,
200
- },
201
- "size": "small",
202
- "title": false,
203
- },
204
- "type": "Card",
205
- },
206
- ],
207
- "id": "block.properties.options",
208
- "layout": Object {
209
- "contentGutter": 0,
210
- },
211
- "properties": Object {
212
- "itemStyle": Object {
213
- "padding": 0,
214
- },
215
- "size": "small",
216
- "title": "options:",
217
- },
218
- "type": "ControlledList",
219
- },
220
- ]
221
- `);
222
- });
223
-
224
- test('array schemaArrayObject propertiesGetterTransformer', () => {
225
- expect(propertiesGetterTransformer(schemaArrayObject, { block_type: 'Block' }))
226
- .toMatchInlineSnapshot(`
227
- Object {
228
- "_object.assign": Array [
229
- Object {
230
- "_state": Object {
231
- "contextId": "Block:Block:{}",
232
- "default": Object {},
233
- "key": "block.properties",
234
- },
235
- },
236
- Object {
237
- "options": Object {
238
- "_array.map": Object {
239
- "callback": Object {
240
- "_function": Object {
241
- "__object.assign": Array [
242
- Object {
243
- "__args": Object {
244
- "contextId": undefined,
245
- "default": Object {},
246
- "key": "0",
247
- },
248
- },
249
- ],
250
- },
251
- },
252
- "on": Object {
253
- "_if_none": Array [
254
- Object {
255
- "_state": Object {
256
- "contextId": "Block:Block:{}",
257
- "key": "block.properties.options",
258
- },
259
- },
260
- Array [],
261
- ],
262
- },
263
- },
264
- },
265
- },
266
- ],
267
- }
268
- `);
269
- });
270
-
271
- test('array schemaArrayObject defaultValueTransformer', () => {
272
- expect(defaultValueTransformer(schemaArrayObject)).toMatchInlineSnapshot(`
273
- Object {
274
- "options": Array [],
275
- }
276
- `);
277
- const schemaArrayObjectDV = {
278
- schema: {
279
- properties: {
280
- type: 'object',
281
- properties: {
282
- options: {
283
- type: 'array',
284
- default: [{ str: 'a' }],
285
- items: {
286
- type: 'object',
287
- properties: {
288
- str: {
289
- type: 'string',
290
- description: 'string description',
291
- },
292
- num: {
293
- type: 'number',
294
- description: 'numebr description',
295
- },
296
- },
297
- },
298
- },
299
- },
300
- },
301
- },
302
- };
303
- expect(defaultValueTransformer(schemaArrayObjectDV)).toMatchInlineSnapshot(`
304
- Object {
305
- "options": Array [
306
- Object {
307
- "str": "a",
308
- },
309
- ],
310
- }
311
- `);
312
- });
313
-
314
- const schemaOneOfPrimitive = {
315
- schema: {
316
- properties: {
317
- type: 'object',
318
- properties: {
319
- options: {
320
- type: 'array',
321
- items: {
322
- oneOf: [
323
- {
324
- type: 'string',
325
- description: 'string description',
326
- },
327
- {
328
- type: 'number',
329
- description: 'number description',
330
- },
331
- ],
332
- },
333
- },
334
- },
335
- },
336
- },
337
- };
338
-
339
- test('array schemaOneOfPrimitive propertiesFormTransformer', () => {
340
- expect(propertiesFormTransformer(schemaOneOfPrimitive)).toMatchInlineSnapshot(`
341
- Array [
342
- Object {
343
- "blocks": Array [
344
- Object {
345
- "areas": Object {
346
- "content": Object {
347
- "blocks": Array [
348
- Object {
349
- "id": "__string_block.properties.options.$",
350
- "layout": Object {
351
- "_global": "settings_input_layout",
352
- },
353
- "properties": Object {
354
- "label": Object {
355
- "align": "right",
356
- "extra": "string description",
357
- "span": 8,
358
- },
359
- "size": "small",
360
- "title": "$",
361
- },
362
- "required": false,
363
- "type": "TextInput",
364
- "visible": Object {
365
- "_if": Object {
366
- "else": false,
367
- "test": Object {
368
- "_eq": Array [
369
- Object {
370
- "_state": "__type_block.properties.options.$",
371
- },
372
- "string",
373
- ],
374
- },
375
- "then": true,
376
- },
377
- },
378
- },
379
- Object {
380
- "id": "__number_block.properties.options.$",
381
- "layout": Object {
382
- "_global": "settings_input_layout",
383
- },
384
- "properties": Object {
385
- "label": Object {
386
- "align": "right",
387
- "extra": "number description",
388
- "span": 8,
389
- },
390
- "size": "small",
391
- "step": 0.1,
392
- "title": "$",
393
- },
394
- "required": false,
395
- "type": "NumberInput",
396
- "visible": Object {
397
- "_if": Object {
398
- "else": false,
399
- "test": Object {
400
- "_eq": Array [
401
- Object {
402
- "_state": "__type_block.properties.options.$",
403
- },
404
- "number",
405
- ],
406
- },
407
- "then": true,
408
- },
409
- },
410
- },
411
- ],
412
- },
413
- "extra": Object {
414
- "blocks": Array [
415
- Object {
416
- "id": "__type_block.properties.options.$",
417
- "properties": Object {
418
- "buttonStyle": "outlined",
419
- "color": "rgba(0, 0, 0, 0.1)",
420
- "label": Object {
421
- "disabled": true,
422
- },
423
- "options": Array [
424
- "string",
425
- "number",
426
- ],
427
- "size": "small",
428
- },
429
- "type": "ButtonSelector",
430
- },
431
- ],
432
- },
433
- },
434
- "id": "$",
435
- "layout": Object {
436
- "contentGutter": 0,
437
- },
438
- "properties": Object {
439
- "bodyStyle": Object {
440
- "padding": 0,
441
- },
442
- "headerStyle": Object {
443
- "background": "rgba(0, 0, 0, 0.06)",
444
- "color": "rgba(0, 0, 0, 0.45)",
445
- },
446
- "inner": true,
447
- "size": "small",
448
- "title": "Select $ type",
449
- },
450
- "type": "Card",
451
- },
452
- ],
453
- "id": "block.properties.options",
454
- "layout": Object {
455
- "contentGutter": 0,
456
- },
457
- "properties": Object {
458
- "itemStyle": Object {
459
- "padding": 0,
460
- },
461
- "size": "small",
462
- "title": "options:",
463
- },
464
- "type": "ControlledList",
465
- },
466
- ]
467
- `);
468
- });
469
-
470
- test('array schemaOneOfPrimitive propertiesGetterTransformer', () => {
471
- expect(propertiesGetterTransformer(schemaOneOfPrimitive, { block_type: 'Block' }))
472
- .toMatchInlineSnapshot(`
473
- Object {
474
- "_object.assign": Array [
475
- Object {
476
- "_state": Object {
477
- "contextId": "Block:Block:{}",
478
- "default": Object {},
479
- "key": "block.properties",
480
- },
481
- },
482
- Object {
483
- "options": Object {
484
- "_array.map": Object {
485
- "callback": Object {
486
- "_function": Object {
487
- "_mql.expr": Object {
488
- "expr": Object {
489
- "$switch": Object {
490
- "branches": Array [
491
- Object {
492
- "case": Object {
493
- "_eq": Array [
494
- Object {
495
- "_state": "__type_0",
496
- },
497
- "string",
498
- ],
499
- },
500
- "then": Object {
501
- "_state": Object {
502
- "contextId": undefined,
503
- "key": "__string_0",
504
- },
505
- },
506
- },
507
- Object {
508
- "case": Object {
509
- "_eq": Array [
510
- Object {
511
- "_state": "__type_0",
512
- },
513
- "number",
514
- ],
515
- },
516
- "then": Object {
517
- "_state": Object {
518
- "contextId": undefined,
519
- "key": "__number_0",
520
- },
521
- },
522
- },
523
- ],
524
- "default": null,
525
- },
526
- },
527
- "on": Object {},
528
- },
529
- },
530
- },
531
- "on": Object {
532
- "_if_none": Array [
533
- Object {
534
- "_state": Object {
535
- "contextId": "Block:Block:{}",
536
- "key": "block.properties.options",
537
- },
538
- },
539
- Array [],
540
- ],
541
- },
542
- },
543
- },
544
- },
545
- ],
546
- }
547
- `);
548
- });
549
-
550
- test('array schemaOneOfPrimitive defaultValueTransformer', () => {
551
- expect(defaultValueTransformer(schemaOneOfPrimitive)).toMatchInlineSnapshot(`
552
- Object {
553
- "options": Array [],
554
- }
555
- `);
556
- const schemaOneOfPrimitiveDV = {
557
- schema: {
558
- properties: {
559
- type: 'object',
560
- properties: {
561
- options: {
562
- type: 'array',
563
- default: ['a', 'b'],
564
- items: {
565
- oneOf: [
566
- {
567
- type: 'string',
568
- description: 'string description',
569
- },
570
- {
571
- type: 'number',
572
- description: 'number description',
573
- },
574
- ],
575
- },
576
- },
577
- },
578
- },
579
- },
580
- };
581
- expect(defaultValueTransformer(schemaOneOfPrimitiveDV)).toMatchInlineSnapshot(`
582
- Object {
583
- "options": Array [
584
- "a",
585
- "b",
586
- ],
587
- }
588
- `);
589
- });
590
-
591
- const schemaPrimitiveOneOf = {
592
- schema: {
593
- properties: {
594
- type: 'object',
595
- properties: {
596
- options: {
597
- oneOf: [
598
- {
599
- type: 'array',
600
- items: {
601
- type: 'string',
602
- description: 'string description',
603
- },
604
- },
605
- {
606
- type: 'array',
607
- items: {
608
- type: 'number',
609
- description: 'number description',
610
- },
611
- },
612
- ],
613
- },
614
- },
615
- },
616
- },
617
- };
618
-
619
- test('array schemaPrimitiveOneOf propertiesFormTransformer', () => {
620
- expect(propertiesFormTransformer(schemaPrimitiveOneOf)).toMatchInlineSnapshot(`
621
- Array [
622
- Object {
623
- "areas": Object {
624
- "content": Object {
625
- "blocks": Array [
626
- Object {
627
- "blocks": Array [
628
- Object {
629
- "id": "__string_arr_block.properties.options.$",
630
- "layout": Object {
631
- "_global": "settings_input_layout",
632
- },
633
- "properties": Object {
634
- "label": Object {
635
- "disabled": true,
636
- },
637
- "size": "small",
638
- "title": "$",
639
- },
640
- "required": false,
641
- "type": "TextInput",
642
- },
643
- ],
644
- "id": "__string_arr_block.properties.options",
645
- "layout": Object {
646
- "contentGutter": 0,
647
- },
648
- "properties": Object {
649
- "itemStyle": Object {
650
- "padding": 0,
651
- },
652
- "size": "small",
653
- "title": "options:",
654
- },
655
- "type": "ControlledList",
656
- "visible": Object {
657
- "_if": Object {
658
- "else": false,
659
- "test": Object {
660
- "_eq": Array [
661
- Object {
662
- "_state": "__type_block.properties.options",
663
- },
664
- "string[]",
665
- ],
666
- },
667
- "then": true,
668
- },
669
- },
670
- },
671
- Object {
672
- "blocks": Array [
673
- Object {
674
- "id": "__number_arr_block.properties.options.$",
675
- "layout": Object {
676
- "_global": "settings_input_layout",
677
- },
678
- "properties": Object {
679
- "label": Object {
680
- "disabled": true,
681
- },
682
- "size": "small",
683
- "step": 0.1,
684
- "title": "$",
685
- },
686
- "required": false,
687
- "type": "NumberInput",
688
- },
689
- ],
690
- "id": "__number_arr_block.properties.options",
691
- "layout": Object {
692
- "contentGutter": 0,
693
- },
694
- "properties": Object {
695
- "itemStyle": Object {
696
- "padding": 0,
697
- },
698
- "size": "small",
699
- "title": "options:",
700
- },
701
- "type": "ControlledList",
702
- "visible": Object {
703
- "_if": Object {
704
- "else": false,
705
- "test": Object {
706
- "_eq": Array [
707
- Object {
708
- "_state": "__type_block.properties.options",
709
- },
710
- "number[]",
711
- ],
712
- },
713
- "then": true,
714
- },
715
- },
716
- },
717
- ],
718
- },
719
- "extra": Object {
720
- "blocks": Array [
721
- Object {
722
- "id": "__type_block.properties.options",
723
- "properties": Object {
724
- "buttonStyle": "outlined",
725
- "color": "rgba(0, 0, 0, 0.1)",
726
- "label": Object {
727
- "disabled": true,
728
- },
729
- "options": Array [
730
- "string[]",
731
- "number[]",
732
- ],
733
- "size": "small",
734
- },
735
- "type": "ButtonSelector",
736
- },
737
- ],
738
- },
739
- },
740
- "id": "options",
741
- "layout": Object {
742
- "contentGutter": 0,
743
- },
744
- "properties": Object {
745
- "bodyStyle": Object {
746
- "padding": 0,
747
- },
748
- "headerStyle": Object {
749
- "background": "rgba(0, 0, 0, 0.06)",
750
- "color": "rgba(0, 0, 0, 0.45)",
751
- },
752
- "inner": true,
753
- "size": "small",
754
- "title": "Select options type",
755
- },
756
- "type": "Card",
757
- },
758
- ]
759
- `);
760
- });
761
-
762
- test('array schemaPrimitiveOneOf propertiesGetterTransformer', () => {
763
- expect(propertiesGetterTransformer(schemaPrimitiveOneOf, { block_type: 'Block' }))
764
- .toMatchInlineSnapshot(`
765
- Object {
766
- "_object.assign": Array [
767
- Object {
768
- "_state": Object {
769
- "contextId": "Block:Block:{}",
770
- "default": Object {},
771
- "key": "block.properties",
772
- },
773
- },
774
- Object {
775
- "options": Object {
776
- "_mql.expr": Object {
777
- "expr": Object {
778
- "$switch": Object {
779
- "branches": Array [
780
- Object {
781
- "case": Object {
782
- "_eq": Array [
783
- Object {
784
- "_state": "__type_block.properties.options",
785
- },
786
- "string[]",
787
- ],
788
- },
789
- "then": Object {
790
- "_state": Object {
791
- "contextId": "Block:Block:{}",
792
- "key": "__string_arr_block.properties.options",
793
- },
794
- },
795
- },
796
- Object {
797
- "case": Object {
798
- "_eq": Array [
799
- Object {
800
- "_state": "__type_block.properties.options",
801
- },
802
- "number[]",
803
- ],
804
- },
805
- "then": Object {
806
- "_state": Object {
807
- "contextId": "Block:Block:{}",
808
- "key": "__number_arr_block.properties.options",
809
- },
810
- },
811
- },
812
- ],
813
- "default": null,
814
- },
815
- },
816
- "on": Object {},
817
- },
818
- },
819
- },
820
- ],
821
- }
822
- `);
823
- });
824
-
825
- test('array schemaPrimitiveOneOf defaultValueTransformer', () => {
826
- expect(defaultValueTransformer(schemaPrimitiveOneOf)).toMatchInlineSnapshot(`
827
- Object {
828
- "options": null,
829
- }
830
- `);
831
- const schemaPrimitiveOneOfDV = {
832
- schema: {
833
- properties: {
834
- type: 'object',
835
- properties: {
836
- options: {
837
- default: ['a', 'b'],
838
- oneOf: [
839
- {
840
- type: 'array',
841
- items: {
842
- type: 'string',
843
- description: 'string description',
844
- },
845
- },
846
- {
847
- type: 'array',
848
- items: {
849
- type: 'number',
850
- description: 'number description',
851
- },
852
- },
853
- ],
854
- },
855
- },
856
- },
857
- },
858
- };
859
- expect(defaultValueTransformer(schemaPrimitiveOneOfDV)).toMatchInlineSnapshot(`
860
- Object {
861
- "options": Array [
862
- "a",
863
- "b",
864
- ],
865
- }
866
- `);
867
- });
868
-
869
- const schemaOneOfArrayStrArrayYaml = {
870
- schema: {
871
- properties: {
872
- type: 'object',
873
- properties: {
874
- options: {
875
- oneOf: [
876
- {
877
- type: 'array',
878
- items: {
879
- type: 'string',
880
- description: 'string description',
881
- },
882
- },
883
- {
884
- type: 'array',
885
- items: {
886
- type: 'object',
887
- description: 'number description',
888
- docs: {
889
- displayType: 'yaml',
890
- },
891
- },
892
- },
893
- ],
894
- },
895
- },
896
- },
897
- },
898
- };
899
-
900
- test('array schemaOneOfArrayStrArrayYaml propertiesFormTransformer', () => {
901
- expect(propertiesFormTransformer(schemaOneOfArrayStrArrayYaml)).toMatchInlineSnapshot(`
902
- Array [
903
- Object {
904
- "areas": Object {
905
- "content": Object {
906
- "blocks": Array [
907
- Object {
908
- "blocks": Array [
909
- Object {
910
- "id": "__string_arr_block.properties.options.$",
911
- "layout": Object {
912
- "_global": "settings_input_layout",
913
- },
914
- "properties": Object {
915
- "label": Object {
916
- "disabled": true,
917
- },
918
- "size": "small",
919
- "title": "$",
920
- },
921
- "required": false,
922
- "type": "TextInput",
923
- },
924
- ],
925
- "id": "__string_arr_block.properties.options",
926
- "layout": Object {
927
- "contentGutter": 0,
928
- },
929
- "properties": Object {
930
- "itemStyle": Object {
931
- "padding": 0,
932
- },
933
- "size": "small",
934
- "title": "options:",
935
- },
936
- "type": "ControlledList",
937
- "visible": Object {
938
- "_if": Object {
939
- "else": false,
940
- "test": Object {
941
- "_eq": Array [
942
- Object {
943
- "_state": "__type_block.properties.options",
944
- },
945
- "string[]",
946
- ],
947
- },
948
- "then": true,
949
- },
950
- },
951
- },
952
- Object {
953
- "blocks": Array [
954
- Object {
955
- "id": "__object_arr_block.properties.options.$",
956
- "layout": Object {
957
- "_global": "settings_input_layout",
958
- },
959
- "properties": Object {
960
- "autoSize": Object {
961
- "minRows": 2,
962
- },
963
- "label": Object {
964
- "disabled": true,
965
- },
966
- "placeholder": "Type YAML here",
967
- "size": "small",
968
- "title": "$",
969
- },
970
- "required": false,
971
- "type": "TextArea",
972
- },
973
- ],
974
- "id": "__object_arr_block.properties.options",
975
- "layout": Object {
976
- "contentGutter": 0,
977
- },
978
- "properties": Object {
979
- "itemStyle": Object {
980
- "padding": 0,
981
- },
982
- "size": "small",
983
- "title": "options:",
984
- },
985
- "type": "ControlledList",
986
- "visible": Object {
987
- "_if": Object {
988
- "else": false,
989
- "test": Object {
990
- "_eq": Array [
991
- Object {
992
- "_state": "__type_block.properties.options",
993
- },
994
- "object[]",
995
- ],
996
- },
997
- "then": true,
998
- },
999
- },
1000
- },
1001
- ],
1002
- },
1003
- "extra": Object {
1004
- "blocks": Array [
1005
- Object {
1006
- "id": "__type_block.properties.options",
1007
- "properties": Object {
1008
- "buttonStyle": "outlined",
1009
- "color": "rgba(0, 0, 0, 0.1)",
1010
- "label": Object {
1011
- "disabled": true,
1012
- },
1013
- "options": Array [
1014
- "string[]",
1015
- "object[]",
1016
- ],
1017
- "size": "small",
1018
- },
1019
- "type": "ButtonSelector",
1020
- },
1021
- ],
1022
- },
1023
- },
1024
- "id": "options",
1025
- "layout": Object {
1026
- "contentGutter": 0,
1027
- },
1028
- "properties": Object {
1029
- "bodyStyle": Object {
1030
- "padding": 0,
1031
- },
1032
- "headerStyle": Object {
1033
- "background": "rgba(0, 0, 0, 0.06)",
1034
- "color": "rgba(0, 0, 0, 0.45)",
1035
- },
1036
- "inner": true,
1037
- "size": "small",
1038
- "title": "Select options type",
1039
- },
1040
- "type": "Card",
1041
- },
1042
- ]
1043
- `);
1044
- });
1045
-
1046
- test('array schemaOneOfArrayStrArrayYaml propertiesGetterTransformer', () => {
1047
- expect(propertiesGetterTransformer(schemaOneOfArrayStrArrayYaml, { block_type: 'Block' }))
1048
- .toMatchInlineSnapshot(`
1049
- Object {
1050
- "_object.assign": Array [
1051
- Object {
1052
- "_state": Object {
1053
- "contextId": "Block:Block:{}",
1054
- "default": Object {},
1055
- "key": "block.properties",
1056
- },
1057
- },
1058
- Object {
1059
- "options": Object {
1060
- "_mql.expr": Object {
1061
- "expr": Object {
1062
- "$switch": Object {
1063
- "branches": Array [
1064
- Object {
1065
- "case": Object {
1066
- "_eq": Array [
1067
- Object {
1068
- "_state": "__type_block.properties.options",
1069
- },
1070
- "string[]",
1071
- ],
1072
- },
1073
- "then": Object {
1074
- "_state": Object {
1075
- "contextId": "Block:Block:{}",
1076
- "key": "__string_arr_block.properties.options",
1077
- },
1078
- },
1079
- },
1080
- Object {
1081
- "case": Object {
1082
- "_eq": Array [
1083
- Object {
1084
- "_state": "__type_block.properties.options",
1085
- },
1086
- "object[]",
1087
- ],
1088
- },
1089
- "then": Object {
1090
- "_array.map": Object {
1091
- "callback": Object {
1092
- "_function": Object {
1093
- "__yaml.parse": Object {
1094
- "__if_none": Array [
1095
- Object {
1096
- "__args": Object {
1097
- "contextId": undefined,
1098
- "key": "0",
1099
- },
1100
- },
1101
- "",
1102
- ],
1103
- },
1104
- },
1105
- },
1106
- "on": Object {
1107
- "_if_none": Array [
1108
- Object {
1109
- "_state": Object {
1110
- "contextId": "Block:Block:{}",
1111
- "key": "__object_arr_block.properties.options",
1112
- },
1113
- },
1114
- Array [],
1115
- ],
1116
- },
1117
- },
1118
- },
1119
- },
1120
- ],
1121
- "default": null,
1122
- },
1123
- },
1124
- "on": Object {},
1125
- },
1126
- },
1127
- },
1128
- ],
1129
- }
1130
- `);
1131
- });
1132
-
1133
- const schemaNestedArray = {
1134
- schema: {
1135
- properties: {
1136
- type: 'object',
1137
- properties: {
1138
- arr1: {
1139
- type: 'array',
1140
- description: 'string description',
1141
- items: {
1142
- type: 'object',
1143
- description: 'string description',
1144
- properties: {
1145
- obj: {
1146
- type: 'object',
1147
- docs: {
1148
- displayType: 'yaml',
1149
- },
1150
- },
1151
- arr2: {
1152
- type: 'array',
1153
- items: {
1154
- type: 'object',
1155
- docs: {
1156
- displayType: 'yaml',
1157
- },
1158
- },
1159
- },
1160
- },
1161
- },
1162
- },
1163
- },
1164
- },
1165
- },
1166
- };
1167
-
1168
- test('array propertiesFormTransformer schemaNestedArray', () => {
1169
- expect(propertiesFormTransformer(schemaNestedArray)).toMatchInlineSnapshot(`
1170
- Array [
1171
- Object {
1172
- "blocks": Array [
1173
- Object {
1174
- "blocks": Array [
1175
- Object {
1176
- "blocks": Array [
1177
- Object {
1178
- "id": "block.properties.arr1.$.arr2.$",
1179
- "layout": Object {
1180
- "_global": "settings_input_layout",
1181
- },
1182
- "properties": Object {
1183
- "autoSize": Object {
1184
- "minRows": 2,
1185
- },
1186
- "label": Object {
1187
- "disabled": true,
1188
- },
1189
- "placeholder": "Type YAML here",
1190
- "size": "small",
1191
- "title": "$",
1192
- },
1193
- "required": false,
1194
- "type": "TextArea",
1195
- },
1196
- ],
1197
- "id": "block.properties.arr1.$.arr2",
1198
- "layout": Object {
1199
- "contentGutter": 0,
1200
- },
1201
- "properties": Object {
1202
- "itemStyle": Object {
1203
- "padding": 0,
1204
- },
1205
- "size": "small",
1206
- "title": "arr2:",
1207
- },
1208
- "type": "ControlledList",
1209
- },
1210
- Object {
1211
- "id": "block.properties.arr1.$.obj",
1212
- "layout": Object {
1213
- "_global": "settings_input_layout",
1214
- },
1215
- "properties": Object {
1216
- "autoSize": Object {
1217
- "minRows": 2,
1218
- },
1219
- "label": Object {
1220
- "align": "right",
1221
- "extra": undefined,
1222
- "span": 8,
1223
- },
1224
- "placeholder": "Type YAML here",
1225
- "size": "small",
1226
- "title": "obj",
1227
- },
1228
- "required": false,
1229
- "type": "TextArea",
1230
- },
1231
- ],
1232
- "id": "block.properties.arr1.$",
1233
- "layout": Object {
1234
- "contentGutter": 0,
1235
- },
1236
- "properties": Object {
1237
- "bodyStyle": Object {
1238
- "padding": 0,
1239
- },
1240
- "size": "small",
1241
- "title": false,
1242
- },
1243
- "type": "Card",
1244
- },
1245
- ],
1246
- "id": "block.properties.arr1",
1247
- "layout": Object {
1248
- "contentGutter": 0,
1249
- },
1250
- "properties": Object {
1251
- "itemStyle": Object {
1252
- "padding": 0,
1253
- },
1254
- "size": "small",
1255
- "title": "arr1:",
1256
- },
1257
- "type": "ControlledList",
1258
- },
1259
- ]
1260
- `);
1261
- });
1262
-
1263
- test('array propertiesGetterTransformer schemaNestedArray', () => {
1264
- expect(propertiesGetterTransformer(schemaNestedArray, { block_type: 'Block' }))
1265
- .toMatchInlineSnapshot(`
1266
- Object {
1267
- "_object.assign": Array [
1268
- Object {
1269
- "_state": Object {
1270
- "contextId": "Block:Block:{}",
1271
- "default": Object {},
1272
- "key": "block.properties",
1273
- },
1274
- },
1275
- Object {
1276
- "arr1": Object {
1277
- "_array.map": Object {
1278
- "callback": Object {
1279
- "_function": Object {
1280
- "__object.assign": Array [
1281
- Object {
1282
- "__args": Object {
1283
- "contextId": undefined,
1284
- "default": Object {},
1285
- "key": "0",
1286
- },
1287
- },
1288
- Object {
1289
- "obj": Object {
1290
- "__yaml.parse": Object {
1291
- "__if_none": Array [
1292
- Object {
1293
- "__args": Object {
1294
- "contextId": undefined,
1295
- "key": "0.obj",
1296
- },
1297
- },
1298
- "",
1299
- ],
1300
- },
1301
- },
1302
- },
1303
- Object {
1304
- "arr2": Object {
1305
- "__array.map": Object {
1306
- "callback": Object {
1307
- "__function": Object {
1308
- "___yaml.parse": Object {
1309
- "___if_none": Array [
1310
- Object {
1311
- "___args": Object {
1312
- "contextId": undefined,
1313
- "key": "0",
1314
- },
1315
- },
1316
- "",
1317
- ],
1318
- },
1319
- },
1320
- },
1321
- "on": Object {
1322
- "__if_none": Array [
1323
- Object {
1324
- "__args": Object {
1325
- "contextId": undefined,
1326
- "key": "0.arr2",
1327
- },
1328
- },
1329
- Array [],
1330
- ],
1331
- },
1332
- },
1333
- },
1334
- },
1335
- ],
1336
- },
1337
- },
1338
- "on": Object {
1339
- "_if_none": Array [
1340
- Object {
1341
- "_state": Object {
1342
- "contextId": "Block:Block:{}",
1343
- "key": "block.properties.arr1",
1344
- },
1345
- },
1346
- Array [],
1347
- ],
1348
- },
1349
- },
1350
- },
1351
- },
1352
- ],
1353
- }
1354
- `);
1355
- });