• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript jQuery.grep函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: querySources

  // matchInput can either by a real event source object, an ID, or the function/URL for the source.
  // returns an array of matching source objects.
  querySources(matchInput) {
    let sources = this.otherSources
    let i
    let source

    // given a proper event source object
    for (i = 0; i < sources.length; i++) {
      source = sources[i]

      if (source === matchInput) {
        return [ source ]
      }
    }

    // an ID match
    source = this.getSourceById(EventSource.normalizeId(matchInput))
    if (source) {
      return [ source ]
    }

    // parse as an event source
    matchInput = EventSourceParser.parse(matchInput, this.calendar)
    if (matchInput) {

      return $.grep(sources, function(source) {
        return isSourcesEquivalent(matchInput, source)
      })
    }
  }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:31,代码来源:EventManager.ts


示例2:

 $form.submit(function () {
         var paths = $.map($('input', $form), U.attrgetter('value'));
         // filter out empty paths
         paths = $.grep(paths, U.identity);
         ctrl.send('setpath', JSON.stringify(paths));
         return false;
     })
开发者ID:hraban,项目名称:lush,代码行数:7,代码来源:path.ts


示例3: renderBgRanges

  renderBgRanges(eventRanges) {
    // don't render timed background events
    eventRanges = $.grep(eventRanges, function(eventRange: any) {
      return eventRange.eventDef.isAllDay()
    })

    super.renderBgRanges(eventRanges)
  }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:8,代码来源:DayGridEventRenderer.ts


示例4: processOptions

  /* Options
  ------------------------------------------------------------------------------------------------------------------*/


  // Parses various options into properties of this object
  processOptions() {
    let slotDuration = this.opt('slotDuration')
    let snapDuration = this.opt('snapDuration')
    let input

    slotDuration = moment.duration(slotDuration)
    snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration

    this.slotDuration = slotDuration
    this.snapDuration = snapDuration
    this.snapsPerSlot = slotDuration / snapDuration // TODO: ensure an integer multiple?

    // might be an array value (for TimelineView).
    // if so, getting the most granular entry (the last one probably).
    input = this.opt('slotLabelFormat')
    if ($.isArray(input)) {
      input = input[input.length - 1]
    }

    this.labelFormat = input ||
      this.opt('smallTimeFormat') // the computed default

    let slots = this.opt('slots')
    if (slots && Array.isArray(slots)) {
      // filter valid slots
      slots = $.grep(slots, function(sl) {
        return sl.hasOwnProperty('start') && sl.hasOwnProperty('end') &&
          typeof(sl.start) === 'string' && typeof(sl.end) === 'string' &&
          sl.start.match(/^[0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?$/) &&
          sl.end.match(/^[0-9]{1,2}:[0-9]{1,2}(:[0-9]{1,2})?$/) &&
          true
      })
      if (slots.length >= 1) { // require at least 1 slot to display properly
        // sort slots by start time
        slots.sort(function(sl1, sl2) {
          let start1 = moment(sl1.start, 'HH:mm:ss')
          let start2 = moment(sl2.start, 'HH:mm:ss')
          if (start1.isBefore(start2)) {
            return -1
          } else if (start2.isBefore(start1)) {
            return 1
          } else {
            return 0
          }
        })

        // make sure each slot ends after it starts, and before the next one starts
        for (let i = 0; i < slots.length; i++) {
          let start1 = moment(slots[i].start, 'HH:mm:ss')
          let end1 = moment(slots[i].end, 'HH:mm:ss')
          if (end1.isBefore(start1)) {
            slots[i].end = slots[i].start
          }
          if (i + 1 < slots.length) {
            let start2 = moment(slots[i + 1].start, 'HH:mm:ss')
            if (start2.isBefore(end1)) {
              slots[i].end = slots[i + 1].start
            }
          }
        }
        this.slots = slots

        // options related to slots
        let showSlotEndTime = this.opt('showSlotEndTime')
        if (showSlotEndTime !== false) { // defaults to true
          this.showSlotEndTime = true
        }
        let showMinorSlotTime = this.opt('showMinorSlotTime')
        if (showMinorSlotTime !== false) { // defaults to true
          this.showMinorSlotTime = true
        }
        let snapOnSlots = this.opt('snapOnSlots')
        if (snapOnSlots && (snapOnSlots === true || // defaults to false
            snapOnSlots.hasOwnProperty('snapPolicy')
          )) {
          this.snapOnSlots = {
            snapPolicy: 'enlarge' // could also be 'closest'
          }
          if (snapOnSlots.snapPolicy === 'closest') {
            this.snapOnSlots.snapPolicy = 'closest'
          }
        }
      }
    }

    input = this.opt('slotLabelInterval')
    this.labelInterval = input ?
      moment.duration(input) :
      this.computeLabelInterval(slotDuration)
  }
开发者ID:kleisauke,项目名称:fullcalendar,代码行数:95,代码来源:TimeGrid.ts


示例5: function

 exec: function (field: string, ctx: JQuery): number {
     return $.grep($(getFieldSelector(field), ctx), function (n) {
         const val = $(n).val() + '';
         return val.length > 0;
     }).length;
 }
开发者ID:c17r,项目名称:jAutoCalc,代码行数:6,代码来源:functions.ts


示例6: getSourceById

 /*
 ID assumed to already be normalized
 */
 getSourceById(id) {
   return $.grep(this.otherSources, function(source: any) {
     return source.id && source.id === id
   })[0]
 }
开发者ID:caseyjhol,项目名称:fullcalendar,代码行数:8,代码来源:EventManager.ts


示例7: removeFalse

export function removeFalse(ar) {
    return $.grep(ar, identity);
}
开发者ID:hraban,项目名称:lush,代码行数:3,代码来源:utils.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript jQuery.inArray函数代码示例发布时间:2022-05-25
下一篇:
TypeScript jQuery.getJSON函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap