@datarailsshared/datarailsshared 1.3.36 → 1.3.39

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.
@@ -2138,6 +2138,8 @@
2138
2138
  function DrToggleButtonComponent(cdr) {
2139
2139
  this.cdr = cdr;
2140
2140
  this._disabled = false;
2141
+ this.bindLabel = null;
2142
+ this.bindValue = null;
2141
2143
  this.onChange = function () { };
2142
2144
  this.onTouched = function () { };
2143
2145
  }
@@ -2162,7 +2164,7 @@
2162
2164
  this._disabled = isDisabled;
2163
2165
  };
2164
2166
  DrToggleButtonComponent.prototype.setValue = function (item) {
2165
- this.selectedValue = item;
2167
+ this.selectedValue = item[this.bindValue] || item;
2166
2168
  this.onChange(this.selectedValue);
2167
2169
  this.onTouched();
2168
2170
  this.cdr.markForCheck();
@@ -2172,12 +2174,12 @@
2172
2174
  DrToggleButtonComponent.decorators = [
2173
2175
  { type: i0.Component, args: [{
2174
2176
  selector: 'dr-toggle-button',
2175
- template: "<div class=\"toggle-container\" [class.disabled]=\"this._disabled \">\r\n <div *ngFor=\"let item of items\" (click)=\"setValue(item)\"\r\n [class.selected]=\"item === selectedValue\"\r\n class=\"toggle-container__item\">\r\n {{item.name || item}}\r\n </div>\r\n</div>\r\n",
2177
+ template: "<div class=\"toggle-container\" [class.disabled]=\"this._disabled \">\r\n <div *ngFor=\"let item of items\" (click)=\"setValue(item)\"\r\n [class.selected]=\"item[bindValue] === selectedValue || item === selectedValue\"\r\n class=\"toggle-container__item\">\r\n {{item[bindLabel] || item.name || item}}\r\n </div>\r\n</div>\r\n",
2176
2178
  providers: [
2177
2179
  { provide: forms.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return DrToggleButtonComponent; }), multi: true }
2178
2180
  ],
2179
2181
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2180
- styles: [".toggle-container{display:flex;flex-wrap:nowrap;background:#F6F7F8;border:1px solid #C3C4CE;box-sizing:border-box;border-radius:20px;height:28px}.toggle-container.disabled{pointer-events:none}.toggle-container__item{height:28px;display:flex;align-items:center;justify-content:center;padding:4px 16px;border-radius:20px;margin:-1px;cursor:pointer}.toggle-container__item.selected{background:#F3F7FF;border:1px solid #579BF2;color:#0061ff;font-weight:600}\n"]
2182
+ styles: [".toggle-container{display:flex;flex-wrap:nowrap;background:#F6F7F8;border:1px solid #C3C4CE;box-sizing:border-box;border-radius:20px;height:28px}.toggle-container.disabled{pointer-events:none}.toggle-container__item{height:28px;display:flex;align-items:center;justify-content:center;padding:4px 16px;border-radius:20px;margin:-1px;cursor:pointer;font-weight:400;font-size:12px;line-height:20px;white-space:nowrap;color:#4e566c}.toggle-container__item.selected{font-weight:400;background:#F2F2FB;border:1px solid #7F7FDD;color:#25258c}\n"]
2181
2183
  },] }
2182
2184
  ];
2183
2185
  DrToggleButtonComponent.ctorParameters = function () { return [
@@ -2185,6 +2187,8 @@
2185
2187
  ]; };
2186
2188
  DrToggleButtonComponent.propDecorators = {
2187
2189
  items: [{ type: i0.Input }],
2190
+ bindLabel: [{ type: i0.Input }],
2191
+ bindValue: [{ type: i0.Input }],
2188
2192
  selectedValue: [{ type: i0.Input }],
2189
2193
  disabled: [{ type: i0.Input }]
2190
2194
  };
