@datarailsshared/datarailsshared 1.3.37 → 1.3.40
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/bundles/datarailsshared-datarailsshared.umd.js +13 -5
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.3.40.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-dropdown/dr-dropdown-position.directive.js +8 -4
- package/esm2015/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.js +8 -4
- package/fesm2015/datarailsshared-datarailsshared.js +14 -6
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.d.ts +2 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.3.37.tgz +0 -0
|
@@ -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:#
|
|
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
|
};
|
|
@@ -3178,12 +3182,16 @@
|
|
|
3178
3182
|
}
|
|
3179
3183
|
else {
|
|
3180
3184
|
var defaultChildPadding = 3;
|
|
3181
|
-
var widthMoreWindowRight = window.innerWidth - this.position.clientX - this.el.nativeElement.offsetWidth - defaultPadding;
|
|
3182
|
-
var widthMoreWindowBottom = window.innerHeight - this.position.clientY - this.el.nativeElement.offsetHeight - defaultPadding;
|
|
3185
|
+
var widthMoreWindowRight = window.innerWidth - (this.position.clientX - this.el.nativeElement.offsetWidth - defaultPadding);
|
|
3186
|
+
var widthMoreWindowBottom = window.innerHeight - (this.position.clientY - this.el.nativeElement.offsetHeight - defaultPadding);
|
|
3187
|
+
var spaceRightAmount = window.innerWidth - (this.position.clientX + this.el.nativeElement.offsetWidth + defaultPadding);
|
|
3183
3188
|
this.widthMoreRight = !(widthMoreWindowRight < 0);
|
|
3184
3189
|
var calculatedHorizantallyPos = widthMoreWindowRight < 0
|
|
3185
3190
|
? -this.position.x + -defaultChildPadding
|
|
3186
3191
|
: this.position.x + defaultChildPadding + xDifference;
|
|
3192
|
+
if (spaceRightAmount <= 0) {
|
|
3193
|
+
calculatedHorizantallyPos -= this.el.nativeElement.offsetWidth;
|
|
3194
|
+
}
|
|
3187
3195
|
var deltaHeight = widthMoreWindowBottom < 0 ? widthMoreWindowBottom : defaultDelta;
|
|
3188
3196
|
this.renderer.setStyle(this.el.nativeElement, 'top', (this.position.y + deltaHeight) + 'px');
|
|
3189
3197
|
this.renderer.setStyle(this.el.nativeElement, 'left', (calculatedHorizantallyPos) + 'px');
|