@operato/event-view 1.2.21 → 1.2.22

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/src/calendar-monthly-styles.js +6 -1
  3. package/dist/src/calendar-monthly-styles.js.map +1 -1
  4. package/dist/src/calendar-monthly.d.ts +1 -10
  5. package/dist/src/calendar-monthly.js +5 -17
  6. package/dist/src/calendar-monthly.js.map +1 -1
  7. package/dist/src/calendar-weekly-styles.js +2 -2
  8. package/dist/src/calendar-weekly-styles.js.map +1 -1
  9. package/dist/src/calendar-weekly.d.ts +1 -10
  10. package/dist/src/calendar-weekly.js +3 -21
  11. package/dist/src/calendar-weekly.js.map +1 -1
  12. package/dist/src/common.d.ts +15 -0
  13. package/dist/src/common.js +13 -0
  14. package/dist/src/common.js.map +1 -0
  15. package/dist/src/event-provider.d.ts +2 -3
  16. package/dist/src/event-provider.js.map +1 -1
  17. package/dist/src/index.d.ts +2 -1
  18. package/dist/src/index.js +2 -1
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/ox-event-view.d.ts +2 -0
  21. package/dist/src/ox-event-view.js +5 -3
  22. package/dist/src/ox-event-view.js.map +1 -1
  23. package/dist/src/sample-event-provider.d.ts +3 -2
  24. package/dist/src/sample-event-provider.js +100 -4
  25. package/dist/src/sample-event-provider.js.map +1 -1
  26. package/dist/src/types.d.ts +20 -0
  27. package/dist/src/types.js +13 -0
  28. package/dist/src/types.js.map +1 -0
  29. package/dist/stories/index.stories.js +54 -1
  30. package/dist/stories/index.stories.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +6 -2
  33. package/src/calendar-monthly-styles.ts +6 -1
  34. package/src/calendar-monthly.ts +7 -33
  35. package/src/calendar-weekly-styles.ts +2 -2
  36. package/src/calendar-weekly.ts +5 -38
  37. package/src/index.ts +2 -1
  38. package/src/ox-event-view.ts +4 -3
  39. package/src/types.ts +38 -0
  40. package/stories/index.stories.ts +60 -2
  41. package/themes/calendar-theme.css +1 -2
  42. package/src/biz-event.ts +0 -6
  43. package/src/event-provider.ts +0 -6
  44. package/src/sample-event-provider.ts +0 -116
@@ -1,6 +1,64 @@
1
1
  import '../src/ox-event-view.js'
2
-
3
2
  import { html, TemplateResult } from 'lit'
3
+ import { BizEvent, CALENDAR, EventProvider } from '../src/types.js'
4
+
5
+ class SampleEventProvider implements EventProvider {
6
+ fetchEventsForCalendar(calendar: CALENDAR) {
7
+ const map = new Map<Date, BizEvent[]>()
8
+
9
+ calendar.forEach(({ date }) =>
10
+ map.set(date, [
11
+ {
12
+ due: '2021-08-21',
13
+ title: 'HAHAHA',
14
+ color: 'yellow'
15
+ },
16
+ {
17
+ due: '2021-08-21',
18
+ title: 'HOHOHO',
19
+ color: 'lime'
20
+ },
21
+ {
22
+ due: '2021-08-21',
23
+ title: 'HIHIHI',
24
+ color: 'yellow'
25
+ },
26
+ {
27
+ due: '2021-08-21',
28
+ title: 'HEHEHE',
29
+ color: 'white'
30
+ },
31
+ {
32
+ due: '2021-08-21',
33
+ title: 'KEKEKE',
34
+ color: 'yellow'
35
+ },
36
+ {
37
+ due: '2021-08-21',
38
+ title: 'MEMEME',
39
+ color: 'orange'
40
+ },
41
+ {
42
+ due: '2021-08-21',
43
+ title: 'MOMOMO',
44
+ color: 'lime'
45
+ },
46
+ {
47
+ due: '2021-08-21',
48
+ title: 'QUOQUO',
49
+ color: 'navy'
50
+ },
51
+ {
52
+ due: '2021-08-21',
53
+ title: 'ZZXXCC',
54
+ color: 'gray'
55
+ }
56
+ ])
57
+ )
58
+
59
+ return map
60
+ }
61
+ }
4
62
 
