@gerandon/ngx-widgets 18.0.0 → 18.0.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.
Files changed (44) hide show
  1. package/esm2022/gerandon-ngx-widgets.mjs +5 -0
  2. package/esm2022/lib/basic-chips/basic-chips.component.mjs +80 -0
  3. package/esm2022/lib/basic-input/basic-input.component.mjs +41 -0
  4. package/esm2022/lib/core/base-input.mjs +81 -0
  5. package/esm2022/lib/core/base-text-input.mjs +20 -0
  6. package/esm2022/lib/core/base-value-accessor.mjs +63 -0
  7. package/esm2022/lib/core/component-unsubscribe.mjs +54 -0
  8. package/esm2022/lib/select/select.component.mjs +61 -0
  9. package/esm2022/lib/textarea-input/textarea-input.component.mjs +39 -0
  10. package/esm2022/public-api.mjs +12 -0
  11. package/fesm2022/gerandon-ngx-widgets.mjs +409 -0
  12. package/fesm2022/gerandon-ngx-widgets.mjs.map +1 -0
  13. package/gerandon-ngx-widgets-18.0.2.tgz +0 -0
  14. package/index.d.ts +5 -0
  15. package/lib/basic-chips/basic-chips.component.d.ts +17 -0
  16. package/lib/basic-input/basic-input.component.d.ts +9 -0
  17. package/lib/core/base-input.d.ts +38 -0
  18. package/lib/core/base-text-input.d.ts +8 -0
  19. package/lib/core/base-value-accessor.d.ts +28 -0
  20. package/lib/core/component-unsubscribe.d.ts +8 -0
  21. package/lib/select/select.component.d.ts +26 -0
  22. package/lib/textarea-input/textarea-input.component.d.ts +7 -0
  23. package/package.json +16 -6
  24. package/{src/public-api.ts → public-api.d.ts} +0 -5
  25. package/ng-package.json +0 -7
  26. package/src/lib/basic-chips/basic-chips.component.html +0 -39
  27. package/src/lib/basic-chips/basic-chips.component.scss +0 -31
  28. package/src/lib/basic-chips/basic-chips.component.ts +0 -83
  29. package/src/lib/basic-input/basic-input.component.html +0 -44
  30. package/src/lib/basic-input/basic-input.component.scss +0 -26
  31. package/src/lib/basic-input/basic-input.component.ts +0 -41
  32. package/src/lib/core/base-input.ts +0 -69
  33. package/src/lib/core/base-text-input.ts +0 -13
  34. package/src/lib/core/base-value-accessor.ts +0 -80
  35. package/src/lib/core/component-unsubscribe.ts +0 -58
  36. package/src/lib/select/select.component.html +0 -36
  37. package/src/lib/select/select.component.scss +0 -7
  38. package/src/lib/select/select.component.ts +0 -70
  39. package/src/lib/textarea-input/textarea-input.component.html +0 -45
  40. package/src/lib/textarea-input/textarea-input.component.scss +0 -27
  41. package/src/lib/textarea-input/textarea-input.component.ts +0 -30
  42. package/tsconfig.lib.json +0 -14
  43. package/tsconfig.lib.prod.json +0 -10
  44. package/tsconfig.spec.json +0 -14
