@lemonadejs/calendar 3.0.3 → 3.1.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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Official Type definitions for the LemonadeJS plugins
3
+ * https://lemonadejs.net
4
+ * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ */
6
+ import Component from './index';
7
+ interface Calendar {
8
+ (): any
9
+ [key: string]: any
10
+ }
11
+
12
+ declare function Calendar<Calendar>(props: Component.Options): any;
13
+ export default Calendar;
package/dist/react.js CHANGED
@@ -1,31 +1,37 @@
1
- // @ts-nocheck
2
- import React, { useRef, useEffect } from "react";
3
- import Component from './index';
4
-
5
- import "./style.css";
6
- import "@lemonadejs/modal/dist/style.css"
7
-
8
- // @ts-ignore
9
- const Calendar = React.forwardRef((props, mainReference) => {
10
- // Dom element
11
- const Ref = useRef(null);
12
-
13
- // Get the properties for the spreadsheet
14
- let options = { ...props };
15
-
16
- useEffect(() => {
17
- // @ts-ignore
18
- if (! Ref.current.innerHTML) {
19
- mainReference.current = Component(Ref.current, options);
20
- }
21
- }, []);
22
-
23
- let prop = {
24
- ref: Ref,
25
- style: { height: '100%', width: '100%' }
26
- };
27
-
28
- return React.createElement("div", prop);
29
- })
30
-
31
- export default Calendar;
1
+ // @ts-nocheck
2
+ import React, { useRef, useEffect } from "react";
3
+ import Component from './index';
4
+
5
+
6
+ // @ts-ignore
7
+ export default React.forwardRef((props, mainReference) => {
8
+ // Dom element
9
+ const Ref = useRef(null);
10
+
11
+ // Get the properties for the spreadsheet
12
+ let options = { ...props };
13
+
14
+ useEffect(() => {
15
+ // @ts-ignore
16
+ if (!Ref.current.innerHTML) {
17
+ mainReference.current = Component(Ref.current, options);
18
+ }
19
+ }, []);
20
+
21
+ useEffect(() => {
22
+ for (let key in props) {
23
+ if (props.hasOwnProperty(key) && mainReference.current.hasOwnProperty(key)) {
24
+ if (props[key] !== mainReference.current[key]) {
25
+ mainReference.current[key] = props[key];
26
+ }
27
+ }
28
+ }
29
+ }, [props])
30
+
31
+ let prop = {
32
+ ref: Ref,
33
+ style: { height: '100%', width: '100%' }
34
+ };
35
+
36
+ return React.createElement("div", prop);
37
+ })
package/dist/style.css CHANGED
@@ -1,231 +1,231 @@
1
- .lm-calendar .lm-modal {
2
- min-width: initial;
3
- min-height: initial;
4
- }
5
-
6
- .lm-calendar-options {
7
- display: none;
8
- }
9
-
10
- .lm-modal .lm-calendar-options {
11
- display: flex;
12
- justify-content: space-between;
13
- border-bottom: 1px solid #ddd;
14
- }
15
-
16
- .lm-modal .lm-calendar-options button {
17
- border: 0;
18
- background-color: transparent;
19
- text-transform: uppercase;
20
- cursor: pointer;
21
- padding: 15px;
22
- font-weight: bold;
23
- }
24
-
25
- .lm-calendar-header {
26
- display: flex;
27
- flex-direction: column;
28
- }
29
-
30
- .lm-calendar-header > div:first-child {
31
- display: flex;
32
- align-items: center;
33
- padding: 10px;
34
- flex: 1;
35
- user-select: none;
36
- }
37
-
38
- .lm-calendar-header .lm-calendar-labels {
39
- display: flex;
40
- flex: 1;
41
- cursor: pointer;
42
- padding-left: 5px;
43
- }
44
-
45
- .lm-calendar-header .lm-calendar-labels > button {
46
- font-size: 1.2em;
47
- border: 0;
48
- padding: 2px;
49
- margin: 2px;
50
- background-color: #fff;
51
- }
52
-
53
- .lm-calendar-navigation button {
54
- cursor: pointer;
55
- padding: 5px;
56
- border: 0;
57
- border-radius: 24px;
58
- }
59
-
60
- .lm-calendar-navigation i:hover {
61
- background-color: #eee;
62
- }
63
-
64
- .lm-calendar-weekdays {
65
- display: none;
66
- grid-template-columns: repeat(7, 1fr);
67
- grid-gap: 2px;
68
- padding: 0 10px 0 10px;
69
- font-size: 0.8em;
70
- }
71
-
72
- .lm-calendar-container[data-view="days"] .lm-calendar-weekdays {
73
- display: grid;
74
- }
75
-
76
- .lm-calendar-weekdays > div {
77
- display: inline-block;
78
- padding: 10px;
79
- box-sizing: border-box;
80
- text-align: center;
81
- font-weight: bold;
82
- }
83
-
84
- .lm-calendar-content {
85
- display: grid;
86
- grid-template-columns: repeat(7, 1fr);
87
- grid-gap: 0;
88
- padding: 8px;
89
- font-size: 0.8em;
90
- outline: none;
91
- }
92
-
93
- .lm-calendar-content > div {
94
- box-sizing: border-box;
95
- text-align: center;
96
- aspect-ratio: 1 / 1;
97
- display: flex;
98
- flex-direction: column;
99
- justify-content: center;
100
- align-items: center;
101
- padding: 10px;
102
- cursor: pointer;
103
- border-radius: 100px;
104
- background-origin: padding-box;
105
- }
106
-
107
- .lm-calendar-container[data-view="months"] .lm-calendar-content {
108
- grid-template-columns: repeat(4, 1fr);
109
- }
110
- .lm-calendar-container[data-view="years"] .lm-calendar-content {
111
- grid-template-columns: repeat(4, 1fr);
112
- }
113
-
114
- .lm-calendar-content > div[data-grey="true"] {
115
- color: #ccc;
116
- }
117
-
118
- .lm-calendar-content > div[data-bold="true"] {
119
- font-weight: bold;
120
- }
121
-
122
- .lm-calendar-content > div[data-event="true"]::before {
123
- content: '';
124
- position: absolute;
125
- margin-top: 22px;
126
- width: 3px;
127
- height: 3px;
128
- border-radius: 3px;
129
- background-color: red;
130
- }
131
-
132
- .lm-calendar-content > div[data-selected="true"] {
133
- font-weight: bold;
134
- background-color: #eee;
135
- }
136
-
137
- .lm-calendar-content:focus > div[data-selected="true"] {
138
- outline: 2px solid black;
139
- outline-offset: -2px;
140
- }
141
-
142
- .lm-calendar-content > div:hover {
143
- background-color: #eee;
144
- }
145
-
146
- .lm-calendar-content > div[data-range="true"] {
147
- position: relative;
148
- }
149
-
150
- .lm-calendar-content > div[data-start="true"],
151
- .lm-calendar-content > div[data-end="true"] {
152
- background-color: #78D350;
153
- }
154
-
155
- .lm-calendar-content > div[data-range="true"]::before {
156
- content: "";
157
- position: absolute;
158
- left: 0;
159
- right: 0;
160
- top: 8px;
161
- bottom: 8px;
162
- background-color: #78D35050;
163
- }
164
-
165
- .lm-calendar-content > div[data-start="true"]::before {
166
- left: 32px;
167
- }
168
-
169
- .lm-calendar-content > div[data-end="true"]::before {
170
- right: 32px;
171
- }
172
-
173
- .lm-calendar-footer > div {
174
- flex: 1;
175
- }
176
-
177
- .lm-calendar-footer {
178
- display: flex;
179
- margin: 0 10px 0 10px;
180
- padding: 8px 0 8px 0;
181
- line-height: 34px;
182
- border-top: 1px solid #eee;
183
- }
184
-
185
- .lm-calendar-footer select {
186
- border: 0;
187
- background-color: transparent;
188
- padding: 6px;
189
- -moz-appearance: none;
190
- -webkit-appearance: none;
191
- margin: 2px;
192
- border-radius: 32px;
193
- font-size: 1.1em;
194
- }
195
-
196
- .lm-calendar-footer select:focus {
197
- background-color: #eee;
198
- }
199
-
200
- .lm-calendar-footer select:hover {
201
- background-color: #eee;
202
- }
203
-
204
- .lm-calendar-footer input {
205
- border: transparent;
206
- padding: 8px;
207
- background-color: #eee;
208
- width: 100%;
209
- cursor: pointer;
210
- }
211
-
212
- .lm-calendar-input {
213
- padding-right: 24px !important;
214
- box-sizing: border-box;
215
- background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Zm280 240q-17 0-28.5-11.5T440-440q0-17 11.5-28.5T480-480q17 0 28.5 11.5T520-440q0 17-11.5 28.5T480-400Zm-160 0q-17 0-28.5-11.5T280-440q0-17 11.5-28.5T320-480q17 0 28.5 11.5T360-440q0 17-11.5 28.5T320-400Zm320 0q-17 0-28.5-11.5T600-440q0-17 11.5-28.5T640-480q17 0 28.5 11.5T680-440q0 17-11.5 28.5T640-400ZM480-240q-17 0-28.5-11.5T440-280q0-17 11.5-28.5T480-320q17 0 28.5 11.5T520-280q0 17-11.5 28.5T480-240Zm-160 0q-17 0-28.5-11.5T280-280q0-17 11.5-28.5T320-320q17 0 28.5 11.5T360-280q0 17-11.5 28.5T320-240Zm320 0q-17 0-28.5-11.5T600-280q0-17 11.5-28.5T640-320q17 0 28.5 11.5T680-280q0 17-11.5 28.5T640-240Z"/></svg>') top 50% right 0 no-repeat, content-box;
216
- }
217
-
218
- .ripple {
219
- background-position: center;
220
- transition: background 0.8s;
221
- }
222
-
223
- .ripple:hover {
224
- background: #E0E0E0 radial-gradient(circle, transparent 1%, #E0E0E0 1%) center/15000%;
225
- }
226
-
227
- .ripple:active {
228
- background-color: #E0E0E0;
229
- background-size: 100%;
230
- transition: background 0s;
1
+ .lm-calendar .lm-modal {
2
+ min-width: initial;
3
+ min-height: initial;
4
+ }
5
+
6
+ .lm-calendar-options {
7
+ display: none;
8
+ }
9
+
10
+ .lm-modal > div > .lm-calendar-options {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ border-bottom: 1px solid #ddd;
14
+ }
15
+
16
+ .lm-modal > div > .lm-calendar-options button {
17
+ border: 0;
18
+ background-color: transparent;
19
+ text-transform: uppercase;
20
+ cursor: pointer;
21
+ padding: 15px;
22
+ font-weight: bold;
23
+ }
24
+
25
+ .lm-calendar-header {
26
+ display: flex;
27
+ flex-direction: column;
28
+ }
29
+
30
+ .lm-calendar-header > div:first-child {
31
+ display: flex;
32
+ align-items: center;
33
+ padding: 10px;
34
+ flex: 1;
35
+ user-select: none;
36
+ }
37
+
38
+ .lm-calendar-header .lm-calendar-labels {
39
+ display: flex;
40
+ flex: 1;
41
+ cursor: pointer;
42
+ padding-left: 5px;
43
+ }
44
+
45
+ .lm-calendar-header .lm-calendar-labels > button {
46
+ font-size: 1.2em;
47
+ border: 0;
48
+ padding: 2px;
49
+ margin: 2px;
50
+ background-color: #fff;
51
+ }
52
+
53
+ .lm-calendar-navigation button {
54
+ cursor: pointer;
55
+ padding: 5px;
56
+ border: 0;
57
+ border-radius: 24px;
58
+ }
59
+
60
+ .lm-calendar-navigation i:hover {
61
+ background-color: #eee;
62
+ }
63
+
64
+ .lm-calendar-weekdays {
65
+ display: none;
66
+ grid-template-columns: repeat(7, 1fr);
67
+ grid-gap: 2px;
68
+ padding: 0 10px 0 10px;
69
+ font-size: 0.8em;
70
+ }
71
+
72
+ .lm-calendar-container[data-view="days"] .lm-calendar-weekdays {
73
+ display: grid;
74
+ }
75
+
76
+ .lm-calendar-weekdays > div {
77
+ display: inline-block;
78
+ padding: 10px;
79
+ box-sizing: border-box;
80
+ text-align: center;
81
+ font-weight: bold;
82
+ }
83
+
84
+ .lm-calendar-content {
85
+ display: grid;
86
+ grid-template-columns: repeat(7, 1fr);
87
+ grid-gap: 0;
88
+ padding: 8px;
89
+ font-size: 0.8em;
90
+ outline: none;
91
+ }
92
+
93
+ .lm-calendar-content > div {
94
+ box-sizing: border-box;
95
+ text-align: center;
96
+ aspect-ratio: 1 / 1;
97
+ display: flex;
98
+ flex-direction: column;
99
+ justify-content: center;
100
+ align-items: center;
101
+ padding: 10px;
102
+ cursor: pointer;
103
+ border-radius: 100px;
104
+ background-origin: padding-box;
105
+ }
106
+
107
+ .lm-calendar-container[data-view="months"] .lm-calendar-content {
108
+ grid-template-columns: repeat(4, 1fr);
109
+ }
110
+ .lm-calendar-container[data-view="years"] .lm-calendar-content {
111
+ grid-template-columns: repeat(4, 1fr);
112
+ }
113
+
114
+ .lm-calendar-content > div[data-grey="true"] {
115
+ color: #ccc;
116
+ }
117
+
118
+ .lm-calendar-content > div[data-bold="true"] {
119
+ font-weight: bold;
120
+ }
121
+
122
+ .lm-calendar-content > div[data-event="true"]::before {
123
+ content: '';
124
+ position: absolute;
125
+ margin-top: 22px;
126
+ width: 3px;
127
+ height: 3px;
128
+ border-radius: 3px;
129
+ background-color: red;
130
+ }
131
+
132
+ .lm-calendar-content > div[data-selected="true"] {
133
+ font-weight: bold;
134
+ background-color: #eee;
135
+ }
136
+
137
+ .lm-calendar-content:focus > div[data-selected="true"] {
138
+ outline: 2px solid black;
139
+ outline-offset: -2px;
140
+ }
141
+
142
+ .lm-calendar-content > div:hover {
143
+ background-color: #eee;
144
+ }
145
+
146
+ .lm-calendar-content > div[data-range="true"] {
147
+ position: relative;
148
+ }
149
+
150
+ .lm-calendar-content > div[data-start="true"],
151
+ .lm-calendar-content > div[data-end="true"] {
152
+ background-color: #78D350;
153
+ }
154
+
155
+ .lm-calendar-content > div[data-range="true"]::before {
156
+ content: "";
157
+ position: absolute;
158
+ left: 0;
159
+ right: 0;
160
+ top: 8px;
161
+ bottom: 8px;
162
+ background-color: #78D35050;
163
+ }
164
+
165
+ .lm-calendar-content > div[data-start="true"]::before {
166
+ left: 32px;
167
+ }
168
+
169
+ .lm-calendar-content > div[data-end="true"]::before {
170
+ right: 32px;
171
+ }
172
+
173
+ .lm-calendar-footer > div {
174
+ flex: 1;
175
+ }
176
+
177
+ .lm-calendar-footer {
178
+ display: flex;
179
+ margin: 0 10px 0 10px;
180
+ padding: 8px 0 8px 0;
181
+ line-height: 34px;
182
+ border-top: 1px solid #eee;
183
+ }
184
+
185
+ .lm-calendar-footer select {
186
+ border: 0;
187
+ background-color: transparent;
188
+ padding: 6px;
189
+ -moz-appearance: none;
190
+ -webkit-appearance: none;
191
+ margin: 2px;
192
+ border-radius: 32px;
193
+ font-size: 1.1em;
194
+ }
195
+
196
+ .lm-calendar-footer select:focus {
197
+ background-color: #eee;
198
+ }
199
+
200
+ .lm-calendar-footer select:hover {
201
+ background-color: #eee;
202
+ }
203
+
204
+ .lm-calendar-footer input {
205
+ border: transparent;
206
+ padding: 8px;
207
+ background-color: #eee;
208
+ width: 100%;
209
+ cursor: pointer;
210
+ }
211
+
212
+ .lm-calendar-input {
213
+ padding-right: 24px !important;
214
+ box-sizing: border-box;
215
+ background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Zm280 240q-17 0-28.5-11.5T440-440q0-17 11.5-28.5T480-480q17 0 28.5 11.5T520-440q0 17-11.5 28.5T480-400Zm-160 0q-17 0-28.5-11.5T280-440q0-17 11.5-28.5T320-480q17 0 28.5 11.5T360-440q0 17-11.5 28.5T320-400Zm320 0q-17 0-28.5-11.5T600-440q0-17 11.5-28.5T640-480q17 0 28.5 11.5T680-440q0 17-11.5 28.5T640-400ZM480-240q-17 0-28.5-11.5T440-280q0-17 11.5-28.5T480-320q17 0 28.5 11.5T520-280q0 17-11.5 28.5T480-240Zm-160 0q-17 0-28.5-11.5T280-280q0-17 11.5-28.5T320-320q17 0 28.5 11.5T360-280q0 17-11.5 28.5T320-240Zm320 0q-17 0-28.5-11.5T600-280q0-17 11.5-28.5T640-320q17 0 28.5 11.5T680-280q0 17-11.5 28.5T640-240Z"/></svg>') top 50% right 0 no-repeat, content-box;
216
+ }
217
+
218
+ .ripple {
219
+ background-position: center;
220
+ transition: background 0.8s;
221
+ }
222
+
223
+ .ripple:hover {
224
+ background: #E0E0E0 radial-gradient(circle, transparent 1%, #E0E0E0 1%) center/15000%;
225
+ }
226
+
227
+ .ripple:active {
228
+ background-color: #E0E0E0;
229
+ background-size: 100%;
230
+ transition: background 0s;
231
231
  }
package/dist/vue.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Official Type definitions for the LemonadeJS plugins
3
+ * https://lemonadejs.net
4
+ * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ */
6
+ import Component from './index';
7
+
8
+ interface Calendar {
9
+ (): any
10
+ [key: string]: any
11
+ }
12
+
13
+ declare function Calendar<Calendar>(props: Component.Options): any;
14
+
15
+ export default Calendar;
package/dist/vue.js CHANGED
@@ -1,32 +1,45 @@
1
- import { h, getCurrentInstance } from 'vue';
2
- import component from "./index";
3
-
4
- import "./style.css";
5
- import "@lemonadejs/modal/dist/style.css"
6
-
7
- export const Calendar = {
8
- inheritAttrs: false,
9
- mounted() {
10
- const { attrs } = getCurrentInstance();
11
-
12
- let options = {
13
- ...attrs
14
- };
15
-
16
- this.el = this.$refs.container;
17
-
18
- this.current = component(this.$refs.container, options);
19
- },
20
- setup() {
21
- let containerProps = {
22
- ref: 'container',
23
- style: {
24
- width: '100%',
25
- height: '100%',
26
- }
27
- };
28
- return () => h('div', containerProps);
29
- }
30
- }
31
-
32
- export default Calendar;
1
+ import { h } from 'vue';
2
+ import component from "./index";
3
+
4
+
5
+ export default {
6
+ inheritAttrs: false,
7
+ mounted() {
8
+ let options = {
9
+ ...this.$attrs
10
+ };
11
+
12
+ this.el = this.$refs.container;
13
+
14
+ this.current = component(this.$refs.container, options);
15
+ },
16
+ setup() {
17
+ let containerProps = {
18
+ ref: 'container',
19
+ style: {
20
+ width: '100%',
21
+ height: '100%',
22
+ }
23
+ };
24
+ return () => h('div', containerProps);
25
+ },
26
+ watch: {
27
+ $attrs: {
28
+ deep: true,
29
+ handler() {
30
+ this.updateState();
31
+ }
32
+ }
33
+ },
34
+ methods: {
35
+ updateState() {
36
+ for (let key in this.$attrs) {
37
+ if (this.$attrs.hasOwnProperty(key) && this.current.hasOwnProperty(key)) {
38
+ if (this.$attrs[key] !== this.current[key]) {
39
+ this.current[key] = this.$attrs[key];
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }