@beeq/angular 1.8.0 → 1.8.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.
Files changed (78) hide show
  1. package/beeq.module.d.ts +15 -0
  2. package/directives/angular-component-lib/utils.d.ts +9 -0
  3. package/directives/boolean-value-accessor.d.ts +9 -0
  4. package/directives/components.d.ts +2042 -0
  5. package/directives/index.d.ts +2 -0
  6. package/directives/number-value-accessor.d.ts +9 -0
  7. package/directives/radio-value-accessor.d.ts +8 -0
  8. package/directives/select-value-accessor.d.ts +8 -0
  9. package/directives/text-value-accessor.d.ts +8 -0
  10. package/directives/value-accessor.d.ts +18 -0
  11. package/esm2022/beeq-angular.mjs +5 -0
  12. package/esm2022/beeq.module.mjs +59 -0
  13. package/esm2022/directives/angular-component-lib/utils.mjs +59 -0
  14. package/esm2022/directives/boolean-value-accessor.mjs +38 -0
  15. package/esm2022/directives/components.mjs +2705 -0
  16. package/esm2022/directives/index.mjs +46 -0
  17. package/esm2022/directives/number-value-accessor.mjs +40 -0
  18. package/esm2022/directives/radio-value-accessor.mjs +35 -0
  19. package/esm2022/directives/select-value-accessor.mjs +35 -0
  20. package/esm2022/directives/text-value-accessor.mjs +35 -0
  21. package/esm2022/directives/value-accessor.mjs +40 -0
  22. package/esm2022/index.mjs +14 -0
  23. package/esm2022/standalone/beeq-angular-standalone.mjs +5 -0
  24. package/esm2022/standalone/directives/angular-component-lib/utils.mjs +59 -0
  25. package/esm2022/standalone/directives/boolean-value-accessor.mjs +38 -0
  26. package/esm2022/standalone/directives/components.mjs +1264 -0
  27. package/esm2022/standalone/directives/number-value-accessor.mjs +40 -0
  28. package/esm2022/standalone/directives/radio-value-accessor.mjs +35 -0
  29. package/esm2022/standalone/directives/select-value-accessor.mjs +35 -0
  30. package/esm2022/standalone/directives/text-value-accessor.mjs +35 -0
  31. package/esm2022/standalone/directives/value-accessor.mjs +40 -0
  32. package/esm2022/standalone/index.mjs +10 -0
  33. package/fesm2022/beeq-angular-standalone.mjs +1491 -0
  34. package/fesm2022/beeq-angular-standalone.mjs.map +1 -0
  35. package/fesm2022/beeq-angular.mjs +3027 -0
  36. package/fesm2022/beeq-angular.mjs.map +1 -0
  37. package/{standalone/src/index.ts → index.d.ts} +1 -4
  38. package/package.json +24 -5
  39. package/standalone/directives/angular-component-lib/utils.d.ts +9 -0
  40. package/standalone/directives/boolean-value-accessor.d.ts +9 -0
  41. package/standalone/directives/components.d.ts +776 -0
  42. package/standalone/directives/number-value-accessor.d.ts +9 -0
  43. package/standalone/directives/radio-value-accessor.d.ts +8 -0
  44. package/standalone/directives/select-value-accessor.d.ts +8 -0
  45. package/standalone/directives/text-value-accessor.d.ts +8 -0
  46. package/standalone/directives/value-accessor.d.ts +18 -0
  47. package/standalone/index.d.ts +6 -0
  48. package/eslint.config.js +0 -45
  49. package/jest.config.ts +0 -21
  50. package/ng-package.json +0 -8
  51. package/project.json +0 -41
  52. package/scripts/fix-value-accessor-path.ts +0 -94
  53. package/src/beeq.module.ts +0 -41
  54. package/src/directives/angular-component-lib/utils.ts +0 -65
  55. package/src/directives/boolean-value-accessor.ts +0 -27
  56. package/src/directives/components.ts +0 -2621
  57. package/src/directives/index.ts +0 -47
  58. package/src/directives/number-value-accessor.ts +0 -29
  59. package/src/directives/radio-value-accessor.ts +0 -24
  60. package/src/directives/select-value-accessor.ts +0 -24
  61. package/src/directives/text-value-accessor.ts +0 -24
  62. package/src/directives/value-accessor.ts +0 -39
  63. package/src/index.ts +0 -15
  64. package/src/test-setup.ts +0 -1
  65. package/standalone/ng-package.json +0 -5
  66. package/standalone/src/directives/angular-component-lib/utils.ts +0 -65
  67. package/standalone/src/directives/boolean-value-accessor.ts +0 -27
  68. package/standalone/src/directives/components.ts +0 -1479
  69. package/standalone/src/directives/index.ts +0 -47
  70. package/standalone/src/directives/number-value-accessor.ts +0 -29
  71. package/standalone/src/directives/radio-value-accessor.ts +0 -24
  72. package/standalone/src/directives/select-value-accessor.ts +0 -24
  73. package/standalone/src/directives/text-value-accessor.ts +0 -24
  74. package/standalone/src/directives/value-accessor.ts +0 -39
  75. package/tsconfig.json +0 -19
  76. package/tsconfig.lib.json +0 -12
  77. package/tsconfig.lib.prod.json +0 -18
  78. package/tsconfig.spec.json +0 -10
