Skip to content

Commit

Permalink
refactor(ɵcomponents): rename SciPropertyComponent to `SciKeyValueC…
Browse files Browse the repository at this point in the history
…omponent`

BREAKING CHANGE: Renaming `SciPropertyComponent` introduced a breaking change.

To migrate:
- Import `SciKeyValueComponent` instead of `SciPropertyComponent`
- Change input from `properties` to `object`
  • Loading branch information
Marcarrian authored and danielwiehl committed Jul 19, 2023
1 parent 217101c commit fec29be
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions apps/components/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const routes: Routes = [
data: {internal: true},
},
{
path: 'sci-property',
loadComponent: () => import('./sci-property-page/sci-property-page.component'),
path: 'sci-key-value',
loadComponent: () => import('./sci-key-value-page/sci-key-value-page.component'),
data: {internal: true},
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1>sci-key-value (ɵ)</h1>

<h2>Dictionary</h2>
<sci-key-value [object]="dictionary"/>

<h2>Map</h2>
<sci-key-value [object]="map"/>
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
* SPDX-License-Identifier: EPL-2.0
*/
import {Component} from '@angular/core';
import {SciPropertyComponent} from '@scion/components.internal/property';
import {SciKeyValueComponent} from '@scion/components.internal/key-value';

@Component({
selector: 'sci-property-page',
templateUrl: './sci-property-page.component.html',
styleUrls: ['./sci-property-page.component.scss'],
selector: 'sci-key-value-page',
templateUrl: './sci-key-value-page.component.html',
styleUrls: ['./sci-key-value-page.component.scss'],
standalone: true,
imports: [SciPropertyComponent],
imports: [SciKeyValueComponent],
})
export default class SciPropertyPageComponent {
export default class SciKeyValuePageComponent {

public dictionary = {
firstname: 'Clarke',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ import {KeyValue, KeyValuePipe, NgFor} from '@angular/common';
import {Dictionaries, Dictionary} from '@scion/toolkit/util';

/**
* Show the properties of an object.
* Displays key-value pairs of an object.
*/
@Component({
selector: 'sci-property',
templateUrl: './property.component.html',
styleUrls: ['./property.component.scss'],
selector: 'sci-key-value',
templateUrl: './key-value.component.html',
styleUrls: ['./key-value.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
NgFor,
KeyValuePipe,
],
})
export class SciPropertyComponent {
export class SciKeyValueComponent {

public flattenedProperties: Dictionary = {};
private _keys: string[] = [];

@Input()
public set properties(properties: Dictionary | Map<string, any>) {
this.flattenedProperties = this.flattenObject(properties || {});
public set object(object: Dictionary | Map<string, any>) {
this.flattenedProperties = this.flattenObject(object || {});
this._keys = Object.keys(this.flattenedProperties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/

/*
* Secondary entrypoint: '@scion/components.internal/property'
* Secondary entrypoint: '@scion/components.internal/key-value'
*
* @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md
*/
export {SciPropertyComponent} from './property.component';
export {SciKeyValueComponent} from './key-value.component';
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
// "@scion/components.internal/params-enter": [
// "projects/scion/components.internal/params-enter/src/public_api"
// ],
// "@scion/components.internal/property": [
// "projects/scion/components.internal/property/src/public_api"
// "@scion/components.internal/key-value": [
// "projects/scion/components.internal/key-value/src/public_api"
// ],
// "@scion/components.internal/qualifier-chip-list": [
// "projects/scion/components.internal/qualifier-chip-list/src/public_api"
Expand Down

0 comments on commit fec29be

Please sign in to comment.