Add moment dependency to the common libraries

pull/14017/head
Salih 3 years ago
parent 8e360a6aa4
commit f6e7cbb13d

@ -1,6 +1,7 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.BootstrapDatepicker;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQueryValidation;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Moment;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Timeago;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
@ -25,6 +26,15 @@ public class AbpAspNetCoreMvcUiPackagesModule : AbpModule
options.AddLanguageFilesMapOrUpdate(BootstrapDatepickerScriptContributor.PackageName,
new NameValue("zh-Hans", "zh-CN"),
new NameValue("zh-Hant", "zh-TW"));
//moment
options.AddLanguagesMapOrUpdate(MomentScriptContributor.PackageName,
new NameValue("zh-Hans", "zh-CN"),
new NameValue("zh-Hant", "zh-TW"));
options.AddLanguageFilesMapOrUpdate(MomentScriptContributor.PackageName,
new NameValue("zh-Hans", "zh-CN"),
new NameValue("zh-Hant", "zh-TW"));
//Timeago
options.AddLanguageFilesMapOrUpdate(TimeagoScriptContributor.PackageName,

@ -0,0 +1,28 @@
using System.Collections.Generic;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Moment;
public class MomentScriptContributor : BundleContributor
{
public const string PackageName = "moment";
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/moment/moment.js");
}
public override void ConfigureDynamicResources(BundleConfigurationContext context)
{
var fileName = context.LazyServiceProvider.LazyGetRequiredService<IOptions<AbpLocalizationOptions>>().Value.GetCurrentUICultureLanguageFilesMap(PackageName);
var filePath = $"/libs/moment/locale/{fileName}.js";
if (context.FileProvider.GetFileInfo(filePath).Exists)
{
context.Files.AddIfNotContains(filePath);
}
}
}

@ -14,6 +14,7 @@
"@abp/bootstrap": "~6.0.0-rc.3",
"@abp/bootstrap-datepicker": "~6.0.0-rc.3",
"@abp/bootstrap-daterangepicker": "file:../bootstrap-daterangepicker",
"@abp/moment":"file:../moment",
"@abp/datatables.net-bs5": "~6.0.0-rc.3",
"@abp/font-awesome": "~6.0.0-rc.3",
"@abp/jquery-form": "~6.0.0-rc.3",

@ -0,0 +1,6 @@
module.exports = {
mappings: {
"@node_modules/moment/moment.js": "@libs/moment/",
"@node_modules/moment/locale/*.*": "@libs/moment/locale/",
}
}

@ -0,0 +1,16 @@
{
"version": "6.0.0-rc.3",
"name": "@abp/moment",
"repository": {
"type": "git",
"url": "https://github.com/abpframework/abp.git",
"directory": "npm/packs/moment"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"moment": "^2.9.0"
},
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431"
}
Loading…
Cancel
Save