mirror of https://github.com/abpframework/abp
				
				
				
			
						commit
						388ec601c2
					
				| @ -0,0 +1,24 @@ | ||||
| name: 'Angular' | ||||
| on: | ||||
|   pull_request: | ||||
|     paths: | ||||
|       - 'npm/ng-packs/**' | ||||
|     branches: | ||||
|       #- master | ||||
|       - dev | ||||
|   push: | ||||
|     paths: | ||||
|       - 'npm/ng-packs/**' | ||||
|     branches: | ||||
|       #- master | ||||
|       - dev | ||||
| jobs: | ||||
|   build-test-lint: | ||||
|     runs-on: ubuntu-18.04 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v1 | ||||
|       - uses: actions/setup-node@v1 | ||||
|         with: | ||||
|           node-version: '10.x' | ||||
|       - run: yarn && yarn ci | ||||
|         working-directory: npm/ng-packs | ||||
| @ -1,60 +0,0 @@ | ||||
| language: csharp | ||||
| mono: none | ||||
| dotnet: 2.1.300 | ||||
| script: | ||||
|   - dotnet build framework | ||||
|   - dotnet build modules/users | ||||
|   - dotnet build modules/permission-management | ||||
|   - dotnet build modules/setting-management | ||||
|   - dotnet build modules/identity | ||||
|   - dotnet build modules/tenant-management | ||||
|   - dotnet build modules/account | ||||
|   - dotnet build modules/docs | ||||
|   - dotnet build modules/blogging | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.Mvc.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AspNetCore.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Auditing.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Authorization.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Autofac.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.AutoMapper.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Caching.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Castle.Core.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Core.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Data.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Ddd.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.EntityFrameworkCore.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.EventBus.Distributed.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.EventBus.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Http.Client.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Localization.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.MemoryDb.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.MongoDB.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.MultiTenancy.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Serialization.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.TestApp.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.UI.Navigation.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Uow.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.Validation.Tests | ||||
|   - dotnet test framework/test/Volo.Abp.VirtualFileSystem.Tests | ||||
|   - dotnet test modules/blogging/test/Volo.Blogging.Application.Tests | ||||
|   - dotnet test modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests | ||||
|   - dotnet test modules/identity/test/Volo.Abp.Identity.Domain.Tests | ||||
|   - dotnet test modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests | ||||
|   - dotnet test modules/identity/test/Volo.Abp.Identity.MongoDB.Tests | ||||
|   - dotnet test modules/identity/test/Volo.Abp.Identity.Application.Tests | ||||
|   - dotnet test modules/permission-management/test/Volo.Abp.PermissionManagement.Tests | ||||
|   - dotnet test modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests | ||||
|   - dotnet test modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests | ||||
|   - dotnet test modules/setting-management/test/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests | ||||
|   - dotnet test modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests | ||||
|   - dotnet test modules/setting-management/test/Volo.Abp.SettingManagement.Tests | ||||
|   - dotnet test modules/tenant-management/test/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests | ||||
|   - dotnet test modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests | ||||
|   - dotnet test modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests | ||||
|   - dotnet test modules/users/test/Volo.Abp.Users.MongoDB.Tests | ||||
|   - dotnet test modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests | ||||
|    | ||||
| @ -1 +1,2 @@ | ||||
| <h1> Abp Ng Packages </h1> | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| # @abp/ng.account.config | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'account-config', | ||||
| }; | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.account </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'account', | ||||
| }; | ||||
| @ -0,0 +1,35 @@ | ||||
| import { createHttpFactory, HttpMethod, SpectatorHttp } from '@ngneat/spectator/jest'; | ||||
| import { AccountService } from '../services/account.service'; | ||||
| import { Store } from '@ngxs/store'; | ||||
| import { RestService } from '@abp/ng.core'; | ||||
| import { RegisterRequest } from '../models/user'; | ||||
| 
 | ||||
| describe('AccountService', () => { | ||||
|   let spectator: SpectatorHttp<AccountService>; | ||||
|   const createHttp = createHttpFactory({ | ||||
|     dataService: AccountService, | ||||
|     providers: [RestService], | ||||
|     mocks: [Store], | ||||
|   }); | ||||
| 
 | ||||
|   beforeEach(() => (spectator = createHttp())); | ||||
| 
 | ||||
|   it('should send a GET to find tenant', () => { | ||||
|     spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); | ||||
|     spectator.service.findTenant('test').subscribe(); | ||||
|     spectator.expectOne('https://abp.io/api/abp/multi-tenancy/tenants/by-name/test', HttpMethod.GET); | ||||
|   }); | ||||
| 
 | ||||
|   it('should send a POST to register API', () => { | ||||
|     const mock = { | ||||
|       userName: 'test', | ||||
|       emailAddress: 'test@test.com', | ||||
|       password: 'test1234', | ||||
|       appName: 'Angular', | ||||
|     } as RegisterRequest; | ||||
|     spectator.get(Store).selectSnapshot.andReturn('https://abp.io'); | ||||
|     spectator.service.register(mock).subscribe(); | ||||
|     const req = spectator.expectOne('https://abp.io/api/account/register', HttpMethod.POST); | ||||
|     expect(req.request.body).toEqual(mock); | ||||
|   }); | ||||
| }); | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.core </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1,10 +1,6 @@ | ||||
| const { pathsToModuleNameMapper } = require('ts-jest/utils'); | ||||
| const { compilerOptions } = require('./tsconfig.spec'); | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'core', | ||||
|   moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '<rootDir>/' } */), | ||||
|   'ts-jest': { allowSyntheticDefaultImports: true }, | ||||
| }; | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| # @abp/ng.identity.config | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'identity-config', | ||||
| }; | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.identity </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.permission-management </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1,24 +1,3 @@ | ||||
| # SettingManagementConfig | ||||
| # @abp/ng.setting-management.config | ||||
| 
 | ||||
