amis 1.9.0-beta.12 → 1.9.0-beta.15

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 (365) hide show
  1. package/lib/Schema.d.ts +4 -2
  2. package/lib/Schema.js.map +1 -1
  3. package/lib/SchemaRenderer.d.ts +2 -2
  4. package/lib/SchemaRenderer.js +3 -3
  5. package/lib/SchemaRenderer.js.map +2 -2
  6. package/lib/actions/Action.d.ts +8 -6
  7. package/lib/actions/Action.js.map +2 -2
  8. package/lib/actions/AjaxAction.d.ts +10 -7
  9. package/lib/actions/AjaxAction.js +27 -21
  10. package/lib/actions/AjaxAction.js.map +2 -2
  11. package/lib/actions/BreakAction.d.ts +2 -2
  12. package/lib/actions/BreakAction.js.map +1 -1
  13. package/lib/actions/BroadcastAction.d.ts +3 -3
  14. package/lib/actions/BroadcastAction.js +3 -2
  15. package/lib/actions/BroadcastAction.js.map +2 -2
  16. package/lib/actions/CmptAction.d.ts +2 -2
  17. package/lib/actions/CmptAction.js +7 -9
  18. package/lib/actions/CmptAction.js.map +2 -2
  19. package/lib/actions/ContinueAction.d.ts +2 -2
  20. package/lib/actions/ContinueAction.js.map +1 -1
  21. package/lib/actions/CopyAction.d.ts +7 -4
  22. package/lib/actions/CopyAction.js +8 -6
  23. package/lib/actions/CopyAction.js.map +2 -2
  24. package/lib/actions/CustomAction.d.ts +2 -2
  25. package/lib/actions/CustomAction.js.map +1 -1
  26. package/lib/actions/DialogAction.d.ts +14 -8
  27. package/lib/actions/DialogAction.js +6 -6
  28. package/lib/actions/DialogAction.js.map +2 -2
  29. package/lib/actions/DrawerAction.d.ts +3 -3
  30. package/lib/actions/DrawerAction.js.map +1 -1
  31. package/lib/actions/EmailAction.d.ts +10 -7
  32. package/lib/actions/EmailAction.js +4 -5
  33. package/lib/actions/EmailAction.js.map +2 -2
  34. package/lib/actions/LinkAction.d.ts +19 -11
  35. package/lib/actions/LinkAction.js +6 -5
  36. package/lib/actions/LinkAction.js.map +2 -2
  37. package/lib/actions/LoopAction.d.ts +6 -3
  38. package/lib/actions/LoopAction.js +22 -20
  39. package/lib/actions/LoopAction.js.map +2 -2
  40. package/lib/actions/PageAction.d.ts +8 -5
  41. package/lib/actions/PageAction.js +3 -2
  42. package/lib/actions/PageAction.js.map +2 -2
  43. package/lib/actions/ParallelAction.d.ts +2 -2
  44. package/lib/actions/ParallelAction.js.map +1 -1
  45. package/lib/actions/SwitchAction.d.ts +2 -2
  46. package/lib/actions/SwitchAction.js.map +1 -1
  47. package/lib/actions/ToastAction.d.ts +2 -2
  48. package/lib/actions/ToastAction.js +6 -4
  49. package/lib/actions/ToastAction.js.map +2 -2
  50. package/lib/components/Editor.d.ts +84 -84
  51. package/lib/components/InputBox.js +1 -1
  52. package/lib/components/InputBox.js.map +2 -2
  53. package/lib/components/Pagination.d.ts +1175 -0
  54. package/lib/components/Pagination.js +274 -0
  55. package/lib/components/Pagination.js.map +13 -0
  56. package/lib/components/PickerContainer.d.ts +1 -0
  57. package/lib/components/PickerContainer.js +3 -2
  58. package/lib/components/PickerContainer.js.map +2 -2
  59. package/lib/components/Rating.js +11 -9
  60. package/lib/components/Rating.js.map +2 -2
  61. package/lib/components/Select.js +3 -3
  62. package/lib/components/Select.js.map +2 -2
  63. package/lib/components/Tag.d.ts +148 -0
  64. package/lib/components/Tag.js +96 -0
  65. package/lib/components/Tag.js.map +13 -0
  66. package/lib/components/TooltipWrapper.d.ts +25 -21
  67. package/lib/components/TooltipWrapper.js +11 -1
  68. package/lib/components/TooltipWrapper.js.map +2 -2
  69. package/lib/components/TransferDropDown.d.ts +85 -84
  70. package/lib/components/TransferDropDown.js +2 -2
  71. package/lib/components/TransferDropDown.js.map +2 -2
  72. package/lib/components/Tree.d.ts +84 -84
  73. package/lib/components/formula/VariableList.d.ts +1 -0
  74. package/lib/components/formula/VariableList.js.map +2 -2
  75. package/lib/components/icons.js +2 -0
  76. package/lib/components/icons.js.map +2 -2
  77. package/lib/components/index.d.ts +4 -1
  78. package/lib/components/index.js +7 -1
  79. package/lib/components/index.js.map +2 -2
  80. package/lib/components/schema-editor/Array.d.ts +11 -0
  81. package/lib/components/schema-editor/Array.js +66 -0
  82. package/lib/components/schema-editor/Array.js.map +13 -0
  83. package/lib/components/schema-editor/Common.d.ts +29 -0
  84. package/lib/components/schema-editor/Common.js +69 -0
  85. package/lib/components/schema-editor/Common.js.map +13 -0
  86. package/lib/components/schema-editor/Item.d.ts +9 -0
  87. package/lib/components/schema-editor/Item.js +31 -0
  88. package/lib/components/schema-editor/Item.js.map +13 -0
  89. package/lib/components/schema-editor/Object.d.ts +44 -0
  90. package/lib/components/schema-editor/Object.js +191 -0
  91. package/lib/components/schema-editor/Object.js.map +13 -0
  92. package/lib/components/schema-editor/SchemaVariableList.d.ts +316 -0
  93. package/lib/components/schema-editor/SchemaVariableList.js +74 -0
  94. package/lib/components/schema-editor/SchemaVariableList.js.map +13 -0
  95. package/lib/components/schema-editor/SchemaVariableListPicker.d.ts +305 -0
  96. package/lib/components/schema-editor/SchemaVariableListPicker.js +32 -0
  97. package/lib/components/schema-editor/SchemaVariableListPicker.js.map +13 -0
  98. package/lib/components/schema-editor/index.d.ts +520 -0
  99. package/lib/components/schema-editor/index.js +118 -0
  100. package/lib/components/schema-editor/index.js.map +13 -0
  101. package/lib/components/table/Cell.d.ts +930 -0
  102. package/lib/components/table/Cell.js +36 -0
  103. package/lib/components/table/Cell.js.map +13 -0
  104. package/lib/components/table/HeadCellDropDown.d.ts +514 -0
  105. package/lib/components/table/HeadCellDropDown.js +52 -0
  106. package/lib/components/table/HeadCellDropDown.js.map +13 -0
  107. package/lib/components/table/HeadCellFilter.d.ts +771 -0
  108. package/lib/components/table/HeadCellFilter.js +106 -0
  109. package/lib/components/table/HeadCellFilter.js.map +13 -0
  110. package/lib/components/table/HeadCellSelect.d.ts +672 -0
  111. package/lib/components/table/HeadCellSelect.js +46 -0
  112. package/lib/components/table/HeadCellSelect.js.map +13 -0
  113. package/lib/components/table/HeadCellSort.d.ts +498 -0
  114. package/lib/components/table/HeadCellSort.js +67 -0
  115. package/lib/components/table/HeadCellSort.js.map +13 -0
  116. package/lib/components/table/index.d.ts +1355 -0
  117. package/lib/components/table/index.js +1095 -0
  118. package/lib/components/table/index.js.map +13 -0
  119. package/lib/env.d.ts +2 -4
  120. package/lib/env.js.map +2 -2
  121. package/lib/factory.js +0 -95
  122. package/lib/factory.js.map +2 -2
  123. package/lib/icons/dot.js +11 -0
  124. package/lib/index.d.ts +6 -1
  125. package/lib/index.js +9 -2
  126. package/lib/index.js.map +2 -2
  127. package/lib/locale/de-DE.js +18 -1
  128. package/lib/locale/de-DE.js.map +2 -2
  129. package/lib/locale/en-US.js +18 -1
  130. package/lib/locale/en-US.js.map +2 -2
  131. package/lib/locale/zh-CN.js +20 -1
  132. package/lib/locale/zh-CN.js.map +2 -2
  133. package/lib/renderers/Action.js +0 -2
  134. package/lib/renderers/Action.js.map +2 -2
  135. package/lib/renderers/Carousel.d.ts +5 -1
  136. package/lib/renderers/Carousel.js +18 -5
  137. package/lib/renderers/Carousel.js.map +2 -2
  138. package/lib/renderers/Form/ButtonGroupSelect.d.ts +2 -0
  139. package/lib/renderers/Form/ButtonGroupSelect.js +7 -0
  140. package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
  141. package/lib/renderers/Form/Checkbox.js +3 -4
  142. package/lib/renderers/Form/Checkbox.js.map +2 -2
  143. package/lib/renderers/Form/Checkboxes.d.ts +2 -1
  144. package/lib/renderers/Form/Checkboxes.js +19 -14
  145. package/lib/renderers/Form/Checkboxes.js.map +2 -2
  146. package/lib/renderers/Form/Combo.js +23 -4
  147. package/lib/renderers/Form/Combo.js.map +2 -2
  148. package/lib/renderers/Form/DiffEditor.d.ts +126 -18
  149. package/lib/renderers/Form/Editor.d.ts +412 -112
  150. package/lib/renderers/Form/Editor.js +10 -1
  151. package/lib/renderers/Form/Editor.js.map +2 -2
  152. package/lib/renderers/Form/InputExcel.js +6 -1
  153. package/lib/renderers/Form/InputExcel.js.map +2 -2
  154. package/lib/renderers/Form/InputFile.js +1 -2
  155. package/lib/renderers/Form/InputFile.js.map +2 -2
  156. package/lib/renderers/Form/InputTree.js +1 -1
  157. package/lib/renderers/Form/InputTree.js.map +2 -2
  158. package/lib/renderers/Form/Item.d.ts +0 -6
  159. package/lib/renderers/Form/JSONSchemaEditor.d.ts +41 -0
  160. package/lib/renderers/Form/JSONSchemaEditor.js +33 -0
  161. package/lib/renderers/Form/JSONSchemaEditor.js.map +13 -0
  162. package/lib/renderers/Form/ListSelect.d.ts +2 -0
  163. package/lib/renderers/Form/ListSelect.js +7 -0
  164. package/lib/renderers/Form/ListSelect.js.map +2 -2
  165. package/lib/renderers/Form/Options.js +1 -0
  166. package/lib/renderers/Form/Options.js.map +2 -2
  167. package/lib/renderers/Form/Select.js +12 -1
  168. package/lib/renderers/Form/Select.js.map +2 -2
  169. package/lib/renderers/Form/TabsTransfer.d.ts +1 -1
  170. package/lib/renderers/Form/TabsTransfer.js +2 -2
  171. package/lib/renderers/Form/TabsTransfer.js.map +2 -2
  172. package/lib/renderers/Form/TreeSelect.d.ts +4 -0
  173. package/lib/renderers/Form/TreeSelect.js +2 -2
  174. package/lib/renderers/Form/TreeSelect.js.map +2 -2
  175. package/lib/renderers/Form/wrapControl.js +10 -5
  176. package/lib/renderers/Form/wrapControl.js.map +2 -2
  177. package/lib/renderers/Pagination.d.ts +49 -30
  178. package/lib/renderers/Pagination.js +3 -132
  179. package/lib/renderers/Pagination.js.map +2 -2
  180. package/lib/renderers/Table/HeadCellSearchDropdown.js +0 -1
  181. package/lib/renderers/Table/HeadCellSearchDropdown.js.map +2 -2
  182. package/lib/renderers/Table-v2/HeadCellSearchDropdown.d.ts +29 -0
  183. package/lib/renderers/Table-v2/HeadCellSearchDropdown.js +158 -0
  184. package/lib/renderers/Table-v2/HeadCellSearchDropdown.js.map +13 -0
  185. package/lib/renderers/Table-v2/TableCell.d.ts +6 -0
  186. package/lib/renderers/Table-v2/TableCell.js +28 -0
  187. package/lib/renderers/Table-v2/TableCell.js.map +13 -0
  188. package/lib/renderers/Table-v2/index.d.ts +256 -0
  189. package/lib/renderers/Table-v2/index.js +548 -0
  190. package/lib/renderers/Table-v2/index.js.map +13 -0
  191. package/lib/renderers/Tabs.js +1 -1
  192. package/lib/renderers/Tabs.js.map +2 -2
  193. package/lib/renderers/Tag.d.ts +66 -0
  194. package/lib/renderers/Tag.js +53 -0
  195. package/lib/renderers/Tag.js.map +13 -0
  196. package/lib/renderers/Wizard.js +3 -3
  197. package/lib/renderers/Wizard.js.map +2 -2
  198. package/lib/schemaExtend.js +24 -30
  199. package/lib/schemaExtend.js.map +2 -2
  200. package/lib/store/combo.d.ts +140 -20
  201. package/lib/store/form.d.ts +56 -8
  202. package/lib/store/formItem.d.ts +3 -1
  203. package/lib/store/formItem.js +3 -1
  204. package/lib/store/formItem.js.map +2 -2
  205. package/lib/store/index.js +2 -0
  206. package/lib/store/index.js.map +2 -2
  207. package/lib/store/table-v2.d.ts +308 -0
  208. package/lib/store/table-v2.js +452 -0
  209. package/lib/store/table-v2.js.map +13 -0
  210. package/lib/store/table.d.ts +112 -16
  211. package/lib/store/table.js +1 -1
  212. package/lib/store/table.js.map +2 -2
  213. package/lib/themes/ang-ie11.css +1686 -120
  214. package/lib/themes/ang.css +1807 -208
  215. package/lib/themes/ang.css.map +1 -1
  216. package/lib/themes/antd-ie11.css +1667 -101
  217. package/lib/themes/antd.css +1789 -201
  218. package/lib/themes/antd.css.map +1 -1
  219. package/lib/themes/cxd-ie11.css +1662 -97
  220. package/lib/themes/cxd.css +1983 -394
  221. package/lib/themes/cxd.css.map +1 -1
  222. package/lib/themes/dark-ie11.css +1667 -101
  223. package/lib/themes/dark.css +1789 -201
  224. package/lib/themes/dark.css.map +1 -1
  225. package/lib/themes/default-ie11.css +1662 -97
  226. package/lib/themes/default.css +1983 -394
  227. package/lib/themes/default.css.map +1 -1
  228. package/lib/utils/DataSchema.d.ts +25 -0
  229. package/lib/utils/DataSchema.js +104 -0
  230. package/lib/utils/DataSchema.js.map +13 -0
  231. package/lib/utils/DataScope.d.ts +23 -0
  232. package/lib/utils/DataScope.js +140 -0
  233. package/lib/utils/DataScope.js.map +13 -0
  234. package/lib/utils/handleAction.js +1 -1
  235. package/lib/utils/handleAction.js.map +2 -2
  236. package/lib/utils/renderer-event.d.ts +8 -2
  237. package/lib/utils/renderer-event.js +102 -1
  238. package/lib/utils/renderer-event.js.map +2 -2
  239. package/package.json +3 -2
  240. package/schema.json +1476 -469
  241. package/scss/_properties.scss +69 -0
  242. package/scss/components/_button.scss +37 -39
  243. package/scss/components/_context-menu.scss +3 -18
  244. package/scss/components/_json-schema-editor.scss +126 -0
  245. package/scss/components/_pagination.scss +104 -23
  246. package/scss/components/_result-box.scss +2 -2
  247. package/scss/components/_table-v2.scss +912 -0
  248. package/scss/components/_tag.scss +177 -0
  249. package/scss/components/form/_selection.scss +1 -14
  250. package/scss/components/form/_text.scss +1 -1
  251. package/scss/themes/_antd-variables.scss +0 -13
  252. package/scss/themes/_common.scss +3 -0
  253. package/scss/themes/_cxd-variables.scss +7 -17
  254. package/scss/themes/_dark-variables.scss +0 -13
  255. package/scss/themes/cxd.scss +1 -1
  256. package/sdk/ang-ie11.css +2240 -227
  257. package/sdk/ang.css +2905 -859
  258. package/sdk/antd-ie11.css +2233 -220
  259. package/sdk/antd.css +2905 -870
  260. package/sdk/barcode.js +51 -51
  261. package/sdk/charts.js +14 -14
  262. package/sdk/codemirror.js +7 -7
  263. package/sdk/color-picker.js +65 -65
  264. package/sdk/cropperjs.js +2 -2
  265. package/sdk/cxd-ie11.css +2223 -211
  266. package/sdk/cxd.css +2911 -875
  267. package/sdk/dark-ie11.css +2233 -220
  268. package/sdk/dark.css +2905 -870
  269. package/sdk/exceljs.js +1 -1
  270. package/sdk/locale/de-DE.js +18 -1
  271. package/sdk/markdown.js +69 -69
  272. package/sdk/papaparse.js +1 -1
  273. package/sdk/renderers/Form/CityDB.js +1 -1
  274. package/sdk/rest.js +16 -16
  275. package/sdk/rich-text.js +62 -62
  276. package/sdk/sdk-ie11.css +2223 -211
  277. package/sdk/sdk.css +2911 -875
  278. package/sdk/sdk.js +1326 -1270
  279. package/sdk/thirds/hls.js/hls.js +1 -1
  280. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  281. package/sdk/tinymce.js +57 -57
  282. package/src/Schema.ts +7 -0
  283. package/src/SchemaRenderer.tsx +4 -5
  284. package/src/actions/Action.ts +7 -6
  285. package/src/actions/AjaxAction.ts +33 -24
  286. package/src/actions/BreakAction.ts +2 -2
  287. package/src/actions/BroadcastAction.ts +6 -5
  288. package/src/actions/CmptAction.ts +5 -6
  289. package/src/actions/ContinueAction.ts +2 -2
  290. package/src/actions/CopyAction.ts +14 -8
  291. package/src/actions/CustomAction.ts +2 -2
  292. package/src/actions/DialogAction.ts +16 -10
  293. package/src/actions/DrawerAction.ts +3 -3
  294. package/src/actions/EmailAction.ts +12 -12
  295. package/src/actions/LinkAction.ts +34 -14
  296. package/src/actions/LoopAction.ts +13 -8
  297. package/src/actions/PageAction.ts +9 -6
  298. package/src/actions/ParallelAction.ts +2 -2
  299. package/src/actions/SwitchAction.ts +2 -2
  300. package/src/actions/ToastAction.ts +9 -5
  301. package/src/components/InputBox.tsx +1 -0
  302. package/src/components/Pagination.tsx +446 -0
  303. package/src/components/PickerContainer.tsx +8 -5
  304. package/src/components/Rating.tsx +16 -9
  305. package/src/components/Select.tsx +3 -3
  306. package/src/components/Tag.tsx +179 -0
  307. package/src/components/TooltipWrapper.tsx +14 -1
  308. package/src/components/TransferDropDown.tsx +3 -0
  309. package/src/components/formula/VariableList.tsx +1 -0
  310. package/src/components/icons.tsx +2 -0
  311. package/src/components/index.tsx +7 -1
  312. package/src/components/schema-editor/Array.tsx +95 -0
  313. package/src/components/schema-editor/Common.tsx +138 -0
  314. package/src/components/schema-editor/Item.tsx +36 -0
  315. package/src/components/schema-editor/Object.tsx +299 -0
  316. package/src/components/schema-editor/SchemaVariableList.tsx +97 -0
  317. package/src/components/schema-editor/SchemaVariableListPicker.tsx +66 -0
  318. package/src/components/schema-editor/index.tsx +211 -0
  319. package/src/components/table/Cell.tsx +70 -0
  320. package/src/components/table/HeadCellDropDown.tsx +115 -0
  321. package/src/components/table/HeadCellFilter.tsx +193 -0
  322. package/src/components/table/HeadCellSelect.tsx +86 -0
  323. package/src/components/table/HeadCellSort.tsx +102 -0
  324. package/src/components/table/index.tsx +1681 -0
  325. package/src/env.tsx +7 -14
  326. package/src/factory.tsx +3 -106
  327. package/src/icons/dot.svg +11 -0
  328. package/src/index.tsx +8 -1
  329. package/src/locale/de-DE.ts +18 -1
  330. package/src/locale/en-US.ts +18 -1
  331. package/src/locale/zh-CN.ts +20 -1
  332. package/src/renderers/Action.tsx +1 -1
  333. package/src/renderers/Carousel.tsx +21 -6
  334. package/src/renderers/Form/ButtonGroupSelect.tsx +10 -1
  335. package/src/renderers/Form/Checkbox.tsx +4 -4
  336. package/src/renderers/Form/Checkboxes.tsx +31 -25
  337. package/src/renderers/Form/Combo.tsx +20 -4
  338. package/src/renderers/Form/Editor.tsx +15 -1
  339. package/src/renderers/Form/InputExcel.tsx +6 -1
  340. package/src/renderers/Form/InputFile.tsx +1 -2
  341. package/src/renderers/Form/InputTree.tsx +1 -1
  342. package/src/renderers/Form/JSONSchemaEditor.tsx +67 -0
  343. package/src/renderers/Form/ListSelect.tsx +9 -1
  344. package/src/renderers/Form/Options.tsx +1 -1
  345. package/src/renderers/Form/Select.tsx +7 -0
  346. package/src/renderers/Form/TabsTransfer.tsx +2 -2
  347. package/src/renderers/Form/TreeSelect.tsx +8 -1
  348. package/src/renderers/Form/wrapControl.tsx +11 -5
  349. package/src/renderers/Pagination.tsx +65 -253
  350. package/src/renderers/Table/HeadCellSearchDropdown.tsx +0 -1
  351. package/src/renderers/Table-v2/HeadCellSearchDropdown.tsx +244 -0
  352. package/src/renderers/Table-v2/TableCell.tsx +19 -0
  353. package/src/renderers/Table-v2/index.tsx +1140 -0
  354. package/src/renderers/Tabs.tsx +1 -1
  355. package/src/renderers/Tag.tsx +128 -0
  356. package/src/renderers/Wizard.tsx +3 -3
  357. package/src/schemaExtend.ts +24 -28
  358. package/src/store/formItem.ts +5 -1
  359. package/src/store/index.ts +2 -0
  360. package/src/store/table-v2.ts +646 -0
  361. package/src/store/table.ts +1 -1
  362. package/src/utils/DataSchema.ts +131 -0
  363. package/src/utils/DataScope.ts +190 -0
  364. package/src/utils/handleAction.ts +1 -1
  365. package/src/utils/renderer-event.ts +113 -2
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaEditorItemObject = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ var helper_1 = require("../../utils/helper");
7
+ var Button_1 = (0, tslib_1.__importDefault)(require("../Button"));
8
+ var icons_1 = require("../icons");
9
+ var InputBox_1 = (0, tslib_1.__importDefault)(require("../InputBox"));
10
+ var Common_1 = require("./Common");
11
+ var Item_1 = require("./Item");
12
+ var SchemaEditorItemObject = /** @class */ (function (_super) {
13
+ (0, tslib_1.__extends)(SchemaEditorItemObject, _super);
14
+ function SchemaEditorItemObject() {
15
+ var _this = _super !== null && _super.apply(this, arguments) || this;
16
+ _this.state = {
17
+ members: _this.propsToMembers(_this.props),
18
+ collapsed: false
19
+ };
20
+ return _this;
21
+ }
22
+ SchemaEditorItemObject.prototype.componentDidUpdate = function (prevProps) {
23
+ var props = this.props;
24
+ // 外部属性变化,更新 state
25
+ if (props.value !== prevProps.value &&
26
+ JSON.stringify(props.value) !== JSON.stringify(this.lastValue)) {
27
+ this.setState({
28
+ members: this.propsToMembers(props)
29
+ });
30
+ }
31
+ };
32
+ SchemaEditorItemObject.prototype.propsToMembers = function (props) {
33
+ var _a, _b;
34
+ var members = [];
35
+ var required = Array.isArray((_a = props.value) === null || _a === void 0 ? void 0 : _a.required)
36
+ ? props.value.required
37
+ : [];
38
+ if ((_b = props.value) === null || _b === void 0 ? void 0 : _b.properties) {
39
+ var properties_1 = props.value.properties;
40
+ Object.keys(properties_1).forEach(function (key) {
41
+ var value = properties_1[key];
42
+ members.push({
43
+ id: (0, helper_1.guid)(),
44
+ key: key || '',
45
+ hasError: !key || members.some(function (i) { return i.key === key; }),
46
+ required: !!~required.indexOf(key),
47
+ schema: value
48
+ });
49
+ });
50
+ }
51
+ return members;
52
+ };
53
+ SchemaEditorItemObject.prototype.pipeOut = function () {
54
+ var members = this.state.members;
55
+ var _a = this.props, value = _a.value, onChange = _a.onChange;
56
+ var properties = {};
57
+ var required = [];
58
+ members
59
+ .filter(function (item) { return !item.hasError; })
60
+ .forEach(function (member) {
61
+ properties[member.key] = member.schema;
62
+ if (member.required) {
63
+ required.push(member.key);
64
+ }
65
+ });
66
+ this.lastValue = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, value), { properties: properties, required: required });
67
+ onChange === null || onChange === void 0 ? void 0 : onChange(this.lastValue);
68
+ };
69
+ SchemaEditorItemObject.prototype.handleAdd = function () {
70
+ var members = this.state.members.concat();
71
+ members.push({
72
+ id: (0, helper_1.guid)(),
73
+ key: '',
74
+ hasError: true,
75
+ required: false,
76
+ schema: {
77
+ type: 'string'
78
+ }
79
+ });
80
+ this.setState({
81
+ members: members
82
+ }, this.pipeOut);
83
+ };
84
+ SchemaEditorItemObject.prototype.handlePropKeyChange = function (index, key) {
85
+ var members = this.state.members.concat();
86
+ members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { key: key, hasError: !key || members.some(function (m, i) { return i !== index && m.key === key; }) });
87
+ this.setState({ members: members }, this.pipeOut);
88
+ };
89
+ SchemaEditorItemObject.prototype.handlePropTitleChange = function (index, title) {
90
+ var members = this.state.members.concat();
91
+ members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { schema: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index].schema), { title: title }) });
92
+ this.setState({ members: members }, this.pipeOut);
93
+ };
94
+ SchemaEditorItemObject.prototype.handlePropRemove = function (index) {
95
+ var members = this.state.members.concat();
96
+ members.splice(index, 1);
97
+ this.setState({ members: members }, this.pipeOut);
98
+ };
99
+ SchemaEditorItemObject.prototype.handlePropChange = function (index, item) {
100
+ var members = this.state.members.concat();
101
+ members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { schema: (0, tslib_1.__assign)({}, item) });
102
+ this.setState({ members: members }, this.pipeOut);
103
+ };
104
+ SchemaEditorItemObject.prototype.handlePropRequiredChange = function (index, required) {
105
+ var members = this.state.members.concat();
106
+ members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { required: required });
107
+ this.setState({ members: members }, this.pipeOut);
108
+ };
109
+ SchemaEditorItemObject.prototype.toggleCollapsed = function () {
110
+ this.setState({
111
+ collapsed: !this.state.collapsed
112
+ });
113
+ };
114
+ SchemaEditorItemObject.prototype.rendererProps = function () {
115
+ var _this = this;
116
+ var _a = this.props, value = _a.value, __ = _a.translate, cx = _a.classnames, renderExtraProps = _a.renderExtraProps, locale = _a.locale, classPrefix = _a.classPrefix, disabled = _a.disabled, showInfo = _a.showInfo, types = _a.types, onTypeChange = _a.onTypeChange;
117
+ var members = this.state.members;
118
+ return (react_1.default.createElement("div", { className: cx('SchemaEditorProps', {
119
+ 'SchemaEditorProps--depth': showInfo !== false
120
+ }) },
121
+ members.length ? (members.map(function (member, index) { return (react_1.default.createElement(Item_1.SchemaEditorItem, { key: member.id, types: types, onTypeChange: onTypeChange, prefix: react_1.default.createElement(react_1.default.Fragment, null,
122
+ react_1.default.createElement(InputBox_1.default, { className: cx('SchemaEditor-key'), hasError: member.hasError, value: member.key || '', onChange: _this.handlePropKeyChange.bind(_this, index), placeholder: __('JSONSchema.key'), disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) }),
123
+ react_1.default.createElement(InputBox_1.default, { className: cx('SchemaEditor-title'), value: member.schema.title || '', onChange: _this.handlePropTitleChange.bind(_this, index), placeholder: __('JSONSchema.title'), disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) })), affix: react_1.default.createElement(Button_1.default, { className: cx('SchemaEditor-btn'), onClick: _this.handlePropRemove.bind(_this, index), iconOnly: true, disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) },
124
+ react_1.default.createElement(icons_1.Icon, { icon: "remove", className: "icon" })), value: member.schema, onChange: _this.handlePropChange.bind(_this, index), renderExtraProps: renderExtraProps, locale: locale, translate: __, classnames: cx, classPrefix: classPrefix, disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref), required: member.required, onRequiredChange: _this.handlePropRequiredChange.bind(_this, index) })); })) : (react_1.default.createElement("div", { className: cx('SchemaEditorProps-placeholder') }, __('placeholder.empty'))),
125
+ react_1.default.createElement(Button_1.default, { level: "link", onClick: this.handleAdd, size: "xs", disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) }, __('JSONSchema.add_prop'))));
126
+ };
127
+ SchemaEditorItemObject.prototype.render = function () {
128
+ var _a = this.props, cx = _a.classnames, showInfo = _a.showInfo, __ = _a.translate, disabled = _a.disabled;
129
+ return (react_1.default.createElement("div", { className: cx('SchemaEditorItem SchemaEditorObject', {
130
+ 'is-collapsed': this.state.collapsed
131
+ }) },
132
+ showInfo !== false ? (react_1.default.createElement(react_1.default.Fragment, null,
133
+ react_1.default.createElement("a", { className: cx('SchemaEditor-caret', {
134
+ 'is-collapsed': this.state.collapsed
135
+ }), onClick: this.toggleCollapsed },
136
+ react_1.default.createElement(icons_1.Icon, { icon: "caret", className: "icon" })),
137
+ this.renderCommon())) : null,
138
+ this.state.collapsed ? null : this.rendererProps()));
139
+ };
140
+ (0, tslib_1.__decorate)([
141
+ helper_1.autobind,
142
+ (0, tslib_1.__metadata)("design:type", Function),
143
+ (0, tslib_1.__metadata)("design:paramtypes", []),
144
+ (0, tslib_1.__metadata)("design:returntype", void 0)
145
+ ], SchemaEditorItemObject.prototype, "pipeOut", null);
146
+ (0, tslib_1.__decorate)([
147
+ helper_1.autobind,
148
+ (0, tslib_1.__metadata)("design:type", Function),
149
+ (0, tslib_1.__metadata)("design:paramtypes", []),
150
+ (0, tslib_1.__metadata)("design:returntype", void 0)
151
+ ], SchemaEditorItemObject.prototype, "handleAdd", null);
152
+ (0, tslib_1.__decorate)([
153
+ helper_1.autobind,
154
+ (0, tslib_1.__metadata)("design:type", Function),
155
+ (0, tslib_1.__metadata)("design:paramtypes", [Number, String]),
156
+ (0, tslib_1.__metadata)("design:returntype", void 0)
157
+ ], SchemaEditorItemObject.prototype, "handlePropKeyChange", null);
158
+ (0, tslib_1.__decorate)([
159
+ helper_1.autobind,
160
+ (0, tslib_1.__metadata)("design:type", Function),
161
+ (0, tslib_1.__metadata)("design:paramtypes", [Number, String]),
162
+ (0, tslib_1.__metadata)("design:returntype", void 0)
163
+ ], SchemaEditorItemObject.prototype, "handlePropTitleChange", null);
164
+ (0, tslib_1.__decorate)([
165
+ helper_1.autobind,
166
+ (0, tslib_1.__metadata)("design:type", Function),
167
+ (0, tslib_1.__metadata)("design:paramtypes", [Number]),
168
+ (0, tslib_1.__metadata)("design:returntype", void 0)
169
+ ], SchemaEditorItemObject.prototype, "handlePropRemove", null);
170
+ (0, tslib_1.__decorate)([
171
+ helper_1.autobind,
172
+ (0, tslib_1.__metadata)("design:type", Function),
173
+ (0, tslib_1.__metadata)("design:paramtypes", [Number, Object]),
174
+ (0, tslib_1.__metadata)("design:returntype", void 0)
175
+ ], SchemaEditorItemObject.prototype, "handlePropChange", null);
176
+ (0, tslib_1.__decorate)([
177
+ helper_1.autobind,
178
+ (0, tslib_1.__metadata)("design:type", Function),
179
+ (0, tslib_1.__metadata)("design:paramtypes", [Number, Boolean]),
180
+ (0, tslib_1.__metadata)("design:returntype", void 0)
181
+ ], SchemaEditorItemObject.prototype, "handlePropRequiredChange", null);
182
+ (0, tslib_1.__decorate)([
183
+ helper_1.autobind,
184
+ (0, tslib_1.__metadata)("design:type", Function),
185
+ (0, tslib_1.__metadata)("design:paramtypes", []),
186
+ (0, tslib_1.__metadata)("design:returntype", void 0)
187
+ ], SchemaEditorItemObject.prototype, "toggleCollapsed", null);
188
+ return SchemaEditorItemObject;
189
+ }(Common_1.SchemaEditorItemCommon));
190
+ exports.SchemaEditorItemObject = SchemaEditorItemObject;
191
+ //# sourceMappingURL=./components/schema-editor/Object.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Object.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "/src/components/schema-editor/Object.tsx"
7
+ ],
8
+ "names": [],
9
+ "mappings": ";;;;AAAA,6DAA0B;AAE1B,6CAAkD;AAClD,kEAA+B;AAC/B,kCAA8B;AAC9B,sEAAmC;AACnC,mCAA6E;AAC7E,+BAAwC;AAaxC;IAA4C,uDAG3C;IAHD;QAAA,qEAsRC;QAlRC,WAAK,GAAG;YACN,OAAO,EAAE,KAAI,CAAC,cAAc,CAAC,KAAI,CAAC,KAAK,CAAC;YACxC,SAAS,EAAE,KAAK;SACjB,CAAC;;IA+QJ,CAAC;IA3QC,mDAAkB,GAAlB,UAAmB,SAAsC;QACvD,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,kBAAkB;QAClB,IACE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK;YAC/B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAC9D;YACA,IAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;aACpC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,+CAAc,GAAd,UAAe,KAAkC;;QAC/C,IAAM,OAAO,GAMR,EAAE,CAAC;QACR,IAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,MAAA,KAAK,CAAC,KAAK,0CAAE,QAA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;;;0EASR;IAGD;QADC,iBAAQ;;;;iEAKR;IAmHH,6BAAC;CAAA,AAtRD,CAA4C,+BAAsB,GAsRjE;AAtRY,wDAAsB",
10
+ "sourcesContent": [
11
+ "import React from 'react';\nimport type {JSONSchema} from '../../utils/DataScope';\nimport {autobind, guid} from '../../utils/helper';\nimport Button from '../Button';\nimport {Icon} from '../icons';\nimport InputBox from '../InputBox';\nimport {SchemaEditorItemCommon, SchemaEditorItemCommonProps} from './Common';\nimport {SchemaEditorItem} from './Item';\n\nexport interface SchemaEditorItemObjectState {\n members: Array<{\n id: string;\n key: string;\n hasError?: boolean;\n required?: boolean;\n schema: JSONSchema;\n }>;\n collapsed: boolean;\n}\n\nexport class SchemaEditorItemObject extends SchemaEditorItemCommon<\n SchemaEditorItemCommonProps,\n SchemaEditorItemObjectState\n> {\n state = {\n members: this.propsToMembers(this.props),\n collapsed: false\n };\n\n lastValue: any;\n\n componentDidUpdate(prevProps: SchemaEditorItemCommonProps) {\n const props = this.props;\n\n // 外部属性变化,更新 state\n if (\n props.value !== prevProps.value &&\n JSON.stringify(props.value) !== JSON.stringify(this.lastValue)\n ) {\n this.setState({\n members: this.propsToMembers(props)\n });\n }\n }\n\n propsToMembers(props: SchemaEditorItemCommonProps) {\n const members: Array<{\n id: string;\n key: string;\n hasError?: boolean;\n required?: boolean;\n schema: JSONSchema;\n }> = [];\n const required = Array.isArray(props.value?.required)\n ? props.value!.required\n : [];\n\n if (props.value?.properties) {\n const properties = props.value.properties;\n Object.keys(properties).forEach(key => {\n const value = properties[key] as any;\n\n members.push({\n id: guid(),\n key: key || '',\n hasError: !key || members.some(i => i.key === key),\n required: !!~required.indexOf(key),\n schema: value\n });\n });\n }\n\n return members;\n }\n\n @autobind\n pipeOut() {\n const members = this.state.members;\n const {value, onChange} = this.props;\n const properties: any = {};\n const required: Array<string> = [];\n\n members\n .filter(item => !item.hasError)\n .forEach(member => {\n properties[member.key] = member.schema;\n\n if (member.required) {\n required.push(member.key);\n }\n });\n\n this.lastValue = {\n ...value,\n properties,\n required\n };\n onChange?.(this.lastValue);\n }\n\n @autobind\n handleAdd() {\n const members = this.state.members.concat();\n members.push({\n id: guid(),\n key: '',\n hasError: true,\n required: false,\n schema: {\n type: 'string'\n }\n });\n\n this.setState(\n {\n members\n },\n this.pipeOut\n );\n }\n\n @autobind\n handlePropKeyChange(index: number, key: string) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n key,\n hasError: !key || members.some((m, i) => i !== index && m.key === key)\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropTitleChange(index: number, title: string) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n schema: {\n ...members[index].schema,\n title\n }\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropRemove(index: number) {\n const members = this.state.members.concat();\n members.splice(index, 1);\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropChange(index: number, item: any) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n schema: {\n ...item\n }\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropRequiredChange(index: number, required: boolean) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n required\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n toggleCollapsed() {\n this.setState({\n collapsed: !this.state.collapsed\n });\n }\n\n rendererProps() {\n const {\n value,\n translate: __,\n classnames: cx,\n renderExtraProps,\n locale,\n classPrefix,\n disabled,\n showInfo,\n types,\n onTypeChange\n } = this.props;\n const members = this.state.members;\n\n return (\n <div\n className={cx('SchemaEditorProps', {\n 'SchemaEditorProps--depth': showInfo !== false\n })}\n >\n {members.length ? (\n members.map((member, index) => (\n <SchemaEditorItem\n key={member.id}\n types={types}\n onTypeChange={onTypeChange}\n prefix={\n <>\n <InputBox\n className={cx('SchemaEditor-key')}\n hasError={member.hasError}\n value={member.key || ''}\n onChange={this.handlePropKeyChange.bind(this, index)}\n placeholder={__('JSONSchema.key')}\n disabled={disabled || !!value?.$ref}\n />\n\n <InputBox\n className={cx('SchemaEditor-title')}\n value={member.schema.title || ''}\n onChange={this.handlePropTitleChange.bind(this, index)}\n placeholder={__('JSONSchema.title')}\n disabled={disabled || !!value?.$ref}\n />\n </>\n }\n affix={\n <Button\n className={cx('SchemaEditor-btn')}\n onClick={this.handlePropRemove.bind(this, index)}\n iconOnly\n disabled={disabled || !!value?.$ref}\n >\n <Icon icon=\"remove\" className=\"icon\" />\n </Button>\n }\n value={member.schema}\n onChange={this.handlePropChange.bind(this, index)}\n renderExtraProps={renderExtraProps}\n locale={locale}\n translate={__}\n classnames={cx}\n classPrefix={classPrefix}\n disabled={disabled || !!value?.$ref}\n required={member.required}\n onRequiredChange={this.handlePropRequiredChange.bind(this, index)}\n />\n ))\n ) : (\n <div className={cx('SchemaEditorProps-placeholder')}>\n {__('placeholder.empty')}\n </div>\n )}\n\n <Button\n level=\"link\"\n onClick={this.handleAdd}\n size=\"xs\"\n disabled={disabled || !!value?.$ref}\n >\n {__('JSONSchema.add_prop')}\n </Button>\n </div>\n );\n }\n\n render() {\n const {classnames: cx, showInfo, translate: __, disabled} = this.props;\n\n return (\n <div\n className={cx('SchemaEditorItem SchemaEditorObject', {\n 'is-collapsed': this.state.collapsed\n })}\n >\n {showInfo !== false ? (\n <>\n <a\n className={cx('SchemaEditor-caret', {\n 'is-collapsed': this.state.collapsed\n })}\n onClick={this.toggleCollapsed}\n >\n <Icon icon=\"caret\" className=\"icon\" />\n </a>\n {this.renderCommon()}\n </>\n ) : null}\n {this.state.collapsed ? null : this.rendererProps()}\n </div>\n );\n }\n}\n"
12
+ ]
13
+ }
@@ -0,0 +1,316 @@
1
+ /// <reference types="hoist-non-react-statics" />
2
+ import React from 'react';
3
+ import { LocaleProps } from '../../locale';
4
+ import { ThemeProps } from '../../theme';
5
+ import { DataSchema } from '../../utils/DataSchema';
6
+ import type { JSONSchema } from '../../utils/DataScope';
7
+ import { VariableItem } from '../formula/Editor';
8
+ export interface SchemaVariableListProps extends LocaleProps, ThemeProps {
9
+ schemas?: Array<JSONSchema> | JSONSchema;
10
+ value?: string;
11
+ onSelect?: (value: string, schema: JSONSchema) => void;
12
+ }
13
+ export interface SchemaVariableListState {
14
+ variables: Array<VariableItem>;
15
+ }
16
+ export declare class SchemaVariableList extends React.Component<SchemaVariableListProps, SchemaVariableListState> {
17
+ state: {
18
+ variables: any[];
19
+ };
20
+ dataSchema?: DataSchema;
21
+ constructor(props: SchemaVariableListProps);
22
+ componentDidUpdate(prevProps: SchemaVariableListProps): void;
23
+ schemasToVaraibles(props: SchemaVariableListProps): any[];
24
+ handleSelect(item: any): void;
25
+ itemRender(option: any): JSX.Element;
26
+ render(): JSX.Element;
27
+ }
28
+ declare const _default: {
29
+ new (props: (Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
30
+ locale?: string | undefined;
31
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
32
+ }) | Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
33
+ locale?: string | undefined;
34
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
35
+ }>): {
36
+ render(): JSX.Element;
37
+ context: any;
38
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
39
+ locale?: string | undefined;
40
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
41
+ }>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
42
+ forceUpdate(callback?: (() => void) | undefined): void;
43
+ readonly props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
44
+ locale?: string | undefined;
45
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
46
+ }> & Readonly<{
47
+ children?: React.ReactNode;
48
+ }>;
49
+ state: Readonly<{}>;
50
+ refs: {
51
+ [key: string]: React.ReactInstance;
52
+ };
53
+ componentDidMount?(): void;
54
+ shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
55
+ locale?: string | undefined;
56
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
57
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
58
+ componentWillUnmount?(): void;
59
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
60
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
61
+ locale?: string | undefined;
62
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
63
+ }>, prevState: Readonly<{}>): any;
64
+ componentDidUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
65
+ locale?: string | undefined;
66
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
67
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
68
+ componentWillMount?(): void;
69
+ UNSAFE_componentWillMount?(): void;
70
+ componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
71
+ locale?: string | undefined;
72
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
73
+ }>, nextContext: any): void;
74
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
75
+ locale?: string | undefined;
76
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
77
+ }>, nextContext: any): void;
78
+ componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
79
+ locale?: string | undefined;
80
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
81
+ }>, nextState: Readonly<{}>, nextContext: any): void;
82
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
83
+ locale?: string | undefined;
84
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
85
+ }>, nextState: Readonly<{}>, nextContext: any): void;
86
+ };
87
+ new (props: Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
88
+ locale?: string | undefined;
89
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
90
+ }, context: any): {
91
+ render(): JSX.Element;
92
+ context: any;
93
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
94
+ locale?: string | undefined;
95
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
96
+ }>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
97
+ forceUpdate(callback?: (() => void) | undefined): void;
98
+ readonly props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
99
+ locale?: string | undefined;
100
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
101
+ }> & Readonly<{
102
+ children?: React.ReactNode;
103
+ }>;
104
+ state: Readonly<{}>;
105
+ refs: {
106
+ [key: string]: React.ReactInstance;
107
+ };
108
+ componentDidMount?(): void;
109
+ shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
110
+ locale?: string | undefined;
111
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
112
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
113
+ componentWillUnmount?(): void;
114
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
115
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
116
+ locale?: string | undefined;
117
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
118
+ }>, prevState: Readonly<{}>): any;
119
+ componentDidUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
120
+ locale?: string | undefined;
121
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
122
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
123
+ componentWillMount?(): void;
124
+ UNSAFE_componentWillMount?(): void;
125
+ componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
126
+ locale?: string | undefined;
127
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
128
+ }>, nextContext: any): void;
129
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
130
+ locale?: string | undefined;
131
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
132
+ }>, nextContext: any): void;
133
+ componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
134
+ locale?: string | undefined;
135
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
136
+ }>, nextState: Readonly<{}>, nextContext: any): void;
137
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
138
+ locale?: string | undefined;
139
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
140
+ }>, nextState: Readonly<{}>, nextContext: any): void;
141
+ };
142
+ displayName: string;
143
+ contextType: React.Context<string>;
144
+ ComposedComponent: React.ComponentType<{
145
+ new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
146
+ render(): JSX.Element;
147
+ context: any;
148
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
149
+ forceUpdate(callback?: (() => void) | undefined): void;
150
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
151
+ children?: React.ReactNode;
152
+ }>;
153
+ state: Readonly<{}>;
154
+ refs: {
155
+ [key: string]: React.ReactInstance;
156
+ };
157
+ componentDidMount?(): void;
158
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
159
+ componentWillUnmount?(): void;
160
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
161
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
162
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
163
+ componentWillMount?(): void;
164
+ UNSAFE_componentWillMount?(): void;
165
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
166
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
167
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
168
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
169
+ };
170
+ new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
171
+ render(): JSX.Element;
172
+ context: any;
173
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
174
+ forceUpdate(callback?: (() => void) | undefined): void;
175
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
176
+ children?: React.ReactNode;
177
+ }>;
178
+ state: Readonly<{}>;
179
+ refs: {
180
+ [key: string]: React.ReactInstance;
181
+ };
182
+ componentDidMount?(): void;
183
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
184
+ componentWillUnmount?(): void;
185
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
186
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
187
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
188
+ componentWillMount?(): void;
189
+ UNSAFE_componentWillMount?(): void;
190
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
191
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
192
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
193
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
194
+ };
195
+ displayName: string;
196
+ contextType: React.Context<string>;
197
+ ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
198
+ } & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
199
+ ComposedComponent: typeof SchemaVariableList;
200
+ }>;
201
+ } & import("hoist-non-react-statics").NonReactStatics<{
202
+ new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
203
+ render(): JSX.Element;
204
+ context: any;
205
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
206
+ forceUpdate(callback?: (() => void) | undefined): void;
207
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
208
+ children?: React.ReactNode;
209
+ }>;
210
+ state: Readonly<{}>;
211
+ refs: {
212
+ [key: string]: React.ReactInstance;
213
+ };
214
+ componentDidMount?(): void;
215
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
216
+ componentWillUnmount?(): void;
217
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
218
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
219
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
220
+ componentWillMount?(): void;
221
+ UNSAFE_componentWillMount?(): void;
222
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
223
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
224
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
225
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
226
+ };
227
+ new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
228
+ render(): JSX.Element;
229
+ context: any;
230
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
231
+ forceUpdate(callback?: (() => void) | undefined): void;
232
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
233
+ children?: React.ReactNode;
234
+ }>;
235
+ state: Readonly<{}>;
236
+ refs: {
237
+ [key: string]: React.ReactInstance;
238
+ };
239
+ componentDidMount?(): void;
240
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
241
+ componentWillUnmount?(): void;
242
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
243
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
244
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
245
+ componentWillMount?(): void;
246
+ UNSAFE_componentWillMount?(): void;
247
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
248
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
249
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
250
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
251
+ };
252
+ displayName: string;
253
+ contextType: React.Context<string>;
254
+ ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
255
+ } & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
256
+ ComposedComponent: typeof SchemaVariableList;
257
+ }, {}> & {
258
+ ComposedComponent: {
259
+ new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
260
+ render(): JSX.Element;
261
+ context: any;
262
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
263
+ forceUpdate(callback?: (() => void) | undefined): void;
264
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
265
+ children?: React.ReactNode;
266
+ }>;
267
+ state: Readonly<{}>;
268
+ refs: {
269
+ [key: string]: React.ReactInstance;
270
+ };
271
+ componentDidMount?(): void;
272
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
273
+ componentWillUnmount?(): void;
274
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
275
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
276
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
277
+ componentWillMount?(): void;
278
+ UNSAFE_componentWillMount?(): void;
279
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
280
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
281
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
282
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
283
+ };
284
+ new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
285
+ render(): JSX.Element;
286
+ context: any;
287
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
288
+ forceUpdate(callback?: (() => void) | undefined): void;
289
+ readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
290
+ children?: React.ReactNode;
291
+ }>;
292
+ state: Readonly<{}>;
293
+ refs: {
294
+ [key: string]: React.ReactInstance;
295
+ };
296
+ componentDidMount?(): void;
297
+ shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
298
+ componentWillUnmount?(): void;
299
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
300
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
301
+ componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
302
+ componentWillMount?(): void;
303
+ UNSAFE_componentWillMount?(): void;
304
+ componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
305
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
306
+ componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
307
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
308
+ };
309
+ displayName: string;
310
+ contextType: React.Context<string>;
311
+ ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
312
+ } & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
313
+ ComposedComponent: typeof SchemaVariableList;
314
+ };
315
+ };
316
+ export default _default;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaVariableList = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ var locale_1 = require("../../locale");
7
+ var theme_1 = require("../../theme");
8
+ var DataSchema_1 = require("../../utils/DataSchema");
9
+ var helper_1 = require("../../utils/helper");
10
+ var VariableList_1 = (0, tslib_1.__importDefault)(require("../formula/VariableList"));
11
+ var TooltipWrapper_1 = (0, tslib_1.__importDefault)(require("../TooltipWrapper"));
12
+ var SchemaVariableList = /** @class */ (function (_super) {
13
+ (0, tslib_1.__extends)(SchemaVariableList, _super);
14
+ function SchemaVariableList(props) {
15
+ var _this = _super.call(this, props) || this;
16
+ _this.state = {
17
+ variables: _this.schemasToVaraibles(_this.props)
18
+ };
19
+ return _this;
20
+ }
21
+ SchemaVariableList.prototype.componentDidUpdate = function (prevProps) {
22
+ var props = this.props;
23
+ if (props.schemas !== prevProps.schemas) {
24
+ this.setState({
25
+ variables: this.schemasToVaraibles(props)
26
+ });
27
+ }
28
+ };
29
+ SchemaVariableList.prototype.schemasToVaraibles = function (props) {
30
+ var schemas = Array.isArray(props.schemas)
31
+ ? props.schemas.concat()
32
+ : props.schemas
33
+ ? [props.schemas]
34
+ : [];
35
+ if (!schemas.length) {
36
+ return [];
37
+ }
38
+ var dataSchema = new DataSchema_1.DataSchema(schemas);
39
+ this.dataSchema = dataSchema;
40
+ return dataSchema.getDataPropsAsOptions();
41
+ };
42
+ SchemaVariableList.prototype.handleSelect = function (item) {
43
+ var _a;
44
+ var onSelect = this.props.onSelect;
45
+ var schema = (_a = this.dataSchema) === null || _a === void 0 ? void 0 : _a.getSchemaByPath(item.value);
46
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(item.value, schema);
47
+ };
48
+ SchemaVariableList.prototype.itemRender = function (option) {
49
+ var _a = this.props, cx = _a.classnames, __ = _a.translate;
50
+ return (react_1.default.createElement("span", { className: cx("FormulaEditor-VariableList-item") },
51
+ react_1.default.createElement("label", null, option.label),
52
+ react_1.default.createElement(TooltipWrapper_1.default, { tooltip: option.description, tooltipTheme: "dark" },
53
+ react_1.default.createElement("span", { className: cx("FormulaEditor-VariableList-item-tag") }, __("SchemaType.".concat(option.type || 'any'))))));
54
+ };
55
+ SchemaVariableList.prototype.render = function () {
56
+ return (react_1.default.createElement(VariableList_1.default, { data: this.state.variables, value: this.props.value, onSelect: this.handleSelect, selectMode: "tree", itemRender: this.itemRender }));
57
+ };
58
+ (0, tslib_1.__decorate)([
59
+ helper_1.autobind,
60
+ (0, tslib_1.__metadata)("design:type", Function),
61
+ (0, tslib_1.__metadata)("design:paramtypes", [Object]),
62
+ (0, tslib_1.__metadata)("design:returntype", void 0)
63
+ ], SchemaVariableList.prototype, "handleSelect", null);
64
+ (0, tslib_1.__decorate)([
65
+ helper_1.autobind,
66
+ (0, tslib_1.__metadata)("design:type", Function),
67
+ (0, tslib_1.__metadata)("design:paramtypes", [Object]),
68
+ (0, tslib_1.__metadata)("design:returntype", void 0)
69
+ ], SchemaVariableList.prototype, "itemRender", null);
70
+ return SchemaVariableList;
71
+ }(react_1.default.Component));
72
+ exports.SchemaVariableList = SchemaVariableList;
73
+ exports.default = (0, locale_1.localeable)((0, theme_1.themeable)(SchemaVariableList));
74
+ //# sourceMappingURL=./components/schema-editor/SchemaVariableList.js.map