You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/npm/ng-packs/dist/feature-management/fesm2015/abp-ng.feature-management.j...

2 lines
11 KiB

{"version":3,"file":"abp-ng.feature-management.js","sources":["ng://@abp/ng.feature-management/lib/actions/feature-management.actions.ts","ng://@abp/ng.feature-management/lib/services/feature-management.service.ts","ng://@abp/ng.feature-management/lib/states/feature-management.state.ts","ng://@abp/ng.feature-management/lib/components/feature-management/feature-management.component.ts","ng://@abp/ng.feature-management/lib/feature-management.module.ts"],"sourcesContent":["import { FeatureManagement } from '../models';\r\n\r\nexport class GetFeatures {\r\n static readonly type = '[FeatureManagement] Get Features';\r\n constructor(public payload: FeatureManagement.Provider) {}\r\n}\r\n\r\nexport class UpdateFeatures {\r\n static readonly type = '[FeatureManagement] Update Features';\r\n constructor(public payload: FeatureManagement.Provider & FeatureManagement.Features) {}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { RestService, Rest } from '@abp/ng.core';\r\nimport { Store } from '@ngxs/store';\r\nimport { Observable } from 'rxjs';\r\nimport { FeatureManagement } from '../models';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class FeatureManagementService {\r\n constructor(private rest: RestService, private store: Store) {}\r\n\r\n getFeatures(params: FeatureManagement.Provider): Observable<FeatureManagement.Features> {\r\n const request: Rest.Request<null> = {\r\n method: 'GET',\r\n url: '/api/abp/features',\r\n params,\r\n };\r\n return this.rest.request<FeatureManagement.Provider, FeatureManagement.Features>(request);\r\n }\r\n\r\n updateFeatures({\r\n features,\r\n providerKey,\r\n providerName,\r\n }: FeatureManagement.Provider & FeatureManagement.Features): Observable<null> {\r\n const request: Rest.Request<FeatureManagement.Features> = {\r\n method: 'PUT',\r\n url: '/api/abp/features',\r\n body: { features },\r\n params: { providerKey, providerName },\r\n };\r\n return this.rest.request<FeatureManagement.Features, null>(request);\r\n }\r\n}\r\n","import { Action, Selector, State, StateContext } from '@ngxs/store';\r\nimport { tap } from 'rxjs/operators';\r\nimport { GetFeatures, UpdateFeatures } from '../actions/feature-management.actions';\r\nimport { FeatureManagement } from '../models/feature-management';\r\nimport { FeatureManagementService } from '../services/feature-management.service';\r\n\r\n@State<FeatureManagement.State>({\r\n name: 'FeatureManagementState',\r\n defaults: { features: {} } as FeatureManagement.State,\r\n})\r\nexport class FeatureManagementState {\r\n @Selector()\r\n static getFeatures({ features }: FeatureManagement.State) {\r\n return features || [];\r\n }\r\n\r\n constructor(private featureManagementService: FeatureManagementService) {}\r\n\r\n @Action(GetFeatures)\r\n getFeatures({ patchState }: StateContext<FeatureManagement.State>, { payload }: GetFeatures) {\r\n return this.featureManagementService.getFeatures(payload).pipe(\r\n tap(({ features }) =>\r\n patchState({\r\n features,\r\n }),\r\n ),\r\n );\r\n }\r\n\r\n @Action(UpdateFeatures)\r\n updateFeatures(_, { payload }: UpdateFeatures) {\r\n return this.featureManagementService.updateFeatures(payload);\r\n }\r\n}\r\n","import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';\r\nimport { Select, Store } from '@ngxs/store';\r\nimport { Observable } from 'rxjs';\r\nimport { GetFeatures, UpdateFeatures } from '../../actions';\r\nimport { FeatureManagement } from '../../models/feature-management';\r\nimport { FeatureManagementState } from '../../states';\r\nimport { FormGroup, FormControl } from '@angular/forms';\r\nimport { pluck, finalize } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'abp-feature-management',\r\n templateUrl: './feature-management.component.html',\r\n})\r\nexport class FeatureManagementComponent {\r\n @Input()\r\n providerKey: string;\r\n\r\n @Input()\r\n providerName: string;\r\n\r\n protec