@vertigis/workflow 5.33.0 → 5.34.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 (195) hide show
  1. package/Activator.d.ts +6 -2
  2. package/Collections.d.ts +8 -5
  3. package/EnumUtils.d.ts +1 -0
  4. package/Errors.d.ts +10 -1
  5. package/Errors.js +1 -1
  6. package/Hooks.d.ts +4 -1
  7. package/IActivityHandler.d.ts +19 -5
  8. package/LanguageStringUtils.js +1 -1
  9. package/ProgramInspectorFacility.d.ts +1 -0
  10. package/Task.d.ts +1 -0
  11. package/activities/app/GetApplicationInfo.d.ts +4 -1
  12. package/activities/app/GetUserInfo.d.ts +4 -1
  13. package/activities/app/RunCommand.d.ts +4 -1
  14. package/activities/app/RunOperation.d.ts +8 -2
  15. package/activities/arcgis/AddGraphics.d.ts +8 -2
  16. package/activities/arcgis/MapProvider.d.ts +4 -1
  17. package/activities/arcgis/QueryTask.d.ts +8 -2
  18. package/activities/arcgis/SetMap.d.ts +4 -1
  19. package/activities/arcgis/ShowResults.d.ts +3 -0
  20. package/activities/arcgis/runUtils.d.ts +5 -1
  21. package/activities/core/ChannelProvider.d.ts +1 -0
  22. package/activities/core/converters.d.ts +1 -1
  23. package/activities/forms/DisplayForm.d.ts +4 -1
  24. package/activities/forms/FormRenderer.d.ts +1 -0
  25. package/activities/forms/FormRenderer.js +1 -1
  26. package/activities/forms/SetFormElementProperty.d.ts +1 -1
  27. package/activities/index.d.ts +1 -0
  28. package/activities/index.js +1 -1
  29. package/activities/pdf/AddGeoreferenceToPdf.d.ts +19 -0
  30. package/activities/pdf/AddGeoreferenceToPdf.js +1 -0
  31. package/activities/ui/Alert.d.ts +4 -1
  32. package/activities/ui/Confirm.d.ts +8 -2
  33. package/activities/ui/Prompt.d.ts +8 -2
  34. package/definition/Program.d.ts +4 -1
  35. package/definition/ProgramInspector.d.ts +4 -1
  36. package/definition/Reference.d.ts +4 -1
  37. package/diagnostics/ConsoleDebugLogger.d.ts +4 -1
  38. package/diagnostics/logging.d.ts +4 -1
  39. package/execution/ActivityLoader.d.ts +4 -1
  40. package/execution/Engine.d.ts +16 -4
  41. package/execution/IDebugSession.d.ts +4 -1
  42. package/forms/Calendar.d.ts +1 -1
  43. package/forms/FormComponent.d.ts +4 -3
  44. package/forms/FormComponent.js +1 -1
  45. package/forms/FormDefinition.d.ts +91 -15
  46. package/forms/FormElement.d.ts +3 -17
  47. package/forms/FormElement.js +1 -1
  48. package/forms/FormHost.d.ts +20 -6
  49. package/forms/FormHost.js +1 -1
  50. package/forms/FormPresenterHost.d.ts +17 -4
  51. package/forms/common.d.ts +6 -7
  52. package/forms/common.js +1 -1
  53. package/forms/components/AccordionGroup.d.ts +15 -0
  54. package/forms/components/AccordionGroup.js +1 -0
  55. package/forms/components/AutoComplete.d.ts +7 -0
  56. package/forms/components/AutoComplete.js +1 -0
  57. package/forms/components/ButtonBar.d.ts +13 -0
  58. package/forms/components/ButtonBar.js +1 -0
  59. package/forms/components/CheckBox.d.ts +7 -0
  60. package/forms/components/CheckBox.js +1 -0
  61. package/forms/components/CheckGroup.d.ts +7 -0
  62. package/forms/components/CheckGroup.js +1 -0
  63. package/forms/components/Custom.d.ts +7 -0
  64. package/forms/components/Custom.js +1 -0
  65. package/forms/components/DatePicker.d.ts +6 -16
  66. package/forms/components/DatePicker.js +1 -1
  67. package/forms/components/DateRangePicker.d.ts +10 -8
  68. package/forms/components/DateRangePicker.js +1 -1
  69. package/forms/components/DateTimePicker.d.ts +6 -8
  70. package/forms/components/DateTimePicker.js +1 -1
  71. package/forms/components/DropDownList.d.ts +7 -0
  72. package/forms/components/DropDownList.js +1 -0
  73. package/forms/components/FilePicker.d.ts +9 -0
  74. package/forms/components/FilePicker.js +1 -0
  75. package/forms/components/Form.d.ts +23 -0
  76. package/forms/components/Form.js +1 -0
  77. package/forms/components/GeometryPicker.d.ts +4 -0
  78. package/forms/components/GeometryPicker.js +1 -0
  79. package/forms/components/GeometryPickerListItem.d.ts +23 -0
  80. package/forms/components/GeometryPickerListItem.js +1 -0
  81. package/forms/components/HorizontalRule.d.ts +7 -0
  82. package/forms/components/HorizontalRule.js +1 -0
  83. package/forms/components/Image.d.ts +7 -0
  84. package/forms/components/Image.js +1 -0
  85. package/forms/components/ItemPicker.d.ts +17 -0
  86. package/forms/components/ItemPicker.js +1 -0
  87. package/forms/components/ListBox.d.ts +7 -0
  88. package/forms/components/ListBox.js +1 -0
  89. package/forms/components/Markdown.d.ts +1 -1
  90. package/forms/components/Markdown.js +1 -1
  91. package/forms/components/Number.d.ts +7 -0
  92. package/forms/components/Number.js +1 -0
  93. package/forms/components/NumberRangeSlider.d.ts +11 -8
  94. package/forms/components/NumberRangeSlider.js +1 -1
  95. package/forms/components/NumberSlider.d.ts +9 -8
  96. package/forms/components/NumberSlider.js +1 -1
  97. package/forms/components/RadioGroup.d.ts +7 -0
  98. package/forms/components/RadioGroup.js +1 -0
  99. package/forms/components/Scanner.d.ts +9 -0
  100. package/forms/components/Scanner.js +1 -0
  101. package/forms/components/Section.d.ts +14 -0
  102. package/forms/components/Section.js +1 -0
  103. package/forms/components/Text.d.ts +1 -1
  104. package/forms/components/Text.js +1 -1
  105. package/forms/components/TextArea.d.ts +1 -1
  106. package/forms/components/TextArea.js +1 -1
  107. package/forms/components/TextBox.d.ts +1 -1
  108. package/forms/components/TextBox.js +1 -1
  109. package/forms/components/TimePicker.d.ts +7 -0
  110. package/forms/components/TimePicker.js +1 -0
  111. package/forms/constants.d.ts +2 -31
  112. package/forms/constants.js +1 -1
  113. package/forms/dateUtilities.d.ts +41 -9
  114. package/forms/dateUtilities.js +1 -1
  115. package/forms/elements/AutoComplete.d.ts +7 -0
  116. package/forms/elements/AutoComplete.js +1 -0
  117. package/forms/elements/Number.d.ts +5 -0
  118. package/forms/elements/Number.js +1 -0
  119. package/forms/elements/NumberRangeSlider.d.ts +5 -3
  120. package/forms/elements/NumberRangeSlider.js +1 -1
  121. package/forms/elements/NumberSlider.d.ts +0 -3
  122. package/forms/elements/NumberSlider.js +0 -1
  123. package/forms/elements/Scanner.d.ts +9 -0
  124. package/forms/elements/Scanner.js +1 -0
  125. package/forms/elements/types.d.ts +4 -2
  126. package/forms/index.d.ts +6 -2
  127. package/forms/index.js +1 -1
  128. package/forms/keyboard.d.ts +1 -0
  129. package/forms/numberFormatter.d.ts +5 -6
  130. package/forms/numberFormatter.js +1 -1
  131. package/forms/numberUtilities.d.ts +113 -0
  132. package/forms/numberUtilities.js +1 -0
  133. package/forms/presenter.d.ts +1 -0
  134. package/forms/presenter.js +1 -1
  135. package/forms/renderers.d.ts +29 -35
  136. package/forms/renderers.js +1 -1
  137. package/forms/textUtilities.d.ts +6 -4
  138. package/forms/textUtilities.js +1 -1
  139. package/forms/utils.d.ts +71 -18
  140. package/forms/utils.js +1 -1
  141. package/index.d.ts +1 -1
  142. package/index.js +0 -1
  143. package/libs/version.d.ts +1 -1
  144. package/libs/version.js +1 -1
  145. package/package.json +10 -11
  146. package/forms/LegacyStyles.d.ts +0 -498
  147. package/forms/LegacyStyles.js +0 -1
  148. package/forms/assets/arrow.d.ts +0 -4
  149. package/forms/assets/arrow.js +0 -1
  150. package/forms/assets/chevron.d.ts +0 -3
  151. package/forms/assets/chevron.js +0 -1
  152. package/forms/assets/cross.d.ts +0 -3
  153. package/forms/assets/cross.js +0 -1
  154. package/forms/assets/datetime.d.ts +0 -3
  155. package/forms/assets/datetime.js +0 -1
  156. package/forms/assets/remove.d.ts +0 -2
  157. package/forms/assets/remove.js +0 -1
  158. package/forms/assets/scan.d.ts +0 -4
  159. package/forms/assets/scan.js +0 -1
  160. package/forms/assets/stock.d.ts +0 -5
  161. package/forms/assets/stock.js +0 -1
  162. package/forms/components/DateRange.d.ts +0 -6
  163. package/forms/components/DateRange.js +0 -1
  164. package/forms/components/Navigator.d.ts +0 -1
  165. package/forms/components/Navigator.js +0 -1
  166. package/forms/components/ReactDateRangeCalendar.d.ts +0 -6
  167. package/forms/components/ReactDateRangeCalendar.js +0 -1
  168. package/forms/components/SyntheticButton.d.ts +0 -1
  169. package/forms/components/SyntheticButton.js +0 -1
  170. package/forms/components/TimePickerInput.d.ts +0 -24
  171. package/forms/components/TimePickerInput.js +0 -1
  172. package/forms/components/TimerManager.d.ts +0 -7
  173. package/forms/components/TimerManager.js +0 -1
  174. package/forms/components/utils.d.ts +0 -2
  175. package/forms/components/utils.js +0 -1
  176. package/forms/datetime.d.ts +0 -5
  177. package/forms/datetime.js +0 -1
  178. package/forms/files.d.ts +0 -4
  179. package/forms/files.js +0 -1
  180. package/forms/geometry.d.ts +0 -4
  181. package/forms/geometry.js +0 -1
  182. package/forms/number.d.ts +0 -11
  183. package/forms/number.js +0 -1
  184. package/forms/numberSliderUtilities.d.ts +0 -12
  185. package/forms/numberSliderUtilities.js +0 -1
  186. package/forms/scanner.d.ts +0 -4
  187. package/forms/scanner.js +0 -1
  188. package/forms/selectors.d.ts +0 -10
  189. package/forms/selectors.js +0 -1
  190. package/forms/styles/daterange.css +0 -1
  191. package/forms/styles/daterange.d.ts +0 -1
  192. package/forms/styles/daterange.js +0 -1
  193. package/forms/styles/stock.css +0 -1
  194. package/forms/styles/stock.d.ts +0 -1
  195. package/forms/styles/stock.js +0 -1
