-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch angular2-smart-table@2.8.1 for the project We're working on.
From the docs the keys of the columns option in settings must be properties of the objects in the data source; Hence, I would like to enforce this with typing, using a generic on the Settings interface in order to have stricter checks.
Moreover the type of the filters should not be a string, but a finite set of values (See the examples on the original repo). But for this case you know better the list of filters implemented (it seems that you have turned "list" into "multiple", right?).
Here is the diff that satisfied us.
diff --git a/node_modules/angular2-smart-table/lib/lib/settings.d.ts b/node_modules/angular2-smart-table/lib/lib/settings.d.ts
index bb11514..6176056 100644
--- a/node_modules/angular2-smart-table/lib/lib/settings.d.ts
+++ b/node_modules/angular2-smart-table/lib/lib/settings.d.ts
@@ -7,8 +7,8 @@ export declare enum SelectModeOptions {
Single = "single",
Multi = "multi"
}
-export interface Settings {
- columns?: IColumns;
+export interface Settings<T = any> {
+ columns?: IColumns<T>;
resizable?: boolean;
hideable?: boolean;
mode?: 'external' | 'inline';
@@ -58,9 +58,7 @@ export interface Expand {
*/
sanitizer?: SanitizerSettings;
}
-export interface IColumns {
- [key: string]: IColumn;
-}
+export type IColumns<T> = Partial<Record<keyof T>, IColumn>
export declare enum IColumnType {
Text = "text",
Html = "html",
@@ -92,7 +90,7 @@ export interface IColumn {
component?: any;
};
filter?: {
- type: string;
+ type: "list" | "html" | "custom" | "completer" | "checkbox";
config?: any;
component?: any;
} | boolean;Could this be a good improvement? Should I open a PR?
This issue body was partially generated by patch-package.