@beeq/angular 1.8.0-beta.9 → 1.8.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.
Files changed (79) hide show
  1. package/README.md +32 -15
  2. package/eslint.config.js +45 -0
  3. package/jest.config.ts +21 -0
  4. package/ng-package.json +8 -0
  5. package/package.json +20 -39
  6. package/project.json +41 -0
  7. package/scripts/fix-value-accessor-path.ts +94 -0
  8. package/src/beeq.module.ts +41 -0
  9. package/src/directives/angular-component-lib/utils.ts +65 -0
  10. package/src/directives/boolean-value-accessor.ts +27 -0
  11. package/src/directives/components.ts +2621 -0
  12. package/src/directives/index.ts +47 -0
  13. package/src/directives/number-value-accessor.ts +29 -0
  14. package/src/directives/radio-value-accessor.ts +24 -0
  15. package/src/directives/select-value-accessor.ts +24 -0
  16. package/src/directives/text-value-accessor.ts +24 -0
  17. package/src/directives/value-accessor.ts +39 -0
  18. package/src/index.ts +15 -0
  19. package/src/test-setup.ts +1 -0
  20. package/standalone/ng-package.json +5 -0
  21. package/standalone/src/directives/angular-component-lib/utils.ts +65 -0
  22. package/standalone/src/directives/boolean-value-accessor.ts +27 -0
  23. package/standalone/src/directives/components.ts +1479 -0
  24. package/standalone/src/directives/index.ts +47 -0
  25. package/standalone/src/directives/number-value-accessor.ts +29 -0
  26. package/standalone/src/directives/radio-value-accessor.ts +24 -0
  27. package/standalone/src/directives/select-value-accessor.ts +24 -0
  28. package/standalone/src/directives/text-value-accessor.ts +24 -0
  29. package/standalone/src/directives/value-accessor.ts +39 -0
  30. package/{index.d.ts → standalone/src/index.ts} +4 -1
  31. package/tsconfig.json +19 -0
  32. package/tsconfig.lib.json +12 -0
  33. package/tsconfig.lib.prod.json +18 -0
  34. package/tsconfig.spec.json +10 -0
  35. package/beeq.module.d.ts +0 -15
  36. package/directives/angular-component-lib/utils.d.ts +0 -9
  37. package/directives/boolean-value-accessor.d.ts +0 -9
  38. package/directives/components.d.ts +0 -784
  39. package/directives/index.d.ts +0 -2
  40. package/directives/number-value-accessor.d.ts +0 -9
  41. package/directives/radio-value-accessor.d.ts +0 -8
  42. package/directives/select-value-accessor.d.ts +0 -8
  43. package/directives/text-value-accessor.d.ts +0 -8
  44. package/directives/value-accessor.d.ts +0 -18
  45. package/esm2022/beeq-angular.mjs +0 -5
  46. package/esm2022/beeq.module.mjs +0 -59
  47. package/esm2022/directives/angular-component-lib/utils.mjs +0 -59
  48. package/esm2022/directives/boolean-value-accessor.mjs +0 -38
  49. package/esm2022/directives/components.mjs +0 -1221
  50. package/esm2022/directives/index.mjs +0 -46
  51. package/esm2022/directives/number-value-accessor.mjs +0 -40
  52. package/esm2022/directives/radio-value-accessor.mjs +0 -35
  53. package/esm2022/directives/select-value-accessor.mjs +0 -35
  54. package/esm2022/directives/text-value-accessor.mjs +0 -35
  55. package/esm2022/directives/value-accessor.mjs +0 -42
  56. package/esm2022/index.mjs +0 -14
  57. package/esm2022/standalone/beeq-angular-standalone.mjs +0 -5
  58. package/esm2022/standalone/directives/angular-component-lib/utils.mjs +0 -59
  59. package/esm2022/standalone/directives/boolean-value-accessor.mjs +0 -38
  60. package/esm2022/standalone/directives/components.mjs +0 -1349
  61. package/esm2022/standalone/directives/number-value-accessor.mjs +0 -40
  62. package/esm2022/standalone/directives/radio-value-accessor.mjs +0 -35
  63. package/esm2022/standalone/directives/select-value-accessor.mjs +0 -35
  64. package/esm2022/standalone/directives/text-value-accessor.mjs +0 -35
  65. package/esm2022/standalone/directives/value-accessor.mjs +0 -42
  66. package/esm2022/standalone/index.mjs +0 -10
  67. package/fesm2022/beeq-angular-standalone.mjs +0 -1578
  68. package/fesm2022/beeq-angular-standalone.mjs.map +0 -1
  69. package/fesm2022/beeq-angular.mjs +0 -1545
  70. package/fesm2022/beeq-angular.mjs.map +0 -1
  71. package/standalone/directives/angular-component-lib/utils.d.ts +0 -9
  72. package/standalone/directives/boolean-value-accessor.d.ts +0 -9
  73. package/standalone/directives/components.d.ts +0 -784
  74. package/standalone/directives/number-value-accessor.d.ts +0 -9
  75. package/standalone/directives/radio-value-accessor.d.ts +0 -8
  76. package/standalone/directives/select-value-accessor.d.ts +0 -8
  77. package/standalone/directives/text-value-accessor.d.ts +0 -8
  78. package/standalone/directives/value-accessor.d.ts +0 -18
  79. package/standalone/index.d.ts +0 -6
