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


TypeScript core.createPlugin函数代码示例

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


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

示例1: expand

  },

  expand(rrule: RRule, framingRange: DateRange): DateMarker[] {
    // we WANT an inclusive start and in exclusive end, but the js rrule lib will only do either BOTH
    // inclusive or BOTH exclusive, which is stupid: https://github.com/jakubroztocil/rrule/issues/84
    // Workaround: make inclusive, which will generate extra occurences, and then trim.
    return rrule.between(framingRange.start, framingRange.end, true)
      .filter(function(date) {
        return date.valueOf() < framingRange.end.valueOf()
      })
  }

}

export default createPlugin({
  recurringTypes: [ recurring ]
})

function parseRRule(input, dateEnv: DateEnv) {
  let allDayGuess = null
  let rrule

  if (typeof input === 'string') {
    rrule = rrulestr(input)

  } else if (typeof input === 'object' && input) { // non-null object
    let refined = { ...input } // copy

    if (typeof refined.dtstart === 'string') {
      let dtstartMeta = dateEnv.createMarkerMeta(refined.dtstart)
开发者ID:fullcalendar,项目名称:fullcalendar,代码行数:30,代码来源:main.ts

示例2: offsetForArray

import moment from 'moment'

// can't simply import 'moment-timezone' because it attempts to load a JSON file,
// which the end-programmer might not have a loader setup for.
// the file we are importing is pre-built to have the lib + timezone data.
import 'moment-timezone/builds/moment-timezone-with-data'

import { NamedTimeZoneImpl, createPlugin } from '@fullcalendar/core'


class MomentNamedTimeZone extends NamedTimeZoneImpl {

  offsetForArray(a: number[]): number {
    return (moment as any).tz(a, this.timeZoneName).utcOffset()
  }

  timestampToArray(ms: number): number[] {
    return (moment as any).tz(ms, this.timeZoneName).toArray()
  }

}

export default createPlugin({
  namedTimeZonedImpl: MomentNamedTimeZone
})
开发者ID:fullcalendar,项目名称:fullcalendar,代码行数:25,代码来源:main.ts

示例3: createPlugin

export default createPlugin({
  viewConfigs: {

    list: {
      class: ListView,
      buttonTextKey: 'list', // what to lookup in locale files
      listDayFormat: { month: 'long', day: 'numeric', year: 'numeric' } // like "January 1, 2016"
    },

    listDay: {
      type: 'list',
      duration: { days: 1 },
      listDayFormat: { weekday: 'long' } // day-of-week is all we need. full date is probably in header
    },

    listWeek: {
      type: 'list',
      duration: { weeks: 1 },
      listDayFormat: { weekday: 'long' }, // day-of-week is more important
      listDayAltFormat: { month: 'long', day: 'numeric', year: 'numeric' }
    },

    listMonth: {
      type: 'list',
      duration: { month: 1 },
      listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
    },

    listYear: {
      type: 'list',
      duration: { year: 1 },
      listDayAltFormat: { weekday: 'long' } // day-of-week is nice-to-have
    }

  }
})
开发者ID:pjobs,项目名称:fullcalendar,代码行数:36,代码来源:main.ts

示例4: createPlugin

  popoverContent: 'card-body',

  // day grid
  // for left/right border color when border is inset from edges (all-day in timeGrid view)
  // avoid `table` class b/c don't want margins/padding/structure. only border color.
  headerRow: 'table-bordered',
  dayRow: 'table-bordered',

  // list view
  listView: 'card card-primary'
}

BootstrapTheme.prototype.baseIconClass = 'fa'
BootstrapTheme.prototype.iconClasses = {
  close: 'fa-times',
  prev: 'fa-chevron-left',
  next: 'fa-chevron-right',
  prevYear: 'fa-angle-double-left',
  nextYear: 'fa-angle-double-right'
}

BootstrapTheme.prototype.iconOverrideOption = 'bootstrapFontAwesome'
BootstrapTheme.prototype.iconOverrideCustomButtonOption = 'bootstrapFontAwesome'
BootstrapTheme.prototype.iconOverridePrefix = 'fa-'

export default createPlugin({
  themeClasses: {
    bootstrap: BootstrapTheme
  }
})
开发者ID:BorjaPintos,项目名称:fullcalendar,代码行数:30,代码来源:main.ts

示例5: createMomentFormatFunc

      createMomentFormatFunc(startMom),
      createMomentFormatFunc(endMom),
      arg.separator
    )
  }

  return convertToMoment(
    arg.date.array,
    arg.timeZone,
    arg.date.timeZoneOffset,
    arg.localeCodes[0]
  ).format(cmd.whole) // TODO: test for this
}

export default createPlugin({
  cmdFormatter: formatWithCmdStr
})


function createMomentFormatFunc(mom: moment.Moment) {
  return function(cmdStr) {
    return cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(
  }
}

function convertToMoment(input: any, timeZone: string, timeZoneOffset: number | null, locale: string): moment.Moment {
  let mom: moment.Moment

  if (timeZone === 'local') {
    mom = moment(input)
开发者ID:BorjaPintos,项目名称:fullcalendar,代码行数:30,代码来源:main.ts

示例6: arrayToLuxon

      cmd,
      start.toFormat.bind(start),
      end.toFormat.bind(end),
      arg.separator
    )
  }

  return arrayToLuxon(
    arg.date.array,
    arg.timeZone,
    arg.localeCodes[0]
  ).toFormat(cmd.whole)
}

export default createPlugin({
  cmdFormatter: formatWithCmdStr,
  namedTimeZonedImpl: LuxonNamedTimeZone
})


function luxonToArray(datetime: LuxonDateTime): number[] {
  return [
    datetime.year,
    datetime.month - 1, // convert 1-based to 0-based
    datetime.day,
    datetime.hour,
    datetime.minute,
    datetime.second,
    datetime.millisecond
  ]
}
开发者ID:BorjaPintos,项目名称:fullcalendar,代码行数:31,代码来源:main.ts

示例7: injectQsComponent

  // make the URLs for each event show times in the correct timezone
  if (url && gcalTimezone) {
    url = injectQsComponent(url, 'ctz=' + gcalTimezone)
  }

  return {
    id: item.id,
    title: item.summary,
    start: item.start.dateTime || item.start.date, // try timed. will fall back to all-day
    end: item.end.dateTime || item.end.date, // same
    url: url,
    location: item.location,
    description: item.description
  }
}


// Injects a string like "arg=value" into the querystring of a URL
// TODO: move to a general util file?
function injectQsComponent(url, component) {
  // inject it after the querystring but before the fragment
  return url.replace(/(\?.*?)?(#|$)/, function(whole, qs, hash) {
    return (qs ? qs + '&' : '?') + component + hash
  })
}

export default createPlugin({
  eventSourceDefs: [ eventSourceDef ]
})
开发者ID:BorjaPintos,项目名称:fullcalendar,代码行数:29,代码来源:main.ts


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