@abp/ng.feature-management 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/abp-ng.feature-management.d.ts +5 -5
- package/bundles/abp-ng.feature-management-proxy.umd.js +28 -28
- package/bundles/abp-ng.feature-management-proxy.umd.js.map +1 -1
- package/bundles/abp-ng.feature-management.umd.js +534 -534
- package/bundles/abp-ng.feature-management.umd.js.map +1 -1
- package/esm2015/abp-ng.feature-management.js +4 -4
- package/esm2015/lib/components/feature-management/feature-management.component.js +158 -158
- package/esm2015/lib/components/index.js +2 -2
- package/esm2015/lib/directives/free-text-input.directive.js +37 -37
- package/esm2015/lib/directives/index.js +2 -2
- package/esm2015/lib/enums/components.js +2 -2
- package/esm2015/lib/feature-management.module.js +22 -22
- package/esm2015/lib/models/feature-management.js +2 -2
- package/esm2015/lib/models/index.js +2 -2
- package/esm2015/proxy/abp-ng.feature-management-proxy.js +4 -4
- package/esm2015/proxy/lib/index.js +3 -3
- package/esm2015/proxy/lib/proxy/feature-management/features.service.js +30 -30
- package/esm2015/proxy/lib/proxy/feature-management/index.js +3 -3
- package/esm2015/proxy/lib/proxy/feature-management/models.js +2 -2
- package/esm2015/proxy/lib/proxy/validation/index.js +3 -3
- package/esm2015/proxy/lib/proxy/validation/string-values/index.js +2 -2
- package/esm2015/proxy/lib/proxy/validation/string-values/models.js +2 -2
- package/esm2015/proxy/public-api.js +2 -2
- package/esm2015/public-api.js +6 -6
- package/fesm2015/abp-ng.feature-management-proxy.js +26 -26
- package/fesm2015/abp-ng.feature-management-proxy.js.map +1 -1
- package/fesm2015/abp-ng.feature-management.js +192 -192
- package/fesm2015/abp-ng.feature-management.js.map +1 -1
- package/lib/components/feature-management/feature-management.component.d.ts +49 -49
- package/lib/components/index.d.ts +1 -1
- package/lib/directives/free-text-input.directive.d.ts +21 -21
- package/lib/directives/index.d.ts +1 -1
- package/lib/enums/components.d.ts +3 -3
- package/lib/feature-management.module.d.ts +11 -11
- package/lib/models/feature-management.d.ts +11 -11
- package/lib/models/index.d.ts +1 -1
- package/package.json +3 -3
- package/proxy/abp-ng.feature-management-proxy.d.ts +5 -5
- package/proxy/lib/index.d.ts +2 -2
- package/proxy/lib/proxy/feature-management/features.service.d.ts +12 -12
- package/proxy/lib/proxy/feature-management/index.d.ts +2 -2
- package/proxy/lib/proxy/feature-management/models.d.ts +30 -30
- package/proxy/lib/proxy/validation/index.d.ts +2 -2
- package/proxy/lib/proxy/validation/string-values/index.d.ts +1 -1
- package/proxy/lib/proxy/validation/string-values/models.d.ts +11 -11
- package/proxy/public-api.d.ts +1 -1
- package/public-api.d.ts +5 -5
|
@@ -11,204 +11,204 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
|
|
|
11
11
|
import * as i5 from '@angular/common';
|
|
12
12
|
import * as i6 from '@angular/forms';
|
|
13
13
|
|
|
14
|
-
const INPUT_TYPES = {
|
|
15
|
-
numeric: 'number',
|
|
16
|
-
default: 'text',
|
|
17
|
-
};
|
|
18
|
-
class FreeTextInputDirective {
|
|
19
|
-
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
20
|
-
set feature(val) {
|
|
21
|
-
this._feature = val;
|
|
22
|
-
this.setInputType();
|
|
23
|
-
}
|
|
24
|
-
get feature() {
|
|
25
|
-
return this._feature;
|
|
26
|
-
}
|
|
27
|
-
setInputType() {
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
const validatorType = (_c = (_b = (_a = this.feature) === null || _a === void 0 ? void 0 : _a.valueType) === null || _b === void 0 ? void 0 : _b.validator) === null || _c === void 0 ? void 0 : _c.name.toLowerCase();
|
|
30
|
-
this.type = (_d = INPUT_TYPES[validatorType]) !== null && _d !== void 0 ? _d : INPUT_TYPES.default;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
FreeTextInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FreeTextInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
34
|
-
FreeTextInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: FreeTextInputDirective, selector: "input[abpFeatureManagementFreeText]", inputs: { feature: ["abpFeatureManagementFreeText", "feature"] }, host: { properties: { "type": "this.type" } }, exportAs: ["inputAbpFeatureManagementFreeText"], ngImport: i0 });
|
|
35
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FreeTextInputDirective, decorators: [{
|
|
36
|
-
type: Directive,
|
|
37
|
-
args: [{
|
|
38
|
-
selector: 'input[abpFeatureManagementFreeText]',
|
|
39
|
-
exportAs: 'inputAbpFeatureManagementFreeText',
|
|
40
|
-
}]
|
|
41
|
-
}], propDecorators: { feature: [{
|
|
42
|
-
type: Input,
|
|
43
|
-
args: ['abpFeatureManagementFreeText']
|
|
44
|
-
}], type: [{
|
|
45
|
-
type: HostBinding,
|
|
46
|
-
args: ['type']
|
|
14
|
+
const INPUT_TYPES = {
|
|
15
|
+
numeric: 'number',
|
|
16
|
+
default: 'text',
|
|
17
|
+
};
|
|
18
|
+
class FreeTextInputDirective {
|
|
19
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
20
|
+
set feature(val) {
|
|
21
|
+
this._feature = val;
|
|
22
|
+
this.setInputType();
|
|
23
|
+
}
|
|
24
|
+
get feature() {
|
|
25
|
+
return this._feature;
|
|
26
|
+
}
|
|
27
|
+
setInputType() {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
const validatorType = (_c = (_b = (_a = this.feature) === null || _a === void 0 ? void 0 : _a.valueType) === null || _b === void 0 ? void 0 : _b.validator) === null || _c === void 0 ? void 0 : _c.name.toLowerCase();
|
|
30
|
+
this.type = (_d = INPUT_TYPES[validatorType]) !== null && _d !== void 0 ? _d : INPUT_TYPES.default;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
FreeTextInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FreeTextInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
34
|
+
FreeTextInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: FreeTextInputDirective, selector: "input[abpFeatureManagementFreeText]", inputs: { feature: ["abpFeatureManagementFreeText", "feature"] }, host: { properties: { "type": "this.type" } }, exportAs: ["inputAbpFeatureManagementFreeText"], ngImport: i0 });
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FreeTextInputDirective, decorators: [{
|
|
36
|
+
type: Directive,
|
|
37
|
+
args: [{
|
|
38
|
+
selector: 'input[abpFeatureManagementFreeText]',
|
|
39
|
+
exportAs: 'inputAbpFeatureManagementFreeText',
|
|
40
|
+
}]
|
|
41
|
+
}], propDecorators: { feature: [{
|
|
42
|
+
type: Input,
|
|
43
|
+
args: ['abpFeatureManagementFreeText']
|
|
44
|
+
}], type: [{
|
|
45
|
+
type: HostBinding,
|
|
46
|
+
args: ['type']
|
|
47
47
|
}] } });
|
|
48
48
|
|
|
49
|
-
var ValueTypes;
|
|
50
|
-
(function (ValueTypes) {
|
|
51
|
-
ValueTypes["ToggleStringValueType"] = "ToggleStringValueType";
|
|
52
|
-
ValueTypes["FreeTextStringValueType"] = "FreeTextStringValueType";
|
|
53
|
-
ValueTypes["SelectionStringValueType"] = "SelectionStringValueType";
|
|
54
|
-
})(ValueTypes || (ValueTypes = {}));
|
|
55
|
-
class FeatureManagementComponent {
|
|
56
|
-
constructor(track, service, configState) {
|
|
57
|
-
this.track = track;
|
|
58
|
-
this.service = service;
|
|
59
|
-
this.configState = configState;
|
|
60
|
-
this.groups = [];
|
|
61
|
-
this.valueTypes = ValueTypes;
|
|
62
|
-
this.visibleChange = new EventEmitter();
|
|
63
|
-
this.modalBusy = false;
|
|
64
|
-
}
|
|
65
|
-
get visible() {
|
|
66
|
-
return this._visible;
|
|
67
|
-
}
|
|
68
|
-
set visible(value) {
|
|
69
|
-
if (this._visible === value)
|
|
70
|
-
return;
|
|
71
|
-
this._visible = value;
|
|
72
|
-
this.visibleChange.emit(value);
|
|
73
|
-
if (value)
|
|
74
|
-
this.openModal();
|
|
75
|
-
}
|
|
76
|
-
openModal() {
|
|
77
|
-
if (!this.providerName) {
|
|
78
|
-
throw new Error('providerName is required.');
|
|
79
|
-
}
|
|
80
|
-
this.getFeatures();
|
|
81
|
-
}
|
|
82
|
-
getFeatures() {
|
|
83
|
-
this.service.get(this.providerName, this.providerKey).subscribe(res => {
|
|
84
|
-
var _a;
|
|
85
|
-
if (!((_a = res.groups) === null || _a === void 0 ? void 0 : _a.length))
|
|
86
|
-
return;
|
|
87
|
-
this.groups = res.groups.map(({ name, displayName }) => ({ name, displayName }));
|
|
88
|
-
this.selectedGroupDisplayName = this.groups[0].displayName;
|
|
89
|
-
this.features = res.groups.reduce((acc, val) => (Object.assign(Object.assign({}, acc), { [val.name]: mapFeatures(val.features, document.body.dir) })), {});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
save() {
|
|
93
|
-
if (this.modalBusy)
|
|
94
|
-
return;
|
|
95
|
-
const changedFeatures = [];
|
|
96
|
-
Object.keys(this.features).forEach(key => {
|
|
97
|
-
this.features[key].forEach(feature => {
|
|
98
|
-
if (feature.value !== feature.initialValue)
|
|
99
|
-
changedFeatures.push({ name: feature.name, value: `${feature.value}` });
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
if (!changedFeatures.length) {
|
|
103
|
-
this.visible = false;
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
this.modalBusy = true;
|
|
107
|
-
this.service
|
|
108
|
-
.update(this.providerName, this.providerKey, { features: changedFeatures })
|
|
109
|
-
.pipe(finalize(() => (this.modalBusy = false)))
|
|
110
|
-
.subscribe(() => {
|
|
111
|
-
this.visible = false;
|
|
112
|
-
if (!this.providerKey) {
|
|
113
|
-
// to refresh host's features
|
|
114
|
-
this.configState.refreshAppState().subscribe();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
onCheckboxClick(val, feature) {
|
|
119
|
-
if (val) {
|
|
120
|
-
this.checkToggleAncestors(feature);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.uncheckToggleDescendants(feature);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
uncheckToggleDescendants(feature) {
|
|
127
|
-
this.findAllDescendantsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node => this.setFeatureValue(node, false));
|
|
128
|
-
}
|
|
129
|
-
checkToggleAncestors(feature) {
|
|
130
|
-
this.findAllAncestorsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node => this.setFeatureValue(node, true));
|
|
131
|
-
}
|
|
132
|
-
findAllAncestorsOfByType(feature, type) {
|
|
133
|
-
let parent = this.findParentByType(feature, type);
|
|
134
|
-
const ancestors = [];
|
|
135
|
-
while (parent) {
|
|
136
|
-
ancestors.push(parent);
|
|
137
|
-
parent = this.findParentByType(parent, type);
|
|
138
|
-
}
|
|
139
|
-
return ancestors;
|
|
140
|
-
}
|
|
141
|
-
findAllDescendantsOfByType(feature, type) {
|
|
142
|
-
const descendants = [];
|
|
143
|
-
const queue = [feature];
|
|
144
|
-
while (queue.length) {
|
|
145
|
-
const node = queue.pop();
|
|
146
|
-
const newDescendants = this.findChildrenByType(node, type);
|
|
147
|
-
descendants.push(...newDescendants);
|
|
148
|
-
queue.push(...newDescendants);
|
|
149
|
-
}
|
|
150
|
-
return descendants;
|
|
151
|
-
}
|
|
152
|
-
findParentByType(feature, type) {
|
|
153
|
-
return this.getCurrentGroup().find(f => f.valueType.name === type && f.name === feature.parentName);
|
|
154
|
-
}
|
|
155
|
-
findChildrenByType(feature, type) {
|
|
156
|
-
return this.getCurrentGroup().filter(f => f.valueType.name === type && f.parentName === feature.name);
|
|
157
|
-
}
|
|
158
|
-
getCurrentGroup() {
|
|
159
|
-
var _a;
|
|
160
|
-
return (_a = this.features[this.selectedGroupDisplayName]) !== null && _a !== void 0 ? _a : [];
|
|
161
|
-
}
|
|
162
|
-
setFeatureValue(feature, val) {
|
|
163
|
-
feature.value = val;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
FeatureManagementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementComponent, deps: [{ token: i1.TrackByService }, { token: i2.FeaturesService }, { token: i1.ConfigStateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
167
|
-
FeatureManagementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: FeatureManagementComponent, selector: "abp-feature-management", inputs: { providerKey: "providerKey", providerName: "providerName", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, exportAs: ["abpFeatureManagement"], ngImport: i0, template: "<abp-modal *ngIf=\"visible\" [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\
|
|
168
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementComponent, decorators: [{
|
|
169
|
-
type: Component,
|
|
170
|
-
args: [{
|
|
171
|
-
selector: 'abp-feature-management',
|
|
172
|
-
templateUrl: './feature-management.component.html',
|
|
173
|
-
exportAs: 'abpFeatureManagement',
|
|
174
|
-
}]
|
|
175
|
-
}], ctorParameters: function () { return [{ type: i1.TrackByService }, { type: i2.FeaturesService }, { type: i1.ConfigStateService }]; }, propDecorators: { providerKey: [{
|
|
176
|
-
type: Input
|
|
177
|
-
}], providerName: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], visible: [{
|
|
180
|
-
type: Input
|
|
181
|
-
}], visibleChange: [{
|
|
182
|
-
type: Output
|
|
183
|
-
}] } });
|
|
184
|
-
function mapFeatures(features, dir) {
|
|
185
|
-
const margin = `margin-${dir === 'rtl' ? 'right' : 'left'}.px`;
|
|
186
|
-
return features.map(feature => {
|
|
187
|
-
var _a;
|
|
188
|
-
const value = ((_a = feature.valueType) === null || _a === void 0 ? void 0 : _a.name) === ValueTypes.ToggleStringValueType
|
|
189
|
-
? (feature.value || '').toLowerCase() === 'true'
|
|
190
|
-
: feature.value;
|
|
191
|
-
return Object.assign(Object.assign({}, feature), { value, initialValue: value, style: { [margin]: feature.depth * 20 } });
|
|
192
|
-
});
|
|
49
|
+
var ValueTypes;
|
|
50
|
+
(function (ValueTypes) {
|
|
51
|
+
ValueTypes["ToggleStringValueType"] = "ToggleStringValueType";
|
|
52
|
+
ValueTypes["FreeTextStringValueType"] = "FreeTextStringValueType";
|
|
53
|
+
ValueTypes["SelectionStringValueType"] = "SelectionStringValueType";
|
|
54
|
+
})(ValueTypes || (ValueTypes = {}));
|
|
55
|
+
class FeatureManagementComponent {
|
|
56
|
+
constructor(track, service, configState) {
|
|
57
|
+
this.track = track;
|
|
58
|
+
this.service = service;
|
|
59
|
+
this.configState = configState;
|
|
60
|
+
this.groups = [];
|
|
61
|
+
this.valueTypes = ValueTypes;
|
|
62
|
+
this.visibleChange = new EventEmitter();
|
|
63
|
+
this.modalBusy = false;
|
|
64
|
+
}
|
|
65
|
+
get visible() {
|
|
66
|
+
return this._visible;
|
|
67
|
+
}
|
|
68
|
+
set visible(value) {
|
|
69
|
+
if (this._visible === value)
|
|
70
|
+
return;
|
|
71
|
+
this._visible = value;
|
|
72
|
+
this.visibleChange.emit(value);
|
|
73
|
+
if (value)
|
|
74
|
+
this.openModal();
|
|
75
|
+
}
|
|
76
|
+
openModal() {
|
|
77
|
+
if (!this.providerName) {
|
|
78
|
+
throw new Error('providerName is required.');
|
|
79
|
+
}
|
|
80
|
+
this.getFeatures();
|
|
81
|
+
}
|
|
82
|
+
getFeatures() {
|
|
83
|
+
this.service.get(this.providerName, this.providerKey).subscribe(res => {
|
|
84
|
+
var _a;
|
|
85
|
+
if (!((_a = res.groups) === null || _a === void 0 ? void 0 : _a.length))
|
|
86
|
+
return;
|
|
87
|
+
this.groups = res.groups.map(({ name, displayName }) => ({ name, displayName }));
|
|
88
|
+
this.selectedGroupDisplayName = this.groups[0].displayName;
|
|
89
|
+
this.features = res.groups.reduce((acc, val) => (Object.assign(Object.assign({}, acc), { [val.name]: mapFeatures(val.features, document.body.dir) })), {});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
save() {
|
|
93
|
+
if (this.modalBusy)
|
|
94
|
+
return;
|
|
95
|
+
const changedFeatures = [];
|
|
96
|
+
Object.keys(this.features).forEach(key => {
|
|
97
|
+
this.features[key].forEach(feature => {
|
|
98
|
+
if (feature.value !== feature.initialValue)
|
|
99
|
+
changedFeatures.push({ name: feature.name, value: `${feature.value}` });
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
if (!changedFeatures.length) {
|
|
103
|
+
this.visible = false;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.modalBusy = true;
|
|
107
|
+
this.service
|
|
108
|
+
.update(this.providerName, this.providerKey, { features: changedFeatures })
|
|
109
|
+
.pipe(finalize(() => (this.modalBusy = false)))
|
|
110
|
+
.subscribe(() => {
|
|
111
|
+
this.visible = false;
|
|
112
|
+
if (!this.providerKey) {
|
|
113
|
+
// to refresh host's features
|
|
114
|
+
this.configState.refreshAppState().subscribe();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
onCheckboxClick(val, feature) {
|
|
119
|
+
if (val) {
|
|
120
|
+
this.checkToggleAncestors(feature);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.uncheckToggleDescendants(feature);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
uncheckToggleDescendants(feature) {
|
|
127
|
+
this.findAllDescendantsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node => this.setFeatureValue(node, false));
|
|
128
|
+
}
|
|
129
|
+
checkToggleAncestors(feature) {
|
|
130
|
+
this.findAllAncestorsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node => this.setFeatureValue(node, true));
|
|
131
|
+
}
|
|
132
|
+
findAllAncestorsOfByType(feature, type) {
|
|
133
|
+
let parent = this.findParentByType(feature, type);
|
|
134
|
+
const ancestors = [];
|
|
135
|
+
while (parent) {
|
|
136
|
+
ancestors.push(parent);
|
|
137
|
+
parent = this.findParentByType(parent, type);
|
|
138
|
+
}
|
|
139
|
+
return ancestors;
|
|
140
|
+
}
|
|
141
|
+
findAllDescendantsOfByType(feature, type) {
|
|
142
|
+
const descendants = [];
|
|
143
|
+
const queue = [feature];
|
|
144
|
+
while (queue.length) {
|
|
145
|
+
const node = queue.pop();
|
|
146
|
+
const newDescendants = this.findChildrenByType(node, type);
|
|
147
|
+
descendants.push(...newDescendants);
|
|
148
|
+
queue.push(...newDescendants);
|
|
149
|
+
}
|
|
150
|
+
return descendants;
|
|
151
|
+
}
|
|
152
|
+
findParentByType(feature, type) {
|
|
153
|
+
return this.getCurrentGroup().find(f => f.valueType.name === type && f.name === feature.parentName);
|
|
154
|
+
}
|
|
155
|
+
findChildrenByType(feature, type) {
|
|
156
|
+
return this.getCurrentGroup().filter(f => f.valueType.name === type && f.parentName === feature.name);
|
|
157
|
+
}
|
|
158
|
+
getCurrentGroup() {
|
|
159
|
+
var _a;
|
|
160
|
+
return (_a = this.features[this.selectedGroupDisplayName]) !== null && _a !== void 0 ? _a : [];
|
|
161
|
+
}
|
|
162
|
+
setFeatureValue(feature, val) {
|
|
163
|
+
feature.value = val;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
FeatureManagementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementComponent, deps: [{ token: i1.TrackByService }, { token: i2.FeaturesService }, { token: i1.ConfigStateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
167
|
+
FeatureManagementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.13", type: FeatureManagementComponent, selector: "abp-feature-management", inputs: { providerKey: "providerKey", providerName: "providerName", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, exportAs: ["abpFeatureManagement"], ngImport: i0, template: "<abp-modal *ngIf=\"visible\" [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\n <ng-template #abpHeader>\n <h3>{{ 'AbpFeatureManagement::Features' | abpLocalization }}</h3>\n </ng-template>\n\n <ng-template #abpBody>\n <div class=\"row\">\n <div class=\"col-md-4\">\n <ul\n ngbNav\n #nav=\"ngbNav\"\n [(activeId)]=\"selectedGroupDisplayName\"\n class=\"nav-pills\"\n orientation=\"vertical\"\n >\n <li\n *ngFor=\"let group of groups; trackBy: track.by('name')\"\n [ngbNavItem]=\"group.displayName\"\n >\n <a ngbNavLink>{{ group.displayName }}</a>\n <ng-template ngbNavContent>\n <h4>{{ selectedGroupDisplayName }}</h4>\n <hr class=\"mt-2 mb-3\" />\n\n <div\n class=\"mt-2\"\n *ngFor=\"let feature of features[group.name]; let i = index; trackBy: track.by('id')\"\n [ngStyle]=\"feature.style\"\n [ngSwitch]=\"feature.valueType?.name\"\n (keyup.enter)=\"save()\"\n >\n <ng-container *ngSwitchCase=\"valueTypes.ToggleStringValueType\">\n <div class=\"form-check\">\n <input\n class=\"form-check-input\"\n type=\"checkbox\"\n [id]=\"feature.name\"\n [(ngModel)]=\"feature.value\"\n (ngModelChange)=\"onCheckboxClick($event, feature)\"\n />\n\n <label class=\"form-check-label\" [htmlFor]=\"feature.name\">{{\n feature.displayName\n }}</label>\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"valueTypes.FreeTextStringValueType\">\n <div class=\"mb-3 form-group\">\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\n feature.displayName\n }}</label>\n <input\n class=\"form-control\"\n type=\"text\"\n [id]=\"feature.name\"\n [(ngModel)]=\"feature.value\"\n [abpFeatureManagementFreeText]=\"feature\"\n />\n\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"valueTypes.SelectionStringValueType\">\n <ng-container *ngIf=\"feature.valueType.itemSource?.items?.length\">\n <div class=\"mb-3 form-group\">\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\n feature.displayName\n }}</label>\n <select class=\"form-select\" [id]=\"feature.name\" [(ngModel)]=\"feature.value\">\n <option\n *ngFor=\"\n let item of feature.valueType.itemSource?.items;\n trackBy: track.by('value')\n \"\n [ngValue]=\"item.value\"\n >\n {{\n item.displayText?.resourceName + '::' + item.displayText?.name\n | abpLocalization\n }}\n </option>\n </select>\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>{{ feature.displayName }}</ng-container>\n </div>\n </ng-template>\n </li>\n </ul>\n </div>\n\n <ng-template #descTmp let-description>\n <small *ngIf=\"description\" class=\"d-block form-text text-muted\">{{ description }}</small>\n </ng-template>\n\n <div class=\"col-md-8\"><div [ngbNavOutlet]=\"nav\"></div></div>\n\n <div class=\"mx-3\" *ngIf=\"!groups.length\">\n {{ 'AbpFeatureManagement::NoFeatureFoundMessage' | abpLocalization }}\n </div>\n </div>\n </ng-template>\n\n <ng-template #abpFooter>\n <button abpClose type=\"button\" class=\"btn btn-secondary\">\n {{ 'AbpFeatureManagement::Cancel' | abpLocalization }}\n </button>\n <abp-button\n *ngIf=\"groups.length\"\n iconClass=\"fa fa-check\"\n [disabled]=\"modalBusy\"\n (click)=\"save()\"\n >\n {{ 'AbpFeatureManagement::Save' | abpLocalization }}\n </abp-button>\n </ng-template>\n</abp-modal>\n", components: [{ type: i3.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { type: i4.NgbNavOutlet, selector: "[ngbNavOutlet]", inputs: ["paneRole", "ngbNavOutlet"] }, { type: i3.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgbNav, selector: "[ngbNav]", inputs: ["animation", "destroyOnHide", "orientation", "roles", "keyboard", "activeId"], outputs: ["activeIdChange", "shown", "hidden", "navChange"], exportAs: ["ngbNav"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgbNavItem, selector: "[ngbNavItem]", inputs: ["disabled", "domId", "destroyOnHide", "ngbNavItem"], outputs: ["shown", "hidden"], exportAs: ["ngbNavItem"] }, { type: i4.NgbNavLink, selector: "a[ngbNavLink]" }, { type: i4.NgbNavContent, selector: "ng-template[ngbNavContent]" }, { type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: FreeTextInputDirective, selector: "input[abpFeatureManagementFreeText]", inputs: ["abpFeatureManagementFreeText"], exportAs: ["inputAbpFeatureManagementFreeText"] }, { type: i6.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i6.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i6.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i3.ModalCloseDirective, selector: "[abpClose]" }], pipes: { "abpLocalization": i1.LocalizationPipe } });
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementComponent, decorators: [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{
|
|
171
|
+
selector: 'abp-feature-management',
|
|
172
|
+
templateUrl: './feature-management.component.html',
|
|
173
|
+
exportAs: 'abpFeatureManagement',
|
|
174
|
+
}]
|
|
175
|
+
}], ctorParameters: function () { return [{ type: i1.TrackByService }, { type: i2.FeaturesService }, { type: i1.ConfigStateService }]; }, propDecorators: { providerKey: [{
|
|
176
|
+
type: Input
|
|
177
|
+
}], providerName: [{
|
|
178
|
+
type: Input
|
|
179
|
+
}], visible: [{
|
|
180
|
+
type: Input
|
|
181
|
+
}], visibleChange: [{
|
|
182
|
+
type: Output
|
|
183
|
+
}] } });
|
|
184
|
+
function mapFeatures(features, dir) {
|
|
185
|
+
const margin = `margin-${dir === 'rtl' ? 'right' : 'left'}.px`;
|
|
186
|
+
return features.map(feature => {
|
|
187
|
+
var _a;
|
|
188
|
+
const value = ((_a = feature.valueType) === null || _a === void 0 ? void 0 : _a.name) === ValueTypes.ToggleStringValueType
|
|
189
|
+
? (feature.value || '').toLowerCase() === 'true'
|
|
190
|
+
: feature.value;
|
|
191
|
+
return Object.assign(Object.assign({}, feature), { value, initialValue: value, style: { [margin]: feature.depth * 20 } });
|
|
192
|
+
});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
const exported = [FeatureManagementComponent, FreeTextInputDirective];
|
|
196
|
-
class FeatureManagementModule {
|
|
197
|
-
}
|
|
198
|
-
FeatureManagementModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
199
|
-
FeatureManagementModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, declarations: [FeatureManagementComponent, FreeTextInputDirective], imports: [CoreModule, ThemeSharedModule, NgbNavModule], exports: [FeatureManagementComponent, FreeTextInputDirective] });
|
|
200
|
-
FeatureManagementModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, imports: [[CoreModule, ThemeSharedModule, NgbNavModule]] });
|
|
201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, decorators: [{
|
|
202
|
-
type: NgModule,
|
|
203
|
-
args: [{
|
|
204
|
-
declarations: [...exported],
|
|
205
|
-
imports: [CoreModule, ThemeSharedModule, NgbNavModule],
|
|
206
|
-
exports: [...exported],
|
|
207
|
-
}]
|
|
195
|
+
const exported = [FeatureManagementComponent, FreeTextInputDirective];
|
|
196
|
+
class FeatureManagementModule {
|
|
197
|
+
}
|
|
198
|
+
FeatureManagementModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
199
|
+
FeatureManagementModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, declarations: [FeatureManagementComponent, FreeTextInputDirective], imports: [CoreModule, ThemeSharedModule, NgbNavModule], exports: [FeatureManagementComponent, FreeTextInputDirective] });
|
|
200
|
+
FeatureManagementModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, imports: [[CoreModule, ThemeSharedModule, NgbNavModule]] });
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0, type: FeatureManagementModule, decorators: [{
|
|
202
|
+
type: NgModule,
|
|
203
|
+
args: [{
|
|
204
|
+
declarations: [...exported],
|
|
205
|
+
imports: [CoreModule, ThemeSharedModule, NgbNavModule],
|
|
206
|
+
exports: [...exported],
|
|
207
|
+
}]
|
|
208
208
|
}] });
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
* Generated bundle index. Do not edit.
|
|
210
|
+
/**
|
|
211
|
+
* Generated bundle index. Do not edit.
|
|
212
212
|
*/
|
|
213
213
|
|
|
214
214
|
export { FeatureManagementComponent, FeatureManagementModule, FreeTextInputDirective, INPUT_TYPES };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abp-ng.feature-management.js","sources":["../../../../packages/feature-management/src/lib/directives/free-text-input.directive.ts","../../../../packages/feature-management/src/lib/components/feature-management/feature-management.component.ts","../../../../packages/feature-management/src/lib/components/feature-management/feature-management.component.html","../../../../packages/feature-management/src/lib/feature-management.module.ts","../../../../packages/feature-management/src/abp-ng.feature-management.ts"],"sourcesContent":["import { Directive, HostBinding, Input } from '@angular/core';\r\n\r\n// TODO: improve this type\r\nexport interface FreeTextType {\r\n valueType: {\r\n validator: {\r\n name: string;\r\n };\r\n };\r\n}\r\n\r\nexport const INPUT_TYPES = {\r\n numeric: 'number',\r\n default: 'text',\r\n};\r\n\r\n@Directive({\r\n selector: 'input[abpFeatureManagementFreeText]',\r\n exportAs: 'inputAbpFeatureManagementFreeText',\r\n})\r\nexport class FreeTextInputDirective {\r\n _feature: FreeTextType;\r\n // eslint-disable-next-line @angular-eslint/no-input-rename\r\n @Input('abpFeatureManagementFreeText') set feature(val: FreeTextType) {\r\n this._feature = val;\r\n this.setInputType();\r\n }\r\n\r\n get feature() {\r\n return this._feature;\r\n }\r\n\r\n @HostBinding('type') type: string;\r\n\r\n private setInputType() {\r\n const validatorType = this.feature?.valueType?.validator?.name.toLowerCase();\r\n this.type = INPUT_TYPES[validatorType] ?? INPUT_TYPES.default;\r\n }\r\n}\r\n","import { ConfigStateService, TrackByService } from '@abp/ng.core';\r\nimport {\r\n FeatureDto,\r\n FeatureGroupDto,\r\n FeaturesService,\r\n UpdateFeatureDto,\r\n} from '@abp/ng.feature-management/proxy';\r\nimport { LocaleDirection } from '@abp/ng.theme.shared';\r\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\r\nimport { finalize } from 'rxjs/operators';\r\nimport { FeatureManagement } from '../../models/feature-management';\r\n\r\nenum ValueTypes {\r\n ToggleStringValueType = 'ToggleStringValueType',\r\n FreeTextStringValueType = 'FreeTextStringValueType',\r\n SelectionStringValueType = 'SelectionStringValueType',\r\n}\r\n\r\n@Component({\r\n selector: 'abp-feature-management',\r\n templateUrl: './feature-management.component.html',\r\n exportAs: 'abpFeatureManagement',\r\n})\r\nexport class FeatureManagementComponent\r\n implements\r\n FeatureManagement.FeatureManagementComponentInputs,\r\n FeatureManagement.FeatureManagementComponentOutputs\r\n{\r\n @Input()\r\n providerKey: string;\r\n\r\n @Input()\r\n providerName: string;\r\n\r\n selectedGroupDisplayName: string;\r\n\r\n groups: Pick<FeatureGroupDto, 'name' | 'displayName'>[] = [];\r\n\r\n features: {\r\n [group: string]: Array<FeatureDto & { style?: { [key: string]: number }; initialValue: any }>;\r\n };\r\n\r\n valueTypes = ValueTypes;\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 if (this._visible === value) return;\r\n\r\n this._visible = value;\r\n this.visibleChange.emit(value);\r\n if (value) this.openModal();\r\n }\r\n\r\n @Output() readonly visibleChange = new EventEmitter<boolean>();\r\n\r\n modalBusy = false;\r\n\r\n constructor(\r\n public readonly track: TrackByService,\r\n protected service: FeaturesService,\r\n protected configState: ConfigStateService,\r\n ) {}\r\n\r\n openModal() {\r\n if (!this.providerName) {\r\n throw new Error('providerName is required.');\r\n }\r\n\r\n this.getFeatures();\r\n }\r\n\r\n getFeatures() {\r\n this.service.get(this.providerName, this.providerKey).subscribe(res => {\r\n if (!res.groups?.length) return;\r\n this.groups = res.groups.map(({ name, displayName }) => ({ name, displayName }));\r\n this.selectedGroupDisplayName = this.groups[0].displayName;\r\n this.features = res.groups.reduce(\r\n (acc, val) => ({\r\n ...acc,\r\n [val.name]: mapFeatures(val.features, document.body.dir as LocaleDirection),\r\n }),\r\n {},\r\n );\r\n });\r\n }\r\n\r\n save() {\r\n if (this.modalBusy) return;\r\n\r\n const changedFeatures = [] as UpdateFeatureDto[];\r\n\r\n Object.keys(this.features).forEach(key => {\r\n this.features[key].forEach(feature => {\r\n if (feature.value !== feature.initialValue)\r\n changedFeatures.push({ name: feature.name, value: `${feature.value}` });\r\n });\r\n });\r\n\r\n if (!changedFeatures.length) {\r\n this.visible = false;\r\n return;\r\n }\r\n\r\n this.modalBusy = true;\r\n this.service\r\n .update(this.providerName, this.providerKey, { features: changedFeatures })\r\n .pipe(finalize(() => (this.modalBusy = false)))\r\n .subscribe(() => {\r\n this.visible = false;\r\n\r\n if (!this.providerKey) {\r\n // to refresh host's features\r\n this.configState.refreshAppState().subscribe();\r\n }\r\n });\r\n }\r\n\r\n onCheckboxClick(val: boolean, feature: FeatureDto) {\r\n if (val) {\r\n this.checkToggleAncestors(feature);\r\n } else {\r\n this.uncheckToggleDescendants(feature);\r\n }\r\n }\r\n\r\n private uncheckToggleDescendants(feature: FeatureDto) {\r\n this.findAllDescendantsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node =>\r\n this.setFeatureValue(node, false),\r\n );\r\n }\r\n\r\n private checkToggleAncestors(feature: FeatureDto) {\r\n this.findAllAncestorsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node =>\r\n this.setFeatureValue(node, true),\r\n );\r\n }\r\n\r\n private findAllAncestorsOfByType(feature: FeatureDto, type: ValueTypes) {\r\n let parent = this.findParentByType(feature, type);\r\n const ancestors = [];\r\n while (parent) {\r\n ancestors.push(parent);\r\n parent = this.findParentByType(parent, type);\r\n }\r\n return ancestors;\r\n }\r\n\r\n private findAllDescendantsOfByType(feature: FeatureDto, type: ValueTypes) {\r\n const descendants = [];\r\n const queue = [feature];\r\n\r\n while (queue.length) {\r\n const node = queue.pop();\r\n const newDescendants = this.findChildrenByType(node, type);\r\n descendants.push(...newDescendants);\r\n queue.push(...newDescendants);\r\n }\r\n\r\n return descendants;\r\n }\r\n\r\n private findParentByType(feature: FeatureDto, type: ValueTypes) {\r\n return this.getCurrentGroup().find(\r\n f => f.valueType.name === type && f.name === feature.parentName,\r\n );\r\n }\r\n\r\n private findChildrenByType(feature: FeatureDto, type: ValueTypes) {\r\n return this.getCurrentGroup().filter(\r\n f => f.valueType.name === type && f.parentName === feature.name,\r\n );\r\n }\r\n\r\n private getCurrentGroup() {\r\n return this.features[this.selectedGroupDisplayName] ?? [];\r\n }\r\n\r\n private setFeatureValue(feature: FeatureDto, val: boolean) {\r\n feature.value = val as any;\r\n }\r\n}\r\n\r\nfunction mapFeatures(features: FeatureDto[], dir: LocaleDirection) {\r\n const margin = `margin-${dir === 'rtl' ? 'right' : 'left'}.px`;\r\n\r\n return features.map(feature => {\r\n const value =\r\n feature.valueType?.name === ValueTypes.ToggleStringValueType\r\n ? (feature.value || '').toLowerCase() === 'true'\r\n : feature.value;\r\n\r\n return {\r\n ...feature,\r\n value,\r\n initialValue: value,\r\n style: { [margin]: feature.depth * 20 },\r\n };\r\n });\r\n}\r\n","<abp-modal *ngIf=\"visible\" [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\r\n <ng-template #abpHeader>\r\n <h3>{{ 'AbpFeatureManagement::Features' | abpLocalization }}</h3>\r\n </ng-template>\r\n\r\n <ng-template #abpBody>\r\n <div class=\"row\">\r\n <div class=\"col-md-4\">\r\n <ul\r\n ngbNav\r\n #nav=\"ngbNav\"\r\n [(activeId)]=\"selectedGroupDisplayName\"\r\n class=\"nav-pills\"\r\n orientation=\"vertical\"\r\n >\r\n <li\r\n *ngFor=\"let group of groups; trackBy: track.by('name')\"\r\n [ngbNavItem]=\"group.displayName\"\r\n >\r\n <a ngbNavLink>{{ group.displayName }}</a>\r\n <ng-template ngbNavContent>\r\n <h4>{{ selectedGroupDisplayName }}</h4>\r\n <hr class=\"mt-2 mb-3\" />\r\n\r\n <div\r\n class=\"mt-2\"\r\n *ngFor=\"let feature of features[group.name]; let i = index; trackBy: track.by('id')\"\r\n [ngStyle]=\"feature.style\"\r\n [ngSwitch]=\"feature.valueType?.name\"\r\n (keyup.enter)=\"save()\"\r\n >\r\n <ng-container *ngSwitchCase=\"valueTypes.ToggleStringValueType\">\r\n <div class=\"form-check\">\r\n <input\r\n class=\"form-check-input\"\r\n type=\"checkbox\"\r\n [id]=\"feature.name\"\r\n [(ngModel)]=\"feature.value\"\r\n (ngModelChange)=\"onCheckboxClick($event, feature)\"\r\n />\r\n\r\n <label class=\"form-check-label\" [htmlFor]=\"feature.name\">{{\r\n feature.displayName\r\n }}</label>\r\n <ng-container\r\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\r\n ></ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"valueTypes.FreeTextStringValueType\">\r\n <div class=\"mb-3 form-group\">\r\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\r\n feature.displayName\r\n }}</label>\r\n <input\r\n class=\"form-control\"\r\n type=\"text\"\r\n [id]=\"feature.name\"\r\n [(ngModel)]=\"feature.value\"\r\n [abpFeatureManagementFreeText]=\"feature\"\r\n />\r\n\r\n <ng-container\r\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\r\n ></ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"valueTypes.SelectionStringValueType\">\r\n <ng-container *ngIf=\"feature.valueType.itemSource?.items?.length\">\r\n <div class=\"mb-3 form-group\">\r\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\r\n feature.displayName\r\n }}</label>\r\n <select class=\"form-select\" [id]=\"feature.name\" [(ngModel)]=\"feature.value\">\r\n <option\r\n *ngFor=\"\r\n let item of feature.valueType.itemSource?.items;\r\n trackBy: track.by('value')\r\n \"\r\n [ngValue]=\"item.value\"\r\n >\r\n {{\r\n item.displayText?.resourceName + '::' + item.displayText?.name\r\n | abpLocalization\r\n }}\r\n </option>\r\n </select>\r\n <ng-container\r\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\r\n ></ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchDefault>{{ feature.displayName }}</ng-container>\r\n </div>\r\n </ng-template>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <ng-template #descTmp let-description>\r\n <small *ngIf=\"description\" class=\"d-block form-text text-muted\">{{ description }}</small>\r\n </ng-template>\r\n\r\n <div class=\"col-md-8\"><div [ngbNavOutlet]=\"nav\"></div></div>\r\n\r\n <div class=\"mx-3\" *ngIf=\"!groups.length\">\r\n {{ 'AbpFeatureManagement::NoFeatureFoundMessage' | abpLocalization }}\r\n </div>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template #abpFooter>\r\n <button abpClose type=\"button\" class=\"btn btn-secondary\">\r\n {{ 'AbpFeatureManagement::Cancel' | abpLocalization }}\r\n </button>\r\n <abp-button\r\n *ngIf=\"groups.length\"\r\n iconClass=\"fa fa-check\"\r\n [disabled]=\"modalBusy\"\r\n (click)=\"save()\"\r\n >\r\n {{ 'AbpFeatureManagement::Save' | abpLocalization }}\r\n </abp-button>\r\n </ng-template>\r\n</abp-modal>\r\n","import { CoreModule } from '@abp/ng.core';\r\nimport { ThemeSharedModule } from '@abp/ng.theme.shared';\r\nimport { NgModule } from '@angular/core';\r\nimport { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';\r\nimport { FeatureManagementComponent } from './components/feature-management/feature-management.component';\r\nimport { FreeTextInputDirective } from './directives/free-text-input.directive';\r\n\r\nconst exported = [FeatureManagementComponent, FreeTextInputDirective];\r\n\r\n@NgModule({\r\n declarations: [...exported],\r\n imports: [CoreModule, ThemeSharedModule, NgbNavModule],\r\n exports: [...exported],\r\n})\r\nexport class FeatureManagementModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAWa,WAAW,GAAG;IACzB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,MAAM;EACf;MAMW,sBAAsB;;IAGjC,IAA2C,OAAO,CAAC,GAAiB;QAClE,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,YAAY,EAAE,CAAC;KACrB;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB;IAIO,YAAY;;QAClB,MAAM,aAAa,GAAG,MAAA,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,0CAAE,SAAS,0CAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7E,IAAI,CAAC,IAAI,GAAG,MAAA,WAAW,CAAC,aAAa,CAAC,mCAAI,WAAW,CAAC,OAAO,CAAC;KAC/D;;oHAjBU,sBAAsB;wGAAtB,sBAAsB;4FAAtB,sBAAsB;kBAJlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qCAAqC;oBAC/C,QAAQ,EAAE,mCAAmC;iBAC9C;8BAI4C,OAAO;sBAAjD,KAAK;uBAAC,8BAA8B;gBAShB,IAA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;sBAA/B,MAAM;;AAiIT,SAAS,WAAW,CAAC,QAAsB,EAAE,GAAoB;IAC/D,MAAM,MAAM,GAAG,UAAU,GAAG,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,KAAK,CAAC;IAE/D,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO;;QACzB,MAAM,KAAK,GACT,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,MAAK,UAAU,CAAC,qBAAqB;cACxD,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,MAAM;cAC9C,OAAO,CAAC,KAAK,CAAC;QAEpB,uCACK,OAAO,KACV,KAAK,EACL,YAAY,EAAE,KAAK,EACnB,KAAK,EAAE,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,EAAE,EAAE,IACvC;KACH,CAAC,CAAC;AACL;;AErMA,MAAM,QAAQ,GAAG,CAAC,0BAA0B,EAAE,sBAAsB,CAAC,CAAC;MAOzD,uBAAuB;;qHAAvB,uBAAuB;sHAAvB,uBAAuB,iBAPlB,0BAA0B,EAAE,sBAAsB,aAIxD,UAAU,EAAE,iBAAiB,EAAE,YAAY,aAJrC,0BAA0B,EAAE,sBAAsB;sHAOvD,uBAAuB,YAHzB,CAAC,UAAU,EAAE,iBAAiB,EAAE,YAAY,CAAC;4FAG3C,uBAAuB;kBALnC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,GAAG,QAAQ,CAAC;oBAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,YAAY,CAAC;oBACtD,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;iBACvB;;;ACbD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"abp-ng.feature-management.js","sources":["../../../../packages/feature-management/src/lib/directives/free-text-input.directive.ts","../../../../packages/feature-management/src/lib/components/feature-management/feature-management.component.ts","../../../../packages/feature-management/src/lib/components/feature-management/feature-management.component.html","../../../../packages/feature-management/src/lib/feature-management.module.ts","../../../../packages/feature-management/src/abp-ng.feature-management.ts"],"sourcesContent":["import { Directive, HostBinding, Input } from '@angular/core';\n\n// TODO: improve this type\nexport interface FreeTextType {\n valueType: {\n validator: {\n name: string;\n };\n };\n}\n\nexport const INPUT_TYPES = {\n numeric: 'number',\n default: 'text',\n};\n\n@Directive({\n selector: 'input[abpFeatureManagementFreeText]',\n exportAs: 'inputAbpFeatureManagementFreeText',\n})\nexport class FreeTextInputDirective {\n _feature: FreeTextType;\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('abpFeatureManagementFreeText') set feature(val: FreeTextType) {\n this._feature = val;\n this.setInputType();\n }\n\n get feature() {\n return this._feature;\n }\n\n @HostBinding('type') type: string;\n\n private setInputType() {\n const validatorType = this.feature?.valueType?.validator?.name.toLowerCase();\n this.type = INPUT_TYPES[validatorType] ?? INPUT_TYPES.default;\n }\n}\n","import { ConfigStateService, TrackByService } from '@abp/ng.core';\nimport {\n FeatureDto,\n FeatureGroupDto,\n FeaturesService,\n UpdateFeatureDto,\n} from '@abp/ng.feature-management/proxy';\nimport { LocaleDirection } from '@abp/ng.theme.shared';\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { finalize } from 'rxjs/operators';\nimport { FeatureManagement } from '../../models/feature-management';\n\nenum ValueTypes {\n ToggleStringValueType = 'ToggleStringValueType',\n FreeTextStringValueType = 'FreeTextStringValueType',\n SelectionStringValueType = 'SelectionStringValueType',\n}\n\n@Component({\n selector: 'abp-feature-management',\n templateUrl: './feature-management.component.html',\n exportAs: 'abpFeatureManagement',\n})\nexport class FeatureManagementComponent\n implements\n FeatureManagement.FeatureManagementComponentInputs,\n FeatureManagement.FeatureManagementComponentOutputs\n{\n @Input()\n providerKey: string;\n\n @Input()\n providerName: string;\n\n selectedGroupDisplayName: string;\n\n groups: Pick<FeatureGroupDto, 'name' | 'displayName'>[] = [];\n\n features: {\n [group: string]: Array<FeatureDto & { style?: { [key: string]: number }; initialValue: any }>;\n };\n\n valueTypes = ValueTypes;\n\n protected _visible;\n\n @Input()\n get visible(): boolean {\n return this._visible;\n }\n\n set visible(value: boolean) {\n if (this._visible === value) return;\n\n this._visible = value;\n this.visibleChange.emit(value);\n if (value) this.openModal();\n }\n\n @Output() readonly visibleChange = new EventEmitter<boolean>();\n\n modalBusy = false;\n\n constructor(\n public readonly track: TrackByService,\n protected service: FeaturesService,\n protected configState: ConfigStateService,\n ) {}\n\n openModal() {\n if (!this.providerName) {\n throw new Error('providerName is required.');\n }\n\n this.getFeatures();\n }\n\n getFeatures() {\n this.service.get(this.providerName, this.providerKey).subscribe(res => {\n if (!res.groups?.length) return;\n this.groups = res.groups.map(({ name, displayName }) => ({ name, displayName }));\n this.selectedGroupDisplayName = this.groups[0].displayName;\n this.features = res.groups.reduce(\n (acc, val) => ({\n ...acc,\n [val.name]: mapFeatures(val.features, document.body.dir as LocaleDirection),\n }),\n {},\n );\n });\n }\n\n save() {\n if (this.modalBusy) return;\n\n const changedFeatures = [] as UpdateFeatureDto[];\n\n Object.keys(this.features).forEach(key => {\n this.features[key].forEach(feature => {\n if (feature.value !== feature.initialValue)\n changedFeatures.push({ name: feature.name, value: `${feature.value}` });\n });\n });\n\n if (!changedFeatures.length) {\n this.visible = false;\n return;\n }\n\n this.modalBusy = true;\n this.service\n .update(this.providerName, this.providerKey, { features: changedFeatures })\n .pipe(finalize(() => (this.modalBusy = false)))\n .subscribe(() => {\n this.visible = false;\n\n if (!this.providerKey) {\n // to refresh host's features\n this.configState.refreshAppState().subscribe();\n }\n });\n }\n\n onCheckboxClick(val: boolean, feature: FeatureDto) {\n if (val) {\n this.checkToggleAncestors(feature);\n } else {\n this.uncheckToggleDescendants(feature);\n }\n }\n\n private uncheckToggleDescendants(feature: FeatureDto) {\n this.findAllDescendantsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node =>\n this.setFeatureValue(node, false),\n );\n }\n\n private checkToggleAncestors(feature: FeatureDto) {\n this.findAllAncestorsOfByType(feature, ValueTypes.ToggleStringValueType).forEach(node =>\n this.setFeatureValue(node, true),\n );\n }\n\n private findAllAncestorsOfByType(feature: FeatureDto, type: ValueTypes) {\n let parent = this.findParentByType(feature, type);\n const ancestors = [];\n while (parent) {\n ancestors.push(parent);\n parent = this.findParentByType(parent, type);\n }\n return ancestors;\n }\n\n private findAllDescendantsOfByType(feature: FeatureDto, type: ValueTypes) {\n const descendants = [];\n const queue = [feature];\n\n while (queue.length) {\n const node = queue.pop();\n const newDescendants = this.findChildrenByType(node, type);\n descendants.push(...newDescendants);\n queue.push(...newDescendants);\n }\n\n return descendants;\n }\n\n private findParentByType(feature: FeatureDto, type: ValueTypes) {\n return this.getCurrentGroup().find(\n f => f.valueType.name === type && f.name === feature.parentName,\n );\n }\n\n private findChildrenByType(feature: FeatureDto, type: ValueTypes) {\n return this.getCurrentGroup().filter(\n f => f.valueType.name === type && f.parentName === feature.name,\n );\n }\n\n private getCurrentGroup() {\n return this.features[this.selectedGroupDisplayName] ?? [];\n }\n\n private setFeatureValue(feature: FeatureDto, val: boolean) {\n feature.value = val as any;\n }\n}\n\nfunction mapFeatures(features: FeatureDto[], dir: LocaleDirection) {\n const margin = `margin-${dir === 'rtl' ? 'right' : 'left'}.px`;\n\n return features.map(feature => {\n const value =\n feature.valueType?.name === ValueTypes.ToggleStringValueType\n ? (feature.value || '').toLowerCase() === 'true'\n : feature.value;\n\n return {\n ...feature,\n value,\n initialValue: value,\n style: { [margin]: feature.depth * 20 },\n };\n });\n}\n","<abp-modal *ngIf=\"visible\" [(visible)]=\"visible\" [busy]=\"modalBusy\" [options]=\"{ size: 'lg' }\">\n <ng-template #abpHeader>\n <h3>{{ 'AbpFeatureManagement::Features' | abpLocalization }}</h3>\n </ng-template>\n\n <ng-template #abpBody>\n <div class=\"row\">\n <div class=\"col-md-4\">\n <ul\n ngbNav\n #nav=\"ngbNav\"\n [(activeId)]=\"selectedGroupDisplayName\"\n class=\"nav-pills\"\n orientation=\"vertical\"\n >\n <li\n *ngFor=\"let group of groups; trackBy: track.by('name')\"\n [ngbNavItem]=\"group.displayName\"\n >\n <a ngbNavLink>{{ group.displayName }}</a>\n <ng-template ngbNavContent>\n <h4>{{ selectedGroupDisplayName }}</h4>\n <hr class=\"mt-2 mb-3\" />\n\n <div\n class=\"mt-2\"\n *ngFor=\"let feature of features[group.name]; let i = index; trackBy: track.by('id')\"\n [ngStyle]=\"feature.style\"\n [ngSwitch]=\"feature.valueType?.name\"\n (keyup.enter)=\"save()\"\n >\n <ng-container *ngSwitchCase=\"valueTypes.ToggleStringValueType\">\n <div class=\"form-check\">\n <input\n class=\"form-check-input\"\n type=\"checkbox\"\n [id]=\"feature.name\"\n [(ngModel)]=\"feature.value\"\n (ngModelChange)=\"onCheckboxClick($event, feature)\"\n />\n\n <label class=\"form-check-label\" [htmlFor]=\"feature.name\">{{\n feature.displayName\n }}</label>\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"valueTypes.FreeTextStringValueType\">\n <div class=\"mb-3 form-group\">\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\n feature.displayName\n }}</label>\n <input\n class=\"form-control\"\n type=\"text\"\n [id]=\"feature.name\"\n [(ngModel)]=\"feature.value\"\n [abpFeatureManagementFreeText]=\"feature\"\n />\n\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"valueTypes.SelectionStringValueType\">\n <ng-container *ngIf=\"feature.valueType.itemSource?.items?.length\">\n <div class=\"mb-3 form-group\">\n <label [htmlFor]=\"feature.name\" class=\"form-label\">{{\n feature.displayName\n }}</label>\n <select class=\"form-select\" [id]=\"feature.name\" [(ngModel)]=\"feature.value\">\n <option\n *ngFor=\"\n let item of feature.valueType.itemSource?.items;\n trackBy: track.by('value')\n \"\n [ngValue]=\"item.value\"\n >\n {{\n item.displayText?.resourceName + '::' + item.displayText?.name\n | abpLocalization\n }}\n </option>\n </select>\n <ng-container\n *ngTemplateOutlet=\"descTmp; context: { $implicit: feature.description }\"\n ></ng-container>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchDefault>{{ feature.displayName }}</ng-container>\n </div>\n </ng-template>\n </li>\n </ul>\n </div>\n\n <ng-template #descTmp let-description>\n <small *ngIf=\"description\" class=\"d-block form-text text-muted\">{{ description }}</small>\n </ng-template>\n\n <div class=\"col-md-8\"><div [ngbNavOutlet]=\"nav\"></div></div>\n\n <div class=\"mx-3\" *ngIf=\"!groups.length\">\n {{ 'AbpFeatureManagement::NoFeatureFoundMessage' | abpLocalization }}\n </div>\n </div>\n </ng-template>\n\n <ng-template #abpFooter>\n <button abpClose type=\"button\" class=\"btn btn-secondary\">\n {{ 'AbpFeatureManagement::Cancel' | abpLocalization }}\n </button>\n <abp-button\n *ngIf=\"groups.length\"\n iconClass=\"fa fa-check\"\n [disabled]=\"modalBusy\"\n (click)=\"save()\"\n >\n {{ 'AbpFeatureManagement::Save' | abpLocalization }}\n </abp-button>\n </ng-template>\n</abp-modal>\n","import { CoreModule } from '@abp/ng.core';\nimport { ThemeSharedModule } from '@abp/ng.theme.shared';\nimport { NgModule } from '@angular/core';\nimport { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';\nimport { FeatureManagementComponent } from './components/feature-management/feature-management.component';\nimport { FreeTextInputDirective } from './directives/free-text-input.directive';\n\nconst exported = [FeatureManagementComponent, FreeTextInputDirective];\n\n@NgModule({\n declarations: [...exported],\n imports: [CoreModule, ThemeSharedModule, NgbNavModule],\n exports: [...exported],\n})\nexport class FeatureManagementModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAWa,WAAW,GAAG;IACzB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,MAAM;EACf;MAMW,sBAAsB;;IAGjC,IAA2C,OAAO,CAAC,GAAiB;QACl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