@sankhyalabs/ezui 5.21.0-dev.10 → 5.21.0-dev.12
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-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-form-view.cjs.entry.js +18 -2
- package/dist/cjs/ez-form.cjs.entry.js +24 -1
- package/dist/cjs/ez-grid.cjs.entry.js +218 -9
- package/dist/cjs/ez-search.cjs.entry.js +1 -0
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
- 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-form/ez-form.js +55 -3
- 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 +52 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +20 -2
- 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 +81 -0
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +2 -4
- 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 +361 -15
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -0
- 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-form-view.entry.js +18 -2
- package/dist/esm/ez-form.entry.js +24 -1
- package/dist/esm/ez-grid.entry.js +218 -9
- package/dist/esm/ez-search.entry.js +1 -0
- package/dist/esm/ez-split-item.entry.js +1 -0
- 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-13727aec.entry.js +1 -0
- package/dist/ezui/{p-1db718ab.entry.js → p-1f96ba9a.entry.js} +2 -2
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/{p-3a21618b.entry.js → p-77362d3a.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-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-form/ez-form.d.ts +9 -2
- 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 +7 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +19 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +6 -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 +12 -0
- package/dist/types/components.d.ts +87 -3
- 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-637f69f2.entry.js +0 -1
- package/dist/ezui/p-7c770f14.entry.js +0 -1
- package/dist/ezui/p-836cdfdf.entry.js +0 -1
- package/dist/ezui/p-99ead599.entry.js +0 -1
- package/dist/ezui/p-bae3d0aa.entry.js +0 -1
|
@@ -4,11 +4,20 @@ 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
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Altera/adiciona uma propriedade nos metados do campo.
|
|
14
23
|
*/
|
|
@@ -41,8 +50,9 @@ export class EzFormView {
|
|
|
41
50
|
return result;
|
|
42
51
|
}
|
|
43
52
|
componentDidRender() {
|
|
44
|
-
this.
|
|
45
|
-
|
|
53
|
+
this._formElements = Array.from(this._element.querySelectorAll("[data-field-name]"));
|
|
54
|
+
this.ezContentReady.emit(this._formElements);
|
|
55
|
+
const formItems = new FormItems(this._formElements);
|
|
46
56
|
this.formItemsReady.emit(formItems);
|
|
47
57
|
}
|
|
48
58
|
isItemFullWidth(userInterface) {
|
|
@@ -52,9 +62,15 @@ export class EzFormView {
|
|
|
52
62
|
].includes(userInterface);
|
|
53
63
|
}
|
|
54
64
|
buildFormItemElement(item, classItem = "") {
|
|
65
|
+
var _a;
|
|
55
66
|
if (this.isItemFullWidth(item.userInterface)) {
|
|
56
67
|
classItem += " input-full_width";
|
|
57
68
|
}
|
|
69
|
+
if (this._customEditors.has(item.name)) {
|
|
70
|
+
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;
|
|
71
|
+
const customEditor = this._customEditors.get(item.name).customEditor;
|
|
72
|
+
return h("div", { class: classItem }, h("ez-custom-form-input", { "data-field-name": item.name, customEditor: customEditor, formViewField: item, builderFallback: fieldBuilder, value: value }));
|
|
73
|
+
}
|
|
58
74
|
return h("div", { class: classItem }, fieldBuilder(item));
|
|
59
75
|
}
|
|
60
76
|
render() {
|
|
@@ -115,6 +131,11 @@ export class EzFormView {
|
|
|
115
131
|
}
|
|
116
132
|
};
|
|
117
133
|
}
|
|
134
|
+
static get states() {
|
|
135
|
+
return {
|
|
136
|
+
"_customEditors": {}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
118
139
|
static get events() {
|
|
119
140
|
return [{
|
|
120
141
|
"method": "ezContentReady",
|
|
@@ -178,6 +199,35 @@ export class EzFormView {
|
|
|
178
199
|
"tags": []
|
|
179
200
|
}
|
|
180
201
|
},
|
|
202
|
+
"addCustomEditor": {
|
|
203
|
+
"complexType": {
|
|
204
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
205
|
+
"parameters": [{
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": ""
|
|
208
|
+
}, {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": ""
|
|
211
|
+
}, {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": ""
|
|
214
|
+
}],
|
|
215
|
+
"references": {
|
|
216
|
+
"Promise": {
|
|
217
|
+
"location": "global"
|
|
218
|
+
},
|
|
219
|
+
"ICustomEditor": {
|
|
220
|
+
"location": "import",
|
|
221
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"return": "Promise<void>"
|
|
225
|
+
},
|
|
226
|
+
"docs": {
|
|
227
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
228
|
+
"tags": []
|
|
229
|
+
}
|
|
230
|
+
},
|
|
181
231
|
"setFieldProp": {
|
|
182
232
|
"complexType": {
|
|
183
233
|
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
|
@@ -5,7 +5,7 @@ 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 {
|
|
@@ -126,7 +126,7 @@ export default class AgGridController {
|
|
|
126
126
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
127
127
|
this._multipleSelection = options.allowMultipleSelection;
|
|
128
128
|
this._dataUnit = options.dataUnit;
|
|
129
|
-
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);
|
|
130
130
|
this._statusResolver = options.statusResolver;
|
|
131
131
|
if (this._dataUnit) {
|
|
132
132
|
this._dataUnit.sortingProvider = this;
|
|
@@ -856,4 +856,22 @@ export default class AgGridController {
|
|
|
856
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;
|
|
857
857
|
return labelSize > this.DEFAULT_MAX_SIZE ? this.DEFAULT_MAX_SIZE : labelSize;
|
|
858
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
|
+
}
|
|
859
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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataType, UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
export const metadata = {
|
|
3
|
+
name: 'metadatada',
|
|
4
|
+
label: 'metadatada',
|
|
5
|
+
fields: [{
|
|
6
|
+
name: 'FIELDNAME',
|
|
7
|
+
label: 'Test',
|
|
8
|
+
dataType: DataType.TEXT,
|
|
9
|
+
userInterface: UserInterface.SHORTTEXT,
|
|
10
|
+
}],
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataType, UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
export const metadata = {
|
|
3
|
+
name: 'metadatada',
|
|
4
|
+
label: 'metadatada',
|
|
5
|
+
fields: [{
|
|
6
|
+
name: 'FIELDNAME',
|
|
7
|
+
label: 'Test',
|
|
8
|
+
dataType: DataType.TEXT,
|
|
9
|
+
userInterface: UserInterface.SHORTTEXT,
|
|
10
|
+
}],
|
|
11
|
+
};
|
|
@@ -20,9 +20,9 @@ export default class EzCellEditor {
|
|
|
20
20
|
init(params) {
|
|
21
21
|
const fieldName = params.column.getColId();
|
|
22
22
|
const dataUnit = params.context.dataUnit;
|
|
23
|
-
|
|
24
|
-
const builder = uiBuilders.get(
|
|
25
|
-
this._gui = builder(
|
|
23
|
+
this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
24
|
+
const builder = uiBuilders.get(this._fieldMetadata.userInterface) || buildTextInput;
|
|
25
|
+
this._gui = builder(this._fieldMetadata);
|
|
26
26
|
if (this._gui.valueSetter != undefined) {
|
|
27
27
|
this._gui.valueSetter(params.value);
|
|
28
28
|
}
|
|
@@ -46,4 +46,7 @@ export default class EzCellEditor {
|
|
|
46
46
|
isPopup() {
|
|
47
47
|
return this._gui.isPopUp;
|
|
48
48
|
}
|
|
49
|
+
getFieldMetadata() {
|
|
50
|
+
return this._fieldMetadata;
|
|
51
|
+
}
|
|
49
52
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { buildEditorMetadata } from "./IEditorMetadata";
|
|
2
|
+
export default class EzCellRender {
|
|
3
|
+
init(params) {
|
|
4
|
+
const span = document.createElement('span');
|
|
5
|
+
this._currentParams = params;
|
|
6
|
+
span.textContent = params.value;
|
|
7
|
+
const fieldName = params.column.getColId();
|
|
8
|
+
const dataUnit = params.context.dataUnit;
|
|
9
|
+
this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
10
|
+
this._gui = span;
|
|
11
|
+
}
|
|
12
|
+
refresh() {
|
|
13
|
+
try {
|
|
14
|
+
this._currentParams.refreshCell();
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
getGui() {
|
|
22
|
+
return this._gui;
|
|
23
|
+
}
|
|
24
|
+
afterGuiAttached() {
|
|
25
|
+
this.focusIn();
|
|
26
|
+
}
|
|
27
|
+
focusIn() {
|
|
28
|
+
this._gui.focus();
|
|
29
|
+
this._gui.setFocus({ selectText: true });
|
|
30
|
+
}
|
|
31
|
+
getValue() {
|
|
32
|
+
return this._currentParams.getValue();
|
|
33
|
+
}
|
|
34
|
+
isPopup() {
|
|
35
|
+
return this._gui.isPopUp;
|
|
36
|
+
}
|
|
37
|
+
getFieldMetadata() {
|
|
38
|
+
return this._fieldMetadata;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,6 +15,8 @@ export class EzGrid {
|
|
|
15
15
|
constructor() {
|
|
16
16
|
this._gridController = new AgGridController(false);
|
|
17
17
|
this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
|
|
18
|
+
this._customEditor = new Map();
|
|
19
|
+
this._customRenders = new Map();
|
|
18
20
|
this._paginationInfo = undefined;
|
|
19
21
|
this._paginationChangedByKeyboard = true;
|
|
20
22
|
this._showSelectionCounter = false;
|
|
@@ -94,6 +96,27 @@ export class EzGrid {
|
|
|
94
96
|
async filterColumns(search) {
|
|
95
97
|
return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
|
|
96
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
101
|
+
*/
|
|
102
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
103
|
+
const newCustomEditor = new Map(this._customEditor);
|
|
104
|
+
newCustomEditor.set(fieldName, {
|
|
105
|
+
customEditor,
|
|
106
|
+
detailContext,
|
|
107
|
+
});
|
|
108
|
+
this._customEditor = newCustomEditor;
|
|
109
|
+
this._gridController.setCellEditors(newCustomEditor);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Registra um render customizado para colunas da grid.
|
|
113
|
+
*/
|
|
114
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
|
115
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
116
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
|
117
|
+
this._customRenders = newCustomRenders;
|
|
118
|
+
this._gridController.setCellRenders(newCustomRenders);
|
|
119
|
+
}
|
|
97
120
|
/**
|
|
98
121
|
* Registra um formatador de valores para uma coluna da grid.
|
|
99
122
|
*/
|
|
@@ -986,6 +1009,64 @@ export class EzGrid {
|
|
|
986
1009
|
"tags": []
|
|
987
1010
|
}
|
|
988
1011
|
},
|
|
1012
|
+
"addCustomEditor": {
|
|
1013
|
+
"complexType": {
|
|
1014
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
1015
|
+
"parameters": [{
|
|
1016
|
+
"tags": [],
|
|
1017
|
+
"text": ""
|
|
1018
|
+
}, {
|
|
1019
|
+
"tags": [],
|
|
1020
|
+
"text": ""
|
|
1021
|
+
}, {
|
|
1022
|
+
"tags": [],
|
|
1023
|
+
"text": ""
|
|
1024
|
+
}],
|
|
1025
|
+
"references": {
|
|
1026
|
+
"Promise": {
|
|
1027
|
+
"location": "global"
|
|
1028
|
+
},
|
|
1029
|
+
"ICustomEditor": {
|
|
1030
|
+
"location": "import",
|
|
1031
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
"return": "Promise<void>"
|
|
1035
|
+
},
|
|
1036
|
+
"docs": {
|
|
1037
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
1038
|
+
"tags": []
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
"addGridCustomRender": {
|
|
1042
|
+
"complexType": {
|
|
1043
|
+
"signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
|
|
1044
|
+
"parameters": [{
|
|
1045
|
+
"tags": [],
|
|
1046
|
+
"text": ""
|
|
1047
|
+
}, {
|
|
1048
|
+
"tags": [],
|
|
1049
|
+
"text": ""
|
|
1050
|
+
}, {
|
|
1051
|
+
"tags": [],
|
|
1052
|
+
"text": ""
|
|
1053
|
+
}],
|
|
1054
|
+
"references": {
|
|
1055
|
+
"Promise": {
|
|
1056
|
+
"location": "global"
|
|
1057
|
+
},
|
|
1058
|
+
"ICustomRender": {
|
|
1059
|
+
"location": "import",
|
|
1060
|
+
"path": "../../utils/customRender/interfaces/ICustomRender"
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
"return": "Promise<void>"
|
|
1064
|
+
},
|
|
1065
|
+
"docs": {
|
|
1066
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
1067
|
+
"tags": []
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
989
1070
|
"addCustomValueFormatter": {
|
|
990
1071
|
"complexType": {
|
|
991
1072
|
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
@@ -17,8 +17,6 @@ export function getText(selectionCount, allSelectedRecords) {
|
|
|
17
17
|
if (allSelectedRecords) {
|
|
18
18
|
return `Todos os <strong>${selectionCount} registros</strong> da grade estão selecionados.`;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return "O único registro dessa página está selecionado";
|
|
20
|
+
const pluralCharacter = selectionCount > 1 ? "s" : "";
|
|
21
|
+
return `Há <strong>${selectionCount} registro${pluralCharacter}</strong> selecionado${pluralCharacter} na grade.`;
|
|
24
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,3 +4,5 @@ export { DialogType } from '../components/ez-dialog/DialogType';
|
|
|
4
4
|
export { CheckMode } from '../components/ez-check/CheckMode';
|
|
5
5
|
export { FormMetadata } from './form/FormMetadata';
|
|
6
6
|
export { default as DataBinder } from './form/DataBinder';
|
|
7
|
+
export { CustomEditorSource } from './customEditor/interfaces/ICustomEditor';
|
|
8
|
+
export { CustomRenderSource } from './customRender/interfaces/ICustomRender';
|
|
@@ -80,6 +80,12 @@ export const EzComboBox: {
|
|
|
80
80
|
new (): EzComboBox;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
interface EzCustomFormInput extends Components.EzCustomFormInput, HTMLElement {}
|
|
84
|
+
export const EzCustomFormInput: {
|
|
85
|
+
prototype: EzCustomFormInput;
|
|
86
|
+
new (): EzCustomFormInput;
|
|
87
|
+
};
|
|
88
|
+
|
|
83
89
|
interface EzDateInput extends Components.EzDateInput, HTMLElement {}
|
|
84
90
|
export const EzDateInput: {
|
|
85
91
|
prototype: EzDateInput;
|