@@ -34,34 +34,9 @@ export declare const FormElementTypes: {
34
34
  TEXTBOX: string;
35
35
  TIMEPICKER: string;
36
36
  };
37
- export declare const CssClasses: {
38
- /**
39
- * The Form Element contains a drop down list.
40
- */
41
- DROPDOWN: string;
42
- /**
43
- * The Form Element has an error.
44
- */
45
- ERROR: string;
46
- /**
47
- * The Form Element cannot contain any more items.
48
- */
49
- FULL: string;
50
- /**
51
- * The Form Element is a Number or Number Slider.
52
- */
53
- NUMERIC: string;
54
- /**
55
- * The Form Element can only contain a single item.
56
- */
57
- SINGLE: string;
58
- /**
59
- * The Form Element allows increment by steps.
60
- */
61
- STEPPER: string;
62
- };
63
37
  /**
64
38
  * The way that Form Element Items are presented to the user.
39
+ * @public
65
40
  */
66
41
  export declare const Orientation: {
67
42
  /** The items are laid out side-by-side, in a row. */
@@ -77,13 +52,9 @@ export declare enum ScanType {
77
52
  BarCode = "barcode",
78
53
  QrCode = "qrcode"
79
54
  }
80
- /**
81
- * The default number of rows for a Text Area in the Scanner Form Element.
82
- * This is defined outside of scanner.tsx to prevent webpack from pulling @zxing/library into the designer.
83
- */
84
- export declare const SCANNER_DEFAULT_ROW_COUNT = 5;
85
55
  /**
86
56
  * The way that a Form Element's title is positioned relative to its content.
57
+ * @public
87
58
  */
88
59
  export declare const TitleLocation: {
89
60
  /** The title is shown above the element's content. */
@@ -1 +1 @@
1
- const FormElementTypes={AUTOCOMPLETE:"AutoComplete",BUTTONBAR:"ButtonBar",CHECKBOX:"CheckBox",CHECKGROUP:"CheckGroup",CUSTOM:"Custom",DATEPICKER:"DatePicker",DATERANGEPICKER:"DateRangePicker",DATETIMEPICKER:"DateTimePicker",DROPDOWNLIST:"DropDownList",FILEPICKER:"FilePicker",GEOMETRYPICKER:"GeometryPicker",HEADER:"Header",HORIZONTALRULE:"HorizontalRule",IMAGE:"Image",ITEMPICKER:"ItemPicker",LISTBOX:"ListBox",NUMBER:"Number",NUMBERRANGESLIDER:"NumberRangeSlider",NUMBERSLIDER:"NumberSlider",PASSWORDBOX:"PasswordBox",RADIOGROUP:"RadioGroup",SCANNER:"Scanner",SECTION:"Section",TEXT:"Text",TEXTAREA:"TextArea",TEXTBOX:"TextBox",TIMEPICKER:"TimePicker"},CssClasses={DROPDOWN:"dropdown",ERROR:"error",FULL:"full",NUMERIC:"Numeric",SINGLE:"single",STEPPER:"stepper"},Orientation={HORIZONTAL:"horizontal",VERTICAL:"vertical"};var ScanType;!function(e){e.BarCode="barcode",e.QrCode="qrcode"}(ScanType=ScanType||{});const SCANNER_DEFAULT_ROW_COUNT=5,TitleLocation={ABOVE:"above",BESIDE:"beside"};export{FormElementTypes,CssClasses,Orientation,ScanType,SCANNER_DEFAULT_ROW_COUNT,TitleLocation};
1
+ const FormElementTypes={AUTOCOMPLETE:"AutoComplete",BUTTONBAR:"ButtonBar",CHECKBOX:"CheckBox",CHECKGROUP:"CheckGroup",CUSTOM:"Custom",DATEPICKER:"DatePicker",DATERANGEPICKER:"DateRangePicker",DATETIMEPICKER:"DateTimePicker",DROPDOWNLIST:"DropDownList",FILEPICKER:"FilePicker",GEOMETRYPICKER:"GeometryPicker",HEADER:"Header",HORIZONTALRULE:"HorizontalRule",IMAGE:"Image",ITEMPICKER:"ItemPicker",LISTBOX:"ListBox",NUMBER:"Number",NUMBERRANGESLIDER:"NumberRangeSlider",NUMBERSLIDER:"NumberSlider",PASSWORDBOX:"PasswordBox",RADIOGROUP:"RadioGroup",SCANNER:"Scanner",SECTION:"Section",TEXT:"Text",TEXTAREA:"TextArea",TEXTBOX:"TextBox",TIMEPICKER:"TimePicker"},Orientation={HORIZONTAL:"horizontal",VERTICAL:"vertical"};var ScanType;!function(e){e.BarCode="barcode",e.QrCode="qrcode"}(ScanType=ScanType||{});const TitleLocation={ABOVE:"above",BESIDE:"beside"};export{FormElementTypes,Orientation,ScanType,TitleLocation};
@@ -1,4 +1,14 @@
1
- import { DateRangeRef } from "./FormDefinition";
1
+ import { Calendar } from "./Calendar";
2
+ import { DateRangeRef, DateTimeFormat, DateTimeRef, DateTimeType } from "./FormDefinition";
3
+ import { defs } from "./FormHost";
4
+ import { FormPresenterHost } from "./FormPresenterHost";
5
+ /**
6
+ * Checks if a form element's value is equal to the supplied value.
7
+ * @param element A Form Element to inspect.
8
+ * @param newValue A new value for the Form Element.
9
+ * @returns True if the element's current value and the new value are equal, false otherwise.
10
+ */
11
+ export declare function areValuesEqual(element: defs.Element, newValue: DateTimeRef | DateRangeRef): boolean;
2
12
  /**
3
13
  * Checks if a given date is valid or not.
4
14
  * @param date The date object to check.
@@ -15,7 +25,7 @@ export declare function tryParseYear(year: string): string;
15
25
  * Returns undefined if input is valid.
16
26
  * @param month The string for the month.
17
27
  */
18
- export declare function tryParseMonth(month: string): string;
28
+ export declare function tryParseMonth(month: string): string | undefined;
19
29
  /**
20
30
  * Converts a given string to a corresponding two digit day. Performs basic validation.
21
31
  * Returns undefined if input is valid.
@@ -53,12 +63,6 @@ export declare function getLocaleDateFormatSeparator(): string;
53
63
  * 1 for year position in mm/yyyy/dd and 0 for year position in yyyy/mm/dd.
54
64
  */
55
65
  export declare function getLocaleDateFormatTokenPosition(token: "yyyy" | "dd" | "MM"): number;
56
- /**
57
- * Returns a string formatted using the locale date format while always using 'yyyy', 'MM' and
58
- * 'dd' token styles ie two digit months and days and four digit years.
59
- * @param date The input date
60
- */
61
- export declare function getDateAsLocaleFormattedString(date: Date): string;
62
66
  /**
63
67
  * Inputs that can be converted to a DateRangeRef. Requires two values that can be converted into
64
68
  * start and end dates
@@ -75,7 +79,7 @@ export declare type DateRangeLike = (Date | number | string)[] | {
75
79
  * DateRangeRef like object.
76
80
  * @returns A valid DateRangeRef if possible. Undefined otherwise.
77
81
  */
78
- export declare function convertToDateRangeRef(value: DateRangeLike): DateRangeRef;
82
+ export declare function convertToDateRangeRef(value: DateRangeLike): DateRangeRef | undefined;
79
83
  /**
80
84
  * This function is for the sole purpose of facilitating testing. This should not be
81
85
  * used for any other purpose. An incorrect value set here will result in incorrect
@@ -83,3 +87,31 @@ export declare function convertToDateRangeRef(value: DateRangeLike): DateRangeRe
83
87
  * @param dateFormat The date format to set in cache.
84
88
  */
85
89
  export declare function __test__setlocaleDateFormatInCache(dateFormat: string): void;
90
+ export declare function loadLocale(host: FormPresenterHost): Promise<Locale>;
91
+ declare type Partial = void | boolean | number | string | {
92
+ [name: string]: any;
93
+ format?: Partial | void;
94
+ locale?: string;
95
+ timezone?: string;
96
+ refValueType?: string;
97
+ value?: number;
98
+ };
99
+ export declare function makeProperFormat(value: Partial, format: Partial): defs.DateTimeFormat;
100
+ export declare function makeProperValue(value: number | string | Partial, calendar: Calendar): Date;
101
+ export declare function isInvalidDate(date: Date | null): boolean;
102
+ export declare function hasErrorChanged(element: defs.Element, error: defs.StatusRef | undefined): boolean;
103
+ /**
104
+ * Updates `element.value` with a new `DateTimeRef` using the supplied parameters.
105
+ *
106
+ * Care is taken to ensure we don't replace `element.value` with an identical
107
+ * `DateTimeRef` as this can lead to infinite loops in react components
108
+ * when `element.value` is a dependency of a hook such as `useEffect`.
109
+ * @param element The element to be updated.
110
+ * @param date The new `Date` value to use.
111
+ * @param refValueType The type of value that this represents.
112
+ * @param format The format of the value.
113
+ * @param calendar A calendar to use to get a text representation of the date.
114
+ * @returns True if the value was updated, false otherwise.
115
+ */
116
+ export declare function updateElementValue(element: defs.Element, date: Date | undefined | null, refValueType: DateTimeType, format: DateTimeFormat, calendar: Calendar): boolean;
117
+ export {};
@@ -1 +1 @@
1
- import{parse,isAfter}from"date-fns";import{parseLocale}from"../definition/ProgramInspector.js";const CURRENT_CENTURY_YEAR_CUTOFF=29,SUPPORTED_DATE_FNS_LOCALES=["cs","da","de","de-AT","en-AU","en-CA","en-GB","en-IN","en-NZ","en-US","en-ZA","fr","fr-CA","fr-CH","it","nb","nl","nl-BE","nn","pt","pt-BR"];let localeDateFormat="",dateFormatSeparator;function isValidDate(e){return e instanceof Date&&!isNaN(e.valueOf())}function tryParseYear(e){if(/^\d+$/.test(e)&&!(4<e.length)){for(2===e.length&&(e=`${CURRENT_CENTURY_YEAR_CUTOFF>=parseInt(e,10)?20:19}${e}`);e.length<4;)e=`0${e}`;return e}}function tryParseMonth(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e=`0${e}`);var a=parseInt(e,10);if(!(a<1||12<a))return e}}function tryParseDay(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e=`0${e}`);var a=parseInt(e,10);if(!(a<1||31<a))return e}}function tryParseDateText(e){if(e){const r=(e=e.replace(/\\/g,"\\\\")).match(/(\d+)/g);if(3===r?.length){var e=getLocaleDateFormatSeparator(),a=getLocaleDateFormatTokenPosition("yyyy"),t=getLocaleDateFormatTokenPosition("MM");for(let e=0;e<3;e++){switch(e){case a:r[e]=tryParseYear(r[e]);break;case t:r[e]=tryParseMonth(r[e]);break;default:r[e]=tryParseDay(r[e])}if(void 0===r[e])return}return`${r[0]}${e}${r[1]}${e}${r[2]}`}}}async function getDateFnsLocale(e){const a=[];e=parseLocale(e);if(e){e.territory&&a.push(`${e.language}-${e.territory}`),a.push(e.language);for(const t of a)if(-1!==SUPPORTED_DATE_FNS_LOCALES.indexOf(t)){let e;try{switch(t){case"cs":e=(await import("date-fns/locale/cs")).default;break;case"da":e=(await import("date-fns/locale/da")).default;break;case"de":e=(await import("date-fns/locale/de")).default;break;case"de-AT":e=(await import("date-fns/locale/de-AT")).default;break;case"en-AU":e=(await import("date-fns/locale/en-AU")).default;break;case"en-CA":e=(await import("date-fns/locale/en-CA")).default;break;case"en-GB":e=(await import("date-fns/locale/en-GB")).default;break;case"en-IN":e=(await import("date-fns/locale/en-IN")).default;break;case"en-NZ":e=(await import("date-fns/locale/en-NZ")).default;break;case"en-US":e=(await import("date-fns/locale/en-US")).default;break;case"en-ZA":e=(await import("date-fns/locale/en-ZA")).default;break;case"fr":e=(await import("date-fns/locale/fr")).default;break;case"fr-CA":e=(await import("date-fns/locale/fr-CA")).default;break;case"fr-CH":e=(await import("date-fns/locale/fr-CH")).default;break;case"it":e=(await import("date-fns/locale/it")).default;break;case"nb":e=(await import("date-fns/locale/nb")).default;break;case"nl":e=(await import("date-fns/locale/nl")).default;break;case"nl-BE":e=(await import("date-fns/locale/nl-BE")).default;break;case"nn":e=(await import("date-fns/locale/nn")).default;break;case"pt":e=(await import("date-fns/locale/pt")).default;break;case"pt-BR":e=(await import("date-fns/locale/pt-BR")).default}}catch{continue}if(e?.localize)return e}}}function getLocaleDateFormat(){if(localeDateFormat)return localeDateFormat;const e=new Date(1999,11,31,0,0,0);return localeDateFormat=e.toLocaleDateString(void 0,{year:"numeric",month:"numeric",day:"numeric"}),localeDateFormat=localeDateFormat.replace("1999","yyyy"),localeDateFormat=localeDateFormat.replace("99","yyyy"),localeDateFormat=localeDateFormat.replace("12","MM"),localeDateFormat=localeDateFormat.replace("31","dd"),localeDateFormat}function getLocaleDateFormatSeparator(){var e;return void 0===dateFormatSeparator&&(e=/[^dMy]+/.exec(getLocaleDateFormat()),dateFormatSeparator=e?e[0]:""),dateFormatSeparator}function getLocaleDateFormatTokenPosition(e){const a=getLocaleDateFormat();var t=a.indexOf("yyyy"),r=a.indexOf("MM"),o=a.indexOf("dd");return"yyyy"===e?0===t?0:r<t&&o<t?2:1:"MM"===e?0===r?0:o<r&&t<r?2:1:0===o?0:r<o&&t<o?2:1}function getDateAsLocaleFormattedString(e){if(!isValidDate(e))return"";var a=tryParseYear(e.getFullYear().toString()),t=tryParseMonth((e.getMonth()+1).toString()),e=tryParseDay(e.getDate().toString());let r=getLocaleDateFormat();return r=r.replace("yyyy",a),r=r.replace("MM",t),r=r.replace("dd",e),r}const coerceIntoDate=e=>{if(e instanceof Date&&isValidDate(e))return new Date(e.valueOf());if("string"==typeof e)if(/^\d+$/.test(e))e=Number(e);else{var a=tryParseDateText(e);if(a){var t=getLocaleDateFormat(),t=parse(a,t,0);if(isValidDate(t))return t}}if("number"==typeof e){e=new Date(e);if(isValidDate(e))return e}};function convertToDateRangeRef(e){let a=void 0,t=void 0,r=!1;Array.isArray(e)?(a=coerceIntoDate(e[0]),t=coerceIntoDate(e[1]),r=!0):"object"==typeof e&&(a=coerceIntoDate(e.startDate),t=coerceIntoDate(e.endDate));var o=!!a&&!!t;let n=o&&!isAfter(a,t);return r&&o&&!n&&(e=a,a=t,t=e,n=!0),o&&n?{refValueType:"daterange",startDate:a,endDate:t}:void 0}function __test__setlocaleDateFormatInCache(e){localeDateFormat=e,dateFormatSeparator=void 0}export{isValidDate,tryParseYear,tryParseMonth,tryParseDay,tryParseDateText,getDateFnsLocale,getLocaleDateFormat,getLocaleDateFormatSeparator,getLocaleDateFormatTokenPosition,getDateAsLocaleFormattedString,convertToDateRangeRef,__test__setlocaleDateFormatInCache};
1
+ import{parse,isAfter}from"date-fns";import{DEFAULT_LOCALE}from"../constants.js";import{parseLocale}from"../definition/ProgramInspector.js";import{Calendar}from"./Calendar.js";import{isStatus}from"./textUtilities.js";import{isDateRangeRef,isDateTimeRef}from"./utils.js";const CURRENT_CENTURY_YEAR_CUTOFF=29,SUPPORTED_DATE_FNS_LOCALES=["cs","da","de","de-AT","en-AU","en-CA","en-GB","en-IN","en-NZ","en-US","en-ZA","fr","fr-CA","fr-CH","it","nb","nl","nl-BE","nn","pt","pt-BR"];let localeDateFormat="",dateFormatSeparator;function areValuesEqual(e,a){const t=e.value;return void 0===t&&void 0===a||null===t&&null===a||(isDateTimeRef(t)&&isDateTimeRef(a)?t.display===a.display&&t.format===a.format&&t.refValueType===a.refValueType&&t.value===a.value:!(!isDateRangeRef(t)||!isDateRangeRef(a))&&(t.endDate?.valueOf()===a.endDate?.valueOf()&&t.refValueType===a.refValueType&&t.startDate?.valueOf()===a.startDate?.valueOf()))}function isValidDate(e){return e instanceof Date&&!isNaN(e.valueOf())}function tryParseYear(e){if(/^\d+$/.test(e)&&!(4<e.length)){for(2===e.length&&(e=`${CURRENT_CENTURY_YEAR_CUTOFF>=parseInt(e,10)?20:19}${e}`);e.length<4;)e=`0${e}`;return e}}function tryParseMonth(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e=`0${e}`);var a=parseInt(e,10);if(!(a<1||12<a))return e}}function tryParseDay(e){if(/^\d+$/.test(e)&&!(2<e.length)){1===e.length&&(e=`0${e}`);var a=parseInt(e,10);if(!(a<1||31<a))return e}}function tryParseDateText(e){if(e){const r=(e=e.replace(/\\/g,"\\\\")).match(/(\d+)/g);if(3===r?.length){var e=getLocaleDateFormatSeparator(),a=getLocaleDateFormatTokenPosition("yyyy"),t=getLocaleDateFormatTokenPosition("MM");for(let e=0;e<3;e++){switch(e){case a:r[e]=tryParseYear(r[e]);break;case t:r[e]=tryParseMonth(r[e]);break;default:r[e]=tryParseDay(r[e])}if(void 0===r[e])return}return`${r[0]}${e}${r[1]}${e}${r[2]}`}}}async function getDateFnsLocale(e){const a=[];e=parseLocale(e);if(e){e.territory&&a.push(`${e.language}-${e.territory}`),a.push(e.language);for(const t of a)if(-1!==SUPPORTED_DATE_FNS_LOCALES.indexOf(t)){let e;try{switch(t){case"cs":e=(await import("date-fns/locale/cs")).default;break;case"da":e=(await import("date-fns/locale/da")).default;break;case"de":e=(await import("date-fns/locale/de")).default;break;case"de-AT":e=(await import("date-fns/locale/de-AT")).default;break;case"en-AU":e=(await import("date-fns/locale/en-AU")).default;break;case"en-CA":e=(await import("date-fns/locale/en-CA")).default;break;case"en-GB":e=(await import("date-fns/locale/en-GB")).default;break;case"en-IN":e=(await import("date-fns/locale/en-IN")).default;break;case"en-NZ":e=(await import("date-fns/locale/en-NZ")).default;break;case"en-US":e=(await import("date-fns/locale/en-US")).default;break;case"en-ZA":e=(await import("date-fns/locale/en-ZA")).default;break;case"fr":e=(await import("date-fns/locale/fr")).default;break;case"fr-CA":e=(await import("date-fns/locale/fr-CA")).default;break;case"fr-CH":e=(await import("date-fns/locale/fr-CH")).default;break;case"it":e=(await import("date-fns/locale/it")).default;break;case"nb":e=(await import("date-fns/locale/nb")).default;break;case"nl":e=(await import("date-fns/locale/nl")).default;break;case"nl-BE":e=(await import("date-fns/locale/nl-BE")).default;break;case"nn":e=(await import("date-fns/locale/nn")).default;break;case"pt":e=(await import("date-fns/locale/pt")).default;break;case"pt-BR":e=(await import("date-fns/locale/pt-BR")).default}}catch{continue}if(e?.localize)return e}}}function getLocaleDateFormat(){if(localeDateFormat)return localeDateFormat;const e=new Date(1999,11,31,0,0,0);return localeDateFormat=e.toLocaleDateString(void 0,{year:"numeric",month:"numeric",day:"numeric"}),localeDateFormat=localeDateFormat.replace("1999","yyyy"),localeDateFormat=localeDateFormat.replace("99","yyyy"),localeDateFormat=localeDateFormat.replace("12","MM"),localeDateFormat=localeDateFormat.replace("31","dd"),localeDateFormat}function getLocaleDateFormatSeparator(){var e;return void 0===dateFormatSeparator&&(e=/[^dMy]+/.exec(getLocaleDateFormat()),dateFormatSeparator=e?e[0]:""),dateFormatSeparator}function getLocaleDateFormatTokenPosition(e){const a=getLocaleDateFormat();var t=a.indexOf("yyyy"),r=a.indexOf("MM"),o=a.indexOf("dd");return"yyyy"===e?0===t?0:r<t&&o<t?2:1:"MM"===e?0===r?0:o<r&&t<r?2:1:0===o?0:r<o&&t<o?2:1}const coerceIntoDate=e=>{if(e instanceof Date&&isValidDate(e))return new Date(e.valueOf());if("string"==typeof e)if(/^\d+$/.test(e))e=Number(e);else{var a=tryParseDateText(e);if(a){var t=getLocaleDateFormat(),t=parse(a,t,0);if(isValidDate(t))return t}}if("number"==typeof e){e=new Date(e);if(isValidDate(e))return e}};function convertToDateRangeRef(e){let a,t,r=!1;Array.isArray(e)?(a=coerceIntoDate(e[0]),t=coerceIntoDate(e[1]),r=!0):"object"==typeof e&&(a=coerceIntoDate(e.startDate),t=coerceIntoDate(e.endDate));var o=!!a&&!!t;let n=o&&!isAfter(a,t);return r&&o&&!n&&(e=a,a=t,t=e,n=!0),o&&n?{refValueType:"daterange",startDate:a,endDate:t}:void 0}function __test__setlocaleDateFormatInCache(e){localeDateFormat=e,dateFormatSeparator=void 0}async function loadLocale(e){e=e.deriveLocale();if("inv"!==e&&"en"!==e&&e!==DEFAULT_LOCALE)return getDateFnsLocale(e)}function makeProperFormat(e,a){if("object"==typeof e&&null!==e)switch(e.refValueType){case"date":case"time":case"datetime":a=e.format}if("object"!=typeof a)return"app"===a?a:"device";if(null===a)return"device";var t=a.locale,r=a.timezone;return"string"==typeof t&&"string"==typeof r?{locale:t,timezone:r}:"device"}function makeProperValue(e,a){if("object"==typeof e){if(null===e)return;switch(e.refValueType){case"date":case"time":case"datetime":break;default:return}e=e.value}if("number"==typeof e||"string"==typeof e){const t=a.coerceIntoValue(e);if(void 0!==t&&null!==t&&isFinite(t.valueOf()))return t}}function isInvalidDate(e){return e instanceof Date&&isNaN(e.getDate())}function hasErrorChanged(e,a){e=e.error;return(void 0!==e||void 0!==a)&&((null!==e||null!==a)&&(!isStatus(e)||!isStatus(a)||e.status!==a.status))}function updateElementValue(e,a,t,r,o){if(null!=a&&isFinite(a.valueOf())){a={refValueType:t,format:r,display:o.format(a,Calendar.fullFormat),value:a.valueOf()};if(!areValuesEqual(e,a))return e.value=a,!0}else if(void 0!==e.value)return!(e.value=void 0);return!1}export{areValuesEqual,isValidDate,tryParseYear,tryParseMonth,tryParseDay,tryParseDateText,getDateFnsLocale,getLocaleDateFormat,getLocaleDateFormatSeparator,getLocaleDateFormatTokenPosition,convertToDateRangeRef,__test__setlocaleDateFormatInCache,loadLocale,makeProperFormat,makeProperValue,isInvalidDate,hasErrorChanged,updateElementValue};
@@ -1,6 +1,13 @@
1
+ import { FormElementPropertyConstraints, PropertyConstraintsWithDefault, PropertyConstraintsWithMinimum } from "../utils";
1
2
  import * as types from "./types";
