@qoretechnologies/reqraft 0.10.55-pr.124.g43fa138 → 0.10.55

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 (375) hide show
  1. package/.claude/CLAUDE.md +25 -0
  2. package/.tasks/INDEX.md +1 -0
  3. package/.tasks/STORY_NETWORK_ISOLATION.md +98 -0
  4. package/README.md +1 -1
  5. package/design/FORM_ENGINE_COMPACT.md +34 -0
  6. package/design/FORM_ENGINE_EXPRESSIONS.md +110 -0
  7. package/design/FORM_ENGINE_FIELD_MIGRATION.md +155 -1
  8. package/design/IDE_INTEGRATION.md +13 -0
  9. package/design/RENDER_EXPRESSION_TRANSPORT.md +76 -10
  10. package/design/SELECT_DIALOG_FLOOR.md +86 -0
  11. package/design/SMART_EDITOR_UX.md +21 -0
  12. package/design/UNAVAILABLE_ALLOWED_VALUES.md +226 -0
  13. package/dist/components/composer/Composer.d.ts +8 -3
  14. package/dist/components/composer/Composer.d.ts.map +1 -1
  15. package/dist/components/composer/Composer.js.map +1 -1
  16. package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
  17. package/dist/components/dpqlEditor/DpqlEditor.js +3 -3
  18. package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
  19. package/dist/components/dpqlEditor/dpqlHelpers.d.ts +6 -0
  20. package/dist/components/dpqlEditor/dpqlHelpers.d.ts.map +1 -1
  21. package/dist/components/dpqlEditor/dpqlHelpers.js +21 -2
  22. package/dist/components/dpqlEditor/dpqlHelpers.js.map +1 -1
  23. package/dist/components/dpqlEditor/dpqlProbe.d.ts +37 -0
  24. package/dist/components/dpqlEditor/dpqlProbe.d.ts.map +1 -0
  25. package/dist/components/dpqlEditor/dpqlProbe.js +203 -0
  26. package/dist/components/dpqlEditor/dpqlProbe.js.map +1 -0
  27. package/dist/components/dpqlEditor/dpqlTags.d.ts +8 -0
  28. package/dist/components/dpqlEditor/dpqlTags.d.ts.map +1 -1
  29. package/dist/components/dpqlEditor/dpqlTags.js +5 -1
  30. package/dist/components/dpqlEditor/dpqlTags.js.map +1 -1
  31. package/dist/components/dpqlEditor/index.d.ts +4 -0
  32. package/dist/components/dpqlEditor/index.d.ts.map +1 -1
  33. package/dist/components/dpqlEditor/index.js +5 -1
  34. package/dist/components/dpqlEditor/index.js.map +1 -1
  35. package/dist/components/dpqlEditor/types.d.ts +42 -2
  36. package/dist/components/dpqlEditor/types.d.ts.map +1 -1
  37. package/dist/components/dpqlEditor/types.js +0 -4
  38. package/dist/components/dpqlEditor/types.js.map +1 -1
  39. package/dist/components/dpqlEditor/useDpqlProbe.d.ts +4 -0
  40. package/dist/components/dpqlEditor/useDpqlProbe.d.ts.map +1 -0
  41. package/dist/components/dpqlEditor/useDpqlProbe.js +29 -0
  42. package/dist/components/dpqlEditor/useDpqlProbe.js.map +1 -0
  43. package/dist/components/dpqlEditor/useDpqlSession.d.ts +5 -2
  44. package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
  45. package/dist/components/dpqlEditor/useDpqlSession.js +8 -2
  46. package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
  47. package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
  48. package/dist/components/form/engine/CompactRow.js +414 -128
  49. package/dist/components/form/engine/CompactRow.js.map +1 -1
  50. package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
  51. package/dist/components/form/engine/CompactToolbar.js +5 -2
  52. package/dist/components/form/engine/CompactToolbar.js.map +1 -1
  53. package/dist/components/form/engine/FormEngine.d.ts +273 -22
  54. package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
  55. package/dist/components/form/engine/FormEngine.js +669 -192
  56. package/dist/components/form/engine/FormEngine.js.map +1 -1
  57. package/dist/components/form/engine/FormFieldsSkeleton.d.ts +48 -0
  58. package/dist/components/form/engine/FormFieldsSkeleton.d.ts.map +1 -0
  59. package/dist/components/form/engine/FormFieldsSkeleton.js +41 -0
  60. package/dist/components/form/engine/FormFieldsSkeleton.js.map +1 -0
  61. package/dist/components/form/engine/OptionFieldMessages.d.ts +108 -2
  62. package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
  63. package/dist/components/form/engine/OptionFieldMessages.js +203 -13
  64. package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
  65. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
  66. package/dist/components/form/engine/_structuredData/SchemaDataView.js +68 -5
  67. package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
  68. package/dist/components/form/engine/compactRowContext.d.ts +15 -1
  69. package/dist/components/form/engine/compactRowContext.d.ts.map +1 -1
  70. package/dist/components/form/engine/compactRowContext.js.map +1 -1
  71. package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
  72. package/dist/components/form/engine/compactRowStyles.js +55 -29
  73. package/dist/components/form/engine/compactRowStyles.js.map +1 -1
  74. package/dist/components/form/engine/compactToolbarContext.d.ts +1 -0
  75. package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
  76. package/dist/components/form/engine/optionActions.d.ts +37 -1
  77. package/dist/components/form/engine/optionActions.d.ts.map +1 -1
  78. package/dist/components/form/engine/optionActions.js +71 -1
  79. package/dist/components/form/engine/optionActions.js.map +1 -1
  80. package/dist/components/form/engine/optionsContext.d.ts +22 -0
  81. package/dist/components/form/engine/optionsContext.d.ts.map +1 -0
  82. package/dist/components/form/engine/optionsContext.js +20 -0
  83. package/dist/components/form/engine/optionsContext.js.map +1 -0
  84. package/dist/components/form/engine/readFirst.d.ts +42 -1
  85. package/dist/components/form/engine/readFirst.d.ts.map +1 -1
  86. package/dist/components/form/engine/readFirst.js +76 -8
  87. package/dist/components/form/engine/readFirst.js.map +1 -1
  88. package/dist/components/form/engine/rendererTypes.d.ts +42 -3
  89. package/dist/components/form/engine/rendererTypes.d.ts.map +1 -1
  90. package/dist/components/form/engine/rendererTypes.js +3 -1
  91. package/dist/components/form/engine/rendererTypes.js.map +1 -1
  92. package/dist/components/form/engine/rowFocus.d.ts +30 -0
  93. package/dist/components/form/engine/rowFocus.d.ts.map +1 -0
  94. package/dist/components/form/engine/rowFocus.js +93 -0
  95. package/dist/components/form/engine/rowFocus.js.map +1 -0
  96. package/dist/components/form/engine/rowMenuContext.d.ts +78 -0
  97. package/dist/components/form/engine/rowMenuContext.d.ts.map +1 -0
  98. package/dist/components/form/engine/rowMenuContext.js +103 -0
  99. package/dist/components/form/engine/rowMenuContext.js.map +1 -0
  100. package/dist/components/form/engine/rowOpenPicker.d.ts +27 -0
  101. package/dist/components/form/engine/rowOpenPicker.d.ts.map +1 -0
  102. package/dist/components/form/engine/rowOpenPicker.js +30 -0
  103. package/dist/components/form/engine/rowOpenPicker.js.map +1 -0
  104. package/dist/components/form/engine/typeChoices.d.ts +42 -0
  105. package/dist/components/form/engine/typeChoices.d.ts.map +1 -0
  106. package/dist/components/form/engine/typeChoices.js +33 -0
  107. package/dist/components/form/engine/typeChoices.js.map +1 -0
  108. package/dist/components/form/expressions/DpqlRendering.d.ts +26 -0
  109. package/dist/components/form/expressions/DpqlRendering.d.ts.map +1 -0
  110. package/dist/components/form/expressions/DpqlRendering.js +53 -0
  111. package/dist/components/form/expressions/DpqlRendering.js.map +1 -0
  112. package/dist/components/form/expressions/ExpressionField.d.ts +7 -1
  113. package/dist/components/form/expressions/ExpressionField.d.ts.map +1 -1
  114. package/dist/components/form/expressions/ExpressionField.js +203 -45
  115. package/dist/components/form/expressions/ExpressionField.js.map +1 -1
  116. package/dist/components/form/expressions/argumentPresence.d.ts +84 -0
  117. package/dist/components/form/expressions/argumentPresence.d.ts.map +1 -0
  118. package/dist/components/form/expressions/argumentPresence.js +217 -0
  119. package/dist/components/form/expressions/argumentPresence.js.map +1 -0
  120. package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
  121. package/dist/components/form/expressions/builder/argumentLabel.js +9 -4
  122. package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
  123. package/dist/components/form/expressions/builder/index.d.ts +15 -2
  124. package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
  125. package/dist/components/form/expressions/builder/index.js +21 -65
  126. package/dist/components/form/expressions/builder/index.js.map +1 -1
  127. package/dist/components/form/expressions/builder/renderTemplate.d.ts +4 -1
  128. package/dist/components/form/expressions/builder/renderTemplate.d.ts.map +1 -1
  129. package/dist/components/form/expressions/builder/renderTemplate.js +10 -67
  130. package/dist/components/form/expressions/builder/renderTemplate.js.map +1 -1
  131. package/dist/components/form/expressions/mockExpressions.d.ts.map +1 -1
  132. package/dist/components/form/expressions/mockExpressions.js +8 -4
  133. package/dist/components/form/expressions/mockExpressions.js.map +1 -1
  134. package/dist/components/form/expressions/renderExpressionToText.d.ts +1 -1
  135. package/dist/components/form/expressions/renderExpressionToText.d.ts.map +1 -1
  136. package/dist/components/form/expressions/renderExpressionToText.js +95 -19
  137. package/dist/components/form/expressions/renderExpressionToText.js.map +1 -1
  138. package/dist/components/form/expressions/types.d.ts +17 -2
  139. package/dist/components/form/expressions/types.d.ts.map +1 -1
  140. package/dist/components/form/expressions/useExpressions.d.ts.map +1 -1
  141. package/dist/components/form/expressions/useExpressions.js +5 -2
  142. package/dist/components/form/expressions/useExpressions.js.map +1 -1
  143. package/dist/components/form/expressions/useRenderExpression.d.ts +7 -16
  144. package/dist/components/form/expressions/useRenderExpression.d.ts.map +1 -1
  145. package/dist/components/form/expressions/useRenderExpression.js +50 -126
  146. package/dist/components/form/expressions/useRenderExpression.js.map +1 -1
  147. package/dist/components/form/fields/Field.d.ts +21 -0
  148. package/dist/components/form/fields/Field.d.ts.map +1 -1
  149. package/dist/components/form/fields/Field.js +54 -8
  150. package/dist/components/form/fields/Field.js.map +1 -1
  151. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +11 -1
  152. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
  153. package/dist/components/form/fields/allowed-values/AllowedValues.js +52 -8
  154. package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
  155. package/dist/components/form/fields/auto/AutoFormField.d.ts +7 -1
  156. package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
  157. package/dist/components/form/fields/auto/AutoFormField.js +91 -28
  158. package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
  159. package/dist/components/form/fields/date/Date.d.ts +1 -1
  160. package/dist/components/form/fields/date/Date.d.ts.map +1 -1
  161. package/dist/components/form/fields/date/Date.js +16 -2
  162. package/dist/components/form/fields/date/Date.js.map +1 -1
  163. package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
  164. package/dist/components/form/fields/long-string/LongString.js +14 -2
  165. package/dist/components/form/fields/long-string/LongString.js.map +1 -1
  166. package/dist/components/form/fields/multi-select/MultiSelectFormField.d.ts.map +1 -1
  167. package/dist/components/form/fields/multi-select/MultiSelectFormField.js +50 -4
  168. package/dist/components/form/fields/multi-select/MultiSelectFormField.js.map +1 -1
  169. package/dist/components/form/fields/number/Number.d.ts +12 -1
  170. package/dist/components/form/fields/number/Number.d.ts.map +1 -1
  171. package/dist/components/form/fields/number/Number.js +6 -3
  172. package/dist/components/form/fields/number/Number.js.map +1 -1
  173. package/dist/components/form/fields/rich-text/RichText.d.ts +47 -2
  174. package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
  175. package/dist/components/form/fields/rich-text/RichText.js +153 -12
  176. package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
  177. package/dist/components/form/fields/select/Select.d.ts.map +1 -1
  178. package/dist/components/form/fields/select/Select.js +120 -20
  179. package/dist/components/form/fields/select/Select.js.map +1 -1
  180. package/dist/components/form/fields/select/SelectCollection.d.ts +166 -9
  181. package/dist/components/form/fields/select/SelectCollection.d.ts.map +1 -1
  182. package/dist/components/form/fields/select/SelectCollection.js +200 -7
  183. package/dist/components/form/fields/select/SelectCollection.js.map +1 -1
  184. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts +2 -1
  185. package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
  186. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -2
  187. package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
  188. package/dist/components/form/fields/template/TemplateField.d.ts +34 -2
  189. package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
  190. package/dist/components/form/fields/template/TemplateField.js +606 -58
  191. package/dist/components/form/fields/template/TemplateField.js.map +1 -1
  192. package/dist/components/form/fields/template/TemplateText.d.ts +36 -0
  193. package/dist/components/form/fields/template/TemplateText.d.ts.map +1 -0
  194. package/dist/components/form/fields/template/TemplateText.js +80 -0
  195. package/dist/components/form/fields/template/TemplateText.js.map +1 -0
  196. package/dist/components/form/index.d.ts +2 -0
  197. package/dist/components/form/index.d.ts.map +1 -1
  198. package/dist/components/form/index.js +4 -0
  199. package/dist/components/form/index.js.map +1 -1
  200. package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
  201. package/dist/components/smartEditor/SmartEditor.js +29 -8
  202. package/dist/components/smartEditor/SmartEditor.js.map +1 -1
  203. package/dist/components/smartEditor/useLspSession.d.ts +5 -1
  204. package/dist/components/smartEditor/useLspSession.d.ts.map +1 -1
  205. package/dist/components/smartEditor/useLspSession.js +16 -2
  206. package/dist/components/smartEditor/useLspSession.js.map +1 -1
  207. package/dist/components/supportTicket/TicketReplyBox.d.ts +8 -4
  208. package/dist/components/supportTicket/TicketReplyBox.d.ts.map +1 -1
  209. package/dist/components/supportTicket/TicketReplyBox.js.map +1 -1
  210. package/dist/helpers/common.d.ts.map +1 -1
  211. package/dist/helpers/common.js +7 -3
  212. package/dist/helpers/common.js.map +1 -1
  213. package/dist/helpers/dpqlDetection.d.ts +58 -0
  214. package/dist/helpers/dpqlDetection.d.ts.map +1 -0
  215. package/dist/helpers/dpqlDetection.js +164 -0
  216. package/dist/helpers/dpqlDetection.js.map +1 -0
  217. package/dist/helpers/optionUiTypes.d.ts +31 -3
  218. package/dist/helpers/optionUiTypes.d.ts.map +1 -1
  219. package/dist/helpers/optionUiTypes.js +36 -1
  220. package/dist/helpers/optionUiTypes.js.map +1 -1
  221. package/dist/helpers/options.d.ts +57 -0
  222. package/dist/helpers/options.d.ts.map +1 -1
  223. package/dist/helpers/options.js +97 -1
  224. package/dist/helpers/options.js.map +1 -1
  225. package/dist/helpers/templateItems.d.ts +47 -0
  226. package/dist/helpers/templateItems.d.ts.map +1 -0
  227. package/dist/helpers/templateItems.js +88 -0
  228. package/dist/helpers/templateItems.js.map +1 -0
  229. package/dist/helpers/templateText.d.ts +80 -0
  230. package/dist/helpers/templateText.d.ts.map +1 -0
  231. package/dist/helpers/templateText.js +291 -0
  232. package/dist/helpers/templateText.js.map +1 -0
  233. package/dist/helpers/templates.d.ts +30 -12
  234. package/dist/helpers/templates.d.ts.map +1 -1
  235. package/dist/helpers/templates.js +91 -33
  236. package/dist/helpers/templates.js.map +1 -1
  237. package/dist/helpers/validations.d.ts +35 -8
  238. package/dist/helpers/validations.d.ts.map +1 -1
  239. package/dist/helpers/validations.js +162 -25
  240. package/dist/helpers/validations.js.map +1 -1
  241. package/dist/hooks/useArgSchema.d.ts +2 -1
  242. package/dist/hooks/useArgSchema.d.ts.map +1 -1
  243. package/dist/hooks/useFetch/useFetch.d.ts +3 -1
  244. package/dist/hooks/useFetch/useFetch.d.ts.map +1 -1
  245. package/dist/hooks/useFetch/useFetch.js +47 -9
  246. package/dist/hooks/useFetch/useFetch.js.map +1 -1
  247. package/dist/hooks/useTemplates.d.ts +20 -0
  248. package/dist/hooks/useTemplates.d.ts.map +1 -1
  249. package/dist/hooks/useTemplates.js +34 -2
  250. package/dist/hooks/useTemplates.js.map +1 -1
  251. package/dist/index.d.ts +2 -1
  252. package/dist/index.d.ts.map +1 -1
  253. package/dist/index.js +5 -1
  254. package/dist/index.js.map +1 -1
  255. package/dist/utils/fetch.d.ts +151 -1
  256. package/dist/utils/fetch.d.ts.map +1 -1
  257. package/dist/utils/fetch.js +256 -44
  258. package/dist/utils/fetch.js.map +1 -1
  259. package/dist/utils/lspClient.d.ts +6 -0
  260. package/dist/utils/lspClient.d.ts.map +1 -1
  261. package/dist/utils/lspClient.js +62 -11
  262. package/dist/utils/lspClient.js.map +1 -1
  263. package/dist/utils/websocket.d.ts +6 -0
  264. package/dist/utils/websocket.d.ts.map +1 -1
  265. package/dist/utils/websocket.js +15 -7
  266. package/dist/utils/websocket.js.map +1 -1
  267. package/package.json +10 -6
  268. package/src/components/composer/Composer.tsx +7 -2
  269. package/src/components/dpqlEditor/DpqlEditor.stories.tsx +3 -119
  270. package/src/components/dpqlEditor/DpqlEditor.tsx +5 -2
  271. package/src/components/dpqlEditor/dpqlHelpers.ts +20 -1
  272. package/src/components/dpqlEditor/dpqlProbe.ts +165 -0
  273. package/src/components/dpqlEditor/dpqlTags.ts +13 -0
  274. package/src/components/dpqlEditor/index.ts +4 -0
  275. package/src/components/dpqlEditor/types.ts +38 -2
  276. package/src/components/dpqlEditor/useDpqlProbe.ts +33 -0
  277. package/src/components/dpqlEditor/useDpqlSession.ts +20 -4
  278. package/src/components/form/engine/CompactRow.tsx +487 -160
  279. package/src/components/form/engine/CompactToolbar.tsx +10 -3
  280. package/src/components/form/engine/FormEngine.stories.tsx +1269 -201
  281. package/src/components/form/engine/FormEngine.tsx +922 -270
  282. package/src/components/form/engine/FormEngineStickyHeaders.stories.tsx +331 -0
  283. package/src/components/form/engine/FormFieldsSkeleton.tsx +77 -0
  284. package/src/components/form/engine/OptionFieldMessages.tsx +300 -14
  285. package/src/components/form/engine/_structuredData/SchemaDataView.tsx +94 -3
  286. package/src/components/form/engine/compactRowContext.ts +15 -6
  287. package/src/components/form/engine/compactRowStyles.ts +56 -2
  288. package/src/components/form/engine/compactToolbarContext.ts +1 -1
  289. package/src/components/form/engine/optionActions.ts +89 -1
  290. package/src/components/form/engine/optionsContext.ts +24 -0
  291. package/src/components/form/engine/readFirst.ts +88 -8
  292. package/src/components/form/engine/rendererTypes.ts +48 -4
  293. package/src/components/form/engine/rowFocus.ts +101 -0
  294. package/src/components/form/engine/rowMenuContext.ts +159 -0
  295. package/src/components/form/engine/rowOpenPicker.ts +27 -0
  296. package/src/components/form/engine/typeChoices.ts +63 -0
  297. package/src/components/form/expressions/DpqlRendering.tsx +85 -0
  298. package/src/components/form/expressions/ExpressionField.stories.tsx +826 -48
  299. package/src/components/form/expressions/ExpressionField.tsx +269 -55
  300. package/src/components/form/expressions/argumentPresence.ts +213 -0
  301. package/src/components/form/expressions/builder/ExpressionBuilder.stories.tsx +38 -21
  302. package/src/components/form/expressions/builder/argumentLabel.tsx +10 -4
  303. package/src/components/form/expressions/builder/index.tsx +39 -81
  304. package/src/components/form/expressions/builder/renderTemplate.tsx +23 -56
  305. package/src/components/form/expressions/dpqlMockLanguage.ts +565 -0
  306. package/src/components/form/expressions/dpqlMockLsp.ts +109 -83
  307. package/src/components/form/expressions/mockExpressions.ts +8 -4
  308. package/src/components/form/expressions/renderExpressionToText.ts +112 -22
  309. package/src/components/form/expressions/types.ts +17 -2
  310. package/src/components/form/expressions/useExpressions.ts +5 -1
  311. package/src/components/form/expressions/useRenderExpression.ts +43 -127
  312. package/src/components/form/fields/Field.tsx +102 -20
  313. package/src/components/form/fields/allowed-values/AllowedValues.tsx +106 -44
  314. package/src/components/form/fields/auto/AutoFormField.stories.tsx +85 -18
  315. package/src/components/form/fields/auto/AutoFormField.tsx +97 -21
  316. package/src/components/form/fields/date/Date.tsx +17 -1
  317. package/src/components/form/fields/long-string/LongString.tsx +15 -3
  318. package/src/components/form/fields/multi-select/MultiSelectFormField.tsx +65 -6
  319. package/src/components/form/fields/number/Number.tsx +25 -0
  320. package/src/components/form/fields/rich-text/RichText.tsx +248 -30
  321. package/src/components/form/fields/select/Select.stories.tsx +392 -0
  322. package/src/components/form/fields/select/Select.tsx +164 -27
  323. package/src/components/form/fields/select/SelectCollection.tsx +350 -6
  324. package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +4 -2
  325. package/src/components/form/fields/template/TemplateField.stories.tsx +93 -14
  326. package/src/components/form/fields/template/TemplateField.tsx +825 -131
  327. package/src/components/form/fields/template/TemplateText.tsx +115 -0
  328. package/src/components/form/index.tsx +4 -0
  329. package/src/components/log/Log.stories.tsx +2 -1
  330. package/src/components/searchFilterBar/SearchFilterBar.stories.tsx +3 -3
  331. package/src/components/smartEditor/SmartEditor.tsx +41 -9
  332. package/src/components/smartEditor/__fixtures__/mockLspServer.ts +52 -3
  333. package/src/components/smartEditor/useLspSession.ts +21 -3
  334. package/src/components/supportTicket/TicketReplyBox.tsx +8 -4
  335. package/src/components/ticketThread/TicketThread.stories.tsx +1 -0
  336. package/src/helpers/common.ts +7 -3
  337. package/src/helpers/dpqlDetection.ts +209 -0
  338. package/src/helpers/optionUiTypes.ts +38 -0
  339. package/src/helpers/options.ts +96 -0
  340. package/src/helpers/templateItems.ts +81 -0
  341. package/src/helpers/templateText.ts +350 -0
  342. package/src/helpers/templates.ts +94 -41
  343. package/src/helpers/validations.ts +203 -51
  344. package/src/hooks/useFetch/useFetch.stories.tsx +6 -5
  345. package/src/hooks/useFetch/useFetch.tsx +53 -7
  346. package/src/hooks/useStorage/useStorage.stories.tsx +2 -1
  347. package/src/hooks/useTemplates.ts +41 -0
  348. package/src/hooks/useWebSocket/useWebsocket.stories.tsx +2 -1
  349. package/src/index.tsx +14 -1
  350. package/src/stores/currentUser/currentUser.stories.tsx +2 -1
  351. package/src/stories/storyNetwork.ts +92 -0
  352. package/src/utils/fetch.ts +311 -21
  353. package/src/utils/lspClient.ts +68 -11
  354. package/src/utils/websocket.ts +20 -9
  355. package/dist/components/form/engine/__fixtures__/basicFormOptions.d.ts +0 -73
  356. package/dist/components/form/engine/__fixtures__/basicFormOptions.d.ts.map +0 -1
  357. package/dist/components/form/engine/__fixtures__/basicFormOptions.js +0 -317
  358. package/dist/components/form/engine/__fixtures__/basicFormOptions.js.map +0 -1
  359. package/dist/components/form/engine/__fixtures__/fieldChromeOptions.d.ts +0 -41
  360. package/dist/components/form/engine/__fixtures__/fieldChromeOptions.d.ts.map +0 -1
  361. package/dist/components/form/engine/__fixtures__/fieldChromeOptions.js +0 -45
  362. package/dist/components/form/engine/__fixtures__/fieldChromeOptions.js.map +0 -1
  363. package/dist/components/form/expressions/dpqlMockLsp.d.ts +0 -3
  364. package/dist/components/form/expressions/dpqlMockLsp.d.ts.map +0 -1
  365. package/dist/components/form/expressions/dpqlMockLsp.js +0 -91
  366. package/dist/components/form/expressions/dpqlMockLsp.js.map +0 -1
  367. package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts +0 -2
  368. package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts.map +0 -1
  369. package/dist/components/form/fields/template/__fixtures__/longExampleValue.js +0 -9
  370. package/dist/components/form/fields/template/__fixtures__/longExampleValue.js.map +0 -1
  371. package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts +0 -55
  372. package/dist/components/smartEditor/__fixtures__/mockLspServer.d.ts.map +0 -1
  373. package/dist/components/smartEditor/__fixtures__/mockLspServer.js +0 -126
  374. package/dist/components/smartEditor/__fixtures__/mockLspServer.js.map +0 -1
  375. package/dist/stories/Data/fileFieldArgSchema.json +0 -86
