@sankhyalabs/ezui 4.15.1 → 4.15.2

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.
@@ -137,7 +137,7 @@ export interface EzGridOptions {
137
137
  * Configuração do valor da coluna de status.
138
138
  * Exemplo: { "RECDESP": { "-1" : "#BD0025", "1" : "#157A00" } }
139
139
  */
140
- statusResolver: IStatusResolver;
140
+ statusResolver: IStatusResolver | StatusResolverFunction;
141
141
  }
142
142
  /**
143
143
  * Representa cada coluna da grade.
@@ -258,3 +258,4 @@ export interface EzGridColumnConfig {
258
258
  export interface IStatusResolver {
259
259
  [fieldName: string]: Map<String, any>;
260
260
  }
261
+ export type StatusResolverFunction = (data: object) => string;
@@ -1,9 +1,11 @@
1
1
  import { ICellRendererComp, ICellRendererParams } from "ag-grid-community";
2
- export declare class CellRenderer implements ICellRendererComp {
2
+ export declare class CellRendererStatus implements ICellRendererComp {
3
+ private readonly DEFAULT_COLOR;
3
4
  private _eGui;
4
5
  init(params: ICellRendererParams | any): void;
5
6
  refresh(params: ICellRendererParams | any): boolean;
6
7
  destroy(): void;
7
8
  getGui(): any;
9
+ private resolveColor;
8
10
  private renderStatus;
9
11
  }
@@ -1,6 +1,6 @@
1
1
  import { DataUnit } from "@sankhyalabs/core";
2
2
  import { EventEmitter } from "../../stencil-public-runtime";
3
- import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver } from "./controller/EzGridController";
3
+ import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from "./controller/EzGridController";
4
4
  import { ISelection } from "./interfaces/ISelection";
5
5
  export declare class EzGrid {
6
6
  private _container;
@@ -55,7 +55,7 @@ export declare class EzGrid {
55
55
  /**
56
56
  * Define um `IStatusResolver` responsável pelo estado da coluna de status.
57
57
  */
58
- statusResolver: IStatusResolver;
58
+ statusResolver: IStatusResolver | StatusResolverFunction;
59
59
  /**
60
60
  * Aplica a definição de colunas.
61
61
  */
@@ -16,7 +16,7 @@ import { DialogType } from "./components/ez-dialog/DialogType";
16
16
  import { IDropdownItem, IDropdownSubAction } from "./components/ez-dropdown/structure/DropdownItem";
17
17
  import { IFormConfig, IRecordValidator } from "./utils/form/interfaces";
18
18
  import { IFormViewField } from "./components/ez-form-view/interfaces/IFormViewField";
19
- import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver } from "./components/ez-grid/controller/EzGridController";
19
+ import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from "./components/ez-grid/controller/EzGridController";
20
20
  import { ISelection } from "./components/ez-grid/interfaces/ISelection";
21
21
  import { IGuideItem } from "./components/ez-guide-navigator/interfaces";
22
22
  import { ListGroup, ListItem, TListMode } from "./components/ez-list/ez-list";
@@ -655,7 +655,7 @@ export namespace Components {
655
655
  /**
656
656
  * Define um `IStatusResolver` responsável pelo estado da coluna de status.
657
657
  */
658
- "statusResolver": IStatusResolver;
658
+ "statusResolver": IStatusResolver | StatusResolverFunction;
659
659
  }
660
660
  interface EzGuideNavigator {
661
661
  /**
@@ -2463,7 +2463,7 @@ declare namespace LocalJSX {
2463
2463
  /**
2464
2464
  * Define um `IStatusResolver` responsável pelo estado da coluna de status.
2465
2465
  */
2466
- "statusResolver"?: IStatusResolver;
2466
+ "statusResolver"?: IStatusResolver | StatusResolverFunction;
2467
2467
  }
2468
2468
  interface EzGuideNavigator {
2469
2469
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "4.15.1",
3
+ "version": "4.15.2",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",
@@ -1,31 +0,0 @@
1
- export class CellRenderer {
2
- constructor() {
3
- this._eGui = undefined;
4
- }
5
- init(params) {
6
- this.renderStatus(params);
7
- }
8
- refresh(params) {
9
- this.renderStatus(params);
10
- return true;
11
- }
12
- destroy() {
13
- this._eGui = undefined;
14
- }
15
- getGui() {
16
- return this._eGui;
17
- }
18
- renderStatus(params) {
19
- const statusResolver = params === null || params === void 0 ? void 0 : params.statusResolver;
20
- if (statusResolver != undefined) {
21
- const statusKey = Object.keys(statusResolver)[0];
22
- const statusValues = statusResolver[statusKey];
23
- const value = params === null || params === void 0 ? void 0 : params.data[statusKey];
24
- const color = statusValues != undefined && value != undefined && statusValues[value];
25
- this._eGui = document.createElement('div');
26
- this._eGui.innerHTML = `
27
- <span class="ez-grid__cell-status" style="background-color: ${color || ""};"></span>
28
- `;
29
- }
30
- }
31
- }