@vertigis/workflow 5.42.0 → 5.44.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 (227) hide show
  1. package/Activator.d.ts +2 -1
  2. package/Collections.d.ts +4 -3
  3. package/Errors.d.ts +0 -10
  4. package/Errors.js +1 -1
  5. package/Hooks.d.ts +16 -6
  6. package/IActivityHandler.d.ts +2 -0
  7. package/ProgramInspectorFacility.d.ts +2 -1
  8. package/Validation.d.ts +8 -2
  9. package/Validation.js +1 -1
  10. package/activities/app/GetApplicationInfo.d.ts +2 -2
  11. package/activities/app/GetApplicationInfo.js +1 -1
  12. package/activities/app/GetUserInfo.d.ts +2 -2
  13. package/activities/app/GetUserInfo.js +1 -1
  14. package/activities/app/RunCommand.d.ts +2 -2
  15. package/activities/app/RunCommand.js +1 -1
  16. package/activities/app/RunOperation.d.ts +2 -2
  17. package/activities/app/RunOperation.js +1 -1
  18. package/activities/app/applicationData.d.ts +6 -0
  19. package/activities/arcgis/AddAttachment.js +1 -1
  20. package/activities/arcgis/AddFeatureLayer.d.ts +1 -1
  21. package/activities/arcgis/AddFeatures.d.ts +2 -2
  22. package/activities/arcgis/AddFeatures.js +1 -1
  23. package/activities/arcgis/AddGraphics.d.ts +1 -1
  24. package/activities/arcgis/BufferServiceTask.d.ts +1 -1
  25. package/activities/arcgis/CastGeometry.js +1 -1
  26. package/activities/arcgis/ClearGraphics.d.ts +1 -1
  27. package/activities/arcgis/ClipEngineTask.js +1 -1
  28. package/activities/arcgis/ClosestFacilityTask.d.ts +1 -1
  29. package/activities/arcgis/CreateFeatureSet.d.ts +2 -2
  30. package/activities/arcgis/CreateFeatureSet.js +1 -1
  31. package/activities/arcgis/CreateGraphic.d.ts +2 -2
  32. package/activities/arcgis/CreateGraphic.js +1 -1
  33. package/activities/arcgis/CreatePoint.d.ts +2 -2
  34. package/activities/arcgis/CreatePoint.js +1 -1
  35. package/activities/arcgis/DeleteAttachments.js +1 -1
  36. package/activities/arcgis/DeleteFeatures.d.ts +2 -2
  37. package/activities/arcgis/DeleteFeatures.js +1 -1
  38. package/activities/arcgis/DistanceServiceTask.js +1 -1
  39. package/activities/arcgis/ExtendedSpatialReferenceInfoEngineTask.d.ts +1 -1
  40. package/activities/arcgis/FeatureSetFromJson.d.ts +2 -2
  41. package/activities/arcgis/FeatureSetFromJson.js +1 -1
  42. package/activities/arcgis/FromGeoCoordinateStringServiceTask.js +1 -1
  43. package/activities/arcgis/GenerateWebmapForReport.d.ts +2 -2
  44. package/activities/arcgis/Geocode.d.ts +1 -1
  45. package/activities/arcgis/Geocode.js +1 -1
  46. package/activities/arcgis/GeometryFromJson.d.ts +2 -2
  47. package/activities/arcgis/GeometryFromJson.js +1 -1
  48. package/activities/arcgis/Geoprocessing.d.ts +1 -1
  49. package/activities/arcgis/GeoprocessingAsync.d.ts +1 -1
  50. package/activities/arcgis/GeoprocessingAsync.js +1 -1
  51. package/activities/arcgis/GetAttributeValue.d.ts +2 -2
  52. package/activities/arcgis/GetAttributeValue.js +1 -1
  53. package/activities/arcgis/GetCentroid.d.ts +2 -2
  54. package/activities/arcgis/GetCentroid.js +1 -1
  55. package/activities/arcgis/GetCodedValueDomain.js +1 -1
  56. package/activities/arcgis/GetFeatureGeometry.d.ts +2 -2
  57. package/activities/arcgis/GetFeatureGeometry.js +1 -1
  58. package/activities/arcgis/GetFeatureLayerInfo.d.ts +4 -2
  59. package/activities/arcgis/GetFeatureLayerInfo.js +1 -1
  60. package/activities/arcgis/GetFeatureSetExtent.d.ts +2 -2
  61. package/activities/arcgis/GetFeatureSetExtent.js +1 -1
  62. package/activities/arcgis/GetFeatureSetObjectIds.d.ts +2 -2
  63. package/activities/arcgis/GetFeatureSetObjectIds.js +1 -1
  64. package/activities/arcgis/GetGeometryExtent.d.ts +2 -2
  65. package/activities/arcgis/GetGeometryExtent.js +1 -1
  66. package/activities/arcgis/GetGraphics.d.ts +1 -1
  67. package/activities/arcgis/GetLayer.d.ts +1 -1
  68. package/activities/arcgis/GetLayerDefinitionExpression.d.ts +1 -1
  69. package/activities/arcgis/GetLayerProperty.d.ts +1 -1
  70. package/activities/arcgis/GetLayerVisibility.d.ts +1 -1
  71. package/activities/arcgis/GetMap.d.ts +1 -1
  72. package/activities/arcgis/GetMapScreenshot.d.ts +1 -1
  73. package/activities/arcgis/GetPortalUser.d.ts +4 -6
  74. package/activities/arcgis/GetPortalUser.js +1 -1
  75. package/activities/arcgis/GetTable.d.ts +1 -1
  76. package/activities/arcgis/GetViewExtent.d.ts +1 -1
  77. package/activities/arcgis/GetViewpoint.d.ts +1 -1
  78. package/activities/arcgis/LabelPointsServiceTask.js +1 -1
  79. package/activities/arcgis/MapProvider.d.ts +3 -0
  80. package/activities/arcgis/ProjectServiceTask.d.ts +1 -1
  81. package/activities/arcgis/ProjectServiceTask.js +1 -1
  82. package/activities/arcgis/QueryAttachmentInfos.js +1 -1
  83. package/activities/arcgis/QueryTask.d.ts +8 -4
  84. package/activities/arcgis/QueryTask.js +1 -1
  85. package/activities/arcgis/RelationServiceTask.js +1 -1
  86. package/activities/arcgis/RelationshipQueryTask.d.ts +1 -1
  87. package/activities/arcgis/RemoveFeatureSetFields.d.ts +3 -0
  88. package/activities/arcgis/RemoveGraphics.d.ts +1 -1
  89. package/activities/arcgis/RemoveLayer.d.ts +1 -1
  90. package/activities/arcgis/RendererFromJson.d.ts +2 -2
  91. package/activities/arcgis/RendererFromJson.js +1 -1
  92. package/activities/arcgis/ReshapeServiceTask.js +1 -1
  93. package/activities/arcgis/ReverseGeocode.d.ts +1 -1
  94. package/activities/arcgis/ReverseGeocode.js +1 -1
  95. package/activities/arcgis/RouteTask.d.ts +1 -1
  96. package/activities/arcgis/RouteTask.js +1 -1
  97. package/activities/arcgis/RunPrint.d.ts +5 -11
  98. package/activities/arcgis/RunPrint.js +1 -1
  99. package/activities/arcgis/RunReport.d.ts +3 -11
  100. package/activities/arcgis/RunReport.js +1 -1
  101. package/activities/arcgis/RunWorkflow.d.ts +1 -9
  102. package/activities/arcgis/RunWorkflow.js +1 -1
  103. package/activities/arcgis/SendLayerToAttributeTable.d.ts +2 -2
  104. package/activities/arcgis/SendLayerToAttributeTable.js +1 -1
  105. package/activities/arcgis/ServiceAreaTask.d.ts +1 -1
  106. package/activities/arcgis/ServiceAreaTask.js +1 -1
  107. package/activities/arcgis/SetFeaturePopup.d.ts +1 -1
  108. package/activities/arcgis/SetImageryLayerOptions.d.ts +5 -1
  109. package/activities/arcgis/SetImageryLayerOptions.js +1 -1
  110. package/activities/arcgis/SetLayerDefinitionExpression.d.ts +1 -1
  111. package/activities/arcgis/SetLayerPopup.d.ts +1 -1
  112. package/activities/arcgis/SetLayerProperty.d.ts +1 -1
  113. package/activities/arcgis/SetLayerVisibility.d.ts +1 -1
  114. package/activities/arcgis/SetMap.d.ts +2 -2
  115. package/activities/arcgis/SetMap.js +1 -1
  116. package/activities/arcgis/SetViewExtent.d.ts +1 -1
  117. package/activities/arcgis/SetViewpoint.d.ts +1 -1
  118. package/activities/arcgis/ShowFeaturePopup.d.ts +1 -1
  119. package/activities/arcgis/ShowResults.d.ts +4 -3
  120. package/activities/arcgis/ShowResults.js +1 -1
  121. package/activities/arcgis/SortFeatureSet.d.ts +2 -2
  122. package/activities/arcgis/SortFeatureSet.js +1 -1
  123. package/activities/arcgis/SymbolFromJson.d.ts +2 -2
  124. package/activities/arcgis/SymbolFromJson.js +1 -1
  125. package/activities/arcgis/ToGeoCoordinateStringServiceTask.js +1 -1
  126. package/activities/arcgis/UnionServiceTask.js +1 -1
  127. package/activities/arcgis/UpdateAttachment.js +1 -1
  128. package/activities/arcgis/UpdateFeatures.d.ts +2 -2
  129. package/activities/arcgis/UpdateFeatures.js +1 -1
  130. package/activities/arcgis/libs/arcGisRestApi.d.ts +20 -1
  131. package/activities/arcgis/shared.d.ts +2 -5
  132. package/activities/arcgis/tools.d.ts +3 -12
  133. package/activities/arcgis/tools.js +1 -1
  134. package/activities/browser/GetBrowserInfo.d.ts +2 -2
  135. package/activities/browser/GetBrowserInfo.js +1 -1
  136. package/activities/core/Annotation.d.ts +2 -2
  137. package/activities/core/Annotation.js +1 -1
  138. package/activities/core/ChannelProvider.d.ts +2 -2
  139. package/activities/core/Container.d.ts +1 -1
  140. package/activities/core/{RunSubworkflow.d.ts → ExecuteFunction.d.ts} +4 -4
  141. package/activities/core/ExecuteFunction.js +1 -0
  142. package/activities/core/Exit.d.ts +1 -1
  143. package/activities/core/{Subworkflow.d.ts → Function.d.ts} +6 -6
  144. package/activities/core/Function.js +1 -0
  145. package/activities/core/GetWorkflowInputs.d.ts +1 -1
  146. package/activities/core/Placeholder.d.ts +2 -2
  147. package/activities/core/Placeholder.js +1 -1
  148. package/activities/core/TextReplace.d.ts +1 -0
  149. package/activities/core/TextReplace.js +1 -1
  150. package/activities/core/TryCatch.d.ts +1 -1
  151. package/activities/core/WebRequest.d.ts +1 -1
  152. package/activities/essentials/GetEssentialsSite.d.ts +1 -1
  153. package/activities/essentials/RunEssentialsWorkflow.d.ts +1 -1
  154. package/activities/forms/AddFormElement.d.ts +4 -2
  155. package/activities/forms/AddFormElement.js +1 -1
  156. package/activities/forms/DisplayForm.d.ts +2 -2
  157. package/activities/forms/FormActor.d.ts +56 -0
  158. package/activities/forms/FormActor.js +1 -0
  159. package/activities/forms/FormRenderer.d.ts +6 -42
  160. package/activities/forms/FormRenderer.js +1 -1
  161. package/activities/forms/GetFormElementItemsFromCollection.d.ts +2 -2
  162. package/activities/forms/GetFormElementItemsFromCollection.js +1 -1
  163. package/activities/forms/GetFormElementProperty.d.ts +2 -2
  164. package/activities/forms/GetFormElementProperty.js +1 -1
  165. package/activities/forms/GetFormElementValue.d.ts +2 -2
  166. package/activities/forms/GetFormElementValue.js +1 -1
  167. package/activities/forms/SetFormElementEvent.d.ts +1 -1
  168. package/activities/index.js +1 -1
  169. package/activities/math/Random.d.ts +2 -2
  170. package/activities/math/Random.js +1 -1
  171. package/activities/pdf/AddTextToPdf.d.ts +2 -2
  172. package/activities/ui/Alert.d.ts +1 -1
  173. package/activities/ui/Confirm.d.ts +1 -1
  174. package/activities/ui/Prompt.d.ts +1 -1
  175. package/activities/wab/OpenWidget.d.ts +2 -2
  176. package/activities/wab/OpenWidget.js +1 -1
  177. package/activities/wab/PublishWidgetData.d.ts +2 -2
  178. package/activities/wab/PublishWidgetData.js +1 -1
  179. package/definition/ProgramInspector.d.ts +21 -13
  180. package/definition/ProgramInspector.js +1 -1
  181. package/definition/Transition.d.ts +1 -1
  182. package/execution/ActivityContext.d.ts +2 -2
  183. package/execution/ActivityContextProxy.d.ts +1 -1
  184. package/execution/AmbientState.d.ts +2 -1
  185. package/execution/AmbientStateProxy.d.ts +1 -0
  186. package/execution/AmbientStateProxy.js +1 -1
  187. package/execution/Engine.d.ts +9 -9
  188. package/execution/ModuleLoader.d.ts +0 -28
  189. package/execution/ModuleLoader.js +1 -1
  190. package/execution/ProgramRunner.js +1 -1
  191. package/execution/util.js +1 -1
  192. package/forms/Calendar.d.ts +1 -1
  193. package/forms/FormDefinition.d.ts +2 -17
  194. package/forms/FormDefinition.js +1 -1
  195. package/forms/FormHost.d.ts +19 -7
  196. package/forms/FormHost.js +1 -1
  197. package/forms/FormPresenterHost.d.ts +16 -4
  198. package/forms/components/AutoComplete.js +1 -1
  199. package/forms/components/CheckGroup.js +1 -1
  200. package/forms/components/DateRangePicker.js +1 -1
  201. package/forms/components/Form.js +1 -1
  202. package/forms/components/FormLabelNumberField.d.ts +1 -1
  203. package/forms/components/GeometryPicker.js +1 -1
  204. package/forms/components/Markdown.d.ts +1 -1
  205. package/forms/components/Number.js +1 -1
  206. package/forms/components/NumberRangeSlider.js +1 -1
  207. package/forms/components/NumberSlider.js +1 -1
  208. package/forms/components/SignatureDialog.d.ts +1 -1
  209. package/forms/components/SketchDialog.d.ts +2 -2
  210. package/forms/components/TextBox.js +1 -1
  211. package/forms/components/common.d.ts +0 -1
  212. package/forms/customNumberFormat.d.ts +70 -0
  213. package/forms/customNumberFormat.js +1 -0
  214. package/forms/dateUtilities.d.ts +15 -7
  215. package/forms/dateUtilities.js +1 -1
  216. package/forms/keyboard.d.ts +2 -8
  217. package/forms/numberFormatter.d.ts +0 -14
  218. package/forms/numberFormatter.js +1 -1
  219. package/forms/numberUtilities.d.ts +1 -13
  220. package/forms/numberUtilities.js +1 -1
  221. package/forms/utils.d.ts +1 -8
  222. package/forms/utils.js +1 -1
  223. package/libs/version.d.ts +1 -1
  224. package/libs/version.js +1 -1
  225. package/package.json +5 -5
  226. package/activities/core/RunSubworkflow.js +0 -1
  227. package/activities/core/Subworkflow.js +0 -1
