bit-ng-library 20.1.7 → 20.1.9
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 +1 -1
- package/fesm2022/bit-ng-library.mjs +17 -19
- package/fesm2022/bit-ng-library.mjs.map +1 -1
- package/index.d.ts +8 -4
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C
|
|
|
38
38
|
|
|
39
39
|
## changelog
|
|
40
40
|
|
|
41
|
-
## [20.1.
|
|
41
|
+
## [20.1.9] -2026-02-13
|
|
42
42
|
|
|
43
43
|
Se añade flexibilidad a la toolbar, que ahora puede tener otherActions en desplegable y como botón.
|
|
44
44
|
Para que una otherACtion se muestre como botón, otherActionsDropdown debe valer false y la acción correspondiente debe tener displayAsButton a true.
|
|
@@ -2312,7 +2312,7 @@ function buildDefaultToolbarForm(formType, saveEnable = true, soloLectura = fals
|
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
2314
2314
|
/**
|
|
2315
|
-
|
|
2315
|
+
* Construye la típica toolbar en función del tipo de formulario:
|
|
2316
2316
|
* FormType.Select: botón de print visible y habilitado
|
|
2317
2317
|
* FormType.Insert: botónes:
|
|
2318
2318
|
* - save visible y habilitado en función de saveEnable.
|
|
@@ -2347,22 +2347,21 @@ function addButtonToToolbar(toolbar, buttonName, button) {
|
|
|
2347
2347
|
* @param action string con el nombre de la action cuando se pulse el botón
|
|
2348
2348
|
* @param label string con la etiqueta usada para buscar en el fichero de traducciones
|
|
2349
2349
|
* @param estilo string con el estilo a aplicar
|
|
2350
|
+
* @param displayAsButton boolean para indicar si la acción (siendo otherAction) se fuerza para mostrar como botón (true)
|
|
2350
2351
|
* @returns un objeto de tipo ToolbarButtonType
|
|
2351
2352
|
*/
|
|
2352
|
-
function buildButtonToolbar(visible, enable, otherAction, action, label, estilo) {
|
|
2353
|
+
function buildButtonToolbar(visible, enable, otherAction, action, label, estilo, displayAsButton) {
|
|
2353
2354
|
let optionToolbar = { visible, enable };
|
|
2354
|
-
if (otherAction)
|
|
2355
|
+
if (otherAction)
|
|
2355
2356
|
optionToolbar["otherAction"] = otherAction;
|
|
2356
|
-
|
|
2357
|
-
if (action) {
|
|
2357
|
+
if (action)
|
|
2358
2358
|
optionToolbar["action"] = action;
|
|
2359
|
-
|
|
2360
|
-
if (label) {
|
|
2359
|
+
if (label)
|
|
2361
2360
|
optionToolbar["label"] = label;
|
|
2362
|
-
|
|
2363
|
-
if (estilo) {
|
|
2361
|
+
if (estilo)
|
|
2364
2362
|
optionToolbar["estilo"] = estilo;
|
|
2365
|
-
|
|
2363
|
+
if (displayAsButton)
|
|
2364
|
+
optionToolbar["displayAsButton"] = displayAsButton;
|
|
2366
2365
|
return optionToolbar;
|
|
2367
2366
|
}
|
|
2368
2367
|
function makeToolbarChildList(enableDelete) {
|
|
@@ -3107,7 +3106,7 @@ class BitToolbarComponent extends BaseComponent {
|
|
|
3107
3106
|
this.translateService = inject(TranslateService);
|
|
3108
3107
|
this.mostrar = false;
|
|
3109
3108
|
this.translations = {};
|
|
3110
|
-
this.toolbar = input(...(ngDevMode ? [
|
|
3109
|
+
this.toolbar = input({}, ...(ngDevMode ? [{ debugName: "toolbar" }] : []));
|
|
3111
3110
|
this.ayuda = input(...(ngDevMode ? [undefined, { debugName: "ayuda" }] : [])); // clave de la ayuda contextual que mostrar para su botón
|
|
3112
3111
|
this.femenino = input(false, ...(ngDevMode ? [{ debugName: "femenino" }] : [])); // género femenino (para los nombres de botones) o no
|
|
3113
3112
|
this.buttonSize = input(...(ngDevMode ? [undefined, { debugName: "buttonSize" }] : [])); // tamaño de los botones, por defecto normal
|
|
@@ -3116,7 +3115,7 @@ class BitToolbarComponent extends BaseComponent {
|
|
|
3116
3115
|
/** Devuelve si hay other actions que deben mostrarse en desplegable (solo cuando hay más de una). */
|
|
3117
3116
|
this.itemsOtherActionsEnDesplegable = computed(() => {
|
|
3118
3117
|
const toolbar = this.toolbar() || {};
|
|
3119
|
-
const actions =
|
|
3118
|
+
const actions = this.getOtherActionsDropdownModel(toolbar);
|
|
3120
3119
|
if (actions?.length > 1)
|
|
3121
3120
|
return actions;
|
|
3122
3121
|
else
|
|
@@ -3183,9 +3182,8 @@ class BitToolbarComponent extends BaseComponent {
|
|
|
3183
3182
|
* Recorremos el toolbar y devolvemos un array con las acciones que tienen que incluirse
|
|
3184
3183
|
* transformadas a MenuItem, para poder mostrarlas en el desplegable de SplitButton.
|
|
3185
3184
|
*/
|
|
3186
|
-
getOtherActionsDropdownModel() {
|
|
3185
|
+
getOtherActionsDropdownModel(toolbar) {
|
|
3187
3186
|
let actions = [];
|
|
3188
|
-
const toolbar = this.toolbar();
|
|
3189
3187
|
for (let key in toolbar) {
|
|
3190
3188
|
if (this.incluirOtherActionEnDropdown(toolbar[key])) {
|
|
3191
3189
|
let toolbarItem = toolbar[key]; // capture the current toolbar item
|
|
@@ -3205,10 +3203,10 @@ class BitToolbarComponent extends BaseComponent {
|
|
|
3205
3203
|
* Indica si la acción debe incluirse en el desplegable de "other actions":
|
|
3206
3204
|
* - Es una otherAction
|
|
3207
3205
|
* - Es visible
|
|
3208
|
-
* - Todas se tienen que incluir en desplegable (this.otherActionsDropdown() es true)
|
|
3206
|
+
* - Todas se tienen que incluir en desplegable (this.otherActionsDropdown() es true) y esta acción tiene displayAsButton como "no true"
|
|
3209
3207
|
*/
|
|
3210
3208
|
incluirOtherActionEnDropdown(toolbarItem) {
|
|
3211
|
-
return toolbarItem.otherAction && toolbarItem.visible &&
|
|
3209
|
+
return toolbarItem.otherAction && toolbarItem.visible && this.otherActionsDropdown() && toolbarItem.displayAsButton !== true;
|
|
3212
3210
|
}
|
|
3213
3211
|
/**
|
|
3214
3212
|
* Indica si la acción debe incluirse como botón "other actions":
|
|
@@ -3217,14 +3215,14 @@ class BitToolbarComponent extends BaseComponent {
|
|
|
3217
3215
|
* - No todas se tienen que incluir en desplegable (this.otherActionsDropdown() es false) o esta acción tiene displayAsButton como "true"
|
|
3218
3216
|
*/
|
|
3219
3217
|
incluirOtherActionComoBoton(toolbarItem) {
|
|
3220
|
-
return
|
|
3218
|
+
return toolbarItem.otherAction && toolbarItem.visible && (!this.otherActionsDropdown() || toolbarItem.displayAsButton === true);
|
|
3221
3219
|
}
|
|
3222
3220
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BitToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3223
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: BitToolbarComponent, isStandalone: false, selector: "bit-toolbar", inputs: { toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, ayuda: { classPropertyName: "ayuda", publicName: "ayuda", isSignal: true, isRequired: false, transformFunction: null }, femenino: { classPropertyName: "femenino", publicName: "femenino", isSignal: true, isRequired: false, transformFunction: null }, buttonSize: { classPropertyName: "buttonSize", publicName: "buttonSize", isSignal: true, isRequired: false, transformFunction: null }, otherActionsDropdown: { classPropertyName: "otherActionsDropdown", publicName: "otherActionsDropdown", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onToolbarButtonPressed: "onToolbarButtonPressed" }, usesInheritance: true, ngImport: i0, template: "<div class=\"contenedor-toolbar\">\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se deben incluir en un desplegable -->\r\n @if (itemsOtherActionsEnDesplegable().length > 1) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"
|
|
3221
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: BitToolbarComponent, isStandalone: false, selector: "bit-toolbar", inputs: { toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, ayuda: { classPropertyName: "ayuda", publicName: "ayuda", isSignal: true, isRequired: false, transformFunction: null }, femenino: { classPropertyName: "femenino", publicName: "femenino", isSignal: true, isRequired: false, transformFunction: null }, buttonSize: { classPropertyName: "buttonSize", publicName: "buttonSize", isSignal: true, isRequired: false, transformFunction: null }, otherActionsDropdown: { classPropertyName: "otherActionsDropdown", publicName: "otherActionsDropdown", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onToolbarButtonPressed: "onToolbarButtonPressed" }, usesInheritance: true, ngImport: i0, template: "<div class=\"contenedor-toolbar\">\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se deben incluir en un desplegable -->\r\n @if (itemsOtherActionsEnDesplegable().length > 1) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"itemsOtherActionsEnDesplegable()\" />\r\n }\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se muestran una tras otra en l\u00EDnea -->\r\n @for (button of itemsOtherActionsEnBoton(); track button) {\r\n <p-button type=\"button\" [disabled]=\"!button.enable\" (click)=\"otherAction(button)\" [size]=\"buttonSize()\">{{\"bitnglibrary.toolbar.\"+button.label | transloco}} <span [class]=\"button.estilo?button.estilo:'pi pi-angle-right'\"></span></p-button>\r\n }\r\n\r\n <!-- acciones estandar -->\r\n @if (visible('new')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('new')\" (click)=\"newElement()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{(femenino() ? \"bitnglibrary.toolbar.new-female\": \"bitnglibrary.toolbar.new\") | transloco}} <span [class]=\"estilo('new', 'pi pi-plus')\"></span></p-button>\r\n }\r\n @if (visible('add')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('add')\" (click)=\"add()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{\"bitnglibrary.toolbar.add\" | transloco}} <span [class]=\"estilo('add', 'pi pi-plus')\"></span></p-button>\r\n }\r\n\r\n @if (visible('export')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('export')\" (click)=\"exportData()\" [size]=\"buttonSize()\" styleClass=\"p-button-secondary\">{{\"bitnglibrary.toolbar.export\" | transloco}} <span [class]=\"estilo('export', 'pi pi-file')\"></span></p-button>\r\n }\r\n @if (visible('save')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('save')\" (click)=\"save()\" [size]=\"buttonSize()\" styleClass=\"p-button-success\">{{\"bitnglibrary.toolbar.save\" | transloco}} <span [class]=\"estilo('save', 'pi pi-save')\"></span></p-button>\r\n }\r\n @if (visible('delete')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('delete')\" (click)=\"delete()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{\"bitnglibrary.toolbar.delete\" | transloco}} <span [class]=\"estilo('delete', 'pi pi-trash')\"></span></p-button>\r\n }\r\n @if (visible('print')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('print')\" (click)=\"print()\" [size]=\"buttonSize()\" styleClass=\"p-button-secondary\">{{\"bitnglibrary.toolbar.print\" | transloco}} <span [class]=\"estilo('print', 'pi pi-print')\"></span></p-button>\r\n }\r\n @if (ayuda()) {\r\n <bit-boton-ayuda boton=\"true\" [ayuda]=\"ayuda()\" [buttonSize]=\"buttonSize()\" />\r\n }\r\n</div>\r\n", dependencies: [{ kind: "component", type: i3$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i2$2.SplitButton, selector: "p-splitbutton, p-splitButton, p-split-button", inputs: ["model", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "icon", "iconPos", "label", "tooltip", "tooltipOptions", "styleClass", "menuStyle", "menuStyleClass", "dropdownIcon", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps", "autofocus", "disabled", "tabindex", "menuButtonDisabled", "buttonDisabled"], outputs: ["onClick", "onMenuHide", "onMenuShow", "onDropdownClick"] }, { kind: "component", type: BitBotonAyudaComponent, selector: "bit-boton-ayuda", inputs: ["ayuda", "boton", "extraClass", "buttonSize"] }, { kind: "pipe", type: i3.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3224
3222
|
}
|
|
3225
3223
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BitToolbarComponent, decorators: [{
|
|
3226
3224
|
type: Component,
|
|
3227
|
-
args: [{ selector: "bit-toolbar", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"contenedor-toolbar\">\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se deben incluir en un desplegable -->\r\n @if (itemsOtherActionsEnDesplegable().length > 1) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"
|
|
3225
|
+
args: [{ selector: "bit-toolbar", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"contenedor-toolbar\">\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se deben incluir en un desplegable -->\r\n @if (itemsOtherActionsEnDesplegable().length > 1) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"itemsOtherActionsEnDesplegable()\" />\r\n }\r\n\r\n <!-- acciones no estandar definidas din\u00E1micamente o muy particulares que se muestran una tras otra en l\u00EDnea -->\r\n @for (button of itemsOtherActionsEnBoton(); track button) {\r\n <p-button type=\"button\" [disabled]=\"!button.enable\" (click)=\"otherAction(button)\" [size]=\"buttonSize()\">{{\"bitnglibrary.toolbar.\"+button.label | transloco}} <span [class]=\"button.estilo?button.estilo:'pi pi-angle-right'\"></span></p-button>\r\n }\r\n\r\n <!-- acciones estandar -->\r\n @if (visible('new')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('new')\" (click)=\"newElement()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{(femenino() ? \"bitnglibrary.toolbar.new-female\": \"bitnglibrary.toolbar.new\") | transloco}} <span [class]=\"estilo('new', 'pi pi-plus')\"></span></p-button>\r\n }\r\n @if (visible('add')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('add')\" (click)=\"add()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{\"bitnglibrary.toolbar.add\" | transloco}} <span [class]=\"estilo('add', 'pi pi-plus')\"></span></p-button>\r\n }\r\n\r\n @if (visible('export')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('export')\" (click)=\"exportData()\" [size]=\"buttonSize()\" styleClass=\"p-button-secondary\">{{\"bitnglibrary.toolbar.export\" | transloco}} <span [class]=\"estilo('export', 'pi pi-file')\"></span></p-button>\r\n }\r\n @if (visible('save')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('save')\" (click)=\"save()\" [size]=\"buttonSize()\" styleClass=\"p-button-success\">{{\"bitnglibrary.toolbar.save\" | transloco}} <span [class]=\"estilo('save', 'pi pi-save')\"></span></p-button>\r\n }\r\n @if (visible('delete')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('delete')\" (click)=\"delete()\" [size]=\"buttonSize()\" styleClass=\"p-button-danger\">{{\"bitnglibrary.toolbar.delete\" | transloco}} <span [class]=\"estilo('delete', 'pi pi-trash')\"></span></p-button>\r\n }\r\n @if (visible('print')) {\r\n <p-button type=\"button\" [disabled]=\"!enable('print')\" (click)=\"print()\" [size]=\"buttonSize()\" styleClass=\"p-button-secondary\">{{\"bitnglibrary.toolbar.print\" | transloco}} <span [class]=\"estilo('print', 'pi pi-print')\"></span></p-button>\r\n }\r\n @if (ayuda()) {\r\n <bit-boton-ayuda boton=\"true\" [ayuda]=\"ayuda()\" [buttonSize]=\"buttonSize()\" />\r\n }\r\n</div>\r\n" }]
|
|
3228
3226
|
}], ctorParameters: () => [], propDecorators: { toolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbar", required: false }] }], ayuda: [{ type: i0.Input, args: [{ isSignal: true, alias: "ayuda", required: false }] }], femenino: [{ type: i0.Input, args: [{ isSignal: true, alias: "femenino", required: false }] }], buttonSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSize", required: false }] }], otherActionsDropdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "otherActionsDropdown", required: false }] }], onToolbarButtonPressed: [{ type: i0.Output, args: ["onToolbarButtonPressed"] }] } });
|
|
3229
3227
|
|
|
3230
3228
|
/**
|