Skip to content

Commit

Permalink
fix: add lodash as a dependency (#2990)
Browse files Browse the repository at this point in the history
Signed-off-by: Akshat Patel <[email protected]>
  • Loading branch information
Akshat55 authored Sep 5, 2024
1 parent 9bcb974 commit 2921d1f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 27 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"@floating-ui/dom": "1.6.3",
"@ibm/telemetry-js": "^1.5.0",
"flatpickr": "4.6.13",
"lodash": "4.17.21",
"tslib": "2.3.0"
}
}
3 changes: 2 additions & 1 deletion src/datepicker/datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ export class DatePicker implements
dateFormat: this.dateFormat,
locale: languages.default?.default[this.language] || languages.default[this.language],
// Little trick force "readonly mode" on datepicker input.
// Docs: Whether clicking on the input should open the picker. You could disable this if you wish to open the calendar manually with.open().
// Docs: Whether clicking on the input should open the picker.
// You could disable this if you wish to open the calendar manually with.open().
clickOpens: !this.readonly
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@carbon/icons",
"@floating-ui/dom",
"@ibm/telemetry-js",
"flatpickr"
"flatpickr",
"lodash"
]
}
1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@floating-ui/dom": "1.6.3",
"@ibm/telemetry-js": "^1.5.0",
"flatpickr": "4.6.13",
"lodash": "4.17.21",
"tslib": "2.3.0"
}
}
34 changes: 17 additions & 17 deletions src/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
]
})
export class Select implements ControlValueAccessor, AfterViewInit {
@Input() set value(v) {
this._value = v;
if (this.select) {
this.select.nativeElement.value = this._value;
}
}

get value() {
return this._value;
}

/**
* Tracks the total number of selects instantiated. Used to generate unique IDs
*/
Expand Down Expand Up @@ -202,17 +213,6 @@ export class Select implements ControlValueAccessor, AfterViewInit {

@ViewChild("select") select: ElementRef;

@Input() set value(v) {
this._value = v;
if (this.select) {
this.select.nativeElement.value = this._value;
}
}

get value() {
return this._value;
}

protected _value;

ngAfterViewInit() {
Expand Down Expand Up @@ -276,12 +276,6 @@ export class Select implements ControlValueAccessor, AfterViewInit {
return value instanceof TemplateRef;
}

/**
* placeholder declarations. Replaced by the functions provided to `registerOnChange` and `registerOnTouched`
*/
protected onChangeHandler = (_: any) => { };
protected onTouchedHandler = () => { };

onMouseDown(event: MouseEvent) {
/**
* This prevents the select from opening with mouse
Expand All @@ -301,4 +295,10 @@ export class Select implements ControlValueAccessor, AfterViewInit {
event.preventDefault();
}
}

/**
* placeholder declarations. Replaced by the functions provided to `registerOnChange` and `registerOnTouched`
*/
protected onChangeHandler = (_: any) => { };
protected onTouchedHandler = () => { };
}
2 changes: 1 addition & 1 deletion src/treeview/tree-node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class TreeNodeComponent implements AfterContentChecked, OnInit, OnDestroy
}

emitFocusEvent(event) {
const node = { id: this.id, label: this.label, value: this.value }
const node = { id: this.id, label: this.label, value: this.value };
this.nodeFocus.emit({ node, event });
this.treeViewService.focusNode(node);
}
Expand Down
3 changes: 2 additions & 1 deletion src/treeview/tree-node.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export interface Node {
id?: string;
active?: boolean;
disabled?: boolean;
// selectable is only valid for nodes with children. If true, the node won't become selected and if clicked it would only expand/compress itself
// Selectable is only valid for nodes with children.
// If true, the node won't become selected and if clicked it would only expand/compress itself
selectable?: boolean;
expanded?: boolean;
selected?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/treeview/treeview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class TreeViewComponent implements AfterViewInit, OnInit, OnDestroy {
if (!eventOnNode) {
return;
}
this.toggle.emit(eventOnNode.node)
this.toggle.emit(eventOnNode.node);
}

/**
Expand Down Expand Up @@ -200,7 +200,7 @@ export class TreeViewComponent implements AfterViewInit, OnInit, OnDestroy {
// making a recursive shallow copy to avoid performance issues when deeply cloning templateRefs if defined in the node
const copiedNode = Object.assign({}, node);
if (node.children) {
copiedNode.children = node.children.map(child => this.copyNode(child));
copiedNode.children = node.children.map(child => this.copyNode(child));
}
return copiedNode;
}
Expand Down

0 comments on commit 2921d1f

Please sign in to comment.