Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: carbon-design-system/carbon-components-angular
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.56.4
Choose a base ref
...
head repository: carbon-design-system/carbon-components-angular
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.56.5
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 30, 2024

  1. chore: lint fix (#3080)

    Signed-off-by: Akshat Patel <[email protected]>
    Akshat55 authored Nov 30, 2024
    Copy the full SHA
    5c03216 View commit details

Commits on Dec 17, 2024

  1. fix: typing for loading translation strings (#3077)

    Co-authored-by: Akshat Patel <[email protected]>
    klaascuvelier and Akshat55 authored Dec 17, 2024
    Copy the full SHA
    f591581 View commit details
Showing with 15 additions and 13 deletions.
  1. +2 −2 src/combobox/combobox.component.spec.ts
  2. +6 −6 src/combobox/combobox.component.ts
  3. +1 −1 src/datepicker/datepicker.stories.ts
  4. +6 −4 src/i18n/i18n.service.ts
4 changes: 2 additions & 2 deletions src/combobox/combobox.component.spec.ts
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ class ComboboxTest {
{id: "2", content: "two", selected: false},
{id: "3", content: "three", selected: false}
];
type = 'single';
type = "single";
itemValueKey = undefined;
model: ListItem;
}
@@ -207,6 +207,6 @@ describe("Combo box", () => {
dropdownOption.click();
fixture.detectChanges();

expect(wrapper.model).toEqual(['1']);
expect(wrapper.model).toEqual(["1"]);
});
});
12 changes: 6 additions & 6 deletions src/combobox/combobox.component.ts
Original file line number Diff line number Diff line change
@@ -696,12 +696,12 @@ export class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnD
const selected = this.view.getSelected();

// in case there are disabled items they should be mapped according to itemValueKey
if (this.itemValueKey && selected) {
const values = selected.map((item) => item[this.itemValueKey]);
this.propagateChangeCallback(values);
} else {
this.propagateChangeCallback(selected);
}
if (this.itemValueKey && selected) {
const values = selected.map((item) => item[this.itemValueKey]);
this.propagateChangeCallback(values);
} else {
this.propagateChangeCallback(selected);
}

this.selected.emit(selected as any);
this.clear.emit(event);
2 changes: 1 addition & 1 deletion src/datepicker/datepicker.stories.ts
Original file line number Diff line number Diff line change
@@ -168,7 +168,7 @@ Range.args = {
language: "en",
flatpickrOptions: {
minDate: new Date("11/01/24"),
maxDate: new Date("11/30/24"),
maxDate: new Date("11/30/24")
}
};
Range.argTypes = {
10 changes: 6 additions & 4 deletions src/i18n/i18n.service.ts
Original file line number Diff line number Diff line change
@@ -135,7 +135,9 @@ export class Overridable {
/**
* An object of strings, should follow the same format as src/i18n/en.json
*/
export type TranslationStrings = { [key: string]: string };
export type TranslationStrings = {
[key: string]: string | TranslationStrings;
};


/**
@@ -148,7 +150,7 @@ export type TranslationStrings = { [key: string]: string };
*/
@Injectable()
export class I18n {
protected translationStrings = EN;
protected translationStrings: TranslationStrings = EN;

protected translations = new Map();

@@ -264,8 +266,8 @@ export class I18n {
*
* @param path looks like `"NOTIFICATION.CLOSE_BUTTON"`
*/
public getValueFromPath(path): string | { [key: string]: string } {
let value = this.translationStrings;
public getValueFromPath(path: string): string | TranslationStrings {
let value: string | TranslationStrings = this.translationStrings;
for (const segment of path.split(".")) {
if (value[segment] !== undefined && value[segment] !== null) {
value = value[segment];