@qrvey/utils 1.2.9-22 → 1.2.9-23

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.9-22*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.9-23*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -688,12 +688,12 @@ Output:
688
688
 
689
689
 
690
690
 
691
- ### dist/filters/adapters/FDToLogic.js
691
+ ### dist/filters/adapters/FDToFlatUI.js
692
692
 
693
693
 
694
- #### FDToLogic(filterData)
694
+ #### FDToFlatUI(filterData, datasetsInfo)
695
695
 
696
- Generates a Filter Logic structure from Filter Data structure.
696
+ Generates a Flattened UI filter structure from Filter Data structure.
697
697
 
698
698
 
699
699
 
@@ -703,6 +703,7 @@ Generates a Filter Logic structure from Filter Data structure.
703
703
  | Name | Type | Description | |
704
704
  | ---- | ---- | ----------- | -------- |
705
705
  | filterData | | The filter data object. |   |
706
+ | datasetsInfo | | Collection of datasets information |   |
706
707
 
707
708
 
708
709
 
@@ -710,13 +711,13 @@ Generates a Filter Logic structure from Filter Data structure.
710
711
  ##### Returns
711
712
 
712
713
 
713
- - a filter logic array
714
+ - a flattened UI filters array
714
715
 
715
716
 
716
717
 
717
- #### getLogicBodyFromFD21(filterData)
718
+ #### FD21ToFlatUI(scopes, datasetsInfo)
718
719
 
719
- Gets the logic body
720
+ Generates a Filter Builder Structure from the Filter Data structure v2.1
720
721
 
721
722
 
722
723
 
@@ -725,7 +726,8 @@ Gets the logic body
725
726
 
726
727
  | Name | Type | Description | |
727
728
  | ---- | ---- | ----------- | -------- |
728
- | filterData | | The filter data object |   |
729
+ | scopes | | The filter scope section |   |
730
+ | datasetsInfo | | Collection of datasets information |   |
729
731
 
730
732
 
731
733
 
@@ -733,17 +735,17 @@ Gets the logic body
733
735
  ##### Returns
734
736
 
735
737
 
736
- - a filter logic array
738
+ - a flattened UI filters array
737
739
 
738
740
 
739
741
 
740
742
 
741
- ### dist/filters/adapters/FDToFlatUI.js
743
+ ### dist/filters/adapters/FDToLogic.js
742
744
 
743
745
 
744
- #### FDToFlatUI(filterData, datasetsInfo)
746
+ #### FDToLogic(filterData)
745
747
 
746
- Generates a Flattened UI filter structure from Filter Data structure.
748
+ Generates a Filter Logic structure from Filter Data structure.
747
749
 
748
750
 
749
751
 
@@ -753,7 +755,6 @@ Generates a Flattened UI filter structure from Filter Data structure.
753
755
  | Name | Type | Description | |
754
756
  | ---- | ---- | ----------- | -------- |
755
757
  | filterData | | The filter data object. |   |
756
- | datasetsInfo | | Collection of datasets information |   |
757
758
 
758
759
 
759
760
 
@@ -761,13 +762,13 @@ Generates a Flattened UI filter structure from Filter Data structure.
761
762
  ##### Returns
762
763
 
763
764
 
764
- - a flattened UI filters array
765
+ - a filter logic array
765
766
 
766
767
 
767
768
 
768
- #### FD21ToFlatUI(scopes, datasetsInfo)
769
+ #### getLogicBodyFromFD21(filterData)
769
770
 
770
- Generates a Filter Builder Structure from the Filter Data structure v2.1
771
+ Gets the logic body
771
772
 
772
773
 
773
774
 
@@ -776,8 +777,7 @@ Generates a Filter Builder Structure from the Filter Data structure v2.1
776
777
 
777
778
  | Name | Type | Description | |
778
779
  | ---- | ---- | ----------- | -------- |
779
- | scopes | | The filter scope section |   |
780
- | datasetsInfo | | Collection of datasets information |   |
780
+ | filterData | | The filter data object |   |
781
781
 
782
782
 
783
783
 
@@ -785,7 +785,7 @@ Generates a Filter Builder Structure from the Filter Data structure v2.1
785
785
  ##### Returns
786
786
 
787
787
 
788
- - a flattened UI filters array
788
+ - a filter logic array
789
789
 
790
790
 
791
791
 
@@ -2722,50 +2722,47 @@ Gets the format config
2722
2722
 
2723
2723
 
2724
2724
 
2725
- ### dist/services/api/getAllDatasets.api.js
2726
-
2727
-
2728
- #### getAllDatasets(config, pickDatasets)
2725
+ ### dist/stencil/decorators/Config.js
2729
2726
 
2730
- Get a dataset list from a collection of Qrvey IDs
2731
2727
 
2728
+ #### Config()
2732
2729
 
2730
+ Stencil.js - Prop Decorator
2731
+ Get and Parse the Widget Configuration Object and also provide the ability to get properties in different case styles such as: lower, upper, camel and pascal
2732
+ But for this, is required ask for a property in `snake_case` style
2733
2733
 
2734
2734
 
2735
- ##### Parameters
2736
2735
 
2737
- | Name | Type | Description | |
2738
- | ---- | ---- | ----------- | -------- |
2739
- | config | | the widget config. Includes the appid and others configuration properties |   |
2740
- | pickDatasets | | Collection of Qrvey IDs for filtering the request |   |
2741
2736
 
2742
2737
 
2743
2738
 
2739
+ ##### Examples
2744
2740
 
2745
- ##### Returns
2741
+ ```javascript
2742
+ \ @Config() @Prop() settings;
2746
2743
 
2744
+ someMethod() {
2745
+ this.settings.snake_case //it search for: obj.snake_case || obj.snakeCase || obj.SnakeCase || obj.snakecase || obj.SNAKECASE
2746
+ }
2747
+ ```
2747
2748
 