@@ -1,16 +1,16 @@
1
- import type { RunSubworkflowOutputs } from "./RunSubworkflow";
1
+ import type { ExecuteFunctionOutputs } from "./ExecuteFunction";
2
2
  import type { IActivityContext, IActivityHandler } from "../../IActivityHandler";
3
- export interface SubworkflowInputs {
4
- subworkflow: RunSubworkflowOutputs;
3
+ export interface FunctionInputs {
4
+ subworkflow: ExecuteFunctionOutputs;
5
5
  argumentsType?: "any" | "{ addressCandidate: esri.AddressCandidate }" | "{ extent: esri.Extent }" | "{ featureSet: esri.FeatureSet }" | "{ geometry: esri.Geometry }" | "{ graphic: esri.Graphic }" | "{ id: number; name: string; location: esri.Point; }" | "{ layer: esri.Layer }" | "{ multiPoint: esri.Multipoint }" | "{ point: esri.Point }" | "{ polygon: esri.Polygon }" | "{ polyline: esri.Polyline }" | "{ portalGroup: esri.PortalGroup }" | "{ portalUser: esri.PortalUser }" | "{ spatialReference: esri.SpatialReference }" | "{ symbol: esri.Symbol }" | string;
6
6
  resultType?: "any" | "ArrayBuffer" | "boolean" | "Date" | "Error" | "Function" | "number" | "number[]" | "Object" | "string" | "string[]" | "esri.Graphic" | "esri.Extent" | "esri.Geometry" | "esri.Multipoint" | "esri.Point" | "esri.Polygon" | "esri.Polyline" | "esri.PortalGroup" | "esri.PortalUser" | "esri.SpatialReference" | "esri.Layer" | "esri.Symbol" | "esri.AddressCandidate" | "esri.FeatureSet" | "{ id: number; name: string; location: esri.Point; }" | string;
7
7
  }
8
- export interface SubworkflowOutputs {
8
+ export interface FunctionOutputs {
9
9
  arguments?: Record<string, any>;
10
10
  setResult: (value: any) => void;
11
11
  }
12
- export declare class Subworkflow implements IActivityHandler {
12
+ export declare class Function implements IActivityHandler {
13
13
  static readonly action = "gcx:wf:core::Subworkflow";
14
14
  static readonly suite = "gcx:wf:builtin";
15
- execute(inputs: SubworkflowInputs, context: IActivityContext): SubworkflowOutputs;
15
+ execute(inputs: FunctionInputs, context: IActivityContext): FunctionOutputs;
16
16
  }
@@ -0,0 +1 @@
1
+ class Function{execute(t,n){0===n.passes&&n.call("content");const e=t.subworkflow;return{arguments:e?.arguments,setResult:t=>{e&&(e.result=t)}}}}Function.action="gcx:wf:core::Subworkflow",Function.suite="gcx:wf:builtin";export{Function};
@@ -8,5 +8,5 @@ export interface GetWorkflowInputsOutputs {
8
8
  export declare class GetWorkflowInputs implements IActivityHandler {
9
9
  static readonly action = "gcx:wf:core::GetWorkflowInputs";
10
10
  static readonly suite = "gcx:wf:builtin";
11
- execute(inputs: EmptyInputs, context: IActivityContext): GetWorkflowInputsOutputs;
11
+ execute(_inputs: EmptyInputs, context: IActivityContext): GetWorkflowInputsOutputs;
12
12
  }
@@ -1,6 +1,6 @@
1
- import type { EmptyInputs, EmptyOutputs, IActivityHandler } from "../../IActivityHandler";
1
+ import type { EmptyOutputs, IActivityHandler } from "../../IActivityHandler";
2
2
  export declare class Placeholder implements IActivityHandler {
3
3
  static readonly action = "gcx:wf:core::Placeholder";
4
4
  static readonly suite = "gcx:wf:builtin";
5
- execute(inputs: EmptyInputs): EmptyOutputs;
5
+ execute(): EmptyOutputs;
6
6
  }
@@ -1 +1 @@
1
- class Placeholder{execute(e){return{}}}Placeholder.action="gcx:wf:core::Placeholder",Placeholder.suite="gcx:wf:builtin";export{Placeholder};
1
+ class Placeholder{execute(){return{}}}Placeholder.action="gcx:wf:core::Placeholder",Placeholder.suite="gcx:wf:builtin";export{Placeholder};
@@ -4,6 +4,7 @@ export interface TextReplaceInputs {
4
4
  text: string;
5
5
  oldValue: string;
6
6
  newValue: string;
7
+ ignoreCase?: boolean;
7
8
  }
8
9
  /** Defines outputs for the TextReplace activity. */
9
10
  export interface TextReplaceOutputs {
@@ -1 +1 @@
1
- import{validation}from"../../Validation.js";class TextReplace{execute(e){const a=validation.string("text",e.text,validation.never),t=validation.string("oldValue",e.oldValue,validation.never);var l=validation.string("newValue",e.newValue,""),e=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),e=new RegExp(e,"g");return{result:a.replace(e,l)}}}TextReplace.action="gcx:wf:core::TextReplace",TextReplace.suite="gcx:wf:builtin";export{TextReplace};
1
+ import{validation}from"../../Validation.js";class TextReplace{execute(e){const a=validation.string("text",e.text,validation.never),t=validation.string("oldValue",e.oldValue,validation.never);var i=validation.string("newValue",e.newValue,""),l=validation.boolean("ignoreCase",e.ignoreCase,!1),e=t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),l=new RegExp(e,"g"+(l?"i":""));return{result:a.replace(l,i)}}}TextReplace.action="gcx:wf:core::TextReplace",TextReplace.suite="gcx:wf:builtin";export{TextReplace};
@@ -8,5 +8,5 @@ export interface TryCatchOutputs {
8
8
  export declare class TryCatch implements IActivityHandler {
9
9
  static readonly action = "gcx:wf:core::TryCatch";
10
10
  static readonly suite = "gcx:wf:builtin";
11
- execute(inputs: EmptyInputs, context: IActivityContext): TryCatchOutputs;
11
+ execute(_inputs: EmptyInputs, context: IActivityContext): TryCatchOutputs;
12
12
  }
@@ -48,5 +48,5 @@ export interface WebRequestOutputs {
48
48
  export declare class WebRequest implements IActivityHandler {
49
49
  static readonly action = "gcx:wf:core:request:WebRequest";
50
50
  static readonly suite = "gcx:wf:builtin";
51
- execute(inputs: WebRequestInputs, context: IActivityContext, type: typeof ChannelProvider): Promise<WebRequestOutputs>;
51
+ execute(inputs: WebRequestInputs, context: IActivityContext, ChannelProviderType: typeof ChannelProvider): Promise<WebRequestOutputs>;
52
52
  }
@@ -221,5 +221,5 @@ export interface GetEssentialsSiteOutputs {
221
221
  export declare class GetEssentialsSite implements IActivityHandler {
222
222
  static readonly action = "gcx:wf:essentials::GetEssentialsSite";
223
223
  static readonly suite = "gcx:wf:builtin";
224
- execute(inputs: EmptyInputs, context: IActivityContext): GetEssentialsSiteOutputs;
224
+ execute(_inputs: EmptyInputs, context: IActivityContext): GetEssentialsSiteOutputs;
225
225
  }
@@ -17,7 +17,7 @@ export interface RunEssentialsWorkflowOutputs {
17
17
  export declare class RunEssentialsWorkflow implements IActivityHandler {
18
18
  static readonly action = "gcx:wf:essentials::RunEssentialsWorkflow";
19
19
  static readonly suite = "gcx:wf:builtin";
20
- execute(inputs: RunEssentialsWorkflowInputs, context: IActivityContext, type: typeof ChannelProvider): Promise<RunEssentialsWorkflowOutputs>;
20
+ execute(inputs: RunEssentialsWorkflowInputs, context: IActivityContext, ChannelProviderType: typeof ChannelProvider): Promise<RunEssentialsWorkflowOutputs>;
21
21
  private isString;
22
22
  private getWorkflowSchema;
23
23
  private validateInputs;
@@ -1,5 +1,5 @@
1
1
  import type { DisplayFormOutputs } from "./DisplayForm";
2
- import type { IActivityHandler, IActivityContext, EmptyOutputs } from "../../IActivityHandler";
2
+ import type { IActivityHandler, EmptyOutputs } from "../../IActivityHandler";
3
3
  import type * as defs from "../../forms/FormDefinition";
4
4
  export interface AddFormElementInputs {
5
5
  form: DisplayFormOutputs;
@@ -10,9 +10,11 @@ export interface AddFormElementInputs {
10
10
  /** The definition of the form element to add. */
11
11
  element: defs.Element;
12
12
  targetForm?: DisplayFormOutputs;
13
+ targetElement?: string | defs.Element;
14
+ targetPosition?: "above" | "below" | "before" | "after" | string;
13
15
  }
14
16
  export declare class AddFormElement implements IActivityHandler {
15
17
  static readonly action = "gcx:wf:forms::AddFormElement";
16
18
  static readonly suite = "gcx:wf:builtin";
17
- execute(inputs: AddFormElementInputs, context: IActivityContext): EmptyOutputs;
19
+ execute(inputs: AddFormElementInputs): EmptyOutputs;
18
20
  }
@@ -1 +1 @@
1
- import{validation}from"../../Validation.js";import{setFormForElement}from"./FormElementMap.js";class AddFormElement{execute(e,t){var{elementName:n,elementType:r,element:m,targetForm:o}=e;let a=e["form"];if(a=o||a,validation.exists("form",a),validation.string("elementName",n,validation.never),validation.string("elementType",r,validation.never),"Header"===r)throw new Error("A form cannot contain more than one header element.");m=a.actor.addElement(n,r,m);return setFormForElement(m,a),{}}}AddFormElement.action="gcx:wf:forms::AddFormElement",AddFormElement.suite="gcx:wf:builtin";export{AddFormElement};
1
+ import{validation}from"../../Validation.js";import{setFormForElement}from"./FormElementMap.js";class AddFormElement{execute(e){var{elementName:t,elementType:o,element:r,targetForm:n,targetPosition:a}=e;let{form:m,targetElement:i}=e;if(m=n||m,validation.exists("form",m),validation.string("elementName",t,validation.never),validation.string("elementType",o,validation.never),"Header"===o)throw new Error("A form cannot contain more than one header element.");i=m.actor.getElementName(i,m.event);let l;switch(a){case"above":case"below":case"before":case"after":l=a}n=l&&i?{relativePosition:l,targetElementName:i}:void 0,n=m.actor.addElement(t,o,r,n);return setFormForElement(n,m),{}}}AddFormElement.action="gcx:wf:forms::AddFormElement",AddFormElement.suite="gcx:wf:builtin";export{AddFormElement};
@@ -33,9 +33,9 @@ export declare class DisplayForm implements IActivityHandler {
33
33
  * Creates a form renderer if it does not exist.
34
34
  * @param inputs The inputs to create the renderer.
35
35
  * @param context The context to use to create the renderer.
36
- * @param type The type of FormRenderer (subclass) to create.
36
+ * @param FormRendererType The type of FormRenderer (subclass) to create.
37
37
  */
38
- static createRenderer(inputs: DisplayFormInputs, context: IActivityContext, type: typeof FormRenderer): FormRenderer;
38
+ static createRenderer(inputs: DisplayFormInputs, context: IActivityContext, FormRendererType: typeof FormRenderer): FormRenderer;
39
39
  static readonly action = "gcx:wf:forms:form:DisplayForm";
40
40
  static readonly suite = "gcx:wf:builtin";
41
41
  /** Performs the operation on behalf of the engine. */
@@ -0,0 +1,56 @@
1
+ import { defs } from "../../forms/FormHost";
2
+ import type { FormElementRegistration } from "../../forms/index";
3
+ export { defs };
4
+ /**
5
+ * Describes the position of something relative to something else.
6
+ * We use "before" and "after" instead of "left" and "right" to still make sense
7
+ * in a right-to-left environment.
8
+ */
9
+ export type RelativePosition = "above" | "below" | "before" | "after";
10
+ /**
11
+ * Details of where to position an element when adding it to the form.
12
+ */
13
+ export interface ElementPosition {
14
+ /** The direction we move from the target element to determine the new position. */
15
+ relativePosition: RelativePosition;
16
+ /** The name of the element to use as a starting position. */
17
+ targetElementName: string;
18
+ }
19
+ /** Defines what the renderer exposes. */
20
+ export default interface FormActor {
21
+ /** Returns the element with the given name. If the element does not exist an error will be thrown. */
22
+ getElement(element: string | defs.Element | undefined, event?: defs.Event): defs.Element;
23
+ getElementRegistration(element: defs.Element): FormElementRegistration | undefined;
24
+ /** Returns the name of the given element. If the element does not exist an error will be thrown. */
25
+ getElementName(element: defs.Element | string | undefined, event?: defs.Event): string;
26
+ /** Sets element visibility to false. */
27
+ hideElement(element: defs.Element): void;
28
+ /** Sets element visibility to true. */
29
+ showElement(element: defs.Element): void;
30
+ /** Assigns an error message to an element. */
31
+ setElementError(elementName: string, error: string | undefined, markdown?: boolean): void;
32
+ /** Finds the specified item and sets it as the current one. Returns true if a match was found, false otherwise. */
33
+ setCurrentItem(elementName: string, value: defs.Value | defs.Text | defs.Item, matchType: defs.ItemMatchType): boolean;
34
+ /**
35
+ * Assigns a property to an element, or overwrites an existing property.
36
+ * @param elementName The name of the element to be updated.
37
+ * @param propertyName The name of the property of the element to be updated.
38
+ * @param propertyValue The new value for the element's property.
39
+ * @param markdown (optional) True if the value should be treated as markdown, false otherwise. The default value is false.
40
+ * @param event (optional) Only relevant when `propertyName` is `"value"`. If a boolean value, indicates whether or not to post a "changed" event. If a `Partial<defs.Element>` specifies some of the properties of the event to be posted. Any `name` and `value` provided here are ignored. The default value is true.
41
+ */
42
+ assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean, event?: Partial<defs.Event> | boolean): void;
43
+ /** Assigns an items property to an element. */
44
+ assignItemsToElement(elementName: string, items: Record<string, defs.Item>, reset?: boolean): void;
45
+ /** Assigns a property to an element item, or overwrites an existing property. */
46
+ assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
47
+ /** Filters the items of an element based on heuristics. */
48
+ filterItems(elementName: string, phrase: string): boolean;
49
+ /**
50
+ * Adds the supplied element to the form.
51
+ * @param elementName The unique name for the element.
52
+ * @param type The type of element to add.
53
+ * @param element The contents of the element to add.
54
+ */
55
+ addElement(elementName: string, type: string, element: defs.Element, elementPosition?: ElementPosition): defs.Element;
56
+ }
@@ -0,0 +1 @@
1
+ import{defs}from"../../forms/FormHost.js";export{defs};
@@ -1,45 +1,9 @@
1
1
  import { FormHost, defs } from "../../forms/FormHost";
2
+ import type { ElementPosition } from "./FormActor";
3
+ import type FormActor from "./FormActor";
2
4
  import type { Activator } from "../../Activator";
3
5
  import type { FormElementRegistration } from "../../forms/index";
4
6
  export { defs };
5
- /** Defines what the renderer exposes. */
6
- export interface FormActor {
7
- /** Returns the element with the given name. If the element does not exist an error will be thrown. */
8
- getElement(element: string | defs.Element | undefined, event?: defs.Event): defs.Element;
9
- getElementRegistration(element: defs.Element): FormElementRegistration | undefined;
10
- /** Returns the name of the given element. If the element does not exist an error will be thrown. */
11
- getElementName(element: defs.Element | string | undefined, event?: defs.Event): string;
12
- /** Sets element visibility to false. */
13
- hideElement(element: defs.Element): void;
14
- /** Sets element visibility to true. */
15
- showElement(element: defs.Element): void;
16
- /** Assigns an error message to an element. */
17
- setElementError(elementName: string, error: string | undefined, markdown?: boolean): void;
18
- /** Finds the specified item and sets it as the current one. Returns true if a match was found, false otherwise. */
19
- setCurrentItem(elementName: string, value: defs.Value | defs.Text | defs.Item, matchType: defs.ItemMatchType): boolean;
20
- /**
21
- * Assigns a property to an element, or overwrites an existing property.
22
- * @param elementName The name of the element to be updated.
23
- * @param propertyName The name of the property of the element to be updated.
24
- * @param propertyValue The new value for the element's property.
25
- * @param markdown (optional) True if the value should be treated as markdown, false otherwise. The default value is false.
26
- * @param event (optional) Only relevant when `propertyName` is `"value"`. If a boolean value, indicates whether or not to post a "changed" event. If a `Partial<defs.Element>` specifies some of the properties of the event to be posted. Any `name` and `value` provided here are ignored. The default value is true.
27
- */
28
- assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean, event?: Partial<defs.Event> | boolean): void;
29
- /** Assigns an items property to an element. */
30
- assignItemsToElement(elementName: string, items: Record<string, defs.Item>, reset?: boolean): void;
31
- /** Assigns a property to an element item, or overwrites an existing property. */
32
- assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
33
- /** Filters the items of an element based on heuristics. */
34
- filterItems(elementName: string, phrase: string): boolean;
35
- /**
36
- * Adds the supplied element to the form.
37
- * @param elementName The unique name for the element.
38
- * @param type The type of element to add.
39
- * @param element The contents of the element to add.
40
- */
41
- addElement(elementName: string, type: string, element: defs.Element): defs.Element;
42
- }
43
7
  /**
44
8
  * Renders a form on behalf of the DisplayForm activity.
45
9
  * @public
@@ -52,7 +16,7 @@ export declare class FormRenderer extends FormHost implements FormActor {
52
16
  static createCustom(): FormRenderer;
53
17
  /** Register this renderer class as the form renderer. */
54
18
  static register(activator: Activator): void;
55
- addElement(elementName: string, type: string, element: defs.Element): defs.Element;
19
+ addElement(elementName: string, type: string, element: defs.Element, elementPosition?: ElementPosition): defs.Element;
56
20
  assignElementProperty(elementName: string, propertyName: string, propertyValue: any, markdown?: boolean, event?: Partial<defs.Event> | boolean): void;
57
21
  assignElementItemProperty(elementName: string, itemKey: string, propertyName: string, propertyValue: any, markdown?: boolean): void;
58
22
  assignItemsToElement(elementName: string, items: Record<string, defs.Item>, reset?: boolean): void;
@@ -126,8 +90,6 @@ export declare class FormRenderer extends FormHost implements FormActor {
126
90
  load(): boolean;
127
91
  /** Loads the form with a new definition. */
128
92
  load(form: defs.Form, template?: defs.Form): boolean;
129
- /** Renders form text as HTML. */
130
- renderHtml(content: defs.Text, htmlContentCategory?: defs.HTMLContentCategory): string;
131
93
  /** Renders form text as plain text. */
132
94
  renderText(content: defs.Text | undefined): string;
133
95
  setCurrentItem(elementName: string, searchValue: defs.Value | defs.Text | defs.Item, itemMatchType: defs.ItemMatchType): boolean;
@@ -135,5 +97,7 @@ export declare class FormRenderer extends FormHost implements FormActor {
135
97
  showElement(element: defs.Element): void;
136
98
  /** Used to request that the form spins without blocking the application. */
137
99
  spinNoBlock(): boolean;
138
- translateText(content: defs.Text): string | defs.MarkdownRef | undefined;
100
+ translateText(content: string | defs.StatusRef | undefined): string | undefined;
101
+ translateText(content: defs.MarkdownRef | undefined): defs.MarkdownRef | undefined;
102
+ translateText(content: defs.Text | undefined): string | defs.MarkdownRef | undefined;
139
103
  }
@@ -1 +1 @@
1
- import{ActivityAbortedError}from"../../Errors.js";import{FormHost,defs}from"../../forms/FormHost.js";import{FormElementTypes}from"../../forms/constants.js";import{getContent}from"../../forms/textUtilities.js";import{text}from"../../forms/utils.js";import{FormElementNotFoundError,NoFormElementAvailableError}from"./Errors.js";function toMarkdownRef(e,t){return"string"!=typeof t?t:{markdown:t}}const guid="F889738A-EBE2-4D52-8B46-3E24CC6E30F6:";class FormRenderer extends FormHost{static create(){return new this}static createCustom(){const e=new this;return e.custom=!0,e}static register(e){e.factories.push(e=>e===this.type?this:void 0)}addElement(e,t,r){if(this.form.elements.hasOwnProperty(e))throw new Error(`Element already present: ${e}`);const s={};if("object"==typeof r)for(const n in r)s[n]=r[n];s.type=t;t=s.section;if(t){let e;if("object"==typeof t?e=t.name:"string"==typeof t&&(e=t),"header"===e||"footer"===e)throw new Error("Elements cannot be added to the header or footer.")}return this.form.elements[e]=s,this.invalidate(),s}assignElementProperty(t,r,s,e=!1,n=!0){e&&(s=toMarkdownRef(r,s));const o=this.getElement(t);if(o[r]!==s){const i={},a=this.getElementRegistration(o);if(a?.onPropertyChange)try{const m=(e,t)=>{i[e]!==t&&(i[e]=t,a.onPropertyChange({properties:{...o,...i},property:e,setProperty:m}))};m(r,s)}catch(e){throw console.error(`Error setting element property.\nElement: "${t}"\nProperty: "${r}"\nValue: ${s}\n`,e),e}else i[r]=s;for(const l of Object.keys(i))o[l]=i[l];a&&"value"in i&&!1!==n&&(t={..."object"==typeof n?n:{},name:t,value:i.value},this.post("changed",t)),this.refresh()}}assignElementItemProperty(e,t,r,s,n){const o=this.getElement(e),i=o.items||{};if(i[t][r]=n?toMarkdownRef(r,s):s,"checked"===r&&[FormElementTypes.CHECKGROUP,FormElementTypes.ITEMPICKER,FormElementTypes.LISTBOX].includes(o.type)){const m=[];for(const t in i){var a=i[t];a.checked&&m.push(a)}o.value=0===m.length?void 0:{refValueType:"items",items:m}}this.refresh(e)}assignItemsToElement(e,t,r){const s=this.getElement(e);let n=s.items||{};!1!==r&&(n={});for(const o in t)n[o]=t[o];s.items=n,s.type!==FormElementTypes.GEOMETRYPICKER&&s.type!==FormElementTypes.ITEMPICKER||delete s.state,this.invalidate(e)}cancelTool(){}deriveLocale(){return this.state?.locale||super.deriveLocale()}dispose(){if(super.dispose()){const e=this.state;return void 0!==e&&null!==e&&e.completion.isPending()&&e.reject(new ActivityAbortedError),!0}return!1}filterItems(e,t){const r=this.find(e);if(void 0===r||null===r)return!1;var s=r.items;if(null==s)return!1;if("string"!=typeof t)return t;let n=!1;const o={};var i=t.toLowerCase().split(/\s+/);for(const l in s){var a=s[l];const f=this.renderText(a.label);var m=f.toLowerCase().split(/\s+/);for(const c of i)if(0<c.length)for(const h of m)0<h.length&&0===h.indexOf(c)&&(n=!0,o[l]=a)}return r.items=o,this.invalidate(e),n}getElement(e,t){let r;if(e){if("string"!=typeof e)return e;r=e}else t?.name&&(r=t.name);if(r){t=this.form.elements[r];if(!t)throw new FormElementNotFoundError(r);return t}throw new NoFormElementAvailableError}getElementName(e,t){if(e){if("string"==typeof e)return e;for(const r in this.form.elements)if(this.form.elements[r]===e)return r;throw new FormElementNotFoundError(e)}if(t?.name)return t.name;throw new NoFormElementAvailableError}getElementRegistration(e){return this.state?.trivia?.getFormElementRegistration?.(e.customType??e.type)}getText(e){var t=this.state;if(void 0!==t){const r=t.environment.getText;if("function"==typeof r){if(text.isMarkdown(e))return{markdown:r(e.markdown)};if(text.isStatus(e))return{markdown:r(`@form-element-status-${e.status}`)};if(e&&"@"===e[0]){t=r(e);if(t)return t}}}return e}hideElement(e){e.visible=!1,this.invalidate()}isRelated(e){return this.state&&this.state.trivia&&this.state.trivia.isDescendantOf&&this.state.trivia.isDescendantOf(e.state)}load(e,t){t=super.load(e,t);if(t&&this.form?.elements)for(const s in this.form.elements){var r=this.form.elements[s];const n=this.getElementRegistration(r);n&&n.getInitialProperties&&(r={...r,...n.getInitialProperties()},this.form.elements[s]=r)}return t}renderHtml(e,t){return super.renderHtml(this.getText(e),t)}renderText(e){return super.renderText(this.getText(e))}setCurrentItem(e,t,r){const n=this.getElement(e);if(!n||!n.items)return!1;let s;switch(r){case"index":s=(e,t,r)=>{var s=Object.keys(n.items);return 0<s.length&&e===s[r]};break;case"item":s=(e,t,r)=>r===t;break;case"key":s=(e,t,r)=>r===e;break;case"label":s=(e,t,r)=>getContent(r)===getContent(t.label);break;case"value":s=(e,t,r)=>r===t.value;break;default:throw new Error("Unsupported value for itemMatchType: "+r)}for(const o in n.items)if(s(o,n.items[o],t))return n.current=o,[FormElementTypes.AUTOCOMPLETE,FormElementTypes.DROPDOWNLIST,FormElementTypes.RADIOGROUP].includes(n.type)&&(n.label=n.items[o].label,n.value=n.items[o].value),this.invalidate(e),this.cascade(e),!0;return!1}setElementError(e,t,r=!1){this.errors[e]=r?toMarkdownRef("error",t):t}showElement(e){e.visible=!0,this.invalidate()}spinNoBlock(){return this.spin()}translateText(e){return super.translateText(this.getText(e))}}FormRenderer.type=guid+"FormRenderer";export{defs,FormRenderer};
1
+ import{ActivityAbortedError}from"../../Errors.js";import{FormHost,defs}from"../../forms/FormHost.js";import{FormElementTypes}from"../../forms/constants.js";import{getContent}from"../../forms/textUtilities.js";import{text}from"../../forms/utils.js";import{FormElementNotFoundError,NoFormElementAvailableError}from"./Errors.js";function toMarkdownRef(e,t){return"string"!=typeof t?t:{markdown:t}}const guid="F889738A-EBE2-4D52-8B46-3E24CC6E30F6:";class FormRenderer extends FormHost{static create(){return new this}static createCustom(){const e=new this;return e.custom=!0,e}static register(e){e.factories.push(e=>e===this.type?this:void 0)}addElement(e,r,t,o){if(r===FormElementTypes.HEADER)throw new Error("A form cannot contain more than one header element.");const n=this.form["elements"];if(n.hasOwnProperty(e))throw new Error(`Element already present: ${e}`);const s={};if("object"==typeof t)for(const p in t)s[p]=t[p];s.type=r;var i=o?.targetElementName;let m=o?.relativePosition,a=!0;o=()=>{let e=-1;for(const t of Object.values(n))void 0!==t.rowNumber&&(e=Math.max(e,t.rowNumber));return e};let l,f;if(i&&m&&n.hasOwnProperty(i)){let e=0,t=0;i=n[i];switch("header"===i.section?m="above":"footer"===i.section?(m="below",e=o()):(e=i.rowNumber,t=i.rowIndex,i.type!==FormElementTypes.SECTION&&r!==FormElementTypes.SECTION||(t=0,"before"===m?m="above":"after"===m&&(m="below"))),m){case"before":a=!1,l=e,f=t;break;case"after":a=!1,l=e,f=t+1;break;case"above":a=!0,l=e,f=0;break;default:a=!0,l=e+1,f=0}}else f=void 0!==s.rowNumber&&void 0!==s.rowIndex?(l=s.rowNumber||0,s.rowIndex||0):(l=o()+1,0);s.rowNumber=l,s.rowIndex=f;for(const t of Object.values(n)){var{rowNumber:c,rowIndex:u}=t;void 0!==c&&void 0!==u&&(a?c>=l&&t.rowNumber++:c===l&&u>=f&&t.rowIndex++)}n[e]=s;const d=[];for(const e of Object.keys(n)){const t=n[e];t.type===FormElementTypes.SECTION&&(d[t.rowNumber]={name:e})}for(const t of Object.values(n))void 0===t.rowNumber||t.rowNumber<l||t.type!==FormElementTypes.SECTION&&(t.section=(e=>{for(;0<=e;){var t=d[e];if(t)return t;e--}})(t.rowNumber));return this.invalidate(),s}assignElementProperty(t,r,o,e=!1,n=!0){e&&(o=toMarkdownRef(r,o));const s=this.getElement(t);if(s[r]!==o){const i={},m=this.getElementRegistration(s);if(m?.onPropertyChange)try{const a=(e,t)=>{i[e]!==t&&(i[e]=t,m.onPropertyChange({properties:{...s,...i},property:e,setProperty:a}))};a(r,o)}catch(e){throw console.error(`Error setting element property.\nElement: "${t}"\nProperty: "${r}"\nValue: ${o}\n`,e),e}else i[r]=o;for(const l of Object.keys(i))s[l]=i[l];m&&"value"in i&&!1!==n&&(t={..."object"==typeof n?n:{},name:t,value:i.value},this.post("changed",t)),this.refresh()}}assignElementItemProperty(e,t,r,o,n){const s=this.getElement(e),i=s.items||{};if(i[t][r]=n?toMarkdownRef(r,o):o,"checked"===r&&[FormElementTypes.CHECKGROUP,FormElementTypes.ITEMPICKER,FormElementTypes.LISTBOX].includes(s.type)){const a=[];for(const t in i){var m=i[t];m.checked&&a.push(m)}s.value=0===a.length?void 0:{refValueType:"items",items:a}}this.refresh(e)}assignItemsToElement(e,t,r){const o=this.getElement(e);let n=o.items||{};!1!==r&&(n={});for(const s in t)n[s]=t[s];o.items=n,o.type!==FormElementTypes.GEOMETRYPICKER&&o.type!==FormElementTypes.ITEMPICKER||delete o.state,this.invalidate(e)}cancelTool(){}deriveLocale(){return this.state?.locale||super.deriveLocale()}dispose(){if(super.dispose()){const e=this.state;return void 0!==e&&null!==e&&e.completion.isPending()&&e.reject(new ActivityAbortedError),!0}return!1}filterItems(e,t){const r=this.find(e);if(void 0===r||null===r)return!1;var o=r.items;if(null==o)return!1;if("string"!=typeof t)return t;let n=!1;const s={};var i=t.toLowerCase().split(/\s+/);for(const l in o){var m=o[l];const f=this.renderText(m.label);var a=f.toLowerCase().split(/\s+/);for(const c of i)if(0<c.length)for(const u of a)0<u.length&&0===u.indexOf(c)&&(n=!0,s[l]=m)}return r.items=s,this.invalidate(e),n}getElement(e,t){let r;if(e){if("string"!=typeof e)return e;r=e}else t?.name&&(r=t.name);if(r){t=this.form.elements[r];if(!t)throw new FormElementNotFoundError(r);return t}throw new NoFormElementAvailableError}getElementName(e,t){if(e){if("string"==typeof e)return e;for(const r in this.form.elements)if(this.form.elements[r]===e)return r;throw new FormElementNotFoundError(e)}if(t?.name)return t.name;throw new NoFormElementAvailableError}getElementRegistration(e){return this.state?.trivia?.getFormElementRegistration?.(e.customType??e.type)}getText(e){var t=this.state;if(void 0!==t){const r=t.environment.getText;if("function"==typeof r){if(text.isMarkdown(e))return{markdown:r(e.markdown)};if(text.isStatus(e))return{markdown:r(`@form-element-status-${e.status}`)};if(e&&"@"===e[0]){t=r(e);if(t)return t}}}return e}hideElement(e){e.visible=!1,this.invalidate()}isRelated(e){return this.state?.trivia?.isDescendantOf?.(e.state)}load(e,t){t=super.load(e,t);if(t&&this.form?.elements)for(const o in this.form.elements){var r=this.form.elements[o];const n=this.getElementRegistration(r);n&&n.getInitialProperties&&(r={...r,...n.getInitialProperties()},this.form.elements[o]=r)}return t}renderText(e){return super.renderText(this.getText(e))}setCurrentItem(e,t,r){const n=this.getElement(e);if(!n||!n.items)return!1;let o;switch(r){case"index":o=(e,t,r)=>{var o=Object.keys(n.items);return 0<o.length&&e===o[r]};break;case"item":o=(e,t,r)=>r===t;break;case"key":o=(e,t,r)=>r===e;break;case"label":o=(e,t,r)=>getContent(r)===getContent(t.label);break;case"value":o=(e,t,r)=>r===t.value;break;default:throw new Error("Unsupported value for itemMatchType: "+r)}for(const s in n.items)if(o(s,n.items[s],t))return n.current=s,[FormElementTypes.AUTOCOMPLETE,FormElementTypes.DROPDOWNLIST,FormElementTypes.RADIOGROUP].includes(n.type)&&(n.label=n.items[s].label,n.value=n.items[s].value),this.invalidate(e),this.cascade(e),!0;return!1}setElementError(e,t,r=!1){this.errors[e]=r?toMarkdownRef("error",t):t}showElement(e){e.visible=!0,this.invalidate()}spinNoBlock(){return this.spin()}translateText(e){return super.translateText(this.getText(e))}}FormRenderer.type=guid+"FormRenderer";export{defs,FormRenderer};
@@ -1,4 +1,4 @@
1
- import type { IActivityHandler, IActivityContext } from "../../IActivityHandler";
1
+ import type { IActivityHandler } from "../../IActivityHandler";
2
2
  import type { Item } from "../../forms/FormDefinition";
3
3
  export interface GetFormElementItemsFromCollectionInputs {
4
4
  /** The collection to be converted to the items collection. */
@@ -45,5 +45,5 @@ export declare class GetFormElementItemsFromCollection implements IActivityHandl
45
45
  * Instead, we check every prototype.
46
46
  */
47
47
  private getPropertyNames;
48
- execute(inputs: GetFormElementItemsFromCollectionInputs, context: IActivityContext): GetFormElementItemsFromCollectionOutputs;
48
+ execute(inputs: GetFormElementItemsFromCollectionInputs): GetFormElementItemsFromCollectionOutputs;
49
49
  }
@@ -1 +1 @@
1
- import*as TemplateUtils from"../../TemplateUtils.js";import{validation}from"../../Validation.js";import{text}from"../../forms/utils.js";class GetFormElementItemsFromCollection{_isLabelFieldName(e,t){return null!=e&&0!==t.length&&e===this._getPropertyName(e,t)}_getPropertyName(e,t){return t.includes(e)?e:void 0}_getPropertyValue(e,t,l){t=this._getPropertyName(e,t);return t?TemplateUtils.valueOrEmptyString(l[t]):void 0}_getTokenValues(e,t,l){const o={};for(const i of e){var r,a=i.token;o.hasOwnProperty(a)||(r=this._getPropertyValue(a,t,l),r=TemplateUtils.getTokenValueString(a,r),o[a]=text.escapeTextForMarkdown(r))}return o}getPropertyNames(e){const t=[];if(!e)return t;for(const l in e)"function"!=typeof e[l]&&t.push(l);return t}execute(l,e){var o=l.labelFieldName||void 0,r=validation.array("collection",l.collection,validation.never);const a={};var i=0<r.length?this.getPropertyNames(r[0]):[],n=this._isLabelFieldName(o,i),s=n?[]:TemplateUtils.findTokenInstances(o);for(let t=0;t<r.length;++t){var m,c=r[t];let e;e=n?c[l.labelFieldName]:o?(m=this._getTokenValues(s,i,c),TemplateUtils.replacePlaceholders(o,s,m)):c,void 0!==e&&null!==e||(e="");const u={};l.valueFieldName?u.value=c[l.valueFieldName]:u.value={refValueType:"data",type:"object",data:c},text.isMarkdown(e)?u.label=e:u.label=e.toString(),a[t]=u}return{items:a}}}GetFormElementItemsFromCollection.action="gcx:wf:forms::GetFormElementItemsFromCollection",GetFormElementItemsFromCollection.suite="gcx:wf:builtin";export{GetFormElementItemsFromCollection};
1
+ import*as TemplateUtils from"../../TemplateUtils.js";import{validation}from"../../Validation.js";import{text}from"../../forms/utils.js";class GetFormElementItemsFromCollection{_isLabelFieldName(e,t){return null!=e&&0!==t.length&&e===this._getPropertyName(e,t)}_getPropertyName(e,t){return t.includes(e)?e:void 0}_getPropertyValue(e,t,l){t=this._getPropertyName(e,t);return t?TemplateUtils.valueOrEmptyString(l[t]):void 0}_getTokenValues(e,t,l){const o={};for(const i of e){var r,a=i.token;o.hasOwnProperty(a)||(r=this._getPropertyValue(a,t,l),r=TemplateUtils.getTokenValueString(a,r),o[a]=text.escapeTextForMarkdown(r))}return o}getPropertyNames(e){const t=[];if(!e)return t;for(const l in e)"function"!=typeof e[l]&&t.push(l);return t}execute(l){var o=l.labelFieldName||void 0,r=validation.array("collection",l.collection,validation.never);const a={};var i=0<r.length?this.getPropertyNames(r[0]):[],n=this._isLabelFieldName(o,i),s=n?[]:TemplateUtils.findTokenInstances(o);for(let t=0;t<r.length;++t){var m,c=r[t];let e;e=n?c[l.labelFieldName]:o?(m=this._getTokenValues(s,i,c),TemplateUtils.replacePlaceholders(o,s,m)):c,void 0!==e&&null!==e||(e="");const u={};l.valueFieldName?u.value=c[l.valueFieldName]:u.value={refValueType:"data",type:"object",data:c},text.isMarkdown(e)?u.label=e:u.label=e.toString(),a[t]=u}return{items:a}}}GetFormElementItemsFromCollection.action="gcx:wf:forms::GetFormElementItemsFromCollection",GetFormElementItemsFromCollection.suite="gcx:wf:builtin";export{GetFormElementItemsFromCollection};
@@ -1,5 +1,5 @@
1
1
  import type { DisplayFormOutputs } from "./DisplayForm";
2
- import type { IActivityHandler, IActivityContext } from "../../IActivityHandler";
2
+ import type { IActivityHandler } from "../../IActivityHandler";
3
3
  import type * as defs from "../../forms/FormDefinition";
4
4
  export interface GetFormElementPropertyInputs {
5
5
  form: DisplayFormOutputs;
@@ -15,5 +15,5 @@ export interface GetFormElementPropertyOutputs {
15
15
  export declare class GetFormElementProperty implements IActivityHandler {
16
16
  static readonly action = "gcx:wf:forms::GetFormElementProperty";
17
17
  static readonly suite = "gcx:wf:builtin";
18
- execute(inputs: GetFormElementPropertyInputs, context: IActivityContext): GetFormElementPropertyOutputs;
18
+ execute(inputs: GetFormElementPropertyInputs): GetFormElementPropertyOutputs;
19
19
  }
@@ -1 +1 @@
1
- import{validation}from"../../Validation.js";import{getFormForElement}from"./FormElementMap.js";class GetFormElementProperty{execute(e,t){var{elementName:r,name:o}=e;let m=e["form"];return"object"==typeof r&&(m=getFormForElement(r)),validation.exists("form",m),{value:m.actor.getElement(r,m.event)[o]}}}GetFormElementProperty.action="gcx:wf:forms::GetFormElementProperty",GetFormElementProperty.suite="gcx:wf:builtin";export{GetFormElementProperty};
1
+ import{validation}from"../../Validation.js";import{getFormForElement}from"./FormElementMap.js";class GetFormElementProperty{execute(e){var{elementName:t,name:r}=e;let o=e["form"];return"object"==typeof t&&(o=getFormForElement(t)),validation.exists("form",o),{value:o.actor.getElement(t,o.event)[r]}}}GetFormElementProperty.action="gcx:wf:forms::GetFormElementProperty",GetFormElementProperty.suite="gcx:wf:builtin";export{GetFormElementProperty};
@@ -1,5 +1,5 @@
1
1
  import type { DisplayFormOutputs } from "./DisplayForm";
2
- import type { IActivityHandler, IActivityContext } from "../../IActivityHandler";
2
+ import type { IActivityHandler } from "../../IActivityHandler";
3
3
  import type * as defs from "../../forms/FormDefinition";
4
4
  export interface GetFormElementValueInputs {
5
5
  form: DisplayFormOutputs;
@@ -13,5 +13,5 @@ export interface GetFormElementValueOutputs {
13
13
  export declare class GetFormElementValue implements IActivityHandler {
14
14
  static readonly action = "gcx:wf:forms::GetFormElementValue";
15
15
  static readonly suite = "gcx:wf:builtin";
16
- execute(inputs: GetFormElementValueInputs, context: IActivityContext): GetFormElementValueOutputs;
16
+ execute(inputs: GetFormElementValueInputs): GetFormElementValueOutputs;
17
17
  }
@@ -1 +1 @@
1
- import{validation}from"../../Validation.js";import{isDataRef,isDateRangeRef,isDateTimeRef,isFilesRef,isGeometryRef,isItemsRef,isNumberRef,isScanRef}from"../../forms/utils.js";import{getFormForElement}from"./FormElementMap.js";class GetFormElementValue{execute(e,t){var m=e["elementName"];let a=e["form"];"object"==typeof m&&(a=getFormForElement(m)),validation.exists("form",a);let i=a.actor.getElement(m,a.event).value;return isDataRef(i)?i=i.data:isDateRangeRef(i)?i=[i.startDate,i.endDate]:isDateTimeRef(i)?i=i.value:isFilesRef(i)?i=i.files:isGeometryRef(i)?i=i.geometry:isItemsRef(i)?i=i.items:isNumberRef(i)?i=i.numeric:isScanRef(i)&&(i=i.value),{value:i}}}GetFormElementValue.action="gcx:wf:forms::GetFormElementValue",GetFormElementValue.suite="gcx:wf:builtin";export{GetFormElementValue};
1
+ import{validation}from"../../Validation.js";import{isDataRef,isDateRangeRef,isDateTimeRef,isFilesRef,isGeometryRef,isItemsRef,isNumberRef,isScanRef}from"../../forms/utils.js";import{getFormForElement}from"./FormElementMap.js";class GetFormElementValue{execute(e){var t=e["elementName"];let m=e["form"];"object"==typeof t&&(m=getFormForElement(t)),validation.exists("form",m);let a=m.actor.getElement(t,m.event).value;return isDataRef(a)?a=a.data:isDateRangeRef(a)?a=[a.startDate,a.endDate]:isDateTimeRef(a)?a=a.value:isFilesRef(a)?a=a.files:isGeometryRef(a)?a=a.geometry:isItemsRef(a)?a=a.items:isNumberRef(a)?a=a.numeric:isScanRef(a)&&(a=a.value),{value:a}}}GetFormElementValue.action="gcx:wf:forms::GetFormElementValue",GetFormElementValue.suite="gcx:wf:builtin";export{GetFormElementValue};
@@ -8,7 +8,7 @@ export interface SetFormElementEventInputs {
8
8
  elementName?: string;
9
9
  /** The name of the event to add to the Element. */
10
10
  eventName: "cancel" | "changed" | "clicked" | "custom" | "dragged" | "load" | "populate" | "submit" | "suggest" | "validate" | string;
11
- /** The id of the activity to be used as the event handler. This can be a Container, Subworkflow, or Try Catch. */
11
+ /** The id of the activity to be used as the event handler. This can be a Container, Function, or Try Catch. */
12
12
  targetActivityId: string;
13
13
  }
14
14
  export declare class SetFormElementEvent implements IActivityHandler {