5
63
  export default {
6
64
  title: 'EventView',
@@ -26,7 +84,7 @@ const Template: Story<ArgTypes> = ({ mode = 'monthly' }: ArgTypes) =>
26
84
  <link rel="stylesheet" href="/themes/calendar-theme.css" />
27
85
  <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
28
86
 
29
- <ox-event-view mode=${mode}> </ox-event-view>
87
+ <ox-event-view mode=${mode} .eventProvider=${new SampleEventProvider()}> </ox-event-view>
30
88
  `
31
89
 
32
90
  export const Regular = Template.bind({})
@@ -36,7 +36,7 @@ body {
36
36
  --calendar-weekly-opacity: 0.5;
37
37
  --calendar-weekly-date-label-background-color: var(--status-danger-color);
38
38
  --calendar-weekly-date-label-margin: var(--margin-narrow);
39
- --calendar-weekly-date-label-padding: 5px var(--padding-narrow);
39
+ --calendar-weekly-date-label-padding: 3px var(--padding-narrow);
40
40
  --calendar-weekly-date-label-color: var(--theme-white-color);
41
41
 
42
42
  --calendar-weekly-background-color: #f4f4f4;
@@ -45,7 +45,6 @@ body {
45
45
  --calendar-weekly-event-padding: 2px var(--padding-default);
46
46
  --calendar-weekly-event-border: 3px solid #ccc;
47
47
  --calendar-weekly-event-border-width: 0 0 0 3px;
48
-
49
48
  }
50
49
 
51
50
  @media only screen and (max-width: 460px) {
package/src/biz-event.ts DELETED
@@ -1,6 +0,0 @@
1
- export type BizEvent = {
2
- due?: string
3
- title: string
4
- color: string
5
- clickEvent?: any
6
- }
@@ -1,6 +0,0 @@
1
- import { BizEvent } from './biz-event'
2
-
3
- export interface EventProvider {
4
- fetchEventsForDate(date: Date, optins: any): BizEvent[]
5
- fetchEventsForDuration(from: Date, to: Date, optins: any): BizEvent[]
6
- }
@@ -1,116 +0,0 @@
1
- import { EventProvider } from './event-provider'
2
-
3
- export class SampleMonthlyEventProvider implements EventProvider {
4
- fetchEventsForDate(date: Date, options: any) {
5
- return [
6
- {
7
- due: '2021-08-21',
8
- title: 'HAHAHA',
9
- color: 'yellow'
10
- },
11
- {
12
- due: '2021-08-21',
13
- title: 'HOHOHO',
14
- color: 'lime'
15
- },
16
- {
17
- due: '2021-08-21',
18
- title: 'HIHIHI',
19
- color: 'yellow'
20
- },
21
- {
22
- due: '2021-08-21',
23
- title: 'HEHEHE',
24
- color: 'white'
25
- },
26
- {
27
- due: '2021-08-21',
28
- title: 'KEKEKE',
29
- color: 'yellow'
30
- },
31
- {
32
- due: '2021-08-21',
33
- title: 'MEMEME',
34
- color: 'orange'
35
- },
36
- {
37
- due: '2021-08-21',
38
- title: 'MOMOMO',
39
- color: 'lime'
40
- },
41
- {
42
- due: '2021-08-21',
43
- title: 'QUOQUO',
44
- color: 'navy'
45
- },
46
- {
47
- due: '2021-08-21',
48
- title: 'ZZXXCC',
49
- color: 'gray'
50
- }
51
- ]
52
- }
53
-
54
- fetchEventsForDuration(from: Date, to: Date, options: any) {
55
- return []
56
- }
57
- }
58
-
59
- export class SampleWeeklyEventProvider implements EventProvider {
60
- fetchEventsForDate(date: Date, options: any) {
61
- return [
62
- {
63
- due: '2021-08-21',
64
- title: 'HAHAHA',
65
- color: 'yellow',
66
- clickEvent: function (title: string, due: string) {
67
- console.log('clicked...', title, due)
68
- }
69
- },
70
- {
71
- due: '2021-08-21',
72
- title: 'HOHOHO',
73
- color: 'lime'
74
- },
75
- {
76
- due: '2021-08-21',
77
- title: 'HIHIHI',
78
- color: 'yellow'
79
- },
80
- {
81
- due: '2021-08-21',
82
- title: 'HEHEHE',
83
- color: 'white'
84
- },
85
- {
86
- due: '2021-08-21',
87
- title: 'KEKEKE',
88
- color: 'yellow'
89
- },
90
- {
91
- due: '2021-08-21',
92
- title: 'MEMEME',
93
- color: 'orange'
94
- },
95
- {
96
- due: '2021-08-21',
97
- title: 'MOMOMO',
98
- color: 'lime'
99
- },
100
- {
101
- due: '2021-08-21',
102
- title: 'QUOQUO',
103
- color: 'navy'
104
- },
105
- {
106
- due: '2021-08-21',
107
- title: 'ZZXXCC',
108
- color: 'gray'
109
- }
110
- ]
111
- }
112
-
113
- fetchEventsForDuration(from: Date, to: Date, options: any) {
114
- return []
115
- }
116
- }