Skip to content

Commit

Permalink
fix: resource-select config merging + ec-output-tags are now oneline
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Feb 15, 2019
1 parent 53d0088 commit c483625
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Expand Up @@ -614,14 +614,15 @@ export class ResourceConfig {
display: (group => group ? group.map(g => g.name) : [])
}
}
}
},
token: {}
};

constructor(private symbol: SymbolService, private typeConfig: TypeConfigService) { }
/** Returns the CrudConfig for the given relation name. */
get(relationName: string): CrudConfig<Resource> {
if (!this.config[relationName]) {
console.error(`${relationName} could not be found in the resource-config.
console.warn(`${relationName} could not be found in the resource-config.
Use one of ${Object.keys(this.config)}`);
return {};
} // TODO enrich fields with type with type-config?
Expand Down
Expand Up @@ -156,7 +156,7 @@ export class ResourceSelectComponent extends SelectComponent<Resource> implement
return;
}
this.config = <CrudConfig<Resource>>Object.assign(this.resourceConfig.get(this.relation)/* , { size: 5 } */,
this.config, { solo: this.solo, selectMode: false, disableSelectSwitch: true } as CrudConfig<Resource>);
this.crudConfig, { solo: this.solo, selectMode: false, disableSelectSwitch: true } as CrudConfig<Resource>);
this.useConfig(this.config);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/style/scss/ec-output/_ec-output-tags.scss
Expand Up @@ -3,8 +3,10 @@
// @param {array} $ec-output-tags-style
.ec-output-tags {
display: flex;
flex-wrap: wrap;
overflow: hidden;
/* flex-wrap: wrap; */
list-style: none;
white-space: nowrap;
padding: 0;
@include inject-style($ec-output-tags-style);
margin: arrayMagic($ec-output-tags-spacing);
Expand Down
12 changes: 9 additions & 3 deletions src/app/resource-select/resource-select-demo.component.html
@@ -1,15 +1,21 @@
<h2>Resource Select</h2>
<ec-resource-select relation="dataManager" [api]="sdk?.datamanager" [(ngModel)]="multi"></ec-resource-select>
<span *ngIf="multi?.length">{{multi?.length}} items selected</span>
<ec-resource-select relation="dataManager" [api]="sdk?.datamanager" [solo]="true" [(ngModel)]="solo"></ec-resource-select>
<ec-resource-select relation="dataManager" [api]="sdk?.datamanager" [solo]="true" [(ngModel)]="solo">
</ec-resource-select>
<span *ngIf="solo">selected: {{solo}}</span>
<ec-notifications class="toast"></ec-notifications>
<h3>Without buttons</h3>
<ec-resource-select [config]="{disableListPop:true,disableCreatePop:true}" relation="dataManager" [api]="sdk?.datamanager"
[solo]="true"></ec-resource-select>
<ec-resource-select [config]="{disableListPop:true,disableCreatePop:true}" relation="dataManager"
[api]="sdk?.datamanager" [solo]="true"></ec-resource-select>

<h3>Accounts</h3>
<ec-resource-select relation="dmAccount" [api]="datamanager" *ngIf="datamanager"></ec-resource-select>

<h3>With config</h3>
<ec-resource-select relation="model" [api]="datamanager" *ngIf="datamanager" [config]="{disableCreatePop:true}">

</ec-resource-select>
<!-- <h3>Asset Tags</h3>
<ec-resource-select relation="tags" [api]="sdk.api"></ec-resource-select> -->
<h3>Tag Select</h3>
Expand Down

0 comments on commit c483625

Please sign in to comment.