monkey-front-components 0.0.429 → 0.0.430

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.
@@ -1808,8 +1808,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
1808
1808
  type: Output
1809
1809
  }] } });
1810
1810
 
1811
- class MECXFilterOptionsComponent {
1811
+ class MECXFilterOptionsComponent extends BaseComponent {
1812
1812
  constructor() {
1813
+ super();
1813
1814
  this.option = null;
1814
1815
  this.closeDirectly = false;
1815
1816
  this.onClose = new EventEmitter();
@@ -1822,25 +1823,33 @@ class MECXFilterOptionsComponent {
1822
1823
  this.closeMenu = () => {
1823
1824
  this._showMenu = false;
1824
1825
  };
1825
- // not to do
1826
1826
  }
1827
1827
  onHandleLoading(loading = false) {
1828
1828
  this._isLoading = loading;
1829
1829
  }
1830
1830
  onHandleLoadValues(first = false) {
1831
1831
  const { values } = this.option;
1832
- this.onHandleLoading(true);
1833
1832
  if (!values?.length && first) {
1834
- const { values, hasMoreValues } = this.option.loadValues();
1835
- this._hasMoreValues = hasMoreValues;
1836
- this.option.values = values;
1833
+ this.option?.loadValues?.();
1837
1834
  }
1838
1835
  else if (!first) {
1839
- const { values, hasMoreValues } = this.option.loadMoreValues();
1840
- this._hasMoreValues = hasMoreValues;
1841
- this.option.values = values;
1836
+ this.option?.loadMoreValues?.();
1842
1837
  }
1843
- this.onHandleLoading(false);
1838
+ }
1839
+ ngOnInit() {
1840
+ const { option } = this;
1841
+ option?.values$?.pipe(takeUntil(this.__unsubscribeAll)).subscribe((data) => {
1842
+ this.option.values = data;
1843
+ });
1844
+ option?.pagination$?.pipe(takeUntil(this.__unsubscribeAll)).subscribe((data) => {
1845
+ this._hasMoreValues = !!(data?.next);
1846
+ });
1847
+ option?.control$?.pipe(takeUntil(this.__unsubscribeAll)).subscribe((data) => {
1848
+ this.onHandleLoading(data?.isLoading);
1849
+ });
1850
+ }
1851
+ ngAfterViewInit() {
1852
+ this.onHandleLoadValues(true);
1844
1853
  }
1845
1854
  onHandleChildrenAction(child) {
1846
1855
  const { option } = this;
@@ -1865,15 +1874,12 @@ class MECXFilterOptionsComponent {
1865
1874
  }
1866
1875
  this._showMenu = true;
1867
1876
  }
1868
- ngAfterViewInit() {
1869
- this.onHandleLoadValues(true);
1870
- }
1871
1877
  onHandleLoadMoreValues() {
1872
1878
  this.onHandleLoadValues();
1873
1879
  }
1874
1880
  }
1875
1881
  MECXFilterOptionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1876
- MECXFilterOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsComponent, selector: "mecx-filter-options", inputs: { option: "option", closeDirectly: "closeDirectly" }, outputs: { onClose: "onClose", onRemove: "onRemove", onSubmit: "onSubmit", onShowFromChildren: "onShowFromChildren" }, ngImport: i0, template: "<div class=\"d-flex justify-content-between header\">\r\n <span class=\"title\">\r\n {{ option?.label | translate }}\r\n </span>\r\n <div class=\"close\" #actionElement (click)=\"onHandleShowMenu()\">\r\n <monkey-icon icon=\"close-12\" color=\"#474747\"></monkey-icon>\r\n </div>\r\n</div>\r\n<ng-container *ngIf=\"option?.type as type\">\r\n <ng-container *ngIf=\"option?.children; else withoutChildren\">\r\n <mecx-filter-options-children [option]=\"option\" (onSubmit)=\"onHandleSubmitChildren($event)\"\r\n (onShow)=\"onShowFromChildren.next($event)\">\r\n </mecx-filter-options-children>\r\n </ng-container>\r\n <ng-template #withoutChildren>\r\n <ng-container [ngSwitch]=\"type\">\r\n <mecx-filter-options-status *ngSwitchCase=\"'status'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-status>\r\n <mecx-filter-options-date-range *ngSwitchCase=\"'date-range'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-date-range>\r\n <mecx-filter-options-currency *ngSwitchCase=\"'currency'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-currency>\r\n <mecx-filter-options-input *ngSwitchCase=\"'input'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-input>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<div class=\"box-loading\" *ngIf=\"_isLoading\">\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n</div>\r\n\r\n<div class=\"footer\" *ngIf=\"_hasMoreValues && !_isLoading\">\r\n <monkey-button type=\"tertiary\" color=\"theme\" [label]=\"'BUTTONS.LOAD-MORE' | translate\"\r\n (click)=\"onHandleLoadMoreValues()\">\r\n </monkey-button>\r\n</div>\r\n\r\n<ng-container\r\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'ltr'\">\r\n <div class=\"close-menu\">\r\n <monkey-button type=\"tertiary\" color=\"error\" (click)=\"onRemove.next()\" size=\"sm\">\r\n {{ 'BUTTONS.REMOVE' | translate }}\r\n </monkey-button>\r\n <monkey-button type=\"tertiary\" color=\"theme\" (click)=\"onClose.next()\" size=\"sm\">\r\n {{ 'BUTTONS.CLOSE' | translate }}\r\n </monkey-button>\r\n </div>\r\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px}:host .header{border-bottom:1px solid #d6d6d6;padding:8px}:host .header .title{color:#4b4a53;font-style:normal;font-size:14px;line-height:16px;font-weight:500;text-align:left}:host .header .close{cursor:pointer;border-radius:120px;padding:4px}:host .header .close:hover{background-color:#6d6d6d0c}:host .box-loaing{display:flex;flex-direction:column;gap:12px}:host .footer ::ng-deep monkey-button{width:100%}:host .footer ::ng-deep monkey-button button{width:100%}:host .loading:empty{margin-top:4px;height:24px;width:100%}:host .loading:empty{animation:loading 1.1s infinite linear;background:#ebebeb;background-image:linear-gradient(to right,#ebebeb 0%,#f2f3f5 20%,#ebebeb 40%,#ebebeb 100%);background-repeat:no-repeat}@keyframes loading{0%{background-position:-100px}to{background-position:500px}}.close-menu{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px;padding:8px}.close-menu ::ng-deep monkey-button{width:100%}.close-menu ::ng-deep monkey-button button{width:100%}\n"], components: [{ type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }, { type: MECXFilterOptionsChildrenComponent, selector: "mecx-filter-options-children", inputs: ["option"], outputs: ["onSubmit", "onShow"] }, { type: MECXFilterOptionsStatusComponent, selector: "mecx-filter-options-status", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsDateRangeComponent, selector: "mecx-filter-options-date-range", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsCurrencyComponent, selector: "mecx-filter-options-currency", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsInputComponent, selector: "mecx-filter-options-input", inputs: ["option"], outputs: ["onSubmit"] }, { type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }], pipes: { "translate": i1$3.TranslatePipe } });
1882
+ MECXFilterOptionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: MECXFilterOptionsComponent, selector: "mecx-filter-options", inputs: { option: "option", closeDirectly: "closeDirectly" }, outputs: { onClose: "onClose", onRemove: "onRemove", onSubmit: "onSubmit", onShowFromChildren: "onShowFromChildren" }, usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex justify-content-between header\">\r\n <span class=\"title\">\r\n {{ option?.label | translate }}\r\n </span>\r\n <div class=\"close\" #actionElement (click)=\"onHandleShowMenu()\">\r\n <monkey-icon icon=\"close-12\" color=\"#474747\"></monkey-icon>\r\n </div>\r\n</div>\r\n<ng-container *ngIf=\"option?.type as type\">\r\n <ng-container *ngIf=\"option?.children; else withoutChildren\">\r\n <mecx-filter-options-children [option]=\"option\" (onSubmit)=\"onHandleSubmitChildren($event)\"\r\n (onShow)=\"onShowFromChildren.next($event)\">\r\n </mecx-filter-options-children>\r\n </ng-container>\r\n <ng-template #withoutChildren>\r\n <ng-container [ngSwitch]=\"type\">\r\n <mecx-filter-options-status *ngSwitchCase=\"'status'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-status>\r\n <mecx-filter-options-date-range *ngSwitchCase=\"'date-range'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-date-range>\r\n <mecx-filter-options-currency *ngSwitchCase=\"'currency'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-currency>\r\n <mecx-filter-options-input *ngSwitchCase=\"'input'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-input>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<div class=\"box-loading\" *ngIf=\"_isLoading\">\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n</div>\r\n\r\n<div class=\"footer\" *ngIf=\"_hasMoreValues && !_isLoading\">\r\n <monkey-button type=\"tertiary\" color=\"theme\" [label]=\"'BUTTONS.LOAD-MORE' | translate\"\r\n (click)=\"onHandleLoadMoreValues()\">\r\n </monkey-button>\r\n</div>\r\n\r\n<ng-container\r\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'ltr'\">\r\n <div class=\"close-menu\">\r\n <monkey-button type=\"tertiary\" color=\"error\" (click)=\"onRemove.next()\" size=\"sm\">\r\n {{ 'BUTTONS.REMOVE' | translate }}\r\n </monkey-button>\r\n <monkey-button type=\"tertiary\" color=\"theme\" (click)=\"onClose.next()\" size=\"sm\">\r\n {{ 'BUTTONS.CLOSE' | translate }}\r\n </monkey-button>\r\n </div>\r\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px}:host .header{border-bottom:1px solid #d6d6d6;padding:8px}:host .header .title{color:#4b4a53;font-style:normal;font-size:14px;line-height:16px;font-weight:500;text-align:left}:host .header .close{cursor:pointer;border-radius:120px;padding:4px}:host .header .close:hover{background-color:#6d6d6d0c}:host .box-loaing{display:flex;flex-direction:column;gap:12px}:host .footer ::ng-deep monkey-button{width:100%}:host .footer ::ng-deep monkey-button button{width:100%}:host .loading:empty{margin-top:4px;height:24px;width:100%}:host .loading:empty{animation:loading 1.1s infinite linear;background:#ebebeb;background-image:linear-gradient(to right,#ebebeb 0%,#f2f3f5 20%,#ebebeb 40%,#ebebeb 100%);background-repeat:no-repeat}@keyframes loading{0%{background-position:-100px}to{background-position:500px}}.close-menu{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px;padding:8px}.close-menu ::ng-deep monkey-button{width:100%}.close-menu ::ng-deep monkey-button button{width:100%}\n"], components: [{ type: i1$2.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }, { type: MECXFilterOptionsChildrenComponent, selector: "mecx-filter-options-children", inputs: ["option"], outputs: ["onSubmit", "onShow"] }, { type: MECXFilterOptionsStatusComponent, selector: "mecx-filter-options-status", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsDateRangeComponent, selector: "mecx-filter-options-date-range", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsCurrencyComponent, selector: "mecx-filter-options-currency", inputs: ["option"], outputs: ["onSubmit"] }, { type: MECXFilterOptionsInputComponent, selector: "mecx-filter-options-input", inputs: ["option"], outputs: ["onSubmit"] }, { type: i1$2.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1$4.MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: ["monkeyecxPopover", "monkeyecxPopoverClosed", "monkeyecxPopoverTarget", "monkeyecxPopoverMinwidth", "monkeyecxPopoverBackdrop", "monkeyecxPopoverWatch", "monkeyecxPopoverDir", "monkeyecxPopoverContextmenu", "monkeyecxPopoverHeight"] }], pipes: { "translate": i1$3.TranslatePipe } });
1877
1883
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MECXFilterOptionsComponent, decorators: [{
1878
1884
  type: Component,
1879
1885
  args: [{ selector: 'mecx-filter-options', template: "<div class=\"d-flex justify-content-between header\">\r\n <span class=\"title\">\r\n {{ option?.label | translate }}\r\n </span>\r\n <div class=\"close\" #actionElement (click)=\"onHandleShowMenu()\">\r\n <monkey-icon icon=\"close-12\" color=\"#474747\"></monkey-icon>\r\n </div>\r\n</div>\r\n<ng-container *ngIf=\"option?.type as type\">\r\n <ng-container *ngIf=\"option?.children; else withoutChildren\">\r\n <mecx-filter-options-children [option]=\"option\" (onSubmit)=\"onHandleSubmitChildren($event)\"\r\n (onShow)=\"onShowFromChildren.next($event)\">\r\n </mecx-filter-options-children>\r\n </ng-container>\r\n <ng-template #withoutChildren>\r\n <ng-container [ngSwitch]=\"type\">\r\n <mecx-filter-options-status *ngSwitchCase=\"'status'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-status>\r\n <mecx-filter-options-date-range *ngSwitchCase=\"'date-range'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-date-range>\r\n <mecx-filter-options-currency *ngSwitchCase=\"'currency'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-currency>\r\n <mecx-filter-options-input *ngSwitchCase=\"'input'\" [option]=\"option\"\r\n (onSubmit)=\"onHandleSubmit($event)\">\r\n </mecx-filter-options-input>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<div class=\"box-loading\" *ngIf=\"_isLoading\">\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n <div class=\"loading\"></div>\r\n</div>\r\n\r\n<div class=\"footer\" *ngIf=\"_hasMoreValues && !_isLoading\">\r\n <monkey-button type=\"tertiary\" color=\"theme\" [label]=\"'BUTTONS.LOAD-MORE' | translate\"\r\n (click)=\"onHandleLoadMoreValues()\">\r\n </monkey-button>\r\n</div>\r\n\r\n<ng-container\r\n *monkeyecxPopover=\"_showMenu; target: $any(actionElement); closed: closeMenu; dir: 'ltr'\">\r\n <div class=\"close-menu\">\r\n <monkey-button type=\"tertiary\" color=\"error\" (click)=\"onRemove.next()\" size=\"sm\">\r\n {{ 'BUTTONS.REMOVE' | translate }}\r\n </monkey-button>\r\n <monkey-button type=\"tertiary\" color=\"theme\" (click)=\"onClose.next()\" size=\"sm\">\r\n {{ 'BUTTONS.CLOSE' | translate }}\r\n </monkey-button>\r\n </div>\r\n</ng-container>", styles: [":host{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px}:host .header{border-bottom:1px solid #d6d6d6;padding:8px}:host .header .title{color:#4b4a53;font-style:normal;font-size:14px;line-height:16px;font-weight:500;text-align:left}:host .header .close{cursor:pointer;border-radius:120px;padding:4px}:host .header .close:hover{background-color:#6d6d6d0c}:host .box-loaing{display:flex;flex-direction:column;gap:12px}:host .footer ::ng-deep monkey-button{width:100%}:host .footer ::ng-deep monkey-button button{width:100%}:host .loading:empty{margin-top:4px;height:24px;width:100%}:host .loading:empty{animation:loading 1.1s infinite linear;background:#ebebeb;background-image:linear-gradient(to right,#ebebeb 0%,#f2f3f5 20%,#ebebeb 40%,#ebebeb 100%);background-repeat:no-repeat}@keyframes loading{0%{background-position:-100px}to{background-position:500px}}.close-menu{display:flex;flex-direction:column;background:#fafafa;border:1px solid #d6d6d6;box-sizing:border-box;box-shadow:0 4px 36px -8px #6d6d6d3a;border-radius:8px!important;margin:0 8px;padding:8px}.close-menu ::ng-deep monkey-button{width:100%}.close-menu ::ng-deep monkey-button button{width:100%}\n"] }]