@sankhyalabs/ezui 1.1.140 → 1.1.143
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 +57 -12
- package/dist/cjs/ez-grid.cjs.entry.js +3 -0
- 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-form/structure/FormSheetMetadata.js +4 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +5 -2
- 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 +171 -60
- 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 +58 -13
- package/dist/esm/ez-grid.entry.js +4 -1
- 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-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-9ce93746.entry.js → p-6816c9ee.entry.js} +5 -5
- package/dist/ezui/p-7746460e.entry.js +1 -0
- package/dist/ezui/p-8639fc8c.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 +1 -0
- 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,5 +1,5 @@
|
|
|
1
1
|
import { h, r as registerInstance, c as createEvent, f as forceUpdate, H as Host, g as getElement } from './index-b21f0a10.js';
|
|
2
|
-
import { UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit } from '@sankhyalabs/core';
|
|
2
|
+
import { UserInterface, Action, WaitingChangeException, ApplicationContext, DataUnitAction, DataUnit } from '@sankhyalabs/core';
|
|
3
3
|
import { A as ApplicationUtils } from './ApplicationUtils-35350d20.js';
|
|
4
4
|
|
|
5
5
|
const buildTextArea = ({ name, label, readOnly }) => {
|
|
@@ -177,7 +177,7 @@ const buildFromDataUnit = (dataUnit) => {
|
|
|
177
177
|
.filter(descriptor => descriptor.required)
|
|
178
178
|
.map(descriptor => descriptor.name),
|
|
179
179
|
cleanOnCopyFields: visibleFields
|
|
180
|
-
.filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
|
|
180
|
+
.filter(descriptor => { var _a, _b; return ((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum); })
|
|
181
181
|
.map(descriptor => descriptor.name),
|
|
182
182
|
defaultValues
|
|
183
183
|
});
|
|
@@ -197,7 +197,7 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
197
197
|
const cleanOnCopyFields = [];
|
|
198
198
|
const defaultValues = {};
|
|
199
199
|
fields.forEach(config => {
|
|
200
|
-
var _a, _b;
|
|
200
|
+
var _a, _b, _c;
|
|
201
201
|
if (config.visible !== false) {
|
|
202
202
|
const tabConfig = getTabConfig(config.tab || "Geral", sheets);
|
|
203
203
|
const descriptor = dataUnit.getField(config.name);
|
|
@@ -210,11 +210,11 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
210
210
|
if (isRequired) {
|
|
211
211
|
requiredFields.push(config.name);
|
|
212
212
|
}
|
|
213
|
-
const clearOnCopy = config.cleanOnCopy === undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : config.cleanOnCopy;
|
|
213
|
+
const clearOnCopy = config.cleanOnCopy === undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : config.cleanOnCopy;
|
|
214
214
|
if (clearOnCopy) {
|
|
215
215
|
cleanOnCopyFields.push(config.name);
|
|
216
216
|
}
|
|
217
|
-
const defaultValue = config.defaultValue === undefined ? (
|
|
217
|
+
const defaultValue = config.defaultValue === undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : config.defaultValue;
|
|
218
218
|
if (defaultValue) {
|
|
219
219
|
defaultValues[config.name] = config.defaultValue;
|
|
220
220
|
}
|
|
@@ -650,11 +650,7 @@ class DataBinder {
|
|
|
650
650
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
651
651
|
}
|
|
652
652
|
updateValue(fieldName, field) {
|
|
653
|
-
|
|
654
|
-
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
655
|
-
if (oldValue != newValue) {
|
|
656
|
-
field["value"] = newValue;
|
|
657
|
-
}
|
|
653
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
658
654
|
}
|
|
659
655
|
updateBind(fieldName, field) {
|
|
660
656
|
const oldBind = this._fields.get(fieldName);
|
|
@@ -662,21 +658,53 @@ class DataBinder {
|
|
|
662
658
|
oldBind.destroy();
|
|
663
659
|
}
|
|
664
660
|
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
665
|
-
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
661
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
666
662
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
667
663
|
this.applyEzUploadContext(fieldName, field);
|
|
668
664
|
}
|
|
669
665
|
changeStarted(fieldName, waitingChange) {
|
|
666
|
+
/**
|
|
667
|
+
* se o waitingChange não é blocante, add um event listener pra
|
|
668
|
+
* fazer o accept da promise
|
|
669
|
+
*
|
|
670
|
+
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
671
|
+
*
|
|
672
|
+
*
|
|
673
|
+
*/
|
|
670
674
|
if (this._dataUnit.records.length === 0) {
|
|
671
675
|
this._dataUnit.addRecord();
|
|
672
676
|
}
|
|
677
|
+
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
678
|
+
const bind = this._fields.get(fieldName);
|
|
679
|
+
if (bind) {
|
|
680
|
+
waitingChange.promise = new Promise((resolve, reject) => {
|
|
681
|
+
bind.waitingChangePromiseResolve = resolve;
|
|
682
|
+
bind.waitingChangePromiseReject = reject;
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|
|
673
686
|
this._dataUnit.startChange(fieldName, waitingChange);
|
|
674
687
|
}
|
|
688
|
+
cancelWaitingChange(fieldName) {
|
|
689
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
690
|
+
this._dataUnit.cancelWaitingChange(fieldName);
|
|
691
|
+
const bind = this._fields.get(fieldName);
|
|
692
|
+
if (bind) {
|
|
693
|
+
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
675
697
|
setFieldValue(fieldName, newValue) {
|
|
676
698
|
if (this._dataUnit.records.length === 0) {
|
|
677
699
|
this._dataUnit.addRecord();
|
|
678
700
|
}
|
|
679
701
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
702
|
+
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
703
|
+
const bind = this._fields.get(fieldName);
|
|
704
|
+
if (bind) {
|
|
705
|
+
bind.acceptWaitingChange();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
680
708
|
}
|
|
681
709
|
bindSearchOptionsLoader(fieldName, field) {
|
|
682
710
|
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
@@ -705,18 +733,36 @@ class DataBinder {
|
|
|
705
733
|
class Bind {
|
|
706
734
|
constructor() {
|
|
707
735
|
this.startChangeEventName = "ezStartChange";
|
|
736
|
+
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
708
737
|
this.changeEventName = "ezChange";
|
|
709
738
|
}
|
|
710
739
|
destroy() {
|
|
711
740
|
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
741
|
+
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
712
742
|
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
713
743
|
}
|
|
714
|
-
|
|
744
|
+
acceptWaitingChange() {
|
|
745
|
+
if (this.waitingChangePromiseResolve) {
|
|
746
|
+
this.waitingChangePromiseResolve();
|
|
747
|
+
this.waitingChangePromiseReject = undefined;
|
|
748
|
+
this.waitingChangePromiseResolve = undefined;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
rejectWaitingChange(reason) {
|
|
752
|
+
if (this.waitingChangePromiseReject) {
|
|
753
|
+
this.waitingChangePromiseReject(reason);
|
|
754
|
+
this.waitingChangePromiseReject = undefined;
|
|
755
|
+
this.waitingChangePromiseResolve = undefined;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
715
759
|
const b = new Bind();
|
|
716
760
|
b.field = field;
|
|
717
761
|
b.fieldName = fieldName;
|
|
718
762
|
b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
|
|
719
763
|
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
764
|
+
b.cancelWaitingChangeListener = () => { cancelWaitingChangeCallback(fieldName); };
|
|
765
|
+
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
720
766
|
b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
|
|
721
767
|
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
722
768
|
return b;
|
|
@@ -821,7 +867,6 @@ let EzForm = class {
|
|
|
821
867
|
}
|
|
822
868
|
}
|
|
823
869
|
if (action.type === Action.RECORDS_ADDED) {
|
|
824
|
-
debugger;
|
|
825
870
|
const metadata = selectFormMetadata(this._store.getState());
|
|
826
871
|
const defaultValues = metadata.getDefaultValues();
|
|
827
872
|
if (defaultValues) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-b21f0a10.js';
|
|
2
|
-
import { NumberUtils, DataType, Action } from '@sankhyalabs/core';
|
|
2
|
+
import { ApplicationContext, NumberUtils, DataType, Action } from '@sankhyalabs/core';
|
|
3
3
|
import { UserInterface, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
4
4
|
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -110062,6 +110062,7 @@ class AgGridController {
|
|
|
110062
110062
|
this.DEFAULT_ROW_HEIGHT = 25;
|
|
110063
110063
|
this.CHECK_BOX_COL_ID = "checkBoxColumn";
|
|
110064
110064
|
this.RECORD_ARCHIVE_COL_ID = "__RECORD_ARCHIVE__";
|
|
110065
|
+
this.BLOCK_LOAD_DEBOUNCE = 400;
|
|
110065
110066
|
this._menuItems = [];
|
|
110066
110067
|
this._idAttribName = "__record__id__";
|
|
110067
110068
|
this._isFirstRecordOfPage = true;
|
|
@@ -110085,6 +110086,7 @@ class AgGridController {
|
|
|
110085
110086
|
;
|
|
110086
110087
|
initDatagrid(container, options) {
|
|
110087
110088
|
if (this._grid === undefined) {
|
|
110089
|
+
agGridEnterprise_cjs.LicenseManager.setLicenseKey(ApplicationContext.getContextValue("__EZUI__GRID_LICENSE__"));
|
|
110088
110090
|
this._columnStateChangeCallback = options.onColumnStateChange;
|
|
110089
110091
|
this._selectionChangeCallback = options.onSelectionChange;
|
|
110090
110092
|
this._paginationChangeCallback = options.onPaginationChange;
|
|
@@ -110104,6 +110106,7 @@ class AgGridController {
|
|
|
110104
110106
|
rowSelection: this._multipleSelection ? "multiple" : "single",
|
|
110105
110107
|
serverSideDatasource: this._dataSource,
|
|
110106
110108
|
sortingOrder: ['desc', 'asc', null],
|
|
110109
|
+
blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
|
|
110107
110110
|
getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
|
|
110108
110111
|
getMainMenuItems: (params) => {
|
|
110109
110112
|
const column = params.column;
|
|
@@ -8,6 +8,8 @@ let EzNumberInput = class {
|
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
registerInstance(this, hostRef);
|
|
10
10
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
|
+
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
12
|
+
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
11
13
|
/**
|
|
12
14
|
* Deixa o campo disponível ou não para uso.
|
|
13
15
|
*/
|
|
@@ -57,6 +59,7 @@ let EzNumberInput = class {
|
|
|
57
59
|
parseNumber() {
|
|
58
60
|
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
59
61
|
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
62
|
+
this.ezCancelWaitingChange.emit();
|
|
60
63
|
this.errorMessage = "O valor digitado não é um número válido";
|
|
61
64
|
}
|
|
62
65
|
else {
|
|
@@ -64,6 +67,7 @@ let EzNumberInput = class {
|
|
|
64
67
|
this.changeValue(parsedNumber);
|
|
65
68
|
}
|
|
66
69
|
catch (e) {
|
|
70
|
+
this.ezCancelWaitingChange.emit();
|
|
67
71
|
this.errorMessage = e.message;
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
@@ -75,11 +79,14 @@ let EzNumberInput = class {
|
|
|
75
79
|
}
|
|
76
80
|
return undefined;
|
|
77
81
|
}
|
|
82
|
+
startChange() {
|
|
83
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
84
|
+
}
|
|
78
85
|
componentDidLoad() {
|
|
79
86
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
80
87
|
}
|
|
81
88
|
render() {
|
|
82
|
-
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 }));
|
|
89
|
+
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 }));
|
|
83
90
|
}
|
|
84
91
|
get _elem() { return getElement(this); }
|
|
85
92
|
static get watchers() { return {
|
|
@@ -35,11 +35,17 @@ let EzTextArea = class {
|
|
|
35
35
|
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
observeValue() {
|
|
39
|
-
this._inputElem
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
observeValue(newValue, oldValue) {
|
|
39
|
+
if (this._inputElem) {
|
|
40
|
+
if (newValue != oldValue) {
|
|
41
|
+
if (this.canChangeValue()) {
|
|
42
|
+
this._inputElem.value = this.value || "";
|
|
43
|
+
}
|
|
44
|
+
this.adjustFloatingLabel();
|
|
45
|
+
this.errorMessage = "";
|
|
46
|
+
this.ezChange.emit(this.value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
observeMode() {
|
|
45
51
|
if (this._initialRows == undefined) {
|
|
@@ -57,6 +63,27 @@ let EzTextArea = class {
|
|
|
57
63
|
this._initialRows = rows;
|
|
58
64
|
}
|
|
59
65
|
}
|
|
66
|
+
//---------------------------------------------
|
|
67
|
+
// Public methods
|
|
68
|
+
//---------------------------------------------
|
|
69
|
+
/**
|
|
70
|
+
* Faz o foco no componente de input
|
|
71
|
+
*/
|
|
72
|
+
async setFocus() {
|
|
73
|
+
this._inputElem.focus();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Remove o foco no componente de input
|
|
77
|
+
*/
|
|
78
|
+
async setBlur() {
|
|
79
|
+
this._inputElem.blur();
|
|
80
|
+
}
|
|
81
|
+
//---------------------------------------------
|
|
82
|
+
// Private methods
|
|
83
|
+
//---------------------------------------------
|
|
84
|
+
canChangeValue() {
|
|
85
|
+
return this._inputElem && (this.value || "") !== this._inputElem.value;
|
|
86
|
+
}
|
|
60
87
|
adjustFloatingLabel() {
|
|
61
88
|
if (this.label && this._labelElem) {
|
|
62
89
|
const hasValue = this.value && this.value.toString().length > 0;
|
|
@@ -77,21 +104,6 @@ let EzTextArea = class {
|
|
|
77
104
|
return this._hostElement.shadowRoot.activeElement !== null;
|
|
78
105
|
}
|
|
79
106
|
//---------------------------------------------
|
|
80
|
-
// Public methods
|
|
81
|
-
//---------------------------------------------
|
|
82
|
-
/**
|
|
83
|
-
* Faz o foco no componente de input
|
|
84
|
-
*/
|
|
85
|
-
async setFocus() {
|
|
86
|
-
this._inputElem.focus();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Remove o foco no componente de input
|
|
90
|
-
*/
|
|
91
|
-
async setBlur() {
|
|
92
|
-
this._inputElem.blur();
|
|
93
|
-
}
|
|
94
|
-
//---------------------------------------------
|
|
95
107
|
// Event handlers
|
|
96
108
|
//---------------------------------------------
|
|
97
109
|
handleFocusout() {
|
|
@@ -101,8 +113,9 @@ let EzTextArea = class {
|
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
handleChange() {
|
|
104
|
-
this.
|
|
105
|
-
|
|
116
|
+
if (this.canChangeValue()) {
|
|
117
|
+
this.value = this._inputElem.value;
|
|
118
|
+
}
|
|
106
119
|
}
|
|
107
120
|
handleFocus() {
|
|
108
121
|
if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
|
|
@@ -48,17 +48,19 @@ let EzTextInput = class {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
observeValue() {
|
|
51
|
+
observeValue(newValue, oldValue) {
|
|
52
52
|
if (this._inputElem) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
if (newValue != oldValue) {
|
|
54
|
+
this._inputElem.value = this.value || "";
|
|
55
|
+
this.handleChange();
|
|
56
|
+
this.adjustFloatingLabel();
|
|
57
|
+
if (this.slaveMode) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.errorMessage = "";
|
|
61
|
+
this.ezChange.emit(this.value);
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
|
-
this.errorMessage = "";
|
|
61
|
-
this.ezChange.emit(this.value);
|
|
62
64
|
}
|
|
63
65
|
adjustFloatingLabel() {
|
|
64
66
|
if (this.label && this._labelElem) {
|
|
@@ -8,6 +8,8 @@ let EzTimeInput = class {
|
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
registerInstance(this, hostRef);
|
|
10
10
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
|
+
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
12
|
+
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
11
13
|
/**
|
|
12
14
|
* Deixa o campo disponível ou não para digitação.
|
|
13
15
|
*/
|
|
@@ -68,10 +70,12 @@ let EzTimeInput = class {
|
|
|
68
70
|
this.prepareValue(this.viewValue);
|
|
69
71
|
if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
70
72
|
this._oldViewValue = this.viewValue;
|
|
73
|
+
this.ezCancelWaitingChange.emit();
|
|
71
74
|
this.errorMessage = "Favor inserir um horário válido.";
|
|
72
75
|
}
|
|
73
76
|
else {
|
|
74
77
|
if (this.viewValue === this._oldViewValue) {
|
|
78
|
+
this.ezCancelWaitingChange.emit();
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
81
|
this._oldViewValue = this.viewValue;
|
|
@@ -90,6 +94,7 @@ let EzTimeInput = class {
|
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
handleChange() {
|
|
97
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
93
98
|
this.viewValue = this._inputElem.value;
|
|
94
99
|
this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
95
100
|
}
|
|
@@ -46,7 +46,12 @@ class RemoteFile {
|
|
|
46
46
|
}
|
|
47
47
|
const response = xhr.response;
|
|
48
48
|
if (response) {
|
|
49
|
-
|
|
49
|
+
try {
|
|
50
|
+
resolve(JSON.parse(response));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
reject(`Servidor não retornou um objeto válido: ${response}.\n${error}`);
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
};
|
|
@@ -98,6 +103,7 @@ let EzUpload = class {
|
|
|
98
103
|
registerInstance(this, hostRef);
|
|
99
104
|
this.ezChange = createEvent(this, "ezChange", 7);
|
|
100
105
|
this.ezStartChange = createEvent(this, "ezStartChange", 7);
|
|
106
|
+
this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
|
|
101
107
|
this._filePointers = new Map();
|
|
102
108
|
/**
|
|
103
109
|
* Deixa o campo disponível ou não para digitação.
|
|
@@ -186,14 +192,27 @@ let EzUpload = class {
|
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
async doAddFile(file) {
|
|
189
|
-
|
|
190
|
-
this.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
try {
|
|
196
|
+
if (this.validateFile(file)) {
|
|
197
|
+
this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio.", blocking: true });
|
|
198
|
+
const uploadingFile = new RemoteFile(file);
|
|
199
|
+
const oldPointer = this._filePointers.get(file.name);
|
|
200
|
+
if (oldPointer && this.isRemoteFile(oldPointer)) {
|
|
201
|
+
oldPointer.abortUpload();
|
|
202
|
+
}
|
|
203
|
+
this._filePointers.set(file.name, uploadingFile);
|
|
204
|
+
uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
205
|
+
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
206
|
+
.catch(msg => {
|
|
207
|
+
this.ezCancelWaitingChange.emit();
|
|
208
|
+
this.showError(msg);
|
|
209
|
+
});
|
|
210
|
+
forceUpdate(this);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
this.ezCancelWaitingChange.emit();
|
|
215
|
+
throw error;
|
|
197
216
|
}
|
|
198
217
|
}
|
|
199
218
|
finishUpload(ezFile) {
|
package/dist/ezui/ezui.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as s}from"./p-139ed2f6.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-fc9b9487",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-2c4372a4",[[0,"ez-application"]]],["p-6287fc90",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-8be1a4d6",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-94ed1ae6",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-517d7759",[[0,"ez-view-stack",{show:[64]}]]],["p-c2de757f",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-727a39e5",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-cabe3671",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-ecee9d8d",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-8cb2c629",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-
|
|
1
|
+
import{p as e,b as s}from"./p-139ed2f6.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-fc9b9487",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-2c4372a4",[[0,"ez-application"]]],["p-6287fc90",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-8be1a4d6",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-94ed1ae6",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-517d7759",[[0,"ez-view-stack",{show:[64]}]]],["p-c2de757f",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-727a39e5",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-cabe3671",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-ecee9d8d",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-8cb2c629",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-6816c9ee",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpGridConfig:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],refresh:[64],quickFilter:[64],nextPage:[64],previousPage:[64],hasNextPage:[64],hasPreviousPage:[64],isLastOfPage:[64],isFirstOfPage:[64],nextRecord:[64],previousRecord:[64],hasNextRecord:[64],hasPreviousRecord:[64],openGridConfig:[64]}]]],["p-33cb1991",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-dd723a09",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-294de17e",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-140f7085",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],slaveMode:[516,"slave-mode"],setFocus:[64],setBlur:[64]}]]],["p-793a28cc",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-6d4b1628",[[1,"ez-search",{value:[1537],label:[1537],enabled:[1540],errorMessage:[1537,"error-message"],optionLoader:[16],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-c246e251",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-49fdfa4b",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-ec21ecce",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-4fdceb7d",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-24e98dc1",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-b524dfca",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-7746460e",[[1,"ez-upload",{label:[1],enabled:[4],maxFileSize:[2,"max-file-size"],maxFiles:[2,"max-files"],requestHeaders:[8,"request-headers"],urlUpload:[1,"url-upload"],urlDelete:[1,"url-delete"],value:[1040],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-b65e22a1",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-2b017e4c",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-317250bc",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-dd6f4872",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressSearch:[4,"suppress-search"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],setFocus:[64],setBlur:[64]}]]],["p-8639fc8c",[[0,"ez-form",{dataUnit:[1040],config:[16],submit:[64],cancel:[64],validate:[64]}]]],["p-4c3cd534",[[0,"test-du",{isDirty:[32]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as e,H as o,g as r}from"./p-139ed2f6.js";import{MaskFormatter as n}from"@sankhyalabs/core";let a=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.enabled=!0,this.canShowError=!0,this.mode="regular",this.slaveMode=!1}observeErrorMessage(){var t,i;this._inputElem&&("string"==typeof this.errorMessage&&""!==this.errorMessage?(this._inputElem.classList.add("hasError"),null===(t=this._messageBoxElem)||void 0===t||t.classList.add("hasError")):(this._inputElem.classList.remove("hasError"),null===(i=this._messageBoxElem)||void 0===i||i.classList.remove("hasError")))}observeMask(){this.mask&&(null==this._maskFormatter?this._maskFormatter=new n(this.mask):this._maskFormatter.mask=this.mask)}observeValue(t,i){if(this._inputElem&&t!=i){if(this._inputElem.value=this.value||"",this.handleChange(),this.adjustFloatingLabel(),this.slaveMode)return;this.errorMessage="",this.ezChange.emit(this.value)}}adjustFloatingLabel(){if(this.label&&this._labelElem){this._inputElem&&!this._inputElem.classList.contains("input--with--label")&&this._inputElem.classList.add("input--with--label");const t=this.value&&this.value.toString().length>0,i=this._labelElem.classList.contains("input__label--floated");t||this.isFocused()?i||this._labelElem.classList.add("input__label--floated"):i&&this._labelElem.classList.remove("input__label--floated")}}isFocused(){return null!==this._hostElement.shadowRoot.activeElement}async setFocus(){this._inputElem.focus()}async setBlur(){this._inputElem.blur()}handleFocusout(){const t=this._inputElem.value;if(t&&this._maskFormatter)try{this._inputElem.value=this._maskFormatter.format(t)}catch(t){this.errorMessage=t.message}this.controlChangeValue(),this.adjustFloatingLabel()}isValidValue(t){return!this.restrict||Array.from(t).reduce(((t,i)=>t&&this.restrict.indexOf(i)>-1),!0)}controlChangeValue(){(this.value||"")!==this._inputElem.value&&(this.value=this._inputElem.value)}handleChange(){if(!this._inputElem)return;const t=this._inputElem.value;this.isValidValue(t)?this._lastValidValue=t:this._inputElem.value=null==this._lastValidValue?"":this._lastValidValue,this.controlChangeValue()}handleSlotChange(t){const i=t.target,e=i.assignedElements()[0];e&&(e.style.position="absolute",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.overflow="hidden",e.style.top="0px",e.style.width="var(--ez-text-input__icon--width)",e.style.height="slim"!=this.mode?"var(--ez-text-input--height)":"var(--ez-text-input--height--slim)","leftIcon"==i.name?(e.style.left="0px",e.style.borderRadius="var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)",this._inputElem.classList.add("icon--left"),this._labelElem&&this._labelElem.classList.add("input__label--left")):"rightIcon"==i.name&&(e.style.right="0px",e.style.borderRadius="0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0",this._inputElem.classList.add("icon--right"),this._labelElem&&this._labelElem.classList.add("input__label--right"))),this.observeErrorMessage()}doFocus(){this.label&&this._labelElem&&!this._labelElem.classList.contains("input__label--floated")&&this._labelElem.classList.add("input__label--floated")}componentDidLoad(){this.observeErrorMessage(),this.observeMask(),this.adjustFloatingLabel()}componentWillLoad(){if(this.observeMask(),this.value){if(this._maskFormatter)try{this.value=this._maskFormatter.format(this.value)}catch(t){this.errorMessage=t.message}this.isValidValue(this.value)||(this._lastValidValue="",this.value="")}}render(){return e(o,null,e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label&&"slim"!=this.mode?e("label",{ref:t=>this._labelElem=t,class:this.enabled?"input__label":"input__label input__label--disabled",onClick:()=>this._inputElem.focus(),title:this.label},this.label):null,e("input",{onFocus:()=>this.doFocus(),ref:t=>this._inputElem=t,type:"text",class:"slim"==this.mode?"input--slim":"",placeholder:"slim"==this.mode&&this.label?this.label:"",value:this.value,disabled:!this.enabled,onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()}}),e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.canShowError&&"slim"!=this.mode&&e("span",{class:"message-box",ref:t=>this._messageBoxElem=t,title:this.errorMessage},this.errorMessage))}get _hostElement(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],mask:["observeMask"],value:["observeValue"]}}};a.style=":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #000);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:read-only{cursor:default}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input--slim::-webkit-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-ms-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:disabled::-webkit-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-ms-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}";export{a as ez_text_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as t,h as e,g as i}from"./p-139ed2f6.js";import{NumberUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-933a7475.js";let a=class{constructor(e){s(this,e),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this.enabled=!0,this.mode="regular"}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){this._textInput&&(this._textInput.errorMessage=this.errorMessage)}observeValue(){this._textInput&&(this._textInput.value=this.getTextValue(this.value)||"")}changeValue(s){this.errorMessage="",s!==this.value?(this.value=s,this.ezChange.emit(this.value)):this.observeValue()}parseNumber(){const s=this._textInput.value?h.stringToNumber(this._textInput.value):void 0;if(void 0!==s&&isNaN(s))this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é um número válido";else try{this.changeValue(s)}catch(s){return this.ezCancelWaitingChange.emit(),void(this.errorMessage=s.message)}}getTextValue(s){if(s)return this.precision>0?h.format(s.toString(),Number(this.precision),Number(this.prettyPrecision)):s.toString()}startChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput)}render(){return e("ez-text-input",{ref:s=>this._textInput=s,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:!0})}get _elem(){return i(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};a.style=":host{display:block;width:100%}";export{a as ez_number_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,H as a,g as s}from"./p-139ed2f6.js";import{DateUtils as r}from"@sankhyalabs/core";import{C as o}from"./p-933a7475.js";let n=class{constructor(i){t(this,i),this.ezChange=e(this,"ezChange",7),this.ezStartChange=e(this,"ezStartChange",7),this.ezCancelWaitingChange=e(this,"ezCancelWaitingChange",7),this.enabled=!0,this.mode="regular"}observeLabel(){this._textInput.label=this.label}observeErrorMessage(){this._textInput&&(this._textInput.errorMessage=this.errorMessage)}observeValue(t,e){t!=e&&this._textInput&&(this.errorMessage="",this._textInput.value=this.getTextValue(this.value))}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}changeValue(t){var e;t=t instanceof Date?r.clearTime(t):void 0,this.value=this.value instanceof Date?r.clearTime(this.value):void 0,this._textInput.errorMessage="",(null==t?void 0:t.toString())!==(null===(e=this.value)||void 0===e?void 0:e.toString())&&(this.value=t,this.ezChange.emit(this.value))}showCalendar(){this.parseDate(),this._calendar.value=this.value,this._calendar.fitVertical(this._textInput.errorMessage||"slim"==this.mode?0:-19,this._elem.clientHeight)}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}parseDate(){const t=this._textInput.value,e=r.strToDate(t);e||!t?this.changeValue(this.value===e?this.value:e):(this.ezCancelWaitingChange.emit(),this._textInput.errorMessage="O valor digitado não é uma data válida")}getTextValue(t){return t?new Intl.DateTimeFormat("pt-BR").format(t):void 0}startChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput)}render(){return i(a,null,i("ez-text-input",{ref:t=>this._textInput=t,onBlur:()=>this.parseDate(),onKeyDown:t=>{"H"!==t.key&&"h"!==t.key||this.changeValue(new Date)},label:this.label,value:this.getTextValue(this.value),onInput:()=>this.startChange(),restrict:"0123456789/",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0},i("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),i("ez-calendar",{onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,ref:t=>this._calendar=t}))}get _elem(){return s(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};n.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{n as ez_date_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as t,h as i,H as e,g as h}from"./p-139ed2f6.js";import{MaskFormatter as r,TimeFormatter as a,NumberUtils as o}from"@sankhyalabs/core";import{C as n}from"./p-933a7475.js";let l=class{constructor(i){s(this,i),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this.enabled=!0,this.showSeconds=!1,this.mode="regular"}observeShowSeconds(){this.prepareMask(this.showSeconds?"##:##:##":"##:##")}observeValue(){isNaN(this.value)&&(this.value=void 0)}prepareMask(s){null==this._maskFormatter?this._maskFormatter=new r(s):this._maskFormatter.mask=s}async setFocus(){this._inputElem.setFocus()}async setBlur(){this._inputElem.setBlur()}handleFocusout(){if(this.errorMessage="",this.prepareValue(this.viewValue),this.viewValue&&!a.validateTime(this.viewValue,this.showSeconds))this._oldViewValue=this.viewValue,this.ezCancelWaitingChange.emit(),this.errorMessage="Favor inserir um horário válido.";else{if(this.viewValue===this._oldViewValue)return void this.ezCancelWaitingChange.emit();this._oldViewValue=this.viewValue,"00:00"===this.viewValue&&null==this.value&&(this.value=0),this.ezChange.emit(this.value)}}prepareValue(s){try{this.viewValue=a.prepareValue(s,this.showSeconds)}catch(s){this.errorMessage=s.message}}handleChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1}),this.viewValue=this._inputElem.value,this.value=o.stringToNumber(this.viewValue.replace(/\D/g,""))}componentDidLoad(){this.observeValue(),n.applyVarsTextInput(this._elem,this._inputElem)}componentWillLoad(){this.observeShowSeconds(),this.value?this.prepareValue(this.value.toString()):this.viewValue&&this.prepareValue(this.viewValue)}render(){return i(e,null,i("ez-text-input",{ref:s=>this._inputElem=s,value:this.viewValue,enabled:this.enabled,label:this.label,restrict:"0123456789:",onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()},errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0},i("ez-icon",{slot:"leftIcon",iconName:"timer-outline"})))}static get assetsDirs(){return["../assets"]}get _elem(){return h(this)}static get watchers(){return{showSeconds:["observeShowSeconds"],value:["observeValue"]}}};l.style=":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";export{l as ez_time_input}
|