@mediusinc/mng-commons 0.12.5 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/esm2020/lib/api/utils/medius-rest.util.mjs +8 -3
  2. package/esm2020/lib/components/action/action.component.mjs +22 -9
  3. package/esm2020/lib/components/action/editor/action-editor.component.mjs +6 -6
  4. package/esm2020/lib/components/action/models/action-execution.model.mjs +6 -1
  5. package/esm2020/lib/components/action/models/index.mjs +2 -1
  6. package/esm2020/lib/components/action/models/tableview-action-default-categories.model.mjs +11 -0
  7. package/esm2020/lib/components/button/button.component.mjs +46 -0
  8. package/esm2020/lib/components/button/index.mjs +2 -0
  9. package/esm2020/lib/components/form/editor/form-editor.component.mjs +3 -2
  10. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +11 -14
  11. package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +41 -18
  12. package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +5 -13
  13. package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +5 -2
  14. package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +5 -3
  15. package/esm2020/lib/components/tableview/table/table.component.mjs +48 -20
  16. package/esm2020/lib/components/tableview/tableview.component.mjs +9 -3
  17. package/esm2020/lib/data-providers/table.data-provider.mjs +9 -2
  18. package/esm2020/lib/data-providers/tableview.data-provider.mjs +30 -2
  19. package/esm2020/lib/descriptors/action/action-confirmation.descriptor.mjs +106 -0
  20. package/esm2020/lib/descriptors/action.descriptor.mjs +63 -154
  21. package/esm2020/lib/descriptors/button.descriptor.mjs +111 -0
  22. package/esm2020/lib/descriptors/column.descriptor.mjs +120 -27
  23. package/esm2020/lib/descriptors/editor.descriptor.mjs +109 -7
  24. package/esm2020/lib/descriptors/field.descriptor.mjs +38 -4
  25. package/esm2020/lib/descriptors/filter.descriptor.mjs +13 -6
  26. package/esm2020/lib/descriptors/index.mjs +3 -1
  27. package/esm2020/lib/descriptors/table.descriptor.mjs +282 -16
  28. package/esm2020/lib/descriptors/tableview.descriptor.mjs +175 -3
  29. package/esm2020/lib/descriptors/types/table.type.mjs +10 -1
  30. package/esm2020/lib/mng-commons.module.mjs +24 -5
  31. package/esm2020/lib/models/index.mjs +2 -1
  32. package/esm2020/lib/models/tableview-attr.model.mjs +2 -0
  33. package/esm2020/lib/pipes/class-map.pipe.mjs +22 -0
  34. package/esm2020/lib/pipes/getter.pipe.mjs +20 -0
  35. package/esm2020/lib/pipes/index.mjs +4 -1
  36. package/esm2020/lib/pipes/template.pipe.mjs +24 -0
  37. package/esm2020/lib/router/models/router.model.mjs +1 -1
  38. package/esm2020/lib/router/tableview-route-builder.mjs +41 -17
  39. package/esm2020/lib/services/action-executor.service.mjs +30 -19
  40. package/esm2020/lib/styles/button-style.builder.mjs +59 -8
  41. package/esm2020/lib/styles/styles.util.mjs +2 -2
  42. package/esm2020/lib/utils/tableview.util.mjs +144 -0
  43. package/esm2020/public-api.mjs +2 -1
  44. package/fesm2015/mediusinc-mng-commons.mjs +1610 -345
  45. package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
  46. package/fesm2020/mediusinc-mng-commons.mjs +1590 -335
  47. package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
  48. package/lib/api/utils/medius-rest.util.d.ts +1 -0
  49. package/lib/components/action/action.component.d.ts +2 -1
  50. package/lib/components/action/models/action-execution.model.d.ts +2 -0
  51. package/lib/components/action/models/index.d.ts +1 -0
  52. package/lib/components/action/models/tableview-action-default-categories.model.d.ts +10 -0
  53. package/lib/components/button/button.component.d.ts +16 -0
  54. package/lib/components/button/index.d.ts +1 -0
  55. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +10 -4
  56. package/lib/components/tableview/route/tableview-route.component.d.ts +0 -5
  57. package/lib/components/tableview/table/table.component.d.ts +4 -2
  58. package/lib/components/tableview/tableview.component.d.ts +3 -0
  59. package/lib/data-providers/table.data-provider.d.ts +6 -1
  60. package/lib/data-providers/tableview.data-provider.d.ts +16 -2
  61. package/lib/descriptors/action/action-confirmation.descriptor.d.ts +48 -0
  62. package/lib/descriptors/action.descriptor.d.ts +30 -83
  63. package/lib/descriptors/button.descriptor.d.ts +40 -0
  64. package/lib/descriptors/column.descriptor.d.ts +45 -5
  65. package/lib/descriptors/editor.descriptor.d.ts +69 -11
  66. package/lib/descriptors/field.descriptor.d.ts +16 -11
  67. package/lib/descriptors/filter.descriptor.d.ts +7 -6
  68. package/lib/descriptors/index.d.ts +2 -0
  69. package/lib/descriptors/table.descriptor.d.ts +124 -8
  70. package/lib/descriptors/tableview.descriptor.d.ts +81 -7
  71. package/lib/descriptors/types/table.type.d.ts +8 -0
  72. package/lib/mng-commons.module.d.ts +74 -70
  73. package/lib/models/index.d.ts +1 -0
  74. package/lib/models/tableview-attr.model.d.ts +9 -0
  75. package/lib/pipes/class-map.pipe.d.ts +7 -0
  76. package/lib/pipes/getter.pipe.d.ts +7 -0
  77. package/lib/pipes/index.d.ts +3 -0
  78. package/lib/pipes/template.pipe.d.ts +10 -0
  79. package/lib/router/models/router.model.d.ts +6 -0
  80. package/lib/router/tableview-route-builder.d.ts +3 -0
  81. package/lib/styles/button-style.builder.d.ts +43 -2
  82. package/lib/utils/tableview.util.d.ts +39 -0
  83. package/package.json +2 -2
  84. package/public-api.d.ts +1 -0
  85. package/scss/mng-overrides/_theme_tableview.scss +17 -0
  86. package/version-info.json +5 -5
