@operato/event-view 1.0.0-beta.5 → 1.0.0-beta.50

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.
@@ -0,0 +1,94 @@
1
+ import { css } from 'lit';
2
+ export const CalendarWeeklyStyles = css `
3
+ :host {
4
+ display: flex;
5
+ flex-direction: column;
6
+ color: var(--calendar-weekly-text-color, #585858);
7
+ }
8
+
9
+ [head] {
10
+ display: flex;
11
+ align-items: center;
12
+ }
13
+
14
+ [head-week] {
15
+ display: flex;
16
+ align-items: left;
17
+ }
18
+
19
+ [this-week] {
20
+ font-size: x-large;
21
+ }
22
+
23
+ [nav] {
24
+ margin-left: auto;
25
+ }
26
+
27
+ ol {
28
+ flex: 1;
29
+
30
+ display: grid;
31
+ grid-template-columns: repeat(7, 1fr);
32
+ grid-template-rows: max-content;
33
+
34
+ padding: 0;
35
+ margin: var(--calendar-weekly-ol-margin, 9px 0);
36
+ border-top: var(--calendar-weekly-ol-top-border, 3px solid #999);
37
+ }
38
+
39
+ li {
40
+ position: relative;
41
+
42
+ list-style: none;
43
+ border: var(--calendar-weekly-border, 1px solid rgba(0, 0, 0, 0.1));
44
+ border-width: var(--calendar-weekly-border-width, 0 1px 1px 0px);
45
+ opacity: var(--calendar-weekly-opacity);
46
+ }
47
+ li:nth-child(7n + 1) {
48
+ border-left-width: 1px;
49
+ }
50
+
51
+ li[day-of-week] {
52
+ opacity: 1;
53
+ background-color: var(--calendar-current-week-background-color, #fff);
54
+ padding: var(--calendar-weekly-label-padding);
55
+ color: rgba(var(--secondary-color-rgb), 0.8);
56
+ text-align: center;
57
+ }
58
+
59
+ li[current-week] {
60
+ background-color: var(--calendar-current-monthly-background-color, #fff);
61
+ opacity: 1;
62
+ }
63
+
64
+ span[date-label] {
65
+ display: block;
66
+ margin: var(--calendar-weekly-date-label-margin);
67
+ text-align: var(--calendar-weekly-label-align, center);
68
+ }
69
+
70
+ li[today] > span[date-label] {
71
+ display: inline-block;
72
+ background-color: var(--calendar-weekly-date-label-background-color, #cc3300);
73
+ padding: var(--calendar-weekly-date-label-padding);
74
+ border-radius: var(--calendar-weekly-date-label-border-radius, 50%);
75
+ color: var(--calendar-weekly-date-label-color, #fff);
76
+ min-width: 16px;
77
+ text-align: center;
78
+ }
79
+
80
+ [date] div {
81
+ display: block;
82
+ font-size: small;
83
+ }
84
+
85
+ [event] {
86
+ display: block;
87
+ background-color: var(--calendar-weekly-background-color);
88
+ border: var(--calendar-weekly-event-border);
89
+ border-width: var(--calendar-weekly-event-border-width);
90
+ margin: var(--calendar-weekly-event-margin, 0 0 4px 0);
91
+ padding: var(--calendar-weekly-event-padding, 2px 4px 2px 4px);
92
+ }
93
+ `;
94
+ //# sourceMappingURL=calendar-weekly-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-weekly-styles.js","sourceRoot":"","sources":["../../src/calendar-weekly-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FtC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const CalendarWeeklyStyles = css`\n :host {\n display: flex;\n flex-direction: column;\n color: var(--calendar-weekly-text-color, #585858);\n }\n\n [head] {\n display: flex;\n align-items: center;\n }\n\n [head-week] {\n display: flex;\n align-items: left;\n }\n\n [this-week] {\n font-size: x-large;\n }\n\n [nav] {\n margin-left: auto;\n }\n\n ol {\n flex: 1;\n\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n grid-template-rows: max-content;\n\n padding: 0;\n margin: var(--calendar-weekly-ol-margin, 9px 0);\n border-top: var(--calendar-weekly-ol-top-border, 3px solid #999);\n }\n\n li {\n position: relative;\n\n list-style: none;\n border: var(--calendar-weekly-border, 1px solid rgba(0, 0, 0, 0.1));\n border-width: var(--calendar-weekly-border-width, 0 1px 1px 0px);\n opacity: var(--calendar-weekly-opacity);\n }\n li:nth-child(7n + 1) {\n border-left-width: 1px;\n }\n\n li[day-of-week] {\n opacity: 1;\n background-color: var(--calendar-current-week-background-color, #fff);\n padding: var(--calendar-weekly-label-padding);\n color: rgba(var(--secondary-color-rgb), 0.8);\n text-align: center;\n }\n\n li[current-week] {\n background-color: var(--calendar-current-monthly-background-color, #fff);\n opacity: 1;\n }\n\n span[date-label] {\n display: block;\n margin: var(--calendar-weekly-date-label-margin);\n text-align: var(--calendar-weekly-label-align, center);\n }\n\n li[today] > span[date-label] {\n display: inline-block;\n background-color: var(--calendar-weekly-date-label-background-color, #cc3300);\n padding: var(--calendar-weekly-date-label-padding);\n border-radius: var(--calendar-weekly-date-label-border-radius, 50%);\n color: var(--calendar-weekly-date-label-color, #fff);\n min-width: 16px;\n text-align: center;\n }\n\n [date] div {\n display: block;\n font-size: small;\n }\n\n [event] {\n display: block;\n background-color: var(--calendar-weekly-background-color);\n border: var(--calendar-weekly-event-border);\n border-width: var(--calendar-weekly-event-border-width);\n margin: var(--calendar-weekly-event-margin, 0 0 4px 0);\n padding: var(--calendar-weekly-event-padding, 2px 4px 2px 4px);\n }\n`\n"]}
@@ -0,0 +1,24 @@
1
+ import { Dayjs } from 'dayjs/esm/index';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ import { BizEvent } from './biz-event';
4
+ import { EventProvider } from './event-provider';
5
+ declare type CALENDAR = {
6
+ label: string;
7
+ date: Date;
8
+ thisWeek: boolean;
9
+ today?: boolean;
10
+ }[];
11
+ export declare class CalendarWeekly extends LitElement {
12
+ static styles: import("lit").CSSResult[];
13
+ year: number;
14
+ month: number;
15
+ week: number;
16
+ eventProvider?: EventProvider;
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ updated(changes: PropertyValues<this>): void;
19
+ findEvents(date: Date): BizEvent[];
20
+ moveTo(year: number, month: number, week: number): void;
21
+ getLastDateOfWeek(year: number, week: number): Dayjs;
22
+ createDaysForCurrentWeek(year: number, week: number): CALENDAR;
23
+ }
24
+ export {};
@@ -0,0 +1,129 @@
1
+ import { __decorate } from "tslib";
2
+ import dayjs from 'dayjs/esm/index';
3
+ import weekday from 'dayjs/esm/plugin/weekday';
4
+ import weekOfYear from 'dayjs/esm/plugin/weekOfYear';
5
+ import { html, LitElement } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { CalendarWeeklyStyles } from './calendar-weekly-styles';
8
+ dayjs.extend(weekday);
9
+ dayjs.extend(weekOfYear);
10
+ const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
11
+ function isToday(date) {
12
+ const today = new Date();
13
+ return (date.getDate() == today.getDate() &&
14
+ date.getMonth() == today.getMonth() &&
15
+ date.getFullYear() == today.getFullYear());
16
+ }
17
+ let CalendarWeekly = class CalendarWeekly extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.year = dayjs().year();
21
+ this.month = dayjs().month();
22
+ this.week = dayjs().week();
23
+ }
24
+ static { this.styles = [CalendarWeeklyStyles]; }
25
+ render() {
26
+ const calendar = this.createDaysForCurrentWeek(this.year, this.week);
27
+ return html `
28
+ <div head>
29
+ <div this-week><b>${dayjs(new Date(this.year, this.month)).format('MMMM')}</b> ${this.year}</div>
30
+
31
+ <div nav>
32
+ <mwc-button
33
+ outlined
34
+ @click=${() => {
35
+ const dayJs = this.getLastDateOfWeek(this.year, this.week);
36
+ const prevWeek = dayJs.subtract(1, 'week');
37
+ this.moveTo(prevWeek.year(), prevWeek.month(), prevWeek.week());
38
+ }}
39
+ ><</mwc-button
40
+ >
41
+ <mwc-button
42
+ @click=${() => {
43
+ this.moveTo(dayjs().year(), dayjs().month(), dayjs().week());
44
+ }}
45
+ >Today</mwc-button
46
+ >
47
+ <mwc-button
48
+ @click=${() => {
49
+ const dayJs = this.getLastDateOfWeek(this.year, this.week);
50
+ const nextWeek = dayJs.add(1, 'week');
51
+ this.moveTo(nextWeek.year(), nextWeek.month(), nextWeek.week());
52
+ }}
53
+ >></mwc-button
54
+ >
55
+ </div>
56
+ </div>
57
+ <div head-week>
58
+ <div this-week><b>Week ${this.week}</b></div>
59
+ </div>
60
+
61
+ <ol>
62
+ ${calendar.map((date, index) => {
63
+ return html `
64
+ <li ?today=${date.today} day-of-week><span date-label>${date.label}(${WEEKDAYS[index]})</span></li>
65
+ `;
66
+ })}
67
+ ${calendar.map(date => {
68
+ return html `<li day-task>
69
+ <div>
70
+ ${this.findEvents(date.date).map(event => html `<span
71
+ @click=${() => event.clickEvent(event.title, event.due)}
72
+ event
73
+ .style="border-color: ${event.color};"
74
+ >${event.title}</span
75
+ >`)}
76
+ </div>
77
+ </li>`;
78
+ })}
79
+ </ol>
80
+ `;
81
+ }
82
+ updated(changes) { }
83
+ findEvents(date) {
84
+ return this.eventProvider?.fetchEventsForDate(date, {}) || [];
85
+ }
86
+ moveTo(year, month, week) {
87
+ this.year = year;
88
+ this.month = month;
89
+ this.week = week;
90
+ }
91
+ getLastDateOfWeek(year, week) {
92
+ const firstWeekLastDay = dayjs(new Date(year, 0, 1)).endOf('w');
93
+ week -= 1; // one-based week, so need the minus-one
94
+ return firstWeekLastDay.add(week, 'w');
95
+ }
96
+ createDaysForCurrentWeek(year, week) {
97
+ const lastDayjs = this.getLastDateOfWeek(year, week);
98
+ const weekDays = 7;
99
+ return [...Array(weekDays)]
100
+ .map((day, index) => {
101
+ const date = new Date(lastDayjs.year(), lastDayjs.month(), lastDayjs.date() - index);
102
+ const label = dayjs(date).format('MM-DD');
103
+ return {
104
+ date,
105
+ label,
106
+ thisWeek: true,
107
+ today: isToday(date)
108
+ };
109
+ })
110
+ .reverse();
111
+ }
112
+ };
113
+ __decorate([
114
+ property({ type: Number })
115
+ ], CalendarWeekly.prototype, "year", void 0);
116
+ __decorate([
117
+ property({ type: Number })
118
+ ], CalendarWeekly.prototype, "month", void 0);
119
+ __decorate([
120
+ property({ type: Number })
121
+ ], CalendarWeekly.prototype, "week", void 0);
122
+ __decorate([
123
+ property({ type: Array })
124
+ ], CalendarWeekly.prototype, "eventProvider", void 0);
125
+ CalendarWeekly = __decorate([
126
+ customElement('calendar-weekly')
127
+ ], CalendarWeekly);
128
+ export { CalendarWeekly };
129
+ //# sourceMappingURL=calendar-weekly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-weekly.js","sourceRoot":"","sources":["../../src/calendar-weekly.ts"],"names":[],"mappings":";AAAA,OAAO,KAAgB,MAAM,iBAAiB,CAAA;AAC9C,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAC9C,OAAO,UAAU,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAG/D,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACrB,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;AAExB,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAElE,SAAS,OAAO,CAAC,IAAU;IACzB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACxB,OAAO,CACL,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE;QACjC,IAAI,CAAC,QAAQ,EAAE,IAAI,KAAK,CAAC,QAAQ,EAAE;QACnC,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,WAAW,EAAE,CAC1C,CAAA;AACH,CAAC;AAUD,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAG8B,SAAI,GAAW,KAAK,E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Ac,CAyG1B;SAzGY,cAAc","sourcesContent":["import dayjs, { Dayjs } from 'dayjs/esm/index'\nimport weekday from 'dayjs/esm/plugin/weekday'\nimport weekOfYear from 'dayjs/esm/plugin/weekOfYear'\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { BizEvent } from './biz-event'\nimport { CalendarWeeklyStyles } from './calendar-weekly-styles'\nimport { EventProvider } from './event-provider'\n\ndayjs.extend(weekday)\ndayjs.extend(weekOfYear)\n\nconst WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n\nfunction isToday(date: Date) {\n const today = new Date()\n return (\n date.getDate() == today.getDate() &&\n date.getMonth() == today.getMonth() &&\n date.getFullYear() == today.getFullYear()\n )\n}\n\ntype CALENDAR = {\n label: string\n date: Date\n thisWeek: boolean\n today?: boolean\n}[]\n\n@customElement('calendar-weekly')\nexport class CalendarWeekly extends LitElement {\n static styles = [CalendarWeeklyStyles]\n\n @property({ type: Number }) year: number = dayjs().year()\n @property({ type: Number }) month: number = dayjs().month()\n @property({ type: Number }) week: number = dayjs().week()\n @property({ type: Array }) eventProvider?: EventProvider\n\n render() {\n const calendar = this.createDaysForCurrentWeek(this.year, this.week)\n\n return html`\n <div head>\n <div this-week><b>${dayjs(new Date(this.year, this.month)).format('MMMM')}</b> ${this.year}</div>\n\n <div nav>\n <mwc-button\n outlined\n @click=${() => {\n const dayJs = this.getLastDateOfWeek(this.year, this.week)\n const prevWeek = dayJs.subtract(1, 'week')\n this.moveTo(prevWeek.year(), prevWeek.month(), prevWeek.week())\n }}\n ><</mwc-button\n >\n <mwc-button\n @click=${() => {\n this.moveTo(dayjs().year(), dayjs().month(), dayjs().week())\n }}\n >Today</mwc-button\n >\n <mwc-button\n @click=${() => {\n const dayJs = this.getLastDateOfWeek(this.year, this.week)\n const nextWeek = dayJs.add(1, 'week')\n this.moveTo(nextWeek.year(), nextWeek.month(), nextWeek.week())\n }}\n >></mwc-button\n >\n </div>\n </div>\n <div head-week>\n <div this-week><b>Week ${this.week}</b></div>\n </div>\n\n <ol>\n ${calendar.map((date, index) => {\n return html`\n <li ?today=${date.today} day-of-week><span date-label>${date.label}(${WEEKDAYS[index]})</span></li>\n `\n })}\n ${calendar.map(date => {\n return html`<li day-task>\n <div>\n ${this.findEvents(date.date).map(\n event =>\n html`<span\n @click=${() => event.clickEvent(event.title, event.due)}\n event\n .style=\"border-color: ${event.color};\"\n >${event.title}</span\n >`\n )}\n </div>\n </li>`\n })}\n </ol>\n `\n }\n\n updated(changes: PropertyValues<this>) {}\n\n findEvents(date: Date): BizEvent[] {\n return this.eventProvider?.fetchEventsForDate(date, {}) || []\n }\n\n moveTo(year: number, month: number, week: number) {\n this.year = year\n this.month = month\n this.week = week\n }\n\n getLastDateOfWeek(year: number, week: number): Dayjs {\n const firstWeekLastDay = dayjs(new Date(year, 0, 1)).endOf('w')\n week -= 1 // one-based week, so need the minus-one\n return firstWeekLastDay.add(week, 'w')\n }\n\n createDaysForCurrentWeek(year: number, week: number): CALENDAR {\n const lastDayjs = this.getLastDateOfWeek(year, week)\n const weekDays = 7\n\n return [...Array(weekDays)]\n .map((day, index) => {\n const date = new Date(lastDayjs.year(), lastDayjs.month(), lastDayjs.date() - index)\n const label = dayjs(date).format('MM-DD')\n return {\n date,\n label,\n thisWeek: true,\n today: isToday(date)\n }\n })\n .reverse()\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  import './calendar-monthly';
2
+ import './calendar-weekly';
2
3
  import { LitElement } from 'lit';
