@sankhyalabs/ezui 1.1.80 → 1.1.81
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-calendar_13.cjs.entry.js → ez-calendar_14.cjs.entry.js} +182 -5
- package/dist/cjs/ez-grid.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/{index-a2266984.js → index-4fc4a0a4.js} +68 -40
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-form/DataBinder.js +7 -1
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +2 -1
- package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +4 -0
- package/dist/custom-elements/index.js +80 -41
- package/dist/esm/{ez-calendar_13.entry.js → ez-calendar_14.entry.js} +180 -4
- package/dist/esm/ez-grid.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/{index-afe19542.js → index-e31373d9.js} +68 -40
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-5509ee41.entry.js → p-1c8d64d0.entry.js} +1 -1
- package/dist/ezui/{p-d5699f29.entry.js → p-8b9ef58b.entry.js} +1 -1
- package/dist/ezui/p-983bd291.js +1 -0
- package/dist/ezui/p-9dbf569a.entry.js +1 -0
- package/dist/ezui/{p-857ead8e.entry.js → p-aef3394b.entry.js} +1 -1
- package/dist/ezui/{p-7a1f2e0e.entry.js → p-da63000f.entry.js} +1 -1
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
- package/package.json +2 -2
- package/dist/cjs/DateUtils-716769e0.js +0 -46
- package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -133
- package/dist/esm/DateUtils-0a1bbd7a.js +0 -44
- package/dist/esm/ez-date-time-input.entry.js +0 -129
- package/dist/ezui/p-00b837e2.js +0 -1
- package/dist/ezui/p-0d8368fc.entry.js +0 -1
- package/dist/ezui/p-49f3432a.entry.js +0 -1
- package/dist/ezui/p-c89629eb.js +0 -1
|
@@ -3,10 +3,52 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2003dec4.js');
|
|
6
|
-
const index$1 = require('./index-
|
|
6
|
+
const index$1 = require('./index-4fc4a0a4.js');
|
|
7
7
|
const FloatingManager = require('./FloatingManager-6cfeb947.js');
|
|
8
8
|
const CSSVarsUtils = require('./CSSVarsUtils-66e86394.js');
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
class DateUtils {
|
|
11
|
+
static clearTime(date, adjustDayLightSavingTime = true) {
|
|
12
|
+
const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
|
13
|
+
return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
|
|
14
|
+
}
|
|
15
|
+
static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
|
|
16
|
+
/** monthYearMode é um booleano para usar o formato MM/YYYY.
|
|
17
|
+
* Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
|
|
18
|
+
* Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
|
|
19
|
+
let parts;
|
|
20
|
+
if (monthYearMode) {
|
|
21
|
+
parts = /^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
parts = /^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
|
|
25
|
+
}
|
|
26
|
+
if (!parts) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
var day = monthYearMode ? 1 : Number(parts[1]);
|
|
30
|
+
var month = Number(parts[(monthYearMode ? 1 : 2)]);
|
|
31
|
+
var year = Number(parts[(monthYearMode ? 2 : 3)]);
|
|
32
|
+
var hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
|
|
33
|
+
var min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
|
|
34
|
+
var sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
|
|
35
|
+
if (year < 100) {
|
|
36
|
+
year += year < 30 ? 2000 : 1900;
|
|
37
|
+
}
|
|
38
|
+
let date = new Date(year, month - 1, day, hour, min, sec, 0);
|
|
39
|
+
if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
|
|
40
|
+
date = DateUtils.adjustDLST(date);
|
|
41
|
+
}
|
|
42
|
+
return date;
|
|
43
|
+
}
|
|
44
|
+
static adjustDLST(date) {
|
|
45
|
+
//Work around para corrigir o Bug do horário de verão.
|
|
46
|
+
if (date.getHours() == 23) {
|
|
47
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
|
|
48
|
+
}
|
|
49
|
+
return date;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
10
52
|
|
|
11
53
|
const ezCalendarCss = ":host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__Time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-calendar__header-line--stroke:2px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--ez-calendar__nav-btn--next-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-calendar__cell--margin:0px var(--space--small, 12px);--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:var(--space--extra-small, 3px) 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__cell--outset--color:var(--color--strokes, #C0C0C0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:'';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--small, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__body{padding:var(--space--small, 6px) 0px}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--small);padding:var(--space--extra-small, 6px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendarTime{margin-left:-10px;display:flex;flex-direction:column;padding:12px 6px;padding-left:16px;padding-bottom:0px;background-color:var(--ez-calendar__Time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:180px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendarTime__header{padding-left:6px;padding-right:6px;display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}";
|
|
12
54
|
|
|
@@ -589,7 +631,7 @@ let EzDateInput = class {
|
|
|
589
631
|
}
|
|
590
632
|
}
|
|
591
633
|
changeValue(newValue) {
|
|
592
|
-
newValue = newValue == null ? null : DateUtils.
|
|
634
|
+
newValue = newValue == null ? null : DateUtils.clearTime(newValue);
|
|
593
635
|
this._textInput.errorMessage = "";
|
|
594
636
|
if (newValue !== this.value) {
|
|
595
637
|
this.value = newValue;
|
|
@@ -611,7 +653,7 @@ let EzDateInput = class {
|
|
|
611
653
|
}
|
|
612
654
|
parseDate() {
|
|
613
655
|
const strValue = this._textInput.value;
|
|
614
|
-
const parsedDate = DateUtils.
|
|
656
|
+
const parsedDate = DateUtils.strToDate(strValue);
|
|
615
657
|
if (parsedDate || !strValue) {
|
|
616
658
|
if (this.value === parsedDate) {
|
|
617
659
|
this.changeValue(this.value);
|
|
@@ -645,6 +687,129 @@ let EzDateInput = class {
|
|
|
645
687
|
};
|
|
646
688
|
EzDateInput.style = ezDateInputCss;
|
|
647
689
|
|
|
690
|
+
const ezDateTimeInputCss = ":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)}";
|
|
691
|
+
|
|
692
|
+
let EzDateTimeInput = class {
|
|
693
|
+
constructor(hostRef) {
|
|
694
|
+
index.registerInstance(this, hostRef);
|
|
695
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
696
|
+
/**
|
|
697
|
+
* Deixa o campo disponível ou não para uso.
|
|
698
|
+
*/
|
|
699
|
+
this.enabled = true;
|
|
700
|
+
/**
|
|
701
|
+
* Exibe ou não os segundos no input
|
|
702
|
+
*/
|
|
703
|
+
this.showSeconds = false;
|
|
704
|
+
}
|
|
705
|
+
setLabel() {
|
|
706
|
+
this._textInput.label = this.label;
|
|
707
|
+
}
|
|
708
|
+
setErrorMessage() {
|
|
709
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
710
|
+
}
|
|
711
|
+
applyValueToInput() {
|
|
712
|
+
if (this._textInput) {
|
|
713
|
+
this._textInput.value = this.getTextValue(this.value);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
onChangeKeyDown(ev) {
|
|
717
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
718
|
+
if (ev.key === "H" || ev.key === "h") {
|
|
719
|
+
this.changeValue(new Date());
|
|
720
|
+
}
|
|
721
|
+
else if (ev.shiftKey && ev.key === "Tab") {
|
|
722
|
+
if (input.selectionStart > 0) {
|
|
723
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
|
|
724
|
+
if (selectIni !== -1) {
|
|
725
|
+
input.setSelectionRange(0, selectIni);
|
|
726
|
+
ev.preventDefault();
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
else if (ev.key === "Tab") {
|
|
731
|
+
if (input.value.length !== input.selectionEnd) {
|
|
732
|
+
let selectIni = input.value.indexOf(" ", input.selectionEnd);
|
|
733
|
+
selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
|
|
734
|
+
input.setSelectionRange(selectIni, input.value.length);
|
|
735
|
+
ev.preventDefault();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
onFocused() {
|
|
740
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
741
|
+
if (input.selectionStart !== input.selectionEnd) {
|
|
742
|
+
let selectIni = input.value.indexOf(" ", input.selectionStart);
|
|
743
|
+
selectIni = selectIni === -1 ? input.value.length : selectIni;
|
|
744
|
+
input.setSelectionRange(0, selectIni);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
onClicked() {
|
|
748
|
+
const input = this._textInput.shadowRoot.querySelector('input');
|
|
749
|
+
let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
|
|
750
|
+
selectIni = selectIni === -1 ? 0 : selectIni + 1;
|
|
751
|
+
selectIni = selectIni > input.selectionEnd ? 0 : selectIni;
|
|
752
|
+
let selectFin = selectIni === 0 ? input.value.indexOf(" ") : input.value.length;
|
|
753
|
+
input.setSelectionRange(selectIni, selectFin);
|
|
754
|
+
}
|
|
755
|
+
changeValue(newValue) {
|
|
756
|
+
this._textInput.errorMessage = "";
|
|
757
|
+
if (newValue !== this.value) {
|
|
758
|
+
this.value = newValue;
|
|
759
|
+
this.ezChange.emit();
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
showCalendar() {
|
|
763
|
+
const top = this._textInput.errorMessage ? 0 : -17;
|
|
764
|
+
this._calendar.fitVertical(top, this._elem.clientHeight);
|
|
765
|
+
this._calendar.style.visibility = 'inherit';
|
|
766
|
+
}
|
|
767
|
+
parseDate() {
|
|
768
|
+
const strValue = this._textInput.value;
|
|
769
|
+
const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
|
|
770
|
+
const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
|
|
771
|
+
const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
|
|
772
|
+
const parsedTime = index$1.TimeFormatter.prepareValue(onlyTime, this.showSeconds);
|
|
773
|
+
const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
|
|
774
|
+
const parsedDate = DateUtils.strToDate(strDateTime);
|
|
775
|
+
if (parsedDate || !strValue) {
|
|
776
|
+
if (this.value === parsedDate) {
|
|
777
|
+
this.changeValue(this.value);
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
this.changeValue(parsedDate);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
this._textInput.errorMessage = "O valor digitado não é uma data válida";
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
getTextValue(d) {
|
|
788
|
+
const options = {
|
|
789
|
+
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
790
|
+
hour: 'numeric', minute: 'numeric'
|
|
791
|
+
};
|
|
792
|
+
const optionsSecond = {
|
|
793
|
+
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
794
|
+
hour: 'numeric', minute: 'numeric', second: 'numeric'
|
|
795
|
+
};
|
|
796
|
+
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : null;
|
|
797
|
+
}
|
|
798
|
+
componentDidLoad() {
|
|
799
|
+
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
800
|
+
}
|
|
801
|
+
render() {
|
|
802
|
+
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, onFocus: () => this.onFocused(), onClick: () => this.onClicked() }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
|
|
803
|
+
}
|
|
804
|
+
get _elem() { return index.getElement(this); }
|
|
805
|
+
static get watchers() { return {
|
|
806
|
+
"label": ["setLabel"],
|
|
807
|
+
"errorMessage": ["setErrorMessage"],
|
|
808
|
+
"value": ["applyValueToInput"]
|
|
809
|
+
}; }
|
|
810
|
+
};
|
|
811
|
+
EzDateTimeInput.style = ezDateTimeInputCss;
|
|
812
|
+
|
|
648
813
|
const buildTextArea = ({ name, label }) => {
|
|
649
814
|
return (index.h("div", { class: "col col--sd-12 padding--small", key: name },
|
|
650
815
|
index.h("ez-text-area", { label: label, "data-field-name": name })));
|
|
@@ -694,6 +859,10 @@ const buildDate = ({ name, label }) => {
|
|
|
694
859
|
return (index.h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
695
860
|
index.h("ez-date-input", { label: label, "data-field-name": name, key: name })));
|
|
696
861
|
};
|
|
862
|
+
const buildTimeDate = ({ name, label }) => {
|
|
863
|
+
return (index.h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
864
|
+
index.h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
|
|
865
|
+
};
|
|
697
866
|
|
|
698
867
|
const buildDecimal = ({ name, label }, properties) => {
|
|
699
868
|
const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
@@ -716,6 +885,7 @@ uiBuilders.set(index$1.UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
|
716
885
|
uiBuilders.set(index$1.UserInterface.SEARCH, buildSearch);
|
|
717
886
|
uiBuilders.set(index$1.UserInterface.FILE, buildFile);
|
|
718
887
|
uiBuilders.set(index$1.UserInterface.DATE, buildDate);
|
|
888
|
+
uiBuilders.set(index$1.UserInterface.DATETIME, buildTimeDate);
|
|
719
889
|
uiBuilders.set(index$1.UserInterface.DECIMALNUMBER, buildDecimal);
|
|
720
890
|
uiBuilders.set(index$1.UserInterface.INTEGERNUMBER, buildInteger);
|
|
721
891
|
const buildField = (field) => {
|
|
@@ -1210,8 +1380,14 @@ var FormActions;
|
|
|
1210
1380
|
|
|
1211
1381
|
class DataBinder {
|
|
1212
1382
|
constructor(dataUnit) {
|
|
1213
|
-
this._dataUnit = dataUnit;
|
|
1214
1383
|
this._fields = new Map();
|
|
1384
|
+
this._dataUnit = dataUnit;
|
|
1385
|
+
this._dataUnit.subscribe(_action => {
|
|
1386
|
+
var _a;
|
|
1387
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
1388
|
+
this.updateValue(field.fieldName, field.field);
|
|
1389
|
+
});
|
|
1390
|
+
});
|
|
1215
1391
|
}
|
|
1216
1392
|
bind(fields) {
|
|
1217
1393
|
fields.forEach(fieldElement => {
|
|
@@ -2411,6 +2587,7 @@ exports.ez_check = EzCheck;
|
|
|
2411
2587
|
exports.ez_collapsible_box = EzCollapsibleBox;
|
|
2412
2588
|
exports.ez_combo_box = EzComboBox;
|
|
2413
2589
|
exports.ez_date_input = EzDateInput;
|
|
2590
|
+
exports.ez_date_time_input = EzDateTimeInput;
|
|
2414
2591
|
exports.ez_form = EzForm;
|
|
2415
2592
|
exports.ez_number_input = EzNumberInput;
|
|
2416
2593
|
exports.ez_search = EzSearch;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index$1 = require('./index-2003dec4.js');
|
|
6
|
-
const index = require('./index-
|
|
6
|
+
const index = require('./index-4fc4a0a4.js');
|
|
7
7
|
const AssetsUtils = require('./AssetsUtils-02db4f46.js');
|
|
8
8
|
|
|
9
9
|
var agGridCommunity_cjs = index.createCommonjsModule(function (module, exports) {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2003dec4.js');
|
|
6
6
|
const AssetsUtils = require('./AssetsUtils-02db4f46.js');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-4fc4a0a4.js');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Classe com utiliários comuns para Strings.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2003dec4.js');
|
|
6
|
-
require('./index-
|
|
6
|
+
require('./index-4fc4a0a4.js');
|
|
7
7
|
const FloatingManager = require('./FloatingManager-6cfeb947.js');
|
|
8
8
|
|
|
9
9
|
const ezPopoverCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--more-visible, 1);position:relative;display:flex;user-select:none;width:100%}.box{z-index:var(--ez-popover__box--z-index);display:flex;flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.box--fit-content{width:fit-content}.box--full-width{width:100%}";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2003dec4.js');
|
|
6
|
-
const index$1 = require('./index-
|
|
6
|
+
const index$1 = require('./index-4fc4a0a4.js');
|
|
7
7
|
const CSSVarsUtils = require('./CSSVarsUtils-66e86394.js');
|
|
8
8
|
const AssetsUtils = require('./AssetsUtils-02db4f46.js');
|
|
9
9
|
|
package/dist/cjs/ezui.cjs.js
CHANGED
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[0,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-
|
|
18
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[0,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"show":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513]}]]],["ez-button_3.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}],[1,"select-box",{"selectedOption":[1,"selected-option"]}],[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"size":[513]}]]],["ez-calendar_14.cjs",[[0,"test-du"],[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}],[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"]}],[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"]}],[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"]}],[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"]}],[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}],[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"setFocus":[64],"setBlur":[64]}],[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]}],[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"],"optionLoader":[16],"_preSelection":[32],"_visibleOptions":[32]}],[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}],[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}],[1,"ez-tabselector",{"selectedIndex":[1537,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}],[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]],["ez-modal_2.cjs",[[1,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}],[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]]], options);
|
|
19
19
|
});
|
|
@@ -803,11 +803,7 @@ class AddedRecordsReducerImpl {
|
|
|
803
803
|
reduce(_stateManager, currentState, action) {
|
|
804
804
|
switch (action.type) {
|
|
805
805
|
case exports.Action.RECORDS_ADDED:
|
|
806
|
-
|
|
807
|
-
action.payload.forEach((r) => {
|
|
808
|
-
newState.push(Object.assign({ __record__id__: "NEW_" + (newState.length + 1) }, r));
|
|
809
|
-
});
|
|
810
|
-
return newState;
|
|
806
|
+
return (currentState || []).concat(action.payload);
|
|
811
807
|
case exports.Action.DATA_SAVED:
|
|
812
808
|
case exports.Action.EDITION_CANCELED:
|
|
813
809
|
return undefined;
|
|
@@ -819,6 +815,10 @@ const AddedRecordsReducer = new AddedRecordsReducerImpl();
|
|
|
819
815
|
const getAddedRecords = (stateManager) => {
|
|
820
816
|
return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
|
|
821
817
|
};
|
|
818
|
+
const prepareAddedRecordId = (stateManager, source) => {
|
|
819
|
+
let index = (getAddedRecords(stateManager) || []).length;
|
|
820
|
+
return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
|
|
821
|
+
};
|
|
822
822
|
|
|
823
823
|
class ChangesReducerImpl {
|
|
824
824
|
constructor() {
|
|
@@ -831,7 +831,9 @@ class ChangesReducerImpl {
|
|
|
831
831
|
if (selection) {
|
|
832
832
|
const newState = new Map(currentState);
|
|
833
833
|
selection.forEach(recordId => {
|
|
834
|
-
|
|
834
|
+
const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
|
|
835
|
+
delete newChanges.records;
|
|
836
|
+
newState.set(recordId, newChanges);
|
|
835
837
|
});
|
|
836
838
|
return newState;
|
|
837
839
|
}
|
|
@@ -860,16 +862,14 @@ const getChangesToSave = (dataUnit, stateManager) => {
|
|
|
860
862
|
const result = [];
|
|
861
863
|
const changes = getChanges(stateManager);
|
|
862
864
|
const records = getRecords(stateManager);
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
|
|
869
|
-
}
|
|
865
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => {
|
|
866
|
+
if (changes) {
|
|
867
|
+
const c = changes.get(r.__record__id__);
|
|
868
|
+
if (c) {
|
|
869
|
+
result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
|
|
870
870
|
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
873
|
const addedRecords = getAddedRecords(stateManager);
|
|
874
874
|
if (addedRecords) {
|
|
875
875
|
addedRecords.forEach(r => {
|
|
@@ -878,7 +878,7 @@ const getChangesToSave = (dataUnit, stateManager) => {
|
|
|
878
878
|
}
|
|
879
879
|
const removedRecords = getRemovedRecords(stateManager);
|
|
880
880
|
const recordsById = {};
|
|
881
|
-
records.forEach(r => recordsById[r.__record__id__] = r);
|
|
881
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
|
|
882
882
|
if (removedRecords) {
|
|
883
883
|
removedRecords.forEach(id => {
|
|
884
884
|
result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
|
|
@@ -934,6 +934,8 @@ class SelectionReducerImpl {
|
|
|
934
934
|
}
|
|
935
935
|
reduce(stateManager, currentState, action) {
|
|
936
936
|
switch (action.type) {
|
|
937
|
+
case exports.Action.RECORDS_ADDED:
|
|
938
|
+
return action.payload.map((r) => r.__record__id__);
|
|
937
939
|
case exports.Action.DATA_SAVED:
|
|
938
940
|
return updateSavedIds(stateManager, action.payload.records);
|
|
939
941
|
case exports.Action.RECORDS_REMOVED:
|
|
@@ -1035,6 +1037,15 @@ function updateSavedIds(stateManager, savedRecords) {
|
|
|
1035
1037
|
return currentSelection;
|
|
1036
1038
|
}
|
|
1037
1039
|
|
|
1040
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1041
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1042
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1043
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1044
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1045
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1046
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1047
|
+
});
|
|
1048
|
+
};
|
|
1038
1049
|
class DataUnit {
|
|
1039
1050
|
constructor(name) {
|
|
1040
1051
|
this._name = name;
|
|
@@ -1076,32 +1087,46 @@ class DataUnit {
|
|
|
1076
1087
|
}
|
|
1077
1088
|
// Loaders
|
|
1078
1089
|
loadMetadata() {
|
|
1079
|
-
this
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1090
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1091
|
+
this.dispatchAction(exports.Action.LOADING_METADATA);
|
|
1092
|
+
return new Promise((resolve, fail) => {
|
|
1093
|
+
if (this.metadataLoader) {
|
|
1094
|
+
this.metadataLoader(this._name).then(metadata => {
|
|
1095
|
+
this.metadata = metadata;
|
|
1096
|
+
resolve(this.metadata);
|
|
1097
|
+
}).catch(error => fail(error));
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1083
1101
|
}
|
|
1084
1102
|
loadData() {
|
|
1085
|
-
this
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
this.records
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1104
|
+
this.dispatchAction(exports.Action.LOADING_DATA);
|
|
1105
|
+
return new Promise((resolve, fail) => {
|
|
1106
|
+
if (this.dataLoader) {
|
|
1107
|
+
const sort = this.getSort();
|
|
1108
|
+
const filters = this.getFilters();
|
|
1109
|
+
this.dataLoader(this._name, sort, filters).then(records => {
|
|
1110
|
+
this.records = records;
|
|
1111
|
+
resolve(this.records);
|
|
1112
|
+
}).catch(error => fail(error));
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1095
1115
|
});
|
|
1096
1116
|
}
|
|
1097
1117
|
saveData() {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1119
|
+
const changes = getChangesToSave(this._name, this._stateManager);
|
|
1120
|
+
if (changes.length > 0) {
|
|
1121
|
+
this.dispatchAction(exports.Action.SAVING_DATA);
|
|
1122
|
+
return new Promise((resolve, fail) => {
|
|
1123
|
+
if (this.saveLoader) {
|
|
1124
|
+
this.saveLoader(this._name, changes).then(records => this.dispatchAction(exports.Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
|
|
1125
|
+
}
|
|
1126
|
+
});
|
|
1103
1127
|
}
|
|
1104
|
-
|
|
1128
|
+
return Promise.resolve();
|
|
1129
|
+
});
|
|
1105
1130
|
}
|
|
1106
1131
|
// API
|
|
1107
1132
|
addFilterProvider(provider) {
|
|
@@ -1127,7 +1152,7 @@ class DataUnit {
|
|
|
1127
1152
|
return getField(this._stateManager, fieldName);
|
|
1128
1153
|
}
|
|
1129
1154
|
addRecord() {
|
|
1130
|
-
this.dispatchAction(exports.Action.RECORDS_ADDED, [{}]);
|
|
1155
|
+
this.dispatchAction(exports.Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
|
|
1131
1156
|
}
|
|
1132
1157
|
removeSelectedRecords() {
|
|
1133
1158
|
const selection = getSelection(this._stateManager);
|
|
@@ -1200,9 +1225,9 @@ class DataUnit {
|
|
|
1200
1225
|
}
|
|
1201
1226
|
var ChangeOperation;
|
|
1202
1227
|
(function (ChangeOperation) {
|
|
1203
|
-
ChangeOperation[
|
|
1204
|
-
ChangeOperation[
|
|
1205
|
-
ChangeOperation[
|
|
1228
|
+
ChangeOperation["INSERT"] = "INSERT";
|
|
1229
|
+
ChangeOperation["UPDATE"] = "UPDATE";
|
|
1230
|
+
ChangeOperation["DELETE"] = "DELETE";
|
|
1206
1231
|
})(ChangeOperation || (ChangeOperation = {}));
|
|
1207
1232
|
class Change {
|
|
1208
1233
|
constructor(dataUnit, record, updates, operation) {
|
|
@@ -1211,6 +1236,9 @@ class Change {
|
|
|
1211
1236
|
this.updatingFields = updates;
|
|
1212
1237
|
this._operation = operation;
|
|
1213
1238
|
}
|
|
1239
|
+
get operation() {
|
|
1240
|
+
return this._operation.toString();
|
|
1241
|
+
}
|
|
1214
1242
|
isInsert() {
|
|
1215
1243
|
return this._operation === ChangeOperation.INSERT;
|
|
1216
1244
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["ez-grid.cjs",[[0,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-
|
|
17
|
+
return index.bootstrapLazy([["ez-grid.cjs",[[0,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64]}]]],["ez-dialog.cjs",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-time-input.cjs",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip.cjs",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application.cjs",[[0,"ez-application"]]],["ez-label-chip.cjs",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover.cjs",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup.cjs",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast.cjs",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"show":[64]}]]],["ez-icon.cjs",[[1,"ez-icon",{"size":[513],"href":[513]}]]],["ez-button_3.cjs",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}],[1,"select-box",{"selectedOption":[1,"selected-option"]}],[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"size":[513]}]]],["ez-calendar_14.cjs",[[0,"test-du"],[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}],[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"]}],[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"]}],[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"]}],[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"]}],[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}],[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"setFocus":[64],"setBlur":[64]}],[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]}],[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"],"optionLoader":[16],"_preSelection":[32],"_visibleOptions":[32]}],[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}],[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}],[1,"ez-tabselector",{"selectedIndex":[1537,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}],[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"restrict":[1],"setFocus":[64],"setBlur":[64]}]]],["ez-modal_2.cjs",[[1,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}],[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export default class DataBinder {
|
|
2
2
|
constructor(dataUnit) {
|
|
3
|
-
this._dataUnit = dataUnit;
|
|
4
3
|
this._fields = new Map();
|
|
4
|
+
this._dataUnit = dataUnit;
|
|
5
|
+
this._dataUnit.subscribe(_action => {
|
|
6
|
+
var _a;
|
|
7
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
8
|
+
this.updateValue(field.fieldName, field.field);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
5
11
|
}
|
|
6
12
|
bind(fields) {
|
|
7
13
|
fields.forEach(fieldElement => {
|
|
@@ -5,7 +5,7 @@ import { buildCheckBox, buildSwitch } from "./tpl/CheckBox.tpl";
|
|
|
5
5
|
import { buildComboBox } from "./tpl/ComboBox.tpl";
|
|
6
6
|
import { buildSearch } from "./tpl/SearchInput.tpl";
|
|
7
7
|
import { buildFile } from "./tpl/FileInput.tpl";
|
|
8
|
-
import { buildDate } from "./tpl/DateInput.tpl";
|
|
8
|
+
import { buildDate, buildTimeDate } from "./tpl/DateInput.tpl";
|
|
9
9
|
import { buildInteger, buildDecimal } from "./tpl/NumberInput.tpl";
|
|
10
10
|
const uiBuilders = new Map();
|
|
11
11
|
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
@@ -15,6 +15,7 @@ uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
|
15
15
|
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
16
16
|
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
17
17
|
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
18
|
+
uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
|
|
18
19
|
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
19
20
|
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
20
21
|
export const buildField = (field) => {
|
|
@@ -3,3 +3,7 @@ export const buildDate = ({ name, label }) => {
|
|
|
3
3
|
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
4
4
|
h("ez-date-input", { label: label, "data-field-name": name, key: name })));
|
|
5
5
|
};
|
|
6
|
+
export const buildTimeDate = ({ name, label }) => {
|
|
7
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8
|
+
h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
|
|
9
|
+
};
|