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