@vertigis/workflow 5.36.0 → 5.37.0

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 (453) hide show
  1. package/Activator.d.ts +25 -25
  2. package/Collections.d.ts +83 -91
  3. package/EnumUtils.d.ts +28 -28
  4. package/Errors.d.ts +155 -155
  5. package/Hooks.d.ts +32 -32
  6. package/IActivityHandler.d.ts +101 -101
  7. package/LanguageStringUtils.d.ts +16 -17
  8. package/LanguageStringUtils.js +1 -1
  9. package/ProgramInspectorFacility.d.ts +23 -24
  10. package/Task.d.ts +56 -56
  11. package/TemplateUtils.d.ts +28 -28
  12. package/Validation.d.ts +151 -26
  13. package/Validation.js +1 -1
  14. package/activities/app/GetApplicationData.d.ts +15 -12
  15. package/activities/app/GetApplicationData.js +1 -1
  16. package/activities/app/GetApplicationInfo.d.ts +15 -15
  17. package/activities/app/GetUserInfo.d.ts +15 -15
  18. package/activities/app/PublishEvent.d.ts +14 -14
  19. package/activities/app/RemoveApplicationData.d.ts +14 -11
  20. package/activities/app/RemoveApplicationData.js +1 -1
  21. package/activities/app/RunCommand.d.ts +17 -17
  22. package/activities/app/RunOperation.d.ts +25 -25
  23. package/activities/app/SetApplicationData.d.ts +13 -10
  24. package/activities/app/SetApplicationData.js +1 -1
  25. package/activities/app/applicationData.d.ts +12 -0
  26. package/activities/app/applicationData.js +1 -0
  27. package/activities/arcgis/AddAttachment.d.ts +22 -22
  28. package/activities/arcgis/AddFeatureLayer.d.ts +23 -23
  29. package/activities/arcgis/AddFeatureLayer.js +1 -1
  30. package/activities/arcgis/AddFeatures.d.ts +27 -27
  31. package/activities/arcgis/AddGraphics.d.ts +27 -27
  32. package/activities/arcgis/ArcadeScript.d.ts +17 -18
  33. package/activities/arcgis/AreaEngineTask.d.ts +20 -20
  34. package/activities/arcgis/BufferEngineTask.d.ts +27 -27
  35. package/activities/arcgis/BufferServiceTask.d.ts +33 -33
  36. package/activities/arcgis/BufferServiceTask.js +1 -1
  37. package/activities/arcgis/CastGeometry.d.ts +23 -23
  38. package/activities/arcgis/ClearGraphics.d.ts +12 -12
  39. package/activities/arcgis/ClearGraphics.js +1 -1
  40. package/activities/arcgis/ClipEngineTask.d.ts +18 -18
  41. package/activities/arcgis/ClosestFacilityTask.d.ts +90 -90
  42. package/activities/arcgis/ClosestFacilityTask.js +1 -1
  43. package/activities/arcgis/CompareGeometries.d.ts +19 -19
  44. package/activities/arcgis/ConvertValueToArcGisFieldType.d.ts +13 -0
  45. package/activities/arcgis/ConvertValueToArcGisFieldType.js +1 -0
  46. package/activities/arcgis/CreateFeatureSet.d.ts +16 -16
  47. package/activities/arcgis/CreateFeatureSet.js +1 -1
  48. package/activities/arcgis/CreateGraphic.d.ts +17 -17
  49. package/activities/arcgis/CreateGraphic.js +1 -1
  50. package/activities/arcgis/CreatePoint.d.ts +17 -17
  51. package/activities/arcgis/CutEngineTask.d.ts +18 -18
  52. package/activities/arcgis/DeleteAttachments.d.ts +22 -22
  53. package/activities/arcgis/DeleteFeatures.d.ts +30 -30
  54. package/activities/arcgis/DensifyEngineTask.d.ts +20 -20
  55. package/activities/arcgis/DifferenceEngineTask.d.ts +23 -23
  56. package/activities/arcgis/DistanceEngineTask.d.ts +20 -20
  57. package/activities/arcgis/DistanceServiceTask.d.ts +24 -24
  58. package/activities/arcgis/DistanceServiceTask.js +1 -1
  59. package/activities/arcgis/ExtendedSpatialReferenceInfoEngineTask.d.ts +17 -17
  60. package/activities/arcgis/FeatureSetFromJson.d.ts +16 -16
  61. package/activities/arcgis/FeatureTableMap.d.ts +12 -12
  62. package/activities/arcgis/FlipEngineTask.d.ts +21 -21
  63. package/activities/arcgis/FromGeoCoordinateStringServiceTask.d.ts +24 -24
  64. package/activities/arcgis/GeneralizeEngineTask.d.ts +22 -22
  65. package/activities/arcgis/GenerateArcGisToken.d.ts +23 -23
  66. package/activities/arcgis/GenerateWebmapForReport.d.ts +20 -20
  67. package/activities/arcgis/GenerateWebmapForReport.js +1 -1
  68. package/activities/arcgis/Geocode.d.ts +37 -38
  69. package/activities/arcgis/Geocode.js +1 -1
  70. package/activities/arcgis/GeometryFromJson.d.ts +16 -16
  71. package/activities/arcgis/Geoprocessing.d.ts +25 -26
  72. package/activities/arcgis/Geoprocessing.js +1 -1
  73. package/activities/arcgis/GeoprocessingAsync.d.ts +36 -37
  74. package/activities/arcgis/GeoprocessingAsync.js +1 -1
  75. package/activities/arcgis/GetAttributeValue.d.ts +22 -22
  76. package/activities/arcgis/GetAttributeValues.d.ts +20 -20
  77. package/activities/arcgis/GetCentroid.d.ts +16 -16
  78. package/activities/arcgis/GetCodedValueDomain.d.ts +29 -29
  79. package/activities/arcgis/GetCodedValueDomain.js +1 -1
  80. package/activities/arcgis/GetCurrentPosition.d.ts +46 -46
  81. package/activities/arcgis/GetFeatureGeometries.d.ts +20 -20
  82. package/activities/arcgis/GetFeatureGeometry.d.ts +18 -18
  83. package/activities/arcgis/GetFeatureLayerInfo.d.ts +22 -22
  84. package/activities/arcgis/GetFeatureSetExtent.d.ts +18 -18
  85. package/activities/arcgis/GetFeatureSetObjectIds.d.ts +20 -20
  86. package/activities/arcgis/GetFormElementItemsFromFeatures.d.ts +49 -50
  87. package/activities/arcgis/GetFormElementItemsFromFeatures.js +1 -1
  88. package/activities/arcgis/GetGeometryExtent.d.ts +17 -17
  89. package/activities/arcgis/GetGraphics.d.ts +19 -19
  90. package/activities/arcgis/GetLayer.d.ts +21 -21
  91. package/activities/arcgis/GetLayerDefinitionExpression.d.ts +18 -18
  92. package/activities/arcgis/GetLayerProperty.d.ts +18 -18
  93. package/activities/arcgis/GetLayerVisibility.d.ts +18 -18
  94. package/activities/arcgis/GetMap.d.ts +11 -11
  95. package/activities/arcgis/GetMapScreenshot.d.ts +18 -18
  96. package/activities/arcgis/GetPortalUser.d.ts +20 -20
  97. package/activities/arcgis/GetTable.d.ts +18 -18
  98. package/activities/arcgis/GetViewExtent.d.ts +16 -16
  99. package/activities/arcgis/GetViewpoint.d.ts +12 -12
  100. package/activities/arcgis/IntersectEngineTask.d.ts +20 -20
  101. package/activities/arcgis/LabelPointsServiceTask.d.ts +18 -18
  102. package/activities/arcgis/LengthEngineTask.d.ts +20 -20
  103. package/activities/arcgis/MapProvider.d.ts +133 -132
  104. package/activities/arcgis/MapProvider.js +1 -1
  105. package/activities/arcgis/NearestCoordinateEngineTask.d.ts +26 -26
  106. package/activities/arcgis/NearestVertexEngineTask.d.ts +26 -26
  107. package/activities/arcgis/NearestVerticesEngineTask.d.ts +34 -34
  108. package/activities/arcgis/OffsetEngineTask.d.ts +25 -25
  109. package/activities/arcgis/ProjectServiceTask.d.ts +27 -27
  110. package/activities/arcgis/ProjectServiceTask.js +1 -1
  111. package/activities/arcgis/QueryAttachmentInfos.d.ts +21 -21
  112. package/activities/arcgis/QueryTask.d.ts +77 -77
  113. package/activities/arcgis/QueryTask.js +1 -1
  114. package/activities/arcgis/RefreshLayer.d.ts +12 -12
  115. package/activities/arcgis/RegisterCorsUrl.d.ts +21 -21
  116. package/activities/arcgis/RelateEngineTask.d.ts +22 -22
  117. package/activities/arcgis/RelationServiceTask.d.ts +29 -29
  118. package/activities/arcgis/RelationServiceTask.js +1 -1
  119. package/activities/arcgis/RelationshipQueryTask.d.ts +37 -38
  120. package/activities/arcgis/RelationshipQueryTask.js +1 -1
  121. package/activities/arcgis/RemoveFeatureSetFields.d.ts +22 -22
  122. package/activities/arcgis/RemoveFeatureSetFields.js +1 -1
  123. package/activities/arcgis/RemoveGraphics.d.ts +14 -14
  124. package/activities/arcgis/RemoveGraphics.js +1 -1
  125. package/activities/arcgis/RemoveLayer.d.ts +16 -16
  126. package/activities/arcgis/RendererFromJson.d.ts +16 -16
  127. package/activities/arcgis/ReshapeServiceTask.d.ts +20 -20
  128. package/activities/arcgis/ReverseGeocode.d.ts +31 -31
  129. package/activities/arcgis/ReverseGeocode.js +1 -1
  130. package/activities/arcgis/RotateEngineTask.d.ts +20 -20
  131. package/activities/arcgis/RouteTask.d.ts +91 -91
  132. package/activities/arcgis/RouteTask.js +1 -1
  133. package/activities/arcgis/RunPrint.d.ts +33 -34
  134. package/activities/arcgis/RunPrint.js +1 -1
  135. package/activities/arcgis/RunReport.d.ts +37 -38
  136. package/activities/arcgis/RunReport.js +1 -1
  137. package/activities/arcgis/RunWorkflow.d.ts +51 -52
  138. package/activities/arcgis/SendLayerToAttributeTable.d.ts +10 -10
  139. package/activities/arcgis/ServiceAreaTask.d.ts +87 -87
  140. package/activities/arcgis/ServiceAreaTask.js +1 -1
  141. package/activities/arcgis/SetFeatureAttribute.d.ts +15 -15
  142. package/activities/arcgis/SetFeatureGeometry.d.ts +13 -13
  143. package/activities/arcgis/SetFeaturePopup.d.ts +12 -12
  144. package/activities/arcgis/SetFeatureSymbol.d.ts +13 -13
  145. package/activities/arcgis/SetImageryLayerOptions.d.ts +27 -27
  146. package/activities/arcgis/SetLayerDefinitionExpression.d.ts +21 -21
  147. package/activities/arcgis/SetLayerDefinitionExpression.js +1 -1
  148. package/activities/arcgis/SetLayerPopup.d.ts +12 -12
  149. package/activities/arcgis/SetLayerProperty.d.ts +23 -23
  150. package/activities/arcgis/SetLayerVisibility.d.ts +23 -23
  151. package/activities/arcgis/SetMap.d.ts +14 -14
  152. package/activities/arcgis/SetViewExtent.d.ts +27 -27
  153. package/activities/arcgis/SetViewpoint.d.ts +23 -23
  154. package/activities/arcgis/ShowFeaturePopup.d.ts +11 -11
  155. package/activities/arcgis/ShowResults.d.ts +51 -51
  156. package/activities/arcgis/SimplifyEngineTask.d.ts +15 -15
  157. package/activities/arcgis/SortFeatureSet.d.ts +20 -20
  158. package/activities/arcgis/SymbolFromJson.d.ts +16 -16
  159. package/activities/arcgis/ToGeoCoordinateStringServiceTask.d.ts +30 -30
  160. package/activities/arcgis/TypeChecking.d.ts +46 -46
  161. package/activities/arcgis/UnionEngineTask.d.ts +19 -19
  162. package/activities/arcgis/UnionServiceTask.d.ts +20 -20
  163. package/activities/arcgis/UpdateAttachment.d.ts +29 -29
  164. package/activities/arcgis/UpdateFeatures.d.ts +27 -27
  165. package/activities/arcgis/libs/arcGisRestApi.d.ts +18 -18
  166. package/activities/arcgis/runUtils.d.ts +93 -93
  167. package/activities/arcgis/shared.d.ts +61 -61
  168. package/activities/arcgis/tools.d.ts +42 -40
  169. package/activities/arcgis/tools.js +1 -1
  170. package/activities/browser/GetBrowserInfo.d.ts +13 -13
  171. package/activities/browser/InjectCss.d.ts +11 -11
  172. package/activities/constants.d.ts +19 -19
  173. package/activities/core/AddItem.d.ts +12 -12
  174. package/activities/core/AddItems.d.ts +12 -12
  175. package/activities/core/Annotation.d.ts +8 -8
  176. package/activities/core/Cast.d.ts +16 -16
  177. package/activities/core/ChannelProvider.d.ts +89 -90
  178. package/activities/core/ChannelProvider.js +1 -1
  179. package/activities/core/ClearItems.d.ts +10 -10
  180. package/activities/core/Container.d.ts +7 -7
  181. package/activities/core/ConvertBytesToText.d.ts +14 -14
  182. package/activities/core/ConvertDataTableToFeatureSet.d.ts +12 -12
  183. package/activities/core/ConvertTextToBytes.d.ts +14 -14
  184. package/activities/core/ConvertToJson.d.ts +16 -16
  185. package/activities/core/ConvertToJson.js +1 -1
  186. package/activities/core/CreateFile.d.ts +18 -18
  187. package/activities/core/CreateValue.d.ts +21 -21
  188. package/activities/core/DecodeUriComponent.d.ts +14 -14
  189. package/activities/core/Delay.d.ts +18 -18
  190. package/activities/core/EncodeUriComponent.d.ts +14 -14
  191. package/activities/core/Evaluate.d.ts +18 -18
  192. package/activities/core/EvaluateAsync.d.ts +18 -18
  193. package/activities/core/Exit.d.ts +7 -7
  194. package/activities/core/ForEach.d.ts +25 -26
  195. package/activities/core/FormatDate.d.ts +23 -23
  196. package/activities/core/GetBase64StringFromBytes.d.ts +15 -15
  197. package/activities/core/GetBase64StringFromFile.d.ts +15 -15
  198. package/activities/core/GetBytesFromBase64String.d.ts +15 -15
  199. package/activities/core/GetFirstItem.d.ts +14 -14
  200. package/activities/core/GetItemAtIndex.d.ts +15 -15
  201. package/activities/core/GetLastItem.d.ts +14 -14
  202. package/activities/core/GetLogLevel.d.ts +9 -9
  203. package/activities/core/GetTextFromFile.d.ts +16 -16
  204. package/activities/core/GetWorkflowInputs.d.ts +12 -12
  205. package/activities/core/If.d.ts +18 -18
  206. package/activities/core/Log.d.ts +14 -14
  207. package/activities/core/Log.js +1 -1
  208. package/activities/core/Loop.d.ts +27 -27
  209. package/activities/core/Loop.js +1 -1
  210. package/activities/core/ParseJson.d.ts +16 -16
  211. package/activities/core/ParseNumber.d.ts +12 -12
  212. package/activities/core/ParseUrl.d.ts +24 -25
  213. package/activities/core/ParseUrl.js +1 -1
  214. package/activities/core/Placeholder.d.ts +6 -6
  215. package/activities/core/RegexMatches.d.ts +17 -17
  216. package/activities/core/RegexReplace.d.ts +18 -18
  217. package/activities/core/RemoveItem.d.ts +14 -14
  218. package/activities/core/RunActivity.d.ts +12 -13
  219. package/activities/core/RunSubworkflow.d.ts +14 -15
  220. package/activities/core/SetLogLevel.d.ts +9 -9
  221. package/activities/core/SetProperty.d.ts +15 -15
  222. package/activities/core/SetWorkflowOutput.d.ts +12 -12
  223. package/activities/core/Subworkflow.d.ts +14 -15
  224. package/activities/core/Switch.d.ts +19 -19
  225. package/activities/core/TextReplace.d.ts +16 -16
  226. package/activities/core/Throw.d.ts +12 -12
  227. package/activities/core/TryCatch.d.ts +12 -12
  228. package/activities/core/WebRequest.d.ts +49 -50
  229. package/activities/core/converters.d.ts +10 -10
  230. package/activities/csv/ConvertCsvToDataTable.d.ts +15 -15
  231. package/activities/csv/ConvertDataTableToCsv.d.ts +15 -15
  232. package/activities/essentials/GetEssentialsSite.d.ts +225 -225
  233. package/activities/essentials/RunEssentialsWorkflow.d.ts +25 -26
  234. package/activities/essentials/RunEssentialsWorkflowActivity.d.ts +17 -18
  235. package/activities/forms/ActivateFormElement.d.ts +13 -13
  236. package/activities/forms/ActivateFormElement.js +1 -1
  237. package/activities/forms/AddFormElement.d.ts +18 -18
  238. package/activities/forms/ClearFormElementError.d.ts +13 -13
  239. package/activities/forms/CompleteForm.d.ts +11 -11
  240. package/activities/forms/DisplayForm.d.ts +48 -49
  241. package/activities/forms/Errors.d.ts +18 -18
  242. package/activities/forms/FilterFormElementItems.d.ts +16 -16
  243. package/activities/forms/FormElementMap.d.ts +13 -13
  244. package/activities/forms/FormRenderer.d.ts +139 -140
  245. package/activities/forms/FormRenderer.js +1 -1
  246. package/activities/forms/GetFormElementItemsFromCollection.d.ts +49 -50
  247. package/activities/forms/GetFormElementItemsFromCollection.js +1 -1
  248. package/activities/forms/GetFormElementProperty.d.ts +19 -19
  249. package/activities/forms/GetFormElementValue.d.ts +17 -17
  250. package/activities/forms/GetFormEventData.d.ts +17 -17
  251. package/activities/forms/HideFormElement.d.ts +13 -13
  252. package/activities/forms/PropagateFormEvent.d.ts +10 -10
  253. package/activities/forms/SetCurrentFormElementItem.d.ts +18 -18
  254. package/activities/forms/SetCurrentFormElementItem.js +1 -1
  255. package/activities/forms/SetFormElementError.d.ts +17 -17
  256. package/activities/forms/SetFormElementEvent.d.ts +18 -18
  257. package/activities/forms/SetFormElementItemProperty.d.ts +34 -21
  258. package/activities/forms/SetFormElementItemProperty.js +1 -1
  259. package/activities/forms/SetFormElementItems.d.ts +18 -19
  260. package/activities/forms/SetFormElementProperty.d.ts +32 -19
  261. package/activities/forms/SetFormElementProperty.js +1 -1
  262. package/activities/forms/ShowFormElement.d.ts +15 -15
  263. package/activities/image/GetImageMetadata.d.ts +16 -16
  264. package/activities/image/RotateImage.d.ts +15 -15
  265. package/activities/index.d.ts +4 -2
  266. package/activities/index.js +1 -1
  267. package/activities/main.d.ts +1 -1
  268. package/activities/math/Abs.d.ts +14 -14
  269. package/activities/math/Cos.d.ts +14 -14
  270. package/activities/math/Max.d.ts +16 -16
  271. package/activities/math/Min.d.ts +16 -16
  272. package/activities/math/Pow.d.ts +15 -15
  273. package/activities/math/Random.d.ts +10 -10
  274. package/activities/math/Sin.d.ts +14 -14
  275. package/activities/math/Sqrt.d.ts +14 -14
  276. package/activities/math/Tan.d.ts +14 -14
  277. package/activities/pdf/AddGeoreferenceToPdf.d.ts +19 -19
  278. package/activities/pdf/AddImageToPdf.d.ts +63 -0
  279. package/activities/pdf/AddImageToPdf.js +1 -0
  280. package/activities/pdf/AddTextToPdf.d.ts +59 -0
  281. package/activities/pdf/AddTextToPdf.js +1 -0
  282. package/activities/pdf/CreatePdf.d.ts +49 -0
  283. package/activities/pdf/CreatePdf.js +1 -0
  284. package/activities/pdf/ExtractPdfPages.d.ts +17 -17
  285. package/activities/pdf/MergePdfs.d.ts +15 -15
  286. package/activities/server/CopyFile.d.ts +10 -10
  287. package/activities/server/CreateDirectory.d.ts +9 -9
  288. package/activities/server/CreateDownload.d.ts +18 -18
  289. package/activities/server/CreateEmailAttachment.d.ts +16 -16
  290. package/activities/server/CreateZipFromDirectory.d.ts +12 -12
  291. package/activities/server/DeleteDirectory.d.ts +9 -9
  292. package/activities/server/DeleteFile.d.ts +9 -9
  293. package/activities/server/DirectoryExists.d.ts +13 -13
  294. package/activities/server/ExtractZipToDirectory.d.ts +11 -11
  295. package/activities/server/FileExists.d.ts +13 -13
  296. package/activities/server/GetDirectoriesInDirectory.d.ts +14 -14
  297. package/activities/server/GetFilesInDirectory.d.ts +14 -14
  298. package/activities/server/MoveFile.d.ts +10 -10
  299. package/activities/server/ReadFile.d.ts +14 -14
  300. package/activities/server/ReadFileBytes.d.ts +13 -13
  301. package/activities/server/RunApplication.d.ts +22 -22
  302. package/activities/server/RunPython.d.ts +23 -23
  303. package/activities/server/SendEmail.d.ts +16 -16
  304. package/activities/server/SqlNonQuery.d.ts +18 -18
  305. package/activities/server/SqlQuery.d.ts +18 -18
  306. package/activities/server/SqlQueryUnsafe.d.ts +18 -18
  307. package/activities/server/WriteFile.d.ts +11 -11
  308. package/activities/server/WriteFileBytes.d.ts +10 -10
  309. package/activities/ui/Alert.d.ts +17 -17
  310. package/activities/ui/Confirm.d.ts +24 -24
  311. package/activities/ui/Prompt.d.ts +26 -26
  312. package/activities/wab/OpenWidget.d.ts +10 -10
  313. package/activities/wab/PublishWidgetData.d.ts +11 -11
  314. package/activities/xlsx/ConvertDataTableToXlsx.d.ts +15 -15
  315. package/activities/xlsx/ConvertXlsxToDataSet.d.ts +15 -15
  316. package/constants.d.ts +2 -2
  317. package/definition/Activity.d.ts +12 -13
  318. package/definition/ActivityInput.d.ts +31 -31
  319. package/definition/Component.d.ts +10 -10
  320. package/definition/DeploymentConfig.d.ts +4 -5
  321. package/definition/Form.d.ts +5 -5
  322. package/definition/Program.d.ts +29 -30
  323. package/definition/ProgramInspector.d.ts +290 -288
  324. package/definition/ProgramInspector.js +1 -1
  325. package/definition/Reference.d.ts +11 -11
  326. package/definition/Resource.d.ts +26 -26
  327. package/definition/Step.d.ts +9 -9
  328. package/definition/Transition.d.ts +17 -17
  329. package/diagnostics/ConsoleDebugLogger.d.ts +10 -10
  330. package/diagnostics/logging.d.ts +5 -5
  331. package/execution/ActivityLoader.d.ts +23 -24
  332. package/execution/Engine.d.ts +84 -85
  333. package/execution/IDebugSession.d.ts +43 -44
  334. package/execution/ModuleLoader.d.ts +42 -42
  335. package/execution/ProgramRunner.d.ts +1 -1
  336. package/execution/ProgramRunner.js +1 -1
  337. package/forms/Calendar.d.ts +89 -89
  338. package/forms/ExclusiveTimer.d.ts +13 -13
  339. package/forms/FormComponent.d.ts +47 -47
  340. package/forms/FormComponent.js +1 -1
  341. package/forms/FormDefinition.d.ts +451 -452
  342. package/forms/FormElement.d.ts +24 -59
  343. package/forms/FormElement.js +1 -1
  344. package/forms/FormHost.d.ts +225 -231
  345. package/forms/FormHost.js +1 -1
  346. package/forms/FormPresenterHost.d.ts +62 -74
  347. package/forms/MutuallyExclusiveSectionGroup.d.ts +41 -41
  348. package/forms/NumberParser.d.ts +27 -26
  349. package/forms/NumberParser.js +1 -1
  350. package/forms/common.d.ts +67 -62
  351. package/forms/common.js +1 -1
  352. package/forms/components/AccordionGroup.d.ts +15 -15
  353. package/forms/components/AutoComplete.d.ts +8 -8
  354. package/forms/components/ButtonBar.d.ts +8 -8
  355. package/forms/components/CheckBox.d.ts +7 -7
  356. package/forms/components/CheckGroup.d.ts +8 -8
  357. package/forms/components/Custom.d.ts +7 -7
  358. package/forms/components/DatePicker.d.ts +8 -8
  359. package/forms/components/DatePicker.js +1 -1
  360. package/forms/components/DateRangePicker.d.ts +12 -12
  361. package/forms/components/DateRangePicker.js +1 -1
  362. package/forms/components/DateTimePicker.d.ts +8 -8
  363. package/forms/components/DateTimePicker.js +1 -1
  364. package/forms/components/DropDownList.d.ts +8 -7
  365. package/forms/components/DropDownList.js +1 -1
  366. package/forms/components/FilePicker.d.ts +10 -9
  367. package/forms/components/FilePicker.js +1 -1
  368. package/forms/components/Form.d.ts +23 -23
  369. package/forms/components/Form.js +1 -1
  370. package/forms/components/FormLabelNumberField.d.ts +17 -17
  371. package/forms/components/GeometryPicker.d.ts +5 -4
  372. package/forms/components/GeometryPicker.js +1 -1
  373. package/forms/components/GeometryPickerListItem.d.ts +23 -23
  374. package/forms/components/HorizontalRule.d.ts +7 -7
  375. package/forms/components/Image.d.ts +7 -7
  376. package/forms/components/ItemPicker.d.ts +15 -17
  377. package/forms/components/ItemPicker.js +1 -1
  378. package/forms/components/ListBox.d.ts +8 -8
  379. package/forms/components/Markdown.d.ts +14 -14
  380. package/forms/components/Number.d.ts +8 -8
  381. package/forms/components/Number.js +1 -1
  382. package/forms/components/NumberRangeSlider.d.ts +12 -12
  383. package/forms/components/NumberSlider.d.ts +11 -11
  384. package/forms/components/RadioGroup.d.ts +8 -8
  385. package/forms/components/Scanner.d.ts +11 -9
  386. package/forms/components/Scanner.js +1 -1
  387. package/forms/components/Section.d.ts +14 -14
  388. package/forms/components/Section.js +1 -1
  389. package/forms/components/Signature.d.ts +12 -11
  390. package/forms/components/Signature.js +1 -1
  391. package/forms/components/SignatureDialog.d.ts +22 -22
  392. package/forms/components/Text.d.ts +8 -8
  393. package/forms/components/TextArea.d.ts +7 -7
  394. package/forms/components/TextBox.d.ts +7 -7
  395. package/forms/components/TimePicker.d.ts +8 -8
  396. package/forms/components/TimePicker.js +1 -1
  397. package/forms/constants.d.ts +81 -81
  398. package/forms/dateUtilities.d.ts +102 -103
  399. package/forms/dateUtilities.js +1 -1
  400. package/forms/elements/AutoComplete.d.ts +13 -13
  401. package/forms/elements/ButtonBar.d.ts +9 -9
  402. package/forms/elements/CheckBox.d.ts +7 -7
  403. package/forms/elements/CheckGroup.d.ts +11 -11
  404. package/forms/elements/Custom.d.ts +7 -7
  405. package/forms/elements/DatePicker.d.ts +6 -6
  406. package/forms/elements/DateRangePicker.d.ts +6 -6
  407. package/forms/elements/DateTimePicker.d.ts +6 -6
  408. package/forms/elements/DropDownList.d.ts +6 -6
  409. package/forms/elements/FilePicker.d.ts +8 -8
  410. package/forms/elements/GeometryPicker.d.ts +18 -18
  411. package/forms/elements/Header.d.ts +10 -10
  412. package/forms/elements/HorizontalRule.d.ts +2 -2
  413. package/forms/elements/Image.d.ts +2 -2
  414. package/forms/elements/ItemPicker.d.ts +13 -13
  415. package/forms/elements/ListBox.d.ts +11 -11
  416. package/forms/elements/Number.d.ts +11 -11
  417. package/forms/elements/NumberRangeSlider.d.ts +10 -10
  418. package/forms/elements/NumberSlider.d.ts +6 -6
  419. package/forms/elements/PasswordBox.d.ts +5 -5
  420. package/forms/elements/RadioGroup.d.ts +6 -6
  421. package/forms/elements/Scanner.d.ts +19 -19
  422. package/forms/elements/Section.d.ts +2 -2
  423. package/forms/elements/Signature.d.ts +16 -16
  424. package/forms/elements/Text.d.ts +2 -2
  425. package/forms/elements/TextArea.d.ts +7 -7
  426. package/forms/elements/TextBox.d.ts +5 -5
  427. package/forms/elements/TimePicker.d.ts +6 -6
  428. package/forms/elements/types.d.ts +83 -83
  429. package/forms/index.d.ts +124 -108
  430. package/forms/keyboard.d.ts +9 -9
  431. package/forms/listUtilities.d.ts +3 -3
  432. package/forms/manifest.d.ts +3 -3
  433. package/forms/manifest.js +1 -1
  434. package/forms/numberFormatter.d.ts +90 -94
  435. package/forms/numberFormatter.js +1 -1
  436. package/forms/numberUtilities.d.ts +150 -150
  437. package/forms/numberUtilities.js +1 -1
  438. package/forms/presenter.d.ts +21 -21
  439. package/forms/presenter.js +1 -1
  440. package/forms/renderers.d.ts +5 -8
  441. package/forms/renderers.js +1 -1
  442. package/forms/textUtilities.d.ts +33 -23
  443. package/forms/textUtilities.js +1 -1
  444. package/forms/utils.d.ts +177 -146
  445. package/forms/utils.js +1 -1
  446. package/index.d.ts +2 -2
  447. package/libs/version.d.ts +1 -1
  448. package/libs/version.js +1 -1
  449. package/licensing/LicenseChecker.d.ts +1 -1
  450. package/licensing/Watermark.d.ts +7 -7
  451. package/package.json +9 -11
  452. package/activities/app/constants.d.ts +0 -1
  453. package/activities/app/constants.js +0 -1
