@kne/react-calendar 1.1.0 → 1.1.1
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/index.css +111 -3
- package/dist/index.css.map +1 -1
- package/dist/index.js +232 -261
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +38 -34
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -196,12 +196,11 @@ const dedupeEventsById = events => {
|
|
|
196
196
|
});
|
|
197
197
|
return [...map.values()];
|
|
198
198
|
};
|
|
199
|
-
const useControlledState =
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
} = _ref;
|
|
199
|
+
const useControlledState = ({
|
|
200
|
+
value,
|
|
201
|
+
defaultValue,
|
|
202
|
+
onChange
|
|
203
|
+
}) => {
|
|
205
204
|
const props = {};
|
|
206
205
|
if (typeof value !== 'undefined') {
|
|
207
206
|
props.value = value;
|
|
@@ -233,15 +232,14 @@ const getRuleDisabled = (result, defaultReason) => {
|
|
|
233
232
|
}
|
|
234
233
|
return null;
|
|
235
234
|
};
|
|
236
|
-
const checkRule =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
} = _ref;
|
|
235
|
+
const checkRule = ({
|
|
236
|
+
date,
|
|
237
|
+
slot,
|
|
238
|
+
mode,
|
|
239
|
+
disabledDate,
|
|
240
|
+
disabledDateTime,
|
|
241
|
+
availableDateTime
|
|
242
|
+
}) => {
|
|
245
243
|
if (disabledDate?.(date.toDate())) {
|
|
246
244
|
return {
|
|
247
245
|
disabled: true
|
|
@@ -309,18 +307,17 @@ const getOverlappingEvents = (slotStart, slotEnd, sortedEvents) => {
|
|
|
309
307
|
}
|
|
310
308
|
return matched;
|
|
311
309
|
};
|
|
312
|
-
const generateTimeSlots =
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
} = _ref;
|
|
310
|
+
const generateTimeSlots = ({
|
|
311
|
+
date,
|
|
312
|
+
events,
|
|
313
|
+
timeUnit = 30,
|
|
314
|
+
dayStart = '09:00',
|
|
315
|
+
dayEnd = '18:00',
|
|
316
|
+
disabledDate,
|
|
317
|
+
disabledDateTime,
|
|
318
|
+
availableDateTime,
|
|
319
|
+
mode = 'schedule'
|
|
320
|
+
}) => {
|
|
324
321
|
const selectedDate = toDayjs(date) || dayjs__default["default"]();
|
|
325
322
|
const startAt = parseDayTime(selectedDate, dayStart);
|
|
326
323
|
const endAt = parseDayTime(selectedDate, dayEnd);
|
|
@@ -506,27 +503,23 @@ const MonthPickerPanel = ({
|
|
|
506
503
|
});
|
|
507
504
|
};
|
|
508
505
|
|
|
509
|
-
const HeaderNavButton =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
showTodayButton,
|
|
527
|
-
onCurrentChange,
|
|
528
|
-
onSelectToday
|
|
529
|
-
} = _ref2;
|
|
506
|
+
const HeaderNavButton = ({
|
|
507
|
+
label,
|
|
508
|
+
onClick,
|
|
509
|
+
children
|
|
510
|
+
}) => /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
511
|
+
type: "button",
|
|
512
|
+
className: style$5['header-nav'],
|
|
513
|
+
"aria-label": label,
|
|
514
|
+
onClick: onClick,
|
|
515
|
+
children: children
|
|
516
|
+
});
|
|
517
|
+
const Header = ({
|
|
518
|
+
current,
|
|
519
|
+
showTodayButton,
|
|
520
|
+
onCurrentChange,
|
|
521
|
+
onSelectToday
|
|
522
|
+
}) => {
|
|
530
523
|
const {
|
|
531
524
|
formatMessage
|
|
532
525
|
} = reactIntl.useIntl();
|
|
@@ -678,16 +671,15 @@ const useStackedLayout = (ref, stackAt) => {
|
|
|
678
671
|
|
|
679
672
|
var style$4 = {"date-cell":"kne-react-calendar_-a9AL","date-number":"kne-react-calendar_9s0kZ","date-has-events":"kne-react-calendar_-Bh5f","date-selected":"kne-react-calendar_Lpltl","date-muted":"kne-react-calendar_1xgRD","date-disabled":"kne-react-calendar_YTv16"};
|
|
680
673
|
|
|
681
|
-
const DateCell =
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
} = _ref;
|
|
674
|
+
const DateCell = ({
|
|
675
|
+
date,
|
|
676
|
+
dayEvents,
|
|
677
|
+
selected,
|
|
678
|
+
currentMonth,
|
|
679
|
+
disabled,
|
|
680
|
+
badgeMaxCount,
|
|
681
|
+
renderDateCell
|
|
682
|
+
}) => {
|
|
691
683
|
const count = dayEvents.length;
|
|
692
684
|
const customCell = renderDateCell?.(date.toDate(), {
|
|
693
685
|
events: dayEvents,
|
|
@@ -851,16 +843,15 @@ const usePanelScrollShadow = (resetKey, scrollRef) => {
|
|
|
851
843
|
};
|
|
852
844
|
};
|
|
853
845
|
|
|
854
|
-
const ViewPanel =
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
} = _ref;
|
|
846
|
+
const ViewPanel = ({
|
|
847
|
+
date,
|
|
848
|
+
events,
|
|
849
|
+
loading,
|
|
850
|
+
renderEventItem,
|
|
851
|
+
renderPanelHeader,
|
|
852
|
+
onEventClick,
|
|
853
|
+
scrollable = true
|
|
854
|
+
}) => {
|
|
864
855
|
const {
|
|
865
856
|
formatMessage
|
|
866
857
|
} = reactIntl.useIntl();
|
|
@@ -1187,10 +1178,7 @@ const defaultDayRange = now => {
|
|
|
1187
1178
|
/**
|
|
1188
1179
|
* `null` 或 `[null, null]` 表示不限制;单侧为空表示该侧不限制;`undefined` 为当天全天。
|
|
1189
1180
|
*/
|
|
1190
|
-
const resolveRange =
|
|
1191
|
-
if (now === void 0) {
|
|
1192
|
-
now = dayjs__default["default"]();
|
|
1193
|
-
}
|
|
1181
|
+
const resolveRange = (range, now = dayjs__default["default"]()) => {
|
|
1194
1182
|
if (range === null) {
|
|
1195
1183
|
return [null, null];
|
|
1196
1184
|
}
|
|
@@ -1218,14 +1206,13 @@ const resolveDuration = (duration, rangeStart, rangeEnd) => {
|
|
|
1218
1206
|
return requested;
|
|
1219
1207
|
};
|
|
1220
1208
|
const resolveStep = step => Number(step) > 0 ? Number(step) : DEFAULT_STEP;
|
|
1221
|
-
const resolveVisibleSpan =
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
} = _ref;
|
|
1209
|
+
const resolveVisibleSpan = ({
|
|
1210
|
+
visibleSpan,
|
|
1211
|
+
duration,
|
|
1212
|
+
baseDuration = duration,
|
|
1213
|
+
rangeStart,
|
|
1214
|
+
rangeEnd
|
|
1215
|
+
}) => {
|
|
1229
1216
|
const minimum = duration * 1.5;
|
|
1230
1217
|
let span = Number(visibleSpan) > 0 ? Number(visibleSpan) : Math.max(baseDuration * 6, DEFAULT_MIN_VISIBLE_SPAN);
|
|
1231
1218
|
if (rangeStart && rangeEnd && !(Number(visibleSpan) > 0)) {
|
|
@@ -1233,24 +1220,20 @@ const resolveVisibleSpan = _ref => {
|
|
|
1233
1220
|
}
|
|
1234
1221
|
return Math.max(span, minimum);
|
|
1235
1222
|
};
|
|
1236
|
-
const snapMs =
|
|
1237
|
-
if (mode === void 0) {
|
|
1238
|
-
mode = 'round';
|
|
1239
|
-
}
|
|
1223
|
+
const snapMs = (ms, stepMs, mode = 'round') => {
|
|
1240
1224
|
const anchor = dayjs__default["default"](ms).startOf('day').valueOf();
|
|
1241
1225
|
const units = (ms - anchor) / stepMs;
|
|
1242
1226
|
const snapped = mode === 'floor' ? Math.floor(units) : mode === 'ceil' ? Math.ceil(units) : Math.round(units);
|
|
1243
1227
|
return anchor + snapped * stepMs;
|
|
1244
1228
|
};
|
|
1245
|
-
const clampWindowStart = (startInput,
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
} = _ref2;
|
|
1229
|
+
const clampWindowStart = (startInput, {
|
|
1230
|
+
rangeStart,
|
|
1231
|
+
rangeEnd,
|
|
1232
|
+
duration,
|
|
1233
|
+
step,
|
|
1234
|
+
snap = true,
|
|
1235
|
+
now
|
|
1236
|
+
}) => {
|
|
1254
1237
|
const durationMs = duration * MINUTE_MS;
|
|
1255
1238
|
const minMs = rangeStart ? rangeStart.valueOf() : -Infinity;
|
|
1256
1239
|
const maxMs = rangeEnd ? rangeEnd.valueOf() - durationMs : Infinity;
|
|
@@ -1269,15 +1252,14 @@ const clampWindowStart = (startInput, _ref2) => {
|
|
|
1269
1252
|
}
|
|
1270
1253
|
return dayjs__default["default"](Math.min(Math.max(target, minMs), maxMs));
|
|
1271
1254
|
};
|
|
1272
|
-
const createTimeWindow =
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
} = _temp === void 0 ? {} : _temp;
|
|
1255
|
+
const createTimeWindow = ({
|
|
1256
|
+
start,
|
|
1257
|
+
duration,
|
|
1258
|
+
range,
|
|
1259
|
+
step,
|
|
1260
|
+
now,
|
|
1261
|
+
snap = true
|
|
1262
|
+
} = {}) => {
|
|
1281
1263
|
const [rangeStart, rangeEnd] = resolveRange(range, now);
|
|
1282
1264
|
const resolvedDuration = resolveDuration(duration, rangeStart, rangeEnd);
|
|
1283
1265
|
const resolvedStep = resolveStep(step);
|
|
@@ -1302,18 +1284,17 @@ const createTimeWindow = function (_temp) {
|
|
|
1302
1284
|
/**
|
|
1303
1285
|
* 拖动窗口一侧边界:另一侧保持不动,拖动侧按 step 吸附,并受最短 / 最长时长与范围约束。
|
|
1304
1286
|
*/
|
|
1305
|
-
const resizeTimeWindow =
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
} = _ref3;
|
|
1287
|
+
const resizeTimeWindow = ({
|
|
1288
|
+
edge,
|
|
1289
|
+
pointerMs,
|
|
1290
|
+
startMs,
|
|
1291
|
+
endMs,
|
|
1292
|
+
step,
|
|
1293
|
+
rangeStart,
|
|
1294
|
+
rangeEnd,
|
|
1295
|
+
minDuration,
|
|
1296
|
+
maxDuration
|
|
1297
|
+
}) => {
|
|
1317
1298
|
const stepMs = resolveStep(step) * MINUTE_MS;
|
|
1318
1299
|
const minMs = (Number(minDuration) > 0 ? Number(minDuration) : resolveStep(step)) * MINUTE_MS;
|
|
1319
1300
|
const maxMs = Number(maxDuration) > 0 ? Number(maxDuration) * MINUTE_MS : Infinity;
|
|
@@ -1337,11 +1318,10 @@ const resizeTimeWindow = _ref3 => {
|
|
|
1337
1318
|
};
|
|
1338
1319
|
};
|
|
1339
1320
|
const toWindowValue = window => [window.start.toDate(), window.end.toDate()];
|
|
1340
|
-
const getViewport = (
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
} = _ref4;
|
|
1321
|
+
const getViewport = ({
|
|
1322
|
+
startMs,
|
|
1323
|
+
duration
|
|
1324
|
+
}, visibleSpanMinutes) => {
|
|
1345
1325
|
const spanMs = visibleSpanMinutes * MINUTE_MS;
|
|
1346
1326
|
const centerMs = startMs + duration * MINUTE_MS / 2;
|
|
1347
1327
|
return {
|
|
@@ -1350,12 +1330,11 @@ const getViewport = (_ref4, visibleSpanMinutes) => {
|
|
|
1350
1330
|
spanMs
|
|
1351
1331
|
};
|
|
1352
1332
|
};
|
|
1353
|
-
const wheelDeltaToPx =
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
} = _ref5;
|
|
1333
|
+
const wheelDeltaToPx = ({
|
|
1334
|
+
delta,
|
|
1335
|
+
deltaMode = 0,
|
|
1336
|
+
trackWidth
|
|
1337
|
+
}) => {
|
|
1359
1338
|
if (deltaMode === 1) {
|
|
1360
1339
|
return delta * 16;
|
|
1361
1340
|
}
|
|
@@ -1368,13 +1347,12 @@ const wheelDeltaToPx = _ref5 => {
|
|
|
1368
1347
|
/**
|
|
1369
1348
|
* 把滚轮像素累加为整步数:步数与刻度尺比例一致,单次离散滚动至少移动一步。
|
|
1370
1349
|
*/
|
|
1371
|
-
const consumeWheelSteps =
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
} = _ref6;
|
|
1350
|
+
const consumeWheelSteps = ({
|
|
1351
|
+
accumulatedPx,
|
|
1352
|
+
deltaPx,
|
|
1353
|
+
pxPerStep,
|
|
1354
|
+
discrete
|
|
1355
|
+
}) => {
|
|
1378
1356
|
const sameDirection = accumulatedPx === 0 || Math.sign(accumulatedPx) === Math.sign(deltaPx);
|
|
1379
1357
|
const total = (sameDirection ? accumulatedPx : 0) + deltaPx;
|
|
1380
1358
|
const perStep = pxPerStep > 0 ? pxPerStep : 1;
|
|
@@ -1426,26 +1404,24 @@ const estimateVelocity = (samples, now) => {
|
|
|
1426
1404
|
const elapsed = latest.t - first.t;
|
|
1427
1405
|
return elapsed > 0 ? (latest.ms - first.ms) / elapsed : 0;
|
|
1428
1406
|
};
|
|
1429
|
-
const timeAtClientX =
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
} = _ref7;
|
|
1407
|
+
const timeAtClientX = ({
|
|
1408
|
+
clientX,
|
|
1409
|
+
rectLeft,
|
|
1410
|
+
rectWidth,
|
|
1411
|
+
rangeStartMs,
|
|
1412
|
+
rangeEndMs,
|
|
1413
|
+
grabOffsetMs = 0
|
|
1414
|
+
}) => {
|
|
1438
1415
|
const span = Math.max(rangeEndMs - rangeStartMs, 1);
|
|
1439
1416
|
const width = rectWidth > 0 ? rectWidth : 1;
|
|
1440
1417
|
const ratio = Math.min(Math.max((clientX - rectLeft) / width, 0), 1);
|
|
1441
1418
|
return rangeStartMs + ratio * span - grabOffsetMs;
|
|
1442
1419
|
};
|
|
1443
|
-
const formatTimeWindowParts =
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
} = _ref8;
|
|
1420
|
+
const formatTimeWindowParts = ({
|
|
1421
|
+
start,
|
|
1422
|
+
end,
|
|
1423
|
+
format = DEFAULT_FORMAT
|
|
1424
|
+
}) => {
|
|
1449
1425
|
const startDate = parseDateLike(start);
|
|
1450
1426
|
const endDate = parseDateLike(end);
|
|
1451
1427
|
if (!startDate || !endDate || typeof format === 'function') {
|
|
@@ -1460,13 +1436,12 @@ const formatTimeWindowParts = _ref8 => {
|
|
|
1460
1436
|
}
|
|
1461
1437
|
return [startText, endDate.format(endFormat)];
|
|
1462
1438
|
};
|
|
1463
|
-
const formatTimeWindow =
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
} = _ref9;
|
|
1439
|
+
const formatTimeWindow = ({
|
|
1440
|
+
start,
|
|
1441
|
+
end,
|
|
1442
|
+
format = DEFAULT_FORMAT,
|
|
1443
|
+
separator = DEFAULT_SEPARATOR
|
|
1444
|
+
}) => {
|
|
1470
1445
|
if (typeof format === 'function') {
|
|
1471
1446
|
const startDate = parseDateLike(start);
|
|
1472
1447
|
const endDate = parseDateLike(end);
|
|
@@ -1496,13 +1471,12 @@ const pickTickMinutes = (pxPerHour, labelEvery) => {
|
|
|
1496
1471
|
/**
|
|
1497
1472
|
* 只生成当前视窗 [viewStart, viewEnd] 内的刻度;`outOfRange` 标出超出可选范围的刻度。
|
|
1498
1473
|
*/
|
|
1499
|
-
const buildScaleTicks =
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
1474
|
+
const buildScaleTicks = (viewStart, viewEnd, {
|
|
1475
|
+
trackWidth,
|
|
1476
|
+
rangeStart,
|
|
1477
|
+
rangeEnd,
|
|
1478
|
+
minLabelPx = 52
|
|
1479
|
+
} = {}) => {
|
|
1506
1480
|
const viewStartMs = dayjs__default["default"](viewStart).valueOf();
|
|
1507
1481
|
const viewEndMs = dayjs__default["default"](viewEnd).valueOf();
|
|
1508
1482
|
const span = viewEndMs - viewStartMs;
|
|
@@ -1599,32 +1573,31 @@ const useElementWidth = ref => {
|
|
|
1599
1573
|
}, [ref]);
|
|
1600
1574
|
return width;
|
|
1601
1575
|
};
|
|
1602
|
-
const TimeWindowInner =
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
} = _ref;
|
|
1576
|
+
const TimeWindowInner = ({
|
|
1577
|
+
value,
|
|
1578
|
+
defaultValue,
|
|
1579
|
+
onChange,
|
|
1580
|
+
duration,
|
|
1581
|
+
range,
|
|
1582
|
+
step,
|
|
1583
|
+
visibleSpan,
|
|
1584
|
+
debounceWait = DEFAULT_DEBOUNCE_WAIT,
|
|
1585
|
+
format = DEFAULT_FORMAT,
|
|
1586
|
+
separator = DEFAULT_SEPARATOR,
|
|
1587
|
+
showDuration = true,
|
|
1588
|
+
size = 'default',
|
|
1589
|
+
inertia = true,
|
|
1590
|
+
resizable = true,
|
|
1591
|
+
wheelEffect = true,
|
|
1592
|
+
lockable = false,
|
|
1593
|
+
locked,
|
|
1594
|
+
defaultLocked = false,
|
|
1595
|
+
onLockedChange,
|
|
1596
|
+
minDuration,
|
|
1597
|
+
maxDuration,
|
|
1598
|
+
className,
|
|
1599
|
+
style: styleProp
|
|
1600
|
+
}) => {
|
|
1628
1601
|
const {
|
|
1629
1602
|
formatMessage
|
|
1630
1603
|
} = reactIntl.useIntl();
|
|
@@ -1767,10 +1740,7 @@ const TimeWindowInner = _ref => {
|
|
|
1767
1740
|
visualTargetRef.current = visualRef.current;
|
|
1768
1741
|
return true;
|
|
1769
1742
|
};
|
|
1770
|
-
const glideTo =
|
|
1771
|
-
if (easeMs === void 0) {
|
|
1772
|
-
easeMs = inertiaTau;
|
|
1773
|
-
}
|
|
1743
|
+
const glideTo = (ms, easeMs = inertiaTau) => {
|
|
1774
1744
|
const snapped = createTimeWindow({
|
|
1775
1745
|
start: ms,
|
|
1776
1746
|
...optionsRef.current
|
|
@@ -1779,10 +1749,9 @@ const TimeWindowInner = _ref => {
|
|
|
1779
1749
|
easeRef.current = easeMs;
|
|
1780
1750
|
setVisualTarget(snapped);
|
|
1781
1751
|
};
|
|
1782
|
-
const setVisualTarget =
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
} = _temp === void 0 ? {} : _temp;
|
|
1752
|
+
const setVisualTarget = (ms, {
|
|
1753
|
+
immediate = false
|
|
1754
|
+
} = {}) => {
|
|
1786
1755
|
const target = clampVisualRef.current(ms);
|
|
1787
1756
|
visualTargetRef.current = target;
|
|
1788
1757
|
if (immediate || typeof requestAnimationFrame === 'undefined') {
|
|
@@ -2408,7 +2377,7 @@ const DefaultFormInner = () => {
|
|
|
2408
2377
|
});
|
|
2409
2378
|
};
|
|
2410
2379
|
|
|
2411
|
-
var style$1 = {"kne-responsive-boundary":"kne-react-calendar_U1upa","kne-responsive-scroll":"kne-react-calendar_vKocI","slots":"kne-react-calendar_Ftp-V","timeline":"kne-react-calendar_EaUED","timeline-axis":"kne-react-calendar_X2W6x","timeline-axis-label":"kne-react-calendar_NvxDW","timeline-grid":"kne-react-calendar_gTav1","timeline-grid-dragging":"kne-react-calendar_4qf3-","timeline-line":"kne-react-calendar_Tp2ES","timeline-line-hour":"kne-react-calendar_M5-iS","timeline-disabled":"kne-react-calendar_-g-DR","timeline-disabled-reason":"kne-react-calendar_3vFqg","timeline-event":"kne-react-calendar_Wd-9L","timeline-event-title":"kne-react-calendar_WKbMK","timeline-event-time":"kne-react-calendar_K98yc","timeline-event-compact":"kne-react-calendar_WrUNC","timeline-event-disabled":"kne-react-calendar_C4d2-","timeline-ghost":"kne-react-calendar_0T5mO","timeline-now":"kne-react-calendar_AzaVv","timeline-popover-anchor":"kne-react-calendar_WtBzl","timeline-selection":"kne-react-calendar_z-uOR","timeline-selection-dragging":"kne-react-calendar_MbeJu","timeline-selection-label":"kne-react-calendar_7nYLD","timeline-selection-compact":"kne-react-calendar_CpsWx","timeline-selection-badge":"kne-react-calendar_NqiWA","timeline-selection-conflict":"kne-react-calendar_XQQ3E","timeline-selection-edge":"kne-react-calendar_s2EvF","timeline-selection-edge-start":"kne-react-calendar_PcIon","timeline-selection-edge-end":"kne-react-calendar_nS8Mr","form-popover":"kne-react-calendar_W-I5J","schedule-popover":"kne-react-calendar_rVLO8","form-popover-title":"kne-react-calendar_mMpFQ","form-
|
|
2380
|
+
var style$1 = {"kne-responsive-boundary":"kne-react-calendar_U1upa","kne-responsive-scroll":"kne-react-calendar_vKocI","slots":"kne-react-calendar_Ftp-V","timeline":"kne-react-calendar_EaUED","timeline-axis":"kne-react-calendar_X2W6x","timeline-axis-label":"kne-react-calendar_NvxDW","timeline-grid":"kne-react-calendar_gTav1","timeline-grid-dragging":"kne-react-calendar_4qf3-","timeline-line":"kne-react-calendar_Tp2ES","timeline-line-hour":"kne-react-calendar_M5-iS","timeline-disabled":"kne-react-calendar_-g-DR","timeline-disabled-reason":"kne-react-calendar_3vFqg","timeline-event":"kne-react-calendar_Wd-9L","timeline-event-title":"kne-react-calendar_WKbMK","timeline-event-time":"kne-react-calendar_K98yc","timeline-event-compact":"kne-react-calendar_WrUNC","timeline-event-disabled":"kne-react-calendar_C4d2-","timeline-ghost":"kne-react-calendar_0T5mO","timeline-now":"kne-react-calendar_AzaVv","timeline-popover-anchor":"kne-react-calendar_WtBzl","timeline-selection":"kne-react-calendar_z-uOR","timeline-selection-dragging":"kne-react-calendar_MbeJu","timeline-selection-label":"kne-react-calendar_7nYLD","timeline-selection-compact":"kne-react-calendar_CpsWx","timeline-selection-badge":"kne-react-calendar_NqiWA","timeline-selection-conflict":"kne-react-calendar_XQQ3E","timeline-selection-edge":"kne-react-calendar_s2EvF","timeline-selection-edge-start":"kne-react-calendar_PcIon","timeline-selection-edge-end":"kne-react-calendar_nS8Mr","form-popover":"kne-react-calendar_W-I5J","schedule-popover":"kne-react-calendar_rVLO8","form-popover-title":"kne-react-calendar_mMpFQ","form-popover-form":"kne-react-calendar_9eAK6","form-popover-body":"kne-react-calendar_DubfV","form-time-window":"kne-react-calendar_Wd4qh","form-actions":"kne-react-calendar_4NPv0","event-detail":"kne-react-calendar_Dc-t3","form-sheet":"kne-react-calendar_n-MRC","form-sheet-content":"kne-react-calendar_ZaEkY","form-conflict":"kne-react-calendar_PpU92","event-detail-clickable":"kne-react-calendar_C3waU","event-detail-title":"kne-react-calendar_FkbSR","event-detail-disabled":"kne-react-calendar_UsltM","event-detail-bar":"kne-react-calendar_ZETY4","event-detail-body":"kne-react-calendar_v9RjG","event-detail-time":"kne-react-calendar_NT-kw","event-detail-text":"kne-react-calendar_vOb62","event-detail-tag":"kne-react-calendar_rs8bh"};
|
|
2412
2381
|
|
|
2413
2382
|
const EventDetail = ({
|
|
2414
2383
|
event,
|
|
@@ -3010,30 +2979,29 @@ function _catch(body, recover) {
|
|
|
3010
2979
|
}
|
|
3011
2980
|
return result;
|
|
3012
2981
|
}
|
|
3013
|
-
const SchedulePanel =
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
} = _ref;
|
|
2982
|
+
const SchedulePanel = ({
|
|
2983
|
+
date,
|
|
2984
|
+
slots,
|
|
2985
|
+
events: dayEvents,
|
|
2986
|
+
dayStart,
|
|
2987
|
+
dayEnd,
|
|
2988
|
+
timeUnit,
|
|
2989
|
+
timeStep,
|
|
2990
|
+
hourHeight,
|
|
2991
|
+
allowConflict,
|
|
2992
|
+
loading,
|
|
2993
|
+
allowMultiSelect,
|
|
2994
|
+
onSlotRangeChange,
|
|
2995
|
+
onFreeSlotClick,
|
|
2996
|
+
onCreate,
|
|
2997
|
+
formInner,
|
|
2998
|
+
formProps,
|
|
2999
|
+
defaultFormValues,
|
|
3000
|
+
renderEventBlock,
|
|
3001
|
+
renderOccupiedSlot,
|
|
3002
|
+
renderPanelHeader,
|
|
3003
|
+
onEventClick
|
|
3004
|
+
}) => {
|
|
3037
3005
|
const {
|
|
3038
3006
|
formatMessage
|
|
3039
3007
|
} = reactIntl.useIntl();
|
|
@@ -3120,42 +3088,12 @@ const SchedulePanel = _ref => {
|
|
|
3120
3088
|
children: formatMessage({
|
|
3121
3089
|
id: 'SchedulePanel.newScheduleTitle'
|
|
3122
3090
|
})
|
|
3123
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
3124
|
-
className: style$1['form-time-window'],
|
|
3125
|
-
size: isMobile ? 'default' : 'small',
|
|
3126
|
-
value: [new Date(selection.startMs), new Date(selection.endMs)],
|
|
3127
|
-
range: windowRange,
|
|
3128
|
-
step: timeStep,
|
|
3129
|
-
minDuration: timeStep,
|
|
3130
|
-
resizable: allowMultiSelect,
|
|
3131
|
-
debounceWait: 120,
|
|
3132
|
-
format: "HH:mm",
|
|
3133
|
-
separator: " - ",
|
|
3134
|
-
onChange: value => {
|
|
3135
|
-
if (!value) {
|
|
3136
|
-
return;
|
|
3137
|
-
}
|
|
3138
|
-
const range = {
|
|
3139
|
-
startMs: value[0].getTime(),
|
|
3140
|
-
endMs: value[1].getTime()
|
|
3141
|
-
};
|
|
3142
|
-
setSelection(range);
|
|
3143
|
-
emitRange(range);
|
|
3144
|
-
}
|
|
3145
|
-
}), conflicts.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
|
|
3146
|
-
className: style$1['form-conflict'],
|
|
3147
|
-
type: "warning",
|
|
3148
|
-
showIcon: true,
|
|
3149
|
-
title: `${formatMessage({
|
|
3150
|
-
id: 'SchedulePanel.conflict'
|
|
3151
|
-
}, {
|
|
3152
|
-
count: conflicts.length
|
|
3153
|
-
})}:${conflicts.map(event => event.title).join('、')}`
|
|
3154
|
-
}) : null, /*#__PURE__*/jsxRuntime.jsxs(FormInfo.Form, {
|
|
3091
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(FormInfo.Form, {
|
|
3155
3092
|
...formProps,
|
|
3156
3093
|
...(isMobile ? {
|
|
3157
3094
|
size: 'large'
|
|
3158
3095
|
} : null),
|
|
3096
|
+
className: classNames(style$1['form-popover-form'], formProps?.className),
|
|
3159
3097
|
data: getDefaultFormValues(defaultFormValues, formContext),
|
|
3160
3098
|
onSubmit: function (values) {
|
|
3161
3099
|
try {
|
|
@@ -3169,7 +3107,41 @@ const SchedulePanel = _ref => {
|
|
|
3169
3107
|
return Promise.reject(e);
|
|
3170
3108
|
}
|
|
3171
3109
|
},
|
|
3172
|
-
children: [
|
|
3110
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3111
|
+
className: style$1['form-popover-body'],
|
|
3112
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(TimeWindow, {
|
|
3113
|
+
className: style$1['form-time-window'],
|
|
3114
|
+
size: isMobile ? 'default' : 'small',
|
|
3115
|
+
value: [new Date(selection.startMs), new Date(selection.endMs)],
|
|
3116
|
+
range: windowRange,
|
|
3117
|
+
step: timeStep,
|
|
3118
|
+
minDuration: timeStep,
|
|
3119
|
+
resizable: allowMultiSelect,
|
|
3120
|
+
debounceWait: 120,
|
|
3121
|
+
format: "HH:mm",
|
|
3122
|
+
separator: " - ",
|
|
3123
|
+
onChange: value => {
|
|
3124
|
+
if (!value) {
|
|
3125
|
+
return;
|
|
3126
|
+
}
|
|
3127
|
+
const range = {
|
|
3128
|
+
startMs: value[0].getTime(),
|
|
3129
|
+
endMs: value[1].getTime()
|
|
3130
|
+
};
|
|
3131
|
+
setSelection(range);
|
|
3132
|
+
emitRange(range);
|
|
3133
|
+
}
|
|
3134
|
+
}), conflicts.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
|
|
3135
|
+
className: style$1['form-conflict'],
|
|
3136
|
+
type: "warning",
|
|
3137
|
+
showIcon: true,
|
|
3138
|
+
title: `${formatMessage({
|
|
3139
|
+
id: 'SchedulePanel.conflict'
|
|
3140
|
+
}, {
|
|
3141
|
+
count: conflicts.length
|
|
3142
|
+
})}:${conflicts.map(event => event.title).join('、')}`
|
|
3143
|
+
}) : null, formInner || /*#__PURE__*/jsxRuntime.jsx(DefaultFormInner, {})]
|
|
3144
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3173
3145
|
className: style$1['form-actions'],
|
|
3174
3146
|
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
3175
3147
|
onClick: clearSelection,
|
|
@@ -3272,14 +3244,13 @@ const SchedulePanel = _ref => {
|
|
|
3272
3244
|
var style = {"kne-responsive-boundary":"kne-react-calendar_gh14z","kne-responsive-scroll":"kne-react-calendar_Kfn6L","schedule-calendar-shell":"kne-react-calendar_csu63","schedule-calendar":"kne-react-calendar_5p1TK","calendar-side":"kne-react-calendar_nd7DK","panel-side":"kne-react-calendar_rWvHE","schedule-calendar-event-list-expanded":"kne-react-calendar_Av0q4","schedule-calendar-stacked":"kne-react-calendar_zGXr5"};
|
|
3273
3245
|
|
|
3274
3246
|
dayjs__default["default"].extend(customParseFormat__default["default"]);
|
|
3275
|
-
const buildMonthRuleCache =
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
} = _ref;
|
|
3247
|
+
const buildMonthRuleCache = ({
|
|
3248
|
+
currentDate,
|
|
3249
|
+
mode,
|
|
3250
|
+
disabledDate,
|
|
3251
|
+
disabledDateTime,
|
|
3252
|
+
availableDateTime
|
|
3253
|
+
}) => {
|
|
3283
3254
|
const cache = new Map();
|
|
3284
3255
|
const monthStart = currentDate.startOf('month');
|
|
3285
3256
|
const monthEnd = currentDate.endOf('month');
|