@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.
Files changed (275) hide show
  1. package/dist/operators/client/filter_default_value.js +55 -0
  2. package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
  3. package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
  4. package/package.json +19 -3
  5. package/404.yaml +0 -26
  6. package/CHANGELOG.md +0 -697
  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 -803
  24. package/blocks/container/Affix.yaml +0 -26
  25. package/blocks/container/Alert.yaml +0 -27
  26. package/blocks/container/Badge.yaml +0 -27
  27. package/blocks/container/Box.yaml +0 -27
  28. package/blocks/container/Card.yaml +0 -29
  29. package/blocks/container/Collapse.yaml +0 -38
  30. package/blocks/container/Comment.yaml +0 -43
  31. package/blocks/container/ConfirmModal.yaml +0 -36
  32. package/blocks/container/Descriptions.yaml +0 -51
  33. package/blocks/container/Drawer.yaml +0 -46
  34. package/blocks/container/Label.yaml +0 -28
  35. package/blocks/container/Modal.yaml +0 -46
  36. package/blocks/container/PageHCF.yaml +0 -28
  37. package/blocks/container/PageHCSF.yaml +0 -29
  38. package/blocks/container/PageHSCF.yaml +0 -29
  39. package/blocks/container/PageHeaderMenu.yaml +0 -52
  40. package/blocks/container/PageSHCF.yaml +0 -29
  41. package/blocks/container/PageSiderMenu.yaml +0 -53
  42. package/blocks/container/Result.yaml +0 -34
  43. package/blocks/container/Span.yaml +0 -27
  44. package/blocks/container/Spin.yaml +0 -27
  45. package/blocks/container/Tabs.yaml +0 -41
  46. package/blocks/container/Tooltip.yaml +0 -38
  47. package/blocks/display/Anchor.yaml +0 -25
  48. package/blocks/display/Avatar.yaml +0 -23
  49. package/blocks/display/Breadcrumb.yaml +0 -28
  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/Divider.yaml +0 -23
  54. package/blocks/display/EChart.yaml +0 -53
  55. package/blocks/display/Html.yaml +0 -50
  56. package/blocks/display/Icon.yaml +0 -23
  57. package/blocks/display/Img.yaml +0 -40
  58. package/blocks/display/Markdown.yaml +0 -31
  59. package/blocks/display/MarkdownWithCode.yaml +0 -46
  60. package/blocks/display/Menu.yaml +0 -48
  61. package/blocks/display/Message.yaml +0 -34
  62. package/blocks/display/MobileMenu.yaml +0 -47
  63. package/blocks/display/Notification.yaml +0 -34
  64. package/blocks/display/Paragraph.yaml +0 -30
  65. package/blocks/display/Progress.yaml +0 -52
  66. package/blocks/display/Skeleton.yaml +0 -27
  67. package/blocks/display/Statistic.yaml +0 -35
  68. package/blocks/display/Title.yaml +0 -32
  69. package/blocks/input/AutoComplete.yaml +0 -30
  70. package/blocks/input/ButtonSelector.yaml +0 -36
  71. package/blocks/input/CheckboxSelector.yaml +0 -36
  72. package/blocks/input/CheckboxSwitch.yaml +0 -56
  73. package/blocks/input/ChromeColorSelector.yaml +0 -24
  74. package/blocks/input/CircleColorSelector.yaml +0 -24
  75. package/blocks/input/ColorSelector.yaml +0 -24
  76. package/blocks/input/CompactColorSelector.yaml +0 -24
  77. package/blocks/input/DateRangeSelector.yaml +0 -26
  78. package/blocks/input/DateSelector.yaml +0 -26
  79. package/blocks/input/DateTimeSelector.yaml +0 -28
  80. package/blocks/input/GithubColorSelector.yaml +0 -24
  81. package/blocks/input/MonthSelector.yaml +0 -26
  82. package/blocks/input/MultipleSelector.yaml +0 -117
  83. package/blocks/input/NumberInput.yaml +0 -24
  84. package/blocks/input/Pagination.yaml +0 -33
  85. package/blocks/input/ParagraphInput.yaml +0 -32
  86. package/blocks/input/PasswordInput.yaml +0 -48
  87. package/blocks/input/RadioSelector.yaml +0 -36
  88. package/blocks/input/RatingSlider.yaml +0 -24
  89. package/blocks/input/S3UploadButton.yaml +0 -28
  90. package/blocks/input/Selector.yaml +0 -98
  91. package/blocks/input/SliderColorSelector.yaml +0 -24
  92. package/blocks/input/SwatchesColorSelector.yaml +0 -24
  93. package/blocks/input/Switch.yaml +0 -24
  94. package/blocks/input/TextArea.yaml +0 -27
  95. package/blocks/input/TextInput.yaml +0 -59
  96. package/blocks/input/TitleInput.yaml +0 -32
  97. package/blocks/input/TwitterColorSelector.yaml +0 -24
  98. package/blocks/input/WeekSelector.yaml +0 -26
  99. package/blocks/list/ControlledList.yaml +0 -191
  100. package/blocks/list/List.yaml +0 -157
  101. package/blocks/list/TimelineList.yaml +0 -136
  102. package/body.html +0 -1
  103. package/concepts/blocks.yaml +0 -249
  104. package/concepts/cli.yaml +0 -173
  105. package/concepts/connections-and-requests.yaml +0 -114
  106. package/concepts/context-and-state.yaml +0 -82
  107. package/concepts/custom-blocks.yaml +0 -190
  108. package/concepts/custom-code.yaml +0 -197
  109. package/concepts/events-and-actions.yaml +0 -224
  110. package/concepts/hosting-files.yaml +0 -50
  111. package/concepts/layout.yaml +0 -1464
  112. package/concepts/lists.yaml +0 -162
  113. package/concepts/lowdefy-schema.yaml +0 -245
  114. package/concepts/operators.yaml +0 -66
  115. package/concepts/overview.yaml +0 -48
  116. package/concepts/secrets.yaml +0 -56
  117. package/connections/AWSS3.yaml +0 -228
  118. package/connections/AmazonRedshift.yaml +0 -75
  119. package/connections/AxiosHttp.yaml +0 -194
  120. package/connections/Elasticsearch.yaml +0 -378
  121. package/connections/GoogleSheet.yaml +0 -332
  122. package/connections/Knex.yaml +0 -181
  123. package/connections/KnexRequests.md +0 -121
  124. package/connections/MSSQL.yaml +0 -90
  125. package/connections/MariaDB.yaml +0 -77
  126. package/connections/MongoDB.yaml +0 -581
  127. package/connections/MySQL.yaml +0 -92
  128. package/connections/OracleDB.yaml +0 -73
  129. package/connections/PostgreSQL.yaml +0 -99
  130. package/connections/Redis.yaml +0 -147
  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 -252
  140. package/howto/generate-pdf.yaml.njk +0 -651
  141. package/howto/generateCsv/lowdefy.yaml +0 -64
  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 -117
  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/howto/use-refrences.md +0 -5
  151. package/introduction.yaml +0 -100
  152. package/lowdefy.yaml +0 -66
  153. package/menus.yaml +0 -832
  154. package/operators/_actions.yaml +0 -123
  155. package/operators/_and.yaml +0 -90
  156. package/operators/_args.yaml +0 -79
  157. package/operators/_array.yaml +0 -326
  158. package/operators/_base64.yaml +0 -56
  159. package/operators/_change_case.yaml +0 -347
  160. package/operators/_date.yaml +0 -71
  161. package/operators/_diff.yaml +0 -75
  162. package/operators/_divide.yaml +0 -46
  163. package/operators/_eq.yaml +0 -67
  164. package/operators/_event.yaml +0 -103
  165. package/operators/_format.yaml +0 -209
  166. package/operators/_function.yaml +0 -66
  167. package/operators/_get.yaml +0 -108
  168. package/operators/_global.yaml +0 -107
  169. package/operators/_gt.yaml +0 -65
  170. package/operators/_gte.yaml +0 -65
  171. package/operators/_hash.yaml +0 -109
  172. package/operators/_if.yaml +0 -44
  173. package/operators/_if_none.yaml +0 -61
  174. package/operators/_index.yaml +0 -65
  175. package/operators/_input.yaml +0 -114
  176. package/operators/_js.yaml +0 -189
  177. package/operators/_json.yaml +0 -128
  178. package/operators/_list_contexts.yaml +0 -37
  179. package/operators/_location.yaml +0 -59
  180. package/operators/_log.yaml +0 -36
  181. package/operators/_lt.yaml +0 -65
  182. package/operators/_lte.yaml +0 -65
  183. package/operators/_math.yaml +0 -374
  184. package/operators/_media.yaml +0 -86
  185. package/operators/_menu.yaml +0 -81
  186. package/operators/_mql.yaml +0 -101
  187. package/operators/_ne.yaml +0 -77
  188. package/operators/_not.yaml +0 -47
  189. package/operators/_number.yaml +0 -157
  190. package/operators/_nunjucks.yaml +0 -73
  191. package/operators/_object.yaml +0 -193
  192. package/operators/_operator.yaml +0 -47
  193. package/operators/_or.yaml +0 -81
  194. package/operators/_product.yaml +0 -59
  195. package/operators/_random.yaml +0 -104
  196. package/operators/_ref.yaml +0 -266
  197. package/operators/_regex.yaml +0 -83
  198. package/operators/_request.yaml +0 -50
  199. package/operators/_secret.yaml +0 -74
  200. package/operators/_state.yaml +0 -114
  201. package/operators/_string.yaml +0 -283
  202. package/operators/_subtract.yaml +0 -38
  203. package/operators/_sum.yaml +0 -59
  204. package/operators/_switch.yaml +0 -51
  205. package/operators/_type.yaml +0 -92
  206. package/operators/_uri.yaml +0 -56
  207. package/operators/_url_query.yaml +0 -120
  208. package/operators/_user.yaml +0 -107
  209. package/operators/_uuid.yaml +0 -114
  210. package/operators/_var.yaml +0 -105
  211. package/operators/_yaml.yaml +0 -107
  212. package/pages.yaml +0 -227
  213. package/public/images/authors/gervwyk.jpeg +0 -0
  214. package/public/images/authors/sandile.jpeg +0 -0
  215. package/public/images/howto/header_generate_csv.jpg +0 -0
  216. package/public/images/howto/header_generate_pdf.jpg +0 -0
  217. package/public/logo_example.png +0 -0
  218. package/public/lowdefy_app_schema.png +0 -0
  219. package/public/modules/csvMake.js +0 -27
  220. package/public/modules/filterDefaultValue.js +0 -48
  221. package/public/modules/importUmd.js +0 -7
  222. package/public/modules/index.js +0 -5
  223. package/public/modules/pdfMake.js +0 -7
  224. package/public/modules/test/filterDefaultValue.test.js +0 -91
  225. package/public/modules/vfs_fonts.js +0 -12
  226. package/public/sitemap.xml +0 -1024
  227. package/templates/actions.yaml.njk +0 -68
  228. package/templates/blocks/defaultValueTransformer.js +0 -53
  229. package/templates/blocks/exampleTransformer.js +0 -81
  230. package/templates/blocks/layout.yaml +0 -114
  231. package/templates/blocks/propertiesFormTransformer.js +0 -419
  232. package/templates/blocks/propertiesGetterTransformer.js +0 -132
  233. package/templates/blocks/schema.yaml.njk +0 -42
  234. package/templates/blocks/style.yaml +0 -26
  235. package/templates/blocks/template.yaml.njk +0 -495
  236. package/templates/blog.yaml.njk +0 -221
  237. package/templates/cli_command.yaml.njk +0 -37
  238. package/templates/footer.yaml.njk +0 -604
  239. package/templates/general.yaml.njk +0 -124
  240. package/templates/generateSitemap.js +0 -41
  241. package/templates/header.yaml +0 -138
  242. package/templates/navigation_buttons.yaml +0 -68
  243. package/templates/operators.yaml.njk +0 -82
  244. package/templates/operatorsMethodTransformer.js +0 -119
  245. package/templates/test/array.test.js +0 -1335
  246. package/templates/test/boolean.test.js +0 -98
  247. package/templates/test/button.test.js +0 -166
  248. package/templates/test/color.test.js +0 -126
  249. package/templates/test/enum.test.js +0 -105
  250. package/templates/test/icon.test.js +0 -109
  251. package/templates/test/integer.test.js +0 -99
  252. package/templates/test/manual.test.js +0 -238
  253. package/templates/test/number.test.js +0 -99
  254. package/templates/test/object.test.js +0 -434
  255. package/templates/test/oneOf.test.js +0 -794
  256. package/templates/test/string.test.js +0 -98
  257. package/templates/test/yaml.test.js +0 -605
  258. package/tutorial/next-steps.yaml +0 -83
  259. package/tutorial/tutorial-actions-operators-config.yaml +0 -142
  260. package/tutorial/tutorial-actions-operators.yaml +0 -436
  261. package/tutorial/tutorial-add-blocks-config.yaml +0 -109
  262. package/tutorial/tutorial-add-blocks.yaml +0 -195
  263. package/tutorial/tutorial-create-page-config.yaml +0 -77
  264. package/tutorial/tutorial-create-page.yaml +0 -196
  265. package/tutorial/tutorial-deploy.yaml +0 -146
  266. package/tutorial/tutorial-requests-config.yaml +0 -186
  267. package/tutorial/tutorial-requests.yaml +0 -338
  268. package/tutorial/tutorial-start.yaml +0 -282
  269. package/users/login-and-logout.yaml +0 -164
  270. package/users/openid-connect.yaml +0 -84
  271. package/users/protected-pages.yaml +0 -67
  272. package/users/roles.yaml +0 -70
  273. package/users/user-object.yaml +0 -73
  274. package/users/users-introduction.yaml +0 -80
  275. package/version.yaml +0 -1