2
3
  export interface AutoComplete extends types.ElementBase, types.EditableElement, types.ElementWithItems<Item>, types.ElementWithStringLabel, types.ElementWithRequire {
3
4
  /** Indicates the current value. */
4
5
  readonly value?: any;
5
6
  }
6
7
  export declare type Item = types.ElementItemBase<any>;
8
+ interface AutoCompletePropertyConstraints extends FormElementPropertyConstraints {
9
+ delay: PropertyConstraintsWithDefault<number> & PropertyConstraintsWithMinimum<number>;
10
+ minLength: PropertyConstraintsWithDefault<number> & PropertyConstraintsWithMinimum<number>;
11
+ }
12
+ export declare const autoCompletePropertyConstraints: AutoCompletePropertyConstraints;
13
+ export {};
@@ -0,0 +1 @@
1
+ const autoCompletePropertyConstraints={delay:{default:300,minimum:1},minLength:{default:3,minimum:1}};export{autoCompletePropertyConstraints};
@@ -1,6 +1,11 @@
1
1
  import { NumberRef } from "../FormDefinition";
2
+ import { NumberFormatConfiguration } from "../numberUtilities";
2
3
  import * as types from "./types";
3
4
  export interface Number extends types.ElementBase, types.EditableElement, types.ElementWithRequire {
4
5
  /** Indicates the current value. */
5
6
  readonly value: NumberRef;
6
7
  }
