@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.
- package/Activator.d.ts +2 -1
- package/Collections.d.ts +4 -3
- package/Errors.d.ts +0 -10
- package/Errors.js +1 -1
- package/Hooks.d.ts +16 -6
- package/IActivityHandler.d.ts +2 -0
- package/ProgramInspectorFacility.d.ts +2 -1
- package/Validation.d.ts +8 -2
- package/Validation.js +1 -1
- package/activities/app/GetApplicationInfo.d.ts +2 -2
- package/activities/app/GetApplicationInfo.js +1 -1
- package/activities/app/GetUserInfo.d.ts +2 -2
- package/activities/app/GetUserInfo.js +1 -1
- package/activities/app/RunCommand.d.ts +2 -2
- package/activities/app/RunCommand.js +1 -1
- package/activities/app/RunOperation.d.ts +2 -2
- package/activities/app/RunOperation.js +1 -1
- package/activities/app/applicationData.d.ts +6 -0
- package/activities/arcgis/AddAttachment.js +1 -1
- package/activities/arcgis/AddFeatureLayer.d.ts +1 -1
- package/activities/arcgis/AddFeatures.d.ts +2 -2
- package/activities/arcgis/AddFeatures.js +1 -1
- package/activities/arcgis/AddGraphics.d.ts +1 -1
- package/activities/arcgis/BufferServiceTask.d.ts +1 -1
- package/activities/arcgis/CastGeometry.js +1 -1
- package/activities/arcgis/ClearGraphics.d.ts +1 -1
- package/activities/arcgis/ClipEngineTask.js +1 -1
- package/activities/arcgis/ClosestFacilityTask.d.ts +1 -1
- package/activities/arcgis/CreateFeatureSet.d.ts +2 -2
- package/activities/arcgis/CreateFeatureSet.js +1 -1
- package/activities/arcgis/CreateGraphic.d.ts +2 -2
- package/activities/arcgis/CreateGraphic.js +1 -1
- package/activities/arcgis/CreatePoint.d.ts +2 -2
- package/activities/arcgis/CreatePoint.js +1 -1
- package/activities/arcgis/DeleteAttachments.js +1 -1
- package/activities/arcgis/DeleteFeatures.d.ts +2 -2
- package/activities/arcgis/DeleteFeatures.js +1 -1
- package/activities/arcgis/DistanceServiceTask.js +1 -1
- package/activities/arcgis/ExtendedSpatialReferenceInfoEngineTask.d.ts +1 -1
- package/activities/arcgis/FeatureSetFromJson.d.ts +2 -2
- package/activities/arcgis/FeatureSetFromJson.js +1 -1
- package/activities/arcgis/FromGeoCoordinateStringServiceTask.js +1 -1
- package/activities/arcgis/GenerateWebmapForReport.d.ts +2 -2
- package/activities/arcgis/Geocode.d.ts +1 -1
- package/activities/arcgis/Geocode.js +1 -1
- package/activities/arcgis/GeometryFromJson.d.ts +2 -2
- package/activities/arcgis/GeometryFromJson.js +1 -1
- package/activities/arcgis/Geoprocessing.d.ts +1 -1
- package/activities/arcgis/GeoprocessingAsync.d.ts +1 -1
- package/activities/arcgis/GeoprocessingAsync.js +1 -1
- package/activities/arcgis/GetAttributeValue.d.ts +2 -2
- package/activities/arcgis/GetAttributeValue.js +1 -1
- package/activities/arcgis/GetCentroid.d.ts +2 -2
- package/activities/arcgis/GetCentroid.js +1 -1
- package/activities/arcgis/GetCodedValueDomain.js +1 -1
- package/activities/arcgis/GetFeatureGeometry.d.ts +2 -2
- package/activities/arcgis/GetFeatureGeometry.js +1 -1
- package/activities/arcgis/GetFeatureLayerInfo.d.ts +4 -2
- package/activities/arcgis/GetFeatureLayerInfo.js +1 -1
- package/activities/arcgis/GetFeatureSetExtent.d.ts +2 -2
- package/activities/arcgis/GetFeatureSetExtent.js +1 -1
- package/activities/arcgis/GetFeatureSetObjectIds.d.ts +2 -2
- package/activities/arcgis/GetFeatureSetObjectIds.js +1 -1
- package/activities/arcgis/GetGeometryExtent.d.ts +2 -2
- package/activities/arcgis/GetGeometryExtent.js +1 -1
- package/activities/arcgis/GetGraphics.d.ts +1 -1
- package/activities/arcgis/GetLayer.d.ts +1 -1
- package/activities/arcgis/GetLayerDefinitionExpression.d.ts +1 -1
- package/activities/arcgis/GetLayerProperty.d.ts +1 -1
- package/activities/arcgis/GetLayerVisibility.d.ts +1 -1
- package/activities/arcgis/GetMap.d.ts +1 -1
- package/activities/arcgis/GetMapScreenshot.d.ts +1 -1
- package/activities/arcgis/GetPortalUser.d.ts +4 -6
- package/activities/arcgis/GetPortalUser.js +1 -1
- package/activities/arcgis/GetTable.d.ts +1 -1
- package/activities/arcgis/GetViewExtent.d.ts +1 -1
- package/activities/arcgis/GetViewpoint.d.ts +1 -1
- package/activities/arcgis/LabelPointsServiceTask.js +1 -1
- package/activities/arcgis/MapProvider.d.ts +3 -0
- package/activities/arcgis/ProjectServiceTask.d.ts +1 -1
- package/activities/arcgis/ProjectServiceTask.js +1 -1
- package/activities/arcgis/QueryAttachmentInfos.js +1 -1
- package/activities/arcgis/QueryTask.d.ts +8 -4
- package/activities/arcgis/QueryTask.js +1 -1
- package/activities/arcgis/RelationServiceTask.js +1 -1
- package/activities/arcgis/RelationshipQueryTask.d.ts +1 -1
- package/activities/arcgis/RemoveFeatureSetFields.d.ts +3 -0
- package/activities/arcgis/RemoveGraphics.d.ts +1 -1
- package/activities/arcgis/RemoveLayer.d.ts +1 -1
- package/activities/arcgis/RendererFromJson.d.ts +2 -2
- package/activities/arcgis/RendererFromJson.js +1 -1
- package/activities/arcgis/ReshapeServiceTask.js +1 -1
- package/activities/arcgis/ReverseGeocode.d.ts +1 -1
- package/activities/arcgis/ReverseGeocode.js +1 -1
- package/activities/arcgis/RouteTask.d.ts +1 -1
- package/activities/arcgis/RouteTask.js +1 -1
- package/activities/arcgis/RunPrint.d.ts +5 -11
- package/activities/arcgis/RunPrint.js +1 -1
- package/activities/arcgis/RunReport.d.ts +3 -11
- package/activities/arcgis/RunReport.js +1 -1
- package/activities/arcgis/RunWorkflow.d.ts +1 -9
- package/activities/arcgis/RunWorkflow.js +1 -1
- package/activities/arcgis/SendLayerToAttributeTable.d.ts +2 -2
- package/activities/arcgis/SendLayerToAttributeTable.js +1 -1
- package/activities/arcgis/ServiceAreaTask.d.ts +1 -1
- package/activities/arcgis/ServiceAreaTask.js +1 -1
- package/activities/arcgis/SetFeaturePopup.d.ts +1 -1
- package/activities/arcgis/SetImageryLayerOptions.d.ts +5 -1
- package/activities/arcgis/SetImageryLayerOptions.js +1 -1
- package/activities/arcgis/SetLayerDefinitionExpression.d.ts +1 -1
- package/activities/arcgis/SetLayerPopup.d.ts +1 -1
- package/activities/arcgis/SetLayerProperty.d.ts +1 -1
- package/activities/arcgis/SetLayerVisibility.d.ts +1 -1
- package/activities/arcgis/SetMap.d.ts +2 -2
- package/activities/arcgis/SetMap.js +1 -1
- package/activities/arcgis/SetViewExtent.d.ts +1 -1
- package/activities/arcgis/SetViewpoint.d.ts +1 -1
- package/activities/arcgis/ShowFeaturePopup.d.ts +1 -1
- package/activities/arcgis/ShowResults.d.ts +4 -3
- package/activities/arcgis/ShowResults.js +1 -1
- package/activities/arcgis/SortFeatureSet.d.ts +2 -2
- package/activities/arcgis/SortFeatureSet.js +1 -1
- package/activities/arcgis/SymbolFromJson.d.ts +2 -2
- package/activities/arcgis/SymbolFromJson.js +1 -1
- package/activities/arcgis/ToGeoCoordinateStringServiceTask.js +1 -1
- package/activities/arcgis/UnionServiceTask.js +1 -1
- package/activities/arcgis/UpdateAttachment.js +1 -1
- package/activities/arcgis/UpdateFeatures.d.ts +2 -2
- package/activities/arcgis/UpdateFeatures.js +1 -1
- package/activities/arcgis/libs/arcGisRestApi.d.ts +20 -1
- package/activities/arcgis/shared.d.ts +2 -5
- package/activities/arcgis/tools.d.ts +3 -12
- package/activities/arcgis/tools.js +1 -1
- package/activities/browser/GetBrowserInfo.d.ts +2 -2
- package/activities/browser/GetBrowserInfo.js +1 -1
- package/activities/core/Annotation.d.ts +2 -2
- package/activities/core/Annotation.js +1 -1
- package/activities/core/ChannelProvider.d.ts +2 -2
- package/activities/core/Container.d.ts +1 -1
- package/activities/core/{RunSubworkflow.d.ts → ExecuteFunction.d.ts} +4 -4
- package/activities/core/ExecuteFunction.js +1 -0
- package/activities/core/Exit.d.ts +1 -1
- package/activities/core/{Subworkflow.d.ts → Function.d.ts} +6 -6
- package/activities/core/Function.js +1 -0
- package/activities/core/GetWorkflowInputs.d.ts +1 -1
- package/activities/core/Placeholder.d.ts +2 -2
- package/activities/core/Placeholder.js +1 -1
- package/activities/core/TextReplace.d.ts +1 -0
- package/activities/core/TextReplace.js +1 -1
- package/activities/core/TryCatch.d.ts +1 -1
- package/activities/core/WebRequest.d.ts +1 -1
- package/activities/essentials/GetEssentialsSite.d.ts +1 -1
- package/activities/essentials/RunEssentialsWorkflow.d.ts +1 -1
- package/activities/forms/AddFormElement.d.ts +4 -2
- package/activities/forms/AddFormElement.js +1 -1
- package/activities/forms/DisplayForm.d.ts +2 -2
- package/activities/forms/FormActor.d.ts +56 -0
- package/activities/forms/FormActor.js +1 -0
- package/activities/forms/FormRenderer.d.ts +6 -42
- package/activities/forms/FormRenderer.js +1 -1
- package/activities/forms/GetFormElementItemsFromCollection.d.ts +2 -2
- package/activities/forms/GetFormElementItemsFromCollection.js +1 -1
- package/activities/forms/GetFormElementProperty.d.ts +2 -2
- package/activities/forms/GetFormElementProperty.js +1 -1
- package/activities/forms/GetFormElementValue.d.ts +2 -2
- package/activities/forms/GetFormElementValue.js +1 -1
- package/activities/forms/SetFormElementEvent.d.ts +1 -1
- package/activities/index.js +1 -1
- package/activities/math/Random.d.ts +2 -2
- package/activities/math/Random.js +1 -1
- package/activities/pdf/AddTextToPdf.d.ts +2 -2
- package/activities/ui/Alert.d.ts +1 -1
- package/activities/ui/Confirm.d.ts +1 -1
- package/activities/ui/Prompt.d.ts +1 -1
- package/activities/wab/OpenWidget.d.ts +2 -2
- package/activities/wab/OpenWidget.js +1 -1
- package/activities/wab/PublishWidgetData.d.ts +2 -2
- package/activities/wab/PublishWidgetData.js +1 -1
- package/definition/ProgramInspector.d.ts +21 -13
- package/definition/ProgramInspector.js +1 -1
- package/definition/Transition.d.ts +1 -1
- package/execution/ActivityContext.d.ts +2 -2
- package/execution/ActivityContextProxy.d.ts +1 -1
- package/execution/AmbientState.d.ts +2 -1
- package/execution/AmbientStateProxy.d.ts +1 -0
- package/execution/AmbientStateProxy.js +1 -1
- package/execution/Engine.d.ts +9 -9
- package/execution/ModuleLoader.d.ts +0 -28
- package/execution/ModuleLoader.js +1 -1
- package/execution/ProgramRunner.js +1 -1
- package/execution/util.js +1 -1
- package/forms/Calendar.d.ts +1 -1
- package/forms/FormDefinition.d.ts +2 -17
- package/forms/FormDefinition.js +1 -1
- package/forms/FormHost.d.ts +19 -7
- package/forms/FormHost.js +1 -1
- package/forms/FormPresenterHost.d.ts +16 -4
- package/forms/components/AutoComplete.js +1 -1
- package/forms/components/CheckGroup.js +1 -1
- package/forms/components/DateRangePicker.js +1 -1
- package/forms/components/Form.js +1 -1
- package/forms/components/FormLabelNumberField.d.ts +1 -1
- package/forms/components/GeometryPicker.js +1 -1
- package/forms/components/Markdown.d.ts +1 -1
- package/forms/components/Number.js +1 -1
- package/forms/components/NumberRangeSlider.js +1 -1
- package/forms/components/NumberSlider.js +1 -1
- package/forms/components/SignatureDialog.d.ts +1 -1
- package/forms/components/SketchDialog.d.ts +2 -2
- package/forms/components/TextBox.js +1 -1
- package/forms/components/common.d.ts +0 -1
- package/forms/customNumberFormat.d.ts +70 -0
- package/forms/customNumberFormat.js +1 -0
- package/forms/dateUtilities.d.ts +15 -7
- package/forms/dateUtilities.js +1 -1
- package/forms/keyboard.d.ts +2 -8
- package/forms/numberFormatter.d.ts +0 -14
- package/forms/numberFormatter.js +1 -1
- package/forms/numberUtilities.d.ts +1 -13
- package/forms/numberUtilities.js +1 -1
- package/forms/utils.d.ts +1 -8
- package/forms/utils.js +1 -1
- package/libs/version.d.ts +1 -1
- package/libs/version.js +1 -1
- package/package.json +5 -5
- package/activities/core/RunSubworkflow.js +0 -1
- package/activities/core/Subworkflow.js +0 -1
|
@@ -12,7 +12,7 @@ export type HistoryItem = DrawingHistoryItem | ImageHistoryItem;
|
|
|
12
12
|
/**
|
|
13
13
|
* A history item for the end user drawing a line on the dialog.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
type DrawingHistoryItem = {
|
|
16
16
|
/** The tool used to draw the line. This determines which canvas the line is drawn onto. */
|
|
17
17
|
tool: ToolType;
|
|
18
18
|
/** The style for the ends of the line. */
|
|
@@ -40,7 +40,7 @@ export interface SketchDialogResult {
|
|
|
40
40
|
width: number;
|
|
41
41
|
height: number;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
interface StyledDialogProps {
|
|
44
44
|
dataUrl: string | undefined;
|
|
45
45
|
height: number | undefined;
|
|
46
46
|
history: HistoryItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Input from"@vertigis/react-ui/Input";import*as React from"react";import{useContext,useEffect,useState}from"react";import{FormElementTypes}from"../constants.js";import HostContext from"../hostContext.js";import{getKeyString}from"../keyboard.js";import{makeUniqueId}from"../utils.js";import FormElement from"./FormElement.js";import{useFocusCallback}from"./common.js";const TextBox=({className:e,element:t,enabled:r,type:o,maxLength:n,name:a,prompt:m,readOnly:s,require:u,tooltip:l,value:i,setValue:p})=>{const c=useContext(HostContext),[f,d]=useState(""),g=`${makeUniqueId(a)}-input`,x=o===FormElementTypes.PASSWORDBOX,v=x?void 0:n,y=c.renderText(m),E=x?void 0:s,C=c.renderText(l);useEffect(()=>{let e="";"string"==typeof i?e=i:"number"!=typeof i||x||(e=c.formatNumber(i)),i!==e&&p(e,!1),f!==e&&d(e)},[i]);const T=e=>{p(e),d(e)},b=e=>{e=e.target.value;e!=i&&T(e)},F=e=>{e=e.target.value;e!=f&&d(e)},h=e=>{var t=getKeyString(e);return"enter"===t?(e=>{const t=e.currentTarget;var r=t.value;if(r!==i)return T(r),t.select(),e.stopPropagation(),e.preventDefault(),!1})(e):"escape"===t?(e=>{const t=e.currentTarget;if(t.value!==i)return d(i),t.select(),e.stopPropagation(),e.preventDefault(),!1})(e):void 0},j=useFocusCallback(r,a,c);return React.createElement(FormElement,{className:e,element:t,inputId:g,name:a},e=>React.createElement(Input,{disabled:!r,fullWidth:!0,id:g,inputProps:{...e,maxLength:v,onKeyDown:h,title:C},inputRef:j,onBlur:b,onChange:F,placeholder:y,readOnly:E,required:u,type:x?"password":"text",value:f}))};export default TextBox;
|
|
1
|
+
import Input from"@vertigis/react-ui/Input";import*as React from"react";import{useContext,useEffect,useState}from"react";import{FormElementTypes}from"../constants.js";import HostContext from"../hostContext.js";import{getKeyString}from"../keyboard.js";import{makeUniqueId}from"../utils.js";import FormElement from"./FormElement.js";import{useFocusCallback}from"./common.js";const TextBox=({className:e,element:t,enabled:r,type:o,maxLength:n,name:a,prompt:m,readOnly:s,require:u,tooltip:l,value:i,setValue:p})=>{const c=useContext(HostContext),[f,d]=useState(""),g=`${makeUniqueId(a)}-input`,x=o===FormElementTypes.PASSWORDBOX,v=x?void 0:n,y=c.renderText(m),E=x?void 0:s,C=c.renderText(l);useEffect(()=>{let e="";"string"==typeof i?e=i:"number"!=typeof i||x||(e=c.formatNumber(i)),i!==e&&p(e,!1),f!==e&&d(e)},[i]);const T=e=>{p(e),d(e)},b=e=>{e=e.target.value;e!=i&&T(e)},F=e=>{e=e.target.value;e!=f&&d(e)},h=e=>{var t=getKeyString(e);return"enter"===t?(e=>{const t=e.currentTarget;var r=t.value;if(r!==i)return T(r),t.select(),e.stopPropagation(),e.preventDefault(),!1})(e):"escape"===t?(e=>{const t=e.currentTarget;if(t.value!==i)return d(i||""),t.select(),e.stopPropagation(),e.preventDefault(),!1})(e):void 0},j=useFocusCallback(r,a,c);return React.createElement(FormElement,{className:e,element:t,inputId:g,name:a},e=>React.createElement(Input,{disabled:!r,fullWidth:!0,id:g,inputProps:{...e,maxLength:v,onKeyDown:h,title:C},inputRef:j,onBlur:b,onChange:F,placeholder:y,readOnly:E,required:u,type:x?"password":"text",value:f}))};export default TextBox;
|
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import type { defs } from "../FormHost";
|
|
3
3
|
import type { FormHostMembers } from "../hostContext";
|
|
4
4
|
import type { ElementType } from "react";
|
|
5
|
-
export type TranslateTextFunction = (content: defs.Text | undefined) => string | defs.MarkdownRef | undefined;
|
|
6
5
|
/**
|
|
7
6
|
* Renders the title for a Form Element.
|
|
8
7
|
* @param elementId The id of the DOM element representing the Form Element.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Similar to a `NumberFormatPart` returned from NumberFormat.formatToParts, this represents and individual part
|
|
3
|
+
* of a custom number format string.
|
|
4
|
+
*/
|
|
5
|
+
interface CustomNumberFormatPart {
|
|
6
|
+
/** True if the placeholder is required, false or undefined otherwise. This is used to distinguish between `0` and `#` characters. */
|
|
7
|
+
required?: boolean;
|
|
8
|
+
type: "decimal" | "exponentInteger" | "exponentMinusSign" | "exponentPlusSign" | "exponentSeparator" | "fraction" | "group" | "integer" | "literal" | "minusSign" | "percentSign" | "permilleSign";
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Counts the number of decimal places in the specified custom format string and returns the result.
|
|
13
|
+
* The supplied value is treated as one of Microsoft's [Custom numeric format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings)
|
|
14
|
+
*
|
|
15
|
+
* There are lots of unusual ways you can combine the supported characters, but for simplicity, we support the most common use case
|
|
16
|
+
* which is using `#` and `0` as placeholders.
|
|
17
|
+
*
|
|
18
|
+
* In cases where the `;` section separator is used, the number of decimals in the format may vary depending on the current value being negative, positive or zero.
|
|
19
|
+
*
|
|
20
|
+
* @param customFormat The custom format to be inspected.
|
|
21
|
+
* @param value The number being formatted.
|
|
22
|
+
* @returns The number of decimal places in the section of `customFormat` used for the specified value.
|
|
23
|
+
*/
|
|
24
|
+
export declare function countDecimalsInCustomFormat(customFormat: string | undefined, value: number | undefined): number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Inspects the supplied {@link customFormat} to determine which features of custom formatting are defined within.
|
|
27
|
+
* @param customFormat The custom format string to be inspected.
|
|
28
|
+
* @returns Details of the various features of custom formatting that are enabled.
|
|
29
|
+
*/
|
|
30
|
+
export declare function inspectCustomFormat(customFormat: string): {
|
|
31
|
+
/** The value to multiply the actual value by before presenting it. For example, percentages are multiplied by 100. */
|
|
32
|
+
multiplier: number;
|
|
33
|
+
/** All of the individual parts of the custom format string that will be visible. Group characters are added after the placeholders are populated. */
|
|
34
|
+
parts: CustomNumberFormatPart[];
|
|
35
|
+
/** True if the formatted value should include grouping characters between sets of integer digits. */
|
|
36
|
+
useGrouping: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Formats a number using the specified custom numeric format string.
|
|
40
|
+
*
|
|
41
|
+
* This follows the behaviour of Microsoft's .NET custom format strings as described here:
|
|
42
|
+
*
|
|
43
|
+
* https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings
|
|
44
|
+
*
|
|
45
|
+
* At this time, it does not yet support the `"\"` escape character or the `";"` section separator.
|
|
46
|
+
*
|
|
47
|
+
* @param value The numerical value to be formatted using a custom format.
|
|
48
|
+
* @param customFormat The custom format string describing how to format the value.
|
|
49
|
+
* @param locale The locale to be used to format the value.
|
|
50
|
+
* @returns A string representation of the value, formatted based on the {@link customFormat}.
|
|
51
|
+
*/
|
|
52
|
+
export declare function customFormatNumber(value: number, customFormat: string, locale?: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Inspects a value that was formatted using a custom numeric format string and split it into parts.
|
|
55
|
+
* This allows for inspection of the parts before ultimately combining them and converting the result
|
|
56
|
+
* to a number.
|
|
57
|
+
* @param formattedNumber A string representation of a value that was previously formatted using the {@link customFormat}.
|
|
58
|
+
* @param locale The locale that was used to format the value.
|
|
59
|
+
* @returns The previously formatted string broken into parts.
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseCustomFormattedNumberToParts(formattedNumber: string, locale?: string): Intl.NumberFormatPart[];
|
|
62
|
+
/**
|
|
63
|
+
* Parses a value that was formatted using the specified custom numeric format string.
|
|
64
|
+
* @param formattedNumber A string representation of a value that was previously formatted using the {@link customFormat}.
|
|
65
|
+
* @param customFormat The custom format string describing how the value was formatted.
|
|
66
|
+
* @param locale The locale that was used to format the value.
|
|
67
|
+
* @returns The numeric value represented by the previously formatted string.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseCustomFormattedNumber(formattedNumber: string, customFormat: string, locale?: string): number;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_LOCALE}from"../constants.js";import{getPercentSymbolInfo,preciseRound}from"./numberUtilities.js";const CustomSpecifiers={Comma:",",DecimalPoint:".",Hash:"#",Percent:"%",Permille:"‰",Semicolon:";",Zero:"0"};function countDecimalsInCustomFormat(e,t){if(!e)return 0;const r=inspectCustomFormat(e=chooseCustomFormatSection(e.split(CustomSpecifiers.Semicolon),t))["parts"];return r.some(e=>"exponentSeparator"===e.type)?void 0:r.some(e=>"decimal"===e.type)?r.filter(e=>"fraction"===e.type).length+2*r.filter(e=>"percentSign"===e.type).length+3*r.filter(e=>"permilleSign"===e.type).length:0}function inspectCustomFormat(e){const t=[];let r=!1,n=!1,i=!1,a=!1;const o=/,|0|#|%|‰|[Ee]|[+-]|\.|\\.|(["'])[^\1]+\1|[^,0#%‰Ee+-\.\\"'+]+/g;for(var l;null!==(l=o.exec(e));){const g=l[0];switch(g){case CustomSpecifiers.Comma:!a||r||n||t.push({type:"group",value:CustomSpecifiers.Comma});break;case CustomSpecifiers.DecimalPoint:r||(t.push({type:"decimal",value:CustomSpecifiers.DecimalPoint}),r=!0);break;case CustomSpecifiers.Hash:n?t.push({type:"exponentInteger",value:CustomSpecifiers.Hash}):r?t.push({type:"fraction",value:CustomSpecifiers.Hash}):(t.push({type:"integer",value:CustomSpecifiers.Hash}),a=!0);break;case CustomSpecifiers.Percent:t.push({type:"percentSign",value:CustomSpecifiers.Percent});break;case CustomSpecifiers.Permille:t.push({type:"permilleSign",value:CustomSpecifiers.Permille});break;case CustomSpecifiers.Zero:n?t.push({type:"exponentInteger",value:CustomSpecifiers.Zero}):r?t.push({required:!0,type:"fraction",value:CustomSpecifiers.Zero}):(t.push({required:!0,type:"integer",value:CustomSpecifiers.Zero}),a=!0);break;case"E":case"e":n?t.push({type:"literal",value:g}):(t.push({type:"exponentSeparator",value:g}),n=!0);break;case"+":n&&!i?(t.push({type:"exponentPlusSign",value:g}),i=!0):t.push({type:"literal",value:g});break;case"-":n&&!i?(t.push({type:"exponentMinusSign",value:g}),i=!0):t.push({type:"literal",value:g});break;default:g.startsWith("\\")?t.push({type:"literal",value:g[1]}):g.startsWith('"')||g.startsWith("'")?t.push({type:"literal",value:g.substring(1,g.length-1)}):t.push({type:"literal",value:g})}}let u=1;var p=t.findLastIndex(e=>"integer"===e.type);if(-1!==p)for(var s=p+1;"group"===t[s]?.type;)u/=1e3,t.splice(s,1);p=t.some(e=>"group"===e.type);let m=t.findIndex(e=>"group"===e.type);for(;-1!==m;)t.splice(m,1),m=t.findIndex(e=>"group"===e.type);var c=t.filter(e=>"percentSign"===e.type).length;for(let e=0;e<c;e++)u*=100;var f=t.filter(e=>"permilleSign"===e.type).length;for(let e=0;e<f;e++)u*=1e3;return{multiplier:u,parts:t,useGrouping:p}}function chooseCustomFormatSection(e,t){var[r,n,i]=e;if(void 0===t)return r;switch(e.length){case 3:if(0===t)return i;case 2:if(t<0&&n)return n;default:return r}}function customFormatNumber(t,e,r=DEFAULT_LOCALE){if(!e){const b=new Intl.NumberFormat(r);return b.format(t)}var n=e.split(CustomSpecifiers.Semicolon),i=(e=chooseCustomFormatSection(n,t))===n[0]&&t<0;const{multiplier:a,parts:o,useGrouping:l}=inspectCustomFormat(e),u={minimumFractionDigits:0,maximumFractionDigits:0};t*=a;var p=o.filter(e=>"fraction"===e.type&&!e.required).length,s=o.filter(e=>"fraction"===e.type&&e.required).length,n=s+p+2*o.filter(e=>"percentSign"===e.type).length+3*o.filter(e=>"permilleSign"===e.type).length;let m=[];var c=t=>{for(let e=t.length-1;0<=e;e--)if(""===t[e].value||0===e)return t[e]};if(o.some(e=>"exponentSeparator"===e.type)){const E=o.filter(e=>"integer"===e.type);var f,e=E.findIndex(e=>"integer"===e.type&&e.required),p=E.findIndex(e=>"integer"===e.type&&!e.required),e=-1===e?0:E.length-e,g=-1===p?e:Math.max(e,E.length-p);if(g<=1)m=new Intl.NumberFormat(r,{maximumFractionDigits:n,minimumFractionDigits:s,notation:"scientific",useGrouping:!1}).formatToParts(t);else{const _=new Intl.NumberFormat(r,{maximumFractionDigits:20,minimumFractionDigits:1,minimumIntegerDigits:1,useGrouping:!1});m=_.formatToParts(t);const T=m.find(e=>"integer"===e.type),P=m.find(e=>"fraction"===e.type);let e=0;for(;T.value.length>g;){var v=T.value[T.value.length-1];P.value=v+P.value,T.value=T.value.substring(0,T.value.length-1),e++}for(;"0"===T.value||T.value.length<g;)0===P.value.length?T.value=T.value.padStart(g,"0"):(f=P.value[0],"0"===T.value?T.value=f:T.value+=f,P.value=P.value.substring(1),e--);var y=preciseRound(parseFloat(m.map(e=>e.value).join("")),n);m=_.formatToParts(y),m.push({type:"exponentSeparator",value:"E"}),e<0&&m.push({type:"exponentMinusSign",value:"-"}),m.push({type:"exponentInteger",value:Math.abs(e).toString()})}const R=o.find(e=>"exponentMinusSign"===e.type||"exponentPlusSign"===e.type);p="+"===R?.value?"always":"negativeOnly",y=m.some(e=>"exponentMinusSign"===e.type);"always"==p&&y?R.value="-":"negativeOnly"==p&&(y?R||(y=o.findIndex(e=>"exponentSeparator"===e.type)+1,o.splice(y,0,{type:"exponentMinusSign",value:"-"})):R&&(R.value="")),o.filter(e=>"exponentInteger"===e.type).forEach(e=>e.value="");var h=m.find(e=>"exponentInteger"===e.type)?.value.split("")||[],C=o.filter(e=>"exponentInteger"===e.type);for(let e=h.length-1;0<=e;e--){const L=c(C);if(!L)break;L.value=h[e]+L.value}o.filter(e=>"exponentInteger"===e.type&&""===e.value).forEach(e=>e.value="0")}else{(0<s||0<n)&&(u.minimumFractionDigits=s,u.maximumFractionDigits=n);const D=new Intl.NumberFormat(r,u);m=D.formatToParts(t)}o.filter(e=>"integer"===e.type||"fraction"===e.type).forEach(e=>e.value="");var S=m.filter(e=>"integer"===e.type).map(e=>e.value.split("")).flat();if(1<S.length||"0"!==S[0]){var I=o.filter(e=>"integer"===e.type);for(let e=S.length-1;0<=e;e--){const H=c(I);if(!H)break;H.value=S[e]+H.value}}var d=m.filter(e=>"fraction"===e.type).map(e=>e.value.split("")).flat();const A=o.filter(e=>"fraction"===e.type);for(let e=0;e<d.length;e++){const M=(()=>{for(let e=0;e<A.length;e++)if(""===A[e].value)return A[e]})();if(!M)break;M.value=d[e]}if(o.filter(e=>e.required&&""===e.value).forEach(e=>e.value="0"),l){for(let t=0;t<o.length;t++){const V=o[t];if("integer"===V.type&&1<V.value.length){var N=V.type,x=V.value.split("");o[t]={type:N,value:x[0]};for(let e=1;e<x.length;e++)o.splice(t+e,0,{type:N,value:x[e]})}}let e=o.findLastIndex(e=>"integer"===e.type);for(;1<=e;){var F=e-2;if("integer"!==o[F-1]?.type)break;o.splice(F,0,{type:"group",value:","}),e=F-1}}if(r!==DEFAULT_LOCALE){const{decimalChar:k,groupChar:w}=getNumberFormatChars(r);k!==INVARIANT_DECIMAL_CHAR&&o.filter(e=>"decimal"===e.type).forEach(e=>e.value=k),w!==INVARIANT_GROUP_CHAR&&o.filter(e=>"group"===e.type).forEach(e=>e.value=w);const O=getPercentSymbolInfo(r)?.symbol||INVARIANT_PERCENT_CHAR;O!==INVARIANT_PERCENT_CHAR&&o.filter(e=>"percentSign"===e.type).forEach(e=>e.value=O)}return!i||-1!==(i=o.findIndex(e=>"integer"===e.type))&&o.splice(i,0,{type:"minusSign",value:"-"}),o.map(e=>e.value).join("")}const INVARIANT_DECIMAL_CHAR=".",INVARIANT_GROUP_CHAR=",",INVARIANT_LOCALE="en-US",INVARIANT_MINUS_SIGN="-",INVARIANT_PERCENT_CHAR="%";function getNumberFormatChars(e){let t=INVARIANT_DECIMAL_CHAR,r=INVARIANT_GROUP_CHAR;const n=new Intl.NumberFormat(e),i=n.formatToParts(1234.5);e=i.find(e=>"group"===e.type);e&&(r=e.value);e=i.find(e=>"decimal"===e.type);return e&&(t=e.value),{groupChar:r,decimalChar:t}}function parseCustomFormattedNumberToParts(e,t=DEFAULT_LOCALE){var{groupChar:r,decimalChar:n}=getNumberFormatChars(t),t=getPercentSymbolInfo(t)?.symbol||INVARIANT_PERCENT_CHAR;const i=[];let a={},o;const l=[n,r,t];var u=e=>{i.push(e),a[e.type]=!0},p={exponentInteger:!0,fraction:!0,integer:!0};for(const m of e){let e=o?.type||"unknown";var s=/[0-9\u0660-\u0669\u06f0-\u06f9]/.test(m);l.includes(m)?(e=m===n?"decimal":m===r?"group":"percentSign",o={type:e,value:m},u(o)):"‰"!==m?"e"!==m.toLowerCase()?"-"!==m.toLocaleLowerCase()?s?o?e in p?o.value+=m:(e=a.decimal?a.fraction?"exponentInteger":"fraction":"integer",o={type:e,value:m},u(o)):(o={type:"integer",value:m},u(o)):"literal"==o?.type?o.value+=m:(o={type:"literal",value:m},u(o)):(e=a.integer||a.decimal?a.exponentSeparator?"exponentMinusSign":"literal":"minusSign",o={type:e,value:m},u(o)):(o={type:"exponentSeparator",value:m},u(o)):(u({type:"literal",value:m}),o=void 0)}return i}function parseCustomFormattedNumber(e,t,r=DEFAULT_LOCALE){let n=parseCustomFormattedNumberToParts(e,r);const i=t.split(CustomSpecifiers.Semicolon),a=i.map(e=>inspectCustomFormat(e));var o=a.map(e=>e.parts.filter(e=>"percentSign"===e.type).length),l=a.map(e=>e.parts.filter(e=>"permilleSign"===e.type).length);const u=["group","literal","percentSign"];n=n.filter(e=>!u.includes(e.type)),r!=INVARIANT_LOCALE&&(n.filter(e=>"decimal"===e.type).forEach(e=>e.value=INVARIANT_DECIMAL_CHAR),n.filter(e=>"minusSign"===e.type||"exponentMinusSign"===e.type).forEach(e=>e.value=INVARIANT_MINUS_SIGN),n.filter(e=>"integer"===e.type||"fraction"===e.type||"exponentInteger"===e.type).forEach(e=>e.value=e.value.replaceAll(/[\u0660-\u0669\u06f0-\u06f9]/g,e=>(15&e.charCodeAt(0)).toString())));t=n.map(e=>e.value).join("");let p=parseFloat(t);if(0===p)return p;let s=n.filter(e=>"fraction"===e.type).map(e=>e.value).join("").length;!n.some(e=>"exponentMinusSign"===e.type)||(m=n.find(e=>"exponentInteger"===e.type))&&(c=parseInt(m.value),s+=c);var m=i[1];if(m){const f=a[1]["multiplier"];var c=p;c/=f;const g=s+2*o[1]+3*l[1];if(customFormatNumber(c=preciseRound(p,g),m,r)===e)return c<0?c:-c}const f=a[0]["multiplier"];p/=f;const g=s+2*o[0]+3*l[0];return p=preciseRound(p,g),p}export{countDecimalsInCustomFormat,inspectCustomFormat,customFormatNumber,parseCustomFormattedNumberToParts,parseCustomFormattedNumber};
|
package/forms/dateUtilities.d.ts
CHANGED
|
@@ -3,10 +3,6 @@ import type { DateRangeRef, DateTimeFormat, DateTimeRef, DateTimeType, FormatRef
|
|
|
3
3
|
import type { defs } from "./FormHost";
|
|
4
4
|
import type { PickersLocaleText } from "@mui/x-date-pickers";
|
|
5
5
|
import type { Locale } from "date-fns";
|
|
6
|
-
/**
|
|
7
|
-
* A list of the locales we currently bundle from `date-fns`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const SUPPORTED_DATE_FNS_LOCALES: string[];
|
|
10
6
|
/**
|
|
11
7
|
* Checks if a form element's value is equal to the supplied value.
|
|
12
8
|
* @param elementValue The current value of a Form Element.
|
|
@@ -48,6 +44,18 @@ export declare function tryParseDay(day: string): string | undefined;
|
|
|
48
44
|
* @param input The input date text.
|
|
49
45
|
*/
|
|
50
46
|
export declare function tryParseDateText(input: string): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The smallest value we can use in date components.
|
|
49
|
+
*
|
|
50
|
+
* `0001-01-01 00:00:00.000` (Local Time)
|
|
51
|
+
*/
|
|
52
|
+
export declare const MinUIDate: Date;
|
|
53
|
+
/**
|
|
54
|
+
* The largest value we can use in date components.
|
|
55
|
+
*
|
|
56
|
+
* `9999-12-31 23:59:59.999` (Local Time)
|
|
57
|
+
*/
|
|
58
|
+
export declare const MaxUIDate: Date;
|
|
51
59
|
/**
|
|
52
60
|
* Uses the `lowerBound` and `upperBound` properties of the supplied format
|
|
53
61
|
* to construct dates for the minimum and maximum values to be returned.
|
|
@@ -55,8 +63,8 @@ export declare function tryParseDateText(input: string): string | undefined;
|
|
|
55
63
|
* @returns The minimum and maximum values as Dates.
|
|
56
64
|
*/
|
|
57
65
|
export declare function getDateBounds(format: FormatRef | undefined): {
|
|
58
|
-
min: Date
|
|
59
|
-
max: Date
|
|
66
|
+
min: Date;
|
|
67
|
+
max: Date;
|
|
60
68
|
};
|
|
61
69
|
/**
|
|
62
70
|
* Retrieves the DateFns locale corresponding to the specified language. This function will return undefined
|
|
@@ -95,7 +103,7 @@ export type DateRangeLike = (Date | number | string)[] | {
|
|
|
95
103
|
* DateRangeRef like object.
|
|
96
104
|
* @returns A valid DateRangeRef if possible. Undefined otherwise.
|
|
97
105
|
*/
|
|
98
|
-
export declare function convertToDateRangeRef(value: DateRangeLike): DateRangeRef | undefined;
|
|
106
|
+
export declare function convertToDateRangeRef(value: DateRangeLike | undefined): DateRangeRef | undefined;
|
|
99
107
|
/**
|
|
100
108
|
* This function is for the sole purpose of facilitating testing. This should not be
|
|
101
109
|
* used for any other purpose. An incorrect value set here will result in incorrect
|
package/forms/dateUtilities.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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{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){return void 0===e&&void 0===a||null===e&&null===a||(isDateTimeRef(e)&&a&&isDateTimeRef(a)?e.display===a.display&&e.refValueType===a.refValueType&&e.value===a.value&&areFormatsEqual(e.format,a.format):!!(isDateRangeRef(e)&&a&&isDateRangeRef(a))&&(e.endDate?.valueOf()===a.endDate?.valueOf()&&e.refValueType===a.refValueType&&e.startDate?.valueOf()===a.startDate?.valueOf()))}function areFormatsEqual(e,a){return void 0===e&&void 0===a||("string"==typeof e&&"string"==typeof a?e===a:"object"==typeof e&&"object"==typeof a&&(null===e||null===a?e===a:e.locale===a.locale&&e.timezone===a.timezone))}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]}`}}}function getDateBounds(e){var{lowerBound:a,upperBound:e}=e||{};return{min:
|
|
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{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){return void 0===e&&void 0===a||null===e&&null===a||(isDateTimeRef(e)&&a&&isDateTimeRef(a)?e.display===a.display&&e.refValueType===a.refValueType&&e.value===a.value&&areFormatsEqual(e.format,a.format):!!(isDateRangeRef(e)&&a&&isDateRangeRef(a))&&(e.endDate?.valueOf()===a.endDate?.valueOf()&&e.refValueType===a.refValueType&&e.startDate?.valueOf()===a.startDate?.valueOf()))}function areFormatsEqual(e,a){return void 0===e&&void 0===a||("string"==typeof e&&"string"==typeof a?e===a:"object"==typeof e&&"object"==typeof a&&(null===e||null===a?e===a:e.locale===a.locale&&e.timezone===a.timezone))}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]}`}}}const MinUIDate=new Date(0,0);MinUIDate.setFullYear(1);const MaxUIDate=new Date(9999,11,31,23,59,59,999);function getDateBounds(e){var{lowerBound:a,upperBound:e}=e||{};return{min:a?new Date(a):MinUIDate,max:e?new Date(e):MaxUIDate}}function getTargetLanguages(e){e=parseLocale(e);if(!e)return[DEFAULT_LOCALE];const a=[];return e.territory&&a.push(`${e.language}-${e.territory}`),a.push(e.language),a.push(DEFAULT_LOCALE),a}async function getDateFnsLocale(e){for(const a of getTargetLanguages(e))if(-1!==SUPPORTED_DATE_FNS_LOCALES.indexOf(a)){let e;try{switch(a){case"cs":e=(await import("date-fns/locale/cs")).cs;break;case"da":e=(await import("date-fns/locale/da")).da;break;case"de":e=(await import("date-fns/locale/de")).de;break;case"de-AT":e=(await import("date-fns/locale/de-AT")).deAT;break;case"en-AU":e=(await import("date-fns/locale/en-AU")).enAU;break;case"en-CA":e=(await import("date-fns/locale/en-CA")).enCA;break;case"en-GB":e=(await import("date-fns/locale/en-GB")).enGB;break;case"en-IN":e=(await import("date-fns/locale/en-IN")).enIN;break;case"en-NZ":e=(await import("date-fns/locale/en-NZ")).enNZ;break;case"en-US":e=(await import("date-fns/locale/en-US")).enUS;break;case"en-ZA":e=(await import("date-fns/locale/en-ZA")).enZA;break;case"fr":e=(await import("date-fns/locale/fr")).fr;break;case"fr-CA":e=(await import("date-fns/locale/fr-CA")).frCA;break;case"fr-CH":e=(await import("date-fns/locale/fr-CH")).frCH;break;case"it":e=(await import("date-fns/locale/it")).it;break;case"nb":e=(await import("date-fns/locale/nb")).nb;break;case"nl":e=(await import("date-fns/locale/nl")).nl;break;case"nl-BE":e=(await import("date-fns/locale/nl-BE")).nlBE;break;case"nn":e=(await import("date-fns/locale/nn")).nn;break;case"pt":e=(await import("date-fns/locale/pt")).pt;break;case"pt-BR":e=(await import("date-fns/locale/pt-BR")).ptBR}}catch{continue}if(e?.localize)return e}}async function getLocaleText(e){for(const a of getTargetLanguages(e))if(-1!==SUPPORTED_DATE_FNS_LOCALES.indexOf(a)){let e;try{switch(a){case"cs":e=(await import("@mui/x-date-pickers/locales/csCZ")).csCZ;break;case"da":e=(await import("@mui/x-date-pickers/locales/daDK")).daDK;break;case"de":case"de-AT":e=(await import("@mui/x-date-pickers/locales/deDE")).deDE;break;case"en-AU":case"en-CA":case"en-GB":case"en-IN":case"en-NZ":case"en-US":case"en-ZA":case"nn":e=(await import("@mui/x-date-pickers/locales/enUS")).enUS;break;case"fr":case"fr-CA":case"fr-CH":e=(await import("@mui/x-date-pickers/locales/frFR")).frFR;break;case"it":e=(await import("@mui/x-date-pickers/locales/itIT")).itIT;break;case"nb":e=(await import("@mui/x-date-pickers/locales/nbNO")).nbNO;break;case"nl":case"nl-BE":e=(await import("@mui/x-date-pickers/locales/nlNL")).nlNL;break;case"pt":case"pt-BR":e=(await import("@mui/x-date-pickers/locales/ptBR")).ptBR}}catch{continue}return e?e.components.MuiLocalizationProvider.defaultProps.localeText:{}}}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"),n=a.indexOf("dd");return"yyyy"===e?0===t?0:r<t&&n<t?2:1:"MM"===e?0===r?0:n<r&&t<r?2:1:0===n?0:r<n&&t<n?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 n=!!a&&!!t;let o=n&&!isAfter(a,t);return r&&n&&!o&&(e=a,a=t,t=e,o=!0),n&&o?{refValueType:"daterange",startDate:a,endDate:t}:void 0}function __test__setlocaleDateFormatInCache(e){localeDateFormat=e,dateFormatSeparator=void 0}async function getLocale(e){return getDateFnsLocale(e)}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 getNewElementValue(e,a,t,r){if(null!=e&&isFinite(e.valueOf()))return{refValueType:a,format:t,display:r.format(e,Calendar.fullFormat),value:e.valueOf()}}export{areValuesEqual,isValidDate,tryParseYear,tryParseMonth,tryParseDay,tryParseDateText,MinUIDate,MaxUIDate,getDateBounds,getDateFnsLocale,getLocaleText,getLocaleDateFormat,getLocaleDateFormatSeparator,getLocaleDateFormatTokenPosition,convertToDateRangeRef,__test__setlocaleDateFormatInCache,getLocale,makeProperValue,getNewElementValue};
|
package/forms/keyboard.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
altKey: boolean;
|
|
3
|
-
ctrlKey: boolean;
|
|
4
|
-
metaKey: boolean;
|
|
5
|
-
shiftKey: boolean;
|
|
6
|
-
key: string;
|
|
7
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
8
2
|
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
9
|
-
export declare function getKeyString(event: KeyboardEvent): string | undefined;
|
|
3
|
+
export declare function getKeyString(event: React.KeyboardEvent): string | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { isNumeric } from "./utils";
|
|
2
1
|
/**
|
|
3
2
|
* Pre-defined format specifiers for use with format().
|
|
4
3
|
*/
|
|
@@ -68,19 +67,6 @@ export declare const DEFAULT_CURRENCY = "USD";
|
|
|
68
67
|
export declare const DEFAULT_CUSTOM_FORMAT = "#.##";
|
|
69
68
|
export declare const DEFAULT_FRACTIONAL_DIGITS = 4;
|
|
70
69
|
export declare const SUPPORTED_CURRENCIES: string[];
|
|
71
|
-
/**
|
|
72
|
-
* Formats a number for display in the current locale.
|
|
73
|
-
*
|
|
74
|
-
* @param num The number to format.
|
|
75
|
-
*/
|
|
76
|
-
export declare function format(num: number): string;
|
|
77
|
-
/**
|
|
78
|
-
* Formats a number for display.
|
|
79
|
-
*
|
|
80
|
-
* @param format See {@link NumberFormatter.format}.
|
|
81
|
-
* @param num The number to format.
|
|
82
|
-
*/
|
|
83
|
-
export declare function format(format: string, num: number): string;
|
|
84
70
|
/**
|
|
85
71
|
* Formats a number for display.
|
|
86
72
|
*
|
package/forms/numberFormatter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{customFormatNumber}from"./customNumberFormat.js";var NumberDisplayFormat;!function(r){r.NUMBER="n",r.FIXED_POINT="f",r.CURRENCY="c",r.ACCOUNTING="a",r.PERCENT="p",r.ROUND_TRIP="r",r.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(r,D){if(null==D||isNaN(D))return"";let t=r.format||NumberDisplayFormat.NUMBER;if(t===NumberDisplayFormat.CUSTOM&&(t=r.customDisplayFormat||DEFAULT_CUSTOM_FORMAT),t===NumberDisplayFormat.ROUND_TRIP)return D.toString();var R,N=t.toLowerCase();N===NumberDisplayFormat.CURRENCY||N===NumberDisplayFormat.ACCOUNTING?(R=r.currency||DEFAULT_CURRENCY,t=N,t+=r.fractionalDigits??"",t+=R?`$${R}`:""):N!==NumberDisplayFormat.NUMBER&&N!==NumberDisplayFormat.FIXED_POINT&&N!==NumberDisplayFormat.PERCENT||(t=N,t+=r.fractionalDigits??"");var N=r["locale"],r=`${N}|${t}`;let a=numberFormatters.get(r);return a||(a=createNumberFormatter(N,t),numberFormatters.set(r,a)),a(D)}function createNumberFormatter(D,t){const R={};let N=t.match(standardFormatPattern);if(N){var a=N[1].toLowerCase(),m=Math.min(20,parseInt(N[2]));let r=N[3];a===NumberDisplayFormat.CURRENCY||a===NumberDisplayFormat.ACCOUNTING?r=(r||DEFAULT_CURRENCY).toUpperCase():(r="",void 0===R.minimumFractionDigits&&(R.minimumFractionDigits=0),void 0===R.maximumFractionDigits&&(R.maximumFractionDigits=Math.max(DEFAULT_FRACTIONAL_DIGITS,R.minimumFractionDigits))),a===NumberDisplayFormat.PERCENT?R.style="percent":a===NumberDisplayFormat.ACCOUNTING?R.currencySign="accounting":a===NumberDisplayFormat.FIXED_POINT&&(R.useGrouping=!1),isNaN(m)||(R.minimumFractionDigits=m,R.maximumFractionDigits=m);const F=r?new Intl.NumberFormat(D,{style:"currency",currency:r,...R}):new Intl.NumberFormat(D,R);return r=>F.format(r)}return r=>customFormatNumber(r,t,D)}const numberFormatters=new Map,standardFormatPattern=/^([acfnp])(\d*)(?:\$([a-zA-Z]{3}))?$/i;export{NumberDisplayFormat,DEFAULT_CURRENCY,DEFAULT_CUSTOM_FORMAT,DEFAULT_FRACTIONAL_DIGITS,SUPPORTED_CURRENCIES,format};
|
|
@@ -31,16 +31,6 @@ export declare const defaultNumberFormatConfiguration: NumberFormatConfiguration
|
|
|
31
31
|
* @returns A {@link defs.NumberConstraints} containing values that can be safely used in a component.
|
|
32
32
|
*/
|
|
33
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 custom format string and returns the result.
|
|
36
|
-
* The supplied value is treated as one of Microsoft's [Custom numeric format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings)
|
|
37
|
-
*
|
|
38
|
-
* There are lots of unusual ways you can combine the supported characters, but for simplicity, we support the most common use case
|
|
39
|
-
* which is using `#` and numeric characters as placeholders.
|
|
40
|
-
* @param customFormat The custom format to be inspected.
|
|
41
|
-
* @returns The number of decimal places in `customFormat`.
|
|
42
|
-
*/
|
|
43
|
-
export declare function countDecimalsInCustomFormat(customFormat: string | undefined): number;
|
|
44
34
|
/**
|
|
45
35
|
* Counts the number of decimal places in the specified number and returns the result.
|
|
46
36
|
* This uses Intl.NumberFormat rather than number.toString() to ensure that large numbers don't get converted to an exponential format.
|
|
@@ -102,7 +92,7 @@ export declare function areValuesEqual(elementValue: defs.Value | undefined, new
|
|
|
102
92
|
* A mark on the slider. This is a copy of the interface by the same name in @mui/base/useSlider.
|
|
103
93
|
* We use string rather than React.Node so that we can share this between runtime and designer without discrepancies between the typings.
|
|
104
94
|
*/
|
|
105
|
-
|
|
95
|
+
interface Mark {
|
|
106
96
|
value: number;
|
|
107
97
|
label?: string;
|
|
108
98
|
}
|
|
@@ -142,8 +132,6 @@ type SymbolInfo = {
|
|
|
142
132
|
* The symbol to displayed.
|
|
143
133
|
*/
|
|
144
134
|
symbol: string;
|
|
145
|
-
symbolCount?: number;
|
|
146
|
-
integerCount?: number;
|
|
147
135
|
};
|
|
148
136
|
export declare function getCurrencySymbolInfo(locale: string, currency: string): SymbolInfo | undefined;
|
|
149
137
|
export declare function getPercentSymbolInfo(locale: string): SymbolInfo | undefined;
|
package/forms/numberUtilities.js
CHANGED
|
@@ -1 +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:n,step:o}=e;var u,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),n="number"!=typeof n||Number.isNaN(n)?r.precision.default:n,void 0!==r.precision.minimum&&(n=Math.max(n,r.precision.minimum)),void 0!==r.precision.maximum&&(n=Math.min(n,r.precision.maximum)),n<0?(u=Math.pow(10,-1*n),void 0!==o&&o%u==0||(o=u)):(o=isNumeric(o)&&0<o?o:r.step.default,void 0!==m&&void 0!==a&&(o=Math.min(o,m-a),u=preciseDivide(m-a,o),Number.isInteger(u)||(r=countDecimalsInValue(o),m=preciseRound(a+Math.floor(u)*o,r)))),{maximum:m,minimum:a,step:o}}const intlNumberFormat=new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:20,useGrouping:!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:n,step:o}=e;var u,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),n="number"!=typeof n||Number.isNaN(n)?r.precision.default:n,void 0!==r.precision.minimum&&(n=Math.max(n,r.precision.minimum)),void 0!==r.precision.maximum&&(n=Math.min(n,r.precision.maximum)),n<0?(u=Math.pow(10,-1*n),void 0!==o&&o%u==0||(o=u)):(o=isNumeric(o)&&0<o?o:r.step.default,void 0!==m&&void 0!==a&&(o=Math.min(o,m-a),u=preciseDivide(m-a,o),Number.isInteger(u)||(r=countDecimalsInValue(o),m=preciseRound(a+Math.floor(u)*o,r)))),{maximum:m,minimum:a,step:o}}const intlNumberFormat=new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:20,useGrouping:!1});function countDecimalsInValue(e){return Number.isInteger(e)?0:intlNumberFormat.formatToParts(e).filter(e=>"fraction"===e.type).map(e=>e.value).join("").length}function sanitizePrecision(e,r,i){i=getNumberFormatConfiguration(i);void 0===e&&(e=i.precision.default);r=countDecimalsInValue(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 preciseDivide(e,r){var i=countDecimalsInValue(e),t=countDecimalsInValue(r);if(0<i||0<t){t=Math.max(i,t),t=Math.pow(10,t);return e*t/(r*t)}return e/r}function enforceConstraints(e,r){var i,t,{maximum:n,minimum:o,step:r}=r;return void 0!==o?(i=preciseDivide(e-o,r),Number.isInteger(i)||(t=countDecimalsInValue(r),e=preciseRound(o+Math.round(i)*r,t))):void 0!==n&&(i=preciseDivide(n-e,r),Number.isInteger(i)||(t=countDecimalsInValue(r),e=preciseRound(n-Math.round(i)*r,t))),void 0!==o&&e<o&&(e=o),e=void 0!==n&&n<e?n:e}function getNumberSliderValues(e,r,i=!1){let t=[],n=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?n=e:"number"==typeof e?.numeric&&(n=e.numeric);if(Array.isArray(e)&&1<=e.length&&(n=e[0],o=e[1]),void 0===n||isNaN(n)||(n=enforceConstraints(n,r),void 0===o||isNaN(o)?i&&t.push(n):(o=enforceConstraints(o,r),t.push(n,o))),t.sort((e,r)=>e-r),t.length===(i?1:2))return t;var u=r.maximum,e=r.minimum;return i?[enforceConstraints((e+u)/2,r)]:[e,u]}function areValuesEqual(e,r){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,n,o){if(n&&o){const u=[{value:i,label:format(e,i)}];for(let e=i+t;e<r;e+=t)u.push({value:e});return u.push({value:r,label:format(e,r)}),u}return n&&!o?[{value:i,label:format(e,i)},{value:r,label:format(e,r)}]:o}function preciseRound(e,r){let i=e.toString();return i.includes("e")&&(i=e.toFixed(r)),Number(Math.round(Number(i+`e${r}`))+`e-${r}`)}function getCurrencySymbolInfo(e,r){const i=new Intl.NumberFormat(e,{style:"currency",currency:r,minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:!1}),t=i.formatToParts(0);e=t.filter(e=>"currency"===e.type)[0],r=t.filter(e=>"integer"===e.type)[0];if(e&&r)return{position:t.indexOf(e)<t.indexOf(r)?"start":"end",symbol:e.value}}function getPercentSymbolInfo(e){const r=new Intl.NumberFormat(e,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:!1}),i=r.formatToParts(0);var t=i.filter(e=>"percentSign"===e.type)[0],e=i.filter(e=>"integer"===e.type)[0];if(t&&e)return{position:i.indexOf(t)<i.indexOf(e)?"start":"end",symbol:t.value}}export{defaultNumberFormatConfiguration,getNumberConstraints,countDecimalsInValue,sanitizePrecision,getNumberFormatConfiguration,enforceConstraints,getNumberSliderValues,areValuesEqual,getMarks,preciseRound,getCurrencySymbolInfo,getPercentSymbolInfo};
|
package/forms/utils.d.ts
CHANGED
|
@@ -109,12 +109,8 @@ export declare function makeSafeClassName(elementName: string | undefined): stri
|
|
|
109
109
|
export declare function makeUniqueId(elementName: string | undefined): string;
|
|
110
110
|
export declare function getAccessibleDescriptionId(elementId: string): string;
|
|
111
111
|
export declare function getDescriptionId(elementId: string): string;
|
|
112
|
-
export declare function getErrorId(elementId: string): string;
|
|
113
112
|
export declare function getInputId(elementId: string): string;
|
|
114
113
|
export declare function getLabelId(elementId: string): string;
|
|
115
|
-
export declare function addClass(element: HTMLElement, name: string): void;
|
|
116
|
-
export declare function removeClass(element: HTMLElement, name: string): void;
|
|
117
|
-
export declare function setClass(element: HTMLElement, name: string, exists: boolean): void;
|
|
118
114
|
/**
|
|
119
115
|
* Returns `true` if the element has a `type` of `"Section"`.
|
|
120
116
|
* @param element The element to be inspected.
|
|
@@ -137,7 +133,6 @@ export declare function isMutuallyExclusiveSection(element?: defs.Element): bool
|
|
|
137
133
|
* @param element The element to be inspected.
|
|
138
134
|
*/
|
|
139
135
|
export declare function isTabSection(element?: defs.Element): boolean;
|
|
140
|
-
export declare function isBoolean(value: defs.Value | undefined): value is boolean;
|
|
141
136
|
export declare function isNumber(value: defs.Value | undefined): value is number;
|
|
142
137
|
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
143
138
|
export declare function isString(value: defs.Value | undefined): value is string;
|
|
@@ -151,8 +146,6 @@ export declare function isItemsRef(value: defs.Value | undefined): value is defs
|
|
|
151
146
|
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
152
147
|
export declare function isNumberRef(value: defs.Value | undefined): value is defs.NumberRef;
|
|
153
148
|
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
154
|
-
export declare function isSketchRef(value: defs.Value | undefined): value is defs.SketchRef;
|
|
155
|
-
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
156
149
|
export declare function sanitizeGeometryRef(value: defs.Value | undefined): defs.GeometryRef | undefined;
|
|
157
150
|
/** @product This is intended for internal use only within VertiGIS Studio products. */
|
|
158
151
|
export declare function createGeometryRef(format: defs.GeometryFormat): defs.GeometryRef;
|
|
@@ -180,7 +173,7 @@ export declare function throttle(func: Function, delay?: number): (this: any) =>
|
|
|
180
173
|
* Determines whether a value is numeric, i.e. a number or a numeric string.
|
|
181
174
|
* @param value The value to check.
|
|
182
175
|
*/
|
|
183
|
-
export declare function isNumeric(value:
|
|
176
|
+
export declare function isNumeric(value: string | number | undefined): boolean;
|
|
184
177
|
export declare function getElementProps(component: FormComponent, element: defs.Element): FormElementProps;
|
|
185
178
|
/**
|
|
186
179
|
* Gets the id of an item from a Record<string, defs.Item>.
|
package/forms/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MuiPickersAdapterContext}from"@vertigis/react-ui/LocalizationProvider";import{useContext}from"react";import{FormElementTypes}from"./constants.js";import*as text from"./textUtilities.js";const DEFAULT_DEBOUNCE_DELAY=300,DEFAULT_THROTTLE_DELAY=100;let next=0,seed=(new Date).valueOf();const guid="5DDC9A38-AAAB-44C1-AD87-415160F43D75";function makeId(){return 2147483648<=next&&(seed=(new Date).valueOf(),next=0),`${guid}:${seed}:${next++}`}function indexOf(e,t){if(null!=e){e=e.index;return"number"==typeof e?e:t}}function compareIndex(e,t){return compareNumber(e.index,t.index)}function compareNumber(e,t){return e<t?-1:t<e?1:0}function sortAndFilter(e,t){void 0===t&&(t=indexOf);const i={};if("object"!=typeof e||null===e)return i;let n=0;const r=[];for(const
|
|
1
|
+
import{MuiPickersAdapterContext}from"@vertigis/react-ui/LocalizationProvider";import{useContext}from"react";import{FormElementTypes}from"./constants.js";import*as text from"./textUtilities.js";const DEFAULT_DEBOUNCE_DELAY=300,DEFAULT_THROTTLE_DELAY=100;let next=0,seed=(new Date).valueOf();const guid="5DDC9A38-AAAB-44C1-AD87-415160F43D75";function makeId(){return 2147483648<=next&&(seed=(new Date).valueOf(),next=0),`${guid}:${seed}:${next++}`}function indexOf(e,t){if(null!=e){e=e.index;return"number"==typeof e?e:t}}function compareIndex(e,t){return compareNumber(e.index,t.index)}function compareNumber(e,t){return e<t?-1:t<e?1:0}function sortAndFilter(e,t){void 0===t&&(t=indexOf);const i={};if("object"!=typeof e||null===e)return i;let n=0;const r=[];for(const c in e){var o=e[c],s=t(o,n++);"number"==typeof s&&r.push({key:c,index:s,item:o})}for(const a of r.sort(compareIndex))i[a.key]=a.item;return i}function inspectItems(e,t,i){let n;var r=sortAndFilter(t,function(e,t){if(null!=e&&!1!==e.visible){e=e.index;return"number"==typeof e?e:t}});if(void 0===(e=null==e||void 0===r[e]?void 0:e)&&null!=i)for(const o in r){if(r[o].value===i){e=o;break}e=void 0}return i=void 0!==e?(n=r[e].label,r[e].value):n=void 0,{current:e,items:r,label:n,value:i}}function makeSafeClassName(e){return`gcx-forms-${e?.replace(/[\W]/g,"")||"element"}`}let idSuffix=0;function makeUniqueId(e){return`${makeSafeClassName(e)}-${++idSuffix}`}function addSuffix(e,t){return`${e}-${t}`}function getAccessibleDescriptionId(e){return addSuffix(e,"accessible-description")}function getDescriptionId(e){return addSuffix(e,"description")}function getInputId(e){return addSuffix(e,"input")}function getLabelId(e){return addSuffix(e,"label")}function isObjectType(e,t){return"object"==typeof e&&null!==e&&(!Array.isArray(e)&&e.refValueType===t)}function isSection(e){return e?.type===FormElementTypes.SECTION}function isAccordionSection(e){return isSection(e)&&"accordion-section"===e.format}function isCollapsibleSection(e){return isSection(e)&&"collapsible-section"===e.format}function isFieldsetSection(e){return isSection(e)&&"fieldset-section"===e.format}function isMutuallyExclusiveSection(e){return isAccordionSection(e)||isTabSection(e)}function isTabSection(e){return isSection(e)&&"tab-section"===e.format}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isDataRef(e){return isObjectType(e,"data")}function isDateRangeRef(e){return isObjectType(e,"daterange")}function isDateTimeRef(e){return isObjectType(e,"date")||isObjectType(e,"time")||isObjectType(e,"datetime")}function isFilesRef(e){return isObjectType(e,"files")}function isScanRef(e){return isObjectType(e,"scan")}function isGeometryRef(e){return isObjectType(e,"geometry")}function isItemsRef(e){return isObjectType(e,"items")}function isNumberRef(e){return isObjectType(e,"number")}function sanitizeGeometryRef(e){if(isGeometryRef(e)){var t=e.geometry;if(Array.isArray(t)&&0<t.length)switch(e.format){case"circle":case"extent":case"line":case"multipoint":case"point":case"polygon":case"polygon-freehand":case"polyline":case"polyline-freehand":return e}}}function createGeometryRef(e){return{refValueType:"geometry",format:e,geometry:[]}}function debounce(t,i=DEFAULT_DEBOUNCE_DELAY){let n;return function(){const e=()=>{n=void 0,t.apply(this,arguments)};return clearTimeout(n),n=setTimeout(e,i),{now:()=>{n&&(clearTimeout(n),e())},cancel:()=>{n&&(clearTimeout(n),n=void 0)}}}}function throttle(i,n=DEFAULT_THROTTLE_DELAY){let r,o;return function(){var e=Date.now(),t=()=>{o=void 0,r=Date.now(),i.apply(this,arguments)};r&&e<r+n?(clearTimeout(o),o=setTimeout(t,n)):t()}}function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}function getElementProps(e,t){var{enabled:i,id:n,raiseEvent:r,setItemProperty:o,setProperty:s,setValue:c}=e,{format:a,manualEntry:u,showMinMaxLabels:f,showTickMarks:l,size:m,type:d,value:p,wrap:y}=t;return{...t,enabled:!!i,id:n,raiseEvent:r,setItemProperty:o,setProperty:s,setValue:c,format:a,manualEntry:u,showMinMaxLabels:f,showTickMarks:l,size:m,type:d,value:p,wrap:y,element:t,name:e.props.name,component:e}}function getItemId(e,t){if(e)for(const i in t)if(t[i]===e)return i}function useLocale(){var e=useContext(MuiPickersAdapterContext)?.utils?.locale?.code;if(!e)throw new Error("Failed to detect locale. Ensure there is a LocalizationProvider in the ancestry of the component that is using this hook.");return e}export{text,makeId,sortAndFilter,inspectItems,makeSafeClassName,makeUniqueId,getAccessibleDescriptionId,getDescriptionId,getInputId,getLabelId,isSection,isAccordionSection,isCollapsibleSection,isFieldsetSection,isMutuallyExclusiveSection,isTabSection,isNumber,isString,isDataRef,isDateRangeRef,isDateTimeRef,isFilesRef,isScanRef,isGeometryRef,isItemsRef,isNumberRef,sanitizeGeometryRef,createGeometryRef,debounce,throttle,isNumeric,getElementProps,getItemId,useLocale};
|
package/libs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "5.
|
|
1
|
+
export declare const VERSION = "5.44.0+33";
|
package/libs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const VERSION="5.
|
|
1
|
+
const VERSION="5.44.0+33";export{VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertigis/workflow",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.44.0",
|
|
4
4
|
"author": "VertiGIS",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@date-fns/utc": "^1.2.0",
|
|
@@ -14,31 +14,31 @@
|
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@arcgis/core": "4.
|
|
17
|
+
"@arcgis/core": "4.31.6",
|
|
18
18
|
"@emotion/react": "^11.8.2",
|
|
19
19
|
"@emotion/styled": "^11.8.1",
|
|
20
20
|
"@swc/core": "^1.3.95",
|
|
21
21
|
"@swc/jest": "^0.2.29",
|
|
22
22
|
"@types/autosuggest-highlight": "^3.2.0",
|
|
23
|
-
"@types/jest": "^29.
|
|
23
|
+
"@types/jest": "^29.5.14",
|
|
24
24
|
"@types/react": "18.2.46",
|
|
25
25
|
"@types/react-dom": "18.2.18",
|
|
26
26
|
"@vertigis/licensing": "5.1.1",
|
|
27
27
|
"@vertigis/react-ui": "16.6.2",
|
|
28
28
|
"cross-env": "7.0.3",
|
|
29
|
+
"cross-fetch": "^4.1.0",
|
|
29
30
|
"jest": "^29.7.0",
|
|
30
31
|
"jest-environment-jsdom": "^29.7.0",
|
|
31
32
|
"jest-junit": "^15.0.0",
|
|
32
33
|
"jest-runtime": "^29.3.1",
|
|
33
34
|
"nock": "^13.2.9",
|
|
34
|
-
"node-fetch": "^3.3.0",
|
|
35
35
|
"react": "18.2.0",
|
|
36
36
|
"react-dom": "18.2.0",
|
|
37
37
|
"tslib": "^2.3.1",
|
|
38
38
|
"typescript": "5.2.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@arcgis/core": ">= 4.
|
|
41
|
+
"@arcgis/core": ">= 4.31.0 < 5.0.0",
|
|
42
42
|
"@vertigis/react-ui": ">= 16.3.1-0 < 17.0.0-0",
|
|
43
43
|
"react": ">= 18 < 19",
|
|
44
44
|
"react-dom": ">= 18 < 19"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{validation}from"../../Validation.js";class RunSubworkflow{execute(o,r){if(0<r.passes)return{result:r.state.result};var t={arguments:{...o.arguments},result:void 0};r.persist(t);let u=validation.string("subworkflowId",o.subworkflowId,validation.never);return"$"===u[0]&&(u=u.substring(1)),r.ambient.trivia.setSubworkflowTransition(u),r.call("default"),t}}RunSubworkflow.action="gcx:wf:core:subworkflow:RunSubworkflow",RunSubworkflow.suite="gcx:wf:builtin";export{RunSubworkflow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class Subworkflow{execute(o,e){0===e.passes&&e.call("content");const t=o["subworkflow"];return{arguments:t?.arguments,setResult:o=>{t&&(t.result=o)}}}}Subworkflow.action="gcx:wf:core::Subworkflow",Subworkflow.suite="gcx:wf:builtin";export{Subworkflow};
|