3
4
  export declare class EventView extends LitElement {
4
5
  static styles: import("lit").CSSResult;
6
+ format: string;
5
7
  render(): import("lit-html").TemplateResult<1>;
6
8
  }
@@ -1,26 +1,36 @@
1
1
  import { __decorate } from "tslib";
2
2
  import './calendar-monthly';
3
- import { LitElement, css, html } from 'lit';
4
- import { customElement } from 'lit/decorators.js';
5
- import { SampleEventProvider } from './sample-event-provider';
3
+ import './calendar-weekly';
4
+ import { css, html, LitElement } from 'lit';
5
+ import { customElement, property } from 'lit/decorators.js';
6
+ import { SampleMonthlyEventProvider, SampleWeeklyEventProvider } from './sample-event-provider';
6
7
  let EventView = class EventView extends LitElement {
7
- render() {
8
- return html ` <calendar-monthly .eventProvider=${new SampleEventProvider()}></calendar-monthly> `;
8
+ constructor() {
9
+ super(...arguments);
10
+ this.format = 'monthly';
9
11
  }
10
- };
11
- EventView.styles = css `
12
+ static { this.styles = css `
12
13
  :host {
13
14
  display: flex;
14
15
  flex-direction: column;
15
16
  }
16
17
 
17
- calendar-monthly {
18
+ calendar-weekly {
18
19
  flex: 1;
19
20
 
20
21
  padding: 0;
21
22
  margin: 0;
22
23
  }
23
- `;
24
+ `; }
25
+ render() {
26
+ return this.format == 'weekly'
27
+ ? html ` <calendar-weekly .eventProvider=${new SampleWeeklyEventProvider()}></calendar-weekly> `
28
+ : html ` <calendar-monthly .eventProvider=${new SampleMonthlyEventProvider()}></calendar-monthly> `;
29
+ }
30
+ };
31
+ __decorate([
32
+ property({ type: String })
33
+ ], EventView.prototype, "format", void 0);
24
34
  EventView = __decorate([
25
35
  customElement('event-view')
26
36
  ], EventView);
