@sd-angular/core 0.0.1040 → 0.0.1041
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/bundles/sd-angular-core-chip.umd.js +40 -9
- package/bundles/sd-angular-core-chip.umd.js.map +1 -1
- package/bundles/sd-angular-core-chip.umd.min.js +2 -2
- package/bundles/sd-angular-core-chip.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-filter.umd.js +703 -0
- package/bundles/sd-angular-core-filter.umd.js.map +1 -0
- package/bundles/sd-angular-core-filter.umd.min.js +2 -0
- package/bundles/sd-angular-core-filter.umd.min.js.map +1 -0
- package/bundles/sd-angular-core-grid-material.umd.js +87 -42
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.js +176 -117
- package/bundles/sd-angular-core-setting.umd.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
- package/bundles/sd-angular-core.umd.js +4 -4
- package/bundles/sd-angular-core.umd.min.js +1 -1
- package/bundles/sd-angular-core.umd.min.js.map +1 -1
- package/chip/sd-angular-core-chip.metadata.json +1 -1
- package/chip/src/lib/chip.component.d.ts +8 -1
- package/esm2015/chip/src/lib/chip.component.js +33 -3
- package/esm2015/chip/src/lib/chip.module.js +6 -3
- package/esm2015/filter/index.js +2 -0
- package/esm2015/filter/sd-angular-core-filter.js +8 -0
- package/esm2015/filter/src/lib/directives/sd-filter-def.directive.js +22 -0
- package/esm2015/filter/src/lib/filter.component.js +161 -0
- package/esm2015/filter/src/lib/filter.model.js +2 -0
- package/esm2015/filter/src/lib/filter.module.js +47 -0
- package/esm2015/filter/src/lib/filter.service.js +60 -0
- package/esm2015/filter/src/lib/pipes/values-local.pipe.js +19 -0
- package/esm2015/filter/src/lib/pipes/values-server.pipe.js +18 -0
- package/esm2015/filter/src/public-api.js +8 -0
- package/esm2015/grid-material/src/lib/components/quick-action/quick-action.component.js +1 -1
- package/esm2015/grid-material/src/lib/services/generated-column/generated-column.service.js +28 -12
- package/esm2015/grid-material/src/lib/services/grid-configuration.service.js +50 -21
- package/esm2015/public-api.js +2 -1
- package/esm2015/setting/src/lib/setting.model.js +1 -1
- package/esm2015/setting/src/lib/setting.service.js +119 -58
- package/fesm2015/sd-angular-core-chip.js +36 -4
- package/fesm2015/sd-angular-core-chip.js.map +1 -1
- package/fesm2015/sd-angular-core-filter.js +323 -0
- package/fesm2015/sd-angular-core-filter.js.map +1 -0
- package/fesm2015/sd-angular-core-grid-material.js +77 -32
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-setting.js +119 -58
- package/fesm2015/sd-angular-core-setting.js.map +1 -1
- package/fesm2015/sd-angular-core.js +1 -0
- package/fesm2015/sd-angular-core.js.map +1 -1
- package/filter/index.d.ts +1 -0
- package/filter/package.json +12 -0
- package/filter/sd-angular-core-filter.d.ts +7 -0
- package/filter/sd-angular-core-filter.metadata.json +1 -0
- package/filter/src/lib/directives/sd-filter-def.directive.d.ts +8 -0
- package/filter/src/lib/filter.component.d.ts +31 -0
- package/filter/src/lib/filter.model.d.ts +105 -0
- package/filter/src/lib/filter.module.d.ts +2 -0
- package/filter/src/lib/filter.service.d.ts +9 -0
- package/filter/src/lib/pipes/values-local.pipe.d.ts +5 -0
- package/filter/src/lib/pipes/values-server.pipe.d.ts +5 -0
- package/filter/src/public-api.d.ts +4 -0
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/services/generated-column/generated-column.service.d.ts +3 -2
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/{sd-angular-core-0.0.1040.tgz → sd-angular-core-0.0.1041.tgz} +0 -0
- package/setting/sd-angular-core-setting.metadata.json +1 -1
- package/setting/src/lib/setting.model.d.ts +20 -6
- package/setting/src/lib/setting.service.d.ts +2 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { Directive, TemplateRef, Input, Injectable, QueryList, Component, ContentChildren, Pipe, NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import { SdTranslateModule } from '@sd-angular/core/translate';
|
|
8
|
+
import { SdCommonModule } from '@sd-angular/core/common';
|
|
9
|
+
import { __awaiter, __classPrivateFieldGet } from 'tslib';
|
|
10
|
+
import { BehaviorSubject, Subscription } from 'rxjs';
|
|
11
|
+
import { startWith } from 'rxjs/operators';
|
|
12
|
+
import { v4 } from 'uuid';
|
|
13
|
+
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
14
|
+
import hash from 'object-hash';
|
|
15
|
+
import { SdSettingService } from '@sd-angular/core/setting';
|
|
16
|
+
import { SdFormModule } from '@sd-angular/core/form';
|
|
17
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
18
|
+
|
|
19
|
+
class SdFilterDefDirective {
|
|
20
|
+
constructor(templateRef) {
|
|
21
|
+
this.templateRef = templateRef;
|
|
22
|
+
}
|
|
23
|
+
set _defaultShowing(val) {
|
|
24
|
+
this.defaultShowing = (val === '') || val;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
SdFilterDefDirective.decorators = [
|
|
28
|
+
{ type: Directive, args: [{
|
|
29
|
+
selector: '[sdFilterDef]'
|
|
30
|
+
},] }
|
|
31
|
+
];
|
|
32
|
+
SdFilterDefDirective.ctorParameters = () => [
|
|
33
|
+
{ type: TemplateRef }
|
|
34
|
+
];
|
|
35
|
+
SdFilterDefDirective.propDecorators = {
|
|
36
|
+
sdFilterDef: [{ type: Input }],
|
|
37
|
+
_defaultShowing: [{ type: Input, args: ['defaultShowing',] }]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var _prefix;
|
|
41
|
+
class SdFilterService {
|
|
42
|
+
constructor(settingService) {
|
|
43
|
+
this.settingService = settingService;
|
|
44
|
+
_prefix.set(this, '61d22e8e-eee8-4aad-8e1c-044a532fea91');
|
|
45
|
+
this.get = (key) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
var _a;
|
|
47
|
+
if (!key) {
|
|
48
|
+
return {
|
|
49
|
+
selectedQuickFilter: null,
|
|
50
|
+
quickFilters: [],
|
|
51
|
+
filter: {}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const { get } = this.settingService.create({
|
|
55
|
+
prefix: __classPrivateFieldGet(this, _prefix),
|
|
56
|
+
key
|
|
57
|
+
});
|
|
58
|
+
const configuration = yield get();
|
|
59
|
+
return {
|
|
60
|
+
selectedQuickFilter: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _a !== void 0 ? _a : null,
|
|
61
|
+
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
62
|
+
filter: (configuration === null || configuration === void 0 ? void 0 : configuration.filter) || {}
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
this.set = (key, configuration) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
var _b;
|
|
67
|
+
configuration = {
|
|
68
|
+
selectedQuickFilter: (_b = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _b !== void 0 ? _b : null,
|
|
69
|
+
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
70
|
+
filter: (configuration === null || configuration === void 0 ? void 0 : configuration.filter) || {}
|
|
71
|
+
};
|
|
72
|
+
if (!key) {
|
|
73
|
+
return configuration;
|
|
74
|
+
}
|
|
75
|
+
const { set } = this.settingService.create({
|
|
76
|
+
prefix: __classPrivateFieldGet(this, _prefix),
|
|
77
|
+
key
|
|
78
|
+
});
|
|
79
|
+
key = hash({
|
|
80
|
+
prefix: __classPrivateFieldGet(this, _prefix),
|
|
81
|
+
key
|
|
82
|
+
});
|
|
83
|
+
yield set(configuration);
|
|
84
|
+
return configuration;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_prefix = new WeakMap();
|
|
89
|
+
SdFilterService.decorators = [
|
|
90
|
+
{ type: Injectable }
|
|
91
|
+
];
|
|
92
|
+
SdFilterService.ctorParameters = () => [
|
|
93
|
+
{ type: SdSettingService }
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
var _prefix$1, _filterOptionChanges, _subscription, _format, _firstLoad;
|
|
97
|
+
class SdFilter {
|
|
98
|
+
constructor(deviceService, settingService, filterService) {
|
|
99
|
+
this.deviceService = deviceService;
|
|
100
|
+
this.settingService = settingService;
|
|
101
|
+
this.filterService = filterService;
|
|
102
|
+
_prefix$1.set(this, '61d22e8e-eee8-4aad-8e1c-044a532fea91');
|
|
103
|
+
_filterOptionChanges.set(this, new BehaviorSubject(null));
|
|
104
|
+
_subscription.set(this, new Subscription());
|
|
105
|
+
this.sdFilterDefs = new QueryList();
|
|
106
|
+
this.isMobileOrTablet = false;
|
|
107
|
+
this.filterChanges = new BehaviorSubject({});
|
|
108
|
+
this.onFilter = (filter) => {
|
|
109
|
+
this.filterChanges.next({
|
|
110
|
+
filter: Object.assign({}, this.information.filter),
|
|
111
|
+
filterDef: Object.assign({}, this.information.filterDef),
|
|
112
|
+
});
|
|
113
|
+
this.setting.set(this.information);
|
|
114
|
+
};
|
|
115
|
+
this.onClear = () => {
|
|
116
|
+
this.information.filter = {};
|
|
117
|
+
this.information.filterDef = {};
|
|
118
|
+
this.onFilter();
|
|
119
|
+
};
|
|
120
|
+
_format.set(this, (filters, information) => {
|
|
121
|
+
var _a, _b, _c, _d, _e;
|
|
122
|
+
for (const filter of filters) {
|
|
123
|
+
if (filter.type === 'daterange') {
|
|
124
|
+
information.filter[filter.field] = {
|
|
125
|
+
from: (_b = (_a = information.filter[filter.field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : undefined,
|
|
126
|
+
to: (_d = (_c = information.filter[filter.field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : undefined
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
information.filter[filter.field] = (_e = information.filter[filter.field]) !== null && _e !== void 0 ? _e : undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
_firstLoad.set(this, (filters, information) => {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
136
|
+
if (information.selectedQuickFilter && information.quickFilters.some(e => e.code === information.selectedQuickFilter)) {
|
|
137
|
+
const selected = information.quickFilters.find(e => e.code === information.selectedQuickFilter);
|
|
138
|
+
information.filter = Object.assign({}, selected.filter);
|
|
139
|
+
information.filterDef = Object.assign({}, selected.filterDef);
|
|
140
|
+
__classPrivateFieldGet(this, _format).call(this, filters, information);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
for (const filter of filters) {
|
|
144
|
+
if (filter.type === 'daterange') {
|
|
145
|
+
information.filter[filter.field] = {
|
|
146
|
+
from: (_d = (_b = (_a = information.filter[filter.field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : (_c = filter.default) === null || _c === void 0 ? void 0 : _c.from) !== null && _d !== void 0 ? _d : undefined,
|
|
147
|
+
to: (_h = (_f = (_e = information.filter[filter.field]) === null || _e === void 0 ? void 0 : _e.to) !== null && _f !== void 0 ? _f : (_g = filter.default) === null || _g === void 0 ? void 0 : _g.to) !== null && _h !== void 0 ? _h : undefined
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
information.filter[filter.field] = (_k = (_j = information.filter[filter.field]) !== null && _j !== void 0 ? _j : filter.default) !== null && _k !== void 0 ? _k : undefined;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
this.setFilter = (args) => {
|
|
157
|
+
const { filter, filterDef } = args;
|
|
158
|
+
this.information = Object.assign(Object.assign({}, this.information), { filter: Object.assign({}, filter), filterDef: Object.assign({}, filterDef) });
|
|
159
|
+
};
|
|
160
|
+
this.isMobileOrTablet = !this.deviceService.isDesktop();
|
|
161
|
+
}
|
|
162
|
+
set _filterOption(option) {
|
|
163
|
+
console.log(option);
|
|
164
|
+
if (option) {
|
|
165
|
+
this.filterOption = option;
|
|
166
|
+
__classPrivateFieldGet(this, _filterOptionChanges).next(option);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
ngOnInit() {
|
|
170
|
+
// if (!this.#key) {
|
|
171
|
+
// this.setting = this.settingService.create<SdFilterInformation>(uuid.v4(), {
|
|
172
|
+
// type: 'session',
|
|
173
|
+
// default: {
|
|
174
|
+
// filter: {},
|
|
175
|
+
// visible: {},
|
|
176
|
+
// quickFilters: [],
|
|
177
|
+
// selectedQuickFilter: null
|
|
178
|
+
// }
|
|
179
|
+
// });
|
|
180
|
+
// } else {
|
|
181
|
+
// this.setting = this.settingService.create<SdFilterInformation>(this.#key, {
|
|
182
|
+
// default: {
|
|
183
|
+
// filter: {},
|
|
184
|
+
// visible: {},
|
|
185
|
+
// quickFilters: [],
|
|
186
|
+
// selectedQuickFilter: null
|
|
187
|
+
// }
|
|
188
|
+
// });
|
|
189
|
+
// }
|
|
190
|
+
}
|
|
191
|
+
ngAfterViewInit() {
|
|
192
|
+
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterOptionChanges).pipe(startWith(this.filterOption)).subscribe((filterOption) => {
|
|
193
|
+
var _a, _b;
|
|
194
|
+
console.log(filterOption);
|
|
195
|
+
if (!filterOption) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const defaultInformation = {
|
|
199
|
+
filter: {},
|
|
200
|
+
visible: {},
|
|
201
|
+
quickFilters: ((_a = filterOption === null || filterOption === void 0 ? void 0 : filterOption.quickFilter) === null || _a === void 0 ? void 0 : _a.defaults) || [],
|
|
202
|
+
selectedQuickFilter: (_b = filterOption === null || filterOption === void 0 ? void 0 : filterOption.quickFilter) === null || _b === void 0 ? void 0 : _b.selectedDefault
|
|
203
|
+
};
|
|
204
|
+
if (!filterOption.key) {
|
|
205
|
+
this.setting = this.settingService.create(v4(), {
|
|
206
|
+
type: 'session',
|
|
207
|
+
default: defaultInformation
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.setting = this.settingService.create({
|
|
212
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
213
|
+
key: filterOption.key
|
|
214
|
+
}, {
|
|
215
|
+
default: defaultInformation
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
this.information = this.setting.get();
|
|
219
|
+
console.log(this.information);
|
|
220
|
+
__classPrivateFieldGet(this, _subscription).add(this.setting.observer.subscribe(filterInformation => {
|
|
221
|
+
this.information = filterInformation;
|
|
222
|
+
__classPrivateFieldGet(this, _format).call(this, filterOption === null || filterOption === void 0 ? void 0 : filterOption.filters, this.information);
|
|
223
|
+
}));
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
ngOnDestroy() {
|
|
227
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
_prefix$1 = new WeakMap(), _filterOptionChanges = new WeakMap(), _subscription = new WeakMap(), _format = new WeakMap(), _firstLoad = new WeakMap();
|
|
231
|
+
SdFilter.decorators = [
|
|
232
|
+
{ type: Component, args: [{
|
|
233
|
+
selector: 'sd-filter',
|
|
234
|
+
template: "<div *ngIf=\"information\" class=\"c-container\">\r\n <div class=\"c-header\">\r\n <div class=\"d-flex align-items-center\">\r\n <button class=\"mx-2\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">filter_alt</mat-icon>\r\n </button>\r\n <span>Hi\u1EC3n th\u1ECB</span>\r\n </div>\r\n <div class=\"d-flex align-items-center\">\r\n <button class=\"mx-2\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">add</mat-icon>\r\n </button>\r\n <button class=\"mx-2\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">settings</mat-icon>\r\n </button>\r\n <button class=\"mx-2\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">download</mat-icon>\r\n </button>\r\n <button class=\"mx-2\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"c-body row mx-0\">\r\n <ng-container *ngFor=\"let item of filterOption?.filters\">\r\n <div *ngIf=\"information.visible[item.field] !== false\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input *ngIf=\"item.type === 'string'\" [label]=\"item.title\" type=\"text\"\r\n [(model)]=\"information.filter[item.field]\" (keyupEnter)=\"onFilter(item)\">\r\n </sd-input>\r\n <sd-input *ngIf=\"item.type === 'number'\" [label]=\"item.title\" type=\"number\"\r\n [(model)]=\"information.filter[item.field]\" (keyupEnter)=\"onFilter(item)\">\r\n </sd-input>\r\n <sd-select *ngIf=\"item.type === 'bool'\" [label]=\"item.title\" [items]=\"[{value:true,display:item.option?.displayOnTrue || 'True' },\r\n {value:false,display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"information.filter[item.field]\" (sdChange)=\"onFilter(item)\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values-local'\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\"\r\n [items]=\"item | sdValuesLocal | async\" [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\" [(model)]=\"information.filter[item.field]\"\r\n (sdChange)=\"onFilter(item)\" [selectAll]=\"item.option.selectAll\" multiple=\"true\">\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item | sdValuesLocal | async\" [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\" [(model)]=\"information.filter[item.field]\"\r\n (sdChange)=\"onFilter(item)\">\r\n </sd-autocomplete>\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item | sdValuesLocal | async\" [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\" [(model)]=\"information.filter[item.field]\"\r\n (sdChange)=\"onFilter(item)\" filtered multiple>\r\n </sd-select>\r\n <sd-select *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item | sdValuesLocal | async\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"information.filter[item.field]\" (sdChange)=\"onFilter(item)\">\r\n </sd-select>\r\n </ng-container>\r\n <ng-container *ngIf=\"item.type === 'values-server'\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\"\r\n [items]=\"item | sdValuesLocal | async\" [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\" [(model)]=\"information.filter[item.field]\"\r\n (sdChange)=\"onFilter(item)\" filtered multiple>\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item | sdValuesLocal | async\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"information.filter[item.field]\" (sdChange)=\"onFilter(item)\">\r\n </sd-autocomplete>\r\n </ng-container>\r\n <sd-date-time *ngIf=\"item.type ==='date' || item.type ==='datetime'\" [label]=\"item.title\"\r\n [(model)]=\"information.filter[item.field]\" [type]=\"item.type\" [min]=\"item?.option?.min\"\r\n [max]=\"item?.option?.max\" (sdChange)=\"onFilter(item)\">\r\n </sd-date-time>\r\n <sd-date-range *ngIf=\"item.type ==='daterange'\" [label]=\"item.title\"\r\n [(from)]=\"information.filter[item.field].from\" [(to)]=\"information.filter[item.field].to\"\r\n [min]=\"item?.option?.min\" [max]=\"item?.option?.max\" (sdChange)=\"onFilter(item)\">\r\n </sd-date-range>\r\n </div>\r\n </ng-container>\r\n </div>\r\n</div>\r\n<!-- <sd-popup-filter [columns]=\"columns\" [externalFilters]=\"externalFilters\" (changeFilter)=\"onChangeFilter($event)\"\r\n (clearFilter)=\"onReset()\" [filterDefs]=\"filterDefs\">\r\n </sd-popup-filter> -->",
|
|
235
|
+
styles: [".c-container .c-header{align-items:center;display:flex;height:48px;justify-content:space-between;padding:0 20px}.c-container mat-icon.c-icon{color:rgba(0,0,0,.54)!important}.c-container button:focus{outline:none}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
236
|
+
},] }
|
|
237
|
+
];
|
|
238
|
+
SdFilter.ctorParameters = () => [
|
|
239
|
+
{ type: DeviceDetectorService },
|
|
240
|
+
{ type: SdSettingService },
|
|
241
|
+
{ type: SdFilterService }
|
|
242
|
+
];
|
|
243
|
+
SdFilter.propDecorators = {
|
|
244
|
+
_filterOption: [{ type: Input, args: ['option',] }],
|
|
245
|
+
sdFilterDefs: [{ type: ContentChildren, args: [SdFilterDefDirective,] }]
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
class SdValuesLocalPipe {
|
|
249
|
+
constructor() {
|
|
250
|
+
this.transform = (filterValues) => __awaiter(this, void 0, void 0, function* () {
|
|
251
|
+
var _a, _b, _c;
|
|
252
|
+
if (typeof ((_a = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _a === void 0 ? void 0 : _a.items) === 'function') {
|
|
253
|
+
return yield ((_b = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _b === void 0 ? void 0 : _b.items());
|
|
254
|
+
}
|
|
255
|
+
return ((_c = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _c === void 0 ? void 0 : _c.items) || [];
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
SdValuesLocalPipe.decorators = [
|
|
260
|
+
{ type: Pipe, args: [{
|
|
261
|
+
name: 'sdValuesLocal'
|
|
262
|
+
},] }
|
|
263
|
+
];
|
|
264
|
+
|
|
265
|
+
class SdValuesServerPipe {
|
|
266
|
+
constructor() {
|
|
267
|
+
this.transform = (filterValues) => {
|
|
268
|
+
var _a, _b, _c;
|
|
269
|
+
if (typeof ((_a = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _a === void 0 ? void 0 : _a.items) === 'function') {
|
|
270
|
+
return (_b = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _b === void 0 ? void 0 : _b.items;
|
|
271
|
+
}
|
|
272
|
+
return ((_c = filterValues === null || filterValues === void 0 ? void 0 : filterValues.option) === null || _c === void 0 ? void 0 : _c.items) || [];
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
SdValuesServerPipe.decorators = [
|
|
277
|
+
{ type: Pipe, args: [{
|
|
278
|
+
name: 'sdValuesServer'
|
|
279
|
+
},] }
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
class SdFilterModule {
|
|
283
|
+
}
|
|
284
|
+
SdFilterModule.decorators = [
|
|
285
|
+
{ type: NgModule, args: [{
|
|
286
|
+
imports: [
|
|
287
|
+
CommonModule,
|
|
288
|
+
MatFormFieldModule,
|
|
289
|
+
MatInputModule,
|
|
290
|
+
MatIconModule,
|
|
291
|
+
MatTooltipModule,
|
|
292
|
+
MatButtonModule,
|
|
293
|
+
SdTranslateModule,
|
|
294
|
+
SdCommonModule,
|
|
295
|
+
SdFormModule
|
|
296
|
+
],
|
|
297
|
+
declarations: [
|
|
298
|
+
SdFilter,
|
|
299
|
+
SdFilterDefDirective,
|
|
300
|
+
SdValuesLocalPipe,
|
|
301
|
+
SdValuesServerPipe
|
|
302
|
+
],
|
|
303
|
+
providers: [
|
|
304
|
+
SdFilterService
|
|
305
|
+
],
|
|
306
|
+
exports: [
|
|
307
|
+
SdCommonModule,
|
|
308
|
+
SdFilterDefDirective,
|
|
309
|
+
SdFilter
|
|
310
|
+
]
|
|
311
|
+
},] }
|
|
312
|
+
];
|
|
313
|
+
|
|
314
|
+
/*
|
|
315
|
+
* Public API Surface of superdev-angular-core
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Generated bundle index. Do not edit.
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
export { SdFilter, SdFilterDefDirective, SdFilterModule, SdFilterService as ɵa, SdValuesLocalPipe as ɵb, SdValuesServerPipe as ɵc };
|
|
323
|
+
//# sourceMappingURL=sd-angular-core-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sd-angular-core-filter.js","sources":["../../../../projects/sd-core/filter/src/lib/directives/sd-filter-def.directive.ts","../../../../projects/sd-core/filter/src/lib/filter.service.ts","../../../../projects/sd-core/filter/src/lib/filter.component.ts","../../../../projects/sd-core/filter/src/lib/pipes/values-local.pipe.ts","../../../../projects/sd-core/filter/src/lib/pipes/values-server.pipe.ts","../../../../projects/sd-core/filter/src/lib/filter.module.ts","../../../../projects/sd-core/filter/src/public-api.ts","../../../../projects/sd-core/filter/sd-angular-core-filter.ts"],"sourcesContent":["import { Directive, Input, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdFilterDef]'\r\n})\r\nexport class SdFilterDefDirective {\r\n @Input() sdFilterDef: string;\r\n defaultShowing: boolean;\r\n @Input('defaultShowing') set _defaultShowing(val: boolean | '') {\r\n this.defaultShowing = (val === '') || val;\r\n }\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport hash from 'object-hash';\r\nimport { SdSettingService } from '@sd-angular/core/setting';\r\nimport { SdFilterInformation } from './filter.model';\r\n\r\n@Injectable()\r\nexport class SdFilterService {\r\n #prefix = '61d22e8e-eee8-4aad-8e1c-044a532fea91';\r\n constructor(private settingService: SdSettingService) {\r\n }\r\n get = async (key: string): Promise<SdFilterInformation> => {\r\n if (!key) {\r\n return {\r\n selectedQuickFilter: null,\r\n quickFilters: [],\r\n filter: {}\r\n }\r\n }\r\n const { get } = this.settingService.create<SdFilterInformation>({\r\n prefix: this.#prefix,\r\n key\r\n });\r\n const configuration = await get();\r\n return {\r\n selectedQuickFilter: configuration?.selectedQuickFilter ?? null,\r\n quickFilters: configuration?.quickFilters || [],\r\n filter: configuration?.filter || {}\r\n };\r\n }\r\n\r\n set = async (key: string, configuration: SdFilterInformation): Promise<SdFilterInformation> => {\r\n configuration = {\r\n selectedQuickFilter: configuration?.selectedQuickFilter ?? null,\r\n quickFilters: configuration?.quickFilters || [],\r\n filter: configuration?.filter || {}\r\n };\r\n if (!key) {\r\n return configuration;\r\n }\r\n const { set } = this.settingService.create<SdFilterInformation>({\r\n prefix: this.#prefix,\r\n key\r\n });\r\n key = hash({\r\n prefix: this.#prefix,\r\n key\r\n });\r\n await set(configuration);\r\n return configuration;\r\n }\r\n}\r\n","import { Component, Input, Output, EventEmitter, ViewChild, AfterViewInit, OnDestroy, ContentChildren, QueryList } from '@angular/core';\r\nimport { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';\r\nimport { map, startWith, switchMap } from 'rxjs/operators';\r\nimport * as uuid from 'uuid';\r\nimport * as hash from 'object-hash';\r\nimport { DeviceDetectorService } from 'ngx-device-detector';\r\nimport { SdFilterDefDirective } from './directives/sd-filter-def.directive';\r\nimport { Filter, SdFilterInformation, FilterObject, SdFilterOption, SdQuickFilter } from './filter.model';\r\nimport { SdFilterService } from './filter.service';\r\nimport { SdSetting, SdSettingService } from '@sd-angular/core/setting';\r\nimport { SdCacheService } from '@sd-angular/core/cache';\r\n\r\n@Component({\r\n selector: 'sd-filter',\r\n templateUrl: './filter.component.html',\r\n styleUrls: ['./filter.component.scss']\r\n})\r\nexport class SdFilter implements AfterViewInit, OnDestroy {\r\n #prefix = '61d22e8e-eee8-4aad-8e1c-044a532fea91';\r\n setting: SdSetting<SdFilterInformation>;\r\n filterOption: SdFilterOption;\r\n @Input('option') set _filterOption(option: SdFilterOption) {\r\n console.log(option);\r\n if (option) {\r\n this.filterOption = option;\r\n this.#filterOptionChanges.next(option);\r\n }\r\n }\r\n #filterOptionChanges = new BehaviorSubject<SdFilterOption>(null);\r\n #subscription = new Subscription();\r\n @ContentChildren(SdFilterDefDirective) sdFilterDefs = new QueryList<SdFilterDefDirective>();\r\n isMobileOrTablet = false;\r\n filterChanges = new BehaviorSubject<FilterObject>({});\r\n filterInformation: Observable<SdFilterInformation>;\r\n information: SdFilterInformation;\r\n constructor(\r\n private deviceService: DeviceDetectorService,\r\n private settingService: SdSettingService,\r\n private filterService: SdFilterService) {\r\n this.isMobileOrTablet = !this.deviceService.isDesktop();\r\n }\r\n\r\n ngOnInit() {\r\n // if (!this.#key) {\r\n // this.setting = this.settingService.create<SdFilterInformation>(uuid.v4(), {\r\n // type: 'session',\r\n // default: {\r\n // filter: {},\r\n // visible: {},\r\n // quickFilters: [],\r\n // selectedQuickFilter: null\r\n // }\r\n // });\r\n // } else {\r\n // this.setting = this.settingService.create<SdFilterInformation>(this.#key, {\r\n // default: {\r\n // filter: {},\r\n // visible: {},\r\n // quickFilters: [],\r\n // selectedQuickFilter: null\r\n // }\r\n // });\r\n // }\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n this.#subscription.add(this.#filterOptionChanges.pipe(startWith(this.filterOption)).subscribe((filterOption) => {\r\n console.log(filterOption);\r\n if (!filterOption) {\r\n return;\r\n }\r\n const defaultInformation: SdFilterInformation = {\r\n filter: {},\r\n visible: {},\r\n quickFilters: filterOption?.quickFilter?.defaults || [],\r\n selectedQuickFilter: filterOption?.quickFilter?.selectedDefault\r\n };\r\n if (!filterOption.key) {\r\n this.setting = this.settingService.create<SdFilterInformation>(uuid.v4(), {\r\n type: 'session',\r\n default: defaultInformation\r\n });\r\n } else {\r\n this.setting = this.settingService.create<SdFilterInformation>({\r\n prefix: this.#prefix,\r\n key: filterOption.key\r\n }, {\r\n default: defaultInformation\r\n });\r\n }\r\n this.information = this.setting.get();\r\n console.log(this.information);\r\n this.#subscription.add(this.setting.observer.subscribe(filterInformation => {\r\n this.information = filterInformation;\r\n this.#format(filterOption?.filters, this.information);\r\n }));\r\n }));\r\n }\r\n\r\n onFilter = (filter?: Filter) => {\r\n this.filterChanges.next({\r\n filter: { ...this.information.filter },\r\n filterDef: { ...this.information.filterDef },\r\n });\r\n this.setting.set(this.information);\r\n }\r\n\r\n onClear = () => {\r\n this.information.filter = {};\r\n this.information.filterDef = {};\r\n this.onFilter();\r\n }\r\n\r\n #format = (filters: Filter[], information: SdFilterInformation) => {\r\n for (const filter of filters) {\r\n if (filter.type === 'daterange') {\r\n information.filter[filter.field] = {\r\n from: information.filter[filter.field]?.from ?? undefined,\r\n to: information.filter[filter.field]?.to ?? undefined\r\n };\r\n } else {\r\n information.filter[filter.field] = information.filter[filter.field] ?? undefined;\r\n }\r\n }\r\n }\r\n\r\n #firstLoad = (filters: Filter[], information: SdFilterInformation) => {\r\n if (information.selectedQuickFilter && information.quickFilters.some(e => e.code === information.selectedQuickFilter)) {\r\n const selected = information.quickFilters.find(e => e.code === information.selectedQuickFilter);\r\n information.filter = { ...selected.filter };\r\n information.filterDef = { ...selected.filterDef };\r\n this.#format(filters, information);\r\n } else {\r\n for (const filter of filters) {\r\n if (filter.type === 'daterange') {\r\n information.filter[filter.field] = {\r\n from: information.filter[filter.field]?.from ?? filter.default?.from ?? undefined,\r\n to: information.filter[filter.field]?.to ?? filter.default?.to ?? undefined\r\n };\r\n } else {\r\n information.filter[filter.field] = information.filter[filter.field] ?? filter.default ?? undefined;\r\n }\r\n }\r\n }\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n setFilter = (args: {\r\n filter: any,\r\n filterDef: any\r\n }) => {\r\n const { filter, filterDef } = args;\r\n this.information = {\r\n ...this.information,\r\n filter: { ...filter },\r\n filterDef: { ...filterDef }\r\n };\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { ValuesLocalFilter } from '../filter.model';\r\n\r\n@Pipe({\r\n name: 'sdValuesLocal'\r\n})\r\nexport class SdValuesLocalPipe implements PipeTransform {\r\n transform = async (filterValues: ValuesLocalFilter): Promise<any[]> => {\r\n if(typeof(filterValues?.option?.items) === 'function') {\r\n return await filterValues?.option?.items();\r\n }\r\n return filterValues?.option?.items || [];\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { ValuesLocalFilter, ValuesServerFilter } from '../filter.model';\r\n\r\n@Pipe({\r\n name: 'sdValuesServer'\r\n})\r\nexport class SdValuesServerPipe implements PipeTransform {\r\n transform = (filterValues: ValuesServerFilter): any[] | ((searchText: string | string[], isFormValue?: boolean) => Promise<any[]>) => {\r\n if(typeof(filterValues?.option?.items) === 'function') {\r\n return filterValues?.option?.items;\r\n }\r\n return filterValues?.option?.items || [];\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdFilterDefDirective } from './directives/sd-filter-def.directive';\r\nimport { SdFilter } from './filter.component';\r\nimport { SdFormModule } from '@sd-angular/core/form';\r\nimport { SdValuesLocalPipe } from './pipes/values-local.pipe';\r\nimport { SdValuesServerPipe } from './pipes/values-server.pipe';\r\nimport { SdFilterService } from './filter.service';\r\nimport { MatButtonModule } from '@angular/material/button';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n MatButtonModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdFormModule\r\n ],\r\n declarations: [\r\n SdFilter,\r\n SdFilterDefDirective,\r\n SdValuesLocalPipe,\r\n SdValuesServerPipe\r\n ],\r\n providers: [\r\n SdFilterService\r\n ],\r\n exports: [\r\n SdCommonModule,\r\n SdFilterDefDirective,\r\n SdFilter\r\n ]\r\n})\r\nexport class SdFilterModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/filter.module';\r\nexport * from './lib/directives/sd-filter-def.directive';\r\nexport * from './lib/filter.model';\r\nexport * from './lib/filter.component';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {SdFilterService as ɵa} from './src/lib/filter.service';\nexport {SdValuesLocalPipe as ɵb} from './src/lib/pipes/values-local.pipe';\nexport {SdValuesServerPipe as ɵc} from './src/lib/pipes/values-server.pipe';"],"names":["_prefix","uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,oBAAoB;IAM/B,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;IAHrD,IAA6B,eAAe,CAAC,GAAiB;QAC5D,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC;KAC3C;;;YARF,SAAS,SAAC;gBACT,QAAQ,EAAE,eAAe;aAC1B;;;YAJ0B,WAAW;;;0BAMnC,KAAK;8BAEL,KAAK,SAAC,gBAAgB;;;;MCFZ,eAAe;IAE1B,YAAoB,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;QADpD,kBAAU,sCAAsC,EAAC;QAGjD,QAAG,GAAG,CAAO,GAAW;;YACtB,IAAI,CAAC,GAAG,EAAE;gBACR,OAAO;oBACL,mBAAmB,EAAE,IAAI;oBACzB,YAAY,EAAE,EAAE;oBAChB,MAAM,EAAE,EAAE;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AAZ,YAAY,CAAE,MAAM,0CAAE,KAAK,KAAI,EAAE,CAAC;SAC1C,CAAA,CAAA;KACF;;;YAVA,IAAI,SAAC;gBACJ,IAAI,EAAE,eAAe;aACtB;;;MCCY,kBAAkB;IAH/B;QAIE,cAAS,GAAG,CAAC,YAAgC;;YAC3C,IAAG,cAAO,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,0CAAE,KAAK,CAAC,KAAK,UAAU,EAAE;gBACrD,aAAO,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,0CAAE,KAAK,CAAC;aACpC;YACD,OAAO,OAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,0CAAE,KAAK,KAAI,EAAE,CAAC;SAC1C,CAAA;KACF;;;YAVA,IAAI,SAAC;gBACJ,IAAI,EAAE,gBAAgB;aACvB;;;MCsCY,cAAc;;;YA3B1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,eAAe;oBACf,iBAAiB;oBACjB,cAAc;oBACd,YAAY;iBACb;gBACD,YAAY,EAAE;oBACZ,QAAQ;oBACR,oBAAoB;oBACpB,iBAAiB;oBACjB,kBAAkB;iBACnB;gBACD,SAAS,EAAE;oBACT,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,oBAAoB;oBACpB,QAAQ;iBACT;aACF;;;AC1CD;;;;ACAA;;;;;;"}
|
|
@@ -798,14 +798,27 @@ class SdGridConfigurationService {
|
|
|
798
798
|
return __classPrivateFieldGet(this, _default).call(this, gridOption);
|
|
799
799
|
}
|
|
800
800
|
const { columns, config } = gridOption;
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
801
|
+
let configuration;
|
|
802
|
+
if ((config === null || config === void 0 ? void 0 : config.storage) === 'server') {
|
|
803
|
+
const { get, remove } = this.settingService.createServer(key, {
|
|
804
|
+
args: config === null || config === void 0 ? void 0 : config.args
|
|
805
|
+
});
|
|
806
|
+
configuration = yield get().catch(() => undefined);
|
|
807
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.columns)) {
|
|
808
|
+
remove().catch(console.error);
|
|
809
|
+
return __classPrivateFieldGet(this, _default).call(this, gridOption);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
const { get, remove } = this.settingService.create(key, {
|
|
814
|
+
type: config === null || config === void 0 ? void 0 : config.storage,
|
|
815
|
+
args: config === null || config === void 0 ? void 0 : config.args
|
|
816
|
+
});
|
|
817
|
+
configuration = get();
|
|
818
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.columns)) {
|
|
819
|
+
remove();
|
|
820
|
+
return __classPrivateFieldGet(this, _default).call(this, gridOption);
|
|
821
|
+
}
|
|
809
822
|
}
|
|
810
823
|
configuration.columns = configuration.columns
|
|
811
824
|
.filter(column => column.isGeneratedColumn || columns.some(e => !e.hidden && e.field === column.origin.field));
|
|
@@ -837,27 +850,43 @@ class SdGridConfigurationService {
|
|
|
837
850
|
});
|
|
838
851
|
});
|
|
839
852
|
_set.set(this, (gridOption, configuration) => {
|
|
840
|
-
var _a, _b;
|
|
853
|
+
var _a, _b, _c, _d;
|
|
841
854
|
const key = __classPrivateFieldGet(this, _getKey).call(this, gridOption);
|
|
842
855
|
if (key) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
856
|
+
if (((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _a === void 0 ? void 0 : _a.storage) === 'server') {
|
|
857
|
+
const { set } = this.settingService.createServer(key, {
|
|
858
|
+
args: (_b = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _b === void 0 ? void 0 : _b.args
|
|
859
|
+
});
|
|
860
|
+
set(configuration);
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
const { set } = this.settingService.create(key, {
|
|
864
|
+
type: (_c = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _c === void 0 ? void 0 : _c.storage,
|
|
865
|
+
args: (_d = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _d === void 0 ? void 0 : _d.args
|
|
866
|
+
});
|
|
867
|
+
set(configuration);
|
|
868
|
+
}
|
|
848
869
|
}
|
|
849
870
|
return JSON.parse(JSON.stringify(configuration));
|
|
850
871
|
});
|
|
851
872
|
_remove.set(this, (gridOption) => {
|
|
852
873
|
return () => {
|
|
853
|
-
var _a, _b;
|
|
874
|
+
var _a, _b, _c, _d;
|
|
854
875
|
const key = __classPrivateFieldGet(this, _getKey).call(this, gridOption);
|
|
855
876
|
if (key) {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
877
|
+
if (((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _a === void 0 ? void 0 : _a.storage) === 'server') {
|
|
878
|
+
const { remove } = this.settingService.createServer(key, {
|
|
879
|
+
args: (_b = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _b === void 0 ? void 0 : _b.args
|
|
880
|
+
});
|
|
881
|
+
remove();
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
const { remove } = this.settingService.create(key, {
|
|
885
|
+
type: (_c = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _c === void 0 ? void 0 : _c.storage,
|
|
886
|
+
args: (_d = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _d === void 0 ? void 0 : _d.args
|
|
887
|
+
});
|
|
888
|
+
remove();
|
|
889
|
+
}
|
|
861
890
|
}
|
|
862
891
|
};
|
|
863
892
|
}
|
|
@@ -2662,16 +2691,24 @@ class SdGeneratedColumnService {
|
|
|
2662
2691
|
key: configuration.key
|
|
2663
2692
|
});
|
|
2664
2693
|
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2694
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
2695
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.createServer(key, {
|
|
2696
|
+
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
2697
|
+
default: []
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
else {
|
|
2701
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2702
|
+
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
2703
|
+
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
2704
|
+
default: []
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2670
2707
|
}
|
|
2671
2708
|
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2672
2709
|
};
|
|
2673
2710
|
this.loadSystem = (configuration) => {
|
|
2674
|
-
var _a;
|
|
2711
|
+
var _a, _b;
|
|
2675
2712
|
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
2676
2713
|
return null;
|
|
2677
2714
|
}
|
|
@@ -2683,11 +2720,19 @@ class SdGeneratedColumnService {
|
|
|
2683
2720
|
key: configuration.key
|
|
2684
2721
|
});
|
|
2685
2722
|
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2723
|
+
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
2724
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.createServer(key, {
|
|
2725
|
+
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
2726
|
+
default: []
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
else {
|
|
2730
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2731
|
+
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
2732
|
+
args: (_b = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _b === void 0 ? void 0 : _b.args,
|
|
2733
|
+
default: []
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2691
2736
|
}
|
|
2692
2737
|
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2693
2738
|
};
|
|
@@ -3113,7 +3158,7 @@ SdGridQuickAction.decorators = [
|
|
|
3113
3158
|
selector: 'sd-grid-quick-action',
|
|
3114
3159
|
template: "<sd-quick-action *ngIf=\"selectedItems | selectionActionFilter: gridOption?.selection?.actions as actions\"\r\n [isOpened]=\"actions?.length\">\r\n <div class=\"d-flex align-items-center\" sdMessage>\r\n <div class=\"c-bg-length\">\r\n <span class=\"c-length\">{{ selectedItems.length }}</span>\r\n </div>\r\n <div class=\"c-message\">{{ gridOption?.selection?.message || (\"selected items\" | sdTranslate) }}</div>\r\n </div>\r\n <div class=\"d-flex align-items-center mr-8\" sdAction>\r\n <ng-container *ngFor=\"let action of actions\">\r\n <sd-button *ngIf=\"action.click\" class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" (action)=\"action.click(selectedItems)\"></sd-button>\r\n <ng-container *ngIf=\"action.children?.length\">\r\n <sd-button class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon || 'more_vert'\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" [matMenuTriggerFor]=\"menu\">\r\n </sd-button>\r\n <mat-menu #menu=\"matMenu\">\r\n <span>\r\n <button *ngFor=\"let childAction of action.children\" mat-menu-item (click)=\"childAction.click(selectedItems)\"\r\n [disabled]=\"childAction.disabled\">\r\n <mat-icon [fontSet]=\"childAction.fontSet\" class=\"c-icon\">{{ childAction.icon }}\r\n </mat-icon>\r\n <span> {{ childAction.title }}</span>\r\n </button>\r\n </span>\r\n </mat-menu>\r\n </ng-container>\r\n </ng-container>\r\n <sd-button class=\"ml-5\" icon=\"close\" color=\"secondary\" type=\"outline\" size=\"sm\"\r\n (action)=\"onClear()\" width=\"35px\"></sd-button>\r\n </div>\r\n</sd-quick-action>",
|
|
3115
3160
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3116
|
-
styles: [".c-bg-length{align-items:flex-start;background:#2962ff;border-radius:4px 0 0 4px;display:flex;flex-direction:column;height:48px;left:0;padding:12px 8px;position:static;top:0;width:
|
|
3161
|
+
styles: [".c-bg-length{align-items:flex-start;background:#2962ff;border-radius:4px 0 0 4px;display:flex;flex-direction:column;height:48px;left:0;min-width:48px;padding:12px 8px;position:static;top:0;width:auto}.c-bg-length .c-length{color:#fff;font-size:16px;font-weight:500;height:24px;left:8px;line-height:24px;min-width:32px;text-align:center;top:12px;width:auto}.c-bg-length .c-length,.c-message{font-family:Roboto;font-style:normal;position:static}.c-message{color:#000;font-size:14px;font-weight:400;height:20px;left:0;line-height:20px;margin:0 0 0 16px;min-width:200px;top:6px}"]
|
|
3117
3162
|
},] }
|
|
3118
3163
|
];
|
|
3119
3164
|
SdGridQuickAction.ctorParameters = () => [];
|