8
+ /**
9
+ * Constraints that the Number element enforces on the bounds.
10
+ */
11
+ export declare const numberFormatConfiguration: Partial<NumberFormatConfiguration>;
@@ -0,0 +1 @@
1
+ const numberFormatConfiguration={lowerBound:{default:void 0},upperBound:{default:void 0}};export{numberFormatConfiguration};
@@ -1,8 +1,10 @@
1
+ import { NumberFormatConfiguration } from "../numberUtilities";
1
2
  import * as types from "./types";
2
3
  export interface NumberRangeSlider extends types.ElementBase, types.EditableElement {
3
4
  /** Indicates the current value. */
4
5
  readonly value: number[];
5
6
  }
6
- export declare const MIN_DECIMALS = 0;
7
- export declare const DEFAULT_DECIMALS = 0;
8
- export declare const DEFAULT_STEP = 0;
7
+ /**
8
+ * Constraints that the Number Range Slider enforces on the precision.
9
+ */
10
+ export declare const numberFormatConfiguration: Partial<NumberFormatConfiguration>;
@@ -1 +1 @@
1
- const MIN_DECIMALS=0,DEFAULT_DECIMALS=0,DEFAULT_STEP=0;export{MIN_DECIMALS,DEFAULT_DECIMALS,DEFAULT_STEP};
1
+ const numberFormatConfiguration={precision:{default:0,minimum:0}};export{numberFormatConfiguration};
@@ -4,6 +4,3 @@ export interface NumberSlider extends types.ElementBase, types.EditableElement {
4
4
  /** Indicates the current value. */
5
5
  readonly value: NumberRef;
6
6
  }
7
- export declare const MIN_DECIMALS = -20;
8
- export declare const DEFAULT_DECIMALS = 3;
9
- export declare const DEFAULT_STEP = 1;
@@ -1 +0,0 @@
1
- const MIN_DECIMALS=-20,DEFAULT_DECIMALS=3,DEFAULT_STEP=1;export{MIN_DECIMALS,DEFAULT_DECIMALS,DEFAULT_STEP};
@@ -1,4 +1,5 @@
1
1
  import { ScanRef } from "../FormDefinition";
2
+ import { FormElementPropertyConstraints, PropertyConstraintsWithDefault, PropertyConstraintsWithMinimum } from "../utils";
2
3
  import * as types from "./types";
3
4
  export interface Scanner extends types.ElementBase, types.EditableElement, types.ElementWithAutoActivate, types.ElementWithRequire {
4
5
  /** True if this element should support manual user entry, false otherwise. */
@@ -8,3 +9,11 @@ export interface Scanner extends types.ElementBase, types.EditableElement, types
8
9
  /** Indicates the current value. */
9
10
  readonly value: ScanRef;
10
11
  }
12
+ interface ScannerConfiguration extends FormElementPropertyConstraints {
13
+ rows: PropertyConstraintsWithDefault<number> & PropertyConstraintsWithMinimum<number>;
14
+ }
15
+ /**
16
+ * Constraints that the Scanner enforces on the rows.
17
+ */
18
+ export declare const scannerConfiguration: ScannerConfiguration;
19
+ export {};
@@ -0,0 +1 @@
1
+ const scannerConfiguration={rows:{default:5,minimum:1}};export{scannerConfiguration};
@@ -1,6 +1,8 @@
1
1
  import * as defs from "../FormDefinition";