2748
- - a promise
2749
2749
 
2750
+ ##### Returns
2750
2751
 
2751
2752
 
2753
+ - `Void`
2752
2754
 
2753
- ### dist/services/api/getAllQrveys.api.js
2754
2755
 
2755
2756
 
2756
- #### getAllQrveys(config, params)
2757
2757
 
2758
- POST Request for getting Qrveys such as Web Forms and Datasets. Use params for getting precise data
2758
+ ### dist/stencil/util/createRef.js
2759
2759
 
2760
2760
 
2761
+ #### createRef()
2761
2762
 
2763
+ lit implementation of React createRef (https://reactjs.org/docs/refs-and-the-dom.html)
2762
2764
 
2763
- ##### Parameters
2764
2765
 
2765
- | Name | Type | Description | |
2766
- | ---- | ---- | ----------- | -------- |
2767
- | config | | Configuration |   |
2768
- | params | | Object for getting precise data |   |
2769
2766
 
2770
2767
 
2771
2768
 
@@ -2773,17 +2770,21 @@ POST Request for getting Qrveys such as Web Forms and Datasets. Use params for g
2773
2770
  ##### Returns
2774
2771
 
2775
2772
 
2776
- - `Void`
2773
+ - function - Function to use in ref prop in html elements
2777
2774
 
2778
2775
 
2779
2776
 
2780
2777
 
2781
- ### dist/services/api/getDatasetColumns.api.js
2778
+ ### dist/stencil/util/getConfig.js
2782
2779
 
2783
2780
 
2784
- #### getDatasetColumns(qrveyid)
2781
+ #### getConfig(cfg)
2785
2782
 
2786
- Get a dataset by Qrvey ID
2783
+ verify the Config object type and try to return a parsed Object
2784
+ - In case _cfg_ is a string, first try to make a JSON parse in other case
2785
+ try to find this string as a variable on Windows object
2786
+ - If _cfg_ is a fuction, tis is invoked and parsed
2787
+ - Finally, if is an object, _cfg_ is inmediatly returned
2787
2788
 
2788
2789
 
2789
2790
 
@@ -2792,7 +2793,7 @@ Get a dataset by Qrvey ID
2792
2793
 
2793
2794
  | Name | Type | Description | |
2794
2795
  | ---- | ---- | ----------- | -------- |
2795
- | qrveyid | | The Qrvey ID |   |
2796
+ | cfg | | |   |
2796
2797
 
2797
2798
 
2798
2799
 
@@ -2800,52 +2801,27 @@ Get a dataset by Qrvey ID
2800
2801
  ##### Returns
2801
2802
 
2802
2803
 
2803
- - a promise
2804
-
2805
-
2806
-
2807
-
2808
- ### dist/stencil/decorators/Config.js
2809
-
2810
-
2811
- #### Config()
2812
-
2813
- Stencil.js - Prop Decorator
2814
- Get and Parse the Widget Configuration Object and also provide the ability to get properties in different case styles such as: lower, upper, camel and pascal
2815
- But for this, is required ask for a property in `snake_case` style
2816
-
2817
-
2818
-
2819
-
2820
-
2821
-
2822
- ##### Examples
2823
-
2824
- ```javascript
2825
- \ @Config() @Prop() settings;
2826
-
2827
- someMethod() {
2828
- this.settings.snake_case //it search for: obj.snake_case || obj.snakeCase || obj.SnakeCase || obj.snakecase || obj.SNAKECASE
2829
- }
2830
- ```
2831
-
2804
+ - `Void`
2832
2805
 
2833
- ##### Returns
2834
2806
 
2835
2807
 
2836
- - `Void`
2837
2808
 
2809
+ ### dist/services/api/getAllDatasets.api.js
2838
2810
 
2839
2811
 
2812
+ #### getAllDatasets(config, pickDatasets)
2840
2813
 
2841
- ### dist/stencil/util/createRef.js
2814
+ Get a dataset list from a collection of Qrvey IDs
2842
2815
 
2843
2816
 
2844
- #### createRef()
2845
2817
 
2846
- lit implementation of React createRef (https://reactjs.org/docs/refs-and-the-dom.html)
2847
2818
 
2819
+ ##### Parameters
2848
2820
 
2821
+ | Name | Type | Description | |
2822
+ | ---- | ---- | ----------- | -------- |
2823
+ | config | | the widget config. Includes the appid and others configuration properties |   |
2824
+ | pickDatasets | | Collection of Qrvey IDs for filtering the request |   |
2849
2825
 
2850
2826
 
2851
2827
 
@@ -2853,21 +2829,17 @@ lit implementation of React createRef (https://reactjs.org/docs/refs-and-the-dom
2853
2829
  ##### Returns
2854
2830
 
2855
2831
 
2856
- - function - Function to use in ref prop in html elements
2832
+ - a promise
2857
2833
 
2858
2834
 
2859
2835
 
2860
2836
 
2861
- ### dist/stencil/util/getConfig.js
2837
+ ### dist/services/api/getAllQrveys.api.js
2862
2838
 
2863
2839
 
2864
- #### getConfig(cfg)
2840
+ #### getAllQrveys(config, params)
2865
2841
 
2866
- verify the Config object type and try to return a parsed Object
2867
- - In case _cfg_ is a string, first try to make a JSON parse in other case
2868
- try to find this string as a variable on Windows object
2869
- - If _cfg_ is a fuction, tis is invoked and parsed
2870
- - Finally, if is an object, _cfg_ is inmediatly returned
2842
+ POST Request for getting Qrveys such as Web Forms and Datasets. Use params for getting precise data
2871
2843
 
2872
2844
 
2873
2845
 
@@ -2876,7 +2848,8 @@ try to find this string as a variable on Windows object
2876
2848
 
2877
2849
  | Name | Type | Description | |
2878
2850
  | ---- | ---- | ----------- | -------- |
2879
- | cfg | | |   |
2851
+ | config | | Configuration |   |
2852
+ | params | | Object for getting precise data |   |
2880
2853
 
2881
2854
 
2882
2855
 
@@ -2889,12 +2862,12 @@ try to find this string as a variable on Windows object
2889
2862
 
2890
2863
 
2891
2864
 
2892
- ### dist/typescript/decorators/Throttled.js
2865
+ ### dist/services/api/getDatasetColumns.api.js
2893
2866
 
2894
2867
 
2895
- #### Throttled(time)
2868
+ #### getDatasetColumns(qrveyid)
2896
2869
 
2897
- (Method Decorator) Throttled Class Method
2870
+ Get a dataset by Qrvey ID
2898
2871
 
2899
2872
 
2900
2873
 
@@ -2903,7 +2876,7 @@ try to find this string as a variable on Windows object
2903
2876
 
2904
2877
  | Name | Type | Description | |
2905
2878
  | ---- | ---- | ----------- | -------- |
2906
- | time | | (optional) deafult 500 |   |
2879
+ | qrveyid | | The Qrvey ID |   |
2907
2880
 
2908
2881
 
2909
2882
 
@@ -2911,7 +2884,7 @@ try to find this string as a variable on Windows object
2911
2884
  ##### Returns
2912
2885
 
2913
2886
 
2914
- - `Void`
2887
+ - a promise
2915
2888
 
2916
2889
 
2917
2890
 
@@ -2943,12 +2916,12 @@ try to find this string as a variable on Windows object
2943
2916
 
2944
2917
 
2945
2918
 
2946
- ### dist/dates/relative/helpers/getStatementCase.js
2919
+ ### dist/typescript/decorators/Throttled.js
2947
2920
 
2948
2921
 
2949
- #### getStatementCase(includeCurrent, isCalendarDate)
2922
+ #### Throttled(time)
2950
2923
 
2951
- Returns a number/constant that identifies a relative date case
2924
+ (Method Decorator) Throttled Class Method
2952
2925
 
2953
2926
 
2954
2927
 
@@ -2957,8 +2930,7 @@ Returns a number/constant that identifies a relative date case
2957
2930
 
2958
2931
  | Name | Type | Description | |
2959
2932
  | ---- | ---- | ----------- | -------- |
2960
- | includeCurrent | `boolean` | |   |
2961
- | isCalendarDate | `boolean` | |   |
2933
+ | time | | (optional) deafult 500 |   |
2962
2934
 
2963
2935
 
2964
2936
 
@@ -2966,7 +2938,7 @@ Returns a number/constant that identifies a relative date case
2966
2938
  ##### Returns
2967
2939
 
2968
2940
 
2969
- - `number`
2941
+ - `Void`
2970
2942
 
2971
2943
 
2972
2944
 
@@ -2998,12 +2970,12 @@ Build a proper relative date statement type
2998
2970
 
2999
2971
 
3000
2972
 
3001
- ### dist/dates/relative/helpers/parseDate.js
2973
+ ### dist/dates/relative/helpers/getStatementCase.js
3002
2974
 
3003
2975
 
3004
- #### parseDate(date)
2976
+ #### getStatementCase(includeCurrent, isCalendarDate)
3005
2977
 
3006
- Parses a string date and returns a dayjs date
2978
+ Returns a number/constant that identifies a relative date case
3007
2979
 
3008
2980
 
3009
2981
 
@@ -3012,7 +2984,8 @@ Parses a string date and returns a dayjs date
3012
2984
 
3013
2985
  | Name | Type | Description | |
3014
2986
  | ---- | ---- | ----------- | -------- |
3015
- | date | `string` `Dayjs` `Date` | |   |
2987
+ | includeCurrent | `boolean` | |   |
2988
+ | isCalendarDate | `boolean` | |   |
3016
2989
 
3017
2990
 
3018
2991
 
@@ -3020,17 +2993,17 @@ Parses a string date and returns a dayjs date
3020
2993
  ##### Returns
3021
2994
 
3022
2995
 
3023
- - `Dayjs` A dayjs date
2996
+ - `number`
3024
2997
 
3025
2998
 
3026
2999
 
3027
3000
 
3028
- ### dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js
3001
+ ### dist/dates/relative/helpers/parseDate.js
3029
3002
 
3030
3003
 
3031
- #### getFilterBuilderGeneralConfig(config)
3004
+ #### parseDate(date)
3032
3005
 
3033
- Returns a filter builder config object by a any given config
3006
+ Parses a string date and returns a dayjs date
3034
3007
 
3035
3008
 
3036
3009
 
@@ -3039,7 +3012,7 @@ Returns a filter builder config object by a any given config
3039
3012
 
3040
3013
  | Name | Type | Description | |
3041
3014
  | ---- | ---- | ----------- | -------- |
3042
- | config | | any config object |   |
3015
+ | date | `string` `Dayjs` `Date` | |   |
3043
3016
 
3044
3017
 
3045
3018
 
@@ -3047,7 +3020,7 @@ Returns a filter builder config object by a any given config
3047
3020
  ##### Returns
3048
3021
 
3049
3022
 
3050
- - The filter builder config object
3023
+ - `Dayjs` A dayjs date
3051
3024
 
3052
3025
 
3053
3026
 
@@ -3348,12 +3321,12 @@ Gets filters from the logic by the scopes hierarchy.
3348
3321
 
3349
3322
 
3350
3323
 
3351
- ### dist/filters/helpers/common/areFiltersEquals.js
3324
+ ### dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js
3352
3325
 
3353
3326
 
3354
- #### areFiltersEquals(filter1, filter2)
3327
+ #### getFilterBuilderGeneralConfig(config)
3355
3328
 
3356
- Validates if both filters are the same
3329
+ Returns a filter builder config object by a any given config
3357
3330
 
3358
3331
 
3359
3332
 
@@ -3362,8 +3335,7 @@ Validates if both filters are the same
3362
3335
 
3363
3336
  | Name | Type | Description | |
3364
3337
  | ---- | ---- | ----------- | -------- |
3365
- | filter1 | | filter 1 |   |
3366
- | filter2 | | filter 2 |   |
3338
+ | config | | any config object |   |
3367
3339
 
3368
3340
 
3369
3341
 
@@ -3371,17 +3343,17 @@ Validates if both filters are the same
3371
3343
  ##### Returns
3372
3344
 
3373
3345
 
3374
- - true: the filters are equal; false: the filters are NOT equal
3346
+ - The filter builder config object
3375
3347
 
3376
3348
 
3377
3349
 
3378
3350
 
3379
- ### dist/filters/helpers/common/excludeFiltersByAggregateColumn.js
3351
+ ### dist/filters/helpers/common/areFiltersEquals.js
3380
3352
 
3381
3353
 
3382
- #### excludeFiltersByAggregateColumn(filterData)
3354
+ #### areFiltersEquals(filter1, filter2)
3383
3355
 
3384
- Excludes Aggregate Filters in the Filter Data. Excluding filters when the column.aggregate is included.
3356
+ Validates if both filters are the same
3385
3357
 
3386
3358
 
3387
3359
 
@@ -3390,7 +3362,8 @@ Excludes Aggregate Filters in the Filter Data. Excluding filters when the column
3390
3362
 
3391
3363
  | Name | Type | Description | |
3392
3364
  | ---- | ---- | ----------- | -------- |
3393
- | filterData | | The filter data object |   |
3365
+ | filter1 | | filter 1 |   |
3366
+ | filter2 | | filter 2 |   |
3394
3367
 
3395
3368
 
3396
3369
 
@@ -3398,17 +3371,17 @@ Excludes Aggregate Filters in the Filter Data. Excluding filters when the column
3398
3371
  ##### Returns
3399
3372
 
3400
3373
 
3401
- - The new filter data object that were excluded the aggregate filters
3374
+ - true: the filters are equal; false: the filters are NOT equal
3402
3375
 
3403
3376
 
3404
3377
 
3405
3378
 
3406
- ### dist/filters/helpers/common/excludeFiltersByScopes.js
3379
+ ### dist/filters/helpers/common/excludeFiltersByAggregateColumn.js
3407
3380
 
3408
3381
 
3409
- #### excludeFiltersByScopes(filterData, scopes)
3382
+ #### excludeFiltersByAggregateColumn(filterData)
3410
3383
 
3411
- Excludes and returns a filter data without filters by the given scopes
3384
+ Excludes Aggregate Filters in the Filter Data. Excluding filters when the column.aggregate is included.
3412
3385
 
3413
3386
 
3414
3387
 
@@ -3417,8 +3390,7 @@ Excludes and returns a filter data without filters by the given scopes
3417
3390
 
3418
3391
  | Name | Type | Description | |
3419
3392
  | ---- | ---- | ----------- | -------- |
3420
- | filterData | | The Filter Data |   |
3421
- | scopes | | collection of scopes to be as filtering parameters |   |
3393
+ | filterData | | The filter data object |   |
3422
3394
 
3423
3395
 
3424
3396
 
@@ -3426,7 +3398,7 @@ Excludes and returns a filter data without filters by the given scopes
3426
3398
  ##### Returns
3427
3399
 
3428
3400
 
3429
- - The new Filter Data without filters by the given scopes.
3401
+ - The new filter data object that were excluded the aggregate filters
3430
3402
 
3431
3403
 
3432
3404
 
@@ -3468,12 +3440,12 @@ The validation to filter the stored filter is depending on:
3468
3440
 
3469
3441
 
3470
3442
 
3471
- ### dist/filters/helpers/common/getFilterColumnLabel.js
3443
+ ### dist/filters/helpers/common/excludeFiltersByScopes.js
3472
3444
 
3473
3445
 
3474
- #### getFilterColumnLabel(column)
3446
+ #### excludeFiltersByScopes(filterData, scopes)
3475
3447
 
3476
- Get an string of the properties of the given filter column.
3448
+ Excludes and returns a filter data without filters by the given scopes
3477
3449
 
3478
3450
 
3479
3451
 
@@ -3482,7 +3454,8 @@ Get an string of the properties of the given filter column.
3482
3454
 
3483
3455
  | Name | Type | Description | |
3484
3456
  | ---- | ---- | ----------- | -------- |
3485
- | column | | The filter column |   |
3457
+ | filterData | | The Filter Data |   |
3458
+ | scopes | | collection of scopes to be as filtering parameters |   |
3486
3459
 
3487
3460
 
3488
3461
 
@@ -3490,7 +3463,7 @@ Get an string of the properties of the given filter column.
3490
3463
  ##### Returns
3491
3464
 
3492
3465
 
3493
- - an string with the property, aggregate or calculation label.
3466
+ - The new Filter Data without filters by the given scopes.
3494
3467
 
3495
3468
 
3496
3469
 
@@ -4480,4 +4453,31 @@ Resolves conditions between UI flattened filter and given parameters
4480
4453
 
4481
4454
 
4482
4455
 
4456
+ ### dist/filters/helpers/common/getFilterColumnLabel.js
4457
+
4458
+
4459
+ #### getFilterColumnLabel(column)
4460
+
4461
+ Get an string of the properties of the given filter column.
4462
+
4463
+
4464
+
4465
+
4466
+ ##### Parameters
4467
+
4468
+ | Name | Type | Description | |
4469
+ | ---- | ---- | ----------- | -------- |
4470
+ | column | | The filter column |   |
4471
+
4472
+
4473
+
4474
+
4475
+ ##### Returns
4476
+
4477
+
4478
+ - an string with the property, aggregate or calculation label.
4479
+
4480
+
4481
+
4482
+
4483
4483
  *Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*
@@ -1,5 +1,4 @@
1
1
  import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
2
- import { IDataset } from "../../qrvey/interfaces/IDataset";
3
2
  import { IColumnPropertyType } from "./IColumnPropertyType";
4
3
  import { IColumnSortingSettings } from "./IColumnSortingSettings";
5
4
  import { IBColumn } from "./IBColumn";
@@ -11,7 +10,6 @@ export interface IColumn extends Omit<IBColumn, "text" | "bucketId" | "formulaId
11
10
  bucketid?: string;
12
11
  aggregate?: IAggregateType;
13
12
  calculation?: IColumnCalculationType;
14
- dataset?: IDataset;
15
13
  formulaid?: string;
16
14
  label?: string;
17
15
  linkid?: string;
@@ -44,7 +44,7 @@ function FD21ToFlatUI(scopes = [], datasetsInfo = []) {
44
44
  const datasetInfo = datasetsInfo.find(dInfo => dInfo.qrveyid === dataset.qrveyid && dInfo.linkid === dataset.linkid);
45
45
  let columnInfo;
46
46
  if (!(0, isEmpty_1.isEmpty)(datasetInfo))
47
- columnInfo = datasetInfo.options.find(cInfo => { var _a, _b; return cInfo.id === filter.column.id && ((_a = cInfo.dataset) === null || _a === void 0 ? void 0 : _a.qrveyid) === filter.column.qrveyid && ((_b = cInfo.dataset) === null || _b === void 0 ? void 0 : _b.linkid) === filter.column.linkid; });
47
+ columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
48
48
  const info = !(0, isEmpty_1.isEmpty)(filter.extras.info) ? { icon: filter.extras.info.icon, label: filter.extras.info.label } : undefined;
49
49
  const property = (0, adaptDateGroupingProperty_1.adaptDateGroupingProperty)(filter.property);
50
50
  const uFilter = {
@@ -48,7 +48,6 @@ function FD21ToUI(scopes = [], section = FILTER_SECTION_1.FILTER_SECTION.ANYWHER
48
48
  ufData.scopes = scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(dataset => {
49
49
  const datasetInfo = datasetsInfo.find(dInfo => dInfo.qrveyid === dataset.qrveyid && dInfo.linkid === dataset.linkid);
50
50
  return Object.assign(Object.assign({}, dataset), { label: datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.label, filters: dataset.filters.map(filter => {
51
- var _a;
52
51
  let columnInfo;
53
52
  if (!(0, isEmpty_1.isEmpty)(datasetInfo))
54
53
  columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
@@ -60,7 +59,7 @@ function FD21ToUI(scopes = [], section = FILTER_SECTION_1.FILTER_SECTION.ANYWHER
60
59
  id: filter.column.id,
61
60
  label: columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.label,
62
61
  linked: columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.linked,
63
- linkid: ((_a = columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.dataset) === null || _a === void 0 ? void 0 : _a.linkid) || (datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.linkid),
62
+ linkid: (columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.linkid) || (datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.linkid),
64
63
  outputFormat: (0, get_1._get)(datasetInfo, 'outputFormat'),
65
64
  qrveyid: filter.column.qrveyid,
66
65
  type: (columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.type) || filter.column.type,
@@ -56,7 +56,7 @@ function buildFilterByExpression(expression, scopeItem, uFilters) {
56
56
  }
57
57
  }
58
58
  function getFilterByExpression(expression, scopeItem) {
59
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
59
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
60
60
  const uiExtras = expression.uiExtras;
61
61
  const scopeid = scopeItem.scope !== FILTER_SCOPE_1.FILTER_SCOPE.GLOBAL ? (0, get_1._get)(scopeItem, 'uiExtras.scopeid') : undefined;
62
62
  const info = !(0, isEmpty_1.isEmpty)(uiExtras.info) ? { icon: uiExtras.info.icon, label: uiExtras.info.label } : undefined;
@@ -92,8 +92,8 @@ function getFilterByExpression(expression, scopeItem) {
92
92
  enabled: true,
93
93
  displayed: true,
94
94
  qrveyid: (_r = uiExtras.column) === null || _r === void 0 ? void 0 : _r.qrveyid,
95
- label: (0, get_1._get)((_s = uiExtras.column) === null || _s === void 0 ? void 0 : _s.dataset, 'name') || ((_u = (_t = uiExtras.column) === null || _t === void 0 ? void 0 : _t.dataset) === null || _u === void 0 ? void 0 : _u.label),
96
- linkid: (_v = uiExtras.column) === null || _v === void 0 ? void 0 : _v.linkid,
95
+ label: (0, get_1._get)(uiExtras.column, 'dataset.name') || ((_s = uiExtras.column) === null || _s === void 0 ? void 0 : _s.label),
96
+ linkid: (_t = uiExtras.column) === null || _t === void 0 ? void 0 : _t.linkid,
97
97
  } }),
98
98
  filterid: undefined,
99
99
  lookupDisplayIndex: uiExtras.lookupDisplayIndex,
@@ -19,7 +19,7 @@ function getUpdatedUIFilters(data, datasets = []) {
19
19
  dataset.filters = dataset.filters.map(filter => {
20
20
  let columnInfo;
21
21
  if (!(0, isEmpty_1.isEmpty)(datasetInfo))
22
- columnInfo = datasetInfo.options.find(cInfo => { var _a, _b; return cInfo.id === filter.column.id && ((_a = cInfo.dataset) === null || _a === void 0 ? void 0 : _a.qrveyid) === filter.column.qrveyid && ((_b = cInfo.dataset) === null || _b === void 0 ? void 0 : _b.linkid) === filter.column.linkid; });
22
+ columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
23
23
  if (!(0, isEmpty_1.isEmpty)(columnInfo)) {
24
24
  filter.column.formulaType = columnInfo.formulaType;
25
25
  filter.column.label = columnInfo.label;
@@ -1,4 +1,5 @@
1
1
  import { IColumn } from "../../columns/interfaces/IColumn";
2
+ import { IDataset } from "../../qrvey/interfaces/IDataset";
2
3
  import { IFSFilterExtrasInfo } from "./common/IFSFilterExtrasInfo";
3
4
  import { IFDateSection } from "./IFDateSection";
4
5
  import { IFOperator } from "./IFOperator";
@@ -10,7 +11,9 @@ import { IFValue } from "./IFValue";
10
11
  import { IFUChartSettings } from "./ui/IFUChartSettings";
11
12
  import { IFUValue } from "./ui/IFUValue";
12
13
  export interface OLD_IFilterDetail {
13
- column?: IColumn;
14
+ column?: IColumn & {
15
+ dataset: IDataset;
16
+ };
14
17
  dateSection?: IFDateSection;
15
18
  enabled?: boolean;
16
19
  lookupDisplayIndex?: number;
@@ -53,13 +53,19 @@ function getLocaleOptions(outputFormat) {
53
53
  const { format, decimals, currency } = outputFormat;
54
54
  switch (format) {
55
55
  case "Currency" /* CURRENCY */: {
56
- const iso = (0, isEmpty_1.isEmpty)(currency) ? definition_1.CURRENCY_DEFAULT : definition_1.currencyISO.find(item => (item.text === currency.text) || item.text.includes(currency.label));
57
- return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0, currencyDisplay: 'narrowSymbol' };
56
+ let iso = (0, isEmpty_1.isEmpty)(currency) ? definition_1.CURRENCY_DEFAULT : definition_1.currencyISO.find(item => item.text === currency.text);
57
+ if ((0, isEmpty_1.isEmpty)(iso)) {
58
+ iso = definition_1.currencyISO.find(item => {
59
+ const symbol = item.text.split(' ')[0];
60
+ return symbol === currency.label;
61
+ });
62
+ }
63
+ return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: decimals, currencyDisplay: 'narrowSymbol' };
58
64
  }
59
65
  case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
60
- notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
61
- case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
62
- case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals };
63
- default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
66
+ notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
67
+ case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
68
+ case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
69
+ default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
64
70
  }
65
71
  }
@@ -1,5 +1,4 @@
1
1
  import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
2
- import { IDataset } from "../../qrvey/interfaces/IDataset";
3
2
  import { IColumnPropertyType } from "./IColumnPropertyType";
4
3
  import { IColumnSortingSettings } from "./IColumnSortingSettings";
5
4
  import { IBColumn } from "./IBColumn";
@@ -11,7 +10,6 @@ export interface IColumn extends Omit<IBColumn, "text" | "bucketId" | "formulaId
11
10
  bucketid?: string;
12
11
  aggregate?: IAggregateType;
13
12
  calculation?: IColumnCalculationType;
14
- dataset?: IDataset;
15
13
  formulaid?: string;
16
14
  label?: string;
17
15
  linkid?: string;
@@ -40,7 +40,7 @@ function FD21ToFlatUI(scopes = [], datasetsInfo = []) {
40
40
  const datasetInfo = datasetsInfo.find(dInfo => dInfo.qrveyid === dataset.qrveyid && dInfo.linkid === dataset.linkid);
41
41
  let columnInfo;
42
42
  if (!isEmpty(datasetInfo))
43
- columnInfo = datasetInfo.options.find(cInfo => { var _a, _b; return cInfo.id === filter.column.id && ((_a = cInfo.dataset) === null || _a === void 0 ? void 0 : _a.qrveyid) === filter.column.qrveyid && ((_b = cInfo.dataset) === null || _b === void 0 ? void 0 : _b.linkid) === filter.column.linkid; });
43
+ columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
44
44
  const info = !isEmpty(filter.extras.info) ? { icon: filter.extras.info.icon, label: filter.extras.info.label } : undefined;
45
45
  const property = adaptDateGroupingProperty(filter.property);
46
46
  const uFilter = {
@@ -44,7 +44,6 @@ function FD21ToUI(scopes = [], section = FILTER_SECTION.ANYWHERE, enabled = true
44
44
  ufData.scopes = scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(dataset => {
45
45
  const datasetInfo = datasetsInfo.find(dInfo => dInfo.qrveyid === dataset.qrveyid && dInfo.linkid === dataset.linkid);
46
46
  return Object.assign(Object.assign({}, dataset), { label: datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.label, filters: dataset.filters.map(filter => {
47
- var _a;
48
47
  let columnInfo;
49
48
  if (!isEmpty(datasetInfo))
50
49
  columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
@@ -56,7 +55,7 @@ function FD21ToUI(scopes = [], section = FILTER_SECTION.ANYWHERE, enabled = true
56
55
  id: filter.column.id,
57
56
  label: columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.label,
58
57
  linked: columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.linked,
59
- linkid: ((_a = columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.dataset) === null || _a === void 0 ? void 0 : _a.linkid) || (datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.linkid),
58
+ linkid: (columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.linkid) || (datasetInfo === null || datasetInfo === void 0 ? void 0 : datasetInfo.linkid),
60
59
  outputFormat: _get(datasetInfo, 'outputFormat'),
61
60
  qrveyid: filter.column.qrveyid,
62
61
  type: (columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.type) || filter.column.type,
@@ -52,7 +52,7 @@ function buildFilterByExpression(expression, scopeItem, uFilters) {
52
52
  }
53
53
  }
54
54
  function getFilterByExpression(expression, scopeItem) {
55
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
56
56
  const uiExtras = expression.uiExtras;
57
57
  const scopeid = scopeItem.scope !== FILTER_SCOPE.GLOBAL ? _get(scopeItem, 'uiExtras.scopeid') : undefined;
58
58
  const info = !isEmpty(uiExtras.info) ? { icon: uiExtras.info.icon, label: uiExtras.info.label } : undefined;
@@ -88,8 +88,8 @@ function getFilterByExpression(expression, scopeItem) {
88
88
  enabled: true,
89
89
  displayed: true,
90
90
  qrveyid: (_r = uiExtras.column) === null || _r === void 0 ? void 0 : _r.qrveyid,
91
- label: _get((_s = uiExtras.column) === null || _s === void 0 ? void 0 : _s.dataset, 'name') || ((_u = (_t = uiExtras.column) === null || _t === void 0 ? void 0 : _t.dataset) === null || _u === void 0 ? void 0 : _u.label),
92
- linkid: (_v = uiExtras.column) === null || _v === void 0 ? void 0 : _v.linkid,
91
+ label: _get(uiExtras.column, 'dataset.name') || ((_s = uiExtras.column) === null || _s === void 0 ? void 0 : _s.label),
92
+ linkid: (_t = uiExtras.column) === null || _t === void 0 ? void 0 : _t.linkid,
93
93
  } }),
94
94
  filterid: undefined,
95
95
  lookupDisplayIndex: uiExtras.lookupDisplayIndex,
@@ -16,7 +16,7 @@ export function getUpdatedUIFilters(data, datasets = []) {
16
16
  dataset.filters = dataset.filters.map(filter => {
17
17
  let columnInfo;
18
18
  if (!isEmpty(datasetInfo))
19
- columnInfo = datasetInfo.options.find(cInfo => { var _a, _b; return cInfo.id === filter.column.id && ((_a = cInfo.dataset) === null || _a === void 0 ? void 0 : _a.qrveyid) === filter.column.qrveyid && ((_b = cInfo.dataset) === null || _b === void 0 ? void 0 : _b.linkid) === filter.column.linkid; });
19
+ columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
20
20
  if (!isEmpty(columnInfo)) {
21
21
  filter.column.formulaType = columnInfo.formulaType;
22
22
  filter.column.label = columnInfo.label;
@@ -1,4 +1,5 @@
1
1
  import { IColumn } from "../../columns/interfaces/IColumn";
2
+ import { IDataset } from "../../qrvey/interfaces/IDataset";
2
3
  import { IFSFilterExtrasInfo } from "./common/IFSFilterExtrasInfo";
3
4
  import { IFDateSection } from "./IFDateSection";
4
5
  import { IFOperator } from "./IFOperator";
@@ -10,7 +11,9 @@ import { IFValue } from "./IFValue";
10
11
  import { IFUChartSettings } from "./ui/IFUChartSettings";
11
12
  import { IFUValue } from "./ui/IFUValue";
12
13
  export interface OLD_IFilterDetail {
13
- column?: IColumn;
14
+ column?: IColumn & {
15
+ dataset: IDataset;
16
+ };
14
17
  dateSection?: IFDateSection;
15
18
  enabled?: boolean;
16
19
  lookupDisplayIndex?: number;
@@ -47,13 +47,19 @@ function getLocaleOptions(outputFormat) {
47
47
  const { format, decimals, currency } = outputFormat;
48
48
  switch (format) {
49
49
  case "Currency" /* CURRENCY */: {
50
- const iso = isEmpty(currency) ? CURRENCY_DEFAULT : currencyISO.find(item => (item.text === currency.text) || item.text.includes(currency.label));
51
- return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0, currencyDisplay: 'narrowSymbol' };
50
+ let iso = isEmpty(currency) ? CURRENCY_DEFAULT : currencyISO.find(item => item.text === currency.text);
51
+ if (isEmpty(iso)) {
52
+ iso = currencyISO.find(item => {
53
+ const symbol = item.text.split(' ')[0];
54
+ return symbol === currency.label;
55
+ });
56
+ }
57
+ return { style: "currency" /* CURRENCY */, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: decimals, currencyDisplay: 'narrowSymbol' };
52
58
  }
53
59
  case "Scientific" /* SCIENTIFIC */: return { style: "decimal" /* DECIMAL */,
54
- notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals };
55
- case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals };
56
- case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals };
57
- default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals };
60
+ notation: "scientific" /* SCIENTIFIC */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
61
+ case "Percentage" /* PERCENTAGE */: return { style: "percent" /* PERCENT */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
62
+ case "Abbreviated" /* ABBREVIATED */: return { notation: "compact" /* COMPACT */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
63
+ default: return { style: "decimal" /* DECIMAL */, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
58
64
  }
59
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.2.9-22",
3
+ "version": "1.2.9-23",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",
@@ -1,5 +1,4 @@
1
1
  import { IColumnCalculationType } from "../../qrvey/interfaces/ICalculationType";
2
- import { IDataset } from "../../qrvey/interfaces/IDataset";
3
2
  import { IColumnPropertyType } from "./IColumnPropertyType";
4
3
  import { IColumnSortingSettings } from "./IColumnSortingSettings";
5
4
  import { IBColumn } from "./IBColumn";
@@ -12,7 +11,6 @@ export interface IColumn extends Omit<IBColumn, "text" | "bucketId" | "formulaId
12
11
  bucketid?: string;
13
12
  aggregate?: IAggregateType;
14
13
  calculation?: IColumnCalculationType;
15
- dataset?: IDataset;
16
14
  formulaid?: string;
17
15
  label?: string;
18
16
  linkid?: string;
@@ -47,7 +47,7 @@ function FD21ToFlatUI(scopes: IFSScope[] = [], datasetsInfo: IDataset[] = []): I
47
47
  dataset.filters.forEach(filter => {
48
48
  const datasetInfo: IDataset = datasetsInfo.find(dInfo => dInfo.qrveyid === dataset.qrveyid && dInfo.linkid === dataset.linkid);
49
49
  let columnInfo: IColumn;
50
- if (!isEmpty(datasetInfo)) columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.dataset?.qrveyid === filter.column.qrveyid && cInfo.dataset?.linkid === filter.column.linkid);
50
+ if (!isEmpty(datasetInfo)) columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
51
51
  const info = !isEmpty(filter.extras.info) ? { icon: filter.extras.info.icon, label: filter.extras.info.label } : undefined;
52
52
  const property = adaptDateGroupingProperty(filter.property);
53
53
 
@@ -71,7 +71,7 @@ export function FDToUI(filterData: IFSData, datasetsInfo: IDataset[] = []): IFUD
71
71
  id: filter.column.id,
72
72
  label: columnInfo?.label,
73
73
  linked: columnInfo?.linked,
74
- linkid: columnInfo?.dataset?.linkid || datasetInfo?.linkid,
74
+ linkid: columnInfo?.linkid || datasetInfo?.linkid,
75
75
  outputFormat: _get(datasetInfo, 'outputFormat'),
76
76
  qrveyid: filter.column.qrveyid,
77
77
  type: columnInfo?.type || filter.column.type,
@@ -103,7 +103,7 @@ function getFilterByExpression(expression: OLD_IFilterExpression, scopeItem: OLD
103
103
  enabled: true,
104
104
  displayed: true,
105
105
  qrveyid: uiExtras.column?.qrveyid,
106
- label: _get( uiExtras.column?.dataset, 'name') || uiExtras.column?.dataset?.label,
106
+ label: _get(uiExtras.column, 'dataset.name') || uiExtras.column?.label,
107
107
  linkid: uiExtras.column?.linkid,
108
108
  },
109
109
  },
@@ -18,7 +18,7 @@ export function getUpdatedUIFilters(data: IFUData, datasets: IDataset[] = []): I
18
18
  if (!isEmpty(datasetInfo)) dataset.label = datasetInfo.label;
19
19
  dataset.filters = dataset.filters.map(filter => {
20
20
  let columnInfo: IColumn;
21
- if (!isEmpty(datasetInfo)) columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.dataset?.qrveyid === filter.column.qrveyid && cInfo.dataset?.linkid === filter.column.linkid);
21
+ if (!isEmpty(datasetInfo)) columnInfo = datasetInfo.options.find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid && cInfo.linkid === filter.column.linkid);
22
22
  if (!isEmpty(columnInfo)) {
23
23
  filter.column.formulaType = columnInfo.formulaType;
24
24
  filter.column.label = columnInfo.label;
@@ -1,4 +1,5 @@
1
1
  import { IColumn } from "../../columns/interfaces/IColumn";
2
+ import { IDataset } from "../../qrvey/interfaces/IDataset";
2
3
  import { IFSFilterExtrasInfo } from "./common/IFSFilterExtrasInfo";
3
4
  import { IFDateSection } from "./IFDateSection";
4
5
  import { IFOperator } from "./IFOperator";
@@ -11,7 +12,7 @@ import { IFUChartSettings } from "./ui/IFUChartSettings";
11
12
  import { IFUValue } from "./ui/IFUValue";
12
13
 
13
14
  export interface OLD_IFilterDetail {
14
- column?: IColumn;
15
+ column?: IColumn & { dataset: IDataset };
15
16
  dateSection?: IFDateSection;
16
17
  enabled?: boolean;
17
18
  lookupDisplayIndex?: number;
@@ -50,13 +50,19 @@ function getLocaleOptions(outputFormat: IFormatOutputFormat) {
50
50
  const { format, decimals, currency } = outputFormat;
51
51
  switch(format) {
52
52
  case LOCALE_FORMATS.CURRENCY: {
53
- const iso = isEmpty(currency) ? CURRENCY_DEFAULT : currencyISO.find(item => (item.text === currency.text) || item.text.includes(currency.label));
54
- return { style: LOCALE_STYLES.CURRENCY, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: 0, currencyDisplay: 'narrowSymbol' };
53
+ let iso = isEmpty(currency) ? CURRENCY_DEFAULT : currencyISO.find(item => item.text === currency.text);
54
+ if(isEmpty(iso)) {
55
+ iso = currencyISO.find(item => {
56
+ const symbol = item.text.split(' ')[0];
57
+ return symbol === currency.label;
58
+ });
59
+ }
60
+ return { style: LOCALE_STYLES.CURRENCY, currency: iso.label, maximumFractionDigits: decimals, minimumFractionDigits: decimals, currencyDisplay: 'narrowSymbol' };
55
61
  }
56
62
  case LOCALE_FORMATS.SCIENTIFIC: return { style: LOCALE_STYLES.DECIMAL,
57
- notation: LOCALE_STYLES.SCIENTIFIC, maximumFractionDigits: decimals };
58
- case LOCALE_FORMATS.PERCENTAGE: return { style: LOCALE_STYLES.PERCENT, maximumFractionDigits: decimals };
59
- case LOCALE_FORMATS.ABBREVIATED: return { notation: LOCALE_STYLES.COMPACT, maximumFractionDigits: decimals };
60
- default: return { style: LOCALE_STYLES.DECIMAL, maximumFractionDigits: decimals };
63
+ notation: LOCALE_STYLES.SCIENTIFIC, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
64
+ case LOCALE_FORMATS.PERCENTAGE: return { style: LOCALE_STYLES.PERCENT, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
65
+ case LOCALE_FORMATS.ABBREVIATED: return { notation: LOCALE_STYLES.COMPACT, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
66
+ default: return { style: LOCALE_STYLES.DECIMAL, maximumFractionDigits: decimals, minimumFractionDigits: decimals };
61
67
  }
62
68
  }