@sankhyalabs/sankhyablocks 1.1.24 → 1.1.25
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/dist/cjs/ApplicationUtils-05b74ee9.js +39 -0
- package/dist/cjs/AssetsUtils-7e3c38f9.js +24 -0
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
- package/dist/cjs/ez-form.cjs.entry.js +463 -0
- package/dist/cjs/ez-grid.cjs.entry.js +647 -0
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
- package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +120 -0
- package/dist/cjs/ez-popup.cjs.entry.js +48 -0
- package/dist/cjs/ez-search.cjs.entry.js +64 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
- package/dist/cjs/ez-toast.cjs.entry.js +44 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/index-682c98b2.js +1771 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +6 -41
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +36 -1
- package/dist/collection/components/snk-application/snk-application.js +2 -1
- package/dist/{collection/temp → components}/ApplicationUtils.js +37 -36
- package/dist/components/AssetsUtils.js +22 -0
- package/dist/components/CSSVarsUtils.js +17 -0
- package/dist/components/ez-action-chip.js +44 -0
- package/dist/components/ez-application.js +39 -0
- package/dist/components/ez-button.js +6 -0
- package/dist/components/ez-button2.js +105 -0
- package/dist/components/ez-calendar.js +6 -0
- package/dist/components/ez-calendar2.js +242 -0
- package/dist/components/ez-check.js +6 -0
- package/dist/components/ez-check2.js +94 -0
- package/dist/components/ez-collapsible-box.js +67 -0
- package/dist/components/ez-combo-box.js +6 -0
- package/dist/components/ez-combo-box2.js +311 -0
- package/dist/components/ez-date-input.js +135 -0
- package/dist/components/ez-date-time-input.js +179 -0
- package/dist/components/ez-dialog.js +124 -0
- package/dist/components/ez-form.js +6 -0
- package/dist/components/ez-form2.js +485 -0
- package/dist/components/ez-grid.js +738 -0
- package/dist/components/ez-icon.js +6 -0
- package/dist/components/ez-icon2.js +56 -0
- package/dist/components/ez-label-chip.js +125 -0
- package/dist/components/ez-list.js +6 -0
- package/dist/components/ez-list2.js +523 -0
- package/dist/components/ez-modal.js +6 -0
- package/dist/components/ez-modal2.js +82 -0
- package/dist/components/ez-number-input.js +115 -0
- package/dist/components/ez-popover.js +145 -0
- package/dist/components/ez-popup.js +67 -0
- package/dist/components/ez-search.js +100 -0
- package/dist/components/ez-tabselector.js +6 -0
- package/dist/components/ez-tabselector2.js +213 -0
- package/dist/components/ez-text-area.js +137 -0
- package/dist/components/ez-text-input.js +6 -0
- package/dist/components/ez-text-input2.js +223 -0
- package/dist/components/ez-time-input.js +153 -0
- package/dist/components/ez-toast.js +64 -0
- package/dist/components/ez-upload.js +382 -0
- package/dist/components/grid-config.js +6 -0
- package/dist/components/grid-config2.js +318 -0
- package/dist/components/select-box.js +6 -0
- package/dist/components/select-box2.js +47 -0
- package/dist/components/snk-application.js +1 -36
- package/dist/components/test-du.js +101 -0
- package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
- package/dist/esm/AssetsUtils-6e6624dc.js +22 -0
- package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +23 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_4.entry.js +653 -0
- package/dist/esm/ez-calendar.entry.js +219 -0
- package/dist/esm/ez-collapsible-box.entry.js +43 -0
- package/dist/esm/ez-combo-box.entry.js +274 -0
- package/dist/esm/ez-date-input.entry.js +98 -0
- package/dist/esm/ez-date-time-input.entry.js +141 -0
- package/dist/esm/ez-dialog.entry.js +85 -0
- package/dist/esm/ez-form.entry.js +459 -0
- package/dist/esm/ez-grid.entry.js +643 -0
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/ez-label-chip.entry.js +100 -0
- package/dist/esm/ez-modal_2.entry.js +311 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +116 -0
- package/dist/esm/ez-popup.entry.js +44 -0
- package/dist/esm/ez-search.entry.js +60 -0
- package/dist/esm/ez-tabselector.entry.js +194 -0
- package/dist/esm/ez-text-area.entry.js +110 -0
- package/dist/esm/ez-text-input.entry.js +197 -0
- package/dist/esm/ez-time-input.entry.js +114 -0
- package/dist/esm/ez-toast.entry.js +40 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/index-35088a3f.js +1740 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +2 -37
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/sankhyablocks/p-0183d259.entry.js +1 -0
- package/dist/sankhyablocks/p-01f23a70.entry.js +1 -0
- package/dist/sankhyablocks/p-07c32f68.entry.js +1 -0
- package/dist/sankhyablocks/p-0f90499d.entry.js +1 -0
- package/dist/sankhyablocks/p-105724a3.entry.js +1 -0
- package/dist/sankhyablocks/p-2ac02d48.entry.js +1 -0
- package/dist/sankhyablocks/p-35364a97.entry.js +1 -0
- package/dist/sankhyablocks/p-3f6aa9a7.entry.js +1 -0
- package/dist/sankhyablocks/p-5f9af495.entry.js +1 -0
- package/dist/sankhyablocks/p-60967cf0.js +1 -0
- package/dist/sankhyablocks/p-6ce33b60.entry.js +57 -0
- package/dist/sankhyablocks/p-70ad6c16.entry.js +1 -0
- package/dist/sankhyablocks/p-710bfffe.entry.js +1 -0
- package/dist/sankhyablocks/p-735440c1.entry.js +1 -0
- package/dist/sankhyablocks/p-811b4b9d.js +1 -0
- package/dist/sankhyablocks/p-813fe4f7.js +1 -0
- package/dist/sankhyablocks/p-85a9446b.js +2 -0
- package/dist/sankhyablocks/p-89a1100f.entry.js +1 -0
- package/dist/sankhyablocks/p-8b543003.entry.js +1 -0
- package/dist/sankhyablocks/p-9750632b.entry.js +1 -0
- package/dist/sankhyablocks/p-a96272f7.entry.js +1 -0
- package/dist/sankhyablocks/p-ac8842e5.entry.js +1 -0
- package/dist/sankhyablocks/p-ba64cc41.entry.js +1 -0
- package/dist/sankhyablocks/p-c1ede043.entry.js +1 -0
- package/dist/sankhyablocks/p-d90ebb85.entry.js +1 -0
- package/dist/sankhyablocks/p-e17dfaae.entry.js +1 -0
- package/dist/sankhyablocks/p-e5355a29.entry.js +1 -0
- package/dist/sankhyablocks/p-ef04b633.entry.js +1 -0
- package/dist/sankhyablocks/p-f6db07fb.entry.js +1 -0
- package/dist/sankhyablocks/p-fcd9bd92.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +29 -0
- package/react/components.js +29 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-4720dab8.js +0 -735
- package/dist/esm/index-72d4e2e0.js +0 -709
- package/dist/sankhyablocks/p-45635e4f.entry.js +0 -57
- package/dist/sankhyablocks/p-a33afc3b.js +0 -2
- package/dist/types/temp/ApplicationUtils.d.ts +0 -11
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-682c98b2.js');
|
|
6
|
+
const agGridEnterprise = require('ag-grid-enterprise');
|
|
7
|
+
const agGridCommunity = require('ag-grid-community');
|
|
8
|
+
const core = require('@sankhyalabs/core');
|
|
9
|
+
const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
|
10
|
+
|
|
11
|
+
const gridTerms = {
|
|
12
|
+
// for filter panel
|
|
13
|
+
page: "Página",
|
|
14
|
+
more: "mais",
|
|
15
|
+
to: "para",
|
|
16
|
+
of: "de",
|
|
17
|
+
next: "Próximo",
|
|
18
|
+
last: "Último",
|
|
19
|
+
first: "Primeiro",
|
|
20
|
+
previous: "Anterior",
|
|
21
|
+
loadingOoo: "Carregar",
|
|
22
|
+
// for set filter
|
|
23
|
+
selectAll: "Selecionar tudo",
|
|
24
|
+
searchOoo: "Procurar",
|
|
25
|
+
blanks: "Vazio",
|
|
26
|
+
// for number filter and text filter
|
|
27
|
+
filterOoo: "Filtrar",
|
|
28
|
+
applyFilter: "Aplicar filtro",
|
|
29
|
+
// for number filter
|
|
30
|
+
equals: "Igual",
|
|
31
|
+
lessThan: "Menor que",
|
|
32
|
+
greaterThan: "Maior que",
|
|
33
|
+
// for text filter
|
|
34
|
+
contains: "Contém",
|
|
35
|
+
startsWith: "Começa com",
|
|
36
|
+
endsWith: "Termina com",
|
|
37
|
+
// the header of the default group column
|
|
38
|
+
group: "Grupo",
|
|
39
|
+
// tool panel
|
|
40
|
+
columns: "Colunas",
|
|
41
|
+
rowGroupColumns: "Colunas do grupo de linhas",
|
|
42
|
+
rowGroupColumnsEmptyMessage: "Colunas do grupo de linhas vazias",
|
|
43
|
+
valueColumns: "Valores das colunas",
|
|
44
|
+
pivotMode: "Modo pivô",
|
|
45
|
+
groups: "Grupos",
|
|
46
|
+
values: "Valores",
|
|
47
|
+
pivots: "Pivôs",
|
|
48
|
+
valueColumnsEmptyMessage: "Valores de colunas vazias",
|
|
49
|
+
pivotColumnsEmptyMessage: "Pivôs de colunas vazias",
|
|
50
|
+
toolPanelButton: "Botão de painel de ferramentas",
|
|
51
|
+
// other
|
|
52
|
+
noRowsToShow: "Não há registros para mostrar.",
|
|
53
|
+
// enterprise menu
|
|
54
|
+
pinColumn: "Fixar coluna",
|
|
55
|
+
valueAggregation: "Agregar valor",
|
|
56
|
+
autosizeThiscolumn: "Redimensionar esta coluna",
|
|
57
|
+
autosizeAllColumns: "Redimensionar todas colunas",
|
|
58
|
+
groupBy: "Agrupar por",
|
|
59
|
+
ungroupBy: "Desagrupar por",
|
|
60
|
+
resetColumns: "Resetar colunas",
|
|
61
|
+
expandAll: "Expandir tudo",
|
|
62
|
+
collapseAll: "Contrair tudo",
|
|
63
|
+
toolPanel: "Painel de ferramentas",
|
|
64
|
+
export: "Exportar",
|
|
65
|
+
csvExport: "Exportar para CSV",
|
|
66
|
+
excelExport: "Exportar para Excel",
|
|
67
|
+
// enterprise menu pinning
|
|
68
|
+
pinLeft: "Fixar coluna",
|
|
69
|
+
pinRight: "Fixar a direita",
|
|
70
|
+
noPin: "Desfixar coluna",
|
|
71
|
+
// enterprise menu aggregation and status panel
|
|
72
|
+
sum: "Soma",
|
|
73
|
+
min: "Mínimo",
|
|
74
|
+
max: "Máximo",
|
|
75
|
+
none: "Nenhum",
|
|
76
|
+
count: "Contagem",
|
|
77
|
+
average: "Média",
|
|
78
|
+
// standard menu
|
|
79
|
+
copy: "Copiar",
|
|
80
|
+
copyWithHeaders: "Copiar com cabeçalho",
|
|
81
|
+
ctrlC: "Ctrl+C",
|
|
82
|
+
paste: "Colar",
|
|
83
|
+
ctrlV: "Ctrl+V"
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation">
|
|
87
|
+
<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
|
|
88
|
+
<div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
|
|
89
|
+
<span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
|
|
90
|
+
<span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon" aria-hidden="true"></span>
|
|
91
|
+
<span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon" aria-hidden="true"></span>
|
|
92
|
+
<span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon" aria-hidden="true"></span>
|
|
93
|
+
<span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon" aria-hidden="true"></span>
|
|
94
|
+
</div>
|
|
95
|
+
</div>`;
|
|
96
|
+
|
|
97
|
+
class Server {
|
|
98
|
+
constructor(data) {
|
|
99
|
+
this._data = data;
|
|
100
|
+
}
|
|
101
|
+
getData(request) {
|
|
102
|
+
const finalArray = this.sort(this.filter(this._data, request), request);
|
|
103
|
+
return { rowData: finalArray.slice(request.startRow, request.endRow), rowCount: finalArray.length };
|
|
104
|
+
}
|
|
105
|
+
filter(data, _request) {
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
sort(data, _request) {
|
|
109
|
+
return data;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/* alasql.options.cache = false;
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
getData: function (request) {
|
|
116
|
+
var results = executeQuery(request);
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
success: true,
|
|
120
|
+
rows: results,
|
|
121
|
+
lastRow: getLastRowIndex(request, results),
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
function executeQuery(request) {
|
|
127
|
+
var sql = buildSql(request);
|
|
128
|
+
|
|
129
|
+
console.log("[FakeServer] - about to execute query:", sql);
|
|
130
|
+
|
|
131
|
+
return alasql(sql, [allData]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function buildSql(request) {
|
|
135
|
+
return "SELECT * FROM ?" + orderBySql(request) + limitSql(request);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function orderBySql(request) {
|
|
139
|
+
var sortModel = request.sortModel;
|
|
140
|
+
|
|
141
|
+
if (sortModel.length === 0) return "";
|
|
142
|
+
|
|
143
|
+
var sorts = sortModel.map(function (s) {
|
|
144
|
+
return s.colId + " " + s.sort.toUpperCase();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return " ORDER BY " + sorts.join(", ");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function limitSql(request) {
|
|
151
|
+
var blockSize = request.endRow - request.startRow;
|
|
152
|
+
|
|
153
|
+
return " LIMIT " + (blockSize + 1) + " OFFSET " + request.startRow;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function getLastRowIndex(request, results) {
|
|
157
|
+
if (!results || results.length === 0) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var currentLastRow = request.startRow + results.length;
|
|
162
|
+
|
|
163
|
+
return currentLastRow <= request.endRow ? currentLastRow : -1;
|
|
164
|
+
}
|
|
165
|
+
}*/
|
|
166
|
+
|
|
167
|
+
class DataSource {
|
|
168
|
+
constructor(dataUnit, serverURL) {
|
|
169
|
+
this._dataUnit = dataUnit;
|
|
170
|
+
this._serverURL = serverURL;
|
|
171
|
+
}
|
|
172
|
+
getRows(params) {
|
|
173
|
+
if (this._useMockedServer) {
|
|
174
|
+
if (this._mockedServer === undefined) {
|
|
175
|
+
this.loadData()
|
|
176
|
+
.then(data => {
|
|
177
|
+
this._mockedServer = new Server(data.rowData);
|
|
178
|
+
params.success(this._mockedServer.getData(params.request));
|
|
179
|
+
})
|
|
180
|
+
.catch(() => params.fail());
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
params.success(this._mockedServer.getData(params.request));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.loadData()
|
|
188
|
+
.then(data => params.success(data))
|
|
189
|
+
.catch(() => params.fail());
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
loadData() {
|
|
193
|
+
return new Promise((resolve, reject) => {
|
|
194
|
+
if (this._dataUnit) {
|
|
195
|
+
this._dataUnit.loadData().then(rowData => resolve({ rowData, rowCount: rowData.length }));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
fetch(this._serverURL)
|
|
199
|
+
.then(response => {
|
|
200
|
+
response.json().then(rowData => resolve({ rowData }));
|
|
201
|
+
})
|
|
202
|
+
.catch(() => reject());
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
class AgGridController {
|
|
209
|
+
constructor(enterprise) {
|
|
210
|
+
this._menuItems = [];
|
|
211
|
+
this._enterprise = enterprise;
|
|
212
|
+
}
|
|
213
|
+
getSort() {
|
|
214
|
+
const sortedColumns = [];
|
|
215
|
+
this._gridOptions.api.getSortModel().forEach(({ colId, sort }) => {
|
|
216
|
+
if (sort) {
|
|
217
|
+
const field = this._dataUnit.getField(colId);
|
|
218
|
+
const mode = sort === "asc" ? UnitMetadata.SortMode.ASC : UnitMetadata.SortMode.DESC;
|
|
219
|
+
const sortField = field ? { field: field.name, dataType: field.dataType, mode } : { field: colId, dataType: core.DataType.TEXT, mode };
|
|
220
|
+
sortedColumns.push(sortField);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return sortedColumns;
|
|
224
|
+
}
|
|
225
|
+
;
|
|
226
|
+
initDatagrid(container, options) {
|
|
227
|
+
if (this._grid === undefined) {
|
|
228
|
+
this._columnStateChangeCallback = options.onColumnStateChange;
|
|
229
|
+
this._selectionChangeCallback = options.onSelectionChange;
|
|
230
|
+
this._paginationChangeCallback = options.onPaginationChange;
|
|
231
|
+
this._doubleClickCallBack = options.onDoubleClick;
|
|
232
|
+
this._multipleSelection = options.allowMultipleSelection;
|
|
233
|
+
this._pageSize = options.pageSize;
|
|
234
|
+
this._serverURL = options.serverURL;
|
|
235
|
+
this._dataUnit = options.dataUnit;
|
|
236
|
+
this._dataUnit.sortingProvider = this;
|
|
237
|
+
this._gridOptions = {
|
|
238
|
+
localeText: gridTerms,
|
|
239
|
+
rowModelType: "serverSide",
|
|
240
|
+
serverSideStoreType: "partial",
|
|
241
|
+
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
242
|
+
serverSideDatasource: new DataSource(this._dataUnit, this._serverURL),
|
|
243
|
+
getRowNodeId: (params) => params.__record__id__,
|
|
244
|
+
getMainMenuItems: (params) => {
|
|
245
|
+
const column = params.column;
|
|
246
|
+
const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
|
|
247
|
+
this._menuItems.forEach(m => items.push({
|
|
248
|
+
name: m.label,
|
|
249
|
+
action: () => m.action(column.getColId(), m.name)
|
|
250
|
+
}));
|
|
251
|
+
return items;
|
|
252
|
+
},
|
|
253
|
+
onViewportChanged: (evt) => {
|
|
254
|
+
if (this._gridOptions && this._gridOptions.api && evt && evt.api) {
|
|
255
|
+
if (this._dataUnit.getSelection()) {
|
|
256
|
+
this._dataUnit.getSelection().forEach(id => {
|
|
257
|
+
let node = evt.api.getRowNode(id);
|
|
258
|
+
node.setSelected(true);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
this.setOptionsEvents(this._gridOptions);
|
|
265
|
+
this.setOptionsPagination(this._gridOptions);
|
|
266
|
+
this.setOptionsSupress(this._gridOptions);
|
|
267
|
+
if (this._enterprise) {
|
|
268
|
+
this._grid = new agGridEnterprise.Grid(container, this._gridOptions);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
this._grid = new agGridCommunity.Grid(container, this._gridOptions);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
setOptionsEvents(opt) {
|
|
276
|
+
opt.onSortChanged = e => this.onCallStateChange("sort", e);
|
|
277
|
+
opt.onColumnResized = e => this.onCallStateChange("columnResize", e);
|
|
278
|
+
opt.onColumnPinned = e => this.onCallStateChange("columnPinned", e);
|
|
279
|
+
opt.onColumnMoved = e => this.onCallStateChange("columnMoved", e);
|
|
280
|
+
opt.onColumnVisible = e => this.onCallStateChange("visibleChange", e);
|
|
281
|
+
opt.onSelectionChanged = e => this.onSelectionChange(e);
|
|
282
|
+
opt.onPaginationChanged = () => this.onPaginationChange();
|
|
283
|
+
opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
|
|
284
|
+
}
|
|
285
|
+
setOptionsPagination(opt) {
|
|
286
|
+
opt.pagination = (this._pageSize > -1);
|
|
287
|
+
opt.paginationPageSize = this._pageSize;
|
|
288
|
+
opt.cacheBlockSize = this._pageSize;
|
|
289
|
+
}
|
|
290
|
+
setOptionsSupress(opt) {
|
|
291
|
+
opt.suppressDragLeaveHidesColumns = true;
|
|
292
|
+
opt.suppressPaginationPanel = true;
|
|
293
|
+
opt.suppressMenuHide = true;
|
|
294
|
+
}
|
|
295
|
+
setData(data) {
|
|
296
|
+
if (this._grid === undefined) {
|
|
297
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
298
|
+
}
|
|
299
|
+
this._gridOptions.api.setRowData(data);
|
|
300
|
+
}
|
|
301
|
+
refresh() {
|
|
302
|
+
if (this._grid === undefined) {
|
|
303
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
304
|
+
}
|
|
305
|
+
this._gridOptions.api.refreshServerSideStore({ purge: false });
|
|
306
|
+
}
|
|
307
|
+
setColumnsDef(cols, showCheckSelection) {
|
|
308
|
+
if (this._grid === undefined) {
|
|
309
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
310
|
+
}
|
|
311
|
+
const colDefs = [];
|
|
312
|
+
if (showCheckSelection) {
|
|
313
|
+
colDefs.push({
|
|
314
|
+
headerName: "",
|
|
315
|
+
checkboxSelection: true,
|
|
316
|
+
headerCheckboxSelection: false,
|
|
317
|
+
width: 28,
|
|
318
|
+
suppressMovable: true,
|
|
319
|
+
suppressAutoSize: true,
|
|
320
|
+
suppressMenu: true,
|
|
321
|
+
lockPosition: true
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
cols.forEach(c => {
|
|
325
|
+
colDefs.push(this.buildColDef(c));
|
|
326
|
+
});
|
|
327
|
+
this._gridOptions.api.setColumnDefs(colDefs);
|
|
328
|
+
}
|
|
329
|
+
getColumnsDef() {
|
|
330
|
+
if (this._grid === undefined) {
|
|
331
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
332
|
+
}
|
|
333
|
+
const colDef = this._gridOptions.columnApi.getAllColumns();
|
|
334
|
+
return colDef.map(c => {
|
|
335
|
+
const def = c.getColDef();
|
|
336
|
+
const colDef = { name: def.field, label: def.headerName };
|
|
337
|
+
this.conditionalSet(colDef, "sortable", def.sortable);
|
|
338
|
+
this.conditionalSet(colDef, "resizable", def.resizable);
|
|
339
|
+
this.conditionalSet(colDef, "sort", def.sort);
|
|
340
|
+
this.conditionalSet(colDef, "sortIndex", def.sortIndex);
|
|
341
|
+
this.conditionalSet(colDef, "width", def.width);
|
|
342
|
+
this.conditionalSet(colDef, "pinned", def.pinned !== null);
|
|
343
|
+
this.conditionalSet(colDef, "hidden", def.hide);
|
|
344
|
+
return colDef;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
setColumnsState(state) {
|
|
348
|
+
if (this._grid === undefined) {
|
|
349
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
350
|
+
}
|
|
351
|
+
//TODO neste ponto estamos utilizando um método descontinuado,
|
|
352
|
+
//pelo fato de que o applyColumnState não reordena as colunas conforme
|
|
353
|
+
//o estado passado.
|
|
354
|
+
//https://stackoverflow.com/questions/51488241/ag-grid-how-to-save-and-reload-column-order
|
|
355
|
+
//Assim que for corrigido o applyColumnState devemos substituir o setColumnState por ele.
|
|
356
|
+
// this._gridOptions.columnApi.applyColumnState({ state: state.map(s => this.buildColState(s)) });
|
|
357
|
+
this._gridOptions.columnApi.setColumnState(state.map(s => this.buildColState(s)));
|
|
358
|
+
}
|
|
359
|
+
getColumnsState() {
|
|
360
|
+
if (this._grid === undefined) {
|
|
361
|
+
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
362
|
+
}
|
|
363
|
+
const colState = this._gridOptions.columnApi.getColumnState();
|
|
364
|
+
return colState.map(s => {
|
|
365
|
+
const def = this._gridOptions.columnApi.getColumn(s.colId).getColDef();
|
|
366
|
+
const label = def.headerName;
|
|
367
|
+
const name = def.checkboxSelection ? "__SELECTION__" : s.colId;
|
|
368
|
+
const colState = { label, name };
|
|
369
|
+
this.conditionalSet(colState, "sort", s.sort);
|
|
370
|
+
this.conditionalSet(colState, "sortIndex", s.sortIndex);
|
|
371
|
+
this.conditionalSet(colState, "width", s.width);
|
|
372
|
+
this.conditionalSet(colState, "pinned", s.pinned !== null);
|
|
373
|
+
this.conditionalSet(colState, "hidden", s.hide);
|
|
374
|
+
return colState;
|
|
375
|
+
}).filter(c => c.name !== "__SELECTION__");
|
|
376
|
+
}
|
|
377
|
+
getSelection() {
|
|
378
|
+
return this._gridOptions.api.getSelectedRows();
|
|
379
|
+
}
|
|
380
|
+
addColumnMenuItem(item) {
|
|
381
|
+
this._menuItems.push(item);
|
|
382
|
+
}
|
|
383
|
+
nextPage() {
|
|
384
|
+
this._gridOptions.api.paginationGoToNextPage();
|
|
385
|
+
}
|
|
386
|
+
previousPage() {
|
|
387
|
+
this._gridOptions.api.paginationGoToPreviousPage();
|
|
388
|
+
}
|
|
389
|
+
buildColDef(source) {
|
|
390
|
+
return {
|
|
391
|
+
headerName: source.label,
|
|
392
|
+
field: source.name,
|
|
393
|
+
sortable: true,
|
|
394
|
+
resizable: true,
|
|
395
|
+
headerComponentParams: {
|
|
396
|
+
template: HeaderColumnTemplate
|
|
397
|
+
},
|
|
398
|
+
valueFormatter: params => {
|
|
399
|
+
return this.getFormatterByColumn(params, source);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
getFormatterByColumn(params, source) {
|
|
404
|
+
var _a, _b;
|
|
405
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === "OPTIONSELECTOR" && source.options) {
|
|
406
|
+
const prop = source === null || source === void 0 ? void 0 : source.options;
|
|
407
|
+
let options;
|
|
408
|
+
if (typeof prop === "string") {
|
|
409
|
+
const parsed = JSON.parse(prop);
|
|
410
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
options = prop;
|
|
414
|
+
}
|
|
415
|
+
let optionSelected;
|
|
416
|
+
options.forEach((option) => {
|
|
417
|
+
if (option.value == params.value) {
|
|
418
|
+
optionSelected = option;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
|
|
422
|
+
}
|
|
423
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
|
|
424
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
|
|
425
|
+
return "Sim";
|
|
426
|
+
}
|
|
427
|
+
else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
|
|
428
|
+
return "Não";
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
|
|
432
|
+
if (params.value !== undefined) {
|
|
433
|
+
return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
if ((source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UnitMetadata.UserInterface.DATETIME) {
|
|
437
|
+
if (params.value !== undefined) {
|
|
438
|
+
return params.value.toLocaleDateString();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
buildColState(source) {
|
|
443
|
+
return {
|
|
444
|
+
colId: source.name,
|
|
445
|
+
sort: source.sort,
|
|
446
|
+
sortIndex: source.sortIndex,
|
|
447
|
+
width: source.width,
|
|
448
|
+
pinned: source.pinned ? "left" : null,
|
|
449
|
+
hide: source.hidden
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
onCallStateChange(type, e) {
|
|
453
|
+
const finished = !("finished" in e) || e["finished"];
|
|
454
|
+
if (finished && this._columnStateChangeCallback) {
|
|
455
|
+
this._columnStateChangeCallback(type, this.getColumnsState());
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
onSelectionChange(e) {
|
|
459
|
+
if (this._selectionChangeCallback) {
|
|
460
|
+
this._selectionChangeCallback(e.api.getSelectedRows());
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
onPaginationChange() {
|
|
464
|
+
if (this._paginationChangeCallback) {
|
|
465
|
+
if (this._gridOptions.api) {
|
|
466
|
+
const api = this._gridOptions.api;
|
|
467
|
+
const currentPage = api.paginationGetCurrentPage();
|
|
468
|
+
const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
|
|
469
|
+
const pageSize = api.paginationGetPageSize();
|
|
470
|
+
const totalRows = api.paginationGetRowCount();
|
|
471
|
+
const pageStart = currentPage * pageSize + 1;
|
|
472
|
+
const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
|
|
473
|
+
this._paginationChangeCallback({
|
|
474
|
+
hasPrevious: currentPage > 0,
|
|
475
|
+
hasNext: !isLastPage,
|
|
476
|
+
currentPage: currentPage + 1,
|
|
477
|
+
pageStart,
|
|
478
|
+
pageEnd,
|
|
479
|
+
totalRows
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
onRowDoubleClick(evt) {
|
|
485
|
+
if (this._doubleClickCallBack) {
|
|
486
|
+
this._doubleClickCallBack(evt.data);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
conditionalSet(host, attribute, value) {
|
|
490
|
+
if (value !== null && value !== undefined && value !== false) {
|
|
491
|
+
host[attribute] = value;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
class DataUnitBridge {
|
|
497
|
+
constructor(gridController, dataUnit) {
|
|
498
|
+
this._gridController = gridController;
|
|
499
|
+
this._dataUnit = dataUnit;
|
|
500
|
+
this._dataUnit.subscribe(action => this.processAction(action));
|
|
501
|
+
}
|
|
502
|
+
processAction(action) {
|
|
503
|
+
switch (action.type) {
|
|
504
|
+
case core.Action.METADATA_LOADED:
|
|
505
|
+
this._gridController.setColumnsDef(this.buildColumnDefs(), true);
|
|
506
|
+
break;
|
|
507
|
+
case core.Action.RECORDS_REMOVED:
|
|
508
|
+
case core.Action.EDITION_CANCELED:
|
|
509
|
+
case core.Action.RECORDS_ADDED:
|
|
510
|
+
case core.Action.RECORDS_COPIED:
|
|
511
|
+
case core.Action.DATA_SAVED:
|
|
512
|
+
this._gridController.refresh();
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
buildColumnDefs() {
|
|
517
|
+
const columnDefs = [];
|
|
518
|
+
if (this._dataUnit.metadata) {
|
|
519
|
+
this._dataUnit.metadata.fields.forEach(f => {
|
|
520
|
+
var _a;
|
|
521
|
+
if (f.visible !== false) {
|
|
522
|
+
columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options });
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
return columnDefs;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ezgrid__header--background-color:var(--background--xlight, #FFF)}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ezgrid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{box-shadow:0 0 16px 0 rgb(0 38 111 / 12%);padding-top:15px;margin-top:-12px;background-color:var(--ezgrid__header--background-color)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}";
|
|
531
|
+
|
|
532
|
+
const EzGrid = class {
|
|
533
|
+
constructor(hostRef) {
|
|
534
|
+
index.registerInstance(this, hostRef);
|
|
535
|
+
this.ezColumnStateChange = index.createEvent(this, "ezColumnStateChange", 7);
|
|
536
|
+
this.ezSelectionChange = index.createEvent(this, "ezSelectionChange", 7);
|
|
537
|
+
this.ezDoubleClick = index.createEvent(this, "ezDoubleClick", 7);
|
|
538
|
+
this._gridController = new AgGridController(false);
|
|
539
|
+
this._popUpVisible = false;
|
|
540
|
+
/**
|
|
541
|
+
* Determina o número de linhas de cada página. Caso informado o valor -1
|
|
542
|
+
* não haverá paginação.
|
|
543
|
+
*/
|
|
544
|
+
this.pageSize = -1;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Método responsável por receber a definição das colunas
|
|
548
|
+
*/
|
|
549
|
+
async setColumnsDef(cols) {
|
|
550
|
+
this._gridController.setColumnsDef(cols, this.multipleSelection);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Adiciona item de menu nas colunas.
|
|
554
|
+
*/
|
|
555
|
+
async addColumnMenuItem(label, name, action) {
|
|
556
|
+
this._gridController.addColumnMenuItem({ label, name, action });
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Método responsável por aplicar estado pré-existente nas colunas do grid.
|
|
560
|
+
*/
|
|
561
|
+
async setColumnsState(state) {
|
|
562
|
+
this._gridController.setColumnsState(state);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Método de carga dos registros. Os objetos deste array devem conter atributos
|
|
566
|
+
* para as colunas desejadas.
|
|
567
|
+
*/
|
|
568
|
+
async setData(data) {
|
|
569
|
+
this._gridController.setData(data);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Retorna as linhas selecionadas na grade.
|
|
573
|
+
*/
|
|
574
|
+
async getSelection() {
|
|
575
|
+
return Promise.resolve(this._gridController.getSelection());
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Método retornar o estado atual das colunas do grid.
|
|
579
|
+
*/
|
|
580
|
+
async getColumnsState() {
|
|
581
|
+
return Promise.resolve(this._gridController.getColumnsState());
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Método retornar o estado atual das colunas do grid.
|
|
585
|
+
*/
|
|
586
|
+
async getColumns() {
|
|
587
|
+
return Promise.resolve(this._gridController.getColumnsDef());
|
|
588
|
+
}
|
|
589
|
+
componentWillLoad() {
|
|
590
|
+
if (this.dataUnit) {
|
|
591
|
+
this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
|
|
592
|
+
addEventListener("ezSelectionChange", (evt) => this.dataUnit.setSelection(evt.detail.map((r) => r.__record__id__)));
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
componentDidLoad() {
|
|
596
|
+
this._gridController.initDatagrid(this._container, {
|
|
597
|
+
onColumnStateChange: (type, state) => this.ezColumnStateChange.emit({ type, state }),
|
|
598
|
+
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
599
|
+
onPaginationChange: (status) => {
|
|
600
|
+
this._navigationHasPrevious = status.hasPrevious;
|
|
601
|
+
this._navigationHasNext = status.hasNext;
|
|
602
|
+
this._navigationFirstRow = status.pageStart;
|
|
603
|
+
this._navigationLastRow = status.pageEnd;
|
|
604
|
+
this._navigationTotalRows = status.totalRows;
|
|
605
|
+
},
|
|
606
|
+
onDoubleClick: (row) => {
|
|
607
|
+
this.ezDoubleClick.emit(row);
|
|
608
|
+
},
|
|
609
|
+
allowMultipleSelection: this.multipleSelection,
|
|
610
|
+
pageSize: this.pageSize,
|
|
611
|
+
serverURL: this.serverUrl,
|
|
612
|
+
dataUnit: this.dataUnit
|
|
613
|
+
});
|
|
614
|
+
if (this._dataUnitBridge) {
|
|
615
|
+
this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
getPaginationControl() {
|
|
619
|
+
if (this.pageSize === -1) {
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
return [
|
|
623
|
+
index.h("div", { class: "text text--primary text--medium margin-right--medium" }, index.h("strong", { class: "text text--primary text--medium" }, `${this._navigationFirstRow}-${this._navigationLastRow}`), ` de ${this._navigationTotalRows}`),
|
|
624
|
+
index.h("ez-button", { size: "small", iconName: "chevron-left", class: "margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this._gridController.previousPage(), label: "P\u00E1gina anterior" }),
|
|
625
|
+
index.h("ez-button", { size: "small", iconName: "chevron-right", class: "margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this._gridController.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
|
|
626
|
+
];
|
|
627
|
+
}
|
|
628
|
+
applyConfig(cols) {
|
|
629
|
+
this._gridController.setColumnsState(cols);
|
|
630
|
+
this.closeConfig();
|
|
631
|
+
}
|
|
632
|
+
closeConfig() {
|
|
633
|
+
this._popUpVisible = false;
|
|
634
|
+
}
|
|
635
|
+
openConfig() {
|
|
636
|
+
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
637
|
+
this._gridConfig.selectedTab = "Colunas";
|
|
638
|
+
this._popUpVisible = true;
|
|
639
|
+
}
|
|
640
|
+
render() {
|
|
641
|
+
return (index.h(index.Host, null, index.h("div", { class: "box box--shadow padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl(), index.h("ez-button", { size: "small", iconName: "settings", class: "button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))), index.h("div", { class: "grid__container ag-sankhya-theme", ref: elem => this._container = elem }), index.h("div", { class: "grid__footer" }), index.h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false }, index.h("grid-config", { ref: ref => this._gridConfig = ref, selectedTab: "Colunas", onConfigFinish: evt => this.applyConfig(evt.detail), onConfigCancel: _evt => this.closeConfig() }))));
|
|
642
|
+
}
|
|
643
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
644
|
+
};
|
|
645
|
+
EzGrid.style = ezGridCss;
|
|
646
|
+
|
|
647
|
+
exports.ez_grid = EzGrid;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-682c98b2.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezIconCss = ":host{display:flex;overflow:hidden;position:relative;--ez-icon--color:var(--icon--color, #ffffff)}svg{display:flex;justify-content:center;align-items:center;fill:var(--ez-icon--color)}.x-small{width:12px;height:12px}.small{width:16px;height:16px}.medium{width:20px;height:20px}.large{width:24px;height:24px}.x-large{width:30px;height:30px}[class^=\"ez-icon-\"],[class*=\" ez-icon-\"]{color:var(--ez-icon--color)}[class^=\"ez-icon-\"],[class*=\" ez-icon-\"]{font-family:'ez-icons' !important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ez-icon-account-outline:before{content:\"\\ea01\"}.ez-icon-account:before{content:\"\\ea02\"}.ez-icon-alert-circle-inverted:before{content:\"\\ea03\"}.ez-icon-alert-circle:before{content:\"\\ea04\"}.ez-icon-alert-mail:before{content:\"\\ea05\"}.ez-icon-alert-outline:before{content:\"\\ea06\"}.ez-icon-alert-popup:before{content:\"\\ea07\"}.ez-icon-apps:before{content:\"\\ea08\"}.ez-icon-arrow_back:before{content:\"\\ea09\"}.ez-icon-bell-inverted:before{content:\"\\ea0a\"}.ez-icon-bell:before{content:\"\\ea0b\"}.ez-icon-business-center:before{content:\"\\ea0c\"}.ez-icon-calendar-text:before{content:\"\\ea0d\"}.ez-icon-calendar:before{content:\"\\ea0e\"}.ez-icon-check-circle-inverted:before{content:\"\\ea0f\"}.ez-icon-check-circle:before{content:\"\\ea10\"}.ez-icon-check:before{content:\"\\ea11\"}.ez-icon-chevron-down:before{content:\"\\ea12\"}.ez-icon-chevron-left:before{content:\"\\ea13\"}.ez-icon-chevron-right:before{content:\"\\ea14\"}.ez-icon-chevron-up:before{content:\"\\ea15\"}.ez-icon-circle--medium:before{content:\"\\ea16\"}.ez-icon-circle:before{content:\"\\ea17\"}.ez-icon-clipboard:before{content:\"\\ea18\"}.ez-icon-close-circle-inverted:before{content:\"\\ea19\"}.ez-icon-close-circle:before{content:\"\\ea1a\"}.ez-icon-close:before{content:\"\\ea1b\"}.ez-icon-comment-inverted:before{content:\"\\ea1c\"}.ez-icon-comment:before{content:\"\\ea1d\"}.ez-icon-configuration:before{content:\"\\ea1e\"}.ez-icon-copy:before{content:\"\\ea1f\"}.ez-icon-crop:before{content:\"\\ea20\"}.ez-icon-delete:before{content:\"\\ea21\"}.ez-icon-description:before{content:\"\\ea22\"}.ez-icon-dot-notification:before{content:\"\\ea23\"}.ez-icon-dots-horizontal:before{content:\"\\ea24\"}.ez-icon-dots-vertical:before{content:\"\\ea25\"}.ez-icon-drag-indicator:before{content:\"\\ea26\"}.ez-icon-edit-file:before{content:\"\\ea27\"}.ez-icon-edit-table:before{content:\"\\ea28\"}.ez-icon-edit-time:before{content:\"\\ea29\"}.ez-icon-edit:before{content:\"\\ea2a\"}.ez-icon-email-inverted:before{content:\"\\ea2b\"}.ez-icon-email:before{content:\"\\ea2c\"}.ez-icon-error-octagon:before{content:\"\\ea2d\"}.ez-icon-expand:before{content:\"\\ea2e\"}.ez-icon-eye-off:before{content:\"\\ea2f\"}.ez-icon-eye:before{content:\"\\ea30\"}.ez-icon-favorite:before{content:\"\\ea31\"}.ez-icon-file-download:before{content:\"\\ea32\"}.ez-icon-file-upload:before{content:\"\\ea33\"}.ez-icon-filter:before{content:\"\\ea34\"}.ez-icon-find-file:before{content:\"\\ea35\"}.ez-icon-find-page:before{content:\"\\ea36\"}.ez-icon-format-color-fill:before{content:\"\\ea37\"}.ez-icon-help-circle-outline:before{content:\"\\ea38\"}.ez-icon-help-inverted:before{content:\"\\ea39\"}.ez-icon-help:before{content:\"\\ea3a\"}.ez-icon-home:before{content:\"\\ea3b\"}.ez-icon-language:before{content:\"\\ea3c\"}.ez-icon-launch:before{content:\"\\ea3d\"}.ez-icon-lightbulb:before{content:\"\\ea3e\"}.ez-icon-list:before{content:\"\\ea3f\"}.ez-icon-loading:before{content:\"\\ea40\"}.ez-icon-lock-outline:before{content:\"\\ea41\"}.ez-icon-lock:before{content:\"\\ea42\"}.ez-icon-menu:before{content:\"\\ea43\"}.ez-icon-minus-circle-inverted:before{content:\"\\ea44\"}.ez-icon-minus:before{content:\"\\ea45\"}.ez-icon-money-off:before{content:\"\\ea46\"}.ez-icon-money:before{content:\"\\ea47\"}.ez-icon-north-west:before{content:\"\\ea48\"}.ez-icon-pause:before{content:\"\\ea49\"}.ez-icon-payments:before{content:\"\\ea4a\"}.ez-icon-play:before{content:\"\\ea4b\"}.ez-icon-plus-circle-inverted:before{content:\"\\ea4c\"}.ez-icon-plus-circle:before{content:\"\\ea4d\"}.ez-icon-plus:before{content:\"\\ea4e\"}.ez-icon-power:before{content:\"\\ea4f\"}.ez-icon-push-pin:before{content:\"\\ea50\"}.ez-icon-restore:before{content:\"\\ea51\"}.ez-icon-return:before{content:\"\\ea52\"}.ez-icon-rotate:before{content:\"\\ea53\"}.ez-icon-save:before{content:\"\\ea54\"}.ez-icon-search:before{content:\"\\ea55\"}.ez-icon-settings-inverted:before{content:\"\\ea56\"}.ez-icon-settings:before{content:\"\\ea57\"}.ez-icon-share:before{content:\"\\ea58\"}.ez-icon-shield:before{content:\"\\ea59\"}.ez-icon-south-east:before{content:\"\\ea5a\"}.ez-icon-success-circle:before{content:\"\\ea5b\"}.ez-icon-sync:before{content:\"\\ea5c\"}.ez-icon-table:before{content:\"\\ea5d\"}.ez-icon-timer-outline:before{content:\"\\ea5e\"}.ez-icon-user-circle:before{content:\"\\ea5f\"}.ez-icon-warning-minus:before{content:\"\\ea60\"}.ez-icon-warning-triangle:before{content:\"\\ea61\"}.x-small--font{font-size:12px}.small--font{font-size:16px}.medium--font{font-size:20px}.large--font{font-size:24px}.x-large--font{font-size:30px}";
|
|
9
|
+
|
|
10
|
+
const EzIcon = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
/**
|
|
14
|
+
* Tamanho do ícone
|
|
15
|
+
*/
|
|
16
|
+
this.size = 'medium';
|
|
17
|
+
}
|
|
18
|
+
isSprite() {
|
|
19
|
+
return this.href && this.href.indexOf('#') > -1;
|
|
20
|
+
}
|
|
21
|
+
getIconClassName() {
|
|
22
|
+
return `ez-icon-${this.iconName}`;
|
|
23
|
+
}
|
|
24
|
+
getIconContent() {
|
|
25
|
+
if (this.isSprite()) {
|
|
26
|
+
return index.h("svg", { class: this.size, role: "img" }, index.h("use", { xlinkHref: this.href }));
|
|
27
|
+
}
|
|
28
|
+
else if (!core.StringUtils.isEmpty(this.iconName)) {
|
|
29
|
+
return index.h("span", { class: `icon-content ${this.getIconClassName()} ${this.size}--font` });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return index.h("img", { class: this.size, src: this.href });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h(index.Host, null, this.getIconContent()));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
EzIcon.style = ezIconCss;
|
|
40
|
+
|
|
41
|
+
exports.ez_icon = EzIcon;
|