@@ -0,0 +1,9 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { ValueAccessor } from './value-accessor';
3
+ import * as i0 from "@angular/core";
4
+ export declare class NumericValueAccessor extends ValueAccessor {
5
+ constructor(el: ElementRef);
6
+ registerOnChange(fn: (_: number | null) => void): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<NumericValueAccessor, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NumericValueAccessor, "bq-input[type=\"number\"], bq-slider:not[type=\"range\"]", never, {}, {}, never, never, true, never>;
9
+ }
@@ -0,0 +1,8 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { ValueAccessor } from './value-accessor';
3
+ import * as i0 from "@angular/core";
4
+ export declare class RadioValueAccessor extends ValueAccessor {
5
+ constructor(el: ElementRef);
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<RadioValueAccessor, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RadioValueAccessor, "bq-radio-group", never, {}, {}, never, never, true, never>;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { ValueAccessor } from './value-accessor';
3
+ import * as i0 from "@angular/core";
4
+ export declare class SelectValueAccessor extends ValueAccessor {
5
+ constructor(el: ElementRef);
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<SelectValueAccessor, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SelectValueAccessor, "bq-select", never, {}, {}, never, never, true, never>;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { ValueAccessor } from './value-accessor';
3
+ import * as i0 from "@angular/core";
4
+ export declare class TextValueAccessor extends ValueAccessor {
5
+ constructor(el: ElementRef);
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<TextValueAccessor, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TextValueAccessor, "bq-date-picker, bq-input:not[type=\"number\"], bq-slider[type=\"range\", bq-textarea", never, {}, {}, never, never, true, never>;
8
+ }
@@ -0,0 +1,18 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ValueAccessor implements ControlValueAccessor {
5
+ protected el: ElementRef;
6
+ private onChange;
7
+ private onTouched;
8
+ protected lastValue: any;
9
+ constructor(el: ElementRef);
10
+ writeValue(value: any): void;
11
+ handleChangeEvent(value: any): void;
12
+ _handleBlurEvent(): void;
13
+ registerOnChange(fn: (value: any) => void): void;
14
+ registerOnTouched(fn: () => void): void;
15
+ setDisabledState(isDisabled: boolean): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<ValueAccessor, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ValueAccessor, never, never, {}, {}, never, never, false, never>;
18
+ }
@@ -0,0 +1,6 @@
1
+ export { BooleanValueAccessor } from './directives/boolean-value-accessor';
2
+ export { NumericValueAccessor } from './directives/number-value-accessor';
3
+ export { RadioValueAccessor } from './directives/radio-value-accessor';
4
+ export { SelectValueAccessor } from './directives/select-value-accessor';
5
+ export { TextValueAccessor } from './directives/text-value-accessor';
6
+ export * from './directives/components';
package/eslint.config.js DELETED
@@ -1,45 +0,0 @@
1
- const { fixupPluginRules } = require('@eslint/compat');
2
- const nxESLint = require('@nx/eslint-plugin');
3
- const angularESLint = require('@angular-eslint/eslint-plugin');
4
- const jsoncParser = require('jsonc-eslint-parser');
5
-
6
- /** @type { import("eslint").Linter.Config[] } */
7
- module.exports = [
8
- {
9
- files: ['*.ts'],
10
- plugins: {
11
- '@angular-eslint': fixupPluginRules(angularESLint),
12
- },
13
- rules: {
14
- '@angular-eslint/component-selector': [
15
- 'error',
16
- {
17
- type: 'element',
18
- prefix: 'bq',
19
- style: 'kebab-case',
20
- },
21
- ],
22
- '@angular-eslint/component-class-suffix': 'off',
23
- '@angular-eslint/directive-class-suffix': 'off',
24
- '@angular-eslint/directive-selector': 'off',
25
- '@angular-eslint/no-host-metadata-property': 'off',
26
- },
27
- },
28
- {
29
- files: ['**/package.json', '**/project.json'],
30
- languageOptions: {
31
- parser: jsoncParser,
32
- },
33
- plugins: {
34
- '@nx': nxESLint,
35
- },
36
- rules: {
37
- '@nx/dependency-checks': [
38
- 'error',
39
- {
40
- ignoredDependencies: ['@beeq/core', '@stencil/core', 'tslib'],
41
- },
42
- ],
43
- },
44
- },
45
- ];
package/jest.config.ts DELETED
@@ -1,21 +0,0 @@
1
- export default {
2
- displayName: 'beeq-angular',
3
- preset: '../../jest.preset.js',
4
- setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
5
- globals: {
6
- 'ts-jest': {
7
- tsconfig: '<rootDir>/tsconfig.spec.json',
8
- stringifyContentPathRegex: '\\.(html|svg)$',
9
- },
10
- },
11
- coverageDirectory: '../../coverage/packages/beeq-angular',
12
- transform: {
13
- '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular',
14
- },
15
- transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
16
- snapshotSerializers: [
17
- 'jest-preset-angular/build/serializers/no-ng-attributes',
18
- 'jest-preset-angular/build/serializers/ng-snapshot',
19
- 'jest-preset-angular/build/serializers/html-comment',
20
- ],
21
- };
package/ng-package.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/beeq-angular",
4
- "lib": {
5
- "entryFile": "src/index.ts"
6
- },
7
- "allowedNonPeerDependencies": ["@beeq/core", "jsonc-parser"]
8
- }
package/project.json DELETED
@@ -1,41 +0,0 @@
1
- {
2
- "name": "beeq-angular",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/beeq-angular/src",
5
- "projectType": "library",
6
- "tags": ["wrapper", "angular", "publishable"],
7
- "prefix": "beeq",
8
- "implicitDependencies": ["beeq"],
9
- "targets": {
10
- "prebuild": {
11
- "executor": "nx:run-commands",
12
- "options": {
13
- "commands": ["tsx packages/beeq-angular/scripts/fix-value-accessor-path.ts"]
14
- },
15
- "dependsOn": [{ "dependencies": true, "target": "build" }]
16
- },
17
- "build": {
18
- "executor": "@nx/angular:package",
19
- "outputs": ["{workspaceRoot}/dist/beeq-angular"],
20
- "options": {
21
- "project": "{projectRoot}/ng-package.json"
22
- },
23
- "configurations": {
24
- "production": {
25
- "tsConfig": "{projectRoot}/tsconfig.lib.prod.json"
26
- },
27
- "development": {
28
- "tsConfig": "{projectRoot}/tsconfig.lib.json"
29
- }
30
- },
31
- "defaultConfiguration": "production",
32
- "dependsOn": [{ "target": "prebuild" }]
33
- },
34
- "lint": {
35
- "executor": "@nx/eslint:lint",
36
- "options": {
37
- "lintFilePatterns": ["{projectRoot}/**/*.ts", "{projectRoot}/package.json", "{projectRoot}/project.json"]
38
- }
39
- }
40
- }
41
- }
@@ -1,94 +0,0 @@
1
- import { resolve } from 'path';
2
- import { promises as fs } from 'fs';
3
-
4
- ['module', 'standalone'].forEach((type) => {
5
- fixValueAccessorPath(type);
6
- });
7
-
8
- /**
9
- * Fix the value accessor path by moving the file to the correct path
10
- *
11
- * @param {string} type - The type of the Angular project (module or standalone)
12
- */
13
- async function fixValueAccessorPath(type: string): Promise<void> {
14
- const angularProjectPath = type === 'module' ? '.' : 'standalone';
15
-
16
- // Define the folders and files paths
17
- const basePath = resolve(__dirname, `../${angularProjectPath}/src/directives`).replace(/\\/g, '/');
18
- const wrongFolderPath = `${basePath}/value-accessor.ts`;
19
- const backupFolderPath = `${basePath}/value-accessor`;
20
- const sourceFilePath = `${basePath}/value-accessor/value-accessor.ts`;
21
- const destinationFilePath = wrongFolderPath;
22
-
23
- // Check if the wrong file exists
24
- if (await isDirectory(wrongFolderPath)) {
25
- console.info(`Renaming wrong Value Accessor file for angular ${type} project...`);
26
- await renameDirectory(wrongFolderPath, backupFolderPath);
27
- } else {
28
- console.info(`No changes required! Wrong folder does not exist for angular ${type} project`);
29
- return;
30
- }
31
-
32
- // Move the file to the correct path
33
- if (await isDirectory(backupFolderPath)) {
34
- console.info(`Moving wrong Value Accessor file for angular ${type} project to the correct path...`);
35
-
36
- try {
37
- await moveFile(sourceFilePath, destinationFilePath);
38
- await removeDirectory(backupFolderPath);
39
- console.info(`File moved successfully for angular ${type} project to the correct path.`);
40
- } catch (err) {
41
- console.error(`Error moving the file for angular ${type} project`, err);
42
- process.exit(1); // Exit the process with a failure code
43
- }
44
- } else {
45
- console.warn(`No changes required! Source folder does not exist for angular ${type} project`);
46
- }
47
- }
48
-
49
- /**
50
- * Check if a path exists and is a directory
51
- *
52
- * @param {string} path - The path to check
53
- * @returns {Promise<boolean>}
54
- */
55
- async function isDirectory(path: string): Promise<boolean> {
56
- try {
57
- const stat = await fs.stat(path);
58
- return stat.isDirectory();
59
- } catch {
60
- return false;
61
- }
62
- }
63
-
64
- /**
65
- * Rename a directory
66
- *
67
- * @param {string} oldPath - The current path of the directory
68
- * @param {string} newPath - The new path of the directory
69
- * @returns {Promise<void>}
70
- */
71
- async function renameDirectory(oldPath: string, newPath: string): Promise<void> {
72
- await fs.rename(oldPath, newPath);
73
- }
74
-
75
- /**
76
- * Move a file
77
- *
78
- * @param {string} source - The source file path
79
- * @param {string} destination - The destination file path
80
- * @returns {Promise<void>}
81
- */
82
- async function moveFile(source: string, destination: string): Promise<void> {
83
- await fs.rename(source, destination);
84
- }
85
-
86
- /**
87
- * Remove a directory
88
- *
89
- * @param {string} path - The path of the directory to remove
90
- * @returns {Promise<void>}
91
- */
92
- async function removeDirectory(path: string): Promise<void> {
93
- await fs.rmdir(path);
94
- }
@@ -1,41 +0,0 @@
1
- import { CommonModule, DOCUMENT } from '@angular/common';
2
- import { APP_INITIALIZER, ModuleWithProviders, NgModule, NgZone } from '@angular/core';
3
- import { defineCustomElements } from '@beeq/core/dist/loader';
4
-
5
- import { DIRECTIVES } from './directives';
6
- import { BooleanValueAccessor } from './directives/boolean-value-accessor';
7
- import { NumericValueAccessor } from './directives/number-value-accessor';
8
- import { RadioValueAccessor } from './directives/radio-value-accessor';
9
- import { SelectValueAccessor } from './directives/select-value-accessor';
10
- import { TextValueAccessor } from './directives/text-value-accessor';
11
-
12
- const DECLARATIONS = [
13
- ...DIRECTIVES,
14
- // ngModel Accessors
15
- BooleanValueAccessor,
16
- NumericValueAccessor,
17
- RadioValueAccessor,
18
- SelectValueAccessor,
19
- TextValueAccessor,
20
- ];
21
-
22
- @NgModule({
23
- imports: [CommonModule],
24
- declarations: DECLARATIONS,
25
- exports: DECLARATIONS,
26
- })
27
- export class BeeQModule {
28
- static forRoot(): ModuleWithProviders<BeeQModule> {
29
- return {
30
- ngModule: BeeQModule,
31
- providers: [
32
- {
33
- provide: APP_INITIALIZER,
34
- useFactory: () => defineCustomElements,
35
- multi: true,
36
- deps: [DOCUMENT, NgZone],
37
- },
38
- ],
39
- };
40
- }
41
- }
@@ -1,65 +0,0 @@
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
- }
@@ -1,27 +0,0 @@
1
- import { Directive, ElementRef } from '@angular/core';
2
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
-
4
- import { ValueAccessor } from './value-accessor';
5
-
6
- @Directive({
7
- /* tslint:disable-next-line:directive-selector */
8
- selector: 'bq-checkbox, bq-switch',
9
- host: {
10
- '(bqChange)': 'handleChangeEvent($event.target.checked)'
11
- },
12
- providers: [
13
- {
14
- provide: NG_VALUE_ACCESSOR,
15
- useExisting: BooleanValueAccessor,
16
- multi: true
17
- }
18
- ]
19
- })
20
- export class BooleanValueAccessor extends ValueAccessor {
21
- constructor(el: ElementRef) {
22
- super(el);
23
- }
24
- override writeValue(value: any) {
25
- this.el.nativeElement.checked = this.lastValue = value == null ? false : value;
26
- }
27
- }