@@ -1,794 +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
- properties: {
23
- type: 'object',
24
- additionalProperties: false,
25
- properties: {
26
- field: {
27
- oneOf: [
28
- {
29
- type: 'number',
30
- description: 'number description',
31
- },
32
- {
33
- type: 'string',
34
- description: 'string description',
35
- },
36
- ],
37
- },
38
- },
39
- },
40
- };
41
-
42
- test('oneOf propertiesFormTransformer', () => {
43
- expect(propertiesFormTransformer(schema)).toMatchInlineSnapshot(`
44
- Array [
45
- Object {
46
- "areas": Object {
47
- "content": Object {
48
- "blocks": Array [
49
- Object {
50
- "id": "__number_block.properties.field",
51
- "layout": Object {
52
- "_global": "settings_input_layout",
53
- },
54
- "properties": Object {
55
- "label": Object {
56
- "align": "right",
57
- "extra": "number description",
58
- "span": 8,
59
- },
60
- "size": "small",
61
- "step": 0.1,
62
- "title": "field",
63
- },
64
- "required": false,
65
- "type": "NumberInput",
66
- "visible": Object {
67
- "_if": Object {
68
- "else": false,
69
- "test": Object {
70
- "_eq": Array [
71
- Object {
72
- "_state": "__type_block.properties.field",
73
- },
74
- "number",
75
- ],
76
- },
77
- "then": true,
78
- },
79
- },
80
- },
81
- Object {
82
- "id": "__string_block.properties.field",
83
- "layout": Object {
84
- "_global": "settings_input_layout",
85
- },
86
- "properties": Object {
87
- "label": Object {
88
- "align": "right",
89
- "extra": "string description",
90
- "span": 8,
91
- },
92
- "size": "small",
93
- "title": "field",
94
- },
95
- "required": false,
96
- "type": "TextInput",
97
- "visible": Object {
98
- "_if": Object {
99
- "else": false,
100
- "test": Object {
101
- "_eq": Array [
102
- Object {
103
- "_state": "__type_block.properties.field",
104
- },
105
- "string",
106
- ],
107
- },
108
- "then": true,
109
- },
110
- },
111
- },
112
- ],
113
- },
114
- "extra": Object {
115
- "blocks": Array [
116
- Object {
117
- "id": "__type_block.properties.field",
118
- "properties": Object {
119
- "buttonStyle": "outlined",
120
- "color": "rgba(0, 0, 0, 0.1)",
121
- "label": Object {
122
- "disabled": true,
123
- },
124
- "options": Array [
125
- "number",
126
- "string",
127
- ],
128
- "size": "small",
129
- },
130
- "type": "ButtonSelector",
131
- },
132
- ],
133
- },
134
- },
135
- "id": "field",
136
- "layout": Object {
137
- "contentGutter": 0,
138
- },
139
- "properties": Object {
140
- "bodyStyle": Object {
141
- "padding": 0,
142
- },
143
- "headerStyle": Object {
144
- "background": "rgba(0, 0, 0, 0.06)",
145
- "color": "rgba(0, 0, 0, 0.45)",
146
- },
147
- "inner": true,
148
- "size": "small",
149
- "title": "Select field type",
150
- },
151
- "type": "Card",
152
- },
153
- ]
154
- `);
155
- });
156
-
157
- test('oneOf propertiesGetterTransformer', () => {
158
- expect(propertiesGetterTransformer(schema, { block_type: 'Block' })).toMatchInlineSnapshot(`
159
- Object {
160
- "_object.assign": Array [
161
- Object {
162
- "_state": Object {
163
- "contextId": "Block:Block:{}",
164
- "default": Object {},
165
- "key": "block.properties",
166
- },
167
- },
168
- Object {
169
- "field": Object {
170
- "_mql.expr": Object {
171
- "expr": Object {
172
- "$switch": Object {
173
- "branches": Array [
174
- Object {
175
- "case": Object {
176
- "_eq": Array [
177
- Object {
178
- "_state": "__type_block.properties.field",
179
- },
180
- "number",
181
- ],
182
- },
183
- "then": Object {
184
- "_state": Object {
185
- "contextId": "Block:Block:{}",
186
- "key": "__number_block.properties.field",
187
- },
188
- },
189
- },
190
- Object {
191
- "case": Object {
192
- "_eq": Array [
193
- Object {
194
- "_state": "__type_block.properties.field",
195
- },
196
- "string",
197
- ],
198
- },
199
- "then": Object {
200
- "_state": Object {
201
- "contextId": "Block:Block:{}",
202
- "key": "__string_block.properties.field",
203
- },
204
- },
205
- },
206
- ],
207
- "default": null,
208
- },
209
- },
210
- "on": Object {},
211
- },
212
- },
213
- },
214
- ],
215
- }
216
- `);
217
- });
218
-
219
- test('oneOf defaultValueTransformer', () => {
220
- expect(defaultValueTransformer(schema)).toMatchInlineSnapshot(`
221
- Object {
222
- "field": null,
223
- }
224
- `);
225
- const schemaDV = {
226
- properties: {
227
- type: 'object',
228
- additionalProperties: false,
229
- properties: {
230
- field: {
231
- default: 1,
232
- oneOf: [
233
- {
234
- type: 'number',
235
- description: 'number description',
236
- },
237
- {
238
- type: 'string',
239
- description: 'string description',
240
- },
241
- ],
242
- },
243
- },
244
- },
245
- };
246
- expect(defaultValueTransformer(schemaDV)).toMatchInlineSnapshot(`
247
- Object {
248
- "field": 1,
249
- }
250
- `);
251
- });
252
-
253
- // for string object
254
- const schemaStrObj = {
255
- properties: {
256
- type: 'object',
257
- additionalProperties: false,
258
- properties: {
259
- field: {
260
- oneOf: [
261
- {
262
- type: 'string',
263
- description: 'string description',
264
- },
265
- {
266
- type: 'object',
267
- description: 'object description',
268
- properties: {
269
- str: {
270
- type: 'string',
271
- description: 'str description',
272
- },
273
- bool: {
274
- type: 'boolean',
275
- description: 'bool description',
276
- },
277
- },
278
- },
279
- ],
280
- },
281
- },
282
- },
283
- };
284
-
285
- test('oneOf schemaStrObj propertiesFormTransformer', () => {
286
- expect(propertiesFormTransformer(schemaStrObj)).toMatchInlineSnapshot(`
287
- Array [
288
- Object {
289
- "areas": Object {
290
- "content": Object {
291
- "blocks": Array [
292
- Object {
293
- "id": "__string_block.properties.field",
294
- "layout": Object {
295
- "_global": "settings_input_layout",
296
- },
297
- "properties": Object {
298
- "label": Object {
299
- "align": "right",
300
- "extra": "string description",
301
- "span": 8,
302
- },
303
- "size": "small",
304
- "title": "field",
305
- },
306
- "required": false,
307
- "type": "TextInput",
308
- "visible": Object {
309
- "_if": Object {
310
- "else": false,
311
- "test": Object {
312
- "_eq": Array [
313
- Object {
314
- "_state": "__type_block.properties.field",
315
- },
316
- "string",
317
- ],
318
- },
319
- "then": true,
320
- },
321
- },
322
- },
323
- Object {
324
- "blocks": Array [
325
- Object {
326
- "id": "__object_block.properties.field.bool",
327
- "layout": Object {
328
- "_global": "settings_input_layout",
329
- },
330
- "properties": Object {
331
- "label": Object {
332
- "align": "right",
333
- "extra": "bool description",
334
- "span": 8,
335
- },
336
- "size": "small",
337
- "title": "bool",
338
- },
339
- "required": false,
340
- "type": "Switch",
341
- },
342
- Object {
343
- "id": "__object_block.properties.field.str",
344
- "layout": Object {
345
- "_global": "settings_input_layout",
346
- },
347
- "properties": Object {
348
- "label": Object {
349
- "align": "right",
350
- "extra": "str description",
351
- "span": 8,
352
- },
353
- "size": "small",
354
- "title": "str",
355
- },
356
- "required": false,
357
- "type": "TextInput",
358
- },
359
- ],
360
- "id": "__object_block.properties.field",
361
- "layout": Object {
362
- "contentGutter": 0,
363
- },
364
- "properties": Object {
365
- "bodyStyle": Object {
366
- "padding": 0,
367
- },
368
- "size": "small",
369
- "title": "field:",
370
- },
371
- "type": "Card",
372
- "visible": Object {
373
- "_if": Object {
374
- "else": false,
375
- "test": Object {
376
- "_eq": Array [
377
- Object {
378
- "_state": "__type_block.properties.field",
379
- },
380
- "object",
381
- ],
382
- },
383
- "then": true,
384
- },
385
- },
386
- },
387
- ],
388
- },
389
- "extra": Object {
390
- "blocks": Array [
391
- Object {
392
- "id": "__type_block.properties.field",
393
- "properties": Object {
394
- "buttonStyle": "outlined",
395
- "color": "rgba(0, 0, 0, 0.1)",
396
- "label": Object {
397
- "disabled": true,
398
- },
399
- "options": Array [
400
- "string",
401
- "object",
402
- ],
403
- "size": "small",
404
- },
405
- "type": "ButtonSelector",
406
- },
407
- ],
408
- },
409
- },
410
- "id": "field",
411
- "layout": Object {
412
- "contentGutter": 0,
413
- },
414
- "properties": Object {
415
- "bodyStyle": Object {
416
- "padding": 0,
417
- },
418
- "headerStyle": Object {
419
- "background": "rgba(0, 0, 0, 0.06)",
420
- "color": "rgba(0, 0, 0, 0.45)",
421
- },
422
- "inner": true,
423
- "size": "small",
424
- "title": "Select field type",
425
- },
426
- "type": "Card",
427
- },
428
- ]
429
- `);
430
- });
431
-
432
- test('oneOf schemaStrObj propertiesGetterTransformer', () => {
433
- expect(propertiesGetterTransformer(schemaStrObj, { block_type: 'Block' })).toMatchInlineSnapshot(`
434
- Object {
435
- "_object.assign": Array [
436
- Object {
437
- "_state": Object {
438
- "contextId": "Block:Block:{}",
439
- "default": Object {},
440
- "key": "block.properties",
441
- },
442
- },
443
- Object {
444
- "field": Object {
445
- "_mql.expr": Object {
446
- "expr": Object {
447
- "$switch": Object {
448
- "branches": Array [
449
- Object {
450
- "case": Object {
451
- "_eq": Array [
452
- Object {
453
- "_state": "__type_block.properties.field",
454
- },
455
- "string",
456
- ],
457
- },
458
- "then": Object {
459
- "_state": Object {
460
- "contextId": "Block:Block:{}",
461
- "key": "__string_block.properties.field",
462
- },
463
- },
464
- },
465
- Object {
466
- "case": Object {
467
- "_eq": Array [
468
- Object {
469
- "_state": "__type_block.properties.field",
470
- },
471
- "object",
472
- ],
473
- },
474
- "then": Object {
475
- "_object.assign": Array [
476
- Object {
477
- "_state": Object {
478
- "contextId": "Block:Block:{}",
479
- "default": Object {},
480
- "key": "__object_block.properties.field",
481
- },
482
- },
483
- ],
484
- },
485
- },
486
- ],
487
- "default": null,
488
- },
489
- },
490
- "on": Object {},
491
- },
492
- },
493
- },
494
- ],
495
- }
496
- `);
497
- });
498
-
499
- test('oneOf schemaStrObj defaultValueTransformer', () => {
500
- expect(defaultValueTransformer(schemaStrObj)).toMatchInlineSnapshot(`
501
- Object {
502
- "field": null,
503
- }
504
- `);
505
- const schemaDV = {
506
- properties: {
507
- type: 'object',
508
- additionalProperties: false,
509
- properties: {
510
- field: {
511
- default: {
512
- str: 'x',
513
- },
514
- oneOf: [
515
- {
516
- type: 'string',
517
- description: 'string description',
518
- },
519
- {
520
- type: 'object',
521
- description: 'object description',
522
- properties: {
523
- str: {
524
- type: 'string',
525
- description: 'str description',
526
- },
527
- bool: {
528
- type: 'boolean',
529
- description: 'bool description',
530
- },
531
- },
532
- },
533
- ],
534
- },
535
- },
536
- },
537
- };
538
- expect(defaultValueTransformer(schemaDV)).toMatchInlineSnapshot(`
539
- Object {
540
- "field": Object {
541
- "str": "x",
542
- },
543
- }
544
- `);
545
- });
546
-
547
- const schemaOneOfStrYaml = {
548
- properties: {
549
- type: 'object',
550
- additionalProperties: false,
551
- properties: {
552
- field: {
553
- oneOf: [
554
- {
555
- type: 'string',
556
- description: 'string description',
557
- },
558
- {
559
- type: 'object',
560
- description: 'object description',
561
- docs: {
562
- displayType: 'yaml',
563
- },
564
- },
565
- ],
566
- },
567
- },
568
- },
569
- };
570
-
571
- test('oneOf propertiesFormTransformer schemaOneOfStrYaml', () => {
572
- expect(propertiesFormTransformer(schemaOneOfStrYaml)).toMatchInlineSnapshot(`
573
- Array [
574
- Object {
575
- "areas": Object {
576
- "content": Object {
577
- "blocks": Array [
578
- Object {
579
- "id": "__string_block.properties.field",
580
- "layout": Object {
581
- "_global": "settings_input_layout",
582
- },
583
- "properties": Object {
584
- "label": Object {
585
- "align": "right",
586
- "extra": "string description",
587
- "span": 8,
588
- },
589
- "size": "small",
590
- "title": "field",
591
- },
592
- "required": false,
593
- "type": "TextInput",
594
- "visible": Object {
595
- "_if": Object {
596
- "else": false,
597
- "test": Object {
598
- "_eq": Array [
599
- Object {
600
- "_state": "__type_block.properties.field",
601
- },
602
- "string",
603
- ],
604
- },
605
- "then": true,
606
- },
607
- },
608
- },
609
- Object {
610
- "id": "__object_block.properties.field",
611
- "layout": Object {
612
- "_global": "settings_input_layout",
613
- },
614
- "properties": Object {
615
- "autoSize": Object {
616
- "minRows": 2,
617
- },
618
- "label": Object {
619
- "align": "right",
620
- "extra": "object description",
621
- "span": 8,
622
- },
623
- "placeholder": "Type YAML here",
624
- "size": "small",
625
- "title": "field",
626
- },
627
- "required": false,
628
- "type": "TextArea",
629
- "visible": Object {
630
- "_if": Object {
631
- "else": false,
632
- "test": Object {
633
- "_eq": Array [
634
- Object {
635
- "_state": "__type_block.properties.field",
636
- },
637
- "object",
638
- ],
639
- },
640
- "then": true,
641
- },
642
- },
643
- },
644
- ],
645
- },
646
- "extra": Object {
647
- "blocks": Array [
648
- Object {
649
- "id": "__type_block.properties.field",
650
- "properties": Object {
651
- "buttonStyle": "outlined",
652
- "color": "rgba(0, 0, 0, 0.1)",
653
- "label": Object {
654
- "disabled": true,
655
- },
656
- "options": Array [
657
- "string",
658
- "object",
659
- ],
660
- "size": "small",
661
- },
662
- "type": "ButtonSelector",
663
- },
664
- ],
665
- },
666
- },
667
- "id": "field",
668
- "layout": Object {
669
- "contentGutter": 0,
670
- },
671
- "properties": Object {
672
- "bodyStyle": Object {
673
- "padding": 0,
674
- },
675
- "headerStyle": Object {
676
- "background": "rgba(0, 0, 0, 0.06)",
677
- "color": "rgba(0, 0, 0, 0.45)",
678
- },
679
- "inner": true,
680
- "size": "small",
681
- "title": "Select field type",
682
- },
683
- "type": "Card",
684
- },
685
- ]
686
- `);
687
- });
688
-
689
- test('oneOf propertiesGetterTransformer schemaOneOfStrYaml', () => {
690
- expect(propertiesGetterTransformer(schemaOneOfStrYaml, { block_type: 'Block' }))
691
- .toMatchInlineSnapshot(`
692
- Object {
693
- "_object.assign": Array [
694
- Object {
695
- "_state": Object {
696
- "contextId": "Block:Block:{}",
697
- "default": Object {},
698
- "key": "block.properties",
699
- },
700
- },
701
- Object {
702
- "field": Object {
703
- "_mql.expr": Object {
704
- "expr": Object {
705
- "$switch": Object {
706
- "branches": Array [
707
- Object {
708
- "case": Object {
709
- "_eq": Array [
710
- Object {
711
- "_state": "__type_block.properties.field",
712
- },
713
- "string",
714
- ],
715
- },
716
- "then": Object {
717
- "_state": Object {
718
- "contextId": "Block:Block:{}",
719
- "key": "__string_block.properties.field",
720
- },
721
- },
722
- },
723
- Object {
724
- "case": Object {
725
- "_eq": Array [
726
- Object {
727
- "_state": "__type_block.properties.field",
728
- },
729
- "object",
730
- ],
731
- },
732
- "then": Object {
733
- "_yaml.parse": Object {
734
- "_if_none": Array [
735
- Object {
736
- "_state": Object {
737
- "contextId": "Block:Block:{}",
738
- "key": "__object_block.properties.field",
739
- },
740
- },
741
- "",
742
- ],
743
- },
744
- },
745
- },
746
- ],
747
- "default": null,
748
- },
749
- },
750
- "on": Object {},
751
- },
752
- },
753
- },
754
- ],
755
- }
756
- `);
757
- });
758
-
759
- test('oneOf defaultValueTransformer schemaOneOfStrYaml', () => {
760
- expect(defaultValueTransformer(schemaOneOfStrYaml)).toMatchInlineSnapshot(`
761
- Object {
762
- "field": null,
763
- }
764
- `);
765
- const schemaOneOfStrYamlDV = {
766
- properties: {
767
- type: 'object',
768
- additionalProperties: false,
769
- properties: {
770
- field: {
771
- default: 'str',
772
- oneOf: [
773
- {
774
- type: 'number',
775
- description: 'number description',
776
- },
777
- {
778
- type: 'object',
779
- description: 'object description',
780
- docs: {
781
- displayType: 'yaml',
782
- },
783
- },
784
- ],
785
- },
786
- },
787
- },
788
- };
789
- expect(defaultValueTransformer(schemaOneOfStrYamlDV)).toMatchInlineSnapshot(`
790
- Object {
791
- "field": "str",
792
- }
793
- `);
794
- });