@spw-ds/spw-angular-library 1.3.5 → 1.4.1
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 +7 -0
- package/package.json +7 -15
- package/src/lib/spw-design-system-directives.module.ts +8 -0
- package/src/lib/spw-design-system.module.ts +16 -0
- package/src/lib/stencil-generated/angular-component-lib/utils.ts +65 -0
- package/src/lib/stencil-generated/components.ts +2297 -0
- package/src/lib/stencil-generated/index.ts +101 -0
- package/src/public-api.ts +3 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
- package/fesm2022/spw-ds-spw-angular-library.mjs +0 -2448
- package/fesm2022/spw-ds-spw-angular-library.mjs.map +0 -1
- package/types/spw-ds-spw-angular-library.d.ts +0 -972
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spw-ds/spw-angular-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Design System du SPW. Librairie Angular.",
|
|
5
5
|
"readme": "../../../../README.md",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@angular/common": ">=18.0.0",
|
|
8
8
|
"@angular/core": ">=18.0.0",
|
|
9
9
|
"@angular/forms": ">=18.0.0",
|
|
10
|
-
"@spw-ds/spw-stencil-library": "1.
|
|
10
|
+
"@spw-ds/spw-stencil-library": "1.4.1"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -16,16 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"tslib": "^2.7.0"
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"default": "./package.json"
|
|
25
|
-
},
|
|
26
|
-
".": {
|
|
27
|
-
"types": "./types/spw-ds-spw-angular-library.d.ts",
|
|
28
|
-
"default": "./fesm2022/spw-ds-spw-angular-library.mjs"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
|
2
|
+
import { defineCustomElements } from '@spw-ds/spw-stencil-library/loader';
|
|
3
|
+
import { SpwDesignSystemDirectivesModule } from './spw-design-system-directives.module';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [SpwDesignSystemDirectivesModule],
|
|
7
|
+
exports: [SpwDesignSystemDirectivesModule],
|
|
8
|
+
providers: [
|
|
9
|
+
{
|
|
10
|
+
provide: APP_INITIALIZER,
|
|
11
|
+
useFactory: () => defineCustomElements,
|
|
12
|
+
multi: true,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
})
|
|
16
|
+
export class SpwDesignSystemModule {}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
* In the event that proxyInputs is called
|
|
17
|
+
* multiple times re-defining these inputs
|
|
18
|
+
* will cause an error to be thrown. As a result
|
|
19
|
+
* we set configurable: true to indicate these
|
|
20
|
+
* properties can be changed.
|
|
21
|
+
*/
|
|
22
|
+
configurable: true,
|
|
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(() => this.el[methodName].apply(this.el, args));
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
|
38
|
+
events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const defineCustomElement = (tagName: string, customElement: any) => {
|
|
42
|
+
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
|
|
43
|
+
customElements.define(tagName, customElement);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// tslint:disable-next-line: only-arrow-functions
|
|
48
|
+
export function ProxyCmp(opts: { defineCustomElementFn?: () => void; inputs?: any; methods?: any }) {
|
|
49
|
+
const decorator = function (cls: any) {
|
|
50
|
+
const { defineCustomElementFn, inputs, methods } = opts;
|
|
51
|
+
|
|
52
|
+
if (defineCustomElementFn !== undefined) {
|
|
53
|
+
defineCustomElementFn();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (inputs) {
|
|
57
|
+
proxyInputs(cls, inputs);
|
|
58
|
+
}
|
|
59
|
+
if (methods) {
|
|
60
|
+
proxyMethods(cls, methods);
|
|
61
|
+
}
|
|
62
|
+
return cls;
|
|
63
|
+
};
|
|
64
|
+
return decorator;
|
|
65
|
+
}
|