当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fullcalendar.isInt函数代码示例

本文整理汇总了TypeScript中fullcalendar.isInt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isInt函数的具体用法?TypeScript isInt怎么用?TypeScript isInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isInt函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: slatCellHtml

  slatCellHtml(date, isEm) {
    let classes
    const { theme } = this.calendar

    if (this.isTimeScale) {
      classes = []
      classes.push(
        isInt(divideRangeByDuration(this.normalizedUnzonedStart, date, this.labelInterval)) ?
          'fc-major' :
          'fc-minor'
      )
    } else {
      classes = this.getDayClasses(date)
      classes.push('fc-day')
    }

    classes.unshift(theme.getClass('widgetContent'))

    if (isEm) {
      classes.push('fc-em-cell')
    }

    return '<td class="' + classes.join(' ') + '"' +
      ' data-date="' + date.format() + '"' +
      '><div /></td>'
  }
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:26,代码来源:TimelineView.ts

示例2: validateLabelAndSlot

function validateLabelAndSlot(timelineView: TimelineView) {
  const { currentUnzonedRange } = timelineView.dateProfile

  // make sure labelInterval doesn't exceed the max number of cells
  if (timelineView.labelInterval) {
    const labelCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), timelineView.labelInterval)
    if (labelCnt > (core as any).MAX_TIMELINE_SLOTS) {
      core.warn('slotLabelInterval results in too many cells')
      timelineView.labelInterval = null
    }
  }

  // make sure slotDuration doesn't exceed the maximum number of cells
  if (timelineView.slotDuration) {
    const slotCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), timelineView.slotDuration)
    if (slotCnt > (core as any).MAX_TIMELINE_SLOTS) {
      core.warn('slotDuration results in too many cells')
      timelineView.slotDuration = null
    }
  }

  // make sure labelInterval is a multiple of slotDuration
  if (timelineView.labelInterval && timelineView.slotDuration) {
    const slotsPerLabel = core.divideDurationByDuration(timelineView.labelInterval, timelineView.slotDuration)
    if (!core.isInt(slotsPerLabel) || (slotsPerLabel < 1)) {
      core.warn('slotLabelInterval must be a multiple of slotDuration')
      return timelineView.slotDuration = null
    }
  }
}
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:30,代码来源:TimelineView.defaults.ts

示例3: ensureLabelInterval

function ensureLabelInterval(timelineView: TimelineView) {
  const { currentUnzonedRange } = timelineView.dateProfile
  let { labelInterval } = timelineView

  if (!labelInterval) {

    // compute based off the slot duration
    // find the largest label interval with an acceptable slots-per-label
    let input
    if (timelineView.slotDuration) {
      for (input of STOCK_SUB_DURATIONS) {
        const tryLabelInterval = moment.duration(input)
        const slotsPerLabel = core.divideDurationByDuration(tryLabelInterval, timelineView.slotDuration)
        if (core.isInt(slotsPerLabel) && (slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL)) {
          labelInterval = tryLabelInterval
          break
        }
      }

      // use the slot duration as a last resort
      if (!labelInterval) {
        labelInterval = timelineView.slotDuration
      }

    // compute based off the view's duration
    // find the largest label interval that yields the minimum number of labels
    } else {
      for (input of STOCK_SUB_DURATIONS) {
        labelInterval = moment.duration(input)
        const labelCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), labelInterval)
        if (labelCnt >= MIN_AUTO_LABELS) {
          break
        }
      }
    }

    timelineView.labelInterval = labelInterval
  }

  return labelInterval
}
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:41,代码来源:TimelineView.defaults.ts

示例4: computeDateSnapCoverage

  // returned value is between 0 and the number of snaps
  computeDateSnapCoverage(date) {
    const snapDiff = divideRangeByDuration(this.normalizedUnzonedStart, date, this.snapDuration)

    if (snapDiff < 0) {
      return 0
    } else if (snapDiff >= this.snapDiffToIndex.length) {
      return this.snapCnt
    } else {
      const snapDiffInt = Math.floor(snapDiff)
      let snapCoverage = this.snapDiffToIndex[snapDiffInt]

      if (isInt(snapCoverage)) { // not an in-between value
        snapCoverage += snapDiff - snapDiffInt // add the remainder
      } else {
        // a fractional value, meaning the date is not visible
        // always round up in this case. works for start AND end dates in a range.
        snapCoverage = Math.ceil(snapCoverage)
      }

      return snapCoverage
    }
  }
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:23,代码来源:TimelineView.ts

示例5: ensureSlotDuration

