@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-52057.0 → 0.0.0-bugfix-dev-59880.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.
- package/dist/cjs/ICustomRender-6fafffce.js +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -0
- package/dist/cjs/ez-alert-list.cjs.entry.js +6 -4
- package/dist/cjs/ez-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -0
- package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +86 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +36 -4
- package/dist/cjs/ez-form.cjs.entry.js +51 -2
- package/dist/cjs/ez-grid.cjs.entry.js +322 -19
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +2 -2
- package/dist/cjs/ez-number-input.cjs.entry.js +9 -2
- package/dist/cjs/ez-search.cjs.entry.js +6 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +2 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +6 -4
- package/dist/collection/components/ez-button/ez-button.css +7 -0
- package/dist/collection/components/ez-button/ez-button.js +1 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +1 -0
- package/dist/collection/components/ez-form/ez-form.js +130 -4
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +245 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +92 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +62 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +35 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +58 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +6 -3
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
- package/dist/collection/components/ez-grid/ez-grid.js +206 -2
- package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +3 -11
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +22 -0
- package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
- package/dist/collection/components/ez-list/ez-list.css +6 -2
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +4 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +12 -1
- package/dist/collection/components/ez-search/ez-search.js +5 -2
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +1 -1
- package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
- package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +539 -44
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -0
- package/dist/esm/ez-alert-list.entry.js +6 -4
- package/dist/esm/ez-button.entry.js +2 -2
- package/dist/esm/ez-collapsible-box.entry.js +1 -0
- package/dist/esm/ez-combo-box.entry.js +1 -0
- package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +88 -3
- package/dist/esm/ez-date-input.entry.js +1 -0
- package/dist/esm/ez-form-view.entry.js +36 -4
- package/dist/esm/ez-form.entry.js +51 -2
- package/dist/esm/ez-grid.entry.js +322 -19
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +2 -2
- package/dist/esm/ez-number-input.entry.js +9 -2
- package/dist/esm/ez-search.entry.js +6 -2
- package/dist/esm/ez-split-item.entry.js +2 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-09de35a2.entry.js +1 -0
- package/dist/ezui/p-13d2fe2d.entry.js +1 -0
- package/dist/ezui/{p-384247cd.entry.js → p-1f96ba9a.entry.js} +2 -2
- package/dist/ezui/p-204b1439.entry.js +1 -0
- package/dist/ezui/p-2b8da3a4.entry.js +1 -0
- package/dist/ezui/p-30775e7f.entry.js +1 -0
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/{p-2a1a0e04.entry.js → p-77362d3a.entry.js} +1 -1
- package/dist/ezui/{p-8defa6d3.entry.js → p-786559c5.entry.js} +1 -1
- package/dist/ezui/p-7922142b.entry.js +1 -0
- package/dist/ezui/p-84e439b9.entry.js +1 -0
- package/dist/ezui/p-922ac38b.entry.js +1 -0
- package/dist/ezui/p-bae4e180.entry.js +1 -0
- package/dist/ezui/p-bcb53f27.entry.js +1 -0
- package/dist/ezui/p-c942e4a7.entry.js +1 -0
- package/dist/ezui/p-e90dd4eb.entry.js +1 -0
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +2 -2
- package/dist/types/components/ez-form/ez-form.d.ts +20 -1
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +41 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +29 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +30 -1
- package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
- package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-grid/subcomponents/utils/selectionCounterUtils.d.ts +4 -0
- package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +1 -0
- package/dist/types/components.d.ts +120 -4
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +29 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
- package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
- package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-0447d17c.entry.js +0 -1
- package/dist/ezui/p-20ec22c0.entry.js +0 -1
- package/dist/ezui/p-44c5b6a5.entry.js +0 -1
- package/dist/ezui/p-5ef056ce.entry.js +0 -1
- package/dist/ezui/p-86ff298d.entry.js +0 -1
- package/dist/ezui/p-99ead599.entry.js +0 -1
- package/dist/ezui/p-9aefaa52.entry.js +0 -1
- package/dist/ezui/p-9f1e89c9.entry.js +0 -1
- package/dist/ezui/p-b041333c.entry.js +0 -1
- package/dist/ezui/p-b567fa8c.entry.js +0 -1
- package/dist/ezui/p-bae3d0aa.entry.js +0 -1
- package/dist/ezui/p-db77a984.entry.js +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { CustomEditorSource } from '../../../utils/customEditor/interfaces/ICustomEditor';
|
|
3
|
+
import { HTMLBuilder, StringUtils } from '@sankhyalabs/core';
|
|
4
|
+
export class EzCustomFormInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.gui = undefined;
|
|
7
|
+
this.customEditor = undefined;
|
|
8
|
+
this.formViewField = undefined;
|
|
9
|
+
this.value = undefined;
|
|
10
|
+
this.detailContext = undefined;
|
|
11
|
+
this.builderFallback = undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Aplica foco no campo.
|
|
15
|
+
*/
|
|
16
|
+
async setFocus() {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Remove o foco do campo.
|
|
22
|
+
*/
|
|
23
|
+
async setBlur() {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
(_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["setBlur"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retorna se o conteúdo é inválido.
|
|
29
|
+
*/
|
|
30
|
+
async isInvalid() {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return ((_b = (_a = this.gui) === null || _a === void 0 ? void 0 : _a["isInvalid"]) === null || _b === void 0 ? void 0 : _b.call(_a)) || false;
|
|
33
|
+
}
|
|
34
|
+
getContent() {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const fieldProps = new Map();
|
|
37
|
+
for (const prop in this.formViewField.props) {
|
|
38
|
+
fieldProps.set(prop, this.formViewField.props[prop]);
|
|
39
|
+
}
|
|
40
|
+
const params = {
|
|
41
|
+
value: this.value,
|
|
42
|
+
name: this.formViewField.name,
|
|
43
|
+
currentEditor: this.builderFallback(this.formViewField),
|
|
44
|
+
editorMetadata: {
|
|
45
|
+
label: this.formViewField.label,
|
|
46
|
+
hidden: ((_a = this.formViewField.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
47
|
+
userInterface: this.formViewField.userInterface,
|
|
48
|
+
options: (_b = this.formViewField.props) === null || _b === void 0 ? void 0 : _b.options,
|
|
49
|
+
props: this.formViewField.props ? fieldProps : undefined,
|
|
50
|
+
optionLoader: this.formViewField.optionLoader
|
|
51
|
+
},
|
|
52
|
+
source: CustomEditorSource.FORM,
|
|
53
|
+
detailContext: this.detailContext
|
|
54
|
+
};
|
|
55
|
+
let gui = this.customEditor.getEditorElement(params);
|
|
56
|
+
if (!gui) {
|
|
57
|
+
gui = this.builderFallback(this.formViewField);
|
|
58
|
+
this.handleValue(gui);
|
|
59
|
+
this.gui = gui;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!(gui instanceof HTMLElement) && typeof gui !== 'string') {
|
|
63
|
+
this.handleValue(gui);
|
|
64
|
+
this.gui = gui;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (typeof gui === 'string') {
|
|
68
|
+
gui = HTMLBuilder.parseElement(gui);
|
|
69
|
+
}
|
|
70
|
+
gui.setAttribute('value', this.value);
|
|
71
|
+
this.gui = h("div", { key: StringUtils.generateUUID(), ref: el => el && el.appendChild(gui) });
|
|
72
|
+
}
|
|
73
|
+
handleValue(gui) {
|
|
74
|
+
//@ts-ignore
|
|
75
|
+
gui.$children$.forEach((child) => {
|
|
76
|
+
child.$attrs$.value = this.value;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
componentWillRender() {
|
|
80
|
+
this.getContent();
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
return (h(Host, null, this.gui));
|
|
84
|
+
}
|
|
85
|
+
static get is() { return "ez-custom-form-input"; }
|
|
86
|
+
static get encapsulation() { return "scoped"; }
|
|
87
|
+
static get properties() {
|
|
88
|
+
return {
|
|
89
|
+
"customEditor": {
|
|
90
|
+
"type": "unknown",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "ICustomEditor",
|
|
94
|
+
"resolved": "ICustomEditor",
|
|
95
|
+
"references": {
|
|
96
|
+
"ICustomEditor": {
|
|
97
|
+
"location": "import",
|
|
98
|
+
"path": "../../../utils/customEditor/interfaces/ICustomEditor"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Inst\u00E2ncia do editor customizado."
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"formViewField": {
|
|
110
|
+
"type": "unknown",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "IFormViewField",
|
|
114
|
+
"resolved": "IFormViewField",
|
|
115
|
+
"references": {
|
|
116
|
+
"IFormViewField": {
|
|
117
|
+
"location": "import",
|
|
118
|
+
"path": "../interfaces"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": "Campo que o elemento customizado representa."
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"value": {
|
|
130
|
+
"type": "any",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "any",
|
|
134
|
+
"resolved": "any",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": "Valores dos campos do formul\u00E1rio."
|
|
142
|
+
},
|
|
143
|
+
"attribute": "value",
|
|
144
|
+
"reflect": false
|
|
145
|
+
},
|
|
146
|
+
"detailContext": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string",
|
|
151
|
+
"resolved": "string",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "Define de qual contexto o editor est\u00E1 sendo acionado."
|
|
159
|
+
},
|
|
160
|
+
"attribute": "detail-context",
|
|
161
|
+
"reflect": false
|
|
162
|
+
},
|
|
163
|
+
"builderFallback": {
|
|
164
|
+
"type": "unknown",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "(field: IFormViewField) => HTMLElement",
|
|
168
|
+
"resolved": "(field: IFormViewField) => HTMLElement",
|
|
169
|
+
"references": {
|
|
170
|
+
"IFormViewField": {
|
|
171
|
+
"location": "import",
|
|
172
|
+
"path": "../interfaces"
|
|
173
|
+
},
|
|
174
|
+
"HTMLElement": {
|
|
175
|
+
"location": "global"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"required": false,
|
|
180
|
+
"optional": false,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": "Builder original do FormView que ser\u00E1 chamado caso o custom n\u00E3o retorne nenhum valor."
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static get states() {
|
|
189
|
+
return {
|
|
190
|
+
"gui": {}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
static get methods() {
|
|
194
|
+
return {
|
|
195
|
+
"setFocus": {
|
|
196
|
+
"complexType": {
|
|
197
|
+
"signature": "() => Promise<void>",
|
|
198
|
+
"parameters": [],
|
|
199
|
+
"references": {
|
|
200
|
+
"Promise": {
|
|
201
|
+
"location": "global"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"return": "Promise<void>"
|
|
205
|
+
},
|
|
206
|
+
"docs": {
|
|
207
|
+
"text": "Aplica foco no campo.",
|
|
208
|
+
"tags": []
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"setBlur": {
|
|
212
|
+
"complexType": {
|
|
213
|
+
"signature": "() => Promise<void>",
|
|
214
|
+
"parameters": [],
|
|
215
|
+
"references": {
|
|
216
|
+
"Promise": {
|
|
217
|
+
"location": "global"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"return": "Promise<void>"
|
|
221
|
+
},
|
|
222
|
+
"docs": {
|
|
223
|
+
"text": "Remove o foco do campo.",
|
|
224
|
+
"tags": []
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"isInvalid": {
|
|
228
|
+
"complexType": {
|
|
229
|
+
"signature": "() => Promise<boolean>",
|
|
230
|
+
"parameters": [],
|
|
231
|
+
"references": {
|
|
232
|
+
"Promise": {
|
|
233
|
+
"location": "global"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"return": "Promise<boolean>"
|
|
237
|
+
},
|
|
238
|
+
"docs": {
|
|
239
|
+
"text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
|
|
240
|
+
"tags": []
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -4,11 +4,35 @@ import { ElementIDUtils, UserInterface } from '@sankhyalabs/core';
|
|
|
4
4
|
import { FormItems } from './structure';
|
|
5
5
|
export class EzFormView {
|
|
6
6
|
constructor() {
|
|
7
|
+
this._customEditors = new Map();
|
|
7
8
|
this.fields = undefined;
|
|
8
9
|
}
|
|
9
10
|
async showUp() {
|
|
10
11
|
this._element.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
15
|
+
*/
|
|
16
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
17
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
18
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
19
|
+
this._customEditors = newCustomEditors;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Altera/adiciona uma propriedade nos metados do campo.
|
|
23
|
+
*/
|
|
24
|
+
async setFieldProp(fieldName, propName, value) {
|
|
25
|
+
const fields = this.fields.map(field => {
|
|
26
|
+
if (field.name === fieldName) {
|
|
27
|
+
field.props = field.props || {};
|
|
28
|
+
if (value || value === 0) {
|
|
29
|
+
field.props[propName] = value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return field;
|
|
33
|
+
});
|
|
34
|
+
this.fields = [...fields];
|
|
35
|
+
}
|
|
12
36
|
groupFields(fields) {
|
|
13
37
|
const result = new Map();
|
|
14
38
|
fields.forEach(item => {
|
|
@@ -28,8 +52,9 @@ export class EzFormView {
|
|
|
28
52
|
return result;
|
|
29
53
|
}
|
|
30
54
|
componentDidRender() {
|
|
31
|
-
this.
|
|
32
|
-
|
|
55
|
+
this._formElements = Array.from(this._element.querySelectorAll("[data-field-name]"));
|
|
56
|
+
this.ezContentReady.emit(this._formElements);
|
|
57
|
+
const formItems = new FormItems(this._formElements);
|
|
33
58
|
this.formItemsReady.emit(formItems);
|
|
34
59
|
}
|
|
35
60
|
isItemFullWidth(userInterface) {
|
|
@@ -39,9 +64,15 @@ export class EzFormView {
|
|
|
39
64
|
].includes(userInterface);
|
|
40
65
|
}
|
|
41
66
|
buildFormItemElement(item, classItem = "") {
|
|
67
|
+
var _a;
|
|
42
68
|
if (this.isItemFullWidth(item.userInterface)) {
|
|
43
69
|
classItem += " input-full_width";
|
|
44
70
|
}
|
|
71
|
+
if (this._customEditors.has(item.name)) {
|
|
72
|
+
const value = (_a = this._formElements.map(el => ({ name: el.dataset.fieldName, value: el['value'] })).find(field => field.name === item.name)) === null || _a === void 0 ? void 0 : _a.value;
|
|
73
|
+
const customEditor = this._customEditors.get(item.name).customEditor;
|
|
74
|
+
return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value }));
|
|
75
|
+
}
|
|
45
76
|
return h("div", { class: classItem }, fieldBuilder(item));
|
|
46
77
|
}
|
|
47
78
|
render() {
|
|
@@ -102,6 +133,11 @@ export class EzFormView {
|
|
|
102
133
|
}
|
|
103
134
|
};
|
|
104
135
|
}
|
|
136
|
+
static get states() {
|
|
137
|
+
return {
|
|
138
|
+
"_customEditors": {}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
105
141
|
static get events() {
|
|
106
142
|
return [{
|
|
107
143
|
"method": "ezContentReady",
|
|
@@ -164,6 +200,60 @@ export class EzFormView {
|
|
|
164
200
|
"text": "",
|
|
165
201
|
"tags": []
|
|
166
202
|
}
|
|
203
|
+
},
|
|
204
|
+
"addCustomEditor": {
|
|
205
|
+
"complexType": {
|
|
206
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
207
|
+
"parameters": [{
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
}, {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": ""
|
|
213
|
+
}, {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": ""
|
|
216
|
+
}],
|
|
217
|
+
"references": {
|
|
218
|
+
"Promise": {
|
|
219
|
+
"location": "global"
|
|
220
|
+
},
|
|
221
|
+
"ICustomEditor": {
|
|
222
|
+
"location": "import",
|
|
223
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"return": "Promise<void>"
|
|
227
|
+
},
|
|
228
|
+
"docs": {
|
|
229
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
230
|
+
"tags": []
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"setFieldProp": {
|
|
234
|
+
"complexType": {
|
|
235
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
|
236
|
+
"parameters": [{
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": ""
|
|
239
|
+
}, {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": ""
|
|
242
|
+
}, {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": ""
|
|
245
|
+
}],
|
|
246
|
+
"references": {
|
|
247
|
+
"Promise": {
|
|
248
|
+
"location": "global"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"return": "Promise<void>"
|
|
252
|
+
},
|
|
253
|
+
"docs": {
|
|
254
|
+
"text": "Altera/adiciona uma propriedade nos metados do campo.",
|
|
255
|
+
"tags": []
|
|
256
|
+
}
|
|
167
257
|
}
|
|
168
258
|
};
|
|
169
259
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export const buildDecimal = ({ name, label, readOnly, props, contextName, canShowError }) => {
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
|
|
5
|
+
const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
|
|
5
6
|
return buildNumeric(name, label, readOnly, precision, prettyPrecision, contextName, canShowError);
|
|
6
7
|
};
|
|
7
8
|
export const buildInteger = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
|
-
import { Grid
|
|
2
|
+
import { Grid } from 'ag-grid-community';
|
|
3
3
|
import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
|
|
4
4
|
import DataSource from './DataSource';
|
|
5
5
|
import { EzGridCustomHeader } from './components/EzGridCustomHeader';
|
|
6
6
|
import { CellRendererStatus } from './components/cellRendererStatus';
|
|
7
7
|
import SelectionHeader from './components/selectionHeader';
|
|
8
|
-
import gridTerms from './i18n/pt-BR
|
|
8
|
+
import gridTerms from './i18n/pt-BR';
|
|
9
9
|
import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from '../../../../utils/constants';
|
|
10
10
|
import GridEditionManager from './GridEditionManager';
|
|
11
11
|
export default class AgGridController {
|
|
@@ -42,6 +42,7 @@ export default class AgGridController {
|
|
|
42
42
|
this._gridConfig = [];
|
|
43
43
|
this._filteredColumns = new Map();
|
|
44
44
|
this._filterColumnleftPosition = 0;
|
|
45
|
+
this._customFormatters = new Map();
|
|
45
46
|
this._enterprise = enterprise;
|
|
46
47
|
}
|
|
47
48
|
getGridConfig() {
|
|
@@ -125,7 +126,7 @@ export default class AgGridController {
|
|
|
125
126
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
126
127
|
this._multipleSelection = options.allowMultipleSelection;
|
|
127
128
|
this._dataUnit = options.dataUnit;
|
|
128
|
-
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled);
|
|
129
|
+
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders);
|
|
129
130
|
this._statusResolver = options.statusResolver;
|
|
130
131
|
if (this._dataUnit) {
|
|
131
132
|
this._dataUnit.sortingProvider = this;
|
|
@@ -157,6 +158,13 @@ export default class AgGridController {
|
|
|
157
158
|
headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
|
|
158
159
|
headerCheckStatusSetter: (selectAll) => this.updateSelectionForAll(selectAll),
|
|
159
160
|
},
|
|
161
|
+
processCellForClipboard: this.processFormatterCellCallback,
|
|
162
|
+
defaultExcelExportParams: {
|
|
163
|
+
processCellCallback: this.processFormatterCellCallback
|
|
164
|
+
},
|
|
165
|
+
defaultCsvExportParams: {
|
|
166
|
+
processCellCallback: this.processFormatterCellCallback
|
|
167
|
+
}
|
|
160
168
|
};
|
|
161
169
|
this.defineRowModelType(this._gridOptions, options);
|
|
162
170
|
this.setOptionsEvents(this._gridOptions);
|
|
@@ -180,7 +188,25 @@ export default class AgGridController {
|
|
|
180
188
|
this.selectRows((selection === null || selection === void 0 ? void 0 : selection.recordIds) || [], true);
|
|
181
189
|
}
|
|
182
190
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
191
|
+
this._customFormatters = options.customFormatters;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
processFormatterCellCallback(params) {
|
|
195
|
+
const column = params.column.getColDef();
|
|
196
|
+
if (typeof column.valueFormatter === 'function') {
|
|
197
|
+
const valueParams = {
|
|
198
|
+
value: params.value,
|
|
199
|
+
data: params.node.data,
|
|
200
|
+
node: params.node,
|
|
201
|
+
colDef: column,
|
|
202
|
+
column: params.column,
|
|
203
|
+
api: params.api,
|
|
204
|
+
columnApi: params.columnApi,
|
|
205
|
+
context: params.context,
|
|
206
|
+
};
|
|
207
|
+
return column.valueFormatter(valueParams);
|
|
183
208
|
}
|
|
209
|
+
return params.value;
|
|
184
210
|
}
|
|
185
211
|
setFilterColumnLeftPosition({ type, ePopup }) {
|
|
186
212
|
if (type === 'columnMenu') {
|
|
@@ -530,7 +556,7 @@ export default class AgGridController {
|
|
|
530
556
|
//Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
|
|
531
557
|
const columnsOffset = colDef.length - columns.length;
|
|
532
558
|
let sort = [];
|
|
533
|
-
state.forEach((cfgColumn, index) => {
|
|
559
|
+
state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
|
|
534
560
|
const colWidth = this.getColumnWidth(cfgColumn);
|
|
535
561
|
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
|
|
536
562
|
this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
|
|
@@ -633,6 +659,13 @@ export default class AgGridController {
|
|
|
633
659
|
if (params.value instanceof Promise) {
|
|
634
660
|
return "Carregando...";
|
|
635
661
|
}
|
|
662
|
+
const customFormatter = this._customFormatters.get(source.name);
|
|
663
|
+
if (customFormatter) {
|
|
664
|
+
const formattedValue = customFormatter.format(params.value, source, params.data.__record__id__);
|
|
665
|
+
if (formattedValue) {
|
|
666
|
+
return formattedValue;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
636
669
|
if (this._dataUnit) {
|
|
637
670
|
return this._dataUnit.getFormattedValue(source.name, params.value);
|
|
638
671
|
}
|
|
@@ -641,6 +674,13 @@ export default class AgGridController {
|
|
|
641
674
|
cellStyle: this.getStyleByColumn(source),
|
|
642
675
|
});
|
|
643
676
|
}
|
|
677
|
+
setCustomFormatters(customFormatters) {
|
|
678
|
+
this._customFormatters = customFormatters;
|
|
679
|
+
}
|
|
680
|
+
refreshSelectedRows() {
|
|
681
|
+
const selectedNodes = this._gridOptions.api.getSelectedNodes();
|
|
682
|
+
this._gridOptions.api.redrawRows({ rowNodes: selectedNodes });
|
|
683
|
+
}
|
|
644
684
|
getInitCellStyle() {
|
|
645
685
|
return {
|
|
646
686
|
'line-height': this.getRowHeight() - 1 + 'px',
|
|
@@ -816,4 +856,22 @@ export default class AgGridController {
|
|
|
816
856
|
const labelSize = (((_b = field === null || field === void 0 ? void 0 : field.label) === null || _b === void 0 ? void 0 : _b.length) || 0) * this.DEFAULT_FONT_SIZE + this.DEFAULT_ICON_SIZE;
|
|
817
857
|
return labelSize > this.DEFAULT_MAX_SIZE ? this.DEFAULT_MAX_SIZE : labelSize;
|
|
818
858
|
}
|
|
859
|
+
setCellEditors(customEditors) {
|
|
860
|
+
var _a;
|
|
861
|
+
if (!this._editionManager) {
|
|
862
|
+
this._customEditors = customEditors;
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
this._editionManager.setCellEditors(customEditors);
|
|
866
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
867
|
+
}
|
|
868
|
+
setCellRenders(customRenders) {
|
|
869
|
+
var _a;
|
|
870
|
+
if (!this._editionManager) {
|
|
871
|
+
this._customRenders = customRenders;
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
this._editionManager.setCellRenders(customRenders);
|
|
875
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
876
|
+
}
|
|
819
877
|
}
|
|
@@ -2,8 +2,10 @@ import { UserInterface } from "@sankhyalabs/core";
|
|
|
2
2
|
import { KeyCode } from "ag-grid-community";
|
|
3
3
|
import { RecordValidationProcessor } from "../../../../utils/validators/recordvalidator/RecordValidationProcessor";
|
|
4
4
|
import EzCellEditor from "./editor/EzCellEditor";
|
|
5
|
+
import EzGridCustomCellEditor from "./components/EzGridCustomCellEditor";
|
|
6
|
+
import EzGridCustomCellRender from "./components/EzGridCustomCellRender";
|
|
5
7
|
export default class GridEditionManager {
|
|
6
|
-
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled) {
|
|
8
|
+
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders) {
|
|
7
9
|
this._dataUnit = dataUnit;
|
|
8
10
|
this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
9
11
|
getRequiredFields: () => this.getRequiredFields(),
|
|
@@ -12,6 +14,8 @@ export default class GridEditionManager {
|
|
|
12
14
|
}, recordsValidator);
|
|
13
15
|
this._useEnterLikeTab = useEnterLikeTab;
|
|
14
16
|
this._editionIsDisabled = editionIsDisabled;
|
|
17
|
+
this._customEditors = customEditors;
|
|
18
|
+
this._customRenders = customRenders;
|
|
15
19
|
}
|
|
16
20
|
configureGrid(options) {
|
|
17
21
|
this._gridOptions = options;
|
|
@@ -78,6 +82,30 @@ export default class GridEditionManager {
|
|
|
78
82
|
col.suppressKeyboardEvent = (params) => {
|
|
79
83
|
return params.event.key === KeyCode.ENTER;
|
|
80
84
|
};
|
|
85
|
+
col.cellEditorSelector = (params) => {
|
|
86
|
+
var _a;
|
|
87
|
+
if ((_a = this._customEditors) === null || _a === void 0 ? void 0 : _a.has(params.colDef.field)) {
|
|
88
|
+
const customEditor = this._customEditors.get(params.colDef.field);
|
|
89
|
+
return {
|
|
90
|
+
component: EzGridCustomCellEditor,
|
|
91
|
+
params: {
|
|
92
|
+
customEditorsInfo: customEditor,
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
col.cellRendererSelector = (params) => {
|
|
98
|
+
var _a;
|
|
99
|
+
if ((_a = this._customRenders) === null || _a === void 0 ? void 0 : _a.has(params.colDef.field)) {
|
|
100
|
+
const customRender = this._customRenders.get(params.colDef.field);
|
|
101
|
+
return {
|
|
102
|
+
component: EzGridCustomCellRender,
|
|
103
|
+
params: {
|
|
104
|
+
customRendersInfo: customRender,
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
81
109
|
return col;
|
|
82
110
|
}
|
|
83
111
|
getRequiredFields() {
|
|
@@ -219,6 +247,12 @@ export default class GridEditionManager {
|
|
|
219
247
|
this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
|
|
220
248
|
}
|
|
221
249
|
}
|
|
250
|
+
setCellEditors(customEditors) {
|
|
251
|
+
this._customEditors = customEditors;
|
|
252
|
+
}
|
|
253
|
+
setCellRenders(customRenders) {
|
|
254
|
+
this._customRenders = customRenders;
|
|
255
|
+
}
|
|
222
256
|
}
|
|
223
257
|
class TargetEdition {
|
|
224
258
|
constructor(rowIndex, column, backwards) {
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HTMLBuilder } from "@sankhyalabs/core";
|
|
2
|
+
import { CustomEditorSource } from "../../../../../utils/customEditor/interfaces/ICustomEditor";
|
|
3
|
+
import EzCellEditor from "../editor/EzCellEditor";
|
|
4
|
+
export default class EzGridCustomCellEditor extends EzCellEditor {
|
|
5
|
+
init(params) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
this._value = params.value;
|
|
8
|
+
this._fieldName = params.column.getColId();
|
|
9
|
+
this._customEditorInstance = params.customEditorsInfo.customEditor;
|
|
10
|
+
super.init(params);
|
|
11
|
+
this._defaultGui = this.getDefaultGui();
|
|
12
|
+
const fieldMetadata = super.getFieldMetadata();
|
|
13
|
+
this._params = {
|
|
14
|
+
value: params.value,
|
|
15
|
+
charPress: params.charPress,
|
|
16
|
+
currentEditor: this._defaultGui,
|
|
17
|
+
name: this._fieldName,
|
|
18
|
+
source: CustomEditorSource.GRID,
|
|
19
|
+
detailContext: params.customEditorsInfo.detailContext,
|
|
20
|
+
setValue: (value) => this.setValue(value),
|
|
21
|
+
getValue: () => this.getValue(),
|
|
22
|
+
editorMetadata: {
|
|
23
|
+
hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
24
|
+
label: fieldMetadata.label,
|
|
25
|
+
userInterface: fieldMetadata.userInterface,
|
|
26
|
+
props: fieldMetadata.props,
|
|
27
|
+
optionLoader: fieldMetadata.optionLoader,
|
|
28
|
+
options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
getDefaultGui() {
|
|
33
|
+
const gui = super.getGui();
|
|
34
|
+
gui.value = this._value;
|
|
35
|
+
gui.onkeyup = (event) => {
|
|
36
|
+
const value = event.target.value;
|
|
37
|
+
this.setValue(value);
|
|
38
|
+
};
|
|
39
|
+
return gui;
|
|
40
|
+
}
|
|
41
|
+
getGui() {
|
|
42
|
+
const editorElement = this._customEditorInstance.getEditorElement(this._params);
|
|
43
|
+
if (!editorElement) {
|
|
44
|
+
return this._defaultGui;
|
|
45
|
+
}
|
|
46
|
+
if (typeof editorElement === 'string') {
|
|
47
|
+
const element = HTMLBuilder.parseElement(editorElement);
|
|
48
|
+
return element;
|
|
49
|
+
}
|
|
50
|
+
return editorElement;
|
|
51
|
+
}
|
|
52
|
+
setValue(value) {
|
|
53
|
+
this._value = value;
|
|
54
|
+
}
|
|
55
|
+
getValue() {
|
|
56
|
+
return this._value;
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import EzCellRender from "../editor/EzCellRender";
|
|
2
|
+
import { HTMLBuilder } from "@sankhyalabs/core";
|
|
3
|
+
import { CustomRenderSource } from "../../../../../utils/customRender/interfaces/ICustomRender";
|
|
4
|
+
export default class EzGridCustomCellRender extends EzCellRender {
|
|
5
|
+
init(params) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
this._fieldName = params.column.getColId();
|
|
8
|
+
this._customRenderInstance = params.customRendersInfo.customRender;
|
|
9
|
+
super.init(params);
|
|
10
|
+
const fieldMetadata = super.getFieldMetadata();
|
|
11
|
+
this._params = {
|
|
12
|
+
value: params.value,
|
|
13
|
+
charPress: '',
|
|
14
|
+
currentRender: super.getGui(),
|
|
15
|
+
name: this._fieldName,
|
|
16
|
+
source: CustomRenderSource.GRID,
|
|
17
|
+
getValue: () => params.getValue(),
|
|
18
|
+
detailContext: params.customRendersInfo.detailContext,
|
|
19
|
+
renderMetadata: {
|
|
20
|
+
hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
21
|
+
label: fieldMetadata.label,
|
|
22
|
+
userInterface: fieldMetadata.userInterface,
|
|
23
|
+
props: fieldMetadata.props,
|
|
24
|
+
optionLoader: fieldMetadata.optionLoader,
|
|
25
|
+
options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
getGui() {
|
|
30
|
+
const editorElement = this._customRenderInstance.getRenderElement(this._params);
|
|
31
|
+
if (!editorElement) {
|
|
32
|
+
return super.getGui();
|
|
33
|
+
}
|
|
34
|
+
if (typeof editorElement === 'string') {
|
|
35
|
+
const element = HTMLBuilder.parseElement(editorElement);
|
|
36
|
+
return element;
|
|
37
|
+
}
|
|
38
|
+
return editorElement;
|
|
39
|
+
}
|
|
40
|
+
}
|