@seafile/seafile-calendar 1.0.14-ahn.1 → 1.0.14-ahn.2
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/assets/index.css +13 -7
- package/es/calendar/CalendarRightPanel.js +15 -10
- package/lib/calendar/CalendarRightPanel.js +15 -10
- package/package.json +1 -1
package/assets/index.css
CHANGED
|
@@ -551,24 +551,30 @@
|
|
|
551
551
|
-ms-flex: 0 0 64px;
|
|
552
552
|
flex: 0 0 64px;
|
|
553
553
|
width: 64px;
|
|
554
|
+
overflow: hidden;
|
|
555
|
+
}
|
|
556
|
+
.rc-calendar-right-panel-col-hour {
|
|
557
|
+
-ms-flex-preferred-size: 65px;
|
|
558
|
+
flex-basis: 65px;
|
|
559
|
+
width: 65px;
|
|
560
|
+
border-right: 1px solid #eee;
|
|
561
|
+
}
|
|
562
|
+
.rc-calendar-right-panel-col-item {
|
|
563
|
+
width: calc(120%);
|
|
564
|
+
height: 100%;
|
|
554
565
|
overflow-y: auto;
|
|
555
566
|
overflow-x: hidden;
|
|
556
567
|
scrollbar-width: none;
|
|
557
568
|
-ms-overflow-style: none;
|
|
558
569
|
-webkit-overflow-scrolling: touch;
|
|
559
570
|
}
|
|
560
|
-
.rc-calendar-right-panel-col::-webkit-scrollbar {
|
|
571
|
+
.rc-calendar-right-panel-col-item::-webkit-scrollbar {
|
|
561
572
|
display: none;
|
|
562
573
|
width: 0;
|
|
563
574
|
height: 0;
|
|
564
575
|
}
|
|
565
|
-
.rc-calendar-right-panel-col-hour {
|
|
566
|
-
border-right: 1px solid #eee;
|
|
567
|
-
}
|
|
568
|
-
.rc-calendar-right-panel-col-item {
|
|
569
|
-
overflow-y: auto;
|
|
570
|
-
}
|
|
571
576
|
.rc-calendar-right-panel-col ul {
|
|
577
|
+
width: 64px;
|
|
572
578
|
list-style: none;
|
|
573
579
|
margin: 0;
|
|
574
580
|
padding: 4px 16px 12px 16px;
|
|
@@ -15,13 +15,18 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
15
15
|
|
|
16
16
|
_this.centerScroll = function (container, index) {
|
|
17
17
|
if (!container || index < 0) return;
|
|
18
|
-
var
|
|
18
|
+
var items = container.querySelectorAll('li');
|
|
19
|
+
var firstItem = items[0];
|
|
20
|
+
var secondItem = items[1];
|
|
19
21
|
var itemHeight = firstItem && firstItem.offsetHeight || 32;
|
|
20
|
-
var
|
|
21
|
-
var maxScroll = Math.max(0, container.scrollHeight -
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
var itemStep = secondItem ? secondItem.offsetTop - firstItem.offsetTop : itemHeight;
|
|
23
|
+
var maxScroll = Math.max(0, container.scrollHeight - container.clientHeight);
|
|
24
|
+
var rowsBeforeSelected = 3;
|
|
25
|
+
var target = Math.max(0, (index - rowsBeforeSelected) * itemStep);
|
|
26
|
+
|
|
27
|
+
if (target > maxScroll) {
|
|
28
|
+
target = Math.floor(maxScroll / itemStep) * itemStep;
|
|
29
|
+
}
|
|
25
30
|
container.scrollTop = target;
|
|
26
31
|
};
|
|
27
32
|
|
|
@@ -192,10 +197,10 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
192
197
|
{ className: prefixCls + '-right-panel-body' },
|
|
193
198
|
React.createElement(
|
|
194
199
|
'div',
|
|
195
|
-
{ className: prefixCls + '-right-panel-col ' + prefixCls + '-right-panel-col-hour'
|
|
200
|
+
{ className: prefixCls + '-right-panel-col ' + prefixCls + '-right-panel-col-hour' },
|
|
196
201
|
React.createElement(
|
|
197
202
|
'div',
|
|
198
|
-
{ className: prefixCls + '-right-panel-col-item' },
|
|
203
|
+
{ className: prefixCls + '-right-panel-col-item', ref: this.hoursRef },
|
|
199
204
|
React.createElement(
|
|
200
205
|
'ul',
|
|
201
206
|
null,
|
|
@@ -225,10 +230,10 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
225
230
|
),
|
|
226
231
|
React.createElement(
|
|
227
232
|
'div',
|
|
228
|
-
{ className: prefixCls + '-right-panel-col'
|
|
233
|
+
{ className: prefixCls + '-right-panel-col' },
|
|
229
234
|
React.createElement(
|
|
230
235
|
'div',
|
|
231
|
-
{ className: prefixCls + '-right-panel-col-item' },
|
|
236
|
+
{ className: prefixCls + '-right-panel-col-item', ref: this.minutesRef },
|
|
232
237
|
React.createElement(
|
|
233
238
|
'ul',
|
|
234
239
|
null,
|
|
@@ -38,13 +38,18 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
38
38
|
|
|
39
39
|
_this.centerScroll = function (container, index) {
|
|
40
40
|
if (!container || index < 0) return;
|
|
41
|
-
var
|
|
41
|
+
var items = container.querySelectorAll('li');
|
|
42
|
+
var firstItem = items[0];
|
|
43
|
+
var secondItem = items[1];
|
|
42
44
|
var itemHeight = firstItem && firstItem.offsetHeight || 32;
|
|
43
|
-
var
|
|
44
|
-
var maxScroll = Math.max(0, container.scrollHeight -
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
var itemStep = secondItem ? secondItem.offsetTop - firstItem.offsetTop : itemHeight;
|
|
46
|
+
var maxScroll = Math.max(0, container.scrollHeight - container.clientHeight);
|
|
47
|
+
var rowsBeforeSelected = 3;
|
|
48
|
+
var target = Math.max(0, (index - rowsBeforeSelected) * itemStep);
|
|
49
|
+
|
|
50
|
+
if (target > maxScroll) {
|
|
51
|
+
target = Math.floor(maxScroll / itemStep) * itemStep;
|
|
52
|
+
}
|
|
48
53
|
container.scrollTop = target;
|
|
49
54
|
};
|
|
50
55
|
|
|
@@ -215,10 +220,10 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
215
220
|
{ className: prefixCls + '-right-panel-body' },
|
|
216
221
|
_react2['default'].createElement(
|
|
217
222
|
'div',
|
|
218
|
-
{ className: prefixCls + '-right-panel-col ' + prefixCls + '-right-panel-col-hour'
|
|
223
|
+
{ className: prefixCls + '-right-panel-col ' + prefixCls + '-right-panel-col-hour' },
|
|
219
224
|
_react2['default'].createElement(
|
|
220
225
|
'div',
|
|
221
|
-
{ className: prefixCls + '-right-panel-col-item' },
|
|
226
|
+
{ className: prefixCls + '-right-panel-col-item', ref: this.hoursRef },
|
|
222
227
|
_react2['default'].createElement(
|
|
223
228
|
'ul',
|
|
224
229
|
null,
|
|
@@ -248,10 +253,10 @@ var CalendarRightPanel = function (_React$Component) {
|
|
|
248
253
|
),
|
|
249
254
|
_react2['default'].createElement(
|
|
250
255
|
'div',
|
|
251
|
-
{ className: prefixCls + '-right-panel-col'
|
|
256
|
+
{ className: prefixCls + '-right-panel-col' },
|
|
252
257
|
_react2['default'].createElement(
|
|
253
258
|
'div',
|
|
254
|
-
{ className: prefixCls + '-right-panel-col-item' },
|
|
259
|
+
{ className: prefixCls + '-right-panel-col-item', ref: this.minutesRef },
|
|
255
260
|
_react2['default'].createElement(
|
|
256
261
|
'ul',
|
|
257
262
|
null,
|