@datarailsshared/datarailsshared 1.3.37 → 1.3.38
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 +6 -2
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.3.38.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.js +7 -3
- package/fesm2015/datarailsshared-datarailsshared.js +6 -2
- 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,7 +2174,7 @@
|
|
|
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
|
],
|
|
@@ -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
|
};
|