@bbq-chat/widgets-angular 1.0.9 → 1.0.11
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/fesm2022/index.mjs +2152 -0
- package/fesm2022/index.mjs.map +1 -0
- package/package.json +15 -20
- package/types/index.d.ts +660 -0
- package/.angular/cache/21.0.5/ng-packagr/97cbacd0e5e4cb18d1fead4d7f3aee1c3863ba3ffbe7cb7dd7780f237a848a5c +0 -1
- package/.angular/cache/21.0.5/ng-packagr/tsbuildinfo/index.tsbuildinfo +0 -1
- package/.eslintrc.json +0 -23
- package/.prettierrc.json +0 -8
- package/EXAMPLES.md +0 -484
- package/angular.json +0 -36
- package/ng-package.json +0 -9
- package/src/angular-widget-renderer.spec.ts +0 -157
- package/src/components/button.component.ts +0 -35
- package/src/components/card.component.ts +0 -52
- package/src/components/datepicker.component.ts +0 -63
- package/src/components/dropdown.component.ts +0 -65
- package/src/components/fileupload.component.ts +0 -71
- package/src/components/form.component.ts +0 -433
- package/src/components/image.component.ts +0 -33
- package/src/components/imagecollection.component.ts +0 -39
- package/src/components/index.ts +0 -20
- package/src/components/input.component.ts +0 -63
- package/src/components/multiselect.component.ts +0 -67
- package/src/components/progressbar.component.ts +0 -50
- package/src/components/slider.component.ts +0 -67
- package/src/components/textarea.component.ts +0 -63
- package/src/components/themeswitcher.component.ts +0 -46
- package/src/components/toggle.component.ts +0 -63
- package/src/custom-widget-renderer.types.ts +0 -120
- package/src/examples/form-validation-listener.component.ts +0 -41
- package/src/public_api.ts +0 -107
- package/src/renderers/AngularWidgetRenderer.ts +0 -100
- package/src/renderers/built-in-components.ts +0 -41
- package/src/renderers/index.ts +0 -7
- package/src/services/form-validation.service.ts +0 -21
- package/src/widget-di.tokens.ts +0 -95
- package/src/widget-registry.service.ts +0 -128
- package/src/widget-renderer.component.ts +0 -421
- package/tsconfig.json +0 -37
- package/tsconfig.lib.json +0 -18
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -13
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type { ButtonWidget } from '@bbq-chat/widgets';
|
|
4
|
-
import { CustomWidgetComponent } from '../custom-widget-renderer.types';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'bbq-button-widget',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CommonModule],
|
|
10
|
-
template: `
|
|
11
|
-
<button
|
|
12
|
-
class="bbq-widget bbq-button"
|
|
13
|
-
[attr.data-widget-type]="'button'"
|
|
14
|
-
[attr.data-action]="buttonWidget.action"
|
|
15
|
-
type="button"
|
|
16
|
-
(click)="onClick()">
|
|
17
|
-
{{ buttonWidget.label }}
|
|
18
|
-
</button>
|
|
19
|
-
`,
|
|
20
|
-
styles: []
|
|
21
|
-
})
|
|
22
|
-
export class ButtonWidgetComponent implements CustomWidgetComponent {
|
|
23
|
-
@Input() widget!: any;
|
|
24
|
-
widgetAction?: (actionName: string, payload: unknown) => void;
|
|
25
|
-
|
|
26
|
-
get buttonWidget(): ButtonWidget {
|
|
27
|
-
return this.widget as ButtonWidget;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
onClick() {
|
|
31
|
-
if (this.widgetAction) {
|
|
32
|
-
this.widgetAction(this.buttonWidget.action, {});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type { CardWidget } from '@bbq-chat/widgets';
|
|
4
|
-
import { CustomWidgetComponent } from '../custom-widget-renderer.types';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'bbq-card-widget',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CommonModule],
|
|
10
|
-
template: `
|
|
11
|
-
<div
|
|
12
|
-
class="bbq-widget bbq-card"
|
|
13
|
-
[attr.data-widget-type]="'card'"
|
|
14
|
-
[attr.data-action]="cardWidget.action"
|
|
15
|
-
role="article">
|
|
16
|
-
<h3 class="bbq-card-title">{{ cardWidget.title }}</h3>
|
|
17
|
-
@if (cardWidget.description) {
|
|
18
|
-
<p class="bbq-card-description">{{ cardWidget.description }}</p>
|
|
19
|
-
}
|
|
20
|
-
@if (cardWidget.imageUrl) {
|
|
21
|
-
<img
|
|
22
|
-
class="bbq-card-image"
|
|
23
|
-
[src]="cardWidget.imageUrl"
|
|
24
|
-
[alt]="cardWidget.title"
|
|
25
|
-
loading="lazy"
|
|
26
|
-
style="display:block;max-width:100%;height:auto;object-fit:cover;max-height:200px;border-radius:6px;margin-bottom:12px;" />
|
|
27
|
-
}
|
|
28
|
-
<button
|
|
29
|
-
class="bbq-card-action bbq-button"
|
|
30
|
-
[attr.data-action]="cardWidget.action"
|
|
31
|
-
type="button"
|
|
32
|
-
(click)="onClick()">
|
|
33
|
-
{{ cardWidget.label }}
|
|
34
|
-
</button>
|
|
35
|
-
</div>
|
|
36
|
-
`,
|
|
37
|
-
styles: []
|
|
38
|
-
})
|
|
39
|
-
export class CardWidgetComponent implements CustomWidgetComponent {
|
|
40
|
-
@Input() widget!: any;
|
|
41
|
-
widgetAction?: (actionName: string, payload: unknown) => void;
|
|
42
|
-
|
|
43
|
-
get cardWidget(): CardWidget {
|
|
44
|
-
return this.widget as CardWidget;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
onClick() {
|
|
48
|
-
if (this.widgetAction) {
|
|
49
|
-
this.widgetAction(this.cardWidget.action, {});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import type { DatePickerWidget } from '@bbq-chat/widgets';
|
|
5
|
-
import { CustomWidgetComponent } from '../custom-widget-renderer.types';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'bbq-datepicker-widget',
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [CommonModule, FormsModule],
|
|
11
|
-
template: `
|
|
12
|
-
<div
|
|
13
|
-
class="bbq-widget bbq-date-picker"
|
|
14
|
-
[attr.data-widget-type]="'datepicker'">
|
|
15
|
-
<label *ngIf="showLabel" class="bbq-date-picker-label" [attr.for]="inputId">
|
|
16
|
-
{{ datePickerWidget.label }}
|
|
17
|
-
</label>
|
|
18
|
-
<input
|
|
19
|
-
type="date"
|
|
20
|
-
[id]="inputId"
|
|
21
|
-
[ngClass]="inputClasses"
|
|
22
|
-
[attr.data-action]="datePickerWidget.action"
|
|
23
|
-
[min]="datePickerWidget.minDate || ''"
|
|
24
|
-
[max]="datePickerWidget.maxDate || ''"
|
|
25
|
-
[(ngModel)]="value" />
|
|
26
|
-
</div>
|
|
27
|
-
`,
|
|
28
|
-
styles: []
|
|
29
|
-
})
|
|
30
|
-
export class DatePickerWidgetComponent implements CustomWidgetComponent, OnInit {
|
|
31
|
-
@Input() widget!: any;
|
|
32
|
-
widgetAction?: (actionName: string, payload: unknown) => void;
|
|
33
|
-
|
|
34
|
-
value = '';
|
|
35
|
-
inputId = '';
|
|
36
|
-
|
|
37
|
-
get datePickerWidget(): DatePickerWidget {
|
|
38
|
-
return this.widget as DatePickerWidget;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get showLabel(): boolean {
|
|
42
|
-
const widget = this.datePickerWidget as any;
|
|
43
|
-
if (widget.hideLabel === true) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
if (widget.showLabel === false) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get inputClasses(): string[] {
|
|
53
|
-
return this.isFormAppearance ? ['bbq-form-datepicker'] : ['bbq-form-datepicker', 'bbq-input'];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private get isFormAppearance(): boolean {
|
|
57
|
-
return (this.datePickerWidget as any).appearance === 'form';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
ngOnInit() {
|
|
61
|
-
this.inputId = `bbq-${this.datePickerWidget.action.replace(/\s+/g, '-').toLowerCase()}-date`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import type { DropdownWidget } from '@bbq-chat/widgets';
|
|
5
|
-
import { CustomWidgetComponent } from '../custom-widget-renderer.types';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'bbq-dropdown-widget',
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [CommonModule, FormsModule],
|
|
11
|
-
template: `
|
|
12
|
-
<div
|
|
13
|
-
class="bbq-widget bbq-dropdown"
|
|
14
|
-
[attr.data-widget-type]="'dropdown'">
|
|
15
|
-
<label *ngIf="showLabel" class="bbq-dropdown-label" [attr.for]="selectId">
|
|
16
|
-
{{ dropdownWidget.label }}
|
|
17
|
-
</label>
|
|
18
|
-
<select
|
|
19
|
-
[id]="selectId"
|
|
20
|
-
[ngClass]="selectClasses"
|
|
21
|
-
[attr.data-action]="dropdownWidget.action"
|
|
22
|
-
[(ngModel)]="value">
|
|
23
|
-
@for (option of dropdownWidget.options; track option) {
|
|
24
|
-
<option [value]="option">{{ option }}</option>
|
|
25
|
-
}
|
|
26
|
-
</select>
|
|
27
|
-
</div>
|
|
28
|
-
`,
|
|
29
|
-
styles: []
|
|
30
|
-
})
|
|
31
|
-
export class DropdownWidgetComponent implements CustomWidgetComponent, OnInit {
|
|
32
|
-
@Input() widget!: any;
|
|
33
|
-
widgetAction?: (actionName: string, payload: unknown) => void;
|
|
34
|
-
|
|
35
|
-
value = '';
|
|
36
|
-
selectId = '';
|
|
37
|
-
|
|
38
|
-
get dropdownWidget(): DropdownWidget {
|
|
39
|
-
return this.widget as DropdownWidget;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get showLabel(): boolean {
|
|
43
|
-
const widget = this.dropdownWidget as any;
|
|
44
|
-
if (widget.hideLabel === true) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
if (widget.showLabel === false) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get selectClasses(): string[] {
|
|
54
|
-
return this.isFormAppearance ? ['bbq-form-select'] : ['bbq-dropdown'];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private get isFormAppearance(): boolean {
|
|
58
|
-
return (this.dropdownWidget as any).appearance === 'form';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
ngOnInit() {
|
|
62
|
-
this.selectId = `bbq-${this.dropdownWidget.action.replace(/\s+/g, '-').toLowerCase()}-select`;
|
|
63
|
-
this.value = this.dropdownWidget.options[0] || '';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type { FileUploadWidget } from '@bbq-chat/widgets';
|
|
4
|
-
import { CustomWidgetComponent } from '../custom-widget-renderer.types';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'bbq-fileupload-widget',
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [CommonModule],
|
|
10
|
-
template: `
|
|
11
|
-
<div
|
|
12
|
-
class="bbq-widget bbq-file-upload"
|
|
13
|
-
[attr.data-widget-type]="'fileupload'">
|
|
14
|
-
<label *ngIf="showLabel" class="bbq-file-label" [attr.for]="inputId">
|
|
15
|
-
{{ fileUploadWidget.label }}
|
|
16
|
-
</label>
|
|
17
|
-
<input
|
|
18
|
-
type="file"
|
|
19
|
-
[id]="inputId"
|
|
20
|
-
[ngClass]="inputClasses"
|
|
21
|
-
[attr.data-action]="fileUploadWidget.action"
|
|
22
|
-
[accept]="fileUploadWidget.accept || ''"
|
|
23
|
-
[attr.data-max-bytes]="fileUploadWidget.maxBytes"
|
|
24
|
-
(change)="onFileChange($event)" />
|
|
25
|
-
</div>
|
|
26
|
-
`,
|
|
27
|
-
styles: []
|
|
28
|
-
})
|
|
29
|
-
export class FileUploadWidgetComponent implements CustomWidgetComponent, OnInit {
|
|
30
|
-
@Input() widget!: any;
|
|
31
|
-
widgetAction?: (actionName: string, payload: unknown) => void;
|
|
32
|
-
|
|
33
|
-
inputId = '';
|
|
34
|
-
|
|
35
|
-
get fileUploadWidget(): FileUploadWidget {
|
|
36
|
-
return this.widget as FileUploadWidget;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get showLabel(): boolean {
|
|
40
|
-
const widget = this.fileUploadWidget as any;
|
|
41
|
-
if (widget.hideLabel === true) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
if (widget.showLabel === false) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
get inputClasses(): string[] {
|
|
51
|
-
return this.isFormAppearance ? ['bbq-form-fileupload'] : ['bbq-file'];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private get isFormAppearance(): boolean {
|
|
55
|
-
return (this.fileUploadWidget as any).appearance === 'form';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
ngOnInit() {
|
|
59
|
-
this.inputId = `bbq-${this.fileUploadWidget.action.replace(/\s+/g, '-').toLowerCase()}-file`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
onFileChange(event: Event) {
|
|
63
|
-
const target = event.target as HTMLInputElement;
|
|
64
|
-
if (target.files && target.files.length > 0) {
|
|
65
|
-
const file = target.files[0];
|
|
66
|
-
if (this.widgetAction) {
|
|
67
|
-
this.widgetAction(this.fileUploadWidget.action, { file });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|