@@ -1,17 +1,39 @@
1
+ import { ILookupDataProvider } from '../data-providers';
2
+ import { TableviewAttributeDef } from '../models/tableview-attr.model';
1
3
  import { ClassType, EnumConstantType, EnumType, MngFieldValidationMessage, MngFieldValidator } from '../types';
2
4
  import { AFieldDescriptor, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, ModelDescriptor, TableDescriptor, TableviewDescriptor } from './';
3
- import { TableviewTypeEnum } from './types';
5
+ import { FieldInputTypeEnum, TableviewTypeEnum } from './types';
4
6
  export declare class EditorDescriptor<T> {
5
7
  static readonly defaultGroupName = "_default";
6
- private readonly _model;
7
- private readonly _tableviewEditorType;
8
- private readonly _tabs;
9
- private readonly _groups;
10
- private readonly _fields;
11
- private _currentTabGroup?;
12
- private _currentGroup?;
13
- private _disabled;
8
+ protected readonly _model: ModelDescriptor<T>;
9
+ protected readonly _modelType: ClassType<T>;
10
+ protected readonly _tableviewEditorType: TableviewTypeEnum;
11
+ protected readonly _tabs: Array<FieldTabGroupDescriptor<T>>;
12
+ protected readonly _groups: Array<FieldGroupDescriptor<T>>;
13
+ protected _fields: Array<AFieldDescriptor<any, T>>;
14
+ protected _currentTabGroup?: FieldTabGroupDescriptor<T>;
15
+ protected _currentGroup?: FieldGroupDescriptor<T>;
16
+ protected _disabled: boolean;
14
17
  constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, tableviewEditorType?: TableviewTypeEnum);
18
+ /**
19
+ * auto generated editor descriptor based on openapi definition
20
+ * generates all fields from definition
21
+ * @param modelType class type
22
+ * @param idProperty
23
+ * @param titleProperty
24
+ * @param tableEditorType
25
+ */
26
+ static from<T>(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, tableEditorType?: TableviewTypeEnum): EditorDescriptor<T>;
27
+ /**
28
+ * auto generated editor descriptor based on openapi definition
29
+ * generates only selected fields
30
+ * @param modelType class type
31
+ * @param attributes list of selected properties to generate fields based on
32
+ * @param idProperty
33
+ * @param titleProperty
34
+ * @param tableEditorType
35
+ */
36
+ static fromModelWithAttributes<T>(modelType: ClassType<T>, attributes: TableviewAttributeDef[], idProperty?: string, titleProperty?: string, tableEditorType?: TableviewTypeEnum): EditorDescriptor<T>;
15
37
  get model(): ModelDescriptor<T>;
16
38
  get tabs(): FieldTabGroupDescriptor<T>[];
17
39
  get fields(): AFieldDescriptor<any, T>[];
