@sankhyalabs/ezui 1.1.76 → 1.1.77
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/ApplicationUtils-d1c1db56.js +35 -0
- package/dist/cjs/AssetsUtils-dd585fba.js +24 -0
- package/dist/cjs/DataUnit-fdd7c70e.js +474 -0
- package/dist/cjs/DateUtils-716769e0.js +46 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +28 -0
- package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +212 -0
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +630 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +250 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +144 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1838 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +61 -190
- package/dist/cjs/ez-popover.cjs.entry.js +3 -3
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +9 -27
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +3 -3
- package/dist/cjs/form-metadata.cjs.entry.js +129 -0
- package/dist/cjs/index-262d703b.js +7442 -0
- package/dist/cjs/{index-9431aeeb.js → index-4e4bae01.js} +1 -5
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +8 -3
- package/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/collection/components/ez-application/ez-application.js +37 -0
- package/dist/collection/components/ez-button/ez-button.css +16 -1
- package/dist/collection/components/ez-button/ez-button.js +27 -2
- package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
- package/dist/collection/components/ez-calendar/ez-calendar.js +168 -24
- package/dist/collection/components/ez-check/ez-check.css +78 -78
- package/dist/collection/components/ez-check/ez-check.js +3 -3
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +67 -51
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +49 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +254 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +4 -4
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +2 -2
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
- package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
- package/dist/collection/components/ez-grid/ez-grid.css +15 -0
- package/dist/collection/components/ez-grid/ez-grid.js +414 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
- package/dist/collection/components/ez-icon/ez-icon.css +1 -1
- package/dist/collection/components/ez-list/ez-list.css +227 -44
- package/dist/collection/components/ez-list/ez-list.js +529 -149
- package/dist/collection/components/ez-modal/ez-modal.css +4 -4
- package/dist/collection/components/ez-modal/ez-modal.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +7 -162
- package/dist/collection/components/ez-number-input/ez-number-input.js +90 -281
- package/dist/collection/components/ez-popover/ez-popover.css +10 -6
- package/dist/collection/components/ez-popup/ez-popup.css +25 -27
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
- package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +1 -0
- package/dist/collection/components/ez-upload/ez-upload.js +3 -3
- package/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/collection/components/test-du/test-du.js +45 -0
- package/dist/collection/servidor.js +94 -94
- package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
- package/dist/custom-elements/index.d.ts +36 -6
- package/dist/custom-elements/index.js +120975 -3013
- package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
- package/dist/esm/AssetsUtils-3803e935.js +22 -0
- package/dist/esm/DataUnit-1cd45202.js +464 -0
- package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +24 -0
- package/dist/esm/ez-button_11.entry.js +111757 -0
- package/dist/esm/ez-calendar.entry.js +208 -0
- package/dist/esm/ez-collapsible-box_6.entry.js +621 -0
- package/dist/esm/ez-combo-box.entry.js +246 -0
- package/dist/esm/ez-date-time-input.entry.js +140 -0
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1834 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +61 -190
- package/dist/esm/ez-popover.entry.js +3 -3
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-time-input.entry.js +3 -21
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/form-metadata.entry.js +125 -0
- package/dist/esm/{index-fd3c8023.js → index-1dacecd3.js} +1 -5
- package/dist/esm/index-cfd5e193.js +7433 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1ea8187e.entry.js +369 -0
- package/dist/ezui/p-37a611ea.js +1 -0
- package/dist/ezui/p-45689464.entry.js +1 -0
- package/dist/ezui/{p-a0b6eee2.entry.js → p-516d0e0f.entry.js} +1 -1
- package/dist/ezui/p-57291f97.entry.js +1 -0
- package/dist/ezui/{p-66954a04.entry.js → p-5a86e18a.entry.js} +1 -1
- package/dist/ezui/{p-823ff0a0.entry.js → p-5da66d3e.entry.js} +1 -1
- package/dist/ezui/p-69416bec.entry.js +1 -0
- package/dist/ezui/p-7107d7ef.js +1 -0
- package/dist/ezui/p-7ef97c5f.entry.js +1 -0
- package/dist/ezui/p-88f45a83.entry.js +1 -0
- package/dist/ezui/p-8c51a6aa.entry.js +1 -0
- package/dist/ezui/{p-e0ab3746.js → p-8f4851a6.js} +1 -1
- package/dist/ezui/p-9dfd537e.js +1 -0
- package/dist/ezui/{p-d443f020.entry.js → p-a18a2d7b.entry.js} +1 -1
- package/dist/ezui/p-a223eed8.entry.js +1 -0
- package/dist/ezui/p-b36308e7.js +1 -0
- package/dist/ezui/p-c0af195b.entry.js +1 -0
- package/dist/ezui/p-c6d469fc.entry.js +1 -0
- package/dist/ezui/p-c89629eb.js +1 -0
- package/dist/ezui/p-e7ee2836.entry.js +1 -0
- package/dist/ezui/p-f7b835cf.entry.js +1 -0
- package/dist/types/components/ez-application/ez-application.d.ts +12 -0
- package/dist/types/components/ez-button/ez-button.d.ts +5 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
- package/dist/types/components/ez-check/ez-check.d.ts +1 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
- package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
- package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
- package/dist/types/components/ez-list/ez-list.d.ts +70 -17
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +33 -50
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
- package/dist/types/components/test-du/test-du.d.ts +6 -0
- package/dist/types/components.d.ts +283 -117
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/{Application.d.ts → ApplicationUtils.d.ts} +1 -1
- package/package.json +10 -8
- package/react/components.d.ts +6 -1
- package/react/components.js +6 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
- package/dist/cjs/ez-button_16.cjs.entry.js +0 -4079
- package/dist/cjs/ez-list.cjs.entry.js +0 -174
- package/dist/cjs/ez-modal.cjs.entry.js +0 -65
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
- package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
- package/dist/esm/ez-button_16.entry.js +0 -4060
- package/dist/esm/ez-list.entry.js +0 -170
- package/dist/esm/ez-modal.entry.js +0 -61
- package/dist/ezui/p-11ae4ae7.entry.js +0 -1
- package/dist/ezui/p-47fa3d6c.entry.js +0 -1
- package/dist/ezui/p-8ab6168f.entry.js +0 -1
- package/dist/ezui/p-9c1fb51c.entry.js +0 -1
- package/dist/ezui/p-9d85125b.entry.js +0 -1
- package/dist/ezui/p-9dfccb16.js +0 -1
- package/dist/ezui/p-a7b546b2.entry.js +0 -1
- package/dist/ezui/p-c833c94f.entry.js +0 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4e4bae01.js');
|
|
6
|
+
require('./index-262d703b.js');
|
|
7
|
+
const FloatingManager = require('./FloatingManager-6cfeb947.js');
|
|
8
|
+
|
|
9
|
+
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%)}";
|
|
10
|
+
|
|
11
|
+
let EzCalendar = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
15
|
+
this._firstRender = true;
|
|
16
|
+
this._todayLabel = "Hoje";
|
|
17
|
+
this._weekDayLabels = ["D", "S", "T", "Q", "Q", "S", "S"];
|
|
18
|
+
this._monthLabels = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
|
19
|
+
this._hoursLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
|
|
20
|
+
this._minutosLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"];
|
|
21
|
+
/**
|
|
22
|
+
* A data selecionada no calendário
|
|
23
|
+
*/
|
|
24
|
+
this.value = new Date();
|
|
25
|
+
/**
|
|
26
|
+
* No modo floating o calendário só se tornará visível
|
|
27
|
+
* quando o método show() for acionado.
|
|
28
|
+
*/
|
|
29
|
+
this.floating = false;
|
|
30
|
+
/**
|
|
31
|
+
* Exibe ou não as horas e minutos no calendario
|
|
32
|
+
*/
|
|
33
|
+
this.time = false;
|
|
34
|
+
/**
|
|
35
|
+
* Exibe ou não os segundos no calendario
|
|
36
|
+
*/
|
|
37
|
+
this.showSeconds = false;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
41
|
+
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
42
|
+
* top, left, bottom e right. Esses parâmetros devem ser informados como
|
|
43
|
+
* strings no formato css.
|
|
44
|
+
*/
|
|
45
|
+
async show(top, left, bottom, right) {
|
|
46
|
+
if (this.floating) {
|
|
47
|
+
this._floatingID = FloatingManager.FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
|
|
48
|
+
window.requestAnimationFrame(() => {
|
|
49
|
+
this._box.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Método necessário para ajustar o posicionamento do calendar acima ou abaixo do ez-date-input conforme a disponibilidade de espaço.
|
|
55
|
+
*/
|
|
56
|
+
async fitVertical(topOffset, bottomOffset) {
|
|
57
|
+
const neededHeight = this._container.getBoundingClientRect().bottom + this._calendarHeight;
|
|
58
|
+
const availableBottom = (window.innerHeight || document.documentElement.clientHeight) > neededHeight;
|
|
59
|
+
if (availableBottom) {
|
|
60
|
+
this.show(topOffset + "px", undefined, "unset");
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.show("unset", undefined, bottomOffset + "px");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
68
|
+
*/
|
|
69
|
+
async hide() {
|
|
70
|
+
if (this._floatingID !== undefined) {
|
|
71
|
+
FloatingManager.FloatingManager.close(this._floatingID);
|
|
72
|
+
this._floatingID = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
valueChanged() {
|
|
76
|
+
if (this.value) {
|
|
77
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
78
|
+
this._currentPosition.setDate(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getMonthLabel() {
|
|
82
|
+
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
83
|
+
}
|
|
84
|
+
isSelectedDate(d) {
|
|
85
|
+
if (this.value) {
|
|
86
|
+
return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
changeMonth(offset) {
|
|
91
|
+
this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
|
|
92
|
+
index.forceUpdate(this);
|
|
93
|
+
}
|
|
94
|
+
selectDate(d) {
|
|
95
|
+
let newDate = d;
|
|
96
|
+
if (this.value) {
|
|
97
|
+
newDate.setHours(this.value.getHours());
|
|
98
|
+
newDate.setMinutes(this.value.getMinutes());
|
|
99
|
+
newDate.setSeconds(this.value.getSeconds());
|
|
100
|
+
}
|
|
101
|
+
this.value = newDate;
|
|
102
|
+
this.ezChange.emit();
|
|
103
|
+
}
|
|
104
|
+
selectHours(hour) {
|
|
105
|
+
if (!this.value) {
|
|
106
|
+
this.value = new Date();
|
|
107
|
+
}
|
|
108
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), hour, this.value.getMinutes(), this.value.getSeconds());
|
|
109
|
+
this.ezChange.emit();
|
|
110
|
+
}
|
|
111
|
+
selectMinutes(minute) {
|
|
112
|
+
if (!this.value) {
|
|
113
|
+
this.value = new Date();
|
|
114
|
+
}
|
|
115
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), minute, this.value.getSeconds());
|
|
116
|
+
this.ezChange.emit();
|
|
117
|
+
}
|
|
118
|
+
selectSeconds(second) {
|
|
119
|
+
if (!this.value) {
|
|
120
|
+
this.value = new Date();
|
|
121
|
+
}
|
|
122
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), this.value.getMinutes(), second);
|
|
123
|
+
this.ezChange.emit();
|
|
124
|
+
}
|
|
125
|
+
updateScroll(element) {
|
|
126
|
+
if (element) {
|
|
127
|
+
const { scrollHeight, clientHeight, scrollTop } = element;
|
|
128
|
+
const remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
|
|
129
|
+
if (remainingScroll > 0) {
|
|
130
|
+
element.classList.add("endHidden");
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
element.classList.remove("endHidden");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
componentDidRender() {
|
|
138
|
+
if (this.floating && this._firstRender) {
|
|
139
|
+
this._calendarHeight = this._box.clientHeight;
|
|
140
|
+
this._box.remove();
|
|
141
|
+
this._firstRender = false;
|
|
142
|
+
}
|
|
143
|
+
this.updateScroll(this._hoursScroll);
|
|
144
|
+
this.updateScroll(this._minutesScroll);
|
|
145
|
+
this.updateScroll(this._secondsScroll);
|
|
146
|
+
}
|
|
147
|
+
componentDidLoad() {
|
|
148
|
+
if (this.time || this.showSeconds) {
|
|
149
|
+
this._hoursScroll.scrollTop = this._hoursSelect.offsetTop - 64;
|
|
150
|
+
this._minutesScroll.scrollTop = this._minutesSelect.offsetTop - 64;
|
|
151
|
+
if (this.showSeconds) {
|
|
152
|
+
this._secondsScroll.scrollTop = this._secondsSelect.offsetTop - 64;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
render() {
|
|
157
|
+
if (this._currentPosition == null) {
|
|
158
|
+
this._currentPosition = new Date();
|
|
159
|
+
if (this.value) {
|
|
160
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
161
|
+
}
|
|
162
|
+
this._currentPosition.setDate(1);
|
|
163
|
+
}
|
|
164
|
+
const firstDate = new Date();
|
|
165
|
+
firstDate.setTime(this._currentPosition.getTime());
|
|
166
|
+
firstDate.setDate(1 - firstDate.getDay());
|
|
167
|
+
return (index.h("section", { ref: elem => this._container = elem }, index.h("div", { ref: elem => this._box = elem, style: { display: 'flex' } }, index.h("div", { class: "calendar" }, index.h("div", { class: "calendar__header" }, index.h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }), index.h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()), index.h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })), index.h("div", { class: "calendar__body" }, index.h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => index.h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))), [0, 7, 14, 21, 28, 35].map(offset => index.h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index$1 => {
|
|
168
|
+
const date = new Date();
|
|
169
|
+
date.setTime(firstDate.getTime());
|
|
170
|
+
date.setDate(date.getDate() + offset + index$1);
|
|
171
|
+
let classNames = "calendar__cell";
|
|
172
|
+
if (this._currentPosition.getMonth() != date.getMonth()) {
|
|
173
|
+
classNames += " calendar__cell--secondary";
|
|
174
|
+
}
|
|
175
|
+
else if (this.isSelectedDate(date)) {
|
|
176
|
+
classNames += " calendar__cell--selected";
|
|
177
|
+
}
|
|
178
|
+
return index.h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
|
|
179
|
+
})))), index.h("div", { class: "calendar__footer" }, index.h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel))), (this.time || this.showSeconds) &&
|
|
180
|
+
index.h("div", { class: "calendarTime" }, index.h("div", { class: "calendarTime__header" }, index.h("div", null, "H"), index.h("div", { class: "separatorTime" }, ":"), index.h("div", null, "M"), this.showSeconds &&
|
|
181
|
+
index.h("div", { class: "separatorTime" }, ":"), this.showSeconds &&
|
|
182
|
+
index.h("div", null, "S")), index.h("div", { class: "calendar__body ", style: { display: 'flex', paddingLeft: '6px', paddingRight: '6px' } }, index.h("div", { class: "calendar__column", ref: elem => this._hoursScroll = elem, onScroll: () => this.updateScroll(this._hoursScroll) }, this._hoursLabel.map((offset, index$1) => {
|
|
183
|
+
if (index$1 === this.value.getHours()) {
|
|
184
|
+
return (index.h("div", { style: { display: 'flex' }, ref: elem => this._hoursSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
|
|
188
|
+
}
|
|
189
|
+
})), index.h("div", { class: "calendar__column", ref: elem => this._minutesScroll = elem, onScroll: () => this.updateScroll(this._minutesScroll) }, this._minutosLabel.map((offset, index$1) => {
|
|
190
|
+
if (index$1 === this.value.getMinutes()) {
|
|
191
|
+
return (index.h("div", { style: { display: 'flex' }, ref: elem => this._minutesSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
|
|
195
|
+
}
|
|
196
|
+
})), this.showSeconds &&
|
|
197
|
+
index.h("div", { class: "calendar__column", ref: elem => this._secondsScroll = elem, onScroll: () => this.updateScroll(this._secondsScroll) }, this._minutosLabel.map((offset, index$1) => {
|
|
198
|
+
if (index$1 === this.value.getSeconds()) {
|
|
199
|
+
return (index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectSeconds(index$1), ref: elem => this._secondsSelect = elem }, offset));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
return (index.h("div", { class: "calendar__cell", onClick: () => this.selectSeconds(index$1) }, offset));
|
|
203
|
+
}
|
|
204
|
+
})))))));
|
|
205
|
+
}
|
|
206
|
+
static get watchers() { return {
|
|
207
|
+
"value": ["valueChanged"]
|
|
208
|
+
}; }
|
|
209
|
+
};
|
|
210
|
+
EzCalendar.style = ezCalendarCss;
|
|
211
|
+
|
|
212
|
+
exports.ez_calendar = EzCalendar;
|