@dev-tcloud/tcloud-ui 0.0.40 → 0.0.41
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/esm2020/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.component.mjs +21 -12
- package/fesm2015/dev-tcloud-tcloud-ui.mjs +20 -12
- package/fesm2015/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/fesm2020/dev-tcloud-tcloud-ui.mjs +20 -11
- package/fesm2020/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2776,7 +2776,7 @@ class TCloudUiFiltersComponent {
|
|
|
2776
2776
|
ngOnChanges(changes) {
|
|
2777
2777
|
if (changes && changes['data']) {
|
|
2778
2778
|
const data = changes['data'].currentValue;
|
|
2779
|
-
console.log('ngOnChanges data', data);
|
|
2779
|
+
//console.log('ngOnChanges data', data);
|
|
2780
2780
|
if (this._data !== data) {
|
|
2781
2781
|
this._data = JSON.parse(JSON.stringify(data));
|
|
2782
2782
|
this.search_data = JSON.parse(JSON.stringify(data));
|
|
@@ -2815,13 +2815,10 @@ class TCloudUiFiltersComponent {
|
|
|
2815
2815
|
const nextKeys = pathArray.slice(i + 1);
|
|
2816
2816
|
const index = key.substring(key.indexOf('[') + 1, key.indexOf(']'));
|
|
2817
2817
|
const arrayKey = key.substring(0, key.indexOf('['));
|
|
2818
|
-
if (current[arrayKey][index]) {
|
|
2819
|
-
console.log('current[arrayKey][index]', current[arrayKey][index]);
|
|
2818
|
+
if (current && current[arrayKey] && current[arrayKey][index]) {
|
|
2819
|
+
//console.log('current[arrayKey][index]', current[arrayKey][index]);
|
|
2820
2820
|
return this.collectionFind(current[arrayKey][index], nextKeys.join("."));
|
|
2821
2821
|
}
|
|
2822
|
-
else {
|
|
2823
|
-
return undefined;
|
|
2824
|
-
}
|
|
2825
2822
|
}
|
|
2826
2823
|
if (key.includes("[]")) {
|
|
2827
2824
|
const arrayKey = key.replace("[]", "");
|
|
@@ -2840,6 +2837,9 @@ class TCloudUiFiltersComponent {
|
|
|
2840
2837
|
return results;
|
|
2841
2838
|
}
|
|
2842
2839
|
else {
|
|
2840
|
+
if (!current || (current && !current[key])) {
|
|
2841
|
+
return undefined;
|
|
2842
|
+
}
|
|
2843
2843
|
current = current[key];
|
|
2844
2844
|
if (current === undefined) {
|
|
2845
2845
|
return undefined;
|
|
@@ -2863,7 +2863,8 @@ class TCloudUiFiltersComponent {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
2865
|
for (let i = 0; i < (this.data).length; i++) {
|
|
2866
|
-
this.data[i]['tc_filter_accept'] = true;
|
|
2866
|
+
// this.data[i]['tc_filter_accept'] = true;
|
|
2867
|
+
this.setDataIndex(i, true);
|
|
2867
2868
|
for (let j = 0; j < (this.filters).length; j++) {
|
|
2868
2869
|
const filter_item = this.filters[j];
|
|
2869
2870
|
if (filter_item.searchText && typeof (filter_item.searchText) === 'string' && filter_item.searchText !== '') {
|
|
@@ -2872,9 +2873,12 @@ class TCloudUiFiltersComponent {
|
|
|
2872
2873
|
if (item_value) {
|
|
2873
2874
|
item_value = this.normalize(item_value);
|
|
2874
2875
|
if (!(item_value.includes(filter_item.searchText) || item_value === filter_item.searchText)) {
|
|
2875
|
-
this.
|
|
2876
|
+
this.setDataIndex(i, false);
|
|
2876
2877
|
}
|
|
2877
2878
|
}
|
|
2879
|
+
else {
|
|
2880
|
+
this.setDataIndex(i, false);
|
|
2881
|
+
}
|
|
2878
2882
|
}
|
|
2879
2883
|
if (typeof (filter_item.searchText) === 'boolean' && filter_item.searchText) {
|
|
2880
2884
|
let item_value = this.collectionFind(this.data[i], filter_item.searchIn);
|
|
@@ -2887,12 +2891,12 @@ class TCloudUiFiltersComponent {
|
|
|
2887
2891
|
}
|
|
2888
2892
|
}
|
|
2889
2893
|
if (qtd_is_true === 0) {
|
|
2890
|
-
this.
|
|
2894
|
+
this.setDataIndex(i, false);
|
|
2891
2895
|
}
|
|
2892
2896
|
}
|
|
2893
2897
|
else {
|
|
2894
2898
|
if (!(item_value === filter_item.searchText)) {
|
|
2895
|
-
this.
|
|
2899
|
+
this.setDataIndex(i, false);
|
|
2896
2900
|
}
|
|
2897
2901
|
}
|
|
2898
2902
|
}
|
|
@@ -2910,7 +2914,7 @@ class TCloudUiFiltersComponent {
|
|
|
2910
2914
|
}
|
|
2911
2915
|
if (is_filter) {
|
|
2912
2916
|
for (let i = 0; i < (this.data).length; i++) {
|
|
2913
|
-
if (this.data[i]
|
|
2917
|
+
if (this.data && this.data[i] && this.data[i]['tc_filter_accept']) {
|
|
2914
2918
|
(search_data).push(this.data[i]);
|
|
2915
2919
|
}
|
|
2916
2920
|
}
|
|
@@ -2919,6 +2923,11 @@ class TCloudUiFiltersComponent {
|
|
|
2919
2923
|
}
|
|
2920
2924
|
this.result.emit(this.data);
|
|
2921
2925
|
}
|
|
2926
|
+
setDataIndex(index, value) {
|
|
2927
|
+
if (this.data && this.data[index]) {
|
|
2928
|
+
this.data[index]['tc_filter_accept'] = value;
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2922
2931
|
}
|
|
2923
2932
|
TCloudUiFiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2924
2933
|
TCloudUiFiltersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TCloudUiFiltersComponent, selector: "tcloud-ui-filters", inputs: { data: "data", filters: "filters" }, outputs: { result: "result" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"show_filters\" class=\"area-filter\">\n <ng-container *ngFor=\"let item of filters; let i = index\">\n\n <ng-container *ngIf=\"!item.type || (item.type && item.type !== 'boolean')\">\n \n <div class=\"box-filter-input\" [style]=\"(item.width !== '') ? 'width:'+item.width : ''\">\n <div class=\"m-description\"><i [class.to-active]=\"_input.value !== ''\" class=\"fas fa-filter icon-filter\"></i> {{ item.description }}</div>\n <div>\n <input \n #_input\n placeholder=\"{{ (item.placeholder !== '') ? item.placeholder : '' }}\"\n name=\"input_{{i+1}}\" \n type=\"text\" \n class=\"form-control tc-form-control\" \n (keyup)=\"searchIn(item, $event)\">\n <button class=\"btn-clear-filter-text\" [class.to-hide]=\"_input.value === ''\" (click)=\"searchIn(item, null); _input.value = ''\">\n <i class=\"fas fa-times\"></i>\n </button>\n </div>\n </div>\n \n </ng-container>\n\n <ng-container *ngIf=\"item.type && item.type === 'boolean'\">\n \n <div class=\"box-filter-input\" [style]=\"(item.width !== '') ? 'width:'+item.width : ''\">\n <div class=\"m-description\"><i [class.to-active]=\"_input.checked === true\" class=\"fas fa-filter icon-filter\"></i> {{ item.description }}</div>\n <div class=\"area-input-checkbox\">\n <div class=\"form-control tc-form-control\">\n <label>\n {{ item.placeholder }}\n <input \n #_input\n placeholder=\"{{ (item.placeholder !== '') ? item.placeholder : '' }}\"\n name=\"input_{{i+1}}\" \n type=\"checkbox\" \n (change)=\"searchIn(item, _input.checked)\"> \n </label>\n </div> \n </div>\n </div>\n\n </ng-container>\n\n\n </ng-container>\n</div>\n\n<!-- <pre>{{ inputs | json }}</pre> -->\n <!-- <pre> {{ data | json }} </pre> -->\n\n<!-- <p>FILTERS</p>\n<pre> {{ filters | json }}</pre> -->", styles: [".box-filter-input{display:inline-block;padding:10px 5px;position:relative}.area-filter{border:1px solid #eeeeee;border-radius:5px;margin-bottom:5px}.btn-clear-filter-text{position:absolute;right:8px;top:38px;background-color:#fff;border:none;cursor:pointer;color:#aaa}.to-hide{display:none}.icon-filter{color:#ccc}.to-active{color:var(--verde)}.area-input-checkbox label{cursor:pointer;margin-bottom:0;color:#9f9f9f}.m-description{margin-bottom:3px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|