本文整理匯總了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 };
}
示例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') + ' ');
});
示例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);
}
示例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'));
});
示例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;
}
示例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);
}
示例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'));
});
示例8: expect
it should return a string in the Globalize format`, () => {
expect(mLFacetValue.formattedCount).toBe(Globalize.format(mLFacetValue.numberOfResults, 'n0'));
});