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


TypeScript globalize.format函数代码示例

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


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

示例1: getSummaryStrings

  private static getSummaryStrings(data: IQuerySuccessEventArgs): ISummaryStrings {
    const queryPerformed = data.query;
    const queryResults = data.results;

    const first = Globalize.format(queryPerformed.firstResult + 1, 'n0');
    const last = Globalize.format(queryPerformed.firstResult + queryResults.results.length, 'n0');
    const totalCount = Globalize.format(queryResults.totalCountFiltered, 'n0');
    const query = QuerySummaryUtils.sanitizeQuery(queryPerformed);

    return { first, last, totalCount, query };
  }
开发者ID:coveo,项目名称:search-ui,代码行数:11,代码来源:QuerySummaryUtils.ts

示例2: it

      it('dateField and dateFormat allow to render the values as date', function () {
        var start = new Date(1, 1, 1),
          end = new Date(2, 2, 2);
        slider = new Slider(el, {
          start: start,
          end: end,
          dateField: true,
          dateFormat: 'm/d/yyyy'
        }, root);

        slider.initializeState();
        expect($$(getSliderCaption(slider.element)).text()).toBe(Globalize.format(start, 'm/d/yyyy') + '  - ' + Globalize.format(end, 'm/d/yyyy') + ' ');
      });
开发者ID:vlarocque,项目名称:search-ui,代码行数:13,代码来源:SliderTest.ts

示例3: buildCollapsed

  private buildCollapsed() {
    let numberOfSelected = _.filter(this.collapsed, (value: FacetValue) => value.selected).length;
    let numberOfExcluded = _.filter(this.collapsed, (value: FacetValue) => value.excluded).length;
    Assert.check(numberOfSelected + numberOfExcluded == this.collapsed.length);

    var elem = $$('div', {
      className: 'coveo-facet-breadcrumb-value'
    });
    if (numberOfSelected > 0) {
      let multi = $$('span', {
        className: 'coveo-facet-breadcrumb-multi-count'
      });
      multi.text(l('NMore', Globalize.format(numberOfSelected, 'n0')));
      elem.el.appendChild(multi.el);
    }
    if (numberOfExcluded > 0) {
      let multiExcluded = $$('span', {
        className: 'coveo-facet-breadcrumb-multi-count'
      });
      multiExcluded.text(l('NMore', Globalize.format(numberOfExcluded, 'n0')));
      elem.el.appendChild(multiExcluded.el);
    }

    let valueElements = _.map(this.collapsed, facetValue => {
      return new this.breadcrumbValueElementKlass(this.facet, facetValue);
    });

    let toolTips = _.map(valueElements, valueElement => {
      return valueElement.getBreadcrumbTooltip();
    });

    elem.el.setAttribute('title', toolTips.join('\n'));
    elem.on('click', () => {
      var elements: HTMLElement[] = [];
      _.forEach(valueElements, valueElement => {
        elements.push(valueElement.build(false).el);
      });
      _.each(elements, el => {
        $$(el).insertBefore(elem.el);
      });
      elem.detach();
    });

    this.valueContainer.appendChild(elem.el);
  }
开发者ID:erocheleau,项目名称:search-ui,代码行数:45,代码来源:BreadcrumbValuesList.ts

示例4: it

      it('format should allow to render the result using the provided format', function () {
        test = Mock.optionsComponentSetup<Aggregate, IAggregateOptions>(Aggregate, {
          field: '@foobar',
          format: 'n0'
        });

        var results = FakeResults.createFakeResults(0);
        results.groupByResults = [FakeResults.createFakeGroupByResult('@foobar', 'foo', 10)];
        results.groupByResults[0].globalComputedFieldResults = [12345];

        Simulate.query(test.env, {
          results: results
        });

        expect($$(test.cmp.element).text()).toEqual(Globalize.format(12345, 'n0'));
      });
开发者ID:vlarocque,项目名称:search-ui,代码行数:16,代码来源:AggregateTest.ts

