@sankhyalabs/ezui 1.1.8 → 1.1.9
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/README.md +72 -72
- package/dist/cjs/{DataUnit-28b290cb.js → DataUnit-9a4a35ca.js} +415 -371
- package/dist/cjs/ez-action-chip.cjs.entry.js +41 -41
- package/dist/cjs/ez-button_14.cjs.entry.js +1911 -1911
- package/dist/cjs/ez-label-chip.cjs.entry.js +120 -120
- package/dist/cjs/ez-modal.cjs.entry.js +104 -104
- package/dist/cjs/ez-number-input.cjs.entry.js +236 -236
- package/dist/cjs/ez-time-input.cjs.entry.js +168 -168
- package/dist/cjs/form-metadata.cjs.entry.js +65 -65
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -82
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -109
- package/dist/collection/components/ez-button/ez-button.css +94 -94
- package/dist/collection/components/ez-button/ez-button.js +125 -125
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -210
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -215
- package/dist/collection/components/ez-check/ez-check.css +265 -265
- package/dist/collection/components/ez-check/ez-check.js +168 -168
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +67 -67
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -108
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -167
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -363
- package/dist/collection/components/ez-date-input/ez-date-input.css +38 -38
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -172
- package/dist/collection/components/ez-form/ez-form.css +19 -19
- package/dist/collection/components/ez-form/ez-form.js +368 -368
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +251 -207
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -16
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +23 -23
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -173
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -71
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -40
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -27
- package/dist/collection/components/ez-icon/ez-icon.css +36 -36
- package/dist/collection/components/ez-icon/ez-icon.js +56 -56
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -117
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -276
- package/dist/collection/components/ez-modal/ez-modal.css +86 -86
- package/dist/collection/components/ez-modal/ez-modal.js +224 -224
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -144
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -465
- package/dist/collection/components/ez-popover/ez-popover.css +38 -38
- package/dist/collection/components/ez-popover/ez-popover.js +323 -323
- package/dist/collection/components/ez-search/ez-search.css +295 -295
- package/dist/collection/components/ez-search/ez-search.js +527 -527
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +125 -125
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +283 -283
- package/dist/collection/components/ez-text-area/ez-text-area.css +139 -139
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -267
- package/dist/collection/components/ez-text-input/ez-text-input.css +169 -169
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -395
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -155
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -326
- package/dist/collection/index.js +1 -1
- package/dist/collection/servidor.js +100 -100
- package/dist/collection/utils/FloatingManager.js +15 -15
- package/dist/collection/utils/utils.js +6 -6
- package/dist/custom-elements/index.js +3125 -3081
- package/dist/esm/{DataUnit-69e518fa.js → DataUnit-d5d4c9a3.js} +415 -371
- package/dist/esm/ez-action-chip.entry.js +41 -41
- package/dist/esm/ez-button_14.entry.js +1911 -1911
- package/dist/esm/ez-label-chip.entry.js +120 -120
- package/dist/esm/ez-modal.entry.js +104 -104
- package/dist/esm/ez-number-input.entry.js +236 -236
- package/dist/esm/ez-time-input.entry.js +168 -168
- package/dist/esm/form-metadata.entry.js +65 -65
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-b0974f4f.entry.js → p-0fcdfb51.entry.js} +1 -1
- package/dist/ezui/p-dac7a6c2.js +1 -0
- package/dist/ezui/{p-db11c600.entry.js → p-dbef7060.entry.js} +1 -1
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +26 -31
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +60 -55
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -17
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -32
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/package.json +114 -114
- package/dist/ezui/p-10ef58b3.js +0 -1
- package/react/components.d.ts +0 -22
- package/react/components.js +0 -25
- package/react/components.js.map +0 -1
- package/react/react-component-lib/createComponent.d.ts +0 -10
- package/react/react-component-lib/createComponent.js +0 -59
- package/react/react-component-lib/createComponent.js.map +0 -1
- package/react/react-component-lib/createOverlayComponent.d.ts +0 -20
- package/react/react-component-lib/createOverlayComponent.js +0 -89
- package/react/react-component-lib/createOverlayComponent.js.map +0 -1
- package/react/react-component-lib/index.d.ts +0 -2
- package/react/react-component-lib/index.js +0 -3
- package/react/react-component-lib/index.js.map +0 -1
- package/react/react-component-lib/interfaces.d.ts +0 -29
- package/react/react-component-lib/interfaces.js +0 -1
- package/react/react-component-lib/interfaces.js.map +0 -1
- package/react/react-component-lib/utils/attachProps.d.ts +0 -12
- package/react/react-component-lib/utils/attachProps.js +0 -96
- package/react/react-component-lib/utils/attachProps.js.map +0 -1
- package/react/react-component-lib/utils/case.d.ts +0 -2
- package/react/react-component-lib/utils/case.js +0 -7
- package/react/react-component-lib/utils/case.js.map +0 -1
- package/react/react-component-lib/utils/dev.d.ts +0 -2
- package/react/react-component-lib/utils/dev.js +0 -13
- package/react/react-component-lib/utils/dev.js.map +0 -1
- package/react/react-component-lib/utils/index.d.ts +0 -7
- package/react/react-component-lib/utils/index.js +0 -21
- package/react/react-component-lib/utils/index.js.map +0 -1
|
@@ -1,215 +1,215 @@
|
|
|
1
|
-
import { FloatingManager } from '@sankhyalabs/core';
|
|
2
|
-
import { Component, forceUpdate, h, Prop, Method, Event, Watch } from '@stencil/core';
|
|
3
|
-
export class EzCalendar {
|
|
4
|
-
constructor() {
|
|
5
|
-
this._firstRender = true;
|
|
6
|
-
this._todayLabel = 'Hoje';
|
|
7
|
-
this._weekDayLabels = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];
|
|
8
|
-
this._monthLabels = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
|
|
9
|
-
/**
|
|
10
|
-
* A data selecionada no calendário
|
|
11
|
-
*/
|
|
12
|
-
this.value = new Date();
|
|
13
|
-
/**
|
|
14
|
-
* No modo floating o calendário só se tornará visível
|
|
15
|
-
* quando o método show() for acionado.
|
|
16
|
-
*/
|
|
17
|
-
this.floating = false;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
21
|
-
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
22
|
-
* top, left, bottom e right. Esses parâmetros devem ser informados como
|
|
23
|
-
* strings no formato css.
|
|
24
|
-
*/
|
|
25
|
-
async show(top, left, bottom, right) {
|
|
26
|
-
if (this.floating) {
|
|
27
|
-
this._floatingID = FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
32
|
-
*/
|
|
33
|
-
async hide() {
|
|
34
|
-
if (this._floatingID !== undefined) {
|
|
35
|
-
FloatingManager.close(this._floatingID);
|
|
36
|
-
this._floatingID = undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
valueChanged() {
|
|
40
|
-
if (this.value) {
|
|
41
|
-
this._currentPosition.setTime(this.value.getTime());
|
|
42
|
-
this._currentPosition.setDate(1);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
getMonthLabel() {
|
|
46
|
-
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
47
|
-
}
|
|
48
|
-
isSelectedDate(d) {
|
|
49
|
-
if (this.value) {
|
|
50
|
-
return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
changeMonth(offset) {
|
|
55
|
-
this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
|
|
56
|
-
forceUpdate(this);
|
|
57
|
-
}
|
|
58
|
-
selectDate(d) {
|
|
59
|
-
this.value = d;
|
|
60
|
-
this.ezChange.emit();
|
|
61
|
-
}
|
|
62
|
-
componentDidRender() {
|
|
63
|
-
if (this.floating && this._firstRender) {
|
|
64
|
-
this._box.remove();
|
|
65
|
-
this._firstRender = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
if (this._currentPosition == null) {
|
|
70
|
-
this._currentPosition = new Date();
|
|
71
|
-
this._currentPosition.setTime(this.value.getTime());
|
|
72
|
-
this._currentPosition.setDate(1);
|
|
73
|
-
}
|
|
74
|
-
const firstDate = new Date();
|
|
75
|
-
firstDate.setTime(this._currentPosition.getTime());
|
|
76
|
-
firstDate.setDate(1 - firstDate.getDay());
|
|
77
|
-
return (h("section", { ref: elem => this._container = elem },
|
|
78
|
-
h("div", { class: "calendar", ref: elem => this._box = elem },
|
|
79
|
-
h("div", { class: "calendar__header" },
|
|
80
|
-
h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }),
|
|
81
|
-
h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()),
|
|
82
|
-
h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })),
|
|
83
|
-
h("div", { class: "calendar__body" },
|
|
84
|
-
h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))),
|
|
85
|
-
[0, 7, 14, 21, 28, 35].map(offset => h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index => {
|
|
86
|
-
const date = new Date();
|
|
87
|
-
date.setTime(firstDate.getTime());
|
|
88
|
-
date.setDate(date.getDate() + offset + index);
|
|
89
|
-
let classNames = "calendar__cell";
|
|
90
|
-
if (this._currentPosition.getMonth() != date.getMonth()) {
|
|
91
|
-
classNames += " calendar__cell--secondary";
|
|
92
|
-
}
|
|
93
|
-
else if (this.isSelectedDate(date)) {
|
|
94
|
-
classNames += " calendar__cell--selected";
|
|
95
|
-
}
|
|
96
|
-
return h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
|
|
97
|
-
})))),
|
|
98
|
-
h("div", { class: "calendar__footer" },
|
|
99
|
-
h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel)))));
|
|
100
|
-
}
|
|
101
|
-
static get is() { return "ez-calendar"; }
|
|
102
|
-
static get encapsulation() { return "shadow"; }
|
|
103
|
-
static get originalStyleUrls() { return {
|
|
104
|
-
"$": ["ez-calendar.css"]
|
|
105
|
-
}; }
|
|
106
|
-
static get styleUrls() { return {
|
|
107
|
-
"$": ["ez-calendar.css"]
|
|
108
|
-
}; }
|
|
109
|
-
static get properties() { return {
|
|
110
|
-
"value": {
|
|
111
|
-
"type": "unknown",
|
|
112
|
-
"mutable": true,
|
|
113
|
-
"complexType": {
|
|
114
|
-
"original": "Date",
|
|
115
|
-
"resolved": "Date",
|
|
116
|
-
"references": {
|
|
117
|
-
"Date": {
|
|
118
|
-
"location": "global"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"required": false,
|
|
123
|
-
"optional": false,
|
|
124
|
-
"docs": {
|
|
125
|
-
"tags": [],
|
|
126
|
-
"text": "A data selecionada no calend\u00E1rio"
|
|
127
|
-
},
|
|
128
|
-
"defaultValue": "new Date()"
|
|
129
|
-
},
|
|
130
|
-
"floating": {
|
|
131
|
-
"type": "boolean",
|
|
132
|
-
"mutable": false,
|
|
133
|
-
"complexType": {
|
|
134
|
-
"original": "boolean",
|
|
135
|
-
"resolved": "boolean",
|
|
136
|
-
"references": {}
|
|
137
|
-
},
|
|
138
|
-
"required": false,
|
|
139
|
-
"optional": false,
|
|
140
|
-
"docs": {
|
|
141
|
-
"tags": [],
|
|
142
|
-
"text": "No modo floating o calend\u00E1rio s\u00F3 se tornar\u00E1 vis\u00EDvel\nquando o m\u00E9todo show() for acionado."
|
|
143
|
-
},
|
|
144
|
-
"attribute": "floating",
|
|
145
|
-
"reflect": true,
|
|
146
|
-
"defaultValue": "false"
|
|
147
|
-
}
|
|
148
|
-
}; }
|
|
149
|
-
static get events() { return [{
|
|
150
|
-
"method": "ezChange",
|
|
151
|
-
"name": "ezChange",
|
|
152
|
-
"bubbles": true,
|
|
153
|
-
"cancelable": true,
|
|
154
|
-
"composed": true,
|
|
155
|
-
"docs": {
|
|
156
|
-
"tags": [],
|
|
157
|
-
"text": "Quando o usu\u00E1rio escolhe uma data, esse evento \u00E9 emitido."
|
|
158
|
-
},
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "string",
|
|
161
|
-
"resolved": "string",
|
|
162
|
-
"references": {}
|
|
163
|
-
}
|
|
164
|
-
}]; }
|
|
165
|
-
static get methods() { return {
|
|
166
|
-
"show": {
|
|
167
|
-
"complexType": {
|
|
168
|
-
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
169
|
-
"parameters": [{
|
|
170
|
-
"tags": [],
|
|
171
|
-
"text": ""
|
|
172
|
-
}, {
|
|
173
|
-
"tags": [],
|
|
174
|
-
"text": ""
|
|
175
|
-
}, {
|
|
176
|
-
"tags": [],
|
|
177
|
-
"text": ""
|
|
178
|
-
}, {
|
|
179
|
-
"tags": [],
|
|
180
|
-
"text": ""
|
|
181
|
-
}],
|
|
182
|
-
"references": {
|
|
183
|
-
"Promise": {
|
|
184
|
-
"location": "global"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"return": "Promise<void>"
|
|
188
|
-
},
|
|
189
|
-
"docs": {
|
|
190
|
-
"text": "Usado no modo floating. Faz com que o componente seja exibido.\n\u00C9 poss\u00EDvel determinar ajustes de posicionamento atrav\u00E9s dos par\u00E2metros\ntop, left, bottom e right. Esses par\u00E2metros devem ser informados como\nstrings no formato css.",
|
|
191
|
-
"tags": []
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"hide": {
|
|
195
|
-
"complexType": {
|
|
196
|
-
"signature": "() => Promise<void>",
|
|
197
|
-
"parameters": [],
|
|
198
|
-
"references": {
|
|
199
|
-
"Promise": {
|
|
200
|
-
"location": "global"
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
"return": "Promise<void>"
|
|
204
|
-
},
|
|
205
|
-
"docs": {
|
|
206
|
-
"text": "Usado no modo floating. Faz com que o componente seja ocultado.",
|
|
207
|
-
"tags": []
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}; }
|
|
211
|
-
static get watchers() { return [{
|
|
212
|
-
"propName": "value",
|
|
213
|
-
"methodName": "valueChanged"
|
|
214
|
-
}]; }
|
|
215
|
-
}
|
|
1
|
+
import { FloatingManager } from '@sankhyalabs/core';
|
|
2
|
+
import { Component, forceUpdate, h, Prop, Method, Event, Watch } from '@stencil/core';
|
|
3
|
+
export class EzCalendar {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._firstRender = true;
|
|
6
|
+
this._todayLabel = 'Hoje';
|
|
7
|
+
this._weekDayLabels = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];
|
|
8
|
+
this._monthLabels = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];
|
|
9
|
+
/**
|
|
10
|
+
* A data selecionada no calendário
|
|
11
|
+
*/
|
|
12
|
+
this.value = new Date();
|
|
13
|
+
/**
|
|
14
|
+
* No modo floating o calendário só se tornará visível
|
|
15
|
+
* quando o método show() for acionado.
|
|
16
|
+
*/
|
|
17
|
+
this.floating = false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
21
|
+
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
22
|
+
* top, left, bottom e right. Esses parâmetros devem ser informados como
|
|
23
|
+
* strings no formato css.
|
|
24
|
+
*/
|
|
25
|
+
async show(top, left, bottom, right) {
|
|
26
|
+
if (this.floating) {
|
|
27
|
+
this._floatingID = FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
32
|
+
*/
|
|
33
|
+
async hide() {
|
|
34
|
+
if (this._floatingID !== undefined) {
|
|
35
|
+
FloatingManager.close(this._floatingID);
|
|
36
|
+
this._floatingID = undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
valueChanged() {
|
|
40
|
+
if (this.value) {
|
|
41
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
42
|
+
this._currentPosition.setDate(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
getMonthLabel() {
|
|
46
|
+
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
47
|
+
}
|
|
48
|
+
isSelectedDate(d) {
|
|
49
|
+
if (this.value) {
|
|
50
|
+
return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
changeMonth(offset) {
|
|
55
|
+
this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
|
|
56
|
+
forceUpdate(this);
|
|
57
|
+
}
|
|
58
|
+
selectDate(d) {
|
|
59
|
+
this.value = d;
|
|
60
|
+
this.ezChange.emit();
|
|
61
|
+
}
|
|
62
|
+
componentDidRender() {
|
|
63
|
+
if (this.floating && this._firstRender) {
|
|
64
|
+
this._box.remove();
|
|
65
|
+
this._firstRender = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
if (this._currentPosition == null) {
|
|
70
|
+
this._currentPosition = new Date();
|
|
71
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
72
|
+
this._currentPosition.setDate(1);
|
|
73
|
+
}
|
|
74
|
+
const firstDate = new Date();
|
|
75
|
+
firstDate.setTime(this._currentPosition.getTime());
|
|
76
|
+
firstDate.setDate(1 - firstDate.getDay());
|
|
77
|
+
return (h("section", { ref: elem => this._container = elem },
|
|
78
|
+
h("div", { class: "calendar", ref: elem => this._box = elem },
|
|
79
|
+
h("div", { class: "calendar__header" },
|
|
80
|
+
h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }),
|
|
81
|
+
h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()),
|
|
82
|
+
h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })),
|
|
83
|
+
h("div", { class: "calendar__body" },
|
|
84
|
+
h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))),
|
|
85
|
+
[0, 7, 14, 21, 28, 35].map(offset => h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index => {
|
|
86
|
+
const date = new Date();
|
|
87
|
+
date.setTime(firstDate.getTime());
|
|
88
|
+
date.setDate(date.getDate() + offset + index);
|
|
89
|
+
let classNames = "calendar__cell";
|
|
90
|
+
if (this._currentPosition.getMonth() != date.getMonth()) {
|
|
91
|
+
classNames += " calendar__cell--secondary";
|
|
92
|
+
}
|
|
93
|
+
else if (this.isSelectedDate(date)) {
|
|
94
|
+
classNames += " calendar__cell--selected";
|
|
95
|
+
}
|
|
96
|
+
return h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
|
|
97
|
+
})))),
|
|
98
|
+
h("div", { class: "calendar__footer" },
|
|
99
|
+
h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel)))));
|
|
100
|
+
}
|
|
101
|
+
static get is() { return "ez-calendar"; }
|
|
102
|
+
static get encapsulation() { return "shadow"; }
|
|
103
|
+
static get originalStyleUrls() { return {
|
|
104
|
+
"$": ["ez-calendar.css"]
|
|
105
|
+
}; }
|
|
106
|
+
static get styleUrls() { return {
|
|
107
|
+
"$": ["ez-calendar.css"]
|
|
108
|
+
}; }
|
|
109
|
+
static get properties() { return {
|
|
110
|
+
"value": {
|
|
111
|
+
"type": "unknown",
|
|
112
|
+
"mutable": true,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "Date",
|
|
115
|
+
"resolved": "Date",
|
|
116
|
+
"references": {
|
|
117
|
+
"Date": {
|
|
118
|
+
"location": "global"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": "A data selecionada no calend\u00E1rio"
|
|
127
|
+
},
|
|
128
|
+
"defaultValue": "new Date()"
|
|
129
|
+
},
|
|
130
|
+
"floating": {
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "boolean",
|
|
135
|
+
"resolved": "boolean",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "No modo floating o calend\u00E1rio s\u00F3 se tornar\u00E1 vis\u00EDvel\r\nquando o m\u00E9todo show() for acionado."
|
|
143
|
+
},
|
|
144
|
+
"attribute": "floating",
|
|
145
|
+
"reflect": true,
|
|
146
|
+
"defaultValue": "false"
|
|
147
|
+
}
|
|
148
|
+
}; }
|
|
149
|
+
static get events() { return [{
|
|
150
|
+
"method": "ezChange",
|
|
151
|
+
"name": "ezChange",
|
|
152
|
+
"bubbles": true,
|
|
153
|
+
"cancelable": true,
|
|
154
|
+
"composed": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "Quando o usu\u00E1rio escolhe uma data, esse evento \u00E9 emitido."
|
|
158
|
+
},
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "string",
|
|
161
|
+
"resolved": "string",
|
|
162
|
+
"references": {}
|
|
163
|
+
}
|
|
164
|
+
}]; }
|
|
165
|
+
static get methods() { return {
|
|
166
|
+
"show": {
|
|
167
|
+
"complexType": {
|
|
168
|
+
"signature": "(top?: string, left?: string, bottom?: string, right?: string) => Promise<void>",
|
|
169
|
+
"parameters": [{
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
}, {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
}, {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": ""
|
|
178
|
+
}, {
|
|
179
|
+
"tags": [],
|
|
180
|
+
"text": ""
|
|
181
|
+
}],
|
|
182
|
+
"references": {
|
|
183
|
+
"Promise": {
|
|
184
|
+
"location": "global"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"return": "Promise<void>"
|
|
188
|
+
},
|
|
189
|
+
"docs": {
|
|
190
|
+
"text": "Usado no modo floating. Faz com que o componente seja exibido.\r\n\u00C9 poss\u00EDvel determinar ajustes de posicionamento atrav\u00E9s dos par\u00E2metros\r\ntop, left, bottom e right. Esses par\u00E2metros devem ser informados como\r\nstrings no formato css.",
|
|
191
|
+
"tags": []
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"hide": {
|
|
195
|
+
"complexType": {
|
|
196
|
+
"signature": "() => Promise<void>",
|
|
197
|
+
"parameters": [],
|
|
198
|
+
"references": {
|
|
199
|
+
"Promise": {
|
|
200
|
+
"location": "global"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"return": "Promise<void>"
|
|
204
|
+
},
|
|
205
|
+
"docs": {
|
|
206
|
+
"text": "Usado no modo floating. Faz com que o componente seja ocultado.",
|
|
207
|
+
"tags": []
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}; }
|
|
211
|
+
static get watchers() { return [{
|
|
212
|
+
"propName": "value",
|
|
213
|
+
"methodName": "valueChanged"
|
|
214
|
+
}]; }
|
|
215
|
+
}
|