@@ -2926,6 +2930,7 @@
2926
2930
  if (data) {
2927
2931
  this.option = data.option;
2928
2932
  this.position = data.position;
2933
+ this.drDropdownInHover = data.drDropdownInHover;
2929
2934
  this.containerClass = data.class;
2930
2935
  this.list = data.list || [];
2931
2936
  this.list.forEach(function (item) {
@@ -2944,6 +2949,10 @@
2944
2949
  enumerable: false,
2945
2950
  configurable: true
2946
2951
  });
2952
+ DrDropdownComponent.prototype.onMouseLeave = function () {
2953
+ if (this.drDropdownInHover)
2954
+ this.menuService.destroy();
2955
+ };
2947
2956
  DrDropdownComponent.prototype.onClickedOutside = function () {
2948
2957
  if (this.firstInit) {
2949
2958
  this.menuService.destroy();
@@ -3008,7 +3017,7 @@
3008
3017
  DrDropdownComponent.decorators = [
3009
3018
  { type: i0.Component, args: [{
3010
3019
  selector: 'dr-dropdown',
3011
- template: "<div #menuContainer\r\n (clickOutside)=\"onClickedOutside()\"\r\n [drDropdownPosition]=\"option\"\r\n #dropdownPosition=\"dropdownPosition\"\r\n [position]=\"position\"\r\n [class]=\"containerClass\"\r\n class=\"dr-dropdown\">\r\n <div class=\"dr-dropdown__container\">\r\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\r\n (click)=\"action(act)\"\r\n [drTooltip]=\"tooltipToShow(act)\"\r\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\r\n [drTooltipOptions]=\"{ withoutArrow: true }\"\r\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\r\n class=\"dr-dropdown__container__item\"\r\n [class.item-disabled]=\"disabled(act)\"\r\n [class.item-selected]=\"selected(act)\">\r\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\r\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\r\n <i *ngFor=\"let actionIcon of act.actionIcons\"\r\n [class]=\"actionIcon.icon\"\r\n [class.showOnHover]=\"actionIcon.showOnHover\"\r\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\r\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\r\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\r\n </div>\r\n </div>\r\n</div>\r\n",
3020
+ template: "<div #menuContainer\r\n (mouseleave)=\"onMouseLeave()\"\r\n (clickOutside)=\"onClickedOutside()\"\r\n [drDropdownPosition]=\"option\"\r\n #dropdownPosition=\"dropdownPosition\"\r\n [position]=\"position\"\r\n [class]=\"containerClass\"\r\n class=\"dr-dropdown\">\r\n <div class=\"dr-dropdown__container\">\r\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\r\n (click)=\"action(act)\"\r\n [drTooltip]=\"tooltipToShow(act)\"\r\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\r\n [drTooltipOptions]=\"{ withoutArrow: true }\"\r\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\r\n class=\"dr-dropdown__container__item\"\r\n [class.item-disabled]=\"disabled(act)\"\r\n [class.item-selected]=\"selected(act)\">\r\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\r\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\r\n <i *ngFor=\"let actionIcon of act.actionIcons\"\r\n [class]=\"actionIcon.icon\"\r\n [class.showOnHover]=\"actionIcon.showOnHover\"\r\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\r\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\r\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\r\n </div>\r\n </div>\r\n</div>\r\n",
3012
3021
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3013
3022
  styles: ["::ng-deep .dr-dropdown__container__item .dr-dropdown{visibility:hidden}::ng-deep .dr-dropdown__container__item:hover .dr-dropdown{visibility:visible}::ng-deep .dr-dropdown__tooltip>.default-content{max-width:300px;white-space:normal!important}.dr-dropdown{position:absolute;z-index:-1;top:0;left:0;width:auto}.dr-dropdown__container{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 4px 8px 1px #00000040;padding:8px 0;overflow-y:auto;max-height:60vh}.dr-dropdown__container__item{display:flex;align-items:center;justify-content:flex-start;cursor:pointer;min-width:15rem;font-style:normal;font-weight:400;font-size:14px;line-height:24px;clear:both;width:100%;white-space:nowrap;padding:0 12px;height:36px;flex-shrink:0}.dr-dropdown__container__item:hover{background-color:#f6f7f8}.dr-dropdown__container__item:hover .showOnHover{visibility:visible}.dr-dropdown__container__item.item-selected{background:#F3F7FF}.dr-dropdown__container__item.item-disabled,.dr-dropdown__container__item.item-disabled i,.dr-dropdown__container__item.item-disabled .dr-dropdown__container__item__text{color:#bcbcbc}.dr-dropdown__container__item i:first-child{margin-right:8px}.dr-dropdown__container__item__text{margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dr-dropdown__container__item i,.dr-dropdown__container__item__text{color:#151b3f}.dr-dropdown__container__item .showOnHover{visibility:hidden}.dr-dropdown.content-top{transform:translate(-50%,-100%)}.dr-dropdown.content-top-left{transform:translate(-100%,-100%)}.dr-dropdown.content-bottom{transform:translate(-50%,50%)}.dr-dropdown.content-bottom-left{transform:translate(-90%,35%)}.dr-dropdown.content-bottom-right{transform:translateY(45%)}.dr-dropdown.content-left{transform:translate(-100%)}.dr-dropdown.content-left-center{transform:translate(-100%,-50%)}.dr-dropdown.content-right{transform:translate(5%)}\n"]
3014
3023
  },] }
@@ -3032,7 +3041,18 @@
3032
3041
  this._document = _document;
3033
3042
  this.position = 'left';
3034
3043
  }
3044
+ DrDropdownDirective.prototype.elementHover = function () {
3045
+ if (!this.drDropdownInHover)
3046
+ return;
3047
+ this.openDropdown();
3048
+ };
3035
3049
  DrDropdownDirective.prototype.elementClick = function () {
3050
+ this.openDropdown();
3051
+ };
3052
+ DrDropdownDirective.prototype.documentClick = function (e) {
3053
+ this.closeDropdown(e);
3054
+ };
3055
+ DrDropdownDirective.prototype.openDropdown = function () {
3036
3056
  var option = this.el.nativeElement.getBoundingClientRect();
3037
3057
  this._document.querySelectorAll('dr-dropdown').forEach(function (item) { return item.remove(); });
3038
3058
  if (this.contentCmpRef && this.contentCmpRef.destroyCbs) {
@@ -3043,13 +3063,14 @@
3043
3063
  this.service.destroy();
3044
3064
  this.showMenu({
3045
3065
  option: option,
3066
+ drDropdownInHover: this.drDropdownInHover,
3046
3067
  position: this.position,
3047
3068
  list: this.drDropdown,
3048
3069
  class: this.drDropdownClass
3049
3070
  });
3050
3071
  }
3051
3072
  };
3052
- DrDropdownDirective.prototype.documentClick = function (e) {
3073
+ DrDropdownDirective.prototype.closeDropdown = function (e) {
3053
3074
  var menuItem = e.target.classList;
3054
3075
  if (menuItem.contains('dr-dropdown__container__item') || menuItem.contains('dr-dropdown__container__item__text')) {
3055
3076
  return;
@@ -3090,7 +3111,9 @@
3090
3111
  position: [{ type: i0.Input }],
3091
3112
  drDropdown: [{ type: i0.Input }],
3092
3113
  drDropdownClass: [{ type: i0.Input }],
3114
+ drDropdownInHover: [{ type: i0.Input }],
3093
3115
  contentCmpRef: [{ type: i0.ViewChild, args: [DrDropdownComponent, { static: true, read: i0.ViewContainerRef },] }],
3116
+ elementHover: [{ type: i0.HostListener, args: ['mouseenter',] }],
3094
3117
  elementClick: [{ type: i0.HostListener, args: ['click',] }],
3095
3118
  documentClick: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
3096
3119
  };