當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。