@@ -21,7 +43,11 @@ export declare class EditorDescriptor<T> {
21
43
  createFieldGroup(name: string, title?: string | null): FieldGroupDescriptor<T>;
22
44
  addFieldDescriptor<FT>(field: AFieldDescriptor<FT, T>): this;
23
45
  addField(property: string): FieldInputDescriptor<T>;
24
- removeField(property: string): this;
46
+ /**
47
+ * removes filed if exists in descriptor
48
+ * @param property field name
49
+ */
50
+ removeField(property: string): void;
25
51
  getField(property: string): AFieldDescriptor<any, T> | null;
26
52
  addFieldLookup<FT>(property: string, modelType: ClassType<FT>): FieldLookupDescriptor<FT, T>;
27
53
  addFieldLookupEnum(property: string, enumType: EnumType, options?: Array<EnumConstantType>, nameAsValue?: boolean, optionsTitlePath?: string | null): FieldLookupEnumDescriptor<T>;
@@ -31,7 +57,39 @@ export declare class EditorDescriptor<T> {
31
57
  addValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): void;
32
58
  copy(): EditorDescriptor<T>;
33
59
  createFieldGroupDescriptor(fieldGroup: FieldGroupDescriptor<T>): this;
34
- private createTabGroupDescriptor;
60
+ protected createTabGroupDescriptor(tabGroup: FieldTabGroupDescriptor<T>): this;
35
61
  private createDefaultGroup;
36
62
  private createDefaultTabGroup;
63
+ /**
64
+ * modifies selected field
65
+ * do not use it for enums! (use withFieldModifiedEnum instead)
66
+ * @param property field name
67
+ * @param fieldType new field type for selected field
68
+ * @param args additional parameters for field
69
+ */
70
+ withFieldModifiedType(property: string, fieldType: FieldInputTypeEnum, ...args: any[]): this;
71
+ /**
72
+ * modifies selected field with enum type
73
+ * @param property field property name
74
+ * @param enumType type of enum for new field
75
+ * @param optionsTitlePath
76
+ * @param values
77
+ * @param nameAsValue
78
+ */
79
+ withFieldModifiedEnum(property: string, enumType?: EnumType, optionsTitlePath?: string | null, values?: Array<EnumConstantType>, nameAsValue?: boolean): this;
80
+ /**
81
+ * adds lookup to given field
82
+ * @param property field property name
83
+ * @param modelType model type of field
84
+ * @param lookupProvider provider to be added to field
85
+ * @param titleProperty
86
+ */
87
+ withFieldModifiedLookup<MT>(property: string, modelType: ClassType<MT>, lookupProvider: ILookupDataProvider<any, any>, titleProperty?: string): this;
88
+ /**
89
+ * generates field based on attribute definition, used for auto model
90
+ * @param attribute definition
91
+ * @param field optional, if defined will be replaced, otherwise new will be generated
92
+ * @param args additional arguments
93
+ */
94
+ private upsertFieldFromAttributeDef;
37
95
  }
@@ -20,7 +20,6 @@ export declare abstract class AGenericFieldDescriptor<ET> {
20
20
  }
21
21
  export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescriptor<ET> {
22
22
  protected readonly _property: string;
23
- protected _group?: AFieldGroupDescriptor<ET>;
24
23
  protected _label?: string | null;
25
24
  protected _placeholder?: string;
26
25
  protected _helpText?: string;
@@ -32,9 +31,9 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
32
31
  protected _setter?: (item: ET, value: T) => void;
33
32
  protected _validations: Array<FieldValidationDescriptor>;
34
33
  protected _asyncValidations: Array<FieldValidationDescriptor>;
35
- protected _requiredExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
36
- protected _disabledExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
37
- protected _hiddenExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
34
+ protected _requiredExpression?: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
35
+ protected _disabledExpression?: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
36
+ protected _hiddenExpression?: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
38
37
  protected _className: string;
39
38
  protected _fieldClassName?: string;
40
39
  protected _labelClassName: string;
@@ -43,7 +42,6 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
43
42
  protected readonly _eventsSubject: Subject<MngFormFieldEvent<T, ET>>;
44
43
  protected constructor(editor: EditorDescriptor<ET>, property: string);
45
44
  get property(): string;
46
- get group(): AFieldGroupDescriptor<ET> | undefined;
47
45
  get label(): string | null | undefined;
48
46
  get placeholder(): string | undefined;
49
47
  get helpText(): string | undefined;
@@ -55,13 +53,13 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
55
53
  get setter(): ((item: ET, value: T) => void) | undefined;
56
54
  get validations(): FieldValidationDescriptor[];
57
55
  get asyncValidations(): FieldValidationDescriptor[];
58
- get requiredExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
56
+ get requiredExpression(): string | Observable<boolean> | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
59
57
  [additionalProperties: string]: any;
60
58
  }> | undefined) => boolean) | undefined;