package/forms/FormHost.js CHANGED
@@ -1 +1 @@
1
- import Bluebird from"bluebird";import{Task}from"../Task.js";import{DEFAULT_LOCALE}from"../constants.js";import*as defs from"./FormDefinition.js";import MutuallyExclusiveSectionGroup from"./MutuallyExclusiveSectionGroup.js";import NumberParser from"./NumberParser.js";import{FormElementTypes}from"./constants.js";import{format}from"./numberFormatter.js";import*as presenter from"./presenter.js";import{sortAndFilter,text}from"./utils.js";const guid="C0166F74-982A-464E-9FB6-9605CB7649C1:",eventName=guid+"FormEvent";function createEvent(e,t){return new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:t})}function overlay(i,s){switch(typeof i){case"boolean":case"number":case"string":return i;case"object":break;default:return s}if(null===i)return s;if(i instanceof Array){let e=s;void 0!==e&&null!==e||(e=[]);let t=0;for(const r of i){var n=overlay(r,e[t]);void 0!==n&&(t<i.length?e[t]=n:e.push(n),++t)}return e}let e=s;void 0===e&&(e={});for(const t in i)e[t]=overlay(i[t],e[t]);return e}function createSubscription(e){function t(){return void 0!==e&&(t.active=!1,e(),!0)}return t.active=!0,t}class FormHost{constructor(){this.form={defaults:{},elements:{}},this.errors={},this.refs={},this.enabled=!1,this.visible=!1,this.dismiss=!1,this.custom=!1,this.container=document.createElement("div"),this.eventIndex=0,this.eventQueue=[],this.mutuallyExclusiveSections={},this.nextFocus=!1,this.nextRefresh=!1,this.style=void 0}deriveLocale(){return DEFAULT_LOCALE}mount(){var e=this.container,t=e.parentNode;null==t&&document.body.appendChild(e),this.update()}unmount(){var e=this.container;const t=e.parentNode;void 0!==t&&null!==t&&t.removeChild(e)}observeFocus(e){this.enabled&&e instanceof HTMLElement&&(this.lastFocus&&this.lastFocus.target===e||this.setLastFocus(e))}focus(e){!0===(e=null==e?!1:e)&&(this.lastFocus=void 0),!1===e&&!1===(e=this.nextFocus)&&(e=!0),this.nextFocus=e,this.invalidate(!0!==e?e:void 0)}show(){const e=this.container;if(void 0===e)return!1;this.custom||void 0!==this.focusObserver||e.addEventListener("focus",this.focusObserver=e=>this.observeFocus(e.target),!0),this.enabled||(this.nextRefresh=!0,this.focus()),this.enforceAccordionConstraints();var t=this.errors;for(const i in t){const s=this.form.elements[i];void 0!==s&&null!==s&&(s.error=t[i],this.invalidate(i))}return this.idle(),!1!==this.nextRefresh&&(this.enabled=!0,this.visible=!0,this.mount()),this.enabled}isInvalid(e){return!!e.error&&!1!==e.visible}getInvalidElements(){return Object.keys(this.form.elements).map(e=>this.form.elements[e]).filter(this.isInvalid)}hasInvalidChild(e){for(const i in this.form.elements){var t=this.form.elements[i];if(this.isInvalid(t)&&this.getParentSection(t)===e)return!0}return!1}spin(){return void 0!==this.container&&(this.idle(),this.visible&&!this.enabled||(this.nextRefresh=!0,this.enabled=!1,this.visible=!0,this.mount()),this.visible)}hide(){return void 0!==this.container&&(this.idle(),this.visible&&(this.enabled=!1,this.visible=!1,this.unmount()),!0)}dispose(){if(this.dismiss)return!1;{this.dismiss=!0;const t=this.container;t.dispatchEvent(createEvent(eventName));var e=this.focusObserver;return void 0!==e&&t.removeEventListener("focus",e,!0),this.idle(),this.unmount(),this.refs={},presenter.releaseForm(this.container),this.container=void 0,this.lastFocus=void 0,!(this.eventTask=void 0)}}renderFocus(e,t){var i=this.nextFocus;if(this.enabled&&e instanceof HTMLElement)if(!1!==i)if(void 0!==t){if(t===i||!0===i&&void 0===this.lastFocus)return this.nextFocus=!1,this.setLastFocus(e,t),e.focus(),!0}else{const s=this.lastFocus?.target;if(!0===i&&s instanceof HTMLElement&&e.contains(s))return this.nextFocus=!1,s.focus(),!0}else if(!1===i&&t&&t!==this.lastFocus?.name&&this.isElementPositionBeforeLastFocused(t))return this.setLastFocus(e,t),e.focus(),!0;return!1}renderHtml(e,t){return"string"==typeof e?text.textToHtml(e):text.isMarkdown(e)?text.markdownToSafeHtml(e.markdown,{inline:t===defs.HTMLContentCategory.Phrasing}):""}renderText(e){return"string"==typeof e?e:text.isMarkdown(e)?text.markdownToText(e.markdown):""}translateText(e){return"string"==typeof e||text.isMarkdown(e)?e:text.isStatus(e)?e.status:void 0}renderVisual(e){return presenter.render(e)||presenter.renderNone(e)}qualifyDefault(e){var t=sortAndFilter(this.form.elements);for(const r in t){var i=t[r];if(null!=i&&!1!==i.visible&&i.enabled){if(i.default)return e.value=i.value,r;var s=sortAndFilter(i.items);if(null!=s)for(const o in s){var n=s[o];if(null!=n&&n.visible&&n.enabled&&n.default)return e.item=o,e.value=n.value,r}}}}qualify(e,t){var i;return null==t&&(t={}),"clicked"===e&&void 0===t.name&&(t.name=this.qualifyDefault(t)),t.type=e,void 0===t.routingKey&&(i=t.name,t.routingKey=void 0!==i?e+"$"+i:e),t}post(e,t){t=this.publish(e,t);const i=this.container;void 0!==i&&i.dispatchEvent(createEvent(eventName,t))}subscribe(i){const e=this.container;if(void 0===e)return createSubscription();const s=function(){i=void 0,e.removeEventListener(eventName,t)},t=function(e){const t=e.detail;void 0!==t?Bluebird.resolve().then(function(){"function"==typeof i&&i(t)}):s()};return e.addEventListener(eventName,t),createSubscription(s)}refresh(e){this.custom||("string"==typeof e?(e=this.refs[e],presenter.refresh(e)):(this.refs={},presenter.refreshForm(this,this.container)))}invalidate(e){const t=this.nextRefresh;"string"==typeof e&&!0!==t&&(!1===t?this.nextRefresh={[e]:!0}:t[e]=!0),void 0!==e&&!0!==e||(this.nextRefresh=!0),!1===e&&!1===t&&(this.nextRefresh={})}update(){var e=this.nextRefresh;if(!0===e&&(this.nextRefresh=!1,this.refresh()),"object"==typeof e){this.nextRefresh=!1;for(const t in e)!0===e[t]&&this.refresh(t)}}idle(){const e=this.timerHandle;void 0!==e&&(this.timerHandle=void 0,e())}busy(){if(void 0===this.timerHandle&&void 0!==this.container){let e=setTimeout(()=>this.spin());this.timerHandle=function(){void 0!==e&&(clearTimeout(e),e=void 0)}}}publish(e,t){return this.enabled?(t=this.enqueue(e,t),0<this.eventQueue.length&&this.spin(),t):this.qualify(e,t)}enqueue(e,t){return t=this.qualify(e,t),void 0!==this.eventTask?(this.resolveEvent(t),this.eventTask=void 0):this.eventQueue.push(t),t}dequeue(){const e=this.eventQueue;if(0<e.length){var t=this.eventIndex,i=e[t++];return t>=e.length?e.length=this.eventIndex=0:this.eventIndex=t,i}}observe(){const t=this;return Bluebird.attempt(function(){if(void 0!==t.eventTask)return t.eventTask;var e=t.dequeue();return void 0!==e?e:t.show()?(t.eventTask=new Task(e=>{t.resolveEvent=e}),t.eventTask):void 0})}load(e,t){if(void 0===this.container)return!1;if(this.eventQueue.length=this.eventIndex=0,this.eventTask=void 0,this.errors={},this.lastFocus=void 0,this.nextFocus=!0,this.nextRefresh=!0,this.enqueue("load"),this.enqueue("prepare"),null!=e){e=overlay(e,e={defaults:{},elements:{}});this.form=overlay(t,e);for(const i in this.form.elements){let e=this.form.elements[i];if(e=overlay(e,{showFilter:!1,checked:!1,enabled:!0,hoisted:!1,visible:!0,overlay:!1,default:!1,validates:!1,readOnly:!1,require:!1,autoActivate:!1}),e.items)for(const s in e.items)e.items[s]=overlay(e.items[s],{enabled:!0,checked:!1,visible:!0,default:!1,validates:!1});this.form.elements[i]=e}}return!0}route(e){switch(e.type){case"changed":return this.cascade(e.name);case"prepare":return this.hydrate(e);case"suggest":return this.suggest(e);case"clicked":return this.click(e);case"validate":return this.verify(e);case"verify":return this.submit(e);case"checked":return this.changed(e)}return!1}changed(e){return this.enqueue("changed",{name:e.name,item:e.item,value:e.value}),!0}isElementValid(e,t=!0,i={status:void 0}){return null!=e&&(i.status=void 0,text.isStatus(e.error)&&"invalid"===e.error.status?!(i.status="invalid"):!0!==e.require||(this.isElementEffectivelyVisible(e)?!!this.isElementValueDefined(e)||!(i.status="missing"):t))}isElementEffectivelyVisible(e){return null!=e&&(!1!==this.getParentSection(e)?.visible&&!1!==e.visible)}isElementValueDefined(e){if(null==e)return!1;if(e.type===FormElementTypes.CHECKBOX)return!0;var t=e.current;if(null!=t)return!0;t=e.value;if(null!=t&&""!==t)return!0;if(e.type!==FormElementTypes.SIGNATURE){t=e.label;if(null!=t&&""!==t)return!0}var i=e.items;if(null!=i)for(const n in i){var s=i[n];if(null!=s&&!0===s.checked)return!0}return!1}trap(e){switch(e.type){case"populate":case"load":case"suggest":break;default:return!1}var t=e.name;const i=this.find(t);if(void 0===i||null===i)return!1;e=i.dependsOn;if("string"!=typeof e)return!1;e=this.find(e);return i.enabled=this.isElementEffectivelyVisible(e)&&this.isElementValueDefined(e),this.invalidate(t),!i.enabled}cascade(e){var t=this.find(e);if(null==t||!1===t.dependsOn)return!1;const i={[e]:!0};var s=sortAndFilter(this.form.elements);for(const r in s){const o=s[r];var n=o.dependsOn;if("string"==typeof n){const l=this.find(n);void 0!==l&&"string"!=typeof l.dependsOn&&(l.dependsOn=!0),!0===i[n]&&(i[r]=!0,o.checked=!1,o.current=void 0,o.label=void 0,o.items=void 0,o.value=void 0,this.invalidate(r),o.dependsOn===e&&this.enqueue("populate",{name:r}))}else o.dependsOn=!1}return!0}click(e){var t=this.form.elements[e.name];return null!=t&&t.type==FormElementTypes.BUTTONBAR&&this.validate(e)}hasInitialSelectionToDependOn(e){e=this.form.elements[e];return e.type===FormElementTypes.DROPDOWNLIST&&(void 0!==e.current&&null!==e.current)}hydrate(e){for(const i in sortAndFilter(this.form.elements)){var t=this.form.elements[i].dependsOn;"string"==typeof t&&!this.hasInitialSelectionToDependOn(t)||this.enqueue("populate",{name:i}),this.enqueue("load",{name:i})}return!0}shouldTriggerValidation(e){var t=this.find(e.name);if(null!=t&&"string"==typeof e.value){e=e.item;if("string"!=typeof e)return!0===t.validates;t=t.items;if(null!=t){e=t[e];if(null!=e)return!0===e.validates}}}validate(e){var t=this.shouldTriggerValidation(e);if(!0!==t)return!1===t&&(this.enqueue("end",{name:e.name,item:e.item,value:e.value,routingKey:"end"}),!0);{const n=this.errors={};var i=sortAndFilter(this.form.elements);for(const r in i){var s=i[r];null!=s&&(n[r]=void 0,this.enqueue("validate",{name:r}))}return this.enqueue("verify",{name:e.name,item:e.item,value:e.value,routingKey:"verify"}),!0}}verify(e){var t=e.name,i=this.form.elements[t],e={status:void 0};return!this.isElementValid(i,!0,e)&&(e.status&&(this.errors[t]={status:e.status}),!1===this.nextFocus&&this.focus(t),!0)}suggest(e){const t=this.form.elements[e.name];return void 0!==t&&null!==t&&(t.items={message:{label:{status:"trivial"},enabled:!1}},this.invalidate(e.name),!0)}submit(e){if(!this.hasErrors()){for(const r in this.form.elements)this.form.elements[r].error=void 0;return this.enqueue("submit",{name:e.name,item:e.item,value:e.value}),!0}var t=this.errors;for(const o in t){const l=this.form.elements[o];void 0!==l&&null!==l&&(l.error=t[o],this.invalidate(o))}const i=[];let s=!1;for(const a of this.getInvalidElements()){const u=this.getParentSection(a);if(this.isAccordionSection(u)){var n=this.findName(u);const h=this.getMutuallyExclusiveSectionGroup(n);if(h){const c=i.find(e=>e.group===h);c?c.element.rowNumber>u.rowNumber&&(c.element=u):(i.push({group:h,element:u}),s=!0)}}else this.isSectionCollapsed(u)&&(u.collapsed=!1,s=!0)}for(const d of i)d.group.expandedSection=d.element;return s&&this.invalidate(),!(this.errors={})}hasErrors(){var e=this.errors;for(const i in e){var t=e[i];if(null!=t)return!0}return!1}find(e){if(null!=e)return"string"==typeof(e="object"==typeof e?e.name:e)?this.form.elements[e]:void 0}findName(e){for(const t in this.form.elements)if(this.form.elements[t]===e)return t}coerceNumber(e){var t=this.deriveLocale();return new NumberParser(t).parse(e)}formatNumber(e,t){return t=t||{locale:this.deriveLocale()},format(t,e)}renderState(e,t,i){return!1}getParentSection(e){e=e.section;if(e){e="string"==typeof e?e:e.name;return this.form.elements[e]}}isSectionCollapsed(e){return!(!e||e.type!==FormElementTypes.SECTION||!this.isCollapsibleSection(e)&&!this.isAccordionSection(e))&&!0===e.collapsed}isElementPositionBeforeLastFocused(e){var t=this.lastFocus;if(!t)return!0;if("footer"===e)return!1;if("footer"===t.name)return!0;if(e&&void 0!==t?.rowNumber&&void 0!==t.rowIndex){e=this.form.elements?.[e];if(e)return void 0!==e.rowNumber&&void 0!==e.rowIndex?e.rowNumber<t.rowNumber||e.rowNumber===t.rowNumber&&e.rowIndex<t.rowIndex:e.index<t.rowNumber||e.index===t.rowNumber&&0<t.rowIndex}return!1}setLastFocus(e,t){this.lastFocus={target:e},t&&(this.lastFocus.name=t,(t=this.form.elements?.[t])&&(void 0!==t.rowNumber&&void 0!==t.rowIndex?(this.lastFocus.rowNumber=t.rowNumber,this.lastFocus.rowIndex=t.rowIndex):(this.lastFocus.rowNumber=t.index,this.lastFocus.rowIndex=0)))}isSection(e){return e?.type===FormElementTypes.SECTION}isAccordionSection(e){return this.isSection(e)&&"accordion-section"===e.format}isCollapsibleSection(e){return this.isSection(e)&&"collapsible-section"===e.format}getAllSectionElements(){const e={};for(const i in this.form.elements){var t=this.form.elements[i];this.isSection(t)&&(e[i]=t)}return e}getMutuallyExclusiveSectionGroup(t){let i=this.mutuallyExclusiveSections[t];if(!i){var e=this.find(t);if(!this.isAccordionSection(e))return;i=new MutuallyExclusiveSectionGroup({elementName:t,element:e});e=this.getAllSectionElements();const r=Object.keys(sortAndFilter(e,e=>e.rowNumber));t=r.indexOf(t);for(let e=t-1;0<=e;e--){const o=r[e];var s=this.find(o);if(!this.isAccordionSection(s))break;i.unshift({elementName:o,element:s})}for(let e=t+1;e<r.length;e++){const o=r[e];var n=this.find(o);if(!this.isAccordionSection(n))break;i.push({elementName:o,element:n})}i.forEach(e=>{this.mutuallyExclusiveSections[e.elementName]=i})}return i}updateAccordionSections(t){const e=this.getMutuallyExclusiveSectionGroup(t);e.forEach(e=>{e.element.collapsed=e.elementName!==t}),this.refresh()}enforceAccordionConstraints(){const e=[];for(const i of Object.keys(this.form.elements).map(e=>({elementName:e,element:this.form.elements[e]})).filter(e=>this.isAccordionSection(e.element)&&!1!==e.element.visible&&!0!==e.element.collapsed).sort((e,t)=>e.element.rowNumber-t.element.rowNumber)){var t=this.getMutuallyExclusiveSectionGroup(i.elementName);-1===e.indexOf(t)?e.push(t):i.element.collapsed=!0}}async displayDialog(e,t){await Promise.resolve()}}export{defs,FormHost};
1
+ import Bluebird from"bluebird";import{Task}from"../Task.js";import{DEFAULT_LOCALE}from"../constants.js";import*as defs from"./FormDefinition.js";import MutuallyExclusiveSectionGroup from"./MutuallyExclusiveSectionGroup.js";import NumberParser from"./NumberParser.js";import{FormElementTypes}from"./constants.js";import{format}from"./numberFormatter.js";import*as presenter from"./presenter.js";import{isAccordionSection,isCollapsibleSection,isSection,sortAndFilter,text}from"./utils.js";const guid="C0166F74-982A-464E-9FB6-9605CB7649C1:",eventName=guid+"FormEvent";function createEvent(e,t){return new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:t})}function overlay(i,s){switch(typeof i){case"boolean":case"number":case"string":return i;case"object":break;default:return s}if(null===i)return s;if(i instanceof Array){let e=s;void 0!==e&&null!==e||(e=[]);let t=0;for(const r of i){var n=overlay(r,e[t]);void 0!==n&&(t<i.length?e[t]=n:e.push(n),++t)}return e}let e=s;void 0===e&&(e={});for(const t in i)e[t]=overlay(i[t],e[t]);return e}function createSubscription(e){function t(){return void 0!==e&&(t.active=!1,e(),!0)}return t.active=!0,t}class FormHost{constructor(){this.form={defaults:{},elements:{}},this.errors={},this.refs={},this.enabled=!1,this.visible=!1,this.dismiss=!1,this.custom=!1,this.container=document.createElement("div"),this.eventIndex=0,this.eventQueue=[],this.mutuallyExclusiveSections={},this.nextFocus=!1,this.nextRefresh=!1}deriveLocale(){return DEFAULT_LOCALE}mount(){var e=this.container,t=e.parentNode;null==t&&document.body.appendChild(e),this.update()}unmount(){var e=this.container;const t=e.parentNode;void 0!==t&&null!==t&&t.removeChild(e)}observeFocus(e){this.enabled&&e instanceof HTMLElement&&(this.lastFocus&&this.lastFocus.target===e||this.setLastFocus(e))}focus(e){!0===(e=null==e?!1:e)&&(this.lastFocus=void 0),!1===e&&!1===(e=this.nextFocus)&&(e=!0),this.nextFocus=e,this.invalidate(!0!==e?e:void 0)}show(){const e=this.container;if(void 0===e)return!1;this.custom||void 0!==this.focusObserver||e.addEventListener("focus",this.focusObserver=e=>this.observeFocus(e.target),!0),this.enabled||(this.nextRefresh=!0,this.focus()),this.enforceAccordionConstraints();var t=this.errors;for(const i in t){const s=this.form.elements[i];void 0!==s&&null!==s&&(s.error=t[i],this.invalidate(i))}return this.idle(),!1!==this.nextRefresh&&(this.enabled=!0,this.visible=!0,this.mount()),this.enabled}isInvalid(e){return!!e.error&&!1!==e.visible}getInvalidElements(){return Object.keys(this.form.elements).map(e=>this.form.elements[e]).filter(this.isInvalid)}hasInvalidChild(e){for(const i in this.form.elements){var t=this.form.elements[i];if(this.isInvalid(t)&&this.getParentSection(t)===e)return!0}return!1}spin(){return void 0!==this.container&&(this.idle(),this.visible&&!this.enabled||(this.nextRefresh=!0,this.enabled=!1,this.visible=!0,this.mount()),this.visible)}hide(){return void 0!==this.container&&(this.idle(),this.visible&&(this.enabled=!1,this.visible=!1,this.unmount()),!0)}dispose(){if(this.dismiss)return!1;{this.dismiss=!0;const t=this.container;t.dispatchEvent(createEvent(eventName));var e=this.focusObserver;return void 0!==e&&t.removeEventListener("focus",e,!0),this.idle(),this.unmount(),this.refs={},presenter.releaseForm(this.container),this.container=void 0,this.lastFocus=void 0,!(this.eventTask=void 0)}}renderFocus(e,t){var i=this.nextFocus;if(this.enabled&&e instanceof HTMLElement)if(!1!==i)if(void 0!==t){if(t===i||!0===i&&void 0===this.lastFocus)return this.nextFocus=!1,this.setLastFocus(e,t),e.focus(),!0}else{const s=this.lastFocus?.target;if(!0===i&&s instanceof HTMLElement&&e.contains(s))return this.nextFocus=!1,s.focus(),!0}else if(!1===i&&t&&t!==this.lastFocus?.name&&this.isElementPositionBeforeLastFocused(t))return this.setLastFocus(e,t),e.focus(),!0;return!1}renderHtml(e,t){return"string"==typeof e?text.textToHtml(e):text.isMarkdown(e)?text.markdownToSafeHtml(e.markdown,{inline:t===defs.HTMLContentCategory.Phrasing}):""}renderText(e){return"string"==typeof e?e:text.isMarkdown(e)?text.markdownToText(e.markdown):""}translateText(e){return"string"==typeof e||text.isMarkdown(e)?e:text.isStatus(e)?e.status:void 0}renderVisual(e){return presenter.render(e)||presenter.renderNone(e)}qualifyDefault(e){var t=sortAndFilter(this.form.elements);for(const r in t){var i=t[r];if(null!=i&&!1!==i.visible&&i.enabled){if(i.default)return e.value=i.value,r;var s=sortAndFilter(i.items);if(null!=s)for(const o in s){var n=s[o];if(null!=n&&n.visible&&n.enabled&&n.default)return e.item=o,e.value=n.value,r}}}}qualify(e,t){var i;return null==t&&(t={}),"clicked"===e&&void 0===t.name&&(t.name=this.qualifyDefault(t)),t.type=e,void 0===t.routingKey&&(i=t.name,t.routingKey=void 0!==i?e+"$"+i:e),t}post(e,t){t=this.publish(e,t);const i=this.container;void 0!==i&&i.dispatchEvent(createEvent(eventName,t))}subscribe(e){let i=e;const t=this.container;if(void 0===t)return createSubscription();const s=function(){i=void 0,t.removeEventListener(eventName,n)},n=function(e){const t=e.detail;void 0!==t?Bluebird.resolve().then(function(){"function"==typeof i&&i(t)}):s()};return t.addEventListener(eventName,n),createSubscription(s)}refresh(e){this.custom||("string"==typeof e?(e=this.refs[e],presenter.refresh(e)):(this.refs={},presenter.refreshForm(this,this.container)))}invalidate(e){const t=this.nextRefresh;"string"==typeof e&&!0!==t&&(!1===t?this.nextRefresh={[e]:!0}:t[e]=!0),void 0!==e&&!0!==e||(this.nextRefresh=!0),!1===e&&!1===t&&(this.nextRefresh={})}update(){var e=this.nextRefresh;if(!0===e&&(this.nextRefresh=!1,this.refresh()),"object"==typeof e){this.nextRefresh=!1;for(const t in e)!0===e[t]&&this.refresh(t)}}idle(){const e=this.timerHandle;void 0!==e&&(this.timerHandle=void 0,e())}busy(){if(void 0===this.timerHandle&&void 0!==this.container){let e=setTimeout(()=>this.spin());this.timerHandle=function(){void 0!==e&&(clearTimeout(e),e=void 0)}}}publish(e,t){return this.enabled?(t=this.enqueue(e,t),0<this.eventQueue.length&&this.spin(),t):this.qualify(e,t)}enqueue(e,t){return t=this.qualify(e,t),void 0!==this.eventTask?(this.resolveEvent(t),this.eventTask=void 0):this.eventQueue.push(t),t}dequeue(){const e=this.eventQueue;if(0<e.length){var t=this.eventIndex,i=e[t++];return t>=e.length?e.length=this.eventIndex=0:this.eventIndex=t,i}}observe(){const t=this;return Bluebird.attempt(function(){if(void 0!==t.eventTask)return t.eventTask;var e=t.dequeue();return void 0!==e?e:t.show()?(t.eventTask=new Task(e=>{t.resolveEvent=e}),t.eventTask):void 0})}load(e,t){if(void 0===this.container)return!1;if(this.eventQueue.length=this.eventIndex=0,this.eventTask=void 0,this.errors={},this.lastFocus=void 0,this.nextFocus=!0,this.nextRefresh=!0,this.enqueue("load"),this.enqueue("prepare"),null!=e){e=overlay(e,e={defaults:{},elements:{}});this.form=overlay(t,e);for(const i in this.form.elements){let e=this.form.elements[i];if(e=overlay(e,{showFilter:!1,checked:!1,enabled:!0,hoisted:!1,visible:!0,overlay:!1,default:!1,validates:!1,readOnly:!1,require:!1,autoActivate:!1}),e.items)for(const s in e.items)e.items[s]=overlay(e.items[s],{enabled:!0,checked:!1,visible:!0,default:!1,validates:!1});this.form.elements[i]=e}}return!0}route(e){switch(e.type){case"changed":return this.cascade(e.name);case"prepare":return this.hydrate(e);case"suggest":return this.suggest(e);case"clicked":return this.click(e);case"validate":return this.verify(e);case"verify":return this.submit(e);case"checked":return this.changed(e)}return!1}changed(e){return this.enqueue("changed",{name:e.name,item:e.item,value:e.value}),!0}isElementValid(e,t=!0,i={status:void 0}){return null!=e&&(i.status=void 0,text.isInvalidError(e.error)?!(i.status="invalid"):!0!==e.require||(this.isElementEffectivelyVisible(e)?!!this.isElementValueDefined(e)||!(i.status="missing"):t))}isElementEffectivelyVisible(e){return null!=e&&(!1!==this.getParentSection(e)?.visible&&!1!==e.visible)}isElementValueDefined(e){if(null==e)return!1;if(e.type===FormElementTypes.CHECKBOX)return!0;var t=e.current;if(null!=t)return!0;t=e.value;if(null!=t&&""!==t)return!0;if(e.type!==FormElementTypes.SIGNATURE){t=e.label;if(null!=t&&""!==t)return!0}var i=e.items;if(null!=i)for(const n in i){var s=i[n];if(null!=s&&!0===s.checked)return!0}return!1}trap(e){switch(e.type){case"populate":case"load":case"suggest":break;default:return!1}var t=e.name;const i=this.find(t);if(void 0===i||null===i)return!1;e=i.dependsOn;if("string"!=typeof e)return!1;e=this.find(e);return i.enabled=this.isElementEffectivelyVisible(e)&&this.isElementValueDefined(e),this.invalidate(t),!i.enabled}cascade(e){var t=this.find(e);if(null==t||!1===t.dependsOn)return!1;const i={[e]:!0};var s=sortAndFilter(this.form.elements);for(const r in s){const o=s[r];var n=o.dependsOn;if("string"==typeof n){const l=this.find(n);void 0!==l&&"string"!=typeof l.dependsOn&&(l.dependsOn=!0),!0===i[n]&&(i[r]=!0,o.checked=!1,o.current=void 0,o.label=void 0,o.items=void 0,o.value=void 0,this.invalidate(r),o.dependsOn===e&&this.enqueue("populate",{name:r}))}else o.dependsOn=!1}return!0}click(e){var t=this.form.elements[e.name];return null!=t&&t.type==FormElementTypes.BUTTONBAR&&this.validate(e)}hasInitialSelectionToDependOn(e){e=this.form.elements[e];return e.type===FormElementTypes.DROPDOWNLIST&&(void 0!==e.current&&null!==e.current)}hydrate(e){for(const i in sortAndFilter(this.form.elements)){var t=this.form.elements[i].dependsOn;"string"==typeof t&&!this.hasInitialSelectionToDependOn(t)||this.enqueue("populate",{name:i}),this.enqueue("load",{name:i})}return!0}shouldTriggerValidation(e){var t=this.find(e.name);if(null!=t&&"string"==typeof e.value){e=e.item;if("string"!=typeof e)return!0===t.validates;t=t.items;if(null!=t){e=t[e];if(null!=e)return!0===e.validates}}}validate(e){var t=this.shouldTriggerValidation(e);if(!0!==t)return!1===t&&(this.enqueue("end",{name:e.name,item:e.item,value:e.value,routingKey:"end"}),!0);{const n=this.errors={};var i=sortAndFilter(this.form.elements);for(const r in i){var s=i[r];null!=s&&(n[r]=void 0,this.enqueue("validate",{name:r}))}return this.enqueue("verify",{name:e.name,item:e.item,value:e.value,routingKey:"verify"}),!0}}verify(e){var t=e.name,i=this.form.elements[t],e={status:void 0};return!this.isElementValid(i,!0,e)&&(e.status&&(this.errors[t]={status:e.status}),!1===this.nextFocus&&this.focus(t),!0)}suggest(e){const t=this.form.elements[e.name];return void 0!==t&&null!==t&&(t.items={message:{label:{status:"trivial"},enabled:!1}},this.invalidate(e.name),!0)}submit(e){if(!this.hasErrors()){for(const r in this.form.elements)this.form.elements[r].error=void 0;return this.enqueue("submit",{name:e.name,item:e.item,value:e.value}),!0}var t=this.errors;for(const o in t){const l=this.form.elements[o];void 0!==l&&null!==l&&(l.error=t[o],this.invalidate(o))}const i=[];let s=!1;for(const a of this.getInvalidElements()){const u=this.getParentSection(a);if(isAccordionSection(u)){var n=this.findName(u);const h=this.getMutuallyExclusiveSectionGroup(n);if(h){const c=i.find(e=>e.group===h);c?c.element.rowNumber>u.rowNumber&&(c.element=u):(i.push({group:h,element:u}),s=!0)}}else this.isSectionCollapsed(u)&&(u.collapsed=!1,s=!0)}for(const d of i)d.group.expandedSection=d.element;return s&&this.invalidate(),!(this.errors={})}hasErrors(){var e=this.errors;for(const i in e){var t=e[i];if(null!=t)return!0}return!1}find(e){if(null!=e)return"string"==typeof(e="object"==typeof e?e.name:e)?this.form.elements[e]:void 0}findName(e){for(const t in this.form.elements)if(this.form.elements[t]===e)return t}coerceNumber(e){var t=this.deriveLocale();return new NumberParser(t).parse(e)}formatNumber(e,t){return t=t||{locale:this.deriveLocale()},format(t,e)}renderState(e,t,i){return!1}getParentSection(e){e=e.section;if(e){e="string"==typeof e?e:e.name;return this.form.elements[e]}}isSectionCollapsed(e){return!(!e||e.type!==FormElementTypes.SECTION||!isCollapsibleSection(e)&&!isAccordionSection(e))&&!0===e.collapsed}isElementPositionBeforeLastFocused(e){var t=this.lastFocus;if(!t)return!0;if("footer"===e)return!1;if("footer"===t.name)return!0;if(e&&void 0!==t?.rowNumber&&void 0!==t.rowIndex){e=this.form.elements?.[e];if(e)return void 0!==e.rowNumber&&void 0!==e.rowIndex?e.rowNumber<t.rowNumber||e.rowNumber===t.rowNumber&&e.rowIndex<t.rowIndex:e.index<t.rowNumber||e.index===t.rowNumber&&0<t.rowIndex}return!1}setLastFocus(e,t){this.lastFocus={target:e},t&&(this.lastFocus.name=t,(t=this.form.elements?.[t])&&(void 0!==t.rowNumber&&void 0!==t.rowIndex?(this.lastFocus.rowNumber=t.rowNumber,this.lastFocus.rowIndex=t.rowIndex):(this.lastFocus.rowNumber=t.index,this.lastFocus.rowIndex=0)))}getAllSectionElements(){const e={};for(const i in this.form.elements){var t=this.form.elements[i];isSection(t)&&(e[i]=t)}return e}getMutuallyExclusiveSectionGroup(t){let i=this.mutuallyExclusiveSections[t];if(!i){var e=this.find(t);if(!isAccordionSection(e))return;i=new MutuallyExclusiveSectionGroup({elementName:t,element:e});e=this.getAllSectionElements();const r=Object.keys(sortAndFilter(e,e=>e.rowNumber));t=r.indexOf(t);for(let e=t-1;0<=e;e--){const o=r[e];var s=this.find(o);if(!isAccordionSection(s))break;i.unshift({elementName:o,element:s})}for(let e=t+1;e<r.length;e++){const o=r[e];var n=this.find(o);if(!isAccordionSection(n))break;i.push({elementName:o,element:n})}i.forEach(e=>{this.mutuallyExclusiveSections[e.elementName]=i})}return i}updateAccordionSections(t){const e=this.getMutuallyExclusiveSectionGroup(t);e.forEach(e=>{e.element.collapsed=e.elementName!==t}),this.refresh()}enforceAccordionConstraints(){const e=[];for(const i of Object.keys(this.form.elements).map(e=>({elementName:e,element:this.form.elements[e]})).filter(e=>isAccordionSection(e.element)&&!1!==e.element.visible&&!0!==e.element.collapsed).sort((e,t)=>e.element.rowNumber-t.element.rowNumber)){var t=this.getMutuallyExclusiveSectionGroup(i.elementName);-1===e.indexOf(t)?e.push(t):i.element.collapsed=!0}}async displayDialog(e,t){await Promise.resolve()}}export{defs,FormHost};
@@ -1,74 +1,62 @@
1
- import { FormComponent } from "./FormComponent";
2
- import * as defs from "./FormDefinition";
3
- import { FormatOptions } from "./numberFormatter";
4
- import type { ComponentType, ReactNode } from "react";
5
- /**
6
- * Exposes various features to components that require features of the environment.
7
- * @product This is intended for internal use only within VertiGIS Studio products.
8
- */
9
- export interface FormPresenterHost {
10
- /** Indicates if the form is enabled or not. */
11
- enabled: boolean;
12
- /** The form to render. */
13
- form: defs.Form;
14
- /** Posts an event. */
15
- post(type: "changed" | "cancel" | "clicked" | "custom" | "dragged" | "suggest", event?: defs.Event): void;
16
- /** Disposes the form. */
17
- dispose(): void;
18
- /** Translates the supplied value. */
19
- translateText(content: defs.Text | undefined): string | defs.MarkdownRef | undefined;
20
- /** References all elements. */
21
- refs: {
22
- [name: string]: FormComponent | undefined;
23
- };
24
- /** Renders the focus. */
25
- renderFocus(target: Node, name?: string): boolean;
26
- /** Renders form text to HTML. */
27
- renderHtml(text: defs.Text, htmlContentCategory?: defs.HTMLContentCategory): string;
28
- /** Renders form text to display text. */
29
- renderText(text: defs.Text | undefined): string;
30
- /** Renders a component's visual. */
31
- renderVisual(component: {}): any;
32
- /** Renders a component's state. */
33
- renderState(name: string, type: "geometry", state?: defs.GeometryState[]): boolean;
34
- /** Renders a component's state. */
35
- renderState(name: string, type: string, state?: {}): boolean;
36
- /** Find the element. */
37
- find(name: string | {
38
- name: string;
39
- }): defs.Element;
40
- /** Coerces a number from a value. */
41
- coerceNumber(value: string): number;
42
- /** Formats a value into a string. */
43
- formatNumber(value: number, options?: FormatOptions): string;
44
- /**
45
- * Derives the current locale set by the host application (or default if undefined) will be returned.
46
- */
47
- deriveLocale(): string;
48
- /**
49
- * Collapses all neighbouring accordion sections except the one specified.
50
- * @param expandedAccordionSection The name of the accordion section to be expanded. All others in the group will be collapsed.
51
- */
52
- updateAccordionSections(expandedAccordionSection: string): void;
53
- /**
54
- * Returns `true` if the element has a `type` of `"Section"` and a `format` of `"accordion-section"`, `false` otherwise.
55
- * @param element The element to be inspected.
56
- */
57
- isAccordionSection(element: defs.Element): boolean;
58
- /**
59
- * Returns `true` if the element has a `type` of `"Section"` and a `format` of `"collapsible-section"`, `false` otherwise.
60
- * @param element The element to be inspected.
61
- */
62
- isCollapsibleSection(element: defs.Element): boolean;
63
- /**
64
- * Shows a dialog in the context of the running application.
65
- * @param children A function that produces the children for the dialog.
66
- * @param DialogComponent The type of component to use as the dialog.
67
- */
68
- displayDialog(children: (closeDialog: () => void) => ReactNode, DialogComponent: ComponentType<any>): Promise<void>;
69
- /**
70
- * Returns `true` if the element has a `type` of `"Section"` and at least one visible child with `error` equal to `true`.
71
- * @param element
72
- */
73
- hasInvalidChild(element: defs.Element): boolean;
74
- }
1
+ import { FormComponent } from "./FormComponent";
2
+ import * as defs from "./FormDefinition";
3
+ import { FormatOptions } from "./numberFormatter";
4
+ import type { ComponentType, ReactNode } from "react";
5
+ /**
6
+ * Exposes various features to components that require features of the environment.
7
+ * @product This is intended for internal use only within VertiGIS Studio products.
8
+ */
9
+ export interface FormPresenterHost {
10
+ /** Indicates if the form is enabled or not. */
11
+ enabled: boolean;
12
+ /** The form to render. */
13
+ form: defs.Form;
14
+ /** Posts an event. */
15
+ post(type: "changed" | "cancel" | "clicked" | "custom" | "dragged" | "suggest", event?: defs.Event): void;
16
+ /** Disposes the form. */
17
+ dispose(): void;
18
+ /** Translates the supplied value. */
19
+ translateText(content: defs.Text | undefined): string | defs.MarkdownRef | undefined;
20
+ /** References all elements. */
21
+ refs: Record<string, FormComponent | undefined>;
22
+ /** Renders the focus. */
23
+ renderFocus(target: Node, name?: string): boolean;
24
+ /** Renders form text to HTML. */
25
+ renderHtml(text: defs.Text, htmlContentCategory?: defs.HTMLContentCategory): string;
26
+ /** Renders form text to display text. */
27
+ renderText(text: defs.Text | undefined): string;
28
+ /** Renders a component's visual. */
29
+ renderVisual(component: {}): any;
30
+ /** Renders a component's state. */
31
+ renderState(name: string, type: "geometry", state?: defs.GeometryState[]): boolean;
32
+ /** Renders a component's state. */
33
+ renderState(name: string, type: string, state?: {}): boolean;
34
+ /** Find the element. */
35
+ find(name: string | {
36
+ name: string;
37
+ } | undefined): defs.Element | undefined;
38
+ /** Coerces a number from a value. */
39
+ coerceNumber(value: string): number;
40
+ /** Formats a value into a string. */
41
+ formatNumber(value: number, options?: FormatOptions): string;
42
+ /**
43
+ * Derives the current locale set by the host application (or default if undefined) will be returned.
44
+ */
45
+ deriveLocale(): string;
46
+ /**
47
+ * Collapses all neighbouring accordion sections except the one specified.
48
+ * @param expandedAccordionSection The name of the accordion section to be expanded. All others in the group will be collapsed.
49
+ */
50
+ updateAccordionSections(expandedAccordionSection: string): void;
51
+ /**
52
+ * Shows a dialog in the context of the running application.
53
+ * @param children A function that produces the children for the dialog.
54
+ * @param DialogComponent The type of component to use as the dialog.
55
+ */
56
+ displayDialog(children: (closeDialog: () => void) => ReactNode, DialogComponent: ComponentType<any>): Promise<void>;
57
+ /**
58
+ * Returns `true` if the element has a `type` of `"Section"` and at least one visible child with `error` equal to `true`.
59
+ * @param element
60
+ */
61
+ hasInvalidChild(element: defs.Element): boolean;
62
+ }
@@ -1,41 +1,41 @@
1
- import * as defs from "./FormDefinition";
2
- /**
3
- * The definition of a Form Element along with its name.
4
- */
5
- export declare type ElementKeyValuePair = {
6
- /** The name of the form element as defined in the form. */
7
- elementName: string;
8
- /** The implementation of the element itself. */
9
- element: defs.Element;
10
- };
11
- /**
12
- * This facilitates the lookup of related Section form elements, for cases where
13
- * mutually-exclusive operations must be performed, such as expand/collapse.
14
- *
15
- * You can use the name of a known Section form element to find all of the other Section form elements in the same group.
16
- * This is only relevant to special types of section that care about mutual exclusion. Regular sections are not added here.
17
- *
18
- * The key is the name of a Section form element.
19
- * The value is an object representing all elements in the same run as the named one.
20
- * The value has its own keys and values to keep track of both the names and actual elements.
21
- *
22
- * The same value is present for all elements in the run, to facilitate faster lookup.
23
- * The element objects are included as well as the names to avoid the need for extra lookup.
24
- */
25
- export default class MutuallyExclusiveSectionGroup extends Array<ElementKeyValuePair> {
26
- /**
27
- * Gets the currently expanded section in this group.
28
- * if none are expanded, this returns undefined.
29
- */
30
- get expandedSection(): defs.Element;
31
- /**
32
- * Sets the currently expanded section in this group.
33
- * All others are collapsed.
34
- */
35
- set expandedSection(element: defs.Element);
36
- getElement(elementName: string): defs.Element;
37
- /**
38
- * Gets a value indicating if a section is currently expanded in this group.
39
- */
40
- get hasExpandedSection(): boolean;
41
- }
1
+ import * as defs from "./FormDefinition";
2
+ /**
3
+ * The definition of a Form Element along with its name.
4
+ */
5
+ export type ElementKeyValuePair = {
6
+ /** The name of the form element as defined in the form. */
7
+ elementName: string;
8
+ /** The implementation of the element itself. */
9
+ element: defs.Element;
10
+ };
11
+ /**
12
+ * This facilitates the lookup of related Section form elements, for cases where
13
+ * mutually-exclusive operations must be performed, such as expand/collapse.
14
+ *
15
+ * You can use the name of a known Section form element to find all of the other Section form elements in the same group.
16
+ * This is only relevant to special types of section that care about mutual exclusion. Regular sections are not added here.
17
+ *
18
+ * The key is the name of a Section form element.
19
+ * The value is an object representing all elements in the same run as the named one.
20
+ * The value has its own keys and values to keep track of both the names and actual elements.
21
+ *
22
+ * The same value is present for all elements in the run, to facilitate faster lookup.
23
+ * The element objects are included as well as the names to avoid the need for extra lookup.
24
+ */
25
+ export default class MutuallyExclusiveSectionGroup extends Array<ElementKeyValuePair> {
26
+ /**
27
+ * Gets the currently expanded section in this group.
28
+ * if none are expanded, this returns undefined.
29
+ */
30
+ get expandedSection(): defs.Element | undefined;
31
+ /**
32
+ * Sets the currently expanded section in this group.
33
+ * All others are collapsed.
34
+ */
35
+ set expandedSection(element: defs.Element | undefined);
36
+ getElement(elementName: string): defs.Element | undefined;
37
+ /**
38
+ * Gets a value indicating if a section is currently expanded in this group.
39
+ */
40
+ get hasExpandedSection(): boolean;
41
+ }
@@ -1,26 +1,27 @@
1
- /**
2
- * Parses a number based on the specified locale.
3
- *
4
- * WARNING: This technique assumes a positional number system, which isn't always the case for every locale (e.g. Hebrew, Korean).
5
- * It seems though that at the moment, in all major browsers, `Intl.NumberFormat` will format these non-positional number systems
6
- * using Western Arabic numerals ("123..."), so this works for now. But if any browser ever implements proper
7
- * number system support for these locales, then this algorithm will no longer parse those locales properly.
8
- */
9
- export default class NumberParser {
10
- private _group;
11
- private _decimal;
12
- private _minus;
13
- private _numeral;
14
- private _index;
15
- /**
16
- * Creates a new instance of the {@link NumberParser} class.
17
- * @param locale The locale to use for parsing the text.
18
- */
19
- constructor(locale: string);
20
- /**
21
- * Parses a localized string representation of a number and returns the numeric value.
22
- * @param str A localized string representation of a number.
23
- * @returns The numeric value of the string.
24
- */
25
- parse(str: string): number;
26
- }
1
+ /**
2
+ * Parses a number based on the specified locale.
3
+ *
4
+ * WARNING: This technique assumes a positional number system, which isn't always the case for every locale (e.g. Hebrew, Korean).
5
+ * It seems though that at the moment, in all major browsers, `Intl.NumberFormat` will format these non-positional number systems
6
+ * using Western Arabic numerals ("123..."), so this works for now. But if any browser ever implements proper
7
+ * number system support for these locales, then this algorithm will no longer parse those locales properly.
8
+ */
9
+ export default class NumberParser {
10
+ private _biDirectionalChars;
11
+ private _group;
12
+ private _decimal;
13
+ private _minus;
14
+ private _numeral;
15
+ private _index;
16
+ /**
17
+ * Creates a new instance of the {@link NumberParser} class.
18
+ * @param locale The locale to use for parsing the text.
19
+ */
20
+ constructor(locale: string);
21
+ /**
22
+ * Parses a localized string representation of a number and returns the numeric value.
23
+ * @param str A localized string representation of a number.
24
+ * @returns The numeric value of the string.
25
+ */
26
+ parse(str: string): number;
27
+ }
@@ -1 +1 @@
1
- export default class NumberParser{constructor(e){const r=new Intl.NumberFormat(e).formatToParts(-12345.6),t=Array.from(new Intl.NumberFormat(e,{useGrouping:!1}).format(9876543210)).reverse(),i=new Map(t.map((e,r)=>[e,r.toString()]));this._group=new RegExp(`[${r.find(e=>"group"===e.type).value}]`,"g"),this._decimal=new RegExp(`[${r.find(e=>"decimal"===e.type).value}]`),this._minus=new RegExp(`[${r.find(e=>"minusSign"===e.type).value}]`),this._numeral=new RegExp(`[${t.join("")}]`,"g"),this._index=e=>i.get(e)}parse(e){e=e.trim().replace(this._group,"").replace(this._decimal,".").replace(this._minus,"-").replace(this._numeral,this._index);return e?+e:NaN}}
1
+ export default class NumberParser{constructor(e){this._biDirectionalChars=/[\u061c\u200E\u200F]/;const r=new Intl.NumberFormat(e).formatToParts(-12345.6),i=Array.from(new Intl.NumberFormat(e,{useGrouping:!1}).format(9876543210)).reverse(),t=new Map(i.map((e,r)=>[e,r.toString()]));this._group=new RegExp(`[${r.find(e=>"group"===e.type).value}]`,"g"),this._decimal=new RegExp(`[${r.find(e=>"decimal"===e.type).value}]`),this._minus=new RegExp(`[${r.find(e=>"minusSign"===e.type).value}]`),this._numeral=new RegExp(`[${i.join("")}]`,"g"),this._index=e=>t.get(e)}parse(e){e=e.trim().replace(this._biDirectionalChars,"").replace(this._group,"").replace(this._decimal,".").replace(this._minus,"-").replace(this._numeral,this._index);return e?+e:NaN}}
package/forms/common.d.ts CHANGED
@@ -1,62 +1,67 @@
1
- import { ReactNode } from "react";
2
- import { FormPresenterHost } from "./FormComponent";
3
- import { defs } from "./FormHost";
4
- export declare function getTitleId(elementId: string): string;
5
- export declare function getDescriptionId(elementId: string): string;
6
- export declare function getErrorId(elementId: string): string;
7
- /**
8
- * Renders the title for a Form Element.
9
- * @param host The form host.
10
- * @param element The Form Element being represented.
11
- * @param elementId The id of the DOM element representing the Form Element.
12
- * @param inputId (optional) The id of the DOM element representing the main input for the Form Element.
13
- * When specified, the title is marked as "for" that DOM element.
14
- * @returns A title component, or `null` if there is no title.
15
- */
16
- export declare function renderTitle(host: FormPresenterHost, element: defs.Element, elementId: string, inputId?: string): JSX.Element;
17
- /**
18
- * Renders the description for a Form Element.
19
- * @param host The form host.
20
- * @param element The Form Element being represented.
21
- * @param elementId The id of the DOM element representing the Form Element.
22
- * @returns A description component, or `null` if there is no description.
23
- */
24
- export declare function renderDescription(host: FormPresenterHost, element: defs.Element, elementId: string, className?: string): JSX.Element;
25
- /**
26
- * Renders the accessible description for a Form Element.
27
- * @param host The form host.
28
- * @param element The Form Element being represented.
29
- * @param elementId The id of the DOM element representing the Form Element.
30
- * @returns An accessible description component, or `null` if there is no accessible description or description.
31
- */
32
- export declare function renderAccessibleDescription(host: FormPresenterHost, element: defs.Element, elementId: string): JSX.Element;
33
- /**
34
- * Renders the error for a Form Element.
35
- * @param host The form host.
36
- * @param element The Form Element being represented.
37
- * @returns An error component, or `null` if there is no error.
38
- */
39
- export declare function renderError(host: FormPresenterHost, element: defs.Element): JSX.Element;
40
- /**
41
- * Asks the host to focus the provided element when the form is initially shown.
42
- * Ignores the specified target if it is null or disabled.
43
- *
44
- * NOTE: Some elements contain more elaborate forms of this element.
45
- * For simplicity, this one replaces the basic cases which were all identical.
46
- * @param target The HTML Element to receive focus.
47
- * @param name The name of the Form Element.
48
- * @param host The form presenter host.
49
- */
50
- export declare function renderFocus(target: (HTMLElement & {
51
- disabled?: boolean | undefined;
52
- }) | null, name: string | undefined, host: FormPresenterHost): void;
53
- /**
54
- * Returns a memoized function which asks the host to focus the provided element when the form is
55
- * initially shown. Ignores the specified target if it is null or disabled.
56
- * @param component The form component
57
- * @returns A memoized function that focuses a target HTML element.
58
- */
59
- export declare function useFocusCallback(enabled: boolean, name: string | undefined, renderFocus: (target: Node, name?: string) => boolean): (target: (ReactNode & {
60
- disabled?: boolean;
61
- thumbRefs?: any[];
62
- }) | null) => void;
1
+ import { ReactNode } from "react";
2
+ import { FormPresenterHost } from "./FormComponent";
3
+ import { defs } from "./FormHost";
4
+ export declare function getTitleId(elementId: string): string;
5
+ export declare function getDescriptionId(elementId: string): string;
6
+ export declare function getErrorId(elementId: string): string;
7
+ export type TranslateTextFunction = (content: defs.Text | undefined) => string | defs.MarkdownRef | undefined;
8
+ /**
9
+ * Renders the title for a Form Element.
10
+ * @param elementId The id of the DOM element representing the Form Element.
11
+ * When specified, the title is marked as "for" that DOM element.
12
+ * @param required Indicates if the element is a required field. If so, the title is rendered with an asterisk beside it.
13
+ * @param title The title of the element.
14
+ * @param translateText A function for translating text, replacing placeholders as well.
15
+ * @param inputId (optional) The id of the DOM element representing the main input for the Form Element.
16
+ * @returns A title component, or `null` if there is no title.
17
+ */
18
+ export declare function renderTitle(elementId: string, required: boolean | undefined, title: defs.Text | undefined, translateText: TranslateTextFunction, inputId?: string): JSX.Element | null;
19
+ /**
20
+ * Renders the description for a Form Element.
21
+ * @param description The description of the Form Element.
22
+ * @param elementId The id of the DOM element representing the Form Element.
23
+ * @param enabled True if the Form Element is enabled, false otherwise.
24
+ * @param translateText A function for translating text, replacing placeholders as well.
25
+ * @param className (optional) A class name to add to the component.
26
+ * @returns A description component, or `null` if there is no description.
27
+ */
28
+ export declare function renderDescription(description: defs.Text | undefined, elementId: string, enabled: boolean | undefined, translateText: TranslateTextFunction, className?: string): JSX.Element | null;
29
+ /**
30
+ * Renders the accessible description for a Form Element.
31
+ * @param accessibleDescription The element's accessible description.
32
+ * @param description The element's description.
33
+ * @param elementId The element's id.
34
+ * @param translateText The translate text function.
35
+ * @returns An accessible description component, or `null` if there is no accessible description or description.
36
+ */
37
+ export declare function renderAccessibleDescription(accessibleDescription: string | undefined, description: defs.Text | undefined, elementId: string, translateText: TranslateTextFunction): JSX.Element | null;
38
+ /**
39
+ * Renders the error for a Form Element.
40
+ * @param error The error to be rendered.
41
+ * @param translateText The translate text function.
42
+ * @returns An error component, or `null` if there is no error.
43
+ */
44
+ export declare function renderError(error: defs.Text | undefined, translateText: TranslateTextFunction): JSX.Element | null;
45
+ /**
46
+ * Asks the host to focus the provided element when the form is initially shown.
47
+ * Ignores the specified target if it is null or disabled.
48
+ *
49
+ * NOTE: Some elements contain more elaborate forms of this element.
50
+ * For simplicity, this one replaces the basic cases which were all identical.
51
+ * @param target The HTML Element to receive focus.
52
+ * @param name The name of the Form Element.
53
+ * @param host The form presenter host.
54
+ */
55
+ export declare function renderFocus(target: (HTMLElement & {
56
+ disabled?: boolean | undefined;
57
+ }) | null, name: string | undefined, host: FormPresenterHost): void;
58
+ /**
59
+ * Returns a memoized function which asks the host to focus the provided element when the form is
60
+ * initially shown. Ignores the specified target if it is null or disabled.
61
+ * @param component The form component
62
+ * @returns A memoized function that focuses a target HTML element.
63
+ */
64
+ export declare function useFocusCallback(enabled: boolean, name: string | undefined, renderFocus: (target: Node, name?: string) => boolean): (target: (ReactNode & {
65
+ disabled?: boolean;
66
+ thumbRefs?: any[];
67
+ }) | null) => void;
package/forms/common.js CHANGED
@@ -1 +1 @@
1
- import Box from"@vertigis/react-ui/Box";import FormHelperText from"@vertigis/react-ui/FormHelperText";import FormLabel from"@vertigis/react-ui/FormLabel";import{useCallback}from"react";import*as React from"react";import{formClasses}from"./components/Form.js";import Markdown from"./components/Markdown.js";import{hasContent,isMarkdown,markdownToText}from"./textUtilities.js";const ERROR_SUFFIX="-error",DESCRIPTION_SUFFIX="-description",TITLE_SUFFIX="-title";function getTitleId(e){return`${e}${TITLE_SUFFIX}`}function getDescriptionId(e){return`${e}${DESCRIPTION_SUFFIX}`}function getErrorId(e){return`${e}${ERROR_SUFFIX}`}function renderTitle(e,r,t,n){return hasContent(r.title)?React.createElement(FormLabel,{className:formClasses.formElementTitle,htmlFor:n,id:`${t}-label`,required:!!r.require},React.createElement(Markdown,{inline:!0,text:r.title,translateText:e.translateText.bind(e)})):null}function renderDescription(e,r,t,n){return hasContent(r.description)?React.createElement(FormHelperText,{className:n,component:"div",disabled:!r.enabled,error:!1,id:`${t}-description`},React.createElement(Markdown,{text:r.description,translateText:e.translateText.bind(e)})):null}function renderAccessibleDescription(e,r,t){let n=e.translateText(r.accessibleDescription);return n||(r=e.translateText(r.description),n=isMarkdown(r)?markdownToText(r.markdown):r),n?React.createElement(Box,{sx:{display:"none"},id:`${t}-accessible-description`},n):null}function renderError(e,r){return hasContent(r.error)?React.createElement(FormHelperText,{component:"div",error:!0,role:"alert"},React.createElement(Markdown,{text:r.error,translateText:e.translateText.bind(e)})):null}function renderFocus(e,r,t){null===e||e.disabled||t.renderFocus(e,r)}function useFocusCallback(e,r,t){return useCallback(e=>{null===(e=Array.isArray(e?.thumbRefs)&&0<e.thumbRefs.length?e.thumbRefs[0].current:e)||e.disabled||t(e,r)},[e,r,t])}export{getTitleId,getDescriptionId,getErrorId,renderTitle,renderDescription,renderAccessibleDescription,renderError,renderFocus,useFocusCallback};
1
+ import Box from"@vertigis/react-ui/Box";import FormHelperText from"@vertigis/react-ui/FormHelperText";import FormLabel from"@vertigis/react-ui/FormLabel";import{useCallback}from"react";import*as React from"react";import{formClasses}from"./components/Form.js";import Markdown from"./components/Markdown.js";import{hasContent,isMarkdown,markdownToText}from"./textUtilities.js";const ERROR_SUFFIX="-error",DESCRIPTION_SUFFIX="-description",TITLE_SUFFIX="-title";function getTitleId(e){return`${e}${TITLE_SUFFIX}`}function getDescriptionId(e){return`${e}${DESCRIPTION_SUFFIX}`}function getErrorId(e){return`${e}${ERROR_SUFFIX}`}function renderTitle(e,r,t,n,o){return hasContent(t)?React.createElement(FormLabel,{className:formClasses.formElementTitle,htmlFor:o,id:`${e}-label`,required:!!r},React.createElement(Markdown,{inline:!0,text:t,translateText:n})):null}function renderDescription(e,r,t,n,o){return hasContent(e)?React.createElement(FormHelperText,{className:o,component:"div",disabled:!t,error:!1,id:`${r}-description`},React.createElement(Markdown,{text:e,translateText:n})):null}function renderAccessibleDescription(e,r,t,n){let o=n(e);return o||(r=n(r),o=isMarkdown(r)?markdownToText(r.markdown):r),o?React.createElement(Box,{sx:{display:"none"},id:`${t}-accessible-description`},o):null}function renderError(e,r){return hasContent(e)?React.createElement(FormHelperText,{component:"div",error:!0,role:"alert"},React.createElement(Markdown,{text:e,translateText:r})):null}function renderFocus(e,r,t){null===e||e.disabled||t.renderFocus(e,r)}function useFocusCallback(e,r,t){return useCallback(e=>{null===(e=Array.isArray(e?.thumbRefs)&&0<e.thumbRefs.length?e.thumbRefs[0].current:e)||e.disabled||t(e,r)},[e,r,t])}export{getTitleId,getDescriptionId,getErrorId,renderTitle,renderDescription,renderAccessibleDescription,renderError,renderFocus,useFocusCallback};
@@ -1,15 +1,15 @@
1
- /// <reference types="react" />
2
- import { FormComponent } from "../FormComponent";
3
- interface AccordionGroupProps {
4
- /** The CSS class name of the root element. */
5
- className?: string;
6
- /**
7
- * The `FormComponent` being used to render the Form Elements within this Component.
8
- */
9
- component: FormComponent;
10
- }
11
- /**
12
- * This component contains a set of "Section" Form Elements with a `format` of `"accordion-section"`.
13
- */
14
- declare const AccordionGroup: ({ className, component }: AccordionGroupProps) => JSX.Element;
15
- export default AccordionGroup;
1
+ /// <reference types="react" />
2
+ import { FormComponent } from "../FormComponent";
3
+ interface AccordionGroupProps {
4
+ /** The CSS class name of the root element. */
5
+ className?: string;
6
+ /**
7
+ * The `FormComponent` being used to render the Form Elements within this Component.
8
+ */
9
+ component: FormComponent;
10
+ }
11
+ /**
12
+ * This component contains a set of "Section" Form Elements with a `format` of `"accordion-section"`.
13
+ */
14
+ declare const AccordionGroup: ({ className, component }: AccordionGroupProps) => JSX.Element;
15
+ export default AccordionGroup;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- import { FormElementProps } from "../..";
3
- import { defs } from "../FormHost";
4
- /**
5
- * The component for the "Auto Complete" Form Element.
6
- */
7
- declare const AutoComplete: ({ className, component, current, delay: elementDelay, element, enabled, error, items: elementItems, label, minLength: elementMinLength, name, prompt, tooltip, renderFocus, renderText, raiseEvent, setProperty, setValue, value, }: FormElementProps<defs.Value | undefined>) => JSX.Element;
8
- export default AutoComplete;
1
+ /// <reference types="react" />
2
+ import { FormElementProps } from "../..";
3
+ import { defs } from "../FormHost";
4
+ /**
5
+ * The component for the "Auto Complete" Form Element.
6
+ */
7
+ declare const AutoComplete: ({ className, component, current, delay: elementDelay, element, enabled, error, items: elementItems, label, minLength: elementMinLength, name, prompt, tooltip, renderFocus, renderText, raiseEvent, setProperty, setValue, value, }: FormElementProps<defs.Value | undefined>) => JSX.Element;
8
+ export default AutoComplete;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- import { FormElementProps } from "../..";
3
- import { defs } from "../FormHost";
4
- /**
5
- * The component for the "Button Bar" Form Element.
6
- */
7
- declare const ButtonBar: ({ className, component, element, enabled, items: elementItems, name, orientation, raiseEvent, renderFocus: hostRenderFocus, renderText, translateText, }: FormElementProps<defs.Value | undefined>) => JSX.Element;
8
- export default ButtonBar;
1
+ /// <reference types="react" />
2
+ import { FormElementProps } from "../..";
3
+ import { defs } from "../FormHost";
4
+ /**
5
+ * The component for the "Button Bar" Form Element.
6
+ */
7
+ declare const ButtonBar: ({ className, component, element, enabled, items: elementItems, name, orientation, raiseEvent, renderFocus: hostRenderFocus, renderText, translateText, }: FormElementProps<defs.Value | undefined>) => JSX.Element;
8
+ export default ButtonBar;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import { FormElementProps } from "../..";
3
- /**
4
- * The component for the "Check Box" Form Element.
5
- */
6
- declare const CheckBox: ({ checked, className, component, element, enabled, label, name, raiseEvent, renderFocus: hostRenderFocus, renderText, setProperty, tooltip: elementTooltip, translateText, value, }: FormElementProps) => JSX.Element;
7
- export default CheckBox;
1
+ /// <reference types="react" />
2
+ import { FormElementProps } from "../..";
3
+ /**
4
+ * The component for the "Check Box" Form Element.
5
+ */
6
+ declare const CheckBox: ({ checked, className, component, element, enabled, label, name, raiseEvent, renderFocus: hostRenderFocus, renderText, setProperty, tooltip: elementTooltip, translateText, value, }: FormElementProps) => JSX.Element;
7
+ export default CheckBox;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- import { FormElementProps } from "../..";
3
- import { defs } from "../FormHost";
4
- /**
5
- * The component for the "Check Group" Form Element.
6
- */
7
- declare const CheckGroup: ({ className, component, current, element, enabled, items: elementItems, name, orientation, raiseEvent, renderFocus: hostRenderFocus, renderText, setProperty, setValue, translateText, value, }: FormElementProps<defs.ItemsRef | undefined>) => JSX.Element;
8
- export default CheckGroup;
1
+ /// <reference types="react" />
2
+ import { FormElementProps } from "../..";
3
+ import { defs } from "../FormHost";
4
+ /**
5
+ * The component for the "Check Group" Form Element.
6
+ */
7
+ declare const CheckGroup: ({ className, component, current, element, enabled, items: elementItems, name, orientation, raiseEvent, renderFocus: hostRenderFocus, renderText, setProperty, setValue, translateText, value, }: FormElementProps<defs.ItemsRef | undefined>) => JSX.Element;
8
+ export default CheckGroup;