@sankhyalabs/ezui 1.1.139 → 1.1.142
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/ez-date-input.cjs.entry.js +16 -5
- package/dist/cjs/ez-date-time-input.cjs.entry.js +7 -1
- package/dist/cjs/ez-form.cjs.entry.js +53 -8
- package/dist/cjs/ez-grid.cjs.entry.js +11 -5
- package/dist/cjs/ez-number-input.cjs.entry.js +8 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +35 -22
- package/dist/cjs/ez-text-input.cjs.entry.js +11 -9
- package/dist/cjs/ez-time-input.cjs.entry.js +5 -0
- package/dist/cjs/ez-upload.cjs.entry.js +28 -9
- package/dist/collection/components/ez-date-input/ez-date-input.js +49 -5
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +40 -1
- package/dist/collection/components/ez-form/DataBinder.js +54 -8
- package/dist/collection/components/ez-form/ez-form.js +0 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +10 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -3
- package/dist/collection/components/ez-number-input/ez-number-input.js +41 -1
- package/dist/collection/components/ez-text-area/ez-text-area.js +35 -22
- package/dist/collection/components/ez-text-input/ez-text-input.js +11 -9
- package/dist/collection/components/ez-time-input/ez-time-input.js +38 -0
- package/dist/collection/components/ez-upload/RemoteFile.js +6 -1
- package/dist/collection/components/ez-upload/ez-upload.js +36 -8
- package/dist/custom-elements/index.js +175 -61
- package/dist/esm/ez-date-input.entry.js +16 -5
- package/dist/esm/ez-date-time-input.entry.js +7 -1
- package/dist/esm/ez-form.entry.js +54 -9
- package/dist/esm/ez-grid.entry.js +12 -6
- package/dist/esm/ez-number-input.entry.js +8 -1
- package/dist/esm/ez-text-area.entry.js +35 -22
- package/dist/esm/ez-text-input.entry.js +11 -9
- package/dist/esm/ez-time-input.entry.js +5 -0
- package/dist/esm/ez-upload.entry.js +28 -9
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-140f7085.entry.js +1 -0
- package/dist/ezui/{p-51cdfa9e.entry.js → p-1b2bf15d.entry.js} +5 -5
- package/dist/ezui/p-24e98dc1.entry.js +1 -0
- package/dist/ezui/p-49fdfa4b.entry.js +1 -0
- package/dist/ezui/p-4fdceb7d.entry.js +1 -0
- package/dist/ezui/p-7746460e.entry.js +1 -0
- package/dist/ezui/p-87808290.entry.js +1 -0
- package/dist/ezui/p-b524dfca.entry.js +1 -0
- package/dist/ezui/p-ec21ecce.entry.js +1 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +12 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +11 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -2
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +11 -0
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -3
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +10 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +5 -0
- package/dist/types/components.d.ts +36 -0
- package/package.json +1 -1
- package/dist/ezui/p-248361f5.entry.js +0 -1
- package/dist/ezui/p-347b145b.entry.js +0 -1
- package/dist/ezui/p-9b82c2fe.entry.js +0 -1
- package/dist/ezui/p-b8d64970.entry.js +0 -1
- package/dist/ezui/p-c620258b.entry.js +0 -1
- package/dist/ezui/p-cb73bee7.entry.js +0 -1
- package/dist/ezui/p-db0981c1.entry.js +0 -1
- package/dist/ezui/p-ec8419f1.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, Action } from "@sankhyalabs/core";
|
|
1
|
+
import { ApplicationContext, Action, WaitingChangeException } from "@sankhyalabs/core";
|
|
2
2
|
export default class DataBinder {
|
|
3
3
|
constructor(dataUnit) {
|
|
4
4
|
this.onDataUnitEvent = (action) => {
|
|
@@ -36,11 +36,7 @@ export default class DataBinder {
|
|
|
36
36
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
37
37
|
}
|
|
38
38
|
updateValue(fieldName, field) {
|
|
39
|
-
|
|
40
|
-
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
41
|
-
if (oldValue != newValue) {
|
|
42
|
-
field["value"] = newValue;
|
|
43
|
-
}
|
|
39
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
44
40
|
}
|
|
45
41
|
updateBind(fieldName, field) {
|
|
46
42
|
const oldBind = this._fields.get(fieldName);
|
|
@@ -48,21 +44,53 @@ export default class DataBinder {
|
|
|
48
44
|
oldBind.destroy();
|
|
49
45
|
}
|
|
50
46
|
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
51
|
-
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
47
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
52
48
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
53
49
|
this.applyEzUploadContext(fieldName, field);
|
|
54
50
|
}
|
|
55
51
|
changeStarted(fieldName, waitingChange) {
|
|
52
|
+
/**
|
|
53
|
+
* se o waitingChange não é blocante, add um event listener pra
|
|
54
|
+
* fazer o accept da promise
|
|
55
|
+
*
|
|
56
|
+
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
56
60
|
if (this._dataUnit.records.length === 0) {
|
|
57
61
|
this._dataUnit.addRecord();
|
|
58
62
|
}
|
|
63
|
+
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
64
|
+
const bind = this._fields.get(fieldName);
|
|
65
|
+
if (bind) {
|
|
66
|
+
waitingChange.promise = new Promise((resolve, reject) => {
|
|
67
|
+
bind.waitingChangePromiseResolve = resolve;
|
|
68
|
+
bind.waitingChangePromiseReject = reject;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
59
72
|
this._dataUnit.startChange(fieldName, waitingChange);
|
|
60
73
|
}
|
|
74
|
+
cancelWaitingChange(fieldName) {
|
|
75
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
76
|
+
this._dataUnit.cancelWaitingChange(fieldName);
|
|
77
|
+
const bind = this._fields.get(fieldName);
|
|
78
|
+
if (bind) {
|
|
79
|
+
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
61
83
|
setFieldValue(fieldName, newValue) {
|
|
62
84
|
if (this._dataUnit.records.length === 0) {
|
|
63
85
|
this._dataUnit.addRecord();
|
|
64
86
|
}
|
|
65
87
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
88
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
89
|
+
const bind = this._fields.get(fieldName);
|
|
90
|
+
if (bind) {
|
|
91
|
+
bind.acceptWaitingChange();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
66
94
|
}
|
|
67
95
|
bindSearchOptionsLoader(fieldName, field) {
|
|
68
96
|
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
@@ -91,18 +119,36 @@ export default class DataBinder {
|
|
|
91
119
|
class Bind {
|
|
92
120
|
constructor() {
|
|
93
121
|
this.startChangeEventName = "ezStartChange";
|
|
122
|
+
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
94
123
|
this.changeEventName = "ezChange";
|
|
95
124
|
}
|
|
96
125
|
destroy() {
|
|
97
126
|
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
127
|
+
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
98
128
|
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
99
129
|
}
|
|
100
|
-
|
|
130
|
+
acceptWaitingChange() {
|
|
131
|
+
if (this.waitingChangePromiseResolve) {
|
|
132
|
+
this.waitingChangePromiseResolve();
|
|
133
|
+
this.waitingChangePromiseReject = undefined;
|
|
134
|
+
this.waitingChangePromiseResolve = undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
rejectWaitingChange(reason) {
|
|
138
|
+
if (this.waitingChangePromiseReject) {
|
|
139
|
+
this.waitingChangePromiseReject(reason);
|
|
140
|
+
this.waitingChangePromiseReject = undefined;
|
|
141
|
+
this.waitingChangePromiseResolve = undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
101
145
|
const b = new Bind();
|
|
102
146
|
b.field = field;
|
|
103
147
|
b.fieldName = fieldName;
|
|
104
148
|
b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
|
|
105
149
|
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
150
|
+
b.cancelWaitingChangeListener = () => { cancelWaitingChangeCallback(fieldName); };
|
|
151
|
+
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
106
152
|
b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
|
|
107
153
|
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
108
154
|
return b;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Grid as EnterpriseGrid } from "ag-grid-enterprise";
|
|
1
|
+
import { Grid as EnterpriseGrid, LicenseManager } from "ag-grid-enterprise";
|
|
2
2
|
import { Grid } from "ag-grid-community";
|
|
3
3
|
import gridTerms from "./i18n/pt-BR.js";
|
|
4
4
|
import HeaderColumnTemplate from "./template/HeaderColumnTemplate.js";
|
|
5
5
|
import DataSource from "./DataSource";
|
|
6
|
-
import { DataType } from "@sankhyalabs/core";
|
|
6
|
+
import { ApplicationContext, DataType } from "@sankhyalabs/core";
|
|
7
7
|
import { SortMode, UserInterface } from "@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";
|
|
8
8
|
import { NumberUtils } from "@sankhyalabs/core";
|
|
9
9
|
export default class AgGridController {
|
|
10
10
|
constructor(enterprise) {
|
|
11
11
|
this.DEFAULT_ROW_HEIGHT = 25;
|
|
12
|
+
this.CHECK_BOX_COL_ID = "checkBoxColumn";
|
|
13
|
+
this.RECORD_ARCHIVE_COL_ID = "__RECORD_ARCHIVE__";
|
|
12
14
|
this._menuItems = [];
|
|
13
15
|
this._idAttribName = "__record__id__";
|
|
14
16
|
this._isFirstRecordOfPage = true;
|
|
@@ -32,6 +34,7 @@ export default class AgGridController {
|
|
|
32
34
|
;
|
|
33
35
|
initDatagrid(container, options) {
|
|
34
36
|
if (this._grid === undefined) {
|
|
37
|
+
LicenseManager.setLicenseKey(ApplicationContext.getContextValue("__EZUI__GRID_LICENSE__"));
|
|
35
38
|
this._columnStateChangeCallback = options.onColumnStateChange;
|
|
36
39
|
this._selectionChangeCallback = options.onSelectionChange;
|
|
37
40
|
this._paginationChangeCallback = options.onPaginationChange;
|
|
@@ -177,7 +180,7 @@ export default class AgGridController {
|
|
|
177
180
|
const colDefs = [];
|
|
178
181
|
if (showCheckSelection) {
|
|
179
182
|
colDefs.push({
|
|
180
|
-
colId:
|
|
183
|
+
colId: this.CHECK_BOX_COL_ID,
|
|
181
184
|
headerName: "",
|
|
182
185
|
checkboxSelection: true,
|
|
183
186
|
headerCheckboxSelection: false,
|
|
@@ -268,7 +271,10 @@ export default class AgGridController {
|
|
|
268
271
|
this._gridOptions.api.paginationGoToPage(page);
|
|
269
272
|
}
|
|
270
273
|
quickFilter(term) {
|
|
271
|
-
this._dataSource.setQuickFilter(term
|
|
274
|
+
this._dataSource.setQuickFilter(term, this._gridOptions.columnApi
|
|
275
|
+
.getAllColumns()
|
|
276
|
+
.filter(col => col.isVisible() && ![this.CHECK_BOX_COL_ID, this.RECORD_ARCHIVE_COL_ID].includes(col.getColId()))
|
|
277
|
+
.map(col => col.getColId()));
|
|
272
278
|
this.goToPage(0);
|
|
273
279
|
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
274
280
|
}
|
|
@@ -19,7 +19,7 @@ export default class DataSource {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this.
|
|
22
|
+
this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this._quickFilter })
|
|
23
23
|
.then(data => params.success(data))
|
|
24
24
|
.catch(() => params.fail());
|
|
25
25
|
}
|
|
@@ -38,7 +38,7 @@ export default class DataSource {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
setQuickFilter(term) {
|
|
42
|
-
this.
|
|
41
|
+
setQuickFilter(term, fields) {
|
|
42
|
+
this._quickFilter = { term, fields };
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -52,6 +52,7 @@ export class EzNumberInput {
|
|
|
52
52
|
parseNumber() {
|
|
53
53
|
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
54
54
|
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
55
|
+
this.ezCancelWaitingChange.emit();
|
|
55
56
|
this.errorMessage = "O valor digitado não é um número válido";
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
@@ -59,6 +60,7 @@ export class EzNumberInput {
|
|
|
59
60
|
this.changeValue(parsedNumber);
|
|
60
61
|
}
|
|
61
62
|
catch (e) {
|
|
63
|
+
this.ezCancelWaitingChange.emit();
|
|
62
64
|
this.errorMessage = e.message;
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
@@ -70,11 +72,14 @@ export class EzNumberInput {
|
|
|
70
72
|
}
|
|
71
73
|
return undefined;
|
|
72
74
|
}
|
|
75
|
+
startChange() {
|
|
76
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
77
|
+
}
|
|
73
78
|
componentDidLoad() {
|
|
74
79
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
75
80
|
}
|
|
76
81
|
render() {
|
|
77
|
-
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
|
|
82
|
+
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onInput: () => this.startChange(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
|
|
78
83
|
}
|
|
79
84
|
static get is() { return "ez-number-input"; }
|
|
80
85
|
static get encapsulation() { return "shadow"; }
|
|
@@ -222,6 +227,41 @@ export class EzNumberInput {
|
|
|
222
227
|
"resolved": "number",
|
|
223
228
|
"references": {}
|
|
224
229
|
}
|
|
230
|
+
}, {
|
|
231
|
+
"method": "ezStartChange",
|
|
232
|
+
"name": "ezStartChange",
|
|
233
|
+
"bubbles": true,
|
|
234
|
+
"cancelable": true,
|
|
235
|
+
"composed": true,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
|
|
239
|
+
},
|
|
240
|
+
"complexType": {
|
|
241
|
+
"original": "WaitingChange",
|
|
242
|
+
"resolved": "WaitingChange",
|
|
243
|
+
"references": {
|
|
244
|
+
"WaitingChange": {
|
|
245
|
+
"location": "import",
|
|
246
|
+
"path": "@sankhyalabs/core"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}, {
|
|
251
|
+
"method": "ezCancelWaitingChange",
|
|
252
|
+
"name": "ezCancelWaitingChange",
|
|
253
|
+
"bubbles": true,
|
|
254
|
+
"cancelable": true,
|
|
255
|
+
"composed": true,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [],
|
|
258
|
+
"text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
|
|
259
|
+
},
|
|
260
|
+
"complexType": {
|
|
261
|
+
"original": "void",
|
|
262
|
+
"resolved": "void",
|
|
263
|
+
"references": {}
|
|
264
|
+
}
|
|
225
265
|
}]; }
|
|
226
266
|
static get methods() { return {
|
|
227
267
|
"setFocus": {
|
|
@@ -30,11 +30,17 @@ export class EzTextArea {
|
|
|
30
30
|
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
observeValue() {
|
|
34
|
-
this._inputElem
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
observeValue(newValue, oldValue) {
|
|
34
|
+
if (this._inputElem) {
|
|
35
|
+
if (newValue != oldValue) {
|
|
36
|
+
if (this.canChangeValue()) {
|
|
37
|
+
this._inputElem.value = this.value || "";
|
|
38
|
+
}
|
|
39
|
+
this.adjustFloatingLabel();
|
|
40
|
+
this.errorMessage = "";
|
|
41
|
+
this.ezChange.emit(this.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
observeMode() {
|
|
40
46
|
if (this._initialRows == undefined) {
|
|
@@ -52,6 +58,27 @@ export class EzTextArea {
|
|
|
52
58
|
this._initialRows = rows;
|
|
53
59
|
}
|
|
54
60
|
}
|
|
61
|
+
//---------------------------------------------
|
|
62
|
+
// Public methods
|
|
63
|
+
//---------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* Faz o foco no componente de input
|
|
66
|
+
*/
|
|
67
|
+
async setFocus() {
|
|
68
|
+
this._inputElem.focus();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Remove o foco no componente de input
|
|
72
|
+
*/
|
|
73
|
+
async setBlur() {
|
|
74
|
+
this._inputElem.blur();
|
|
75
|
+
}
|
|
76
|
+
//---------------------------------------------
|
|
77
|
+
// Private methods
|
|
78
|
+
//---------------------------------------------
|
|
79
|
+
canChangeValue() {
|
|
80
|
+
return this._inputElem && (this.value || "") !== this._inputElem.value;
|
|
81
|
+
}
|
|
55
82
|
adjustFloatingLabel() {
|
|
56
83
|
if (this.label && this._labelElem) {
|
|
57
84
|
const hasValue = this.value && this.value.toString().length > 0;
|
|
@@ -72,21 +99,6 @@ export class EzTextArea {
|
|
|
72
99
|
return this._hostElement.shadowRoot.activeElement !== null;
|
|
73
100
|
}
|
|
74
101
|
//---------------------------------------------
|
|
75
|
-
// Public methods
|
|
76
|
-
//---------------------------------------------
|
|
77
|
-
/**
|
|
78
|
-
* Faz o foco no componente de input
|
|
79
|
-
*/
|
|
80
|
-
async setFocus() {
|
|
81
|
-
this._inputElem.focus();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Remove o foco no componente de input
|
|
85
|
-
*/
|
|
86
|
-
async setBlur() {
|
|
87
|
-
this._inputElem.blur();
|
|
88
|
-
}
|
|
89
|
-
//---------------------------------------------
|
|
90
102
|
// Event handlers
|
|
91
103
|
//---------------------------------------------
|
|
92
104
|
handleFocusout() {
|
|
@@ -96,8 +108,9 @@ export class EzTextArea {
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
handleChange() {
|
|
99
|
-
this.
|
|
100
|
-
|
|
111
|
+
if (this.canChangeValue()) {
|
|
112
|
+
this.value = this._inputElem.value;
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
handleFocus() {
|
|
103
116
|
if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
|
|
@@ -43,17 +43,19 @@ export class EzTextInput {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
observeValue() {
|
|
46
|
+
observeValue(newValue, oldValue) {
|
|
47
47
|
if (this._inputElem) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
if (newValue != oldValue) {
|
|
49
|
+
this._inputElem.value = this.value || "";
|
|
50
|
+
this.handleChange();
|
|
51
|
+
this.adjustFloatingLabel();
|
|
52
|
+
if (this.slaveMode) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.errorMessage = "";
|
|
56
|
+
this.ezChange.emit(this.value);
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
|
-
this.errorMessage = "";
|
|
56
|
-
this.ezChange.emit(this.value);
|
|
57
59
|
}
|
|
58
60
|
adjustFloatingLabel() {
|
|
59
61
|
if (this.label && this._labelElem) {
|
|
@@ -63,10 +63,12 @@ export class EzTimeInput {
|
|
|
63
63
|
this.prepareValue(this.viewValue);
|
|
64
64
|
if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
65
65
|
this._oldViewValue = this.viewValue;
|
|
66
|
+
this.ezCancelWaitingChange.emit();
|
|
66
67
|
this.errorMessage = "Favor inserir um horário válido.";
|
|
67
68
|
}
|
|
68
69
|
else {
|
|
69
70
|
if (this.viewValue === this._oldViewValue) {
|
|
71
|
+
this.ezCancelWaitingChange.emit();
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
74
|
this._oldViewValue = this.viewValue;
|
|
@@ -85,6 +87,7 @@ export class EzTimeInput {
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
handleChange() {
|
|
90
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
88
91
|
this.viewValue = this._inputElem.value;
|
|
89
92
|
this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
90
93
|
}
|
|
@@ -257,6 +260,41 @@ export class EzTimeInput {
|
|
|
257
260
|
"resolved": "number",
|
|
258
261
|
"references": {}
|
|
259
262
|
}
|
|
263
|
+
}, {
|
|
264
|
+
"method": "ezStartChange",
|
|
265
|
+
"name": "ezStartChange",
|
|
266
|
+
"bubbles": true,
|
|
267
|
+
"cancelable": true,
|
|
268
|
+
"composed": true,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
|
|
272
|
+
},
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "WaitingChange",
|
|
275
|
+
"resolved": "WaitingChange",
|
|
276
|
+
"references": {
|
|
277
|
+
"WaitingChange": {
|
|
278
|
+
"location": "import",
|
|
279
|
+
"path": "@sankhyalabs/core"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
"method": "ezCancelWaitingChange",
|
|
285
|
+
"name": "ezCancelWaitingChange",
|
|
286
|
+
"bubbles": true,
|
|
287
|
+
"cancelable": true,
|
|
288
|
+
"composed": true,
|
|
289
|
+
"docs": {
|
|
290
|
+
"tags": [],
|
|
291
|
+
"text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
|
|
292
|
+
},
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "void",
|
|
295
|
+
"resolved": "void",
|
|
296
|
+
"references": {}
|
|
297
|
+
}
|
|
260
298
|
}]; }
|
|
261
299
|
static get methods() { return {
|
|
262
300
|
"setFocus": {
|
|
@@ -43,7 +43,12 @@ export default class RemoteFile {
|
|
|
43
43
|
}
|
|
44
44
|
const response = xhr.response;
|
|
45
45
|
if (response) {
|
|
46
|
-
|
|
46
|
+
try {
|
|
47
|
+
resolve(JSON.parse(response));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
reject(`Servidor não retornou um objeto válido: ${response}.\n${error}`);
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
};
|
|
@@ -91,14 +91,27 @@ export class EzUpload {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
async doAddFile(file) {
|
|
94
|
-
|
|
95
|
-
this.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
try {
|
|
95
|
+
if (this.validateFile(file)) {
|
|
96
|
+
this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio.", blocking: true });
|
|
97
|
+
const uploadingFile = new RemoteFile(file);
|
|
98
|
+
const oldPointer = this._filePointers.get(file.name);
|
|
99
|
+
if (oldPointer && this.isRemoteFile(oldPointer)) {
|
|
100
|
+
oldPointer.abortUpload();
|
|
101
|
+
}
|
|
102
|
+
this._filePointers.set(file.name, uploadingFile);
|
|
103
|
+
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
104
|
+
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
105
|
+
.catch(msg => {
|
|
106
|
+
this.ezCancelWaitingChange.emit();
|
|
107
|
+
this.showError(msg);
|
|
108
|
+
});
|
|
109
|
+
forceUpdate(this);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.ezCancelWaitingChange.emit();
|
|
114
|
+
throw error;
|
|
102
115
|
}
|
|
103
116
|
}
|
|
104
117
|
finishUpload(ezFile) {
|
|
@@ -461,6 +474,21 @@ export class EzUpload {
|
|
|
461
474
|
}
|
|
462
475
|
}
|
|
463
476
|
}
|
|
477
|
+
}, {
|
|
478
|
+
"method": "ezCancelWaitingChange",
|
|
479
|
+
"name": "ezCancelWaitingChange",
|
|
480
|
+
"bubbles": true,
|
|
481
|
+
"cancelable": true,
|
|
482
|
+
"composed": true,
|
|
483
|
+
"docs": {
|
|
484
|
+
"tags": [],
|
|
485
|
+
"text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
|
|
486
|
+
},
|
|
487
|
+
"complexType": {
|
|
488
|
+
"original": "void",
|
|
489
|
+
"resolved": "void",
|
|
490
|
+
"references": {}
|
|
491
|
+
}
|
|
464
492
|
}]; }
|
|
465
493
|
static get methods() { return {
|
|
466
494
|
"addFiles": {
|