@siemens/ix-angular 1.0.0-beta.2
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/ng-package.json +9 -0
- package/package.json +27 -0
- package/src/angular-component-lib/utils.ts +63 -0
- package/src/app-initialize.ts +29 -0
- package/src/components.ts +1631 -0
- package/src/declare-components.ts +68 -0
- package/src/index.ts +16 -0
- package/src/modal/index.ts +10 -0
- package/src/modal/modal.config.ts +14 -0
- package/src/modal/modal.service.ts +64 -0
- package/src/module.ts +44 -0
- package/src/toast/index.ts +10 -0
- package/src/toast/toast.config.ts +15 -0
- package/src/toast/toast.service.ts +51 -0
- package/src/tree/index.ts +10 -0
- package/src/tree/tree.ts +124 -0
- package/tsconfig.json +43 -0
package/ng-package.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siemens/ix-angular",
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "Siemens iX for Angular",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "ng-packagr -c tsconfig.json",
|
|
7
|
+
"fix-packagejson": ""
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@siemens/ix": "~1.0.0-beta.2",
|
|
12
|
+
"@siemens/ix-icons": "~1.0.0-beta.3"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@angular/core": ">10.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@angular/common": "^14.2.0",
|
|
19
|
+
"@angular/compiler": "^14.2.0",
|
|
20
|
+
"@angular/compiler-cli": "^14.2.0",
|
|
21
|
+
"@angular/core": "^14.2.0",
|
|
22
|
+
"@siemens/ix": "~1.0.0-beta.2",
|
|
23
|
+
"fs-extra": "^10.1.0",
|
|
24
|
+
"ng-packagr": "^14.2.0",
|
|
25
|
+
"typescript": "4.7.2"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
this.z.runOutsideAngular(() => (this.el[item] = val));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const proxyMethods = (Cmp: any, methods: string[]) => {
|
|
20
|
+
const Prototype = Cmp.prototype;
|
|
21
|
+
methods.forEach(methodName => {
|
|
22
|
+
Prototype[methodName] = function () {
|
|
23
|
+
const args = arguments;
|
|
24
|
+
return this.z.runOutsideAngular(() =>
|
|
25
|
+
this.el[methodName].apply(this.el, args)
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
|
32
|
+
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const defineCustomElement = (tagName: string, customElement: any) => {
|
|
36
|
+
if (
|
|
37
|
+
customElement !== undefined &&
|
|
38
|
+
typeof customElements !== 'undefined' &&
|
|
39
|
+
!customElements.get(tagName)
|
|
40
|
+
) {
|
|
41
|
+
customElements.define(tagName, customElement);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// tslint:disable-next-line: only-arrow-functions
|
|
46
|
+
export function ProxyCmp(opts: { defineCustomElementFn?: () => void, inputs?: any; methods?: any }) {
|
|
47
|
+
const decorator = function (cls: any) {
|
|
48
|
+
const { defineCustomElementFn, inputs, methods } = opts;
|
|
49
|
+
|
|
50
|
+
if (defineCustomElementFn !== undefined) {
|
|
51
|
+
defineCustomElementFn();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (inputs) {
|
|
55
|
+
proxyInputs(cls, inputs);
|
|
56
|
+
}
|
|
57
|
+
if (methods) {
|
|
58
|
+
proxyMethods(cls, methods);
|
|
59
|
+
}
|
|
60
|
+
return cls;
|
|
61
|
+
};
|
|
62
|
+
return decorator;
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2022 Siemens AG
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { applyPolyfills, defineCustomElements } from '@siemens/ix/loader';
|
|
11
|
+
|
|
12
|
+
let didInitialize = false;
|
|
13
|
+
|
|
14
|
+
export const appInitialize = (doc: Document) => {
|
|
15
|
+
return () => {
|
|
16
|
+
const win: Window | undefined = doc.defaultView as any;
|
|
17
|
+
if (win && typeof (window as any) !== 'undefined') {
|
|
18
|
+
if (didInitialize) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
didInitialize = true;
|
|
23
|
+
|
|
24
|
+
applyPolyfills().then(() => {
|
|
25
|
+
return defineCustomElements();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|