@@ -0,0 +1,47 @@
1
+
2
+ import * as d from './components';
3
+
4
+ export const DIRECTIVES = [
5
+ d.BqAccordion,
6
+ d.BqAccordionGroup,
7
+ d.BqAlert,
8
+ d.BqAvatar,
9
+ d.BqBadge,
10
+ d.BqBreadcrumb,
11
+ d.BqBreadcrumbItem,
12
+ d.BqButton,
13
+ d.BqCard,
14
+ d.BqCheckbox,
15
+ d.BqDatePicker,
16
+ d.BqDialog,
17
+ d.BqDivider,
18
+ d.BqDrawer,
19
+ d.BqDropdown,
20
+ d.BqEmptyState,
21
+ d.BqIcon,
22
+ d.BqInput,
23
+ d.BqNotification,
24
+ d.BqOption,
25
+ d.BqOptionGroup,
26
+ d.BqOptionList,
27
+ d.BqPageTitle,
28
+ d.BqPanel,
29
+ d.BqProgress,
30
+ d.BqRadio,
31
+ d.BqRadioGroup,
32
+ d.BqSelect,
33
+ d.BqSideMenu,
34
+ d.BqSideMenuItem,
35
+ d.BqSlider,
36
+ d.BqSpinner,
37
+ d.BqStatus,
38
+ d.BqStepItem,
39
+ d.BqSteps,
40
+ d.BqSwitch,
41
+ d.BqTab,
42
+ d.BqTabGroup,
43
+ d.BqTag,
44
+ d.BqTextarea,
45
+ d.BqToast,
46
+ d.BqTooltip
47
+ ];
@@ -0,0 +1,29 @@
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-input[type="number"], bq-slider:not[type="range"]',
9
+ host: {
10
+ '(bqChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: NumericValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class NumericValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ override registerOnChange(fn: (_: number | null) => void) {
25
+ super.registerOnChange(value => {
26
+ fn(value === '' ? null : parseFloat(value));
27
+ });
28
+ }
29
+ }
@@ -0,0 +1,24 @@
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-radio-group',
9
+ host: {
10
+ '(bqChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: RadioValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class RadioValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ }
@@ -0,0 +1,24 @@
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-select',
9
+ host: {
10
+ '(bqChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: SelectValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class SelectValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ }
@@ -0,0 +1,24 @@
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-date-picker, bq-input:not[type="number"], bq-slider[type="range", bq-textarea',
9
+ host: {
10
+ '(bqChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: TextValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class TextValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ }
@@ -0,0 +1,39 @@
1
+ import { Directive, ElementRef, HostListener } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+
4
+ @Directive({})
5
+ export class ValueAccessor implements ControlValueAccessor {
6
+
7
+ private onChange: (value: any) => void = () => {/**/};
8
+ private onTouched: () => void = () => {/**/};
9
+ protected lastValue: any;
10
+
11
+ constructor(protected el: ElementRef) {}
12
+
13
+ writeValue(value: any) {
14
+ this.el.nativeElement.value = this.lastValue = value == null ? '' : value;
15
+ }
16
+
17
+ handleChangeEvent(value: any) {
18
+ if (value !== this.lastValue) {
19
+ this.lastValue = value;
20
+ this.onChange(value);
21
+ }
22
+ }
23
+
24
+ @HostListener('focusout')
25
+ _handleBlurEvent() {
26
+ this.onTouched();
27
+ }
28
+
29
+ registerOnChange(fn: (value: any) => void) {
30
+ this.onChange = fn;
31
+ }
32
+ registerOnTouched(fn: () => void) {
33
+ this.onTouched = fn;
34
+ }
35
+
36
+ setDisabledState(isDisabled: boolean) {
37
+ this.el.nativeElement.disabled = isDisabled;
38
+ }
39
+ }
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ /* -------------------------------------------------------------------------- */
2
+ /* DIRECTIVES */
3
+ /* -------------------------------------------------------------------------- */
4
+ export { BooleanValueAccessor } from './directives/boolean-value-accessor';
5
+ export { NumericValueAccessor } from './directives/number-value-accessor';
6
+ export { RadioValueAccessor } from './directives/radio-value-accessor';
7
+ export { SelectValueAccessor } from './directives/select-value-accessor';
8
+ export { TextValueAccessor } from './directives/text-value-accessor';
9
+
10
+ export * from './directives/components';
11
+
12
+ /* -------------------------------------------------------------------------- */
13
+ /* PACKAGE MODULE */
14
+ /* -------------------------------------------------------------------------- */
15
+ export { BeeQModule } from './beeq.module';
@@ -0,0 +1 @@
1
+ import 'jest-preset-angular/setup-jest';
@@ -0,0 +1,5 @@
1
+ {
2
+ "lib": {
3
+ "entryFile": "src/index.ts"
4
+ }
5
+ }
@@ -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
+ }
@@ -0,0 +1,27 @@
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
+ ],standalone: true
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
+ }