@heartlandone/vega-angular 1.3.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/.browserslistrc +16 -0
- package/.prettierrc.js +13 -0
- package/LICENSE +21 -0
- package/README.md +132 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +132 -0
- package/dist/esm2020/heartlandone-vega-angular.mjs +5 -0
- package/dist/esm2020/lib/components-module.mjs +24 -0
- package/dist/esm2020/lib/stencil-generated/angular-component-lib/utils.mjs +62 -0
- package/dist/esm2020/lib/stencil-generated/components.mjs +953 -0
- package/dist/esm2020/lib/stencil-generated/text-value-accessor.mjs +35 -0
- package/dist/esm2020/lib/stencil-generated/value-accessor.mjs +44 -0
- package/dist/esm2020/public-api.mjs +8 -0
- package/dist/fesm2015/heartlandone-vega-angular.mjs +1079 -0
- package/dist/fesm2015/heartlandone-vega-angular.mjs.map +1 -0
- package/dist/fesm2020/heartlandone-vega-angular.mjs +1079 -0
- package/dist/fesm2020/heartlandone-vega-angular.mjs.map +1 -0
- package/dist/heartlandone-vega-angular.d.ts +5 -0
- package/dist/lib/components-module.d.ts +10 -0
- package/dist/lib/stencil-generated/angular-component-lib/utils.d.ts +9 -0
- package/dist/lib/stencil-generated/components.d.ts +467 -0
- package/dist/lib/stencil-generated/text-value-accessor.d.ts +8 -0
- package/dist/lib/stencil-generated/value-accessor.d.ts +18 -0
- package/dist/package.json +40 -0
- package/dist/public-api.d.ts +4 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +10 -0
- package/package.json +36 -0
- package/src/lib/components-module.ts +16 -0
- package/src/lib/stencil-generated/angular-component-lib/utils.ts +71 -0
- package/src/lib/stencil-generated/components.ts +1007 -0
- package/src/lib/stencil-generated/text-value-accessor.ts +24 -0
- package/src/lib/stencil-generated/value-accessor.ts +42 -0
- package/src/public-api.ts +7 -0
- package/src/scripts/stencil-post-build-script.js +59 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
import { fromEvent } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
export const proxyInputs = (Cmp: any, inputs: string[]) => {
|
|
6
|
+
const Prototype = Cmp.prototype;
|
|
7
|
+
inputs.forEach(item => {
|
|
8
|
+
Object.defineProperty(Prototype, item, {
|
|
9
|
+
get() {
|
|
10
|
+
return this.el[item];
|
|
11
|
+
},
|
|
12
|
+
set(val: any) {
|
|
13
|
+
// Link issues: https://gethired.atlassian.net/browse/GHUI-331
|
|
14
|
+
// add a beforehand checking to make sure value is only set when component is loaded
|
|
15
|
+
if (this.el.classList.contains('hydrated')) {
|
|
16
|
+
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
17
|
+
} else {
|
|
18
|
+
this.el.componentOnReady().then(() => {
|
|
19
|
+
this.z.runOutsideAngular(() => (this.el[item] = val))
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const proxyMethods = (Cmp: any, methods: string[]) => {
|
|
28
|
+
const Prototype = Cmp.prototype;
|
|
29
|
+
methods.forEach(methodName => {
|
|
30
|
+
Prototype[methodName] = function () {
|
|
31
|
+
const args = arguments;
|
|
32
|
+
return this.z.runOutsideAngular(() =>
|
|
33
|
+
this.el[methodName].apply(this.el, args)
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
|
40
|
+
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const defineCustomElement = (tagName: string, customElement: any) => {
|
|
44
|
+
if (
|
|
45
|
+
customElement !== undefined &&
|
|
46
|
+
typeof customElements !== 'undefined' &&
|
|
47
|
+
!customElements.get(tagName)
|
|
48
|
+
) {
|
|
49
|
+
customElements.define(tagName, customElement);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// tslint:disable-next-line: only-arrow-functions
|
|
54
|
+
export function ProxyCmp(opts: { defineCustomElementFn?: () => void, inputs?: any; methods?: any }) {
|
|
55
|
+
const decorator = function (cls: any) {
|
|
56
|
+
const { defineCustomElementFn, inputs, methods } = opts;
|
|
57
|
+
|
|
58
|
+
if (defineCustomElementFn !== undefined) {
|
|
59
|
+
defineCustomElementFn();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (inputs) {
|
|
63
|
+
proxyInputs(cls, inputs);
|
|
64
|
+
}
|
|
65
|
+
if (methods) {
|
|
66
|
+
proxyMethods(cls, methods);
|
|
67
|
+
}
|
|
68
|
+
return cls;
|
|
69
|
+
};
|
|
70
|
+
return decorator;
|
|
71
|
+
}
|