@progressive-development/pd-calendar 0.6.7 → 0.9.2
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/generated/locales/be.d.ts +4 -0
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +4 -0
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +4 -0
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -10
- package/dist/locales/be.js +7 -4
- package/dist/locales/de.js +7 -4
- package/dist/locales/en.js +7 -4
- package/dist/pd-calendar/PdCalendar.d.ts +50 -0
- package/dist/pd-calendar/PdCalendar.d.ts.map +1 -0
- package/dist/pd-calendar/PdCalendar.js +434 -0
- package/dist/{pd-calendar-cell.d.ts → pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts} +4 -2
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts.map +1 -0
- package/dist/{pd-calendar-cell.js → pd-calendar/pd-calendar-cell/PdCalendarCell.js} +97 -102
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.js +8 -0
- package/dist/{stories/cell.stories.d.ts → pd-calendar/pd-calendar-cell/pd-calendar-cell.stories.d.ts} +2 -2
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.stories.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar.d.ts.map +1 -0
- package/dist/{stories/index.stories.d.ts → pd-calendar/pd-calendar.stories.d.ts} +2 -2
- package/dist/pd-calendar/pd-calendar.stories.d.ts.map +1 -0
- package/dist/{pd-year-popup.d.ts → pd-calendar/pd-year-popup/PdYearPopup.d.ts} +4 -2
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts.map +1 -0
- package/dist/{pd-year-popup.js → pd-calendar/pd-year-popup/PdYearPopup.js} +57 -62
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts +3 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.js +8 -0
- package/dist/pd-calendar.d.ts +2 -48
- package/dist/pd-calendar.js +6 -437
- package/dist/pd-datepicker/PdDatepicker.d.ts +112 -0
- package/dist/pd-datepicker/PdDatepicker.d.ts.map +1 -0
- package/dist/pd-datepicker/PdDatepicker.js +494 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts +23 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts.map +1 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts +3 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts.map +1 -0
- package/dist/pd-datepicker.d.ts +2 -0
- package/dist/pd-datepicker.js +8 -0
- package/package.json +29 -46
- package/dist/pd-calendar-cell.d.ts.map +0 -1
- package/dist/pd-calendar.d.ts.map +0 -1
- package/dist/pd-year-popup.d.ts.map +0 -1
- package/dist/stories/cell.stories.d.ts.map +0 -1
- package/dist/stories/index.stories.d.ts.map +0 -1
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
import { css, html } from 'lit';
|
|
2
|
+
import { localized, msg } from '@lit/localize';
|
|
3
|
+
import { property, state } from 'lit/decorators.js';
|
|
4
|
+
import { parse, format } from 'date-fns';
|
|
5
|
+
import { PdBaseInputElement } from '@progressive-development/pd-forms';
|
|
6
|
+
import { pdIcons } from '@progressive-development/pd-icon';
|
|
7
|
+
import '@progressive-development/pd-forms/pd-input';
|
|
8
|
+
import '@progressive-development/pd-forms/pd-button';
|
|
9
|
+
import '@progressive-development/pd-forms/pd-select';
|
|
10
|
+
import '../pd-calendar.js';
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const UNDEF = "UNDEF";
|
|
23
|
+
const INPUT_TYPE_DATE = 7;
|
|
24
|
+
const DEFAULT_FORMAT = "yyyy-MM-dd";
|
|
25
|
+
const DATE_TIMES = [
|
|
26
|
+
{ name: "Uhrzeit auswählen", value: UNDEF },
|
|
27
|
+
{ name: "07:00", value: "07:00" },
|
|
28
|
+
{ name: "07:30", value: "07:30" },
|
|
29
|
+
{ name: "08:00", value: "08:00" },
|
|
30
|
+
{ name: "08:30", value: "08:30" },
|
|
31
|
+
{ name: "09:00", value: "09:00" },
|
|
32
|
+
{ name: "09:30", value: "09:30" },
|
|
33
|
+
{ name: "10:00", value: "10:00" },
|
|
34
|
+
{ name: "10:30", value: "10:30" },
|
|
35
|
+
{ name: "11:00", value: "11:00" },
|
|
36
|
+
{ name: "11:30", value: "11:30" },
|
|
37
|
+
{ name: "12:00", value: "12:00" },
|
|
38
|
+
{ name: "12:30", value: "12:30" },
|
|
39
|
+
{ name: "13:00", value: "13:00" },
|
|
40
|
+
{ name: "13:30", value: "13:30" },
|
|
41
|
+
{ name: "14:00", value: "14:00" },
|
|
42
|
+
{ name: "14:30", value: "14:30" },
|
|
43
|
+
{ name: "15:00", value: "15:00" },
|
|
44
|
+
{ name: "15:30", value: "15:30" },
|
|
45
|
+
{ name: "16:00", value: "16:00" },
|
|
46
|
+
{ name: "16:30", value: "16:30" },
|
|
47
|
+
{ name: "17:00", value: "17:00" },
|
|
48
|
+
{ name: "17:30", value: "17:30" },
|
|
49
|
+
{ name: "18:00", value: "18:00" },
|
|
50
|
+
{ name: "18:30", value: "18:30" },
|
|
51
|
+
{ name: "19:00", value: "19:00" },
|
|
52
|
+
{ name: "19:30", value: "19:30" }
|
|
53
|
+
];
|
|
54
|
+
function getDateRangeValue(start, end, formatStr = DEFAULT_FORMAT) {
|
|
55
|
+
return `${start ? format(start, formatStr) : "--"} - ${end ? format(end, formatStr) : "--"}`;
|
|
56
|
+
}
|
|
57
|
+
function getDateTimeValue(date, time, formatStr = DEFAULT_FORMAT) {
|
|
58
|
+
return `${date ? format(date, formatStr) : ""} ${time && time !== UNDEF ? time : ""}`;
|
|
59
|
+
}
|
|
60
|
+
function getDataForDaysBetween(start, end) {
|
|
61
|
+
const result = {};
|
|
62
|
+
let from = new Date(start);
|
|
63
|
+
let to = new Date(end);
|
|
64
|
+
if (from > to) [from, to] = [to, from];
|
|
65
|
+
while (from <= to) {
|
|
66
|
+
result[format(from, DEFAULT_FORMAT)] = [{ special: true }];
|
|
67
|
+
from.setDate(from.getDate() + 1);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
let PdDatepicker = class extends PdBaseInputElement {
|
|
72
|
+
constructor() {
|
|
73
|
+
super();
|
|
74
|
+
this.dateRange = false;
|
|
75
|
+
this.hideToday = false;
|
|
76
|
+
this.withYearPopup = [];
|
|
77
|
+
this.withTime = false;
|
|
78
|
+
this._showCalendar = false;
|
|
79
|
+
this._timeSelection = UNDEF;
|
|
80
|
+
this._calendarPosition = "bottom";
|
|
81
|
+
this._inputType = INPUT_TYPE_DATE;
|
|
82
|
+
this._validators = [this._requiredDateTimeValidator.bind(this)];
|
|
83
|
+
}
|
|
84
|
+
_requiredDateTimeValidator() {
|
|
85
|
+
return this.required && !this._startDateValue || this.dateRange && this._startDateValue && !this._endDateValue || this.withTime && this._startDateValue && this._timeSelection === UNDEF ? msg("Eingabe unvollständig", {
|
|
86
|
+
id: "pd.form.field.selectDateTimeRequired"
|
|
87
|
+
}) : null;
|
|
88
|
+
}
|
|
89
|
+
update(changedProps) {
|
|
90
|
+
if (changedProps.has("initialDate") && this.initialDate) {
|
|
91
|
+
this._prepareFieldsFromInitDate();
|
|
92
|
+
this._updateInputField(false, void 0);
|
|
93
|
+
}
|
|
94
|
+
super.update(changedProps);
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return html`
|
|
98
|
+
<pd-input
|
|
99
|
+
id="datePickerId"
|
|
100
|
+
.label="${this.label}"
|
|
101
|
+
.placeHolder="${this.placeHolder}"
|
|
102
|
+
.icon="${pdIcons.ICON_DATE}"
|
|
103
|
+
.initValue="${this._value}"
|
|
104
|
+
?readonly=${true}
|
|
105
|
+
?required="${this.required}"
|
|
106
|
+
?disabled="${this.disabled}"
|
|
107
|
+
icon-right
|
|
108
|
+
@click="${this._inputClick}"
|
|
109
|
+
@pd-form-element-change="${this._innerFormChange}"
|
|
110
|
+
@pd-form-element-blur="${this._innerBlur}"
|
|
111
|
+
@pd-form-element-focus="${this._innerFocus}"
|
|
112
|
+
@pd-form-element-register="${this._innerRegister}"
|
|
113
|
+
@enter-pressed="${this._innerEnter}"
|
|
114
|
+
>
|
|
115
|
+
<div slot="icon-right">
|
|
116
|
+
<slot name="icon-right"></slot>
|
|
117
|
+
</div>
|
|
118
|
+
></pd-input
|
|
119
|
+
>
|
|
120
|
+
${this._renderErrorMsg()}
|
|
121
|
+
<div class="calendar-small ${this._calendarPosition}">
|
|
122
|
+
<pd-calendar
|
|
123
|
+
.withYearPopup="${this.withYearPopup}"
|
|
124
|
+
.refDate="${this._startDateValue}"
|
|
125
|
+
.data="${this._rangeSelection || {}}"
|
|
126
|
+
numberClass="center"
|
|
127
|
+
selectableDates
|
|
128
|
+
showSelection
|
|
129
|
+
prevMonthConstraint="-1"
|
|
130
|
+
nextMonthConstraint="-1"
|
|
131
|
+
@select-date="${this._triggerCalendarDateSelected}"
|
|
132
|
+
@mouse-enter-date="${this._triggerHoverCalculateRange}"
|
|
133
|
+
></pd-calendar>
|
|
134
|
+
|
|
135
|
+
${this.withTime ? html`
|
|
136
|
+
<pd-select
|
|
137
|
+
class="date-time-select"
|
|
138
|
+
id="dateTimeSelectId"
|
|
139
|
+
.values="${DATE_TIMES}"
|
|
140
|
+
label="${msg("Uhrzeit", { id: "pd.datepicker.time" })}"
|
|
141
|
+
initValue="${this._timeSelection}"
|
|
142
|
+
required
|
|
143
|
+
@pd-form-element-change="${(e) => {
|
|
144
|
+
this._timeSelection = e.detail.value;
|
|
145
|
+
e.stopPropagation();
|
|
146
|
+
}}"
|
|
147
|
+
@pd-form-element-blur="${this._innerBlur}"
|
|
148
|
+
@pd-form-element-focus="${this._innerFocus}"
|
|
149
|
+
@pd-form-element-register="${this._innerRegister}"
|
|
150
|
+
@enter-pressed="${this._innerEnter}"
|
|
151
|
+
></pd-select>
|
|
152
|
+
` : ""}
|
|
153
|
+
|
|
154
|
+
<div class="bottom-buttons">
|
|
155
|
+
${!this.hideToday ? html`<pd-button
|
|
156
|
+
text="${msg("Heute", { id: "pd.datepicker.today" })}"
|
|
157
|
+
@button-clicked="${this._triggerSetTodayButton}"
|
|
158
|
+
></pd-button>` : ""}
|
|
159
|
+
<pd-button
|
|
160
|
+
text="${msg("Reset", { id: "pd.datepicker.reset" })}"
|
|
161
|
+
@button-clicked="${this._triggerResetButton}"
|
|
162
|
+
></pd-button>
|
|
163
|
+
${this.withTime ? html`
|
|
164
|
+
<pd-button
|
|
165
|
+
id="buttonSetValueId"
|
|
166
|
+
text="Ok"
|
|
167
|
+
?disabled="${!this._startDateValue || this._timeSelection === UNDEF}"
|
|
168
|
+
@button-clicked="${this._triggerSetValueButton}"
|
|
169
|
+
></pd-button>
|
|
170
|
+
` : ""}
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Getter for outside call.
|
|
177
|
+
*
|
|
178
|
+
* @returns obj: { start?: Date; end?: Date } - the prepared date values.
|
|
179
|
+
*/
|
|
180
|
+
get dateValues() {
|
|
181
|
+
const start = this.withTime && this._startDateValue ? parse(
|
|
182
|
+
`${format(this._startDateValue, "yyyy-MM-dd")} ${this._timeSelection}`,
|
|
183
|
+
"yyyy-MM-dd HH:mm",
|
|
184
|
+
/* @__PURE__ */ new Date()
|
|
185
|
+
) : this._startDateValue;
|
|
186
|
+
return { start, end: this._endDateValue };
|
|
187
|
+
}
|
|
188
|
+
reset() {
|
|
189
|
+
if (this.initialDate) {
|
|
190
|
+
this._prepareFieldsFromInitDate();
|
|
191
|
+
} else {
|
|
192
|
+
this._clearFields();
|
|
193
|
+
}
|
|
194
|
+
super.reset();
|
|
195
|
+
}
|
|
196
|
+
clear() {
|
|
197
|
+
this._clearFields();
|
|
198
|
+
this._updateInputField(true, void 0);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @returns formated value from current field selections.
|
|
202
|
+
*/
|
|
203
|
+
_getInitialValue() {
|
|
204
|
+
return this._formatDateValue();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @returns parsed date
|
|
208
|
+
*/
|
|
209
|
+
_getParsedValue() {
|
|
210
|
+
return this.dateValues;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Init _startDateValue and _timeSelection from initial date.
|
|
214
|
+
*/
|
|
215
|
+
_prepareFieldsFromInitDate() {
|
|
216
|
+
if (this.initialDate) {
|
|
217
|
+
this._startDateValue = new Date(
|
|
218
|
+
this.initialDate.getFullYear(),
|
|
219
|
+
this.initialDate.getMonth(),
|
|
220
|
+
this.initialDate.getDate()
|
|
221
|
+
);
|
|
222
|
+
if (this.withTime) {
|
|
223
|
+
this._timeSelection = format(this.initialDate, "HH:mm");
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Clear _startDateValue and _timeSelection.
|
|
229
|
+
*/
|
|
230
|
+
_clearFields() {
|
|
231
|
+
this._startDateValue = void 0;
|
|
232
|
+
this._endDateValue = void 0;
|
|
233
|
+
this._rangeSelection = void 0;
|
|
234
|
+
this._timeSelection = UNDEF;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Update element value from input fields.
|
|
238
|
+
*/
|
|
239
|
+
_updateInputField(dispatchEvent, e) {
|
|
240
|
+
this._handleChangedValue(
|
|
241
|
+
this._formatDateValue(),
|
|
242
|
+
e,
|
|
243
|
+
dispatchEvent,
|
|
244
|
+
false,
|
|
245
|
+
void 0
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Toogle view calendar on click into pd-input field.
|
|
250
|
+
*/
|
|
251
|
+
_inputClick() {
|
|
252
|
+
const input = this.shadowRoot?.getElementById("datePickerId");
|
|
253
|
+
if (input) {
|
|
254
|
+
const rect = input.getBoundingClientRect();
|
|
255
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
256
|
+
const spaceAbove = rect.top;
|
|
257
|
+
this._calendarPosition = spaceBelow < 300 && spaceAbove > spaceBelow ? "top" : "bottom";
|
|
258
|
+
this._showCalendar = !this._showCalendar;
|
|
259
|
+
setTimeout(() => {
|
|
260
|
+
this.shadowRoot?.querySelector(".calendar-small")?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
261
|
+
}, 0);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Triggered by date selection in small calendar.
|
|
266
|
+
* Set internal values depending on daterange configuration.
|
|
267
|
+
*
|
|
268
|
+
* @param e Event from small calendar.
|
|
269
|
+
*/
|
|
270
|
+
_triggerCalendarDateSelected(e) {
|
|
271
|
+
const date = e.detail.date;
|
|
272
|
+
if (this.dateRange) {
|
|
273
|
+
if (!this._startDateValue) {
|
|
274
|
+
this._startDateValue = date;
|
|
275
|
+
this._endDateValue = void 0;
|
|
276
|
+
} else if (!this._endDateValue) {
|
|
277
|
+
if (date.getTime() < this._startDateValue.getTime()) {
|
|
278
|
+
this._endDateValue = this._startDateValue;
|
|
279
|
+
this._startDateValue = date;
|
|
280
|
+
} else {
|
|
281
|
+
this._endDateValue = date;
|
|
282
|
+
}
|
|
283
|
+
this._showCalendar = false;
|
|
284
|
+
} else {
|
|
285
|
+
this._startDateValue = date;
|
|
286
|
+
this._endDateValue = void 0;
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
this._startDateValue = date;
|
|
290
|
+
if (this.withTime) {
|
|
291
|
+
const el = this.shadowRoot?.getElementById(
|
|
292
|
+
this._timeSelection === UNDEF ? "dateTimeSelectId" : "buttonSetValueId"
|
|
293
|
+
);
|
|
294
|
+
el?.focus();
|
|
295
|
+
} else {
|
|
296
|
+
this._showCalendar = false;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (!this._showCalendar) {
|
|
300
|
+
this._updateInputField(true, e);
|
|
301
|
+
}
|
|
302
|
+
e.stopPropagation();
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Triggered by Today button in small calendar view.
|
|
306
|
+
* Set calendar date to today.
|
|
307
|
+
*/
|
|
308
|
+
_triggerSetTodayButton(e) {
|
|
309
|
+
this._startDateValue = /* @__PURE__ */ new Date();
|
|
310
|
+
if (this.dateRange) {
|
|
311
|
+
this._endDateValue = void 0;
|
|
312
|
+
this._rangeSelection = void 0;
|
|
313
|
+
} else {
|
|
314
|
+
this._showCalendar = this.withTime;
|
|
315
|
+
}
|
|
316
|
+
this._updateInputField(!this._showCalendar, e);
|
|
317
|
+
e.stopPropagation();
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Triggered by Reset button in small calendar view.
|
|
321
|
+
* Reset selected values to origin state (initaldate or empty).
|
|
322
|
+
*/
|
|
323
|
+
_triggerResetButton(e) {
|
|
324
|
+
this.reset();
|
|
325
|
+
this._showCalendar = false;
|
|
326
|
+
this.shadowRoot?.getElementById("datePickerId")?.reset();
|
|
327
|
+
e.stopPropagation();
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Triggered by ok button in small calendar view.
|
|
331
|
+
* Set selected value and close calendar.
|
|
332
|
+
*/
|
|
333
|
+
_triggerSetValueButton(e) {
|
|
334
|
+
this._updateInputField(true, e);
|
|
335
|
+
this._showCalendar = false;
|
|
336
|
+
e.stopPropagation();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Calculate range of dates between two dates on mouse over.
|
|
340
|
+
* Only needed for date range visuell selection in small calendar.
|
|
341
|
+
*
|
|
342
|
+
* @param e
|
|
343
|
+
*/
|
|
344
|
+
_triggerHoverCalculateRange(e) {
|
|
345
|
+
if (this._startDateValue && this.dateRange && e.detail.date && !this._endDateValue) {
|
|
346
|
+
this._rangeSelection = getDataForDaysBetween(
|
|
347
|
+
this._startDateValue,
|
|
348
|
+
e.detail.date
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Format date value from _startDateValue and _startDateValue and _timeSelection.
|
|
354
|
+
* Depending on daterange and withtime configuration.
|
|
355
|
+
*
|
|
356
|
+
* @returns string with date value
|
|
357
|
+
*/
|
|
358
|
+
_formatDateValue() {
|
|
359
|
+
if (!this._startDateValue && !this._endDateValue && this._timeSelection === UNDEF)
|
|
360
|
+
return "";
|
|
361
|
+
return this.dateRange ? getDateRangeValue(
|
|
362
|
+
this._startDateValue,
|
|
363
|
+
this._endDateValue,
|
|
364
|
+
this.dateFormat
|
|
365
|
+
) : getDateTimeValue(
|
|
366
|
+
this._startDateValue,
|
|
367
|
+
this._timeSelection,
|
|
368
|
+
this.dateFormat
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
// ###### Start Inner Element Events
|
|
372
|
+
_innerEnter(e) {
|
|
373
|
+
e.stopPropagation();
|
|
374
|
+
}
|
|
375
|
+
_innerRegister(e) {
|
|
376
|
+
e.stopPropagation();
|
|
377
|
+
}
|
|
378
|
+
_innerUnRegister(e) {
|
|
379
|
+
e.stopPropagation();
|
|
380
|
+
}
|
|
381
|
+
_innerFocus(e) {
|
|
382
|
+
e.stopPropagation();
|
|
383
|
+
}
|
|
384
|
+
_innerBlur(e) {
|
|
385
|
+
e.stopPropagation();
|
|
386
|
+
}
|
|
387
|
+
_innerFormChange(e) {
|
|
388
|
+
e.stopPropagation();
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
PdDatepicker.styles = [
|
|
392
|
+
PdBaseInputElement.styles,
|
|
393
|
+
css`
|
|
394
|
+
:host {
|
|
395
|
+
position: relative;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
:host([disabled]) {
|
|
399
|
+
pointer-events: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:host([_showCalendar]) .calendar-small {
|
|
403
|
+
visibility: visible;
|
|
404
|
+
opacity: 1;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.calendar-small {
|
|
408
|
+
position: absolute;
|
|
409
|
+
background-color: white;
|
|
410
|
+
visibility: hidden;
|
|
411
|
+
z-index: 1000;
|
|
412
|
+
box-shadow: var(--pd-menu-shadow, 3px 3px 5px grey);
|
|
413
|
+
transition: 0.5s ease-out;
|
|
414
|
+
transform: translateY(0);
|
|
415
|
+
opacity: 0;
|
|
416
|
+
padding: 0.5em 1em 0.5em 0.2em;
|
|
417
|
+
|
|
418
|
+
--pd-calendar-width: var(--pd-input-field-width, 250px);
|
|
419
|
+
--pd-calendar-cell-height: 30px;
|
|
420
|
+
--pd-calendar-week-title-bg-col: white;
|
|
421
|
+
--pd-calendar-week-title-font-col: #0a3a48;
|
|
422
|
+
--pd-calendar-cell-selectable-shadow: 0;
|
|
423
|
+
--pd-calendar-cell-day-free-bg-col: white;
|
|
424
|
+
--pd-calendar-cell-day-info-free-col: #0a3a48;
|
|
425
|
+
--pd-calendar-title-font-size: 20px;
|
|
426
|
+
--pd-calendar-title-icon-size: 20px;
|
|
427
|
+
--pd-calendar-weekday-title-font-size: 15px;
|
|
428
|
+
--pd-calendar-number-font-size: 15px;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.calendar-small.bottom {
|
|
432
|
+
top: 100%; /* Unter dem Input-Feld */
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.calendar-small.top {
|
|
436
|
+
bottom: 100%; /* Über dem Input-Feld */
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.bottom-buttons {
|
|
440
|
+
display: flex;
|
|
441
|
+
--pd-button-width: 78px;
|
|
442
|
+
}
|
|
443
|
+
`
|
|
444
|
+
];
|
|
445
|
+
__decorateClass([
|
|
446
|
+
property({ type: String })
|
|
447
|
+
], PdDatepicker.prototype, "locale", 2);
|
|
448
|
+
__decorateClass([
|
|
449
|
+
property({ type: Object })
|
|
450
|
+
], PdDatepicker.prototype, "initialDate", 2);
|
|
451
|
+
__decorateClass([
|
|
452
|
+
property({ type: String })
|
|
453
|
+
], PdDatepicker.prototype, "dateFormat", 2);
|
|
454
|
+
__decorateClass([
|
|
455
|
+
property({ type: Boolean })
|
|
456
|
+
], PdDatepicker.prototype, "dateRange", 2);
|
|
457
|
+
__decorateClass([
|
|
458
|
+
property({ type: Boolean })
|
|
459
|
+
], PdDatepicker.prototype, "hideToday", 2);
|
|
460
|
+
__decorateClass([
|
|
461
|
+
property({ type: Array })
|
|
462
|
+
], PdDatepicker.prototype, "withYearPopup", 2);
|
|
463
|
+
__decorateClass([
|
|
464
|
+
property({ type: String })
|
|
465
|
+
], PdDatepicker.prototype, "placeHolderTime", 2);
|
|
466
|
+
__decorateClass([
|
|
467
|
+
property({ type: Boolean })
|
|
468
|
+
], PdDatepicker.prototype, "withTime", 2);
|
|
469
|
+
__decorateClass([
|
|
470
|
+
property({ type: String })
|
|
471
|
+
], PdDatepicker.prototype, "min", 2);
|
|
472
|
+
__decorateClass([
|
|
473
|
+
property({ type: String })
|
|
474
|
+
], PdDatepicker.prototype, "max", 2);
|
|
475
|
+
__decorateClass([
|
|
476
|
+
property({ type: Boolean, reflect: true })
|
|
477
|
+
], PdDatepicker.prototype, "_showCalendar", 2);
|
|
478
|
+
__decorateClass([
|
|
479
|
+
state()
|
|
480
|
+
], PdDatepicker.prototype, "_startDateValue", 2);
|
|
481
|
+
__decorateClass([
|
|
482
|
+
state()
|
|
483
|
+
], PdDatepicker.prototype, "_endDateValue", 2);
|
|
484
|
+
__decorateClass([
|
|
485
|
+
state()
|
|
486
|
+
], PdDatepicker.prototype, "_rangeSelection", 2);
|
|
487
|
+
__decorateClass([
|
|
488
|
+
state()
|
|
489
|
+
], PdDatepicker.prototype, "_timeSelection", 2);
|
|
490
|
+
PdDatepicker = __decorateClass([
|
|
491
|
+
localized()
|
|
492
|
+
], PdDatepicker);
|
|
493
|
+
|
|
494
|
+
export { PdDatepicker };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/web-components';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
tags: string[];
|
|
5
|
+
render: (args: import('@storybook/web-components').Args) => import('lit').TemplateResult<1>;
|
|
6
|
+
argTypes: {};
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj;
|
|
10
|
+
export declare const Standard: Story;
|
|
11
|
+
export declare const PlaceholderLabel: Story;
|
|
12
|
+
export declare const Locale: Story;
|
|
13
|
+
export declare const Required: Story;
|
|
14
|
+
export declare const YearSelection: Story;
|
|
15
|
+
export declare const HugeYearSelection: Story;
|
|
16
|
+
export declare const Disabled: Story;
|
|
17
|
+
export declare const WithTime: Story;
|
|
18
|
+
export declare const WithRange: Story;
|
|
19
|
+
export declare const InitialValue: Story;
|
|
20
|
+
export declare const MinMax: Story;
|
|
21
|
+
export declare const DatepickerInForm: Story;
|
|
22
|
+
export declare const DatepickerInFormWithInit: Story;
|
|
23
|
+
//# sourceMappingURL=pd-date-picker.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-date-picker.stories.d.ts","sourceRoot":"","sources":["../../src/pd-datepicker/pd-date-picker.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+CAA+C,CAAC;AACvD,OAAO,6CAA6C,CAAC;AAErD,OAAO,oBAAoB,CAAC;AAG5B,QAAA,MAAM,IAAI;;;;;CAkBM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAK9B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAiBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAS3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAS/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC;AAKF,eAAO,MAAM,YAAY,EAAE,KAe1B,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAcpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KA+F9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,KA2ItC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-datepicker.d.ts","sourceRoot":"","sources":["../../src/pd-datepicker/pd-datepicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progressive-development/pd-calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Webcomponent for calendar",
|
|
5
5
|
"author": "PD Progressive Development",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": "./dist/index.js",
|
|
12
13
|
"./pd-calendar": "./dist/pd-calendar.js",
|
|
14
|
+
"./pd-datepicker": "./dist/pd-datepicker.js",
|
|
13
15
|
"./locales/be": "./dist/locales/be.js",
|
|
14
16
|
"./locales/de": "./dist/locales/de.js",
|
|
15
17
|
"./locales/en": "./dist/locales/en.js"
|
|
@@ -20,52 +22,15 @@
|
|
|
20
22
|
"README.md",
|
|
21
23
|
"LICENSE"
|
|
22
24
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
25
|
-
"start": "vite",
|
|
26
|
-
"build": "vite build",
|
|
27
|
-
"preview": "vite preview",
|
|
28
|
-
"clean": "rm -rf dist",
|
|
29
|
-
"lint": "eslint --ext .ts,.html src --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
30
|
-
"format": "eslint --ext .ts,.html src --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
31
|
-
"test": "vitest run --coverage",
|
|
32
|
-
"test:watch": "vitest --watch",
|
|
33
|
-
"check": "npm run lint && npm run build",
|
|
34
|
-
"prepublishOnly": "npm run clean && npm run check",
|
|
35
|
-
"localizeExtract": "lit-localize extract",
|
|
36
|
-
"localizeBuild": "lit-localize build",
|
|
37
|
-
"storybook": "storybook dev -p 6006",
|
|
38
|
-
"build-storybook": "storybook build"
|
|
39
|
-
},
|
|
40
25
|
"dependencies": {
|
|
26
|
+
"lit": "^3.3.1",
|
|
41
27
|
"@lit/localize": "^0.12.2",
|
|
42
|
-
"
|
|
43
|
-
"@progressive-development/pd-shared-styles": "^0.2.5",
|
|
28
|
+
"date-fns": "^2.30.0",
|
|
44
29
|
"fecha": "^4.2.3",
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@
|
|
49
|
-
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
50
|
-
"@lit/localize-tools": "^0.6.10",
|
|
51
|
-
"@storybook/addon-essentials": "^8.6.14",
|
|
52
|
-
"@storybook/addon-links": "^8.6.14",
|
|
53
|
-
"@storybook/blocks": "^8.0.10",
|
|
54
|
-
"@storybook/test": "^8.6.14",
|
|
55
|
-
"@storybook/web-components": "^8.0.10",
|
|
56
|
-
"@storybook/web-components-vite": "^8.6.14",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
58
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
59
|
-
"eslint": "^8.57.1",
|
|
60
|
-
"eslint-config-prettier": "^9.1.0",
|
|
61
|
-
"eslint-plugin-storybook": "^0.8.0",
|
|
62
|
-
"prettier": "^3.5.3",
|
|
63
|
-
"rollup-plugin-visualizer": "^5.14.0",
|
|
64
|
-
"storybook": "^8.6.14",
|
|
65
|
-
"typescript": "^5.8.3",
|
|
66
|
-
"vite": "^5.4.19",
|
|
67
|
-
"vite-plugin-dts": "^4.5.4",
|
|
68
|
-
"vitest": "^2.1.9"
|
|
30
|
+
"tslib": "^2.8.1",
|
|
31
|
+
"@progressive-development/pd-shared-styles": "0.3.0",
|
|
32
|
+
"@progressive-development/pd-forms": "0.9.2",
|
|
33
|
+
"@progressive-development/pd-icon": "0.9.2"
|
|
69
34
|
},
|
|
70
35
|
"customElements": "custom-elements.json",
|
|
71
36
|
"keywords": [
|
|
@@ -80,5 +45,23 @@
|
|
|
80
45
|
"day",
|
|
81
46
|
"month",
|
|
82
47
|
"week"
|
|
83
|
-
]
|
|
84
|
-
|
|
48
|
+
],
|
|
49
|
+
"scripts": {
|
|
50
|
+
"analyze": "cem analyze --litelement --exclude dist,demo",
|
|
51
|
+
"start": "vite",
|
|
52
|
+
"build": "pnpm run analyze && vite build",
|
|
53
|
+
"preview": "vite preview",
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"clean:all": "rm -rf dist node_modules pnpm-lock.yaml",
|
|
56
|
+
"lint": "eslint --ext .ts,.html src --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --check --ignore-path ../../../.eslintignore",
|
|
57
|
+
"lint:lit": "lit-analyzer",
|
|
58
|
+
"format": "eslint --ext .ts,.html src --fix --ignore-path ../../../.eslintignore && prettier \"**/*.ts\" --write --ignore-path ../../../.eslintignore",
|
|
59
|
+
"test": "vitest run --coverage",
|
|
60
|
+
"test:watch": "vitest --watch",
|
|
61
|
+
"check": "pnpm run lint && pnpm run lint:lit && pnpm run build",
|
|
62
|
+
"localizeExtract": "lit-localize extract",
|
|
63
|
+
"localizeBuild": "lit-localize build",
|
|
64
|
+
"storybook": "storybook dev -p 6006",
|
|
65
|
+
"build-storybook": "storybook build"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-calendar-cell.d.ts","sourceRoot":"","sources":["../src/pd-calendar-cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAS5D;;;;;;;GAOG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,OAAO,SAAM;IAEb;;OAEG;IAEH,WAAW,SAAc;IAKzB,GAAG,SAAM;IAGT,aAAa,SAAM;IAGnB,SAAS,SAAM;IAEf,OAAgB,MAAM,EAAE,cAAc,CAoJpC;IAEO,MAAM;IAMf,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;CAQpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-calendar.d.ts","sourceRoot":"","sources":["../src/pd-calendar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK5E,OAAO,0CAA0C,CAAC;AASlD,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqD1C;;;;;;;GAOG;AACH,qBAEa,UAAW,SAAQ,UAAU;IAExC,OAAO,CAAC,EAAE,IAAI,CAAC;IAGf,eAAe,UAAS;IAGxB,aAAa,EAAE,MAAM,EAAE,CAAM;IAG7B,mBAAmB,UAAS;IAG5B,mBAAmB,UAAS;IAG5B,aAAa,UAAS;IAGtB,WAAW,UAAS;IAGpB,mBAAmB,SAAM;IAGzB,mBAAmB,SAAM;IAGzB,IAAI,EAAE,YAAY,CAAM;IAGxB,WAAW,SAAc;IAGzB,OAAO,CAAC,SAAS,CAAc;IAG/B,OAAO,CAAC,YAAY,CAAc;IAGlC,OAAO,CAAC,WAAW,CAAK;IAExB,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,sBAAsB,CAAc;IAC5C,OAAO,CAAC,kBAAkB,CAAK;IAE/B,OAAgB,MAAM,EAAE,cAAc,CAsHpC;IAEO,iBAAiB,IAAI,IAAI;IAKzB,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAOrD,MAAM;IAOf,OAAO,CAAC,mBAAmB;IA6E3B,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAUpC,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,yBAAyB;CAOlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pd-year-popup.d.ts","sourceRoot":"","sources":["../src/pd-year-popup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ5D;;;;;;;;GAQG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC;;OAEG;IAEH,aAAa,EAAE,MAAM,EAAE,CAAM;IAE7B;;OAEG;IAEH,WAAW,SAAM;IAEjB,OAAgB,MAAM,EAAE,cAAc,CA+DpC;IAEO,MAAM;IAkBf,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,eAAe;CAQxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cell.stories.d.ts","sourceRoot":"","sources":["../../src/stories/cell.stories.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,wBAAwB,CAAC;AAGhC,QAAA,MAAM,IAAI;;;;;;;;;CAuCM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.d.ts","sourceRoot":"","sources":["../../src/stories/index.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIhE,OAAO,mBAAmB,CAAC;AAG3B,QAAA,MAAM,IAAI;;;;;;;;;CAwBM,CAAC;AAEjB,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AActB,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAUF,eAAO,MAAM,sBAAsB,EAAE,KAOpC,CAAC;AAiBF,eAAO,MAAM,eAAe,EAAE,KAO7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,KAQxC,CAAC;AAIF,eAAO,MAAM,8BAA8B,EAAE,KAM5C,CAAC;AA2CF,eAAO,MAAM,UAAU,EAAE,KA0BxB,CAAC;AAOF,eAAO,MAAM,2BAA2B,EAAE,KA2BzC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,KA+BnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,KA0BtC,CAAC"}
|