| This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.7. | ||||
| 
 | ||||
| ## Code scaffolding | ||||
| 
 | ||||
| Run `ng generate component component-name --project setting-management-config` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project setting-management-config`. | ||||
| > Note: Don't forget to add `--project setting-management-config` or else it will be added to the default project in your `angular.json` file.  | ||||
| 
 | ||||
| ## Build | ||||
| 
 | ||||
| Run `ng build setting-management-config` to build the project. The build artifacts will be stored in the `dist/` directory. | ||||
| 
 | ||||
| ## Publishing | ||||
| 
 | ||||
| After building your library with `ng build setting-management-config`, go to the dist folder `cd dist/setting-management-config` and run `npm publish`. | ||||
| 
 | ||||
| ## Running unit tests | ||||
| 
 | ||||
| Run `ng test setting-management-config` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||||
| 
 | ||||
| ## Further help | ||||
| 
 | ||||
| To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'setting-management-config', | ||||
| }; | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'setting-management', | ||||
| }; | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| # @abp/ng.tenant-management.config | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -0,0 +1,6 @@ | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'tenant-management-config', | ||||
| }; | ||||
| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/spec", | ||||
|     "types": ["node", "jest"] | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "esModuleInterop": true, | ||||
|     "outDir": "../../dist/out-tsc", | ||||
|     "module": "commonjs", | ||||
|     "types": ["jest", "node"] | ||||
|   }, | ||||
|   "files": [], | ||||
|   "include": ["**/*.spec.ts", "**/*.d.ts"] | ||||
| } | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.tenant-management </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.theme.basic </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1 +1,3 @@ | ||||
| <h1> @abp/ng.theme.shared </h1> | ||||
| 
 | ||||
| [docs.abp.io](https://docs.abp.io) | ||||
|  | ||||
| @ -1,10 +1,6 @@ | ||||
| const { pathsToModuleNameMapper } = require('ts-jest/utils'); | ||||
| const { compilerOptions } = require('./tsconfig.spec'); | ||||
| const jestConfig = require('../../jest.config'); | ||||
| 
 | ||||
| module.exports = { | ||||
|   ...jestConfig, | ||||
|   name: 'theme-shared', | ||||
|   moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '<rootDir>/' } */), | ||||
|   'ts-jest': { allowSyntheticDefaultImports: true }, | ||||
| }; | ||||
|  | ||||
| @ -0,0 +1,52 @@ | ||||
| import { Injectable, Optional } from '@angular/core'; | ||||
| import { NgbDateParserFormatter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; | ||||
| import { DatePipe } from '@angular/common'; | ||||
| 
 | ||||
| function padNumber(value: number) { | ||||
|   if (isNumber(value)) { | ||||
|     return `0${value}`.slice(-2); | ||||
|   } else { | ||||
|     return ''; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| function isNumber(value: any): boolean { | ||||
|   return !isNaN(toInteger(value)); | ||||
| } | ||||
| 
 | ||||
| function toInteger(value: any): number { | ||||
|   return parseInt(`${value}`, 10); | ||||
| } | ||||
| 
 | ||||
| @Injectable() | ||||
| export class DateParserFormatter extends NgbDateParserFormatter { | ||||
|   constructor(@Optional() private datePipe: DatePipe) { | ||||
|     super(); | ||||
|   } | ||||
| 
 | ||||
|   parse(value: string): NgbDateStruct { | ||||
|     if (value) { | ||||
|       const dateParts = value.trim().split('-'); | ||||
|       if (dateParts.length === 1 && isNumber(dateParts[0])) { | ||||
|         return { year: toInteger(dateParts[0]), month: null, day: null }; | ||||
|       } else if (dateParts.length === 2 && isNumber(dateParts[0]) && isNumber(dateParts[1])) { | ||||
|         return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: null }; | ||||
|       } else if (dateParts.length === 3 && isNumber(dateParts[0]) && isNumber(dateParts[1]) && isNumber(dateParts[2])) { | ||||
|         return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: toInteger(dateParts[2]) }; | ||||
|       } | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
| 
 | ||||
|   format(date: NgbDateStruct): string { | ||||
|     if (date && this.datePipe) { | ||||
|       return this.datePipe.transform(new Date(date.year, date.month, date.day), 'shortDate'); | ||||
|     } else { | ||||
|       return date | ||||
|         ? `${date.year}-${isNumber(date.month) ? padNumber(date.month) : ''}-${ | ||||
|             isNumber(date.day) ? padNumber(date.day) : '' | ||||
|           }` | ||||
|         : ''; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1 +1,2 @@ | ||||
| export * from './widget-utils'; | ||||
| export * from './date-parser-formatter'; | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue
	
	 liangshiwei
						liangshiwei