示例5: instantiateToString

 instantiateToString(object?: IQueryResult, instantiateOptions?: IInstantiateTemplateOptions): string {
   var preview =
     "<div class='coveo-result-frame'>" +
     "<div class='coveo-result-row'>" +
     "<div class='coveo-result-cell' style='width: 40px; padding-right:5px;vertical-align: middle'>" +
     "<a class='CoveoIcon' data-small='true'></a>" +
     '</div>' +
     "<div class='coveo-result-cell' style='font-size:13px;vertical-align: middle'>" +
     "<a class='CoveoResultLink'></a>" +
     '</div>' +
     "<div class='coveo-result-cell' style='width:80px; text-align:right; font-size:13px; padding-right: 5px;vertical-align: middle'>" +
     Globalize.format(parseInt(object.raw[this.computedField.slice(1)]), this.format) +
     '</div>' +
     '</div>' +
     '</div>';
   return preview;
 }
开发者ID:coveo,项目名称:search-ui,代码行数:17,代码来源:DefaultMatrixResultPreviewTemplate.ts

示例6: buildCollapsed

  private buildCollapsed() {
    let numberOfSelected = _.filter(this.collapsed, (value: FacetValue) => value.selected).length;
    let numberOfExcluded = _.filter(this.collapsed, (value: FacetValue) => value.excluded).length;
    Assert.check(numberOfSelected + numberOfExcluded == this.collapsed.length);

    var elem = $$('div', {
      className: 'coveo-facet-breadcrumb-value'
    });
    if (!DeviceUtils.isMobileDevice() && !this.facet.searchInterface.isNewDesign()) {
      let sep = $$('span', {
        className: 'coveo-separator'
      });
      sep.text(', ');
      elem.el.appendChild(sep.el);
    }
    if (numberOfSelected > 0) {
      let multi = $$('span', {
        className: 'coveo-facet-breadcrumb-multi-count'
      });
      multi.text(l('NMore', Globalize.format(numberOfSelected, 'n0')));
      elem.el.appendChild(multi.el);

      let multiIcon = $$('div', {
        className: 'coveo-selected coveo-facet-breadcrumb-multi-icon'
      });
      elem.el.appendChild(multiIcon.el);
    }
    if (numberOfExcluded > 0) {
      let multiExcluded = $$('span', {
        className: 'coveo-facet-breadcrumb-multi-count'
      });
      multiExcluded.text(l('NMore', Globalize.format(numberOfExcluded, 'n0')));
      elem.el.appendChild(multiExcluded.el);

      let multiExcludedIcon = $$('div', {
        className: 'coveo-excluded coveo-facet-breadcrumb-multi-icon'
      });
      elem.el.appendChild(multiExcludedIcon.el);
    }

    let valueElements = _.map(this.collapsed, (facetValue) => {
      return new this.breadcrumbValueElementKlass(this.facet, facetValue);
    });

    let toolTips = _.map(valueElements, (valueElement) => {
      return valueElement.getBreadcrumbTooltip();
    });

    elem.el.setAttribute('title', toolTips.join('\n'));
    elem.on('click', () => {
      var elements: HTMLElement[] = [];
      _.forEach(valueElements, (valueElement) => {
        if (!DeviceUtils.isMobileDevice() && !this.facet.searchInterface.isNewDesign()) {
          let separatorsClicked = $$('span', {
            className: 'coveo-facet-breadcrumb-separator'
          });
          separatorsClicked.text(', ');
          elements.push(separatorsClicked.el);
        }
        elements.push(valueElement.build(false).el);
      });
      _.each(elements, (el) => {
        $$(el).insertBefore(elem.el);
      });
      elem.detach();
    });

    this.valueContainer.appendChild(elem.el);
  }
开发者ID:vlarocque,项目名称:search-ui,代码行数:69,代码来源:BreadcrumbValuesList.ts

示例7: it

 it('should allow to get the cell value', function () {
   var value = test.cmp.getCellValue(5, 5);
   expect(value).toBe(Globalize.format(fakeResults.groupByResults[0].values[5].computedFieldResults[0], 'c0'));
 });
开发者ID:vlarocque,项目名称:search-ui,代码行数:4,代码来源:MatrixTest.ts

示例8: expect

   it should return a string in the Globalize format`, () => {
   expect(mLFacetValue.formattedCount).toBe(Globalize.format(mLFacetValue.numberOfResults, 'n0'));
 });
开发者ID:coveo,项目名称:search-ui,代码行数:3,代码来源:MLFacetValueTest.ts


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