function ensureSlotDuration(timelineView: TimelineView) {
  const { currentUnzonedRange } = timelineView.dateProfile
  let { slotDuration } = timelineView

  if (!slotDuration) {
    const labelInterval = ensureLabelInterval(timelineView) // will compute if necessary

    // compute based off the label interval
    // find the largest slot duration that is different from labelInterval, but still acceptable
    for (let input of STOCK_SUB_DURATIONS) {
      const trySlotDuration = moment.duration(input)
      const slotsPerLabel = core.divideDurationByDuration(labelInterval, trySlotDuration)
      if (core.isInt(slotsPerLabel) && (slotsPerLabel > 1) && (slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL)) {
        slotDuration = trySlotDuration
        break
      }
    }

    // only allow the value if it won't exceed the view's # of slots limit
    if (slotDuration) {
      const slotCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), slotDuration)
      if (slotCnt > MAX_AUTO_CELLS) {
        slotDuration = null
      }
    }

    // use the label interval as a last resort
    if (!slotDuration) {
      slotDuration = labelInterval
    }

    timelineView.slotDuration = slotDuration
  }

  return slotDuration
}
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:36,代码来源:TimelineView.defaults.ts

示例6: renderSlatHtml

  renderSlatHtml() {
    let cell
    let date
    let rowCells
    let format
    const { theme } = this.calendar
    const { labelInterval } = this
    const formats = this.headerFormats
    const cellRows = formats.map((format) => []) // indexed by row,col
    let leadingCell = null
    let prevWeekNumber = null
    const { slotDates } = this
    const slotCells = [] // meta

    const rowUnits = formats.map((format) => (
      queryMostGranularFormatUnit(format)
    ))

    for (date of slotDates) {
      const weekNumber = date.week()
      const isWeekStart = this.emphasizeWeeks && (prevWeekNumber !== null) && (prevWeekNumber !== weekNumber)

      for (let row = 0; row < formats.length; row++) {
        format = formats[row]
        rowCells = cellRows[row]
        leadingCell = rowCells[rowCells.length - 1]
        const isSuperRow = (formats.length > 1) && (row < (formats.length - 1)) // more than one row and not the last
        let newCell = null

        if (isSuperRow) {
          let text = date.format(format)
          if (!leadingCell || (leadingCell.text !== text)) {
            newCell = this.buildCellObject(date, text, rowUnits[row])
          } else {
            leadingCell.colspan += 1
          }
        } else {
          if (!leadingCell || isInt(divideRangeByDuration(this.normalizedUnzonedStart, date, labelInterval))) {
            let text = date.format(format)
            newCell = this.buildCellObject(date, text, rowUnits[row])
          } else {
            leadingCell.colspan += 1
          }
        }

        if (newCell) {
          newCell.weekStart = isWeekStart
          rowCells.push(newCell)
        }
      }

      slotCells.push({ weekStart: isWeekStart })
      prevWeekNumber = weekNumber
    }

    const isChrono = labelInterval > this.slotDuration
    const isSingleDay = this.slotDuration.as('days') === 1

    let html = '<table class="' + theme.getClass('tableGrid') + '">'
    html += '<colgroup>'
    for (date of slotDates) {
      html += '<col/>'
    }
    html += '</colgroup>'
    html += '<tbody>'
    for (let i = 0; i < cellRows.length; i++) {
      rowCells = cellRows[i]
      const isLast = i === (cellRows.length - 1)
      html += '<tr' + (isChrono && isLast ? ' class="fc-chrono"' : '') + '>'

      for (cell of rowCells) {
        let headerCellClassNames = [ theme.getClass('widgetHeader') ]

        if (cell.weekStart) {
          headerCellClassNames.push('fc-em-cell')
        }
        if (isSingleDay) {
          headerCellClassNames = headerCellClassNames.concat(
            this.getDayClasses(cell.date, true) // adds "today" class and other day-based classes
          )
        }

        html +=
          '<th class="' + headerCellClassNames.join(' ') + '"' +
            ' data-date="' + cell.date.format() + '"' +
            (cell.colspan > 1 ? ' colspan="' + cell.colspan + '"' : '') +
          '>' +
            '<div class="fc-cell-content">' +
              cell.spanHtml +
            '</div>' +
          '</th>'
      }

      html += '</tr>'
    }
    html += '</tbody></table>'

    let slatHtml = '<table class="' + theme.getClass('tableGrid') + '">'
    slatHtml += '<colgroup>'
    for (cell of slotCells) {
//.........这里部分代码省略.........
开发者ID:diomed,项目名称:fullcalendar-scheduler,代码行数:101,代码来源:TimelineView.ts


注:本文中的fullcalendar.isInt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。