@sd-angular/core 0.0.1038 → 0.0.1042
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/assets/scss/core/color.scss +4 -0
- package/badge/sd-angular-core-badge.metadata.json +1 -1
- package/bundles/sd-angular-core-badge.umd.js +2 -2
- package/bundles/sd-angular-core-badge.umd.js.map +1 -1
- package/bundles/sd-angular-core-badge.umd.min.js +1 -1
- package/bundles/sd-angular-core-badge.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-chip.umd.js +41 -10
- 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 +96 -48
- 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/badge/src/lib/badge.component.js +3 -3
- package/esm2015/chip/src/lib/chip.component.js +34 -4
- 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/column-inline-filter/column-inline-filter.component.js +10 -7
- package/esm2015/grid-material/src/lib/components/quick-action/quick-action.component.js +1 -1
- package/esm2015/grid-material/src/lib/grid-material.component.js +1 -6
- package/esm2015/grid-material/src/lib/models/grid-column.model.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-badge.js +2 -2
- package/fesm2015/sd-angular-core-badge.js.map +1 -1
- package/fesm2015/sd-angular-core-chip.js +37 -5
- 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 +86 -43
- 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/models/grid-column.model.d.ts +1 -0
- 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.1038.tgz → sd-angular-core-0.0.1042.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-angular-core-chip.js","sources":["../../../../projects/sd-core/chip/src/lib/directives/sd-chip-display-def.directive.ts","../../../../projects/sd-core/chip/src/lib/chip.component.ts","../../../../projects/sd-core/chip/src/lib/pipes/removable-chip.pipe.ts","../../../../projects/sd-core/chip/src/lib/chip.module.ts","../../../../projects/sd-core/chip/src/public-api.ts","../../../../projects/sd-core/chip/sd-angular-core-chip.ts"],"sourcesContent":["import { Directive, Input, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdChipDisplayDef]'\r\n})\r\nexport class SdChipDisplayDef {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n OnInit, OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ElementRef,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { COMMA, ENTER } from '@angular/cdk/keycodes';\r\nimport { map, startWith, switchMap } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\nimport { NgForm, NgModel, FormControl, FormGroup, ValidatorFn, AsyncValidatorFn, Validators, FormGroupDirective } from '@angular/forms';\r\nimport { Observable, Subscription, Subject } from 'rxjs';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { SdTranslateService } from '@sd-angular/core/translate';\r\nimport { MatChipInputEvent, MatChipList } from '@angular/material/chips';\r\nimport { MatAutocomplete, MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdChipUpdate } from './chip.model';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdChipDisplayDef } from './directives/sd-chip-display-def.directive';\r\n\r\nclass SdChipErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-chip',\r\n templateUrl: './chip.component.html',\r\n styleUrls: ['./chip.component.scss']\r\n})\r\nexport class SdChip implements OnInit, OnDestroy, AfterViewInit {\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n separatorKeysCodes: number[] = [ENTER, COMMA];\r\n selectable = true;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n removable: boolean | ((item: any) => boolean) = true;\r\n @Input('removable') set _removable(val: '' | boolean | ((item: any) => boolean)) {\r\n this.removable = (val === '') || val;\r\n }\r\n #itemChanges = new Subject<any[]>();\r\n #items: any[] = [];\r\n @Input() set items(items: undefined | any[]) {\r\n if (!items) {\r\n this.#items = [];\r\n } else if (Array.isArray(items)) {\r\n this.#items = items.filter(e => (e ?? '').toString().trim() !== '');\r\n } else {\r\n this.#items = items;\r\n }\r\n this.inputControl.updateValueAndValidity();\r\n this.#itemChanges.next(this.items);\r\n }\r\n @Input() limit = 50;\r\n selectedItems: any[] = [];\r\n filteredItems: Observable<any[]>;\r\n\r\n ipt: any;\r\n\r\n // model\r\n @Input() set model(values: undefined | (string | number)[]) {\r\n if (!Array.isArray(values)) {\r\n values = [];\r\n }\r\n this.formControl.setValue(values, {\r\n emitEvent: false\r\n });\r\n }\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n min: number;\r\n @Input('min') set pMin(val: number | string) {\r\n this.min = +val || 0;\r\n this.#updateValidator();\r\n }\r\n max: number;\r\n @Input('max') set pMax(val: number | string) {\r\n this.max = +val || 0;\r\n this.#updateValidator();\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n this.inputControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n this.inputControl.enable();\r\n }\r\n }\r\n\r\n @Output() sdChange = new EventEmitter<any[]>();\r\n @Output() sdUpdate = new EventEmitter<SdChipUpdate>();\r\n @Output() chipSelected = new EventEmitter<any>();\r\n\r\n @ViewChild('input') input: ElementRef<HTMLInputElement>;\r\n @ViewChild('auto') matAutocomplete: MatAutocomplete;\r\n @ViewChild('chipList', { static: true }) chipList: MatChipList;\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n @ContentChild(SdChipDisplayDef) sdChipDisplay: SdChipDisplayDef;\r\n inputControl = new FormControl();\r\n formControl = new FormControl();\r\n matcher = new SdChipErrotStateMatcher(this.formControl);\r\n #subscription = new Subscription();\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.filteredItems = this.inputControl.valueChanges.pipe(\r\n startWith<string | { [key: string]: string }>(''),\r\n map(item => typeof item === 'string' ? item : (item?.[this.displayField] ?? '')),\r\n map(name => this.filter(name))\r\n );\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(() => {\r\n const values: (string | number)[] = this.formControl.value || [];\r\n this.selectedItems = this.#items.filter(item => values.findIndex(value => value === item?.[this.valueField]) !== -1);\r\n this.modelChange.emit(values);\r\n this.sdChange.emit(values);\r\n setTimeout(() => {\r\n this.#form?.markAsDirty();\r\n }, 0);\r\n }));\r\n this.#subscription.add(this.#itemChanges.pipe(startWith(this.#items)).subscribe(() => {\r\n const values: (string | number)[] = this.formControl.value || [];\r\n this.selectedItems = [];\r\n for (const value of values) {\r\n const item = this.#items.find(e => e?.[this.valueField] === value) || {};\r\n this.selectedItems.push({\r\n ...item,\r\n [this.valueField]: value\r\n });\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.min > 0) {\r\n validators.push(Validators.minLength(this.min));\r\n }\r\n if (this.max > 0) {\r\n validators.push(Validators.maxLength(this.max));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n filter = (value: string): { [key: string]: string }[] => {\r\n return this.#items\r\n .filter(item => {\r\n if (this.formControl.value?.some(val => val === item[this.valueField])) {\r\n return false;\r\n }\r\n return !value || this.utilityService.changeAliasLowerCase(item[this.displayField])\r\n .indexOf(this.utilityService.changeAliasLowerCase(value)) !== -1;\r\n }).filter((item, index) => index < this.limit);\r\n }\r\n\r\n onAdd = (event: MatChipInputEvent): void => {\r\n // Add item only when MatAutocomplete is not open\r\n // To make sure this does not conflict with OptionSelected Event\r\n if (!this.matAutocomplete.isOpen) {\r\n const value = (event.value ?? '').toString().toLowerCase().trim();\r\n if (value) {\r\n\r\n const item = this.#items.find(e => e[this.displayField]\r\n && e[this.displayField].toString().toLowerCase().trim() === value);\r\n\r\n if (item) {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n values.push(item[this.valueField]);\r\n this.formControl.setValue(values);\r\n }\r\n }\r\n this.inputControl.setValue('');\r\n }\r\n }\r\n\r\n onRemove = (item: any): void => {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n this.formControl.setValue(values.filter(value => item?.[this.valueField] !== value));\r\n this.inputControl.setValue('');\r\n }\r\n\r\n select = (item: any): void => {\r\n this.chipSelected.emit(item);\r\n }\r\n\r\n selected = (event: MatAutocompleteSelectedEvent): void => {\r\n const value = (event.option.value?.[this.valueField] ?? '').toString().trim();\r\n if (value) {\r\n const item = this.#items.find(e => e[this.valueField]\r\n && e[this.valueField].toString().trim() === value);\r\n if (item) {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n values.push(item[this.valueField]);\r\n this.formControl.setValue(values);\r\n this.input.nativeElement.value = '';\r\n this.inputControl.setValue('');\r\n setTimeout(() => {\r\n this.autocompleteTrigger?.openPanel();\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n displayFn = (value: string | { [key: string]: string }): string | undefined => {\r\n if (typeof value === 'string') {\r\n if (!this.#items) {\r\n return undefined;\r\n }\r\n const selectedItem = this.#items.find(item => item[this.valueField] === value);\r\n if (selectedItem) {\r\n return selectedItem[this.displayField];\r\n }\r\n if (this.#items.some(item => item[this.displayField].toLowerCase().indexOf(value.toLowerCase()) !== -1)) {\r\n return value;\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return value ? value[this.displayField] : undefined;\r\n }\r\n }\r\n\r\n onClear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl.setValue('');\r\n this.formControl.setValue([]);\r\n this.autocompleteTrigger?.openPanel();\r\n this.ref.detectChanges();\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdRemovableChip'\r\n})\r\nexport class SdRemovableChipPipe implements PipeTransform {\r\n constructor() { }\r\n transform(item: any, removable: boolean | ((item: any) => boolean)): boolean {\r\n if(typeof(removable) === 'boolean') {\r\n return removable;\r\n }\r\n return removable(item);\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 { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdChip } from './chip.component';\r\nimport { SdChipDisplayDef } from './directives/sd-chip-display-def.directive';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { SdRemovableChipPipe } from './pipes/removable-chip.pipe';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatChipsModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdChip,\r\n SdChipDisplayDef,\r\n SdRemovableChipPipe\r\n ],\r\n exports: [\r\n SdChip,\r\n SdChipDisplayDef\r\n ]\r\n})\r\nexport class SdChipModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/chip.module';\r\nexport * from './lib/chip.component';\r\nexport * from './lib/chip.model';\r\nexport * from './lib/directives/sd-chip-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {SdRemovableChipPipe as ɵa} from './src/lib/pipes/removable-chip.pipe';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;;MAKa,gBAAgB;IAC3B,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,oBAAoB;aAC/B;;;YAJ0B,WAAW;;;;AC0BtC,MAAM,uBAAuB;IAC3B,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;KAAK;IACjD,YAAY,CAAC,OAA2B,EAAE,IAAwC;;QAChF,MAAM,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC;QAC3C,OAAO,CAAC,EAAE,OAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,MAAK,OAAA,IAAI,CAAC,WAAW,0CAAE,KAAK,YAAI,IAAI,CAAC,WAAW,0CAAE,OAAO,CAAA,IAAI,WAAW,CAAC,CAAC,CAAC;KAC/G;CACF;MAOY,MAAM;IAoGjB,YACU,GAAsB,EACtB,cAAgC;QADhC,QAAG,GAAH,GAAG,CAAmB;QACtB,mBAAc,GAAd,cAAc,CAAkB;QArG1C,gBAAQA,EAAO,EAAE,EAAC;QAMlB,uBAAkB,GAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC9C,eAAU,GAAG,IAAI,CAAC;QAElB,wBAAiB;QAcjB,cAAS,GAAuC,IAAI,CAAC;QAIrD,uBAAe,IAAI,OAAO,EAAS,EAAC;QACpC,iBAAgB,EAAE,EAAC;QAYV,UAAK,GAAG,EAAE,CAAC;QACpB,kBAAa,GAAU,EAAE,CAAC;;QAe1B,eAAU,GAAG,KA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K;oBAWL,KAAK;oBAOL,KAAK;uBAUL,KAAK;mBAML,KAAK,SAAC,KAAK;mBAKX,KAAK,SAAC,KAAK;0BAIX,MAAM;uBAGN,KAAK;uBAWL,MAAM;uBACN,MAAM;2BACN,MAAM;oBAEN,SAAS,SAAC,OAAO;8BACjB,SAAS,SAAC,MAAM;uBAChB,SAAS,SAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;kCACtC,SAAS,SAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;4BAClE,YAAY,SAAC,gBAAgB;;;MClInB,mBAAmB;IAC9B,iBAAiB;IACjB,SAAS,CAAC,IAAS,EAAE,SAA6C;QAChE,IAAG,QAAO,SAAS,CAAC,KAAK,SAAS,EAAE;YAClC,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;KACxB;;;YAVF,IAAI,SAAC;gBACJ,IAAI,EAAE,iBAAiB;aACxB;;;;MCoCY,YAAY;;;YAxBxB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,cAAc;oBACd,gBAAgB;oBAChB,kBAAkB;oBAClB,qBAAqB;oBACrB,aAAa;oBACb,wBAAwB;oBACxB,cAAc;oBACd,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,MAAM;oBACN,gBAAgB;oBAChB,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,MAAM;oBACN,gBAAgB;iBACjB;aACF;;;ACtCD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sd-angular-core-chip.js","sources":["../../../../projects/sd-core/chip/src/lib/directives/sd-chip-display-def.directive.ts","../../../../projects/sd-core/chip/src/lib/chip.component.ts","../../../../projects/sd-core/chip/src/lib/pipes/removable-chip.pipe.ts","../../../../projects/sd-core/chip/src/lib/chip.module.ts","../../../../projects/sd-core/chip/src/public-api.ts","../../../../projects/sd-core/chip/sd-angular-core-chip.ts"],"sourcesContent":["import { Directive, Input, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdChipDisplayDef]'\r\n})\r\nexport class SdChipDisplayDef {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n OnInit, OnDestroy,\r\n AfterViewInit,\r\n ChangeDetectorRef,\r\n ElementRef,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { COMMA, ENTER } from '@angular/cdk/keycodes';\r\nimport { map, startWith, switchMap } from 'rxjs/operators';\r\n\r\nimport * as uuid from 'uuid';\r\nimport { NgForm, NgModel, FormControl, FormGroup, ValidatorFn, AsyncValidatorFn, Validators, FormGroupDirective } from '@angular/forms';\r\nimport { Observable, Subscription, Subject } from 'rxjs';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { SdTranslateService } from '@sd-angular/core/translate';\r\nimport { MatChipInputEvent, MatChipList } from '@angular/material/chips';\r\nimport { MatAutocomplete, MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';\r\nimport { SdChipUpdate } from './chip.model';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { SdChipDisplayDef } from './directives/sd-chip-display-def.directive';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\n\r\nclass SdChipErrotStateMatcher implements ErrorStateMatcher {\r\n constructor(private formControl: FormControl) { }\r\n isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {\r\n const isSubmitted = form && form.submitted;\r\n return !!(this.formControl?.invalid && (this.formControl?.dirty || this.formControl?.touched || isSubmitted));\r\n }\r\n}\r\n\r\n@Component({\r\n selector: 'sd-chip',\r\n templateUrl: './chip.component.html',\r\n styleUrls: ['./chip.component.scss']\r\n})\r\nexport class SdChip implements OnInit, OnDestroy, AfterViewInit {\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n separatorKeysCodes: number[] = [ENTER, COMMA];\r\n selectable = true;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n @Input() placeholder: string;\r\n removable: boolean | ((item: any) => boolean) = true;\r\n @Input('removable') set _removable(val: '' | boolean | ((item: any) => boolean)) {\r\n this.removable = (val === '') || val;\r\n }\r\n #itemChanges = new Subject<any[]>();\r\n #items: any[] = [];\r\n @Input() set items(items: undefined | any[]) {\r\n if (!items) {\r\n this.#items = [];\r\n } else if (Array.isArray(items)) {\r\n this.#items = items.filter(e => (e ?? '').toString().trim() !== '');\r\n } else {\r\n this.#items = items;\r\n }\r\n this.inputControl.updateValueAndValidity();\r\n this.#itemChanges.next(this.items);\r\n }\r\n @Input() limit = 50;\r\n selectedItems: any[] = [];\r\n filteredItems: Observable<any[]>;\r\n\r\n ipt: any;\r\n\r\n // model\r\n @Input() set model(values: undefined | (string | number)[]) {\r\n if (!Array.isArray(values)) {\r\n values = [];\r\n }\r\n this.formControl.setValue(values, {\r\n emitEvent: false\r\n });\r\n }\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n min: number;\r\n @Input('min') set pMin(val: number | string) {\r\n this.min = +val || 0;\r\n this.#updateValidator();\r\n }\r\n max: number;\r\n @Input('max') set pMax(val: number | string) {\r\n this.max = +val || 0;\r\n this.#updateValidator();\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n this.inputControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n this.inputControl.enable();\r\n }\r\n }\r\n\r\n @Output() sdChange = new EventEmitter<any[]>();\r\n @Output() sdUpdate = new EventEmitter<SdChipUpdate>();\r\n @Output() chipSelected = new EventEmitter<any>();\r\n\r\n @ViewChild('input') input: ElementRef<HTMLInputElement>;\r\n @ViewChild('auto') matAutocomplete: MatAutocomplete;\r\n @ViewChild('chipList', { static: true }) chipList: MatChipList;\r\n @ViewChild(MatAutocompleteTrigger, { read: MatAutocompleteTrigger }) autocompleteTrigger: MatAutocompleteTrigger;\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n @ContentChild(SdChipDisplayDef) sdChipDisplay: SdChipDisplayDef;\r\n isFocused = false;\r\n inputControl = new FormControl();\r\n formControl = new FormControl();\r\n matcher = new SdChipErrotStateMatcher(this.formControl);\r\n #subscription = new Subscription();\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.filteredItems = this.inputControl.valueChanges.pipe(\r\n startWith<string | { [key: string]: string }>(''),\r\n map(item => typeof item === 'string' ? item : (item?.[this.displayField] ?? '')),\r\n map(name => this.filter(name))\r\n );\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(() => {\r\n const values: (string | number)[] = this.formControl.value || [];\r\n this.selectedItems = this.#items.filter(item => values.findIndex(value => value === item?.[this.valueField]) !== -1);\r\n this.modelChange.emit(values);\r\n this.sdChange.emit(values);\r\n setTimeout(() => {\r\n this.#form?.markAsDirty();\r\n }, 0);\r\n }));\r\n this.#subscription.add(this.#itemChanges.pipe(startWith(this.#items)).subscribe(() => {\r\n const values: (string | number)[] = this.formControl.value || [];\r\n this.selectedItems = [];\r\n for (const value of values) {\r\n const item = this.#items.find(e => e?.[this.valueField] === value) || {};\r\n this.selectedItems.push({\r\n ...item,\r\n [this.valueField]: value\r\n });\r\n }\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.min > 0) {\r\n validators.push(Validators.minLength(this.min));\r\n }\r\n if (this.max > 0) {\r\n validators.push(Validators.maxLength(this.max));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n filter = (value: string): { [key: string]: string }[] => {\r\n return this.#items\r\n .filter(item => {\r\n if (this.formControl.value?.some(val => val === item[this.valueField])) {\r\n return false;\r\n }\r\n return !value || this.utilityService.changeAliasLowerCase(item[this.displayField])\r\n .indexOf(this.utilityService.changeAliasLowerCase(value)) !== -1;\r\n }).filter((item, index) => index < this.limit);\r\n }\r\n\r\n onAdd = (event: MatChipInputEvent): void => {\r\n // Add item only when MatAutocomplete is not open\r\n // To make sure this does not conflict with OptionSelected Event\r\n if (!this.matAutocomplete.isOpen) {\r\n const value = (event.value ?? '').toString().toLowerCase().trim();\r\n if (value) {\r\n\r\n const item = this.#items.find(e => e[this.displayField]\r\n && e[this.displayField].toString().toLowerCase().trim() === value);\r\n\r\n if (item) {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n values.push(item[this.valueField]);\r\n this.formControl.setValue(values);\r\n }\r\n }\r\n this.inputControl.setValue('');\r\n }\r\n }\r\n\r\n onRemove = (item: any): void => {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n this.formControl.setValue(values.filter(value => item?.[this.valueField] !== value));\r\n this.inputControl.setValue('');\r\n }\r\n\r\n select = (item: any): void => {\r\n this.chipSelected.emit(item);\r\n }\r\n\r\n onSelect = (event: MatAutocompleteSelectedEvent) => {\r\n const value = (event.option.value?.[this.valueField] ?? '').toString().trim();\r\n if (value) {\r\n const item = this.#items.find(e => e[this.valueField]\r\n && e[this.valueField].toString().trim() === value);\r\n if (item) {\r\n const values: (string | number)[] = this.formControl.value ?? [];\r\n values.push(item[this.valueField]);\r\n this.formControl.setValue(values);\r\n this.input.nativeElement.value = '';\r\n this.inputControl.setValue('');\r\n setTimeout(() => {\r\n this.autocompleteTrigger?.openPanel();\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n displayFn = (value: string | { [key: string]: string }): string | undefined => {\r\n if (typeof value === 'string') {\r\n if (!this.#items) {\r\n return undefined;\r\n }\r\n const selectedItem = this.#items.find(item => item[this.valueField] === value);\r\n if (selectedItem) {\r\n return selectedItem[this.displayField];\r\n }\r\n if (this.#items.some(item => item[this.displayField].toLowerCase().indexOf(value.toLowerCase()) !== -1)) {\r\n return value;\r\n } else {\r\n return undefined;\r\n }\r\n } else {\r\n return value ? value[this.displayField] : undefined;\r\n }\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.inputControl.setValue('');\r\n // this.inputControl.updateValueAndValidity();\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n this.inputControl.setValue('', {\r\n emitEvent: false\r\n });\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.autocompleteTrigger?.openPanel();\r\n this.input?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n onClear = ($event?: any) => {\r\n $event?.stopPropagation();\r\n this.inputControl.setValue('');\r\n this.formControl.setValue([]);\r\n this.autocompleteTrigger?.openPanel();\r\n this.ref.detectChanges();\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdRemovableChip'\r\n})\r\nexport class SdRemovableChipPipe implements PipeTransform {\r\n constructor() { }\r\n transform(item: any, removable: boolean | ((item: any) => boolean)): boolean {\r\n if(typeof(removable) === 'boolean') {\r\n return removable;\r\n }\r\n return removable(item);\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 { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdChip } from './chip.component';\r\nimport { SdChipDisplayDef } from './directives/sd-chip-display-def.directive';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { SdRemovableChipPipe } from './pipes/removable-chip.pipe';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatAutocompleteModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatChipsModule,\r\n SdTranslateModule,\r\n SdCommonModule\r\n ],\r\n declarations: [\r\n SdChip,\r\n SdChipDisplayDef,\r\n SdRemovableChipPipe\r\n ],\r\n exports: [\r\n SdCommonModule,\r\n SdChip,\r\n SdChipDisplayDef,\r\n ]\r\n})\r\nexport class SdChipModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/chip.module';\r\nexport * from './lib/chip.component';\r\nexport * from './lib/chip.model';\r\nexport * from './lib/directives/sd-chip-display-def.directive';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {SdRemovableChipPipe as ɵa} from './src/lib/pipes/removable-chip.pipe';"],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ACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,cAAc;oBACd,gBAAgB;oBAChB,kBAAkB;oBAClB,qBAAqB;oBACrB,aAAa;oBACb,wBAAwB;oBACxB,cAAc;oBACd,iBAAiB;oBACjB,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,MAAM;oBACN,gBAAgB;oBAChB,mBAAmB;iBACpB;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,MAAM;oBACN,gBAAgB;iBACjB;aACF;;;ACzCD;;;;ACAA;;;;;;"}
|
|
@@ -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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