2
- /** We re-define Text here to hide defs.StatusRef from the end user.
3
- * It is only for internal use, and adds no value in this context.
2
+ /**
3
+ * We re-define Text here to hide defs.StatusRef from the end user.
4
+ * It is only for internal use, and adds no value in this context.
5
+ * @public
4
6
  */
5
7
  export declare type Text = string | defs.MarkdownRef;
6
8
  /** Properties common to all Elements, except the Header. */
package/forms/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
- export * from "./constants";
3
- import { Text } from "./elements/types";
2
+ export { Orientation, TitleLocation } from "./constants";
3
+ export type { Text } from "./elements/types";
4
+ /** @public */
4
5
  export interface FormElementProps<TValue = undefined> extends FormElementSettableProps<TValue> {
5
6
  /** The description of the element. */
6
7
  description?: Text;
@@ -35,12 +36,14 @@ export interface FormElementProps<TValue = undefined> extends FormElementSettabl
35
36
  */
36
37
  setValue: (value: this["value"]) => void;
37
38
  }
39
+ /** @public */
38
40
  export interface FormElementSettableProps<TValue = undefined> {
39
41
  /** The value of the element. */
40
42
  value: TValue;
41
43
  }
42
44
  declare type SettablePropsFromProps<TProps extends FormElementProps> = Omit<TProps, keyof FormElementProps> & FormElementSettableProps<TProps["value"]>;
43
45
  declare type Unionize<T> = T[keyof T];
46
+ /** @public */
44
47
  export declare type PropertyChangeEvent<TSettableProps, TSetProperty> = Unionize<{
45
48
  [K in keyof Required<TSettableProps>]: {
46
49
  properties: Readonly<TSettableProps>;
@@ -48,6 +51,7 @@ export declare type PropertyChangeEvent<TSettableProps, TSetProperty> = Unionize
48
51
  setProperty: TSetProperty;
49
52
  };
50
53
  }>;
