@sankhyalabs/ezui 5.4.2 → 5.6.0

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.
@@ -2,7 +2,7 @@ import { DataUnit } from '@sankhyalabs/core';
2
2
  import { EventEmitter } from '../../stencil-public-runtime';
3
3
  import { IMultiSelectionListDataSource } from '../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource';
4
4
  import { EzGridColumStateEvent, EzGridColumn, EzGridColumnConfig, IGridConfig, IStatusResolver, StatusResolverFunction } from './controller/EzGridController';
5
- import { ISelection } from './interfaces/ISelection';
5
+ import { ISelection, ISelectionToastConfig } from './interfaces';
6
6
  export declare class EzGrid {
7
7
  private _container;
8
8
  private _refPaginationControl;
@@ -18,6 +18,7 @@ export declare class EzGrid {
18
18
  private _isAllSelection;
19
19
  private _currentPageSelected;
20
20
  private _selectionCount;
21
+ private _originalRecords;
21
22
  /**
22
23
  * Emitido quando acontece a alteração de estado das colunas do grid: Ordenação, largura, etc.
23
24
  */
@@ -46,6 +47,10 @@ export declare class EzGrid {
46
47
  * Configuração de exibição da grade.
47
48
  */
48
49
  config: IGridConfig;
50
+ /**
51
+ * Configuração da seleção de grade no toast.
52
+ */
53
+ selectionToastConfig: ISelectionToastConfig;
49
54
  /**
50
55
  * Endereço do servidor para obtenção dos dados.
51
56
  */
@@ -114,5 +119,8 @@ export declare class EzGrid {
114
119
  componentDidLoad(): void;
115
120
  componentWillRender(): void;
116
121
  componentDidRender(): void;
122
+ private getDataSource;
123
+ private buildDefaultDataSource;
124
+ private buildIMultiSelectionOption;
117
125
  render(): any;
118
126
  }
@@ -0,0 +1,3 @@
1
+ export interface ISelectionToastConfig {
2
+ canSelectAll: boolean;
3
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ISelection';
2
+ export * from './ISelectionToastConfig';
@@ -4,12 +4,15 @@ import { IMultiSelectionListDataSource } from '../../ez-multi-selection-list/int
4
4
  import { IMultiSelectionOption } from '../../ez-multi-selection-list/interfaces/IMultiSelectionOption';
5
5
  export declare class FilterColumn {
6
6
  private readonly TOP_POSITION;
7
+ private readonly TOP_POSITION_HEADER_HIDDEN;
8
+ private readonly DEFAULT_HEIGHT;
7
9
  private ezPopoverElement;
8
10
  private ezMultiSelectionList;
9
11
  applyFilterColumnOptions: EventEmitter<IAppliedFilterColumnOptions>;
10
12
  opened: boolean;
11
13
  columnName: string;
12
14
  columnLabel: string;
15
+ gridHeaderHidden: boolean;
13
16
  dataSource: IMultiSelectionListDataSource;
14
17
  dataUnit: DataUnit;
15
18
  options: IMultiSelectionOption[];
@@ -22,6 +25,7 @@ export declare class FilterColumn {
22
25
  * @Params IFilterColumnConfigs informações para configurar o filtro
23
26
  */
24
27
  show(configs: IFilterColumnConfigs): Promise<void>;
28
+ private calcTopPosition;
25
29
  private clearConfigs;
26
30
  private canShow;
27
31
  private submit;
@@ -1,10 +1,11 @@
1
+ import { PaginationInfo } from "@sankhyalabs/core";
1
2
  import { FunctionalComponent } from "../../../stencil-public-runtime";
2
3
  interface SelectionCounterProps {
3
4
  selectionCount: number;
4
- total: number;
5
5
  allRecordSelected: boolean;
6
6
  currentPageSelected: boolean;
7
- hasPagination: boolean;
7
+ canSelectAll: boolean;
8
+ paginationInfo: PaginationInfo;
8
9
  onSelectAll: () => void;
9
10
  onSelectPage: () => void;
10
11
  onClearAll: () => void;
@@ -17,8 +17,8 @@ import { IDropdownItem, IDropdownSubAction } from "./components/ez-dropdown/stru
17
17
  import { IFormConfig, IRecordValidator } from "./utils/form/interfaces";
18
18
  import { IFormViewField } from "./components/ez-form-view/interfaces/IFormViewField";
19
19
  import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from "./components/ez-grid/controller/EzGridController";
20
+ import { ISelection, ISelectionToastConfig } from "./components/ez-grid/interfaces";
20
21
  import { IMultiSelectionListDataSource } from "./components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource";
21
- import { ISelection } from "./components/ez-grid/interfaces/ISelection";
22
22
  import { IGuideItem } from "./components/ez-guide-navigator/interfaces";
23
23
  import { ListGroup, ListItem, TListMode } from "./components/ez-list/ez-list";
24
24
  import { THeightMode } from "./components/ez-modal/ez-modal";
@@ -656,6 +656,10 @@ export namespace Components {
656
656
  * Aplica um filtro rápido.
657
657
  */
658
658
  "quickFilter": (term: string) => Promise<void>;
659
+ /**
660
+ * Configuração da seleção de grade no toast.
661
+ */
662
+ "selectionToastConfig": ISelectionToastConfig;
659
663
  /**
660
664
  * Endereço do servidor para obtenção dos dados.
661
665
  */
@@ -1434,6 +1438,7 @@ export namespace Components {
1434
1438
  "columnName": string;
1435
1439
  "dataSource": IMultiSelectionListDataSource;
1436
1440
  "dataUnit": DataUnit;
1441
+ "gridHeaderHidden": boolean;
1437
1442
  "hide": () => Promise<void>;
1438
1443
  "opened": boolean;
1439
1444
  "options": IMultiSelectionOption[];
@@ -2550,6 +2555,10 @@ declare namespace LocalJSX {
2550
2555
  * Emitido quando acontece a alteração de seleção de linhas.
2551
2556
  */
2552
2557
  "onEzSelectionChange"?: (event: EzGridCustomEvent<ISelection>) => void;
2558
+ /**
2559
+ * Configuração da seleção de grade no toast.
2560
+ */
2561
+ "selectionToastConfig"?: ISelectionToastConfig;
2553
2562
  /**
2554
2563
  * Endereço do servidor para obtenção dos dados.
2555
2564
  */
@@ -3219,6 +3228,7 @@ declare namespace LocalJSX {
3219
3228
  "columnName"?: string;
3220
3229
  "dataSource"?: IMultiSelectionListDataSource;
3221
3230
  "dataUnit"?: DataUnit;
3231
+ "gridHeaderHidden"?: boolean;
3222
3232
  "onApplyFilterColumnOptions"?: (event: FilterColumnCustomEvent<IAppliedFilterColumnOptions>) => void;
3223
3233
  "opened"?: boolean;
3224
3234
  "options"?: IMultiSelectionOption[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "5.4.2",
3
+ "version": "5.6.0",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e}from"./p-e318d280.js";import{UserInterface as s}from"@sankhyalabs/core";const o=window,l=new CustomEvent("onSubmitFilter",{detail:{showToast:!0}}),n=class{constructor(e){t(this,e),this.applyFilterColumnOptions=i(this,"applyFilterColumnOptions",7),this.TOP_POSITION="65px",this.opened=!0,this.columnName=void 0,this.columnLabel=void 0,this.dataSource=void 0,this.dataUnit=void 0,this.options=void 0,this.selectedItems=void 0,this.fieldDescriptor=void 0,this.useOptions=!1}async hide(){await this.ezPopoverElement.hide(),await this.clearConfigs()}async show(t){this.canShow(t)&&(await this.hide(),this.fieldDescriptor=this.dataUnit.getField(t.columnName),this.setOptions(t.filteredOptions),this.columnName=t.columnName,this.columnLabel=t.columnLabel,await this.ezPopoverElement.show(this.TOP_POSITION,t.leftPosition))}async clearConfigs(){var t;await(null===(t=this.ezMultiSelectionList)||void 0===t?void 0:t.clearFilteredOptions()),this.options=null,this.columnName=null}canShow(t){return!this.ezPopoverElement.opened||t.columnName!==this.columnName}submit(){this.applyFilterColumnOptions.emit({field:this.columnName,values:this.selectedItems}),o.dispatchEvent(l),this.hide()}changeSelectedItems(t){this.selectedItems=t}hasToUseOptions(){return this.fieldDescriptor.userInterface===s.OPTIONSELECTOR||this.fieldDescriptor.userInterface===s.SWITCH||this.fieldDescriptor.userInterface===s.CHECKBOX}isCheckBoxOrSwitch(){return this.fieldDescriptor.userInterface===s.SWITCH||this.fieldDescriptor.userInterface===s.CHECKBOX}setOptions(t){const i=this.hasToUseOptions();this.useOptions=i,this.options=i?this.buildOptions(t):null!=t?t:null}buildOptions(t){var i,e;if(t&&t.length>0)return t;if(this.isCheckBoxOrSwitch())return[{label:"Sim",value:"true",check:!0},{label:"Não",value:"false",check:!0}];const s=JSON.parse(null===(e=null===(i=this.fieldDescriptor)||void 0===i?void 0:i.properties)||void 0===e?void 0:e.options);return Object.keys(s).map((t=>({label:s[t],value:t,check:!0})))}handleEzVisibilityChange(t){!1===t.detail&&this.clearConfigs()}render(){return e("ez-popover",{class:"filter-column__popover","overlay-type":"none",ref:t=>this.ezPopoverElement=t,autoClose:!0,onEzVisibilityChange:this.handleEzVisibilityChange.bind(this)},e("section",{class:"filter-column"},e("header",{class:"filter-column__header"},e("span",{class:"ez-text ez-text--medium filter-column__header-title"},"Filtro da coluna ",this.columnLabel),e("ez-button",{mode:"icon","icon-name":"close",class:"ez-button--tertiary",onClick:()=>this.hide()})),e("ez-multi-selection-list",{columnName:this.columnName,dataSource:this.dataSource,options:this.options,useOptions:this.useOptions,ref:t=>this.ezMultiSelectionList=t,onChangeFilteredOptions:t=>this.changeSelectedItems(t.detail)}),e("footer",{class:"filter-column__footer"},e("ez-button",{label:"Aplicar",class:"ez-button--primary",onClick:this.submit.bind(this)}))))}};n.style=".filter-column{padding:var(--space--2xs, 8px);position:relative}.filter-column__header{margin-bottom:var(--space--2xs, 8px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:var(--space--xl, 32px)}.filter-column__footer{position:relative;display:flex;flex-direction:row;justify-content:flex-end;align-items:center;width:100%;bottom:0;left:0;padding-top:var(--space--2xs, 8px);border-top:var(--border--medium) var(--color--disable-secondary)}.filter-column__popover{position:absolute}.filter-column__header-title{margin-left:8px}";export{n as filter_column}