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