@genesislcap/foundation-ui 14.304.3-alpha-586ff22.0 → 14.306.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/dist/custom-elements.json +58 -234
- package/dist/dts/number-field/number-field.d.ts +0 -2
- package/dist/dts/number-field/number-field.d.ts.map +1 -1
- package/dist/dts/number-field/number-field.template.d.ts.map +1 -1
- package/dist/dts/number-field/utils.d.ts +3 -47
- package/dist/dts/number-field/utils.d.ts.map +1 -1
- package/dist/dts/stepper/stepper.d.ts +3 -0
- package/dist/dts/stepper/stepper.d.ts.map +1 -1
- package/dist/esm/number-field/number-field.js +43 -90
- package/dist/esm/number-field/utils.js +9 -257
- package/dist/esm/stepper/stepper.js +55 -10
- package/package.json +18 -18
|
@@ -28891,22 +28891,6 @@
|
|
|
28891
28891
|
},
|
|
28892
28892
|
"default": "'en-US'"
|
|
28893
28893
|
},
|
|
28894
|
-
{
|
|
28895
|
-
"kind": "field",
|
|
28896
|
-
"name": "autoStepPrecision",
|
|
28897
|
-
"type": {
|
|
28898
|
-
"text": "boolean"
|
|
28899
|
-
},
|
|
28900
|
-
"default": "false"
|
|
28901
|
-
},
|
|
28902
|
-
{
|
|
28903
|
-
"kind": "field",
|
|
28904
|
-
"name": "maximumInputPrecision",
|
|
28905
|
-
"type": {
|
|
28906
|
-
"text": "number"
|
|
28907
|
-
},
|
|
28908
|
-
"default": "12"
|
|
28909
|
-
},
|
|
28910
28894
|
{
|
|
28911
28895
|
"kind": "field",
|
|
28912
28896
|
"name": "options",
|
|
@@ -29332,29 +29316,6 @@
|
|
|
29332
29316
|
"default": "'en-US'",
|
|
29333
29317
|
"fieldName": "locale"
|
|
29334
29318
|
},
|
|
29335
|
-
{
|
|
29336
|
-
"type": {
|
|
29337
|
-
"text": "number"
|
|
29338
|
-
},
|
|
29339
|
-
"description": "Indicates that this element should get focus after the page finishes loading. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautofocus | autofocus HTML attribute for more information.",
|
|
29340
|
-
"fieldName": "hideStep",
|
|
29341
|
-
"default": "false",
|
|
29342
|
-
"inheritedFrom": {
|
|
29343
|
-
"name": "NumberField",
|
|
29344
|
-
"module": "src/number-field/number-field.ts"
|
|
29345
|
-
}
|
|
29346
|
-
},
|
|
29347
|
-
{
|
|
29348
|
-
"name": "maximumInputPrecision",
|
|
29349
|
-
"type": {
|
|
29350
|
-
"text": "number"
|
|
29351
|
-
},
|
|
29352
|
-
"default": "MAX_INPUT_PRECISION",
|
|
29353
|
-
"resolveInitializer": {
|
|
29354
|
-
"module": "src/number-field/number-field.ts"
|
|
29355
|
-
},
|
|
29356
|
-
"fieldName": "maximumInputPrecision"
|
|
29357
|
-
},
|
|
29358
29319
|
{
|
|
29359
29320
|
"name": "readonly",
|
|
29360
29321
|
"type": {
|
|
@@ -29624,39 +29585,27 @@
|
|
|
29624
29585
|
"name": "validateValue",
|
|
29625
29586
|
"return": {
|
|
29626
29587
|
"type": {
|
|
29627
|
-
"text": ""
|
|
29588
|
+
"text": "string"
|
|
29628
29589
|
}
|
|
29629
29590
|
},
|
|
29630
29591
|
"parameters": [
|
|
29631
29592
|
{
|
|
29632
29593
|
"name": "value",
|
|
29633
29594
|
"type": {
|
|
29634
|
-
"text": "string
|
|
29635
|
-
}
|
|
29636
|
-
"description": "The value to validate and format"
|
|
29595
|
+
"text": "string"
|
|
29596
|
+
}
|
|
29637
29597
|
},
|
|
29638
29598
|
{
|
|
29639
29599
|
"name": "locale",
|
|
29640
29600
|
"type": {
|
|
29641
29601
|
"text": "string"
|
|
29642
|
-
}
|
|
29643
|
-
"description": "The locale to use for formatting"
|
|
29602
|
+
}
|
|
29644
29603
|
},
|
|
29645
29604
|
{
|
|
29646
29605
|
"name": "withFormatting",
|
|
29647
|
-
"default": "true"
|
|
29648
|
-
"description": "Whether to use locale-specific formatting"
|
|
29649
|
-
},
|
|
29650
|
-
{
|
|
29651
|
-
"name": "precision",
|
|
29652
|
-
"optional": true,
|
|
29653
|
-
"type": {
|
|
29654
|
-
"text": "number"
|
|
29655
|
-
},
|
|
29656
|
-
"description": "The precision to use for formatting"
|
|
29606
|
+
"default": "true"
|
|
29657
29607
|
}
|
|
29658
|
-
]
|
|
29659
|
-
"description": "Validates and formats a value based on locale and precision"
|
|
29608
|
+
]
|
|
29660
29609
|
},
|
|
29661
29610
|
{
|
|
29662
29611
|
"kind": "function",
|
|
@@ -29678,13 +29627,6 @@
|
|
|
29678
29627
|
"type": {
|
|
29679
29628
|
"text": "string"
|
|
29680
29629
|
}
|
|
29681
|
-
},
|
|
29682
|
-
{
|
|
29683
|
-
"name": "precision",
|
|
29684
|
-
"optional": true,
|
|
29685
|
-
"type": {
|
|
29686
|
-
"text": "number"
|
|
29687
|
-
}
|
|
29688
29630
|
}
|
|
29689
29631
|
]
|
|
29690
29632
|
},
|
|
@@ -29724,138 +29666,8 @@
|
|
|
29724
29666
|
"type": {
|
|
29725
29667
|
"text": "number"
|
|
29726
29668
|
}
|
|
29727
|
-
},
|
|
29728
|
-
{
|
|
29729
|
-
"name": "precision",
|
|
29730
|
-
"optional": true,
|
|
29731
|
-
"type": {
|
|
29732
|
-
"text": "number"
|
|
29733
|
-
}
|
|
29734
29669
|
}
|
|
29735
29670
|
]
|
|
29736
|
-
},
|
|
29737
|
-
{
|
|
29738
|
-
"kind": "function",
|
|
29739
|
-
"name": "addWithPrecision",
|
|
29740
|
-
"return": {
|
|
29741
|
-
"type": {
|
|
29742
|
-
"text": ""
|
|
29743
|
-
}
|
|
29744
|
-
},
|
|
29745
|
-
"parameters": [
|
|
29746
|
-
{
|
|
29747
|
-
"name": "a",
|
|
29748
|
-
"type": {
|
|
29749
|
-
"text": "number"
|
|
29750
|
-
},
|
|
29751
|
-
"description": "First number"
|
|
29752
|
-
},
|
|
29753
|
-
{
|
|
29754
|
-
"name": "b",
|
|
29755
|
-
"type": {
|
|
29756
|
-
"text": "number"
|
|
29757
|
-
},
|
|
29758
|
-
"description": "Second number"
|
|
29759
|
-
}
|
|
29760
|
-
],
|
|
29761
|
-
"description": "Performs high precision addition using Pure JavaScript (NO BigInt needed!)\nThis is the BEST solution for precision arithmetic"
|
|
29762
|
-
},
|
|
29763
|
-
{
|
|
29764
|
-
"kind": "function",
|
|
29765
|
-
"name": "subtractWithPrecision",
|
|
29766
|
-
"return": {
|
|
29767
|
-
"type": {
|
|
29768
|
-
"text": ""
|
|
29769
|
-
}
|
|
29770
|
-
},
|
|
29771
|
-
"parameters": [
|
|
29772
|
-
{
|
|
29773
|
-
"name": "a",
|
|
29774
|
-
"type": {
|
|
29775
|
-
"text": "number"
|
|
29776
|
-
},
|
|
29777
|
-
"description": "First number"
|
|
29778
|
-
},
|
|
29779
|
-
{
|
|
29780
|
-
"name": "b",
|
|
29781
|
-
"type": {
|
|
29782
|
-
"text": "number"
|
|
29783
|
-
},
|
|
29784
|
-
"description": "Second number"
|
|
29785
|
-
}
|
|
29786
|
-
],
|
|
29787
|
-
"description": "Performs high precision subtraction using Pure JavaScript"
|
|
29788
|
-
},
|
|
29789
|
-
{
|
|
29790
|
-
"kind": "function",
|
|
29791
|
-
"name": "incrementWithPrecision",
|
|
29792
|
-
"return": {
|
|
29793
|
-
"type": {
|
|
29794
|
-
"text": ""
|
|
29795
|
-
}
|
|
29796
|
-
},
|
|
29797
|
-
"parameters": [
|
|
29798
|
-
{
|
|
29799
|
-
"name": "valueString",
|
|
29800
|
-
"type": {
|
|
29801
|
-
"text": "string | number"
|
|
29802
|
-
},
|
|
29803
|
-
"description": "The value as a string to maintain precision"
|
|
29804
|
-
},
|
|
29805
|
-
{
|
|
29806
|
-
"name": "step",
|
|
29807
|
-
"type": {
|
|
29808
|
-
"text": "number"
|
|
29809
|
-
},
|
|
29810
|
-
"description": "The step value to add"
|
|
29811
|
-
}
|
|
29812
|
-
],
|
|
29813
|
-
"description": "Increment a value with precision using direct string manipulation"
|
|
29814
|
-
},
|
|
29815
|
-
{
|
|
29816
|
-
"kind": "function",
|
|
29817
|
-
"name": "decrementWithPrecision",
|
|
29818
|
-
"return": {
|
|
29819
|
-
"type": {
|
|
29820
|
-
"text": ""
|
|
29821
|
-
}
|
|
29822
|
-
},
|
|
29823
|
-
"parameters": [
|
|
29824
|
-
{
|
|
29825
|
-
"name": "valueString",
|
|
29826
|
-
"type": {
|
|
29827
|
-
"text": "string | number"
|
|
29828
|
-
},
|
|
29829
|
-
"description": "The value as a string to maintain precision"
|
|
29830
|
-
},
|
|
29831
|
-
{
|
|
29832
|
-
"name": "step",
|
|
29833
|
-
"type": {
|
|
29834
|
-
"text": "number"
|
|
29835
|
-
},
|
|
29836
|
-
"description": "The step value to subtract"
|
|
29837
|
-
}
|
|
29838
|
-
],
|
|
29839
|
-
"description": "Decrement a value with precision using direct string manipulation"
|
|
29840
|
-
},
|
|
29841
|
-
{
|
|
29842
|
-
"kind": "function",
|
|
29843
|
-
"name": "calculateAutoStepPrecision",
|
|
29844
|
-
"return": {
|
|
29845
|
-
"type": {
|
|
29846
|
-
"text": ""
|
|
29847
|
-
}
|
|
29848
|
-
},
|
|
29849
|
-
"parameters": [
|
|
29850
|
-
{
|
|
29851
|
-
"name": "value",
|
|
29852
|
-
"type": {
|
|
29853
|
-
"text": "string | number"
|
|
29854
|
-
},
|
|
29855
|
-
"description": "The value to calculate step precision for"
|
|
29856
|
-
}
|
|
29857
|
-
],
|
|
29858
|
-
"description": "Calculate auto step precision based on decimal places\nMaintains original step calculation for compatibility"
|
|
29859
29671
|
}
|
|
29860
29672
|
],
|
|
29861
29673
|
"exports": [
|
|
@@ -29922,46 +29734,6 @@
|
|
|
29922
29734
|
"name": "validateMinMax",
|
|
29923
29735
|
"module": "src/number-field/utils.ts"
|
|
29924
29736
|
}
|
|
29925
|
-
},
|
|
29926
|
-
{
|
|
29927
|
-
"kind": "js",
|
|
29928
|
-
"name": "addWithPrecision",
|
|
29929
|
-
"declaration": {
|
|
29930
|
-
"name": "addWithPrecision",
|
|
29931
|
-
"module": "src/number-field/utils.ts"
|
|
29932
|
-
}
|
|
29933
|
-
},
|
|
29934
|
-
{
|
|
29935
|
-
"kind": "js",
|
|
29936
|
-
"name": "subtractWithPrecision",
|
|
29937
|
-
"declaration": {
|
|
29938
|
-
"name": "subtractWithPrecision",
|
|
29939
|
-
"module": "src/number-field/utils.ts"
|
|
29940
|
-
}
|
|
29941
|
-
},
|
|
29942
|
-
{
|
|
29943
|
-
"kind": "js",
|
|
29944
|
-
"name": "incrementWithPrecision",
|
|
29945
|
-
"declaration": {
|
|
29946
|
-
"name": "incrementWithPrecision",
|
|
29947
|
-
"module": "src/number-field/utils.ts"
|
|
29948
|
-
}
|
|
29949
|
-
},
|
|
29950
|
-
{
|
|
29951
|
-
"kind": "js",
|
|
29952
|
-
"name": "decrementWithPrecision",
|
|
29953
|
-
"declaration": {
|
|
29954
|
-
"name": "decrementWithPrecision",
|
|
29955
|
-
"module": "src/number-field/utils.ts"
|
|
29956
|
-
}
|
|
29957
|
-
},
|
|
29958
|
-
{
|
|
29959
|
-
"kind": "js",
|
|
29960
|
-
"name": "calculateAutoStepPrecision",
|
|
29961
|
-
"declaration": {
|
|
29962
|
-
"name": "calculateAutoStepPrecision",
|
|
29963
|
-
"module": "src/number-field/utils.ts"
|
|
29964
|
-
}
|
|
29965
29737
|
}
|
|
29966
29738
|
]
|
|
29967
29739
|
},
|
|
@@ -41462,6 +41234,14 @@
|
|
|
41462
41234
|
},
|
|
41463
41235
|
"default": "false"
|
|
41464
41236
|
},
|
|
41237
|
+
{
|
|
41238
|
+
"kind": "field",
|
|
41239
|
+
"name": "allowForwardJumps",
|
|
41240
|
+
"type": {
|
|
41241
|
+
"text": "boolean"
|
|
41242
|
+
},
|
|
41243
|
+
"default": "false"
|
|
41244
|
+
},
|
|
41465
41245
|
{
|
|
41466
41246
|
"kind": "field",
|
|
41467
41247
|
"name": "orientation",
|
|
@@ -41605,6 +41385,42 @@
|
|
|
41605
41385
|
}
|
|
41606
41386
|
]
|
|
41607
41387
|
},
|
|
41388
|
+
{
|
|
41389
|
+
"kind": "method",
|
|
41390
|
+
"name": "handleBackwardJump",
|
|
41391
|
+
"privacy": "private",
|
|
41392
|
+
"return": {
|
|
41393
|
+
"type": {
|
|
41394
|
+
"text": "void"
|
|
41395
|
+
}
|
|
41396
|
+
},
|
|
41397
|
+
"parameters": [
|
|
41398
|
+
{
|
|
41399
|
+
"name": "targetStepIndex",
|
|
41400
|
+
"type": {
|
|
41401
|
+
"text": "number"
|
|
41402
|
+
}
|
|
41403
|
+
}
|
|
41404
|
+
]
|
|
41405
|
+
},
|
|
41406
|
+
{
|
|
41407
|
+
"kind": "method",
|
|
41408
|
+
"name": "handleForwardJump",
|
|
41409
|
+
"privacy": "private",
|
|
41410
|
+
"return": {
|
|
41411
|
+
"type": {
|
|
41412
|
+
"text": "void"
|
|
41413
|
+
}
|
|
41414
|
+
},
|
|
41415
|
+
"parameters": [
|
|
41416
|
+
{
|
|
41417
|
+
"name": "targetStepIndex",
|
|
41418
|
+
"type": {
|
|
41419
|
+
"text": "number"
|
|
41420
|
+
}
|
|
41421
|
+
}
|
|
41422
|
+
]
|
|
41423
|
+
},
|
|
41608
41424
|
{
|
|
41609
41425
|
"kind": "field",
|
|
41610
41426
|
"name": "disabledPreviousStep",
|
|
@@ -41821,6 +41637,14 @@
|
|
|
41821
41637
|
"default": "false",
|
|
41822
41638
|
"fieldName": "allowBackwardJumps"
|
|
41823
41639
|
},
|
|
41640
|
+
{
|
|
41641
|
+
"name": "allow-forward-jumps",
|
|
41642
|
+
"type": {
|
|
41643
|
+
"text": "boolean"
|
|
41644
|
+
},
|
|
41645
|
+
"default": "false",
|
|
41646
|
+
"fieldName": "allowForwardJumps"
|
|
41647
|
+
},
|
|
41824
41648
|
{
|
|
41825
41649
|
"name": "orientation",
|
|
41826
41650
|
"type": {
|
|
@@ -10,8 +10,6 @@ export declare class NumberField extends FASTNumberField {
|
|
|
10
10
|
value: string;
|
|
11
11
|
withFormatting: boolean;
|
|
12
12
|
locale: string;
|
|
13
|
-
autoStepPrecision: boolean;
|
|
14
|
-
maximumInputPrecision: number;
|
|
15
13
|
options: Intl.NumberFormatOptions;
|
|
16
14
|
stepUp(): void;
|
|
17
15
|
stepDown(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../src/number-field/number-field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../src/number-field/number-field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOrE;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAe;IACxC,YAAY,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,mBAAmB;IAKA,QAAQ,EAAE,OAAO,CAAS;IAC/C,KAAK,EAAE,MAAM,CAAM;IACE,cAAc,EAAE,OAAO,CAAS;IACrD,MAAM,EAAE,MAAM,CAAW;IAE/B,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAG/B;IAEF,MAAM,IAAI,IAAI;IAuBd,QAAQ,IAAI,IAAI;IAuBhB,2BAA2B;IAK3B,eAAe,IAAI,IAAI;IAuBvB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAoC5C,UAAU,IAAI,IAAI;CAsBnB;AAED,eAAO,MAAM,kCAAkC,EAAE,cAGhD,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAWpC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,oTAMhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.template.d.ts","sourceRoot":"","sources":["../../../src/number-field/number-field.template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"number-field.template.d.ts","sourceRoot":"","sources":["../../../src/number-field/number-field.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAGL,yBAAyB,EACzB,kBAAkB,EAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,yBAAyB,CACnE,YAAY,CAAC,WAAW,CAAC,EACzB,kBAAkB,CA0EnB,CAAC"}
|
|
@@ -5,51 +5,7 @@ export declare const formatControlValue: (value: string, locale: string) => stri
|
|
|
5
5
|
export declare const sanitiseInputVal: (inputVal: string, locale: string) => string;
|
|
6
6
|
export declare const toIntlNumberFormat: (value: string, locale: string, options: Intl.NumberFormatOptions) => string;
|
|
7
7
|
export declare const preserveTrailingZerosAfterParse: (value: string, parsedValue: string, locale: string) => string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @param locale - The locale to use for formatting
|
|
12
|
-
* @param withFormatting - Whether to use locale-specific formatting
|
|
13
|
-
* @param precision - The precision to use for formatting
|
|
14
|
-
* @returns The validated and formatted value
|
|
15
|
-
*/
|
|
16
|
-
export declare const validateValue: (value: string | number, locale: string, withFormatting?: boolean, precision?: number) => string;
|
|
17
|
-
export declare const validateInput: (value: string, locale: string, precision?: number) => string;
|
|
18
|
-
export declare const validateMinMax: (value: string, locale: string, withFormatting: boolean, min: number, max: number, precision?: number) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Performs high precision addition using Pure JavaScript (NO BigInt needed!)
|
|
21
|
-
* This is the BEST solution for precision arithmetic
|
|
22
|
-
* @param a - First number
|
|
23
|
-
* @param b - Second number
|
|
24
|
-
* @returns Sum with maintained precision
|
|
25
|
-
*/
|
|
26
|
-
export declare const addWithPrecision: (a: number, b: number) => number;
|
|
27
|
-
/**
|
|
28
|
-
* Performs high precision subtraction using Pure JavaScript
|
|
29
|
-
* @param a - First number
|
|
30
|
-
* @param b - Second number
|
|
31
|
-
* @returns Difference with maintained precision
|
|
32
|
-
*/
|
|
33
|
-
export declare const subtractWithPrecision: (a: number, b: number) => number;
|
|
34
|
-
/**
|
|
35
|
-
* Increment a value with precision using direct string manipulation
|
|
36
|
-
* @param valueString - The value as a string to maintain precision
|
|
37
|
-
* @param step - The step value to add
|
|
38
|
-
* @returns The incremented value as a string with preserved precision
|
|
39
|
-
*/
|
|
40
|
-
export declare const incrementWithPrecision: (valueString: string | number, step: number) => string;
|
|
41
|
-
/**
|
|
42
|
-
* Decrement a value with precision using direct string manipulation
|
|
43
|
-
* @param valueString - The value as a string to maintain precision
|
|
44
|
-
* @param step - The step value to subtract
|
|
45
|
-
* @returns The decremented value as a string with preserved precision
|
|
46
|
-
*/
|
|
47
|
-
export declare const decrementWithPrecision: (valueString: string | number, step: number) => string;
|
|
48
|
-
/**
|
|
49
|
-
* Calculate auto step precision based on decimal places
|
|
50
|
-
* Maintains original step calculation for compatibility
|
|
51
|
-
* @param value - The value to calculate step precision for
|
|
52
|
-
* @returns The calculated step value
|
|
53
|
-
*/
|
|
54
|
-
export declare const calculateAutoStepPrecision: (value: string | number) => number;
|
|
8
|
+
export declare const validateValue: (value: string, locale: string, withFormatting?: boolean) => string;
|
|
9
|
+
export declare const validateInput: (value: string, locale: string) => string;
|
|
10
|
+
export declare const validateMinMax: (value: string, locale: string, withFormatting: boolean, min: number, max: number) => string;
|
|
55
11
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/number-field/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/number-field/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,GAClC,OAAO,MAAM,EACb,QAAQ,MAAM,KACb;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAI5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAWlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,MAEnE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,SAAS,IAAI,CAAC,mBAAmB,KAChC,MAEF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,OAAO,MAAM,EACb,aAAa,MAAM,EACnB,QAAQ,MAAM,KACb,MA+BF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,wBAAqB,KAAG,MAYpF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAG7D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,uBAAqB,EACrB,KAAK,MAAM,EACX,KAAK,MAAM,KACV,MAWF,CAAC"}
|
|
@@ -10,6 +10,7 @@ export declare class Stepper extends FoundationElement {
|
|
|
10
10
|
hideSubmitButton: boolean;
|
|
11
11
|
hideStepNumber: boolean;
|
|
12
12
|
allowBackwardJumps: boolean;
|
|
13
|
+
allowForwardJumps: boolean;
|
|
13
14
|
orientation: TabsOrientation;
|
|
14
15
|
orientationChanged(): void;
|
|
15
16
|
activeid: string;
|
|
@@ -27,6 +28,8 @@ export declare class Stepper extends FoundationElement {
|
|
|
27
28
|
connectedCallback(): void;
|
|
28
29
|
private getActiveIndex;
|
|
29
30
|
handleStepClick(stepIndex: any): void;
|
|
31
|
+
private handleBackwardJump;
|
|
32
|
+
private handleForwardJump;
|
|
30
33
|
get disabledPreviousStep(): boolean;
|
|
31
34
|
get isLastStep(): boolean;
|
|
32
35
|
get islastStepValid(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../../src/stepper/stepper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,CAAA;CAAE,CAAC;AAEhD;;GAEG;AACH,qBAAa,OAAQ,SAAQ,iBAAiB;IACgB,gBAAgB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAS;
|
|
1
|
+
{"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../../src/stepper/stepper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,CAAA;CAAE,CAAC;AAEhD;;GAEG;AACH,qBAAa,OAAQ,SAAQ,iBAAiB;IACgB,gBAAgB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAS;IACrC,iBAAiB,EAAE,OAAO,CAAS;IAC1F,WAAW,EAAE,eAAe,CAA4B;IAC9D,kBAAkB,IAAI,IAAI;IAOpB,QAAQ,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ7C,IAAI,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;IAC/C,WAAW,IAAI,IAAI;IAWP,SAAS,EAAE,WAAW,EAAE,CAAC;IACrC,gBAAgB,IAAI,IAAI;IAUZ,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,aAAa,SAAK;IAClB,cAAc,EAAE,MAAM,CAAK;IAEvC,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAgB;IAEnC,iBAAiB,IAAI,IAAI;IAQzB,OAAO,CAAC,cAAc;IAStB,eAAe,CAAC,SAAS,KAAA;IAQzB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAwCzB,IAAc,oBAAoB,YAEjC;IAED,IAAc,UAAU,YAEvB;IAED,IAAc,eAAe,YAkB5B;IAED,OAAO,IAAI,IAAI;IAIf,QAAQ,IAAI,IAAI;IAqChB,YAAY,IAAI,IAAI;IAQpB,SAAS,CAAC,OAAO,QAAO,IAAI,CAqC1B;IAEF,gBAAgB,aAWd;IAEF,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,mBAAmB;CAG5B;AAGD,eAAO,MAAM,8BAA8B,EAAE,cAA0B,CAAC;AAExE,eAAO,MAAM,oBAAoB,IAAK,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;kBAM5B,CAAC"}
|
|
@@ -4,9 +4,8 @@ import { NumberField as FASTNumberField } from '@microsoft/fast-components';
|
|
|
4
4
|
import { DOM, attr } from '@microsoft/fast-element';
|
|
5
5
|
import { foundationNumberFieldStyles as styles } from './number-field.styles';
|
|
6
6
|
import { foundationNumberFieldTemplate as template } from './number-field.template';
|
|
7
|
-
import {
|
|
7
|
+
import { formatControlValue, toIntlNumberFormat, validateInput, validateMinMax } from './utils';
|
|
8
8
|
const MAX_DECIMAL_PLACES = 3;
|
|
9
|
-
const MAX_INPUT_PRECISION = 12;
|
|
10
9
|
/**
|
|
11
10
|
* @tagname %%prefix%%-number-field
|
|
12
11
|
*/
|
|
@@ -17,8 +16,6 @@ export class NumberField extends FASTNumberField {
|
|
|
17
16
|
this.value = '';
|
|
18
17
|
this.withFormatting = false;
|
|
19
18
|
this.locale = 'en-US';
|
|
20
|
-
this.autoStepPrecision = false;
|
|
21
|
-
this.maximumInputPrecision = MAX_INPUT_PRECISION;
|
|
22
19
|
this.options = {
|
|
23
20
|
maximumFractionDigits: MAX_DECIMAL_PLACES,
|
|
24
21
|
minimumFractionDigits: 0,
|
|
@@ -30,60 +27,33 @@ export class NumberField extends FASTNumberField {
|
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
stepUp() {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
const stepUpValue = incrementWithPrecision(this.value, stepValue);
|
|
47
|
-
this.value = stepUpValue.toString();
|
|
48
|
-
}
|
|
49
|
-
if (this.control) {
|
|
50
|
-
if (this.min !== undefined || this.max !== undefined) {
|
|
51
|
-
this.control.value = validateMinMax(this.value, this.locale, this.withFormatting, this.min, this.max, this.maximumInputPrecision);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.control.value = this.value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
30
|
+
const value = parseFloat(this.value);
|
|
31
|
+
const stepUpValue = !isNaN(value)
|
|
32
|
+
? value + this.step
|
|
33
|
+
: this.min > 0
|
|
34
|
+
? this.min
|
|
35
|
+
: this.max < 0
|
|
36
|
+
? this.max
|
|
37
|
+
: !this.min
|
|
38
|
+
? this.step
|
|
39
|
+
: 0;
|
|
40
|
+
this.value = stepUpValue.toString();
|
|
41
|
+
this.control.value = validateMinMax(stepUpValue.toString(), this.locale, this.withFormatting, this.min, this.max);
|
|
57
42
|
this.handleTextInput();
|
|
58
43
|
}
|
|
59
44
|
stepDown() {
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
stepValue = this.step;
|
|
75
|
-
}
|
|
76
|
-
const stepDownValue = decrementWithPrecision(this.value, stepValue);
|
|
77
|
-
this.value = stepDownValue.toString();
|
|
78
|
-
}
|
|
79
|
-
if (this.control) {
|
|
80
|
-
if (this.min !== undefined || this.max !== undefined) {
|
|
81
|
-
this.control.value = validateMinMax(this.value, this.locale, this.withFormatting, this.min, this.max, this.maximumInputPrecision);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.control.value = this.value;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
45
|
+
const value = parseFloat(this.value);
|
|
46
|
+
const stepDownValue = !isNaN(value)
|
|
47
|
+
? value - this.step
|
|
48
|
+
: this.min > 0
|
|
49
|
+
? this.min
|
|
50
|
+
: this.max < 0
|
|
51
|
+
? this.max
|
|
52
|
+
: !this.min
|
|
53
|
+
? 0 - this.step
|
|
54
|
+
: 0;
|
|
55
|
+
this.value = stepDownValue.toString();
|
|
56
|
+
this.control.value = validateMinMax(stepDownValue.toString(), this.locale, this.withFormatting, this.min, this.max);
|
|
87
57
|
this.handleTextInput();
|
|
88
58
|
}
|
|
89
59
|
hasSeparatorWithoutDecimals() {
|
|
@@ -91,29 +61,22 @@ export class NumberField extends FASTNumberField {
|
|
|
91
61
|
return new RegExp(regexString);
|
|
92
62
|
}
|
|
93
63
|
handleTextInput() {
|
|
94
|
-
if (!this.control)
|
|
95
|
-
return;
|
|
96
64
|
if (this.control.value === '-' || this.control.value === '-0')
|
|
97
65
|
return;
|
|
98
66
|
this['isUserInput'] = true;
|
|
99
67
|
if (this.withFormatting && !new NumberParser(this.locale).hasSeparator(this.control.value)) {
|
|
100
68
|
DOM.queueUpdate(() => {
|
|
101
|
-
const validValue = validateInput(this.control.value, this.locale
|
|
69
|
+
const validValue = validateInput(this.control.value, this.locale);
|
|
102
70
|
this.value = validValue;
|
|
103
|
-
|
|
104
|
-
this.control.value = formatControlValue(validValue, this.locale);
|
|
105
|
-
}
|
|
71
|
+
this.control.value = formatControlValue(validValue, this.locale);
|
|
106
72
|
this.$emit('input');
|
|
107
73
|
});
|
|
108
74
|
}
|
|
109
75
|
else if (!this.withFormatting &&
|
|
110
76
|
!this.hasSeparatorWithoutDecimals().test(this.control.value)) {
|
|
111
77
|
DOM.queueUpdate(() => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, '');
|
|
115
|
-
}
|
|
116
|
-
this.value = ((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
78
|
+
this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, '');
|
|
79
|
+
this.value = this.control.value;
|
|
117
80
|
this.$emit('input');
|
|
118
81
|
});
|
|
119
82
|
}
|
|
@@ -125,41 +88,37 @@ export class NumberField extends FASTNumberField {
|
|
|
125
88
|
}
|
|
126
89
|
if (next !== undefined && next !== null && next !== previous) {
|
|
127
90
|
if (!this['isUserInput']) {
|
|
128
|
-
this.value = validateMinMax(this.value, this.locale, false, this.min, this.max
|
|
91
|
+
this.value = validateMinMax(this.value, this.locale, false, this.min, this.max);
|
|
129
92
|
DOM.queueUpdate(() => {
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
: this.value;
|
|
135
|
-
}
|
|
93
|
+
this.control.value =
|
|
94
|
+
this.withFormatting && this.value
|
|
95
|
+
? toIntlNumberFormat(this.value, this.locale, this.options)
|
|
96
|
+
: this.value;
|
|
136
97
|
});
|
|
137
98
|
return;
|
|
138
99
|
}
|
|
139
100
|
const value = next;
|
|
140
101
|
DOM.queueUpdate(() => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (this.control.value === '' || this.value === '') {
|
|
102
|
+
var _a;
|
|
103
|
+
if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.value) === '' || this.value === '') {
|
|
144
104
|
this.control.value = value;
|
|
145
105
|
return;
|
|
146
106
|
}
|
|
147
107
|
this.control.value = formatControlValue(String(value), this.locale);
|
|
148
108
|
this.value = this.withFormatting
|
|
149
|
-
? validateInput(this.control.value, this.locale
|
|
109
|
+
? validateInput(this.control.value, this.locale)
|
|
150
110
|
: this.control.value;
|
|
151
111
|
});
|
|
152
112
|
}
|
|
153
113
|
}
|
|
154
114
|
handleBlur() {
|
|
155
|
-
if (!this.control)
|
|
156
|
-
return;
|
|
157
115
|
this['isUserInput'] = false;
|
|
158
|
-
const validatedValue = validateMinMax(this.control.value, this.locale, this.withFormatting, this.min, this.max
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
116
|
+
const validatedValue = validateMinMax(this.control.value, this.locale, this.withFormatting, this.min, this.max);
|
|
117
|
+
if (validatedValue && !isNaN(parseFloat(validatedValue))) {
|
|
118
|
+
this.value = Intl.NumberFormat('en-US', {
|
|
119
|
+
maximumFractionDigits: this.options.maximumFractionDigits,
|
|
120
|
+
useGrouping: false,
|
|
121
|
+
}).format(parseFloat(validatedValue));
|
|
163
122
|
}
|
|
164
123
|
this.control.value =
|
|
165
124
|
this.withFormatting && this.value
|
|
@@ -183,12 +142,6 @@ __decorate([
|
|
|
183
142
|
__decorate([
|
|
184
143
|
attr
|
|
185
144
|
], NumberField.prototype, "locale", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
attr({ mode: 'boolean' })
|
|
188
|
-
], NumberField.prototype, "autoStepPrecision", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
attr
|
|
191
|
-
], NumberField.prototype, "maximumInputPrecision", void 0);
|
|
192
145
|
export const foundationNumberFieldShadowOptions = {
|
|
193
146
|
delegatesFocus: true,
|
|
194
147
|
mode: 'open',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NumberParser } from '@genesislcap/foundation-utils';
|
|
2
2
|
const formattedInputPrecision = 12;
|
|
3
3
|
const FORMAT_TEST_NUMBER = 12345.6;
|
|
4
|
-
const DECIMAL_BASE = 10;
|
|
5
4
|
export const getSeparatorsFromParser = (value, locale) => {
|
|
6
5
|
var _a;
|
|
7
6
|
const parts = new Intl.NumberFormat(locale).formatToParts(FORMAT_TEST_NUMBER);
|
|
@@ -50,75 +49,19 @@ export const preserveTrailingZerosAfterParse = (value, parsedValue, locale) => {
|
|
|
50
49
|
}
|
|
51
50
|
return String(parsedValue);
|
|
52
51
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* @param withFormatting - Whether to use locale-specific formatting
|
|
58
|
-
* @param precision - The precision to use for formatting
|
|
59
|
-
* @returns The validated and formatted value
|
|
60
|
-
*/
|
|
61
|
-
export const validateValue = (value, locale, withFormatting = true, precision) => {
|
|
62
|
-
if (value === undefined || value === null || value === '') {
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
65
|
-
const stringValue = typeof value === 'number' ? value.toString() : value;
|
|
66
|
-
const inputPrecision = precision !== null && precision !== void 0 ? precision : formattedInputPrecision;
|
|
67
|
-
let cleanValue;
|
|
68
|
-
if (withFormatting) {
|
|
69
|
-
cleanValue = sanitiseInputVal(stringValue, locale);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const { decimalSeparator } = getSeparatorsFromParser(stringValue, locale);
|
|
73
|
-
if (decimalSeparator !== '.') {
|
|
74
|
-
const normalizedValue = stringValue.replace(new RegExp(`\\${decimalSeparator}`, 'g'), '.');
|
|
75
|
-
cleanValue = normalizedValue;
|
|
76
|
-
const decimalIndex = cleanValue.indexOf('.');
|
|
77
|
-
if (decimalIndex !== -1) {
|
|
78
|
-
cleanValue = cleanValue.substring(0, decimalIndex);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
cleanValue = stringValue;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// Ensure cleanValue is always a string (single conversion point)
|
|
86
|
-
cleanValue = String(cleanValue);
|
|
87
|
-
const numberRegex = /^-?\d*\.?\d+$/;
|
|
88
|
-
if (!numberRegex.test(cleanValue)) {
|
|
89
|
-
return '';
|
|
90
|
-
}
|
|
91
|
-
if (inputPrecision !== undefined) {
|
|
92
|
-
const cleanValueStr = cleanValue.replace('.', '');
|
|
93
|
-
const significantDigits = cleanValueStr.replace(/^0+/, '').length;
|
|
94
|
-
if (significantDigits > inputPrecision) {
|
|
95
|
-
const decimalIndex = cleanValue.indexOf('.');
|
|
96
|
-
if (decimalIndex !== -1) {
|
|
97
|
-
const integerPart = cleanValue.substring(0, decimalIndex);
|
|
98
|
-
const integerDigits = integerPart.length;
|
|
99
|
-
if (integerDigits >= inputPrecision) {
|
|
100
|
-
return cleanValue.substring(0, inputPrecision);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
const decimalDigitsNeeded = inputPrecision - integerDigits;
|
|
104
|
-
const decimalPart = cleanValue.substring(decimalIndex + 1);
|
|
105
|
-
const truncatedDecimalPart = decimalPart.substring(0, decimalDigitsNeeded);
|
|
106
|
-
return `${integerPart}.${truncatedDecimalPart}`;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return cleanValue.substring(0, inputPrecision);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
52
|
+
export const validateValue = (value, locale, withFormatting = true) => {
|
|
53
|
+
let validValue = parseFloat(parseFloat(withFormatting ? sanitiseInputVal(value, locale) : value).toPrecision(formattedInputPrecision));
|
|
54
|
+
if (isNaN(validValue)) {
|
|
55
|
+
validValue = '';
|
|
113
56
|
}
|
|
114
|
-
return
|
|
57
|
+
return String(validValue);
|
|
115
58
|
};
|
|
116
|
-
export const validateInput = (value, locale
|
|
117
|
-
const parsedValue = validateValue(value, locale
|
|
59
|
+
export const validateInput = (value, locale) => {
|
|
60
|
+
const parsedValue = validateValue(value, locale);
|
|
118
61
|
return preserveTrailingZerosAfterParse(value, parsedValue, locale);
|
|
119
62
|
};
|
|
120
|
-
export const validateMinMax = (value, locale, withFormatting = true, min, max
|
|
121
|
-
let validValue = parseFloat(validateValue(value, locale, withFormatting
|
|
63
|
+
export const validateMinMax = (value, locale, withFormatting = true, min, max) => {
|
|
64
|
+
let validValue = parseFloat(validateValue(value, locale, withFormatting));
|
|
122
65
|
if (isNaN(validValue)) {
|
|
123
66
|
validValue = '';
|
|
124
67
|
}
|
|
@@ -128,194 +71,3 @@ export const validateMinMax = (value, locale, withFormatting = true, min, max, p
|
|
|
128
71
|
}
|
|
129
72
|
return String(validValue);
|
|
130
73
|
};
|
|
131
|
-
/**
|
|
132
|
-
* Performs high precision addition using Pure JavaScript (NO BigInt needed!)
|
|
133
|
-
* This is the BEST solution for precision arithmetic
|
|
134
|
-
* @param a - First number
|
|
135
|
-
* @param b - Second number
|
|
136
|
-
* @returns Sum with maintained precision
|
|
137
|
-
*/
|
|
138
|
-
export const addWithPrecision = (a, b) => {
|
|
139
|
-
try {
|
|
140
|
-
const aStr = a.toString();
|
|
141
|
-
const bStr = b.toString();
|
|
142
|
-
const aDecimalIndex = aStr.indexOf('.');
|
|
143
|
-
const bDecimalIndex = bStr.indexOf('.');
|
|
144
|
-
const aPrecision = aDecimalIndex === -1 ? 0 : aStr.length - aDecimalIndex - 1;
|
|
145
|
-
const bPrecision = bDecimalIndex === -1 ? 0 : bStr.length - bDecimalIndex - 1;
|
|
146
|
-
const maxPrecision = Math.max(aPrecision, bPrecision);
|
|
147
|
-
const multiplier = Math.pow(DECIMAL_BASE, maxPrecision);
|
|
148
|
-
const aInt = Math.round(a * multiplier);
|
|
149
|
-
const bInt = Math.round(b * multiplier);
|
|
150
|
-
const resultInt = aInt + bInt;
|
|
151
|
-
return resultInt / multiplier;
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
// fallback
|
|
155
|
-
return a + b;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Performs high precision subtraction using Pure JavaScript
|
|
160
|
-
* @param a - First number
|
|
161
|
-
* @param b - Second number
|
|
162
|
-
* @returns Difference with maintained precision
|
|
163
|
-
*/
|
|
164
|
-
export const subtractWithPrecision = (a, b) => {
|
|
165
|
-
try {
|
|
166
|
-
const aStr = a.toString();
|
|
167
|
-
const bStr = b.toString();
|
|
168
|
-
const aDecimalIndex = aStr.indexOf('.');
|
|
169
|
-
const bDecimalIndex = bStr.indexOf('.');
|
|
170
|
-
const aPrecision = aDecimalIndex === -1 ? 0 : aStr.length - aDecimalIndex - 1;
|
|
171
|
-
const bPrecision = bDecimalIndex === -1 ? 0 : bStr.length - bDecimalIndex - 1;
|
|
172
|
-
const maxPrecision = Math.max(aPrecision, bPrecision);
|
|
173
|
-
const multiplier = Math.pow(DECIMAL_BASE, maxPrecision);
|
|
174
|
-
const aInt = Math.round(a * multiplier);
|
|
175
|
-
const bInt = Math.round(b * multiplier);
|
|
176
|
-
const resultInt = aInt - bInt;
|
|
177
|
-
return resultInt / multiplier;
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
// fallback
|
|
181
|
-
return a - b;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Increment a value with precision using direct string manipulation
|
|
186
|
-
* @param valueString - The value as a string to maintain precision
|
|
187
|
-
* @param step - The step value to add
|
|
188
|
-
* @returns The incremented value as a string with preserved precision
|
|
189
|
-
*/
|
|
190
|
-
export const incrementWithPrecision = (valueString, step) => {
|
|
191
|
-
try {
|
|
192
|
-
const valueStr = typeof valueString === 'string' ? valueString : valueString.toString();
|
|
193
|
-
const decimalIndex = valueStr.indexOf('.');
|
|
194
|
-
if (decimalIndex === -1) {
|
|
195
|
-
const value = parseInt(valueStr);
|
|
196
|
-
return (value + step).toString();
|
|
197
|
-
}
|
|
198
|
-
const decimalPart = valueStr.substring(decimalIndex + 1);
|
|
199
|
-
const decimalPlaces = decimalPart.length;
|
|
200
|
-
const lastDigitIndex = decimalPart.length - 1;
|
|
201
|
-
const lastDigit = parseInt(decimalPart.charAt(lastDigitIndex));
|
|
202
|
-
const newLastDigit = lastDigit + 1;
|
|
203
|
-
if (newLastDigit <= 9) {
|
|
204
|
-
const newDecimalPart = decimalPart.substring(0, lastDigitIndex) + newLastDigit;
|
|
205
|
-
return valueStr.substring(0, decimalIndex + 1) + newDecimalPart;
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
let newDecimalPart = '';
|
|
209
|
-
let carry = 1;
|
|
210
|
-
for (let i = lastDigitIndex; i >= 0; i -= 1) {
|
|
211
|
-
const digit = parseInt(decimalPart.charAt(i));
|
|
212
|
-
const newDigit = digit + carry;
|
|
213
|
-
if (newDigit <= 9) {
|
|
214
|
-
newDecimalPart = newDigit + newDecimalPart;
|
|
215
|
-
carry = 0;
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
newDecimalPart = '0' + newDecimalPart;
|
|
219
|
-
carry = 1;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (carry === 1) {
|
|
223
|
-
const integerPart = parseInt(valueStr.substring(0, decimalIndex));
|
|
224
|
-
return integerPart + 1 + '.' + newDecimalPart;
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
return valueStr.substring(0, decimalIndex + 1) + newDecimalPart;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
const value = typeof valueString === 'string' ? parseFloat(valueString) : valueString;
|
|
233
|
-
return (value + step).toString();
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* Decrement a value with precision using direct string manipulation
|
|
238
|
-
* @param valueString - The value as a string to maintain precision
|
|
239
|
-
* @param step - The step value to subtract
|
|
240
|
-
* @returns The decremented value as a string with preserved precision
|
|
241
|
-
*/
|
|
242
|
-
export const decrementWithPrecision = (valueString, step) => {
|
|
243
|
-
try {
|
|
244
|
-
const valueStr = typeof valueString === 'string' ? valueString : valueString.toString();
|
|
245
|
-
const decimalIndex = valueStr.indexOf('.');
|
|
246
|
-
if (decimalIndex === -1) {
|
|
247
|
-
const value = parseInt(valueStr);
|
|
248
|
-
return (value - step).toString();
|
|
249
|
-
}
|
|
250
|
-
const decimalPart = valueStr.substring(decimalIndex + 1);
|
|
251
|
-
const decimalPlaces = decimalPart.length;
|
|
252
|
-
const lastDigitIndex = decimalPart.length - 1;
|
|
253
|
-
const lastDigit = parseInt(decimalPart.charAt(lastDigitIndex));
|
|
254
|
-
const newLastDigit = lastDigit - 1;
|
|
255
|
-
if (newLastDigit >= 0) {
|
|
256
|
-
const newDecimalPart = decimalPart.substring(0, lastDigitIndex) + newLastDigit;
|
|
257
|
-
return valueStr.substring(0, decimalIndex + 1) + newDecimalPart;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
let newDecimalPart = '';
|
|
261
|
-
let borrow = 1;
|
|
262
|
-
for (let i = lastDigitIndex; i >= 0; i -= 1) {
|
|
263
|
-
const digit = parseInt(decimalPart.charAt(i));
|
|
264
|
-
const newDigit = digit - borrow;
|
|
265
|
-
if (newDigit >= 0) {
|
|
266
|
-
newDecimalPart = newDigit + newDecimalPart;
|
|
267
|
-
borrow = 0;
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
newDecimalPart = '9' + newDecimalPart;
|
|
271
|
-
borrow = 1;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (borrow === 1) {
|
|
275
|
-
const integerPart = parseInt(valueStr.substring(0, decimalIndex));
|
|
276
|
-
return integerPart - 1 + '.' + newDecimalPart;
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
return valueStr.substring(0, decimalIndex + 1) + newDecimalPart;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
catch (error) {
|
|
284
|
-
const value = typeof valueString === 'string' ? parseFloat(valueString) : valueString;
|
|
285
|
-
return (value - step).toString();
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* Calculate auto step precision based on decimal places
|
|
290
|
-
* Maintains original step calculation for compatibility
|
|
291
|
-
* @param value - The value to calculate step precision for
|
|
292
|
-
* @returns The calculated step value
|
|
293
|
-
*/
|
|
294
|
-
export const calculateAutoStepPrecision = (value) => {
|
|
295
|
-
try {
|
|
296
|
-
const valueStr = typeof value === 'string' ? value : value.toString();
|
|
297
|
-
const decimalIndex = valueStr.indexOf('.');
|
|
298
|
-
if (decimalIndex === -1) {
|
|
299
|
-
return 1;
|
|
300
|
-
}
|
|
301
|
-
const decimalPart = valueStr.substring(decimalIndex + 1);
|
|
302
|
-
const decimalPlaces = decimalPart.length;
|
|
303
|
-
if (decimalPlaces === 0) {
|
|
304
|
-
return 1;
|
|
305
|
-
}
|
|
306
|
-
const step = Math.pow(DECIMAL_BASE, -decimalPlaces);
|
|
307
|
-
return parseFloat(step.toFixed(decimalPlaces));
|
|
308
|
-
}
|
|
309
|
-
catch (error) {
|
|
310
|
-
const valueStr = typeof value === 'string' ? value : value.toString();
|
|
311
|
-
const decimalIndex = valueStr.indexOf('.');
|
|
312
|
-
if (decimalIndex === -1)
|
|
313
|
-
return 1;
|
|
314
|
-
const decimalPart = valueStr.substring(decimalIndex + 1);
|
|
315
|
-
const decimalPlaces = decimalPart.length;
|
|
316
|
-
if (decimalPlaces === 0)
|
|
317
|
-
return 1;
|
|
318
|
-
const step = Math.pow(DECIMAL_BASE, -decimalPlaces);
|
|
319
|
-
return parseFloat(step.toFixed(decimalPlaces));
|
|
320
|
-
}
|
|
321
|
-
};
|
|
@@ -11,6 +11,7 @@ export class Stepper extends FoundationElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.allowBackwardJumps = false;
|
|
14
|
+
this.allowForwardJumps = false;
|
|
14
15
|
this.orientation = TabsOrientation.vertical;
|
|
15
16
|
this.progressValue = 0;
|
|
16
17
|
this.activeTabIndex = 0;
|
|
@@ -33,7 +34,8 @@ export class Stepper extends FoundationElement {
|
|
|
33
34
|
tab.setAttribute('isLast', String(isLast));
|
|
34
35
|
tab.setAttribute('hideStepNumber', String(this.hideStepNumber === true));
|
|
35
36
|
tab.setAttribute('tabindex', isActiveTab ? '0' : '-1');
|
|
36
|
-
tab.setAttribute('showCursorPointer', String(index <= this.activeTabIndex && this.allowBackwardJumps)
|
|
37
|
+
tab.setAttribute('showCursorPointer', String((index <= this.activeTabIndex && this.allowBackwardJumps) ||
|
|
38
|
+
(index > this.activeTabIndex && this.allowForwardJumps)));
|
|
37
39
|
if (isActiveTab) {
|
|
38
40
|
this.activetab = tab;
|
|
39
41
|
this.activeid = tabId;
|
|
@@ -113,16 +115,56 @@ export class Stepper extends FoundationElement {
|
|
|
113
115
|
}
|
|
114
116
|
handleStepClick(stepIndex) {
|
|
115
117
|
if (stepIndex < this.activeTabIndex && this.allowBackwardJumps) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
this.handleBackwardJump(stepIndex);
|
|
119
|
+
}
|
|
120
|
+
else if (stepIndex > this.activeTabIndex && this.allowForwardJumps) {
|
|
121
|
+
this.handleForwardJump(stepIndex);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
handleBackwardJump(targetStepIndex) {
|
|
125
|
+
// Reset completion status for all steps after the clicked step
|
|
126
|
+
for (let i = targetStepIndex + 1; i <= this.activeTabIndex; i = i + 1) {
|
|
127
|
+
this.tabs[i].completed = false;
|
|
128
|
+
}
|
|
129
|
+
this.activetab = this.tabs[targetStepIndex];
|
|
130
|
+
this.activeid = this.tabIds[targetStepIndex];
|
|
131
|
+
this.$emit('step-click', {
|
|
132
|
+
activetab: this.activetab,
|
|
133
|
+
activeid: this.activeid,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
handleForwardJump(targetStepIndex) {
|
|
137
|
+
// Validate intermediate steps (exclusive of target)
|
|
138
|
+
for (let i = this.activeTabIndex; i < targetStepIndex; i += 1) {
|
|
139
|
+
if (this.validation && this.validation[i]) {
|
|
140
|
+
if (!this.validation[i].isValid()) {
|
|
141
|
+
this.tabs[i].completed = false;
|
|
142
|
+
this.tabs[i].error = true;
|
|
143
|
+
this.getCompletedTabs();
|
|
144
|
+
this.$emit('validation-failure', {
|
|
145
|
+
stepIndex: i,
|
|
146
|
+
stepId: this.tabIds[i],
|
|
147
|
+
message: `Validation failed for step ${i + 1}`,
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
this.tabs[i].error = false;
|
|
118
152
|
}
|
|
119
|
-
this.activetab = this.tabs[stepIndex];
|
|
120
|
-
this.activeid = this.tabIds[stepIndex];
|
|
121
|
-
this.$emit('step-click', {
|
|
122
|
-
activetab: this.activetab,
|
|
123
|
-
activeid: this.activeid,
|
|
124
|
-
});
|
|
125
153
|
}
|
|
154
|
+
for (let i = this.activeTabIndex; i < targetStepIndex; i += 1) {
|
|
155
|
+
this.tabs[i].completed = true;
|
|
156
|
+
this.tabs[i].error = false;
|
|
157
|
+
}
|
|
158
|
+
this.tabs[targetStepIndex].completed = false;
|
|
159
|
+
this.tabs[targetStepIndex].error = false;
|
|
160
|
+
this.activeTabIndex = targetStepIndex;
|
|
161
|
+
this.activetab = this.tabs[targetStepIndex];
|
|
162
|
+
this.activeid = this.tabIds[targetStepIndex];
|
|
163
|
+
this.getCompletedTabs();
|
|
164
|
+
this.$emit('step-click', {
|
|
165
|
+
activetab: this.activetab,
|
|
166
|
+
activeid: this.activeid,
|
|
167
|
+
});
|
|
126
168
|
}
|
|
127
169
|
get disabledPreviousStep() {
|
|
128
170
|
return this.activeTabIndex === 0 ? true : false;
|
|
@@ -153,7 +195,6 @@ export class Stepper extends FoundationElement {
|
|
|
153
195
|
}
|
|
154
196
|
nextStep() {
|
|
155
197
|
var _a;
|
|
156
|
-
this.$emit('next-step');
|
|
157
198
|
if (this.validation && this.validation[this.activeTabIndex]) {
|
|
158
199
|
if (!this.validation[this.activeTabIndex].isValid()) {
|
|
159
200
|
this.tabs[this.activeTabIndex].completed = false;
|
|
@@ -167,6 +208,7 @@ export class Stepper extends FoundationElement {
|
|
|
167
208
|
this.tabs[this.activeTabIndex].completed = true;
|
|
168
209
|
this.activeTabIndex = this.activeTabIndex + 1;
|
|
169
210
|
this.activeid = this.tabIds[this.activeTabIndex];
|
|
211
|
+
this.$emit('next-step');
|
|
170
212
|
this.$emit('validation-success');
|
|
171
213
|
}
|
|
172
214
|
const lastStepIndex = this.tabs.length - 1;
|
|
@@ -216,6 +258,9 @@ __decorate([
|
|
|
216
258
|
__decorate([
|
|
217
259
|
attr({ attribute: 'allow-backward-jumps', mode: 'boolean' })
|
|
218
260
|
], Stepper.prototype, "allowBackwardJumps", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
attr({ attribute: 'allow-forward-jumps', mode: 'boolean' })
|
|
263
|
+
], Stepper.prototype, "allowForwardJumps", void 0);
|
|
219
264
|
__decorate([
|
|
220
265
|
attr
|
|
221
266
|
], Stepper.prototype, "orientation", void 0);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-ui",
|
|
3
3
|
"description": "Genesis Foundation UI",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.306.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@genesislcap/foundation-testing": "14.
|
|
87
|
-
"@genesislcap/genx": "14.
|
|
88
|
-
"@genesislcap/rollup-builder": "14.
|
|
89
|
-
"@genesislcap/ts-builder": "14.
|
|
90
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
91
|
-
"@genesislcap/vite-builder": "14.
|
|
92
|
-
"@genesislcap/webpack-builder": "14.
|
|
86
|
+
"@genesislcap/foundation-testing": "14.306.0",
|
|
87
|
+
"@genesislcap/genx": "14.306.0",
|
|
88
|
+
"@genesislcap/rollup-builder": "14.306.0",
|
|
89
|
+
"@genesislcap/ts-builder": "14.306.0",
|
|
90
|
+
"@genesislcap/uvu-playwright-builder": "14.306.0",
|
|
91
|
+
"@genesislcap/vite-builder": "14.306.0",
|
|
92
|
+
"@genesislcap/webpack-builder": "14.306.0",
|
|
93
93
|
"copyfiles": "^2.4.1",
|
|
94
94
|
"rxjs": "^7.5.4"
|
|
95
95
|
},
|
|
@@ -99,15 +99,15 @@
|
|
|
99
99
|
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
|
100
100
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
|
101
101
|
"@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
|
|
102
|
-
"@genesislcap/expression-builder": "14.
|
|
103
|
-
"@genesislcap/foundation-comms": "14.
|
|
104
|
-
"@genesislcap/foundation-criteria": "14.
|
|
105
|
-
"@genesislcap/foundation-errors": "14.
|
|
106
|
-
"@genesislcap/foundation-events": "14.
|
|
107
|
-
"@genesislcap/foundation-logger": "14.
|
|
108
|
-
"@genesislcap/foundation-notifications": "14.
|
|
109
|
-
"@genesislcap/foundation-user": "14.
|
|
110
|
-
"@genesislcap/foundation-utils": "14.
|
|
102
|
+
"@genesislcap/expression-builder": "14.306.0",
|
|
103
|
+
"@genesislcap/foundation-comms": "14.306.0",
|
|
104
|
+
"@genesislcap/foundation-criteria": "14.306.0",
|
|
105
|
+
"@genesislcap/foundation-errors": "14.306.0",
|
|
106
|
+
"@genesislcap/foundation-events": "14.306.0",
|
|
107
|
+
"@genesislcap/foundation-logger": "14.306.0",
|
|
108
|
+
"@genesislcap/foundation-notifications": "14.306.0",
|
|
109
|
+
"@genesislcap/foundation-user": "14.306.0",
|
|
110
|
+
"@genesislcap/foundation-utils": "14.306.0",
|
|
111
111
|
"@microsoft/fast-colors": "5.3.1",
|
|
112
112
|
"@microsoft/fast-components": "2.30.6",
|
|
113
113
|
"@microsoft/fast-element": "1.14.0",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"access": "public"
|
|
129
129
|
},
|
|
130
130
|
"customElements": "dist/custom-elements.json",
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "df5d88c4e8e25a56d2bf22dab70ca551784e6df0"
|
|
132
132
|
}
|