@@ -9,6 +9,7 @@ import { expect, fireEvent, fn, userEvent, waitFor, within } from 'storybook/tes
9
9
  import { useState } from 'react';
10
10
  import { sleep } from '../../../../../__tests__/utils';
11
11
  import { StoryMeta } from '../../../../types';
12
+ import { templateChipLabel } from '../../../../helpers/templateText';
12
13
  import { mockExpressions } from '../mockExpressions';
13
14
  import { IExpression } from '../types';
14
15
  import { ExpressionBuilder } from './index';
@@ -643,14 +644,38 @@ export const VariableArgumentsCanBeAdded: Story = {
643
644
  const CONCAT_OPERANDS = ['first', 'second', 'third'];
644
645
  const OPERAND_LITERALS = [...CONCAT_OPERANDS, 'plain', '$local:some-richtext'];
645
646
 
647
+ /**
648
+ * What an operand field holds. A text operand is edited in the chip editor
649
+ * (these stories offer templates), so it is read from the editable field; a
650
+ * template chip in it shows the name these stories' templates give the
651
+ * reference ("Richtext Template"), read back as the reference it names.
652
+ */
653
+ const readOperand = (field: HTMLElement): string => {
654
+ if (field instanceof HTMLInputElement || field instanceof HTMLTextAreaElement) {
655
+ return field.value;
656
+ }
657
+ const shown = (field.textContent ?? '').replace(/\uFEFF/g, '').trim();
658
+ return (
659
+ OPERAND_LITERALS.find(
660
+ (literal) => literal === shown || templateChipLabel(localTemplates as never, literal) === shown
661
+ ) ?? shown
662
+ );
663
+ };
664
+
665
+ /** Every operand editor's text, in DOM order (no number or position inputs). */
666
+ const operandTexts = () =>
667
+ Array.from(
668
+ document.querySelectorAll<HTMLElement>('.expression textarea, .expression [contenteditable="true"]')
669
+ ).map(readOperand);
670
+
646
671
  /** Seeded operand values in DOM order — only the seeded ones, so stray fields don't count. */
647
672
  const operandValues = () =>
648
673
  Array.from(
649
- document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>(
650
- '.expression textarea, .expression input'
674
+ document.querySelectorAll<HTMLElement>(
675
+ '.expression textarea, .expression input, .expression [contenteditable="true"]'
651
676
  )
652
677
  )
653
- .map((field) => field.value)
678
+ .map(readOperand)
654
679
  .filter((value) => OPERAND_LITERALS.includes(value));
655
680
 
656
681
  const count = (selector: string) => document.querySelectorAll(selector).length;
@@ -698,7 +723,7 @@ export const ConcatExpression: Story = {
698
723
  docs: {
699
724
  description: {
700
725
  story:
701
- 'Renders a "concat" varargs expression with three string operands ("first", "second", "third"). By default each operand gets a drag grip and a "Move Argument" section in its ⋮ menu — opened and expanded here on the second operand to show "Move before / after / to start / to end" and, at three operands, a "Move to position" caption with a single "2nd" position dropdown beside it, opened to show 1st / 2nd / 3rd.',
726
+ 'Renders a "concat" varargs expression with three string operands ("first", "second", "third"), each edited in the chip editor a string field with templates now uses — a contenteditable box rather than a textarea, so a template reference in an operand reads as its name. By default each operand gets a drag grip and a "Move Argument" section in its ⋮ menu — opened and expanded here on the second operand to show "Move before / after / to start / to end" and, at three operands, a "Move to position" caption with a single "2nd" position dropdown beside it, opened to show 1st / 2nd / 3rd.',
702
727
  },
703
728
  },
704
729
  },
@@ -743,7 +768,7 @@ export const ReorderLongConcat: Story = {
743
768
  docs: {
744
769
  description: {
745
770
  story:
746
- 'Renders a seven-operand "concat": typing 6 and Enter into the second operand\'s "Move to position" field moves it to sixth, "More → 7th" moves it last, and the menu is then reopened on that operand with "Move Argument" expanded and "More" open — the strip shows the segments 1–4, the number field for 5–7 with its arrow, and the list 5th / 6th / 7th with 7th (the current position) disabled.',
771
+ 'Renders a seven-operand "concat": typing 6 and Enter into the second operand\'s "Move to position" field moves it to sixth, "More → 7th" moves it last, and the menu is then reopened on that operand with "Move Argument" expanded and "More" open — the strip shows the segments 1–4, the number field for 5–7 with its arrow, and the list 5th / 6th / 7th with 7th (the current position) disabled. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
747
772
  },
748
773
  },
749
774
  },
@@ -765,11 +790,7 @@ export const ReorderLongConcat: Story = {
765
790
  await fireEvent.keyDown(field, { key: 'Enter' });
766
791
  await waitFor(
767
792
  () =>
768
- expect(
769
- Array.from(
770
- document.querySelectorAll<HTMLTextAreaElement>('.expression textarea')
771
- ).map((t) => t.value)
772
- ).toEqual(['first', 'third', 'fourth', 'fifth', 'sixth', 'second', 'seventh']),
793
+ expect(operandTexts()).toEqual(['first', 'third', 'fourth', 'fifth', 'sixth', 'second', 'seventh']),
773
794
  { timeout: 10000 }
774
795
  );
775
796
 
@@ -780,11 +801,7 @@ export const ReorderLongConcat: Story = {
780
801
  await clickSelector('.expression-arg-move-to-7');
781
802
  await waitFor(
782
803
  () =>
783
- expect(
784
- Array.from(
785
- document.querySelectorAll<HTMLTextAreaElement>('.expression textarea')
786
- ).map((t) => t.value)
787
- ).toEqual(['first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'second']),
804
+ expect(operandTexts()).toEqual(['first', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'second']),
788
805
  { timeout: 10000 }
789
806
  );
790
807
  expect(context.args.onChange).toHaveBeenLastCalledWith(
@@ -815,7 +832,7 @@ export const ReorderViaOverflowMenu: Story = {
815
832
  docs: {
816
833
  description: {
817
834
  story:
818
- 'Renders the "concat" expression with only the ⋮ menu surface (no grip) and reorders it through the "Move Argument" section: "Move to start" on the third operand, "Move after" on the operand that is now second, then "3rd" from the "Move to position" dropdown on the first — the order goes first/second/third → third/first/second → third/second/first → second/first/third, each move closes its menu, and onChange reports the reordered args.',
835
+ 'Renders the "concat" expression with only the ⋮ menu surface (no grip) and reorders it through the "Move Argument" section: "Move to start" on the third operand, "Move after" on the operand that is now second, then "3rd" from the "Move to position" dropdown on the first — the order goes first/second/third → third/first/second → third/second/first → second/first/third, each move closes its menu, and onChange reports the reordered args. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
819
836
  },
820
837
  },
821
838
  },
@@ -854,7 +871,7 @@ export const ReorderViaDragHandle: Story = {
854
871
  docs: {
855
872
  description: {
856
873
  story:
857
- 'Renders the "concat" expression with a drag grip before each operand and no "Move Argument" section in the ⋮ menu. Dragging the third operand onto the first puts it first — the order becomes third/first/second.',
874
+ 'Renders the "concat" expression with a drag grip before each operand and no "Move Argument" section in the ⋮ menu. Dragging the third operand onto the first puts it first — the order becomes third/first/second. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
858
875
  },
859
876
  },
860
877
  },
@@ -1145,7 +1162,7 @@ export const ReorderViaPositionPicker: Story = {
1145
1162
  docs: {
1146
1163
  description: {
1147
1164
  story:
1148
- 'Renders the "concat" expression with each operand\'s position ("1st", "2nd", "3rd") as a dropdown before its field. Picking "1st" on the third operand moves it to the front — the order becomes third/first/second.',
1165
+ 'Renders the "concat" expression with each operand\'s position ("1st", "2nd", "3rd") as a dropdown before its field. Picking "1st" on the third operand moves it to the front — the order becomes third/first/second. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
1149
1166
  },
1150
1167
  },
1151
1168
  },
@@ -1175,7 +1192,7 @@ export const ReorderAllSurfaces: Story = {
1175
1192
  docs: {
1176
1193
  description: {
1177
1194
  story:
1178
- 'Renders the "concat" expression with every reorder surface at once — a drag grip and a position dropdown before each operand, plus the "Move Argument" section in the ⋮ menu, opened and expanded on the second operand.',
1195
+ 'Renders the "concat" expression with every reorder surface at once — a drag grip and a position dropdown before each operand, plus the "Move Argument" section in the ⋮ menu, opened and expanded on the second operand. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
1179
1196
  },
1180
1197
  },
1181
1198
  },
@@ -1197,7 +1214,7 @@ export const ReorderDisabled: Story = {
1197
1214
  docs: {
1198
1215
  description: {
1199
1216
  story:
1200
- 'Renders the "concat" expression with reordering turned off — no grip, no position dropdown, and the ⋮ menu (opened on the second operand) has no "Move Argument" section; only the remove buttons remain.',
1217
+ 'Renders the "concat" expression with reordering turned off — no grip, no position dropdown, and the ⋮ menu (opened on the second operand) has no "Move Argument" section; only the remove buttons remain. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
1201
1218
  },
1202
1219
  },
1203
1220
  },
@@ -1222,7 +1239,7 @@ export const ReorderOnPhone: Story = {
1222
1239
  docs: {
1223
1240
  description: {
1224
1241
  story:
1225
- 'Renders the phone presentation of the "concat" expression with every reorder surface — the operands stack into a column, each keeps its grip and position dropdown, and the ⋮ menu (opened and expanded on the second operand) still carries the "Move Argument" section, so reordering needs no hover or drag.',
1242
+ 'Renders the phone presentation of the "concat" expression with every reorder surface — the operands stack into a column, each keeps its grip and position dropdown, and the ⋮ menu (opened and expanded on the second operand) still carries the "Move Argument" section, so reordering needs no hover or drag. Each string operand is edited in the chip editor a field with templates now uses — a contenteditable box rather than a textarea, which is why the operand boxes are narrower than they were.',
1226
1243
  },
1227
1244
  },
1228
1245
  },
@@ -49,9 +49,15 @@ export const ExpressionBuilderArgumentLabel = ({
49
49
  ...types.getExactMatches(schema.ui_type),
50
50
  ...types.getAcceptedTypes(schema.ui_type),
51
51
  ]);
52
- const { isValid, reason } = arg.is_expression
53
- ? validateFieldWithResult('expression', arg, { expressions })
54
- : validateFieldWithResult(argumentType, arg.value, schema, !schema.required);
52
+ /* `arg` is optional — an operand the author has not filled in yet has no
53
+ entry at all, and a literal carried straight from a parse can be the null
54
+ literal itself. Both were dereferenced unguarded here, which took the whole
55
+ expression editor down to its error boundary rather than drawing an empty
56
+ argument. */
57
+ const { isValid, reason } =
58
+ arg?.is_expression ?
59
+ validateFieldWithResult('expression', arg, { expressions })
60
+ : validateFieldWithResult(argumentType, arg?.value, schema, !schema.required);
55
61
 
56
62
  return (
57
63
  <ReqoreP
@@ -94,7 +100,7 @@ export const ExpressionBuilderArgumentLabel = ({
94
100
  {!matchesType ? (
95
101
  <ReqoreIcon icon='ErrorWarningLine' color='warning' size='10px' margin='both' />
96
102
  ) : null}
97
- {(argumentType || (arg.is_expression && arg.value?.exp)) &&
103
+ {(argumentType || (arg?.is_expression && arg.value?.exp)) &&
98
104
  types.getTypeDisplayName(argumentType) !== types.getTypeDisplayName(schema.ui_type) &&
99
105
  !matchesTypeExactly ? (
100
106
  <>
@@ -25,6 +25,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
25
25
  import styled from 'styled-components';
26
26
  import { moveItem } from '../../../../helpers/common';
27
27
  import { areQorusTypesCompatible, getArgumentType } from '../../../../helpers/expressions';
28
+ import { addMissingExpressionArgs } from '../argumentPresence';
28
29
  import { findTemplate } from '../../../../helpers/templates';
29
30
  import { validateField, validateFieldWithResult } from '../../../../helpers/validations';
30
31
  import { IQorusTypeObject, useQorusTypes } from '../../../../hooks/useQorusTypes';
@@ -79,6 +80,18 @@ export interface IExpressionBuilderProps {
79
80
  expressions?: IExpressionSchema[];
80
81
  expressionsUrl?: string;
81
82
  serverHandled?: boolean;
83
+ /**
84
+ * SEAM (reqraft): the host's per-`ui_type` editors, forwarded to the operand
85
+ * fields below.
86
+ *
87
+ * Without them an operand whose type is one of the CONSUMER's own ui_types
88
+ * falls through `AutoFormField`'s switch to the literal "Unknown type!" tag.
89
+ * That is what an assertion's `Value` did the moment it was turned into an
90
+ * expression: the field is `test-reference`, an IDE ui_type whose editor the
91
+ * IDE registers through `componentOverrides`, and the builder rendered its
92
+ * operands without them.
93
+ */
94
+ componentOverrides?: Record<string, React.FC<any>>;
82
95
  size?: string;
83
96
  /**
84
97
  * SEAM (reqraft): extra hover actions prepended to each expression card —
@@ -132,6 +145,7 @@ export const Expression = ({
132
145
  expressionsUrl,
133
146
  serverHandled,
134
147
  extraActions,
148
+ componentOverrides,
135
149
  ...props
136
150
  }: IExpressionProps) => {
137
151
  const types = useQorusTypes();
@@ -267,62 +281,8 @@ export const Expression = ({
267
281
  );
268
282
 
269
283
  const addMissingArgs = useCallback(
270
- (expression: string, args: IExpression[] = []): IExpression[] => {
271
- const newArgs = [...args];
272
- // Check if this expression has variable arguments
273
- const selectedExpression = expressions.value?.find((exp) => exp.name === expression);
274
-
275
- // An operand slot with nothing in it yet: the schema's default value
276
- // when it has one, otherwise an envelope typed after the schema for
277
- // the editors that need a type to mount. `updateExp` leaves such a
278
- // slot behind for every catalogue argument the previous value had no
279
- // operand for (a fresh builder has none), so every branch below has
280
- // to fill them — an `undefined` operand that reaches the validator or
281
- // an operand editor is read for its `type` and crashes the builder.
282
- const isEmptySlot = (slot: IExpression | undefined, arg: IExpressionSchemaArg) =>
283
- slot === undefined || size(slot) === 0 || (arg.default_value && !('value' in slot));
284
- const emptySlot = (arg: IExpressionSchemaArg): IExpression =>
285
- arg.default_value
286
- ? { value: arg.default_value, type: arg.ui_type }
287
- : {
288
- type:
289
- arg.ui_type === 'richtext' || arg.ui_type === 'number' || arg.ui_type === 'bool'
290
- ? arg.ui_type
291
- : undefined,
292
- };
293
-
294
- if (selectedExpression.varargs) {
295
- if (selectedExpression.subtype === 2) {
296
- newArgs.push({
297
- is_expression: true,
298
- value: {
299
- args: [],
300
- },
301
- });
302
- } else {
303
- // Every operand follows the one schema argument; add slots up to
304
- // min_args and fill the empty ones.
305
- const [schema] = selectedExpression.args;
306
-
307
- newArgs.push(
308
- ...Array.from({ length: selectedExpression.min_args - 1 }, () => emptySlot(schema))
309
- );
310
- newArgs.forEach((slot, index) => {
311
- if (isEmptySlot(slot, schema)) {
312
- newArgs[index] = emptySlot(schema);
313
- }
314
- });
315
- }
316
- } else {
317
- selectedExpression.args.forEach((arg, index) => {
318
- if (isEmptySlot(newArgs[index], arg)) {
319
- newArgs[index] = emptySlot(arg);
320
- }
321
- });
322
- }
323
-
324
- return newArgs;
325
- },
284
+ (expression: string, args: IExpression[] = []): IExpression[] =>
285
+ addMissingExpressionArgs(expressions.value as never, expression, args as never) as never,
326
286
  [JSON.stringify(expressions.value)]
327
287
  );
328
288
 
@@ -511,13 +471,7 @@ export const Expression = ({
511
471
  );
512
472
 
513
473
  const updateArg = useCallback(
514
- (
515
- val: any,
516
- index: number = 0,
517
- type?: string,
518
- isFunction?: boolean,
519
- isRequired?: boolean
520
- ) => {
474
+ (val: any, index: number = 0, type?: string, isFunction?: boolean) => {
521
475
  const args = clone(value.value.args);
522
476
  const newVal = clone(val);
523
477
 
@@ -525,12 +479,18 @@ export const Expression = ({
525
479
  newVal.args = addMissingArgs(newVal.exp, newVal.args);
526
480
  }
527
481
 
482
+ /* `required` is NOT written here. It is a schema key — it describes the
483
+ catalogue's declaration of the argument, not the author's value, and
484
+ nothing reads it back off a stored argument (validation takes it from
485
+ the schema). Persisting it made a cleared argument indistinguishable
486
+ from real data: the value dropped out as `undefined`, `required: true`
487
+ stayed, and what was saved to the draft was `{type, required}` — an
488
+ argument DEFINITION sitting where its value should be. */
528
489
  args[index] = {
529
490
  ...args[index],
530
491
  value: newVal,
531
492
  type: !isFunction ? type || args[index]?.type : undefined,
532
493
  is_expression: isFunction,
533
- required: isRequired,
534
494
  };
535
495
 
536
496
  onValueChange(
@@ -776,16 +736,10 @@ export const Expression = ({
776
736
  const handleFirstParamChange = useCallback(
777
737
  (_name, value, type, isFunction) => {
778
738
  if (isFunction || (type !== 'any' && type !== 'auto')) {
779
- updateArg(
780
- value,
781
- 0,
782
- isFunction ? undefined : type,
783
- isFunction,
784
- selectedExpression?.args?.[0]?.required
785
- );
739
+ updateArg(value, 0, isFunction ? undefined : type, isFunction);
786
740
  }
787
741
  },
788
- [updateArg, JSON.stringify(selectedExpression)]
742
+ [updateArg]
789
743
  );
790
744
 
791
745
  const buildCustomTemplateItems = useCallback(
@@ -1062,7 +1016,9 @@ export const Expression = ({
1062
1016
  {confirmDialogData.children}
1063
1017
  </ConfirmUnsupportedTypeModal>
1064
1018
  )}
1065
- {showSummary && <ExpressionRenderTemplate exp={value} expressions={expressions.value} />}
1019
+ {showSummary && (
1020
+ <ExpressionRenderTemplate exp={value} expressions={expressions.value} templates={localTemplates} />
1021
+ )}
1066
1022
  {!selectedExpression && !serverExpression && !firstArgument?.value && level === 0 ? (
1067
1023
  <ReqoreMessage size='small' opaque={false} intent='info'>
1068
1024
  Select an operation to start building your expression
@@ -1102,6 +1058,7 @@ export const Expression = ({
1102
1058
  >
1103
1059
  <TemplateField
1104
1060
  component={auto}
1061
+ componentOverrides={componentOverrides}
1105
1062
  // SEAM (reqraft): an operand that becomes an expression mounts
1106
1063
  // its own builder through this TemplateField — hand the host's
1107
1064
  // actions on, or nesting silently drops them (the group
@@ -1223,6 +1180,7 @@ export const Expression = ({
1223
1180
  <TemplateField
1224
1181
  minimal
1225
1182
  component={auto}
1183
+ componentOverrides={componentOverrides}
1226
1184
  // SEAM (reqraft): same as the first operand above.
1227
1185
  extraActions={extraActions}
1228
1186
  noSoft
@@ -1257,13 +1215,7 @@ export const Expression = ({
1257
1215
  !!arg.default_value
1258
1216
  }
1259
1217
  onChange={((_name, value, type, isFunction) => {
1260
- updateArg(
1261
- value,
1262
- index + 1,
1263
- isFunction ? undefined : type,
1264
- isFunction,
1265
- arg.required
1266
- );
1218
+ updateArg(value, index + 1, isFunction ? undefined : type, isFunction);
1267
1219
  }) as any}
1268
1220
  fluid={phone}
1269
1221
  fixed={!phone}
@@ -1351,6 +1303,7 @@ export const ExpressionBuilder = ({
1351
1303
  expressionsUrl,
1352
1304
  serverHandled,
1353
1305
  extraActions,
1306
+ componentOverrides,
1354
1307
  reorder,
1355
1308
  }: IExpressionBuilderProps) => {
1356
1309
  const templates = useTemplates(!isChild, localTemplates);
@@ -1472,7 +1425,11 @@ export const ExpressionBuilder = ({
1472
1425
  >
1473
1426
  <ReqoreControlGroup vertical fluid size='normal' style={{ position: 'relative' }} wrap>
1474
1427
  {showSummary && (
1475
- <ExpressionRenderTemplate exp={value} expressions={_expressions.expressions} />
1428
+ <ExpressionRenderTemplate
1429
+ exp={value}
1430
+ expressions={_expressions.expressions}
1431
+ templates={localTemplates}
1432
+ />
1476
1433
  )}
1477
1434
  <StyledExpressionItemLabel
1478
1435
  as={ReqoreP}
@@ -1535,6 +1492,7 @@ export const ExpressionBuilder = ({
1535
1492
  id={level === 0 && index === 0 ? 'expression-builder' : undefined}
1536
1493
  serverHandled={serverHandled}
1537
1494
  extraActions={extraActions}
1495
+ componentOverrides={componentOverrides}
1538
1496
  reorder={reorder}
1539
1497
  />
1540
1498
  </ReqoreErrorBoundary>
@@ -1,75 +1,42 @@
1
1
  // SEAM (reqraft): the IDE rendered the readable expression via
2
- // `callBackendBasic('render-expression')` over the Creator WebSocket; here
3
- // the same server rendering arrives over the LSP (`dpql/renderExpression`,
4
- // via `useRenderExpression`), with a client-side approximation as fallback.
5
- //
6
- // Server path: the rendering is displayed through a read-only `DpqlEditor`,
7
- // which gives template-reference chips (the `$context:value` converter) AND
8
- // LSP-backed token colours (semantic tokens) — diagnostics are suppressed
9
- // because the rendering is human-readable text, not parseable DPQL. The
10
- // fallback path keeps the plain rich-text rendering plus an explicit
11
- // "Approximate" tag so the serving path is never ambiguous.
2
+ // `callBackendBasic('render-expression')` over the Creator WebSocket; here the
3
+ // same server rendering arrives over the LSP (`dpql/renderExpression`, via
4
+ // `useRenderExpression`) and is shown through `ExpressionRendering`, the one
5
+ // read-only rendering every expression surface shares — monospace, coloured by
6
+ // the language server, template references as chips.
12
7
  // The component name/shape is kept identical so `index.tsx`'s usage is
13
8
  // unchanged.
14
- import { ReqoreTag } from '@qoretechnologies/reqore';
15
- import { useAsyncRetry } from 'react-use';
16
- import { DpqlEditor } from '../../../dpqlEditor';
9
+ import { ReqoreMessage } from '@qoretechnologies/reqore';
10
+ import { IReqoreFormTemplates } from '@qoretechnologies/reqore/dist/components/Textarea';
17
11
  import { validateField } from '../../../../helpers/validations';
18
- import { RichTextFormField } from '../../fields/rich-text/RichText';
19
- import { useRenderExpression } from '../useRenderExpression';
12
+ import { ExpressionRendering } from '../DpqlRendering';
20
13
  import { IExpression, IExpressionSchema } from '../types';
21
14
 
22
- const noop = (): void => undefined;
23
-
24
15
  export interface IExpressionRenderTemplateProps {
25
16
  exp: IExpression;
26
17
  expressions: IExpressionSchema[];
18
+ /** The builder's template catalogue: a reference in it reads as its name. */
19
+ templates?: IReqoreFormTemplates;
27
20
  }
28
21
 
29
- export const ExpressionRenderTemplate = ({ exp, expressions }: IExpressionRenderTemplateProps) => {
30
- const { renderRich } = useRenderExpression();
31
-
32
- const isValid = validateField('expression', exp, { expressions });
33
-
34
- const renderTemplate = useAsyncRetry(async () => {
35
- if (!isValid) return null;
36
- return renderRich(exp.value, expressions);
37
- }, [JSON.stringify(exp), JSON.stringify(expressions)]);
38
-
39
- if (!isValid || !renderTemplate.value || !renderTemplate.value.server) {
22
+ export const ExpressionRenderTemplate = ({
23
+ exp,
24
+ expressions,
25
+ templates,
26
+ }: IExpressionRenderTemplateProps) => {
27
+ if (!validateField('expression', exp, { expressions })) {
40
28
  return (
41
- <>
42
- <RichTextFormField
43
- readOnly
44
- value={
45
- isValid
46
- ? renderTemplate.value?.text
47
- : 'Expression is invalid, unable to render summary'
48
- }
49
- flat
50
- panelProps={{ style: { flexGrow: 0, flexShrink: 0 } }}
51
- size='small'
52
- />
53
- {isValid && renderTemplate.value ? (
54
- <ReqoreTag
55
- size='small'
56
- minimal
57
- intent='muted'
58
- label='Approximate — server rendering unavailable'
59
- />
60
- ) : null}
61
- </>
29
+ <ReqoreMessage size='small' intent='muted' flat opaque={false}>
30
+ Expression is invalid, unable to render summary
31
+ </ReqoreMessage>
62
32
  );
63
33
  }
64
34
 
65
35
  return (
66
- <DpqlEditor
67
- value={renderTemplate.value.text}
68
- onChange={noop}
69
- readOnly
70
- showDiagnostics={false}
71
- enableHover={false}
72
- templateTagsUseIntent
36
+ <ExpressionRendering
37
+ expression={exp.value}
38
+ templates={templates}
39
+ data-testid='expression-explanation'
73
40
  />
74
41
  );
75
42
  };