bit-ng-library 20.1.6 → 20.1.8

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 CHANGED
@@ -38,6 +38,11 @@ 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.8] -2026-02-04
42
+
43
+ Se añade flexibilidad a la toolbar, que ahora puede tener otherActions en desplegable y como botón.
44
+ Para que una otherACtion se muestre como botón, otherActionsDropdown debe valer false y la acción correspondiente debe tener displayAsButton a true.
45
+
41
46
  ## [20.1.6] -2026-01-14
42
47
 
43
48
  Se añade fluid al incluir un p-autoComplete. Es una directiva de PrimeNG que consigue que el campo de autocompletar ocupe todo el ancho disponible en su contenedor.
@@ -2312,7 +2312,7 @@ function buildDefaultToolbarForm(formType, saveEnable = true, soloLectura = fals
2312
2312
  }
2313
2313
  }
2314
2314
  /**
2315
- * Construye la típica toolbar en función del tipo de formulario:
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) {
@@ -3090,34 +3089,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
3090
3089
  }]
3091
3090
  }], propDecorators: { ayuda: [{ type: i0.Input, args: [{ isSignal: true, alias: "ayuda", required: false }] }], boton: [{ type: i0.Input, args: [{ isSignal: true, alias: "boton", required: false }] }], extraClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "extraClass", required: false }] }], buttonSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonSize", required: false }] }] } });
3092
3091
 
3093
- /**
3094
- * Convierte un map de acciones del toolbar en un array de acciones pero conteniendo
3095
- * solo aquellas acciones que tengan la propiedad otherAction definida a true
3096
- */
3097
- class OtherToolbarActionPipe {
3098
- transform(toolbarMap) {
3099
- let actions = [];
3100
- for (var key in toolbarMap) {
3101
- if (toolbarMap[key].otherAction) {
3102
- actions.push(toolbarMap[key]);
3103
- }
3104
- }
3105
- return actions;
3106
- }
3107
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3108
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, isStandalone: false, name: "otherToolbarAction" }); }
3109
- }
3110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, decorators: [{
3111
- type: Pipe,
3112
- args: [{
3113
- name: "otherToolbarAction",
3114
- standalone: false
3115
- }]
3116
- }] });
3117
-
3118
3092
  /**
3119
3093
  * Componenente que muestra una barra de botones.
3120
- **/
3094
+ */
3121
3095
  class BitToolbarComponent extends BaseComponent {
3122
3096
  static { this.FILTER_BUTTON = "filter"; }
3123
3097
  static { this.PRINT_BUTTON = "print"; }
@@ -3131,31 +3105,34 @@ class BitToolbarComponent extends BaseComponent {
3131
3105
  super();
3132
3106
  this.translateService = inject(TranslateService);
3133
3107
  this.mostrar = false;
3108
+ this.translations = {};
3134
3109
  this.toolbar = input(...(ngDevMode ? [undefined, { debugName: "toolbar" }] : []));
3135
3110
  this.ayuda = input(...(ngDevMode ? [undefined, { debugName: "ayuda" }] : [])); // clave de la ayuda contextual que mostrar para su botón
3136
3111
  this.femenino = input(false, ...(ngDevMode ? [{ debugName: "femenino" }] : [])); // género femenino (para los nombres de botones) o no
3137
3112
  this.buttonSize = input(...(ngDevMode ? [undefined, { debugName: "buttonSize" }] : [])); // tamaño de los botones, por defecto normal
3138
- this.otherActionsDropdown = input(false, ...(ngDevMode ? [{ debugName: "otherActionsDropdown" }] : [])); // determina si las "other actions" deben mostrarse en línea o como un desplegable
3113
+ this.otherActionsDropdown = input(false, ...(ngDevMode ? [{ debugName: "otherActionsDropdown" }] : [])); // determina si todas las "other actions" se muestran en un desplegable o depende del atributo displayAsButton de cada una
3139
3114
  this.onToolbarButtonPressed = output();
3140
- this.mostrarOtherActionsEnDesplegable = computed(() => {
3141
- // calcular si las other actions deben mostrarse en desplegable
3142
- // (se ha pedido asi y hay más de una)
3143
- let otherActionsVisibles = 0;
3144
- for (let key in this.toolbar()) {
3145
- const toolbar = this.toolbar();
3146
- if (toolbar[key].otherAction && toolbar[key].visible) {
3147
- otherActionsVisibles++;
3148
- }
3149
- }
3150
- return this.otherActionsDropdown() && otherActionsVisibles > 1;
3151
- }, ...(ngDevMode ? [{ debugName: "mostrarOtherActionsEnDesplegable" }] : []));
3152
- this.itemsOtherActions = computed(() => {
3153
- if (this.mostrarOtherActionsEnDesplegable()) {
3154
- return this.getOtherActionsDropdownModel();
3155
- }
3156
- return [];
3157
- }, ...(ngDevMode ? [{ debugName: "itemsOtherActions" }] : []));
3158
- this.translateService.selectTranslate("toolbar", {}, "bitnglibrary", true)
3115
+ /** Devuelve si hay other actions que deben mostrarse en desplegable (solo cuando hay más de una). */
3116
+ this.itemsOtherActionsEnDesplegable = computed(() => {
3117
+ const toolbar = this.toolbar() || {};
3118
+ const actions = Object.values(toolbar).filter((item) => this.incluirOtherActionEnDropdown(item));
3119
+ if (actions?.length > 1)
3120
+ return actions;
3121
+ else
3122
+ return [];
3123
+ }, ...(ngDevMode ? [{ debugName: "itemsOtherActionsEnDesplegable" }] : []));
3124
+ /** Devuelve si hay other actions que deben mostrarse como botón (incluye la de desplegable si hay solo una). */
3125
+ this.itemsOtherActionsEnBoton = computed(() => {
3126
+ const toolbar = this.toolbar() || {};
3127
+ const actions = Object.values(toolbar).filter((item) => this.incluirOtherActionComoBoton(item));
3128
+ const actionsEnDesplegable = this.itemsOtherActionsEnDesplegable();
3129
+ // Si hay acciones en desplegable y solo es una, la incluimos también como botón
3130
+ if (actionsEnDesplegable?.length === 1)
3131
+ actions.push(actionsEnDesplegable[0]);
3132
+ return actions;
3133
+ }, ...(ngDevMode ? [{ debugName: "itemsOtherActionsEnBoton" }] : []));
3134
+ this.translateService
3135
+ .selectTranslate("toolbar", {}, "bitnglibrary", true)
3159
3136
  .pipe(takeUntil(this.destroy$))
3160
3137
  .subscribe((translations) => {
3161
3138
  this.translations = translations;
@@ -3201,30 +3178,52 @@ class BitToolbarComponent extends BaseComponent {
3201
3178
  otherAction(button) {
3202
3179
  this.onToolbarButtonPressed.emit(button.action);
3203
3180
  }
3204
- // Recorremos el toolbar y devolvemos un array con las acciones que tengan la propiedad otherAction a true,
3205
- // transformadas a MenuItem, para poder mostrarlas en el desplegable de SplitButton
3181
+ /**
3182
+ * Recorremos el toolbar y devolvemos un array con las acciones que tienen que incluirse
3183
+ * transformadas a MenuItem, para poder mostrarlas en el desplegable de SplitButton.
3184
+ */
3206
3185
  getOtherActionsDropdownModel() {
3207
3186
  let actions = [];
3208
- for (let key in this.toolbar()) {
3209
- const toolbar = this.toolbar();
3210
- if (toolbar[key].otherAction) {
3187
+ const toolbar = this.toolbar();
3188
+ for (let key in toolbar) {
3189
+ if (this.incluirOtherActionEnDropdown(toolbar[key])) {
3211
3190
  let toolbarItem = toolbar[key]; // capture the current toolbar item
3212
3191
  actions.push({
3213
3192
  label: this.translations[toolbarItem.label],
3214
3193
  icon: toolbarItem.estilo,
3215
3194
  visible: toolbarItem.visible,
3216
- command: () => { this.otherAction(toolbarItem); } // use the captured toolbar item
3195
+ command: () => {
3196
+ this.otherAction(toolbarItem);
3197
+ } // use the captured toolbar item
3217
3198
  });
3218
3199
  }
3219
3200
  }
3220
3201
  return actions;
3221
3202
  }
3203
+ /**
3204
+ * Indica si la acción debe incluirse en el desplegable de "other actions":
3205
+ * - Es una otherAction
3206
+ * - Es visible
3207
+ * - Todas se tienen que incluir en desplegable (this.otherActionsDropdown() es true) y esta acción tiene displayAsButton como "no true"
3208
+ */
3209
+ incluirOtherActionEnDropdown(toolbarItem) {
3210
+ return toolbarItem.otherAction && toolbarItem.visible && this.otherActionsDropdown() && toolbarItem.displayAsButton !== true;
3211
+ }
3212
+ /**
3213
+ * Indica si la acción debe incluirse como botón "other actions":
3214
+ * - Es una otherAction
3215
+ * - Es visible
3216
+ * - No todas se tienen que incluir en desplegable (this.otherActionsDropdown() es false) o esta acción tiene displayAsButton como "true"
3217
+ */
3218
+ incluirOtherActionComoBoton(toolbarItem) {
3219
+ return toolbarItem.otherAction && toolbarItem.visible && (!this.otherActionsDropdown() || toolbarItem.displayAsButton === true);
3220
+ }
3222
3221
  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: "<!-- acciones no estandar definidas din\u00E1micamente o muy particulares-->\r\n<!-- si otherActionsDropdown viene a true y hay m\u00E1s de una acci\u00F3n, se muestran como un desplegable, si no, todas las acciones en l\u00EDnea -->\r\n<div class=\"contenedor-toolbar\">\r\n\r\n @if (mostrarOtherActionsEnDesplegable()) {\r\n @if (otherActionsDropdown()) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"itemsOtherActions()\" />\r\n }\r\n }\r\n\r\n <!-- si otherActionsDropdown viene a false o solo hay una acci\u00F3n, se muestran una tras otra en l\u00EDnea -->\r\n @if (!mostrarOtherActionsEnDesplegable()) {\r\n @for (button of (toolbar() | otherToolbarAction); track button) {\r\n @if (button.visible) {\r\n <p-button type=\"button\" [disabled]=\"!button.enable\" (click)=\"otherAction(button)\" [size]=\"buttonSize()\">{{\"bitnglibrary.toolbar.\"+button.label | transloco}}&nbsp;&nbsp;<span [class]=\"button.estilo?button.estilo:'pi pi-angle-right'\"></span></p-button>\r\n }\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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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" }, { kind: "pipe", type: OtherToolbarActionPipe, name: "otherToolbarAction" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3222
+ 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]=\"getOtherActionsDropdownModel()\" />\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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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
3223
  }
3225
3224
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BitToolbarComponent, decorators: [{
3226
3225
  type: Component,
3227
- args: [{ selector: "bit-toolbar", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<!-- acciones no estandar definidas din\u00E1micamente o muy particulares-->\r\n<!-- si otherActionsDropdown viene a true y hay m\u00E1s de una acci\u00F3n, se muestran como un desplegable, si no, todas las acciones en l\u00EDnea -->\r\n<div class=\"contenedor-toolbar\">\r\n\r\n @if (mostrarOtherActionsEnDesplegable()) {\r\n @if (otherActionsDropdown()) {\r\n <p-splitbutton label=\"{{'bitnglibrary.toolbar.other-actions' | transloco}}\" [model]=\"itemsOtherActions()\" />\r\n }\r\n }\r\n\r\n <!-- si otherActionsDropdown viene a false o solo hay una acci\u00F3n, se muestran una tras otra en l\u00EDnea -->\r\n @if (!mostrarOtherActionsEnDesplegable()) {\r\n @for (button of (toolbar() | otherToolbarAction); track button) {\r\n @if (button.visible) {\r\n <p-button type=\"button\" [disabled]=\"!button.enable\" (click)=\"otherAction(button)\" [size]=\"buttonSize()\">{{\"bitnglibrary.toolbar.\"+button.label | transloco}}&nbsp;&nbsp;<span [class]=\"button.estilo?button.estilo:'pi pi-angle-right'\"></span></p-button>\r\n }\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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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" }]
3226
+ 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]=\"getOtherActionsDropdownModel()\" />\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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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}}&nbsp;&nbsp;<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
3227
  }], 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
3228
 
3230
3229
  /**
@@ -5152,6 +5151,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
5152
5151
  }]
5153
5152
  }] });
5154
5153
 
5154
+ /**
5155
+ * Convierte un map de acciones del toolbar en un array de acciones pero conteniendo
5156
+ * solo aquellas acciones que tengan la propiedad otherAction definida a true
5157
+ */
5158
+ class OtherToolbarActionPipe {
5159
+ transform(toolbarMap) {
5160
+ let actions = [];
5161
+ for (var key in toolbarMap) {
5162
+ if (toolbarMap[key].otherAction) {
5163
+ actions.push(toolbarMap[key]);
5164
+ }
5165
+ }
5166
+ return actions;
5167
+ }
5168
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
5169
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, isStandalone: false, name: "otherToolbarAction" }); }
5170
+ }
5171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: OtherToolbarActionPipe, decorators: [{
5172
+ type: Pipe,
5173
+ args: [{
5174
+ name: "otherToolbarAction",
5175
+ standalone: false
5176
+ }]
5177
+ }] });
5178
+
5155
5179
  /**
5156
5180
  * Acorta un texto con saltos de línea, sustituyendo los saltos por "//" y limitando la cadena final a 200 caracteres
5157
5181
  */