@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,806 +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
- additionalProperties: false,
26
- properties: {
27
- field: {
28
- oneOf: [
29
- {
30
- type: 'number',
31
- description: 'number description',
32
- },
33
- {
34
- type: 'string',
35
- description: 'string description',
36
- },
37
- ],
38
- },
39
- },
40
- },
41
- },
42
- };
43
-
44
- test('oneOf propertiesFormTransformer', () => {
45
- expect(propertiesFormTransformer(schema)).toMatchInlineSnapshot(`
46
- Array [
47
- Object {
48
- "areas": Object {
49
- "content": Object {
50
- "blocks": Array [
51
- Object {
52
- "id": "__number_block.properties.field",
53
- "layout": Object {
54
- "_global": "settings_input_layout",
55
- },
56
- "properties": Object {
57
- "label": Object {
58
- "align": "right",
59
- "extra": "number description",
60
- "span": 8,
61
- },
62
- "size": "small",
63
- "step": 0.1,
64
- "title": "field",
65
- },
66
- "required": false,
67
- "type": "NumberInput",
68
- "visible": Object {
69
- "_if": Object {
70
- "else": false,
71
- "test": Object {
72
- "_eq": Array [
73
- Object {
74
- "_state": "__type_block.properties.field",
75
- },
76
- "number",
77
- ],
78
- },
79
- "then": true,
80
- },
81
- },
82
- },
83
- Object {
84
- "id": "__string_block.properties.field",
85
- "layout": Object {
86
- "_global": "settings_input_layout",
87
- },
88
- "properties": Object {
89
- "label": Object {
90
- "align": "right",
91
- "extra": "string description",
92
- "span": 8,
93
- },
94
- "size": "small",
95
- "title": "field",
96
- },
97
- "required": false,
98
- "type": "TextInput",
99
- "visible": Object {
100
- "_if": Object {
101
- "else": false,
102
- "test": Object {
103
- "_eq": Array [
104
- Object {
105
- "_state": "__type_block.properties.field",
106
- },
107
- "string",
108
- ],
109
- },
110
- "then": true,
111
- },
112
- },
113
- },
114
- ],
115
- },
116
- "extra": Object {
117
- "blocks": Array [
118
- Object {
119
- "id": "__type_block.properties.field",
120
- "properties": Object {
121
- "buttonStyle": "outlined",
122
- "color": "rgba(0, 0, 0, 0.1)",
123
- "label": Object {
124
- "disabled": true,
125
- },
126
- "options": Array [
127
- "number",
128
- "string",
129
- ],
130
- "size": "small",
131
- },
132
- "type": "ButtonSelector",
133
- },
134
- ],
135
- },
136
- },
137
- "id": "field",
138
- "layout": Object {
139
- "contentGutter": 0,
140
- },
141
- "properties": Object {
142
- "bodyStyle": Object {
143
- "padding": 0,
144
- },
145
- "headerStyle": Object {
146
- "background": "rgba(0, 0, 0, 0.06)",
147
- "color": "rgba(0, 0, 0, 0.45)",
148
- },
149
- "inner": true,
150
- "size": "small",
151
- "title": "Select field type",
152
- },
153
- "type": "Card",
154
- },
155
- ]
156
- `);
157
- });
158
-
159
- test('oneOf propertiesGetterTransformer', () => {
160
- expect(propertiesGetterTransformer(schema, { block_type: 'Block' })).toMatchInlineSnapshot(`
161
- Object {
162
- "_object.assign": Array [
163
- Object {
164
- "_state": Object {
165
- "contextId": "Block:Block:{}",
166
- "default": Object {},
167
- "key": "block.properties",
168
- },
169
- },
170
- Object {
171
- "field": Object {
172
- "_mql.expr": Object {
173
- "expr": Object {
174
- "$switch": Object {
175
- "branches": Array [
176
- Object {
177
- "case": Object {
178
- "_eq": Array [
179
- Object {
180
- "_state": "__type_block.properties.field",
181
- },
182
- "number",
183
- ],
184
- },
185
- "then": Object {
186
- "_state": Object {
187
- "contextId": "Block:Block:{}",
188
- "key": "__number_block.properties.field",
189
- },
190
- },
191
- },
192
- Object {
193
- "case": Object {
194
- "_eq": Array [
195
- Object {
196
- "_state": "__type_block.properties.field",
197
- },
198
- "string",
199
- ],
200
- },
201
- "then": Object {
202
- "_state": Object {
203
- "contextId": "Block:Block:{}",
204
- "key": "__string_block.properties.field",
205
- },
206
- },
207
- },
208
- ],
209
- "default": null,
210
- },
211
- },
212
- "on": Object {},
213
- },
214
- },
215
- },
216
- ],
217
- }
218
- `);
219
- });
220
-
221
- test('oneOf defaultValueTransformer', () => {
222
- expect(defaultValueTransformer(schema)).toMatchInlineSnapshot(`
223
- Object {
224
- "field": null,
225
- }
226
- `);
227
- const schemaDV = {
228
- schema: {
229
- properties: {
230
- type: 'object',
231
- additionalProperties: false,
232
- properties: {
233
- field: {
234
- default: 1,
235
- oneOf: [
236
- {
237
- type: 'number',
238
- description: 'number description',
239
- },
240
- {
241
- type: 'string',
242
- description: 'string description',
243
- },
244
- ],
245
- },
246
- },
247
- },
248
- },
249
- };
250
- expect(defaultValueTransformer(schemaDV)).toMatchInlineSnapshot(`
251
- Object {
252
- "field": 1,
253
- }
254
- `);
255
- });
256
-
257
- // for string object
258
- const schemaStrObj = {
259
- schema: {
260
- properties: {
261
- type: 'object',
262
- additionalProperties: false,
263
- properties: {
264
- field: {
265
- oneOf: [
266
- {
267
- type: 'string',
268
- description: 'string description',
269
- },
270
- {
271
- type: 'object',
272
- description: 'object description',
273
- properties: {
274
- str: {
275
- type: 'string',
276
- description: 'str description',
277
- },
278
- bool: {
279
- type: 'boolean',
280
- description: 'bool description',
281
- },
282
- },
283
- },
284
- ],
285
- },
286
- },
287
- },
288
- },
289
- };
290
-
291
- test('oneOf schemaStrObj propertiesFormTransformer', () => {
292
- expect(propertiesFormTransformer(schemaStrObj)).toMatchInlineSnapshot(`
293
- Array [
294
- Object {
295
- "areas": Object {
296
- "content": Object {
297
- "blocks": Array [
298
- Object {
299
- "id": "__string_block.properties.field",
300
- "layout": Object {
301
- "_global": "settings_input_layout",
302
- },
303
- "properties": Object {
304
- "label": Object {
305
- "align": "right",
306
- "extra": "string description",
307
- "span": 8,
308
- },
309
- "size": "small",
310
- "title": "field",
311
- },
312
- "required": false,
313
- "type": "TextInput",
314
- "visible": Object {
315
- "_if": Object {
316
- "else": false,
317
- "test": Object {
318
- "_eq": Array [
319
- Object {
320
- "_state": "__type_block.properties.field",
321
- },
322
- "string",
323
- ],
324
- },
325
- "then": true,
326
- },
327
- },
328
- },
329
- Object {
330
- "blocks": Array [
331
- Object {
332
- "id": "__object_block.properties.field.bool",
333
- "layout": Object {
334
- "_global": "settings_input_layout",
335
- },
336
- "properties": Object {
337
- "label": Object {
338
- "align": "right",
339
- "extra": "bool description",
340
- "span": 8,
341
- },
342
- "size": "small",
343
- "title": "bool",
344
- },
345
- "required": false,
346
- "type": "Switch",
347
- },
348
- Object {
349
- "id": "__object_block.properties.field.str",
350
- "layout": Object {
351
- "_global": "settings_input_layout",
352
- },
353
- "properties": Object {
354
- "label": Object {
355
- "align": "right",
356
- "extra": "str description",
357
- "span": 8,
358
- },
359
- "size": "small",
360
- "title": "str",
361
- },
362
- "required": false,
363
- "type": "TextInput",
364
- },
365
- ],
366
- "id": "__object_block.properties.field",
367
- "layout": Object {
368
- "contentGutter": 0,
369
- },
370
- "properties": Object {
371
- "bodyStyle": Object {
372
- "padding": 0,
373
- },
374
- "size": "small",
375
- "title": "field:",
376
- },
377
- "type": "Card",
378
- "visible": Object {
379
- "_if": Object {
380
- "else": false,
381
- "test": Object {
382
- "_eq": Array [
383
- Object {
384
- "_state": "__type_block.properties.field",
385
- },
386
- "object",
387
- ],
388
- },
389
- "then": true,
390
- },
391
- },
392
- },
393
- ],
394
- },
395
- "extra": Object {
396
- "blocks": Array [
397
- Object {
398
- "id": "__type_block.properties.field",
399
- "properties": Object {
400
- "buttonStyle": "outlined",
401
- "color": "rgba(0, 0, 0, 0.1)",
402
- "label": Object {
403
- "disabled": true,
404
- },
405
- "options": Array [
406
- "string",
407
- "object",
408
- ],
409
- "size": "small",
410
- },
411
- "type": "ButtonSelector",
412
- },
413
- ],
414
- },
415
- },
416
- "id": "field",
417
- "layout": Object {
418
- "contentGutter": 0,
419
- },
420
- "properties": Object {
421
- "bodyStyle": Object {
422
- "padding": 0,
423
- },
424
- "headerStyle": Object {
425
- "background": "rgba(0, 0, 0, 0.06)",
426
- "color": "rgba(0, 0, 0, 0.45)",
427
- },
428
- "inner": true,
429
- "size": "small",
430
- "title": "Select field type",
431
- },
432
- "type": "Card",
433
- },
434
- ]
435
- `);
436
- });
437
-
438
- test('oneOf schemaStrObj propertiesGetterTransformer', () => {
439
- expect(propertiesGetterTransformer(schemaStrObj, { block_type: 'Block' })).toMatchInlineSnapshot(`
440
- Object {
441
- "_object.assign": Array [
442
- Object {
443
- "_state": Object {
444
- "contextId": "Block:Block:{}",
445
- "default": Object {},
446
- "key": "block.properties",
447
- },
448
- },
449
- Object {
450
- "field": Object {
451
- "_mql.expr": Object {
452
- "expr": Object {
453
- "$switch": Object {
454
- "branches": Array [
455
- Object {
456
- "case": Object {
457
- "_eq": Array [
458
- Object {
459
- "_state": "__type_block.properties.field",
460
- },
461
- "string",
462
- ],
463
- },
464
- "then": Object {
465
- "_state": Object {
466
- "contextId": "Block:Block:{}",
467
- "key": "__string_block.properties.field",
468
- },
469
- },
470
- },
471
- Object {
472
- "case": Object {
473
- "_eq": Array [
474
- Object {
475
- "_state": "__type_block.properties.field",
476
- },
477
- "object",
478
- ],
479
- },
480
- "then": Object {
481
- "_object.assign": Array [
482
- Object {
483
- "_state": Object {
484
- "contextId": "Block:Block:{}",
485
- "default": Object {},
486
- "key": "__object_block.properties.field",
487
- },
488
- },
489
- ],
490
- },
491
- },
492
- ],
493
- "default": null,
494
- },
495
- },
496
- "on": Object {},
497
- },
498
- },
499
- },
500
- ],
501
- }
502
- `);
503
- });
504
-
505
- test('oneOf schemaStrObj defaultValueTransformer', () => {
506
- expect(defaultValueTransformer(schemaStrObj)).toMatchInlineSnapshot(`
507
- Object {
508
- "field": null,
509
- }
510
- `);
511
- const schemaDV = {
512
- schema: {
513
- properties: {
514
- type: 'object',
515
- additionalProperties: false,
516
- properties: {
517
- field: {
518
- default: {
519
- str: 'x',
520
- },
521
- oneOf: [
522
- {
523
- type: 'string',
524
- description: 'string description',
525
- },
526
- {
527
- type: 'object',
528
- description: 'object description',
529
- properties: {
530
- str: {
531
- type: 'string',
532
- description: 'str description',
533
- },
534
- bool: {
535
- type: 'boolean',
536
- description: 'bool description',
537
- },
538
- },
539
- },
540
- ],
541
- },
542
- },
543
- },
544
- },
545
- };
546
- expect(defaultValueTransformer(schemaDV)).toMatchInlineSnapshot(`
547
- Object {
548
- "field": Object {
549
- "str": "x",
550
- },
551
- }
552
- `);
553
- });
554
-
555
- const schemaOneOfStrYaml = {
556
- schema: {
557
- properties: {
558
- type: 'object',
559
- additionalProperties: false,
560
- properties: {
561
- field: {
562
- oneOf: [
563
- {
564
- type: 'string',
565
- description: 'string description',
566
- },
567
- {
568
- type: 'object',
569
- description: 'object description',
570
- docs: {
571
- displayType: 'yaml',
572
- },
573
- },
574
- ],
575
- },
576
- },
577
- },
578
- },
579
- };
580
-
581
- test('oneOf propertiesFormTransformer schemaOneOfStrYaml', () => {
582
- expect(propertiesFormTransformer(schemaOneOfStrYaml)).toMatchInlineSnapshot(`
583
- Array [
584
- Object {
585
- "areas": Object {
586
- "content": Object {
587
- "blocks": Array [
588
- Object {
589
- "id": "__string_block.properties.field",
590
- "layout": Object {
591
- "_global": "settings_input_layout",
592
- },
593
- "properties": Object {
594
- "label": Object {
595
- "align": "right",
596
- "extra": "string description",
597
- "span": 8,
598
- },
599
- "size": "small",
600
- "title": "field",
601
- },
602
- "required": false,
603
- "type": "TextInput",
604
- "visible": Object {
605
- "_if": Object {
606
- "else": false,
607
- "test": Object {
608
- "_eq": Array [
609
- Object {
610
- "_state": "__type_block.properties.field",
611
- },
612
- "string",
613
- ],
614
- },
615
- "then": true,
616
- },
617
- },
618
- },
619
- Object {
620
- "id": "__object_block.properties.field",
621
- "layout": Object {
622
- "_global": "settings_input_layout",
623
- },
624
- "properties": Object {
625
- "autoSize": Object {
626
- "minRows": 2,
627
- },
628
- "label": Object {
629
- "align": "right",
630
- "extra": "object description",
631
- "span": 8,
632
- },
633
- "placeholder": "Type YAML here",
634
- "size": "small",
635
- "title": "field",
636
- },
637
- "required": false,
638
- "type": "TextArea",
639
- "visible": Object {
640
- "_if": Object {
641
- "else": false,
642
- "test": Object {
643
- "_eq": Array [
644
- Object {
645
- "_state": "__type_block.properties.field",
646
- },
647
- "object",
648
- ],
649
- },
650
- "then": true,
651
- },
652
- },
653
- },
654
- ],
655
- },
656
- "extra": Object {
657
- "blocks": Array [
658
- Object {
659
- "id": "__type_block.properties.field",
660
- "properties": Object {
661
- "buttonStyle": "outlined",
662
- "color": "rgba(0, 0, 0, 0.1)",
663
- "label": Object {
664
- "disabled": true,
665
- },
666
- "options": Array [
667
- "string",
668
- "object",
669
- ],
670
- "size": "small",
671
- },
672
- "type": "ButtonSelector",
673
- },
674
- ],
675
- },
676
- },
677
- "id": "field",
678
- "layout": Object {
679
- "contentGutter": 0,
680
- },
681
- "properties": Object {
682
- "bodyStyle": Object {
683
- "padding": 0,
684
- },
685
- "headerStyle": Object {
686
- "background": "rgba(0, 0, 0, 0.06)",
687
- "color": "rgba(0, 0, 0, 0.45)",
688
- },
689
- "inner": true,
690
- "size": "small",
691
- "title": "Select field type",
692
- },
693
- "type": "Card",
694
- },
695
- ]
696
- `);
697
- });
698
-
699
- test('oneOf propertiesGetterTransformer schemaOneOfStrYaml', () => {
700
- expect(propertiesGetterTransformer(schemaOneOfStrYaml, { block_type: 'Block' }))
701
- .toMatchInlineSnapshot(`
702
- Object {
703
- "_object.assign": Array [
704
- Object {
705
- "_state": Object {
706
- "contextId": "Block:Block:{}",
707
- "default": Object {},
708
- "key": "block.properties",
709
- },
710
- },
711
- Object {
712
- "field": Object {
713
- "_mql.expr": Object {
714
- "expr": Object {
715
- "$switch": Object {
716
- "branches": Array [
717
- Object {
718
- "case": Object {
719
- "_eq": Array [
720
- Object {
721
- "_state": "__type_block.properties.field",
722
- },
723
- "string",
724
- ],
725
- },
726
- "then": Object {
727
- "_state": Object {
728
- "contextId": "Block:Block:{}",
729
- "key": "__string_block.properties.field",
730
- },
731
- },
732
- },
733
- Object {
734
- "case": Object {
735
- "_eq": Array [
736
- Object {
737
- "_state": "__type_block.properties.field",
738
- },
739
- "object",
740
- ],
741
- },
742
- "then": Object {
743
- "_yaml.parse": Object {
744
- "_if_none": Array [
745
- Object {
746
- "_state": Object {
747
- "contextId": "Block:Block:{}",
748
- "key": "__object_block.properties.field",
749
- },
750
- },
751
- "",
752
- ],
753
- },
754
- },
755
- },
756
- ],
757
- "default": null,
758
- },
759
- },
760
- "on": Object {},
761
- },
762
- },
763
- },
764
- ],
765
- }
766
- `);
767
- });
768
-
769
- test('oneOf defaultValueTransformer schemaOneOfStrYaml', () => {
770
- expect(defaultValueTransformer(schemaOneOfStrYaml)).toMatchInlineSnapshot(`
771
- Object {
772
- "field": null,
773
- }
774
- `);
775
- const schemaOneOfStrYamlDV = {
776
- schema: {
777
- properties: {
778
- type: 'object',
779
- additionalProperties: false,
780
- properties: {
781
- field: {
782
- default: 'str',
783
- oneOf: [
784
- {
785
- type: 'number',
786
- description: 'number description',
787
- },
788
- {
789
- type: 'object',
790
- description: 'object description',
791
- docs: {
792
- displayType: 'yaml',
793
- },
794
- },
795
- ],
796
- },
797
- },
798
- },
799
- },
800
- };
801
- expect(defaultValueTransformer(schemaOneOfStrYamlDV)).toMatchInlineSnapshot(`
802
- Object {
803
- "field": "str",
804
- }
805
- `);
806
- });