54
+ /** @public */
51
55
  export interface FormElementRegistration<TProps extends FormElementProps<any> = FormElementProps, TSettableProps extends SettablePropsFromProps<TProps> = SettablePropsFromProps<TProps>> {
52
56
  /** The React component definition of the form element. */
53
57
  component: React.ComponentType<TProps>;
package/forms/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./constants.js";
1
+ export{Orientation,TitleLocation}from"./constants.js";
@@ -5,4 +5,5 @@ export interface KeyboardEvent {
5
5
  shiftKey: boolean;
6
6
  key: string;
7
7
  }
8
+ /** @product This is intended for internal use only within VertiGIS Studio products. */
8
9
  export declare function getKeyString(event: KeyboardEvent): string;
@@ -24,7 +24,7 @@ export declare enum NumberDisplayFormat {
24
24
  */
25
25
  ACCOUNTING = "a",
26
26
  /**
27
- * A localized representation of a percentage (e.g. 0.99 -> "99%" in the
27
+ * A localized representation of a percentage (e.g. 0.99 -\> "99%" in the
28
28
  * en-US locale).
29
29
  */
30
30
  PERCENT = "p",
@@ -48,16 +48,15 @@ export declare enum NumberDisplayFormat {
48
48
  */
49
49
  export interface FormatOptions {
50
50
  /**
51
- * The locale to use when formatting the number. If not specified, the
52
- * current locale is used (see locale module).
51
+ * The locale to use when formatting the number.
53
52
  */
54
- locale?: string;
53
+ locale: string;
55
54
  /**
56
55
  * The number format. See {@link NumberFormatter.format}.
57
56
  */
58
57
  format?: NumberDisplayFormat;
59
58
  /**
60
- * See {@link NumberSettings.currency}.
59
+ * See NumberFormat.currency.
61
60
  */
62
61
  currency?: string;
63
62
  /**
@@ -65,7 +64,7 @@ export interface FormatOptions {
65
64
  */
66
65
  customDisplayFormat?: string;
67
66
  /**
68
- * See {@link NumberSettings.fractionalDigits}.
67
+ * See NumberFormat.precision.
69
68
  */
70
69
  fractionalDigits?: number;
71
70
  }
@@ -1 +1 @@
1
- import{DEFAULT_LOCALE}from"../constants.js";export{isNumeric}from"./utils.js";var NumberDisplayFormat;!function(t){t.NUMBER="n",t.FIXED_POINT="f",t.CURRENCY="c",t.ACCOUNTING="a",t.PERCENT="p",t.ROUND_TRIP="r",t.DEFAULT="n",t.CUSTOM="custom"}(NumberDisplayFormat=NumberDisplayFormat||{});const DEFAULT_CURRENCY="USD",DEFAULT_CUSTOM_FORMAT="#.##",DEFAULT_FRACTIONAL_DIGITS=4,SUPPORTED_CURRENCIES=["ADP","AED","AFA","AFN","ALK","ALL","AMD","ANG","AOA","AOK","AON","AOR","ARA","ARL","ARM","ARP","ARS","ATS","AUD","AWG","AZM","AZN","BAD","BAM","BAN","BBD","BDT","BEC","BEF","BEL","BGL","BGM","BGN","BGO","BHD","BIF","BMD","BND","BOB","BOL","BOP","BOV","BRB","BRC","BRE","BRL","BRN","BRR","BRZ","BSD","BTN","BUK","BWP","BYB","BYN","BYR","BZD","CAD","CDF","CHE","CHF","CHW","CLE","CLF","CLP","CNH","CNX","CNY","COP","COU","CRC","CSD","CSK","CUC","CUP","CVE","CYP","CZK","DDM","DEM","DJF","DKK","DOP","DZD","ECS","ECV","EEK","EGP","ERN","ESA","ESB","ESP","ETB","EUR","FIM","FJD","FKP","FRF","GBP","GEK","GEL","GHC","GHS","GIP","GMD","GNF","GNS","GQE","GRD","GTQ","GWE","GWP","GYD","HKD","HNL","HRD","HRK","HTG","HUF","IDR","IEP","ILP","ILR","ILS","INR","IQD","IRR","ISJ","ISK","ITL","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRH","KRO","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LTT","LUC","LUF","LUL","LVL","LVR","LYD","MAD","MAF","MCF","MDC","MDL","MGA","MGF","MKD","MKN","MLF","MMK","MNT","MOP","MRO","MRU","MTL","MTP","MUR","MVP","MVR","MWK","MXN","MXP","MXV","MYR","MZE","MZM","MZN","NAD","NGN","NIC","NIO","NLG","NOK","NPR","NZD","OMR","PAB","PEI","PEN","PES","PGK","PHP","PKR","PLN","PLZ","PTE","PYG","QAR","RHD","ROL","RON","RSD","RUB","RUR","RWF","SAR","SBD","SCR","SDD","SDG","SDP","SEK","SGD","SHP","SIT","SKK","SLL","SOS","SRD","SRG","SSP","STD","STN","SUR","SVC","SYP","SZL","THB","TJR","TJS","TMM","TMT","TND","TOP","TPE","TRL","TRY","TTD","TWD","TZS","UAH","UAK","UGS","UGX","USD","USN","USS","UYI","UYP","UYU","UYW","UZS","VEB","VEF","VES","VND","VNN","VUV","WST","XAF","XAG","XAU","XBA","XBB","XBC","XBD","XCD","XDR","XEU","XFO","XFU","XOF","XPD","XPF","XPT","XRE","XSU","XTS","XUA","XXX","YDD","YER","YUD","YUM","YUN","YUR","ZAL","ZAR","ZMK","ZMW","ZRN","ZRZ","ZWD","ZWL","ZWR"];function format(...t){return globalFormatter.format.apply(globalFormatter,t)}class NumberFormatter{format(...t){let r=NaN,a={};if(1===t.length?(r=t[0],a={}):2<=arguments.length&&(r=t[1],a="string"==typeof t[0]?{format:t[0]}:t[0]||a),null===r||void 0===r||isNaN(r))return"";let e=a.format||NumberDisplayFormat.DEFAULT;if(e===NumberDisplayFormat.CUSTOM&&(e=a.customDisplayFormat||DEFAULT_CUSTOM_FORMAT),e===NumberDisplayFormat.ROUND_TRIP)return r.toString();var m=e.toLowerCase();m===NumberDisplayFormat.CURRENCY||m===NumberDisplayFormat.ACCOUNTING?(i=a.currency||DEFAULT_CURRENCY,e=m,e+=a.fractionalDigits??"",e+=i?`$${i}`:""):m!==NumberDisplayFormat.NUMBER&&m!==NumberDisplayFormat.FIXED_POINT&&m!==NumberDisplayFormat.PERCENT||(e=m,e+=a.fractionalDigits??""),a.locale=a.locale||DEFAULT_LOCALE;const D=[a.locale];var i=`${D.join(";")}|${e}`;let N=numberFormatters.get(i);return N||(N=[],1===(m=e.split(";",3)).length?(N[0]=this._createNumberFormatter(D,m[0]),N[1]=N[0],N[2]=N[0]):2===m.length?(N[0]=this._createNumberFormatter(D,m[0]),N[1]=this._createNumberFormatter(D,m[1]),N[2]=N[0]):3===m.length&&(N[0]=this._createNumberFormatter(D,m[0]),N[1]=this._createNumberFormatter(D,m[1]),N[2]=this._createNumberFormatter(D,m[2])),numberFormatters.set(i,N)),0<r?N[0](r):r<0?N[1](r):N[2](r)}_createNumberFormatter(r,t){const a={};let e=t.match(standardFormatPattern);if(e){var m=e[1].toLowerCase(),D=Math.min(20,parseInt(e[2]));let t=e[3];m===NumberDisplayFormat.CURRENCY||m===NumberDisplayFormat.ACCOUNTING?t=(t||DEFAULT_CURRENCY).toUpperCase():(t="",void 0===a.minimumFractionDigits&&(a.minimumFractionDigits=0),void 0===a.maximumFractionDigits&&(a.maximumFractionDigits=Math.max(DEFAULT_FRACTIONAL_DIGITS,a.minimumFractionDigits))),m===NumberDisplayFormat.PERCENT?a.style="percent":m===NumberDisplayFormat.ACCOUNTING?a.currencySign="accounting":m===NumberDisplayFormat.FIXED_POINT&&(a.useGrouping=!1),isNaN(D)||(a.minimumFractionDigits=D,a.maximumFractionDigits=D);const E=t?new Intl.NumberFormat(r,{style:"currency",currency:t,...a}):new Intl.NumberFormat(r,a);return t=>E.format(t)}var i,N;e=t.match(/[0#]+|\.|,|%|\\.|(["'])[^\1]+\1|[^0#.,\\'"]+/g);let R=!1,F="",o="",n="",s="";a.minimumFractionDigits=0,a.maximumFractionDigits=0,a.useGrouping=!1;for(i of e)switch(i[0]){case".":R=!0;break;case",":a.useGrouping=!0;break;case"%":a.style="percent";break;case"0":case"#":R?o+=i:F+=i;break;default:0===i.indexOf('"')||0===i.indexOf("'")?i=i.slice(1,-1):0===i.indexOf("\\")&&(i=i.slice(1)),F||o?s+=i:n+=i}if(!F||0<=(N=F.indexOf("0"))&&(a.minimumIntegerDigits=F.length-N),o&&(N=o.lastIndexOf("0"),a.minimumFractionDigits=0<=N?N+1:0,a.maximumFractionDigits=Math.min(20,o.length)),F||o){const C=new Intl.NumberFormat(r,a);return t=>`${n}${C.format(t)}${s}`}return()=>n+s}}const numberFormatters=new Map,standardFormatPattern=/^([acfnp])(\d*)(?:\$([a-zA-Z]{3}))?$/i,globalFormatter=new NumberFormatter;export{NumberDisplayFormat,DEFAULT_CURRENCY,DEFAULT_CUSTOM_FORMAT,DEFAULT_FRACTIONAL_DIGITS,SUPPORTED_CURRENCIES,format};
1
+ import{DEFAULT_LOCALE}from"../constants.js";export{isNumeric}from"./utils.js";var NumberDisplayFormat;!function(t){t.NUMBER="n",t.FIXED_POINT="f",t.CURRENCY="c",t.ACCOUNTING="a",t.PERCENT="p",t.ROUND_TRIP="r",t.DEFAULT="n",t.CUSTOM="custom"}(NumberDisplayFormat=NumberDisplayFormat||{});const DEFAULT_CURRENCY="USD",DEFAULT_CUSTOM_FORMAT="#.##",DEFAULT_FRACTIONAL_DIGITS=4,SUPPORTED_CURRENCIES=["ADP","AED","AFA","AFN","ALK","ALL","AMD","ANG","AOA","AOK","AON","AOR","ARA","ARL","ARM","ARP","ARS","ATS","AUD","AWG","AZM","AZN","BAD","BAM","BAN","BBD","BDT","BEC","BEF","BEL","BGL","BGM","BGN","BGO","BHD","BIF","BMD","BND","BOB","BOL","BOP","BOV","BRB","BRC","BRE","BRL","BRN","BRR","BRZ","BSD","BTN","BUK","BWP","BYB","BYN","BYR","BZD","CAD","CDF","CHE","CHF","CHW","CLE","CLF","CLP","CNH","CNX","CNY","COP","COU","CRC","CSD","CSK","CUC","CUP","CVE","CYP","CZK","DDM","DEM","DJF","DKK","DOP","DZD","ECS","ECV","EEK","EGP","ERN","ESA","ESB","ESP","ETB","EUR","FIM","FJD","FKP","FRF","GBP","GEK","GEL","GHC","GHS","GIP","GMD","GNF","GNS","GQE","GRD","GTQ","GWE","GWP","GYD","HKD","HNL","HRD","HRK","HTG","HUF","IDR","IEP","ILP","ILR","ILS","INR","IQD","IRR","ISJ","ISK","ITL","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRH","KRO","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LTL","LTT","LUC","LUF","LUL","LVL","LVR","LYD","MAD","MAF","MCF","MDC","MDL","MGA","MGF","MKD","MKN","MLF","MMK","MNT","MOP","MRO","MRU","MTL","MTP","MUR","MVP","MVR","MWK","MXN","MXP","MXV","MYR","MZE","MZM","MZN","NAD","NGN","NIC","NIO","NLG","NOK","NPR","NZD","OMR","PAB","PEI","PEN","PES","PGK","PHP","PKR","PLN","PLZ","PTE","PYG","QAR","RHD","ROL","RON","RSD","RUB","RUR","RWF","SAR","SBD","SCR","SDD","SDG","SDP","SEK","SGD","SHP","SIT","SKK","SLL","SOS","SRD","SRG","SSP","STD","STN","SUR","SVC","SYP","SZL","THB","TJR","TJS","TMM","TMT","TND","TOP","TPE","TRL","TRY","TTD","TWD","TZS","UAH","UAK","UGS","UGX","USD","USN","USS","UYI","UYP","UYU","UYW","UZS","VEB","VEF","VES","VND","VNN","VUV","WST","XAF","XAG","XAU","XBA","XBB","XBC","XBD","XCD","XDR","XEU","XFO","XFU","XOF","XPD","XPF","XPT","XRE","XSU","XTS","XUA","XXX","YDD","YER","YUD","YUM","YUN","YUR","ZAL","ZAR","ZMK","ZMW","ZRN","ZRZ","ZWD","ZWL","ZWR"];function format(...t){return globalFormatter.format.apply(globalFormatter,t)}class NumberFormatter{format(...t){let r=NaN,a={locale:DEFAULT_LOCALE};if(1===t.length?r=t[0]:2<=arguments.length&&(r=t[1],a="string"==typeof t[0]?{format:t[0],locale:DEFAULT_LOCALE}:t[0]||a),null===r||void 0===r||isNaN(r))return"";let e=a.format||NumberDisplayFormat.DEFAULT;if(e===NumberDisplayFormat.CUSTOM&&(e=a.customDisplayFormat||DEFAULT_CUSTOM_FORMAT),e===NumberDisplayFormat.ROUND_TRIP)return r.toString();var m=e.toLowerCase();m===NumberDisplayFormat.CURRENCY||m===NumberDisplayFormat.ACCOUNTING?(i=a.currency||DEFAULT_CURRENCY,e=m,e+=a.fractionalDigits??"",e+=i?`$${i}`:""):m!==NumberDisplayFormat.NUMBER&&m!==NumberDisplayFormat.FIXED_POINT&&m!==NumberDisplayFormat.PERCENT||(e=m,e+=a.fractionalDigits??"");const D=[a.locale];var i=`${D.join(";")}|${e}`;let N=numberFormatters.get(i);return N||(N=[],1===(m=e.split(";",3)).length?(N[0]=this._createNumberFormatter(D,m[0]),N[1]=N[0],N[2]=N[0]):2===m.length?(N[0]=this._createNumberFormatter(D,m[0]),N[1]=this._createNumberFormatter(D,m[1]),N[2]=N[0]):3===m.length&&(N[0]=this._createNumberFormatter(D,m[0]),N[1]=this._createNumberFormatter(D,m[1]),N[2]=this._createNumberFormatter(D,m[2])),numberFormatters.set(i,N)),0<r?N[0](r):r<0?N[1](r):N[2](r)}_createNumberFormatter(r,t){const a={};let e=t.match(standardFormatPattern);if(e){var m=e[1].toLowerCase(),D=Math.min(20,parseInt(e[2]));let t=e[3];m===NumberDisplayFormat.CURRENCY||m===NumberDisplayFormat.ACCOUNTING?t=(t||DEFAULT_CURRENCY).toUpperCase():(t="",void 0===a.minimumFractionDigits&&(a.minimumFractionDigits=0),void 0===a.maximumFractionDigits&&(a.maximumFractionDigits=Math.max(DEFAULT_FRACTIONAL_DIGITS,a.minimumFractionDigits))),m===NumberDisplayFormat.PERCENT?a.style="percent":m===NumberDisplayFormat.ACCOUNTING?a.currencySign="accounting":m===NumberDisplayFormat.FIXED_POINT&&(a.useGrouping=!1),isNaN(D)||(a.minimumFractionDigits=D,a.maximumFractionDigits=D);const E=t?new Intl.NumberFormat(r,{style:"currency",currency:t,...a}):new Intl.NumberFormat(r,a);return t=>E.format(t)}var i,N;e=t.match(/[0#]+|\.|,|%|\\.|(["'])[^\1]+\1|[^0#.,\\'"]+/g);let R=!1,F="",o="",n="",s="";a.minimumFractionDigits=0,a.maximumFractionDigits=0,a.useGrouping=!1;for(i of e)switch(i[0]){case".":R=!0;break;case",":a.useGrouping=!0;break;case"%":a.style="percent";break;case"0":case"#":R?o+=i:F+=i;break;default:0===i.indexOf('"')||0===i.indexOf("'")?i=i.slice(1,-1):0===i.indexOf("\\")&&(i=i.slice(1)),F||o?s+=i:n+=i}if(!F||0<=(N=F.indexOf("0"))&&(a.minimumIntegerDigits=F.length-N),o&&(N=o.lastIndexOf("0"),a.minimumFractionDigits=0<=N?N+1:0,a.maximumFractionDigits=Math.min(20,o.length)),F||o){const A=new Intl.NumberFormat(r,a);return t=>`${n}${A.format(t)}${s}`}return()=>n+s}}const numberFormatters=new Map,standardFormatPattern=/^([acfnp])(\d*)(?:\$([a-zA-Z]{3}))?$/i,globalFormatter=new NumberFormatter;export{NumberDisplayFormat,DEFAULT_CURRENCY,DEFAULT_CUSTOM_FORMAT,DEFAULT_FRACTIONAL_DIGITS,SUPPORTED_CURRENCIES,format};
@@ -0,0 +1,113 @@
1
+ import * as defs from "./FormDefinition";
2
+ import { FormatOptions } from "./numberFormatter";
3
+ import { PropertyConstraints, PropertyConstraintsWithDefault } from "./utils";
4
+ /**
5
+ * Configuration for cleaning up a {@link defs.NumberFormat} used in producing a {@link defs.NumberConstraints}.
6
+ *
7
+ * This is a bit meta.
8
+ * * A `NumberConstraints` is used at runtime to ensure the value that a user entered is valid.
9
+ * * The `NumberConstraints` is generated from a `NumberFormat` which may only be partially defined, or may have values that are out of range.
10
+ * * We need to populate and validate the `NumberFormat` first of all before we can generate a valid `NumberConstraints`.
11
+ */
12
+ export interface NumberFormatConfiguration {
13
+ [key: string]: PropertyConstraints<any> | undefined;
14
+ lowerBound: PropertyConstraints<number>;
15
+ precision: PropertyConstraintsWithDefault<number>;
16
+ step: PropertyConstraintsWithDefault<number>;
17
+ upperBound: PropertyConstraints<number>;
18
+ }
19
+ export declare const defaultNumberFormatConfiguration: NumberFormatConfiguration;
20
+ /**
21
+ * Returns constraints to be used to ensure a value is a valid number for a form element.
22
+ *
23
+ * Non-numeric or missing values are replaced by defaults.
24
+ *
25
+ * The step is sanitized as follows:
26
+ * 1. If it is not a number it is set to 1.
27
+ * 2. If it is <= zero it is set to 1. (The @vertigis/react-ui/Slider gets stuck on the minimum value if the step is zero.)
28
+ * 2. It cannot be greater than the full range. (max-min)
29
+ * @param numberFormat The formatting options to use, typically configured on a Form Element.
30
+ * @param partialNumberFormatConfiguration Additional configuration specific to the caller. These are combined with the defaults.
31
+ * @returns A {@link defs.NumberConstraints} containing values that can be safely used in a component.
32
+ */
33
+ export declare function getNumberConstraints(numberFormat: defs.NumberFormat | undefined, partialNumberFormatConfiguration?: Partial<NumberFormatConfiguration>): defs.NumberConstraints;
34
+ /**
35
+ * Counts the number of decimal places in the specified number and returns the result.
36
+ * This uses Intl.NumberFormat rather than number.toString() to ensure that large numbers don't get converted to an exponential format.
37
+ *
38
+ * Despite this, it may not be accurate for very large numbers as it seems the decimal places might still be ignored.
39
+ * e.g. `(10 ** 21.5) + 0.123456789 and `(10 ** 21.5)` both return "3162277660168379400000".
40
+ * @param value The value to be inspected.
41
+ * @returns The number of decimal places in `value`.
42
+ */
43
+ export declare function countDecimalPlaces(value: number): number;
44
+ /**
45
+ * Determines how many decimal places should be used in presenting values to the user.
46
+ *
47
+ * There must be at least enough decimal places for the step size, although there could be more.
48
+ * @param precision A precision value, likely from element.format.precision.
49
+ * @param step The step size being used. This must be a validated step size from a NumberConstraints.
50
+ * @param partialNumberFormatConfiguration Any configuration to normalize the supplied precision.
51
+ * @returns The number of decimal places to be used to display values.
52
+ */
53
+ export declare function sanitizePrecision(precision: number | undefined, step: number, partialNumberFormatConfiguration?: Partial<NumberFormatConfiguration>): number;
54
+ /**
55
+ * Combines the provided configuration with the default and returns a new {@link NumberFormatConfiguration}.
56
+ * @param partialConfiguration Configuration to be added with the defaults.
57
+ * @returns The full set of constraints to use.
58
+ */
59
+ export declare function getNumberFormatConfiguration(partialConfiguration: Partial<NumberFormatConfiguration> | undefined): NumberFormatConfiguration;
60
+ /**
61
+ * Compares a value with some constraints and returns an adjusted value that satisfies the constraints. There are three considerations:
62
+ * 1. The value must be >= `minimum`. Otherwise it is changed to `minimum`.
63
+ * 2. The value must be <= `maximum`. Otherwise it is changed to `maximum`.
64
+ * 3. The value must land on a valid step between the bounds. Otherwise it is moved to the nearest step.
65
+ * This can only be enforced if `minimum` or `maximum` is specified.
66
+ *
67
+ * It is assumed that the supplied `numberConstraints` satisfy the following criteria:
68
+ * * `maximum` must not be less than or equal to `minimum`.
69
+ * * If `maximum` and `minimum` are both defined:
70
+ * * `maximum` must be a whole number of steps greater than `minimum`.
71
+ * * `step` must not be greater than `maximum - minimum`.
72
+ * @param value The value to be inspected.
73
+ * @param numberConstraints The constraints to be applied to the value.
74
+ * @returns A new value which satisfies the constraints.
75
+ */
76
+ export declare function enforceConstraints(value: number, numberConstraints: defs.NumberConstraints): number;
77
+ /**
78
+ * Retrieves the effective number slider values after applying various validation checks and bounds.
79
+ * @param values The initial input values based on which the result is computed.
80
+ * @param numberConstraints
81
+ * @returns A sorted numeric array with user entered values, if valid and default values if not.
82
+ */
83
+ export declare function getNumberSliderValues(values: defs.Value | undefined, numberConstraints: defs.NumberConstraints, singleValue?: boolean): number[];
84
+ /**
85
+ * Checks if a form element's value is equal to the supplied value.
86
+ * @param element A Form Element to inspect.
87
+ * @param newValue A new value for the Form Element.
88
+ * @returns True if the element's current value and the new value are equal, false otherwise.
89
+ */
90
+ export declare function areValuesEqual(element: defs.Element, newValue: defs.NumberRef | undefined): boolean;
91
+ /**
92
+ * A mark on the slider. This is a copy of the interface by the same name in @mui/base/useSlider.
93
+ * We use string rather than React.Node so that we can share this between runtime and designer without discrepancies between the typings.
94
+ */
95
+ export interface Mark {
96
+ value: number;
97
+ label?: string;
98
+ }
99
+ /**
100
+ * Gets marks to be used with the @vertigis/react-ui/Slider component.
101
+ *
102
+ * Returning `true` is a shortcut to tell the Slider to generate its own marks based on the step size.
103
+ * This is only possible when `showMinMaxLabels` is false, though, as they are also rendered as marks.
104
+ * When `showMinMaxLabels` and `showTickMarks` are both true, we need to manually generate all of the marks.
105
+ * @param maximum The highest allowed value.
106
+ * @param minimum The lowest allowed value.
107
+ * @param step: The amount of change between values.
108
+ * @param formatOptions The FormatOptions for formatting text on the labels.
109
+ * @param showMinMaxLabels True if labels should be included for min and max, false otherwise.
110
+ * @param showTickMarks True if tick marsks should be shown, false otherwise.
111
+ * @returns The value for the marks property for the slider.
112
+ */
113
+ export declare function getMarks(maximum: number, minimum: number, step: number, formatOptions: FormatOptions, showMinMaxLabels: boolean, showTickMarks: boolean): boolean | Mark[];
@@ -0,0 +1 @@
1
+ import{format}from"./numberFormatter.js";import{isNumberRef,isNumeric}from"./utils.js";const defaultNumberFormatConfiguration={lowerBound:{default:0},precision:{default:3,minimum:-20,maximum:20},step:{default:1},upperBound:{default:100}};function getNumberConstraints(e,r){var{lowerBound:i,upperBound:t}=e=e||{};let{precision:u,step:o}=e;var n,r=getNumberFormatConfiguration(r);let a=isNumeric(i)?i:r.lowerBound.default,m=isNumeric(t)?t:r.upperBound.default;return void 0!==m&&void 0!==a&&m<=a&&(a=r.lowerBound.default,m=r.upperBound.default),u="number"!=typeof u||Number.isNaN(u)?r.precision.default:u,void 0!==r.precision.minimum&&(u=Math.max(u,r.precision.minimum)),void 0!==r.precision.maximum&&(u=Math.min(u,r.precision.maximum)),u<0?(n=Math.pow(10,-1*u),void 0!==o&&o%n==0||(o=n)):(o=isNumeric(o)&&0<o?o:r.step.default,void 0!==m&&void 0!==a&&(o=Math.min(o,m-a),n=(m-a)/o,Number.isInteger(n)||(r=countDecimalPlaces(o),m=roundAccurately(a+Math.floor(n)*o,r)))),{maximum:m,minimum:a,step:o}}const intlNumberFormat=new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:20,useGrouping:!1});function countDecimalPlaces(e){if(Number.isInteger(e))return 0;const r=intlNumberFormat.format(e);e=r.indexOf(".");return-1===e?0:r.length-e-1}function sanitizePrecision(e,r,i){i=getNumberFormatConfiguration(i);void 0===e&&(e=i.precision.default);r=countDecimalPlaces(r);return Math.max(r,e)}function getNumberFormatConfiguration(e){const r={lowerBound:{...defaultNumberFormatConfiguration.lowerBound},precision:{...defaultNumberFormatConfiguration.precision},step:{...defaultNumberFormatConfiguration.step},upperBound:{...defaultNumberFormatConfiguration.upperBound}};if(void 0!==e)for(const i in e)r[i]=Object.assign(r[i],e[i]);return r}function enforceConstraints(e,r){var i,t,{maximum:u,minimum:o,step:r}=r;return void 0!==o?(i=(e-o)/r,Number.isInteger(i)||(t=countDecimalPlaces(r),e=roundAccurately(o+Math.round(i)*r,t))):void 0!==u&&(i=(u-e)/r,Number.isInteger(i)||(t=countDecimalPlaces(r),e=roundAccurately(u-Math.round(i)*r,t))),void 0!==o&&e<o&&(e=o),e=void 0!==u&&u<e?u:e}function getNumberSliderValues(e,r,i=!1){let t=[],u=NaN,o=NaN;if("string"==typeof e){const a=e.split("\n").filter(e=>""!==e);e=a.map(e=>(e=>(e=(e||"").trim(),isNumeric(e)?parseFloat(e):NaN))(e))}else"number"==typeof e?u=e:"number"==typeof e?.numeric&&(u=e.numeric);if(Array.isArray(e)&&1<=e.length&&(u=e[0],o=e[1]),void 0===u||isNaN(u)||(u=enforceConstraints(u,r),void 0===o||isNaN(o)?i&&t.push(u):(o=enforceConstraints(o,r),t.push(u,o))),t=t.sort((e,r)=>e-r),t.length===(i?1:2))return t;var n=r.maximum,e=r.minimum;return i?[enforceConstraints((e+n)/2,r)]:[e,n]}function areValuesEqual(e,r){e=e.value;if(void 0===e&&void 0===r||null===e&&null===r)return!0;var i,t;return!(!isNumberRef(e)||!isNumberRef(r))&&(e.display===r.display&&e.refValueType===r.refValueType&&e.numeric===r.numeric&&(i=e.format,t=r.format,void 0===i&&void 0===t||void 0!==i&&void 0!==t&&(i.currency===t.currency&&i.customDisplayFormat===t.customDisplayFormat&&i.displayFormat===t.displayFormat&&i.lowerBound===t.lowerBound&&i.precision===t.precision&&i.step===t.step&&i.upperBound===t.upperBound)))}function getMarks(r,i,t,e,u,o){if(u&&o){const n=[{value:i,label:format(e,i)}];for(let e=i+t;e<r;e+=t)n.push({value:e});return n.push({value:r,label:format(e,r)}),n}return u&&!o?[{value:i,label:format(e,i)},{value:r,label:format(e,r)}]:o}function roundAccurately(e,r){return Number(Math.round(Number(e+`e${r}`))+`e-${r}`)}export{defaultNumberFormatConfiguration,getNumberConstraints,countDecimalPlaces,sanitizePrecision,getNumberFormatConfiguration,enforceConstraints,getNumberSliderValues,areValuesEqual,getMarks};
@@ -8,6 +8,7 @@ export declare function refresh(component: {}): void;
8
8
  export declare function refreshForm(host: FormPresenterHost, container: Element): void;
9
9
  /**
10
10
  * Releases the underlying visual for the element.
11
+ * @product This is intended for internal use only within VertiGIS Studio products.
11
12
  * @param element The element to release from.
12
13
  */
13
14
  export declare function releaseForm(container: HTMLElement): void;
@@ -1 +1 @@
1
- import{createElement}from"react";import*as React from"react";import{unmountComponentAtNode,render as reactRender}from"react-dom";import{FormComponent}from"./FormComponent.js";import*as renderers from"./renderers.js";function refresh(e){e instanceof FormComponent&&e.forceUpdate()}function refreshForm(e,r){reactRender(React.createElement(FormComponent,{host:e,type:"form"}),r)}function releaseForm(e){unmountComponentAtNode(e)}function render(e){if(e instanceof FormComponent){switch(e.props.type){case"form":return renderers.renderForm(e);case"header":return renderers.renderHeader(e);case"main":return renderers.renderMain(e);case"footer":return renderers.renderFooter(e);case"body":return renderers.renderBody(e);case"row":return renderers.renderRow(e);case"section":return renderers.element.renderSection(e,e.prepare());case"element":break;default:return}var r=e.prepare();if(null==r)return;var n=r.type;if("string"!=typeof n)return;if("Custom"===n)return e.props.host.renderCustom(e,r);if(e.elementRegistration)return createElement(e.elementRegistration.component,renderers.getElementProps(e,r));const t=renderers.element["render"+n];if("function"==typeof t)return t(e,r)}}function renderNone(e){if(e instanceof FormComponent)return renderers.renderNone(e)}export{refresh,refreshForm,releaseForm,render,renderNone};
1
+ import{createElement}from"react";import*as React from"react";import{unmountComponentAtNode,render as reactRender}from"react-dom";import{FormComponent}from"./FormComponent.js";import*as renderers from"./renderers.js";import{getElementProps}from"./utils.js";function refresh(e){e instanceof FormComponent&&e.forceUpdate()}function refreshForm(e,r){reactRender(React.createElement(FormComponent,{host:e,type:"form"}),r)}function releaseForm(e){unmountComponentAtNode(e)}function render(e){if(e instanceof FormComponent){switch(e.props.type){case"form":return renderers.renderForm(e);case"header":return renderers.renderHeader(e);case"main":return renderers.renderMain(e);case"footer":return renderers.renderFooter(e);case"body":return renderers.renderBody(e);case"row":return renderers.renderRow(e);case"section":return renderers.element.renderSection(e,e.prepare());case"accordionGroup":return renderers.renderAccordionGroup(e);case"element":break;default:return}var r=e.prepare();if(null==r)return;var n=r.type;if("string"!=typeof n)return;if("Custom"===n)return e.props.host.renderCustom(e,r);if(e.elementRegistration)return createElement(e.elementRegistration.component,getElementProps(e,r));const o=renderers.element["render"+n];if("function"==typeof o)return o(e,r)}}function renderNone(e){if(e instanceof FormComponent)return renderers.renderNone(e)}export{refresh,refreshForm,releaseForm,render,renderNone};
@@ -1,46 +1,40 @@
1
1
  /// <reference types="react" />
2
2
  import { FormComponent } from "./FormComponent";
3
- import * as defs from "./FormDefinition";
4
- import * as datetime from "./datetime";
5
- import * as files from "./files";
6
- import * as geometry from "./geometry";
7
- import * as number from "./number";
8
- import * as scanner from "./scanner";
9
- import * as selectors from "./selectors";
10
- import { FormElementProps } from "./index";
3
+ import { Element } from "./FormDefinition";
11
4
  export declare function renderForm(component: FormComponent): JSX.Element;
12
5
  export declare function renderHeader(component: FormComponent): JSX.Element;
13
6
  export declare function renderFooter(component: FormComponent): JSX.Element;
14
7
  export declare function renderBody(component: FormComponent): JSX.Element;
15
8
  export declare function renderRow(component: FormComponent): JSX.Element;
16
9
  export declare function renderMain(component: FormComponent): JSX.Element;
10
+ export declare function renderAccordionGroup(component: FormComponent): JSX.Element;
17
11
  export declare function renderNone(component: FormComponent): any;
12
+ /** @product This is intended for internal use only within VertiGIS Studio products. */
18
13
  export declare namespace element {
19
- function renderPasswordBox(component: FormComponent, element: defs.Element): JSX.Element;
20
- function renderText(component: FormComponent, element: defs.Element): JSX.Element;
21
- function renderTextArea(component: FormComponent, element: defs.Element): JSX.Element;
22
- function renderTextBox(component: FormComponent, element: defs.Element): JSX.Element;
23
- export import renderNumber = number.renderNumber;
24
- export import renderNumberRangeSlider = number.renderNumberRangeSlider;
25
- export import renderNumberSlider = number.renderNumberSlider;
26
- export import renderAutoComplete = selectors.renderAutoComplete;
27
- export import renderCheckBox = selectors.renderCheckBox;
28
- export import renderCheckGroup = selectors.renderCheckGroup;
29
- export import renderDropDownList = selectors.renderDropDownList;
30
- export import renderItemPicker = selectors.renderItemPicker;
31
- export import renderListBox = selectors.renderListBox;
32
- export import renderRadioGroup = selectors.renderRadioGroup;
33
- export import renderDatePicker = datetime.renderDateTimePicker;
34
- export import renderDateRangePicker = datetime.renderDateRangePicker;
35
- export import renderTimePicker = datetime.renderDateTimePicker;
36
- export import renderDateTimePicker = datetime.renderDateTimePicker;
37
- export import renderGeometryPicker = geometry.renderGeometryPicker;
38
- export import renderFilePicker = files.renderFilePicker;
39
- export import renderScanner = scanner.renderScanner;
40
- function renderSection(component: FormComponent, element: defs.Element): JSX.Element;
41
- function renderHorizontalRule(component: FormComponent, element: defs.Element): JSX.Element;
42
- function renderImage(component: FormComponent, element: defs.Element): JSX.Element;
43
- function renderButtonBar(component: FormComponent, element: defs.Element): JSX.Element;
44
- function renderCustom(component: FormComponent, element: defs.Element): JSX.Element;
14
+ function renderAutoComplete(component: FormComponent, element: Element): JSX.Element;
15
+ function renderButtonBar(component: FormComponent, element: Element): JSX.Element;
16
+ function renderCheckBox(component: FormComponent, element: Element): JSX.Element;
17
+ function renderCheckGroup(component: FormComponent, element: Element): JSX.Element;
18
+ function renderCustom(component: FormComponent, element: Element): JSX.Element;
19
+ function renderDatePicker(component: FormComponent, element: Element): JSX.Element;
20
+ function renderDateRangePicker(component: FormComponent, element: Element): JSX.Element;
21
+ function renderDateTimePicker(component: FormComponent, element: Element): JSX.Element;
22
+ function renderDropDownList(component: FormComponent, element: Element): JSX.Element;
23
+ function renderFilePicker(component: FormComponent, element: Element): JSX.Element;
24
+ function renderGeometryPicker(component: FormComponent, element: Element): JSX.Element;
25
+ function renderHorizontalRule(component: FormComponent, element: Element): JSX.Element;
26
+ function renderImage(component: FormComponent, element: Element): JSX.Element;
27
+ function renderItemPicker(component: FormComponent, element: Element): JSX.Element;
28
+ function renderListBox(component: FormComponent, element: Element): JSX.Element;
29
+ function renderNumber(component: FormComponent, element: Element): JSX.Element;
30
+ function renderNumberRangeSlider(component: FormComponent, element: Element): JSX.Element;
31
+ function renderNumberSlider(component: FormComponent, element: Element): JSX.Element;
32
+ function renderPasswordBox(component: FormComponent, element: Element): JSX.Element;
33
+ function renderRadioGroup(component: FormComponent, element: Element): JSX.Element;
34
+ function renderScanner(component: FormComponent, element: Element): JSX.Element;
35
+ function renderSection(component: FormComponent, element: Element): JSX.Element;
36
+ function renderText(component: FormComponent, element: Element): JSX.Element;
37
+ function renderTextArea(component: FormComponent, element: Element): JSX.Element;
38
+ function renderTextBox(component: FormComponent, element: Element): JSX.Element;
39
+ function renderTimePicker(component: FormComponent, element: Element): JSX.Element;
45
40
  }
46
- export declare function getElementProps(component: FormComponent, element: defs.Element): FormElementProps;