@@ -1 +1 @@
1
- {"version":3,"file":"event-view.js","sourceRoot":"","sources":["../../src/event-view.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAY,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAG7D,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAevC,MAAM;QACJ,OAAO,IAAI,CAAA,qCAAqC,IAAI,mBAAmB,EAAE,uBAAuB,CAAA;IAClG,CAAC;CACF,CAAA;AAjBQ,gBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAYlB,CAAA;AAbU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAkBrB;SAlBY,SAAS","sourcesContent":["import './calendar-monthly'\n\nimport { LitElement, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { SampleEventProvider } from './sample-event-provider'\n\n@customElement('event-view')\nexport class EventView extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n calendar-monthly {\n flex: 1;\n\n padding: 0;\n margin: 0;\n }\n `\n\n render() {\n return html` <calendar-monthly .eventProvider=${new SampleEventProvider()}></calendar-monthly> `\n }\n}\n"]}
1
+ {"version":3,"file":"event-view.js","sourceRoot":"","sources":["../../src/event-view.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAG/F,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAAzC;;QAe8B,WAAM,GAAW,SAAS,CAAA;IAOxD,CAAC;aArBQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAYlB,CAAA;IAID,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,IAAI,QAAQ;YAC5B,CAAC,CAAC,IAAI,CAAA,oCAAoC,IAAI,yBAAyB,EAAE,sBAAsB;YAC/F,CAAC,CAAC,IAAI,CAAA,qCAAqC,IAAI,0BAA0B,EAAE,uBAAuB,CAAA;IACtG,CAAC;CACF,CAAA;AAP6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAA2B;AAf3C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAsBrB;SAtBY,SAAS","sourcesContent":["import './calendar-monthly'\nimport './calendar-weekly'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { SampleMonthlyEventProvider, SampleWeeklyEventProvider } from './sample-event-provider'\n\n@customElement('event-view')\nexport class EventView extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n calendar-weekly {\n flex: 1;\n\n padding: 0;\n margin: 0;\n }\n `\n\n @property({ type: String }) format: string = 'monthly'\n\n render() {\n return this.format == 'weekly'\n ? html` <calendar-weekly .eventProvider=${new SampleWeeklyEventProvider()}></calendar-weekly> `\n : html` <calendar-monthly .eventProvider=${new SampleMonthlyEventProvider()}></calendar-monthly> `\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { EventProvider } from './event-provider';
2
- export declare class SampleEventProvider implements EventProvider {
2
+ export declare class SampleMonthlyEventProvider implements EventProvider {
3
3
  fetchEventsForDate(date: Date, options: any): {
4
4
  due: string;
5
5
  title: string;
@@ -7,3 +7,17 @@ export declare class SampleEventProvider implements EventProvider {
7
7
  }[];
8
8
  fetchEventsForDuration(from: Date, to: Date, options: any): never[];
9
9
  }
10
+ export declare class SampleWeeklyEventProvider implements EventProvider {
11
+ fetchEventsForDate(date: Date, options: any): ({
12
+ due: string;
13
+ title: string;
14
+ color: string;
15
+ clickEvent: (title: string, due: string) => void;
16
+ } | {
17
+ due: string;
18
+ title: string;
19
+ color: string;
20
+ clickEvent?: undefined;
21
+ })[];
22
+ fetchEventsForDuration(from: Date, to: Date, options: any): never[];
23
+ }
@@ -1,4 +1,4 @@
1
- export class SampleEventProvider {
1
+ export class SampleMonthlyEventProvider {
2
2
  fetchEventsForDate(date, options) {
3
3
  return [
4
4
  {
@@ -52,4 +52,61 @@ export class SampleEventProvider {
52
52
  return [];
53
53
  }
54
54
  }
55
+ export class SampleWeeklyEventProvider {
56
+ fetchEventsForDate(date, options) {
57
+ return [
58
+ {
59
+ due: '2021-08-21',
60
+ title: 'HAHAHA',
61
+ color: 'yellow',
62
+ clickEvent: function (title, due) {
63
+ console.log('clicked...', title, due);
64
+ }
65
+ },
66
+ {
67
+ due: '2021-08-21',
68
+ title: 'HOHOHO',
69
+ color: 'lime'
70
+ },
71
+ {
72
+ due: '2021-08-21',
73
+ title: 'HIHIHI',
74
+ color: 'yellow'
75
+ },
76
+ {
77
+ due: '2021-08-21',
78
+ title: 'HEHEHE',
79
+ color: 'white'
80
+ },
81
+ {
82
+ due: '2021-08-21',
83
+ title: 'KEKEKE',
84
+ color: 'yellow'
85
+ },
86
+ {
87
+ due: '2021-08-21',
88
+ title: 'MEMEME',
89
+ color: 'orange'
90
+ },
91
+ {
92
+ due: '2021-08-21',
93
+ title: 'MOMOMO',
94
+ color: 'lime'
95
+ },
96
+ {
97
+ due: '2021-08-21',
98
+ title: 'QUOQUO',
99
+ color: 'navy'
100
+ },
101
+ {
102
+ due: '2021-08-21',
103
+ title: 'ZZXXCC',
104
+ color: 'gray'
105
+ }
106
+ ];
107
+ }
108
+ fetchEventsForDuration(from, to, options) {
109
+ return [];
110
+ }
111
+ }
55
112
  //# sourceMappingURL=sample-event-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sample-event-provider.js","sourceRoot":"","sources":["../../src/sample-event-provider.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,mBAAmB;IAC9B,kBAAkB,CAAC,IAAU,EAAE,OAAY;QACzC,OAAO;YACL;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,OAAO;aACf;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;SACF,CAAA;IACH,CAAC;IAED,sBAAsB,CAAC,IAAU,EAAE,EAAQ,EAAE,OAAY;QACvD,OAAO,EAAE,CAAA;IACX,CAAC;CACF","sourcesContent":["import { EventProvider } from './event-provider'\n\nexport class SampleEventProvider implements EventProvider {\n fetchEventsForDate(date: Date, options: any) {\n return [\n {\n due: '2021-08-21',\n title: 'HAHAHA',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'HOHOHO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'HIHIHI',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'HEHEHE',\n color: 'white'\n },\n {\n due: '2021-08-21',\n title: 'KEKEKE',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'MEMEME',\n color: 'orange'\n },\n {\n due: '2021-08-21',\n title: 'MOMOMO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'QUOQUO',\n color: 'navy'\n },\n {\n due: '2021-08-21',\n title: 'ZZXXCC',\n color: 'gray'\n }\n ]\n }\n\n fetchEventsForDuration(from: Date, to: Date, options: any) {\n return []\n }\n}\n"]}
1
+ {"version":3,"file":"sample-event-provider.js","sourceRoot":"","sources":["../../src/sample-event-provider.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,0BAA0B;IACrC,kBAAkB,CAAC,I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jB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,OAAO;aACf;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;aAChB;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;YACD;gBACE,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,MAAM;aACd;SACF,CAAA;IACH,CAAC;IAED,sBAAsB,CAAC,IAAU,EAAE,EAAQ,EAAE,OAAY;QACvD,OAAO,EAAE,CAAA;IACX,CAAC;CACF","sourcesContent":["import { EventProvider } from './event-provider'\n\nexport class SampleMonthlyEventProvider implements EventProvider {\n fetchEventsForDate(date: Date, options: any) {\n return [\n {\n due: '2021-08-21',\n title: 'HAHAHA',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'HOHOHO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'HIHIHI',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'HEHEHE',\n color: 'white'\n },\n {\n due: '2021-08-21',\n title: 'KEKEKE',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'MEMEME',\n color: 'orange'\n },\n {\n due: '2021-08-21',\n title: 'MOMOMO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'QUOQUO',\n color: 'navy'\n },\n {\n due: '2021-08-21',\n title: 'ZZXXCC',\n color: 'gray'\n }\n ]\n }\n\n fetchEventsForDuration(from: Date, to: Date, options: any) {\n return []\n }\n}\n\nexport class SampleWeeklyEventProvider implements EventProvider {\n fetchEventsForDate(date: Date, options: any) {\n return [\n {\n due: '2021-08-21',\n title: 'HAHAHA',\n color: 'yellow',\n clickEvent: function (title: string, due: string) {\n console.log('clicked...', title, due)\n }\n },\n {\n due: '2021-08-21',\n title: 'HOHOHO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'HIHIHI',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'HEHEHE',\n color: 'white'\n },\n {\n due: '2021-08-21',\n title: 'KEKEKE',\n color: 'yellow'\n },\n {\n due: '2021-08-21',\n title: 'MEMEME',\n color: 'orange'\n },\n {\n due: '2021-08-21',\n title: 'MOMOMO',\n color: 'lime'\n },\n {\n due: '2021-08-21',\n title: 'QUOQUO',\n color: 'navy'\n },\n {\n due: '2021-08-21',\n title: 'ZZXXCC',\n color: 'gray'\n }\n ]\n }\n\n fetchEventsForDuration(from: Date, to: Date, options: any) {\n return []\n }\n}\n"]}
@@ -1,17 +1,13 @@
1
- import { TemplateResult } from 'lit';
2
1
  import '../src/event-view.js';
2
+ import { TemplateResult } from 'lit';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  component: string;
6
6
  argTypes: {
7
- title: {
8
- control: string;
9
- };
10
- counter: {
11
- control: string;
12
- };
13
- textColor: {
7
+ format: {
14
8
  control: string;
9
+ options: string[];
10
+ description: string;
15
11
  };
16
12
  };
17
13
  };
@@ -22,12 +18,7 @@ interface Story<T> {
22
18
  argTypes?: Record<string, unknown>;
23
19
  }
24
20
  interface ArgTypes {
25
- title?: string;
26
- counter?: number;
27
- textColor?: string;
28
- slot?: TemplateResult;
21
+ format?: string;
29
22
  }
30
23
  export declare const Regular: Story<ArgTypes>;
31
- export declare const CustomTitle: Story<ArgTypes>;
32
- export declare const CustomCounter: Story<ArgTypes>;
33
- export declare const SlottedContent: Story<ArgTypes>;
24
+ export declare const WeeklyEventView: Story<ArgTypes>;
@@ -1,37 +1,24 @@
1
- import { html } from 'lit';
2
1
  import '../src/event-view.js';
2
+ import { html } from 'lit';
3
3
  export default {
4
4
  title: 'EventView',
5
5
  component: 'event-view',
6
6
  argTypes: {
7
- title: { control: 'text' },
8
- counter: { control: 'number' },
9
- textColor: { control: 'color' },
7
+ format: { control: 'select', options: ['monthly', 'weekly'], description: 'set event view format' }
10
8
  }
11
9
  };
12
- const Template = ({ title = 'Hello world', counter = 5, textColor, slot, }) => html `
13
- <event-view
14
- style="--event-view-text-color: ${textColor || 'black'}"
15
- .title=${title}
16
- .counter=${counter}
17
- >
18
- ${slot}
19
- </event-view>
20
- `;
10
+ const Template = ({ format = 'monthly' }) => html `
11
+ <link rel="stylesheet" href="/themes/app-theme.css" />
12
+ <link rel="stylesheet" href="/themes/calendar-theme.css" />
13
+
14
+ <event-view format=${format}> </event-view>
15
+ `;
21
16
  export const Regular = Template.bind({});
22
- export const CustomTitle = Template.bind({});
23
- CustomTitle.args = {
24
- title: 'My title',
25
- };
26
- export const CustomCounter = Template.bind({});
27
- CustomCounter.args = {
28
- counter: 123456,
29
- };
30
- export const SlottedContent = Template.bind({});
31
- SlottedContent.args = {
32
- slot: html `<p>Slotted content</p>`,
17
+ Regular.args = {
18
+ format: 'monthly'
33
19
  };
34
- SlottedContent.argTypes = {
35
- slot: { table: { disable: true } },
20
+ export const WeeklyEventView = Template.bind({});
21
+ WeeklyEventView.args = {
22
+ format: 'weekly'
36
23
  };
37
24
  //# sourceMappingURL=index.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,sBAAsB,CAAC;AAE9B,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAChC;CACF,CAAC;AAeF,MAAM,QAAQ,GAAoB,CAAC,EACjC,KAAK,GAAG,aAAa,EACrB,OAAO,GAAG,CAAC,EACX,SAAS,EACT,IAAI,GACK,EAAE,EAAE,CAAC,IAAI,CAAA;;sCAEkB,SAAS,IAAI,OAAO;aAC7C,KAAK;eACH,OAAO;;MAEhB,IAAI;;CAET,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7C,WAAW,CAAC,IAAI,GAAG;IACjB,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/C,aAAa,CAAC,IAAI,GAAG;IACnB,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChD,cAAc,CAAC,IAAI,GAAG;IACpB,IAAI,EAAE,IAAI,CAAA,wBAAwB;CACnC,CAAC;AACF,cAAc,CAAC,QAAQ,GAAG;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport '../src/event-view.js';\n\nexport default {\n title: 'EventView',\n component: 'event-view',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' },\n }\n};\n\ninterface Story<T> {\n (args: T): TemplateResult;\n args?: Partial<T>;\n argTypes?: Record<string, unknown>;\n}\n\ninterface ArgTypes {\n title?: string;\n counter?: number;\n textColor?: string;\n slot?: TemplateResult;\n}\n\nconst Template: Story<ArgTypes> = ({\n title = 'Hello world',\n counter = 5,\n textColor,\n slot,\n}: ArgTypes) => html`\n <event-view\n style=\"--event-view-text-color: ${textColor || 'black'}\"\n .title=${title}\n .counter=${counter}\n >\n ${slot}\n </event-view>\n`;\n\nexport const Regular = Template.bind({});\n\nexport const CustomTitle = Template.bind({});\nCustomTitle.args = {\n title: 'My title',\n};\n\nexport const CustomCounter = Template.bind({});\nCustomCounter.args = {\n counter: 123456,\n};\n\nexport const SlottedContent = Template.bind({});\nSlottedContent.args = {\n slot: html`<p>Slotted content</p>`,\n};\nSlottedContent.argTypes = {\n slot: { table: { disable: true } },\n};\n"]}
1
+ {"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE;KACpG;CACF,CAAA;AAYD,MAAM,QAAQ,GAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,EAAY,EAAE,EAAE,CACrE,IAAI,CAAA;;;;yBAImB,MAAM;GAC5B,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM,EAAE,SAAS;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAChD,eAAe,CAAC,IAAI,GAAG;IACrB,MAAM,EAAE,QAAQ;CACjB,CAAA","sourcesContent":["import '../src/event-view.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'EventView',\n component: 'event-view',\n argTypes: {\n format: { control: 'select', options: ['monthly', 'weekly'], description: 'set event view format' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n format?: string\n}\n\nconst Template: Story<ArgTypes> = ({ format = 'monthly' }: ArgTypes) =>\n html`\n <link rel=\"stylesheet\" href=\"/themes/app-theme.css\" />\n <link rel=\"stylesheet\" href=\"/themes/calendar-theme.css\" />\n\n <event-view format=${format}> </event-view>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {\n format: 'monthly'\n}\n\nexport const WeeklyEventView = Template.bind({})\nWeeklyEventView.args = {\n format: 'weekly'\n}\n"]}