@dev-tcloud/tcloud-ui 0.0.32 → 0.0.34
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 +1 -0
- package/esm2020/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.component.mjs +123 -0
- package/esm2020/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.mjs +2 -0
- package/esm2020/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.module.mjs +28 -0
- package/esm2020/lib/tcloud-ui.module.mjs +8 -1
- package/esm2020/public-api.mjs +5 -1
- package/fesm2015/dev-tcloud-tcloud-ui.mjs +151 -1
- package/fesm2015/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/fesm2020/dev-tcloud-tcloud-ui.mjs +150 -1
- package/fesm2020/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.component.d.ts +25 -0
- package/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.d.ts +9 -0
- package/lib/_modules/tcloud-ui-filters/tcloud-ui-filters.module.d.ts +9 -0
- package/lib/tcloud-ui.module.d.ts +4 -3
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -2747,6 +2747,149 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
2747
2747
|
}]
|
|
2748
2748
|
}], ctorParameters: function () { return []; } });
|
|
2749
2749
|
|
|
2750
|
+
class TCloudUiFiltersComponent {
|
|
2751
|
+
constructor() {
|
|
2752
|
+
this.inputs = [];
|
|
2753
|
+
this.show_filters = false;
|
|
2754
|
+
this.result = new EventEmitter();
|
|
2755
|
+
}
|
|
2756
|
+
set data(data) {
|
|
2757
|
+
//this._data = data;
|
|
2758
|
+
}
|
|
2759
|
+
get data() { return this._data; }
|
|
2760
|
+
set filters(filters) {
|
|
2761
|
+
//this._filters = filters;
|
|
2762
|
+
}
|
|
2763
|
+
get filters() { return this._filters; }
|
|
2764
|
+
ngOnInit() {
|
|
2765
|
+
}
|
|
2766
|
+
ngOnChanges(changes) {
|
|
2767
|
+
const data = changes['data'].currentValue;
|
|
2768
|
+
if (this._data !== data) {
|
|
2769
|
+
this._data = JSON.parse(JSON.stringify(data));
|
|
2770
|
+
this.search_data = JSON.parse(JSON.stringify(data));
|
|
2771
|
+
this.init();
|
|
2772
|
+
}
|
|
2773
|
+
const filters = changes['filters'].currentValue;
|
|
2774
|
+
if (this._filters !== filters) {
|
|
2775
|
+
this._filters = JSON.parse(JSON.stringify(filters));
|
|
2776
|
+
this.init();
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
init() {
|
|
2780
|
+
if (this.data && this.filters) {
|
|
2781
|
+
this.show_filters = true;
|
|
2782
|
+
this.toResult();
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
normalize(text) {
|
|
2786
|
+
const v = (((`${text}`).normalize('NFD').replace(/[\u0300-\u036f]/g, "")).trim()).toLowerCase();
|
|
2787
|
+
return v;
|
|
2788
|
+
}
|
|
2789
|
+
fetchFromObject(obj, prop) {
|
|
2790
|
+
if (typeof obj === 'undefined') {
|
|
2791
|
+
return false;
|
|
2792
|
+
}
|
|
2793
|
+
var _index = `${prop}`.indexOf('.');
|
|
2794
|
+
if (_index > -1) {
|
|
2795
|
+
return this.fetchFromObject(obj[prop.substring(0, _index)], prop.substr(_index + 1));
|
|
2796
|
+
}
|
|
2797
|
+
return obj[prop];
|
|
2798
|
+
}
|
|
2799
|
+
searchIn(item, event) {
|
|
2800
|
+
if (typeof event === 'boolean') {
|
|
2801
|
+
item.searchText = event;
|
|
2802
|
+
}
|
|
2803
|
+
else {
|
|
2804
|
+
if (event === null) {
|
|
2805
|
+
item.searchText = '';
|
|
2806
|
+
}
|
|
2807
|
+
else {
|
|
2808
|
+
item.searchText = (event.target.value).toUpperCase();
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
for (let i = 0; i < (this.data).length; i++) {
|
|
2812
|
+
this.data[i]['tc_filter_accept'] = true;
|
|
2813
|
+
for (let j = 0; j < (this.filters).length; j++) {
|
|
2814
|
+
const filter_item = this.filters[j];
|
|
2815
|
+
if (filter_item.searchText && typeof (filter_item.searchText) === 'string' && filter_item.searchText !== '') {
|
|
2816
|
+
filter_item.searchText = this.normalize(filter_item.searchText);
|
|
2817
|
+
let item_value = this.fetchFromObject(this.data[i], filter_item.searchIn);
|
|
2818
|
+
if (item_value) {
|
|
2819
|
+
item_value = this.normalize(item_value);
|
|
2820
|
+
if (!(item_value.includes(filter_item.searchText) || item_value === filter_item.searchText)) {
|
|
2821
|
+
this.data[i]['tc_filter_accept'] = false;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (typeof (filter_item.searchText) === 'boolean') {
|
|
2826
|
+
let item_value = this.fetchFromObject(this.data[i], filter_item.searchIn);
|
|
2827
|
+
if (filter_item.searchText) {
|
|
2828
|
+
if (!(item_value === filter_item.searchText)) {
|
|
2829
|
+
this.data[i]['tc_filter_accept'] = false;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
this.toResult();
|
|
2836
|
+
}
|
|
2837
|
+
toResult() {
|
|
2838
|
+
const search_data = [];
|
|
2839
|
+
let is_filter = false;
|
|
2840
|
+
for (let i = 0; i < (this.filters).length; i++) {
|
|
2841
|
+
if (this.filters[i].searchText && this.filters[i].searchText !== '') {
|
|
2842
|
+
is_filter = true;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
if (is_filter) {
|
|
2846
|
+
for (let i = 0; i < (this.data).length; i++) {
|
|
2847
|
+
if (this.data[i]?.['tc_filter_accept']) {
|
|
2848
|
+
(search_data).push(this.data[i]);
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
this.result.emit(search_data);
|
|
2852
|
+
return;
|
|
2853
|
+
}
|
|
2854
|
+
this.result.emit(this.data);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
TCloudUiFiltersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2858
|
+
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><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=\"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><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=\"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}\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"] }] });
|
|
2859
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersComponent, decorators: [{
|
|
2860
|
+
type: Component,
|
|
2861
|
+
args: [{ selector: 'tcloud-ui-filters', 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><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=\"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><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=\"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}\n"] }]
|
|
2862
|
+
}], ctorParameters: function () { return []; }, propDecorators: { data: [{
|
|
2863
|
+
type: Input
|
|
2864
|
+
}], filters: [{
|
|
2865
|
+
type: Input
|
|
2866
|
+
}], result: [{
|
|
2867
|
+
type: Output
|
|
2868
|
+
}] } });
|
|
2869
|
+
|
|
2870
|
+
class TCloudUiFiltersModule {
|
|
2871
|
+
}
|
|
2872
|
+
TCloudUiFiltersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2873
|
+
TCloudUiFiltersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersModule, declarations: [TCloudUiFiltersComponent], imports: [CommonModule,
|
|
2874
|
+
FormsModule], exports: [TCloudUiFiltersComponent] });
|
|
2875
|
+
TCloudUiFiltersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersModule, imports: [CommonModule,
|
|
2876
|
+
FormsModule] });
|
|
2877
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiFiltersModule, decorators: [{
|
|
2878
|
+
type: NgModule,
|
|
2879
|
+
args: [{
|
|
2880
|
+
declarations: [
|
|
2881
|
+
TCloudUiFiltersComponent
|
|
2882
|
+
],
|
|
2883
|
+
exports: [
|
|
2884
|
+
TCloudUiFiltersComponent
|
|
2885
|
+
],
|
|
2886
|
+
imports: [
|
|
2887
|
+
CommonModule,
|
|
2888
|
+
FormsModule
|
|
2889
|
+
]
|
|
2890
|
+
}]
|
|
2891
|
+
}] });
|
|
2892
|
+
|
|
2750
2893
|
class TCloudUiModule {
|
|
2751
2894
|
}
|
|
2752
2895
|
TCloudUiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2763,6 +2906,7 @@ TCloudUiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
2763
2906
|
TCloudUiTableModule,
|
|
2764
2907
|
TCloudUiNumberStepModule,
|
|
2765
2908
|
TCloudUiScrollBoxModule,
|
|
2909
|
+
TCloudUiFiltersModule,
|
|
2766
2910
|
// Directives
|
|
2767
2911
|
TCloudUiDirectiveModule,
|
|
2768
2912
|
// Pipes
|
|
@@ -2779,6 +2923,7 @@ TCloudUiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version:
|
|
|
2779
2923
|
TCloudUiTableModule,
|
|
2780
2924
|
TCloudUiNumberStepModule,
|
|
2781
2925
|
TCloudUiScrollBoxModule,
|
|
2926
|
+
TCloudUiFiltersModule,
|
|
2782
2927
|
// Directives
|
|
2783
2928
|
TCloudUiDirectiveModule,
|
|
2784
2929
|
// Pipes
|
|
@@ -2799,6 +2944,7 @@ TCloudUiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
|
|
|
2799
2944
|
TCloudUiTableModule,
|
|
2800
2945
|
TCloudUiNumberStepModule,
|
|
2801
2946
|
TCloudUiScrollBoxModule,
|
|
2947
|
+
TCloudUiFiltersModule,
|
|
2802
2948
|
// Directives
|
|
2803
2949
|
TCloudUiDirectiveModule,
|
|
2804
2950
|
// Pipes
|
|
@@ -2815,6 +2961,7 @@ TCloudUiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
|
|
|
2815
2961
|
TCloudUiTableModule,
|
|
2816
2962
|
TCloudUiNumberStepModule,
|
|
2817
2963
|
TCloudUiScrollBoxModule,
|
|
2964
|
+
TCloudUiFiltersModule,
|
|
2818
2965
|
// Directives
|
|
2819
2966
|
TCloudUiDirectiveModule,
|
|
2820
2967
|
// Pipes
|
|
@@ -2836,6 +2983,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
2836
2983
|
TCloudUiTableModule,
|
|
2837
2984
|
TCloudUiNumberStepModule,
|
|
2838
2985
|
TCloudUiScrollBoxModule,
|
|
2986
|
+
TCloudUiFiltersModule,
|
|
2839
2987
|
// Directives
|
|
2840
2988
|
TCloudUiDirectiveModule,
|
|
2841
2989
|
// Pipes
|
|
@@ -2855,6 +3003,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
2855
3003
|
TCloudUiTableModule,
|
|
2856
3004
|
TCloudUiNumberStepModule,
|
|
2857
3005
|
TCloudUiScrollBoxModule,
|
|
3006
|
+
TCloudUiFiltersModule,
|
|
2858
3007
|
// Directives
|
|
2859
3008
|
TCloudUiDirectiveModule,
|
|
2860
3009
|
// Pipes
|
|
@@ -2875,5 +3024,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
2875
3024
|
* Generated bundle index. Do not edit.
|
|
2876
3025
|
*/
|
|
2877
3026
|
|
|
2878
|
-
export { BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, MonthNamePipe, RespectivePipe, StatusInfoPipe, TCloudUiAlignDirective, TCloudUiChoiceIssuesComponent, TCloudUiChoiceIssuesModule, TCloudUiDataListComponent, TCloudUiDataListModule, TCloudUiDataListOptionComponent, TCloudUiDirectiveModule, TCloudUiInputSearchComponent, TCloudUiInputSearchModule, TCloudUiLineStepCircleComponent, TCloudUiLineStepCircleModule, TCloudUiLinhaLogoComponent, TCloudUiLinhaLogoModule, TCloudUiLoadingTransitionsService, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModalModule, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiInputModule, TCloudUiMultiSelectComponent, TCloudUiMultiSelectModule, TCloudUiNotFoundComponent, TCloudUiNotFoundModule, TCloudUiNumberStepComponent, TCloudUiNumberStepModule, TCloudUiPipesModule, TCloudUiScrollBoxComponent, TCloudUiScrollBoxModule, TCloudUiSearchInObjectService, TCloudUiTabContentComponent, TCloudUiTabHeadComponent, TCloudUiTabMenuComponent, TCloudUiTabMenuModule, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTableModule, TCloudUiTooltipDirective };
|
|
3027
|
+
export { BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, MonthNamePipe, RespectivePipe, StatusInfoPipe, TCloudUiAlignDirective, TCloudUiChoiceIssuesComponent, TCloudUiChoiceIssuesModule, TCloudUiDataListComponent, TCloudUiDataListModule, TCloudUiDataListOptionComponent, TCloudUiDirectiveModule, TCloudUiFiltersComponent, TCloudUiFiltersModule, TCloudUiInputSearchComponent, TCloudUiInputSearchModule, TCloudUiLineStepCircleComponent, TCloudUiLineStepCircleModule, TCloudUiLinhaLogoComponent, TCloudUiLinhaLogoModule, TCloudUiLoadingTransitionsService, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModalModule, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiInputModule, TCloudUiMultiSelectComponent, TCloudUiMultiSelectModule, TCloudUiNotFoundComponent, TCloudUiNotFoundModule, TCloudUiNumberStepComponent, TCloudUiNumberStepModule, TCloudUiPipesModule, TCloudUiScrollBoxComponent, TCloudUiScrollBoxModule, TCloudUiSearchInObjectService, TCloudUiTabContentComponent, TCloudUiTabHeadComponent, TCloudUiTabMenuComponent, TCloudUiTabMenuModule, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTableModule, TCloudUiTooltipDirective };
|
|
2879
3028
|
//# sourceMappingURL=dev-tcloud-tcloud-ui.mjs.map
|