@libs-ui/components-buttons-group 0.1.1-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/README.md +131 -0
- package/esm2022/group.component.mjs +36 -0
- package/esm2022/index.mjs +2 -0
- package/esm2022/libs-ui-components-buttons-group.mjs +5 -0
- package/fesm2022/libs-ui-components-buttons-group.mjs +43 -0
- package/fesm2022/libs-ui-components-buttons-group.mjs.map +1 -0
- package/group.component.d.ts +16 -0
- package/index.d.ts +1 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Button Group
|
|
2
|
+
|
|
3
|
+
## Giới thiệu
|
|
4
|
+
|
|
5
|
+
`@libs-ui/components-buttons-group` là một component nhóm Button cho Angular, cho phép hiển thị nhiều nút theo hàng, hỗ trợ quản lý trạng thái active và disable cho toàn nhóm.
|
|
6
|
+
|
|
7
|
+
## Tính năng
|
|
8
|
+
|
|
9
|
+
- Hiển thị danh sách nút theo hàng ngang
|
|
10
|
+
- Hỗ trợ two-way binding cho chỉ số nút đang active (`indexActive`)
|
|
11
|
+
- Emit sự kiện khi thay đổi nút active (`outChange`)
|
|
12
|
+
- Hỗ trợ disable toàn bộ nhóm nút
|
|
13
|
+
- Tích hợp popover control event (`outFunctionsControl`)
|
|
14
|
+
|
|
15
|
+
## Cài đặt
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @libs-ui/components-buttons-group
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
hoặc
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @libs-ui/components-buttons-group
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Sử dụng
|
|
28
|
+
|
|
29
|
+
### Inline Template
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { Component } from '@angular/core';
|
|
33
|
+
import { LibsUiComponentsButtonsGroupComponent } from '@libs-ui/components-buttons-group';
|
|
34
|
+
|
|
35
|
+
@Component({
|
|
36
|
+
selector: 'app-example',
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [LibsUiComponentsButtonsGroupComponent],
|
|
39
|
+
template: `
|
|
40
|
+
<libs_ui-components-buttons-group
|
|
41
|
+
[buttons]="buttons"
|
|
42
|
+
[(indexActive)]="activeIndex"
|
|
43
|
+
(outChange)="onChange($event)"></libs_ui-components-buttons-group>
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class ExampleComponent {
|
|
47
|
+
buttons = [
|
|
48
|
+
{ key: '1', label: 'Option 1' },
|
|
49
|
+
{ key: '2', label: 'Option 2' },
|
|
50
|
+
{ key: '3', label: 'Option 3' },
|
|
51
|
+
];
|
|
52
|
+
activeIndex = 0;
|
|
53
|
+
onChange(button: any) {
|
|
54
|
+
console.log('Changed:', button);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### File HTML riêng
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { Component } from '@angular/core';
|
|
63
|
+
import { LibsUiComponentsButtonsGroupComponent } from '@libs-ui/components-buttons-group';
|
|
64
|
+
|
|
65
|
+
@Component({
|
|
66
|
+
selector: 'app-example',
|
|
67
|
+
standalone: true,
|
|
68
|
+
imports: [LibsUiComponentsButtonsGroupComponent],
|
|
69
|
+
templateUrl: './example.component.html',
|
|
70
|
+
})
|
|
71
|
+
export class ExampleComponent {
|
|
72
|
+
buttons = [
|
|
73
|
+
/* ... */
|
|
74
|
+
];
|
|
75
|
+
activeIndex = 0;
|
|
76
|
+
onChange(button: any) {}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<libs_ui-components-buttons-group
|
|
82
|
+
[buttons]="buttons"
|
|
83
|
+
[(indexActive)]="activeIndex"
|
|
84
|
+
(outChange)="onChange($event)"></libs_ui-components-buttons-group>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Công nghệ sử dụng
|
|
88
|
+
|
|
89
|
+
- **Angular 18** với standalone components và Signals
|
|
90
|
+
- **Tailwind CSS** 3.x (phong cách demo)
|
|
91
|
+
|
|
92
|
+
## API Reference
|
|
93
|
+
|
|
94
|
+
### Inputs
|
|
95
|
+
|
|
96
|
+
| Tên | Kiểu | Mặc định | Mô tả |
|
|
97
|
+
| ----------- | ---------------- | -------- | --------------------------------------- |
|
|
98
|
+
| buttons | `Array<IButton>` | required | Mảng các nút sẽ hiển thị trong nhóm. |
|
|
99
|
+
| indexActive | `number` | `0` | Chỉ số của nút đang được chọn (từ 0). |
|
|
100
|
+
| disable | `boolean` | `false` | Nếu true: vô hiệu hóa toàn bộ nhóm nút. |
|
|
101
|
+
|
|
102
|
+
### Outputs
|
|
103
|
+
|
|
104
|
+
| Tên | Kiểu | Mô tả |
|
|
105
|
+
| ------------------- | ------------------------------ | ----------------------------------- |
|
|
106
|
+
| outChange | `(button: IButton) => void` | Trả về nút vừa được chọn. |
|
|
107
|
+
| outFunctionsControl | `IPopoverFunctionControlEvent` | Cung cấp API để điều khiển popover. |
|
|
108
|
+
|
|
109
|
+
### Interfaces
|
|
110
|
+
|
|
111
|
+
#### `IButton`
|
|
112
|
+
|
|
113
|
+
| Property | Type | Required | Description |
|
|
114
|
+
| -------------- | ------------------ | -------- | ----------------------------------------------- |
|
|
115
|
+
| key | `string` | no | Khóa định danh của nút (unique). |
|
|
116
|
+
| type | `TYPE_BUTTON` | no | Kiểu giao diện của nút (primary, secondary...). |
|
|
117
|
+
| sizeButton | `TYPE_SIZE_BUTTON` | no | Kích thước của nút (nhỏ, trung, lớn). |
|
|
118
|
+
| iconOnlyType | `boolean` | no | Nếu true: chỉ hiện icon, không hiện nhãn. |
|
|
119
|
+
| label | `string` | no | Văn bản hiển thị trên nút. |
|
|
120
|
+
| disable | `boolean` | no | Vô hiệu hóa nút khi true. |
|
|
121
|
+
| classInclude | `string` | no | Class CSS thêm cho container của nút. |
|
|
122
|
+
| classIconLeft | `string` | no | Class CSS thêm cho icon bên trái. |
|
|
123
|
+
| classIconRight | `string` | no | Class CSS thêm cho icon bên phải. |
|
|
124
|
+
| classLabel | `string` | no | Class CSS thêm cho nhãn. |
|
|
125
|
+
| popover | `IPopover` | no | Cấu hình popover cho nút (nếu cần). |
|
|
126
|
+
|
|
127
|
+
#### `IPopoverFunctionControlEvent`
|
|
128
|
+
|
|
129
|
+
| Property | Type | Required | Description |
|
|
130
|
+
| -------- | ---- | -------- | --------------------------------------------------- |
|
|
131
|
+
| ... | ... | ... | Xem `@libs-ui/components-popover` để biết chi tiết. |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input, model, output, signal } from '@angular/core';
|
|
2
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
3
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class LibsUiComponentsButtonsGroupComponent {
|
|
6
|
+
functionsControlPopover = signal(undefined);
|
|
7
|
+
// #region INPUT
|
|
8
|
+
buttons = input.required();
|
|
9
|
+
indexActive = model(0);
|
|
10
|
+
disable = input(false);
|
|
11
|
+
// #region OUTPUT
|
|
12
|
+
outChange = output();
|
|
13
|
+
outFunctionsControl = output();
|
|
14
|
+
/* FUNCTIONS */
|
|
15
|
+
async handlerClickButton(index, button) {
|
|
16
|
+
if (this.indexActive() === index) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.indexActive.set(index);
|
|
20
|
+
this.outChange.emit(button);
|
|
21
|
+
}
|
|
22
|
+
async handlerFunctionsControl(control) {
|
|
23
|
+
this.outFunctionsControl.emit(control);
|
|
24
|
+
this.functionsControlPopover.set(control);
|
|
25
|
+
}
|
|
26
|
+
get FunctionsControl() {
|
|
27
|
+
return this.functionsControlPopover();
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsButtonsGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
30
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsButtonsGroupComponent, isStandalone: true, selector: "libs_ui-components-buttons-group", inputs: { buttons: { classPropertyName: "buttons", publicName: "buttons", isSignal: true, isRequired: true, transformFunction: null }, indexActive: { classPropertyName: "indexActive", publicName: "indexActive", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indexActive: "indexActiveChange", outChange: "outChange", outFunctionsControl: "outFunctionsControl" }, ngImport: i0, template: "<div class=\"libs-ui-buttons-group\">\n @for (button of buttons(); track button) {\n <libs_ui-components-buttons-button\n [type]=\"indexActive() === $index ? 'button-primary' : 'button-primary-revert'\"\n [label]=\"button.label || ''\"\n [disable]=\"disable() || button.disable || false\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [classIconRight]=\"button.classIconRight || ''\"\n [popover]=\"button.popover || {}\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outClick)=\"handlerClickButton($index, button)\" />\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-buttons-group{display:flex}:host ::ng-deep .libs-ui-buttons-group .libs-ui-button-disable{border:1px solid var(--libs-ui-button-other-color-border, #226ff5)!important}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button:hover{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button-disable{border-left:0!important}:host ::ng-deep .libs-ui-buttons-group>:first-child libs_ui-components-popover .libs-ui-button{border-radius:4px 0 0 4px}:host ::ng-deep .libs-ui-buttons-group>:last-child libs_ui-components-popover .libs-ui-button{border-left:0!important;border-radius:0 4px 4px 0}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
31
|
+
}
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsButtonsGroupComponent, decorators: [{
|
|
33
|
+
type: Component,
|
|
34
|
+
args: [{ selector: 'libs_ui-components-buttons-group', standalone: true, imports: [TranslateModule, LibsUiComponentsButtonsButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"libs-ui-buttons-group\">\n @for (button of buttons(); track button) {\n <libs_ui-components-buttons-button\n [type]=\"indexActive() === $index ? 'button-primary' : 'button-primary-revert'\"\n [label]=\"button.label || ''\"\n [disable]=\"disable() || button.disable || false\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [classIconRight]=\"button.classIconRight || ''\"\n [popover]=\"button.popover || {}\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outClick)=\"handlerClickButton($index, button)\" />\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-buttons-group{display:flex}:host ::ng-deep .libs-ui-buttons-group .libs-ui-button-disable{border:1px solid var(--libs-ui-button-other-color-border, #226ff5)!important}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button:hover{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button-disable{border-left:0!important}:host ::ng-deep .libs-ui-buttons-group>:first-child libs_ui-components-popover .libs-ui-button{border-radius:4px 0 0 4px}:host ::ng-deep .libs-ui-buttons-group>:last-child libs_ui-components-popover .libs-ui-button{border-left:0!important;border-radius:0 4px 4px 0}\n"] }]
|
|
35
|
+
}] });
|
|
36
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JvdXAuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy11aS9jb21wb25lbnRzL2J1dHRvbnMvZ3JvdXAvc3JjL2dyb3VwLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9idXR0b25zL2dyb3VwL3NyYy9ncm91cC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNqRyxPQUFPLEVBQVcsc0NBQXNDLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUVyRyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0scUJBQXFCLENBQUM7O0FBV3RELE1BQU0sT0FBTyxxQ0FBcUM7SUFDeEMsdUJBQXVCLEdBQUcsTUFBTSxDQUEyQyxTQUFTLENBQUMsQ0FBQztJQUU5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kaXY+XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from './group.component';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvYnV0dG9ucy9ncm91cC9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxtQkFBbUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZ3JvdXAuY29tcG9uZW50JztcbiJdfQ==
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlicy11aS1jb21wb25lbnRzLWJ1dHRvbnMtZ3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvYnV0dG9ucy9ncm91cC9zcmMvbGlicy11aS1jb21wb25lbnRzLWJ1dHRvbnMtZ3JvdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLFNBQVMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9pbmRleCc7XG4iXX0=
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, input, model, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
4
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
5
|
+
|
|
6
|
+
class LibsUiComponentsButtonsGroupComponent {
|
|
7
|
+
functionsControlPopover = signal(undefined);
|
|
8
|
+
// #region INPUT
|
|
9
|
+
buttons = input.required();
|
|
10
|
+
indexActive = model(0);
|
|
11
|
+
disable = input(false);
|
|
12
|
+
// #region OUTPUT
|
|
13
|
+
outChange = output();
|
|
14
|
+
outFunctionsControl = output();
|
|
15
|
+
/* FUNCTIONS */
|
|
16
|
+
async handlerClickButton(index, button) {
|
|
17
|
+
if (this.indexActive() === index) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
this.indexActive.set(index);
|
|
21
|
+
this.outChange.emit(button);
|
|
22
|
+
}
|
|
23
|
+
async handlerFunctionsControl(control) {
|
|
24
|
+
this.outFunctionsControl.emit(control);
|
|
25
|
+
this.functionsControlPopover.set(control);
|
|
26
|
+
}
|
|
27
|
+
get FunctionsControl() {
|
|
28
|
+
return this.functionsControlPopover();
|
|
29
|
+
}
|
|
30
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsButtonsGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: LibsUiComponentsButtonsGroupComponent, isStandalone: true, selector: "libs_ui-components-buttons-group", inputs: { buttons: { classPropertyName: "buttons", publicName: "buttons", isSignal: true, isRequired: true, transformFunction: null }, indexActive: { classPropertyName: "indexActive", publicName: "indexActive", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indexActive: "indexActiveChange", outChange: "outChange", outFunctionsControl: "outFunctionsControl" }, ngImport: i0, template: "<div class=\"libs-ui-buttons-group\">\n @for (button of buttons(); track button) {\n <libs_ui-components-buttons-button\n [type]=\"indexActive() === $index ? 'button-primary' : 'button-primary-revert'\"\n [label]=\"button.label || ''\"\n [disable]=\"disable() || button.disable || false\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [classIconRight]=\"button.classIconRight || ''\"\n [popover]=\"button.popover || {}\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outClick)=\"handlerClickButton($index, button)\" />\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-buttons-group{display:flex}:host ::ng-deep .libs-ui-buttons-group .libs-ui-button-disable{border:1px solid var(--libs-ui-button-other-color-border, #226ff5)!important}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button:hover{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button-disable{border-left:0!important}:host ::ng-deep .libs-ui-buttons-group>:first-child libs_ui-components-popover .libs-ui-button{border-radius:4px 0 0 4px}:host ::ng-deep .libs-ui-buttons-group>:last-child libs_ui-components-popover .libs-ui-button{border-left:0!important;border-radius:0 4px 4px 0}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
32
|
+
}
|
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsButtonsGroupComponent, decorators: [{
|
|
34
|
+
type: Component,
|
|
35
|
+
args: [{ selector: 'libs_ui-components-buttons-group', standalone: true, imports: [TranslateModule, LibsUiComponentsButtonsButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"libs-ui-buttons-group\">\n @for (button of buttons(); track button) {\n <libs_ui-components-buttons-button\n [type]=\"indexActive() === $index ? 'button-primary' : 'button-primary-revert'\"\n [label]=\"button.label || ''\"\n [disable]=\"disable() || button.disable || false\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [classIconRight]=\"button.classIconRight || ''\"\n [popover]=\"button.popover || {}\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outClick)=\"handlerClickButton($index, button)\" />\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-buttons-group{display:flex}:host ::ng-deep .libs-ui-buttons-group .libs-ui-button-disable{border:1px solid var(--libs-ui-button-other-color-border, #226ff5)!important}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button:hover{border-radius:0;border-left:0}:host ::ng-deep .libs-ui-buttons-group>:not(:first-child):not(:last-child) libs_ui-components-popover .libs-ui-button-disable{border-left:0!important}:host ::ng-deep .libs-ui-buttons-group>:first-child libs_ui-components-popover .libs-ui-button{border-radius:4px 0 0 4px}:host ::ng-deep .libs-ui-buttons-group>:last-child libs_ui-components-popover .libs-ui-button{border-left:0!important;border-radius:0 4px 4px 0}\n"] }]
|
|
36
|
+
}] });
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Generated bundle index. Do not edit.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export { LibsUiComponentsButtonsGroupComponent };
|
|
43
|
+
//# sourceMappingURL=libs-ui-components-buttons-group.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libs-ui-components-buttons-group.mjs","sources":["../../../../../../libs-ui/components/buttons/group/src/group.component.ts","../../../../../../libs-ui/components/buttons/group/src/group.component.html","../../../../../../libs-ui/components/buttons/group/src/libs-ui-components-buttons-group.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, model, output, signal } from '@angular/core';\nimport { IButton, LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';\nimport { IPopoverFunctionControlEvent } from '@libs-ui/components-popover';\nimport { TranslateModule } from '@ngx-translate/core';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'libs_ui-components-buttons-group',\n templateUrl: './group.component.html',\n styleUrl: './group.component.scss',\n standalone: true,\n imports: [TranslateModule, LibsUiComponentsButtonsButtonComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class LibsUiComponentsButtonsGroupComponent {\n private functionsControlPopover = signal<IPopoverFunctionControlEvent | undefined>(undefined);\n\n // #region INPUT\n readonly buttons = input.required<Array<IButton>>();\n readonly indexActive = model<number>(0);\n readonly disable = input<boolean>(false);\n\n // #region OUTPUT\n readonly outChange = output<IButton>();\n readonly outFunctionsControl = output<IPopoverFunctionControlEvent>();\n\n /* FUNCTIONS */\n protected async handlerClickButton(index: number, button: IButton) {\n if (this.indexActive() === index) {\n return;\n }\n this.indexActive.set(index);\n this.outChange.emit(button);\n }\n\n protected async handlerFunctionsControl(control: IPopoverFunctionControlEvent) {\n this.outFunctionsControl.emit(control);\n this.functionsControlPopover.set(control);\n }\n\n public get FunctionsControl(): IPopoverFunctionControlEvent | undefined {\n return this.functionsControlPopover();\n }\n}\n","<div class=\"libs-ui-buttons-group\">\n @for (button of buttons(); track button) {\n <libs_ui-components-buttons-button\n [type]=\"indexActive() === $index ? 'button-primary' : 'button-primary-revert'\"\n [label]=\"button.label || ''\"\n [disable]=\"disable() || button.disable || false\"\n [classIconLeft]=\"button.classIconLeft || ''\"\n [classInclude]=\"button.classInclude || ''\"\n [classIconRight]=\"button.classIconRight || ''\"\n [popover]=\"button.popover || {}\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outClick)=\"handlerClickButton($index, button)\" />\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAca,qCAAqC,CAAA;AACxC,IAAA,uBAAuB,GAAG,MAAM,CAA2C,SAAS,CAAC;;AAGpF,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAkB;AAC1C,IAAA,WAAW,GAAG,KAAK,CAAS,CAAC,CAAC;AAC9B,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,CAAC;;IAG/B,SAAS,GAAG,MAAM,EAAW;IAC7B,mBAAmB,GAAG,MAAM,EAAgC;;AAG3D,IAAA,MAAM,kBAAkB,CAAC,KAAa,EAAE,MAAe,EAAA;AAC/D,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;YAChC;QACF;AACA,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B;IAEU,MAAM,uBAAuB,CAAC,OAAqC,EAAA;AAC3E,QAAA,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC;AACtC,QAAA,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC;IAC3C;AAEA,IAAA,IAAW,gBAAgB,GAAA;AACzB,QAAA,OAAO,IAAI,CAAC,uBAAuB,EAAE;IACvC;wGA5BW,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAA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oBAAA,EAAA,UAAA,EAAA,mCAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,iBAAA,EAAA,qBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAGtD,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBATjD,SAAS;+BAEE,kCAAkC,EAAA,UAAA,EAGhC,IAAI,EAAA,OAAA,EACP,CAAC,eAAe,EAAE,sCAAsC,CAAC,EAAA,eAAA,EACjD,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,6oBAAA,EAAA,MAAA,EAAA,CAAA,i5BAAA,CAAA,EAAA;;;AEZjD;;AAEG;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IButton } from '@libs-ui/components-buttons-button';
|
|
2
|
+
import { IPopoverFunctionControlEvent } from '@libs-ui/components-popover';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class LibsUiComponentsButtonsGroupComponent {
|
|
5
|
+
private functionsControlPopover;
|
|
6
|
+
readonly buttons: import("@angular/core").InputSignal<IButton[]>;
|
|
7
|
+
readonly indexActive: import("@angular/core").ModelSignal<number>;
|
|
8
|
+
readonly disable: import("@angular/core").InputSignal<boolean>;
|
|
9
|
+
readonly outChange: import("@angular/core").OutputEmitterRef<IButton>;
|
|
10
|
+
readonly outFunctionsControl: import("@angular/core").OutputEmitterRef<IPopoverFunctionControlEvent>;
|
|
11
|
+
protected handlerClickButton(index: number, button: IButton): Promise<void>;
|
|
12
|
+
protected handlerFunctionsControl(control: IPopoverFunctionControlEvent): Promise<void>;
|
|
13
|
+
get FunctionsControl(): IPopoverFunctionControlEvent | undefined;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsButtonsGroupComponent, never>;
|
|
15
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LibsUiComponentsButtonsGroupComponent, "libs_ui-components-buttons-group", never, { "buttons": { "alias": "buttons"; "required": true; "isSignal": true; }; "indexActive": { "alias": "indexActive"; "required": false; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; }, { "indexActive": "indexActiveChange"; "outChange": "outChange"; "outFunctionsControl": "outFunctionsControl"; }, never, never, true, never>;
|
|
16
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './group.component';
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@libs-ui/components-buttons-group",
|
|
3
|
+
"version": "0.1.1-1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/core": ">=18.0.0",
|
|
6
|
+
"@libs-ui/components-buttons-button": "0.1.1-1",
|
|
7
|
+
"@libs-ui/components-popover": "0.1.1-1",
|
|
8
|
+
"@ngx-translate/core": "^15.0.0"
|
|
9
|
+
},
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"module": "fesm2022/libs-ui-components-buttons-group.mjs",
|
|
12
|
+
"typings": "index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": {
|
|
15
|
+
"default": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"esm2022": "./esm2022/libs-ui-components-buttons-group.mjs",
|
|
20
|
+
"esm": "./esm2022/libs-ui-components-buttons-group.mjs",
|
|
21
|
+
"default": "./fesm2022/libs-ui-components-buttons-group.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tslib": "^2.3.0"
|
|
26
|
+
}
|
|
27
|
+
}
|