makula-schedule 1.1.8 → 2.0.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.
- package/README.md +1 -3
- package/dist/components/HeaderView.js +120 -113
- package/dist/components/ResourceEvents.js +36 -1
- package/dist/components/ResourceView.js +35 -20
- package/dist/components/SchedulerData.js +26 -59
- package/dist/components/index.js +38 -16
- package/dist/config/i18n.js +80 -0
- package/dist/config/scheduler.js +13 -0
- package/dist/css/style.css +9148 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.js +26 -1
- package/package.json +14 -13
package/dist/components/index.js
CHANGED
|
@@ -104,6 +104,29 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
104
104
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
105
105
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
106
106
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } // eslint-disable-next-line no-unused-vars
|
|
107
|
+
/**
|
|
108
|
+
* Render the scheduler UI with resource and agenda views, responsive sizing, and drag-and-drop support.
|
|
109
|
+
*
|
|
110
|
+
* @param {object} props - Component properties.
|
|
111
|
+
* @param {SchedulerData} props.schedulerData - Scheduler state and configuration used to drive rendering and behavior.
|
|
112
|
+
* @param {Array<DnDSource>} [props.dndSources] - Additional drag-and-drop sources to merge into the
|
|
113
|
+
* scheduler's DnD context.
|
|
114
|
+
* @param {React.RefObject<HTMLElement>} [props.parentRef] - Parent element ref used when sizing
|
|
115
|
+
* is driven by the parent container.
|
|
116
|
+
* @param {function(SchedulerData):void} props.prevClick - Callback invoked to navigate to the previous range.
|
|
117
|
+
* @param {function(SchedulerData):void} props.nextClick - Callback invoked to navigate to the next range.
|
|
118
|
+
* @param {function(SchedulerData, object):void} props.onViewChange - Callback invoked when the view type,
|
|
119
|
+
* agenda toggle, or perspective changes.
|
|
120
|
+
* @param {function(SchedulerData, string|Date):void} props.onSelectDate - Callback invoked when a date is selected.
|
|
121
|
+
* @param {React.ReactNode} [props.leftCustomHeader] - Optional custom content rendered on the left side of the header.
|
|
122
|
+
* @param {React.ReactNode} [props.rightCustomHeader] - Optional custom content rendered on the
|
|
123
|
+
* right side of the header.
|
|
124
|
+
* @param {function} [props.CustomResourceHeader] - Optional component used to render the resource header cell.
|
|
125
|
+
* @param {object} [props.configTableHeaderStyle] - Optional inline style object applied
|
|
126
|
+
* to the resource header container.
|
|
127
|
+
* @returns {JSX.Element} The scheduler root element tree to be rendered.
|
|
128
|
+
*/
|
|
129
|
+
|
|
107
130
|
function Scheduler(props) {
|
|
108
131
|
var schedulerData = props.schedulerData,
|
|
109
132
|
dndSources = props.dndSources,
|
|
@@ -116,7 +139,6 @@ function Scheduler(props) {
|
|
|
116
139
|
rightCustomHeader = props.rightCustomHeader,
|
|
117
140
|
ViewButtonRender = props.ViewButtonRender,
|
|
118
141
|
CustomLoader = props.CustomLoader,
|
|
119
|
-
showWeekNumber = props.showWeekNumber,
|
|
120
142
|
CustomResourceHeader = props.CustomResourceHeader,
|
|
121
143
|
CustomResourceCell = props.CustomResourceCell,
|
|
122
144
|
configTableHeaderStyle = props.configTableHeaderStyle;
|
|
@@ -417,10 +439,13 @@ function Scheduler(props) {
|
|
|
417
439
|
contentScrollbarWidth = state.contentScrollbarWidth,
|
|
418
440
|
resourceScrollbarHeight = state.resourceScrollbarHeight,
|
|
419
441
|
resourceScrollbarWidth = state.resourceScrollbarWidth;
|
|
442
|
+
var showWeekNumber = config.showWeekNumber,
|
|
443
|
+
weekNumberRowHeight = config.weekNumberRowHeight;
|
|
420
444
|
var tbodyContent = /*#__PURE__*/_react["default"].createElement("tr", null);
|
|
421
445
|
if (showAgenda) {
|
|
422
446
|
tbodyContent = /*#__PURE__*/_react["default"].createElement(_AgendaView["default"], props);
|
|
423
447
|
} else {
|
|
448
|
+
var _config$headerBorderC, _config$headerBorderC2, _config$weekNumberLab, _config$headerBorderC3;
|
|
424
449
|
var resourceTableWidth = schedulerData.getResourceTableWidth();
|
|
425
450
|
var schedulerContainerWidth = width - (config.resourceViewEnabled ? resourceTableWidth : 0);
|
|
426
451
|
var schedulerWidth = schedulerData.getContentTableWidth() - 1;
|
|
@@ -455,11 +480,12 @@ function Scheduler(props) {
|
|
|
455
480
|
margin: "0px -".concat(contentScrollbarWidth, "px 0px 0px")
|
|
456
481
|
};
|
|
457
482
|
if (config.schedulerMaxHeight > 0) {
|
|
483
|
+
var totalHeaderHeight = config.tableHeaderHeight + (showWeekNumber ? weekNumberRowHeight : 0);
|
|
458
484
|
schedulerContentStyle = _objectSpread(_objectSpread({}, schedulerContentStyle), {}, {
|
|
459
|
-
maxHeight: config.schedulerMaxHeight -
|
|
485
|
+
maxHeight: config.schedulerMaxHeight - totalHeaderHeight
|
|
460
486
|
});
|
|
461
487
|
resourceContentStyle = _objectSpread(_objectSpread({}, resourceContentStyle), {}, {
|
|
462
|
-
maxHeight: config.schedulerMaxHeight -
|
|
488
|
+
maxHeight: config.schedulerMaxHeight - totalHeaderHeight
|
|
463
489
|
});
|
|
464
490
|
} else if (config.responsiveByParent && schedulerData.documentHeight > 0) {
|
|
465
491
|
// Responsive height minus SchedulerHeader
|
|
@@ -482,30 +508,29 @@ function Scheduler(props) {
|
|
|
482
508
|
className: "resource-view"
|
|
483
509
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
484
510
|
style: _objectSpread({
|
|
485
|
-
borderBottom:
|
|
486
|
-
height:
|
|
511
|
+
borderBottom: "1px solid ".concat((_config$headerBorderC = config.headerBorderColor) !== null && _config$headerBorderC !== void 0 ? _config$headerBorderC : '#e9e9e9'),
|
|
512
|
+
height: config.tableHeaderHeight + (showWeekNumber ? weekNumberRowHeight : 0)
|
|
487
513
|
}, configTableHeaderStyle)
|
|
488
514
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
489
515
|
style: {
|
|
490
516
|
overflowX: 'scroll',
|
|
491
517
|
overflowY: 'hidden',
|
|
492
|
-
margin: "0px 0px -".concat(contentScrollbarHeight, "px")
|
|
493
|
-
overflow: 'visible'
|
|
518
|
+
margin: "0px 0px -".concat(contentScrollbarHeight, "px")
|
|
494
519
|
}
|
|
495
520
|
}, /*#__PURE__*/_react["default"].createElement("table", {
|
|
496
521
|
className: "resource-table"
|
|
497
522
|
}, /*#__PURE__*/_react["default"].createElement("thead", null, showWeekNumber && /*#__PURE__*/_react["default"].createElement("tr", {
|
|
498
523
|
style: {
|
|
499
|
-
height:
|
|
524
|
+
height: weekNumberRowHeight
|
|
500
525
|
}
|
|
501
526
|
}, /*#__PURE__*/_react["default"].createElement("th", {
|
|
502
527
|
style: {
|
|
503
|
-
borderBottom:
|
|
528
|
+
borderBottom: "1px solid ".concat((_config$headerBorderC2 = config.headerBorderColor) !== null && _config$headerBorderC2 !== void 0 ? _config$headerBorderC2 : '#e9e9e9'),
|
|
504
529
|
fontSize: '0.85em',
|
|
505
530
|
opacity: 0.7,
|
|
506
531
|
padding: '4px 8px'
|
|
507
532
|
}
|
|
508
|
-
},
|
|
533
|
+
}, (_config$weekNumberLab = config.weekNumberLabel) !== null && _config$weekNumberLab !== void 0 ? _config$weekNumberLab : 'Week No.')), /*#__PURE__*/_react["default"].createElement("tr", {
|
|
509
534
|
style: {
|
|
510
535
|
height: config.tableHeaderHeight
|
|
511
536
|
}
|
|
@@ -531,8 +556,8 @@ function Scheduler(props) {
|
|
|
531
556
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
532
557
|
style: {
|
|
533
558
|
overflow: 'hidden',
|
|
534
|
-
borderBottom:
|
|
535
|
-
height:
|
|
559
|
+
borderBottom: "1px solid ".concat((_config$headerBorderC3 = config.headerBorderColor) !== null && _config$headerBorderC3 !== void 0 ? _config$headerBorderC3 : '#e9e9e9'),
|
|
560
|
+
height: config.tableHeaderHeight + (showWeekNumber ? weekNumberRowHeight : 0)
|
|
536
561
|
}
|
|
537
562
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
538
563
|
style: {
|
|
@@ -555,9 +580,7 @@ function Scheduler(props) {
|
|
|
555
580
|
}
|
|
556
581
|
}, /*#__PURE__*/_react["default"].createElement("table", {
|
|
557
582
|
className: "scheduler-bg-table"
|
|
558
|
-
}, /*#__PURE__*/_react["default"].createElement(_HeaderView["default"],
|
|
559
|
-
showWeekNumber: showWeekNumber
|
|
560
|
-
})))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
583
|
+
}, /*#__PURE__*/_react["default"].createElement(_HeaderView["default"], props))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
561
584
|
style: schedulerContentStyle,
|
|
562
585
|
ref: schedulerContentRef,
|
|
563
586
|
onMouseOver: onSchedulerContentMouseOver,
|
|
@@ -643,7 +666,6 @@ Scheduler.propTypes = {
|
|
|
643
666
|
onScrollRight: _propTypes["default"].func,
|
|
644
667
|
onScrollTop: _propTypes["default"].func,
|
|
645
668
|
onScrollBottom: _propTypes["default"].func,
|
|
646
|
-
showWeekNumber: _propTypes["default"].bool,
|
|
647
669
|
CustomResourceHeader: _propTypes["default"].func,
|
|
648
670
|
CustomResourceCell: _propTypes["default"].func,
|
|
649
671
|
configTableHeaderStyle: _propTypes["default"].object
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultLabels = getDefaultLabels;
|
|
7
|
+
exports.getLabel = getLabel;
|
|
8
|
+
exports.resetLabelsProvider = resetLabelsProvider;
|
|
9
|
+
exports.setLabelsProvider = setLabelsProvider;
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
|
+
/**
|
|
17
|
+
* i18n configuration and labels provider
|
|
18
|
+
*
|
|
19
|
+
* This module provides a centralized way to manage user-facing strings in the scheduler.
|
|
20
|
+
* Users can provide localized labels either through the config or by setting a custom
|
|
21
|
+
* labels provider function.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Default English labels
|
|
25
|
+
var defaultLabels = {
|
|
26
|
+
resourceName: 'Resource Name',
|
|
27
|
+
taskName: 'Task Name',
|
|
28
|
+
agendaViewHeader: 'Agenda',
|
|
29
|
+
weekNumberLabel: 'Week No.'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Current labels provider (can be a function or object)
|
|
33
|
+
var labelsProvider = null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the current label for a given key
|
|
37
|
+
* @param {string} key - The label key (e.g., 'resourceName', 'taskName')
|
|
38
|
+
* @param {string} locale - Optional locale code for locale-specific translations
|
|
39
|
+
* @returns {string} The localized label or the default English label
|
|
40
|
+
*/
|
|
41
|
+
function getLabel(key) {
|
|
42
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
43
|
+
// If a custom provider function is set, use it
|
|
44
|
+
if (typeof labelsProvider === 'function') {
|
|
45
|
+
var label = labelsProvider(key, locale);
|
|
46
|
+
return label !== undefined && label !== null ? label : defaultLabels[key];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If a labels object provider is set, use it with fallback
|
|
50
|
+
if (labelsProvider && _typeof(labelsProvider) === 'object') {
|
|
51
|
+
var _label = labelsProvider[key];
|
|
52
|
+
return _label !== undefined && _label !== null ? _label : defaultLabels[key];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Fall back to default English labels
|
|
56
|
+
return defaultLabels[key];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Set a custom labels provider
|
|
61
|
+
* @param {Function|Object} provider - Either a function(key, locale) -> string or an object with label key-value pairs
|
|
62
|
+
*/
|
|
63
|
+
function setLabelsProvider(provider) {
|
|
64
|
+
labelsProvider = provider;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get all default labels
|
|
69
|
+
* @returns {Object} Object with all default English labels
|
|
70
|
+
*/
|
|
71
|
+
function getDefaultLabels() {
|
|
72
|
+
return _objectSpread({}, defaultLabels);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reset to default English labels
|
|
77
|
+
*/
|
|
78
|
+
function resetLabelsProvider() {
|
|
79
|
+
labelsProvider = null;
|
|
80
|
+
}
|
package/dist/config/scheduler.js
CHANGED
|
@@ -5,6 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _default2 = require("./default");
|
|
8
|
+
/**
|
|
9
|
+
* Default scheduler configuration
|
|
10
|
+
*
|
|
11
|
+
* User-facing strings (resourceName, taskName, agendaViewHeader, weekNumberLabel)
|
|
12
|
+
* are set to English defaults but can be overridden through:
|
|
13
|
+
* 1. Passing a custom config object when creating SchedulerData
|
|
14
|
+
* 2. Using setLabelsProvider() from the i18n module to set a custom labels provider
|
|
15
|
+
* 3. Directly modifying config properties after instantiation
|
|
16
|
+
*/
|
|
8
17
|
var _default = exports["default"] = {
|
|
9
18
|
schedulerWidth: '100%',
|
|
10
19
|
besidesWidth: 20,
|
|
@@ -49,6 +58,9 @@ var _default = exports["default"] = {
|
|
|
49
58
|
summaryColor: '#666',
|
|
50
59
|
summaryPos: _default2.SummaryPos.TopRight,
|
|
51
60
|
groupOnlySlotColor: '#F8F8F8',
|
|
61
|
+
headerBorderColor: '#e9e9e9',
|
|
62
|
+
weekNumberRowHeight: 24,
|
|
63
|
+
showWeekNumber: false,
|
|
52
64
|
startResizable: true,
|
|
53
65
|
endResizable: true,
|
|
54
66
|
movable: true,
|
|
@@ -72,6 +84,7 @@ var _default = exports["default"] = {
|
|
|
72
84
|
resourceName: 'Resource Name',
|
|
73
85
|
taskName: 'Task Name',
|
|
74
86
|
agendaViewHeader: 'Agenda',
|
|
87
|
+
weekNumberLabel: 'Week No.',
|
|
75
88
|
addMorePopoverHeaderFormat: 'MMM D, YYYY dddd',
|
|
76
89
|
eventItemPopoverDateFormat: 'MMM D',
|
|
77
90
|
nonAgendaDayCellHeaderFormat: 'ha',
|