@heartlandone/vega-angular 2.5.0 → 2.6.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.
@@ -259,7 +259,7 @@ export declare class VegaCheckboxGroup {
259
259
  protected el: HTMLElement;
260
260
  constructor(c: ChangeDetectorRef, r: ElementRef, z: NgZone);
261
261
  static ɵfac: i0.ɵɵFactoryDeclaration<VegaCheckboxGroup, never>;
262
- static ɵcmp: i0.ɵɵComponentDeclaration<VegaCheckboxGroup, "vega-checkbox-group", never, { "disabled": "disabled"; "hint": "hint"; "isValid": "isValid"; "label": "label"; "required": "required"; "value": "value"; "vegaFlexProp": "vegaFlexProp"; }, {}, never, ["*"]>;
262
+ static ɵcmp: i0.ɵɵComponentDeclaration<VegaCheckboxGroup, "vega-checkbox-group", never, { "autoValidation": "autoValidation"; "disabled": "disabled"; "hint": "hint"; "isValid": "isValid"; "label": "label"; "required": "required"; "validationRules": "validationRules"; "value": "value"; "vegaFlexProp": "vegaFlexProp"; }, {}, never, ["*"]>;
263
263
  }
264
264
  export declare interface VegaChip extends Components.VegaChip {
265
265
  /**
@@ -535,7 +535,7 @@ export declare class VegaFlex {
535
535
  protected el: HTMLElement;
536
536
  constructor(c: ChangeDetectorRef, r: ElementRef, z: NgZone);
537
537
  static ɵfac: i0.ɵɵFactoryDeclaration<VegaFlex, never>;
538
- static ɵcmp: i0.ɵɵComponentDeclaration<VegaFlex, "vega-flex", never, { "alignItems": "alignItems"; "breakpoint": "breakpoint"; "direction": "direction"; "gap": "gap"; "justifyContent": "justifyContent"; "margin": "margin"; "useNativeFlex": "useNativeFlex"; }, {}, never, ["*"]>;
538
+ static ɵcmp: i0.ɵɵComponentDeclaration<VegaFlex, "vega-flex", never, { "alignItems": "alignItems"; "breakpoint": "breakpoint"; "direction": "direction"; "flexWrap": "flexWrap"; "gap": "gap"; "justifyContent": "justifyContent"; "margin": "margin"; "useNativeFlex": "useNativeFlex"; }, {}, never, ["*"]>;
539
539
  }
540
540
  export declare interface VegaFont extends Components.VegaFont {
541
541
  }
@@ -1033,7 +1033,7 @@ export declare class VegaRadioGroup {
1033
1033
  protected el: HTMLElement;
1034
1034
  constructor(c: ChangeDetectorRef, r: ElementRef, z: NgZone);
1035
1035
  static ɵfac: i0.ɵɵFactoryDeclaration<VegaRadioGroup, never>;
1036
- static ɵcmp: i0.ɵɵComponentDeclaration<VegaRadioGroup, "vega-radio-group", never, { "disabled": "disabled"; "hint": "hint"; "isValid": "isValid"; "label": "label"; "name": "name"; "required": "required"; "value": "value"; "vegaFlexProp": "vegaFlexProp"; }, {}, never, ["*"]>;
1036
+ static ɵcmp: i0.ɵɵComponentDeclaration<VegaRadioGroup, "vega-radio-group", never, { "autoValidation": "autoValidation"; "disabled": "disabled"; "hint": "hint"; "isValid": "isValid"; "label": "label"; "name": "name"; "required": "required"; "validationRules": "validationRules"; "value": "value"; "vegaFlexProp": "vegaFlexProp"; }, {}, never, ["*"]>;
1037
1037
  }
1038
1038
  export declare interface VegaSectionTitle extends Components.VegaSectionTitle {
1039
1039
  }
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@heartlandone/vega-angular",
3
3
  "sideEffects": false,
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "Angular specific wrapper for @heartlandone/vega",
6
6
  "peerDependencies": {
7
7
  "@angular/common": ">=12.0.0",
@@ -18,7 +18,7 @@
18
18
  "url": "https://github.com/heartlandpayments/Vega/tree/main/vega-angular-workspace/projects/vega-angular"
19
19
  },
20
20
  "dependencies": {
21
- "@heartlandone/vega": "2.4.0",
21
+ "@heartlandone/vega": "2.5.0",
22
22
  "tslib": "^2.3.0",
23
23
  "@juggle/resize-observer": "^3.4.0"
24
24
  },
@@ -36,6 +36,14 @@
36
36
  "es2015": "./fesm2015/heartlandone-vega-angular.mjs",
37
37
  "node": "./fesm2015/heartlandone-vega-angular.mjs",
38
38
  "default": "./fesm2020/heartlandone-vega-angular.mjs"
39
+ },
40
+ "./testing": {
41
+ "types": "./testing/heartlandone-vega-angular-testing.d.ts",
42
+ "esm2020": "./esm2020/testing/heartlandone-vega-angular-testing.mjs",
43
+ "es2020": "./fesm2020/heartlandone-vega-angular-testing.mjs",
44
+ "es2015": "./fesm2015/heartlandone-vega-angular-testing.mjs",
45
+ "node": "./fesm2015/heartlandone-vega-angular-testing.mjs",
46
+ "default": "./fesm2020/heartlandone-vega-angular-testing.mjs"
39
47
  }
40
48
  }
41
49
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@heartlandone/vega-angular/testing" />
5
+ export * from './public-api';
@@ -0,0 +1,7 @@
1
+ import type { RenderResult } from '@testing-library/angular';
2
+ export declare function waitForVegaReady(renderResult: RenderResult<unknown, unknown>, delay?: number): Promise<RenderResult<unknown, unknown>>;
3
+ export declare type MockedResizeObserverController = {
4
+ hide: (selector: string, container?: HTMLElement) => void;
5
+ show: (selector: string, container?: HTMLElement) => void;
6
+ };
7
+ export declare function mockResizeObserver(): MockedResizeObserverController;
@@ -0,0 +1,10 @@
1
+ {
2
+ "module": "../fesm2015/heartlandone-vega-angular-testing.mjs",
3
+ "es2020": "../fesm2020/heartlandone-vega-angular-testing.mjs",
4
+ "esm2020": "../esm2020/testing/heartlandone-vega-angular-testing.mjs",
5
+ "fesm2020": "../fesm2020/heartlandone-vega-angular-testing.mjs",
6
+ "fesm2015": "../fesm2015/heartlandone-vega-angular-testing.mjs",
7
+ "typings": "heartlandone-vega-angular-testing.d.ts",
8
+ "sideEffects": false,
9
+ "name": "@heartlandone/vega-angular/testing"
10
+ }
@@ -0,0 +1 @@
1
+ export * from './index';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@heartlandone/vega-angular",
3
3
  "sideEffects": false,
4
- "version": "2.5.0",
4
+ "version": "2.6.0",
5
5
  "description": "Angular specific wrapper for @heartlandone/vega",
6
6
  "peerDependencies": {
7
7
  "@angular/common": ">=12.0.0",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/heartlandpayments/Vega/tree/main/vega-angular-workspace/projects/vega-angular"
26
26
  },
27
27
  "dependencies": {
28
- "@heartlandone/vega": "2.5.0",
28
+ "@heartlandone/vega": "2.6.0",
29
29
  "tslib": "^2.3.0",
30
30
  "@juggle/resize-observer": "^3.4.0"
31
31
  },
@@ -466,13 +466,13 @@ export declare interface VegaCheckboxGroup extends Components.VegaCheckboxGroup
466
466
 
467
467
  @ProxyCmp({
468
468
  defineCustomElementFn: undefined,
469
- inputs: ['disabled', 'hint', 'isValid', 'label', 'required', 'value', 'vegaFlexProp']
469
+ inputs: ['autoValidation', 'disabled', 'hint', 'isValid', 'label', 'required', 'validationRules', 'value', 'vegaFlexProp']
470
470
  })
471
471
  @Component({
472
472
  selector: 'vega-checkbox-group',
473
473
  changeDetection: ChangeDetectionStrategy.OnPush,
474
474
  template: '<ng-content></ng-content>',
475
- inputs: ['disabled', 'hint', 'isValid', 'label', 'required', 'value', 'vegaFlexProp']
475
+ inputs: ['autoValidation', 'disabled', 'hint', 'isValid', 'label', 'required', 'validationRules', 'value', 'vegaFlexProp']
476
476
  })
477
477
  export class VegaCheckboxGroup {
478
478
  protected el: HTMLElement;
@@ -931,13 +931,13 @@ export declare interface VegaFlex extends Components.VegaFlex {}
931
931
 
932
932
  @ProxyCmp({
933
933
  defineCustomElementFn: undefined,
934
- inputs: ['alignItems', 'breakpoint', 'direction', 'gap', 'justifyContent', 'margin', 'useNativeFlex']
934
+ inputs: ['alignItems', 'breakpoint', 'direction', 'flexWrap', 'gap', 'justifyContent', 'margin', 'useNativeFlex']
935
935
  })
936
936
  @Component({
937
937
  selector: 'vega-flex',
938
938
  changeDetection: ChangeDetectionStrategy.OnPush,
939
939
  template: '<ng-content></ng-content>',
940
- inputs: ['alignItems', 'breakpoint', 'direction', 'gap', 'justifyContent', 'margin', 'useNativeFlex']
940
+ inputs: ['alignItems', 'breakpoint', 'direction', 'flexWrap', 'gap', 'justifyContent', 'margin', 'useNativeFlex']
941
941
  })
942
942
  export class VegaFlex {
943
943
  protected el: HTMLElement;
@@ -1818,13 +1818,13 @@ export declare interface VegaRadioGroup extends Components.VegaRadioGroup {
1818
1818
 
1819
1819
  @ProxyCmp({
1820
1820
  defineCustomElementFn: undefined,
1821
- inputs: ['disabled', 'hint', 'isValid', 'label', 'name', 'required', 'value', 'vegaFlexProp']
1821
+ inputs: ['autoValidation', 'disabled', 'hint', 'isValid', 'label', 'name', 'required', 'validationRules', 'value', 'vegaFlexProp']
1822
1822
  })
1823
1823
  @Component({
1824
1824
  selector: 'vega-radio-group',
1825
1825
  changeDetection: ChangeDetectionStrategy.OnPush,
1826
1826
  template: '<ng-content></ng-content>',
1827
- inputs: ['disabled', 'hint', 'isValid', 'label', 'name', 'required', 'value', 'vegaFlexProp']
1827
+ inputs: ['autoValidation', 'disabled', 'hint', 'isValid', 'label', 'name', 'required', 'validationRules', 'value', 'vegaFlexProp']
1828
1828
  })
1829
1829
  export class VegaRadioGroup {
1830
1830
  protected el: HTMLElement;
@@ -0,0 +1,123 @@
1
+ import { FeatureFlag } from '@heartlandone/vega';
2
+ import { waitFor } from '@testing-library/angular';
3
+ import type { RenderResult } from '@testing-library/angular';
4
+
5
+ type Nullable<T> = T | undefined | null;
6
+
7
+ export async function waitForVegaReady(
8
+ renderResult: RenderResult<unknown, unknown>,
9
+ delay: number = 300,
10
+ ): Promise<RenderResult<unknown, unknown>> {
11
+ await waitFor(() => {
12
+ renderResult.container
13
+ .querySelectorAll('*:not(.hydrated)')
14
+ // eslint-disable-next-line unicorn/no-array-for-each
15
+ .forEach((element: Element) => {
16
+ if (element.tagName.startsWith('VEGA')) {
17
+ throw new Error('Vega component is not rendered yet, retrying...');
18
+ }
19
+ });
20
+ });
21
+ /*
22
+ * The following code is added to load the vega component, and the attribute value is set after each component is loaded.
23
+ * To determine whether there is a hydrated style that cannot meet the requirements after the component is loaded,
24
+ * It need to set the sleep time to ensure that each attribute of the vega component is fully loaded
25
+ *
26
+ code link: ./node_modules/@heartlandone/vega-react/dist/react-component-lib/utils/attachProps.js(line 28-33)}
27
+ */
28
+ await sleep(delay);
29
+ return renderResult;
30
+ }
31
+
32
+ export type MockedResizeObserverController = {
33
+ hide: (selector: string, container?: HTMLElement) => void;
34
+ show: (selector: string, container?: HTMLElement) => void;
35
+ };
36
+
37
+ export function mockResizeObserver(): MockedResizeObserverController {
38
+ type MockedResizeObserver = ResizeObserver & {
39
+ show: () => void;
40
+ hide: () => void;
41
+ };
42
+ FeatureFlag.disable('VEGA_ANGULAR.USE_JUGGLE_RESIZE_OBSERVER');
43
+ const resizeObserverElementMap: Map<HTMLElement, MockedResizeObserver> = new Map();
44
+ const VegaResizeObserver: unknown = class {
45
+ private readonly callback: ResizeObserverCallback;
46
+ private observedElements: HTMLElement[] = [];
47
+ constructor(callback: ResizeObserverCallback) {
48
+ this.callback = callback;
49
+ }
50
+
51
+ observe(element: HTMLElement): void {
52
+ if (!this.isObserved(element)) {
53
+ resizeObserverElementMap.set(element, this);
54
+ this.observedElements.push(element);
55
+ }
56
+ }
57
+
58
+ unobserve(element: HTMLElement): void {
59
+ if (this.isObserved(element)) {
60
+ resizeObserverElementMap.delete(element);
61
+ this.observedElements = this.observedElements.filter(
62
+ (observedElement: HTMLElement) => observedElement !== element,
63
+ );
64
+ }
65
+ }
66
+
67
+ disconnect(): void {
68
+ for (const element of this.observedElements) {
69
+ resizeObserverElementMap.delete(element);
70
+ }
71
+ this.observedElements = [];
72
+ }
73
+
74
+ show(): void {
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ this.callback([{ contentRect: { height: 100 } }] as any, this);
77
+ }
78
+
79
+ hide(): void {
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ this.callback([{ contentRect: { height: 0 } }] as any, this);
82
+ }
83
+
84
+ private isObserved(element: HTMLElement): boolean {
85
+ return this.observedElements.includes(element);
86
+ }
87
+ };
88
+ Object.assign(window, { VegaResizeObserver });
89
+ return {
90
+ show: (selector: string, container?: HTMLElement): void => {
91
+ (container || document)
92
+ .querySelectorAll(selector)
93
+ // eslint-disable-next-line unicorn/no-array-for-each
94
+ .forEach((el: Element) => {
95
+ const resizeObserver: Nullable<MockedResizeObserver> = resizeObserverElementMap.get(
96
+ el as HTMLElement,
97
+ );
98
+ if (resizeObserver) {
99
+ resizeObserver.show();
100
+ }
101
+ });
102
+ },
103
+ hide: (selector: string, container?: HTMLElement): void => {
104
+ (container || document)
105
+ .querySelectorAll(selector)
106
+ // eslint-disable-next-line unicorn/no-array-for-each
107
+ .forEach((el: Element) => {
108
+ const resizeObserver: Nullable<MockedResizeObserver> = resizeObserverElementMap.get(
109
+ el as HTMLElement,
110
+ );
111
+ if (resizeObserver) {
112
+ resizeObserver.hide();
113
+ }
114
+ });
115
+ },
116
+ };
117
+ }
118
+
119
+ function sleep(ms: number): Promise<void> {
120
+ return new Promise((resolve: () => void) => {
121
+ setTimeout(resolve, ms);
122
+ });
123
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "./dist",
4
+ "lib": {
5
+ "entryFile": "./public-api.ts"
6
+ },
7
+ "allowedNonPeerDependencies": ["@testing-library/angular", "@heartlandone/vega"]
8
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ * Public API Surface of vega-angular
3
+ */
4
+ export * from './index';