@@ -1,58 +0,0 @@
1
- import { isDevMode } from '@angular/core';
2
-
3
- import { Observable, Subject, takeUntil } from 'rxjs';
4
- import { SafeSubscriber } from 'rxjs/internal/Subscriber';
5
-
6
- /**
7
- * Automatically unsubscribe from an Observable when the view is destroyed
8
- * Tested with checking the "complete" event of a subscribe method
9
- * @description
10
- * An Annotation that should be used with an Observable typed variable to handle its subscriptions
11
- * @author gergo.asztalos
12
- */
13
- export function UnsubscribeOnDestroy<ObservableType>(): PropertyDecorator {
14
- return function (target: any, propertyKey: string | symbol) {
15
- const ngOnDestroy = target.ngOnDestroy;
16
-
17
- const secretKey = `_${<string>propertyKey}$`;
18
- // Probably with function we could use own context
19
- const destroyKey = (_this: any) =>
20
- _this.hasOwnProperty('destroy$') ? 'destroy$' : `${_this.constructor.name}_destroy$`;
21
- Object.defineProperty(target, secretKey, { enumerable: false, writable: true });
22
- Object.defineProperty(target, propertyKey, {
23
- configurable: true,
24
- enumerable: true,
25
- get: function() {
26
- return this[secretKey];
27
- },
28
- set: function(newValue: Observable<ObservableType> | SafeSubscriber<ObservableType>) {
29
- if (!this[destroyKey(this)]) {
30
- this[destroyKey(this)] = new Subject();
31
- }
32
- if (newValue instanceof Observable) {
33
- this[secretKey] = newValue.pipe(
34
- takeUntil(this[destroyKey(this)]),
35
- );
36
- } else {
37
- this[secretKey] = newValue;
38
- }
39
- },
40
- });
41
-
42
- target.ngOnDestroy = function () {
43
- if (this[propertyKey] instanceof SafeSubscriber) {
44
- this[propertyKey].unsubscribe();
45
- this[secretKey].unsubscribe();
46
- } else if (this.hasOwnProperty(destroyKey(this))) {
47
- this[destroyKey(this)].next();
48
- this[destroyKey(this)].complete();
49
- }
50
- delete this[secretKey];
51
- if (isDevMode()) {
52
- // eslint-disable-next-line no-console,max-len
53
- console.debug(`<UnsubscribeOnDestroy> - Observable/Subscription <${<string>propertyKey}> completed in class: ${this.constructor.name}`);
54
- }
55
- ngOnDestroy && ngOnDestroy.call(this);
56
- };
57
- };
58
- }
@@ -1,36 +0,0 @@
1
- <mat-form-field appearance="outline" [subscriptSizing]="subscriptSizing" [floatLabel]="floatLabel">
2
- @if (label) {
3
- <mat-label>{{ label }}</mat-label>
4
- }
5
- <mat-select #inputElement
6
- #input="ngForm"
7
- [multiple]="multiple"
8
- [placeholder]="!floatLabel ? label : placeholder"
9
- [formControl]="control"
10
- [id]="id"
11
- [class.input-disabled]="isDisabled || control.disabled"
12
- [compareWith]="_isEqual"
13
- [attr.disabled]="isDisabled || control.disabled ? '' : null">
14
- @if (emptyOptionLabel) {
15
- <mat-option (click)="control.reset()">
16
- {{ emptyOptionLabel }}
17
- </mat-option>
18
- }
19
- @for(option of options; track option) {
20
- <mat-option [value]="option.value">
21
- {{ option.label }}
22
- </mat-option>
23
- }
24
- </mat-select>
25
- @if (suffix) {
26
- <span matSuffix>{{suffix}}</span>
27
- }
28
- @if (control.errors?.['server']) {
29
- <mat-error>{{ control.errors?.['server'] }}</mat-error>
30
- } @else if (control.errors?.['required']) {
31
- <mat-error>{{ validationTranslations.required }}</mat-error>
32
- @for (error of validatorMessagesArray; track error) {
33
- <mat-error>{{ error.value }}</mat-error>
34
- }
35
- }
36
- </mat-form-field>
@@ -1,7 +0,0 @@
1
- gerandon-select {
2
- mat-form-field {
3
- width: 100%;
4
- .mat-mdc-text-field-wrapper {
5
- }
6
- }
7
- }
@@ -1,70 +0,0 @@
1
- import {
2
- Component,
3
- ElementRef,
4
- forwardRef,
5
- Input,
6
- OnInit,
7
- QueryList,
8
- ViewChildren,
9
- ViewEncapsulation,
10
- } from '@angular/core';
11
- import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
12
- import { MatInputModule } from '@angular/material/input';
13
- import { MatSelectModule } from '@angular/material/select';
14
- import { MatTooltipModule } from '@angular/material/tooltip';
15
-
16
- import {BaseInput} from '../core/base-input';
17
- import { isEqual } from 'lodash-es';
18
- import { Observable } from 'rxjs';
19
- import { takeUntil } from 'rxjs/operators';
20
-
21
- export interface SelectOptionType {
22
- label: string;
23
- value: string | number | null | unknown;
24
- }
25
-
26
- @Component({
27
- selector: 'gerandon-select',
28
- templateUrl: './select.component.html',
29
- styleUrls: ['./select.component.scss'],
30
- encapsulation: ViewEncapsulation.None,
31
- standalone: true,
32
- providers: [
33
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SelectComponent), multi: true }
34
- ],
35
- imports: [
36
- MatInputModule,
37
- MatSelectModule,
38
- ReactiveFormsModule,
39
- MatTooltipModule,
40
- ],
41
- })
42
- export class SelectComponent extends BaseInput<unknown> implements OnInit {
43
-
44
- /**
45
- * In this case, an empty option appears that resets the control, to an empty value state
46
- */
47
- @Input() public emptyOptionLabel?: string;
48
- @Input() public multiple?: boolean;
49
- @Input() public options!: SelectOptionType[];
50
- @Input() public asyncOptions!: Observable<SelectOptionType[]>;
51
- @ViewChildren('optionElements') public optionElements!: QueryList<ElementRef>;
52
-
53
- /**
54
- * Angular Material - Select component comparsion is only '===', does not work with Array values
55
- * https://github.com/angular/components/blob/a07c0758a5ec2eb4de1bb822354be08178c66aa4/src/lib/select/select.ts#L242C48-L242C58
56
- */
57
- public readonly _isEqual = isEqual;
58
-
59
- override ngOnInit() {
60
- this.placeholder = !this.placeholder ? (this.validationTranslations.selectGlobalPlaceholder || this.label) : this.placeholder;
61
- super.ngOnInit();
62
- this.id = this.id || this.formControlName || this.name;
63
- if (this.asyncOptions) {
64
- this.asyncOptions.pipe(takeUntil(this.destroy$)).subscribe((resp) => {
65
- this.options = resp;
66
- this.cdr.detectChanges();
67
- });
68
- }
69
- }
70
- }
@@ -1,45 +0,0 @@
1
- <div class="textarea-input cva-input">
2
- <mat-form-field appearance="outline" [subscriptSizing]="subscriptSizing" [floatLabel]="floatLabel">
3
- @if (label) {
4
- <mat-label [class.disabled]="isDisabled">{{ label }}</mat-label>
5
- }
6
- <textarea
7
- [id]="id"
8
- #inputElement
9
- #input="ngForm"
10
- #autosize="cdkTextareaAutosize"
11
- matInput
12
- cdkTextareaAutosize
13
- [cdkAutosizeMinRows]="rows"
14
- class="w-100 cva-control"
15
- [attr.disabled]="isDisabled || control.disabled ? '' : null"
16
- [readonly]="isDisabled"
17
- [placeholder]="placeholder"
18
- [formControl]="control"
19
- [maxLength]="maxLength"
20
- [name]="name">
21
- </textarea>
22
- <span class="counter">{{control?.value?.length || 0}} / {{ maxLength }}</span>
23
- @if (prefixIcon) {
24
- <mat-icon matPrefix color="accent">
25
- {{prefixIcon}}
26
- </mat-icon>
27
- }
28
- @if (suffixIcon) {
29
- <mat-icon matSuffix color="accent">
30
- {{suffixIcon}}
31
- </mat-icon>
32
- }
33
- @if (suffix) {
34
- <span matSuffix>{{suffix}}</span>
35
- }
36
- @if (control.errors?.['server']) {
37
- <mat-error>{{ control.errors?.['server'] }}</mat-error>
38
- } @else if (control.errors?.['required']) {
39
- <mat-error>{{ validationTranslations.required }}</mat-error>
40
- @for (error of validatorMessagesArray; track error) {
41
- <mat-error>{{ error.value }}</mat-error>
42
- }
43
- }
44
- </mat-form-field>
45
- </div>
@@ -1,27 +0,0 @@
1
- gerandon-textarea-input {
2
- display: block;
3
- .counter {
4
- right: 20px;
5
- bottom: 0;
6
- position: absolute;
7
- font-size: 10px;
8
- }
9
- .textarea-input {
10
- .disabled {
11
- color: #CED4DAFF;
12
- }
13
- mat-form-field {
14
- width: 100%;
15
- textarea {
16
- padding-top: 10px;
17
- &::placeholder {
18
- color: #ADB5BDFF;
19
- font-style: italic;
20
- }
21
- &:disabled {
22
- cursor: not-allowed;
23
- }
24
- }
25
- }
26
- }
27
- }
@@ -1,30 +0,0 @@
1
- import { Component, forwardRef, Input, ViewEncapsulation } from '@angular/core';
2
- import { FormsModule, NG_ASYNC_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
3
- import { MatFormFieldModule } from '@angular/material/form-field';
4
- import { MatIconModule } from '@angular/material/icon';
5
- import { MatInputModule } from '@angular/material/input';
6
- import {BaseTextInput} from "../core/base-text-input";
7
-
8
- @Component({
9
- selector: 'gerandon-textarea-input',
10
- templateUrl: 'textarea-input.component.html',
11
- styleUrls: ['textarea-input.component.scss'],
12
- standalone: true,
13
- encapsulation: ViewEncapsulation.None,
14
- imports: [
15
- FormsModule,
16
- MatFormFieldModule,
17
- MatIconModule,
18
- MatInputModule,
19
- ReactiveFormsModule,
20
- ],
21
- providers: [
22
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TextareaInputComponent), multi: true },
23
- { provide: NG_ASYNC_VALIDATORS, useExisting: forwardRef(() => TextareaInputComponent), multi: true },
24
- ],
25
- })
26
- export class TextareaInputComponent extends BaseTextInput<string> {
27
-
28
- @Input() public rows = 10;
29
-
30
- }
package/tsconfig.lib.json DELETED
@@ -1,14 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "exclude": [
12
- "**/*.spec.ts"
13
- ]
14
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,14 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../out-tsc/spec",
6
- "types": [
7
- "jasmine"
8
- ]
9
- },
10
- "include": [
11
- "**/*.spec.ts",
12
- "**/*.d.ts"
13
- ]
14
- }