@zeedhi/zd-calendar-common 1.0.0
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/coverage/clover.xml +132 -0
- package/coverage/coverage-final.json +4 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/calendar.ts.html +691 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +146 -0
- package/coverage/lcov-report/index.ts.html +91 -0
- package/coverage/lcov-report/interfaces.ts.html +406 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +169 -0
- package/dist/calendar-common.esm.js +176 -0
- package/dist/calendar-common.umd.js +183 -0
- package/jest.config.js +10 -0
- package/package.json +27 -0
- package/tests/unit/calendar.spec.ts +478 -0
- package/tsconfig.eslint.json +10 -0
- package/types/tests/unit/calendar.spec.d.ts +1 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/common'), require('@zeedhi/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/common', '@zeedhi/core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/zd-calendar-common"] = {}, global["@zeedhi/common"], global["@zeedhi/core"]));
|
|
5
|
+
})(this, (function (exports, common, core) { 'use strict';
|
|
6
|
+
|
|
7
|
+
class Calendar extends common.ComponentRender {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.showHeader = true;
|
|
11
|
+
this.categoryDays = 1;
|
|
12
|
+
this.categoryHideDynamic = false;
|
|
13
|
+
this.categoryShowAll = false;
|
|
14
|
+
this.color = 'primary';
|
|
15
|
+
this.dayFormat = null;
|
|
16
|
+
this.eventCategory = 'category';
|
|
17
|
+
this.eventColor = 'primary';
|
|
18
|
+
this.eventEnd = 'end';
|
|
19
|
+
this.eventHeight = 20;
|
|
20
|
+
this.eventMarginBottom = 1;
|
|
21
|
+
this.eventMore = true;
|
|
22
|
+
this.eventMoreText = 'CALENDAR_MORE';
|
|
23
|
+
this.eventName = 'name';
|
|
24
|
+
this.eventOverlapMode = 'stack';
|
|
25
|
+
this.eventOverlapThreshold = 60;
|
|
26
|
+
this.eventStart = 'start';
|
|
27
|
+
this.eventTextColor = 'white';
|
|
28
|
+
this.eventTimed = 'timed';
|
|
29
|
+
this.calendarEvents = [];
|
|
30
|
+
this.firstInterval = 0;
|
|
31
|
+
this.firstTime = 0;
|
|
32
|
+
this.hideHeader = false;
|
|
33
|
+
this.intervalCount = 24;
|
|
34
|
+
this.intervalFormat = null;
|
|
35
|
+
this.intervalHeight = 48;
|
|
36
|
+
this.intervalMinutes = 60;
|
|
37
|
+
this.intervalStyle = null;
|
|
38
|
+
this.intervalWidth = 60;
|
|
39
|
+
this.locale = 'pt-BR';
|
|
40
|
+
this.localeFirstDayOfYear = 0;
|
|
41
|
+
this.maxDays = 7;
|
|
42
|
+
this.minWeeks = 1;
|
|
43
|
+
this.monthFormat = null;
|
|
44
|
+
this.shortIntervals = true;
|
|
45
|
+
this.shortMonths = true;
|
|
46
|
+
this.shortWeekDays = true;
|
|
47
|
+
this.showIntervalLabel = null;
|
|
48
|
+
this.showMonthOnFirst = true;
|
|
49
|
+
this.showWeek = false;
|
|
50
|
+
this.type = 'month';
|
|
51
|
+
this.weekdayFormat = null;
|
|
52
|
+
this.weekdays = [0, 1, 2, 3, 4, 5, 6];
|
|
53
|
+
this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
|
|
54
|
+
this.title = this.getInitValue('title', props.title, this.title);
|
|
55
|
+
this.categories = this.getInitValue('categories', props.categories, this.categories);
|
|
56
|
+
this.categoryDays = this.getInitValue('categoryDays', props.categoryDays, this.categoryDays);
|
|
57
|
+
this.categoryForInvalid = this.getInitValue('categoryForInvalid', props.categoryForInvalid, this.categoryForInvalid);
|
|
58
|
+
this.categoryHideDynamic = this.getInitValue('categoryHideDynamic', props.categoryHideDynamic, this.categoryHideDynamic);
|
|
59
|
+
this.categoryShowAll = this.getInitValue('categoryShowAll', props.categoryShowAll, this.categoryShowAll);
|
|
60
|
+
this.categoryText = this.getInitValue('categoryText', props.categoryText, this.categoryText);
|
|
61
|
+
this.color = this.getInitValue('color', props.color, this.color);
|
|
62
|
+
this.dayFormat = this.getInitValue('dayFormat', props.dayFormat, this.dayFormat);
|
|
63
|
+
this.end = this.getInitValue('end', props.end, this.end);
|
|
64
|
+
this.eventCategory = this.getInitValue('eventCategory', props.eventCategory, this.eventCategory);
|
|
65
|
+
this.eventColor = this.getInitValue('eventColor', props.eventColor, this.eventColor);
|
|
66
|
+
this.eventEnd = this.getInitValue('eventEnd', props.eventEnd, this.eventEnd);
|
|
67
|
+
this.eventHeight = this.getInitValue('eventHeight', props.eventHeight, this.eventHeight);
|
|
68
|
+
this.eventMarginBottom = this.getInitValue('eventMarginBottom', props.eventMarginBottom, this.eventMarginBottom);
|
|
69
|
+
this.eventMore = this.getInitValue('eventMore', props.eventMore, this.eventMore);
|
|
70
|
+
this.eventMoreText = this.getInitValue('eventMoreText', props.eventMoreText, this.eventMoreText);
|
|
71
|
+
this.eventName = this.getInitValue('eventName', props.eventName, this.eventName);
|
|
72
|
+
this.eventOverlapMode = this.getInitValue('eventOverlapMode', props.eventOverlapMode, this.eventOverlapMode);
|
|
73
|
+
this.eventOverlapThreshold = this.getInitValue('eventOverlapThreshold', props.eventOverlapThreshold, this.eventOverlapThreshold);
|
|
74
|
+
this.eventStart = this.getInitValue('eventStart', props.eventStart, this.eventStart);
|
|
75
|
+
this.eventTextColor = this.getInitValue('eventTextColor', props.eventTextColor, this.eventTextColor);
|
|
76
|
+
this.eventTimed = this.getInitValue('eventTimed', props.eventTimed, this.eventTimed);
|
|
77
|
+
this.calendarEvents = this.getInitValue('calendarEvents', props.calendarEvents, this.calendarEvents);
|
|
78
|
+
this.firstInterval = this.getInitValue('firstInterval', props.firstInterval, this.firstInterval);
|
|
79
|
+
this.firstTime = this.getInitValue('firstTime', props.firstTime, this.firstTime);
|
|
80
|
+
this.hideHeader = this.getInitValue('hideHeader', props.hideHeader, this.hideHeader);
|
|
81
|
+
this.intervalCount = this.getInitValue('intervalCount', props.intervalCount, this.intervalCount);
|
|
82
|
+
this.intervalFormat = this.getInitValue('intervalFormat', props.intervalFormat, this.intervalFormat);
|
|
83
|
+
this.intervalHeight = this.getInitValue('intervalHeight', props.intervalHeight, this.intervalHeight);
|
|
84
|
+
this.intervalMinutes = this.getInitValue('intervalMinutes', props.intervalMinutes, this.intervalMinutes);
|
|
85
|
+
this.intervalStyle = this.getInitValue('intervalStyle', props.intervalStyle, this.intervalStyle);
|
|
86
|
+
this.intervalWidth = this.getInitValue('intervalWidth', props.intervalWidth, this.intervalWidth);
|
|
87
|
+
this.locale = this.getInitValue('locale', props.locale, this.locale);
|
|
88
|
+
this.localeFirstDayOfYear = this.getInitValue('localeFirstDayOfYear', props.localeFirstDayOfYear, this.localeFirstDayOfYear);
|
|
89
|
+
this.maxDays = this.getInitValue('maxDays', props.maxDays, this.maxDays);
|
|
90
|
+
this.minWeeks = this.getInitValue('minWeeks', props.minWeeks, this.minWeeks);
|
|
91
|
+
this.monthFormat = this.getInitValue('monthFormat', props.monthFormat, this.monthFormat);
|
|
92
|
+
this.now = this.getInitValue('now', props.now, this.now);
|
|
93
|
+
this.shortIntervals = this.getInitValue('shortIntervals', props.shortIntervals, this.shortIntervals);
|
|
94
|
+
this.shortMonths = this.getInitValue('shortMonths', props.shortMonths, this.shortMonths);
|
|
95
|
+
this.shortWeekDays = this.getInitValue('shortWeekDays', props.shortWeekDays, this.shortWeekDays);
|
|
96
|
+
this.showIntervalLabel = this.getInitValue('showIntervalLabel', props.showIntervalLabel, this.showIntervalLabel);
|
|
97
|
+
this.showMonthOnFirst = this.getInitValue('showMonthOnFirst', props.showMonthOnFirst, this.showMonthOnFirst);
|
|
98
|
+
this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
|
|
99
|
+
this.start = this.getInitValue('start', props.start, this.start);
|
|
100
|
+
this.type = this.getInitValue('type', props.type, this.type);
|
|
101
|
+
this.value = this.getInitValue('value', props.value, this.value);
|
|
102
|
+
this.weekdayFormat = this.getInitValue('weekdayFormat', props.weekdayFormat, this.weekdayFormat);
|
|
103
|
+
this.weekdays = this.getInitValue('weekdays', props.weekdays, this.weekdays);
|
|
104
|
+
this.selectTypeData = this.getInitValue('selectTypeData', props.selectTypeData, this.selectTypeData);
|
|
105
|
+
this.createAccessors();
|
|
106
|
+
}
|
|
107
|
+
addCalendarEvents(events) {
|
|
108
|
+
events.forEach((event) => {
|
|
109
|
+
this.calendarEvents.push(event);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
updateCalendarEvent(events) {
|
|
113
|
+
if (this.calendarEvents.length >= 0) {
|
|
114
|
+
events.forEach((event) => {
|
|
115
|
+
const index = this.calendarEvents.findIndex((item) => item.id === event.id);
|
|
116
|
+
if (index !== -1) {
|
|
117
|
+
this.calendarEvents[index] = event;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
this.calendarEvents.push(event);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
clearCalendarEvents() {
|
|
126
|
+
this.calendarEvents = [];
|
|
127
|
+
}
|
|
128
|
+
removeCalendarEvents(events) {
|
|
129
|
+
if (this.calendarEvents.length >= 0) {
|
|
130
|
+
events.forEach((event) => {
|
|
131
|
+
const index = this.calendarEvents.findIndex((item) => item.id === event.id);
|
|
132
|
+
if (index !== -1) {
|
|
133
|
+
this.calendarEvents.splice(index, 1);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
core.Messages.add({
|
|
141
|
+
'pt-BR': {
|
|
142
|
+
translation: {
|
|
143
|
+
CALENDAR_MONTH: 'Mês',
|
|
144
|
+
CALENDAR_DAY: 'Dia',
|
|
145
|
+
CALENDAR_WEEK: 'Semana',
|
|
146
|
+
CALENDAR_TODAY: 'Hoje',
|
|
147
|
+
CALENDAR_CATEGORY: 'Categoria',
|
|
148
|
+
CALENDAR_4DAYS: '4 Dias',
|
|
149
|
+
CALENDAR_MORE: 'mais',
|
|
150
|
+
CALENDAR_CLOSE: 'Fechar',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
'en-US': {
|
|
154
|
+
translation: {
|
|
155
|
+
CALENDAR_MONTH: 'Month',
|
|
156
|
+
CALENDAR_DAY: 'Day',
|
|
157
|
+
CALENDAR_WEEK: 'Week',
|
|
158
|
+
CALENDAR_TODAY: 'Today',
|
|
159
|
+
CALENDAR_CATEGORY: 'Category',
|
|
160
|
+
CALENDAR_4DAYS: '4 Days',
|
|
161
|
+
CALENDAR_MORE: 'more',
|
|
162
|
+
CALENDAR_CLOSE: 'Close',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
'es-ES': {
|
|
166
|
+
translation: {
|
|
167
|
+
CALENDAR_MONTH: 'Mes',
|
|
168
|
+
CALENDAR_DAY: 'Día',
|
|
169
|
+
CALENDAR_WEEK: 'Semana',
|
|
170
|
+
CALENDAR_TODAY: 'Hoy dia',
|
|
171
|
+
CALENDAR_CATEGORY: 'Hoy dia',
|
|
172
|
+
CALENDAR_4DAYS: '4 Dias',
|
|
173
|
+
CALENDAR_MORE: 'más',
|
|
174
|
+
CALENDAR_CLOSE: 'Cerrar',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
exports.Calendar = Calendar;
|
|
180
|
+
|
|
181
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
182
|
+
|
|
183
|
+
}));
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zeedhi/zd-calendar-common",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Powered by Zeedhi",
|
|
5
|
+
"main": "dist/calendar-common.umd.js",
|
|
6
|
+
"module": "dist/calendar-common.esm.js",
|
|
7
|
+
"typings": "types/src/index.d.ts",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup -c",
|
|
13
|
+
"lint": "eslint . --fix --ext .ts",
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"watch": "npm run build -- -w"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/jest": "^26.0.19",
|
|
19
|
+
"jest": "^26.6.3",
|
|
20
|
+
"ts-jest": "^26.4.4"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@zeedhi/common": "*",
|
|
24
|
+
"@zeedhi/core": "*"
|
|
25
|
+
},
|
|
26
|
+
"gitHead": "052812e98c51855a1da2b71e3ec4e79cee527d54"
|
|
27
|
+
}
|