本文整理汇总了TypeScript中@providers/utils/text.CoreTextUtilsProvider类的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreTextUtilsProvider类的具体用法?TypeScript CoreTextUtilsProvider怎么用?TypeScript CoreTextUtilsProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreTextUtilsProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
action.fields.forEach((offlineContent) => {
if (typeof offlineContents[offlineContent.fieldid] == 'undefined') {
offlineContents[offlineContent.fieldid] = {};
}
if (offlineContent.subfield) {
offlineContents[offlineContent.fieldid][offlineContent.subfield] =
this.textUtils.parseJSON(offlineContent.value);
} else {
offlineContents[offlineContent.fieldid][''] = this.textUtils.parseJSON(offlineContent.value);
}
});
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:12,代码来源:helper.ts
示例2:
sites.forEach((site: any) => {
// Format the site name.
promises.push(this.textUtils.formatText(site.siteName, true, true).catch(() => {
return site.siteName;
}).then((formatted) => {
site.fullNameAndSiteName = this.translate.instant('core.fullnameandsitename',
{ fullname: site.fullName, sitename: formatted });
}));
});
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:9,代码来源:site-picker.ts
示例3: showStatus
/**
* Set image and description to show as completion icon.
*/
protected showStatus(): void {
const moduleName = this.moduleName || '';
let langKey,
image;
if (this.completion.tracking === 1 && this.completion.state === 0) {
image = 'completion-manual-n';
langKey = 'core.completion-alt-manual-n';
} else if (this.completion.tracking === 1 && this.completion.state === 1) {
image = 'completion-manual-y';
langKey = 'core.completion-alt-manual-y';
} else if (this.completion.tracking === 2 && this.completion.state === 0) {
image = 'completion-auto-n';
langKey = 'core.completion-alt-auto-n';
} else if (this.completion.tracking === 2 && this.completion.state === 1) {
image = 'completion-auto-y';
langKey = 'core.completion-alt-auto-y';
} else if (this.completion.tracking === 2 && this.completion.state === 2) {
image = 'completion-auto-pass';
langKey = 'core.completion-alt-auto-pass';
} else if (this.completion.tracking === 2 && this.completion.state === 3) {
image = 'completion-auto-fail';
langKey = 'core.completion-alt-auto-fail';
}
if (image) {
if (this.completion.overrideby > 0) {
image += '-override';
}
this.completionImage = 'assets/img/completion/' + image + '.svg';
}
if (moduleName) {
this.textUtils.formatText(moduleName, true, true, 50).then((modNameFormatted) => {
let promise;
if (this.completion.overrideby > 0) {
langKey += '-override';
promise = this.userProvider.getProfile(this.completion.overrideby, this.completion.courseId, true).then(
(profile) => {
return {
overrideuser: profile.fullname,
modname: modNameFormatted
};
});
} else {
promise = Promise.resolve(modNameFormatted);
}
return promise.then((translateParams) => {
this.completionDescription = this.translate.instant(langKey, { $a: translateParams });
});
});
}
}
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:59,代码来源:module-completion.ts
示例4: realGradeValueHelper
/**
* Calculates the real value of a grade based on real_grade_value.
*
* @param {number} value Percentual value from 0 to 100.
* @param {number} max The maximal grade.
* @param {number} decimals Decimals to show in the formatted grade.
* @return {string} Real grade formatted.
*/
protected realGradeValueHelper(value: number, max: number, decimals: number): string {
if (value == null) {
return null;
} else if (max == 0) {
return '0';
} else {
value = this.textUtils.roundToDecimals(max * value / 100, decimals);
return this.utils.formatFloat(value);
}
}
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:19,代码来源:helper.ts
示例5: init
/**
* Initialize field.
*/
protected init(): void {
if (this.isShowOrListMode()) {
this.component = AddonModDataProvider.COMPONENT;
this.componentId = this.database.coursemodule;
return;
}
let text;
// Check if rich text editor is enabled.
if (this.mode == 'edit') {
const files = (this.value && this.value.files) || [];
text = this.value ? this.textUtils.replacePluginfileUrls(this.value.content, files) : '';
}
this.addControl('f_' + this.field.id, text);
}
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:20,代码来源:textarea.ts
示例6: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
this.maxSize = Number(this.maxSize); // Make sure it's defined and it's a number.
this.maxSize = !isNaN(this.maxSize) && this.maxSize > 0 ? this.maxSize : -1;
if (this.maxSize == -1) {
this.maxSizeReadable = this.translate.instant('core.unknown');
} else {
this.maxSizeReadable = this.textUtils.bytesToSize(this.maxSize, 2);
}
if (typeof this.maxSubmissions == 'undefined' || this.maxSubmissions < 0) {
this.maxSubmissionsReadable = this.translate.instant('core.unknown');
this.unlimitedFiles = true;
} else {
this.maxSubmissionsReadable = String(this.maxSubmissions);
}
if (this.acceptedTypes && this.acceptedTypes.trim()) {
this.fileTypes = this.fileUploaderProvider.prepareFiletypeList(this.acceptedTypes);
}
}
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:24,代码来源:attachments.ts
示例7: format
/**
* Format value to be shown. Replacing plugin file Urls.
*
* @param {any} value Value to replace.
* @return {string} Replaced string to be rendered.
*/
format(value: any): string {
const files = (value && value.files) || [];
return value ? this.textUtils.replacePluginfileUrls(value.content, files) : '';
}
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:11,代码来源:textarea.ts
示例8: showInfo
showInfo(): void {
this.textUtils.expandText(this.title, this.info, this.component, this.componentId);
}
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:3,代码来源:navigation-bar.ts
示例9:
return this.file.createDir(destination, folder, true).then(() => {
// Folder created, add it to the destination path.
destination = this.textUtils.concatenatePaths(destination, folder);
});
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:4,代码来源:zip.ts
注:本文中的@providers/utils/text.CoreTextUtilsProvider类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论