mirror of https://github.com/abpframework/abp
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.
2 lines
21 KiB
2 lines
21 KiB
{"version":3,"sources":["../../../node_modules/tslib/tslib.es6.js","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"],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","GetFeatures","payload","this","type","UpdateFeatures","FeatureManagementService","rest","store","prototype","getFeatures","params","request","method","url","updateFeatures","_a","body","features","providerKey","providerName","Injectable","args","providedIn","RestService","Store","FeatureManagementState","featureManagementService","_b","patchState","pipe","tap","_","tslib_1.__decorate","Action","Selector","State","name","defaults","FeatureManagementComponent","visibleChange","EventEmitter","modalBusy","_visible","value","emit","openModal","Error","_this","dispatch","pluck","subscribe","buildForm","formGroupObj","FormControl","form","FormGroup","save","selectSnapshot","map","feature","finalize","visible","Component","selector","template","Input","Output","Select","Observable","FeatureManagementModule","NgModule","declarations","imports","CoreModule","ThemeSharedModule","NgxsModule","forFeature","exports"],"mappings":";;;;;;;;;;;;;;oFAoDO,SAASA,EAAWC,EAAYC,EAAQC,EAAKC,GAChD,IAA2HC,EAAvHC,EAAIC,UAAUC,OAAQC,EAAIH,EAAI,EAAIJ,EAAkB,OAATE,EAAgBA,EAAOM,OAAOC,yBAAyBT,EAAQC,GAAOC,EACrH,GAAuB,iBAAZQ,SAAoD,mBAArBA,QAAQC,SAAyBJ,EAAIG,QAAQC,SAASZ,EAAYC,EAAQC,EAAKC,QACpH,IAAK,IAAIU,EAAIb,EAAWO,OAAS,EAAGM,GAAK,EAAGA,KAAST,EAAIJ,EAAWa,MAAIL,GAAKH,E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AtBpC,EAASvB,GAAGiD,MAAoB,KAAO1B,EAASvB,GAAGiD,OAGvFzC,KAAKoD,KAAO,IAAIC,EAAAA,UAAUH,IAG5Bd,EAAA9B,UAAAgD,KAAA,WAAA,IAAAT,EAAA7C,KACE,IAAIA,KAAKuC,UAAT,CAEAvC,KAAKuC,WAAY,MAEbxB,EAAWf,KAAKK,MAAMkD,eAAehC,EAAuBhB,aAEhEQ,EAAWA,EAASyC,KAAG,SAAEC,EAASjE,GAAM,MAAA,CACtC0C,KAAMuB,EAAQvB,KACdO,MAAQI,EAAKO,KAAKX,MAAMjD,IAA6B,UAAvBqD,EAAKO,KAAKX,MAAMjD,GAAwBqD,EAAKO,KAAKX,MAAMjD,GAAvB,SAGjEQ,KAAKK,MACFyC,SACC,IAAI5C,EAAe,CACjBc,YAAahB,KAAKgB,YAClBC,aAAcjB,KAAKiB,aACnBF,SAAQA,KAGXY,KAAK+B,EAAAA,UAAQ,WAAO,OAACb,EAAKN,WAAY,MACtCS,WAAS,WACRH,EAAKc,SAAU,2BA1FtBC,EAAAA,UAASzC,KAAA,CAAC,CACT0C,SAAU,yBACVC,SAAA,+2CAVexC,EAAAA,8CAadyC,EAAAA,4BAGAA,EAAAA,uBAKAA,EAAAA,6BAYAC,EAAAA,UAGDlC,EAAAA,CADCmC,EAAAA,OAAO1C,EAAuBhB,6BACpB2D,EAAAA,6CAiEb9B,KCtGA,IAAA+B,EAAA,WAOA,SAAAA,KAKsC,2BALrCC,EAAAA,SAAQjD,KAAA,CAAC,CACRkD,aAAc,CAACjC,GACfkC,QAAS,CAACC,EAAAA,WAAYC,EAAAA,kBAAmBC,EAAAA,WAAWC,WAAW,CAACnD,KAChEoD,QAAS,CAACvC,OAE0B+B,EAZtC","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","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 protected _visible;\r\n\r\n @Input()\r\n get visible(): boolean {\r\n return this._visible;\r\n }\r\n\r\n set visible(value: boolean) {\r\n this._visible = value;\r\n this.visibleChange.emit(value);\r\n\r\n if (value) this.openModal();\r\n }\r\n\r\n @Output() readonly visibleChange = new EventEmitter<boolean>();\r\n\r\n @Select(FeatureManagementState.getFeatures)\r\n features$: Observable<FeatureManagement.Feature[]>;\r\n\r\n modalBusy = false;\r\n\r\n form: FormGroup;\r\n\r\n constructor(private store: Store) {}\r\n\r\n openModal() {\r\n if (!this.providerKey || !this.providerName) {\r\n throw new Error('Provider Key and Provider Name are required.');\r\n }\r\n\r\n this.getFeatures();\r\n }\r\n\r\n getFeatures() {\r\n this.store\r\n .dispatch(\r\n new GetFeatures({\r\n providerKey: this.providerKey,\r\n providerName: this.providerName,\r\n }),\r\n )\r\n .pipe(pluck('FeatureManagementState', 'features'))\r\n .subscribe(features => {\r\n this.buildForm(features);\r\n });\r\n }\r\n\r\n buildForm(features) {\r\n const formGroupObj = {};\r\n\r\n for (let i = 0; i < features.length; i++) {\r\n formGroupObj[i] = new FormControl(features[i].value === 'false' ? null : features[i].value);\r\n }\r\n\r\n this.form = new FormGroup(formGroupObj);\r\n }\r\n\r\n save() {\r\n if (this.modalBusy) return;\r\n\r\n this.modalBusy = true;\r\n\r\n let features = this.store.selectSnapshot(FeatureManagementState.getFeatures);\r\n\r\n features = features.map((feature, i) => ({\r\n name: feature.name,\r\n value: !this.form.value[i] || this.form.value[i] === 'false' ? null : this.form.value[i],\r\n }));\r\n\r\n this.store\r\n .dispatch(\r\n new UpdateFeatures({\r\n providerKey: this.providerKey,\r\n providerName: this.providerName,\r\n features,\r\n }),\r\n )\r\n .pipe(finalize(() => (this.modalBusy = false)))\r\n .subscribe(() => {\r\n this.visible = false;\r\n });\r\n }\r\n}\r\n","import { CoreModule } from '@abp/ng.core';\r\nimport { ThemeSharedModule } from '@abp/ng.theme.shared';\r\nimport { NgModule } from '@angular/core';\r\nimport { FeatureManagementComponent } from './components/feature-management/feature-management.component';\r\nimport { NgxsModule } from '@ngxs/store';\r\nimport { FeatureManagementState } from './states/feature-management.state';\r\n\r\n@NgModule({\r\n declarations: [FeatureManagementComponent],\r\n imports: [CoreModule, ThemeSharedModule, NgxsModule.forFeature([FeatureManagementState])],\r\n exports: [FeatureManagementComponent],\r\n})\r\nexport class FeatureManagementModule {}\r\n"]}
|