Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TimeGrid.prototype.renderSlatRowHtml = function (dateProfile) {
var _a = this, dateEnv = _a.dateEnv, theme = _a.theme, isRtl = _a.isRtl;
var html = '';
var dayStart = startOfDay(dateProfile.renderRange.start);
var slotTime = dateProfile.minTime;
var slotIterator = createDuration(0);
var slotDate; // will be on the view's first day, but we only care about its time
var isLabeled;
var axisHtml;
// Calculate the time for each slot
while (asRoughMs(slotTime) < asRoughMs(dateProfile.maxTime)) {
slotDate = dateEnv.add(dayStart, slotTime);
isLabeled = wholeDivideDurations(slotIterator, this.labelInterval) !== null;
axisHtml =
'' +
(isLabeled ?
'<span>' + // for matchCellWidths
htmlEscape(dateEnv.format(slotDate, this.labelFormat)) +
'</span>' :
'') +
'';
html +=
'' +
(!isRtl ? axisHtml : '') +
'' +
renderSlatRowHtml(dateProfile: DateProfile) {
let { dateEnv, theme, isRtl } = this.context
let html = ''
let dayStart = startOfDay(dateProfile.renderRange.start)
let slotTime = dateProfile.minTime
let slotIterator = createDuration(0)
let slotDate // will be on the view's first day, but we only care about its time
let isLabeled
let axisHtml
// Calculate the time for each slot
while (asRoughMs(slotTime) < asRoughMs(dateProfile.maxTime)) {
slotDate = dateEnv.add(dayStart, slotTime)
isLabeled = wholeDivideDurations(slotIterator, this.labelInterval) !== null
axisHtml =
'' +
(isLabeled ?
'<span>' + // for matchCellWidths
htmlEscape(dateEnv.format(slotDate, this.labelFormat)) +
'</span>' :
''
) +
''
html +=
'
computeTimeTop(duration: Duration) {
let len = this.slatEls.length
let dateProfile = this.props.dateProfile
let slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.minTime)) / asRoughMs(this.slotDuration) // floating-point value of # of slots covered
let slatIndex
let slatRemainder
// compute a floating-point number for how many slats should be progressed through.
// from 0 to number of slats (inclusive)
// constrained because minTime/maxTime might be customized.
slatCoverage = Math.max(0, slatCoverage)
slatCoverage = Math.min(len, slatCoverage)
// an integer index of the furthest whole slat
// from 0 to number slats (*exclusive*, so len-1)
slatIndex = Math.floor(slatCoverage)
slatIndex = Math.min(slatIndex, len - 1)
// how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
// could be 1.0 if slatCoverage is covering *all* the slots
TimeGrid.prototype.computeTimeTop = function (duration) {
var len = this.slatEls.length;
var dateProfile = this.props.dateProfile;
var slatCoverage = (duration.milliseconds - asRoughMs(dateProfile.minTime)) / asRoughMs(this.slotDuration); // floating-point value of # of slots covered
var slatIndex;
var slatRemainder;
// compute a floating-point number for how many slats should be progressed through.
// from 0 to number of slats (inclusive)
// constrained because minTime/maxTime might be customized.
slatCoverage = Math.max(0, slatCoverage);
slatCoverage = Math.min(len, slatCoverage);
// an integer index of the furthest whole slat
// from 0 to number slats (*exclusive*, so len-1)
slatIndex = Math.floor(slatCoverage);
slatIndex = Math.min(slatIndex, len - 1);
// how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
// could be 1.0 if slatCoverage is covering *all* the slots
slatRemainder = slatCoverage - slatIndex;
return this.slatPositions.tops[slatIndex] +
this.slatPositions.getHeight(slatIndex) * slatRemainder;