61
- get disabledExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
59
+ get disabledExpression(): string | Observable<boolean> | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
62
60
  [additionalProperties: string]: any;
63
61
  }> | undefined) => boolean) | undefined;
64
- get hiddenExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
62
+ get hiddenExpression(): string | Observable<boolean> | ((field?: FormlyFieldConfig<import("@ngx-formly/core").FormlyFieldProps & {
65
63
  [additionalProperties: string]: any;
66
64
  }> | undefined) => boolean) | undefined;
67
65
  get className(): string;
@@ -75,9 +73,9 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
75
73
  withLabel(label: string | null): this;
76
74
  withPlaceholder(placeholder: string): this;
77
75
  withHelpText(helpText: string): this;
78
- withRequired(required?: boolean, requiredExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>, hideLabelMarker?: boolean): this;
79
- withDisabled(disabled?: boolean, disabledExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>): this;
80
- withHidden(hiddenExpression: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>): this;
76
+ withRequired(required?: boolean, requiredExpression?: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>, hideLabelMarker?: boolean): this;
77
+ withDisabled(disabled?: boolean, disabledExpression?: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>): this;
78
+ withHidden(hiddenExpression: string | ((field?: FormlyFieldConfig) => boolean) | Observable<boolean>): this;
81
79
  withDefaultValue(defaultValue: T): this;
82
80
  withGetter(getter: (item: ET) => T): this;
83
81
  withSetter(setter: (item: ET, value: T) => void): this;
@@ -119,6 +117,12 @@ export declare class FieldInputDescriptor<ET> extends AFieldDescriptor<string |
119
117
  private _fileOnSelectHandler?;
120
118
  private _customComponentName?;
121
119
  constructor(editor: EditorDescriptor<ET>, property: string);
120
+ /**
121
+ * converts field to given type with additional arguments
122
+ * @param fieldType field type enum
123
+ * @param args any additional arguments for field (optional)
124
+ */
125
+ asType(fieldType: FieldInputTypeEnum, ...args: any[]): this;
122
126
  get fieldType(): FieldInputTypeEnum;
123
127
  get rows(): number | undefined;
124
128
  get numberMin(): number | undefined;
@@ -269,6 +273,7 @@ export declare abstract class AFieldGroupDescriptor<ET> extends AGenericFieldDes
269
273
  protected _fields: AGenericFieldDescriptor<ET>[];
270
274
  protected _validations: Array<FieldValidationDescriptor>;
271
275
  protected constructor(editor: EditorDescriptor<ET>, name: string);
276
+ removeField(property: string, filterFunction: (fields: AGenericFieldDescriptor<ET>[]) => AGenericFieldDescriptor<ET>[]): AGenericFieldDescriptor<ET>[];
272
277
  get title(): string | undefined;
273
278
  abstract get fields(): AGenericFieldDescriptor<ET>[];
274
279
  get validations(): FieldValidationDescriptor[];
