Newer
Older
groupNode = node;
break;
}
}
}
if (!groupNode) {
groupNode = {
group: {
value: groupValue,
};
nodes.splice(newGroupIndex, 0, groupNode);
}
return groupNode;
}
function insertResourceNodeInSiblings(resourceNode, siblings, orderSpecs) {
var i;
for (i = 0; i < siblings.length; i += 1) {
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
var cmp = compareByFieldSpecs(siblings[i].resourceFields, resourceNode.resourceFields, orderSpecs); // TODO: pass in ResourceApi?
if (cmp > 0) { // went 1 past. insert at i
break;
}
}
siblings.splice(i, 0, resourceNode);
}
function buildResourceFields(resource) {
var obj = __assign(__assign(__assign({}, resource.extendedProps), resource.ui), resource);
delete obj.ui;
delete obj.extendedProps;
return obj;
}
function isGroupsEqual(group0, group1) {
return group0.spec === group1.spec && group0.value === group1.value;
}
var resourceCommonPlugin = createPlugin({
deps: [
premiumCommonPlugin,
],
reducers: [
reduceResources,
],
isLoadingFuncs: [
function (state) { return state.resourceSource && state.resourceSource.isFetching; },
],
eventRefiners: EVENT_REFINERS$1,
eventDefMemberAdders: [generateEventDefResourceMembers],
isDraggableTransformers: [transformIsDraggable],
eventDragMutationMassagers: [massageEventDragMutation],
eventDefMutationAppliers: [applyEventDefMutation],
dateSelectionTransformers: [transformDateSelectionJoin],
datePointTransforms: [transformDatePoint],
dateSpanTransforms: [transformDateSpan],
viewPropsTransformers: [ResourceDataAdder, ResourceEventConfigAdder],
isPropsValid: isPropsValidWithResources,
externalDefTransforms: [transformExternalDef],
eventResizeJoinTransforms: [transformEventResizeJoin],
eventDropTransformers: [transformEventDrop],
optionChangeHandlers: optionChangeHandlers,
listenerRefiners: LISTENER_REFINERS$1,
propSetHandlers: { resourceStore: handleResourceStore },
var ResourceDayTableJoiner = /** @class */ (function (_super) {
__extends(ResourceDayTableJoiner, _super);
function ResourceDayTableJoiner() {
return _super !== null && _super.apply(this, arguments) || this;
}
ResourceDayTableJoiner.prototype.transformSeg = function (seg, resourceDayTableModel, resourceI) {
var colRanges = resourceDayTableModel.computeColRanges(seg.firstCol, seg.lastCol, resourceI);
return colRanges.map(function (colRange) { return (__assign(__assign(__assign({}, seg), colRange), { isStart: seg.isStart && colRange.isStart, isEnd: seg.isEnd && colRange.isEnd })); });
};
return ResourceDayTableJoiner;
}(VResourceJoiner));
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
var ResourceDayTable = /** @class */ (function (_super) {
__extends(ResourceDayTable, _super);
function ResourceDayTable() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowAcrossResources = false;
_this.splitter = new VResourceSplitter();
_this.slicers = {};
_this.joiner = new ResourceDayTableJoiner();
_this.tableRef = createRef();
_this.handleRootEl = function (rootEl) {
if (rootEl) {
_this.context.registerInteractiveComponent(_this, { el: rootEl });
}
else {
_this.context.unregisterInteractiveComponent(_this);
}
};
return _this;
}
ResourceDayTable.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var resourceDayTableModel = props.resourceDayTableModel, nextDayThreshold = props.nextDayThreshold, dateProfile = props.dateProfile;
var splitProps = this.splitter.splitProps(props);
this.slicers = mapHash(splitProps, function (split, resourceId) { return _this.slicers[resourceId] || new DayTableSlicer(); });
var slicedProps = mapHash(this.slicers, function (slicer, resourceId) { return slicer.sliceProps(splitProps[resourceId], dateProfile, nextDayThreshold, context, resourceDayTableModel.dayTableModel); });
this.allowAcrossResources = resourceDayTableModel.dayTableModel.colCnt === 1; // hack for EventResizing
return (createElement(Table, __assign({ forPrint: props.forPrint, ref: this.tableRef, elRef: this.handleRootEl }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { cells: resourceDayTableModel.cells, dateProfile: dateProfile, colGroupNode: props.colGroupNode, tableMinWidth: props.tableMinWidth, renderRowIntro: props.renderRowIntro, dayMaxEvents: props.dayMaxEvents, dayMaxEventRows: props.dayMaxEventRows, showWeekNumbers: props.showWeekNumbers, expandRows: props.expandRows, headerAlignElRef: props.headerAlignElRef, clientWidth: props.clientWidth, clientHeight: props.clientHeight })));
};
ResourceDayTable.prototype.prepareHits = function () {
this.tableRef.current.prepareHits();
};
ResourceDayTable.prototype.queryHit = function (positionLeft, positionTop) {
var rawHit = this.tableRef.current.positionToHit(positionLeft, positionTop);
if (rawHit) {
return {
component: this,
dateSpan: {
range: rawHit.dateSpan.range,
allDay: rawHit.dateSpan.allDay,
resourceId: this.props.resourceDayTableModel.cells[rawHit.row][rawHit.col].resource.id,
},
dayEl: rawHit.dayEl,
rect: {
left: rawHit.relativeRect.left,
right: rawHit.relativeRect.right,
top: rawHit.relativeRect.top,
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
};
return ResourceDayTable;
}(DateComponent));
var ResourceDayTableView = /** @class */ (function (_super) {
__extends(ResourceDayTableView, _super);
function ResourceDayTableView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.flattenResources = memoize(flattenResources);
_this.buildResourceDayTableModel = memoize(buildResourceDayTableModel);
_this.headerRef = createRef();
_this.tableRef = createRef();
return _this;
}
ResourceDayTableView.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var options = context.options;
var resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER;
var resources = this.flattenResources(props.resourceStore, resourceOrderSpecs);
var resourceDayTableModel = this.buildResourceDayTableModel(props.dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context);
var headerContent = options.dayHeaders && (createElement(ResourceDayHeader, { ref: this.headerRef, resources: resources, dateProfile: props.dateProfile, dates: resourceDayTableModel.dayTableModel.headerDates, datesRepDistinctDays: true }));
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
var bodyContent = function (contentArg) { return (createElement(ResourceDayTable, { ref: _this.tableRef, dateProfile: props.dateProfile, resourceDayTableModel: resourceDayTableModel, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, dayMaxEvents: options.dayMaxEvents, dayMaxEventRows: options.dayMaxEventRows, showWeekNumbers: options.weekNumbers, expandRows: !props.isHeightAuto, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint })); };
return options.dayMinWidth
? this.renderHScrollLayout(headerContent, bodyContent, resourceDayTableModel.colCnt, options.dayMinWidth)
: this.renderSimpleLayout(headerContent, bodyContent);
};
return ResourceDayTableView;
}(TableView));
function buildResourceDayTableModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) {
var dayTable = buildDayTableModel(dateProfile, dateProfileGenerator);
return datesAboveResources ?
new DayResourceTableModel(dayTable, resources, context) :
new ResourceDayTableModel(dayTable, resources, context);
}
var resourceDayGridPlugin = createPlugin({
deps: [
premiumCommonPlugin,
resourceCommonPlugin,
],
initialView: 'resourceDayGridDay',
views: {
resourceDayGrid: {
type: 'dayGrid',
component: ResourceDayTableView,
},
resourceDayGridDay: {
type: 'resourceDayGrid',
},
resourceDayGridWeek: {
type: 'resourceDayGrid',
},
resourceDayGridMonth: {
type: 'resourceDayGrid',
duration: { months: 1 },
// TODO: wish we didn't have to C&P from dayGrid's file
monthMode: true,
fixedWeekCount: true,
},
},
var ResourceDayTimeColsJoiner = /** @class */ (function (_super) {
__extends(ResourceDayTimeColsJoiner, _super);
function ResourceDayTimeColsJoiner() {
return _super !== null && _super.apply(this, arguments) || this;
}
ResourceDayTimeColsJoiner.prototype.transformSeg = function (seg, resourceDayTable, resourceI) {
return [
__assign(__assign({}, seg), { col: resourceDayTable.computeCol(seg.col, resourceI) }),
];
};
return ResourceDayTimeColsJoiner;
}(VResourceJoiner));
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
var ResourceDayTimeCols = /** @class */ (function (_super) {
__extends(ResourceDayTimeCols, _super);
function ResourceDayTimeCols() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.allowAcrossResources = false;
_this.buildDayRanges = memoize(buildDayRanges);
_this.splitter = new VResourceSplitter();
_this.slicers = {};
_this.joiner = new ResourceDayTimeColsJoiner();
_this.timeColsRef = createRef();
_this.handleRootEl = function (rootEl) {
if (rootEl) {
_this.context.registerInteractiveComponent(_this, { el: rootEl });
}
else {
_this.context.unregisterInteractiveComponent(_this);
}
};
return _this;
}
ResourceDayTimeCols.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var dateEnv = context.dateEnv, options = context.options;
var dateProfile = props.dateProfile, resourceDayTableModel = props.resourceDayTableModel;
var dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
var splitProps = this.splitter.splitProps(props);
this.slicers = mapHash(splitProps, function (split, resourceId) { return _this.slicers[resourceId] || new DayTimeColsSlicer(); });
var slicedProps = mapHash(this.slicers, function (slicer, resourceId) { return slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges); });
this.allowAcrossResources = dayRanges.length === 1;
return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it
createElement(NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, function (nowDate, todayRange) { return (createElement(TimeCols, __assign({ ref: _this.timeColsRef, rootElRef: _this.handleRootEl }, _this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && _this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords }))); }));
};
ResourceDayTimeCols.prototype.buildNowIndicatorSegs = function (date) {
var nonResourceSegs = this.slicers[''].sliceNowDate(date, this.context, this.dayRanges);
return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs);
};
ResourceDayTimeCols.prototype.queryHit = function (positionLeft, positionTop) {
var rawHit = this.timeColsRef.current.positionToHit(positionLeft, positionTop);
if (rawHit) {
return {
component: this,
dateSpan: {
range: rawHit.dateSpan.range,
allDay: rawHit.dateSpan.allDay,
resourceId: this.props.resourceDayTableModel.cells[0][rawHit.col].resource.id,
},
dayEl: rawHit.dayEl,
rect: {
left: rawHit.relativeRect.left,
right: rawHit.relativeRect.right,
top: rawHit.relativeRect.top,
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
};
return ResourceDayTimeCols;
}(DateComponent));
var ResourceDayTimeColsView = /** @class */ (function (_super) {
__extends(ResourceDayTimeColsView, _super);
function ResourceDayTimeColsView() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.flattenResources = memoize(flattenResources);
_this.buildResourceTimeColsModel = memoize(buildResourceTimeColsModel);
_this.buildSlatMetas = memoize(buildSlatMetas);
return _this;
}
ResourceDayTimeColsView.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var options = context.options, dateEnv = context.dateEnv;
var dateProfile = props.dateProfile;
var splitProps = this.allDaySplitter.splitProps(props);
var resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER;
var resources = this.flattenResources(props.resourceStore, resourceOrderSpecs);
var resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context);
var slatMetas = this.buildSlatMetas(dateProfile.slotMinTime, dateProfile.slotMaxTime, options.slotLabelInterval, options.slotDuration, dateEnv);
var dayMinWidth = options.dayMinWidth;
var hasAttachedAxis = !dayMinWidth;
var hasDetachedAxis = dayMinWidth;
var headerContent = options.dayHeaders && (createElement(ResourceDayHeader, { resources: resources, dates: resourceDayTableModel.dayTableModel.headerDates, dateProfile: dateProfile, datesRepDistinctDays: true, renderIntro: hasAttachedAxis ? this.renderHeadAxis : null }));
var allDayContent = (options.allDaySlot !== false) && (function (contentArg) { return (createElement(ResourceDayTable, __assign({}, splitProps.allDay, { dateProfile: dateProfile, resourceDayTableModel: resourceDayTableModel, nextDayThreshold: options.nextDayThreshold, tableMinWidth: contentArg.tableMinWidth, colGroupNode: contentArg.tableColGroupNode, renderRowIntro: hasAttachedAxis ? _this.renderTableRowAxis : null, showWeekNumbers: false, expandRows: false, headerAlignElRef: _this.headerElRef, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, forPrint: props.forPrint }, _this.getAllDayMaxEventProps()))); });
var timeGridContent = function (contentArg) { return (createElement(ResourceDayTimeCols, __assign({}, splitProps.timed, { dateProfile: dateProfile, axis: hasAttachedAxis, slotDuration: options.slotDuration, slatMetas: slatMetas, resourceDayTableModel: resourceDayTableModel, tableColGroupNode: contentArg.tableColGroupNode, tableMinWidth: contentArg.tableMinWidth, clientWidth: contentArg.clientWidth, clientHeight: contentArg.clientHeight, onSlatCoords: _this.handleSlatCoords, expandRows: contentArg.expandRows, forPrint: props.forPrint, onScrollTopRequest: _this.handleScrollTopRequest }))); };
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
return hasDetachedAxis
? this.renderHScrollLayout(headerContent, allDayContent, timeGridContent, resourceDayTableModel.colCnt, dayMinWidth, slatMetas, this.state.slatCoords)
: this.renderSimpleLayout(headerContent, allDayContent, timeGridContent);
};
return ResourceDayTimeColsView;
}(TimeColsView));
function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) {
var dayTable = buildTimeColsModel(dateProfile, dateProfileGenerator);
return datesAboveResources ?
new DayResourceTableModel(dayTable, resources, context) :
new ResourceDayTableModel(dayTable, resources, context);
}
var resourceTimeGridPlugin = createPlugin({
deps: [
premiumCommonPlugin,
resourceCommonPlugin,
],
initialView: 'resourceTimeGridDay',
views: {
resourceTimeGrid: {
type: 'timeGrid',
component: ResourceDayTimeColsView,
},
resourceTimeGridDay: {
type: 'resourceTimeGrid',
},
resourceTimeGridWeek: {
type: 'resourceTimeGrid',
duration: { weeks: 1 },
},
},
});
/*
Renders the DOM responsible for the subrow expander area,
as well as the space before it (used to align expanders of similar depths)
*/
function ExpanderIcon(_a) {
var depth = _a.depth, hasChildren = _a.hasChildren, isExpanded = _a.isExpanded, onExpanderClick = _a.onExpanderClick;
var nodes = [];
for (var i = 0; i < depth; i += 1) {
nodes.push(createElement("span", { className: "fc-icon" }));
}
var iconClassNames = ['fc-icon'];
if (hasChildren) {
if (isExpanded) {
iconClassNames.push('fc-icon-minus-square');
}
else {
iconClassNames.push('fc-icon-plus-square');
}
}
nodes.push(createElement("span", { className: 'fc-datagrid-expander' + (hasChildren ? '' : ' fc-datagrid-expander-placeholder'), onClick: onExpanderClick },
createElement("span", { className: iconClassNames.join(' ') })));
return createElement.apply(void 0, __spreadArrays([Fragment, {}], nodes));
}
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
function refineHookProps$1(raw) {
return {
resource: new ResourceApi(raw.context, raw.resource),
fieldValue: raw.fieldValue,
view: raw.context.viewApi,
};
}
var SpreadsheetIndividualCellInner = /** @class */ (function (_super) {
__extends(SpreadsheetIndividualCellInner, _super);
function SpreadsheetIndividualCellInner() {
return _super !== null && _super.apply(this, arguments) || this;
}
SpreadsheetIndividualCellInner.prototype.render = function () {
var props = this.props;
return (createElement(ContentHook, { hookProps: props.hookProps, content: props.colSpec.cellContent, defaultContent: renderResourceInner }, function (innerElRef, innerContent) { return (createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent)); }));
};
return SpreadsheetIndividualCellInner;
}(BaseComponent));
function renderResourceInner(hookProps) {
return hookProps.fieldValue || createElement(Fragment, null, "\u00A0");
}
// worth making a PureComponent? (because of innerHeight)
var SpreadsheetIndividualCell = /** @class */ (function (_super) {
__extends(SpreadsheetIndividualCell, _super);
function SpreadsheetIndividualCell() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.refineHookProps = memoizeObjArg(refineHookProps$1);
_this.normalizeClassNames = buildClassNameNormalizer();
_this.onExpanderClick = function (ev) {
var props = _this.props;
if (props.hasChildren) {
_this.context.dispatch({
type: 'SET_RESOURCE_ENTITY_EXPANDED',
id: props.resource.id,
});
}
};
return _this;
}
SpreadsheetIndividualCell.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var colSpec = props.colSpec;
var hookProps = this.refineHookProps({
resource: props.resource,
fieldValue: props.fieldValue,
});
var customClassNames = this.normalizeClassNames(colSpec.cellClassNames, hookProps);
return (createElement(MountHook, { hookProps: hookProps, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, function (rootElRef) { return (createElement("td", { ref: rootElRef, "data-resource-id": props.resource.id, className: [
'fc-datagrid-cell',
'fc-resource',
].concat(customClassNames).join(' ') },
createElement("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } },
createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" },
colSpec.isMain && (createElement(ExpanderIcon, { depth: props.depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, onExpanderClick: _this.onExpanderClick })),
createElement(SpreadsheetIndividualCellInner, { hookProps: hookProps, colSpec: colSpec }))))); }));
};
return SpreadsheetIndividualCell;
}(BaseComponent));
// for VERTICAL cell grouping, in spreadsheet area
var SpreadsheetGroupCell = /** @class */ (function (_super) {
__extends(SpreadsheetGroupCell, _super);
function SpreadsheetGroupCell() {
return _super !== null && _super.apply(this, arguments) || this;
}
SpreadsheetGroupCell.prototype.render = function () {
var _a = this, props = _a.props, context = _a.context;
var colSpec = props.colSpec;
var hookProps = {
groupValue: props.fieldValue,
};
// a grouped cell. no data that is specific to this specific resource
// `colSpec` is for the group. a GroupSpec :(
return (createElement(RenderHook, { hookProps: hookProps, classNames: colSpec.cellClassNames, content: colSpec.cellContent, defaultContent: renderGroupInner, didMount: colSpec.cellDidMount, willUnmount: colSpec.cellWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (
// TODO: make data-attr with group value?
createElement("td", { className: ['fc-datagrid-cell', 'fc-resource-group'].concat(classNames).join(' '), rowSpan: props.rowSpan, ref: rootElRef },
createElement("div", { className: "fc-datagrid-cell-frame fc-datagrid-cell-frame-liquid" },
createElement("div", { className: "fc-datagrid-cell-cushion fc-sticky", ref: innerElRef }, innerContent)))); }));
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
};
return SpreadsheetGroupCell;
}(BaseComponent));
function renderGroupInner(hookProps) {
return hookProps.groupValue || createElement(Fragment, null, "\u00A0");
}
var SpreadsheetRow = /** @class */ (function (_super) {
__extends(SpreadsheetRow, _super);
function SpreadsheetRow() {
return _super !== null && _super.apply(this, arguments) || this;
}
SpreadsheetRow.prototype.render = function () {
var props = this.props;
var resource = props.resource, rowSpans = props.rowSpans, depth = props.depth;
var resourceFields = buildResourceFields(resource); // slightly inefficient. already done up the call stack
return (createElement("tr", null, props.colSpecs.map(function (colSpec, i) {
var rowSpan = rowSpans[i];
if (rowSpan === 0) { // not responsible for group-based rows. VRowGroup is
rowSpan = 1;
}
var fieldValue = colSpec.field ? resourceFields[colSpec.field] :
(resource.title || getPublicId(resource.id));
if (rowSpan > 1) {
return (createElement(SpreadsheetGroupCell, { key: i, colSpec: colSpec, fieldValue: fieldValue, rowSpan: rowSpan }));
}
return (createElement(SpreadsheetIndividualCell, { key: i, colSpec: colSpec, resource: resource, fieldValue: fieldValue, depth: depth, hasChildren: props.hasChildren, isExpanded: props.isExpanded, innerHeight: props.innerHeight }));
})));
};
return SpreadsheetRow;
}(BaseComponent));
SpreadsheetRow.addPropsEquality({
});
// for HORIZONTAL cell grouping, in spreadsheet area
var SpreadsheetGroupRow = /** @class */ (function (_super) {
__extends(SpreadsheetGroupRow, _super);
function SpreadsheetGroupRow() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.innerInnerRef = createRef();
_this.onExpanderClick = function () {
var props = _this.props;
_this.context.dispatch({
type: 'SET_RESOURCE_ENTITY_EXPANDED',
id: props.id,
});
};
return _this;
}
SpreadsheetGroupRow.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var hookProps = { groupValue: props.group.value, view: context.viewApi };
var spec = props.group.spec;
return (createElement("tr", null,
createElement(RenderHook, { hookProps: hookProps, classNames: spec.labelClassNames, content: spec.labelContent, defaultContent: renderCellInner, didMount: spec.labelDidMount, willUnmount: spec.labelWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, colSpan: props.spreadsheetColCnt, className: [
'fc-datagrid-cell',
'fc-resource-group',
context.theme.getClass('tableCellShaded'),
].concat(classNames).join(' ') },
createElement("div", { className: "fc-datagrid-cell-frame", style: { height: props.innerHeight } },
createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner", ref: _this.innerInnerRef },
createElement(ExpanderIcon, { depth: 0, hasChildren: true, isExpanded: props.isExpanded, onExpanderClick: _this.onExpanderClick }),
createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent))))); })));
};
return SpreadsheetGroupRow;
}(BaseComponent));
SpreadsheetGroupRow.addPropsEquality({
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
});
function renderCellInner(hookProps) {
return hookProps.groupValue || createElement(Fragment, null, "\u00A0");
}
var SPREADSHEET_COL_MIN_WIDTH = 20;
var SpreadsheetHeader = /** @class */ (function (_super) {
__extends(SpreadsheetHeader, _super);
function SpreadsheetHeader() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.resizerElRefs = new RefMap(_this._handleColResizerEl.bind(_this));
_this.colDraggings = {};
return _this;
}
SpreadsheetHeader.prototype.render = function () {
var _this = this;
var _a = this.props, colSpecs = _a.colSpecs, superHeaderRendering = _a.superHeaderRendering, rowInnerHeights = _a.rowInnerHeights;
var hookProps = { view: this.context.viewApi };
var rowNodes = [];
rowInnerHeights = rowInnerHeights.slice(); // copy, because we're gonna pop
if (superHeaderRendering) {
var rowInnerHeight_1 = rowInnerHeights.shift();
rowNodes.push(createElement("tr", { key: "row-super" },
createElement(RenderHook, { hookProps: hookProps, classNames: superHeaderRendering.headerClassNames, content: superHeaderRendering.headerContent, didMount: superHeaderRendering.headerDidMount, willUnmount: superHeaderRendering.headerWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("th", { colSpan: colSpecs.length, ref: rootElRef, className: [
'fc-datagrid-cell',
'fc-datagrid-cell-super',
].concat(classNames).join(' ') },
createElement("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight_1 } },
createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner", ref: innerElRef }, innerContent)))); })));
}
var rowInnerHeight = rowInnerHeights.shift();
rowNodes.push(createElement("tr", { key: "row" }, colSpecs.map(function (colSpec, i) {
var isLastCol = i === (colSpecs.length - 1);
// need empty inner div for abs positioning for resizer
return (createElement(RenderHook, { key: i, hookProps: hookProps, classNames: colSpec.headerClassNames, content: colSpec.headerContent, didMount: colSpec.headerDidMount, willUnmount: colSpec.headerWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("th", { ref: rootElRef, className: ['fc-datagrid-cell'].concat(classNames).join(' ') },
createElement("div", { className: "fc-datagrid-cell-frame", style: { height: rowInnerHeight } },
createElement("div", { className: "fc-datagrid-cell-cushion fc-scrollgrid-sync-inner" },
colSpec.isMain && (createElement("span", { className: "fc-datagrid-expander fc-datagrid-expander-placeholder" },
createElement("span", { className: "fc-icon" }))),
createElement("span", { className: "fc-datagrid-cell-main", ref: innerElRef }, innerContent)),
createElement("div", { className: "fc-datagrid-cell-resizer", ref: _this.resizerElRefs.createRef(i) })))); }));
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
})));
return (createElement(Fragment, null, rowNodes));
};
SpreadsheetHeader.prototype._handleColResizerEl = function (resizerEl, index) {
var colDraggings = this.colDraggings;
if (!resizerEl) {
var dragging = colDraggings[index];
if (dragging) {
dragging.destroy();
delete colDraggings[index];
}
}
else {
var dragging = this.initColResizing(resizerEl, parseInt(index, 10));
if (dragging) {
colDraggings[index] = dragging;
}
}
};
SpreadsheetHeader.prototype.initColResizing = function (resizerEl, index) {
var _a = this.context, pluginHooks = _a.pluginHooks, isRtl = _a.isRtl;
var onColWidthChange = this.props.onColWidthChange;
var ElementDraggingImpl = pluginHooks.elementDraggingImpl;
if (ElementDraggingImpl) {
var dragging = new ElementDraggingImpl(resizerEl);
var startWidth_1; // of just the single column
var currentWidths_1; // of all columns
dragging.emitter.on('dragstart', function () {
var allCells = findElements(elementClosest(resizerEl, 'tr'), 'th');
currentWidths_1 = allCells.map(function (cellEl) { return (cellEl.getBoundingClientRect().width); });
startWidth_1 = currentWidths_1[index];
});
dragging.emitter.on('dragmove', function (pev) {
currentWidths_1[index] = Math.max(startWidth_1 + pev.deltaX * (isRtl ? -1 : 1), SPREADSHEET_COL_MIN_WIDTH);
if (onColWidthChange) {
onColWidthChange(currentWidths_1.slice()); // send a copy since currentWidths continues to be mutated
}
});
dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area
return dragging;
}
};
return SpreadsheetHeader;
}(BaseComponent));
var ResourceTimelineLaneMisc = /** @class */ (function (_super) {
__extends(ResourceTimelineLaneMisc, _super);
function ResourceTimelineLaneMisc() {
return _super !== null && _super.apply(this, arguments) || this;
}
ResourceTimelineLaneMisc.prototype.render = function () {
var _a = this, props = _a.props, context = _a.context;
var hookProps = { resource: new ResourceApi(context, props.resource) }; // just easier to make directly
return (createElement(ContentHook, { hookProps: hookProps, content: context.options.resourceLaneContent }, function (innerElRef, innerContent) { return (innerContent && // TODO: test how this would interfere with height
createElement("div", { className: "fc-timeline-lane-misc", ref: innerElRef }, innerContent)); }));
};
return ResourceTimelineLaneMisc;
}(BaseComponent));
var ResourceTimelineLane = /** @class */ (function (_super) {
__extends(ResourceTimelineLane, _super);
function ResourceTimelineLane() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.refineHookProps = memoizeObjArg(refineHookProps$2);
_this.normalizeClassNames = buildClassNameNormalizer();
_this.handleHeightChange = function (innerEl, isStable) {
if (_this.props.onHeightChange) {
_this.props.onHeightChange(
// would want to use own <tr> ref, but not guaranteed to be ready when this fires
elementClosest(innerEl, 'tr'), isStable);
}
};
return _this;
}
ResourceTimelineLane.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, context = _a.context;
var options = context.options;
var hookProps = this.refineHookProps({ resource: props.resource, context: context });
var customClassNames = this.normalizeClassNames(options.resourceLaneClassNames, hookProps);
return (createElement("tr", { ref: props.elRef },
createElement(MountHook, { hookProps: hookProps, didMount: options.resourceLaneDidMount, willUnmount: options.resourceLaneWillUnmount }, function (rootElRef) { return (createElement("td", { ref: rootElRef, className: ['fc-timeline-lane', 'fc-resource'].concat(customClassNames).join(' '), "data-resource-id": props.resource.id },
createElement("div", { className: "fc-timeline-lane-frame", style: { height: props.innerHeight } },
createElement(ResourceTimelineLaneMisc, { resource: props.resource }),
createElement(TimelineLane, { dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: props.nextDayThreshold, businessHours: props.businessHours, eventStore: props.eventStore, eventUiBases: props.eventUiBases, dateSelection: props.dateSelection, eventSelection: props.eventSelection, eventDrag: props.eventDrag, eventResize: props.eventResize, timelineCoords: props.timelineCoords, onHeightChange: _this.handleHeightChange })))); }))); // important NOT to do liquid-height. dont want to shrink height smaller than content
};
return ResourceTimelineLane;
}(BaseComponent));
resource: new ResourceApi(raw.context, raw.resource),
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
};
}
/*
parallels the SpreadsheetGroupRow
*/
var DividerRow = /** @class */ (function (_super) {
__extends(DividerRow, _super);
function DividerRow() {
return _super !== null && _super.apply(this, arguments) || this;
}
DividerRow.prototype.render = function () {
var _this = this;
var props = this.props;
var renderingHooks = this.props.renderingHooks;
var hookProps = { groupValue: props.groupValue, view: this.context.viewApi };
return (createElement("tr", { ref: props.elRef },
createElement(RenderHook, { hookProps: hookProps, classNames: renderingHooks.laneClassNames, content: renderingHooks.laneContent, didMount: renderingHooks.laneDidMount, willUnmount: renderingHooks.laneWillUnmount }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("td", { ref: rootElRef, className: [
'fc-timeline-lane',
'fc-resource-group',
_this.context.theme.getClass('tableCellShaded'),
].concat(classNames).join(' ') },
createElement("div", { style: { height: props.innerHeight }, ref: innerElRef }, innerContent))); })));
};
return DividerRow;
}(BaseComponent));
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
var ResourceTimelineLanesBody = /** @class */ (function (_super) {
__extends(ResourceTimelineLanesBody, _super);
function ResourceTimelineLanesBody() {
return _super !== null && _super.apply(this, arguments) || this;
}
ResourceTimelineLanesBody.prototype.render = function () {
var _a = this, props = _a.props, context = _a.context;
var rowElRefs = props.rowElRefs, innerHeights = props.innerHeights;
return (createElement("tbody", null, props.rowNodes.map(function (node, index) {
if (node.group) {
return (createElement(DividerRow, { key: node.id, elRef: rowElRefs.createRef(node.id), groupValue: node.group.value, renderingHooks: node.group.spec, innerHeight: innerHeights[index] || '' }));
}
if (node.resource) {
var resource = node.resource;
return (createElement(ResourceTimelineLane, __assign({ key: node.id, elRef: rowElRefs.createRef(node.id) }, props.splitProps[resource.id], { resource: resource, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, nextDayThreshold: context.options.nextDayThreshold, businessHours: resource.businessHours || props.fallbackBusinessHours, innerHeight: innerHeights[index] || '', timelineCoords: props.slatCoords, onHeightChange: props.onRowHeightChange })));
}
return null;
})));
};
return ResourceTimelineLanesBody;
}(BaseComponent));
var ResourceTimelineLanes = /** @class */ (function (_super) {
__extends(ResourceTimelineLanes, _super);
function ResourceTimelineLanes() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.rootElRef = createRef();
_this.rowElRefs = new RefMap();
return _this;
}
ResourceTimelineLanes.prototype.render = function () {
var _a = this, props = _a.props, context = _a.context;
return (createElement("table", { ref: this.rootElRef, className: 'fc-scrollgrid-sync-table ' + context.theme.getClass('table'), style: {
minWidth: props.tableMinWidth,
width: props.clientWidth,
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
} },
createElement(ResourceTimelineLanesBody, { rowElRefs: this.rowElRefs, rowNodes: props.rowNodes, dateProfile: props.dateProfile, tDateProfile: props.tDateProfile, nowDate: props.nowDate, todayRange: props.todayRange, splitProps: props.splitProps, fallbackBusinessHours: props.fallbackBusinessHours, slatCoords: props.slatCoords, innerHeights: props.innerHeights, onRowHeightChange: props.onRowHeightChange })));
};
ResourceTimelineLanes.prototype.componentDidMount = function () {
this.updateCoords();
};
ResourceTimelineLanes.prototype.componentDidUpdate = function () {
this.updateCoords();
};
ResourceTimelineLanes.prototype.componentWillUnmount = function () {
if (this.props.onRowCoords) {
this.props.onRowCoords(null);
}
};
ResourceTimelineLanes.prototype.updateCoords = function () {
var props = this.props;
if (props.onRowCoords && props.clientWidth !== null) { // a populated clientWidth means sizing has stabilized
this.props.onRowCoords(new PositionCache(this.rootElRef.current, collectRowEls(this.rowElRefs.currentMap, props.rowNodes), false, true));
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
}
};
return ResourceTimelineLanes;
}(BaseComponent));
function collectRowEls(elMap, rowNodes) {
return rowNodes.map(function (rowNode) { return elMap[rowNode.id]; });
}
var ResourceTimelineGrid = /** @class */ (function (_super) {
__extends(ResourceTimelineGrid, _super);
function ResourceTimelineGrid() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.computeHasResourceBusinessHours = memoize(computeHasResourceBusinessHours);
_this.resourceSplitter = new ResourceSplitter(); // doesn't let it do businessHours tho
_this.bgSlicer = new TimelineLaneSlicer();
_this.slatsRef = createRef(); // needed for Hit creation :(
_this.state = {
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
};
_this.handleEl = function (el) {
if (el) {
_this.context.registerInteractiveComponent(_this, { el: el });
}
else {
_this.context.unregisterInteractiveComponent(_this);
}
};
_this.handleSlatCoords = function (slatCoords) {
_this.setState({ slatCoords: slatCoords });
if (_this.props.onSlatCoords) {
_this.props.onSlatCoords(slatCoords);
}
};
_this.handleRowCoords = function (rowCoords) {
_this.rowCoords = rowCoords;
if (_this.props.onRowCoords) {
_this.props.onRowCoords(rowCoords);
}
};
return _this;
}
ResourceTimelineGrid.prototype.render = function () {
var _this = this;
var _a = this, props = _a.props, state = _a.state, context = _a.context;
var dateProfile = props.dateProfile, tDateProfile = props.tDateProfile;
var timerUnit = greatestDurationDenominator(tDateProfile.slotDuration).unit;
var hasResourceBusinessHours = this.computeHasResourceBusinessHours(props.rowNodes);
var splitProps = this.resourceSplitter.splitProps(props);
var bgLaneProps = splitProps[''];
var bgSlicedProps = this.bgSlicer.sliceProps(bgLaneProps, dateProfile, tDateProfile.isTimeScale ? null : props.nextDayThreshold, context, // wish we didn't need to pass in the rest of these args...
dateProfile, context.dateProfileGenerator, tDateProfile, context.dateEnv);
// WORKAROUND: make ignore slatCoords when out of sync with dateProfile
var slatCoords = state.slatCoords && state.slatCoords.dateProfile === props.dateProfile ? state.slatCoords : null;
return (createElement("div", { ref: this.handleEl, className: "fc-timeline-body", style: { minWidth: props.tableMinWidth } },
createElement(NowTimer, { unit: timerUnit }, function (nowDate, todayRange) { return (createElement(Fragment, null,
createElement(TimelineSlats, { ref: _this.slatsRef, dateProfile: dateProfile, tDateProfile: tDateProfile, nowDate: nowDate, todayRange: todayRange, clientWidth: props.clientWidth, tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, onCoords: _this.handleSlatCoords, onScrollLeftRequest: props.onScrollLeftRequest }),
createElement(TimelineLaneBg, { businessHourSegs: hasResourceBusinessHours ? null : bgSlicedProps.businessHourSegs, bgEventSegs: bgSlicedProps.bgEventSegs, timelineCoords: slatCoords,
// empty array will result in unnecessary rerenders?
eventResizeSegs: (bgSlicedProps.eventResize ? bgSlicedProps.eventResize.segs : []), dateSelectionSegs: bgSlicedProps.dateSelectionSegs, nowDate: nowDate, todayRange: todayRange }),
createElement(ResourceTimelineLanes, { rowNodes: props.rowNodes, dateProfile: dateProfile, tDateProfile: props.tDateProfile, nowDate: nowDate, todayRange: todayRange, splitProps: splitProps, fallbackBusinessHours: hasResourceBusinessHours ? props.businessHours : null, clientWidth: props.clientWidth, minHeight: props.expandRows ? props.clientHeight : '', tableMinWidth: props.tableMinWidth, innerHeights: props.rowInnerHeights, slatCoords: slatCoords, onRowCoords: _this.handleRowCoords, onRowHeightChange: props.onRowHeightChange }),
(context.options.nowIndicator && slatCoords && slatCoords.isDateInRange(nowDate)) && (createElement("div", { className: "fc-timeline-now-indicator-container" },
createElement(NowIndicatorRoot, { isAxis: false, date: nowDate }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timeline-now-indicator-line'].concat(classNames).join(' '), style: { left: slatCoords.dateToCoord(nowDate) } }, innerContent)); }))))); })));
};
// Hit System
// ------------------------------------------------------------------------------------------
ResourceTimelineGrid.prototype.queryHit = function (positionLeft, positionTop) {
var rowCoords = this.rowCoords;
var rowIndex = rowCoords.topToIndex(positionTop);
if (rowIndex != null) {
var resource = this.props.rowNodes[rowIndex].resource;
if (resource) { // not a group
var slatHit = this.slatsRef.current.positionToHit(positionLeft);
if (slatHit) {
return {
component: this,
dateSpan: {
range: slatHit.dateSpan.range,
allDay: slatHit.dateSpan.allDay,
},
rect: {
left: slatHit.left,
right: slatHit.right,
top: rowCoords.tops[rowIndex],
},
dayEl: slatHit.dayEl,
};
}
}
}
};
return ResourceTimelineGrid;
}(DateComponent));
function computeHasResourceBusinessHours(rowNodes) {
for (var _i = 0, rowNodes_1 = rowNodes; _i < rowNodes_1.length; _i++) {
var node = rowNodes_1[_i];
var resource = node.resource;
if (resource && resource.businessHours) {
return true;
}
}
return false;
}
var MIN_RESOURCE_AREA_WIDTH = 30; // definitely bigger than scrollbars
var ResourceTimelineViewLayout = /** @class */ (function (_super) {
__extends(ResourceTimelineViewLayout, _super);
function ResourceTimelineViewLayout() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.scrollGridRef = createRef();
_this.timeBodyScrollerElRef = createRef();
_this.spreadsheetHeaderChunkElRef = createRef();
_this.rootElRef = createRef();
_this.state = {
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
};
return _this;
}
ResourceTimelineViewLayout.prototype.render = function () {
var _a = this, props = _a.props, state = _a.state, context = _a.context;
var options = context.options;
var stickyHeaderDates = !props.forPrint && getStickyHeaderDates(options);
var stickyFooterScrollbar = !props.forPrint && getStickyFooterScrollbar(options);
var sections = [
{
type: 'header',
key: 'header',
syncRowHeights: true,
isSticky: stickyHeaderDates,
chunks: [
{
key: 'datagrid',
elRef: this.spreadsheetHeaderChunkElRef,
// TODO: allow the content to specify this. have general-purpose 'content' with obj with keys
tableClassName: 'fc-datagrid-header',
rowContent: props.spreadsheetHeaderRows,
},
{
key: 'divider',
outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })),
},
{
key: 'timeline',
content: props.timeHeaderContent,
},
],
},
{
type: 'body',
key: 'body',
syncRowHeights: true,
liquid: true,
expandRows: Boolean(options.expandRows),
chunks: [
{
key: 'datagrid',
tableClassName: 'fc-datagrid-body',
},
{
key: 'divider',
outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })),
},
{
key: 'timeline',
scrollerElRef: this.timeBodyScrollerElRef,
content: props.timeBodyContent,
},
],
},
];
if (stickyFooterScrollbar) {
sections.push({
type: 'footer',
key: 'footer',
isSticky: true,
chunks: [
{
key: 'datagrid',
},
{
key: 'divider',
outerContent: (createElement("td", { className: 'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded') })),
},
{
key: 'timeline',
content: renderScrollShim,
},
],
});
}
var resourceAreaWidth = state.resourceAreaWidthOverride != null
? state.resourceAreaWidthOverride
: options.resourceAreaWidth;
return (createElement(ScrollGrid, { ref: this.scrollGridRef, elRef: this.rootElRef, liquid: !props.isHeightAuto && !props.forPrint, colGroups: [
{ cols: props.spreadsheetCols, width: resourceAreaWidth },
{ cols: [] },
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
], sections: sections }));
};
ResourceTimelineViewLayout.prototype.forceTimeScroll = function (left) {
var scrollGrid = this.scrollGridRef.current;
scrollGrid.forceScrollLeft(2, left); // 2 = the time area
};
ResourceTimelineViewLayout.prototype.forceResourceScroll = function (top) {
var scrollGrid = this.scrollGridRef.current;
scrollGrid.forceScrollTop(1, top); // 1 = the body
};
ResourceTimelineViewLayout.prototype.getResourceScroll = function () {
var timeBodyScrollerEl = this.timeBodyScrollerElRef.current;
return timeBodyScrollerEl.scrollTop;
};
// Resource Area Resizing
// ------------------------------------------------------------------------------------------
// NOTE: a callback Ref for the resizer was firing multiple times with same elements (Preact)
// that's why we use spreadsheetResizerElRef instead
ResourceTimelineViewLayout.prototype.componentDidMount = function () {
this.initSpreadsheetResizing();
};
ResourceTimelineViewLayout.prototype.componentWillUnmount = function () {
this.destroySpreadsheetResizing();
};
ResourceTimelineViewLayout.prototype.initSpreadsheetResizing = function () {
var _this = this;
var _a = this.context, isRtl = _a.isRtl, pluginHooks = _a.pluginHooks;
var ElementDraggingImpl = pluginHooks.elementDraggingImpl;
var spreadsheetHeadEl = this.spreadsheetHeaderChunkElRef.current;
if (ElementDraggingImpl) {
var rootEl_1 = this.rootElRef.current;
var dragging = this.spreadsheetResizerDragging = new ElementDraggingImpl(rootEl_1, '.fc-resource-timeline-divider');
var dragStartWidth_1;
var viewWidth_1;
dragging.emitter.on('dragstart', function () {
dragStartWidth_1 = spreadsheetHeadEl.getBoundingClientRect().width;
viewWidth_1 = rootEl_1.getBoundingClientRect().width;
});
dragging.emitter.on('dragmove', function (pev) {
var newWidth = dragStartWidth_1 + pev.deltaX * (isRtl ? -1 : 1);
newWidth = Math.max(newWidth, MIN_RESOURCE_AREA_WIDTH);
newWidth = Math.min(newWidth, viewWidth_1 - MIN_RESOURCE_AREA_WIDTH);
_this.setState({
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
});
});
dragging.setAutoScrollEnabled(false); // because gets weird with auto-scrolling time area
}
};
ResourceTimelineViewLayout.prototype.destroySpreadsheetResizing = function () {
if (this.spreadsheetResizerDragging) {
this.spreadsheetResizerDragging.destroy();
}
};
return ResourceTimelineViewLayout;
}(BaseComponent));
var ResourceTimelineView = /** @class */ (function (_super) {
__extends(ResourceTimelineView, _super);
function ResourceTimelineView(props, context) {
var _this = _super.call(this, props, context) || this;
_this.processColOptions = memoize(processColOptions);
_this.buildTimelineDateProfile = memoize(buildTimelineDateProfile);
_this.hasNesting = memoize(hasNesting);
_this.buildRowNodes = memoize(buildRowNodes);