@dev-tcloud/tcloud-ui 0.0.19 → 0.0.21

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.
@@ -1099,7 +1099,6 @@ class DataListService {
1099
1099
  this._stateSourceOptions.next(v);
1100
1100
  }
1101
1101
  setActiveItem(v) {
1102
- // console.log('setActiveItem', v);
1103
1102
  this._stateSourceActive.next(v);
1104
1103
  }
1105
1104
  getActiveItem() {
@@ -1188,6 +1187,22 @@ class TCloudUiDataListComponent {
1188
1187
  this.toResize();
1189
1188
  this.toClick();
1190
1189
  }
1190
+ ngAfterViewChecked() {
1191
+ if (this.list_selected_options && (this.list_selected_options).length > 0) {
1192
+ for (let i = 0; i < (this.list_selected_options).length; i++) {
1193
+ const item = this.list_selected_options[i];
1194
+ if (item.value === this.selected_item) {
1195
+ setTimeout(() => {
1196
+ if (this.selected_description !== item.description) {
1197
+ this.selected_description = item.description;
1198
+ this.dataListService.setActiveItem(this.selected_item);
1199
+ }
1200
+ });
1201
+ break;
1202
+ }
1203
+ }
1204
+ }
1205
+ }
1191
1206
  generateID() {
1192
1207
  return `data-list-${Math.floor(Math.random() * Math.floor(Math.random() * Date.now()))}`;
1193
1208
  }
@@ -1369,9 +1384,12 @@ class TCloudUiDataListOptionComponent {
1369
1384
  this.id = '';
1370
1385
  this.select_options = new ISelectOptions();
1371
1386
  this.selected = new EventEmitter();
1372
- this.subscription_active = dataListService.stateValue$.subscribe(v => { this.actived_value = v; });
1373
1387
  }
1374
1388
  ngOnInit() {
1389
+ this.actived_value = this.dataListService.getActiveItem();
1390
+ this.subscription_active = this.dataListService.stateActive$.subscribe(v => {
1391
+ this.actived_value = v;
1392
+ });
1375
1393
  this.id = this.generateID();
1376
1394
  this.setSelectOptions();
1377
1395
  }
@@ -1405,10 +1423,10 @@ class TCloudUiDataListOptionComponent {
1405
1423
  }
1406
1424
  }
1407
1425
  TCloudUiDataListOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDataListOptionComponent, deps: [{ token: DataListService }], target: i0.ɵɵFactoryTarget.Component });
1408
- TCloudUiDataListOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TCloudUiDataListOptionComponent, selector: "tcloud-ui-data-list-option", inputs: { value: "value" }, outputs: { selected: "selected" }, ngImport: i0, template: "<button \r\n [title]=\"select_options.description\"\r\n id=\"{{id}}\"\r\n [attr.data-description]=\"select_options.description\"\r\n class=\"dropdown-item\" \r\n [class.null-value]=\"value === undefined || value === null || value === ''\"\r\n [class.active]=\"value === actived_value\" \r\n type=\"button\" \r\n [value]=\"value\"\r\n (click)=\"setSelectedItem(value)\" >\r\n <ng-content></ng-content>\r\n</button>\r\n", styles: ["button{color:#666;width:100%;padding:10px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}button:hover{background-color:#e5f5f9;color:#333}button.active{background-color:#ceedf5;color:#333}.null-value{height:35px}\n"] });
1426
+ TCloudUiDataListOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TCloudUiDataListOptionComponent, selector: "tcloud-ui-data-list-option", inputs: { value: "value" }, outputs: { selected: "selected" }, ngImport: i0, template: "<button \r\n [title]=\"select_options.description\"\r\n id=\"{{id}}\"\r\n [attr.data-description]=\"select_options.description\"\r\n [attr.data-actived-value]=\"actived_value\"\r\n class=\"dropdown-item\" \r\n [class.null-value]=\"value === undefined || value === null || value === ''\"\r\n [class.active]=\"value === actived_value\" \r\n type=\"button\" \r\n [value]=\"value\"\r\n (click)=\"setSelectedItem(value)\" >\r\n <ng-content></ng-content>\r\n</button>\r\n", styles: ["button{color:#666;width:100%;padding:10px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}button:hover{background-color:#e5f5f9;color:#333}button.active{background-color:#ceedf5;color:#333}.null-value{height:35px}\n"] });
1409
1427
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TCloudUiDataListOptionComponent, decorators: [{
1410
1428
  type: Component,
1411
- args: [{ selector: 'tcloud-ui-data-list-option', template: "<button \r\n [title]=\"select_options.description\"\r\n id=\"{{id}}\"\r\n [attr.data-description]=\"select_options.description\"\r\n class=\"dropdown-item\" \r\n [class.null-value]=\"value === undefined || value === null || value === ''\"\r\n [class.active]=\"value === actived_value\" \r\n type=\"button\" \r\n [value]=\"value\"\r\n (click)=\"setSelectedItem(value)\" >\r\n <ng-content></ng-content>\r\n</button>\r\n", styles: ["button{color:#666;width:100%;padding:10px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}button:hover{background-color:#e5f5f9;color:#333}button.active{background-color:#ceedf5;color:#333}.null-value{height:35px}\n"] }]
1429
+ args: [{ selector: 'tcloud-ui-data-list-option', template: "<button \r\n [title]=\"select_options.description\"\r\n id=\"{{id}}\"\r\n [attr.data-description]=\"select_options.description\"\r\n [attr.data-actived-value]=\"actived_value\"\r\n class=\"dropdown-item\" \r\n [class.null-value]=\"value === undefined || value === null || value === ''\"\r\n [class.active]=\"value === actived_value\" \r\n type=\"button\" \r\n [value]=\"value\"\r\n (click)=\"setSelectedItem(value)\" >\r\n <ng-content></ng-content>\r\n</button>\r\n", styles: ["button{color:#666;width:100%;padding:10px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}button:hover{background-color:#e5f5f9;color:#333}button.active{background-color:#ceedf5;color:#333}.null-value{height:35px}\n"] }]
1412
1430
  }], ctorParameters: function () { return [{ type: DataListService }]; }, propDecorators: { value: [{
1413
1431
  type: Input
1414
1432
  }], selected: [{