@@ -10,10 +10,10 @@ export declare class FilterDescriptor<T> {
10
10
  protected readonly _property: string;
11
11
  protected _filterType: FilterTypeEnum;
12
12
  protected _filterProperty?: string;
13
- private _hasDefaultValue;
14
- protected _defaultFilterMatchMode: FilterMatchModeEnum;
15
- protected _defaultValue?: string;
16
- private _defaultValueTo?;
13
+ protected _hasDefaultValue: boolean;
14
+ protected _defaultFilterMatchMode?: FilterMatchModeEnum;
15
+ protected _defaultValue?: string | string[];
16
+ protected _defaultValueTo?: string;
17
17
  protected _matchModes: string[] | null;
18
18
  protected _numberMinFractionDigits?: number;
19
19
  protected _numberMaxFractionDigits?: number;
@@ -28,9 +28,9 @@ export declare class FilterDescriptor<T> {
28
28
  constructor(property: string);
29
29
  get filterType(): FilterTypeEnum;
30
30
  get hasDefaultValue(): boolean;
31
- get defaultValue(): string | undefined;
31
+ get defaultValue(): string | string[] | undefined;
32
32
  get defaultValueTo(): string | undefined;
33
- get defaultFilterMatchMode(): FilterMatchModeEnum;
33
+ get defaultFilterMatchMode(): FilterMatchModeEnum | undefined;
34
34
  get filterProperty(): string | undefined;
35
35
  get matchModes(): string[] | null;
36
36
  get numberMinFractionDigits(): number | undefined;
@@ -93,6 +93,7 @@ export declare class FilterLookupDescriptor<T> extends FilterDescriptor<T> imple
93
93
  withLookupDataProvider(dataProvider: ILookupDataProvider<T, any>): this;
94
94
  withMultiselect(multiselect?: boolean): this;
95
95
  withDropdownClassName(dropdownClassName: string): this;
96
+ withDefaultFilter(filterValue: string | string[], filterValueTo?: string, filterMatchMode?: FilterMatchModeEnum): this;
96
97
  asAutocomplete(openOnFocus?: boolean, inlineSearch?: boolean): this;
97
98
  copy(): FilterLookupDescriptor<T>;
98
99
  protected copyFieldsTo(filter: FilterLookupDescriptor<T>): void;
@@ -7,3 +7,5 @@ export * from './filter.descriptor';
7
7
  export * from './model.descriptor';
8
8
  export * from './table.descriptor';
9
9
  export * from './tableview.descriptor';
10
+ export * from './button.descriptor';
11
+ export * from './action/action-confirmation.descriptor';
@@ -1,16 +1,20 @@
1
1
  import { Type } from '@angular/core';
2
+ import { MediusQueryResult } from '../api/models';
3
+ import { ILookupDataProvider } from '../data-providers';
2
4
  import { IColumnValueComponent } from '../models';
5
+ import { TableviewAttributeDef } from '../models/tableview-attr.model';
3
6
  import { ClassType, EnumType } from '../types';
4
- import { ColumnDescriptor } from './column.descriptor';
7
+ import { ColumnDescriptor, ColumnDynamicDescriptor } from './column.descriptor';
5
8
  import { ModelDescriptor } from './model.descriptor';
6
- import { TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum } from './types';
9
+ import { ColumnTypeEnum, TableDynamicColumnsModeEnum, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum } from './types';
7
10
  export declare class TableDescriptor<T> {
8
11
  private readonly _model;
12
+ private _modelType;
9
13
  private _filterDisplay;
10
14
  private _paginationMode;
11
15
  private _rowsPerPageOptions;
12
16
  private _defaultNumRows;
13
- private _columns;
17
+ protected _columns: Array<ColumnDescriptor<any, T>>;
14
18
  private _title?;
15
19
  private _hideHeader;
16
20
  private _dataKeyProperty?;
@@ -23,7 +27,26 @@ export declare class TableDescriptor<T> {
23
27
  private _rowHeight?;
24
28
  private _hasHover;
25
29
  private _hasGridlines;
30
+ private _headerClassName?;
31
+ private _rowClassName?;
32
+ private _rowClassNameMapFn?;
33
+ private _autoGenerated;
26
34
  constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
35
+ /**
36
+ * generates descriptor based on modelType attribute definition
37
+ * @param modelType class type
38
+ * @param idProperty
39
+ * @param titleProperty
40
+ */
41
+ static from<T>(modelType: ClassType<T>, idProperty?: string, titleProperty?: string): TableDescriptor<T>;
42
+ /**
43
+ * generates descriptor base on given attribute definition
44
+ * @param modelType class type
45
+ * @param attributes attributes from which descriptor is generated
46
+ * @param idProperty
47
+ * @param titleProperty
48
+ */
49
+ static fromModelWithAttributes<T>(modelType: ClassType<T>, attributes: TableviewAttributeDef[], idProperty?: string, titleProperty?: string): TableDescriptor<T>;
27
50
  get filterDisplay(): TableFilterDisplayEnum;
28
51
  get paginationMode(): TablePaginationModeEnum;
29
52
  get rowsPerPageOptions(): number[];
@@ -42,6 +65,10 @@ export declare class TableDescriptor<T> {
42
65
  get rowHeight(): number | undefined;
43
66
  get hasHover(): boolean;
44
67
  get hasGridlines(): boolean;
68
+ get rowClassName(): string | undefined;
69
+ get rowClassNameMapFn(): ((className?: string | undefined, item?: T | undefined) => string) | undefined;
70
+ get headerClassName(): string | undefined;
71
+ getColumn(property: string): ColumnDescriptor<string, T> | undefined;
45
72
  addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
46
73
  addColumn(property: string): ColumnDescriptor<string, T>;
47
74
  addColumnNumber(property: string, displayFormat?: string): ColumnDescriptor<number, T>;
@@ -49,18 +76,107 @@ export declare class TableDescriptor<T> {
49
76
  addColumnBoolean(property: string, yes?: string, no?: string, asIcon?: boolean): ColumnDescriptor<boolean, T>;
50
77
  addColumnEnum(property: string, enumType: EnumType, nameAsValue?: boolean, titlePath?: string | null): ColumnDescriptor<EnumType, T>;
51
78
  addColumnCustomComponent(property: string, customComponentType: Type<IColumnValueComponent<T>>): ColumnDescriptor<any, T>;
79
+ removeColumn(property: string): void;
52
80
  withFilterDisplay(filterDisplayType: TableFilterDisplayEnum): this;
53
81
  withPaginationMode(paginationMode: TablePaginationModeEnum): this;
54
82
  withRowsPerPage(rows: number, options?: Array<number>): this;
55
- withTitle(title: string): TableDescriptor<T>;
83
+ withTitle(title: string): this;
56
84
  withHideHeader(hideHeader?: boolean): this;
57
- withDataKeyProperty(property: string): TableDescriptor<T>;
58
- withDefaultSort(property: string, asc?: boolean): TableDescriptor<T>;
85
+ withDataKeyProperty(property: string): this;
86
+ withDefaultSort(property: string, asc?: boolean): this;
59
87
  withClassName(className: string): this;
60
88
  withSize(size?: TableSizeEnum): this;
61
- withTableFullHeightOffset(tableFullHeightOffset: number): TableDescriptor<T>;
62
- withRowHeight(rowHeight: number): TableDescriptor<T>;
89
+ withTableFullHeightOffset(tableFullHeightOffset: number): this;
90
+ withRowHeight(rowHeight: number): this;
63
91
  withHover(hover: boolean): this;
64
92
  withGridlines(gridlines: boolean): this;
93
+ withRowClassName(rowClassName?: string, classNameMapFn?: (className?: string, item?: T) => string): this;
94
+ withHeaderClassName(headerClassName: string): this;
95
+ protected copyFieldsTo(obj: TableDescriptor<T>): void;
65
96
  copy(): TableDescriptor<T>;
97
+ /**
98
+ * generates column based on attributes
99
+ * @param attribute attribute map
100
+ * @param column if provided, replaced by new, otherwise new is created
101
+ * @param args additional parameters
102
+ */
103
+ private upsertColumnFromAttributeDef;
104
+ /**
105
+ * defines modified type of column
106
+ * DO NOT USE with enum (use withCustomEnumType)
107
+ * @param property column name
108
+ * @param columnType modified type
109
+ * @param args additional attributes
110
+ */
111
+ withColumnModifiedType(property: string, columnType?: ColumnTypeEnum, ...args: any[]): this;
112
+ /**
113
+ * defines custom enum type for column
114
+ * @param property column name
115
+ * @param enumType
116
+ */
117
+ withColumnModifiedEnum(property: string, enumType?: EnumType): this;
118
+ /**
119
+ * modifies column with class and lookup provider
120
+ * @param property column name
121
+ * @param lookupProvider lookupProvider for class
122
+ * @param itemsLabelProperty
123
+ * @param filterProperty
124
+ */
125
+ withColumnModifiedLookup(property: string, lookupProvider: ILookupDataProvider<any, any>, itemsLabelProperty?: string, filterProperty?: string): this;
126
+ }
127
+ export declare class TableDynamicDescriptor extends TableDescriptor<any> {
128
+ private _excludedColumns;
129
+ private _filterColumns;
130
+ private _sortColumns;
131
+ private _sortColumnMode;
132
+ private _filterColumnMode;
133
+ protected _columns: ColumnDynamicDescriptor[];
134
+ constructor(idProperty?: string, titleProperty?: string);
135
+ get columns(): ColumnDynamicDescriptor[];
136
+ /**
137
+ * defines excluded columns when generating descriptor
138
+ * @param excludedColumn names of excluded columns
139
+ */
140
+ withColumnsExcluded(excludedColumn: string[]): this;
141
+ /**
142
+ * defines column properties on which sort is defined or not depending on sortColumnMode
143
+ * @param sortOnColumns column names
144
+ * @param sortColumnMode INCLUDE_ONLY (default) only given columns will have sort, EXCLUDE given columns will NOT have sort
145
+ */
146
+ withColumnsSort(sortOnColumns: string[], sortColumnMode?: TableDynamicColumnsModeEnum): this;
147
+ /**
148
+ * defines column properties on which filter is defined or not depending on filterColumnMode
149
+ * @param filterOnColumn column names
150
+ * @param filterColumnMode INCLUDE_ONLY (default) only given columns will have filter, EXCLUDE given columns will NOT have filter
151
+ */
152
+ withColumnsFilter(filterOnColumn: string[], filterColumnMode?: TableDynamicColumnsModeEnum): this;
153
+ /**
154
+ * sets given type to column with given property and returns this table
155
+ * @param property column's property
156
+ * @param type custom type for column
157
+ * @param args addition arguments for column
158
+ */
159
+ withColumnModifiedType(property: string, type: ColumnTypeEnum, ...args: any[]): this;
160
+ /**
161
+ * sets title to column with given property and returns this table
162
+ * @param property column's property
163
+ * @param title column's title
164
+ */
165
+ withColumnTitle(property: string, title: string): this;
166
+ /**
167
+ * generates columns defined on table based on data fetched from api
168
+ * @param data data from api
169
+ */
170
+ toTableDescriptorFromData(data: MediusQueryResult<any>): TableDescriptor<any>;
171
+ /**
172
+ * adds ColumnDynamicDescriptor to this table
173
+ * @param property column's property
174
+ */
175
+ addColumn(property: string): ColumnDynamicDescriptor;
176
+ removeColumn(property: string): this;
177
+ /**
178
+ * creates deep copy of table dynamic descriptor
179
+ */
180
+ copy(): TableDynamicDescriptor;
181
+ toTableDescriptor(): TableDescriptor<any>;
66
182
  }
@@ -1,23 +1,44 @@
1
1
  import { Type } from '@angular/core';
2
2
  import { FieldValidatorFn } from '@ngx-formly/core/lib/models/config';
3
+ import { ILookupDataProvider } from '../data-providers';
3
4
  import { IColumnValueComponent } from '../models';
5
+ import { TableviewAttributeDef } from '../models/tableview-attr.model';
4
6
  import { ClassType, EnumConstantType, EnumType } from '../types';
5
- import { AFieldDescriptor, ColumnDescriptor, EditorDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, ModelDescriptor, TableDescriptor } from './';
7
+ import { AFieldDescriptor, ColumnDescriptor, EditorDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, ModelDescriptor, TableDescriptor, TableDynamicDescriptor } from './index';
8
+ import { ColumnTypeEnum, FieldInputTypeEnum, TableviewTypeEnum } from './types';
6
9
  export declare class TableviewDescriptor<T> {
7
10
  private readonly _model;
11
+ private _modelType;
12
+ protected _table: TableDescriptor<T>;
13
+ protected _viewEditor: EditorDescriptor<T>;
14
+ protected _addEditor: EditorDescriptor<T>;
15
+ protected _editEditor: EditorDescriptor<T>;
16
+ protected _tableTitle?: string;
8
17
  constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
9
- private _table;
18
+ /**
19
+ * generates descriptor from attribute definition of openaapi model
20
+ * @param modelType class type
21
+ * @param idProperty
22
+ * @param titleProperty
23
+ */
24
+ static from<T>(modelType: ClassType<T>, idProperty?: string, titleProperty?: string): TableviewDescriptor<T>;
25
+ /**
26
+ * generates descriptor from given attribute definition
27
+ * @param modelType class type
28
+ * @param columnAttributes attribute definition to generate columns
29
+ * @param fieldAttributes attribute definition to generate fields, if undefined columnDefinition is used, if null editors are not generated
30
+ * @param idProperty
31
+ * @param titleProperty
32
+ */
33
+ static fromModelWithDefinition<T>(modelType: ClassType<T>, columnAttributes: TableviewAttributeDef[], fieldAttributes?: TableviewAttributeDef[] | null, idProperty?: string, titleProperty?: string): TableviewDescriptor<T>;
10
34
  get table(): TableDescriptor<T>;
11
- private _viewEditor;
12
35
  get viewEditor(): EditorDescriptor<T>;
13
- private _addEditor;
14
36
  get addEditor(): EditorDescriptor<T>;
15
- private _editEditor;
16
37
  get editEditor(): EditorDescriptor<T>;
17
- private _tableTitle;
18
- get tableTitle(): string;
38
+ get tableTitle(): string | undefined;
19
39
  get model(): ModelDescriptor<T>;
20
40
  withTableDescriptor(descriptor: TableDescriptor<T>): this;
41
+ withEditorDescriptors(descriptor: EditorDescriptor<T>): this;
21
42
  withViewDescriptor(descriptor: EditorDescriptor<T>): this;
22
43
  withAddDescriptor(descriptor: EditorDescriptor<T>): this;
23
44
  withEditDescriptor(descriptor: EditorDescriptor<T>): this;
@@ -25,6 +46,9 @@ export declare class TableviewDescriptor<T> {
25
46
  withValidator(name: string, expression: FieldValidatorFn): this;
26
47
  addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
27
48
  addColumn(property: string): ColumnDescriptor<string, T>;
49
+ removeColumn(property: string): void;
50
+ getField(property: string, editorType: TableviewTypeEnum): AFieldDescriptor<any, T> | null;
51
+ removeField(property: string): void;
28
52
  addColumnNumber(property: string, displayFormat?: string): ColumnDescriptor<number, T>;
29
53
  addColumnDate(property: string, displayFormat?: string): ColumnDescriptor<Date, T>;
30
54
  addColumnBoolean(property: string, yes?: string, no?: string, asIcon?: boolean): ColumnDescriptor<boolean, T>;
@@ -39,4 +63,54 @@ export declare class TableviewDescriptor<T> {
39
63
  addFieldManyEditor<FT>(property: string, tableviewDescriptor: TableviewDescriptor<FT>): FieldManyEditorDescriptor<FT, T>;
40
64
  addFieldManyToManyEditor<FT>(property: string, mainTableDescriptor: TableDescriptor<FT>, lookupTableDescriptor: TableDescriptor<FT>): FieldManyToManyEditorDescriptor<FT, T>;
41
65
  copy(): TableviewDescriptor<T>;
66
+ /**
67
+ * creates column and field with custom type, for example currency
68
+ * if field exists, it is replaced
69
+ * DO NOT USE WITH TYPES WHERE ARGS ARE REQUIRED - ERROR WILL BE THROWN
70
+ * for enum use withEnumType
71
+ * for custom class use withClassType
72
+ * @param property name of field
73
+ * @param columnType required column type
74
+ * @param fieldType optional, if not provided it is converted from column type
75
+ */
76
+ withModifiedType(property: string, columnType: ColumnTypeEnum, fieldType?: FieldInputTypeEnum): this;
77
+ /**
78
+ * creates column with enum type
79
+ * if fields exists, it is replaced
80
+ * @param property property name
81
+ * @param enumType type of enum
82
+ * @param fieldType type of field, optional, default is Text
83
+ */
84
+ withModifiedEnum(property: string, enumType?: EnumType, fieldType?: FieldInputTypeEnum): this;
85
+ /**
86
+ * generates column with custom class type
87
+ * field is generated only if lookupProvider is provided
88
+ * @param property property name
89
+ * @param modelType class type of object
90
+ * @param titleProperty
91
+ * @param lookupProvider
92
+ * @param itemsLabelProperty
93
+ * @param filterProperty
94
+ */
95
+ withModifiedLookup<MT>(property: string, modelType?: ClassType<MT>, lookupProvider?: ILookupDataProvider<MT, any>, titleProperty?: string, itemsLabelProperty?: string, filterProperty?: string): this;
96
+ }
97
+ export declare class TableviewDynamicDescriptor extends TableviewDescriptor<any> {
98
+ protected _table: TableDynamicDescriptor;
99
+ constructor(idProperty?: string, titleProperty?: string);
100
+ get table(): TableDynamicDescriptor;
101
+ /**
102
+ * sets custom table descriptor
103
+ * @param descriptor
104
+ */
105
+ withTableDescriptor(descriptor: TableDynamicDescriptor): this;
106
+ /**
107
+ * sets visibility hidden state to column with given property
108
+ * equals to be removing in auto and base tableview descriptor
109
+ * * @param property column's property
110
+ */
111
+ removeColumn(property: string): this;
112
+ /**
113
+ * creates depp copy of tableview object and its children
114
+ */
115
+ copy(): TableviewDynamicDescriptor;
42
116
  }
@@ -11,3 +11,11 @@ export declare enum TableSizeEnum {
11
11
  Normal = 1,
12
12
  Large = 2
13
13
  }
14
+ /**
15
+ * EXCLUDE default, all columns has sort and filter on by default, developer EXCLUDES properties from sort/filter
16
+ * INCLUDE_ONLY only selected columns have sort/filter, developers INCLUDES properties
17
+ */
18
+ export declare enum TableDynamicColumnsModeEnum {
19
+ EXCLUDE = 0,
20
+ INCLUDE_ONLY = 1
21
+ }