@omegagrid/calendar 0.5.19 → 0.6.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/dist/constants.d.ts +13 -12
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -5
- package/dist/constants.js.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/options.js +6 -10
- package/dist/options.js.map +1 -1
- package/dist/ui/calendar.d.ts.map +1 -1
- package/dist/ui/calendar.js +63 -75
- package/dist/ui/calendar.js.map +1 -1
- package/dist/ui/calendar.style.js +4 -10
- package/dist/ui/calendar.style.js.map +1 -1
- package/dist/ui/dropdown.js +21 -27
- package/dist/ui/dropdown.js.map +1 -1
- package/dist/ui/dropdown.style.js +2 -5
- package/dist/ui/dropdown.style.js.map +1 -1
- package/dist/ui/index.js +2 -18
- package/dist/ui/index.js.map +1 -1
- package/dist/utils.js +20 -30
- package/dist/utils.js.map +1 -1
- package/package.json +6 -6
package/dist/constants.d.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
/// <reference types="color" />
|
|
2
1
|
declare const _default: {
|
|
3
2
|
PREFIX: string;
|
|
4
3
|
DEFAULT_ACCENT_COLOR: string;
|
|
5
|
-
DEFAULT_ACCENT_COLOR_2: import("color")<string | number |
|
|
4
|
+
DEFAULT_ACCENT_COLOR_2: import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | any | ArrayLike<number> | {
|
|
6
5
|
[key: string]: any;
|
|
7
|
-
}> | {
|
|
6
|
+
}> | ArrayLike<number> | {
|
|
8
7
|
[key: string]: any;
|
|
9
|
-
}> | {
|
|
8
|
+
}> | ArrayLike<number> | {
|
|
10
9
|
[key: string]: any;
|
|
11
|
-
}> | {
|
|
10
|
+
}> | ArrayLike<number> | {
|
|
12
11
|
[key: string]: any;
|
|
13
|
-
}> | {
|
|
12
|
+
}> | ArrayLike<number> | {
|
|
14
13
|
[key: string]: any;
|
|
15
|
-
}> | {
|
|
14
|
+
}> | ArrayLike<number> | {
|
|
16
15
|
[key: string]: any;
|
|
17
|
-
}> | {
|
|
16
|
+
}> | ArrayLike<number> | {
|
|
18
17
|
[key: string]: any;
|
|
19
|
-
}> | {
|
|
18
|
+
}> | ArrayLike<number> | {
|
|
20
19
|
[key: string]: any;
|
|
21
|
-
}> | {
|
|
20
|
+
}> | ArrayLike<number> | {
|
|
22
21
|
[key: string]: any;
|
|
23
|
-
}> | {
|
|
22
|
+
}> | ArrayLike<number> | {
|
|
24
23
|
[key: string]: any;
|
|
25
|
-
}> | {
|
|
24
|
+
}> | ArrayLike<number> | {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}> | ArrayLike<number> | {
|
|
26
27
|
[key: string]: any;
|
|
27
28
|
}>;
|
|
28
29
|
SIZER_SIZE: number;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAGE"}
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const core_1 = require("@omegagrid/core");
|
|
4
|
-
exports.default = {
|
|
1
|
+
import { constants as coreConstants } from '@omegagrid/core';
|
|
2
|
+
export default {
|
|
5
3
|
HEADER_HEIGHT: 22,
|
|
6
|
-
...
|
|
4
|
+
...coreConstants
|
|
7
5
|
};
|
|
8
6
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,eAAe;IACd,aAAa,EAAE,EAAE;IACjB,GAAG,aAAa;CAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ui"), exports);
|
|
1
|
+
export * from './ui';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
|
package/dist/options.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.initOptions = void 0;
|
|
4
|
-
const core_1 = require("@omegagrid/core");
|
|
5
|
-
const date_fns_1 = require("date-fns");
|
|
1
|
+
import { initCommonOptions } from "@omegagrid/core";
|
|
2
|
+
import { endOfWeek, startOfWeek } from "date-fns";
|
|
6
3
|
const DEFAULT_OPTIONS = {
|
|
7
4
|
minDate: new Date(1900, 0, 1, 0, 0, 0),
|
|
8
5
|
maxDate: new Date(2100, 11, 31, 0, 0, 0),
|
|
@@ -10,16 +7,15 @@ const DEFAULT_OPTIONS = {
|
|
|
10
7
|
todayButton: true,
|
|
11
8
|
controlsPosition: 'top'
|
|
12
9
|
};
|
|
13
|
-
function initOptions(options, origOptions = null) {
|
|
10
|
+
export function initOptions(options, origOptions = null) {
|
|
14
11
|
const opts = {
|
|
15
|
-
...
|
|
12
|
+
...initCommonOptions(options, origOptions),
|
|
16
13
|
...DEFAULT_OPTIONS,
|
|
17
14
|
...origOptions,
|
|
18
15
|
...options,
|
|
19
16
|
};
|
|
20
|
-
opts.minDate =
|
|
21
|
-
opts.maxDate =
|
|
17
|
+
opts.minDate = startOfWeek(opts.minDate, { weekStartsOn: opts.weekStart });
|
|
18
|
+
opts.maxDate = endOfWeek(opts.maxDate, { weekStartsOn: opts.weekStart });
|
|
22
19
|
return opts;
|
|
23
20
|
}
|
|
24
|
-
exports.initOptions = initOptions;
|
|
25
21
|
//# sourceMappingURL=options.js.map
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmC,MAAM,iBAAiB,CAAC;AAErF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAUlD,MAAM,eAAe,GAAqB;IACzC,OAAO,EAAE,I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__decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16,42 +15,37 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
16
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
17
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
18
17
|
};
|
|
19
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
-
};
|
|
22
18
|
var _Calendar_instances, _Calendar_dateFormatter, _Calendar_dispatchChangeEvent, _Calendar_calculateColumnWidth, _Calendar_calculateRowHeight, _Calendar_grid, _Calendar_gridInitialized, _Calendar_month, _Calendar_renderer, _Calendar_getSourceData, _Calendar_onSelect, _Calendar_onRender, _Calendar_onSelectChange;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const constants_1 = __importDefault(require("../constants"));
|
|
38
|
-
let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
19
|
+
import { OmegaComponent, dates, dom, events } from '@omegagrid/core';
|
|
20
|
+
import { html } from 'lit';
|
|
21
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
22
|
+
import { join } from 'lit/directives/join.js';
|
|
23
|
+
import { style } from './calendar.style';
|
|
24
|
+
import { CellRange } from '@omegagrid/grid';
|
|
25
|
+
import { initOptions } from '../options';
|
|
26
|
+
import { getNumberOfWeeks, getWeekDays, getDate, getYears, getMonthNames, getWeekOffset, getCellCoordsByDate } from '../utils';
|
|
27
|
+
import { format, isEqual, startOfDay } from 'date-fns';
|
|
28
|
+
import { guard } from 'lit/directives/guard.js';
|
|
29
|
+
import { cache } from 'lit/directives/cache.js';
|
|
30
|
+
import { msg } from '@omegagrid/localize';
|
|
31
|
+
import constants from '../constants';
|
|
32
|
+
let Calendar = class Calendar extends OmegaComponent {
|
|
39
33
|
constructor() {
|
|
40
34
|
super(...arguments);
|
|
41
35
|
_Calendar_instances.add(this);
|
|
42
|
-
this.date =
|
|
36
|
+
this.date = startOfDay(new Date());
|
|
43
37
|
this.year = (new Date()).getFullYear();
|
|
44
38
|
this.month = (new Date()).getMonth() + 1;
|
|
45
39
|
_Calendar_dateFormatter.set(this, void 0);
|
|
46
|
-
_Calendar_dispatchChangeEvent.set(this, () => this.dispatchEvent(new
|
|
40
|
+
_Calendar_dispatchChangeEvent.set(this, () => this.dispatchEvent(new events.ChangeEvent({ value: this.date })));
|
|
47
41
|
_Calendar_calculateColumnWidth.set(this, () => this.body.clientWidth / 7);
|
|
48
|
-
_Calendar_calculateRowHeight.set(this, () => (this.body.clientHeight -
|
|
42
|
+
_Calendar_calculateRowHeight.set(this, () => (this.body.clientHeight - constants.HEADER_HEIGHT) / 6);
|
|
49
43
|
_Calendar_grid.set(this, void 0);
|
|
50
44
|
_Calendar_gridInitialized.set(this, false);
|
|
51
45
|
_Calendar_month.set(this, void 0);
|
|
52
46
|
_Calendar_renderer.set(this, (div, cell) => {
|
|
53
|
-
const date =
|
|
54
|
-
div.innerHTML =
|
|
47
|
+
const date = getDate(cell.r, cell.c, this.options);
|
|
48
|
+
div.innerHTML = format(date, 'd');
|
|
55
49
|
div.style.textAlign = 'center';
|
|
56
50
|
if (__classPrivateFieldGet(this, _Calendar_month, "f") == null) {
|
|
57
51
|
__classPrivateFieldSet(this, _Calendar_month, (date.getMonth() + (date.getDate() < 10 ? 0 : 1)) % 12, "f");
|
|
@@ -68,7 +62,7 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
68
62
|
});
|
|
69
63
|
_Calendar_onSelect.set(this, (e) => {
|
|
70
64
|
if (e.selection.activeCell) {
|
|
71
|
-
this.updateDate(
|
|
65
|
+
this.updateDate(getDate(e.selection.range.r1, e.selection.range.c1, this.options));
|
|
72
66
|
}
|
|
73
67
|
});
|
|
74
68
|
_Calendar_onRender.set(this, () => __classPrivateFieldSet(this, _Calendar_month, null, "f"));
|
|
@@ -78,9 +72,9 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
78
72
|
await this.updateComplete;
|
|
79
73
|
this.gotoCurrentSelection();
|
|
80
74
|
});
|
|
81
|
-
this.renderControls = () =>
|
|
75
|
+
this.renderControls = () => html `
|
|
82
76
|
<div class="header">
|
|
83
|
-
${this.date ?
|
|
77
|
+
${this.date ? html `
|
|
84
78
|
<og-button
|
|
85
79
|
class="date"
|
|
86
80
|
color="transparent"
|
|
@@ -89,21 +83,19 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
89
83
|
</og-button>
|
|
90
84
|
` : ''}
|
|
91
85
|
|
|
92
|
-
${this.options.todayButton ?
|
|
86
|
+
${this.options.todayButton ? html `
|
|
93
87
|
<og-button
|
|
94
88
|
style="flex: 1; text-align: center"
|
|
95
89
|
class="today"
|
|
96
90
|
color="transparent"
|
|
97
|
-
.text="${
|
|
91
|
+
.text="${msg('today')}"
|
|
98
92
|
@click="${() => this.updateDate(new Date())}">
|
|
99
93
|
</og-button>
|
|
100
|
-
` :
|
|
94
|
+
` : html `
|
|
101
95
|
<div style="flex: 1"></div>
|
|
102
96
|
`}
|
|
103
97
|
|
|
104
|
-
${
|
|
105
|
-
var _a;
|
|
106
|
-
return (0, lit_1.html) `
|
|
98
|
+
${guard([this.month], () => html `
|
|
107
99
|
<og-button
|
|
108
100
|
class="left"
|
|
109
101
|
icon="caret-left"
|
|
@@ -117,8 +109,8 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
117
109
|
color="accent"
|
|
118
110
|
style="width: 60px; text-align: center"
|
|
119
111
|
@change="${__classPrivateFieldGet(this, _Calendar_onSelectChange, "f")}"
|
|
120
|
-
.value="${
|
|
121
|
-
.items="${
|
|
112
|
+
.value="${this.month?.toString()}"
|
|
113
|
+
.items="${getMonthNames(this.options).map((name, i) => ({ key: (i + 1).toString(), value: name }))}">
|
|
122
114
|
</og-dropdown-list>
|
|
123
115
|
|
|
124
116
|
<og-button
|
|
@@ -127,10 +119,9 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
127
119
|
color="accent"
|
|
128
120
|
@click="${() => this.addMonth(1)}">
|
|
129
121
|
</og-button>
|
|
130
|
-
|
|
131
|
-
})}
|
|
122
|
+
`)}
|
|
132
123
|
|
|
133
|
-
${
|
|
124
|
+
${guard([this.year], () => html `
|
|
134
125
|
<og-button
|
|
135
126
|
class="left"
|
|
136
127
|
icon="caret-left"
|
|
@@ -148,7 +139,7 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
148
139
|
alignment="left"
|
|
149
140
|
@change="${__classPrivateFieldGet(this, _Calendar_onSelectChange, "f")}"
|
|
150
141
|
.value="${this.year.toString()}"
|
|
151
|
-
.items="${
|
|
142
|
+
.items="${getYears(this.options).map(y => ({ key: y.toString(), value: y.toString() }))}">
|
|
152
143
|
</og-dropdown-list>
|
|
153
144
|
|
|
154
145
|
<og-button
|
|
@@ -161,17 +152,17 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
161
152
|
`)}
|
|
162
153
|
</div>
|
|
163
154
|
`;
|
|
164
|
-
this.render = () =>
|
|
165
|
-
|
|
155
|
+
this.render = () => join(this.options.controlsPosition != 'top' ? [
|
|
156
|
+
cache(html `<div class="body"></div>`),
|
|
166
157
|
this.renderControls()
|
|
167
158
|
] : [
|
|
168
159
|
this.renderControls(),
|
|
169
|
-
|
|
160
|
+
cache(html `<div class="body"></div>`)
|
|
170
161
|
], '');
|
|
171
162
|
}
|
|
172
163
|
get dateFormatter() {
|
|
173
164
|
if (!__classPrivateFieldGet(this, _Calendar_dateFormatter, "f")) {
|
|
174
|
-
__classPrivateFieldSet(this, _Calendar_dateFormatter,
|
|
165
|
+
__classPrivateFieldSet(this, _Calendar_dateFormatter, dates.getDateFormatter(this.options.locale), "f");
|
|
175
166
|
}
|
|
176
167
|
return __classPrivateFieldGet(this, _Calendar_dateFormatter, "f");
|
|
177
168
|
}
|
|
@@ -182,7 +173,7 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
182
173
|
}
|
|
183
174
|
willUpdate(props) {
|
|
184
175
|
if (props.has('options') || !this.options) {
|
|
185
|
-
this.options =
|
|
176
|
+
this.options = initOptions(this.options);
|
|
186
177
|
}
|
|
187
178
|
}
|
|
188
179
|
connectedCallback() {
|
|
@@ -191,14 +182,14 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
191
182
|
}
|
|
192
183
|
disconnectedCallback() {
|
|
193
184
|
if (this.body)
|
|
194
|
-
|
|
185
|
+
dom.empty(this.body);
|
|
195
186
|
__classPrivateFieldSet(this, _Calendar_grid, null, "f");
|
|
196
187
|
}
|
|
197
188
|
updateBody() {
|
|
198
189
|
if (!this.body)
|
|
199
190
|
return;
|
|
200
191
|
if (this.body.firstElementChild != this.grid) {
|
|
201
|
-
|
|
192
|
+
dom.empty(this.body);
|
|
202
193
|
this.grid.setSourceData(__classPrivateFieldGet(this, _Calendar_instances, "m", _Calendar_getSourceData).call(this));
|
|
203
194
|
this.body.appendChild(this.grid);
|
|
204
195
|
}
|
|
@@ -206,14 +197,13 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
206
197
|
get grid() {
|
|
207
198
|
if (__classPrivateFieldGet(this, _Calendar_grid, "f"))
|
|
208
199
|
return __classPrivateFieldGet(this, _Calendar_grid, "f");
|
|
209
|
-
__classPrivateFieldSet(this, _Calendar_grid,
|
|
210
|
-
|
|
200
|
+
__classPrivateFieldSet(this, _Calendar_grid, dom.createElement('og-grid'), "f");
|
|
201
|
+
dom.setInset(__classPrivateFieldGet(this, _Calendar_grid, "f"), 0);
|
|
211
202
|
__classPrivateFieldGet(this, _Calendar_grid, "f").addEventListener('grid.select', __classPrivateFieldGet(this, _Calendar_onSelect, "f"));
|
|
212
203
|
__classPrivateFieldGet(this, _Calendar_grid, "f").addEventListener('grid.render', __classPrivateFieldGet(this, _Calendar_onRender, "f"));
|
|
213
204
|
__classPrivateFieldGet(this, _Calendar_grid, "f").addEventListener('grid.init', () => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
(_a = this.grid) === null || _a === void 0 ? void 0 : _a.selecting.select(new grid_1.CellRange(coords.column, coords.row));
|
|
205
|
+
const coords = getCellCoordsByDate(this.date, this.options);
|
|
206
|
+
this.grid?.selecting.select(new CellRange(coords.column, coords.row));
|
|
217
207
|
this.goto();
|
|
218
208
|
__classPrivateFieldSet(this, _Calendar_gridInitialized, true, "f");
|
|
219
209
|
});
|
|
@@ -223,28 +213,26 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
223
213
|
this.grid.layout();
|
|
224
214
|
}
|
|
225
215
|
goto(date = null) {
|
|
226
|
-
var _a;
|
|
227
216
|
__classPrivateFieldSet(this, _Calendar_month, null, "f");
|
|
228
|
-
date =
|
|
217
|
+
date = date ?? this.date ?? new Date();
|
|
229
218
|
this.year = date.getFullYear();
|
|
230
219
|
this.month = date.getMonth() + 1;
|
|
231
|
-
__classPrivateFieldGet(this, _Calendar_grid, "f").rendering.scrollTo(
|
|
220
|
+
__classPrivateFieldGet(this, _Calendar_grid, "f").rendering.scrollTo(getWeekOffset(date, this.options), 0);
|
|
232
221
|
}
|
|
233
222
|
updated(props) {
|
|
234
|
-
var _a, _b;
|
|
235
223
|
this.updateBody();
|
|
236
224
|
if (props.has('options')) {
|
|
237
|
-
|
|
225
|
+
this.grid?.setSourceData(__classPrivateFieldGet(this, _Calendar_instances, "m", _Calendar_getSourceData).call(this));
|
|
238
226
|
}
|
|
239
227
|
if (props.has('date') && __classPrivateFieldGet(this, _Calendar_gridInitialized, "f")) {
|
|
240
|
-
const coords =
|
|
241
|
-
|
|
228
|
+
const coords = getCellCoordsByDate(this.date, this.options);
|
|
229
|
+
this.grid?.selecting.select(new CellRange(coords.column, coords.row));
|
|
242
230
|
this.goto();
|
|
243
231
|
}
|
|
244
232
|
}
|
|
245
233
|
updateDate(date, dispatchEvent = true) {
|
|
246
|
-
date =
|
|
247
|
-
if (
|
|
234
|
+
date = startOfDay(date);
|
|
235
|
+
if (isEqual(date, this.date))
|
|
248
236
|
return;
|
|
249
237
|
this.date = date;
|
|
250
238
|
if (dispatchEvent)
|
|
@@ -272,7 +260,6 @@ let Calendar = class Calendar extends core_1.OmegaComponent {
|
|
|
272
260
|
}
|
|
273
261
|
}
|
|
274
262
|
};
|
|
275
|
-
exports.Calendar = Calendar;
|
|
276
263
|
_Calendar_dateFormatter = new WeakMap();
|
|
277
264
|
_Calendar_dispatchChangeEvent = new WeakMap();
|
|
278
265
|
_Calendar_calculateColumnWidth = new WeakMap();
|
|
@@ -287,12 +274,12 @@ _Calendar_onSelectChange = new WeakMap();
|
|
|
287
274
|
_Calendar_instances = new WeakSet();
|
|
288
275
|
_Calendar_getSourceData = function _Calendar_getSourceData() {
|
|
289
276
|
return {
|
|
290
|
-
columns:
|
|
277
|
+
columns: getWeekDays(this.options).map(day => ({
|
|
291
278
|
renderer: __classPrivateFieldGet(this, _Calendar_renderer, "f"),
|
|
292
|
-
header: [{ label: day, height:
|
|
279
|
+
header: [{ label: day, height: constants.HEADER_HEIGHT }]
|
|
293
280
|
})),
|
|
294
281
|
options: {
|
|
295
|
-
rows:
|
|
282
|
+
rows: getNumberOfWeeks(this.options),
|
|
296
283
|
rowHeight: __classPrivateFieldGet(this, _Calendar_calculateRowHeight, "f").call(this),
|
|
297
284
|
columnWidth: __classPrivateFieldGet(this, _Calendar_calculateColumnWidth, "f").call(this),
|
|
298
285
|
colLetters: false,
|
|
@@ -313,29 +300,30 @@ _Calendar_getSourceData = function _Calendar_getSourceData() {
|
|
|
313
300
|
}
|
|
314
301
|
};
|
|
315
302
|
};
|
|
316
|
-
Calendar.styles = [
|
|
303
|
+
Calendar.styles = [style];
|
|
317
304
|
__decorate([
|
|
318
|
-
|
|
305
|
+
query('.body')
|
|
319
306
|
], Calendar.prototype, "body", void 0);
|
|
320
307
|
__decorate([
|
|
321
|
-
|
|
308
|
+
property({ type: Object })
|
|
322
309
|
], Calendar.prototype, "options", void 0);
|
|
323
310
|
__decorate([
|
|
324
|
-
|
|
311
|
+
property({ type: Object })
|
|
325
312
|
], Calendar.prototype, "date", void 0);
|
|
326
313
|
__decorate([
|
|
327
|
-
|
|
314
|
+
property({ type: Number })
|
|
328
315
|
], Calendar.prototype, "year", void 0);
|
|
329
316
|
__decorate([
|
|
330
|
-
|
|
317
|
+
property({ type: Number })
|
|
331
318
|
], Calendar.prototype, "month", void 0);
|
|
332
319
|
__decorate([
|
|
333
|
-
|
|
320
|
+
query('og-dropdown-list.month')
|
|
334
321
|
], Calendar.prototype, "monthDropdown", void 0);
|
|
335
322
|
__decorate([
|
|
336
|
-
|
|
323
|
+
query('og-dropdown-list.year')
|
|
337
324
|
], Calendar.prototype, "yearDropdown", void 0);
|
|
338
|
-
|
|
339
|
-
|
|
325
|
+
Calendar = __decorate([
|
|
326
|
+
customElement('og-calendar')
|
|
340
327
|
], Calendar);
|
|
328
|
+
export { Calendar };
|
|
341
329
|
//# sourceMappingURL=calendar.js.map
|
package/dist/ui/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/ui/calendar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/ui/calendar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAwB,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM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I,sCAAsB,MAA1B,IAAI,CAAwB;YACzC,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,KAAK;YAChB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,KAAK;YAChB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE;gBACV,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,KAAK;aAClB;YACD,SAAS,EAAE;gBACV,kBAAkB,EAAE,KAAK;gBACzB,oBAAoB,EAAE,KAAK;aAC3B;SACD;KACD,CAAC;AACH,CAAC;AA/IM,eAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,KAAK,CAAC,OAAO,CAAC;sCACM;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACR;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACK;AAG9B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACS;AAGlC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACW;AAGpC;IADC,KAAK,CAAC,wBAAwB,CAAC;+CACJ;AAG5B;IADC,KAAK,CAAC,uBAAuB,CAAC;8CACJ;AAvBf,QAAQ;IADpB,aAAa,CAAC,aAAa,CAAC;GAChB,QAAQ,CAySpB"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.style = void 0;
|
|
7
|
-
const lit_1 = require("lit");
|
|
8
|
-
const constants_1 = __importDefault(require("../constants"));
|
|
9
|
-
exports.style = (0, lit_1.css) `
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import constants from '../constants';
|
|
3
|
+
export const style = css `
|
|
10
4
|
* {
|
|
11
5
|
box-sizing: border-box;
|
|
12
6
|
}
|
|
@@ -21,7 +15,7 @@ exports.style = (0, lit_1.css) `
|
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
.header {
|
|
24
|
-
flex: 0 0 ${
|
|
18
|
+
flex: 0 0 ${constants.HEADER_HEIGHT}px;
|
|
25
19
|
background: var(--og-accent-color);
|
|
26
20
|
color: #ffffff;
|
|
27
21
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.style.js","sourceRoot":"","sources":["../../src/ui/calendar.style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.style.js","sourceRoot":"","sources":["../../src/ui/calendar.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;cAeV,SAAS,CAAC,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BpC,CAAC"}
|
package/dist/ui/dropdown.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17,26 +16,22 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
17
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
18
17
|
};
|
|
19
18
|
var _CalendarDropdown_value, _CalendarDropdown_calendar;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const unsafe_html_js_1 = require("lit/directives/unsafe-html.js");
|
|
28
|
-
let CalendarDropdown = class CalendarDropdown extends core_1.Dropdown {
|
|
19
|
+
import { Dropdown, dom, events } from "@omegagrid/core";
|
|
20
|
+
import { customElement, property } from "lit/decorators.js";
|
|
21
|
+
import { initOptions } from "../options";
|
|
22
|
+
import { html } from "lit";
|
|
23
|
+
import { style } from "./dropdown.style";
|
|
24
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
25
|
+
let CalendarDropdown = class CalendarDropdown extends Dropdown {
|
|
29
26
|
constructor() {
|
|
30
27
|
super(...arguments);
|
|
31
|
-
this.calendarOptions =
|
|
28
|
+
this.calendarOptions = initOptions({
|
|
32
29
|
controlsPosition: 'bottom'
|
|
33
30
|
});
|
|
34
31
|
_CalendarDropdown_value.set(this, void 0);
|
|
35
32
|
this.cross = false;
|
|
36
33
|
_CalendarDropdown_calendar.set(this, void 0);
|
|
37
|
-
this.render = () =>
|
|
38
|
-
var _a;
|
|
39
|
-
return (0, lit_1.html) `
|
|
34
|
+
this.render = () => html `
|
|
40
35
|
<og-button
|
|
41
36
|
caret
|
|
42
37
|
color="${this.color}"
|
|
@@ -44,11 +39,11 @@ let CalendarDropdown = class CalendarDropdown extends core_1.Dropdown {
|
|
|
44
39
|
style="flex: 1"
|
|
45
40
|
@mousedown="${this._onMousedown}">
|
|
46
41
|
<div id="content" slot="content">
|
|
47
|
-
${
|
|
42
|
+
${this.calendar?.formattedDate || unsafeHTML(' ')}
|
|
48
43
|
</div>
|
|
49
44
|
</og-button>
|
|
50
45
|
|
|
51
|
-
${this.hasCrossButton ?
|
|
46
|
+
${this.hasCrossButton ? html `
|
|
52
47
|
<og-button
|
|
53
48
|
id="cross"
|
|
54
49
|
@mousedown="${() => this.clearValue(true)}"
|
|
@@ -59,7 +54,6 @@ let CalendarDropdown = class CalendarDropdown extends core_1.Dropdown {
|
|
|
59
54
|
|
|
60
55
|
${this.renderDropdown()}
|
|
61
56
|
`;
|
|
62
|
-
};
|
|
63
57
|
}
|
|
64
58
|
get value() { return __classPrivateFieldGet(this, _CalendarDropdown_value, "f"); }
|
|
65
59
|
set value(value) {
|
|
@@ -75,14 +69,14 @@ let CalendarDropdown = class CalendarDropdown extends core_1.Dropdown {
|
|
|
75
69
|
get calendar() {
|
|
76
70
|
if (__classPrivateFieldGet(this, _CalendarDropdown_calendar, "f"))
|
|
77
71
|
return __classPrivateFieldGet(this, _CalendarDropdown_calendar, "f");
|
|
78
|
-
__classPrivateFieldSet(this, _CalendarDropdown_calendar,
|
|
72
|
+
__classPrivateFieldSet(this, _CalendarDropdown_calendar, dom.createElement('og-calendar'), "f");
|
|
79
73
|
__classPrivateFieldGet(this, _CalendarDropdown_calendar, "f").date = __classPrivateFieldGet(this, _CalendarDropdown_value, "f");
|
|
80
74
|
__classPrivateFieldGet(this, _CalendarDropdown_calendar, "f").options = this.calendarOptions;
|
|
81
75
|
__classPrivateFieldGet(this, _CalendarDropdown_calendar, "f").slot = 'inner-content';
|
|
82
76
|
__classPrivateFieldGet(this, _CalendarDropdown_calendar, "f").addEventListener('change', (e) => {
|
|
83
77
|
__classPrivateFieldSet(this, _CalendarDropdown_value, e.value, "f");
|
|
84
78
|
// this.close();
|
|
85
|
-
this.dispatchEvent(new
|
|
79
|
+
this.dispatchEvent(new events.ChangeEvent({ value: e.value }));
|
|
86
80
|
this.requestUpdate();
|
|
87
81
|
});
|
|
88
82
|
return __classPrivateFieldGet(this, _CalendarDropdown_calendar, "f");
|
|
@@ -97,23 +91,23 @@ let CalendarDropdown = class CalendarDropdown extends core_1.Dropdown {
|
|
|
97
91
|
this.value = null;
|
|
98
92
|
this.close();
|
|
99
93
|
if (dispatchEvent)
|
|
100
|
-
this.dispatchEvent(new
|
|
94
|
+
this.dispatchEvent(new events.ChangeEvent({ value: null }));
|
|
101
95
|
}
|
|
102
96
|
};
|
|
103
|
-
exports.CalendarDropdown = CalendarDropdown;
|
|
104
97
|
_CalendarDropdown_value = new WeakMap();
|
|
105
98
|
_CalendarDropdown_calendar = new WeakMap();
|
|
106
|
-
CalendarDropdown.styles = [...
|
|
99
|
+
CalendarDropdown.styles = [...Dropdown.styles, style];
|
|
107
100
|
__decorate([
|
|
108
|
-
|
|
101
|
+
property({ type: Object })
|
|
109
102
|
], CalendarDropdown.prototype, "calendarOptions", void 0);
|
|
110
103
|
__decorate([
|
|
111
|
-
|
|
104
|
+
property({ type: Object, noAccessor: true })
|
|
112
105
|
], CalendarDropdown.prototype, "value", null);
|
|
113
106
|
__decorate([
|
|
114
|
-
|
|
107
|
+
property({ type: Boolean })
|
|
115
108
|
], CalendarDropdown.prototype, "cross", void 0);
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
CalendarDropdown = __decorate([
|
|
110
|
+
customElement('og-calendar-dropdown')
|
|
118
111
|
], CalendarDropdown);
|
|
112
|
+
export { CalendarDropdown };
|
|
119
113
|
//# sourceMappingURL=dropdown.js.map
|
package/dist/ui/dropdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../src/ui/dropdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../src/ui/dropdown.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAW,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ;IAAvC;;QAKN,oB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AI,EAAE,OAAO,EAAC,CAAC;+CACZ;AArBF,gBAAgB;IAD5B,aAAa,CAAC,sBAAsB,CAAC;GACzB,gBAAgB,CA+E5B"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.style = void 0;
|
|
4
|
-
const lit_1 = require("lit");
|
|
5
|
-
exports.style = (0, lit_1.css) `
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export const style = css `
|
|
6
3
|
og-input {
|
|
7
4
|
flex: 1;
|
|
8
5
|
border: 1px solid var(--og-accent-color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.style.js","sourceRoot":"","sources":["../../src/ui/dropdown.style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dropdown.style.js","sourceRoot":"","sources":["../../src/ui/dropdown.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BvB,CAAC"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./calendar"), exports);
|
|
18
|
-
__exportStar(require("./dropdown"), exports);
|
|
1
|
+
export * from './calendar';
|
|
2
|
+
export * from './dropdown';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -1,46 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const core_1 = require("@omegagrid/core");
|
|
6
|
-
function getNumberOfWeeks(options) {
|
|
7
|
-
return Math.ceil((0, date_fns_1.differenceInDays)(options.maxDate, options.minDate) / 7);
|
|
1
|
+
import { eachDayOfInterval, format, startOfWeek, endOfWeek, differenceInDays, add, startOfMonth } from "date-fns";
|
|
2
|
+
import { dates } from "@omegagrid/core";
|
|
3
|
+
export function getNumberOfWeeks(options) {
|
|
4
|
+
return Math.ceil(differenceInDays(options.maxDate, options.minDate) / 7);
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}).map(date => (0, date_fns_1.format)(date, 'cccccc', { locale: core_1.dates.getDateLocale(options.locale) }));
|
|
6
|
+
export function getWeekDays(options) {
|
|
7
|
+
return eachDayOfInterval({
|
|
8
|
+
start: startOfWeek(new Date(), { weekStartsOn: options.weekStart }),
|
|
9
|
+
end: endOfWeek(new Date(), { weekStartsOn: options.weekStart }),
|
|
10
|
+
}).map(date => format(date, 'cccccc', { locale: dates.getDateLocale(options.locale) }));
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return (0, date_fns_1.add)(options.minDate, { days: row * 7 + column });
|
|
12
|
+
export function getDate(row, column, options) {
|
|
13
|
+
return add(options.minDate, { days: row * 7 + column });
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
function getYears(options) {
|
|
15
|
+
export function getYears(options) {
|
|
22
16
|
const years = [];
|
|
23
17
|
for (let i = options.minDate.getFullYear(); i <= options.maxDate.getFullYear(); i++) {
|
|
24
18
|
years.push(i);
|
|
25
19
|
}
|
|
26
20
|
return years;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
locale: core_1.dates.getDateLocale(options.locale)
|
|
22
|
+
export function getMonthNames(options) {
|
|
23
|
+
return [...(new Array(12)).keys()].map(i => format(new Date(2000, i, 1), 'LLLL', {
|
|
24
|
+
locale: dates.getDateLocale(options.locale)
|
|
32
25
|
}));
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return Math.floor((0, date_fns_1.differenceInDays)((0, date_fns_1.startOfMonth)(date), options.minDate) / 7);
|
|
27
|
+
export function getWeekOffset(date, options) {
|
|
28
|
+
return Math.floor(differenceInDays(startOfMonth(date), options.minDate) / 7);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
|
-
function getCellCoordsByDate(date, options) {
|
|
30
|
+
export function getCellCoordsByDate(date, options) {
|
|
40
31
|
return {
|
|
41
|
-
row: Math.floor(
|
|
42
|
-
column:
|
|
32
|
+
row: Math.floor(differenceInDays(date, options.minDate) / 7),
|
|
33
|
+
column: differenceInDays(date, options.minDate) % 7
|
|
43
34
|
};
|
|
44
35
|
}
|
|
45
|
-
exports.getCellCoordsByDate = getCellCoordsByDate;
|
|
46
36
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"m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AI,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QACrF,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE;QAChF,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;KAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,OAAgB;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAU,EAAE,OAAgB;IAC/D,OAAO;QACN,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5D,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;KACnD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/calendar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Calendar component",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fortawesome/fontawesome-svg-core": "6.4.2",
|
|
31
|
-
"@omegagrid/core": "^0.
|
|
32
|
-
"@omegagrid/grid": "^0.
|
|
33
|
-
"@omegagrid/grid-core": "^0.
|
|
34
|
-
"@omegagrid/localize": "^0.
|
|
31
|
+
"@omegagrid/core": "^0.6.0",
|
|
32
|
+
"@omegagrid/grid": "^0.6.0",
|
|
33
|
+
"@omegagrid/grid-core": "^0.6.0",
|
|
34
|
+
"@omegagrid/localize": "^0.6.0",
|
|
35
35
|
"@riovir/wc-fontawesome": "^0.1.9",
|
|
36
36
|
"date-fns": "^3.2.0",
|
|
37
37
|
"lit": "^3.1.1",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"jest-environment-jsdom": "^29.7.0",
|
|
48
48
|
"ts-jest": "^29.1.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
|
-
"typescript": "5.3
|
|
50
|
+
"typescript": "5.6.3"
|
|
51
51
|
}
|
|
52
52
|
}
|